public static function add_rewrite_rules($rules)
 {
     //Get taxonomies
     $taxonomies = get_taxonomies();
     $blog_prefix = '';
     $endpoint = Slash_Edit::get_instance()->get_endpoint();
     if (is_multisite() && !is_subdomain_install() && is_main_site()) {
         /* stolen from /wp-admin/options-permalink.php */
         $blog_prefix = 'blog/';
     }
     $exclude = array('category', 'post_tag', 'nav_menu', 'link_category', 'post_format');
     foreach ($taxonomies as $key => $taxonomy) {
         if (in_array($key, $exclude)) {
             continue;
         }
         $rules["{$blog_prefix}{$key}/([^/]+)/{$endpoint}(/(.*))?/?\$"] = 'index.php?' . $key . '=$matches[1]&' . $endpoint . '=$matches[3]';
     }
     //Add home_url/edit to rewrites
     $add_frontpage_edit_rules = false;
     if (!get_page_by_path($endpoint)) {
         $add_frontpage_edit_rules = true;
     } else {
         $page = get_page_by_path($endpoint);
         if (is_a($page, 'WP_Post') && $page->post_status != 'publish') {
             $add_frontpage_edit_rules = true;
         }
     }
     if ($add_frontpage_edit_rules) {
         $edit_array_rule = array("{$endpoint}/?\$" => 'index.php?' . $endpoint . '=frontpage');
         $rules = $edit_array_rule + $rules;
     }
     return $rules;
 }
Example #2
0
 /**
  * Check if the current blog_id is considered a "book"
  *
  * @return bool
  */
 static function isBook()
 {
     // Currently, the main site is considered a "blog/landing page" whereas everything else is considered a "book".
     // We might improve this in the future.
     $is_book = is_main_site() === false;
     return $is_book;
 }
