/** * Constructor. * * @since 1.1 * * @return void **/ public function __construct() { Shopping::restore('confirmed', $this->confirmed); if (is_admin()) { return; } if (!$this->posted()) { return; } $action = $this->form('checkout'); add_action('shopp_confirm_order', array($this, 'confirmed')); if (empty($action)) { return; } $this->Register = new ShoppRegistration(); add_action('shopp_process_shipmethod', array($this, 'shipmethod')); add_action('shopp_process_checkout', array($this, 'data')); add_action('shopp_process_checkout', array($this, 'customer')); add_action('shopp_process_checkout', array($this, 'shipaddress')); add_action('shopp_process_checkout', array($this, 'shipmethod')); add_action('shopp_process_checkout', array($this, 'billaddress')); add_action('shopp_process_checkout', array($this, 'payment')); add_action('shopp_process_checkout', array($this, 'process')); add_filter('shopp_validate_checkout', array('ShoppFormValidation', 'names')); add_filter('shopp_validate_checkout', array('ShoppFormValidation', 'email')); add_filter('shopp_validate_checkout', array('ShoppFormValidation', 'data')); add_filter('shopp_validate_checkout', array('ShoppFormValidation', 'login')); add_filter('shopp_validate_checkout', array('ShoppFormValidation', 'passwords')); add_filter('shopp_validate_checkout', array('ShoppFormValidation', 'billaddress')); }
public function __construct() { parent::__construct(); ShoppCatalog(); Shopping::restore('search', $this->search); Shopping::restore('browsing', $this->browsing); Shopping::restore('referrer', $this->referrer); Shopping::restore('viewed', $this->viewed); // Setup WP_Query overrides add_action('parse_query', array($this, 'query')); add_filter('posts_request', array($this, 'noquery'), 10, 2); add_filter('posts_request', array($this, 'onfront'), 10, 2); add_filter('posts_results', array($this, 'found'), 10, 2); add_filter('the_posts', array($this, 'posts'), 10, 2); add_action('wp', array($this, 'loaded')); add_action('wp', array($this, 'security')); add_action('wp', array($this, 'trackurl')); add_action('wp', array($this, 'viewed')); add_action('wp', array($this, 'cart')); add_action('wp', array($this, 'dashboard')); add_action('wp', array($this, 'shortcodes')); add_action('wp', array($this, 'behaviors')); add_filter('wp_get_nav_menu_items', array($this, 'menulinks'), 10, 2); add_filter('wp_list_pages', array($this, 'securelinks')); // Wrap Shopp content in #shopp div to enable CSS and Javascript add_filter('shopp_order_lookup', array('Storefront', 'wrapper')); add_filter('shopp_order_confirmation', array('Storefront', 'wrapper')); add_filter('shopp_errors_page', array('Storefront', 'wrapper')); add_filter('shopp_catalog_template', array('Storefront', 'wrapper')); add_filter('shopp_cart_template', array('Storefront', 'wrapper')); add_filter('shopp_checkout_page', array('Storefront', 'wrapper')); add_filter('shopp_account_template', array('Storefront', 'wrapper')); add_filter('shopp_category_template', array('Storefront', 'wrapper')); add_filter('shopp_order_receipt', array('Storefront', 'wrapper')); add_filter('shopp_account_manager', array('Storefront', 'wrapper')); add_filter('shopp_account_vieworder', array('Storefront', 'wrapper')); add_filter('the_content', array($this, 'autowrap'), 99); add_action('wp_enqueue_scripts', 'shopp_dependencies'); add_action('shopp_storefront_init', array($this, 'account')); add_filter('wp_nav_menu_objects', array($this, 'menus')); // Maintenance mode overrides add_filter('search_template', array($this, 'maintenance')); add_filter('taxonomy_template', array($this, 'maintenance')); add_filter('page_template', array($this, 'maintenance')); add_filter('single_template', array($this, 'maintenance')); // Template rendering add_action('do_feed_rss2', array($this, 'feed'), 1); add_filter('search_template', array($this, 'pages')); add_filter('page_template', array($this, 'pages')); add_filter('archive_template', array($this, 'pages')); add_filter('taxonomy_template', array($this, 'collections')); add_filter('single_template', array($this, 'single')); }
/** * Store constructor * * @author Jonathan Davis * @since 1.1 * @version 1.2 * * @return void **/ public function __construct() { parent::__construct(); Shopping::restore('worklist', $this->worklist); if ('off' == shopp_setting('inventory')) { array_splice($this->views, 4, 1); } if (isset($_GET['view']) && in_array($_GET['view'], $this->views)) { $this->view = $_GET['view']; } if (get_current_screen()) { get_current_screen()->post_type = ShoppProduct::$posttype; } if (!empty($_GET['id'])) { wp_enqueue_script('jquery-ui-draggable'); wp_enqueue_script('postbox'); wp_enqueue_script('wp-lists'); if (user_can_richedit()) { wp_enqueue_script('editor'); wp_enqueue_script('quicktags'); add_action('admin_print_footer_scripts', 'wp_tiny_mce', 20); } shopp_enqueue_script('colorbox'); shopp_enqueue_script('editors'); shopp_enqueue_script('scalecrop'); shopp_enqueue_script('calendar'); shopp_enqueue_script('product-editor'); shopp_enqueue_script('priceline'); shopp_enqueue_script('ocupload'); shopp_enqueue_script('swfupload'); shopp_enqueue_script('jquery-tmpl'); shopp_enqueue_script('suggest'); shopp_enqueue_script('search-select'); do_action('shopp_product_editor_scripts'); add_action('admin_head', array(&$this, 'layout')); } else { add_action('load-' . $this->screen, array($this, 'loader')); add_action('admin_print_scripts', array($this, 'columns')); } if ('inventory' == $this->view && shopp_setting_enabled('inventory')) { do_action('shopp_inventory_manager_scripts'); } add_action('load-' . $this->screen, array($this, 'workflow')); do_action('shopp_product_admin_scripts'); new ContentParser(); add_action('shopp_product_saved', array($this, 'index'), 99, 1); }
public function __construct(ShoppScreenController $Screen, $context, $priority, array $args = array()) { Shopping::restore('admin_notices', $this->notices); $this->Screen = $Screen; $this->references = $args; add_meta_box($this->id, $this->title() . self::help($this->id), array($this, 'box'), $Screen->id, $context, $priority, $args); // Parse query request if ($this->query()) { $this->actions(); $this->handlers('actions', (array) $this->actions()); do_action('shopp_metabox_' . $this->id . '_actions'); } // Parse posted form if ($this->posted()) { $this->handlers('ops', (array) $this->ops()); do_action('shopp_metabox_' . $this->id . '_ops'); } $this->references(); $this->init(); }
/** * Categorize constructor * * @return void * @author Jonathan Davis **/ public function __construct() { parent::__construct(); Shopping::restore('worklist', $this->worklist); if ('shopp-tags' == $_GET['page']) { wp_redirect(add_query_arg(array('taxonomy' => ProductTag::$taxon), admin_url('edit-tags.php'))); return; } if (!empty($_GET['id']) && !isset($_GET['a'])) { wp_enqueue_script('postbox'); wp_enqueue_script('swfupload-all'); if (user_can_richedit()) { wp_enqueue_script('editor'); wp_enqueue_script('quicktags'); add_action('admin_print_footer_scripts', 'wp_tiny_mce', 20); } shopp_enqueue_script('colorbox'); shopp_enqueue_script('editors'); shopp_enqueue_script('category-editor'); shopp_enqueue_script('priceline'); shopp_enqueue_script('ocupload'); shopp_enqueue_script('swfupload'); shopp_enqueue_script('shopp-swfupload-queue'); do_action('shopp_category_editor_scripts'); add_action('admin_head', array($this, 'layout')); } elseif (!empty($_GET['a']) && $_GET['a'] == 'arrange') { shopp_enqueue_script('category-arrange'); do_action('shopp_category_arrange_scripts'); add_action('admin_print_scripts', array($this, 'arrange_cols')); } elseif (!empty($_GET['a']) && $_GET['a'] == 'products') { shopp_enqueue_script('products-arrange'); do_action('shopp_category_products_arrange_scripts'); add_action('admin_print_scripts', array($this, 'products_cols')); } else { add_action('admin_print_scripts', array($this, 'columns')); } do_action('shopp_category_admin_scripts'); add_action('load-' . $this->screen, array($this, 'workflow')); }
/** * ShoppAdminController constructor * * @since 1.1 * * @param string $ui The directory path to the UI templates * @param array $request The screen request parameters * @return void **/ public function __construct($ui) { global $plugin_page; // Setup helper properties $this->ui = $ui; $this->id = ShoppAdmin::screen(); $this->pagename = $plugin_page; // Setup notices before actions and process ops Shopping::restore('admin_notices', $this->notices); add_action('shopp_admin_notices', array($this, 'notices')); // Parse query request if ($this->query()) { // Flag new model requests if ('new' == $this->request('id')) { $this->request['new'] = true; } $this->handlers('actions', (array) $this->actions()); do_action('shopp_admin_' . $this->slug() . '_actions'); } // Setup the working object model $this->Model = $this->process($this->load()); }
/** * Helper to access the Shopp-ing session instance * * @api * @since 1.2 * * @return Shopping **/ function ShoppShopping() { return Shopping::object(); }
<div class="content-wrapper" id="print"> <?php $invoiceid = strtoupper(Shopping::generateRandomString()); ?> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Invoice <small>#<?php echo $invoiceid; ?> </small> </h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li> <li><a href="#">Examples</a></li> <li class="active">Invoice</li> </ol> </section> <!-- <div class="pad margin no-print">--> <!-- <div class="callout callout-info" style="margin-bottom: 0!important;"> --> <!-- <h4><i class="fa fa-info"></i> Note:</h4>--> <!-- This page has been enhanced for printing. Click the print button at the bottom of the invoice to test.--> <!-- </div>--> <!-- </div>--> <!-- Main content --> <section class="invoice"> <!-- title row --> <div class="row">
/** * Do not use. Deprecated. * * @deprecated ShoppingObject::store * @see Shopping::restore * * @param string $property Property name to use * @param object $data The data to store * @return void **/ public static function store($property, &$data) { return Shopping::restore($property, $data); }
/** * Resets the session and redirects to the thank you page * * @author Jonathan Davis * @since 1.1 * * @return void **/ public function success() { if (!empty($this->inprogress)) { $this->purchase = $this->inprogress; ShoppPurchase(new ShoppPurchase($this->purchase)); $this->inprogress = false; // Remove the order processing lock delete_transient('shopp_order_' . ShoppShopping()->session()); do_action('shopp_order_success', ShoppPurchase()); Shopping::resession(); } if (false !== $this->purchase) { Shopp::redirect(Shopp::url(false, 'thanks')); } }
/** * Metodo para traer los productos relacionados de una compra * [getProductDataTable description] * @return [type] [description] */ public function getProductDataTable() { $arrjson = array(); $shopping = null; if (Input::get('shopping_id')) { $shopping_id = Input::get('shopping_id'); $shopping = Shopping::find($shopping_id); $shopping->products; } $product = Product::all(); $arrjson = array('valid' => true, 'shopping' => $shopping, 'product' => $product); return Response::json($arrjson); }
/** * Detect if promotions exist and pre-load if so. */ public function __construct() { Shopping::restore('promos', $this->promos); }
/** * ShoppAdminController constructor * * @since 1.1 * * @return void **/ public function __construct() { $request = isset($_GET['page']) ? $_GET['page'] : null; $Admin = ShoppAdmin(); if (!empty($Admin)) { $this->Admin = $Admin; } if (is_null($request)) { return; } global $plugin_page; $this->page = $plugin_page; $this->url = add_query_arg('page', $request, admin_url('admin.php')); if (function_exists('get_current_screen') && ($screen = get_current_screen())) { $this->screen = $screen->id; } if (false !== strpos($request, '-')) { $pages = explode('-', $_GET['page']); $this->pagename = end($pages); } Shopping::restore('admin_notices', $this->notices); add_action('shopp_admin_notices', array($this, 'notices')); $this->maintenance(); }
public function __construct() { Shopping::restore('paymethod', $this->selected); Shopping::restore('payselected', $this->userset); }
public function init() { Shopping::restore('notices', $this->notices); $this->notices = array_reverse($this->notices); }
} class ShoppingPoint { private $point; // point public function __construct($point) { $this->point = $point; } // 100 10, 300 50, 500 100 public function useWay($params) { if ($params['money'] < 100) { $this->point += 10; } elseif (300 > $params['money'] && $params['money'] >= 100) { $this->point += 50; } elseif (500 > $params['money'] && $params['money'] >= 300) { $this->point += 100; } else { if ($params['money'] >= 500) { $this->point += 150; } } // deal point return array('money' => $params['money'], 'point' => $this->point); } } $cd = new Shopping(10); echo $cd->useWay(new ShoppingDiscount()); echo "<hr>"; print_r($cd->useWay(new ShoppingPoint(100)));
public function init() { Shopping::restore('notices', $this->notices); }
/** * Resession */ public static function resession() { global $Shopp; if (method_exists('Shopping', 'resession')) { // Shopp >= 1.2 // @see https://github.com/ingenesis/shopp/blob/1.2/Shopp.php#L362-L368 // @see https://github.com/ingenesis/shopp/blob/1.2/core/model/Shopping.php#L94-L135 Shopping::resession(); } elseif (method_exists($Shopp, 'resession')) { // Shopp <= 1.1.9.1 // @see https://github.com/ingenesis/shopp/blob/1.1.9.1/Shopp.php#L385-L423 // @see https://github.com/ingenesis/shopp/blob/1.1/Shopp.php#L382-L413 $Shopp->resession(); } }
<?php // Question 7: echo "The scope resolution operator(::) allows access to static properties or methods\nof a class without instantiation. Even constants can be static accessed." . PHP_EOL . PHP_EOL; class Shopping { public static function pay() { return '12,500.00' . PHP_EOL; } } echo Shopping::pay(); echo PHP_EOL . "The -> allows access to instantiated members of an object like properties or\nmethods" . PHP_EOL . PHP_EOL; class ShoppingCart { public function pay() { return '12,500.00'; } } $instance = new ShoppingCart(); echo $instance->pay();