| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /* |
| 3 | 3 | * Plugin Name: ShiftController |
| 4 | 4 | * Plugin URI: https://www.shiftcontroller.com/ |
| 5 | 5 | * Description: Staff scheduling plugin |
| 6 | - * Version: 4.9.77 | |
| 6 | + * Version: 4.9.24 | |
| 7 | 7 | * Author: plainware.com |
| 8 | 8 | * Author URI: https://www.shiftcontroller.com/ |
| 9 | 9 | * Text Domain: shiftcontroller |
| 10 | 10 | * Domain Path: /languages/ |
| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | * Text Domain: shiftcontroller |
| 10 | 10 | * Domain Path: /languages/ |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -define( 'SH4_VERSION', 4977 ); | |
| 13 | +define( 'SH4_VERSION', 4924 ); | |
| 14 | 14 | |
| 15 | 15 | if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 16 | 16 | |
| 17 | 17 | if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { |
| @@ -56,9 +56,9 @@ | ||
| 56 | 56 | 'notifications', |
| 57 | 57 | 'ical', |
| 58 | 58 | 'feed', |
| 59 | 59 | 'app', |
| 60 | - // 'upgrade3', | |
| 60 | + 'upgrade3', | |
| 61 | 61 | 'platform', |
| 62 | 62 | 'api', |
| 63 | 63 | 'reminders', |
| 64 | 64 | 'promo', |
| @@ -89,48 +89,26 @@ | ||
| 89 | 89 | |
| 90 | 90 | parent::adminInit(); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function getOurShortcodeAtts() | |
| 94 | - { | |
| 95 | - $ret = false; | |
| 96 | - | |
| 97 | - $currentUrl = $_SERVER['REQUEST_URI']; | |
| 98 | - $currentPageId = url_to_postid( $currentUrl ); | |
| 99 | - if( $currentPageId ){ | |
| 100 | - $shortcode = 'shiftcontroller4'; | |
| 101 | - $pages = HC3_Functions::wpGetIdByShortcode( $shortcode ); | |
| 102 | - if( isset($pages[$currentPageId]) ){ | |
| 103 | - $ret = $pages[ $currentPageId ]; | |
| 104 | - } | |
| 105 | - } | |
| 106 | - | |
| 107 | - return $ret; | |
| 108 | - } | |
| 109 | - | |
| 110 | 93 | // intercepts if in the front page our slug is given then it's ours |
| 111 | 94 | public function intercept() |
| 112 | 95 | { |
| 113 | - $shortcodeAtts = null; | |
| 114 | - | |
| 115 | -// compatibility with WooCommerce Availability Scheduler 12.4 | |
| 116 | -global $was_post_remover; | |
| 117 | -if( $was_post_remover ){ | |
| 118 | - $shortcodeAtts = $this->getOurShortcodeAtts(); | |
| 119 | - if( false !== $shortcodeAtts ){ | |
| 120 | - remove_action( 'posts_request', array($was_post_remover,'AS_check_if_unhide_products_and_update_cart') ); | |
| 121 | - } | |
| 122 | -} | |
| 123 | - | |
| 124 | 96 | if( ! $this->isIntercepted() ){ |
| 125 | 97 | return; |
| 126 | 98 | } |
| 127 | 99 | |
| 128 | 100 | // it it points to a page with our shortcode then init request with shortcode atts |
| 101 | + $currentUrl = $_SERVER['REQUEST_URI']; | |
| 102 | + $currentPageId = url_to_postid( $currentUrl ); | |
| 103 | + | |
| 129 | 104 | $route = ''; |
| 130 | - if( null === $shortcodeAtts ){ | |
| 131 | - $shortcodeAtts = $this->getOurShortcodeAtts(); | |
| 132 | - if( false !== $shortcodeAtts ){ | |
| 105 | + if( $currentPageId ){ | |
| 106 | + $shortcode = 'shiftcontroller4'; | |
| 107 | + $pages = HC3_Functions::wpGetIdByShortcode( $shortcode ); | |
| 108 | + | |
| 109 | + if( isset($pages[$currentPageId]) ){ | |
| 110 | + $shortcodeAtts = $pages[$currentPageId]; | |
| 133 | 111 | $route = $this->initRequestByAtts( $shortcodeAtts ); |
| 134 | 112 | } |
| 135 | 113 | } |
| 136 | 114 | |
| @@ -196,15 +174,11 @@ | ||
| 196 | 174 | $root = $this->root(); |
| 197 | 175 | $request = $root->make('HC3_Request'); |
| 198 | 176 | $slug = $request->getSlug(); |
| 199 | 177 | |
| 200 | - // $processParams = array( 'type', 'groupby', 'start', 'end', 'time', 'pickup', 'conflict' ); | |
| 201 | - // if( $slug != 'myschedule' ){ | |
| 202 | - // $processParams = array_merge( $processParams, array('calendar', 'employee', 'hideui') ); | |
| 203 | - // } | |
| 204 | - $processParams = array( 'type', 'groupby', 'start', 'end', 'time', 'pickup', 'conflict', 'hideui' ); | |
| 178 | + $processParams = array( 'type', 'groupby', 'start', 'end', 'time', 'pickup', 'conflict' ); | |
| 205 | 179 | if( $slug != 'myschedule' ){ |
| 206 | - $processParams = array_merge( $processParams, array('calendar', 'employee') ); | |
| 180 | + $processParams = array_merge( $processParams, array('calendar', 'employee', 'hideui') ); | |
| 207 | 181 | } |
| 208 | 182 | $arrayFor = array( 'calendar', 'employee', 'hideui' ); |
| 209 | 183 | |
| 210 | 184 | $allowedRoutes = array('schedule', 'myschedule'); |
| @@ -231,12 +205,8 @@ | ||
| 231 | 205 | $v = array($v); |
| 232 | 206 | } |
| 233 | 207 | } |
| 234 | 208 | $request->initParam( $k, $v ); |
| 235 | - } | |
| 236 | - | |
| 237 | - if( ('myschedule' == $route) && ('schedule' == $slug) ){ | |
| 238 | - $request->setSlug('myschedule'); | |
| 239 | 209 | } |
| 240 | 210 | |
| 241 | 211 | return $route; |
| 242 | 212 | } |