Example #3
0
 /**
  * This function taken and only slightly adapted from WP No Category Base plugin by Saurabh Gupta
  */
 function category_rewrite_rules($rewrite)
 {
     global $wp_rewrite;
     $category_rewrite = array();
     $categories = get_categories(array('hide_empty' => false));
     $blog_prefix = '';
     if (function_exists('is_multisite') && is_multisite() && !is_subdomain_install() && is_main_site()) {
         $blog_prefix = 'blog/';
     }
     foreach ($categories as $category) {
         $category_nicename = $category->slug;
         if ($category->parent == $category->cat_ID) {
             // recursive recursion
             $category->parent = 0;
         } elseif ($category->parent != 0) {
             $category_nicename = get_category_parents($category->parent, false, '/', true) . $category_nicename;
         }
         $category_rewrite[$blog_prefix . '(' . $category_nicename . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
         $category_rewrite[$blog_prefix . '(' . $category_nicename . ')/page/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[2]';
         $category_rewrite[$blog_prefix . '(' . $category_nicename . ')/?$'] = 'index.php?category_name=$matches[1]';
     }
     // Redirect support from Old Category Base
     $old_base = $wp_rewrite->get_category_permastruct();
     $old_base = str_replace('%category%', '(.+)', $old_base);
     $old_base = trim($old_base, '/');
     $category_rewrite[$old_base . '$'] = 'index.php?wpseo_category_redirect=$matches[1]';
     return $category_rewrite;
 }
Example #4
0
function ra_replicator_filter_site_actions($actions, $blog_id)
{
    if (!is_main_site($blog_id)) {
        $actions['replicate'] = '<a href="' . esc_url(wp_nonce_url(network_admin_url('sites.php?page=wp-replicator&amp;replicate=' . $blog_id), 'replicate-' . $blog_id)) . '">' . __('Replicate') . '</a>';
    }
    return $actions;
}
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $limit = (int) @$instance['limit'];
     $limit = $limit ? $limit : 5;
     $data = new Wdpv_Options();
     $voted_timeframe = @$instance['voted_timeframe'];
     if (!in_array($voted_timeframe, array_keys($data->timeframes))) {
         $voted_timeframe = false;
     }
     if (is_main_site()) {
         $model = new Wdpv_Model();
         $posts = $model->get_popular_on_network($limit, $voted_timeframe);
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         if (is_array($posts)) {
             echo "<ul class='wdpv_popular_posts wdpv_network_popular'>";
             foreach ($posts as $post) {
                 $data = get_blog_post($post['blog_id'], $post['post_id']);
                 echo "<li>";
                 echo '<a href="' . get_blog_permalink($post['blog_id'], $post['post_id']) . '">' . $data->post_title . '</a> ';
                 printf(__('<span class="wdpv_vote_count">(%s votes)</span>', 'wdpv'), $post['total']);
                 echo "</li>";
             }
             echo "</ul>";
         }
         echo $after_widget;
     }
 }
Example #6
0
 /**
  * This function scans theme folder for files.
  *
  * @param $ext string File extension to scan
  * @param $mode int 0 - theme, 1 - plugin
  * @return array Relative file path.
  */
 public static function scan_for_files($ext, $mode = 0)
 {
     $root = $_SERVER['DOCUMENT_ROOT'];
     switch ($mode) {
         case 0:
             $url = get_template_directory_uri();
             break;
         case 1:
             $url = plugin_dir_url(__FILE__) . 'assets/custom';
             break;
         default:
             $url = get_template_directory_uri();
             break;
     }
     if (is_multisite() && !is_main_site()) {
         $dir = preg_replace('/https?:\\/\\/[^\\/]+\\/[^\\/]+/i', '', $url);
     } else {
         $dir = preg_replace('/https?:\\/\\/[^\\/]+/i', '', $url);
     }
     $files = self::rglob($root . $dir . "/*.{$ext}");
     $result = array();
     $root_preg = preg_quote($root, '/');
     $path_preg = preg_quote($dir, '/');
     foreach ((array) $files as $file) {
         $strip_root = preg_replace("/{$root_preg}/", '', $file, 1);
         $path = preg_replace("/{$path_preg}/", '', $strip_root, 1);
         if ($mode == 1) {
             $result[] = array('path' => 'custom' . $path);
         } else {
             $result[] = array('path' => $path);
         }
     }
     return $result;
 }
Example #7
0
 /**
  * Subscribe.
  *
  * @since 141004
  * @package s2Member\List_Servers
  *
  * @param array $args Input arguments.
  *
  * @return bool True if successful.
  */
 public static function subscribe($args)
 {
     if (!($args = self::validate_args($args))) {
         return FALSE;
     }
     // Invalid args.
     if (!$args->opt_in) {
         // Double check.
         return FALSE;
     }
     // Must say explicitly.
     if (empty($GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $args->level . '_aweber_list_ids'])) {
         return FALSE;
     }
     // No list configured at this level.
     $aw_level_list_ids = $GLOBALS['WS_PLUGIN__']['s2member']['o']['level' . $args->level . '_aweber_list_ids'];
     foreach (preg_split('/[' . "\r\n\t" . '\\s;,]+/', $aw_level_list_ids, NULL, PREG_SPLIT_NO_EMPTY) as $_aw_list) {
         $_aw = array('args' => $args, 'function' => __FUNCTION__, 'list' => trim($_aw_list), 'list_id' => trim($_aw_list), 'api_method' => 'listSubscribe');
         if (!$_aw['list']) {
             continue;
         }
         // List missing.
         $_aw['bcc'] = apply_filters('ws_plugin__s2member_aweber_bcc', FALSE, get_defined_vars());
         $_aw['pass_inclusion'] = apply_filters('ws_plugin__s2member_aweber_pass_inclusion', FALSE, get_defined_vars()) && $args->pass ? "\n" . 'Pass: '******'';
         if ($_aw['wp_mail_response'] = wp_mail($_aw['list_id'] . '@aweber.com', $_aw['wp_mail_sbj'] = apply_filters('ws_plugin__s2member_aweber_sbj', 's2Member Subscription Request', get_defined_vars()), $_aw['wp_mail_msg'] = apply_filters('ws_plugin__s2member_aweber_msg', 's2Member Subscription Request' . "\n" . 's2Member w/ PayPal Email ID' . "\n" . 'Ad Tracking: s2Member-' . (is_multisite() && !is_main_site() ? $GLOBALS['current_blog']->domain . $GLOBALS['current_blog']->path : $_SERVER['HTTP_HOST']) . "\n" . 'EMail Address: ' . $args->email . "\n" . 'Buyer: ' . $args->name . "\n" . 'Full Name: ' . $args->name . "\n" . 'First Name: ' . $args->fname . "\n" . 'Last Name: ' . $args->lname . "\n" . 'IP Address: ' . $args->ip . "\n" . 'User ID: ' . $args->user_id . "\n" . 'Login: '******'pass_inclusion'] . "\n" . 'Role: ' . $args->role . "\n" . 'Level: ' . $args->level . "\n" . 'CCaps: ' . $args->ccaps . "\n" . ' - end.', get_defined_vars()), $_aw['wp_mail_headers'] = 'From: "' . preg_replace('/"/', "'", $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_name']) . '" <' . $GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_from_email'] . '>' . ($_aw['bcc'] ? "\r\n" . 'Bcc: ' . $_aw['bcc'] : '') . "\r\n" . 'Content-Type: text/plain; charset=UTF-8')) {
             $_aw['wp_mail_success'] = $success = TRUE;
         }
         // Flag this as `TRUE`; assists with return value below.
         c_ws_plugin__s2member_utils_logs::log_entry('aweber-api', $_aw);
     }
     unset($_aw_list, $_aw);
     // Just a little housekeeping.
     return !empty($success);
     // If one suceeds.
 }
 public function __construct()
 {
     echo '<div class="ws-menu-page-hr"></div>' . "\n";
     echo '<h3 style="margin:0;">Auto-Return Page Template (<a href="#" onclick="jQuery(\'div#ws-plugin--s2member-pro-paypal-return-page-template\').toggle(); return false;" class="ws-dotted-link">optional customizations</a>)</h3>' . "\n";
     echo '<div id="ws-plugin--s2member-pro-paypal-return-page-template" style="display:none;">' . "\n";
     echo '<p>With s2Member Pro installed, you have the ability to customize your <a href="' . esc_attr(site_url("/?s2member_paypal_return=1&s2member_paypal_proxy=paypal&s2member_paypal_proxy_use=x-preview")) . '" target="_blank" rel="external">Auto-Return Page Template</a>. If you are using PayPal Standard integration <em>(i.e. PayPal Buttons)</em>, each of your Customers are returned back to your site immediately after they complete checkout at PayPal. Your Auto-Return Page displays a message and instructions for the Customer. s2Member may change the message and instructions dynamically, based on what the Customer is actually doing <em>(i.e. based on the type of transaction that is taking place)</em>. So, although we do NOT recommend that you attempt to change the message and instructions presented dynamically by s2Member, you CAN certainly control the Header, and/or the overall appearance of s2Member\'s Auto-Return Page Template.</p>' . "\n";
     echo '<p>The quickest/easiest way, is to simply add some HTML code in the box below. For instance, you might include an &lt;img&gt; tag with your logo. The box below, allows you to customize the Header section <em>(i.e. the top)</em> of s2Member\'s default Auto-Return Page Template. Everything else, including the textual response and other important details that each Customer needs to know about, are already handled dynamically by s2Member <em>(based on the type of transaction that is taking place)</em>. All you need to do is customize the Header with your logo and anything else you feel is important. Although this Header customization is completely optional, we recommend an <a href="http://www.w3schools.com/tags/tag_img.asp" target="_blank" rel="external">&lt;img&gt; tag</a>, with a logo that is around 300px wide. After you "Save All Changes" below, you may <a href="' . esc_attr(site_url("/?s2member_paypal_return=1&s2member_paypal_proxy=paypal&s2member_paypal_proxy_use=x-preview")) . '" target="_blank" rel="external">click this link to see what your Header looks like</a>.</p>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<th>' . "\n";
     echo '<label for="ws-plugin--s2member-pro-paypal-return-template-header">' . "\n";
     echo 'Auto-Return Page Template Header:' . "\n";
     echo '</label>' . "\n";
     echo '</th>' . "\n";
     echo '</tr>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<textarea name="ws_plugin__s2member_pro_paypal_return_template_header" id="ws-plugin--s2member-pro-paypal-return-template-header" rows="5" wrap="off" spellcheck="false">' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_return_template_header"]) . '</textarea><br />' . "\n";
     echo 'Any valid XHTML / JavaScript' . (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site() ? '' : ' (or even PHP)') . ' code will work just fine here.' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '<div class="ws-menu-page-hr"></div>' . "\n";
     if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
         echo '<p>It is also possible to build your own Auto-Return Page Template, if you prefer. If you feel the need to create your own Auto-Return Page Template, please make a copy of s2Member\'s default template: <code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir"] . "/includes/templates/returns/default-template.php")) . '</code>. Place your copy of this default template, inside your active WordPress theme directory, and name the file: <code>/paypal-return.php</code>. s2Member will automatically find your Auto-Return Page Template in this location, and s2Member will use your template, instead of the default. Further details are provided inside s2Member\'s default template file. Once your custom template file is in place, you may <a href="' . esc_attr(site_url("/?s2member_paypal_return=1&s2member_paypal_proxy=paypal&s2member_paypal_proxy_use=x-preview")) . '" target="_blank" rel="external">click this link to see what it looks like</a>.</p>' . "\n";
     }
     echo '<p>It is also possible to bypass s2Member\'s Auto-Return system all together, if you prefer. For further details, please read more about the <code>success=""</code> Shortcode Attribute for PayPal Buttons generated by s2Member. You will find details on this inside your Dashboard, under: <code>s2Member -› PayPal Buttons -› Shortcode Attributes (Explained)</code>. Please note: you will still need to configure your PayPal account for Auto-Return/PDT <em>(as instructed above)</em>. Then, you may use the <code>success=""</code> Attribute in your Shortcode, when/if you need it. In other words, if you use the <code>success=""</code> Attribute in your Shortcode, the initial redirection back to s2Member\'s default Auto-Return/PDT handler MUST still occur. However, instead of s2Member displaying an Auto-Return Template to the Customer, s2Member will silently redirect the Customer to the URL that you specified in the <code>success="http://..."</code> Attribute of your Shortcode, allowing you to take complete control over what happens next.</p>' . "\n";
     echo '</div>' . "\n";
 }
 /**
  * Handles Registration Links.
  *
  * @package s2Member\Registrations
  * @since 3.5
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after redirection.
  */
 public static function register()
 {
     do_action("ws_plugin__s2member_before_register", get_defined_vars());
     /**/
     if (!empty($_GET["s2member_register"])) {
         eval('while (@ob_end_clean ());');
         /* First we end/clean any output buffers that may exist already. */
         /**/
         $msg_503 = _x('<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.', "s2member-front", "s2member");
         /**/
         if (is_array($register = preg_split("/\\:\\.\\:\\|\\:\\.\\:/", c_ws_plugin__s2member_utils_encryption::decrypt(trim(stripslashes((string) $_GET["s2member_register"])))))) {
             if (count($register) === 6 && $register[0] === "subscr_gateway_subscr_id_custom_item_number_time") {
                 if (is_numeric($register[5]) && $register[5] <= strtotime("now") && $register[5] >= strtotime("-" . apply_filters("ws_plugin__s2member_register_link_exp_time", "2 days", get_defined_vars()))) {
                     $_COOKIE["s2member_subscr_gateway"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[1]);
                     $_COOKIE["s2member_subscr_id"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[2]);
                     $_COOKIE["s2member_custom"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[3]);
                     $_COOKIE["s2member_item_number"] = c_ws_plugin__s2member_utils_encryption::encrypt($register[4]);
                     /**/
                     if (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies)) {
                         status_header(200);
                         /* Send a 200 OK status header. */
                         header("Content-Type: text/html; charset=utf-8");
                         /* Content-Type with UTF-8. */
                         /**/
                         setcookie("s2member_subscr_gateway", $_COOKIE["s2member_subscr_gateway"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_subscr_gateway", $_COOKIE["s2member_subscr_gateway"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
                         setcookie("s2member_subscr_id", $_COOKIE["s2member_subscr_id"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_subscr_id", $_COOKIE["s2member_subscr_id"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
                         setcookie("s2member_custom", $_COOKIE["s2member_custom"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_custom", $_COOKIE["s2member_custom"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
                         setcookie("s2member_item_number", $_COOKIE["s2member_item_number"], time() + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie("s2member_item_number", $_COOKIE["s2member_item_number"], time() + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
                         /**/
                         do_action("ws_plugin__s2member_during_register", get_defined_vars());
                         /**/
                         if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && is_main_site() && ($location = c_ws_plugin__s2member_utils_urls::wp_signup_url())) {
                             echo '<script type="text/javascript">' . "\n";
                             echo "window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($location) . "';";
                             echo '</script>' . "\n";
                         } else {
                             if ($location = c_ws_plugin__s2member_utils_urls::wp_register_url()) {
                                 echo '<script type="text/javascript">' . "\n";
                                 echo "window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq($location) . "';";
                                 echo '</script>' . "\n";
                             }
                         }
                         exit;
                         /* Clean exit. The browser will now be redirected to ``$location``. */
                     } else {
                         status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
                     }
                 } else {
                     status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
                 }
             } else {
                 status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
             }
         } else {
             status_header(503) . header("Content-Type: text/html; charset=utf-8") . exit($msg_503);
         }
     }
     /**/
     do_action("ws_plugin__s2member_after_register", get_defined_vars());
 }
 /**
  * Handles Return templates w/ response message.
  *
  * @package s2Member\Return_Templates
  * @since 110720
  *
  * @param string $template Optional A Subscr. Gateway code should be used as the template name, or `default` is a multipurpose template. Defaults to `default`. Used in template selection.
  * @param string $response Optional. Response message to fill template with, using the Replacement Code `%%response%%` inside the template file. Defaults to: `Thank you. Please click the link below.`.
  * @param string $continue_html Optional. The HTML value of the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: `Continue`.
  * @param string $continue_link Optional. The HREF value for the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: ``home_url ('/', 'http')``.
  *
  * @return string The full HTML code of the template. All Replacement Codes inside the template file will have already been filled by this routine.
  */
 public static function return_template($template = '', $response = '', $continue_html = '', $continue_link = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_return_template', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     $template = $template ? $template : 'default';
     $continue_link = $continue_link ? $continue_link : home_url('/', 'http');
     $continue_html = $continue_html ? $continue_html : _x('Continue', 's2member-front', 's2member');
     $response = $response ? $response : _x('Thank you. Please click the link below.', 's2member-front', 's2member');
     $custom_template = is_file(TEMPLATEPATH . '/' . $template . '-return.php') ? TEMPLATEPATH . '/' . $template . '-return.php' : '';
     $custom_template = is_file(get_stylesheet_directory() . '/' . $template . '-return.php') ? get_stylesheet_directory() . '/' . $template . '-return.php' : $custom_template;
     $custom_template = is_file(WP_CONTENT_DIR . '/' . $template . '-return.php') ? WP_CONTENT_DIR . '/' . $template . '-return.php' : $custom_template;
     $custom_template = !$custom_template && is_file(TEMPLATEPATH . '/default-return.php') ? TEMPLATEPATH . '/default-return.php' : $custom_template;
     $custom_template = !$custom_template && is_file(get_stylesheet_directory() . '/default-return.php') ? get_stylesheet_directory() . '/default-return.php' : $custom_template;
     $custom_template = !$custom_template && is_file(WP_CONTENT_DIR . '/default-return.php') ? WP_CONTENT_DIR . '/default-return.php' : $custom_template;
     $specific_template = $custom_template ? $custom_template : (is_file($_default_specific_template = dirname(dirname(__FILE__)) . '/templates/returns/' . $template . '-return.php') ? $_default_specific_template : '');
     $code = trim(file_get_contents($specific_template ? $specific_template : ($_default_template = dirname(dirname(__FILE__)) . '/templates/returns/default-return.php')));
     $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
     $doctype_html_head = c_ws_plugin__s2member_utils_html::doctype_html_head(get_bloginfo('name'), 'ws_plugin__s2member_during_return_template_head_' . ($specific_template ? basename($specific_template) : 'default-return.php'));
     $code = preg_replace('/%%doctype_html_head%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_doctype_html_head', $doctype_html_head, get_defined_vars())), $code);
     $code = preg_replace('/%%header%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_header', sprintf(_x('[ %s ] <strong><em>says&hellip;</em></strong>', 's2member-front', 's2member'), esc_html($_SERVER['HTTP_HOST'])), get_defined_vars())), $code);
     $code = preg_replace('/%%response%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_response', $response, get_defined_vars())), $code);
     $code = preg_replace('/%%continue%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_continue', '<a href="' . esc_attr($continue_link) . '">' . $continue_html . '</a>', get_defined_vars())), $code);
     $code = preg_replace('/%%support%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_support', sprintf(_x('If you need assistance, please <a href="%s" target="_blank">contact support</a>.', 's2member-front', 's2member'), esc_attr($GLOBALS['WS_PLUGIN__']['s2member']['o']['reg_email_support_link'])), get_defined_vars())), $code);
     $code = preg_replace('/%%tracking%%/i', c_ws_plugin__s2member_utils_strings::esc_refs(apply_filters('ws_plugin__s2member_return_template_tracking', c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes(), get_defined_vars())), $code);
     return apply_filters('ws_plugin__s2member_return_template', $code, get_defined_vars());
 }
 function mmm_menu_options_array()
 {
     global $mmm_menu_options_array;
     global $mega_main_menu;
     if (isset($mmm_menu_options_array) && $mmm_menu_options_array !== false) {
         $options = $mmm_menu_options_array;
     } else {
         /* Additional styles */
         $additional_styles_presets = $mega_main_menu->get_option('additional_styles_presets');
         $additional_styles[__('Default', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN'])] = 'default_style';
         if (is_array($additional_styles_presets)) {
             unset($additional_styles_presets['0']);
             foreach ($additional_styles_presets as $key => $value) {
                 $additional_styles[$key . '. ' . $value['style_name']] = 'additional_style_' . $key;
             }
         }
         /* Submenu types */
         $submenu_types = array(__('Standard Submenu', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'default_dropdown', __('Multicolumn Submenu', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'multicolumn_dropdown', __('Tabs Submenu', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'tabs_dropdown', __('Grid Submenu', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'grid_dropdown', __('Posts Grid Submenu', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'post_type_dropdown');
         if (is_multisite() && is_main_site()) {
             $submenu_types[__('Posts Grid Submenu (Multisite)', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN'])] = 'post_type_dropdown_multisite';
         }
         $number_of_widgets = $mega_main_menu->get_option('number_of_widgets', '1');
         if (is_numeric($number_of_widgets) && $number_of_widgets > 0) {
             for ($i = 1; $i <= $number_of_widgets; $i++) {
                 $submenu_widgets[__('Widgets area ', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) . $i] = $mega_main_menu->constant['MM_WARE_PREFIX'] . '_menu_widgets_area_' . $i;
             }
             $submenu_types = array_merge($submenu_types, $submenu_widgets);
         }
         /* options */
         $options = array(array('descr' => __('Description', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'key' => 'item_descr', 'type' => 'textarea', 'col_width' => 2), array('descr' => __('Style of This Item', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'key' => 'item_style', 'type' => 'select', 'values' => $additional_styles, 'default' => 'default'), array('descr' => __('Visibility Control', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'key' => 'item_visibility', 'type' => 'select', 'values' => array(__('Always Visible', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'all', __('Visible Only to Logged Users', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'logged', __('Visible Only to Unlogged Visitors', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'visitors')), array('descr' => __('Icon of This Item (set empty to hide)', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'key' => 'item_icon', 'type' => 'icons'), array('key' => 'disable_text', 'type' => 'checkbox', 'values' => array(__('Hide Text of This Item', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'true')), array('key' => 'disable_link', 'type' => 'checkbox', 'values' => array(__('Disable Link', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'true')), array('key' => 'pull_to_other_side', 'type' => 'checkbox', 'values' => array(__('Pull to the Other Side', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'true')), array('name' => __('Options of Dropdown', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('Submenu Type', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'key' => 'submenu_type', 'type' => 'select', 'values' => $submenu_types), array('key' => 'submenu_post_type', 'descr' => __('Post Type for Display in Dropdown', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'type' => 'select', 'values' => mm_common::get_all_taxonomies(), 'dependency' => array('element' => 'menu-item-submenu_type[__ID__]', 'value' => array('post_type_dropdown'))), array('key' => 'submenu_drops_side', 'descr' => __('Side of Dropdown Area', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'type' => 'select', 'values' => array(__('Drop To Right Side', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'drop_to_right', __('Drop To Left Side', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'drop_to_left', __('Drop To Center', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'drop_to_center')), array('descr' => __('Submenu Columns (Not For Standard Drops)', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'key' => 'submenu_columns', 'type' => 'select', 'values' => range(1, 10)), array('key' => 'submenu_enable_full_width', 'type' => 'checkbox', 'values' => array(__('Enable Full Width Dropdown (only for horizontal menu)', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']) => 'true')), array('name' => __('Dropdown Background Image', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'descr' => __('', $mega_main_menu->constant['MM_TEXTDOMAIN_ADMIN']), 'key' => 'submenu_bg_image', 'type' => 'background_image', 'default' => ''));
         $GLOBALS['mmm_menu_options_array'] = $options;
     }
     return $options;
 }
function stats_is_plugin_available($plugin_slug = '', $plugin_name = '', $link_class = '', $link_id = '')
{
    if (empty($plugin_slug)) {
        return;
    }
    if (empty($plugin_name)) {
        $plugin_name = __('Activate Plugin', 'stats');
    }
    $action = '';
    if (file_exists(WP_PLUGIN_DIR . '/' . $plugin_slug)) {
        $plugins = get_plugins('/' . $plugin_slug);
        if (!empty($plugins)) {
            $keys = array_keys($plugins);
            $plugin_file = $plugin_slug . '/' . $keys[0];
            $action = '<a 	id="' . esc_attr($link_id) . '"
							class="' . esc_attr($link_class) . '"
							href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=plugins'), 'activate-plugin_' . $plugin_file)) . '"title="' . esc_attr__('Activate Plugin', 'stats') . '"">' . esc_attr($plugin_name) . '</a>';
        }
    }
    if (empty($action) && function_exists('is_main_site') && is_main_site()) {
        $action = '<a 	id="' . esc_attr($link_id) . '"
							class="thickbox ' . esc_attr($link_class) . '"
							href="' . esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '&from=plugins&TB_iframe=true&width=600&height=550')) . '" title="' . esc_attr__('Install Plugin', 'stats') . '">' . esc_attr($plugin_name) . '</a>';
    }
    return $action;
}
 function init()
 {
     global $wpmudev_un;
     if (class_exists('WPMUDEV_Dashboard') || isset($wpmudev_un->version) && version_compare($wpmudev_un->version, '3.4', '<')) {
         return;
     }
     // Schedule update cron on main site only
     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, 'updates_check'));
     }
     add_action('delete_site_transient_update_plugins', array(&$this, 'updates_check'));
     //refresh after upgrade/install
     add_action('delete_site_transient_update_themes', array(&$this, 'updates_check'));
     //refresh after upgrade/install
     if (is_admin() && current_user_can('install_plugins')) {
         add_action('site_transient_update_plugins', array(&$this, 'filter_plugin_count'));
         add_action('site_transient_update_themes', array(&$this, 'filter_theme_count'));
         add_filter('plugins_api', array(&$this, 'filter_plugin_info'), 101, 3);
         //run later to work with bad autoupdate plugins
         add_filter('themes_api', array(&$this, 'filter_plugin_info'), 101, 3);
         //run later to work with bad autoupdate plugins
         add_action('admin_init', array(&$this, 'filter_plugin_rows'), 15);
         //make sure it runs after WP's
         add_action('core_upgrade_preamble', array(&$this, 'disable_checkboxes'));
         add_action('activated_plugin', array(&$this, 'set_activate_flag'));
         //remove version 1.0
         remove_action('admin_notices', 'wdp_un_check', 5);
         remove_action('network_admin_notices', 'wdp_un_check', 5);
         //remove version 2.0, a bit nasty but only way
         remove_all_actions('all_admin_notices', 5);
         //if dashboard is installed but not activated
         if (file_exists(WP_PLUGIN_DIR . '/wpmudev-updates/update-notifications.php')) {
             if (!get_site_option('wdp_un_autoactivated')) {
                 //include plugin API if necessary
                 if (!function_exists('activate_plugin')) {
                     require_once ABSPATH . 'wp-admin/includes/plugin.php';
                 }
                 $result = activate_plugin('/wpmudev-updates/update-notifications.php', network_admin_url('admin.php?page=wpmudev'), is_multisite());
                 if (!is_wp_error($result)) {
                     //if autoactivate successful don't show notices
                     update_site_option('wdp_un_autoactivated', 1);
                     return;
                 }
             }
             add_action('admin_print_styles', array(&$this, 'notice_styles'));
             add_action('all_admin_notices', array(&$this, 'activate_notice'), 5);
         } else {
             //dashboard not installed at all
             if (get_site_option('wdp_un_autoactivated')) {
                 update_site_option('wdp_un_autoactivated', 0);
                 //reset flag when dashboard is deleted
             }
             add_action('admin_print_styles', array(&$this, 'notice_styles'));
             add_action('all_admin_notices', array(&$this, 'install_notice'), 5);
         }
     }
 }
 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";
     }
 }
 /**
  * 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);
 }
 /**
  * Handles Google Return URL processing.
  *
  * @package s2Member\Google
  * @since 131123
  *
  * @attaches-to ``add_action("init");``
  *
  * @return null Or exits script execution after redirection.
  */
 public static function google_return()
 {
     global $current_site, $current_blog;
     if (!empty($_GET["s2member_pro_google_return"]) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_google_merchant_id"]) {
         $google["s2member_log"][] = "Return URL processed on: " . date("D M j, Y g:i:s a T");
         $google["s2member_log"][] = "Piping through s2Member's core/standard PayPal processor with `proxy_use` ( `ty-email` ).";
         $google["s2member_log"][] = "Please check PayPal RTN logs for further processing details.";
         $rtn_q = "&s2member_paypal_proxy=google&s2member_paypal_proxy_use=standard-emails,ty-email";
         if (!empty($_GET["s2member_pro_google_return_success"])) {
             $rtn_q .= "&s2member_paypal_return_success=" . rawurlencode(trim(stripslashes($_GET["s2member_pro_google_return_success"])));
         }
         $rtn_r = home_url("/?s2member_pro_google_return&s2member_paypal_return=1" . $rtn_q);
         $rtn_r = c_ws_plugin__s2member_utils_urls::add_s2member_sig($rtn_r, "s2member_paypal_proxy_verification");
         $google["s2member_log"][] = $rtn_r;
         wp_redirect($rtn_r);
         $logt = c_ws_plugin__s2member_utilities::time_details();
         $logv = c_ws_plugin__s2member_utilities::ver_details();
         $logm = c_ws_plugin__s2member_utilities::mem_details();
         $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . @$_SERVER["HTTP_USER_AGENT"];
         $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
         $log2 = is_multisite() && !is_main_site() ? "google-rtn-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "google-rtn.log";
         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) {
             if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])) {
                 if (is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files()) {
                     file_put_contents($logs_dir . "/" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($google, true)) . "\n\n", FILE_APPEND);
                 }
             }
         }
         exit;
         // Exit now.
     }
 }
Example #17
0
function bfox_bp_register_widgets()
{
    // Only register these widgets for the main blog
    if (is_main_site()) {
        do_action('bfox_bp_register_widgets');
    }
}
Example #18
0
 /**
  * Logs HTTP communication (if enabled).
  *
  * @package optimizeMember\Utilities
  * @since 120212
  */
 public static function http_api_debug($response = NULL, $state = NULL, $class = NULL, $args = NULL, $url = NULL)
 {
     if (!$GLOBALS['WS_PLUGIN__']['optimizemember']['o']['gateway_debug_logs']) {
         return;
     }
     // Logging is NOT enabled in this case.
     $is_optimizemember = !empty($args['optimizemember']) || strpos($url, 'optimizemember') !== FALSE ? TRUE : FALSE;
     if (!$GLOBALS['WS_PLUGIN__']['optimizemember']['o']['gateway_debug_logs_extensive'] && !$is_optimizemember) {
         return;
     }
     // Extensive logging is NOT enabled in this case.
     global $current_site, $current_blog;
     // For Multisite support.
     $http_api_debug = array('state' => $state, 'transport_class' => $class, 'args' => $args, 'url' => $url, 'response' => $response);
     $logt = c_ws_plugin__optimizemember_utilities::time_details();
     $logv = c_ws_plugin__optimizemember_utilities::ver_details();
     $logm = c_ws_plugin__optimizemember_utilities::mem_details();
     $log4 = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "\n" . 'User-Agent: ' . $_SERVER['HTTP_USER_AGENT'];
     $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
     $log2 = is_multisite() && !is_main_site() ? 'http-api-debug-4-' . trim(preg_replace('/[^a-z0-9]/i', '-', !empty($_log4) ? $_log4 : ''), '-') . '.log' : 'http-api-debug.log';
     $http_api_debug_conceal_private_info = c_ws_plugin__optimizemember_utils_logs::conceal_private_info(var_export($http_api_debug, TRUE));
     if (is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['optimizemember']['c']['logs_dir'])) {
         if (is_writable($logs_dir) && c_ws_plugin__optimizemember_utils_logs::archive_oversize_log_files()) {
             if ($GLOBALS['WS_PLUGIN__']['optimizemember']['o']['gateway_debug_logs_extensive']) {
                 file_put_contents($logs_dir . '/wp-' . $log2, 'LOG ENTRY: ' . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
             }
             if ($is_optimizemember) {
                 // Log optimizeMember HTTP connections separately.
                 file_put_contents($logs_dir . '/opm-' . $log2, 'LOG ENTRY: ' . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
             }
         }
     }
 }
Example #19
0
 /**
  * Handles Return templates w/ response message.
  *
  * @package s2Member\Return_Templates
  * @since 110720
  *
  * @param str $template Optional A Subscr. Gateway code should be used as the template name, or `default` is a multipurpose template. Defaults to `default`. Used in template selection.
  * @param str $response Optional. Response message to fill template with, using the Replacement Code `%%response%%` inside the template file. Defaults to: `Thank you. Please click the link below.`.
  * @param str $continue_html Optional. The HTML value of the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: `Continue`.
  * @param str $continue_link Optional. The HREF value for the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: ``home_url ("/")``.
  * @return str The full HTML code of the template. All Replacement Codes inside the template file will have already been filled by this routine.
  */
 public static function return_template($template = FALSE, $response = FALSE, $continue_html = FALSE, $continue_link = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_return_template", get_defined_vars());
     unset($__refs, $__v);
     $template = $template ? $template : "default";
     $continue_link = $continue_link ? $continue_link : home_url("/");
     $continue_html = $continue_html ? $continue_html : _x("Continue", "s2member-front", "s2member");
     $response = $response ? $response : _x("Thank you. Please click the link below.", "s2member-front", "s2member");
     $custom_template = file_exists(TEMPLATEPATH . "/" . $template . "-return.php") ? TEMPLATEPATH . "/" . $template . "-return.php" : false;
     $custom_template = file_exists(TEMPLATEPATH . "/" . $template . "-return.html") ? TEMPLATEPATH . "/" . $template . "-return.html" : $custom_template;
     $custom_template = file_exists(WP_CONTENT_DIR . "/" . $template . "-return.php") ? WP_CONTENT_DIR . "/" . $template . "-return.php" : $custom_template;
     $custom_template = file_exists(WP_CONTENT_DIR . "/" . $template . "-return.html") ? WP_CONTENT_DIR . "/" . $template . "-return.html" : $custom_template;
     $custom_template = !$custom_template && file_exists(TEMPLATEPATH . "/default-return.php") ? TEMPLATEPATH . "/default-return.php" : $custom_template;
     $custom_template = !$custom_template && file_exists(TEMPLATEPATH . "/default-return.html") ? TEMPLATEPATH . "/default-return.html" : $custom_template;
     $custom_template = !$custom_template && file_exists(WP_CONTENT_DIR . "/default-return.php") ? WP_CONTENT_DIR . "/default-return.php" : $custom_template;
     $custom_template = !$custom_template && file_exists(WP_CONTENT_DIR . "/default-return.html") ? WP_CONTENT_DIR . "/default-return.html" : $custom_template;
     $specific_template = $custom_template ? $custom_template : (file_exists($_default_specific_template = dirname(dirname(__FILE__)) . "/templates/returns/" . $template . "-return.php") ? $_default_specific_template : false);
     $code = trim(file_get_contents($specific_template ? $specific_template : ($_default_template = dirname(dirname(__FILE__)) . "/templates/returns/default-return.php")));
     $code = trim(!$custom_template || !is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() ? c_ws_plugin__s2member_utilities::evl($code) : $code);
     $doctype_html_head = c_ws_plugin__s2member_utils_html::doctype_html_head(get_bloginfo("name"), "ws_plugin__s2member_during_return_template_head_" . ($specific_template ? basename($specific_template) : "default-return.php"));
     $code = preg_replace("/%%doctype_html_head%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_doctype_html_head", $doctype_html_head, get_defined_vars())), $code);
     $code = preg_replace("/%%header%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_header", sprintf(_x('[ %s ] <strong><em>says&hellip;</em></strong>', "s2member-front", "s2member"), esc_html($_SERVER["HTTP_HOST"])), get_defined_vars())), $code);
     $code = preg_replace("/%%response%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_response", $response, get_defined_vars())), $code);
     $code = preg_replace("/%%continue%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_continue", '<a href="' . esc_attr($continue_link) . '">' . $continue_html . '</a>', get_defined_vars())), $code);
     $code = preg_replace("/%%support%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_support", sprintf(_x('If you need assistance, please <a href="%s" target="_blank">contact support</a>.', "s2member-front", "s2member"), esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_support_link"])), get_defined_vars())), $code);
     $code = preg_replace("/%%tracking%%/i", c_ws_plugin__s2member_utils_strings::esc_ds(apply_filters("ws_plugin__s2member_return_template_tracking", c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes(), get_defined_vars())), $code);
     return apply_filters("ws_plugin__s2member_return_template", $code, get_defined_vars());
 }
 /**
  * Logs HTTP communication (if enabled).
  *
  * @package s2Member\Utilities
  * @since 120212
  *
  * @return null Nothing.
  */
 public static function http_api_debug($response = NULL, $state = NULL, $class = NULL, $args = NULL, $url = NULL)
 {
     if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) {
         return;
     }
     // Logging is NOT enabled in this case.
     $is_s2member = !empty($args["s2member"]) || strpos($url, "s2member") !== false ? true : false;
     if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs_extensive"] && !$is_s2member) {
         return;
     }
     // Extensive logging is NOT enabled in this case.
     global $current_site, $current_blog;
     $http_api_debug = array("state" => $state, "transport_class" => $class, "args" => $args, "url" => $url, "response" => $response);
     $logt = c_ws_plugin__s2member_utilities::time_details();
     $logv = c_ws_plugin__s2member_utilities::ver_details();
     $logm = c_ws_plugin__s2member_utilities::mem_details();
     $log4 = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\nUser-Agent: " . $_SERVER["HTTP_USER_AGENT"];
     $log4 = is_multisite() && !is_main_site() ? ($_log4 = $current_blog->domain . $current_blog->path) . "\n" . $log4 : $log4;
     $log2 = is_multisite() && !is_main_site() ? "http-api-debug-4-" . trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-") . ".log" : "http-api-debug.log";
     $http_api_debug_conceal_private_info = c_ws_plugin__s2member_utils_logs::conceal_private_info(var_export($http_api_debug, true));
     if (is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])) {
         if (is_writable($logs_dir) && c_ws_plugin__s2member_utils_logs::archive_oversize_log_files()) {
             if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs_extensive"]) {
                 file_put_contents($logs_dir . "/wp-" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
             }
             if ($is_s2member) {
                 // Log s2Member HTTP connections separately.
                 file_put_contents($logs_dir . "/s2-" . $log2, "LOG ENTRY: " . $logt . "\n" . $logv . "\n" . $logm . "\n" . $log4 . "\n" . $http_api_debug_conceal_private_info . "\n\n", FILE_APPEND);
             }
         }
     }
 }
Example #21
0
 function get_bookings($ids_only = false, $status = false)
 {
     global $wpdb;
     $status_condition = $blog_condition = '';
     if (is_multisite()) {
         if (!is_main_site()) {
             //not the main blog, force single blog search
             $blog_condition = "AND e.blog_id=" . get_current_blog_id();
         } elseif (is_main_site() && !get_option('dbem_ms_global_events')) {
             $blog_condition = "AND (e.blog_id=" . get_current_blog_id() . ' OR e.blog_id IS NULL)';
         }
     }
     if (is_numeric($status)) {
         $status_condition = " AND booking_status={$status}";
     } elseif (EM_Object::array_is_numeric($status)) {
         $status_condition = " AND booking_status IN (" . implode(',', $status) . ")";
     }
     $EM_Booking = em_get_booking();
     //empty booking for fields
     $results = $wpdb->get_results("SELECT b." . implode(', b.', array_keys($EM_Booking->fields)) . " FROM " . EM_BOOKINGS_TABLE . " b, " . EM_EVENTS_TABLE . " e WHERE e.event_id=b.event_id AND person_id={$this->ID} {$blog_condition} {$status_condition} ORDER BY " . get_option('dbem_bookings_default_orderby', 'event_start_date') . " " . get_option('dbem_bookings_default_order', 'ASC'), ARRAY_A);
     $bookings = array();
     if ($ids_only) {
         foreach ($results as $booking_data) {
             $bookings[] = $booking_data['booking_id'];
         }
         return apply_filters('em_person_get_bookings', $bookings, $this);
     } else {
         foreach ($results as $booking_data) {
             $bookings[] = em_get_booking($booking_data);
         }
         return apply_filters('em_person_get_bookings', new EM_Bookings($bookings), $this);
     }
 }
 public static function no_recent_backup_reminder()
 {
     // Alert user if no new backups FINISHED within X number of days if enabled. Max 1 email notification per 24 hours period.
     if (is_main_site()) {
         // Only run for main site or standalone.
         if (pb_backupbuddy::$options['no_new_backups_error_days'] > 0) {
             if (pb_backupbuddy::$options['last_backup_finish'] > 0) {
                 $time_since_last = time() - pb_backupbuddy::$options['last_backup_finish'];
                 $days_since_last = round($time_since_last / 60 / 60 / 24);
                 if ($days_since_last > pb_backupbuddy::$options['no_new_backups_error_days']) {
                     $last_sent = get_transient('pb_backupbuddy_no_new_backup_error');
                     if (false === $last_sent) {
                         $last_sent = time();
                         set_transient('pb_backupbuddy_no_new_backup_error', $last_sent, 60 * 60 * 24);
                     }
                     if (time() - $last_sent > 60 * 60 * 24) {
                         // 24hrs+ elapsed since last email sent.
                         $message = 'Warning! BackupBuddy is configured to notify you if no new backups have completed in `' . pb_backupbuddy::$options['no_new_backups_error_days'] . '` days. It has been `' . $days_since_last . '` days since your last completed backup.';
                         pb_backupbuddy::status('warning', $message);
                         backupbuddy_core::mail_error($message);
                     }
                 }
             }
         }
     }
 }
 /**
  * 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());
 }
Example #24
0
 function plug_page()
 {
     global $psts;
     //add it under the pro blogs menu
     if (!is_main_site()) {
         add_submenu_page('psts-checkout', $psts->get_setting('ps_name'), $psts->get_setting('ps_name'), 'edit_pages', 'premium-support', array(&$this, 'support_page'));
     }
 }
Example #25
0
function get_blog_prefix()
{
    $blog_prefix = '';
    if (is_multisite() && !is_subdomain_install() && is_main_site()) {
        $blog_prefix = '/blog';
    }
    return $blog_prefix;
}
Example #26
0
 /**
  * Clear (i.e., reset) OPCache.
  *
  * @since 151002 Adding OPCache support.
  *
  * @param bool $manually True if clearing is done manually.
  * @param bool $maybe    Defaults to a true value.
  *
  * @return int Total keys cleared.
  */
 public function clearOpcache($manually = false, $maybe = true)
 {
     if (!is_multisite() || is_main_site() || current_user_can($this->network_cap)) {
         return $this->wipeOpcache($manually, $maybe);
     }
     return 0;
     // Not applicable.
 }
Example #27
0
function wpcf7_is_main_site()
{
    // will be removed when WordPress 2.9 is not supported
    if (function_exists('is_main_site')) {
        return is_main_site();
    }
    return false;
}
Example #28
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $this->_setManager(wprss_licensing_get_manager());
     // Only load notices if on admin side
     if (is_main_site() && is_admin()) {
         $this->_initNotices();
     }
 }
 /**
  * Callback for admin_menu hook,
  * Register LoginRadius_settings and its sanitization callback. Add Login Radius meta box to pages and posts.
  */
 public function admin_init()
 {
     register_setting('loginradius_share_settings', 'LoginRadius_share_settings');
     // Replicate Social Login configuration to the subblogs in the multisite network
     if (is_multisite() && is_main_site()) {
         add_action('wpmu_new_blog', array($this, 'replicate_settings_to_new_blog'));
         add_action('update_option_LoginRadius_share_settings', array($this, 'login_radius_update_old_blogs'));
     }
 }
 /**
  * Callback for admin_menu hook,
  * Register OpenSocialShare_settings and its sanitization callback. Add Open Social Share meta box to pages and posts.
  */
 public function admin_init()
 {
     register_setting('opensocialshare_api_settings', 'OpenSocialShare_API_settings', array($this, 'validate_options'));
     // Replicate Social Login configuration to the subblogs in the multisite network
     if (is_multisite() && is_main_site()) {
         add_action('wpmu_new_blog', array($this, 'replicate_settings_to_new_blog'));
         add_action('update_option_OpenSocialShare_API_settings', array($this, 'oss_update_old_blogs'));
     }
 }