public function __construct(WPML_Translate_Link_Target_Global_State $translate_link_target_global_state, &$wpdb, $post_data)
 {
     parent::__construct($wpdb);
     $this->translate_link_target_global_state = $translate_link_target_global_state;
     $this->translate_link_targets = $this->create_translate_link_target();
     $this->post_data = $post_data;
 }
 /**
  * WPML_TM_Dashboard constructor.
  *
  * @param wpdb     $wpdb
  * @param array[]  $active_languages
  * @param string[] $translatable_types
  */
 public function __construct(&$wpdb, $active_languages, $translatable_types)
 {
     parent::__construct($wpdb);
     $this->active_languages = array_keys($active_languages);
     $this->translatable_types = $translatable_types;
     $this->wpdb = $wpdb;
 }
Exemplo n.º 3
0
 /**
  * @param wpdb $wpdb
  * WPML_ST_TM_Jobs constructor.
  */
 public function __construct(&$wpdb)
 {
     parent::__construct($wpdb);
     add_filter('wpml_tm_jobs_union_table_sql', array($this, 'jobs_union_table_sql_filter'), 10, 2);
     add_filter('wpml_post_translation_original_table', array($this, 'filter_tm_post_job_table'), 10, 1);
     add_filter('wpml_st_job_state_pending', array($this, 'tm_external_job_in_progress_filter'), 10, 2);
 }
Exemplo n.º 4
0
 public function __construct(&$wpdb, $requested_host)
 {
     parent::__construct($wpdb);
     add_filter('style_loader_src', array($this, 'filter_include_url'));
     add_filter('script_loader_src', array($this, 'filter_include_url'));
     add_filter('the_password_form', array($this, 'wpml_password_form_filter'));
     $this->requested_host = $requested_host;
 }
 /**
  * WPML_TM_ICL_Strings constructor.
  *
  * @param wpdb $wpdb
  * @param int  $string_id
  */
 public function __construct(&$wpdb, $string_id)
 {
     parent::__construct($wpdb);
     $string_id = (int) $string_id;
     if ($string_id > 0) {
         $this->string_id = $string_id;
     } else {
         throw new InvalidArgumentException('Invalid String ID: ' . $string_id);
     }
 }
 /**
  * WPML_TM_ICL_Translation_Status constructor.
  *
  * @param wpdb            $wpdb
  * @param WPML_TM_Records $tm_records
  * @param int             $id
  * @param string          $type
  */
 public function __construct(&$wpdb, &$tm_records, $id, $type = 'translation_id')
 {
     parent::__construct($wpdb);
     $this->tm_records =& $tm_records;
     if ($id > 0 && in_array($type, array('translation_id', 'rid'), true)) {
         $this->{$type} = $id;
     } else {
         throw new InvalidArgumentException('Unknown column: ' . $type . ' or invalid id: ' . $id);
     }
 }
 /**
  * WPML_ST_ICL_String_Translations constructor.
  *
  * @param wpdb   $wpdb
  * @param int    $string_id
  * @param string $lang_code
  */
 public function __construct(&$wpdb, $string_id, $lang_code)
 {
     parent::__construct($wpdb);
     $string_id = (int) $string_id;
     if ($string_id > 0 && $lang_code) {
         $this->string_id = $string_id;
         $this->lang_code = $lang_code;
     } else {
         throw new InvalidArgumentException('Invalid String ID: ' . $string_id . ' or language_code: ' . $lang_code);
     }
 }
 /**
  * WPML_TM_ICL_Translation_Status constructor.
  *
  * @param wpdb   $wpdb
  * @param string $code
  * @param string $type
  */
 public function __construct(&$wpdb, $code, $type = 'code')
 {
     parent::__construct($wpdb);
     $code = (string) $code;
     if ($code !== '' && $type === 'code') {
         $this->code = $code;
     } elseif ($type === 'default_locale' && $code !== '') {
         $this->default_locale = $code;
     } else {
         throw new InvalidArgumentException('Empty language code or invalid column type!');
     }
 }
 /**
  * WPML_TM_ICL_Translations constructor.
  *
  * @param wpdb            $wpdb
  * @param WPML_TM_Records $tm_records
  * @param int|array       $id
  * @param string          $type translation id, trid_lang or id_prefix for now
  */
 public function __construct(&$wpdb, &$tm_records, $id, $type = 'translation_id')
 {
     parent::__construct($wpdb);
     $this->tm_records =& $tm_records;
     if ($id > 0 && $type === 'translation_id') {
         $this->{$type} = $id;
     } elseif ($type === 'id_type_prefix' && isset($id['element_id']) && isset($id['type_prefix'])) {
         $this->translation_id = $this->wpdb->get_var($this->wpdb->prepare(" SELECT translation_id\n\t\t\t\t\t\t\t\t\t\tFROM {$this->wpdb->prefix}{$this->table}\n\t\t\t\t\t\t\t\t\t\tWHERE element_id = %d\n\t\t\t\t\t\t\t\t\t\t\tAND element_type LIKE %s\n\t\t\t\t\t\t\t\t\t\tLIMIT 1", $id['element_id'], $id['type_prefix'] . '%'));
     } elseif ($type === 'trid_lang' && isset($id['trid']) && isset($id['language_code'])) {
         $this->translation_id = $this->wpdb->get_var($this->wpdb->prepare(" SELECT translation_id\n\t\t\t\t\t\t\t\t\t\tFROM {$this->wpdb->prefix}{$this->table}\n\t\t\t\t\t\t\t\t\t\tWHERE trid = %d\n\t\t\t\t\t\t\t\t\t\t\tAND language_code = %s\n\t\t\t\t\t\t\t\t\t\tLIMIT 1", $id['trid'], $id['language_code']));
     } else {
         throw new InvalidArgumentException('Unknown column: ' . $type . ' or invalid id: ' . serialize($id));
     }
 }
 /**
  * WPML_Custom_Field_XML_Settings_Import constructor.
  *
  * @param wpdb                              $wpdb
  * @param WPML_Custom_Field_Setting_Factory $setting_factory
  * @param array                             $settings_array
  */
 public function __construct(&$wpdb, &$setting_factory, $settings_array)
 {
     parent::__construct($wpdb);
     $this->setting_factory =& $setting_factory;
     $this->settings_array = $settings_array;
 }
