public function get_most_popular_domain($plugin) { $plugin_localization_domains = icl_get_sub_setting('st', 'plugin_localization_domains'); $most_popular = ''; $most_count = 0; foreach ($plugin_localization_domains[$plugin] as $name => $count) { if ($name == 'WordPress') { continue; } if ($count > $most_count) { $most_popular = $name; $most_count = $count; } } return $most_popular; }
/** * @param $element * @param $option_key * @param $readonly_config_key * @param $always_true_types * * @return bool|mixed */ private function is_translated_element($element, $option_key, $readonly_config_key, $always_true_types) { $ret = false; if (is_scalar($element)) { if (in_array($element, $always_true_types)) { $ret = true; } else { $translation_management_options = $this->get_setting('translation-management'); $element_settings = icl_get_sub_setting($option_key, $element); if (isset($element_settings)) { $ret = icl_get_sub_setting($option_key, $element); } elseif (isset($translation_management_options[$readonly_config_key][$element]) && $translation_management_options[$readonly_config_key][$element] == 1) { $ret = true; } else { $ret = false; } } } return $ret; }
global $wpdb; $contexts = $wpdb->get_col("SELECT DISTINCT context\r\r\n\t\t\t\t\t\t\t FROM {$wpdb->prefix}icl_strings"); foreach ($contexts as $context) { if (strpos($context, ' (removed)') > 0) { $fix_context = 'theme ' . str_replace(' (removed)', '', $context); $wpdb->query($wpdb->prepare("UPDATE\r\r\n\t\t\t\t\t\t\t\t\t\t {$wpdb->prefix}icl_strings\r\r\n\t\t\t\t\t\t\t\t\t\t SET context = %s\r\r\n\t\t\t\t\t\t\t\t\t\t WHERE context = %s", $fix_context, $context)); } } } fix_removed_contexts_from_3_2_upgrade(); $local = new WPML_Localization(); $theme_localization_stats = $local->get_theme_localization_stats(); $theme_requires_rescan = $local->does_theme_require_rescan(); $plugin_localization_stats = $local->get_plugin_localization_stats(); $plugin_wrong_localization_stats = $local->get_wrong_plugin_localization_stats(); $theme_localization_domains = icl_get_sub_setting('st', 'theme_localization_domains'); ?> <h3><?php _e('Strings in the theme', 'wpml-string-translation'); ?> </h3> <div class="updated fade"> <p> <i><?php _e('Re-scanning the plugins or the themes will reset the strings tracked in the code or the HTML source', 'wpml-string-translation'); ?> </i></p> </div>
/** * Returns the HTML showing the .mo file options on the Plugins and Theme Localization Screen. * @return string */ public static function render_settings_menu() { ICL_WP_Pointers::add(array('ICL_WP_Pointers', 'pointer_mo_auto_download_260')); $auto_download_mo = icl_get_sub_setting('st', 'auto_download_mo'); $dl_mo = empty($auto_download_mo); $output = '<br />'; $output .= '<form id="icl_auto_download_mo" name="icl_auto_download_mo" method="post" action="">'; $output .= '<input type="hidden" name="action" value="icl_adm_save_preferences" />'; $output .= '<h3>' . __('Select how to get translations for WordPress core', 'wpml-string-translation') . '</h3>'; $output .= wp_nonce_field('icl_auto_download_mo_nonce', '_icl_nonce', true, false); $output .= '<ul style="display:inline-block;padding:0;margin:0;" id="icl_adm_options"><li><label>'; $output .= '<input type="radio" name="auto_download_mo" value="1"'; if (!$dl_mo) { $output .= ' checked="checked" '; } $output .= '/>'; $output .= ' ' . __('WPML will automatically download translations for WordPress', 'wpml-string-translation'); $output .= '</label></li><li><label>'; $output .= '<input type="radio" name="auto_download_mo" value="0"'; if ($dl_mo) { $output .= 'checked="checked"'; } $output .= '/>'; $output .= ' ' . __('I will download translations for WordPress and save .mo files in wp-includes/languages', 'wpml-string-translation'); $output .= '</label></li></ul><p>'; $output .= '<input class="button-secondary" type="submit" value="' . __('Save', 'wpml-string-translation') . '" />'; $output .= '<span class="icl_ajx_response" id="icl_ajx_response2" style="display:inline"></span></p></form>'; return $output; }
/** * @param $element_type * @param $option_key * @param $readonly_config_key * @param $always_true_types * * @return bool|mixed */ private function is_translated_element($element_type, $option_key, $readonly_config_key, $always_true_types) { $ret = false; if (is_scalar($element_type)) { $ret = in_array($element_type, $always_true_types, true); if (!$ret) { $translation_management_options = $this->get_setting('translation-management'); if ('any' === $element_type) { $ret = count($always_true_types) > 0 || count($translation_management_options[$readonly_config_key]) > 0; } else { $ret = icl_get_sub_setting($option_key, $element_type); if (!$ret) { if (isset($translation_management_options[$readonly_config_key][$element_type]) && $translation_management_options[$readonly_config_key][$element_type] == 1) { $ret = true; } else { $ret = false; } } } } } return $ret; }