Пример #1
0
    public function heading()
    {
        $display_version = ShoppVersion::release();
        Shopp::_em('
# Welcome to Shopp %s

Thank you for using Shopp! E-commerce just got a little easier and more secure. Enjoy!', $display_version);
        ?>

		<div class="shopp-badge"><div class="logo">Shopp</div><span class="version"><?php 
        printf(__('Version %s'), $display_version);
        ?>
</span></div>

		<?php 
        $this->tabs(array('shopp-welcome' => __('What&#8217;s New'), 'shopp-credits' => __('Credits')));
        ?>

		<?php 
    }
Пример #2
0
 public static function defaults(ShoppStyles $styles)
 {
     $script = basename(__FILE__);
     $schema = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' ? 'https://' : 'http://';
     if (defined('SHOPP_PLUGINURI')) {
         $url = SHOPP_PLUGINURI . '/core';
     } else {
         $url = preg_replace("|{$script}.*|i", '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     }
     $styles->base_url = $url;
     // Short checksum for cache control that changes with Shopp versions while masking it somewhat
     $styles->default_version = hash('crc32b', ABSPATH . ShoppVersion::release());
     $styles->default_dirs = array('/ui/styles/');
     $styles->add('admin', '/ui/styles/admin.css');
     $styles->add('admin-rtl', '/ui/styles/rtl.css');
     $styles->add('catalog', '/ui/styles/catalog.css');
     $styles->add('colorbox', '/ui/styles/colorbox.css');
     $styles->add('dashboard', '/ui/styles/dashboard.css');
     $styles->add('icons', '/ui/styles/icons.css');
     $styles->add('menus', '/ui/styles/menu.css');
     $styles->add('welcome', '/ui/styles/welcome.css');
     // Fix icons
     $styles->add('selectize', '/ui/styles/selectize.css');
 }
Пример #3
0
 /**
  * Setup configurable constants
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @return void
  **/
 public function constants()
 {
     if (!defined('SHOPP_VERSION')) {
         define('SHOPP_VERSION', ShoppVersion::release());
     }
     if (!defined('SHOPP_GATEWAY_USERAGENT')) {
         define('SHOPP_GATEWAY_USERAGENT', ShoppVersion::agent());
     }
     // @deprecated
     if (!defined('SHOPP_HOME')) {
         define('SHOPP_HOME', ShoppSupport::HOMEPAGE);
     }
     if (!defined('SHOPP_CUSTOMERS')) {
         define('SHOPP_CUSTOMERS', ShoppSupport::FORUMS);
     }
     if (!defined('SHOPP_DOCS')) {
         define('SHOPP_DOCS', ShoppSupport::DOCS);
     }
     // Helper for line break output
     if (!defined('BR')) {
         define('BR', '<br />');
     }
     // Overrideable config macros
     if (!defined('SHOPP_NOSSL')) {
         define('SHOPP_NOSSL', false);
     }
     // Require SSL to protect transactions, overrideable for development
     if (!defined('SHOPP_PREPAYMENT_DOWNLOADS')) {
         define('SHOPP_PREPAYMENT_DOWNLOADS', false);
     }
     // Require payment capture granting access to downloads
     if (!defined('SHOPP_SESSION_TIMEOUT')) {
         define('SHOPP_SESSION_TIMEOUT', 172800);
     }
     // Sessions live for 2 days
     if (!defined('SHOPP_CART_EXPIRES')) {
         define('SHOPP_CART_EXPIRES', 1209600);
     }
     // Carts are stashed for up to 2 weeks
     if (!defined('SHOPP_QUERY_DEBUG')) {
         define('SHOPP_QUERY_DEBUG', false);
     }
     // Debugging queries is disabled by default
     if (!defined('SHOPP_GATEWAY_TIMEOUT')) {
         define('SHOPP_GATEWAY_TIMEOUT', 10);
     }
     // Gateway connections timeout after 10 seconds
     if (!defined('SHOPP_SHIPPING_TIMEOUT')) {
         define('SHOPP_SHIPPING_TIMEOUT', 10);
     }
     // Shipping provider connections timeout after 10 seconds
     if (!defined('SHOPP_SUBMIT_TIMEOUT')) {
         define('SHOPP_SUBMIT_TIMEOUT', 20);
     }
     // Order submission timeout
     if (!defined('SHOPP_TEMP_PATH')) {
         define('SHOPP_TEMP_PATH', sys_get_temp_dir());
     }
     // Use the system defined temporary directory
     if (!defined('SHOPP_ADDONS')) {
         define('SHOPP_ADDONS', WP_CONTENT_DIR . '/shopp-addons');
     }
     // A configurable directory to keep Shopp addons
     if (!defined('SHOPP_NAMESPACE_TAXONOMIES')) {
         define('SHOPP_NAMESPACE_TAXONOMIES', true);
     }
     // Add taxonomy namespacing for permalinks /shop/category/category-name, /shopp/tag/tag-name
 }
Пример #4
0
function shopp_default_scripts(&$scripts)
{
    $script = basename(__FILE__);
    $schema = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' ? 'https://' : 'http://';
    if (defined('SHOPP_PLUGINURI')) {
        $url = SHOPP_PLUGINURI . '/core';
    } else {
        $url = preg_replace("|{$script}.*|i", '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    }
    $scripts->base_url = $url;
    $scripts->default_version = mktime(false, false, false, 1, 1, 2010);
    $scripts->default_dirs = array('/ui/behaviors/', '/ui/products');
    // Short checksum for cache control that changes with Shopp versions while masking it somewhat
    $version = hash('crc32b', ABSPATH . ShoppVersion::release());
    $version = time();
    $scripts->add('shopp', '/ui/behaviors/shopp.js', array('jquery'), $version);
    $scripts->add_data('shopp', 'group', 1);
    $scripts->add('jquery-tmpl', '/ui/behaviors/jquery/jquery.tmpl.min.js', array('jquery'), $version);
    $scripts->add_data('jquery-tmpl', 'group', 1);
    $scripts->add('address', '/ui/behaviors/address.js', array('jquery', 'shopp'), $version);
    $scripts->add_data('address', 'group', 1);
    $scripts->add('cart', '/ui/behaviors/cart.js', array('jquery', 'shopp'), $version);
    $scripts->add_data('cart', 'group', 1);
    $scripts->add('catalog', '/ui/behaviors/catalog.js', array('jquery', 'shopp'), $version);
    $scripts->add_data('catalog', 'group', 1);
    $scripts->add('calendar', '/ui/behaviors/calendar.js', array('jquery', 'shopp'), $version);
    $scripts->add_data('calendar', 'group', 1);
    $scripts->add('daterange', '/ui/behaviors/daterange.js', array('jquery', 'shopp', 'calendar'), $version);
    $scripts->add_data('daterange', 'group', 1);
    $scripts->add('checkout', '/ui/behaviors/checkout.js', array('jquery', 'shopp'), $version);
    $scripts->add_data('checkout', 'group', 1);
    $scripts->add('colorbox', '/ui/behaviors/colorbox.min.js', array('jquery'), $version);
    $scripts->add_data('colorbox', 'group', 1);
    $scripts->add('ocupload', '/ui/behaviors/ocupload.js', array('jquery'), $version);
    $scripts->add_data('ocupload', 'group', 1);
    $scripts->add('orders', '/ui/behaviors/orders.js', array('jquery'), $version);
    $scripts->add_data('orders', 'group', 1);
    $scripts->add('scalecrop', '/ui/behaviors/scalecrop.js', array('jquery', 'jquery-ui-core', 'jquery-ui-draggable'), $version);
    $scripts->add_data('scalecrop', 'group', 1);
    $scripts->add('priceline', '/ui/behaviors/priceline.js', array('jquery', 'shopp'), $version);
    $scripts->add_data('priceline', 'group', 1);
    $scripts->add('editors', '/ui/behaviors/editors.js', array('jquery', 'jquery-ui-sortable'), $version);
    $scripts->add_data('editors', 'group', 1);
    $scripts->add('product-editor', '/ui/products/editor.js', array('jquery', 'priceline'), $version);
    $scripts->add_data('product-editor', 'group', 1);
    $scripts->add('category-editor', '/ui/categories/category.js', array('jquery', 'priceline'), $version);
    $scripts->add_data('category-editor', 'group', 1);
    $scripts->add('category-arrange', '/ui/categories/arrange.js', array('jquery', 'shopp'), $version);
    $scripts->add_data('category-arrange', 'group', 1);
    $scripts->add('products-arrange', '/ui/categories/products.js', array('jquery'), $version);
    $scripts->add_data('products-arrange', 'group', 1);
    $scripts->add('setup', '/ui/behaviors/setup.js', array('jquery'), $version);
    $scripts->add_data('setup', 'group', 1);
    $scripts->add('pageset', '/ui/behaviors/pageset.js', array('jquery'), $version);
    $scripts->add_data('pageset', 'group', 1);
    $scripts->add('payments', '/ui/behaviors/payments.js', array('jquery'), $version);
    $scripts->add_data('payments', 'group', 1);
    $scripts->add('storage', '/ui/behaviors/storage.js', array('jquery'), $version);
    $scripts->add_data('storage', 'group', 1);
    $scripts->add('shiprates', '/ui/behaviors/shiprates.js', array('jquery'), $version);
    $scripts->add_data('shiprates', 'group', 1);
    $scripts->add('taxrates', '/ui/behaviors/taxrates.js', array('jquery'), $version);
    $scripts->add_data('taxrates', 'group', 1);
    $scripts->add('imageset', '/ui/behaviors/imageset.js', array('jquery'), $version);
    $scripts->add_data('imageset', 'group', 1);
    $scripts->add('system', '/ui/behaviors/system.js', array('jquery'), $version);
    $scripts->add_data('system', 'group', 1);
    $scripts->add('spin', '/ui/behaviors/spin.js', array('jquery'), $version);
    $scripts->add_data('spin', 'group', 1);
    $scripts->add('suggest', '/ui/behaviors/suggest.js', array('jquery'), $version);
    $scripts->add_data('suggest', 'group', 1);
    $scripts->add('search-select', '/ui/behaviors/searchselect.js', array('jquery'), $version);
    $scripts->add_data('search-select', 'group', 1);
    $scripts->add('membership-editor', '/ui/memberships/editor.js', array('jquery', 'jquery-tmpl', 'search-select'), $version);
    $scripts->add_data('membership-editor', 'group', 1);
    $scripts->add('labelset', '/ui/behaviors/labelset.js', array('jquery', 'jquery-tmpl'), $version);
    $scripts->add_data('labelset', 'group', 1);
    $scripts->add('flot', '/ui/behaviors/flot/jquery.flot.min.js', array('jquery'), $version);
    $scripts->add_data('flot', 'group', 1);
    $scripts->add('flot-time', '/ui/behaviors/flot/jquery.flot.time.min.js', array('jquery'), $version);
    $scripts->add_data('flot-time', 'group', 1);
    $scripts->add('flot-grow', '/ui/behaviors/flot/jquery.flot.grow.min.js', array('flot'), $version);
    $scripts->add_data('flot-grow', 'group', 1);
    $scripts->add('jvectormap', '/ui/behaviors/jvectormap.min.js', array('jquery'), $version);
    $scripts->add_data('jvectormap', 'group', 1);
    $scripts->add('worldmap', '/ui/behaviors/worldmap.min.js', array('jvectormap'), $version);
    $scripts->add_data('worldmap', 'group', 1);
    $scripts->add('reports', '/ui/behaviors/reports.js', array(), $version);
    $scripts->add_data('reports', 'group', 1);
}
Пример #5
0
 /**
  * Queues Shopp storefront javascript and styles as needed
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function behaviors()
 {
     $Shopp = Shopp::object();
     if (is_ssl()) {
         $urls = array('option_siteurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src');
         foreach ($urls as $filter) {
             add_filter($filter, 'force_ssl');
         }
     }
     // Replace the WordPress canonical link
     remove_action('wp_head', 'rel_canonical');
     add_action('wp_head', array($this, 'header'));
     add_action('wp_footer', array($this, 'footer'));
     shopp_enqueue_style('catalog');
     shopp_enqueue_style('icons');
     shopp_enqueue_style('colorbox');
     shopp_enqueue_style('shopp', Shopp::template_url('shopp.css'), array('catalog'), hash('crc32b', ABSPATH . ShoppVersion::release()), 'all');
     $orderhistory = is_account_page() && isset($_GET['id']) && !empty($_GET['id']);
     if (is_thanks_page() || $orderhistory) {
         wp_enqueue_style('shopp.printable', SHOPP_ADMIN_URI . '/styles/printable.css', array(), 20110511, 'print');
     }
     $loading = shopp_setting('script_loading');
     if (!$loading || 'global' == $loading || !empty($page)) {
         shopp_enqueue_script('colorbox');
         shopp_enqueue_script('shopp');
         shopp_enqueue_script('catalog');
         shopp_enqueue_script('cart');
         if (is_catalog_page()) {
             shopp_custom_script('catalog', "var pricetags = {};\n");
         }
     }
     if (is_checkout_page()) {
         shopp_enqueue_script('address');
         shopp_enqueue_script('checkout');
     }
     if (is_confirm_page()) {
         shopp_enqueue_script('checkout');
     }
     if (is_account_page()) {
         shopp_enqueue_script('address');
         $regions = Lookup::country_zones();
         $js = 'var regions=' . json_encode($regions);
         add_storefrontjs($js, true);
     }
 }
Пример #6
0
 /**
  * Determines if the module is a valid and compatible Shopp module
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return boolean True if the addon validates, false otherwise
  **/
 public function valid()
 {
     $error = false;
     if (false === strpos(strtolower($this->package), 'shopp') || empty($this->classname) || empty($this->interface)) {
         $error = true;
     } elseif (empty($this->version)) {
         $error = shopp_debug(sprintf('%s could not be loaded because no @version property was set in the addon header comments.', $this->filename));
     } elseif (empty($this->since)) {
         $error = shopp_debug(sprintf('%s could not be loaded because no @since property was set in the addon header comments.', $this->filename));
     } elseif (class_exists('ShoppVersion')) {
         if (version_compare(self::baseversion(ShoppVersion::release()), self::baseversion($this->since)) == -1) {
             $error = shopp_debug(sprintf('%s could not be loaded because it requires version %s (or higher) of Shopp.', $this->name, $this->since));
         }
     }
     if ($error) {
         return false;
     }
     return true;
 }
Пример #7
0
 /**
  * Provides a salted checksum of the current release
  *
  * This is used primarily for front-end browser cache control for assets (JS, CSS)
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @return string A short hex string representing the current cache version
  **/
 public static function cache()
 {
     return hash('crc32b', __FILE__ . ShoppVersion::release());
 }
Пример #8
0
 /**
  * Check if Shopp is installed and active.
  * If it is and the version is compatible, load our Shopp connector.
  */
 protected function shopp()
 {
     // Check if the legacy plugin exists
     if (class_exists('Tribe__Events__Tickets__Shopp__Main')) {
         $args = array('action' => 'deactivate', 'plugin' => $this->get_plugin_file('The Events Calendar: Shopp Tickets'), 'plugin_status' => 'all', 'paged' => 1, 's' => '');
         $deactivate_url = wp_nonce_url(add_query_arg($args, 'plugins.php'), 'deactivate-plugin_' . $args['plugin']);
         $this->nag_data['shopp'] = array(__('Shopp', 'event-tickets-plus'), $deactivate_url, 'legacy-plugin');
         return;
     }
     $shoppVersion = false;
     if (class_exists('ShoppVersion')) {
         $shoppVersion = ShoppVersion::release();
     } elseif (defined('SHOPP_VERSION')) {
         $shoppVersion = SHOPP_VERSION;
     }
     // Pre-1.3
     if (empty($shoppVersion)) {
         return;
     }
     // Here we will check for Comptibility problems
     if (!version_compare($shoppVersion, Tribe__Tickets_Plus__Commerce__Shopp__Main::REQUIRED_SHOPP_VERSION, '>=')) {
         $this->nag_data['shopp'] = array(__('Shopp', 'event-tickets-plus'), add_query_arg(array('tab' => 'plugin-information', 'plugin' => 'shopp', 'TB_iframe' => 'true'), admin_url('plugin-install.php')), 'incompatible');
         return;
     }
     Tribe__Tickets_Plus__Commerce__Shopp__Main::get_instance();
 }
Пример #9
0
 public static function earlyupdates()
 {
     $updates = shopp_setting('updates');
     $core = isset($updates->response[SHOPP_PLUGINFILE]) ? $updates->response[SHOPP_PLUGINFILE] : false;
     $addons = isset($updates->response[SHOPP_PLUGINFILE . '/addons']) ? $updates->response[SHOPP_PLUGINFILE . '/addons'] : false;
     if (!$core && !$addons) {
         return false;
     }
     $plugin_name = 'Shopp';
     $plugin_slug = strtolower($plugin_name);
     $store_url = ShoppSupport::STORE;
     $account_url = "{$store_url}/account/";
     $updates = array();
     if (!empty($core) && isset($core->new_version) && version_compare($core->new_version, ShoppVersion::release(), '>')) {
         $details_url = admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '&core=' . $core->new_version . '&TB_iframe=true&width=600&height=800');
         $updates[] = Shopp::_mi('%2$s Shopp %1$s is available %3$s from shopplugin.com now.', $core->new_version, '<a href="' . $details_url . '" class="thickbox" title="' . esc_attr($plugin_name) . '">', '</a>');
     }
     if (!empty($addons)) {
         // Addon update messages
         $addonupdates = array();
         foreach ((array) $addons as $addon) {
             $addonupdates[] = $addon->name . ' ' . $addon->new_version;
         }
         if (count($addons) > 1) {
             $last = array_pop($addonupdates);
             $updates[] = Shopp::_mi('Add-on updates are available for %s &amp; %s.', join(', ', $addonupdates), $last);
         } elseif (count($addons) == 1) {
             $updates[] = Shopp::_mi('An add-on update is available for %s.', $addonupdates[0]);
         }
     }
     if (is_network_admin() || !is_multisite()) {
         $wp_list_table = _get_list_table('WP_Plugins_List_Table');
         echo '<tr class="plugin-update-tr"><th colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
         Shopp::_emi('You&apos;re missing out on important updates! %1$s &nbsp; %2$s Buy a Shopp Support Key! %3$s', empty($updates) ? '' : join(' ', $updates), '<a href="' . ShoppSupport::STORE . '" class="button button-primary">', '</a>');
         echo '<style type="text/css">#shopp th,#shopp td{border-bottom:0;}</style>';
         echo '</div></td></tr>';
     }
     return true;
 }
Пример #10
0
 public static function cacheversion()
 {
     return hash('crc32b', ABSPATH . ShoppVersion::release());
 }
Пример #11
0
    ?>
		<?php 
    if (isset($_GET['_shopp_upgrade_notice'])) {
        ?>
			<?php 
        check_admin_referer('shopp_upgrade_notice');
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        $homeurl = wp_specialchars_decode(get_option('home'), ENT_QUOTES);
        $admin = get_bloginfo('admin_email');
        $site = parse_url($homeurl);
        $_ = array();
        $_[] = 'From: "' . $blogname . '" <' . shopp_setting('merchant_email') . '>';
        $_[] = 'To: ' . $admin;
        $_[] = sprintf('Subject: Shopp Upgraded on %s', $site['host']);
        $_[] = '';
        $_[] = sprintf(__('The Shopp installation on %1$s has been upgraded to %2$s and requires a database upgrade. Please login to %1$s and perform the upgrade by deactivating and reactivating the Shopp plugin.', 'Shopp'), $homeurl, ShoppVersion::release());
        $message = apply_filters('shopp_upgrade_notice_message', join("\n", $_));
        if (Shopp::email($message)) {
            shopp_debug('A Shopp upgrade notification was sent.');
        }
        Shopp::_em('### Upgrade Notice Sent

An upgrade notice has been sent to the site administrator.');
        ?>
		<?php 
    } else {
        ?>

			<div class="error"><?php 
        Shopp::_em('### Contact Your Site Administrator
Пример #12
0
 /**
  * Initializes default settings or resets missing settings
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function setup()
 {
     $Settings = ShoppSettings();
     $Settings->setup('show_welcome', 'on');
     $Settings->setup('display_welcome', 'on');
     // General Settings
     $Settings->setup('shipping', 'on');
     $Settings->setup('order_status', array(__('Pending', 'Shopp'), __('Completed', 'Shopp')));
     $Settings->setup('shopp_setup', 'completed');
     $Settings->setup('maintenance', 'off');
     $Settings->setup('dashboard', 'on');
     // Preferences
     $Settings->setup('order_confirmation', '');
     $Settings->setup('receipt_copy', '1');
     $Settings->setup('account_system', 'none');
     $Settings->setup('shopping_cart', 'on');
     $Settings->setup('cancel_reasons', array(__('Not as described or expected', 'Shopp'), __('Wrong size', 'Shopp'), __('Found better prices elsewhere', 'Shopp'), __('Product is missing parts', 'Shopp'), __('Product is defective or damaged', 'Shopp'), __('Took too long to deliver', 'Shopp'), __('Item out of stock', 'Shopp'), __('Customer request to cancel', 'Shopp'), __('Item discontinued', 'Shopp'), __('Other reason', 'Shopp')));
     // Shipping
     $Settings->setup('active_shipping', '');
     $Settings->setup('shipping', '');
     $Settings->setup('inventory', '');
     $Settings->setup('shipping_packaging', 'like');
     $Settings->setup('shipping_package_weight_limit', '-1');
     // Taxes
     $Settings->setup('tax_inclusive', '');
     $Settings->setup('taxes', '');
     $Settings->setup('taxrates', '');
     $Settings->setup('tax_shipping', '');
     // Presentation Settings
     $Settings->setup('theme_templates', 'off');
     $Settings->setup('row_products', '3');
     $Settings->setup('catalog_pagination', '24');
     $Settings->setup('default_product_order', 'title');
     $Settings->setup('product_image_order', 'ASC');
     $Settings->setup('product_image_orderby', 'sortorder');
     // System Settings
     $Settings->setup('uploader_pref', 'flash');
     $Settings->setup('script_loading', 'global');
     $Settings->setup('script_server', 'plugin');
     // Pre-inits
     $Settings->setup('active_catalog_promos', '');
     $Settings->setup('version', ShoppVersion::release());
     $this->images();
     // Setup default image settings
 }