本文整理汇总了PHP中SitePress::get_settings方法的典型用法代码示例。如果您正苦于以下问题:PHP SitePress::get_settings方法的具体用法?PHP SitePress::get_settings怎么用?PHP SitePress::get_settings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SitePress
的用法示例。
在下文中一共展示了SitePress::get_settings方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: estimate_custom_field_word_count
private function estimate_custom_field_word_count()
{
$sitepress_settings = $this->sitepress->get_settings();
if (!isset($this->language_code) || !isset($this->id) || !$this->is_registered_type()) {
return 0;
}
$words = 0;
$post_id = $this->id;
if (!empty($sitepress_settings['translation-management']['custom_fields_translation']) && is_array($sitepress_settings['translation-management']['custom_fields_translation'])) {
$custom_fields = array();
foreach ($sitepress_settings['translation-management']['custom_fields_translation'] as $cf => $op) {
if (WPML_TRANSLATE_CUSTOM_FIELD === (int) $op) {
$custom_fields[] = $cf;
}
}
foreach ($custom_fields as $cf) {
$custom_fields_value = get_post_meta($post_id, $cf);
if ($custom_fields_value && is_scalar($custom_fields_value)) {
// only support scalar values fo rnow
$words += $this->get_string_words_count($this->language_code, $custom_fields_value);
} else {
foreach ($custom_fields_value as $custom_fields_value_item) {
if ($custom_fields_value_item && is_scalar($custom_fields_value_item)) {
// only support scalar values fo rnow
$words += $this->get_string_words_count($this->language_code, $custom_fields_value_item);
}
}
}
}
}
return (int) $words;
}
示例2: __construct
public function __construct(&$sitepress, &$wpdb, &$wp_query)
{
$this->wpdb =& $wpdb;
$this->sitepress =& $sitepress;
$this->wp_query =& $wp_query;
$this->sitepress_settings = $this->sitepress->get_settings();
}
示例3: SitePress
function __construct()
{
global $cms_nav_ie_ver, $sitepress;
if (!isset($sitepress)) {
$sitepress = new SitePress();
$sitepress->initialize_cache();
}
$sitepress_settings = $sitepress->get_settings();
$this->settings = $sitepress_settings['modules']['cms-navigation'];
$cms_nav_user_agent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('#MSIE ([0-9]+)\\.[0-9]#', $cms_nav_user_agent, $matches)) {
$cms_nav_ie_ver = $matches[1];
}
add_action('icl_navigation_breadcrumb', array($this, 'cms_navigation_breadcrumb'));
add_action('icl_navigation_menu', array($this, 'cms_navigation_menu_nav'));
add_action('icl_navigation_sidebar', array($this, 'cms_navigation_page_navigation'));
add_action('save_post', array($this, 'cms_navigation_update_post_settings'));
add_action('admin_head', array($this, 'cms_navigation_page_edit_options'));
add_action('admin_head', array($this, 'cms_navigation_js'));
add_action('init', array($this, 'cms_navigation_css'));
add_action('plugins_loaded', array($this, 'sidebar_navigation_widget_init'));
add_filter('page_link', array($this, 'rewrite_page_link'), 15, 2);
add_action('parse_query', array($this, 'redirect_offsite_urls'));
add_filter('permalink_structure_changed', array($this, 'clear_cache'));
add_filter('update_option_show_on_front', array($this, 'clear_cache'));
add_filter('update_option_page_on_front', array($this, 'clear_cache'));
add_filter('update_option_page_for_posts', array($this, 'clear_cache'));
add_action('delete_post', array($this, 'clear_cache'));
add_action('delete_category', array($this, 'clear_cache'));
add_action('create_category', array($this, 'clear_cache'));
add_action('edited_category', array($this, 'clear_cache'));
// not needed - save_post handles this
//add_action('trashed_post', array($this,'clear_cache'));
//add_action('untrashed_post', array($this,'clear_cache'));
}
示例4: elseif
}
if (is_admin() || defined('XMLRPC_REQUEST')) {
require ICL_PLUGIN_PATH . '/lib/icl_api.php';
require ICL_PLUGIN_PATH . '/lib/xml2array.php';
require ICL_PLUGIN_PATH . '/lib/Snoopy.class.php';
require ICL_PLUGIN_PATH . '/inc/translation-management/translation-management.class.php';
require ICL_PLUGIN_PATH . '/inc/translation-management/pro-translation.class.php';
require ICL_PLUGIN_PATH . '/inc/pointers.php';
} elseif (preg_match('#wp-comments-post\\.php$#', $_SERVER['REQUEST_URI'])) {
require ICL_PLUGIN_PATH . '/inc/translation-management/translation-management.class.php';
require ICL_PLUGIN_PATH . '/inc/translation-management/pro-translation.class.php';
}
if (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'activate' && $_REQUEST['action'] != 'activate-selected' || (!isset($_REQUEST['plugin']) || $_REQUEST['plugin'] != basename(ICL_PLUGIN_PATH) . '/' . basename(__FILE__)) && !@in_array(ICL_PLUGIN_FOLDER . '/' . basename(__FILE__), $_REQUEST['checked'])) {
global $sitepress;
$sitepress = new SitePress();
$sitepress_settings = $sitepress->get_settings();
// Comments translation
if ($sitepress_settings['existing_content_language_verified']) {
require ICL_PLUGIN_PATH . '/inc/comments-translation/functions.php';
}
require ICL_PLUGIN_PATH . '/modules/cache-plugins-integration/cache-plugins-integration.php';
require ICL_PLUGIN_PATH . '/inc/wp-login-filters.php';
require_once ICL_PLUGIN_PATH . '/inc/plugins-integration.php';
// installer hook - start
include_once ICL_PLUGIN_PATH . '/inc/installer/loader.php';
//produces global variable $wp_installer_instance
WP_Installer_Setup($wp_installer_instance, array('plugins_install_tab' => 1, 'site_key_nags' => array(array('repository_id' => 'wpml', 'product_name' => 'WPML', 'condition_cb' => array($sitepress, 'setup')))));
// installer hook - end
}
if (!empty($sitepress_settings['automatic_redirect'])) {
require_once ICL_PLUGIN_PATH . '/inc/browser-redirect.php';