function load()
 {
     global $sitepress, $wpdb;
     if (!$sitepress) {
         return;
     } elseif (!$sitepress->get_setting('setup_complete')) {
         add_action('admin_notices', array($this, '_wpml_not_installed_warning'));
         return;
     }
     $upgrade = new WPML_ST_Upgrade($wpdb, $sitepress);
     $upgrade->run();
     $this->init_active_languages();
     require WPML_ST_PATH . '/inc/admin-texts/wpml-admin-texts.class.php';
     require WPML_ST_PATH . '/inc/widget-text.php';
     require WPML_ST_PATH . '/inc/wpml-localization.class.php';
     require WPML_ST_PATH . '/inc/gettext/wpml-string-translation-mo-import.class.php';
     require WPML_ST_PATH . '/inc/wpml-string-shortcode.php';
     include WPML_ST_PATH . '/inc/slug-translation.php';
     wpml_st_load_admin_texts();
     add_action('init', array($this, 'init'));
     wpml_st_load_slug_translation();
     add_filter('pre_update_option_blogname', array($this, 'pre_update_option_blogname'), 5, 2);
     add_filter('pre_update_option_blogdescription', array($this, 'pre_update_option_blogdescription'), 5, 2);
     //Handle Admin Notices
     add_action('icl_ajx_custom_call', array($this, 'ajax_calls'), 10, 2);
     add_action('init', array($this, 'set_auto_register_status'));
     /**
      * @deprecated 3.3 - Each string has its own language now.
      */
     add_filter('WPML_ST_strings_language', array($this, 'get_strings_language'));
     add_filter('wpml_st_strings_language', array($this, 'get_strings_language'));
     add_action('wpml_st_delete_all_string_data', array($this, 'delete_all_string_data'), 10, 1);
     add_action('wpml_scan_theme_for_strings', array($this, 'scan_theme_for_strings'), 10, 1);
     add_filter('wpml_st_string_status', array($this, 'get_string_status_filter'), 10, 2);
     add_filter('wpml_string_id', array($this, 'get_string_id_filter'), 10, 2);
     add_filter('wpml_get_string_language', array($this, 'get_string_language_filter'), 10, 3);
     do_action('wpml_st_loaded');
 }
 function load()
 {
     global $sitepress;
     if (!$sitepress) {
         return;
     } elseif (!$sitepress->get_setting('setup_complete')) {
         add_action('admin_notices', array($this, '_wpml_not_installed_warning'));
         return;
     }
     $this->init_active_languages();
     require WPML_ST_PATH . '/inc/admin-texts/wpml-admin-texts.class.php';
     require WPML_ST_PATH . '/inc/widget-text.php';
     require WPML_ST_PATH . '/inc/wpml-localization.class.php';
     require WPML_ST_PATH . '/inc/gettext/wpml-string-translation-mo-import.class.php';
     require WPML_ST_PATH . '/inc/wpml-string-shortcode.php';
     include WPML_ST_PATH . '/inc/slug-translation.php';
     wpml_st_load_admin_texts();
     add_action('init', array($this, 'init'));
     wpml_st_load_slug_translation();
     add_filter('pre_update_option_blogname', array($this, 'pre_update_option_blogname'), 5, 2);
     add_filter('pre_update_option_blogdescription', array($this, 'pre_update_option_blogdescription'), 5, 2);
     //Handle Admin Notices
     if (isset($GLOBALS['pagenow']) && !in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) {
         add_action('init', array('WPML_String_Translation', '_st_warnings'));
     }
     add_action('icl_ajx_custom_call', array($this, 'ajax_calls'), 10, 2);
     add_action('init', array($this, 'set_auto_register_status'));
     add_filter('WPML_ST_strings_language', array($this, 'get_strings_language'));
     add_filter('WPML_ST_strings_context_language', array($this, 'get_default_context_language'), 10, 2);
     add_filter('wpml_st_strings_language', array($this, 'get_strings_language'));
     add_filter('wpml_st_strings_context_language', array($this, 'get_default_context_language'), 10, 2);
     add_action('wpml_st_delete_all_string_data', array($this, 'delete_all_string_data'), 10, 1);
     add_action('wpml_scan_theme_for_strings', array($this, 'scan_theme_for_strings'), 10, 1);
     add_filter('wpml_st_string_status', array($this, 'get_string_status_filter'), 10, 2);
     add_filter('wpml_string_id', array($this, 'get_string_id_filter'), 10, 2);
     do_action('wpml_st_loaded');
 }
Ejemplo n.º 3
0
 /**
  * We use the `post_type_link` filter as an action to move the `WPML_Slug_Translation::post_type_link_filter` method.
  *
  * The `WPML_Slug_Translation::post_type_link_filter` method is moved down the filter chain from 1 (WPML set priority)
  * to 15 (after default).
  * This change allows the smart WPML slug translation filter to work on the Eng version of the correct post permalink.
  *
  * @param string $post_type_link
  *
  * @return string The untouched post type link.
  */
 public function move_wpml_slug_translation_filter($post_type_link)
 {
     if (function_exists('wpml_st_load_slug_translation') && ($slug_translation = wpml_st_load_slug_translation())) {
         remove_filter('post_type_link', array($slug_translation, 'post_type_link_filter'), 1);
         add_filter('post_type_link', array($slug_translation, 'post_type_link_filter'), 15, 4);
     }
     return $post_type_link;
 }