function __construct() { add_action('psts_settings_page', array(&$this, 'settings')); if (is_pro_site()) { add_action('widgets_init', create_function('', 'return register_widget("ProSites_Pro_Widget");')); } }
function force_roles_on_free_sites($roles) { if (!class_exists('ProSites')) { return $roles; } // Doesn't apply if we don't have ProSites if (current_user_can('manage_network_options')) { return $roles; } // Doesn't affect Super Admins if (!function_exists('is_pro_site')) { return $roles; } // Erm... should never happen. $values = get_site_option('wdeb_pro'); $force = @$values['force_on_free']; if (!$force) { return $roles; } // No forcing, nothing to do if (is_pro_site()) { return $roles; } // Pro site, no forcing; // Force on ALL roles return array('administrator' => 'administrator', 'editor' => 'editor', 'author' => 'author', 'contributor' => 'contributor', 'subscriber' => 'subscriber'); }
function force_redirect($value) { global $psts; if (is_pro_site(false, 1)) { return 0; } else { return 1; } }
function __construct() { // add_action( 'psts_settings_page', array( &$this, 'settings' ) ); self::$user_label = __('Pro Widget', 'psts'); self::$user_description = __('Brag about your Pro Level with a widget', 'psts'); if (is_pro_site()) { add_action('widgets_init', create_function('', 'return register_widget("ProSites_Pro_Widget");')); } }
/** * Prevents Buddypress from displaying non-pro sites in activities or anything * If third parameter is null, the funcion has been called via bp_blogs_is_blog_recordable_for_user filter * otherwise via bp_blogs_is_blog_recordable * * @uses is_pro_site() * * @param int $recordable_globally previous value for recorded globally * @param int $blog_id ID of the blog being checked. * @param int $user_id (Optional) ID of the user for whom access is being checked. * * @return bool True if site is pro or originally was recorable False if filtering is on plus it's a non-pro site **/ function prosites_filter_blogs($recordable_globally = null, $blog_id = false, $user_id = null) { global $bp, $psts; // If related feature is off simply return original value if (!$psts->get_setting('bp_hide_unpaid')) { return $recordable_globally; } // Otherwise check if site is pro return is_pro_site($blog_id); }
function message() { global $psts, $current_screen, $blog_id; if (is_pro_site(false, $psts->get_setting('xmlrpc_level', 1)) || $this->ads_xmlrpc()) { return; } if ($current_screen->id == 'options-writing') { $notice = str_replace('LEVEL', $psts->get_level_setting($psts->get_setting('xmlrpc_level', 1), 'name'), $psts->get_setting('xmlrpc_message')); echo '<div class="error"><p><a href="' . $psts->checkout_url($blog_id) . '">' . $notice . '</a></p></div>'; } }
public function network_pro_posts_cb($atts) { if (!is_main_site() && !ALLOW_SUBSITE_PRO_POSTS) { return 'Sorry! This shortcode is only available for main site.'; } $defaults = array('posts_per_page' => 10, 'post_type' => 'post', 'randomize' => false, 'include_main_site' => false, 'pro_level' => 'all'); extract(shortcode_atts($defaults, $atts)); $posts = $sites = array(); if ($pro_level == 'all') { $levels = get_site_option('psts_levels'); } else { $levels = array($pro_level => 1); } foreach ($levels as $key => $value) { $sql = 'SELECT * from ' . $this->db->base_prefix . "pro_sites where level = '" . $key . "'"; $sites = $this->db->get_results($sql, OBJECT); } if ($include_main_site) { $main_site = new stdClass(); $main_site->blog_ID = 1; array_unshift($sites, $main_site); } foreach ($sites as $site) { if ($site->blog_ID == 0) { continue; } if (!is_pro_site($site->blog_ID)) { continue; } $sql = "SELECT * from " . $this->db->base_prefix . "network_posts where BLOG_ID = '" . $site->blog_ID . "' AND post_type = '" . $post_type . "' LIMIT 0, " . $posts_per_page; $subsite_posts = $this->db->get_results($sql, OBJECT); foreach ($subsite_posts as $subsite_post) { array_push($posts, $subsite_post); } } if ($randomize) { shuffle($posts); } $html = '<div class="pro_sites_posts">'; $html .= '<ul>'; foreach ($posts as $post) { $html .= '<li>'; $html .= '<h3><a href="' . network_get_permalink($post->BLOG_ID, $post->ID) . '">' . $post->post_title . '</a></h3>'; $html .= '</li>'; } $html .= '</ul>'; $html .= '</div>'; return $html; }
function admin_menu() { global $submenu, $psts; $blog_id = get_current_blog_id(); $menu_items = $psts->get_setting('ual', array()); foreach ($menu_items as $id => $options) { if ($options['name'] && !is_pro_site($blog_id, $options['level'])) { if (!$options['parent']) { add_menu_page($options['name'], $options['name'], 'manage_options', 'upgrade_redirect&source=test', array(&$this, 'redirect'), '', $options['priority']); } else { $redirect_url = $psts->checkout_url($blog_id, 'Menu - ' . $options['name']); $submenu[$options['parent']] = $this->magic_insert($options['priority'] - 1, array($options['name'], 'manage_options', $redirect_url), $submenu[$options['parent']]); } } } }
function filter($space) { global $psts; //don't filter on network settings page to avoid confusion if (is_network_admin()) { return $space; } $quota = $psts->get_level_setting($psts->get_level(), 'quota'); if ($quota && is_pro_site(false, $psts->get_level())) { return $quota; } else { if (function_exists('psts_hide_ads') && psts_hide_ads() && ($quota = $psts->get_setting("quota_upgraded_space"))) { return $quota; } else { return $space; } } }
function force_roles_on_free_sites($roles) { if (!class_exists('ProSites')) { return $roles; } // Doesn't apply if we don't have ProSites if (current_user_can('manage_network_options')) { return $roles; } // Doesn't affect Super Admins if (!function_exists('is_pro_site')) { return $roles; } // Erm... should never happen. $values = get_site_option('wdeb_pro'); $force = @$values['force_on_free']; if (!$force) { return $roles; } // No forcing, nothing to do if (is_pro_site()) { return $roles; } // Pro site, no forcing; // Force on ALL roles global $wp_roles; if (!isset($wp_roles)) { $wp_roles = new WP_Roles(); } $all_roles = array_keys($wp_roles->get_names()); return array_combine($all_roles, $all_roles); /* // Just WP default roles... return array ( 'administrator' => 'administrator', 'editor' => 'editor', 'author' => 'author', 'contributor' => 'contributor', 'subscriber' => 'subscriber', ); */ }
function blogs_directory_hide_some_blogs($blog_id) { $blogs_directory_hide_blogs = get_site_option('blogs_directory_hide_blogs'); /*Hide Pro Site blogs */ if (isset($blogs_directory_hide_blogs['pro_site']) && 1 == $blogs_directory_hide_blogs['pro_site']) { global $ProSites_Module_PayToBlog, $psts; //don't show unpaid blogs if (is_object($ProSites_Module_PayToBlog) && $psts->get_setting('ptb_front_disable') && !is_pro_site($blog_id, 1)) { return true; } } /*Hide Private blogs */ if (isset($blogs_directory_hide_blogs['private']) && 1 == $blogs_directory_hide_blogs['private']) { //don't show private blogs $privacy = get_blog_option($blog_id, 'blog_public'); if (is_numeric($privacy) && 1 != $privacy) { return true; } } return false; }
public function network_info_cb($atts) { $html = ''; $sites = wp_get_sites(); $html .= __('Total Sites: ', 'ni') . count($sites); $users = $this->_db->get_var("SELECT COUNT(1) FROM {$this->_db->users}"); $html .= '<br>' . __('Total Users: ', 'ni') . $users; if ($this->is_pro_site_active) { $pro_sites = 0; foreach ($sites as $site) { if (is_pro_site($site['blog_id'])) { $pro_sites++; } } $html .= '<br>' . __('Total Pro Sites: ', 'ni') . $pro_sites; } if (is_main_site() || defined('ALLOW_NI_IN_SUBSITE') && ALLOW_NI_IN_SUBSITE) { return $html; } return __('You are not allowed to use this shortcode!', 'ni'); }
function checkout_output($content) { //make sure we are in the loop and on current page loop item if (!in_the_loop() || get_queried_object_id() != get_the_ID()) { return $content; } //make sure logged in if (!is_user_logged_in()) { $content .= '<p>' . __('You must first login before you can choose a site to upgrade:', 'psts') . '</p>'; $content .= wp_login_form(array('echo' => false)); return $content; } //set blog_id if (isset($_POST['bid'])) { $blog_id = intval($_POST['bid']); } else { if (isset($_GET['bid'])) { $blog_id = intval($_GET['bid']); } else { $blog_id = false; } } if ($blog_id) { //check for admin permissions for this blog switch_to_blog($blog_id); $permission = current_user_can('edit_pages'); restore_current_blog(); if (!$permission) { $content = '<p>' . __('Sorry, but you do not have permission to upgrade this site. Only the site administrator can upgrade their site.', 'psts') . '</p>'; $content .= '<p><a href="' . $this->checkout_url() . '">« ' . __('Choose a different site', 'psts') . '</a></p>'; return $content; } if ($this->get_expire($blog_id) > 2147483647) { $level = $this->get_level_setting($this->get_level($blog_id), 'name'); $content = '<p>' . sprintf(__('This site has been permanently given %s status.', 'psts'), $level) . '</p>'; $content .= '<p><a href="' . $this->checkout_url() . '">« ' . __('Choose a different site', 'psts') . '</a></p>'; return $content; } //this is the main hook for gateways to add all their code $content = apply_filters('psts_checkout_output', $content, $blog_id); } else { //blogid not set $blogs = get_blogs_of_user(get_current_user_id()); if ($blogs) { $content .= '<h3>' . __('Please choose a site to Upgrade or Modify:', 'psts') . '</h3>'; $content .= '<ul>'; foreach ($blogs as $blog) { //check for permission switch_to_blog($blog->userblog_id); $permission = current_user_can('edit_pages'); restore_current_blog(); if (!$permission) { continue; } $has_blog = true; $level = $this->get_level($blog->userblog_id); $level_label = $level ? $this->get_level_setting($level, 'name') : sprintf(__('Not %s', 'psts'), $this->get_setting('rebrand')); $upgrade_label = is_pro_site($blog->userblog_id) ? sprintf(__('Modify "%s"', 'psts'), $blog->blogname) : sprintf(__('Upgrade "%s"', 'psts'), $blog->blogname); $content .= '<li><a href="' . $this->checkout_url($blog->userblog_id) . '">' . $upgrade_label . '</a> (<em>' . $blog->siteurl . '</em>) - ' . $level_label . '</li>'; } $content .= '</ul>'; } //show message if no valid blogs if (!$has_blog) { $content .= '<strong>' . __('Sorry, but it appears you are not an administrator for any sites.', 'psts') . '</strong>'; } } return '<div id="psts-checkout-output">' . $content . '</div>'; //div wrap }
/** * Check if user is upgrading or downgrading * * @param $blog_id * @param $post */ private static function is_modifying($blog_id, $post, $initAmount) { global $psts; $modify = false; $level = !empty($post['level']) ? $post['level'] : ''; $period = !empty($post['period']) ? $post['period'] : ''; if (empty($blog_id) || empty($level) || empty($period)) { return false; } //Check if there is existing profile id $profile_id = self::get_profile_id($blog_id); if (!empty($profile_id)) { //Get details from Paypal $profile_details = PaypalApiHelper::GetRecurringPaymentsProfileDetails($profile_id); //Check if there is any profile reference $profile_ref = !empty($profile_details['PROFILEREFERENCE']) ? $profile_details['PROFILEREFERENCE'] : ''; if (!empty($profile_ref)) { //Get Existing plan details from reference list($pre, $blog_id, $prev_level, $prev_period, $amount, $currency, $timestamp, $activation_key) = explode('_', $profile_ref); } if ($period != $prev_period || $level != $prev_level) { $modify = true; } } if ($modify) { //check for modifying if (!empty($blog_id) && is_pro_site($blog_id) && !is_pro_trial($blog_id)) { $modify = $psts->calc_upgrade($blog_id, $initAmount, $level, $period); $modify = $modify ? $modify : $psts->get_expire($blog_id); } else { $modify = false; } } return $modify; }
function admin_page() { global $wpdb; //double-check rights if (!current_user_can('manage_options')) { echo "<p>" . __('Nice Try...', 'mp') . "</p>"; //If accessed properly, this message doesn't appear. return; } $settings = get_option('mp_settings'); ?> <div class="wrap"> <h3 class="nav-tab-wrapper"> <?php $tab = !empty($_GET['tab']) ? $_GET['tab'] : 'main'; if (!$this->get_setting('disable_cart')) { $tabs = array('coupons' => __('Coupons', 'mp'), 'presentation' => __('Presentation', 'mp'), 'messages' => __('Messages', 'mp'), 'shipping' => __('Shipping', 'mp'), 'gateways' => __('Payments', 'mp'), 'shortcodes' => __('Shortcodes', 'mp'), 'importers' => __('Importers', 'mp')); } else { $tabs = array('presentation' => __('Presentation', 'mp'), 'shortcodes' => __('Shortcodes', 'mp'), 'importers' => __('Importers', 'mp')); } $tabhtml = array(); // If someone wants to remove or add a tab $tabs = apply_filters('marketpress_tabs', $tabs); $class = 'main' == $tab ? ' nav-tab-active' : ''; $tabhtml[] = ' <a href="' . admin_url('edit.php?post_type=product&page=marketpress') . '" class="nav-tab' . $class . '">' . __('General', 'mp') . '</a>'; foreach ($tabs as $stub => $title) { $class = $stub == $tab ? ' nav-tab-active' : ''; $tabhtml[] = ' <a href="' . admin_url('edit.php?post_type=product&page=marketpress&tab=' . $stub) . '" class="nav-tab' . $class . '">' . $title . '</a>'; } echo implode("\n", $tabhtml); ?> </h3> <div class="clear"></div> <?php switch ($tab) { //---------------------------------------------------// case "main": //save settings if (isset($_POST['marketplace_settings'])) { //allow plugins to verify settings before saving if (isset($_POST['mp']['tax']['canada_rate'])) { foreach ($_POST['mp']['tax']['canada_rate'] as $key => $rate) { $tax_rate = $rate * 0.01; $_POST['mp']['tax']['canada_rate'][$key] = $tax_rate < 1 && $tax_rate >= 0 ? $tax_rate : 0; } } else { $tax_rate = $_POST['mp']['tax']['rate'] * 0.01; $_POST['mp']['tax']['rate'] = $tax_rate < 1 && $tax_rate >= 0 ? $tax_rate : 0; } $settings = array_merge($settings, apply_filters('mp_main_settings_filter', $_POST['mp'])); update_option('mp_settings', $settings); echo '<div class="updated fade"><p>' . __('Settings saved.', 'mp') . '</p></div>'; } ?> <script type="text/javascript"> jQuery(document).ready(function($) { $("#mp-country-select, #mp-currency-select").change(function() { $("#mp-main-form").submit(); }); }); </script> <div class="icon32"><img src="<?php echo $this->plugin_url . 'images/settings.png'; ?> " /></div> <h2><?php _e('General Settings', 'mp'); ?> </h2> <div id="poststuff" class="metabox-holder mp-settings"> <form id="mp-main-form" method="post" action="edit.php?post_type=product&page=marketpress&tab=main"> <input type="hidden" name="marketplace_settings" value="1" /> <div class="postbox"> <h3 class='hndle'><span><?php _e('Location Settings', 'mp'); ?> </span></h3> <div class="inside"> <span class="description"><?php _e('This is the base location that shipping and tax rates will be calculated from.', 'mp'); ?> </span> <table class="form-table"> <tr> <th scope="row"><?php _e('Base Country', 'mp'); ?> </th> <td> <select id="mp-country-select" name="mp[base_country]"> <?php foreach ($this->countries as $key => $value) { ?> <option value="<?php echo $key; ?> "<?php selected($this->get_setting('base_country'), $key); ?> ><?php echo esc_attr($value); ?> </option><?php } ?> </select> </td> </tr> <?php switch ($this->get_setting('base_country')) { case 'US': $list = $this->usa_states; break; case 'CA': $list = $this->canadian_provinces; break; case 'GB': $list = $this->uk_counties; break; case 'AU': $list = $this->australian_states; break; default: $list = false; } //only show if correct country if (is_array($list)) { ?> <tr> <th scope="row"><?php _e('Base State/Province/Region', 'mp'); ?> </th> <td> <select name="mp[base_province]"> <?php foreach ($list as $key => $value) { ?> <option value="<?php echo esc_attr($key); ?> "<?php selected($this->get_setting('base_province'), $key); ?> ><?php echo esc_attr($value); ?> </option><?php } ?> </select> </td> </tr> <?php } //only show if correct country or US province if (is_array($list) || in_array($this->get_setting('base_country'), array('UM', 'AS', 'FM', 'GU', 'MH', 'MP', 'PW', 'PR', 'PI'))) { ?> <tr> <th scope="row"><?php _e('Base Zip/Postal Code', 'mp'); ?> </th> <td> <input value="<?php echo esc_attr($this->get_setting('base_zip')); ?> " size="10" name="mp[base_zip]" type="text" /> </td> </tr> <?php } ?> </table> </div> </div> <div class="postbox"> <h3 class='hndle'><span><?php _e('Tax Settings', 'mp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <?php switch ($this->get_setting('base_country')) { case 'US': ?> <tr> <th scope="row"><?php echo sprintf(__('%s Tax Rate', 'mp'), esc_attr($this->usa_states[$this->get_setting('base_province')])); ?> </th> <td> <input value="<?php echo $this->get_setting('tax->rate') * 100; ?> " size="3" name="mp[tax][rate]" type="text" style="text-align:right;" />% </td> </tr> <?php break; case 'CA': ?> <tr> <th scope="row"><a href="http://sbinfocanada.about.com/od/pst/a/PSTecommerce.htm" target="_blank"><?php _e('Total Tax Rates (VAT,GST,PST,HST)', 'mp'); ?> </a></th> <td> <span class="description"><a href="http://en.wikipedia.org/wiki/Sales_taxes_in_Canada" target="_blank"><?php _e('Current Rates »', 'mp'); ?> </a></span> <table cellspacing="0" cellpadding="0"> <?php foreach ($this->canadian_provinces as $key => $label) { ?> <tr> <td style="padding: 0 5px;"><label for="mp_tax_<?php echo $key; ?> "><?php echo esc_attr($label); ?> </label></td> <td style="padding: 0 5px;"><input value="<?php echo $this->get_setting("tax->canada_rate->{$key}") * 100; ?> " size="3" id="mp_tax_<?php echo $key; ?> " name="mp[tax][canada_rate][<?php echo $key; ?> ]" type="text" style="text-align:right;" />%</td> </tr> <?php } ?> </table> </td> </tr> <?php break; case 'GB': ?> <tr> <th scope="row"><?php _e('VAT Tax Rate', 'mp'); ?> </th> <td> <input value="<?php echo $this->get_setting('tax->rate') * 100; ?> " size="3" name="mp[tax][rate]" type="text" style="text-align:right;" />% </td> </tr> <?php break; case 'AU': ?> <tr> <th scope="row"><?php _e('GST Tax Rate', 'mp'); ?> </th> <td> <input value="<?php echo $this->get_setting('tax->rate') * 100; ?> " size="3" name="mp[tax][rate]" type="text" style="text-align:right;" />% </td> </tr> <?php break; default: //in european union if (in_array($this->get_setting('base_country'), $this->eu_countries)) { ?> <tr> <th scope="row"><?php _e('VAT Tax Rate', 'mp'); ?> </th> <td> <input value="<?php echo $this->get_setting('tax->rate') * 100; ?> " size="3" name="mp[tax][rate]" type="text" style="text-align:right;" />% </td> </tr> <?php } else { //all other countries ?> <tr> <th scope="row"><?php _e('Country Total Tax Rate (VAT, GST, Etc.)', 'mp'); ?> </th> <td> <input value="<?php echo $this->get_setting('tax->rate') * 100; ?> " size="3" name="mp[tax][rate]" type="text" style="text-align:right;" />% </td> </tr> <tr> <th scope="row"><?php _e('Tax Orders Outside Your Base Country?', 'mp'); ?> </th> <td> <label><input value="1" name="mp[tax][tax_outside]" type="radio"<?php checked($this->get_setting('tax->tax_outside'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[tax][tax_outside]" type="radio"<?php checked($this->get_setting('tax->tax_outside'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> </td> </tr> <?php } break; } ?> <tr> <th scope="row"><?php _e('Apply Tax To Shipping Fees?', 'mp'); ?> </th> <td> <label><input value="1" name="mp[tax][tax_shipping]" type="radio"<?php checked($this->get_setting('tax->tax_shipping'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[tax][tax_shipping]" type="radio"<?php checked($this->get_setting('tax->tax_shipping'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> <br /><span class="description"><?php _e('Please see your local tax laws. Most areas charge tax on shipping fees.', 'mp'); ?> </span> </td> </tr> <tr> <th scope="row"><?php _e('Enter Prices Inclusive of Tax?', 'mp'); ?> </th> <td> <label><input value="1" name="mp[tax][tax_inclusive]" type="radio"<?php checked($this->get_setting('tax->tax_inclusive'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[tax][tax_inclusive]" type="radio"<?php checked($this->get_setting('tax->tax_inclusive'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> <br /><span class="description"><?php _e('Enabling this option allows you to enter and show all prices inclusive of tax, while still listing the tax total as a line item in shopping carts. Please see your local tax laws.', 'mp'); ?> </span> </td> </tr> </table> </div> </div> <div class="postbox"> <h3 class='hndle'><span><?php _e('Currency Settings', 'mp'); ?> </span></h3> <div class="inside"> <span class="description"><?php _e('These preferences affect display only. Your payment gateway of choice may not support every currency listed here.', 'mp'); ?> </span> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e('Store Currency', 'mp'); ?> </th> <td> <select id="mp-currency-select" name="mp[currency]"> <?php foreach ($this->currencies as $key => $value) { ?> <option value="<?php echo $key; ?> "<?php selected($this->get_setting('currency'), $key); ?> ><?php echo esc_attr($value[0]) . ' - ' . $this->format_currency($key); ?> </option><?php } ?> </select> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Currency Symbol Position', 'mp'); ?> </th> <td> <label><input value="1" name="mp[curr_symbol_position]" type="radio"<?php checked($this->get_setting('curr_symbol_position'), 1); ?> > <?php echo $this->format_currency($this->get_setting('currency')); ?> 100</label><br /> <label><input value="2" name="mp[curr_symbol_position]" type="radio"<?php checked($this->get_setting('curr_symbol_position'), 2); ?> > <?php echo $this->format_currency($this->get_setting('currency')); ?> 100</label><br /> <label><input value="3" name="mp[curr_symbol_position]" type="radio"<?php checked($this->get_setting('curr_symbol_position'), 3); ?> > 100<?php echo $this->format_currency($this->get_setting('currency')); ?> </label><br /> <label><input value="4" name="mp[curr_symbol_position]" type="radio"<?php checked($this->get_setting('curr_symbol_position'), 4); ?> > 100 <?php echo $this->format_currency($this->get_setting('currency')); ?> </label> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Show Decimal in Prices', 'mp'); ?> </th> <td> <label><input value="1" name="mp[curr_decimal]" type="radio"<?php checked($this->get_setting('curr_decimal') !== 0 ? 1 : 0, 1); ?> > <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[curr_decimal]" type="radio"<?php checked($this->get_setting('curr_decimal'), 0); ?> > <?php _e('No', 'mp'); ?> </label> </td> </tr> </table> </div> </div> <div class="postbox"> <h3 class='hndle'><span><?php _e('Miscellaneous Settings', 'mp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tr id="mp-inventory-setting"> <th scope="row"><?php _e('Inventory Warning Threshold', 'mp'); ?> </th> <td> <span class="description"><?php _e('At what low stock count do you want to be warned for products you have enabled inventory tracking for?', 'mp'); ?> </span><br /> <select name="mp[inventory_threshhold]"> <?php $inventory_threshhold = $this->get_setting('inventory_threshhold', 3); for ($i = 0; $i <= 100; $i++) { $selected = $inventory_threshhold == $i ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '">' . $i . '</option>'; } ?> </select> </td> </tr> <tr id="mp-downloads-setting"> <th scope="row"><?php _e('Maximum Downloads', 'mp'); ?> </th> <td> <span class="description"><?php _e('How many times may a customer download a file they have purchased? (It\'s best to set this higher than one in case they have any problems downloading)', 'mp'); ?> </span><br /> <select name="mp[max_downloads]"> <?php $max_downloads = $this->get_setting('max_downloads', 5); for ($i = 1; $i <= 100; $i++) { $selected = $max_downloads == $i ? ' selected="selected"' : ''; echo '<option value="' . $i . '"' . $selected . '">' . $i . '</option>'; } ?> </select> </td> </tr> <tr> <th scope="row"><?php _e('Force Login', 'mp'); ?> </th> <td> <?php $force_login = $this->get_setting('force_login') ? 1 : 0; ?> <label><input value="1" name="mp[force_login]" type="radio"<?php checked($force_login, 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[force_login]" type="radio"<?php checked($force_login, 0); ?> /> <?php _e('No', 'mp'); ?> </label> <br /><span class="description"><?php _e('Whether or not customers must be registered and logged in to checkout. (Not recommended: Enabling this can lower conversions)', 'mp'); ?> </span> </td> </tr> <tr> <th scope="row"><?php _e('Product Listings Only', 'mp'); ?> </th> <td> <label><input value="1" name="mp[disable_cart]" type="radio"<?php checked($this->get_setting('disable_cart'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[disable_cart]" type="radio"<?php checked($this->get_setting('disable_cart'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> <br /><span class="description"><?php _e('This option turns MarketPress into more of a product listing plugin, disabling shopping carts, checkout, and order management. This is useful if you simply want to list items you can buy in a store somewhere else, optionally linking the "Buy Now" buttons to an external site. Some examples are a car dealership, or linking to songs/albums in itunes, or linking to products on another site with your own affiliate links.', 'mp'); ?> </span> </td> </tr> <tr> <th scope="row"><?php _e('Google Analytics Ecommerce Tracking', 'mp'); ?> </th> <td> <select name="mp[ga_ecommerce]"> <option value="none"<?php selected($this->get_setting('ga_ecommerce'), 'none'); ?> ><?php _e('None', 'mp'); ?> </option> <option value="new"<?php selected($this->get_setting('ga_ecommerce'), 'new'); ?> ><?php _e('Asynchronous Tracking Code', 'mp'); ?> </option> <option value="old"<?php selected($this->get_setting('ga_ecommerce'), 'old'); ?> ><?php _e('Old Tracking Code', 'mp'); ?> </option> </select> <br /><span class="description"><?php _e('If you already use Google Analytics for your website, you can track detailed ecommerce information by enabling this setting. Choose whether you are using the new asynchronous or old tracking code. Before Google Analytics can report ecommerce activity for your website, you must enable ecommerce tracking on the profile settings page for your website. Also keep in mind that some gateways do not reliably show the receipt page, so tracking may not be accurate in those cases. It is recommended to use the PayPal gateway for the most accurate data. <a href="http://analytics.blogspot.com/2009/05/how-to-use-ecommerce-tracking-in-google.html" target="_blank">More information »</a>', 'mp'); ?> </span> </td> </tr> <tr> <th scope="row"><?php _e('Special Instructions Field', 'mp'); ?> </th> <td> <label><input value="1" name="mp[special_instructions]" type="radio"<?php checked($this->get_setting('special_instructions'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[special_instructions]" type="radio"<?php checked($this->get_setting('special_instructions'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> <br /><span class="description"><?php printf(__('Enabling this field will display a textbox on the shipping checkout page for users to enter special instructions for their order. Useful for product personalization, etc. Note you may want to <a href="%s">adjust the message on the shipping page.', 'mp'), admin_url('edit.php?post_type=product&page=marketpress&tab=messages#mp_msgs_shipping')); ?> </span> </td> </tr> </table> </div> </div> <?php //for adding additional settings for a shipping module do_action('mp_general_settings'); ?> <p class="submit"> <input class="button-primary" type="submit" name="submit_settings" value="<?php _e('Save Changes', 'mp'); ?> " /> </p> </form> </div> <?php break; //---------------------------------------------------// //---------------------------------------------------// case "coupons": $coupons = get_option('mp_coupons'); if (!is_array($coupons)) { $coupons = array(); } //delete checked coupons if (isset($_POST['allcoupon_delete'])) { //check nonce check_admin_referer('mp_coupons'); if (is_array($_POST['coupons_checks'])) { //loop through and delete foreach ($_POST['coupons_checks'] as $del_code) { unset($coupons[$del_code]); } update_option('mp_coupons', $coupons); //display message confirmation echo '<div class="updated fade"><p>' . __('Coupon(s) succesfully deleted.', 'mp') . '</p></div>'; } } //save or add coupon if (isset($_POST['submit_settings'])) { //check nonce check_admin_referer('mp_coupons'); $error = false; $new_coupon_code = preg_replace('/[^A-Z0-9_-]/', '', strtoupper($_POST['coupon_code'])); if (empty($new_coupon_code)) { $error[] = __('Please enter a valid Coupon Code', 'mp'); } $coupons[$new_coupon_code]['discount'] = round($_POST['discount'], 2); if ($coupons[$new_coupon_code]['discount'] <= 0) { $error[] = __('Please enter a valid Discount Amount', 'mp'); } $coupons[$new_coupon_code]['discount_type'] = $_POST['discount_type']; if ($coupons[$new_coupon_code]['discount_type'] != 'amt' && $coupons[$new_coupon_code]['discount_type'] != 'pct') { $error[] = __('Please choose a valid Discount Type', 'mp'); } $coupons[$new_coupon_code]['start'] = strtotime($_POST['start']); if ($coupons[$new_coupon_code]['start'] === false) { $error[] = __('Please enter a valid Start Date', 'mp'); } $coupons[$new_coupon_code]['end'] = strtotime($_POST['end']); if ($coupons[$new_coupon_code]['end'] && $coupons[$new_coupon_code]['end'] < $coupons[$new_coupon_code]['start']) { $error[] = __('Please enter a valid End Date not earlier than the Start Date', 'mp'); } $coupons[$new_coupon_code]['uses'] = is_numeric($_POST['uses']) ? (int) $_POST['uses'] : ''; if (!$error) { update_option('mp_coupons', $coupons); $new_coupon_code = ''; echo '<div class="updated fade"><p>' . __('Coupon succesfully saved.', 'mp') . '</p></div>'; } } //if editing a coupon $new_coupon_code = isset($_GET['code']) ? $_GET['code'] : null; ?> <script type="text/javascript"> jQuery(document).ready(function ($) { jQuery.datepicker.setDefaults(jQuery.datepicker.regional['<?php echo $this->language; ?> ']); jQuery('.pickdate').datepicker({dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, minDate: 0, firstDay: <?php echo get_option('start_of_week') == '0' ? 7 : get_option('start_of_week'); ?> }); }); </script> <div class="icon32"><img src="<?php echo $this->plugin_url . 'images/service.png'; ?> " /></div> <h2><?php _e('Coupons', 'mp'); ?> </h2> <p><?php _e('You can create, delete, or update coupon codes for your store here.', 'mp'); ?> </p> <?php $apage = isset($_GET['apage']) ? intval($_GET['apage']) : 1; $num = isset($_GET['num']) ? intval($_GET['num']) : 10; $coupon_list = get_option('mp_coupons'); $total = is_array($coupon_list) ? count($coupon_list) : 0; if ($total) { $coupon_list = array_slice($coupon_list, intval(($apage - 1) * $num), intval($num), true); } $coupon_navigation = paginate_links(array('base' => add_query_arg('apage', '%#%'), 'format' => '', 'total' => ceil($total / $num), 'current' => $apage)); $page_link = $apage > 1 ? '&apage=' . $apage : ''; ?> <form id="form-coupon-list" action="edit.php?post_type=product&page=marketpress&tab=coupons<?php echo $page_link; ?> " method="post"> <?php wp_nonce_field('mp_coupons'); ?> <div class="tablenav"> <?php if ($coupon_navigation) { echo "<div class='tablenav-pages'>{$coupon_navigation}</div>"; } ?> <div class="alignleft"> <input type="submit" value="<?php _e('Delete', 'mp'); ?> " name="allcoupon_delete" class="button-secondary delete" /> <br class="clear" /> </div> </div> <br class="clear" /> <?php // define the columns to display, the syntax is 'internal name' => 'display name' $posts_columns = array('code' => __('Coupon Code', 'mp'), 'discount' => __('Discount', 'mp'), 'start' => __('Start Date', 'mp'), 'end' => __('Expire Date', 'mp'), 'used' => __('Used', 'mp'), 'remaining' => __('Remaining Uses', 'mp'), 'edit' => __('Edit', 'mp')); ?> <table width="100%" cellpadding="3" cellspacing="3" class="widefat"> <thead> <tr> <th scope="col" class="check-column"><input type="checkbox" /></th> <?php foreach ($posts_columns as $column_id => $column_display_name) { $col_url = $column_display_name; ?> <th scope="col"><?php echo $col_url; ?> </th> <?php } ?> </tr> </thead> <tbody id="the-list"> <?php if (is_array($coupon_list) && count($coupon_list)) { $bgcolor = $class = ''; foreach ($coupon_list as $coupon_code => $coupon) { $class = 'alternate' == $class ? '' : 'alternate'; //assign classes based on coupon availability $class = $this->check_coupon($coupon_code) ? $class . ' coupon-active' : $class . ' coupon-inactive'; echo '<tr class="' . $class . ' blog-row"> <th scope="row" class="check-column"> <input type="checkbox" name="coupons_checks[]"" value="' . $coupon_code . '" /> </th>'; foreach ($posts_columns as $column_name => $column_display_name) { switch ($column_name) { case 'code': ?> <th scope="row"> <?php echo $coupon_code; ?> </th> <?php break; case 'discount': ?> <th scope="row"> <?php if ($coupon['discount_type'] == 'pct') { echo $coupon['discount'] . '%'; } else { if ($coupon['discount_type'] == 'amt') { echo $this->format_currency('', $coupon['discount']); } } ?> </th> <?php break; case 'start': ?> <th scope="row"> <?php echo date_i18n(get_option('date_format'), $coupon['start']); ?> </th> <?php break; case 'end': ?> <th scope="row"> <?php echo $coupon['end'] ? date_i18n(get_option('date_format'), $coupon['end']) : __('No End', 'mp'); ?> </th> <?php break; case 'used': ?> <th scope="row"> <?php echo isset($coupon['used']) ? number_format_i18n($coupon['used']) : 0; ?> </th> <?php break; case 'remaining': ?> <th scope="row"> <?php if ($coupon['uses']) { echo number_format_i18n(intval($coupon['uses']) - intval(@$coupon['used'])); } else { _e('Unlimited', 'mp'); } ?> </th> <?php break; case 'edit': ?> <th scope="row"> <a href="edit.php?post_type=product&page=marketpress&tab=coupons<?php echo $page_link; ?> &code=<?php echo $coupon_code; ?> #add_coupon"><?php _e('Edit', 'mp'); ?> »</a> </th> <?php break; } } ?> </tr> <?php } } else { $bgcolor = ''; ?> <tr style='background-color: <?php echo $bgcolor; ?> '> <td colspan="7"><?php _e('No coupons yet.', 'mp'); ?> </td> </tr> <?php } // end if coupons ?> </tbody> <tfoot> <tr> <th scope="col" class="check-column"><input type="checkbox" /></th> <?php foreach ($posts_columns as $column_id => $column_display_name) { $col_url = $column_display_name; ?> <th scope="col"><?php echo $col_url; ?> </th> <?php } ?> </tr> </tfoot> </table> <div class="tablenav"> <?php if ($coupon_navigation) { echo "<div class='tablenav-pages'>{$coupon_navigation}</div>"; } ?> </div> <div id="poststuff" class="metabox-holder mp-settings"> <div class="postbox"> <h3 class='hndle'><span> <?php if (isset($_GET['code']) || isset($error) && $error) { _e('Edit Coupon', 'mp'); } else { _e('Add Coupon', 'mp'); } ?> </span></h3> <div class="inside"> <?php //display error message if it exists if (isset($error) && $error) { ?> <div class="error"><p><?php echo implode("<br>\n", $error); ?> </p></div><?php } //setup defaults if (isset($coupons[$new_coupon_code])) { $discount = isset($coupons[$new_coupon_code]['discount']) && isset($coupons[$new_coupon_code]['discount_type']) && $coupons[$new_coupon_code]['discount_type'] == 'amt' ? round($coupons[$new_coupon_code]['discount'], 2) : $coupons[$new_coupon_code]['discount']; } else { $discount = ''; } $discount_type = isset($coupons[$new_coupon_code]['discount_type']) ? $coupons[$new_coupon_code]['discount_type'] : ''; $start = !empty($coupons[$new_coupon_code]['start']) ? date('Y-m-d', $coupons[$new_coupon_code]['start']) : date('Y-m-d'); $end = !empty($coupons[$new_coupon_code]['end']) ? date('Y-m-d', $coupons[$new_coupon_code]['end']) : ''; $uses = isset($coupons[$new_coupon_code]['uses']) ? $coupons[$new_coupon_code]['uses'] : ''; ?> <table id="add_coupon"> <thead> <tr> <th> <?php _e('Coupon Code', 'mp'); ?> <br /> <small style="font-weight: normal;"><?php _e('Letters and Numbers only', 'mp'); ?> </small> </th> <th><?php _e('Discount', 'mp'); ?> </th> <th><?php _e('Start Date', 'mp'); ?> </th> <th> <?php _e('Expire Date', 'mp'); ?> <br /> <small style="font-weight: normal;"><?php _e('No end if blank', 'mp'); ?> </small> </th> <th> <?php _e('Allowed Uses', 'mp'); ?> <br /> <small style="font-weight: normal;"><?php _e('Unlimited if blank', 'mp'); ?> </small> </th> </tr> </thead> <tbody> <tr> <td> <input value="<?php echo $new_coupon_code; ?> " name="coupon_code" type="text" style="text-transform: uppercase;" /> </td> <td> <input value="<?php echo $discount; ?> " size="3" name="discount" type="text" /> <select name="discount_type"> <option value="amt"<?php selected($discount_type, 'amt'); ?> ><?php echo $this->format_currency(); ?> </option> <option value="pct"<?php selected($discount_type, 'pct'); ?> >%</option> </select> </td> <td> <input value="<?php echo $start; ?> " class="pickdate" size="11" name="start" type="text" /> </td> <td> <input value="<?php echo $end; ?> " class="pickdate" size="11" name="end" type="text" /> </td> <td> <input value="<?php echo $uses; ?> " size="4" name="uses" type="text" /> </td> </tr> </tbody> </table> <p class="submit"> <input class="button-primary" type="submit" name="submit_settings" value="<?php _e('Save Coupon', 'mp'); ?> " /> </p> </div> </div> </div> </form> <?php break; //---------------------------------------------------// //---------------------------------------------------// case "presentation": //save settings if (isset($_POST['marketplace_settings'])) { //get old store slug $old_slug = $this->get_setting('slugs->store'); //filter slugs $_POST['mp']['slugs'] = array_map('sanitize_title', (array) $_POST['mp']['slugs']); // Fixing http://premium.wpmudev.org/forums/topic/store-page-content-overwritten $new_slug = $_POST['mp']['slugs']['store']; $new_post_id = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '{$new_slug}' AND post_type = 'page'"); if ($new_slug != $old_slug && $new_post_id != 0) { echo '<div class="error fade"><p>' . __('Store base URL conflicts with another page', 'mp') . '</p></div>'; } else { $settings = array_merge($settings, apply_filters('mp_presentation_settings_filter', $_POST['mp'])); update_option('mp_settings', $settings); $this->create_store_page($old_slug); //schedule flush rewrite rules due to product slugs on next page load (too late to do it here) update_option('mp_flush_rewrite', 1); echo '<div class="updated fade"><p>' . __('Settings saved.', 'mp') . '</p></div>'; } } ?> <div class="icon32"><img src="<?php echo $this->plugin_url . 'images/my_work.png'; ?> " /></div> <h2><?php _e('Presentation Settings', 'mp'); ?> </h2> <div id="poststuff" class="metabox-holder mp-settings"> <form method="post" action="edit.php?post_type=product&page=marketpress&tab=presentation"> <input type="hidden" name="marketplace_settings" value="1" /> <div class="postbox"> <h3 class='hndle'><span><?php _e('General Settings', 'mp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <th scope="row"><?php _e('Store Style', 'mp'); ?> </th> <td> <?php $this->store_themes_select(); ?> <br /><span class="description"><?php _e('This option changes the built-in css styles for store pages.', 'mp'); ?> </span> <?php if (is_multisite() && is_super_admin() || !is_multisite()) { ?> <br /><span class="description"><?php printf(__('For a custom css style, save your css file with the "MarketPress Style: NAME" header in the "%s/marketpress-styles/" folder and it will appear in this list so you may select it. You can also select "None" and create custom theme templates and css to make your own completely unique store design. More information on that <a href="%sthemes/Themeing_MarketPress.txt">here »</a>', 'mp'), WP_CONTENT_DIR, $this->plugin_url); ?> </span> <h4><?php _e('Full-featured MarketPress Themes:', 'mp'); ?> </h4> <div class="mp-theme-preview"><a title="<?php _e('Download Now »', 'mp'); ?> " href="http://premium.wpmudev.org/project/frame-market-theme"><img alt="FrameMarket Theme" src="http://premium.wpmudev.org/wp-content/projects/219/listing-image-thumb.png" /> <strong><?php _e('FrameMarket/GridMarket', 'mp'); ?> </strong></a><br /> <?php _e('The ultimate MarkePress theme brings visual perfection to WordPress e-commerce. This professional front-end does all the work for you!', 'mp'); ?> </div> <div class="mp-theme-preview"><a title="<?php _e('Download Now »', 'mp'); ?> " href="http://premium.wpmudev.org/project/simplemarket"><img alt="SimpleMarket Theme" src="http://premium.wpmudev.org/wp-content/projects/237/listing-image-thumb.png" /> <strong><?php _e('SimpleMarket', 'mp'); ?> </strong></a><br /> <?php _e('The FREE SimpleMarket Theme uses an HTML 5 responsive design so your e-commerce site looks great across all screen-sizes and devices such as smartphones or tablets!', 'mp'); ?> </div> <?php } ?> </td> </tr> </table> </div> </div> <div class="postbox"> <h3 class='hndle'><span><?php _e('Single Product Settings', 'mp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tr> <th scope="row"><?php _e('Checkout Button Type', 'mp'); ?> </th> <td> <label><input value="addcart" name="mp[product_button_type]" type="radio"<?php checked($this->get_setting('product_button_type'), 'addcart'); ?> /> <?php _e('Add To Cart', 'mp'); ?> </label><br /> <label><input value="buynow" name="mp[product_button_type]" type="radio"<?php checked($this->get_setting('product_button_type'), 'buynow'); ?> /> <?php _e('Buy Now', 'mp'); ?> </label> </td> </tr> <tr> <th scope="row"><?php _e('Show Quantity Option', 'mp'); ?> </th> <td> <label><input value="1" name="mp[show_quantity]" type="radio"<?php checked($this->get_setting('show_quantity'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[show_quantity]" type="radio"<?php checked($this->get_setting('show_quantity'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> </td> </tr> <tr> <th scope="row"><?php _e('Show Product Image', 'mp'); ?> </th> <td> <label><input value="1" name="mp[show_img]" type="radio"<?php checked($this->get_setting('show_img'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[show_img]" type="radio"<?php checked($this->get_setting('show_img'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> </td> </tr> <tr> <th scope="row"><?php _e('Product Image Size', 'mp'); ?> </th> <td> <label><input value="thumbnail" name="mp[product_img_size]" type="radio"<?php checked($this->get_setting('product_img_size'), 'thumbnail'); ?> /> <a href="options-media.php"><?php _e('WP Thumbnail size', 'mp'); ?> </a></label><br /> <label><input value="medium" name="mp[product_img_size]" type="radio"<?php checked($this->get_setting('product_img_size'), 'medium'); ?> /> <a href="options-media.php"><?php _e('WP Medium size', 'mp'); ?> </a></label><br /> <label><input value="large" name="mp[product_img_size]" type="radio"<?php checked($this->get_setting('product_img_size'), 'large'); ?> /> <a href="options-media.php"><?php _e('WP Large size', 'mp'); ?> </a></label><br /> <label><input value="custom" name="mp[product_img_size]" type="radio"<?php checked($this->get_setting('product_img_size'), 'custom'); ?> /> <?php _e('Custom', 'mp'); ?> </label>: <label><?php _e('Height', 'mp'); ?> <input size="3" name="mp[product_img_height]" value="<?php echo esc_attr($this->get_setting('product_img_height')); ?> " type="text" /></label> <label><?php _e('Width', 'mp'); ?> <input size="3" name="mp[product_img_width]" value="<?php echo esc_attr($this->get_setting('product_img_width')); ?> " type="text" /></label> </td> </tr> <tr> <th scope="row"><?php _e('Show Image Lightbox', 'mp'); ?> </th> <td> <label><input value="1" name="mp[show_lightbox]" type="radio"<?php checked($this->get_setting('show_lightbox'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[show_lightbox]" type="radio"<?php checked($this->get_setting('show_lightbox'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> <br /><span class="description"><?php _e('Makes clicking the single product image open an instant zoomed preview.', 'mp'); ?> </span> </td> </tr> </table> </div> </div> <div class="postbox"> <h3 class='hndle'><span><?php _e('Product List Settings', 'mp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <?php /* ?> <tr> <th scope="row"><?php _e('Product List View', 'mp') ?></th> <td> <label><input value="list" name="mp[list_view]" type="radio"<?php checked($this->get_setting('list_view'), 'list') ?> /> <?php _e('List View', 'mp') ?></label><br /> <label><input value="grid" name="mp[list_view]" type="radio"<?php checked($this->get_setting('list_view'), 'grid') ?> /> <?php _e('Grid View', 'mp') ?></label> </td> </tr> <?php */ ?> <tr> <th scope="row"><?php _e('Checkout Button Type', 'mp'); ?> </th> <td> <label><input value="addcart" name="mp[list_button_type]" type="radio"<?php checked($this->get_setting('list_button_type'), 'addcart'); ?> /> <?php _e('Add To Cart', 'mp'); ?> </label><br /> <label><input value="buynow" name="mp[list_button_type]" type="radio"<?php checked($this->get_setting('list_button_type'), 'buynow'); ?> /> <?php _e('Buy Now', 'mp'); ?> </label> </td> </tr> <tr> <th scope="row"><?php _e('Show Product Thumbnail', 'mp'); ?> </th> <td> <label><input value="1" name="mp[show_thumbnail]" type="radio"<?php checked($this->get_setting('show_thumbnail'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[show_thumbnail]" type="radio"<?php checked($this->get_setting('show_thumbnail'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> </td> </tr> <tr> <th scope="row"><?php _e('Product Thumbnail Size', 'mp'); ?> </th> <td> <label><input value="thumbnail" name="mp[list_img_size]" type="radio"<?php checked($this->get_setting('list_img_size'), 'thumbnail'); ?> /> <a href="options-media.php"><?php _e('WP Thumbnail size', 'mp'); ?> </a></label><br /> <label><input value="medium" name="mp[list_img_size]" type="radio"<?php checked($this->get_setting('list_img_size'), 'medium'); ?> /> <a href="options-media.php"><?php _e('WP Medium size', 'mp'); ?> </a></label><br /> <label><input value="large" name="mp[list_img_size]" type="radio"<?php checked($this->get_setting('list_img_size'), 'large'); ?> /> <a href="options-media.php"><?php _e('WP Large size', 'mp'); ?> </a></label><br /> <label><input value="custom" name="mp[list_img_size]" type="radio"<?php checked($this->get_setting('list_img_size'), 'custom'); ?> /> <?php _e('Custom', 'mp'); ?> </label>: <label><?php _e('Height', 'mp'); ?> <input size="3" name="mp[list_img_height]" value="<?php echo esc_attr($this->get_setting('list_img_height')); ?> " type="text" /></label> <label><?php _e('Width', 'mp'); ?> <input size="3" name="mp[list_img_width]" value="<?php echo esc_attr($this->get_setting('list_img_width')); ?> " type="text" /></label> </td> </tr> <tr> <th scope="row"><?php _e('Show Excerpts', 'mp'); ?> </th> <td> <label><input value="1" name="mp[show_excerpt]" type="radio"<?php checked($this->get_setting('show_excerpt'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[show_excerpt]" type="radio"<?php checked($this->get_setting('show_excerpt'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> </td> </tr> <tr> <th scope="row"><?php _e('Paginate Products', 'mp'); ?> </th> <td> <label><input value="1" name="mp[paginate]" type="radio"<?php checked($this->get_setting('paginate'), 1); ?> /> <?php _e('Yes', 'mp'); ?> </label> <label><input value="0" name="mp[paginate]" type="radio"<?php checked($this->get_setting('paginate'), 0); ?> /> <?php _e('No', 'mp'); ?> </label> <label><input value="<?php echo esc_attr($this->get_setting('per_page', 20)); ?> " name="mp[per_page]" type="text" size="2" /> <?php _e('Products per page', 'mp'); ?> </label> </td> </tr> <tr> <th scope="row"><?php _e('Order Products By', 'mp'); ?> </th> <td> <select name="mp[order_by]"> <option value="title"<?php selected($this->get_setting('order_by'), 'title'); ?> ><?php _e('Product Name', 'mp'); ?> </option> <option value="date"<?php selected($this->get_setting('order_by'), 'date'); ?> ><?php _e('Publish Date', 'mp'); ?> </option> <option value="ID"<?php selected($this->get_setting('order_by'), 'ID'); ?> ><?php _e('Product ID', 'mp'); ?> </option> <option value="author"<?php selected($this->get_setting('order_by'), 'author'); ?> ><?php _e('Product Author', 'mp'); ?> </option> <option value="sales"<?php selected($this->get_setting('order_by'), 'sales'); ?> ><?php _e('Number of Sales', 'mp'); ?> </option> <option value="price"<?php selected($this->get_setting('order_by'), 'price'); ?> ><?php _e('Product Price', 'mp'); ?> </option> <option value="rand"<?php selected($this->get_setting('order_by'), 'rand'); ?> ><?php _e('Random', 'mp'); ?> </option> </select> <label><input value="DESC" name="mp[order]" type="radio"<?php checked($this->get_setting('order'), 'DESC'); ?> /> <?php _e('Descending', 'mp'); ?> </label> <label><input value="ASC" name="mp[order]" type="radio"<?php checked($this->get_setting('order'), 'ASC'); ?> /> <?php _e('Ascending', 'mp'); ?> </label> </td> </tr> </table> </div> </div> <div class="postbox"> <h3 class='hndle'><span><?php _e('Store URL Slugs', 'mp'); ?> </span></h3> <div class="inside"> <span class="description"><?php _e('Customizes the url structure of your store', 'mp'); ?> </span> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e('Store Base', 'mp'); ?> </th> <td>/<input type="text" name="mp[slugs][store]" value="<?php echo esc_attr($this->get_setting('slugs->store')); ?> " size="20" maxlength="50" />/<br /> <span class="description"><?php _e('This page will be created so you can change it\'s content and the order in which it appears in navigation menus if your theme supports it.', 'mp'); ?> </span></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Products List', 'mp'); ?> </th> <td>/<?php echo esc_attr($this->get_setting('slugs->store')); ?> /<input type="text" name="mp[slugs][products]" value="<?php echo esc_attr($this->get_setting('slugs->products')); ?> " size="20" maxlength="50" />/</td> </tr> <tr valign="top"> <th scope="row"><?php _e('Shopping Cart Page', 'mp'); ?> </th> <td>/<?php echo esc_attr($this->get_setting('slugs->store')); ?> /<input type="text" name="mp[slugs][cart]" value="<?php echo esc_attr($this->get_setting('slugs->cart')); ?> " size="20" maxlength="50" />/</td> </tr> <tr valign="top"> <th scope="row"><?php _e('Order Status Page', 'mp'); ?> </th> <td>/<?php echo esc_attr($this->get_setting('slugs->store')); ?> /<input type="text" name="mp[slugs][orderstatus]" value="<?php echo esc_attr($this->get_setting('slugs->orderstatus')); ?> " size="20" maxlength="50" />/</td> </tr> <tr valign="top"> <th scope="row"><?php _e('Product Category', 'mp'); ?> </th> <td>/<?php echo esc_attr($this->get_setting('slugs->store')); ?> /<?php echo esc_attr($this->get_setting('slugs->products')); ?> /<input type="text" name="mp[slugs][category]" value="<?php echo esc_attr($this->get_setting('slugs->category')); ?> " size="20" maxlength="50" />/</td> </tr> <tr valign="top"> <th scope="row"><?php _e('Product Tag', 'mp'); ?> </th> <td>/<?php echo esc_attr($this->get_setting('slugs->store')); ?> /<?php echo esc_attr($this->get_setting('slugs->products')); ?> /<input type="text" name="mp[slugs][tag]" value="<?php echo esc_attr($this->get_setting('slugs->tag')); ?> " size="20" maxlength="50" />/</td> </tr> </table> </div> </div> <?php do_action('mp_presentation_settings'); ?> <p class="submit"> <input class="button-primary" type="submit" name="submit_settings" value="<?php _e('Save Changes', 'mp'); ?> " /> </p> </form> </div> <?php break; //---------------------------------------------------// //---------------------------------------------------// case "messages": //save settings if (isset($_POST['messages_settings'])) { //remove html from emails $_POST['mp']['email'] = array_map('wp_filter_nohtml_kses', (array) $_POST['mp']['email']); //filter msg inputs if necessary if (!current_user_can('unfiltered_html')) { $_POST['mp']['msg'] = array_map('wp_kses_post', (array) $_POST['mp']['msg']); } //strip slashes $_POST['mp']['msg'] = array_map('stripslashes', (array) $_POST['mp']['msg']); $_POST['mp']['email'] = array_map('stripslashes', (array) $_POST['mp']['email']); $settings = array_merge($settings, apply_filters('mp_messages_settings_filter', $_POST['mp'])); update_option('mp_settings', $settings); echo '<div class="updated fade"><p>' . __('Settings saved.', 'mp') . '</p></div>'; } ?> <div class="icon32"><img src="<?php echo $this->plugin_url . 'images/messages.png'; ?> " /></div> <h2><?php _e('Messages Settings', 'mp'); ?> </h2> <div id="poststuff" class="metabox-holder mp-settings"> <form id="mp-messages-form" method="post" action="edit.php?post_type=product&page=marketpress&tab=messages"> <input type="hidden" name="messages_settings" value="1" /> <div class="postbox"> <h3 class='hndle'><span><?php _e('Email Notifications', 'mp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tr> <th scope="row"><?php _e('Store Admin Email', 'mp'); ?> </th> <td> <?php $store_email = $this->get_setting('store_email') ? $this->get_setting('store_email') : get_option("admin_email"); ?> <span class="description"><?php _e('The email address that new order notifications are sent to and received from.', 'mp'); ?> </span><br /> <input type="text" name="mp[store_email]" value="<?php echo esc_attr($store_email); ?> " maxlength="150" size="50" /> </td> </tr> <tr> <th scope="row"><?php _e('New Order', 'mp'); ?> </th> <td> <span class="description"><?php _e('The email text sent to your customer to confirm a new order. These codes will be replaced with order details: CUSTOMERNAME, ORDERID, ORDERINFO, SHIPPINGINFO, PAYMENTINFO, TOTAL, TRACKINGURL, ORDERNOTES. No HTML allowed.', 'mp'); ?> </span><br /> <label><?php _e('Subject:', 'mp'); ?> <br /> <input type="text" class="mp_emails_sub" name="mp[email][new_order_subject]" value="<?php echo esc_attr($this->get_setting('email->new_order_subject')); ?> " maxlength="150" /></label><br /> <label><?php _e('Text:', 'mp'); ?> <br /> <textarea class="mp_emails_txt" name="mp[email][new_order_txt]"><?php echo esc_textarea($this->get_setting('email->new_order_txt')); ?> </textarea> </label> </td> </tr> <tr> <th scope="row"><?php _e('Order Shipped', 'mp'); ?> </th> <td> <span class="description"><?php _e('The email text sent to your customer when you mark an order as "Shipped". These codes will be replaced with order details: CUSTOMERNAME, ORDERID, ORDERINFO, SHIPPINGINFO, PAYMENTINFO, TOTAL, TRACKINGURL, ORDERNOTES. No HTML allowed.', 'mp'); ?> </span><br /> <label><?php _e('Subject:', 'mp'); ?> <br /> <input type="text" class="mp_emails_sub" name="mp[email][shipped_order_subject]" value="<?php echo esc_attr($this->get_setting('email->shipped_order_subject')); ?> " maxlength="150" /></label><br /> <label><?php _e('Text:', 'mp'); ?> <br /> <textarea class="mp_emails_txt" name="mp[email][shipped_order_txt]"><?php echo esc_textarea($this->get_setting('email->shipped_order_txt')); ?> </textarea> </label> </td> </tr> </table> </div> </div> <div class="postbox mp-pages-msgs"> <h3 class='hndle'><span><?php _e('Store Pages', 'mp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tr> <th scope="row"><?php _e('Store Page', 'mp'); ?> </th> <td> <span class="description"><?php _e('The main store page is an actual page on your site. You can edit it here:', 'mp'); ?> </span> <?php $post_id = get_option('mp_store_page'); edit_post_link(__('Edit Page »', 'mp'), '', '', $post_id); ?> </td> </tr> <tr> <th scope="row"><?php _e('Product Listing Pages', 'mp'); ?> </th> <td> <span class="description"><?php _e('Displayed at the top of the product listing pages. Optional, HTML allowed.', 'mp'); ?> </span><br /> <?php wp_editor($this->get_setting('msg->product_list'), 'product_list', array('textarea_name' => 'mp[msg][product_list]')); ?> </td> </tr> <tr> <th scope="row"><?php _e('Order Status Page', 'mp'); ?> </th> <td> <span class="description"><?php _e('Displayed at the top of the Order Status page. Optional, HTML allowed.', 'mp'); ?> </span><br /> <?php wp_editor($this->get_setting('msg->order_status'), 'order_status', array('textarea_name' => 'mp[msg][order_status]')); ?> </td> </tr> </table> </div> </div> <div class="postbox mp-pages-msgs"> <h3 class='hndle'><span><?php _e('Shopping Cart Pages', 'mp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tr> <th scope="row"><?php _e('Shopping Cart Page', 'mp'); ?> </th> <td> <span class="description"><?php _e('Displayed at the top of the Shopping Cart page. Optional, HTML allowed.', 'mp'); ?> </span><br /> <?php wp_editor($this->get_setting('msg->cart'), 'cart', array('textarea_name' => 'mp[msg][cart]')); ?> </td> </tr> <tr id="mp_msgs_shipping"> <th scope="row"><?php _e('Shipping Form Page', 'mp'); ?> </th> <td> <span class="description"><?php _e('Displayed at the top of the Shipping Form page. Optional, HTML allowed.', 'mp'); ?> </span><br /> <?php wp_editor($this->get_setting('msg->shipping'), 'shipping', array('textarea_name' => 'mp[msg][shipping]')); ?> </td> </tr> <tr> <th scope="row"><?php _e('Payment Form Page', 'mp'); ?> </th> <td> <span class="description"><?php _e('Displayed at the top of the Payment Form page. Optional, HTML allowed.', 'mp'); ?> </span><br /> <?php wp_editor($this->get_setting('msg->checkout'), 'checkout', array('textarea_name' => 'mp[msg][checkout]')); ?> </td> </tr> <tr> <th scope="row"><?php _e('Order Confirmation Page', 'mp'); ?> </th> <td> <span class="description"><?php _e('Displayed at the top of the final Order Confirmation page. HTML allowed.', 'mp'); ?> </span><br /> <?php wp_editor($this->get_setting('msg->confirm_checkout'), 'confirm_checkout', array('textarea_name' => 'mp[msg][confirm_checkout]')); ?> </td> </tr> <tr> <th scope="row"><?php _e('Order Complete Page', 'mp'); ?> </th> <td> <span class="description"><?php _e('Displayed at the top of the page notifying customers of a successful order. HTML allowed.', 'mp'); ?> </span><br /> <?php wp_editor($this->get_setting('msg->success'), 'success', array('textarea_name' => 'mp[msg][success]')); ?> </td> </tr> </table> </div> </div> <?php //for adding additional messages do_action('mp_messages_settings', $settings); ?> <p class="submit"> <input class="button-primary" type="submit" name="submit_settings" value="<?php _e('Save Changes', 'mp'); ?> " /> </p> </form> </div> <?php break; //---------------------------------------------------// //---------------------------------------------------// case "shipping": global $mp_shipping_plugins; //save settings if (isset($_POST['shipping_settings'])) { echo '<div class="updated fade"><p>' . __('Settings saved.', 'mp') . '</p></div>'; } ?> <script type="text/javascript"> jQuery(document).ready(function ($) { $("#mp-select-all").click(function() { $("#mp-target-countries input[type='checkbox']").attr('checked', true); return false; }); $("#mp-select-eu").click(function() { $("#mp-target-countries input[type='checkbox'].eu").attr('checked', true); return false; }); $("#mp-select-none").click(function() { $("#mp-target-countries input[type='checkbox']").attr('checked', false); return false; }); $(".mp-shipping-method").change(function() { $("#mp-shipping-form").submit(); }); }); </script> <div class="icon32"><img src="<?php echo $this->plugin_url . 'images/delivery.png'; ?> " /></div> <h2><?php _e('Shipping Settings', 'mp'); ?> </h2> <div id="poststuff" class="metabox-holder mp-settings"> <form id="mp-shipping-form" method="post" action="edit.php?post_type=product&page=marketpress&tab=shipping"> <input type="hidden" name="shipping_settings" value="1" /> <div id="mp_flat_rate" class="postbox"> <h3 class='hndle'><span><?php _e('General Settings', 'mp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tr> <th scope="row"><?php _e('Choose Target Countries', 'mp'); ?> </th> <td> <div><?php _e('Select:', 'mp'); ?> <a id="mp-select-all" href="#"><?php _e('All', 'mp'); ?> </a> <a id="mp-select-eu" href="#"><?php _e('EU', 'mp'); ?> </a> <a id="mp-select-none" href="#"><?php _e('None', 'mp'); ?> </a></div> <div id="mp-target-countries"> <?php foreach ($this->countries as $code => $name) { ?> <label><input type="checkbox"<?php echo in_array($code, $this->eu_countries) ? ' class="eu"' : ''; ?> name="mp[shipping][allowed_countries][]" value="<?php echo $code; ?> "<?php echo in_array($code, $this->get_setting('shipping->allowed_countries', array())) ? ' checked="checked"' : ''; ?> /> <?php echo esc_attr($name); ?> </label><br /><?php } ?> </div><br /> <span class="description"><?php _e('These are the countries you will sell and ship to.', 'mp'); ?> </span> </td> </tr> <tr> <th scope="row"><?php _e('Select Shipping Method', 'mp'); ?> </th> <td> <select name="mp[shipping][method]" class="mp-shipping-method"> <option value="none"<?php selected($this->get_setting('shipping->method'), 'none'); ?> ><?php _e('No Shipping', 'mp'); ?> </option> <?php $calculated_methods = 0; foreach ((array) $mp_shipping_plugins as $code => $plugin) { if ($plugin[2]) { $calculated_methods++; continue; } ?> <option value="<?php echo $code; ?> "<?php selected($this->get_setting('shipping->method'), $code); ?> ><?php echo esc_attr($plugin[1]); ?> </option><?php } if ($calculated_methods) { ?> <option value="calculated"<?php selected($this->get_setting('shipping->method'), 'calculated'); ?> ><?php _e('Calculated Options', 'mp'); ?> </option><?php } ?> </select> </td> </tr> <?php if ($calculated_methods && $this->get_setting('shipping->method') == 'calculated') { ?> <tr> <th scope="row"><?php _e('Select Shipping Options', 'mp'); ?> </th> <td> <span class="description"><?php _e('Select which calculated shipping methods the customer will be able to choose from:', 'mp'); ?> </span><br /> <?php foreach ((array) $mp_shipping_plugins as $code => $plugin) { if (!$plugin[2]) { continue; } //skip non calculated ?> <label><input type="checkbox" class="mp-shipping-method" name="mp[shipping][calc_methods][<?php echo $code; ?> ]" value="<?php echo $code; ?> "<?php echo $this->get_setting("shipping->calc_methods->{$code}") ? ' checked="checked"' : ''; ?> /> <?php echo esc_attr($plugin[1]); ?> </label><br /><?php } ?> </td> </tr> <?php } ?> <tr> <th scope="row"><?php _e('Measurement System', 'mp'); ?> </th> <td> <label><input value="english" name="mp[shipping][system]" type="radio"<?php checked($this->get_setting('shipping->system'), 'english'); ?> /> <?php _e('Engish (Pounds)', 'mp'); ?> </label> <label><input value="metric" name="mp[shipping][system]" type="radio"<?php checked($this->get_setting('shipping->system'), 'metric'); ?> /> <?php _e('Metric (Kilograms)', 'mp'); ?> </label> </td> </tr> </table> </div> </div> <?php //for adding additional settings for a shipping module do_action('mp_shipping_settings', $settings); ?> <p class="submit"> <input class="button-primary" type="submit" name="submit_settings" value="<?php _e('Save Changes', 'mp'); ?> " /> </p> </form> </div> <?php break; //---------------------------------------------------// //---------------------------------------------------// case "gateways": global $mp_gateway_plugins; //save settings if (isset($_POST['gateway_settings'])) { if (isset($_POST['mp'])) { $filtered_settings = apply_filters('mp_gateway_settings_filter', $_POST['mp']); //allow plugins to verify settings before saving $settings = array_merge($settings, $filtered_settings); update_option('mp_settings', $settings); } echo '<div class="updated fade"><p>' . __('Settings saved.', 'mp') . '</p></div>'; } ?> <script type="text/javascript"> jQuery(document).ready(function ($) { $("input.mp_allowed_gateways").change(function() { $("#mp-gateways-form").submit(); }); }); </script> <div class="icon32"><img src="<?php echo $this->plugin_url . 'images/credit-cards.png'; ?> " /></div> <h2><?php _e('Payment Settings', 'mp'); ?> </h2> <div id="poststuff" class="metabox-holder mp-settings"> <form id="mp-gateways-form" method="post" action="edit.php?post_type=product&page=marketpress&tab=gateways"> <input type="hidden" name="gateway_settings" value="1" /> <?php if (!$this->global_cart) { ?> <div id="mp_gateways" class="postbox"> <h3 class='hndle'><span><?php _e('General Settings', 'mp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tr> <th scope="row"><?php _e('Select Payment Gateway(s)', 'mp'); ?> </th> <td> <?php //check network permissions if (is_multisite() && !is_main_site()) { $network_settings = get_site_option('mp_network_settings'); foreach ((array) $mp_gateway_plugins as $code => $plugin) { if ($network_settings['allowed_gateways'][$code] == 'full') { $allowed_plugins[$code] = $plugin; } else { if ($network_settings['allowed_gateways'][$code] == 'supporter' && function_exists('is_pro_site') && is_pro_site(false, $network_settings['gateways_pro_level'][$code])) { $allowed_plugins[$code] = $plugin; } } } $mp_gateway_plugins = $allowed_plugins; } foreach ((array) $mp_gateway_plugins as $code => $plugin) { if ($plugin[3]) { //if demo ?> <label><input type="checkbox" class="mp_allowed_gateways" name="mp[gateways][allowed][]" value="<?php echo $code; ?> " disabled="disabled" /> <?php echo esc_attr($plugin[1]); ?> </label> <a class="mp-pro-update" href="http://premium.wpmudev.org/project/e-commerce" title="<?php _e('Upgrade', 'mp'); ?> »"><?php _e('Pro Only »', 'mp'); ?> </a><br /><?php } else { ?> <label><input type="checkbox" class="mp_allowed_gateways" name="mp[gateways][allowed][]" value="<?php echo $code; ?> "<?php echo in_array($code, $this->get_setting('gateways->allowed', array())) ? ' checked="checked"' : ''; ?> /> <?php echo esc_attr($plugin[1]); ?> </label><br /><?php } } ?> </td> </tr> </table> </div> </div> <?php } ?> <?php //for adding additional settings for a payment gateway plugin do_action('mp_gateway_settings', $settings); ?> <p class="submit"> <input class="button-primary" type="submit" name="submit_settings" value="<?php _e('Save Changes', 'mp'); ?> " /> </p> </form> </div> <?php break; //---------------------------------------------------// //---------------------------------------------------// case "shortcodes": ?> <div class="icon32"><img src="<?php echo $this->plugin_url . 'images/help.png'; ?> " /></div> <h2><?php _e('MarketPress Shortcodes', 'mp'); ?> </h2> <div id="poststuff" class="metabox-holder mp-settings"> <!-- <div class="postbox"> <h3 class='hndle'><span><?php _e('General Information', 'mp'); ?> </span></h3> <div class="inside"> <iframe src="http://premium.wpmudev.org/wdp-un.php?action=help&id=144" width="100%" height="400px"></iframe> </div> </div> --> <div class="postbox"> <h3 class='hndle'><span><?php _e('Shortcodes', 'mp'); ?> </span></h3> <div class="inside"> <p><?php _e('Shortcodes allow you to include dynamic store content in posts and pages on your site. Simply type or paste them into your post or page content where you would like them to appear. Optional attributes can be added in a format like <em>[shortcode attr1="value" attr2="value"]</em>.', 'mp'); ?> </p> <table class="form-table"> <tr> <th scope="row"><?php _e('Product Tag Cloud', 'mp'); ?> </th> <td> <strong>[mp_tag_cloud]</strong> - <span class="description"><?php _e('Displays a cloud or list of your product tags.', 'mp'); ?> </span> <a href="http://codex.wordpress.org/Template_Tags/wp_tag_cloud"><?php _e('Optional Attributes »', 'mp'); ?> </a> </td> </tr> <tr> <th scope="row"><?php _e('Product Categories List', 'mp'); ?> </th> <td> <strong>[mp_list_categories]</strong> - <span class="description"><?php _e('Displays an HTML list of your product categories.', 'mp'); ?> </span> <a href="http://codex.wordpress.org/Template_Tags/wp_list_categories"><?php _e('Optional Attributes »', 'mp'); ?> </a> </td> </tr> <tr> <th scope="row"><?php _e('Product Categories Dropdown', 'mp'); ?> </th> <td> <strong>[mp_dropdown_categories]</strong> - <span class="description"><?php _e('Displays an HTML dropdown of your product categories.', 'mp'); ?> </span> <a href="http://codex.wordpress.org/Template_Tags/wp_dropdown_categories"><?php _e('Optional Attributes »', 'mp'); ?> </a> </td> </tr> <tr> <th scope="row"><?php _e('Popular Products List', 'mp'); ?> </th> <td> <strong>[mp_popular_products]</strong> - <span class="description"><?php _e('Displays a list of popular products ordered by sales.', 'mp'); ?> </span> <p> <strong><?php _e('Optional Attributes:', 'mp'); ?> </strong> <ul class="mp-shortcode-options"> <li><?php _e('"number" - max number of products to display. Defaults to 5.', 'mp'); ?> </li> <li><?php _e('Example:', 'mp'); ?> <em>[mp_popular_products number="5"]</em></li> </ul></p> </td> </tr> <tr> <th scope="row"><?php _e('Products List', 'mp'); ?> </th> <td> <strong>[mp_list_products]</strong> - <span class="description"><?php _e('Displays a list of products according to preference. Optional attributes default to the values in Presentation Settings -> Product List.', 'mp'); ?> </span> <p> <strong><?php _e('Optional Attributes:', 'mp'); ?> </strong> <ul class="mp-shortcode-options"> <li><?php _e('"paginate" - Whether to paginate the product list. This is useful to only show a subset.', 'mp'); ?> </li> <li><?php _e('"page" - The page number to display in the product list if "paginate" is set to true.', 'mp'); ?> </li> <li><?php _e('"per_page" - How many products to display in the product list if "paginate" is set to true.', 'mp'); ?> </li> <li><?php _e('"order_by" - What field to order products by. Can be: title, date, ID, author, price, sales, rand (random).', 'mp'); ?> </li> <li><?php _e('"order" - Direction to order products by. Can be: DESC, ASC', 'mp'); ?> </li> <li><?php _e('"category" - Limits list to a specific product category. Use the category Slug', 'mp'); ?> </li> <li><?php _e('"tag" - Limits list to a specific product tag. Use the tag Slug', 'mp'); ?> </li> <li><?php _e('Example:', 'mp'); ?> <em>[mp_list_products paginate="true" page="1" per_page="10" order_by="price" order="DESC" category="downloads"]</em></li> </ul></p> </td> </tr> <tr> <th scope="row"><?php _e('Single Product', 'mp'); ?> </th> <td> <strong>[mp_product]</strong> - <span class="description"><?php _e('Displays a single product according to preference.', 'mp'); ?> </span> <p> <strong><?php _e('Optional Attributes:', 'mp'); ?> </strong> <ul class="mp-shortcode-options"> <li><?php _e('"product_id" - The ID of the product to display.', 'mp'); ?> </li> <li><?php _e('"title" - Whether to display the product title.', 'mp'); ?> </li> <li><?php _e('"content" - Whether and what type of content to display. Options are false/0, "full", or "excerpt". Default "full"', 'mp'); ?> </li> <li><?php _e('"image" - Whether and what context of image size to display. Options are false/0, "single", or "list". Default "single"', 'mp'); ?> </li> <li><?php _e('"meta" - Whether to display the product meta (price, buy button).', 'mp'); ?> </li> <li><?php _e('Example:', 'mp'); ?> <em>[mp_product product_id="1" title="1" content="excerpt" image="single" meta="1"]</em></li> </ul></p> </td> </tr> <tr> <th scope="row"><?php _e('Product Image', 'mp'); ?> </th> <td> <strong>[mp_product_image]</strong> - <span class="description"><?php _e('Displays the featured image of a given product.', 'mp'); ?> </span> <p> <strong><?php _e('Optional Attributes:', 'mp'); ?> </strong> <ul class="mp-shortcode-options"> <li><?php _e('"product_id" - The ID for the product. Optional if shortcode is in the loop.', 'mp'); ?> </li> <li><?php _e('"context" - What context for preset size options. Options are list, single, or widget, default single.', 'mp'); ?> </li> <li><?php _e('"size" - Set a custom pixel width/height. If omitted defaults to the size set by "context".', 'mp'); ?> </li> <li><?php _e('Example:', 'mp'); ?> <em>[mp_product_image product_id="1" size="150"]</em></li> </ul></p> </td> </tr> <tr> <th scope="row"><?php _e('Product Buy Button', 'mp'); ?> </th> <td> <strong>[mp_buy_button]</strong> - <span class="description"><?php _e('Displays the buy or add to cart button.', 'mp'); ?> </span> <p> <strong><?php _e('Optional Attributes:', 'mp'); ?> </strong> <ul class="mp-shortcode-options"> <li><?php _e('"product_id" - The ID for the product. Optional if shortcode is in the loop.', 'mp'); ?> </li> <li><?php _e('"context" - What context for display. Options are list or single, default single which shows all variations.', 'mp'); ?> </li> <li><?php _e('Example:', 'mp'); ?> <em>[mp_buy_button product_id="1" context="single"]</em></li> </ul></p> </td> </tr> <tr> <th scope="row"><?php _e('Product Price', 'mp'); ?> </th> <td> <strong>[mp_product_price]</strong> - <span class="description"><?php _e('Displays the product price (and sale price).', 'mp'); ?> </span> <p> <strong><?php _e('Optional Attributes:', 'mp'); ?> </strong> <ul class="mp-shortcode-options"> <li><?php _e('"product_id" - The ID for the product. Optional if shortcode is in the loop.', 'mp'); ?> </li> <li><?php _e('"label" - A label to prepend to the price. Defaults to "Price: ".', 'mp'); ?> </li> <li><?php _e('Example:', 'mp'); ?> <em>[mp_product_price product_id="1" label="Buy this thing now!"]</em></li> </ul></p> </td> </tr> <tr> <th scope="row"><?php _e('Product Meta', 'mp'); ?> </th> <td> <strong>[mp_product_meta]</strong> - <span class="description"><?php _e('Displays the full product meta box with price and buy now/add to cart button.', 'mp'); ?> </span> <p> <strong><?php _e('Optional Attributes:', 'mp'); ?> </strong> <ul class="mp-shortcode-options"> <li><?php _e('"product_id" - The ID for the product. Optional if shortcode is in the loop.', 'mp'); ?> </li> <li><?php _e('"label" - A label to prepend to the price. Defaults to "Price: ".', 'mp'); ?> </li> <li><?php _e('"context" - What context for display. Options are list or single, default single which shows all variations.', 'mp'); ?> </li> <li><?php _e('Example:', 'mp'); ?> <em>[mp_product_meta product_id="1" label="Buy this thing now!"]</em></li> </ul></p> </td> </tr> <tr> <th scope="row"><?php _e('Store Links', 'mp'); ?> </th> <td> <strong>[mp_cart_link]</strong> - <span class="description"><?php _e('Displays a link or url to the current shopping cart page.', 'mp'); ?> </span><br /> <strong>[mp_store_link]</strong> - <span class="description"><?php _e('Displays a link or url to the current store page.', 'mp'); ?> </span><br /> <strong>[mp_products_link]</strong> - <span class="description"><?php _e('Displays a link or url to the current products list page.', 'mp'); ?> </span><br /> <strong>[mp_orderstatus_link]</strong> - <span class="description"><?php _e('Displays a link or url to the order status page.', 'mp'); ?> </span><br /> <p> <strong><?php _e('Optional Attributes:', 'mp'); ?> </strong> <ul class="mp-shortcode-options"> <li><?php _e('"url" - Whether to return a clickable link or url. Can be: true, false. Defaults to showing link.', 'mp'); ?> </li> <li><?php _e('"link_text" - The text to show in the link.', 'mp'); ?> </li> <li><?php _e('Example:', 'mp'); ?> <em>[mp_cart_link link_text="Go here!"]</em></li> </ul></p> </td> </tr> <tr> <th scope="row"><?php _e('Store Navigation List', 'mp'); ?> </th> <td> <strong>[mp_store_navigation]</strong> - <span class="description"><?php _e('Displays a list of links to your store pages.', 'mp'); ?> </span> </td> </tr> </table> </div> </div> <?php //for adding additional help content boxes do_action('mp_help_page', $settings); ?> </div> <?php break; //---------------------------------------------------// //---------------------------------------------------// case "importers": ?> <div class="icon32"><img src="<?php echo $this->plugin_url . 'images/import.png'; ?> " /></div> <form id="mp-import-form" method="post" action="" enctype="multipart/form-data"> <h2><?php _e('Import Products', 'mp'); ?> </h2> <div id="poststuff" class="metabox-holder mp-importer"> <?php do_action('marketpress_add_importer'); ?> </div> </form> </div> <?php break; } //end switch //hook to create a new admin screen. do_action('marketpress_add_screen', $tab); echo '</div>'; }
/** * Apply the rule-logic to the specified popup * * @since 4.6 * @param mixed $data Rule-data which was saved via the save_() handler. * @return bool Decission to display popup or not. */ protected function apply_no_prosite($data) { $prosite = function_exists('is_pro_site') && is_pro_site(); return !$prosite; }
function selective_message_display() { if (function_exists('get_site_option') && defined('PO_GLOBAL') && PO_GLOBAL == true) { $updateoption = 'update_site_option'; $getoption = 'get_site_option'; } else { $updateoption = 'update_option'; $getoption = 'get_option'; } $popovers = $this->get_active_popovers(); if (!empty($popovers)) { foreach ((array) $popovers as $popover) { // We have an active popover so extract the information and test it $popover_title = stripslashes($popover->popover_title); $popover_content = stripslashes($popover->popover_content); $popover->popover_settings = unserialize($popover->popover_settings); $popover_size = $popover->popover_settings['popover_size']; $popover_location = $popover->popover_settings['popover_location']; $popover_colour = $popover->popover_settings['popover_colour']; $popover_margin = $popover->popover_settings['popover_margin']; $popover_size = $this->sanitise_array($popover_size); $popover_location = $this->sanitise_array($popover_location); $popover_colour = $this->sanitise_array($popover_colour); $popover_margin = $this->sanitise_array($popover_margin); $popover_check = $popover->popover_settings['popover_check']; $popover_ereg = $popover->popover_settings['popover_ereg']; $popover_count = $popover->popover_settings['popover_count']; $popover_usejs = $popover->popover_settings['popover_usejs']; $popoverstyle = isset($popover->popover_settings['popover_style']) ? $popover->popover_settings['popover_style'] : ''; $popover_hideforever = isset($popover->popover_settings['popoverhideforeverlink']) ? $popover->popover_settings['popoverhideforeverlink'] : ''; $popover_delay = isset($popover->popover_settings['popoverdelay']) ? $popover->popover_settings['popoverdelay'] : ''; $popover_onurl = isset($popover->popover_settings['onurl']) ? $popover->popover_settings['onurl'] : ''; $popover_notonurl = isset($popover->popover_settings['notonurl']) ? $popover->popover_settings['notonurl'] : ''; $popover_incountry = isset($popover->popover_settings['incountry']) ? $popover->popover_settings['incountry'] : ''; $popover_notincountry = isset($popover->popover_settings['notincountry']) ? $popover->popover_settings['notincountry'] : ''; $popover_onurl = $this->sanitise_array($popover_onurl); $popover_notonurl = $this->sanitise_array($popover_notonurl); $show = true; if (!empty($popover_check)) { $order = explode(',', $popover_check['order']); foreach ($order as $key) { switch ($key) { case "supporter": if (function_exists('is_pro_site') && is_pro_site()) { $show = false; } break; case "loggedin": if ($this->is_loggedin()) { $show = false; } break; case "isloggedin": if (!$this->is_loggedin()) { $show = false; } break; case "commented": if ($this->has_commented()) { $show = false; } break; case "searchengine": if (!$this->is_fromsearchengine($_REQUEST['thereferrer'])) { $show = false; } break; case "internal": $internal = str_replace('^http://', '', get_option('home')); if ($this->referrer_matches($internal, $_REQUEST['thereferrer'])) { $show = false; } break; case "referrer": $match = $popover_ereg; if (!$this->referrer_matches($match, $_REQUEST['thereferrer'])) { $show = false; } break; case "count": if ($this->has_reached_limit($popover_count)) { $show = false; } break; case 'onurl': if (!$this->onurl($popover_onurl, $_REQUEST['thefrom'])) { $show = false; } break; case 'notonurl': if ($this->onurl($popover_notonurl, $_REQUEST['thefrom'])) { $show = false; } break; case 'incountry': $incountry = $this->incountry($popover_incountry); if (!$incountry || $incountry === 'XX') { $show = false; } break; case 'notincountry': $incountry = $this->incountry($popover_notincountry); if ($incountry || $incountry === 'XX') { $show = false; } break; default: if (has_filter('popover_process_rule_' . $key)) { if (!apply_filters('popover_process_rule_' . $key, false)) { $show = false; } } break; } } // Check for forced popover and if set then output that one instead of any other if (isset($_REQUEST['active_popover']) && (int) $_REQUEST['active_popover'] != 0) { if ($popover->id == (int) $_REQUEST['active_popover']) { $show = true; } else { $show = false; } } } if ($show == true) { if ($this->clear_forever()) { $show = false; } } if ($show == true) { // return the popover to the calling function $popover = array(); $popover['name'] = 'a' . md5(date('d')) . '-po'; // Show the advert if (!empty($popover_delay) && $popover_delay != 'immediate') { // Set the delay $popover['delay'] = $popover_delay * 1000; } else { $popover['delay'] = 0; } if ($popover_usejs == 'yes') { $popover['usejs'] = 'yes'; } else { $popover['usejs'] = 'no'; } $style = ''; $backgroundstyle = ''; if ($popover_usejs == 'yes') { $style = 'z-index:999999;'; $box = 'color: #' . $popover_colour['fore'] . '; background: #' . $popover_colour['back'] . ';'; $style .= 'left: -1000px; top: =100px;'; } else { $style = 'left: ' . $popover_location['left'] . '; top: ' . $popover_location['top'] . ';' . ' z-index:999999;'; $style .= 'margin-top: ' . $popover_margin['top'] . '; margin-bottom: ' . $popover_margin['bottom'] . '; margin-right: ' . $popover_margin['right'] . '; margin-left: ' . $popover_margin['left'] . ';'; $box = 'width: ' . $popover_size['width'] . '; height: ' . $popover_size['height'] . '; color: #' . $popover_colour['fore'] . '; background: #' . $popover_colour['back'] . ';'; } if (!empty($popover_delay) && $popover_delay != 'immediate') { // Hide the popover initially $style .= ' visibility: hidden;'; $backgroundstyle .= ' visibility: hidden;'; } $availablestyles = apply_filters('popover_available_styles_directory', array()); $popover['html'] = ''; if (in_array($popoverstyle, array_keys($availablestyles))) { $popover_messagebox = 'a' . md5(date('d')) . '-po'; if (file_exists(trailingslashit($availablestyles[$popoverstyle]) . 'popover.php')) { ob_start(); include_once trailingslashit($availablestyles[$popoverstyle]) . 'popover.php'; $popover['html'] = ob_get_contents(); ob_end_clean(); } } $availablestylesurl = apply_filters('popover_available_styles_url', array()); $popover['style'] = ''; if (in_array($popoverstyle, array_keys($availablestyles))) { // Add the styles if (file_exists(trailingslashit($availablestyles[$popoverstyle]) . 'style.css')) { ob_start(); include_once trailingslashit($availablestyles[$popoverstyle]) . 'style.css'; $content = ob_get_contents(); ob_end_clean(); $popover['style'] = str_replace('#messagebox', '#' . $popover_messagebox, $content); $popover['style'] = str_replace('%styleurl%', trailingslashit($availablestylesurl[$popoverstyle]), $popover['style']); } } // Add the cookie if (isset($_COOKIE['popover_view_' . COOKIEHASH])) { $count = intval($_COOKIE['popover_view_' . COOKIEHASH]); if (!is_numeric($count)) { $count = 0; } $count++; } else { $count = 1; } if (!headers_sent()) { setcookie('popover_view_' . COOKIEHASH, $count, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); } return $popover; // Exit from the for - as we have sent a popover break; } } } // There is no popover to show - so send back a no-popover message return array('name' => 'nopopover'); }
function new_blog($blog_id) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; global $psts; $psts_plugins = (array) $psts->get_setting('pp_plugins'); $auto_activate = array(); switch_to_blog($blog_id); //look for valid plugins with anyone access foreach ($psts_plugins as $plugin_file => $data) { if ($data['auto'] && is_numeric($data['level']) && (is_pro_site($blog_id, $data['level']) || $data['level'] == 0) && !is_plugin_active($plugin_file)) { $auto_activate[] = $plugin_file; } } //if any activate them if (count($auto_activate)) { activate_plugins($auto_activate, '', false); //silently activate any plugins } restore_current_blog(); }
/** * Populate an array with existing user information * * Array will be rendered by ProSites_View_Front_Gateway * * @param $blog_id * @param $domain * @param bool $get_all * * @return array|bool */ public static function get_existing_user_information($blog_id, $domain, $get_all = true) { global $psts; $args = array(); $img_base = $psts->plugin_url . 'images/'; $trialing = ProSites_Helper_Registration::is_trial($blog_id); if ($trialing) { $args['trial'] = '<div id="psts-general-error" class="psts-warning">' . __('You are still within your trial period. Once your trial finishes your account will be automatically charged.', 'psts') . '</div>'; } // Pending information /** * @todo: Hook psts_blog_info_pending (Front/Gateway.php) */ if (!empty($blog_id) && 1 == get_blog_option($blog_id, 'psts_stripe_waiting')) { $args['pending'] = '<div id="psts-general-error" class="psts-warning">' . __('There are pending changes to your account. This message will disappear once these pending changes are completed.', 'psts') . '</div>'; } // Successful payment if (self::$complete_message) { // @todo: Hook psts_blog_info_complete_message $args['complete_message'] = '<div id="psts-complete-msg">' . self::$complete_message . '</div>'; // @todo: Hook psts_blog_info_thanks_message $args['thanks_message'] = '<p>' . $psts->get_setting('stripe_thankyou') . '</p>'; //If Checking out on signup, there wouldn't be a blogid probably // if ( ! empty ( $domain ) ) { // //Hardcoded, TODO: Search for alternative // $admin_url = is_ssl() ? trailingslashit( "https://$domain" ) . 'wp-admin/' : trailingslashit( "http://$domain" ) . 'wp-admin/'; // $args['visit_site_message'] = '<p><a href="' . $admin_url . '">' . __( 'Visit your newly upgraded site »', 'psts' ) . '</a></p>'; // } else { $args['visit_site_message'] = '<p><a href="' . get_admin_url($blog_id, '', 'http') . '">' . __('Go to your site »', 'psts') . '</a></p>'; // } self::$complete_message = false; } // Cancellation message if (self::$cancel_message) { $args['cancel'] = true; $args['cancellation_message'] = self::$cancel_message; self::$cancel_message = false; } // Existing customer information --- only if $get_all is true (default) $customer_id = self::get_customer_data($blog_id)->customer_id; if (!empty($customer_id) && $get_all) { try { $customer_object = Stripe_Customer::retrieve($customer_id); } catch (Exception $e) { $error = $e->getMessage(); } // Move to render info class $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id)); $level = $psts->get_level_setting($psts->get_level($blog_id), 'name'); $is_recurring = $psts->is_blog_recurring($blog_id); $args['recurring'] = $is_recurring; // If invoice cant be created, its not looking good. Cancel. try { $invoice_object = Stripe_Invoice::upcoming(array("customer" => $customer_id)); } catch (Exception $e) { if ($is_recurring) { $args['cancel'] = true; $args['cancellation_message'] = '<div class="psts-cancel-notification"> <p class="label"><strong>' . __('Your subscription has been canceled', 'psts') . '</strong></p> <p>' . sprintf(__('This site should continue to have %1$s features until %2$s.', 'psts'), $level, $end_date) . '</p>'; } } $args['level'] = $level; $args['expires'] = $end_date; // All good, keep populating the array. if (!isset($args['cancel'])) { // Get the last valid card if (isset($customer_object->cards->data[0]) && isset($customer_object->default_card)) { foreach ($customer_object->cards->data as $tmpcard) { if ($tmpcard->id == $customer_object->default_card) { $card = $tmpcard; break; } } } elseif (isset($customer_object->active_card)) { //for API pre 2013-07-25 $card = $customer_object->active_card; } $args['card_type'] = $card->brand; $args['card_reminder'] = $card->last4; $args['card_digit_location'] = 'end'; $args['card_expire_month'] = $card->exp_month; $args['card_expire_year'] = $card->exp_year; // Get the period $plan_parts = explode('_', $customer_object->subscriptions->data[0]->plan->id); $period = array_pop($plan_parts); $args['period'] = $period; // Get last payment date try { $existing_invoice_object = Stripe_Invoice::all(array("customer" => $customer_id, "count" => 1)); } catch (Exception $e) { $error = $e->getMessage(); } if (isset($existing_invoice_object->data[0]) && $customer_object->subscriptions->data[0]->status != 'trialing') { $args['last_payment_date'] = $existing_invoice_object->data[0]->date; } // Get next payment date if (isset($invoice_object->next_payment_attempt)) { $args['next_payment_date'] = $invoice_object->next_payment_attempt; } // Cancellation link if ($is_recurring) { if (is_pro_site($blog_id)) { $args['cancel_info'] = '<p class="prosites-cancel-description">' . sprintf(__('If you choose to cancel your subscription this site should continue to have %1$s features until %2$s.', 'psts'), $level, $end_date) . '</p>'; $cancel_label = __('Cancel Your Subscription', 'psts'); // CSS class of <a> is important to handle confirmations $args['cancel_link'] = '<p class="prosites-cancel-link"><a class="cancel-prosites-plan button" href="' . wp_nonce_url($psts->checkout_url($blog_id) . '&action=cancel', 'psts-cancel') . '" title="' . esc_attr($cancel_label) . '">' . esc_html($cancel_label) . '</a></p>'; } } // Receipt form $args['receipt_form'] = $psts->receipt_form($blog_id); } // Show all is true $args['all_fields'] = true; } return empty($args) ? array() : $args; }
/** * Displays the checkout screen * * @param $content * @param $blog_id * @param string $domain * * @return string */ function checkout_screen($content, $blog_id, $domain = '') { global $psts, $wpdb, $current_site, $current_user; if (!$blog_id && !$domain) { return $content; } $img_base = $psts->plugin_url . 'images/'; $twocheckout_active = false; //hide top part of content if its a pro blog if (is_pro_site($blog_id) || $psts->errors->get_error_message('coupon')) { $content = ''; } if ($errmsg = $psts->errors->get_error_message('general')) { $content = '<div id="psts-general-error" class="psts-error">' . $errmsg . '</div>'; //hide top part of content if theres an error } //display the complete message if having if ($this->complete_message) { $content = '<div id="psts-complete-msg">' . $this->complete_message . '</div>'; $content .= '<p>' . $psts->get_setting('2co_thankyou') . '</p>'; $content .= '<p><a href="' . get_admin_url($blog_id, '', 'http') . '">' . __('Visit your newly upgraded site »', 'psts') . '</a></p>'; //remove session return $content; } //check if pro/express user if ($profile_id = $this->get_profile_id($blog_id)) { $content .= '<div id="psts_existing_info">'; $cancel_content = ''; $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id)); $level = $psts->get_level_setting($psts->get_level($blog_id), 'name'); //cancel subscription if (isset($_GET['action']) && $_GET['action'] == 'cancel' && wp_verify_nonce($_GET['_wpnonce'], 'psts-cancel')) { $resArray = $this->tcheckout_cancel_subscription($profile_id); if ($resArray['response_code'] == 'OK') { $content .= '<div id="message" class="updated fade"><p>' . sprintf(__('Your %1$s subscription has been canceled. You should continue to have access until %2$s.', 'psts'), $current_site->site_name . ' ' . $psts->get_setting('rebrand'), $end_date) . '</p></div>'; //record stat $psts->record_stat($blog_id, 'cancel'); $psts->email_notification($blog_id, 'canceled'); $psts->log_action($blog_id, sprintf(__('Subscription successfully canceled by the user. They should continue to have access until %s', 'psts'), $end_date)); } else { $content .= '<div id="message" class="error fade"><p>' . __('There was a problem canceling your subscription, please contact us for help: ', 'psts') . $resArray2['errors'][0]['message'] . '</p></div>'; } } //show sub detail $resArray = $this->tcheckout_get_profile_detail($profile_id); $active_recurring = $this->get_recurring_lineitems($resArray); $lineitem = $active_recurring[0]; if ($resArray['response_code'] == 'OK' && isset($lineitem)) { if (isset($lineitem['date_placed'])) { $prev_billing = date_i18n(get_option('date_format'), strtotime($lineitem['date_placed'])); } else { if ($last_payment = $psts->last_transaction($blog_id)) { $prev_billing = date_i18n(get_option('date_format'), $last_payment['timestamp']); } else { $prev_billing = __("None yet with this subscription <small>(only initial separate single payment has been made, or you've recently modified your subscription)</small>", 'psts'); } } if (isset($lineitem['date_next'])) { $next_billing = date_i18n(get_option('date_format'), strtotime($lineitem['date_next'])); } else { $next_billing = __("Invoice not deposited yet or not scheduled to recur.", 'psts'); } if (is_pro_site($blog_id)) { $content .= '<li>' . __('Level:', 'psts') . ' <strong>' . $level . '</strong></li>'; } $content .= '<li>' . __('Payment Method:', 'psts') . ' <strong>2Checkout via ' . ucwords(str_replace('_', ' ', $lineitem['method'])) . '</strong>'; $content .= '<li>' . __('Last Payment Date:', 'psts') . ' <strong>' . $prev_billing . '</strong></li>'; $content .= '<li>' . __('Next Payment Date:', 'psts') . ' <strong>' . $next_billing . '</strong></li>'; if (get_option('psts_2co_recuring_next_plan')) { $plan = get_option('psts_2co_recuring_next_plan'); $content .= '<li>' . sprintf(__('Your new level %1$s will be start at %2$s:', 'psts'), $plan['level'], $next_billing) . '</li>'; } $content .= '</ul><br />'; $cancel_content .= '<h3>' . __('Cancel Your Subscription', 'psts') . '</h3>'; if (is_pro_site($blog_id)) { $cancel_content .= '<p>' . sprintf(__('If you choose to cancel your subscription this site should continue to have %1$s features until %2$s.', 'psts'), $level, $end_date) . '</p>'; } $cancel_content .= '<p><a id="twocheckout_cancel" href="' . wp_nonce_url($psts->checkout_url($blog_id) . '&action=cancel', 'psts-cancel') . '" title="' . __('Cancel Your Subscription', 'psts') . '"><img src="' . $img_base . 'cancel_subscribe_gen.gif" /></a></p>'; $twocheckout_active = true; } else { if ($resArray['response_code'] == 'OK' && !isset($lineitem)) { $content .= '<h3>' . __('Your subscription has been canceled', 'psts') . '</h3>'; $content .= '<p>' . sprintf(__('This site should continue to have %1$s features until %2$s.', 'psts'), $psts->get_setting('rebrand'), $end_date) . '</p>'; } else { if ($resArray['response_code'] == 'OK' || $resArray['status'] == 'declined') { $content .= '<h3>' . sprintf(__('Your subscription is: %s', 'psts'), $resArray['status']) . '</h3>'; $content .= '<p>' . __('Please update your payment information below to resolve this.', 'psts') . '</p>'; $cancel_content .= '<h3>' . __('Cancel Your Subscription', 'psts') . '</h3>'; if (is_pro_site($blog_id)) { $cancel_content .= '<p>' . sprintf(__('If you choose to cancel your subscription this site should continue to have %1$s features until %2$s.', 'psts'), $level, $end_date) . '</p>'; } $cancel_content .= '<p><a id="twocheckout_cancel" href="' . wp_nonce_url($psts->checkout_url($blog_id) . '&action=cancel', 'psts-cancel') . '" title="' . __('Cancel Your Subscription', 'psts') . '"><img src="' . $img_base . 'cancel_subscribe_gen.gif" /></a></p>'; $twocheckout_active = true; } else { $content .= '<div class="psts-error">' . __("There was a problem accessing your subscription information: ", 'psts') . $resArray2['errors'][0]['message'] . '</div>'; } } } //print receipt send form $content .= $psts->receipt_form($blog_id); if (!defined('PSTS_CANCEL_LAST')) { $content .= $cancel_content; } $content .= '</div>'; } else { if (is_pro_site($blog_id)) { $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id)); $level = $psts->get_level_setting($psts->get_level($blog_id), 'name'); $old_gateway = $wpdb->get_var("SELECT gateway FROM {$wpdb->base_prefix}pro_sites WHERE blog_ID = '{$blog_id}'"); $content .= '<div id="psts_existing_info">'; $content .= '<h3>' . __('Your Subscription Information', 'psts') . '</h3><ul>'; $content .= '<li>' . __('Level:', 'psts') . ' <strong>' . $level . '</strong></li>'; if ($old_gateway == 'PayPal') { $content .= '<li>' . __('Payment Method: <strong>Your PayPal Account</strong>', 'psts') . '</li>'; } else { if ($old_gateway == 'Amazon') { $content .= '<li>' . __('Payment Method: <strong>Your Amazon Account</strong>', 'psts') . '</li>'; } else { if ($psts->get_expire($blog_id) >= 9999999999.0) { $content .= '<li>' . __('Expire Date: <strong>Never</strong>', 'psts') . '</li>'; } else { $content .= '<li>' . sprintf(__('Expire Date: <strong>%s</strong>', 'psts'), $end_date) . '</li>'; } } } $content .= '</ul><br />'; $cancel_content = ''; if ($old_gateway == 'PayPal' || $old_gateway == 'Amazon') { $cancel_content .= '<h3>' . __('Cancel Your Subscription', 'psts') . '</h3>'; $cancel_content .= '<p>' . sprintf(__('If your subscription is still active your next scheduled payment should be %1$s.', 'psts'), $end_date) . '</p>'; $cancel_content .= '<p>' . sprintf(__('If you choose to cancel your subscription this site should continue to have %1$s features until %2$s.', 'psts'), $level, $end_date) . '</p>'; //show instructions for old gateways if ($old_gateway == 'PayPal') { $cancel_content .= '<p><a id="twocheckout_cancel" target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_subscr-find&alias=' . urlencode(get_site_option("supporter_paypal_email")) . '" title="' . __('Cancel Your Subscription', 'psts') . '"><img src="' . $psts->plugin_url . 'images/cancel_subscribe_gen.gif" /></a><br /><small>' . __('You can also cancel following <a href="https://www.paypal.com/helpcenter/main.jsp;jsessionid=SCPbTbhRxL6QvdDMvshNZ4wT2DH25d01xJHj6cBvNJPGFVkcl6vV!795521328?t=solutionTab&ft=homeTab&ps=&solutionId=27715&locale=en_US&_dyncharset=UTF-8&countrycode=US&cmd=_help-ext">these steps</a>.', 'psts') . '</small></p>'; } else { if ($old_gateway == 'Amazon') { $cancel_content .= '<p>' . __('To cancel your subscription, simply go to <a id="twocheckout_cancel" target="_blank" href="https://payments.amazon.com/">https://payments.amazon.com/</a>, click Your Account at the top of the page, log in to your Amazon Payments account (if asked), and then click the Your Subscriptions link. This page displays your subscriptions, showing the most recent, active subscription at the top. To view the details of a specific subscription, click Details. Then cancel your subscription by clicking the Cancel Subscription button on the Subscription Details page.', 'psts') . '</p>'; } } } if ($old_gateway == '2checkout') { $cancel_content .= '<h3>' . __('Cancel Your Subscription', 'psts') . '</h3>'; $cancel_content .= '<p>' . sprintf(__('If your subscription is still active your next scheduled payment should be %1$s.', 'psts'), $end_date) . '</p>'; $cancel_content .= '<p>' . sprintf(__('If you choose to cancel your subscription this site should continue to have %1$s features until %2$s.', 'psts'), $level, $end_date) . '</p>'; } //print receipt send form $content .= $psts->receipt_form($blog_id); if (!defined('PSTS_CANCEL_LAST')) { $content .= $cancel_content; } $content .= '</div>'; } } if ($twocheckout_active) { $content .= '<h2>' . __('Change Your Plan or Payment Details', 'psts') . '</h2> <p>' . __('You can modify or upgrade your plan by placing a new subscription and canceling your previous subscription. Your new subscription expire time will be prorated for the first installment.', 'psts') . '</p>'; } else { $content .= '<p>' . __('Please choose your desired plan then click the checkout button below.', 'psts') . '</p>'; } //build the checkout form $content .= $this->build_checkout_form_html($blog_id, $domain); //put cancel button at end if (defined('PSTS_CANCEL_LAST')) { $content .= $cancel_content; } return $content; }
function register_google_analytics_post_widget() { global $google_analytics_async; if (!current_user_can('manage_options') || $this->stats_source == 'network' && !is_super_admin() && !empty($google_analytics_async->network_settings['track_settings']['supporter_only_reports']) && function_exists('is_pro_site') && !is_pro_site(get_current_blog_id(), $google_analytics_async->network_settings['track_settings']['supporter_only_reports'])) { return; } $screens = array('post', 'page'); foreach ($screens as $screen) { add_meta_box('google_analytics_dashboard', __('Statistics - Last 30 Days', $this->text_domain), array(&$this, 'google_analytics_widget'), $screen, 'normal'); } }
function checkout_screen($content, $blog_id) { global $psts, $wpdb, $current_site, $current_user; if (!$blog_id) { return $content; } //cancel subscription if (isset($_GET['action']) && $_GET['action'] == 'cancel' && wp_verify_nonce($_GET['_wpnonce'], 'psts-cancel')) { $error = ''; try { $customer_id = $this->get_customer_id($blog_id); $cu = Stripe_Customer::retrieve($customer_id); $cu->cancelSubscription(); } catch (Exception $e) { $error = $e->getMessage(); } if ($error != '') { $content .= '<div id="message" class="error fade"><p>' . __('There was a problem canceling your subscription, please contact us for help: ', 'psts') . $error . '</p></div>'; } else { //record stat $psts->record_stat($blog_id, 'cancel'); $psts->email_notification($blog_id, 'canceled'); update_blog_option($blog_id, 'psts_stripe_canceled', 1); $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id)); $psts->log_action($blog_id, sprintf(__('Subscription successfully cancelled by %1$s. They should continue to have access until %2$s', 'psts'), $current_user->display_name, $end_date)); $content .= '<div id="message" class="updated fade"><p>' . sprintf(__('Your %1$s subscription has been canceled. You should continue to have access until %2$s.', 'psts'), $current_site->site_name . ' ' . $psts->get_setting('rebrand'), $end_date) . '</p></div>'; } } $cancel_status = get_blog_option($blog_id, 'psts_stripe_canceled'); $cancel_content = ''; $img_base = $psts->plugin_url . 'images/'; $pp_active = false; //hide top part of content if its a pro blog if (is_pro_site($blog_id) || $psts->errors->get_error_message('coupon')) { $content = ''; } if ($errmsg = $psts->errors->get_error_message('general')) { $content = '<div id="psts-general-error" class="psts-error">' . $errmsg . '</div>'; //hide top part of content if theres an error } //if transaction was successful display a complete message and skip the rest if ($this->complete_message) { $content = '<div id="psts-complete-msg">' . $this->complete_message . '</div>'; $content .= '<p>' . $psts->get_setting('stripe_thankyou') . '</p>'; $content .= '<p><a href="' . get_admin_url($blog_id, '', 'http') . '">' . __('Visit your newly upgraded site »', 'psts') . '</a></p>'; return $content; } if ($customer_id = $this->get_customer_id($blog_id)) { try { $customer_object = Stripe_Customer::retrieve($customer_id); } catch (Exception $e) { $error = $e->getMessage(); } $content .= '<div id="psts_existing_info">'; $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id)); $level = $psts->get_level_setting($psts->get_level($blog_id), 'name'); try { $invoice_object = Stripe_Invoice::upcoming(array("customer" => $customer_id)); } catch (Exception $e) { $cancel_status = 1; } try { $existing_invoice_object = Stripe_Invoice::all(array("customer" => $customer_id, "count" => 1)); } catch (Exception $e) { $error = $e->getMessage(); } if ($cancel_status == 1) { $content .= '<h3>' . __('Your subscription has been canceled', 'psts') . '</h3>'; $content .= '<p>' . sprintf(__('This site should continue to have %1$s features until %2$s.', 'psts'), $psts->get_setting('rebrand'), $end_date) . '</p>'; } if ($cancel_status == 0) { $content .= '<ul>'; if (is_pro_site($blog_id)) { $content .= '<li>' . __('Level:', 'psts') . ' <strong>' . $level . '</strong></li>'; } if (isset($customer_object->active_card)) { $content .= '<li>' . __('Payment Method: <strong>' . $customer_object->active_card->type . ' Card</strong> ending in <strong>' . $customer_object->active_card->last4 . '</strong>. Expires <strong>' . $customer_object->active_card->exp_month . '/' . $customer_object->active_card->exp_year . '</strong>', 'psts') . '</li>'; } if (isset($exitsing_invoice_object->data[0])) { $content .= '<li>' . __('Last Payment Date:', 'psts') . ' <strong>' . date_i18n(get_option('date_format'), $existing_invoice_object->data[0]->date) . '</strong></li>'; } if (isset($invoice_object->next_payment_attempt)) { $content .= '<li>' . __('Next Payment Date:', 'psts') . ' <strong>' . date_i18n(get_option('date_format'), $invoice_object->next_payment_attempt) . '</strong></li>'; } $content .= "</ul>"; $cancel_content .= '<h3>' . __('Cancel Your Subscription', 'psts') . '</h3>'; $pp_active = false; if (is_pro_site($blog_id)) { $cancel_content .= '<p>' . sprintf(__('If you choose to cancel your subscription this site should continue to have %1$s features until %2$s.', 'psts'), $level, $end_date) . '</p>'; $cancel_content .= '<p><a id="stripe_cancel" href="' . wp_nonce_url($psts->checkout_url($blog_id) . '&action=cancel', 'psts-cancel') . '" title="' . __('Cancel Your Subscription', 'psts') . '"><img src="' . $img_base . 'cancel_subscribe_gen.gif" /></a></p>'; $pp_active = true; } //print receipt send form $content .= $psts->receipt_form($blog_id); if (!defined('PSTS_CANCEL_LAST')) { $content .= $cancel_content; } $content .= "<br>"; $content .= '</div>'; } } if (!$cancel_status && is_pro_site($blog_id) && !is_pro_trial($blog_id)) { $content .= '<h2>' . __('Change Your Plan or Payment Details', 'psts') . '</h2> <p>' . __('You can modify or upgrade your plan or just change your payment method or information below. Your new subscription will automatically go into effect when your next payment is due.', 'psts') . '</p>'; } else { if (!is_pro_site($blog_id) || is_pro_trial($blog_id)) { $content .= '<p>' . __('Please choose your desired plan then click the checkout button below.', 'psts') . '</p>'; } } $content .= '<form action="' . $psts->checkout_url($blog_id) . '" method="post" autocomplete="off" id="payment-form">'; //print the checkout grid $content .= $psts->checkout_grid($blog_id); $content .= '<div id="psts-stripe-checkout"> <h2>' . __('Checkout With a Credit Card:', 'psts') . '</h2>'; $content .= '<div id="psts-processcard-error"></div>'; $content .= ' <table id="psts-cc-table"> <tbody> <!-- Credit Card Type --> <tr> <td class="pypl_label" align="right">' . __('Cardholder Name:', 'psts') . ' </td><td>'; if ($errmsg = $psts->errors->get_error_message('name')) { $content .= '<div class="psts-error">' . $errmsg . '</div>'; } $content .= '<input id="cc_name" type="text" class="cctext card-first-name" value="" size="25" /> </td> </tr> <tr> <td class="pypl_label" align="right">' . __('Card Number:', 'psts') . ' </td> <td>'; if ($errmsg = $psts->errors->get_error_message('number')) { $content .= '<div class="psts-error">' . $errmsg . '</div>'; } $content .= '<input id="cc_number" type="text" class="cctext card-number" value="" size="23" /><br /><img src="' . $img_base . 'stripe-cards.png" /> </td> </tr> <tr> <td class="pypl_label" align="right">' . __('Expiration Date:', 'psts') . ' </td> <td valign="middle">'; if ($errmsg = $psts->errors->get_error_message('expiration')) { $content .= '<div class="psts-error">' . $errmsg . '</div>'; } $content .= '<select id="cc_month" class="card-expiry-month">' . $this->month_dropdown() . '</select> / <select id="cc_year" class="card-expiry-year">' . $this->year_dropdown() . '</select> </td> </tr> <!-- Card Security Code --> <tr> <td class="pypl_label" align="right"><nobr>' . __('Card Security Code:', 'psts') . '</nobr> </td> <td valign="middle">'; if ($errmsg = $psts->errors->get_error_message('cvv2')) { $content .= '<div class="psts-error">' . $errmsg . '</div>'; } $content .= '<label><input id="cc_cvv2" size="5" maxlength="4" type="password" class="cctext card-cvc" title="' . __('Please enter a valid card security code. This is the 3 digits on the signature panel, or 4 digits on the front of Amex cards.', 'psts') . '" /> <img src="' . $img_base . 'buy-cvv.gif" height="27" width="42" title="' . __('Please enter a valid card security code. This is the 3 digits on the signature panel, or 4 digits on the front of Amex cards.', 'psts') . '" /></label> </td> </tr> </table> </tbody></table> <input type="hidden" name="cc_checkout" value="1" /> <p> <input type="submit" id="cc_checkout" name="stripe_checkout_button" value="' . __('Subscribe', 'psts') . ' »" class="submit-button"/> <span id="stripe_processing" style="display: none;float: right;"><img src="' . $img_base . 'loading.gif" /> ' . __('Processing...', 'psts') . '</span> </p> </div>'; $content .= '</form>'; if (defined('PSTS_CANCEL_LAST')) { $content .= $cancel_content; } return $content; }
public static function render_free($style, $blog_id) { global $psts; $session_data = ProSites_Helper_Session::session('new_blog_details'); $free_text = $psts->get_setting('free_msg'); $content = ''; if (!isset($_GET['bid']) && empty($blog_id) && !isset($session_data['new_blog_details']['blogname'])) { $content = '<div class="free-plan-link" style="' . esc_attr($style) . '">'; $content .= apply_filters('prosites_checkout_free_link', '<a>' . esc_html($free_text) . '</a>', $blog_id); $content .= '</div>'; } else { if (empty($blog_id) && !empty($_GET['bid'])) { $blog_id = (int) $_GET['bid']; } if (!is_pro_site($blog_id)) { $free_link = apply_filters('prosites_checkout_free_link', '<a class="pblg-checkout-opt" style="width:100%" id="psts-free-option" href="' . get_admin_url($blog_id, 'index.php?psts_dismiss=1', 'http') . '" title="' . __('Dismiss', 'psts') . '">' . $psts->get_setting('free_msg', __('No thank you, I will continue with a basic site for now', 'psts')) . '</a>', $blog_id); $content = '<div class="free-plan-link-logged-in" style="' . esc_attr($style) . '"><p>' . esc_html__('Your current site is a basic site with no extra features. Upgrade now by selecting a plan above.', 'psts') . '</p><p>' . $free_link . '</p></div>'; } } return $content; }
function message() { global $psts, $current_screen, $post_type, $blog_id; if (is_pro_site(false, $psts->get_setting('pq_level', 1))) { return; } if (in_array($current_screen->id, array('edit-post', 'post', 'edit-page', 'page'))) { $quota_settings = $psts->get_setting("pq_quotas"); if (is_array($quota_settings)) { if (isset($quota_settings[$post_type])) { if (is_numeric(@$quota_settings[$post_type]['quota']) && wp_count_posts($post_type)->publish >= @$quota_settings[$post_type]['quota']) { $notice = str_replace('LEVEL', $psts->get_level_setting($psts->get_setting('pq_level', 1), 'name'), @$quota_settings[$post_type]['message']); echo '<div class="error"><p><a href="' . $psts->checkout_url($blog_id) . '">' . $notice . '</a></p></div>'; } } } } }
function customize_controls_print_footer_scripts() { global $psts, $blog_id; $theme = wp_get_theme($_REQUEST['theme']); $allowed_themes = $psts->get_setting('pt_allowed_themes'); if ($allowed_themes == false) { $allowed_themes = array(); } if (isset($allowed_themes[esc_html($theme['Stylesheet'])]) && $allowed_themes[esc_html($theme['Stylesheet'])] && !is_pro_site($blog_id, $allowed_themes[$theme['Stylesheet']]) && !$this->ads_theme()) { $rebrand = sprintf(__('%s Only', 'psts'), $psts->get_level_setting($allowed_themes[$theme['Stylesheet']], 'name')); $upgrade_notice = str_replace('LEVEL', $psts->get_level_setting($allowed_themes[$theme['Stylesheet']], 'name'), $psts->get_setting('pt_text')); $upgrade_link = '<a href="' . $psts->checkout_url($blog_id) . '" target="_parent" class="activatelink nonpsts button-primary" title="' . esc_attr($upgrade_notice) . '">' . $rebrand . '</a>'; ?> <script type="text/javascript"> jQuery('#save').remove(); jQuery('#customize-header-actions').prepend('<?php echo $upgrade_link; ?> '); </script> <?php } }
function message() { global $psts, $current_screen, $blog_id; if (is_pro_site(false, $psts->get_setting('uh_level', 1)) || $this->ads_unfilter()) { return; } if (in_array($current_screen->id, array('edit-page', 'page', 'edit-post', 'post')) && isset($_GET['message'])) { $notice = str_replace('LEVEL', $psts->get_level_setting($psts->get_setting('uh_level', 1), 'name'), $psts->get_setting('uh_message')); echo '<div class="error"><p><a href="' . $psts->checkout_url($blog_id) . '">' . $notice . '</a></p></div>'; } }
/** * Checkout Screen for Manual Payment * * @param $content * @param $blog_id * @param string $domain * * @return string */ public static function checkout_screen($content, $blog_id, $domain = '') { global $psts, $wpdb, $current_site, $current_user; if (!$blog_id && !$domain) { return $content; } //hide top part of content if its a pro blog if (is_pro_site($blog_id)) { $content = ''; } if ($errmsg = $psts->errors->get_error_message('general')) { $content .= '<div id="psts-general-error" class="psts-error">' . $errmsg . '</div>'; } //if transaction was successful display a complete message and skip the rest if (self::$complete_message) { $content = '<div id="psts-complete-msg">' . self::$complete_message . '</div>'; return $content; } if (is_pro_site($blog_id)) { $end_date = date_i18n(get_option('date_format'), $psts->get_expire($blog_id)); $level = $psts->get_level_setting($psts->get_level($blog_id), 'name'); $old_gateway = $wpdb->get_var("SELECT gateway FROM {$wpdb->base_prefix}pro_sites WHERE blog_ID = '{$blog_id}'"); $content .= '<div id="psts_existing_info">'; $content .= '<h3>' . __('Your Account Information', 'psts') . '</h3><ul>'; $content .= '<li>' . __('Level:', 'psts') . ' <strong>' . $level . '</strong></li>'; if ($old_gateway == 'PayPal') { $content .= '<li>' . __('Payment Method: <strong>Your PayPal Account</strong>', 'psts') . '</li>'; } else { if ($old_gateway == 'Amazon') { $content .= '<li>' . __('Payment Method: <strong>Your Amazon Account</strong>', 'psts') . '</li>'; } else { if ($psts->get_expire($blog_id) >= 9999999999.0) { $content .= '<li>' . __('Expire Date: <strong>Never</strong>', 'psts') . '</li>'; } else { $content .= '<li>' . sprintf(__('Expire Date: <strong>%s</strong>', 'psts'), $end_date) . '</li>'; } } } $content .= '</ul><br />'; if ($old_gateway == 'PayPal' || $old_gateway == 'Amazon') { $content .= '<h3>' . __('Cancel Your Subscription', 'psts') . '</h3>'; $content .= '<p>' . sprintf(__('If your subscription is still active your next scheduled payment should be %1$s.', 'psts'), $end_date) . '</p>'; $content .= '<p>' . sprintf(__('If you choose to cancel your subscription this site should continue to have %1$s features until %2$s.', 'psts'), $level, $end_date) . '</p>'; //show instructions for old gateways if ($old_gateway == 'PayPal') { $content .= '<p><a id="pypl_cancel" target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_subscr-find&alias=' . urlencode(get_site_option("supporter_paypal_email")) . '" title="' . __('Cancel Your Subscription', 'psts') . '"><img src="' . $psts->plugin_url . 'images/cancel_subscribe_gen.gif" /></a><br /><small>' . __('You can also cancel following <a href="https://www.paypal.com/webapps/helpcenter/article/?articleID=94044#canceling_recurring_paymemt_subscription_automatic_billing">these steps</a>.', 'psts') . '</small></p>'; } else { if ($old_gateway == 'Amazon') { $content .= '<p>' . __('To cancel your subscription, simply go to <a id="pypl_cancel" target="_blank" href="https://payments.amazon.com/">https://payments.amazon.com/</a>, click Your Account at the top of the page, log in to your Amazon Payments account (if asked), and then click the Your Subscriptions link. This page displays your subscriptions, showing the most recent, active subscription at the top. To view the details of a specific subscription, click Details. Then cancel your subscription by clicking the Cancel Subscription button on the Subscription Details page.', 'psts') . '</p>'; } } } $content .= '</div>'; } $content .= '<form action="' . $psts->checkout_url($blog_id) . '" method="post">'; //print the checkout grid // $content .= $psts->checkout_grid( $blog_id, $domain ); $content .= '<div id="psts-manual-checkout"><h2>' . $psts->get_setting('mp_name') . '</h2>'; $content .= '<div id="psts-manual-instructions">' . stripslashes(do_shortcode($psts->get_setting('mp_instructions'))) . '</div>'; if ($psts->get_setting('mp_show_form')) { $prefill = isset($_POST['psts_mp_text']) ? esc_textarea(stripslashes($_POST['psts_mp_text'])) : ''; $content .= '<textarea id="psts-manual-textarea" name="psts_mp_text">' . $prefill . '</textarea>'; } $content .= '<p><input id="psts-manual-submit" type="submit" name="psts_mp_submit" value="' . esc_attr__('Submit', 'psts') . '"></p>'; $content .= '</div></form>'; return $content; }
function additional_privacy_is_pro() { if (get_site_option('sitewide_privacy_pro_only') == 'yes' && function_exists('is_pro_site') && !(is_pro_site() || !psts_show_ads())) { return false; } return true; }
function check_activated($active_plugins) { if (is_super_admin()) { //don't filter siteadmin return $active_plugins; } //only perform check right after activation hack attempt if ($_POST['action'] != 'activate-selected' && $_POST['action2'] != 'activate-selected') { return $active_plugins; } $auto_activate = (array) get_site_option('pm_auto_activate_list'); $user_control = (array) get_site_option('pm_user_control_list'); $supporter_control = (array) get_site_option('pm_supporter_control_list'); $override_plugins = (array) get_option('pm_plugin_override_list'); foreach ((array) $active_plugins as $plugin_file => $plugin_data) { if (in_array($plugin_file, $user_control) || in_array($plugin_file, $auto_activate) || in_array($plugin_file, $supporter_control) || in_array($plugin_file, $override_plugins)) { //do nothing - leave it in } else { deactivate_plugins($plugin_file, true); //silently remove any plugins unset($active_plugins[$plugin_file]); } } if (function_exists('is_pro_site')) { if (count($supporter_control) && !is_pro_site()) { deactivate_plugins($supporter_control, true); //silently remove any plugins foreach ($supporter_control as $plugin_file) { unset($active_plugins[$plugin_file]); } } } return $active_plugins; }
function setup_plugin() { $this->options = get_site_option('domain_mapping', array()); if (empty($this->options)) { $this->options['map_ipaddress'] = get_site_option('map_ipaddress'); $this->options['map_supporteronly'] = get_site_option('map_supporteronly', '0'); $this->options['map_admindomain'] = get_site_option('map_admindomain', 'user'); $this->options['map_logindomain'] = get_site_option('map_logindomain', 'user'); update_site_option('domain_mapping', $this->options); } if (is_admin()) { // We are in the admin area, so check for the redirects here switch ($this->options['map_admindomain']) { case 'user': break; case 'mapped': $this->redirect_to_mapped_domain(); break; case 'original': if (defined('DOMAIN_MAPPING')) { // put in the code to send me to the original domain $this->redirect_to_orig_domain(); } break; } } else { if (strpos(addslashes($_SERVER["SCRIPT_NAME"]), '/wp-login.php') !== false) { // We are in the login area, so check for the redirects here switch ($this->options['map_logindomain']) { case 'user': break; case 'mapped': $this->redirect_to_mapped_domain(); break; case 'original': if (defined('DOMAIN_MAPPING')) { // put in the code to send me to the original domain $this->redirect_to_orig_domain(); } break; } } } // Add the network admin settings add_action('network_admin_menu', array(&$this, 'add_network_admin_page')); if (function_exists('is_pro_site') && $this->options['map_supporteronly'] == '1') { // The supporter function exists and we are limiting domain mapping to supporters if (is_pro_site()) { // Add the management page add_action('admin_menu', array(&$this, 'add_site_admin_page')); add_action('wp_logout', array(&$this, 'wp_logout'), 10); add_action('admin_head', array(&$this, 'build_cookie')); add_action('template_redirect', array(&$this, 'redirect_to_mapped_domain')); } } else { // Add the management page add_action('admin_menu', array(&$this, 'add_site_admin_page')); add_action('wp_logout', array(&$this, 'wp_logout'), 10); add_action('admin_head', array(&$this, 'build_cookie')); add_action('template_redirect', array(&$this, 'redirect_to_mapped_domain')); } add_action('delete_blog', array(&$this, 'delete_blog_domain_mapping'), 1, 2); }