function wppb_check_email_value($message, $field, $request_data, $form_location) { global $wpdb; if (isset($request_data['email']) && trim($request_data['email']) == '' && $field['required'] == 'Yes') { return wppb_required_field_error($field["field-title"]); } if (isset($request_data['email']) && !is_email(trim($request_data['email']))) { return __('The email you entered is not a valid email address.', 'profilebuilder'); } if (is_multisite() || !is_multisite() && (isset($wppb_generalSettings['emailConfirmation']) && $wppb_generalSettings['emailConfirmation'] == 'yes')) { $user_signup = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "signups WHERE user_email = %s", $request_data['email'])); if (!empty($user_signup)) { return __('This email is already reserved to be used soon.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder'); } } $users = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_email = %s", $request_data['email'])); if (!empty($users)) { if ($form_location == 'register') { return __('This email is already in use.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder'); } if ($form_location == 'edit_profile') { $current_user = wp_get_current_user(); foreach ($users as $user) { if ($user->ID != $current_user->ID) { return __('This email is already in use.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder'); } } } } return $message; }
/** * This function used to install required tables in the database on time of activation. * @author Flipper Code <*****@*****.**> * @version 1.0.0 * @package Maps */ function wpgmp_network_propagate($network_wide) { if (is_multisite() && $network_wide) { // See if being activated on the entire network or one blog global $wpdb; // Get this so we can switch back to it later $currentblog = $wpdb->blogid; // For storing the list of activated blogs $activated = array(); // Get all blogs in the network and activate plugin on each one $sql = "SELECT blog_id FROM {$wpdb->blogs}"; $blog_ids = $wpdb->get_col($wpdb->prepare($sql, null)); foreach ($blog_ids as $blog_id) { switch_to_blog($blog_id); wpgmp_activation(); } // Switch back to the current blog switch_to_blog($currentblog); // Store the array for a later function update_site_option('wpgmp_activated', $activated); } else { // Running on a single blog wpgmp_activation(); } }
/** * Show a form where users can enter their license key * Takes Multisites into account * * @param bool $embedded * @return null */ public function show_license_form($embedded = true) { // For non-multisites, always show the license form if (!is_multisite()) { parent::show_license_form($embedded); return; } // Plugin is network activated if ($this->is_network_activated) { // We're on the network admin if (is_network_admin()) { parent::show_license_form($embedded); } else { // We're not in the network admin area, show a notice parent::show_license_form_heading(); if (is_super_admin()) { echo "<p>" . sprintf(__('%s is network activated, you can manage your license in the <a href="%s">network admin license page</a>.', $this->product->get_text_domain()), $this->product->get_item_name(), $this->product->get_license_page_url()) . "</p>"; } else { echo "<p>" . sprintf(__('%s is network activated, please contact your site administrator to manage the license.', $this->product->get_text_domain()), $this->product->get_item_name()) . "</p>"; } } } else { if (false == is_network_admin()) { parent::show_license_form($embedded); } } }
function wppa_delete_from_cloudinary($id) { $prefix = is_multisite() && !WPPA_MULTISITE_GLOBAL ? $blog_id . '-' : ''; $pub_id = $prefix . $id; $args = array("invalidate" => true); \Cloudinary\Uploader::destroy($pub_id, $args); }
function run() { $this->settings = get_site_option('itsec_hide_backend'); //Execute module functions on frontend init if ($this->settings['enabled'] === true) { $jetpack_active_modules = get_option('jetpack_active_modules'); if (is_multisite() && function_exists('is_plugin_active_for_network')) { //see if Jetpack is active $is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array())) || is_plugin_active_for_network('jetpack/jetpack.php'); } else { $is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array())); } if (!($is_jetpack_active === true && is_array($jetpack_active_modules) && in_array('json-api', $jetpack_active_modules) && isset($_GET['action']) && $_GET['action'] == 'jetpack_json_api_authorization')) { $this->auth_cookie_expired = false; add_action('auth_cookie_expired', array($this, 'auth_cookie_expired')); add_action('init', array($this, 'execute_hide_backend'), 1000); add_action('login_init', array($this, 'execute_hide_backend_login')); add_action('plugins_loaded', array($this, 'plugins_loaded'), 11); add_filter('body_class', array($this, 'remove_admin_bar')); add_filter('loginout', array($this, 'filter_loginout')); add_filter('wp_redirect', array($this, 'filter_login_url'), 10, 2); add_filter('lostpassword_url', array($this, 'filter_login_url'), 10, 2); add_filter('site_url', array($this, 'filter_login_url'), 10, 2); add_filter('retrieve_password_message', array($this, 'retrieve_password_message')); add_filter('comment_moderation_text', array($this, 'comment_moderation_text')); remove_action('template_redirect', 'wp_redirect_admin_locations', 1000); } } }
public static function getNotWebCachePath() { if (is_multisite()) { return self::getBasePath() . '/cache/nextend/notweb' . get_current_blog_id(); } return self::getBasePath() . '/cache/nextend/notweb'; }
/** * Class constructor */ function __construct() { $this->options = WPSEO_Options::get_all(); if (is_multisite()) { WPSEO_Options::maybe_set_multisite_defaults(false); } if ($this->options['stripcategorybase'] === true) { add_action('created_category', array($this, 'schedule_rewrite_flush')); add_action('edited_category', array($this, 'schedule_rewrite_flush')); add_action('delete_category', array($this, 'schedule_rewrite_flush')); } $this->page_gsc = new WPSEO_GSC(); $this->dashboard_widget = new Yoast_Dashboard_Widget(); // Needs the lower than default priority so other plugins can hook underneath it without issue. add_action('admin_menu', array($this, 'register_settings_page'), 5); add_action('network_admin_menu', array($this, 'register_network_settings_page')); add_filter('plugin_action_links_' . WPSEO_BASENAME, array($this, 'add_action_link'), 10, 2); add_action('admin_enqueue_scripts', array($this, 'config_page_scripts')); if ('0' == get_option('blog_public')) { add_action('admin_footer', array($this, 'blog_public_warning')); } if ((isset($this->options['theme_has_description']) && $this->options['theme_has_description'] === true || $this->options['theme_description_found'] !== '') && $this->options['ignore_meta_description_warning'] !== true) { add_action('admin_footer', array($this, 'meta_description_warning')); } if ($this->options['cleanslugs'] === true) { add_filter('name_save_pre', array($this, 'remove_stopwords_from_slug'), 0); } add_filter('user_contactmethods', array($this, 'update_contactmethods'), 10, 1); add_action('after_switch_theme', array($this, 'switch_theme')); add_action('switch_theme', array($this, 'switch_theme')); add_filter('set-screen-option', array($this, 'save_bulk_edit_options'), 10, 3); add_action('admin_init', array('WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts'), 10, 1); add_action('admin_init', array($this, 'import_plugin_hooks')); WPSEO_Utils::register_cache_clear_option('wpseo', ''); }
public function process() { $conds = apply_filters('qm/collect/conditionals', array('is_404', 'is_admin', 'is_archive', 'is_attachment', 'is_author', 'is_blog_admin', 'is_category', 'is_comment_feed', 'is_customize_preview', 'is_date', 'is_day', 'is_embed', 'is_feed', 'is_front_page', 'is_home', 'is_main_network', 'is_main_site', 'is_month', 'is_network_admin', 'is_page', 'is_page_template', 'is_paged', 'is_post_type_archive', 'is_preview', 'is_robots', 'is_rtl', 'is_search', 'is_single', 'is_singular', 'is_ssl', 'is_sticky', 'is_tag', 'is_tax', 'is_time', 'is_trackback', 'is_user_admin', 'is_year')); $conds = apply_filters('query_monitor_conditionals', $conds); $true = $false = $na = array(); foreach ($conds as $cond) { if (function_exists($cond)) { if ('is_sticky' === $cond and !get_post($id = null)) { # Special case for is_sticky to prevent PHP notices $false[] = $cond; } else { if (!is_multisite() and in_array($cond, array('is_main_network', 'is_main_site'))) { # Special case for multisite conditionals to prevent them from being annoying on single site installs $na[] = $cond; } else { if (call_user_func($cond)) { $true[] = $cond; } else { $false[] = $cond; } } } } else { $na[] = $cond; } } $this->data['conds'] = compact('true', 'false', 'na'); }
public function log($connector, $message, $args, $object_id, $contexts, $user_id = null) { global $wpdb; if (is_null($user_id)) { $user_id = get_current_user_id(); } require_once MAINWP_WP_STREAM_INC_DIR . 'class-wp-stream-author.php'; $user = new WP_User($user_id); $roles = get_option($wpdb->get_blog_prefix() . 'user_roles'); if (!isset($args['author_meta'])) { $args['author_meta'] = array('user_email' => $user->user_email, 'display_name' => defined('WP_CLI') && empty($user->display_name) ? 'WP-CLI' : $user->display_name, 'user_login' => $user->user_login, 'user_role_label' => !empty($user->roles) ? $roles[$user->roles[0]]['name'] : null, 'agent' => MainWP_WP_Stream_Author::get_current_agent()); if (defined('WP_CLI') && function_exists('posix_getuid')) { $uid = posix_getuid(); $user_info = posix_getpwuid($uid); $args['author_meta']['system_user_id'] = $uid; $args['author_meta']['system_user_name'] = $user_info['name']; } } // Remove meta with null values from being logged $meta = array_filter($args, function ($var) { return !is_null($var); }); $recordarr = array('object_id' => $object_id, 'site_id' => is_multisite() ? get_current_site()->id : 1, 'blog_id' => apply_filters('blog_id_logged', is_network_admin() ? 0 : get_current_blog_id()), 'author' => $user_id, 'author_role' => !empty($user->roles) ? $user->roles[0] : null, 'created' => current_time('mysql', 1), 'summary' => vsprintf($message, $args), 'parent' => self::$instance->prev_record, 'connector' => $connector, 'contexts' => $contexts, 'meta' => $meta, 'ip' => mainwp_wp_stream_filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP)); $record_id = MainWP_WP_Stream_DB::get_instance()->insert($recordarr); return $record_id; }
/** * Filter the raw post content and replace any images that are "local" with cloudinary images */ static function convert_the_content_images_to_cloudinary_pull_request($content) { if (!in_the_loop()) { return $content; } //setup account name for use with get_cdn_prefix() $account = static::get_option_value('cloud_name'); //if there is no account set, do not continue if (empty($account)) { return $content; } //prepare new values for use in string replacements $cdn_fetch_prefix_no_protocal = static::get_cdn_prefix($account); $site_url = get_bloginfo('url'); $site_url_no_protocal = preg_replace('/http[s]?:\\/\\//', '', $site_url); $cdn_content = $content; //prepare for multisite, switch location of images to actual source if (is_multisite()) { global $blog_id; //fix rewrite urls to go directly to the file within the multisite subfolder $cdn_content = str_replace($site_url . '/files/', $site_url . '/wp-content/blogs.dir/' . $blog_id . '/files/', $cdn_content); } //move any images that match the site source to pull them from the cdn $cdn_fetch_options = static::get_cdn_options(); $cdn_content = preg_replace_callback("/<img(.*)src=\"(http:|https:)?\\/\\/(" . $site_url_no_protocal . ")(\\/.*\\/)((.*-(\\d{3})x(\\d{3}))|.*)?(\\.[a-zA-Z]{3,4}\")([^>]+>)/im", array(get_called_class(), 'callback_convert_image_source_to_cdn_url'), $cdn_content); //if preg replace function worked correctly, use the new CDN content if (!empty($cdn_content)) { return $cdn_content; } //otherwise return the regular content return $content; }
/** * Handles the Shortcode for: `[s2Get /]`. * * @package s2Member\s2Get * @since 3.5 * * @attaches-to ``add_shortcode("s2Get");`` * * @param array $attr An array of Attributes. * @param string $content Content inside the Shortcode. * @param string $shortcode The actual Shortcode name itself. * @return mixed Value of the requested data, or null on failure. * * @todo Prevent this routine from potentially returning objects/arrays? */ public static function sc_get_details($attr = FALSE, $content = FALSE, $shortcode = FALSE) { foreach (array_keys(get_defined_vars()) as $__v) { $__refs[$__v] =& ${$__v}; } do_action("ws_plugin__s2member_before_sc_get_details", get_defined_vars()); unset($__refs, $__v); $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr); // Force array; trim quote entities. $attr = shortcode_atts(array("constant" => "", "user_field" => "", "user_option" => "", "user_id" => ""), $attr); foreach (array_keys(get_defined_vars()) as $__v) { $__refs[$__v] =& ${$__v}; } do_action("ws_plugin__s2member_before_sc_get_details_after_shortcode_atts", get_defined_vars()); unset($__refs, $__v); if ($attr["constant"] && defined($attr["constant"])) { if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() || preg_match("/^S2MEMBER_/i", $attr["constant"])) { $get = constant($attr["constant"]); } } else { if ($attr["user_field"] && (is_user_logged_in() || $attr["user_id"])) { $get = c_ws_plugin__s2member_utils_users::get_user_field($attr["user_field"], (int) $attr["user_id"]); } else { if ($attr["user_option"] && (is_user_logged_in() || $attr["user_id"])) { $get = get_user_option($attr["user_option"], (int) $attr["user_id"]); } } } return apply_filters("ws_plugin__s2member_sc_get_details", isset($get) ? $get : null, get_defined_vars()); }
public function initialize() { $this->user = new stdClass(); if (is_user_logged_in()) { /* Populate settings we need for the menu based on the current user. */ $this->user->blogs = get_blogs_of_user(get_current_user_id()); if (is_multisite()) { $this->user->active_blog = get_active_blog_for_user(get_current_user_id()); $this->user->domain = empty($this->user->active_blog) ? user_admin_url() : trailingslashit(get_home_url($this->user->active_blog->blog_id)); $this->user->account_domain = $this->user->domain; } else { $this->user->active_blog = $this->user->blogs[get_current_blog_id()]; $this->user->domain = trailingslashit(home_url()); $this->user->account_domain = $this->user->domain; } } add_action('wp_head', 'wp_admin_bar_header'); add_action('admin_head', 'wp_admin_bar_header'); if (current_theme_supports('admin-bar')) { $admin_bar_args = get_theme_support('admin-bar'); // add_theme_support( 'admin-bar', array( 'callback' => '__return_false') ); $header_callback = $admin_bar_args[0]['callback']; } if (empty($header_callback)) { $header_callback = '_admin_bar_bump_cb'; } add_action('wp_head', $header_callback); wp_enqueue_script('admin-bar'); wp_enqueue_style('admin-bar'); do_action('admin_bar_init'); }
/** * Settings page for plugin * * Display and Process Settings page for this plugin. * */ function jr_mt_settings_page() { echo '<div class="wrap">'; screen_icon('plugins'); echo '<h2>jonradio Multiple Themes</h2>'; // Required because it is only called automatically for Admin Pages in the Settings section settings_errors('jr_mt_settings'); $theme = wp_get_theme()->Name; global $jr_mt_options_cache; ?> <p>This plugin allows you to selectively change the Theme you have selected as your <b>Current Theme</b> in <b>Appearance-Themes</b> on the Admin panels. You can choose from any of the <b>Available Themes</b> listed on the Appearance-Themes Admin panel for: <ul> <li> » All Pages</li> <li> » All Posts</li> <li> » The Site Home</li> <li> » A Specific Page</li> <li> » A Specific Post</li> <li> » Any other non-Admin page that has its own Permalink; for example, a specific Archive or Category page</li> </ul> <?php if (function_exists('is_multisite') && is_multisite()) { echo "In a WordPress Network (AKA Multisite), Themes must be <b>Network Enabled</b> before they will appear as Available Themes on individual sites' Appearance-Themes panel."; } echo '</p>'; echo '<p>'; echo "The Current Theme is <b>{$theme}</b>. You will not normally need to specify it in any of the Settings on this page. The only exception would be if you specify a different Theme for All Pages or All Posts and wish to use the Current Theme for a specific Page, Post or other non-Admin page."; echo '</p>'; echo '<form action="options.php" method="POST">'; // Plugin Settings are displayed and entered here: settings_fields('jr_mt_settings'); do_settings_sections('jr_mt_settings_page'); echo '<p><input name="save" type="submit" value="Save Changes" class="button-primary" /></p></form>'; }
/** * Flash all cache * * @return boolean * * @access public */ public function flashCache() { global $wpdb; //clear visitor's cache first if (is_multisite()) { //get all sites first and iterate through each $query = 'SELECT blog_id FROM ' . $wpdb->blogs; $blog_list = $wpdb->get_results($query); if (is_array($blog_list)) { foreach ($blog_list as $blog) { $query = 'DELETE FROM ' . $wpdb->get_blog_prefix($blog->blog_id) . 'options '; $query .= 'WHERE `option_name` = "aam_visitor_cache"'; $wpdb->query($query); } } } else { $query = 'DELETE FROM ' . $wpdb->options . ' '; $query .= 'WHERE `option_name` = "aam_visitor_cache"'; $wpdb->query($query); } //clear users cache $query = 'DELETE FROM ' . $wpdb->usermeta . ' '; $query .= 'WHERE `meta_key` = "aam_cache"'; $wpdb->query($query); return true; }
function init() { global $cms_nav_ie_ver; $this->plugin_localization(); // Check if WPML is active. If not display warning message and not load CMS Navigation if (!defined('ICL_SITEPRESS_VERSION') || ICL_PLUGIN_INACTIVE) { if (!function_exists('is_multisite') || !is_multisite()) { add_action('admin_notices', array($this, '_no_wpml_warning')); } return false; } elseif (version_compare(ICL_SITEPRESS_VERSION, '2.0.5', '<')) { add_action('admin_notices', array($this, '_old_wpml_warning')); return false; } // Load plugin settings $this->settings = get_option('wpml_cms_nav_settings'); // Use WPML legacy. Read settings from WPML if they exist there. if (empty($this->settings) && defined('ICL_SITEPRESS_VERSION')) { require_once WPML_CMS_NAV_PLUGIN_PATH . '/inc/cms-navigation-schema.php'; wpml_cms_nav_default_settings(); } // Initialize cache $this->cache['offsite_url_cache'] = new wpml_cms_nav_cache('cms_nav_offsite_url', true); // Determine User agent to be used in rendering the menu correctly for IE $cms_nav_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : false; if ($cms_nav_user_agent && preg_match('#MSIE ([0-9]+)\\.[0-9]#', $cms_nav_user_agent, $matches)) { $cms_nav_ie_ver = $matches[1]; } // Setup the WP-Admin resources add_action('admin_init', array($this, 'admin_init')); // Setup the WP-Admin menus add_action('admin_menu', array($this, 'menu')); // Clear cache hook add_action('wp_ajax_wpml_cms_nav_clear_nav_cache', array($this, 'clear_cache')); // Save form(options) hook add_action('wp_ajax_wpml_cms_nav_save_form', array($this, 'save_form')); // theme hooks 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')); // more hooks add_action('save_post', array($this, 'cms_navigation_update_post_settings'), 4, 2); add_action('admin_head', array($this, 'cms_navigation_page_edit_options')); add_action('admin_head', array($this, 'cms_navigation_js')); // offsite urls hooks add_filter('page_link', array($this, 'rewrite_page_link'), 15, 2); add_action('parse_query', array($this, 'redirect_offsite_urls')); // situations to clear the cache 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')); // add message to WPML dashboard widget add_action('icl_dashboard_widget_content', array($this, 'icl_dashboard_widget_content')); return true; }
/** * */ function WYSIJA_help_queue() { $this->config = WYSIJA::get('config', 'model'); $this->subClass = WYSIJA::get('user', 'model'); //acymailing_get('class.sub'); $this->listsubClass = WYSIJA::get('user_list', 'model'); //acymailing_get('class.listsub'); $this->listsubClass->checkAccess = false; $this->listsubClass->sendNotif = false; $this->listsubClass->sendConf = false; $is_multisite = is_multisite(); //$is_multisite=true;//PROD comment that line // get the right sending limit based on the setup we are on, // if we are on a multisite we need to see which sending method is used to determine that if ($is_multisite && $this->config->getValue('sending_method') == 'network') { $this->send_limit = (int) $this->config->getValue('ms_sending_emails_number'); } else { $this->send_limit = (int) $this->config->getValue('sending_emails_number'); } if (isset($_REQUEST['totalsend'])) { $this->send_limit = (int) $_REQUEST['totalsend'] - $_REQUEST['alreadysent']; } @ini_set('max_execution_time', 0); @ini_set('default_socket_timeout', 10); @ignore_user_abort(true); //we set a stoppage time to avoid broken process $time_limit = ini_get('max_execution_time'); if (!empty($time_limit)) { $this->stoptime = time() + $time_limit - 4; } }
/** * @see CPAC_Column_Actions::get_actions() * @since 2.4.7 */ public function get_actions($id) { $actions = array(); $user_object = new WP_User($id); $screen = get_current_screen(); if ('site-users-network' == $screen->id) { $url = "site-users.php?id={$this->site_id}&"; } else { $url = 'users.php?'; } if (get_current_user_id() == $user_object->ID) { $edit_link = 'profile.php'; } else { $edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(stripslashes($_SERVER['REQUEST_URI'])), "user-edit.php?user_id={$user_object->ID}")); } if (current_user_can('edit_user', $user_object->ID)) { $edit = "<strong><a href=\"{$edit_link}\">{$user_object->user_login}</a></strong><br />"; $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; } else { $edit = "<strong>{$user_object->user_login}</strong><br />"; } if (!is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('delete_user', $user_object->ID)) { $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&user={$user_object->ID}", 'bulk-users') . "'>" . __('Delete') . "</a>"; } if (is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('remove_user', $user_object->ID)) { $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url($url . "action=remove&user={$user_object->ID}", 'bulk-users') . "'>" . __('Remove') . "</a>"; } return $actions; }
public function __construct() { if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) { echo '<div class="ws-menu-page-group" title="Pro API For Remote Operations">' . "\n"; echo '<div class="ws-menu-page-section ws-plugin--s2member-api-remote-operations-section">' . "\n"; echo '<h3>Pro API For Remote Operations (PHP scripting required)</h3>' . "\n"; echo '<p>With s2Member Pro installed, you have access to the s2Member Pro API For Remote Operations. This is made available for developers that wish to create User/Member accounts dynamically through custom scripts of their own. s2Member\'s Remote Operations API requires a secret API Key in order to POST authenticated requests to your installation of s2Member.</p>' . "\n"; echo '<div class="ws-menu-page-hr"></div>' . "\n"; echo '<h4>Remote Operations API: <strong>Your secret API Key</strong></h4>' . "\n"; echo '<input type="text" autocomplete="off" value="' . format_to_edit(c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen()) . '" style="width:99%;" />' . "\n"; echo '<p><em><strong class="ws-menu-page-hilite">Experimental:</strong> The Remote Operations API is currently in an experimental state. The Operations that are currently possible include: <code>auth_check_user</code>, <code>get_user</code>, <code>create_user</code>, <code>modify_user</code>, <code>delete_user</code>. In a future release of s2Member Pro, we will add further documentation and some additional Remote Operations to this API. Thanks for your patience.</em></p>' . "\n"; echo '<div class="ws-menu-page-hr"></div>' . "\n"; echo '<h4>Remote Operation: <code>auth_check_user</code> (authenticate existing Users/Members)</h4>' . "\n"; echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(str_replace("www.example.com", $_SERVER["HTTP_HOST"], str_replace("http://www.example.com/", site_url("/"), str_replace("[API Key]", c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen(), file_get_contents(dirname(__FILE__) . "/code-samples/remote-op-auth-check-user.x-php"))))) . '</p>' . "\n"; echo '<h4>Remote Operation: <code>get_user</code> (retrieve data about existing Users/Members)</h4>' . "\n"; echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(str_replace("www.example.com", $_SERVER["HTTP_HOST"], str_replace("http://www.example.com/", site_url("/"), str_replace("[API Key]", c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen(), file_get_contents(dirname(__FILE__) . "/code-samples/remote-op-get-user.x-php"))))) . '</p>' . "\n"; echo '<div class="ws-menu-page-hr"></div>' . "\n"; echo '<h4>Remote Operation: <code>create_user</code> (or update existing Users/Members)</h4>' . "\n"; echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(str_replace("www.example.com", $_SERVER["HTTP_HOST"], str_replace("http://www.example.com/", site_url("/"), str_replace("[API Key]", c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen(), file_get_contents(dirname(__FILE__) . "/code-samples/remote-op-create-user.x-php"))))) . '</p>' . "\n"; echo '<div class="ws-menu-page-hr"></div>' . "\n"; echo '<h4>Remote Operation: <code>modify_user</code> (updates existing Users/Members)</h4>' . "\n"; echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(str_replace("www.example.com", $_SERVER["HTTP_HOST"], str_replace("http://www.example.com/", site_url("/"), str_replace("[API Key]", c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen(), file_get_contents(dirname(__FILE__) . "/code-samples/remote-op-modify-user.x-php"))))) . '</p>' . "\n"; echo '<div class="ws-menu-page-hr"></div>' . "\n"; echo '<h4>Remote Operation: <code>delete_user</code> (deletes existing Users/Members)</h4>' . "\n"; echo '<p>' . c_ws_plugin__s2member_utils_strings::highlight_php(str_replace("www.example.com", $_SERVER["HTTP_HOST"], str_replace("http://www.example.com/", site_url("/"), str_replace("[API Key]", c_ws_plugin__s2member_pro_remote_ops::remote_ops_key_gen(), file_get_contents(dirname(__FILE__) . "/code-samples/remote-op-delete-user.x-php"))))) . '</p>' . "\n"; echo '<div class="ws-menu-page-hr"></div>' . "\n"; echo '<p><strong>TIP:</strong> In addition to this documentation, you may also want to have a look at the <a href="http://www.s2member.com/codex/" target="_blank" rel="external">s2Member Codex</a>.<br />' . "\n"; echo '<strong>See Also:</strong> <a href="http://www.s2member.com/codex/stable/s2member/api_constants/package-summary/" target="_blank" rel="external">s2Member Codex -› API Constants</a>, and <a href="http://www.s2member.com/codex/stable/s2member/api_functions/package-summary/" target="_blank" rel="external">s2Member Codex -› API Functions</a>.</p>' . "\n"; echo '</div>' . "\n"; echo '</div>' . "\n"; } }
/** * Construct */ function __construct($type = 'mycred_default') { // Prep $this->is_multisite = is_multisite(); $this->use_master_template = mycred_override_settings(); $this->use_central_logging = mycred_centralize_log(); if ($type == '' || $type === NULL) { $type = 'mycred_default'; } // Load Settings $option_id = 'mycred_pref_core'; if ($type != 'mycred_default' && $type != '') { $option_id .= '_' . $type; } $this->core = mycred_get_option($option_id, $this->defaults()); if ($this->core !== false) { foreach ((array) $this->core as $key => $value) { $this->{$key} = $value; } } if ($type != '') { $this->cred_id = $type; } if (defined('MYCRED_LOG_TABLE')) { $this->log_table = MYCRED_LOG_TABLE; } else { global $wpdb; if ($this->is_multisite && $this->use_central_logging) { $this->log_table = $wpdb->base_prefix . 'myCRED_log'; } else { $this->log_table = $wpdb->prefix . 'myCRED_log'; } } do_action_ref_array('mycred_settings', array(&$this)); }
/** * 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 function constant($mm_config = array()) { // Set theme primary information. foreach ($mm_config as $key => $value) { $this->constant[$key] = $value; } // Set theme identificators and prefixes. $this->constant['MM_OPTIONS_NAME'] = $this->constant['MM_WARE_SLUG'] . '_options'; $this->constant['MM_OPTIONS_DB_NAME'] = $this->constant['MM_OPTIONS_NAME']; $this->constant['MM_TEXTDOMAIN'] = $this->constant['MM_WARE_SLUG']; $this->constant['MM_TEXTDOMAIN_ADMIN'] = $this->constant['MM_WARE_SLUG'] . '_admin'; $this->constant['MM_THEME_PAGE_SLUG'] = $this->constant['MM_OPTIONS_NAME']; // Set theme static locations. // DIRECTORIES $this->constant['MM_WARE_DIR'] = dirname($this->constant['MM_WARE_INIT_FILE']); $this->constant['MM_WARE_FRAMEWORK_DIR'] = $this->constant['MM_WARE_DIR'] . '/framework'; $this->constant['MM_WARE_EXTENSIONS_DIR'] = $this->constant['MM_WARE_DIR'] . '/extensions'; $this->constant['MM_WARE_SRC_DIR'] = $this->constant['MM_WARE_DIR'] . '/src'; $this->constant['MM_WARE_CSS_DIR'] = $this->constant['MM_WARE_SRC_DIR'] . '/css'; // URL's if (is_multisite()) { $home_url = get_home_url(); } else { $wpurl = get_bloginfo('wpurl'); $home_url = $wpurl; } $ware_dir_explode = array_reverse(explode('/', str_replace('\\', '/', $this->constant['MM_WARE_DIR']))); $this->constant['MM_WARE_URL'] = $home_url . '/' . $ware_dir_explode[2] . '/' . $ware_dir_explode[1] . '/' . $ware_dir_explode[0]; $this->constant['MM_WARE_SRC_URL'] = $this->constant['MM_WARE_URL'] . '/src'; $this->constant['MM_WARE_CSS_URL'] = $this->constant['MM_WARE_SRC_URL'] . '/css'; $this->constant['MM_WARE_JS_URL'] = $this->constant['MM_WARE_SRC_URL'] . '/js'; $this->constant['MM_WARE_FONTS_URL'] = $this->constant['MM_WARE_SRC_URL'] . '/fonts'; $this->constant['MM_WARE_IMG_URL'] = $this->constant['MM_WARE_SRC_URL'] . '/img'; }
/** * Get things started * * Defines our WP_Session constants, includes the necessary libraries and * retrieves the WP Session instance * * @since 1.0 */ public function __construct() { $this->use_php_sessions = $this->use_php_sessions(); $this->exp_option = give_get_option('session_lifetime'); if ($this->use_php_sessions) { if (is_multisite()) { $this->prefix = '_' . get_current_blog_id(); } // Use PHP SESSION (must be enabled via the GIVE_USE_PHP_SESSIONS constant) add_action('init', array($this, 'maybe_start_session'), -2); } else { // Use WP_Session (default) if (!defined('WP_SESSION_COOKIE')) { define('WP_SESSION_COOKIE', 'give_wp_session'); } if (!class_exists('Recursive_ArrayAccess')) { require_once GIVE_PLUGIN_DIR . 'includes/libraries/class-recursive-arrayaccess.php'; } if (!class_exists('WP_Session')) { require_once GIVE_PLUGIN_DIR . 'includes/libraries/class-wp-session.php'; require_once GIVE_PLUGIN_DIR . 'includes/libraries/wp-session.php'; } add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999); add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999); } if (empty($this->session) && !$this->use_php_sessions) { add_action('plugins_loaded', array($this, 'init'), -1); } else { add_action('init', array($this, 'init'), -1); } }
/** * Database changes required for Smart Coupons * * Add option 'smart_coupon_email_subject' if not exists * Enable 'Auto Generation' for Store Credit (discount_type: 'smart_coupon') not having any customer_email * Disable 'apply_before_tax' for all Store Credit (discount_type: 'smart_coupon') */ function smart_coupon_activate() { global $wpdb, $blog_id; if (is_multisite()) { $blog_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}", 0); } else { $blog_ids = array($blog_id); } if (!get_option('smart_coupon_email_subject')) { add_option('smart_coupon_email_subject'); } foreach ($blog_ids as $blog_id) { if (file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php') && is_plugin_active('woocommerce/woocommerce.php')) { $wpdb_obj = clone $wpdb; $wpdb->blogid = $blog_id; $wpdb->set_prefix($wpdb->base_prefix); $query = "SELECT postmeta.post_id FROM {$wpdb->prefix}postmeta as postmeta WHERE postmeta.meta_key = 'discount_type' AND postmeta.meta_value = 'smart_coupon' AND postmeta.post_id IN\n\t\t\t\t\t(SELECT p.post_id FROM {$wpdb->prefix}postmeta AS p WHERE p.meta_key = 'customer_email' AND p.meta_value = 'a:0:{}') "; $results = $wpdb->get_col($query); foreach ($results as $result) { update_post_meta($result, 'auto_generate_coupon', 'yes'); } // To disable apply_before_tax option for Gift Certificates / Store Credit. $post_id_tax_query = "SELECT post_id FROM {$wpdb->prefix}postmeta WHERE meta_key = 'discount_type' AND meta_value = 'smart_coupon'"; $tax_post_ids = $wpdb->get_col($post_id_tax_query); foreach ($tax_post_ids as $tax_post_id) { update_post_meta($tax_post_id, 'apply_before_tax', 'no'); } $wpdb = clone $wpdb_obj; } } if (!is_network_admin() && !isset($_GET['activate-multi'])) { set_transient('_smart_coupons_activation_redirect', 1, 30); } }
protected function activate() { foreach ($this->plugins as $plugin) { if (!$this->network_wide && Jetpack::is_plugin_active($plugin) || is_plugin_active_for_network($plugin)) { $this->log[$plugin]['error'] = __('The Plugin is already active.', 'jetpack'); $has_errors = true; continue; } if (!$this->network_wide && is_network_only_plugin($plugin) && is_multisite()) { $this->log[$plugin]['error'] = __('Plugin can only be Network Activated', 'jetpack'); $has_errors = true; continue; } $result = activate_plugin($plugin, '', $this->network_wide); if (is_wp_error($result)) { $this->log[$plugin]['error'] = $result->get_error_messages(); $has_errors = true; continue; } $success = Jetpack::is_plugin_active($plugin); if ($success && $this->network_wide) { $success &= is_plugin_active_for_network($plugin); } if (!$success) { $this->log[$plugin]['error'] = $result->get_error_messages; $has_errors = true; continue; } $this->log[$plugin][] = __('Plugin activated.', 'jetpack'); } if (!$this->bulk && isset($has_errors)) { $plugin = $this->plugins[0]; return new WP_Error('activation_error', $this->log[$plugin]['error']); } }
function install() { global $wpdb; include_once 'admin/install.php'; $this->remove_transients(); if (is_multisite()) { $network = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : ""; $activate = isset($_GET['action']) ? $_GET['action'] : ""; $isNetwork = $network == '/wp-admin/network/plugins.php' ? true : false; $isActivation = $activate == 'deactivate' ? false : true; if ($isNetwork and $isActivation) { $old_blog = $wpdb->blogid; $blogids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs}", NULL)); foreach ($blogids as $blog_id) { switch_to_blog($blog_id); nggallery_install($this); } switch_to_blog($old_blog); return; } } // remove the update message delete_option('ngg_update_exists'); nggallery_install($this); }
function wppb_check_username_value($message, $field, $request_data, $form_location) { global $wpdb; if ($field['required'] == 'Yes') { if (isset($request_data['username']) && trim($request_data['username']) == '' || $form_location == 'register' && !isset($request_data['username'])) { return wppb_required_field_error($field["field-title"]); } } if (!empty($request_data['username'])) { if ($form_location == 'register') { $search_by_user_login = get_users('search=' . $request_data['username']); } if (!empty($search_by_user_login)) { return __('This username already exists.', 'profile-builder') . '<br/>' . __('Please try a different one!', 'profile-builder'); } if (!validate_username($request_data['username'])) { return __('This username is invalid because it uses illegal characters.', 'profile-builder') . '<br/>' . __('Please enter a valid username.', 'profile-builder'); } $wppb_generalSettings = get_option('wppb_general_settings'); if ($wppb_generalSettings['emailConfirmation'] == 'yes') { if (is_multisite() && $request_data['username'] != preg_replace('/\\s+/', '', $request_data['username'])) { return __('This username is invalid because it uses illegal characters.', 'profile-builder') . '<br/>' . __('Please enter a valid username.', 'profile-builder'); } $userSignup = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "signups WHERE user_login = %s", $request_data['username'])); if (!empty($userSignup)) { return __('This username is already reserved to be used soon.', 'profile-builder') . '<br/>' . __('Please try a different one!', 'profile-builder'); } } } return $message; }
function uw_register_widgets() { if (!is_blog_installed()) { return; } unregister_widget('Widget_Akismet'); unregister_widget('WP_Widget_Meta'); unregister_widget('WP_Widget_Recent_Posts'); unregister_widget('WP_Widget_RSS'); //register_widget('UW_Widget_Single_Image'); //register_widget('UW_RSS_Widget'); //register_widget('UW_Widget_Recent_Posts'); //register_widget('UW_Widget_CommunityPhotos'); register_widget('UW_Widget_Categories'); //register_widget('UW_Widget_Twitter'); //register_widget('UW_KEXP_KUOW_Widget'); //register_widget('UW_Showcase_Widget'); //register_widget('UW_Subpage_Menu'); register_widget('UW_Nav_Menu_Widget'); //register_widget('UW_Calendar'); //register_widget('UW_Campus_Map'); // Specific to Page Builder only register_widget('UW_Headline_Separator_Widget'); register_widget('UW_Headline_Widget'); register_widget('UW_Intro_Widget'); //register_widget('UW_YouTube_Playlist_Widget'); if (is_multisite() && get_blog_details('marketing')) { register_widget('UW_Pride_Points'); } }
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'); }
/** * Check if installation environment meets minimum PB requirements. * Can be shared by other plugins that depend on Pressbooks. Example usage: * * if ( ! @include_once( WP_PLUGIN_DIR . '/pressbooks/compatibility.php' ) ) { * add_action( 'admin_notices', function () { * echo '<div id="message" class="error fade"><p>' . __( 'Cannot find Pressbooks install.', 'pressbooks' ) . '</p></div>'; * } ); * return; * } * elseif ( ! pb_meets_minimum_requirements() ) { * return; * } * * * @return bool */ function pb_meets_minimum_requirements() { $is_compatible = true; // --------------------------------------------------------------------------------------------------------------- // PHP Version // --------------------------------------------------------------------------------------------------------------- // Override PHP version at your own risk! global $pb_minimum_php; if (empty($pb_minimum_php)) { $pb_minimum_php = '5.6.0'; } if (!version_compare(PHP_VERSION, $pb_minimum_php, '>=')) { add_action('admin_notices', '_pb_minimum_php'); $is_compatible = false; } // --------------------------------------------------------------------------------------------------------------- // WordPress Version // --------------------------------------------------------------------------------------------------------------- // Override WP version at your own risk! global $pb_minimum_wp; if (empty($pb_minimum_wp)) { $pb_minimum_wp = '4.4'; } if (!is_multisite() || !version_compare(get_bloginfo('version'), $pb_minimum_wp, '>=')) { add_action('admin_notices', '_pb_minimum_wp'); $is_compatible = false; } return $is_compatible; }
/** * Start importer background process on production environment. */ public function run() { // Get current deploy status (if any). $deploy_status = $this->api->get_deploy_status($this->batch->get_id()); // Make sure background import for this job is not already running. if ($deploy_status > 0) { return; } // Inicate that background import is about to start. $this->api->set_deploy_status($this->batch->get_id(), 1); // Default site path. $site_path = '/'; // Site path in multi-site setup. if (is_multisite()) { $site = get_blog_details(); $site_path = $site->path; } // Trigger import script. $import_script = dirname(dirname(dirname(__FILE__))) . '/scripts/import-batch.php'; $background_process = new Background_Process('php ' . $import_script . ' ' . ABSPATH . ' ' . get_site_url() . ' ' . $this->batch->get_id() . ' ' . $site_path . ' ' . $this->api->generate_import_key($this->batch)); if (file_exists($import_script)) { $background_process->run(); } if (!$background_process->get_pid()) { // Failed to start background import. $this->api->add_deploy_message($this->batch->get_id(), 'Batch import failed to start.', 'info'); $this->api->set_deploy_status($this->batch->get_id(), 2); } }