Changeset 649
- Timestamp:
- 07/31/2011 04:06:43 AM (10 months ago)
- Location:
- trunk/WordPress/plugin/transposh
- Files:
-
- 3 edited
-
js/transposhcontrol.js (modified) (1 diff)
-
wp/transposh_admin.php (modified) (11 diffs)
-
wp/transposh_options.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/js/transposhcontrol.js
r587 r649 246 246 247 247 jQuery("#transposh-translate").click(do_translate_all); 248 249 jQuery(".warning-close").click(function() { 250 //alert(this); 251 jQuery(this).parent().hide(); 252 //alert(); 253 jQuery.post(ajaxurl, { 254 action: 'closed_tpwarn', 255 id: jQuery(this).parent().attr('id') 256 }); 257 }) 248 258 249 259 }); -
trunk/WordPress/plugin/transposh/wp/transposh_admin.php
r639 r649 26 26 /** @var transposh_plugin $transposh father class */ 27 27 private $transposh; 28 private $localeright = 'right'; 29 private $localeleft = 'left'; 28 30 29 31 // constructor of class, PHP4 compatible construction for backward compatibility … … 38 40 // register the callback been used if options of page been submitted and needs to be processed 39 41 add_action('admin_post_save_transposh', array(&$this, 'on_save_changes')); 42 // register a callback to allow admin removal of warnings 43 add_action('wp_ajax_closed_tpwarn', array(&$this, 'on_closed_tpwarn')); 40 44 } 41 45 … … 188 192 wp_enqueue_script('jqueryui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js', array('jquery'), '1.8.2', true); 189 193 190 191 194 //add several metaboxes now, all metaboxes registered during load page can be switched off/on at "Screen Options" automatically, nothing special to do therefore 192 195 add_meta_box('transposh-sidebox-about', __('About this plugin', TRANSPOSH_TEXT_DOMAIN), array(&$this, 'on_sidebox_about_content'), $this->pagehook, 'side', 'core'); … … 204 207 //executed to show the plugins complete admin page 205 208 function on_show_page() { 209 global $wp_locale; 210 if ($wp_locale->text_direction == 'rtl') { 211 $this->localeleft = 'right'; 212 $this->localeright = 'left'; 213 } 214 206 215 //we need the global screen column value to beable to have a sidebar in WordPress 2.8 207 216 //global $screen_layout_columns; … … 214 223 echo '<div id="transposh-general" class="wrap">'; 215 224 screen_icon('options-general'); 216 217 225 echo '<h2>' . __('Transposh', TRANSPOSH_TEXT_DOMAIN) . '</h2>' . 218 226 '<form action="admin-post.php" method="post">'; 227 228 // add some user warnings that leads to some FAQs 229 if ((int) ini_get('memory_limit') < 64) { 230 $this->add_warning('tp_mem_warning', sprintf(__('Your current PHP memory limit of %s is quite low, if you experience blank pages please consider increasing it.', TRANSPOSH_TEXT_DOMAIN), ini_get('memory_limit'))); 231 } 232 233 if (!function_exists('apc_fetch') && !function_exists('xcache_get') && !function_exists('eaccelerator_get')) { 234 $this->add_warning('tp_cache_warning', __('We were not able to find a supported in-memory caching engine, installing one can improve performance.', TRANSPOSH_TEXT_DOMAIN)); 235 } 219 236 220 237 wp_nonce_field(TR_NONCE); … … 276 293 277 294 function on_sidebox_about_content($data) { 278 global $wp_locale; 279 echo '<ul style="list-style-type:disc;margin-' . ($wp_locale->text_direction == 'rtl' ? 'right' : 'left') . ':20px;">'; 295 echo '<ul style="list-style-type:disc;margin-' . $this->localeleft . ':20px;">'; 280 296 echo '<li><a href="http://transposh.org/">' . __('Plugin Homepage', TRANSPOSH_TEXT_DOMAIN) . '</a></li>'; 281 297 echo '<li><a href="http://transposh.org/redir/newfeature">' . __('Suggest a Feature', TRANSPOSH_TEXT_DOMAIN) . '</a></li>'; … … 313 329 function on_contentbox_languages_content($data) { 314 330 // we need some styles 315 global $wp_locale;316 317 331 echo '<style type="text/css"> 318 332 #sortable { list-style-type: none; margin: 0; padding: 0; } 319 #sortable li, #default_lang li { margin: 3px 3px 3px 0; padding: 5px; float: ' . ($wp_locale->text_direction == 'rtl' ? 'right' : 'left'). '; width: 190px; height: 14px;}333 #sortable li, #default_lang li { margin: 3px 3px 3px 0; padding: 5px; float: ' . $this->localeleft . '; width: 190px; height: 14px;} 320 334 .languages { 321 335 -moz-border-radius: 6px; … … 352 366 } 353 367 .logoicon { 354 float:' . ($wp_locale->text_direction == 'rtl' ? 'left' : 'right'). ';368 float:' . $this->localeright . '; 355 369 margin-left:2px; 356 370 margin-top:-1px; … … 372 386 list ($langname, $langorigname, $flag) = explode(",", $langrecord); 373 387 echo '<li id="' . $langcode . '" class="languages ' . ($this->transposh->options->is_viewable_language($langcode) || $this->transposh->options->is_default_language($langcode) ? "active" : "") 374 . (!$this->transposh->options->is_viewable_language($langcode) && $this->transposh->options->is_editable_language($langcode) ? "translateable" : "") . '"><div style="float:' . ($wp_locale->text_direction == 'rtl' ? 'right' : 'left'). '">'388 . (!$this->transposh->options->is_viewable_language($langcode) && $this->transposh->options->is_editable_language($langcode) ? "translateable" : "") . '"><div style="float:' . $this->localeleft . '">' 375 389 . transposh_utils::display_flag("{$this->transposh->transposh_plugin_url}/img/flags", $flag, false /* $langorigname,$this->transposh->options->get_widget_css_flags() */) 376 390 . '<input type="hidden" name="languages[]" value="' . $langcode . ($this->transposh->options->is_viewable_language($langcode) ? ",v" : ",") . ($this->transposh->options->is_viewable_language($langcode) ? ",t" : ",") . '" />' … … 388 402 echo "</ul></div>"; 389 403 // options to play with 390 echo '<div style="clear: both;">' . __('Display options:', TRANSPOSH_TEXT_DOMAIN) . '<br/><ul style="list-style-type: disc; margin-' . ($wp_locale->text_direction == 'rtl' ? 'right' : 'left'). ':20px;font-size:11px">';404 echo '<div style="clear: both;">' . __('Display options:', TRANSPOSH_TEXT_DOMAIN) . '<br/><ul style="list-style-type: disc; margin-' . $this->localeleft . ':20px;font-size:11px">'; 391 405 echo '<li><a href="#" id="changename">' . __('Toggle names of languages between English and Original', TRANSPOSH_TEXT_DOMAIN) . '</a></li>'; 392 406 echo '<li><a href="#" id="selectall">' . __('Make all languages active', TRANSPOSH_TEXT_DOMAIN) . '</a></li>'; … … 547 561 } 548 562 563 function add_warning($id, $message) { 564 if (!$this->transposh->options->get_transposh_admin_hide_warning($id)) { 565 echo '<div id="' . $id . '" class="error">' . 566 '<span class="ui-icon ui-icon-alert" style="float: ' . $this->localeleft . '; margin-' . $this->localeright . ': .3em;"></span>' . 567 $message . 568 '<span class="warning-close ui-icon ui-icon-closethick" style="float:' . $this->localeright . '; margin-' . $this->localeleft . ': .3em;"></span>' . 569 '</div>'; 570 } 571 } 572 573 function on_closed_tpwarn() { 574 $this->transposh->options->set_transposh_admin_hide_warning($_POST['id']); 575 $this->transposh->options->update_options(); 576 die(); // this is required to return a proper result 577 } 578 549 579 } 550 580 -
trunk/WordPress/plugin/transposh/wp/transposh_options.php
r639 r649 73 73 //Stores the site key to transposh services (backup @since 0.5.0) 74 74 define('TRANSPOSH_BACKUP_SCHEDULE', 'transposh_backup_schedule'); 75 //Stores hidden warnings (@since 0.7.6) 76 define('TRANSPOSH_ADMIN_HIDE_WARNINGS', 'transposh_admin_hide_warnings'); 75 77 76 78 class transposh_plugin_options { … … 114 116 $this->set_default_option_value(TRANSPOSH_KEY); 115 117 $this->set_default_option_value(TRANSPOSH_BACKUP_SCHEDULE); 118 $this->set_default_option_value(TRANSPOSH_ADMIN_HIDE_WARNINGS); 116 119 $this->migrate_old_config(); 117 120 logger($this->options, 4); … … 267 270 } 268 271 272 function get_transposh_admin_hide_warning($id) { 273 return strpos($this->options[TRANSPOSH_ADMIN_HIDE_WARNINGS], $id . ',') !== false; 274 } 275 269 276 /** 270 277 * Sets a value at the options array … … 315 322 } 316 323 317 /**324 /** 318 325 * Set the widget theme 319 326 * @since 0.7.0 … … 401 408 $val = ($val) ? 1 : 0; 402 409 $this->set_value($val, $this->options[TRANSPOSH_DEFAULT_LOCALE_OVERRIDE]); 410 } 411 412 function set_transposh_admin_hide_warning($id) { 413 if (!$this->get_transposh_admin_hide_warning($id)) { 414 $this->set_value($this->options[TRANSPOSH_ADMIN_HIDE_WARNINGS] . $id . ',', $this->options[TRANSPOSH_ADMIN_HIDE_WARNINGS]); 415 } 403 416 } 404 417
Note: See TracChangeset
for help on using the changeset viewer.
