if (@txpinterface == 'admin') {
add_privs('article','1,2,3,4,5,6');
add_privs('hak_tinymce_prefs', '1,2');
add_privs('hak_tinymce_js','1,2,3,4,5,6');
add_privs('hak_tinymce_compressor_js','1,2,3,4,5,6');
add_privs('hak_txpimage','1,2,3,4,5,6');
add_privs('hak_txpcatselect','1,2,3,4,5,6');
add_privs('hak_txpcountselect','1,2,3,4,5,6');
register_callback(array("hak_tinymce","js_prep"), "hak_tinymce_js");
register_callback(array("hak_tinymce","compressor_js_prep"), "hak_tinymce_compressor_js");
register_callback("hak_txpimage", "hak_txpimage");
register_callback("hak_txpcatselect", "hak_txpcatselect");
register_callback("hak_txpcountselect", "hak_txpcountselect");
register_tab('extensions', 'hak_tinymce_prefs', 'hak_tinymce');
register_callback(array('hak_tinymce','prefs'), 'hak_tinymce_prefs');
register_callback(array('hak_tinymce','inject_toggle'), 'article_ui', 'extend_col_1');
register_callback(array("hak_tinymce","inject_js"), "article_ui", "extend_col_1");
register_callback(array('hak_tinymce','override_markup_selects'), 'article_ui', 'markup');
register_callback(array('hak_tinymce','track_markup_selection'), 'article_ui', 'view');
}
class hak_tinymce {
function inject_toggle($event, $step, $default, $context_data='') {
extract(hak_tinymce::getPrefs());
if (!hak_tinymce::show_toggle($context_data)) {
return;
}
$msg = '';
if ($enable_body || $enable_excerpt) {
$msg = '
'.
'';
}
return $msg;
}
function inject_js($event, $step, $default, $context_data='') {
global $prefs;
if (hak_tinymce::check_install()) {
$hak_tinymce = hak_tinymce::getPrefs();
extract($prefs);
extract($context_data);
if ($step == 'create') {
$textile_body = $use_textile;
$textile_excerpt = $use_textile;
}
$hak_tinymce["script_path"] = ($hak_tinymce["use_compressor"]) ? hak_compressor_path($hak_tinymce["tinymce_path"]) : $hak_tinymce["tinymce_path"];
$msg = "";
if ($hak_tinymce["use_compressor"]) {
$msg .= "";
}
$msg .= "";
if ($hak_tinymce["enable_excerpt"] || $hak_tinymce["enable_body"]) {
return $msg;
}
}
}
function override_markup_selects($event, $step, $default, $context_data='') {
extract(hak_tinymce::getPrefs());
$empty = ' ';
if ($hide_textile_select) {
return tag($default, 'div', ' style="display:none"');
}
return $default;
}
function track_markup_selection($event, $step, $default, $context_data) {
$toggles = gps("hak_tinymceToggle");
if (hak_tinymce::is_edit_screen() || empty($toggles)) {
return $default;
}
foreach ($toggles as $toggle) {
$default .= hInput("hak_tinymceToggle[]", $toggle);
}
return $default;
}
function js_prep() {
header('Content-type: application/x-javascript');
echo hak_tinymce::js();
exit(0);
}
function compressor_js_prep() {
header('Content-type: application/x-javascript');
echo hak_tinymce::compressor_js();
exit(0);
}
function prefs($event, $step) {
pagetop('hak_tinymce '.gTxt('preferences'), ($step == 'update' ? gTxt('preferences_saved') : ''));
if ($step == 'install') {
// Install the preferences table.
hak_tinymce::install();
}
if ($step == 'uninstall') {
//remove table
safe_query("DROP TABLE ".PFX."txp_hak_tinymce");
}
if ($step == 'update') {
extract(doSlash(gpsa(array(
'hak_show_toggle',
'hak_hide_on_textile_edit',
'hak_tinymce_path',
'hak_tinymce_body_init',
'hak_tinymce_excerpt_init',
'hak_tinymce_callbacks',
'hak_hide_textile_select',
'hak_enable_body',
'hak_enable_excerpt',
'hak_use_compressor',
'hak_tinymce_compressor_init'
))));
safe_update('txp_hak_tinymce', "pref_value = '$hak_show_toggle'", "pref_name = 'show_toggle'");
safe_update('txp_hak_tinymce', "pref_value = '$hak_hide_on_textile_edit'", "pref_name = 'hide_on_textile_edit'");
safe_update('txp_hak_tinymce', "pref_value = '$hak_tinymce_path'", "pref_name = 'tinymce_path'");
safe_update('txp_hak_tinymce', "pref_value = '$hak_tinymce_body_init'", "pref_name = 'body_init'");
safe_update('txp_hak_tinymce', "pref_value = '$hak_tinymce_excerpt_init'", "pref_name = 'excerpt_init'");
safe_update('txp_hak_tinymce', "pref_value = '$hak_tinymce_callbacks'", "pref_name = 'callbacks'");
safe_update('txp_hak_tinymce', "pref_value = '$hak_hide_textile_select'", "pref_name = 'hide_textile_select'");
safe_update('txp_hak_tinymce', "pref_value = '$hak_enable_body'", "pref_name = 'enable_body'");
safe_update('txp_hak_tinymce', "pref_value = '$hak_enable_excerpt'", "pref_name = 'enable_excerpt'");
safe_update('txp_hak_tinymce', "pref_value = '$hak_use_compressor'", "pref_name = 'use_compressor'");
safe_update('txp_hak_tinymce', "pref_value = '$hak_tinymce_compressor_init'", "pref_name = 'compressor_init'");
}
if (hak_tinymce::check_install()) {
extract(hak_tinymce::getPrefs());
echo n.t.''.
n.t.t.hed('hak_tinymce '.gTxt('Preferences'), '1').
n.n.form(
n.eInput('hak_tinymce_prefs').
n.sInput('update').
n.fInput('submit', 'update', 'Update', 'smallerbox').
n.graf(hak_tinymce::mce_gTxt('hak_show_toggle').br.
n.yesnoRadio('hak_show_toggle',$show_toggle).br.
n.tag(tag(hak_tinymce::mce_gTxt('auto_disable'),"em"),"small")
).
n.graf(hak_tinymce::mce_gTxt('hak_hide_on_textile_edit').br.
n.yesnoRadio('hak_hide_on_textile_edit',$hide_on_textile_edit)
).
n.graf(hak_tinymce::mce_gTxt('hak_hide_textile_select').br.
n.yesnoRadio('hak_hide_textile_select',$hide_textile_select)
).
n.graf(hak_tinymce::mce_gTxt('hak_tinymce_path').br.
n.finput('text','hak_tinymce_path',$tinymce_path,'','','',60,'','hak_tinymce_path').
hak_tinymce::file_exists($tinymce_path)
).
n.graf(hak_tinymce::mce_gTxt('enable_body').br.
n.yesnoRadio('hak_enable_body',$enable_body)
).
n.graf(hak_tinymce::mce_gTxt('hak_tinymce_body_init').br.
tag(tag("(".hak_tinymce::mce_gTxt('line_end').")","em"),"small").n.href(hak_tinymce::mce_gTxt('documentation'),"http://tinymce.moxiecode.com/documentation.php").br.
n.text_area('hak_tinymce_body_init',200, 400, $body_init)
).
n.graf(hak_tinymce::mce_gTxt('enable_excerpt').br.
n.yesnoRadio('hak_enable_excerpt',$enable_excerpt)
).
n.graf(hak_tinymce::mce_gTxt('hak_tinymce_excerpt_init').br.
tag(tag("(".hak_tinymce::mce_gTxt('line_end').")","em"),"small").n.href(hak_tinymce::mce_gTxt('documentation'),"http://tinymce.moxiecode.com/documentation.php").br.
n.text_area('hak_tinymce_excerpt_init',200,400,$excerpt_init)
).
n.graf(hak_tinymce::mce_gTxt('hak_tinymce_callbacks').br.
n.text_area('hak_tinymce_callbacks',200,400,$callbacks)
).
n.graf(hak_tinymce::mce_gTxt('use_compressor').br.
n.yesnoRadio('hak_use_compressor',$use_compressor).
hak_tinymce::file_exists(hak_compressor_path($tinymce_path), "compressor_not_found")
).
n.graf(hak_tinymce::mce_gTxt('hak_tinymce_compressor_init').br.
tag(tag("(".hak_tinymce::mce_gTxt('compressor_line_end').")","em"),"small").
n.href(hak_tinymce::mce_gTxt('documentation'),"http://wiki.moxiecode.com/index.php/TinyMCE:Compressor/PHP").br.
n.text_area('hak_tinymce_compressor_init',200,400,$compressor_init)
).
n.n.fInput('submit', 'update', 'Update', 'smallerbox')
).
'
';
echo n.t.''.
n.hed(hak_tinymce::mce_gTxt('uninstall'), '1').
n.t.t.graf(hak_tinymce::mce_gTxt('uninstall_message')).
n.n.form(
n.eInput('hak_tinymce_prefs').
n.sInput('uninstall').
n.n.fInput('submit', 'uninstall', 'Uninstall ', 'smallerbox'),"","confirm('".hak_tinymce::mce_gTxt('uninstall_confirm')."')"
).
'
';
} else {
echo n.t.''.
n.t.t.hed('hak_tinymce '.gTxt('Preferences'), '1').
n.graf(hak_tinymce::mce_gTxt('install_message')).
n.n.form(
n.eInput('hak_tinymce_prefs').
n.sInput('install').
n.n.fInput('submit', 'install', 'Install ', 'smallerbox')
).
'
';
}
}
// functions
function compressor_js() {
extract(hak_tinymce::getPrefs());
$js = "tinyMCE_GZ.init({ \n";
$js.= rtrim($compressor_init, ",");
$js .="});";
return $js;
}
function js() {
extract(hak_tinymce::getPrefs());
$hu = hu;
$js = << 'Show editor toggle:',
'hak_hide_on_textile_edit' => 'Hide editor toggle when editing articles created with textile or convert linebreaks: ',
'hak_tinymce_body_init' => 'Initialization for article body editor:',
'hak_tinymce_excerpt_init' => 'Initialization for article excerpt editor:',
'hak_tinymce_callbacks' => 'Callback functions:',
'hak_tinymce_compressor_init' => 'Initialization for Gzip compressor editor:',
'hak_tinymce_path' => 'Path to tiny_mce script (relative to your textpattern directory or document root):',
'file_not_found' => 'File not found in specified location.',
'compressor_not_found' => 'Compressor files not found with TinyMCE files.',
'line_end' => 'All lines should end with commas.',
'compressor_line_end' => 'The last line should not end with a comma.',
'install_message' => 'hak_tinymce is not yet properly initialized. Use the button below to create the preferences table.',
'hak_toggle_editor' => 'Toggle Editor',
'uninstall' => 'Uninstall',
'uninstall_message' => 'Using the button below will remove the hak_tinymce preferences table. You will still have to remove the actual TinyMCE installation.',
'uninstall_confirm' => 'Are you sure you want to delete the preferences table?',
'insert_thumb' => 'Insert Thumbnail',
'insert_image' => 'Insert Full Size Image',
'hak_hide_textile_select' => 'Hide "Use textile" Dropdowns:',
'enable_body' => 'Enable editor for article body:',
'enable_excerpt' => 'Enable editor for article excerpt:',
'auto_disable' => 'The toggle is automatically hidden if you disable the editor for the article body and the article excerpt below.',
'documentation' => '[Documentation]',
'use_compressor' => 'Use the Gzip compressor:'
);
$lang = array(
'en-us' => $en_us
);
$language = (isset($lang[$language])) ? $language : 'en-us';
$msg = (isset($lang[$language][$what])) ? $lang[$language][$what] : $what;
return $msg;
}
function check_install() {
// Check if the hak_tinymce table already exists
if (getThings("Show tables like '".PFX."txp_hak_tinymce'")) {
// if it does check if we need to upgrade
$pluginversion = safe_field('version','txp_plugin',"name = 'hak_tinymce'");
$prefs = hak_tinymce::getPrefs();
$version = (array_key_exists('version', $prefs)) ? $prefs['version'] : "0.0" ;
if (!empty($version) && $version != $pluginversion) { // if the versions don't match send off to upgrade.
hak_tinymce::upgrade($version);
}
return true;
}
return false;
}
function install() {
//figure out what MySQL version we are using (from _update.php)
$mysqlversion = mysql_get_server_info();
$tabletype = ( intval($mysqlversion[0]) >= 5 || preg_match('#^4\.(0\.[2-9]|(1[89]))|(1\.[2-9])#',$mysqlversion))
? " ENGINE=MyISAM "
: " TYPE=MyISAM ";
if ( isset($txpcfg['dbcharset']) && (intval($mysqlversion[0]) >= 5 || preg_match('#^4\.[1-9]#',$mysqlversion)))
{
$tabletype .= " CHARACTER SET = ". $txpcfg['dbcharset'] ." ";
}
// Create the hak_tinymce table
$hak_tinymce_prefs_table = safe_query("CREATE TABLE `".PFX."txp_hak_tinymce` (
`pref_name` VARCHAR(255) NOT NULL,
`pref_value` TEXT NOT NULL,
PRIMARY KEY (`pref_name`)
) $tabletype");
// if the table creation succeeds populate with values
if ($hak_tinymce_prefs_table) {
extract(get_prefs());
$hak_mceSettings_default = '';
$hak_mceSettings_default .= "theme : \"advanced\",\n";
$hak_mceSettings_default .= "language : \"en\",\n";
$hak_mceSettings_default .= "relative_urls : false,\n";
$hak_mceSettings_default .= "remove_script_host : false,\n";
$hak_mceSettings_default .= "plugins : \"searchreplace,txpimage\",\n";
$hak_mceSettings_default .= "theme_advanced_buttons1 : \"bold,italic,underline,strikethrough,forecolor,backcolor,removeformat,numlist,bullist,outdent,indent,justifyleft,justifycenter,justifyright,justifyfull\",\n";
$hak_mceSettings_default .= "theme_advanced_buttons2 : \"link,unlink,separator,image,separator,search,replace,separator,cut,copy,paste,separator,code,separator,formatselect\",\n";
$hak_mceSettings_default .= "theme_advanced_buttons3 : \"\",\n";
$hak_mceSettings_default .= "theme_advanced_toolbar_location : \"top\",\n";
$hak_mceSettings_default .= "theme_advanced_toolbar_align : \"left\",";
$hak_mceSettings_default .= "entity_encoding : \"numeric\",";
$hak_mceSettings_compressor = "theme : \"advanced\",\n";
$hak_mceSettings_compressor .= "plugins : \"searchreplace,txpimage\",\n";
$hak_mceSettings_compressor .= "disk_cache : true,\n";
$hak_mceSettings_compressor .= "languages : \"en\",\n";
$hak_mceSettings_compressor .= "debug : false";
// set pref array values properly checking if it had been setup before.
$hak_tinymce_prefs["show_toggle"] = (isset($hak_tinymce_show_toggle)) ? $hak_tinymce_show_toggle : "1";
$hak_tinymce_prefs["hide_on_textile_edit"] = (isset($hak_tinymce_hide_on_textile_edit)) ? $hak_tinymce_hide_on_textile_edit : "1";
$hak_tinymce_prefs["body_init"] = (isset($hak_tinymce_init_form) && $hak_tinymce_init_form != "hak_tinymce_default") ? fetch_form($hak_tinymce_init_form) : $hak_mceSettings_default;
$hak_tinymce_prefs["body_init"] .= "\nheight:\"420\",";
$hak_tinymce_prefs["excerpt_init"] = $hak_mceSettings_default."\nheight:\"150\",";
$hak_tinymce_prefs["callbacks"] = '';
$hak_tinymce_prefs["tinymce_path"] = 'tiny_mce/tiny_mce.js';
$hak_tinymce_prefs["hide_textile_select"] = '0';
$hak_tinymce_prefs["enable_body"] = '1';
$hak_tinymce_prefs["enable_excerpt"] = '1';
// insert them into the new table
foreach ($hak_tinymce_prefs as $key => $value) {
safe_insert("txp_hak_tinymce","pref_name='".$key."', pref_value='".$value."'");
}
// Run any necessary upgrades
hak_tinymce::upgrade('0.0');
// delete old prefs
safe_delete("txp_prefs","name='hak_tinymce_init_form'");
safe_delete("txp_prefs","name='hak_tinymce_show_toggle'");
safe_delete("txp_prefs","name='hak_tinymce_hide_on_textile_edit'");
}
return true;
}
function upgrade($installedversion) {
if ($installedversion < '0.7') {
$hak_mceSettings_compressor = "theme : \"simple,advanced\",\n";
$hak_mceSettings_compressor .= "plugins : \"searchreplace,-txpimage\",\n";
$hak_mceSettings_compressor .= "disk_cache : true,\n";
$hak_mceSettings_compressor .= "languages : \"en\",\n";
$hak_mceSettings_compressor .= "debug : false";
$hak_tinymce_prefs["use_compressor"] = '0';
$hak_tinymce_prefs["compressor_init"] = $hak_mceSettings_compressor;
hak_tinymce::update_version("0.7");
foreach ($hak_tinymce_prefs as $key => $value) {
if (!safe_field("pref_name", 'txp_hak_tinymce', "pref_name = '".$key."'")) {
safe_insert("txp_hak_tinymce","pref_name='".$key."', pref_value='".$value."'");
} else {
safe_update('txp_hak_tinymce', "pref_value = '".$value."'", "pref_name = '".$key."'");
}
}
} // -- End 0.7 upgrade
// Generic version updater
hak_tinymce::update_version("0.9.9");
}
function update_version($version) {
safe_upsert('txp_hak_tinymce', "pref_value = '".$version."'", "pref_name = 'version'");
}
function file_exists($file, $message = "file_not_found") {
global $path_to_site;
$out = '';
if (!file_exists($file) && !file_exists($path_to_site.$file)) {
$out = br.n.tag(hak_tinymce::mce_gTxt($message),"span",' style="color:red"');
}
return $out;
}
function map_attribs($arr) {
$format = '{src:"'.$arr["path"].'"';
$format .= (!empty($arr["width"])) ? ',width:'.$arr["width"] : '';
$format .= (!empty($arr["height"])) ? ',height:'.$arr["height"] : '';
$format .= (!empty($arr["alt"])) ? ',alt:"'.$arr["alt"].'"' : '';
$format .= (!empty($arr["title"])) ? ',title:"'.$arr["title"].'"' : '';
$format .= '}';
return $format;
}
} //--- End Class
//----------------------------------------
//----------------------------------------
function hak_compressor_path($file) {
$path = str_replace('tiny_mce.js','tiny_mce_gzip.js',$file);
return $path;
}
//--- Functions for the image browser ----
function hak_txpimage() {
global $img_dir,$path_to_site,$txpcfg;
$category = gps("c");
$category = (!empty($category)) ? "AND category='".$category."'" : "" ;
$limit_image = gps("limimg");
$limit_img_count = gps("limcount");
if ( (empty($limit_img_count)) || (!intval($limit_img_count)) ){
$limit_img_count = 0;
}
else { $limit_img_count = intval($limit_img_count) - 1; }
if (empty($limit_image)) { $limit_image = " LIMIT 10"; }
else {
if ($limit_image == "All") { $limit_image = ""; }
elseif (!intval($limit_image)) { $limit_image = " LIMIT 10"; }
else { $limit_image = " LIMIT ".$limit_img_count*$limit_image.",".$limit_image; };
}
$rs = safe_rows_start("*", "txp_image","1=1 ".$category." ORDER BY id DESC,category,name".$limit_image);
$src = gps("src");
if ($rs) {
$out = array();
while ($a = nextRow($rs)) {
extract($a);
$thumbclick ='';
$image["path"] = hu.$img_dir.'/'.$id.$ext;
$image["width"] = $w;
$image["height"] = $h;
$image["alt"] = (empty($alt)) ? "" : rawurlencode($alt);
$image["caption"] = (empty($caption)) ? "" : rawurlencode($caption);
$onclick = 'onclick=\'TxpImageDialog.insertImage(this,'.hak_tinymce::map_attribs($image).');return'.n.'false;\'';
$preview = $image;
$thumb = $image;
if($thumbnail) {
$thumb["path"] = hu.$img_dir.'/'.$id.'t'.$ext;
$thumb["width"] = $thumb_w;
$thumb["height"] = $thumb_h;
$thumb["alt"] = $image["alt"];
$thumb["caption"] = $image["caption"];
$preview = $thumb;
$thumbclick = 'onclick=\'TxpImageDialog.insertImage(this,'.hak_tinymce::map_attribs($thumb).');return'.n.'false;\'';
$thumbclick = '';
}
//$desiredheight = $preview["height"];
if ($preview["width"] > $preview["height"]) {
$new["width"] = 100;
if (!empty($preview["width"])) {
$new["height"] = (100 / $preview["width"]) * $preview["height"];
} else {
$new["height"] = "";
}
$margin = (100 - $new["height"]) / 2;
$margin = intval($margin)."px 0";
} else {
$new["height"] = 100;
if (!empty($preview["height"])) {
$new["width"] = (100 / $preview["height"] ) * $preview["width"];
} else {
$new["width"] = "";
}
$margin = (100 - $new["width"]) / 2;
$margin = "0 ".intval($margin)."px";
}
$selected = ($src == $image["path"] || $src == $thumb["path"]) ? "active" : "";
$out[] = ''.
'
'.
$thumbclick.
'
';
}
echo implode($out,"\n");
exit(0);
}
}
function hak_txpcatselect() {
$rs = getTree("root",'image');
if ($rs) {
echo tag(gTxt('category'),"legend").
treeSelectInput("category",$rs,"","txpCategory");
//Limit
echo "";
echo "Lim-img:";
echo "";
echo "<";
echo "8";
echo "
";
}
exit(0);
}
function hak_txpcountselect() {
function count_to_width($n, $widthc){
$result = 0;
if ($n > 99999) {$n = 99999;}
$w = $n * 4;
if ($n < 10) { $result = $n * $widthc; }
elseif ($n < 100) { $result = ($n - 9) * 2 * $widthc + (9 * $widthc); }
elseif ($n < 1000) { $result = ($n - 99) * 3 * $widthc + (180 * $widthc) + (9 * $widthc); }
elseif ($n < 10000) { $result = ($n - 999) * 4 * $widthc + (2700 * $widthc) + (180 * $widthc) + (9 * $widthc); }
else { $result = ($n - 9999) * 5 * $widthc + (36000 * $widthc) + (2700 * $widthc) + (180 * $widthc) + (9 * $widthc); }
return $result + $w;
}
function width_to_count($wl, $wh, $w, $l, $n, $widthc){
$result = array($l, $l);
$check1 = 0; $check2 = 0;
while ( $w > 0 ) {
if ($result[0] < $n) {$tl = count_to_width($result[0] + 1, $widthc) - count_to_width($result[0], $widthc);}
else {$tl = count_to_width($n, $widthc) - count_to_width($n-1, $widthc);}
if (($result[0] > 1) AND ($wl > 0) AND ($w > $tl)) {
$result[0]--;
$tmpl = count_to_width($result[0] + 1, $widthc) - count_to_width($result[0], $widthc);
$w = $w - $tmpl;
$wl = $wl - $tmpl;
}
else {
if ( $check1 == 0 ){ $w = $w - $widthc - 4; }
$check1 = 1;
}
if ($result[1] > 1) {$th = count_to_width($result[1], $widthc) - count_to_width($result[1] - 1, $widthc);}
else {$th = $widthc + 4;}
if (($result[1] < $n) AND ($wh > 0) AND ($w > $th)) {
$result[1]++;
$tmph = count_to_width($result[1], $widthc) - count_to_width($result[1] - 1, $widthc);
$w = $w - $tmph;
$wh = $wh - $tmph;
}
else {
if ($check2 = 0) {
$tmph = count_to_width($result[1], $widthc) - count_to_width($result[1] - 1, $widthc);
$w = $w - $tmph;
}
$check2 = 1;
}
if (($check1 == 1) AND ($check2 == 1)) {break;}
}
return $result;
}
global $img_dir,$path_to_site,$txpcfg;
$category = gps("c");
$category = (!empty($category)) ? "AND category='".$category."'" : "" ;
$limit_image = gps("limimg");
if ((empty($limit_image)) || ($limit_image == "All") || (!intval($limit_image))){ $limit_image = 1; }
$limit_img_count = gps("limcount");
if ((empty($limit_img_count)) || (!intval($limit_img_count)) ) { $limit_img_count = 1; }
$count_width = gps("width");
if ((empty($count_width)) || (!intval($count_width)) ) { $count_width = 0; }
$last_width = gps("wl");
if ((empty($last_width)) || (!intval($last_width))) {$last_width = 12;}
$char_width = gps("wc");
if ((empty($char_width)) || (!intval($char_width))) { $char_width = 12; }
$rcount = safe_count("txp_image", "1=1 ".$category);
echo "\n";
$yw = 0;
$x = ceil($rcount/$limit_image);
$yw = ($last_width * 4 + 16) + count_to_width($x, $char_width);
echo "";
exit(0);
}