本文整理汇总了PHP中wp_load_alloptions函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_load_alloptions函数的具体用法?PHP wp_load_alloptions怎么用?PHP wp_load_alloptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_load_alloptions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export
/**
* Export package configuration
*
* @return string
*/
public function export()
{
global $wp_version;
// Get options
$options = wp_load_alloptions();
// Get Site URL
$site_url = site_url();
if (isset($options['siteurl'])) {
$site_url = rtrim($options['siteurl'], '/');
}
// Get Home URL
$home_url = home_url();
if (isset($options['home'])) {
$home_url = rtrim($options['home'], '/');
}
// Default configuration
$config = array('SiteURL' => $site_url, 'HomeURL' => $home_url, 'Plugin' => array('Version' => AI1WM_VERSION), 'WordPress' => array('Version' => $wp_version, 'Content' => WP_CONTENT_DIR));
// Get user identity
if (apply_filters('ai1wm_keep_user_identity_on_export', false)) {
$config['Export']['User'] = array('Id' => get_current_user_id());
}
// Save package file
$package = file_put_contents($this->storage()->package(), json_encode($config));
if (false === $package) {
throw new Ai1wm_Import_Exception('Unable to write package.json file');
}
}
示例2: get_context
/**
* Custom implementation for get_context method.
*/
public function get_context()
{
global $content_width;
if (class_exists('Easy_Digital_Downloads')) {
global $edd_options;
}
$context = Timber::get_context();
$sidebar_primary = Timber::get_widgets('sidebar_primary');
$sidebar_footer = Timber::get_widgets('sidebar_footer');
$context['theme_mods'] = get_theme_mods();
$context['site_options'] = wp_load_alloptions();
$context['teaser_mode'] = apply_filters('maera/teaser/mode', 'excerpt');
$context['thumbnail']['width'] = apply_filters('maera/image/width', 600);
$context['thumbnail']['height'] = apply_filters('maera/image/height', 371);
$context['menu']['primary'] = has_nav_menu('primary_navigation') ? new TimberMenu('primary_navigation') : null;
$context['sidebar']['primary'] = apply_filters('maera/sidebar/primary', $sidebar_primary);
$context['sidebar']['footer'] = apply_filters('maera/sidebar/footer', $sidebar_footer);
$context['pagination'] = Timber::get_pagination();
$context['comment_form'] = TimberHelper::get_comment_form();
$context['comments_args'] = array('style' => 'ul', 'reply_text' => __('Reply', 'maera'), 'short_ping' => true, 'avatar_size' => 60);
$context['site_logo'] = get_option('site_logo', false);
$context['content_width'] = $content_width;
$context['sidebar_template'] = maera_templates_sidebar();
if (class_exists('Easy_Digital_Downloads')) {
$data['edd_options'] = $edd_options;
$data['download_categories'] = Timber::get_terms('download_category');
$data['download_tags'] = Timber::get_terms('download_tag');
$data['default_image'] = new TimberImage(get_template_directory_uri() . '/assets/images/default.png');
}
return apply_filters('maera/timber/context', $context);
}
示例3: add_to_context
function add_to_context($context)
{
$context['foo'] = 'bar';
$context['stuff'] = 'I am a value set in your functions.php file';
$context['notes'] = 'These values are available everytime you call Timber::get_context();';
$context['menu'] = new TimberMenu();
//$context['custom_wp_nav_menu'] = wp_nav_menu( array( 'container_class' => 'menu-header', 'echo' => false, 'menu_class' => 'nav-menu' ) );
$context['custom_wp_nav_menu'] = wp_nav_menu(array('container_class' => 'menu-header', 'echo' => false, 'menu_class' => 'nav-menu'));
$context['site'] = $this;
$context['theme_url'] = get_stylesheet_directory_uri();
$context['is_logged_in'] = is_user_logged_in();
$context['theme_mod'] = get_theme_mods();
$context['options'] = wp_load_alloptions();
$context['site_url'] = site_url();
if (is_home() || is_front_page()) {
$context['is_home'] = true;
}
/*
* Footer
*/
$context['footer_tag_line'] = get_option('footer_text');
$context['footer_address'] = get_option('address');
$context['footer_site_url'] = site_url();
$context['footer_inquiry_mail'] = get_option('inquiry_mail');
$context['footer_telephone'] = get_option('telephone');
$context['s_facebook'] = get_option('facebook');
$context['s_twitter'] = get_option('twitter');
$context['s_linkedin'] = get_option('linkedin');
$context['footer_copyright'] = get_option('copyright');
return $context;
}
示例4: blogolife_settings_page
function blogolife_settings_page()
{
?>
<div class='wrap'>
<h1><?php
_e('BlogoLife old settings', 'blogolife');
?>
</h1>
<?php
$all_options = wp_load_alloptions();
$old_settings = array('wpl_logo_url', 'wpl_header_desc', 'wpl_ga_code', 'wpl_css', 'wpl_menu', 'wpl_next_preview_post', 'wpl_rss', 'wpl_favicon_url', 'wpl_display_categories_post', 'wpl_display_author_post', 'wpl_display_date_post', 'wpl_display_author_page', 'wpl_display_date_page', 'wpl_nivo', 'wpl_share_buttons_page', 'wpl_share_buttons_post', 'wpl_twitter', 'wpl_google_plus', 'wpl_facebook', 'wpl_linkedin', 'wpl_tumblr', 'wpl_delicious', 'wpl_digg', 'wpl_stumbleupon', 'wpl_flickr', 'wpl_picasa', 'wpl_youtube', 'wpl_dribbble', 'wpl_pinterest', 'wpl_meta_description', 'wpl_meta_keywords');
$my_options = array();
foreach ($all_options as $name => $value) {
if (stristr($name, 'wpl_') && $value != '') {
if (in_array($name, $old_settings)) {
if ($name === 'wpl_ga_code') {
$ua_regex = "/UA-[0-9]{5,}-[0-9]{1,}/";
preg_match_all($ua_regex, $value, $ua_id);
$my_options[$name] = $ua_id[0][0];
} else {
$my_options[$name] = $value;
}
}
}
}
echo "<pre>";
print_r($my_options);
echo "</pre>";
?>
</div>
<?php
}
示例5: bapi_wp_site_options
function bapi_wp_site_options()
{
global $bapi_all_options;
$bapi_all_options = wp_load_alloptions();
if (!isset($bapi_all_options['bapi_solutiondata'])) {
$bapi_all_options['bapi_solutiondata'] = '';
}
if (!isset($bapi_all_options['bapi_solutiondata_lastmod'])) {
$bapi_all_options['bapi_solutiondata_lastmod'] = 0;
}
if (!isset($bapi_all_options['bapi_keywords_array'])) {
$bapi_all_options['bapi_keywords_array'] = '';
}
if (!isset($bapi_all_options['bapi_keywords_lastmod'])) {
$bapi_all_options['bapi_keywords_lastmod'] = 0;
}
if (!isset($bapi_all_options['bapi_language'])) {
$bapi_all_options['bapi_language'] = 'en-US';
}
if (!isset($bapi_all_options['bapi_baseurl'])) {
$bapi_all_options['bapi_baseurl'] = 'connect.bookt.com';
}
if (defined('BAPI_BASEURL')) {
$bapi_all_options['bapi_baseurl'] = BAPI_BASEURL;
}
if (!isset($bapi_all_options['bapi_first_look'])) {
$bapi_all_options['bapi_first_look'] = 0;
}
//print_r($bapi_all_options); exit();
}
示例6: get_options
/**
* Set site options.
* @return $this
*/
public function get_options()
{
switch_to_blog($this->_my_site->blog_id);
$this->_my_data["options"] = wp_load_alloptions();
restore_current_blog();
return $this;
}
示例7: remove_um
function remove_um()
{
global $ultimatemember;
foreach (wp_load_alloptions() as $k => $v) {
if (substr($k, 0, 3) == 'um_') {
if ($k == 'um_core_pages') {
$v = unserialize($v);
foreach ($v as $post_id) {
wp_delete_post($post_id, 1);
}
}
delete_option($k);
}
}
$forms = get_posts(array('post_type' => 'um_form', 'numberposts' => -1));
foreach ($forms as $form) {
wp_delete_post($form->ID, 1);
}
$directories = get_posts(array('post_type' => 'um_directory', 'numberposts' => -1));
foreach ($directories as $directory) {
wp_delete_post($directory->ID, 1);
}
$roles = get_posts(array('post_type' => 'um_role', 'numberposts' => -1));
foreach ($roles as $role) {
wp_delete_post($role->ID, 1);
}
if (is_plugin_active(um_plugin)) {
deactivate_plugins(um_plugin);
}
exit(wp_redirect(admin_url('plugins.php')));
}
示例8: aa_app_options
function aa_app_options()
{
ob_start();
echo "<pre>";
print_r(wp_load_alloptions());
echo "</pre>";
return ob_get_clean();
}
示例9: zh_cn_l10n_save_patch_states
/**
* Changes the state of a certain patch in the database
*
* @since 3.3.0
*/
function zh_cn_l10n_save_patch_states($patch_id, $updated_state, $flush = false)
{
$_zh_cn_l10n_preference_patches = unserialize(get_option('zh_cn_l10n_preference_patches'));
$_zh_cn_l10n_preference_patches[$patch_id] = $updated_state;
update_option('zh_cn_l10n_preference_patches', serialize($_zh_cn_l10n_preference_patches));
if ($flush) {
wp_load_alloptions();
}
}
示例10: eme_options_delete
function eme_options_delete()
{
$all_options = wp_load_alloptions();
foreach ($all_options as $name => $value) {
if (preg_match('/^eme_/', $name)) {
delete_option($name);
}
}
}
示例11: test_set_site_transient_is_not_stored_as_autoload_option
/**
* @ticket 22846
*/
public function test_set_site_transient_is_not_stored_as_autoload_option()
{
$key = 'not_autoloaded';
if (is_multisite()) {
$this->markTestSkipped('Does not apply when used in multisite.');
}
set_site_transient($key, 'Not an autoload option');
$options = wp_load_alloptions();
$this->assertFalse(isset($options['_site_transient_' . $key]));
}
示例12: test_update_network_option_is_not_stored_as_autoload_option
/**
* @ticket 22846
*/
public function test_update_network_option_is_not_stored_as_autoload_option()
{
$key = rand_str();
if (is_multisite()) {
$this->markTestSkipped('Does not apply when used in multisite.');
}
update_network_option(null, $key, 'Not an autoload option');
$options = wp_load_alloptions();
$this->assertFalse(isset($options[$key]));
}
示例13: theme_admin_print_scripts
function theme_admin_print_scripts()
{
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-bqq');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('theme-admin');
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
wp_enqueue_style("google-font-open-sans", "http://fonts.googleapis.com/css?family=Open+Sans:400,600");
$sidebars = array("default" => array(array("name" => "header", "label" => __("header", 'medicenter')), array("name" => "footer_top", "label" => __("footer top", 'medicenter')), array("name" => "footer_bottom", "label" => __("footer bottom", 'medicenter'))), "template-blog.php" => array(array("name" => "header", "label" => __("header", 'medicenter')), array("name" => "footer_top", "label" => __("footer top", 'medicenter')), array("name" => "footer_bottom", "label" => __("footer bottom", 'medicenter'))), "single.php" => array(array("name" => "header", "label" => __("header", 'medicenter')), array("name" => "footer_top", "label" => __("footer top", 'medicenter')), array("name" => "footer_bottom", "label" => __("footer bottom", 'medicenter'))), "single-features.php" => array(array("name" => "header", "label" => __("header", 'medicenter')), array("name" => "footer_top", "label" => __("footer top", 'medicenter')), array("name" => "footer_bottom", "label" => __("footer bottom", 'medicenter'))), "search.php" => array(array("name" => "header", "label" => __("header", 'medicenter')), array("name" => "footer_top", "label" => __("footer top", 'medicenter')), array("name" => "footer_bottom", "label" => __("footer bottom", 'medicenter'))), "template-default-without-breadcrumbs.php" => array(array("name" => "footer_top", "label" => __("footer top", 'medicenter')), array("name" => "footer_bottom", "label" => __("footer bottom", 'medicenter'))), "template-home.php" => array(array("name" => "top", "label" => __("top", 'medicenter')), array("name" => "footer_top", "label" => __("footer top", 'medicenter')), array("name" => "footer_bottom", "label" => __("footer bottom", 'medicenter'))), "404.php" => array(array("name" => "header", "label" => __("header", 'medicenter')), array("name" => "footer_top", "label" => __("footer top", 'medicenter')), array("name" => "footer_bottom", "label" => __("footer bottom", 'medicenter'))));
//get theme sidebars
$theme_sidebars = array();
$theme_sidebars_array = get_posts(array('post_type' => 'medicenter_sidebars', 'posts_per_page' => '-1', 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC'));
for ($i = 0; $i < count($theme_sidebars_array); $i++) {
$theme_sidebars[$i]["id"] = $theme_sidebars_array[$i]->ID;
$theme_sidebars[$i]["title"] = $theme_sidebars_array[$i]->post_title;
}
//get theme sliders
$sliderAllShortcodeIds = array();
$allOptions = wp_load_alloptions();
foreach ($allOptions as $key => $value) {
if (substr($key, 0, 26) == "medicenter_slider_settings") {
$sliderAllShortcodeIds[] = $key;
}
}
//get revolution sliders
if (is_plugin_active('revslider/revslider.php')) {
global $wpdb;
$rs = $wpdb->get_results("\r\n\t\tSELECT id, title, alias\r\n\t\tFROM " . $wpdb->prefix . "revslider_sliders\r\n\t\tORDER BY id ASC LIMIT 100\r\n\t\t");
if ($rs) {
foreach ($rs as $slider) {
$sliderAllShortcodeIds[] = "revolution_slider_settings_" . $slider->alias;
}
}
}
//get layer sliders
if (is_plugin_active('LayerSlider/layerslider.php')) {
global $wpdb;
$ls = $wpdb->get_results("\r\n\t\tSELECT id, name, date_c\r\n\t\tFROM " . $wpdb->prefix . "layerslider\r\n\t\tWHERE flag_hidden = '0' AND flag_deleted = '0'\r\n\t\tORDER BY date_c ASC LIMIT 999\r\n\t\t");
$layer_sliders = array();
if ($ls) {
foreach ($ls as $slider) {
$sliderAllShortcodeIds[] = "aaaaalayer_slider_settings_" . $slider->id;
}
}
}
//sort slider ids
sort($sliderAllShortcodeIds);
$data = array('img_url' => get_template_directory_uri() . "/images/", 'admin_img_url' => get_template_directory_uri() . "/admin/images/", 'sidebar_label' => __('Sidebar', 'medicenter'), 'slider_label' => __('Main Slider', 'medicenter'), 'sidebars' => $sidebars, 'theme_sidebars' => $theme_sidebars, 'page_sidebars' => get_post_meta(get_the_ID(), "medicenter_page_sidebars", true), 'theme_sliders' => $sliderAllShortcodeIds, 'main_slider' => get_post_meta(get_the_ID(), "main_slider", true));
//pass data to javascript
$params = array('l10n_print_after' => 'config = ' . json_encode($data) . ';');
wp_localize_script("theme-admin", "config", $params);
}
示例14: _wpcom_vip_maybe_clear_alloptions_cache
/**
* Fix a race condition in alloptions caching
*
* See https://core.trac.wordpress.org/ticket/31245
*/
function _wpcom_vip_maybe_clear_alloptions_cache($option)
{
if (!wp_installing()) {
$alloptions = wp_load_alloptions();
//alloptions should be cached at this point
if (isset($alloptions[$option])) {
//only if option is among alloptions
wp_cache_delete('alloptions', 'options');
}
}
}
示例15: all
/**
* Returns all options
*
* @param string $prefix
* @return array
*/
public function all($prefix)
{
$options = wp_load_alloptions();
$pluginOptions = array();
foreach ($options as $key => $value) {
if (substr($key, 0, $length = strlen($prefix)) === $prefix) {
$pluginOptions[substr($key, $length)] = $value;
}
}
return $pluginOptions;
}