Exemplo n.º 11
0
 function __construct()
 {
     do_action('wpml_before_startup');
     global $pagenow, $sitepress_settings, $wpdb, $wpml_post_translations, $wpml_term_translations;
     $this->wpml_helper = new WPML_Helper($wpdb);
     parent::__construct($wpdb);
     $this->locale_utils = new WPML_Locale($wpdb, $this);
     $sitepress_settings = get_option('icl_sitepress_settings');
     $this->settings =& $sitepress_settings;
     $this->always_translatable_post_types = array('post', 'page');
     $this->always_translatable_taxonomies = array('category', 'post_tag');
     //TODO: [WPML 3.5] To remove in WPML 3.5
     //@since 3.1
     if (is_admin() && !$this->get_setting('icl_capabilities_verified')) {
         icl_enable_capabilities();
         $sitepress_settings = get_option('icl_sitepress_settings');
     }
     if (is_null($pagenow) && is_multisite()) {
         include ICL_PLUGIN_PATH . '/inc/hacks/vars-php-multisite.php';
     }
     if (false != $this->settings) {
         $this->verify_settings();
     }
     if (isset($_GET['page']) && $_GET['page'] == ICL_PLUGIN_FOLDER . '/menu/troubleshooting.php' && isset($_GET['debug_action'])) {
         ob_start();
     }
     if (isset($_REQUEST['icl_ajx_action'])) {
         add_action('init', array($this, 'ajax_setup'), 15);
     }
     add_action('admin_footer', array($this, 'icl_nonces'));
     // Process post requests
     if (!empty($_POST)) {
         add_action('init', array($this, 'process_forms'));
     }
     $this->initialize_cache();
     $this->flags = new WPML_Flags($wpdb);
     add_action('plugins_loaded', array($this, 'init'), 1);
     add_action('wp_loaded', array($this, 'maybe_set_this_lang'));
     add_action('init', array($this, 'on_wp_init'), 1);
     add_action('switch_blog', array($this, 'init_settings'), 10, 1);
     // Administration menus
     add_action('admin_menu', array($this, 'administration_menu'));
     add_action('admin_menu', array($this, 'administration_menu2'), 30);
     add_action('init', array($this, 'plugin_localization'));
     if ($this->get_setting('existing_content_language_verified') && ($this->get_setting('setup_complete') || !empty($_GET['page']) && $this->get_setting('setup_wizard_step') == 3 && $_GET['page'] == ICL_PLUGIN_FOLDER . '/menu/languages.php')) {
         // Post/page language box
         add_filter('comment_feed_join', array($this, 'comment_feed_join'));
         add_filter('comments_clauses', array($this, 'comments_clauses'), 10, 2);
         // Allow us to filter the Query vars before the posts query is being built and executed
         add_filter('pre_get_posts', array($this, 'pre_get_posts'));
         add_filter('the_posts', array($this, 'the_posts'), 10);
         if ($pagenow == 'edit.php') {
             add_action('quick_edit_custom_box', array('WPML_Terms_Translations', 'quick_edit_terms_removal'), 10, 2);
         }
         add_filter('get_pages', array($this, 'exclude_other_language_pages2'));
         add_filter('wp_dropdown_pages', array($this, 'wp_dropdown_pages'));
         add_filter('get_comment_link', array($this, 'get_comment_link_filter'));
         // filter the saving of terms so that the taxonomy_ids of translated terms are correctly adjusted across taxonomies
         add_action('created_term_translation', array('WPML_Terms_Translations', 'sync_ttid_action'), 10, 3);
         // filters terms by language for the term/tag-box autoselect
         if (isset($_GET['action']) && $_GET['action'] == 'ajax-tag-search' || isset($_POST['action']) && $_POST['action'] == 'get-tagcloud') {
             add_filter('get_terms', array('WPML_Terms_Translations', 'get_terms_filter'), 10, 2);
         }
         $this->set_term_filters_and_hooks();
         add_action('parse_query', array($this, 'parse_query'));
         // The delete filter only ensures the synchronizing of delete actions between translations of a term.
         add_action('delete_term', array($this, 'delete_term'), 1, 3);
         add_action('set_object_terms', array('WPML_Terms_Translations', 'set_object_terms_action'), 10, 6);
         // AJAX Actions for the post edit screen
         add_action('wp_ajax_wpml_save_term', array('WPML_Post_Edit_Ajax', 'wpml_save_term'));
         add_action('wp_ajax_wpml_switch_post_language', array('WPML_Post_Edit_Ajax', 'wpml_switch_post_language'));
         add_action('wp_ajax_wpml_set_post_edit_lang', array('WPML_Post_Edit_Ajax', 'wpml_set_post_edit_lang'));
         add_action('wp_ajax_wpml_get_default_lang', array('WPML_Post_Edit_Ajax', 'wpml_get_default_lang'));
         //AJAX Actions for the taxonomy translation screen
         add_action('wp_ajax_wpml_get_table_taxonomies', array('WPML_Taxonomy_Translation_Table_Display', 'wpml_get_table_taxonomies'));
         add_action('wp_ajax_wpml_get_terms_and_labels_for_taxonomy_table', array('WPML_Taxonomy_Translation_Table_Display', 'wpml_get_terms_and_labels_for_taxonomy_table'));
         // Ajax Action for the updating of term names on the troubleshooting page
         add_action('wp_ajax_wpml_update_term_names_troubleshoot', array('WPML_Troubleshooting_Terms_Menu', 'wpml_update_term_names_troubleshoot'));
         // short circuit get default category
         add_filter('pre_option_default_category', array($this, 'pre_option_default_category'));
         add_filter('update_option_default_category', array($this, 'update_option_default_category'), 1, 2);
         // custom hook for adding the language selector to the template
         //@deprecated see 'wpml_add_language_selector' action in $this->api_hooks();)
         add_action('icl_language_selector', array($this, 'language_selector'));
         // front end js
         add_action('wp_head', array($this, 'front_end_js'));
         add_action('wp_head', array($this, 'rtl_fix'));
         add_action('admin_print_styles', array($this, 'rtl_fix'));
         add_action('restrict_manage_posts', array($this, 'restrict_manage_posts'));
         // adjacent posts links
         add_filter('get_previous_post_join', array($this, 'get_adjacent_post_join'));
         add_filter('get_next_post_join', array($this, 'get_adjacent_post_join'));
         add_filter('get_previous_post_where', array($this, 'get_adjacent_post_where'));
         add_filter('get_next_post_where', array($this, 'get_adjacent_post_where'));
         // feeds links
         add_filter('feed_link', array($this, 'feed_link'));
         // commenting links
         add_filter('post_comments_feed_link', array($this, 'post_comments_feed_link'));
         add_filter('trackback_url', array($this, 'trackback_url'));
         add_filter('user_trailingslashit', array($this, 'user_trailingslashit'), 1, 2);
         // date based archives
         add_filter('year_link', array($this, 'archives_link'));
         add_filter('month_link', array($this, 'archives_link'));
         add_filter('day_link', array($this, 'archives_link'));
         add_filter('getarchives_join', array($this, 'getarchives_join'));
         add_filter('getarchives_where', array($this, 'getarchives_where'));
         add_filter('pre_option_home', array($this, 'pre_option_home'));
         if (!is_admin()) {
             add_filter('attachment_link', array($this, 'attachment_link_filter'), 10, 2);
         }
         // Filter custom type archive link (since WP 3.1)
         add_filter('post_type_archive_link', array($this, 'post_type_archive_link_filter'), 10, 2);
         add_filter('author_link', array($this, 'author_link'));
         // language negotiation
         add_action('query_vars', array($this, 'query_vars'));
         add_filter('language_attributes', array($this, 'language_attributes'));
         add_filter('locale', array($this, 'locale'), 10, 1);
         add_filter('pre_option_page_on_front', array($this, 'pre_option_page_on_front'));
         add_filter('pre_option_page_for_posts', array($this, 'pre_option_page_for_posts'));
         add_filter('pre_option_sticky_posts', array($this, 'option_sticky_posts'), 10, 2);
         add_action('wp_head', array($this, 'set_wp_query'));
         add_action('show_user_profile', array($this, 'show_user_options'));
         add_action('personal_options_update', array($this, 'save_user_options'));
         // column with links to translations (or add translation) - low priority
         add_action('init', array($this, 'configure_custom_column'), 1010);
         // accommodate Types init@999
         if (!is_admin()) {
             add_action('wp_head', array($this, 'meta_generator_tag'));
         }
         require_once ICL_PLUGIN_PATH . '/inc/wp-nav-menus/iclNavMenu.class.php';
         new iclNavMenu($this, $wpdb, $wpml_post_translations, $wpml_term_translations);
         if (is_admin() || defined('XMLRPC_REQUEST') || preg_match('#wp-comments-post\\.php$#', $_SERVER['REQUEST_URI'])) {
             global $iclTranslationManagement;
             $iclTranslationManagement = wpml_load_core_tm();
         }
         add_action('wp_login', array($this, 'reset_admin_language_cookie'));
         if ($this->settings['seo']['head_langs']) {
             add_action('wp_head', array($this, 'head_langs'));
         }
         /**
          * add extra debug information
          */
         add_filter('icl_get_extra_debug_info', array($this, 'add_extra_debug_info'));
     }
     //end if the initial language is set - existing_content_language_verified
     add_action('wp_dashboard_setup', array($this, 'dashboard_widget_setup'));
     add_filter('core_version_check_locale', array($this, 'wp_upgrade_locale'));
     if ($pagenow === 'post.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' && isset($_GET['post'])) {
         add_action('init', '_icl_trash_restore_prompt');
     }
     add_action('init', array($this, 'js_load'), 2);
     // enqueue scripts - higher priority
     add_filter('url_to_postid', array($this, 'url_to_postid'));
     //cron job to update WPML config index file from CDN
     add_action('update_wpml_config_index', array($this, 'update_wpml_config_index_event'));
     //update WPML config files
     add_action('wp_ajax_update_wpml_config_index', array($this, 'update_wpml_config_index_event_ajax'));
     add_action('after_switch_theme', array($this, 'update_wpml_config_index_event'));
     add_action('activated_plugin', array($this, 'update_wpml_config_index_event'));
     add_action('core_upgrade_preamble', array($this, 'update_index_screen'));
     add_shortcode('wpml_language_selector_widget', 'icl_language_selector');
     add_shortcode('wpml_language_selector_footer', 'icl_language_selector_footer');
     add_filter('get_search_form', array($this, 'get_search_form_filter'));
     $this->api_hooks();
     add_action('wpml_loaded', array($this, 'load_dependencies'), 10000);
     do_action('wpml_after_startup');
 }
 public function __construct($wpdb, $wpml_post_translations, $wpml_term_translations)
 {
     parent::__construct($wpdb);
     $this->wpml_post_translations = $wpml_post_translations;
     $this->wpml_term_translations = $wpml_term_translations;
 }
 /**
  * @param WPDB $wpdb
  */
 public function __construct(WPDB $wpdb)
 {
     parent::__construct($wpdb);
     $this->domain_fallback = new WPML_ST_Domain_Fallback();
     $this->chunk_retrieve = new WPML_DB_Chunk($wpdb);
 }
