コード例 #1
0
 public function autowrap($content)
 {
     if (!in_array(get_the_ID(), $this->shortcoded)) {
         return $content;
     }
     return ShoppStorefront::wrapper($content);
 }
コード例 #2
0
ファイル: Core.php プロジェクト: BlessySoftwares/anvelocom
 /**
  * Wraps mark-up in a #shopp container, if needed
  *
  * @deprecated Use ShoppStorefront::wrapper() instead
  **/
 public static function div($string)
 {
     return ShoppStorefront::wrapper($string);
 }
コード例 #3
0
ファイル: Pages.php プロジェクト: jonathandavis/shopp
 public function content($content)
 {
     global $wp_query;
     // Test that this is the main query and it is a product
     if (!$wp_query->is_main_query() || !is_shopp_product()) {
         return $content;
     }
     $Product = ShoppProduct();
     $templates = array('product.php');
     if (isset($Product->id) && !empty($Product->id)) {
         array_unshift($templates, 'product-' . $Product->id . '.php');
     }
     if (isset($Product->slug) && !empty($Product->slug)) {
         array_unshift($templates, 'product-' . $Product->slug . '.php');
     }
     // Load product summary data, before checking inventory
     if (!isset($Product->summed)) {
         $Product->load_data(array('summary'));
     }
     if (Shopp::str_true($Product->inventory) && $Product->stock < 1) {
         array_unshift($templates, 'product-outofstock.php');
     }
     ob_start();
     locate_shopp_template($templates, true);
     $content = ob_get_contents();
     ob_end_clean();
     return ShoppStorefront::wrapper($content);
 }
コード例 #4
0
ファイル: storefront.php プロジェクト: jonathandavis/shopp
 /**
  * Provides markup for the current collection or sets the current collection context
  *
  * @api `shopp('storefront.category')`
  * @since 1.2
  *
  * @param string          $result  The output
  * @param array           $options The options
  * - **controls**: `on` (on,off) Override the display of control elements in the `category.php` template
  * - **id**: Specify a collection by database ID to display through `shopp('collection...')` tags
  * - **load**: `off` (on,off) Load the collection into the working context without automatically rendering it with the `category.php` template
  * - **name**: Specify a collection by name to display through `shopp('collection...')` tags
  * - **order**: `title` (bestselling,highprice,lowprice,newest,oldest,random,title) Sets the sort order for products for sortable collections
  * - **pagination**: `numeric` (numeric,alpha) Set the pagination type to numbers `numeric` or alphabetic `alpha` pagination
  * - **reset**: This option is used by itself to reset the working collection context to the previous collection context or empty
  * - **show**: `1000` Limit the number of products to show in the category display
  * - **slug**: Specify a collection by slug to display through `shopp('collection...')` tags
  * - **title**: Sets the title to be shown for the collection, overriding the collection's own title
  * - **view**: (grid,list) Set the initial view of the category regardless of any shopper preference. The shopper can still change the view using view controls (if available) to change the view again.
  * @param ShoppStorefront $O       The working object
  * @return string The category markup
  **/
 public static function category($result, $options, $O)
 {
     $Storefront = ShoppStorefront();
     $reset = null;
     if (isset($options['name'])) {
         ShoppCollection(new ProductCategory($options['name'], 'name'));
     } elseif (isset($options['slug'])) {
         ShoppCollection(new ProductCategory($options['slug'], 'slug'));
     } elseif (isset($options['id'])) {
         ShoppCollection(new ProductCategory($options['id']));
     }
     if (isset($options['reset'])) {
         return is_a($Storefront->Requested, 'ProductCollection') ? ShoppCollection($Storefront->Requested) : ShoppCollection($reset);
     }
     if (isset($options['title'])) {
         ShoppCollection()->name = $options['title'];
     }
     if (isset($options['show'])) {
         ShoppCollection()->loading['limit'] = $options['show'];
     }
     if (isset($options['pagination'])) {
         ShoppCollection()->loading['pagination'] = $options['pagination'];
     }
     if (isset($options['order'])) {
         ShoppCollection()->loading['order'] = $options['order'];
     }
     if (isset($options['taxquery'])) {
         ShoppCollection()->loading['taxquery'] = $options['taxquery'];
     }
     if (isset($options['load'])) {
         return true;
     }
     if (isset($options['controls']) && !Shopp::str_true($options['controls'])) {
         ShoppCollection()->controls = false;
     }
     if (isset($options['view'])) {
         if ('grid' == $options['view']) {
             ShoppCollection()->view = 'grid';
         } else {
             ShoppCollection()->view = 'list';
         }
     }
     ob_start();
     $templates = array('category.php', 'collection.php');
     $ids = array('slug', 'id');
     foreach ($ids as $property) {
         if (isset(ShoppCollection()->{$property})) {
             $id = ShoppCollection()->{$property};
         }
         array_unshift($templates, 'category-' . $id . '.php', 'collection-' . $id . '.php');
     }
     locate_shopp_template($templates, true);
     $content = ob_get_clean();
     // Reset the current collection to previously requested collection or empty it
     if (is_a($Storefront->Requested, 'ProductCollection')) {
         ShoppCollection($Storefront->Requested);
     } else {
         ShoppCollection($reset);
     }
     if (isset($options['wrap']) && Shopp::str_true($options['wrap'])) {
         $content = ShoppStorefront::wrapper($content);
     }
     return $content;
 }