| @@ -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.96 | |
| 6 | + * Version: 4.9.26 | |
| 7 | 7 | * Author: plainware.com |
| 8 | 8 | * Author URI: https://www.shiftcontroller.com/ |
| 9 | 9 | * Text Domain: shiftcontroller |
| 10 | 10 | * Domain Path: /languages/ |
| @@ -9,11 +9,9 @@ | ||
| 9 | 9 | * Text Domain: shiftcontroller |
| 10 | 10 | * Domain Path: /languages/ |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if (!defined('SH4_VERSION')) { | |
| 14 | - define( 'SH4_VERSION', 4996 ); | |
| 15 | -} | |
| 13 | +define( 'SH4_VERSION', 4926 ); | |
| 16 | 14 | |
| 17 | 15 | if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 18 | 16 | |
| 19 | 17 | if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { |
| @@ -30,9 +28,8 @@ | ||
| 30 | 28 | $conf = include( dirname(__FILE__) . '/config.php' ); |
| 31 | 29 | } |
| 32 | 30 | |
| 33 | 31 | $hc3path = defined('HC3_DEV_INSTALL') ? HC3_DEV_INSTALL : dirname(__FILE__) . '/hc3'; |
| 34 | -$hc3path = dirname(__FILE__) . '/hc3'; | |
| 35 | 32 | include_once( $hc3path . '/_wordpress/abstract/plugin.php' ); |
| 36 | 33 | |
| 37 | 34 | class ShiftController4 extends HC3_Abstract_Plugin |
| 38 | 35 | { |
| @@ -59,9 +56,9 @@ | ||
| 59 | 56 | 'notifications', |
| 60 | 57 | 'ical', |
| 61 | 58 | 'feed', |
| 62 | 59 | 'app', |
| 63 | - // 'upgrade3', | |
| 60 | + 'upgrade3', | |
| 64 | 61 | 'platform', |
| 65 | 62 | 'api', |
| 66 | 63 | 'reminders', |
| 67 | 64 | 'promo', |
| @@ -92,48 +89,26 @@ | ||
| 92 | 89 | |
| 93 | 90 | parent::adminInit(); |
| 94 | 91 | } |
| 95 | 92 | |
| 96 | - public function getOurShortcodeAtts() | |
| 97 | - { | |
| 98 | - $ret = false; | |
| 99 | - | |
| 100 | - $currentUrl = $_SERVER['REQUEST_URI']; | |
| 101 | - $currentPageId = url_to_postid( $currentUrl ); | |
| 102 | - if( $currentPageId ){ | |
| 103 | - $shortcode = 'shiftcontroller4'; | |
| 104 | - $pages = HC3_Functions::wpGetIdByShortcode( $shortcode ); | |
| 105 | - if( isset($pages[$currentPageId]) ){ | |
| 106 | - $ret = $pages[ $currentPageId ]; | |
| 107 | - } | |
| 108 | - } | |
| 109 | - | |
| 110 | - return $ret; | |
| 111 | - } | |
| 112 | - | |
| 113 | 93 | // intercepts if in the front page our slug is given then it's ours |
| 114 | 94 | public function intercept() |
| 115 | 95 | { |
| 116 | - $shortcodeAtts = null; | |
| 117 | - | |
| 118 | -// compatibility with WooCommerce Availability Scheduler 12.4 | |
| 119 | -global $was_post_remover; | |
| 120 | -if( $was_post_remover ){ | |
| 121 | - $shortcodeAtts = $this->getOurShortcodeAtts(); | |
| 122 | - if( false !== $shortcodeAtts ){ | |
| 123 | - remove_action( 'posts_request', array($was_post_remover,'AS_check_if_unhide_products_and_update_cart') ); | |
| 124 | - } | |
| 125 | -} | |
| 126 | - | |
| 127 | 96 | if( ! $this->isIntercepted() ){ |
| 128 | 97 | return; |
| 129 | 98 | } |
| 130 | 99 | |
| 131 | 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 | + | |
| 132 | 104 | $route = ''; |
| 133 | - if( null === $shortcodeAtts ){ | |
| 134 | - $shortcodeAtts = $this->getOurShortcodeAtts(); | |
| 135 | - 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]; | |
| 136 | 111 | $route = $this->initRequestByAtts( $shortcodeAtts ); |
| 137 | 112 | } |
| 138 | 113 | } |
| 139 | 114 | |
| @@ -199,15 +174,11 @@ | ||
| 199 | 174 | $root = $this->root(); |
| 200 | 175 | $request = $root->make('HC3_Request'); |
| 201 | 176 | $slug = $request->getSlug(); |
| 202 | 177 | |
| 203 | - // $processParams = array( 'type', 'groupby', 'start', 'end', 'time', 'pickup', 'conflict' ); | |
| 204 | - // if( $slug != 'myschedule' ){ | |
| 205 | - // $processParams = array_merge( $processParams, array('calendar', 'employee', 'hideui') ); | |
| 206 | - // } | |
| 207 | - $processParams = array( 'type', 'groupby', 'start', 'end', 'time', 'pickup', 'conflict', 'hideui', 't1', 't2' ); | |
| 178 | + $processParams = array( 'type', 'groupby', 'start', 'end', 'time', 'pickup', 'conflict' ); | |
| 208 | 179 | if( $slug != 'myschedule' ){ |
| 209 | - $processParams = array_merge( $processParams, array('calendar', 'employee') ); | |
| 180 | + $processParams = array_merge( $processParams, array('calendar', 'employee', 'hideui') ); | |
| 210 | 181 | } |
| 211 | 182 | $arrayFor = array( 'calendar', 'employee', 'hideui' ); |
| 212 | 183 | |
| 213 | 184 | $allowedRoutes = array('schedule', 'myschedule'); |
| @@ -234,12 +205,8 @@ | ||
| 234 | 205 | $v = array($v); |
| 235 | 206 | } |
| 236 | 207 | } |
| 237 | 208 | $request->initParam( $k, $v ); |
| 238 | - } | |
| 239 | - | |
| 240 | - if( ('myschedule' == $route) && ('schedule' == $slug) ){ | |
| 241 | - $request->setSlug('myschedule'); | |
| 242 | 209 | } |
| 243 | 210 | |
| 244 | 211 | return $route; |
| 245 | 212 | } |