Exemplo n.º 14
0
 /**
  * WPML_TM_API constructor.
  *
  * @param wpdb                  $wpdb
  * @param TranslationManagement $TranslationManagement
  */
 public function __construct(&$wpdb, &$TranslationManagement)
 {
     parent::__construct($wpdb);
     $this->TranslationManagement =& $TranslationManagement;
     $this->init_hooks();
 }
 /**
  * @param wpdb $wpdb
  */
 public function __construct(&$wpdb)
 {
     parent::__construct($wpdb);
     $this->type_prefix_length = strlen($this->get_type_prefix());
 }
 /**
  * @param wpdb $wpdb
  */
 public function __construct(&$wpdb)
 {
     parent::__construct($wpdb);
     $this->element_join = $this->get_element_join();
 }
 /**
  * @param int $string_id
  * @param wpdb $wpdb
  */
 public function __construct($string_id, &$wpdb)
 {
     parent::__construct($wpdb);
     $this->string_id = $string_id;
 }
 /**
  * @param wpdb $wpdb
  */
 public function __construct(&$wpdb)
 {
     parent::__construct($wpdb);
     $this->hooks();
 }
 public function __construct(&$wpdb, $wp_api)
 {
     parent::__construct($wpdb);
     $this->wp_api = $wp_api;
 }
 /**
  * @param wpdb $wpdb
  */
 public function __construct(&$wpdb)
 {
     parent::__construct($wpdb);
     $this->lang_info_table = $wpdb->prefix . 'icl_translations';
 }
