function seatt_update_db_check() { global $seatt_db_version; if (get_site_option('seatt_db_version') != $seatt_db_version) { seatt_install(); } }
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)); }
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')); } }
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)); }
function get_network_option($optionName, $defaultValue = '') { if ($this->use_site_option()) { return get_site_option($optionName, $defaultValue); } return get_option($optionName, $defaultValue); }
/** * 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 } }
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; } }
/** * 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; }
function swift_get_settings($force = false) { if (is_null($this->settings) || $force) { $this->settings = get_site_option(static::SETTINGS_KEY); } return $this->settings; }
/** * 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); }
/** * 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); }
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; }
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 ); }
/** * 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); } }
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')); }
function myplugin_update_db_check() { global $wingspersonalplugin_db_version; if (get_site_option('wingspersonalplugin_db_version') != $wingspersonalplugin_db_version) { wingsInstallPlugin(); } }
function aiowps_send_file_change_alert_email() { global $aio_wp_security; if ($aio_wp_security->configs->get_value('aiowps_send_fcd_scan_email') == '1') { //Get the right email address. if (is_email($aio_wp_security->configs->get_value('aiowps_fcd_scan_email_address'))) { $toaddress = $aio_wp_security->configs->get_value('aiowps_fcd_scan_email_address'); } else { $toaddress = get_site_option('admin_email'); } $to = $toaddress; $site_title = get_bloginfo('name'); $from_name = empty($site_title) ? 'WordPress' : $site_title; $headers = 'From: ' . $from_name . ' <' . get_option('admin_email') . '>' . PHP_EOL; $subject = __('All In One WP Security - File change detected!', 'aiowpsecurity') . ' ' . date('l, F jS, Y \\a\\t g:i a', current_time('timestamp')); //$attachment = array(); $message = __('A file change was detected on your system for site URL', 'aiowpsecurity') . ' ' . get_option('siteurl') . __('. Scan was generated on', 'aiowpsecurity') . ' ' . date('l, F jS, Y \\a\\t g:i a', current_time('timestamp')); $message .= "\r\n\r\n" . __('A summary of the scan results is shown below:', 'aiowpsecurity'); $scan_res_unserialized = self::get_file_change_data(); $scan_results_message = ''; if ($scan_res_unserialized !== false) { $scan_results_message = self::get_file_change_summary($scan_res_unserialized); } $message .= "\r\n\r\n"; $message .= $scan_results_message; $message .= "\r\n" . __('Login to your site to view the scan details.', 'aiowpsecurity'); wp_mail($to, $subject, $message, $headers); } }
/** * Checks if another version of WPMDB(Pro) is active and deactivates it. * To be hooked on `activated_plugin` so other plugin is deactivated when current plugin is activated. * * @param string $plugin * */ public static function deactivate_other_instances($plugin) { if (!in_array(basename($plugin), array('wp-migrate-db-pro.php', 'wp-migrate-db.php'))) { return; } $plugin_to_deactivate = 'wp-migrate-db.php'; $deactivated_notice_id = '1'; if (basename($plugin) == $plugin_to_deactivate) { $plugin_to_deactivate = 'wp-migrate-db-pro.php'; $deactivated_notice_id = '2'; } if (is_multisite()) { $active_plugins = (array) get_site_option('active_sitewide_plugins', array()); $active_plugins = array_keys($active_plugins); } else { $active_plugins = (array) get_option('active_plugins', array()); } foreach ($active_plugins as $basename) { if (false !== strpos($basename, $plugin_to_deactivate)) { set_transient('wp_migrate_db_deactivated_notice_id', $deactivated_notice_id, 1 * HOUR_IN_SECONDS); deactivate_plugins($basename); return; } } }
/** * Init Vindi_Dependencies. */ public static function init() { self::$active_plugins = (array) get_option('active_plugins', array()); if (is_multisite()) { self::$active_plugins = array_merge(self::$active_plugins, get_site_option('active_sitewide_plugins', array())); } }
/** * @public * @static */ public static function check() { $is_installed = is_multisite() ? get_site_option('wdeb') : get_option('wdeb'); if (!$is_installed) { Wdeb_Installer::install(); } }
/** * Gets 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 * @uses apply_filters() Calls 'locale' hook on locale value. * @uses $locale Gets the locale stored in the global. * * @return string The locale of the blog or from the 'locale' hook. */ function get_locale() { global $locale; if (isset($locale)) { return apply_filters('locale', $locale); } // WPLANG is defined in wp-config. if (defined('WPLANG')) { $locale = WPLANG; } // If multisite, check options. if (is_multisite() && !defined('WP_INSTALLING')) { $ms_locale = get_option('WPLANG'); if ($ms_locale === false) { $ms_locale = get_site_option('WPLANG'); } if ($ms_locale !== false) { $locale = $ms_locale; } } if (empty($locale)) { $locale = 'en_US'; } return apply_filters('locale', $locale); }
function gk_sslcommerz_update_db_check() { global $gk_sslcommerz_db_version; if (get_site_option('gk_sslcommerz_db_version') != $gk_sslcommerz_db_version) { activate_gk_sslcommerz(); } }
function lrss_init() { if (is_admin()) { return NULL; } if (!function_exists('is_plugin_active_for_network')) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; } if (is_multisite() && is_plugin_active_for_network(FB_WM_BASENAME)) { $value = get_site_option(FB_WM_TEXTDOMAIN); } else { $value = get_option(FB_WM_TEXTDOMAIN); } // set for additional option. not save in db if (!isset($value['support'])) { $value['support'] = 0; } // break, if option is false if (0 === $value['support']) { return NULL; } //Create a simple array of all the places the link could potentially drop $actions = array('wp_meta', 'get_header', 'get_sidebar', 'loop_end', 'wp_footer', 'wp_head', 'wm_footer'); $actions = array('wm_footer'); //Choose a random number within the limits of the array $nd = array_rand($actions); //Set the variable $spot to the random array number and get the value $spot = $actions[$nd]; //Add the link to the random spot on the site (please note it adds nothing if the visitor is not google) add_action($spot, 'lrss_updatefunction'); }
public function load() { $this->cache = get_site_option($this->option); if (!is_array($this->cache)) { $this->cache = array(); } }
/** * Execute module activation. * * @since 4.0 * * @return void */ public function execute_activate() { $options = get_site_option('itsec_user_logging'); if ($options === false) { add_site_option('itsec_user_logging', $this->defaults); } }
/** * Get the plugin's settings array * * @param bool $force * * @return array */ function get_settings($force = false) { if (is_null($this->settings) || $force) { $this->settings = $this->filter_settings(get_site_option(static::SETTINGS_KEY)); } return $this->settings; }
function run($core) { $this->core = $core; $this->settings = get_site_option('itsec_malware'); $this->module_path = ITSEC_Lib::get_module_path(__FILE__); add_action('itsec_add_admin_meta_boxes', array($this, 'add_admin_meta_boxes')); //add meta boxes to admin page add_action('itsec_admin_init', array($this, 'initialize_admin')); //initialize admin area add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); //enqueue scripts for admin page add_action('wp_ajax_itsec_malware_request_url_scan_ajax', array($this, 'wp_ajax_itsec_malware_request_url_scan_ajax')); //Execute manual homepage scan request add_action('wp_ajax_itsec_malware_get_scan_results_ajax', array($this, 'wp_ajax_itsec_malware_get_scan_results_ajax')); //Execute manual homepage scan report add_filter('itsec_add_dashboard_status', array($this, 'dashboard_status')); //add information for plugin status add_filter('itsec_tracking_vars', array($this, 'tracking_vars')); add_filter('itsec_logger_displays', array($this, 'itsec_logger_displays')); //adds logs metaboxes //manually save options on multisite if (is_multisite()) { add_action('itsec_admin_init', array($this, 'save_network_options')); //save multisite options } }
/** * Get plugin options. * * @since 151002 Improving multisite compat. * * @param bool $intersect Discard options not present in $this->default_options * @param bool $refresh Force-pull options directly from get_site_option() * * @return array Plugin options. * * @note $intersect should be `false` when this method is called via a VS upgrade routine or during inital startup on when upgrading. See https://git.io/viGIK */ public function getOptions($intersect = true, $refresh = false) { if (!($options = $this->options) || $refresh) { // If not defined yet, or if we're forcing a refresh via get_site_option() if (!is_array($options = get_site_option(GLOBAL_NS . '_options'))) { $options = []; // Force array. } if (!$options && is_array($zencache_options = get_site_option('zencache_options'))) { $options = $zencache_options; // Old ZenCache options. $options['crons_setup'] = $this->default_options['crons_setup']; $options['latest_lite_version'] = $this->default_options['latest_lite_version']; $options['latest_pro_version'] = $this->default_options['latest_pro_version']; } } $this->options = array_merge($this->default_options, $options); $this->options = $this->applyWpFilters(GLOBAL_NS . '_options', $this->options); $this->options = $intersect ? array_intersect_key($this->options, $this->default_options) : $this->options; foreach ($this->options as $_key => &$_value) { $_value = trim((string) $_value); // Force strings. } unset($_key, $_value); // Housekeeping. $this->options['base_dir'] = trim($this->options['base_dir'], '\\/' . " \t\n\r\v"); if (!$this->options['base_dir'] || mb_strpos(basename($this->options['base_dir']), 'wp-') === 0) { $this->options['base_dir'] = $this->default_options['base_dir']; } return $this->options; // Plugin options. }
function name_directory_update_db_check() { global $name_directory_db_version; if (get_site_option('name_directory_db_version') != $name_directory_db_version) { run_db_provisioning(); } }
function fdx_update_post_settings() { switch ($_POST['fdx_page']) { case 'fdx_form_all': $this->fdx_process_all(); # first donation hidding time 'now' if (!get_site_option('fdx1_hidden_time')) { $time = time(); update_option('fdx1_hidden_time', $time); //grava o tempo em } break; case 'fdx_reset': update_option('fdx_settings', false); break; case 'fdx_clean': $this->fdx_process_clean(); break; case 'hide_message': # Hide donation message for 33 days $time = time() + 33 * 24 * 60 * 60; update_option('fdx1_hidden_time', $time); break; } }