Changeset 2820025
- Timestamp:
- 11/17/2022 07:17:22 PM (3 years ago)
- Location:
- swidget-for-cmp
- Files:
-
- 10 added
- 3 edited
-
tags/1.9.0 (added)
-
tags/1.9.0/edd (added)
-
tags/1.9.0/edd/class-edd-session.php (added)
-
tags/1.9.0/edd/libraries (added)
-
tags/1.9.0/edd/libraries/class-recursive-arrayaccess.php (added)
-
tags/1.9.0/edd/libraries/class-wp-session.php (added)
-
tags/1.9.0/edd/libraries/wp-session.php (added)
-
tags/1.9.0/readme.txt (added)
-
tags/1.9.0/settingsPage.php (added)
-
tags/1.9.0/swidget-cmp.php (added)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/settingsPage.php (modified) (1 diff)
-
trunk/swidget-cmp.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
swidget-for-cmp/trunk/readme.txt
r2775742 r2820025 5 5 Requires at least: 4.1.0 6 6 Tested up to: 5.8.1 7 Stable tag: 1. 87 Stable tag: 1.9 8 8 Requires PHP: 5.2 9 9 License: GPLv2 or later … … 17 17 18 18 #### Add to Cart 19 20 19 `[swaddtocart site="siteID" item="itemID"]` 21 20 … … 42 41 Optional parameter `date="YYYYMMDD"` should only be used for timed items. 43 42 _Note: timed items use the item ID of the timeslot, NOT the group ID._ 43 44 #### Multi-Item Add to Cart 45 `[swmulticart site="siteID" items="itemsString"]` 46 _Desplays a series of items as a drop-down menu. "items" expects a comma-delimited list of Siriusware item IDs._ 47 48 #### Multi-Item Quick Checkout 49 `[swmulticheckout items="itemsString"]` 50 Optional parameter `site="siteID"` 51 _Desplays a series of items as a drop-down menu. "items" expects a comma-delimited list of Siriusware item IDs._ 44 52 45 53 #### Cart … … 93 101 * **Select New Date** (`sw_txt_select_new_date`) - The label text for the date selector (timed ticketing) 94 102 * **Select New Time** (`sw_txt_select_new_time`) - The label text for the time selector (timed ticketing) 103 * **Select New Item** (`sw_txt_select_new_item`) - The label text for the item selector (multi-item) 95 104 * **Date Dropdown Placeholder** (`sw_txt_date_dropdown_placeholder`) - The default text for the date selector (timed ticketing) 96 105 * **Time Dropdown Placeholder** (`sw_txt_time_dropdown_placeholder`) - The default text for the time selector (timed ticketing) 106 * **Item Dropdown Placeholder** (`sw_txt_item_dropdown_placeholder`) - The default text for the item selector (multi-item) 97 107 * **Pay What you Wish Placeholder** (`sw_txt_pay_what_you_wish`) - The default text for the pay what you wish message 98 108 … … 167 177 == Changelog == 168 178 179 = 1.9.0 = 180 181 * Added "swmulticart" and "swmulticheckout" shortcodes 182 169 183 = 1.8.1 = 170 184 -
swidget-for-cmp/trunk/settingsPage.php
r2775742 r2820025 47 47 "sw_txt_select_new_date" => "Select a different date", 48 48 "sw_txt_select_new_time" => "Select a different time", 49 "sw_txt_select_new_item" => "Select a different item", 49 50 "sw_txt_date_dropdown_placeholder" => "Select a date", 50 51 "sw_txt_time_dropdown_placeholder" => "Select a time", 52 "sw_txt_item_dropdown_placeholder" => "Select an item", 51 53 ); 52 54 } -
swidget-for-cmp/trunk/swidget-cmp.php
r2775796 r2820025 5 5 GitHub Plugin URI: CMP-Studio/swidget-cmp 6 6 Description: Siriusware Widget for Carnegie Museusms of Pittsburgh 7 Version: 1. 8.17 Version: 1.9.0 8 8 Author: Carnegie Museums of Pittsburgh 9 9 Author URI: http://www.carnegiemuseums.org … … 15 15 16 16 //Session handling via DB 17 //see https://pippinsplugins.com/storing-session-data-in-wordpress-without- _session/17 //see https://pippinsplugins.com/storing-session-data-in-wordpress-without-session/ 18 18 if (!class_exists("EDD_Session")) { 19 19 include_once dirname( __FILE__ ) . '/edd/class-edd-session.php'; … … 46 46 } 47 47 48 //Initialize 48 /* 49 * Initialize 50 */ 49 51 if(!function_exists('swcmp_shortcodes_init')){ 50 52 function swcmp_session_init() … … 125 127 "sw_txt_select_new_date" => "txtSelectNewDate", 126 128 "sw_txt_select_new_time" => "txtSelectNewTime", 129 "sw_txt_select_new_item" => "txtSelectNewItem", 127 130 "sw_txt_date_dropdown_placeholder" => "txtDateDropdownPlaceholder", 128 131 "sw_txt_time_dropdown_placeholder" => "txtTimeDropdownPlaceholder", 132 "sw_txt_item_dropdown_placeholder" => "txtItemDropdownPlaceholder", 129 133 "sw_pre_selected_date" => "preSelectedDate", 130 134 "sw_pre_selected_time" => "preSelectedTime", … … 154 158 } 155 159 156 //The checkout widget 160 /* 161 * The checkout ("quick") widgets 162 */ 157 163 function swcmp_init_checkout() 158 164 { … … 200 206 $group = intval($co_atts["group"]); 201 207 $settings = swcmp_get_settings($atts); 208 202 209 $class = "swcmp_{$site}_{$group}"; 203 204 210 $out = <<<EOT 205 211 <script> … … 254 260 } 255 261 262 function swcmp_multi_checkout($atts=[], $content=null, $tag='') { 263 } 264 265 function swcmp_multiselect_quick($atts=[], $content=null, $tag='') 266 { 267 // normalize attribute keys, lowercase 268 $atts = array_change_key_case((array)$atts, CASE_LOWER); 269 $co_atts = shortcode_atts([ 270 "site" => null, 271 "items" => null 272 ], $atts, $tag); 273 //Start Output 274 $site = intval($co_atts["site"]); 275 $items = $co_atts["items"]; 276 //sanitize $items as comma-delimited integers. If it fails, just fall back to the int value 277 $validMatch = preg_match('/^(\d+,?)+$/', $items); 278 if (!$validMatch) { 279 $items = intval($co_atts["items"]); 280 } 281 $settings = swcmp_get_settings($atts); 282 //I don't think date will be used... 283 284 //since we don't have a traditional site & item... 285 $itemsStr = str_replace(",", "", $items); 286 $class = ($site ? "swcmp_{$site}_{$itemsStr}" : "swcmp_{$itemsStr}"); 287 $out = <<<EOT 288 <script> 289 jQuery(document).ready(function() { 290 jQuery("#swidget-script").one('load swidgetLoaded', function() { 291 jQuery(".$class").swMultiSelectorQuick($site, "$items", $settings); 292 }); 293 if (jQuery.fn.swMultiSelectorQuick) { 294 jQuery("#swidget-script").trigger('swidgetLoaded'); 295 } 296 }); 297 </script> 298 <div class="swidget-holder $class"></div> 299 EOT; 300 301 return $out; 302 } 303 256 304 add_shortcode('swcheckout', __NAMESPACE__ . '\swcmp_checkout'); 257 305 add_shortcode('swcheckouttimed', __NAMESPACE__ . '\swcmp_checkouttimed'); 258 306 add_shortcode('swoneclickcheckout', __NAMESPACE__ . '\swcmp_1clickcheckout'); 259 } 260 261 262 //Cart based functions 307 //add_shortcode('swmulticheckout', __NAMESPACE__ . '\swcmp_multi_checkout'); //calls multiple quickCheckout instances 308 add_shortcode('swmulticheckout', __NAMESPACE__ . '\swcmp_multiselect_quick'); 309 } 310 311 312 /* 313 * The cart based widgets 314 */ 263 315 function swcmp_init_cart() 264 316 { … … 276 328 277 329 $class = "swcmp_cart_$cart"; 278 279 330 $out = <<<EOT 280 331 <script> … … 311 362 312 363 $class = "swcmp_$site" . "_" . $item; 313 314 364 $out = <<<EOT 315 365 <script> … … 346 396 347 397 $class = "swidget_$site" . "_" . $group; 348 349 398 $out = <<<EOT 350 399 <script> … … 475 524 } 476 525 526 function swcmp_multi_addtocart($atts=[], $content=null, $tag='') 527 { 528 // normalize attribute keys, lowercase 529 $atts = array_change_key_case((array)$atts, CASE_LOWER); 530 $co_atts = shortcode_atts([ 531 "site" => null, 532 "items" => null, 533 "date" => null 534 ], $atts, $tag); 535 //Start Output 536 $site = intval($co_atts["site"]); 537 $items = $co_atts["items"]; 538 //sanitize $items as comma-delimited integers. If it fails, just fall back to the int value 539 $validMatch = preg_match('/^(\d+,?)+$/', $items); 540 if (!$validMatch) { 541 $items = intval($co_atts["items"]); 542 } 543 $date = ($co_atts["date"] ? intval($co_atts["date"]) : "null"); 544 $settings = swcmp_get_settings($atts); 545 546 $cart = swcmp_get_cart($site); 547 if(!isset($cart)) return ""; 548 549 $class = "swcmp_$site" . "_" . $item; 550 $out = <<<EOT 551 <script> 552 jQuery( document ).ready(function(){ 553 jQuery("#swidget-script").one('load swidgetLoaded', function() { 554 jQuery(".$class").swMultiCart($cart, $site, $settings); 555 }); 556 if (jQuery.fn.swMultiCart) { 557 jQuery("#swidget-script").trigger('swidgetLoaded'); 558 } 559 }); 560 </script> 561 <div class="swidget-holder $class" data-items="$items" data-start_date="$date"></div> 562 EOT; 563 564 return $out; 565 } 566 567 function swcmp_multiselect_cart($atts=[], $content=null, $tag='') 568 { 569 // normalize attribute keys, lowercase 570 $atts = array_change_key_case((array)$atts, CASE_LOWER); 571 $co_atts = shortcode_atts([ 572 "site" => null, 573 "items" => null, 574 ], $atts, $tag); 575 //Start Output 576 $site = intval($co_atts["site"]); 577 $items = $co_atts["items"]; 578 //sanitize $items as comma-delimited integers. If it fails, just fall back to the int value 579 $validMatch = preg_match('/^(\d+,?)+$/', $items); 580 if (!$validMatch) { 581 $items = intval($co_atts["items"]); 582 } 583 $settings = swcmp_get_settings($atts); 584 585 $cart = swcmp_get_cart($site); 586 if(!isset($cart)) return "<p>Failed</p>"; 587 588 $itemsStr = str_replace(",", "", $items); 589 $class = "swcmp_{$site}_{$itemsStr}"; 590 $out = <<<EOT 591 <script> 592 jQuery(document).ready(function() { 593 jQuery("#swidget-script").one('load swidgetLoaded', function() { 594 jQuery(".$class").swMultiSelectorCart($cart, $site, "$items", $settings); 595 }); 596 if (jQuery.fn.swMultiSelectorCart) { 597 jQuery("#swidget-script").trigger('swidgetLoaded'); 598 } 599 }); 600 </script> 601 <div class="swidget-holder $class"></div> 602 EOT; 603 604 return $out; 605 } 606 477 607 function swcmp_getcardbalance() 478 608 { … … 501 631 add_shortcode('swaddtocarttimed_firstga', __NAMESPACE__ . '\swcmp_addtocarttimed_firstga'); 502 632 add_shortcode('swoneclickaddtocart', __NAMESPACE__ . '\swcmp_1clickaddtocart'); 633 //add_shortcode('swmulticart', __NAMESPACE__ . '\swcmp_multi_addtocart'); 634 add_shortcode('swmulticart', __NAMESPACE__ . '\swcmp_multiselect_cart'); 503 635 add_shortcode('swcardbalance', __NAMESPACE__ . '\swcmp_getcardbalance'); 504 636 }
Note: See TracChangeset
for help on using the changeset viewer.