Exemplo n.º 21
0
 /**
  * WPML_Query_Utils constructor.
  *
  * @param wpdb $wpdb
  * @param $wp_api
  */
 public function __construct(wpdb &$wpdb, WPML_WP_API &$wp_api)
 {
     parent::__construct($wpdb);
     $this->wp_api =& $wp_api;
 }
 /**
  * @param wpdb      $wpdb
  * @param SitePress $sitepress
  */
 public function __construct(&$wpdb, &$sitepress)
 {
     parent::__construct($wpdb);
     $this->sitepress =& $sitepress;
 }
Exemplo n.º 23
0
 /**
  * @param WPDB $wpdb
  * @param int $post_id
  */
 public function __construct(WPDB $wpdb, $post_id)
 {
     parent::__construct($wpdb);
     $this->post_id = $post_id;
 }
 /**
  * @param WPDB $wpdb
  * WPML_ST_TM_Jobs constructor.
  */
 public function __construct(&$wpdb)
 {
     parent::__construct($wpdb);
     add_filter('wpml_tm_jobs_union_table_sql', array($this, 'jobs_union_table_sql_filter'), 10, 2);
     add_filter('wpml_post_translation_original_table', array($this, 'filter_tm_post_job_table'), 10, 1);
 }
Exemplo n.º 25
0
 public function __construct(&$wpdb)
 {
     parent::__construct($wpdb);
     $this->icl_flag_cache = new icl_cache('flags', true);
 }
 public function __construct(WPML_Translate_Link_Target_Global_State $translate_link_target_global_state, &$wpdb, $pro_translation)
 {
     parent::__construct($wpdb);
     $this->pro_translation = $pro_translation;
     $this->translate_link_target_global_state = $translate_link_target_global_state;
 }
 /**
  * @param wpdb $wpdb
  */
 public function __construct(&$wpdb)
 {
     parent::__construct($wpdb);
 }
 /**
  * WPML_TP_String_Job constructor.
  *
  * @param wpdb                         $wpdb
  * @param WPML_Translation_Basket      $basket
  * @param WPML_Translation_Job_Factory $job_factory
  */
 public function __construct(&$wpdb, &$basket, &$job_factory)
 {
     parent::__construct($wpdb);
     $this->basket =& $basket;
     $this->job_factory =& $job_factory;
 }