Changeset 1500641
- Timestamp:
- 09/22/2016 10:49:56 PM (9 years ago)
- Location:
- pushpress-integration/trunk
- Files:
-
- 7 edited
-
inc/wp_pushpress_model.php (modified) (6 diffs)
-
inc/wp_pushpress_shortcode.php (modified) (2 diffs)
-
lib/php-sdk/lib/Pushpress/ApiRequestor.php (modified) (1 diff)
-
pushpress.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
-
templates/frontend/shortcode_plans.php (modified) (3 diffs)
-
templates/frontend/shortcode_products.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pushpress-integration/trunk/inc/wp_pushpress_model.php
r1498520 r1500641 17 17 public function get_products() { 18 18 19 if (! $productsObj = get_transient("pp_client_active_products")) { 19 $key = "pp_client_active_products"; 20 if (! $productsObj = get_transient($key)) { 20 21 $params = array( 21 'active' => 1 22 'active' => 1, 23 'show_on_wp' => 1 22 24 ); 23 25 //get products object 24 26 $productsObj = Pushpress_Product::all($params); 25 set_transient( 'pp_client_active_products', $productsObj, 300 ); // 5m 26 } 27 27 28 set_transient( $key, $productsObj, 300 ); // 5m 29 } 30 28 31 29 32 $productsList = array(); 30 33 31 34 foreach ($productsObj['data'] as $product) { 32 if($product->is_public){33 35 //get categories 34 36 $catId = $product->category->uuid; … … 47 49 sort($prices); 48 50 $productsList[$catId]['products'][$product->uuid]['price'] = $prices; 49 } 50 } 51 52 } 53 54 51 55 52 56 … … 91 95 } 92 96 97 public function get_products_by_id($id) { 98 $productsList = array(); 99 100 $key = "pp_client_active_product_" . $id; 101 102 if (! $product = get_transient($key)) { 103 104 //get products object 105 $product = Pushpress_Product::retrieve($id); 106 set_transient( $key, $productsObj, 300 ); // 5m 107 108 $productsList[$product->category->uuid]['products'][$product->uuid]['slug'] = $product->slug; 109 $productsList[$product->category->uuid]['products'][$product->uuid]['name'] = $product->name; 110 $productsList[$product->category->uuid]['products'][$product->uuid]['description'] = $product->description; 111 $prices = array(); 112 $options = $product->options; 113 foreach ($options as $option) { 114 $prices[] = $option->price; 115 } 116 sort($prices); 117 $productsList[$product->category->uuid]['products'][$product->uuid]['price'] = $prices; 118 } 119 120 return $productsList; 121 122 } 123 93 124 public function get_products_by_category($category) { 94 125 … … 103 134 //get products object 104 135 $productsObj = Pushpress_Product::all($params); 105 set_transient( $key, $productsObj, 600 ); // 5m136 set_transient( $key, $productsObj, 300 ); // 5m 106 137 } 107 138 … … 159 190 public function get_plans_by_id($id) { 160 191 $plansList = array(); 192 161 193 try { 162 194 163 195 $planType = array('R' => 'Recurring', 'N' => 'Non-Recurring', 'P' => 'Punchcards'); 164 196 165 if (!empty($id) && $this->plan_exist($id)) {197 if (!empty($id)) { 166 198 //get all products object 167 199 $plan = Pushpress_Plan::retrieve($id); … … 229 261 $end = strtotime("today 00:00:00 +1 year"); // 1 year later 230 262 231 $cache_key = "pp_client_calendar " . $isEvent . "_" . $start . "_" . $end;263 $cache_key = "pp_client_calendar_" . $isEvent . "_" . $start . "_" . $end; 232 264 233 265 if (! $calendar = get_transient($cache_key)) { -
pushpress-integration/trunk/inc/wp_pushpress_shortcode.php
r1287386 r1500641 12 12 13 13 public function products($atts) { 14 if (empty($atts['category'])) { 14 15 if (($atts['category'])) { 16 $products = $this->model->get_products_by_category($atts['category']); 17 } 18 else if (($atts['id'])) { 19 $products = $this->model->get_products_by_id($atts['id']); 20 } else { 15 21 $products = $this->model->get_products(); 16 } else {17 $products = $this->model->get_products_by_category($atts['category']);18 22 } 19 23 … … 30 34 $plans = $this->model->get_plans(); 31 35 $courses = $this->model->get_events("course", $atts); 36 // $events = $this->model->get_events("event", $atts); 37 } else { 38 // $events = $this->model->get_event_by_id($atts['id']); 39 $plans = $this->model->get_plans_by_id($atts['id']); 40 } 41 42 ob_start(); 43 include PUSHPRESS_FRONTEND . 'shortcode_plans.php'; 44 $output = ob_get_contents(); 45 ob_end_clean(); 46 return $output; 47 } 48 49 public function events($atts) { 50 51 if (empty($atts['id'])) { 32 52 $events = $this->model->get_events("event", $atts); 33 53 } else { 34 $events = $this->model->get_event_by_id($atts['id']); 35 $plans = $this->model->get_plans_by_id($atts['id']); 54 $events = $this->model->get_event_by_id($atts['id']); 36 55 } 37 56 -
pushpress-integration/trunk/lib/php-sdk/lib/Pushpress/ApiRequestor.php
r1230496 r1500641 125 125 if (PushpressApi::$apiVersion) 126 126 $headers[] = 'Pushpress-Version: ' . PushpressApi::$apiVersion; 127 128 127 129 list($rbody, $rcode) = $this->_curlRequest($meth, $absUrl, $headers, $params); 128 130 return array($rbody, $rcode, $myApiKey); -
pushpress-integration/trunk/pushpress.php
r1498520 r1500641 2 2 /** 3 3 * @package WP-PushPress 4 * @version 1.5. 54 * @version 1.5.6 5 5 */ 6 6 /* … … 9 9 Description: Easily integrate your workouts, calendar, products, membership plans, events and more with your Wordpress blog! This plugin is a free add-on for existing PushPress clients. See https://pushpress.com for more info. 10 10 Author: PushPress, Inc 11 Version: 1.5. 511 Version: 1.5.6 12 12 Author URI: https://pushpress.com 13 13 */ 14 14 define('PUSHPRESS_DEV', FALSE); 15 define( 'PP_PLUGIN_VERSION', '1.5. 5');15 define( 'PP_PLUGIN_VERSION', '1.5.6'); 16 16 define( 'PUSHPRESS_ERROR_REPORT', 0 ); 17 17 define( 'PUSHPRESS_BUTTON_CLASS', 'pushpress-button-class-' . rand(0, 10000)); … … 39 39 $this->prefixPagesSlug = 'pushpress-'; 40 40 $this->prefixShortcodes = 'wp-pushpress-'; 41 $this->listPagesSlug = array('products', 'plans', ' schedule', 'workouts', 'leads');41 $this->listPagesSlug = array('products', 'plans', 'events', 'schedule', 'workouts', 'leads'); 42 42 43 43 if ( is_admin() ){ -
pushpress-integration/trunk/readme.txt
r1498520 r1500641 4 4 Requires at least: 3.0.1 5 5 Tested up to: 4.6.1 6 Stable tag: 1.5. 56 Stable tag: 1.5.6 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 105 105 = 1.5.5 = 106 106 Enhanced mobile version of plans, products and events pages. 107 108 = 1.5.6 = 109 Added new shortcode: wp-pushpress-events to show events. 110 Removed events from the wp-pushpress-plans shortcode. 111 Added filter on products to only show items you designed as "show on wordpress". 112 Remove the header from shortcodes that are invoked using an ID to show only one item. [wp-pushpress-plans id="uniqueIDofPlan"] -
pushpress-integration/trunk/templates/frontend/shortcode_plans.php
r1498520 r1500641 6 6 7 7 <div class="wp-pushpress"> 8 8 9 <?php 9 10 if( !empty( $plans ) && count($plans) > 0 ){ … … 12 13 13 14 <ul class="wp-pushpress-list"> 15 <?php if (!$atts['id']) { ?> 14 16 <li class="item-first"> 15 17 <h3><?php echo $planType[$k];?></h3> 16 18 </li> 17 19 <?php 20 } 18 21 foreach ($item as $key => $value) { 19 22 ?> … … 74 77 75 78 <ul class="wp-pushpress-list"> 76 <li class="item-first"><h3>Events</h3> 77 <div class="clear"></div></li> 79 <?php if (!$atts['id']) { ?> 80 <li class="item-first"> 81 <h3>Events</h3> 82 </li> 83 78 84 <?php 85 } 79 86 foreach ($events as $key => $value) { 80 87 ?> -
pushpress-integration/trunk/templates/frontend/shortcode_products.php
r1498520 r1500641 21 21 22 22 <ul class="wp-pushpress-list"> 23 <?php if (!$atts['id']) { ?> 23 24 <li class="item-first"> 24 25 <h3><?php echo $item['category_name'];?></h3> 25 26 </li> 27 <?php } ?> 26 28 <?php 27 29 foreach ($item['products'] as $key => $value) {
Note: See TracChangeset
for help on using the changeset viewer.