Changeset 755
- Timestamp:
- 12/09/2012 02:49:53 AM (6 months ago)
- Location:
- trunk/WordPress/plugin/transposh
- Files:
-
- 5 edited
-
js/admin/utils.js (modified) (2 diffs)
-
js/admin/warningclose.js (modified) (1 diff)
-
transposh.php (modified) (1 diff)
-
wp/transposh_admin.php (modified) (12 diffs)
-
wp/transposh_options.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/js/admin/utils.js
r752 r755 9 9 $.ajaxSetup({ 10 10 cache: false 11 }); 12 13 $("#transposh-reset-options").click(function() { 14 if (!confirm("Are you sure you want to do this?")) return false; 15 if (!confirm("Are you REALLY sure you want to do this, your configuration will be reset?")) return false; 16 $.post(ajaxurl, { 17 action: 'tp_reset' 18 }); 11 19 }); 12 20 … … 51 59 return false; 52 60 }; 61 53 62 $("#transposh-clean-auto").click(function() { 54 63 cleanautoclick(0,$(this)); -
trunk/WordPress/plugin/transposh/js/admin/warningclose.js
r752 r755 2 2 $(function() { 3 3 $(".warning-close").click(function() { 4 $(this).parent ().hide();4 $(this).parents('div:first').hide(); 5 5 $.post(ajaxurl, { 6 6 action: 'tp_close_warning', -
trunk/WordPress/plugin/transposh/transposh.php
r754 r755 398 398 // this is an ajax special case, currently crafted and tested on buddy press, lets hope this won't make hell break loose. 399 399 // it basically sets language based on referred when accessing wp-load.php (which is the way bp does ajax) 400 tp_logger(substr($_SERVER['SCRIPT_FILENAME'], -11), 4);400 tp_logger(substr($_SERVER['SCRIPT_FILENAME'], -11), 5); 401 401 if (substr($_SERVER['SCRIPT_FILENAME'], -11) == 'wp-load.php') { 402 402 $this->target_language = transposh_utils::get_language_from_url($_SERVER['HTTP_REFERER'], $this->home_url); -
trunk/WordPress/plugin/transposh/wp/transposh_admin.php
r753 r755 30 30 private $pages = array(); 31 31 private $contains_settings = false; 32 private $page = ''; 32 33 33 34 // constructor of class, PHP4 compatible construction for backward compatibility … … 44 45 // register ajax callbacks 45 46 add_action('wp_ajax_tp_close_warning', array(&$this, 'on_ajax_tp_close_warning')); 47 add_action('wp_ajax_tp_reset', array(&$this, 'on_ajax_tp_reset')); 46 48 add_action('wp_ajax_tp_backup', array(&$this, 'on_ajax_tp_backup')); 47 49 add_action('wp_ajax_tp_restore', array(&$this, 'on_ajax_tp_restore')); … … 63 65 'tp_support' => array(__('Support', TRANSPOSH_TEXT_DOMAIN)), 64 66 ); 67 if (isset($_GET['page']) && isset($this->pages[$_GET['page']])) $this->page = $_GET['page']; 65 68 } 66 69 … … 227 230 */ 228 231 function admin_print_scripts() { 229 switch ($ _GET['page']) {232 switch ($this->page) { 230 233 case 'tp_main': 231 234 wp_enqueue_script('common'); … … 274 277 // retrieve the function output and set it as tab content 275 278 'content' => $this->on_contextual_help())); 276 if ($ _GET['page']== 'tp_main') {279 if ($this->page == 'tp_main') { 277 280 add_screen_option('layout_columns', array('max' => 4, 'default' => 2)); 278 281 add_meta_box('transposh-sidebox-about', __('About this plugin', TRANSPOSH_TEXT_DOMAIN), array(&$this, 'on_sidebox_about_content'), '', 'side', 'core'); … … 287 290 echo '<form action="admin-post.php" method="post">'; 288 291 echo '<input type="hidden" name="action" value="save_transposh"/>'; 289 echo '<input type="hidden" name="page" value="' . $ _GET['page']. '"/>';292 echo '<input type="hidden" name="page" value="' . $this->page . '"/>'; 290 293 echo wp_nonce_field(TR_NONCE); 291 294 screen_icon('transposh-logo'); … … 293 296 echo '<h2 class="nav-tab-wrapper">'; 294 297 foreach ($this->pages as $slug => $titles) { 295 $active = ($slug === $ _GET['page']) ? ' nav-tab-active' : '';298 $active = ($slug === $this->page) ? ' nav-tab-active' : ''; 296 299 echo '<a href="admin.php?page=' . $slug . '" class="nav-tab' . $active . '">'; 297 300 echo esc_html($titles[0]); … … 300 303 echo '</h2>'; 301 304 302 // TODO: look at this... 303 call_user_func(array(&$this, $_GET['page'])); 305 if ($this->page) call_user_func(array(&$this, $this->page)); 304 306 305 307 // Add submission for pages that can be modified … … 573 575 * Insert buttons allowing removal of automated translations from database and maintenence 574 576 */ 577 echo '<div style="margin:10px 0"><a id="transposh-reset-options" href="#" nonce="' . wp_create_nonce('transposh-clean') . '" class="button">' . __('Reset configuration to default (saves keys)', TRANSPOSH_TEXT_DOMAIN) . '</a></div>'; 575 578 echo '<div style="margin:10px 0"><a id="transposh-clean-auto" href="#" nonce="' . wp_create_nonce('transposh-clean') . '" class="button">' . __('Delete all automated translations', TRANSPOSH_TEXT_DOMAIN) . '</a></div>'; 576 579 echo '<div style="margin:10px 0"><a id="transposh-clean-auto14" href="#" nonce="' . wp_create_nonce('transposh-clean') . '" class="button">' . __('Delete automated translations older than 14 days', TRANSPOSH_TEXT_DOMAIN) . '</a></div>'; … … 738 741 } 739 742 740 if ( !(class_exists('Memcache') /* !!&& $this->memcache->connect(TP_MEMCACHED_SRV, TP_MEMCACHED_PORT) */) && !function_exists('apc_fetch') && !function_exists('xcache_get') && !function_exists('eaccelerator_get')) {743 if ($this->page && !(class_exists('Memcache') /* !!&& $this->memcache->connect(TP_MEMCACHED_SRV, TP_MEMCACHED_PORT) */) && !function_exists('apc_fetch') && !function_exists('xcache_get') && !function_exists('eaccelerator_get')) { 741 744 $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) . ' <a href="http://transposh.org/faq#performance">' . __('Check Transposh FAQs', TRANSPOSH_TEXT_DOMAIN) . '</a>', 'updated'); 742 745 } … … 746 749 if (!$this->transposh->options->get_transposh_admin_hide_warning($id)) { 747 750 //$this->add_warning_script(); 748 wp_enqueue_script('transposh_warningclose', $this->transposh->transposh_plugin_url . '/' . TRANSPOSH_DIR_JS . '/ warningclose.js', array('jquery'), TRANSPOSH_PLUGIN_VER, true);751 wp_enqueue_script('transposh_warningclose', $this->transposh->transposh_plugin_url . '/' . TRANSPOSH_DIR_JS . '/admin/warningclose.js', array('jquery'), TRANSPOSH_PLUGIN_VER, true); 749 752 echo '<div class="' . $level . '"><p>⚠ ' . 750 753 $message . … … 770 773 $this->transposh->options->update_options(); 771 774 die(); // this is required to return a proper result 775 } 776 777 function on_ajax_tp_reset() { 778 $this->transposh->options->reset_options(); 779 die(); 772 780 } 773 781 -
trunk/WordPress/plugin/transposh/wp/transposh_options.php
r753 r755 188 188 $value = $_POST[$name]; 189 189 } 190 190 191 191 if (TP_OPT_BOOLEAN == $this->vars[$name]->get_type()) { 192 192 $value = ($value) ? 1 : 0; 193 193 } 194 195 if ($this->vars[$name]->get_value() != $value) {194 195 if ($this->vars[$name]->get_value() !== $value) { 196 196 tp_logger("option '$name' value set: $value"); 197 197 $this->vars[$name]->set_value($value); … … 306 306 307 307 /** 308 * Resets all options except keys 309 */ 310 function reset_options() { 311 $this->options = array(); 312 foreach (array('msn_key', 'google_key', 'oht_id', 'oht_key','transposh_key') as $key) { 313 $this->options[$key] = $this->vars[$key]->get_value(); 314 } 315 update_option(TRANSPOSH_OPTIONS, $this->options); 316 } 317 318 /** 308 319 * Determine if the given language code is the default language 309 320 * @param string $language
Note: See TracChangeset
for help on using the changeset viewer.
