本文整理汇总了PHP中get_site_option函数的典型用法代码示例。如果您正苦于以下问题:PHP get_site_option函数的具体用法?PHP get_site_option怎么用?PHP get_site_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_site_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: seatt_update_db_check
function seatt_update_db_check()
{
global $seatt_db_version;
if (get_site_option('seatt_db_version') != $seatt_db_version) {
seatt_install();
}
}
示例2: bp_wire_posts_template
function bp_wire_posts_template($item_id, $component_slug, $can_post, $per_page, $max)
{
global $bp;
if ($bp->current_component == $bp->wire->slug) {
$this->table_name = $bp->profile->table_name_wire;
// If the user is viewing their own wire, delete the notifications.
if ('all-posts' == $bp->current_action && bp_is_home()) {
bp_core_delete_notifications_for_user_by_type($bp->loggedin_user->id, 'xprofile', 'new_wire_post');
}
} else {
$this->table_name = $bp->{$component_slug}->table_name_wire;
}
$this->pag_page = isset($_REQUEST['wpage']) ? intval($_REQUEST['wpage']) : 1;
$this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
$this->wire_posts = BP_Wire_Post::get_all_for_item($item_id, $this->table_name, $this->pag_page, $this->pag_num);
$this->total_wire_post_count = (int) $this->wire_posts['count'];
$this->wire_posts = $this->wire_posts['wire_posts'];
$this->wire_post_count = count($this->wire_posts);
if ((int) get_site_option('non-friend-wire-posting') && ($bp->current_component == $bp->profile->slug || $bp->current_component == $bp->wire->slug)) {
$this->can_post = 1;
} else {
$this->can_post = $can_post;
}
$this->pag_links = paginate_links(array('base' => add_query_arg('wpage', '%#%', $bp->displayed_user->domain), 'format' => '', 'total' => ceil($this->total_wire_post_count / $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '«', 'next_text' => '»', 'mid_size' => 1));
}
示例3: _initHooks
protected function _initHooks()
{
add_action('admin_init', array($this, 'admin_init'), 20);
add_action('admin_menu', array($this, 'admin_menu'));
add_action('network_admin_menu', array($this, 'network_admin_menu'));
add_action('admin_head', array($this, 'admin_head'));
add_action('wp_dashboard_setup', array($this, 'dashboard_setup'));
add_action('wp_ajax_better-analytics_heatmaps', array($this, 'display_page'));
add_action('wp_ajax_better-analytics_area_charts', array($this, 'display_page'));
add_action('wp_ajax_better-analytics_monitor', array($this, 'display_page'));
add_action('wp_ajax_better-analytics_events', array($this, 'display_page'));
add_action('wp_ajax_better-analytics_charts', array($this, 'display_charts'));
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
add_filter('wp_redirect', array($this, 'filter_redirect'));
add_filter('admin_footer_text', array($this, 'admin_footer_text'));
add_filter('all_plugins', array($this, 'all_plugins'));
add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
add_filter('wpmu_options', array($this, 'show_network_settings'));
add_action('update_wpmu_options', array($this, 'save_network_settings'));
add_filter('removable_query_args', array($this, 'removable_query_args'));
$betterAnalyticsOptions = get_option('better_analytics');
if (!$betterAnalyticsOptions['property_id']) {
add_action('admin_notices', array($this, 'not_configured'));
}
if (!get_site_option('ba_site_tokens') && !get_option('ba_tokens')) {
add_action('admin_notices', array($this, 'cant_auto_configure'));
} elseif (!$betterAnalyticsOptions['api']['profile']) {
add_action('admin_notices', array($this, 'can_auto_configure'));
}
if (get_transient('ba_last_error')) {
add_action('admin_notices', array($this, 'last_error'));
}
}
示例4: test_get_doesnt_cache_default_value
function test_get_doesnt_cache_default_value()
{
$option = rand_str();
$default = 'a default';
$this->assertEquals(get_site_option($option, $default), $default);
$this->assertFalse(get_site_option($option));
}
示例5: get_network_option
function get_network_option($optionName, $defaultValue = '')
{
if ($this->use_site_option()) {
return get_site_option($optionName, $defaultValue);
}
return get_option($optionName, $defaultValue);
}
示例6: run
/**
* Setup the module's administrative functionality
*
* Loads the database backup module's privileged functionality including
* settings fields.
*
* @since 4.0.0
*
* @param ITSEC_Core $core The core plugin instance
*
* @return void
*/
function run($core)
{
$this->core = $core;
$this->settings = get_site_option('itsec_backup');
$this->module_path = ITSEC_Lib::get_module_path(__FILE__);
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
//enqueue scripts for admin page
add_action('itsec_add_admin_meta_boxes', array($this, 'itsec_add_admin_meta_boxes'));
//add meta boxes to admin page
add_action('itsec_admin_init', array($this, 'itsec_admin_init'));
//initialize admin area
add_filter('itsec_add_dashboard_status', array($this, 'itsec_add_dashboard_status'));
//add information for plugin status
add_filter('itsec_tooltip_modules', array($this, 'itsec_tooltip_modules'));
//register tooltip action
add_filter('itsec_tracking_vars', array($this, 'itsec_tracking_vars'));
if (isset($_POST['itsec_backup']) && $_POST['itsec_backup'] == 'one_time_backup') {
add_action('itsec_admin_init', array($this, 'one_time_backup'));
}
//manually save options on multisite
if (is_multisite()) {
add_action('itsec_admin_init', array($this, 'itsec_admin_init_multisite'));
//save multisite options
}
}
示例7: _getOption
protected function _getOption($option)
{
switch ($option) {
case 'apiClientId':
$betterAnalyticsSiteOptions = get_site_option('better_analytics_site');
$betterAnalyticsOptions = get_option('better_analytics');
if (!empty($betterAnalyticsSiteOptions['api']['use_own'])) {
return @$betterAnalyticsSiteOptions['api']['client_id'];
} elseif (!empty($betterAnalyticsOptions['api']['use_own'])) {
return @$betterAnalyticsOptions['api']['client_id'];
} else {
return $this->_credentials['client_id'];
}
case 'apiClientSecret':
$betterAnalyticsSiteOptions = get_site_option('better_analytics_site');
$betterAnalyticsOptions = get_option('better_analytics');
if (!empty($betterAnalyticsSiteOptions['api']['use_own'])) {
return @$betterAnalyticsSiteOptions['api']['client_secret'];
} elseif (!empty($betterAnalyticsOptions['api']['use_own'])) {
return @$betterAnalyticsOptions['api']['client_secret'];
} else {
return $this->_credentials['client_secret'];
}
case 'apiProfile':
$betterAnalyticsOptions = get_option('better_analytics');
return @$betterAnalyticsOptions['api']['profile'];
case 'tokens':
return @json_decode(DigitalPointBetterAnalytics_Base_Public::getInstance()->getTokens());
case 'internalV':
$betterAnalyticsOptions = get_transient('ba_int');
return @$betterAnalyticsOptions['v'];
default:
return false;
}
}
示例8: get_themes
/**
* Return a filtered list of themes
*
* @since 1.0
* @return array
*/
public function get_themes()
{
$default_themes = $this->default_themes();
if ($saved_themes = get_site_option("megamenu_themes")) {
foreach ($default_themes as $key => $settings) {
if ($key != 'default') {
$default_themes[$key] = array_merge($default_themes['default'], $default_themes[$key]);
}
// Merge in any custom modifications to default themes
if (isset($saved_themes[$key])) {
$default_themes[$key] = array_merge($default_themes[$key], $saved_themes[$key]);
unset($saved_themes[$key]);
}
}
foreach ($saved_themes as $key => $settings) {
// Add in saved themes, ensuring they always have a placeholder for any new settings
// which have since been added to the default theme.
$default_themes[$key] = array_merge($default_themes['default'], $settings);
}
}
// process replacements
foreach ($default_themes as $key => $settings) {
foreach ($settings as $var => $val) {
if (isset($default_themes[$key][$val])) {
$default_themes[$key][$var] = $default_themes[$key][$val];
}
}
}
uasort($default_themes, array($this, 'sort_by_title'));
return $default_themes;
}
示例9: swift_get_settings
function swift_get_settings($force = false)
{
if (is_null($this->settings) || $force) {
$this->settings = get_site_option(static::SETTINGS_KEY);
}
return $this->settings;
}
示例10: get_locale
/**
* Get the current locale.
*
* If the locale is set, then it will filter the locale in the 'locale' filter
* hook and return the value.
*
* If the locale is not set already, then the WPLANG constant is used if it is
* defined. Then it is filtered through the 'locale' filter hook and the value
* for the locale global set and the locale is returned.
*
* The process to get the locale should only be done once, but the locale will
* always be filtered using the 'locale' hook.
*
* @since 1.5.0
*
* @return string The locale of the blog or from the 'locale' hook.
*/
function get_locale()
{
global $locale;
if (isset($locale)) {
/**
* Filter WordPress install's locale ID.
*
* @since 1.5.0
*
* @param string $locale The locale ID.
*/
return apply_filters('locale', $locale);
}
// WPLANG is defined in wp-config.
if (defined('WPLANG')) {
$locale = WPLANG;
}
// If multisite, check options.
if (is_multisite()) {
// Don't check blog option when installing.
if (defined('WP_INSTALLING') || false === ($ms_locale = get_option('WPLANG'))) {
$ms_locale = get_site_option('WPLANG');
}
if ($ms_locale !== false) {
$locale = $ms_locale;
}
}
if (empty($locale)) {
$locale = 'en_US';
}
/** This filter is documented in wp-includes/l10n.php */
return apply_filters('locale', $locale);
}
示例11: __construct
/**
* Set up the API module.
*
* @since 4.0.0
* @internal
*/
public function __construct()
{
if (WPMUDEV_CUSTOM_API_SERVER) {
$this->server_root = trailingslashit(WPMUDEV_CUSTOM_API_SERVER);
}
$this->server_url = $this->server_root . $this->rest_api;
if (defined('WPMUDEV_APIKEY') && WPMUDEV_APIKEY) {
$this->api_key = WPMUDEV_APIKEY;
} else {
// If 'clear_key' is present in URL then do not load the key from DB.
$this->api_key = get_site_option('wpmudev_apikey');
}
// Schedule automatic data update on the main site of the network.
if (is_main_site()) {
if (!wp_next_scheduled('wpmudev_scheduled_jobs')) {
wp_schedule_event(time(), 'twicedaily', 'wpmudev_scheduled_jobs');
}
add_action('wpmudev_scheduled_jobs', array($this, 'refresh_membership_data'));
} elseif (wp_next_scheduled('wpmudev_scheduled_jobs')) {
// In case the cron job was already installed in a sub-site...
wp_clear_scheduled_hook('wpmudev_scheduled_jobs');
}
/**
* Run custom initialization code for the API module.
*
* @since 4.0.0
* @var WPMUDEV_Dashboard_Api The dashboards API module.
*/
do_action('wpmudev_dashboard_api_init', $this);
}
示例12: the_data
private function the_data()
{
$usage = get_site_option('wpe_upload_space_usage');
$ttl = get_site_option('wpe_upload_space_usage_ttl');
// If TTL is more then interval from now, it's bogus, so kill it.
if ($ttl > time() + self::CACHE_TTL) {
$ttl = false;
}
// If have from cache and it's within TTL, then do nothing else.
// If TTL has not expired, leave
if ($ttl && $ttl >= time()) {
return $usage;
}
// Get the value and save it in the cache
$usage_remote = $this->from_remote();
$expire = time() + self::CACHE_TTL;
// If did not have an initial value
if (false === $usage) {
add_site_option('wpe_upload_space_usage', $usage_remote);
add_site_option('wpe_upload_space_usage_ttl', $expire);
} else {
update_site_option('wpe_upload_space_usage', $usage_remote);
update_site_option('wpe_upload_space_usage_ttl', $expire);
}
return $usage_remote;
}
示例13: undismiss_core_update
function undismiss_core_update( $version, $locale ) {
$dismissed = get_site_option( 'dismissed_update_core' );
$key = $version.'|'.$locale;
if ( !isset( $dismissed[$key] ) ) return false;
unset( $dismissed[$key] );
return update_site_option( 'dismissed_update_core', $dismissed );
}
示例14: execute_activate
/**
* Execute module activation.
*
* @since 4.0
*
* @return void
*/
public function execute_activate()
{
$options = get_site_option('itsec_password');
if ($options === false) {
add_site_option('itsec_password', $this->defaults);
}
}
示例15: run
function run()
{
$this->settings = get_site_option('itsec_four_oh_four');
add_filter('itsec_lockout_modules', array($this, 'register_lockout'));
add_filter('itsec_logger_modules', array($this, 'register_logger'));
add_action('wp_head', array($this, 'check_404'));
}