@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
| 4 | 4 | use EventEspresso\core\services\loaders\LoaderFactory; |
| 5 | 5 | |
| 6 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 7 | 7 | exit('No direct script access allowed'); |
| 8 | 8 | } |
| 9 | 9 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function __construct() |
| 53 | 53 | { |
| 54 | - espresso_load_required('EventEspresso\core\Factory', EE_CORE . 'Factory.php'); |
|
| 54 | + espresso_load_required('EventEspresso\core\Factory', EE_CORE.'Factory.php'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | $this->_load_class_tools(); |
| 106 | 106 | // load interfaces |
| 107 | 107 | espresso_load_required('EEI_Payment_Method_Interfaces', |
| 108 | - EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php'); |
|
| 108 | + EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php'); |
|
| 109 | 109 | // deprecated functions |
| 110 | - espresso_load_required('EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php'); |
|
| 110 | + espresso_load_required('EE_Deprecated', EE_CORE.'EE_Deprecated.core.php'); |
|
| 111 | 111 | // WP cron jobs |
| 112 | 112 | $loader->getShared('EE_Cron_Tasks'); |
| 113 | 113 | $loader->getShared('EE_Request_Handler'); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function dependency_map() |
| 145 | 145 | { |
| 146 | - if (! $this->dependency_map instanceof EE_Dependency_Map) { |
|
| 146 | + if ( ! $this->dependency_map instanceof EE_Dependency_Map) { |
|
| 147 | 147 | throw new EE_Error( |
| 148 | 148 | sprintf( |
| 149 | 149 | __('Invalid EE_Dependency_Map: "%1$s"', 'event_espresso'), |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function registry() |
| 164 | 164 | { |
| 165 | - if (! $this->registry instanceof EE_Registry) { |
|
| 165 | + if ( ! $this->registry instanceof EE_Registry) { |
|
| 166 | 166 | throw new EE_Error( |
| 167 | 167 | sprintf( |
| 168 | 168 | __('Invalid EE_Registry: "%1$s"', 'event_espresso'), |
@@ -180,14 +180,14 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | private function _load_dependency_map() |
| 182 | 182 | { |
| 183 | - if (! is_readable(EE_CORE . 'EE_Dependency_Map.core.php')) { |
|
| 183 | + if ( ! is_readable(EE_CORE.'EE_Dependency_Map.core.php')) { |
|
| 184 | 184 | EE_Error::add_error( |
| 185 | 185 | __('The EE_Dependency_Map core class could not be loaded.', 'event_espresso'), |
| 186 | 186 | __FILE__, __FUNCTION__, __LINE__ |
| 187 | 187 | ); |
| 188 | 188 | wp_die(EE_Error::get_notices()); |
| 189 | 189 | } |
| 190 | - require_once(EE_CORE . 'EE_Dependency_Map.core.php'); |
|
| 190 | + require_once(EE_CORE.'EE_Dependency_Map.core.php'); |
|
| 191 | 191 | return EE_Dependency_Map::instance($this->request, $this->response); |
| 192 | 192 | } |
| 193 | 193 | |
@@ -198,14 +198,14 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | private function _load_registry() |
| 200 | 200 | { |
| 201 | - if (! is_readable(EE_CORE . 'EE_Registry.core.php')) { |
|
| 201 | + if ( ! is_readable(EE_CORE.'EE_Registry.core.php')) { |
|
| 202 | 202 | EE_Error::add_error( |
| 203 | 203 | __('The EE_Registry core class could not be loaded.', 'event_espresso'), |
| 204 | 204 | __FILE__, __FUNCTION__, __LINE__ |
| 205 | 205 | ); |
| 206 | 206 | wp_die(EE_Error::get_notices()); |
| 207 | 207 | } |
| 208 | - require_once(EE_CORE . 'EE_Registry.core.php'); |
|
| 208 | + require_once(EE_CORE.'EE_Registry.core.php'); |
|
| 209 | 209 | return EE_Registry::instance($this->dependency_map); |
| 210 | 210 | } |
| 211 | 211 | |
@@ -216,13 +216,13 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | private function _load_class_tools() |
| 218 | 218 | { |
| 219 | - if (! is_readable(EE_HELPERS . 'EEH_Class_Tools.helper.php')) { |
|
| 219 | + if ( ! is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) { |
|
| 220 | 220 | EE_Error::add_error( |
| 221 | 221 | __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'), |
| 222 | 222 | __FILE__, __FUNCTION__, __LINE__ |
| 223 | 223 | ); |
| 224 | 224 | } |
| 225 | - require_once(EE_HELPERS . 'EEH_Class_Tools.helper.php'); |
|
| 225 | + require_once(EE_HELPERS.'EEH_Class_Tools.helper.php'); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | use EventEspresso\core\services\loaders\LoaderFactory; |
| 5 | 5 | |
| 6 | 6 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
| 7 | - exit('No direct script access allowed'); |
|
| 7 | + exit('No direct script access allowed'); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | |
@@ -24,208 +24,208 @@ discard block |
||
| 24 | 24 | class EE_Load_Espresso_Core implements EEI_Request_Decorator, EEI_Request_Stack_Core_App |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var EE_Request $request |
|
| 29 | - */ |
|
| 30 | - protected $request; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @var EE_Response $response |
|
| 34 | - */ |
|
| 35 | - protected $response; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @var EE_Dependency_Map $dependency_map |
|
| 39 | - */ |
|
| 40 | - protected $dependency_map; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @var EE_Registry $registry |
|
| 44 | - */ |
|
| 45 | - protected $registry; |
|
| 46 | - |
|
| 47 | - |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * EE_Load_Espresso_Core constructor |
|
| 51 | - */ |
|
| 52 | - public function __construct() |
|
| 53 | - { |
|
| 54 | - espresso_load_required('EventEspresso\core\Factory', EE_CORE . 'Factory.php'); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * handle |
|
| 61 | - * sets hooks for running rest of system |
|
| 62 | - * provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point |
|
| 63 | - * starting EE Addons from any other point may lead to problems |
|
| 64 | - * |
|
| 65 | - * @param EE_Request $request |
|
| 66 | - * @param EE_Response $response |
|
| 67 | - * @return EE_Response |
|
| 68 | - * @throws EE_Error |
|
| 69 | - * @throws InvalidDataTypeException |
|
| 70 | - * @throws InvalidInterfaceException |
|
| 71 | - * @throws InvalidArgumentException |
|
| 72 | - */ |
|
| 73 | - public function handle_request(EE_Request $request, EE_Response $response) |
|
| 74 | - { |
|
| 75 | - $this->request = $request; |
|
| 76 | - $this->response = $response; |
|
| 77 | - // info about how to load classes required by other classes |
|
| 78 | - $this->dependency_map = $this->_load_dependency_map(); |
|
| 79 | - // central repository for classes |
|
| 80 | - $this->registry = $this->_load_registry(); |
|
| 81 | - // PSR4 Autoloaders |
|
| 82 | - $this->registry->load_core('EE_Psr4AutoloaderInit'); |
|
| 83 | - do_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading'); |
|
| 84 | - $loader = LoaderFactory::getLoader($this->registry); |
|
| 85 | - $this->dependency_map->setLoader($loader); |
|
| 86 | - // build DI container |
|
| 87 | - // $OpenCoffeeShop = new EventEspresso\core\services\container\OpenCoffeeShop(); |
|
| 88 | - // $OpenCoffeeShop->addRecipes(); |
|
| 89 | - // $CoffeeShop = $OpenCoffeeShop->CoffeeShop(); |
|
| 90 | - // workarounds for PHP < 5.3 |
|
| 91 | - $this->_load_class_tools(); |
|
| 92 | - // load interfaces |
|
| 93 | - espresso_load_required('EEI_Payment_Method_Interfaces', |
|
| 94 | - EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php'); |
|
| 95 | - // deprecated functions |
|
| 96 | - espresso_load_required('EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php'); |
|
| 97 | - // WP cron jobs |
|
| 98 | - $loader->getShared('EE_Cron_Tasks'); |
|
| 99 | - $loader->getShared('EE_Request_Handler'); |
|
| 100 | - $loader->getShared('EE_System'); |
|
| 101 | - return $this->response; |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * @return EE_Request |
|
| 108 | - */ |
|
| 109 | - public function request() |
|
| 110 | - { |
|
| 111 | - return $this->request; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * @return EE_Response |
|
| 118 | - */ |
|
| 119 | - public function response() |
|
| 120 | - { |
|
| 121 | - return $this->response; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * @return EE_Dependency_Map |
|
| 128 | - * @throws EE_Error |
|
| 129 | - */ |
|
| 130 | - public function dependency_map() |
|
| 131 | - { |
|
| 132 | - if (! $this->dependency_map instanceof EE_Dependency_Map) { |
|
| 133 | - throw new EE_Error( |
|
| 134 | - sprintf( |
|
| 135 | - __('Invalid EE_Dependency_Map: "%1$s"', 'event_espresso'), |
|
| 136 | - print_r($this->dependency_map, true) |
|
| 137 | - ) |
|
| 138 | - ); |
|
| 139 | - } |
|
| 140 | - return $this->dependency_map; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * @return EE_Registry |
|
| 147 | - * @throws EE_Error |
|
| 148 | - */ |
|
| 149 | - public function registry() |
|
| 150 | - { |
|
| 151 | - if (! $this->registry instanceof EE_Registry) { |
|
| 152 | - throw new EE_Error( |
|
| 153 | - sprintf( |
|
| 154 | - __('Invalid EE_Registry: "%1$s"', 'event_espresso'), |
|
| 155 | - print_r($this->registry, true) |
|
| 156 | - ) |
|
| 157 | - ); |
|
| 158 | - } |
|
| 159 | - return $this->registry; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * @return EE_Dependency_Map |
|
| 166 | - */ |
|
| 167 | - private function _load_dependency_map() |
|
| 168 | - { |
|
| 169 | - if (! is_readable(EE_CORE . 'EE_Dependency_Map.core.php')) { |
|
| 170 | - EE_Error::add_error( |
|
| 171 | - __('The EE_Dependency_Map core class could not be loaded.', 'event_espresso'), |
|
| 172 | - __FILE__, __FUNCTION__, __LINE__ |
|
| 173 | - ); |
|
| 174 | - wp_die(EE_Error::get_notices()); |
|
| 175 | - } |
|
| 176 | - require_once(EE_CORE . 'EE_Dependency_Map.core.php'); |
|
| 177 | - return EE_Dependency_Map::instance($this->request, $this->response); |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * @return EE_Registry |
|
| 184 | - */ |
|
| 185 | - private function _load_registry() |
|
| 186 | - { |
|
| 187 | - if (! is_readable(EE_CORE . 'EE_Registry.core.php')) { |
|
| 188 | - EE_Error::add_error( |
|
| 189 | - __('The EE_Registry core class could not be loaded.', 'event_espresso'), |
|
| 190 | - __FILE__, __FUNCTION__, __LINE__ |
|
| 191 | - ); |
|
| 192 | - wp_die(EE_Error::get_notices()); |
|
| 193 | - } |
|
| 194 | - require_once(EE_CORE . 'EE_Registry.core.php'); |
|
| 195 | - return EE_Registry::instance($this->dependency_map); |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * @return void |
|
| 202 | - */ |
|
| 203 | - private function _load_class_tools() |
|
| 204 | - { |
|
| 205 | - if (! is_readable(EE_HELPERS . 'EEH_Class_Tools.helper.php')) { |
|
| 206 | - EE_Error::add_error( |
|
| 207 | - __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'), |
|
| 208 | - __FILE__, __FUNCTION__, __LINE__ |
|
| 209 | - ); |
|
| 210 | - } |
|
| 211 | - require_once(EE_HELPERS . 'EEH_Class_Tools.helper.php'); |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * called after the request stack has been fully processed |
|
| 218 | - * if any of the middleware apps has requested the plugin be deactivated, then we do that now |
|
| 219 | - * |
|
| 220 | - * @param EE_Request $request |
|
| 221 | - * @param EE_Response $response |
|
| 222 | - */ |
|
| 223 | - public function handle_response(EE_Request $request, EE_Response $response) |
|
| 224 | - { |
|
| 225 | - if ($response->plugin_deactivated()) { |
|
| 226 | - espresso_deactivate_plugin(EE_PLUGIN_BASENAME); |
|
| 227 | - } |
|
| 228 | - } |
|
| 27 | + /** |
|
| 28 | + * @var EE_Request $request |
|
| 29 | + */ |
|
| 30 | + protected $request; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @var EE_Response $response |
|
| 34 | + */ |
|
| 35 | + protected $response; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @var EE_Dependency_Map $dependency_map |
|
| 39 | + */ |
|
| 40 | + protected $dependency_map; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @var EE_Registry $registry |
|
| 44 | + */ |
|
| 45 | + protected $registry; |
|
| 46 | + |
|
| 47 | + |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * EE_Load_Espresso_Core constructor |
|
| 51 | + */ |
|
| 52 | + public function __construct() |
|
| 53 | + { |
|
| 54 | + espresso_load_required('EventEspresso\core\Factory', EE_CORE . 'Factory.php'); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * handle |
|
| 61 | + * sets hooks for running rest of system |
|
| 62 | + * provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point |
|
| 63 | + * starting EE Addons from any other point may lead to problems |
|
| 64 | + * |
|
| 65 | + * @param EE_Request $request |
|
| 66 | + * @param EE_Response $response |
|
| 67 | + * @return EE_Response |
|
| 68 | + * @throws EE_Error |
|
| 69 | + * @throws InvalidDataTypeException |
|
| 70 | + * @throws InvalidInterfaceException |
|
| 71 | + * @throws InvalidArgumentException |
|
| 72 | + */ |
|
| 73 | + public function handle_request(EE_Request $request, EE_Response $response) |
|
| 74 | + { |
|
| 75 | + $this->request = $request; |
|
| 76 | + $this->response = $response; |
|
| 77 | + // info about how to load classes required by other classes |
|
| 78 | + $this->dependency_map = $this->_load_dependency_map(); |
|
| 79 | + // central repository for classes |
|
| 80 | + $this->registry = $this->_load_registry(); |
|
| 81 | + // PSR4 Autoloaders |
|
| 82 | + $this->registry->load_core('EE_Psr4AutoloaderInit'); |
|
| 83 | + do_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading'); |
|
| 84 | + $loader = LoaderFactory::getLoader($this->registry); |
|
| 85 | + $this->dependency_map->setLoader($loader); |
|
| 86 | + // build DI container |
|
| 87 | + // $OpenCoffeeShop = new EventEspresso\core\services\container\OpenCoffeeShop(); |
|
| 88 | + // $OpenCoffeeShop->addRecipes(); |
|
| 89 | + // $CoffeeShop = $OpenCoffeeShop->CoffeeShop(); |
|
| 90 | + // workarounds for PHP < 5.3 |
|
| 91 | + $this->_load_class_tools(); |
|
| 92 | + // load interfaces |
|
| 93 | + espresso_load_required('EEI_Payment_Method_Interfaces', |
|
| 94 | + EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php'); |
|
| 95 | + // deprecated functions |
|
| 96 | + espresso_load_required('EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php'); |
|
| 97 | + // WP cron jobs |
|
| 98 | + $loader->getShared('EE_Cron_Tasks'); |
|
| 99 | + $loader->getShared('EE_Request_Handler'); |
|
| 100 | + $loader->getShared('EE_System'); |
|
| 101 | + return $this->response; |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * @return EE_Request |
|
| 108 | + */ |
|
| 109 | + public function request() |
|
| 110 | + { |
|
| 111 | + return $this->request; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * @return EE_Response |
|
| 118 | + */ |
|
| 119 | + public function response() |
|
| 120 | + { |
|
| 121 | + return $this->response; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * @return EE_Dependency_Map |
|
| 128 | + * @throws EE_Error |
|
| 129 | + */ |
|
| 130 | + public function dependency_map() |
|
| 131 | + { |
|
| 132 | + if (! $this->dependency_map instanceof EE_Dependency_Map) { |
|
| 133 | + throw new EE_Error( |
|
| 134 | + sprintf( |
|
| 135 | + __('Invalid EE_Dependency_Map: "%1$s"', 'event_espresso'), |
|
| 136 | + print_r($this->dependency_map, true) |
|
| 137 | + ) |
|
| 138 | + ); |
|
| 139 | + } |
|
| 140 | + return $this->dependency_map; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * @return EE_Registry |
|
| 147 | + * @throws EE_Error |
|
| 148 | + */ |
|
| 149 | + public function registry() |
|
| 150 | + { |
|
| 151 | + if (! $this->registry instanceof EE_Registry) { |
|
| 152 | + throw new EE_Error( |
|
| 153 | + sprintf( |
|
| 154 | + __('Invalid EE_Registry: "%1$s"', 'event_espresso'), |
|
| 155 | + print_r($this->registry, true) |
|
| 156 | + ) |
|
| 157 | + ); |
|
| 158 | + } |
|
| 159 | + return $this->registry; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * @return EE_Dependency_Map |
|
| 166 | + */ |
|
| 167 | + private function _load_dependency_map() |
|
| 168 | + { |
|
| 169 | + if (! is_readable(EE_CORE . 'EE_Dependency_Map.core.php')) { |
|
| 170 | + EE_Error::add_error( |
|
| 171 | + __('The EE_Dependency_Map core class could not be loaded.', 'event_espresso'), |
|
| 172 | + __FILE__, __FUNCTION__, __LINE__ |
|
| 173 | + ); |
|
| 174 | + wp_die(EE_Error::get_notices()); |
|
| 175 | + } |
|
| 176 | + require_once(EE_CORE . 'EE_Dependency_Map.core.php'); |
|
| 177 | + return EE_Dependency_Map::instance($this->request, $this->response); |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * @return EE_Registry |
|
| 184 | + */ |
|
| 185 | + private function _load_registry() |
|
| 186 | + { |
|
| 187 | + if (! is_readable(EE_CORE . 'EE_Registry.core.php')) { |
|
| 188 | + EE_Error::add_error( |
|
| 189 | + __('The EE_Registry core class could not be loaded.', 'event_espresso'), |
|
| 190 | + __FILE__, __FUNCTION__, __LINE__ |
|
| 191 | + ); |
|
| 192 | + wp_die(EE_Error::get_notices()); |
|
| 193 | + } |
|
| 194 | + require_once(EE_CORE . 'EE_Registry.core.php'); |
|
| 195 | + return EE_Registry::instance($this->dependency_map); |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * @return void |
|
| 202 | + */ |
|
| 203 | + private function _load_class_tools() |
|
| 204 | + { |
|
| 205 | + if (! is_readable(EE_HELPERS . 'EEH_Class_Tools.helper.php')) { |
|
| 206 | + EE_Error::add_error( |
|
| 207 | + __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'), |
|
| 208 | + __FILE__, __FUNCTION__, __LINE__ |
|
| 209 | + ); |
|
| 210 | + } |
|
| 211 | + require_once(EE_HELPERS . 'EEH_Class_Tools.helper.php'); |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * called after the request stack has been fully processed |
|
| 218 | + * if any of the middleware apps has requested the plugin be deactivated, then we do that now |
|
| 219 | + * |
|
| 220 | + * @param EE_Request $request |
|
| 221 | + * @param EE_Response $response |
|
| 222 | + */ |
|
| 223 | + public function handle_response(EE_Request $request, EE_Response $response) |
|
| 224 | + { |
|
| 225 | + if ($response->plugin_deactivated()) { |
|
| 226 | + espresso_deactivate_plugin(EE_PLUGIN_BASENAME); |
|
| 227 | + } |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | 230 | |
| 231 | 231 | |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
| 4 | - exit('No direct script access allowed'); |
|
| 4 | + exit('No direct script access allowed'); |
|
| 5 | 5 | } |
| 6 | 6 | require_once(EE_MODELS . 'EEM_Base.model.php'); |
| 7 | 7 | |
@@ -17,193 +17,193 @@ discard block |
||
| 17 | 17 | class EEM_Transaction extends EEM_Base |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - // private instance of the Transaction object |
|
| 21 | - protected static $_instance; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * Status ID(STS_ID on esp_status table) to indicate the transaction is complete, |
|
| 25 | - * but payment is pending. This is the state for transactions where payment is promised |
|
| 26 | - * from an offline gateway. |
|
| 27 | - */ |
|
| 28 | - // const open_status_code = 'TPN'; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * Status ID(STS_ID on esp_status table) to indicate the transaction failed, |
|
| 32 | - * either due to a technical reason (server or computer crash during registration), |
|
| 33 | - * or some other reason that prevent the collection of any useful contact information from any of the registrants |
|
| 34 | - */ |
|
| 35 | - const failed_status_code = 'TFL'; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * Status ID(STS_ID on esp_status table) to indicate the transaction was abandoned, |
|
| 39 | - * either due to a technical reason (server or computer crash during registration), |
|
| 40 | - * or due to an abandoned cart after registrant chose not to complete the registration process |
|
| 41 | - * HOWEVER... |
|
| 42 | - * an abandoned TXN differs from a failed TXN in that it was able to capture contact information for at least one |
|
| 43 | - * registrant |
|
| 44 | - */ |
|
| 45 | - const abandoned_status_code = 'TAB'; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Status ID(STS_ID on esp_status table) to indicate an incomplete transaction, |
|
| 49 | - * meaning that monies are still owing: TXN_paid < TXN_total |
|
| 50 | - */ |
|
| 51 | - const incomplete_status_code = 'TIN'; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Status ID (STS_ID on esp_status table) to indicate a complete transaction. |
|
| 55 | - * meaning that NO monies are owing: TXN_paid == TXN_total |
|
| 56 | - */ |
|
| 57 | - const complete_status_code = 'TCM'; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * Status ID(STS_ID on esp_status table) to indicate the transaction is overpaid. |
|
| 61 | - * This is the same as complete, but site admins actually owe clients the moneys! TXN_paid > TXN_total |
|
| 62 | - */ |
|
| 63 | - const overpaid_status_code = 'TOP'; |
|
| 64 | - |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * private constructor to prevent direct creation |
|
| 68 | - * |
|
| 69 | - * @Constructor |
|
| 70 | - * @access protected |
|
| 71 | - * |
|
| 72 | - * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any |
|
| 73 | - * incoming timezone data that gets saved). Note this just sends the timezone info to the |
|
| 74 | - * date time model field objects. Default is NULL (and will be assumed using the set |
|
| 75 | - * timezone in the 'timezone_string' wp option) |
|
| 76 | - * |
|
| 77 | - * @return EEM_Transaction |
|
| 78 | - * @throws \EE_Error |
|
| 79 | - */ |
|
| 80 | - protected function __construct($timezone) |
|
| 81 | - { |
|
| 82 | - $this->singular_item = __('Transaction', 'event_espresso'); |
|
| 83 | - $this->plural_item = __('Transactions', 'event_espresso'); |
|
| 84 | - |
|
| 85 | - $this->_tables = array( |
|
| 86 | - 'TransactionTable' => new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
| 87 | - ); |
|
| 88 | - $this->_fields = array( |
|
| 89 | - 'TransactionTable' => array( |
|
| 90 | - 'TXN_ID' => new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
| 91 | - 'TXN_timestamp' => new EE_Datetime_Field('TXN_timestamp', |
|
| 92 | - __('date when transaction was created', 'event_espresso'), false, EE_Datetime_Field::now, |
|
| 93 | - $timezone), |
|
| 94 | - 'TXN_total' => new EE_Money_Field('TXN_total', |
|
| 95 | - __('Total value of Transaction', 'event_espresso'), false, 0), |
|
| 96 | - 'TXN_paid' => new EE_Money_Field('TXN_paid', |
|
| 97 | - __('Amount paid towards transaction to date', 'event_espresso'), false, 0), |
|
| 98 | - 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), |
|
| 99 | - false, EEM_Transaction::failed_status_code, 'Status'), |
|
| 100 | - 'TXN_session_data' => new EE_Serialized_Text_Field('TXN_session_data', |
|
| 101 | - __('Serialized session data', 'event_espresso'), true, ''), |
|
| 102 | - 'TXN_hash_salt' => new EE_Plain_Text_Field('TXN_hash_salt', |
|
| 103 | - __('Transaction Hash Salt', 'event_espresso'), true, ''), |
|
| 104 | - 'PMD_ID' => new EE_Foreign_Key_Int_Field('PMD_ID', |
|
| 105 | - __("Last Used Payment Method", 'event_espresso'), true, null, 'Payment_Method'), |
|
| 106 | - 'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', |
|
| 107 | - __('Registration Steps', 'event_espresso'), false, array()), |
|
| 108 | - ) |
|
| 109 | - ); |
|
| 110 | - $this->_model_relations = array( |
|
| 111 | - 'Registration' => new EE_Has_Many_Relation(), |
|
| 112 | - 'Payment' => new EE_Has_Many_Relation(), |
|
| 113 | - 'Status' => new EE_Belongs_To_Relation(), |
|
| 114 | - 'Line_Item' => new EE_Has_Many_Relation(false), |
|
| 115 | - //you can delete a transaction without needing to delete its line items |
|
| 116 | - 'Payment_Method' => new EE_Belongs_To_Relation(), |
|
| 117 | - 'Message' => new EE_Has_Many_Relation() |
|
| 118 | - ); |
|
| 119 | - $this->_model_chain_to_wp_user = 'Registration.Event'; |
|
| 120 | - parent::__construct($timezone); |
|
| 121 | - |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * txn_status_array |
|
| 127 | - * get list of transaction statuses |
|
| 128 | - * |
|
| 129 | - * @access public |
|
| 130 | - * @return array |
|
| 131 | - */ |
|
| 132 | - public static function txn_status_array() |
|
| 133 | - { |
|
| 134 | - return apply_filters( |
|
| 135 | - 'FHEE__EEM_Transaction__txn_status_array', |
|
| 136 | - array( |
|
| 137 | - EEM_Transaction::overpaid_status_code, |
|
| 138 | - EEM_Transaction::complete_status_code, |
|
| 139 | - EEM_Transaction::incomplete_status_code, |
|
| 140 | - EEM_Transaction::abandoned_status_code, |
|
| 141 | - EEM_Transaction::failed_status_code, |
|
| 142 | - ) |
|
| 143 | - ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * get the revenue per day for the Transaction Admin page Reports Tab |
|
| 148 | - * |
|
| 149 | - * @access public |
|
| 150 | - * |
|
| 151 | - * @param string $period |
|
| 152 | - * |
|
| 153 | - * @return \stdClass[] |
|
| 154 | - */ |
|
| 155 | - public function get_revenue_per_day_report($period = '-1 month') |
|
| 156 | - { |
|
| 157 | - $sql_date = $this->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', strtotime($period)), |
|
| 158 | - 'Y-m-d H:i:s', 'UTC'); |
|
| 159 | - |
|
| 160 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp'); |
|
| 161 | - |
|
| 162 | - return $this->_get_all_wpdb_results( |
|
| 163 | - array( |
|
| 164 | - array( |
|
| 165 | - 'TXN_timestamp' => array('>=', $sql_date) |
|
| 166 | - ), |
|
| 167 | - 'group_by' => 'txnDate', |
|
| 168 | - 'order_by' => array('TXN_timestamp' => 'ASC') |
|
| 169 | - ), |
|
| 170 | - OBJECT, |
|
| 171 | - array( |
|
| 172 | - 'txnDate' => array('DATE(' . $query_interval . ')', '%s'), |
|
| 173 | - 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
|
| 174 | - ) |
|
| 175 | - ); |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - |
|
| 179 | - /** |
|
| 180 | - * get the revenue per event for the Transaction Admin page Reports Tab |
|
| 181 | - * |
|
| 182 | - * @access public |
|
| 183 | - * |
|
| 184 | - * @param string $period |
|
| 185 | - * |
|
| 186 | - * @throws \EE_Error |
|
| 187 | - * @return mixed |
|
| 188 | - */ |
|
| 189 | - public function get_revenue_per_event_report($period = '-1 month') |
|
| 190 | - { |
|
| 191 | - global $wpdb; |
|
| 192 | - $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
| 193 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
| 194 | - $registration_payment_table = $wpdb->prefix . 'esp_registration_payment'; |
|
| 195 | - $event_table = $wpdb->posts; |
|
| 196 | - $payment_table = $wpdb->prefix . 'esp_payment'; |
|
| 197 | - $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
|
| 198 | - $approved_payment_status = EEM_Payment::status_id_approved; |
|
| 199 | - $extra_event_on_join = ''; |
|
| 200 | - //exclude events not authored by user if permissions in effect |
|
| 201 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
| 202 | - $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - return $wpdb->get_results( |
|
| 206 | - "SELECT |
|
| 20 | + // private instance of the Transaction object |
|
| 21 | + protected static $_instance; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * Status ID(STS_ID on esp_status table) to indicate the transaction is complete, |
|
| 25 | + * but payment is pending. This is the state for transactions where payment is promised |
|
| 26 | + * from an offline gateway. |
|
| 27 | + */ |
|
| 28 | + // const open_status_code = 'TPN'; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * Status ID(STS_ID on esp_status table) to indicate the transaction failed, |
|
| 32 | + * either due to a technical reason (server or computer crash during registration), |
|
| 33 | + * or some other reason that prevent the collection of any useful contact information from any of the registrants |
|
| 34 | + */ |
|
| 35 | + const failed_status_code = 'TFL'; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * Status ID(STS_ID on esp_status table) to indicate the transaction was abandoned, |
|
| 39 | + * either due to a technical reason (server or computer crash during registration), |
|
| 40 | + * or due to an abandoned cart after registrant chose not to complete the registration process |
|
| 41 | + * HOWEVER... |
|
| 42 | + * an abandoned TXN differs from a failed TXN in that it was able to capture contact information for at least one |
|
| 43 | + * registrant |
|
| 44 | + */ |
|
| 45 | + const abandoned_status_code = 'TAB'; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Status ID(STS_ID on esp_status table) to indicate an incomplete transaction, |
|
| 49 | + * meaning that monies are still owing: TXN_paid < TXN_total |
|
| 50 | + */ |
|
| 51 | + const incomplete_status_code = 'TIN'; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Status ID (STS_ID on esp_status table) to indicate a complete transaction. |
|
| 55 | + * meaning that NO monies are owing: TXN_paid == TXN_total |
|
| 56 | + */ |
|
| 57 | + const complete_status_code = 'TCM'; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * Status ID(STS_ID on esp_status table) to indicate the transaction is overpaid. |
|
| 61 | + * This is the same as complete, but site admins actually owe clients the moneys! TXN_paid > TXN_total |
|
| 62 | + */ |
|
| 63 | + const overpaid_status_code = 'TOP'; |
|
| 64 | + |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * private constructor to prevent direct creation |
|
| 68 | + * |
|
| 69 | + * @Constructor |
|
| 70 | + * @access protected |
|
| 71 | + * |
|
| 72 | + * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any |
|
| 73 | + * incoming timezone data that gets saved). Note this just sends the timezone info to the |
|
| 74 | + * date time model field objects. Default is NULL (and will be assumed using the set |
|
| 75 | + * timezone in the 'timezone_string' wp option) |
|
| 76 | + * |
|
| 77 | + * @return EEM_Transaction |
|
| 78 | + * @throws \EE_Error |
|
| 79 | + */ |
|
| 80 | + protected function __construct($timezone) |
|
| 81 | + { |
|
| 82 | + $this->singular_item = __('Transaction', 'event_espresso'); |
|
| 83 | + $this->plural_item = __('Transactions', 'event_espresso'); |
|
| 84 | + |
|
| 85 | + $this->_tables = array( |
|
| 86 | + 'TransactionTable' => new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
| 87 | + ); |
|
| 88 | + $this->_fields = array( |
|
| 89 | + 'TransactionTable' => array( |
|
| 90 | + 'TXN_ID' => new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
| 91 | + 'TXN_timestamp' => new EE_Datetime_Field('TXN_timestamp', |
|
| 92 | + __('date when transaction was created', 'event_espresso'), false, EE_Datetime_Field::now, |
|
| 93 | + $timezone), |
|
| 94 | + 'TXN_total' => new EE_Money_Field('TXN_total', |
|
| 95 | + __('Total value of Transaction', 'event_espresso'), false, 0), |
|
| 96 | + 'TXN_paid' => new EE_Money_Field('TXN_paid', |
|
| 97 | + __('Amount paid towards transaction to date', 'event_espresso'), false, 0), |
|
| 98 | + 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), |
|
| 99 | + false, EEM_Transaction::failed_status_code, 'Status'), |
|
| 100 | + 'TXN_session_data' => new EE_Serialized_Text_Field('TXN_session_data', |
|
| 101 | + __('Serialized session data', 'event_espresso'), true, ''), |
|
| 102 | + 'TXN_hash_salt' => new EE_Plain_Text_Field('TXN_hash_salt', |
|
| 103 | + __('Transaction Hash Salt', 'event_espresso'), true, ''), |
|
| 104 | + 'PMD_ID' => new EE_Foreign_Key_Int_Field('PMD_ID', |
|
| 105 | + __("Last Used Payment Method", 'event_espresso'), true, null, 'Payment_Method'), |
|
| 106 | + 'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', |
|
| 107 | + __('Registration Steps', 'event_espresso'), false, array()), |
|
| 108 | + ) |
|
| 109 | + ); |
|
| 110 | + $this->_model_relations = array( |
|
| 111 | + 'Registration' => new EE_Has_Many_Relation(), |
|
| 112 | + 'Payment' => new EE_Has_Many_Relation(), |
|
| 113 | + 'Status' => new EE_Belongs_To_Relation(), |
|
| 114 | + 'Line_Item' => new EE_Has_Many_Relation(false), |
|
| 115 | + //you can delete a transaction without needing to delete its line items |
|
| 116 | + 'Payment_Method' => new EE_Belongs_To_Relation(), |
|
| 117 | + 'Message' => new EE_Has_Many_Relation() |
|
| 118 | + ); |
|
| 119 | + $this->_model_chain_to_wp_user = 'Registration.Event'; |
|
| 120 | + parent::__construct($timezone); |
|
| 121 | + |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * txn_status_array |
|
| 127 | + * get list of transaction statuses |
|
| 128 | + * |
|
| 129 | + * @access public |
|
| 130 | + * @return array |
|
| 131 | + */ |
|
| 132 | + public static function txn_status_array() |
|
| 133 | + { |
|
| 134 | + return apply_filters( |
|
| 135 | + 'FHEE__EEM_Transaction__txn_status_array', |
|
| 136 | + array( |
|
| 137 | + EEM_Transaction::overpaid_status_code, |
|
| 138 | + EEM_Transaction::complete_status_code, |
|
| 139 | + EEM_Transaction::incomplete_status_code, |
|
| 140 | + EEM_Transaction::abandoned_status_code, |
|
| 141 | + EEM_Transaction::failed_status_code, |
|
| 142 | + ) |
|
| 143 | + ); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * get the revenue per day for the Transaction Admin page Reports Tab |
|
| 148 | + * |
|
| 149 | + * @access public |
|
| 150 | + * |
|
| 151 | + * @param string $period |
|
| 152 | + * |
|
| 153 | + * @return \stdClass[] |
|
| 154 | + */ |
|
| 155 | + public function get_revenue_per_day_report($period = '-1 month') |
|
| 156 | + { |
|
| 157 | + $sql_date = $this->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', strtotime($period)), |
|
| 158 | + 'Y-m-d H:i:s', 'UTC'); |
|
| 159 | + |
|
| 160 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp'); |
|
| 161 | + |
|
| 162 | + return $this->_get_all_wpdb_results( |
|
| 163 | + array( |
|
| 164 | + array( |
|
| 165 | + 'TXN_timestamp' => array('>=', $sql_date) |
|
| 166 | + ), |
|
| 167 | + 'group_by' => 'txnDate', |
|
| 168 | + 'order_by' => array('TXN_timestamp' => 'ASC') |
|
| 169 | + ), |
|
| 170 | + OBJECT, |
|
| 171 | + array( |
|
| 172 | + 'txnDate' => array('DATE(' . $query_interval . ')', '%s'), |
|
| 173 | + 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
|
| 174 | + ) |
|
| 175 | + ); |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + |
|
| 179 | + /** |
|
| 180 | + * get the revenue per event for the Transaction Admin page Reports Tab |
|
| 181 | + * |
|
| 182 | + * @access public |
|
| 183 | + * |
|
| 184 | + * @param string $period |
|
| 185 | + * |
|
| 186 | + * @throws \EE_Error |
|
| 187 | + * @return mixed |
|
| 188 | + */ |
|
| 189 | + public function get_revenue_per_event_report($period = '-1 month') |
|
| 190 | + { |
|
| 191 | + global $wpdb; |
|
| 192 | + $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
| 193 | + $registration_table = $wpdb->prefix . 'esp_registration'; |
|
| 194 | + $registration_payment_table = $wpdb->prefix . 'esp_registration_payment'; |
|
| 195 | + $event_table = $wpdb->posts; |
|
| 196 | + $payment_table = $wpdb->prefix . 'esp_payment'; |
|
| 197 | + $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
|
| 198 | + $approved_payment_status = EEM_Payment::status_id_approved; |
|
| 199 | + $extra_event_on_join = ''; |
|
| 200 | + //exclude events not authored by user if permissions in effect |
|
| 201 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
| 202 | + $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + return $wpdb->get_results( |
|
| 206 | + "SELECT |
|
| 207 | 207 | Transaction_Event.event_name AS event_name, |
| 208 | 208 | SUM(Transaction_Event.paid) AS revenue |
| 209 | 209 | FROM |
@@ -230,185 +230,185 @@ discard block |
||
| 230 | 230 | $extra_event_on_join |
| 231 | 231 | ) AS Transaction_Event |
| 232 | 232 | GROUP BY event_name", |
| 233 | - OBJECT |
|
| 234 | - ); |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * Gets the current transaction given the reg_url_link, or assumes the reg_url_link is in the |
|
| 240 | - * $_REQUEST global variable. Either way, tries to find the current transaction (through |
|
| 241 | - * the registration pointed to by reg_url_link), if not returns null |
|
| 242 | - * |
|
| 243 | - * @param string $reg_url_link |
|
| 244 | - * |
|
| 245 | - * @return EE_Transaction |
|
| 246 | - */ |
|
| 247 | - public function get_transaction_from_reg_url_link($reg_url_link = '') |
|
| 248 | - { |
|
| 249 | - return $this->get_one(array( |
|
| 250 | - array( |
|
| 251 | - 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', |
|
| 252 | - '') |
|
| 253 | - ) |
|
| 254 | - )); |
|
| 255 | - } |
|
| 256 | - |
|
| 257 | - |
|
| 258 | - /** |
|
| 259 | - * Updates the provided EE_Transaction with all the applicable payments |
|
| 260 | - * (or fetch the EE_Transaction from its ID) |
|
| 261 | - * |
|
| 262 | - * @deprecated |
|
| 263 | - * |
|
| 264 | - * @param EE_Transaction|int $transaction_obj_or_id |
|
| 265 | - * @param boolean $save_txn whether or not to save the transaction during this function call |
|
| 266 | - * |
|
| 267 | - * @return boolean |
|
| 268 | - * @throws \EE_Error |
|
| 269 | - */ |
|
| 270 | - public function update_based_on_payments($transaction_obj_or_id, $save_txn = true) |
|
| 271 | - { |
|
| 272 | - EE_Error::doing_it_wrong( |
|
| 273 | - __CLASS__ . '::' . __FUNCTION__, |
|
| 274 | - sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
| 275 | - 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
| 276 | - '4.6.0' |
|
| 277 | - ); |
|
| 278 | - /** @type EE_Transaction_Processor $transaction_processor */ |
|
| 279 | - $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 280 | - |
|
| 281 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
|
| 282 | - $this->ensure_is_obj($transaction_obj_or_id) |
|
| 283 | - ); |
|
| 284 | - } |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * Deletes "junk" transactions that were probably added by bots. There might be TONS |
|
| 288 | - * of these, so we are very careful to NOT select (which the models do even when deleting), |
|
| 289 | - * and so we only use wpdb directly and only do minimal joins. |
|
| 290 | - * Transactions are considered "junk" if they're failed for longer than a week. |
|
| 291 | - * Also, there is an extra check for payments related to the transaction, because if a transaction has a payment on |
|
| 292 | - * it, it's probably not junk (regardless of what status it has). |
|
| 293 | - * The downside to this approach is that is addons are listening for object deletions |
|
| 294 | - * on EEM_Base::delete() they won't be notified of this. However, there is an action that plugins can hook into |
|
| 295 | - * to catch these types of deletions. |
|
| 296 | - * |
|
| 297 | - * @global WPDB $wpdb |
|
| 298 | - * @return mixed |
|
| 299 | - */ |
|
| 300 | - public function delete_junk_transactions() |
|
| 301 | - { |
|
| 302 | - /** @type WPDB $wpdb */ |
|
| 303 | - global $wpdb; |
|
| 304 | - $deleted = false; |
|
| 305 | - $time_to_leave_alone = apply_filters( |
|
| 306 | - 'FHEE__EEM_Transaction__delete_junk_transactions__time_to_leave_alone' |
|
| 307 | - , WEEK_IN_SECONDS |
|
| 308 | - ); |
|
| 309 | - |
|
| 310 | - |
|
| 311 | - /** |
|
| 312 | - * This allows code to filter the query arguments used for retrieving the transaction IDs to delete. |
|
| 313 | - * Useful for plugins that want to exclude transactions matching certain query parameters. |
|
| 314 | - * The query parameters should be in the format accepted by the EEM_Base model queries. |
|
| 315 | - */ |
|
| 316 | - $ids_query = apply_filters( |
|
| 317 | - 'FHEE__EEM_Transaction__delete_junk_transactions__initial_query_args', |
|
| 318 | - array( |
|
| 319 | - 0 => array( |
|
| 320 | - 'STS_ID' => EEM_Transaction::failed_status_code, |
|
| 321 | - 'Payment.PAY_ID' => array( 'IS NULL' ), |
|
| 322 | - 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
| 323 | - ) |
|
| 324 | - ), |
|
| 325 | - $time_to_leave_alone |
|
| 326 | - ); |
|
| 327 | - |
|
| 328 | - |
|
| 329 | - /** |
|
| 330 | - * This filter is for when code needs to filter the list of transaction ids that represent transactions |
|
| 331 | - * about to be deleted based on some other criteria that isn't easily done via the query args filter. |
|
| 332 | - */ |
|
| 333 | - $txn_ids = apply_filters( |
|
| 334 | - 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
|
| 335 | - EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
| 336 | - $time_to_leave_alone |
|
| 337 | - ); |
|
| 338 | - //now that we have the ids to delete |
|
| 339 | - if (! empty($txn_ids) && is_array($txn_ids)) { |
|
| 340 | - // first, make sure these TXN's are removed the "ee_locked_transactions" array |
|
| 341 | - EEM_Transaction::unset_locked_transactions($txn_ids); |
|
| 342 | - // let's get deletin'... |
|
| 343 | - // Why no wpdb->prepare? Because the data is trusted. |
|
| 344 | - // We got the ids from the original query to get them FROM |
|
| 345 | - // the db (which is sanitized) so no need to prepare them again. |
|
| 346 | - $query = ' |
|
| 233 | + OBJECT |
|
| 234 | + ); |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * Gets the current transaction given the reg_url_link, or assumes the reg_url_link is in the |
|
| 240 | + * $_REQUEST global variable. Either way, tries to find the current transaction (through |
|
| 241 | + * the registration pointed to by reg_url_link), if not returns null |
|
| 242 | + * |
|
| 243 | + * @param string $reg_url_link |
|
| 244 | + * |
|
| 245 | + * @return EE_Transaction |
|
| 246 | + */ |
|
| 247 | + public function get_transaction_from_reg_url_link($reg_url_link = '') |
|
| 248 | + { |
|
| 249 | + return $this->get_one(array( |
|
| 250 | + array( |
|
| 251 | + 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', |
|
| 252 | + '') |
|
| 253 | + ) |
|
| 254 | + )); |
|
| 255 | + } |
|
| 256 | + |
|
| 257 | + |
|
| 258 | + /** |
|
| 259 | + * Updates the provided EE_Transaction with all the applicable payments |
|
| 260 | + * (or fetch the EE_Transaction from its ID) |
|
| 261 | + * |
|
| 262 | + * @deprecated |
|
| 263 | + * |
|
| 264 | + * @param EE_Transaction|int $transaction_obj_or_id |
|
| 265 | + * @param boolean $save_txn whether or not to save the transaction during this function call |
|
| 266 | + * |
|
| 267 | + * @return boolean |
|
| 268 | + * @throws \EE_Error |
|
| 269 | + */ |
|
| 270 | + public function update_based_on_payments($transaction_obj_or_id, $save_txn = true) |
|
| 271 | + { |
|
| 272 | + EE_Error::doing_it_wrong( |
|
| 273 | + __CLASS__ . '::' . __FUNCTION__, |
|
| 274 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
| 275 | + 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
| 276 | + '4.6.0' |
|
| 277 | + ); |
|
| 278 | + /** @type EE_Transaction_Processor $transaction_processor */ |
|
| 279 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 280 | + |
|
| 281 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
|
| 282 | + $this->ensure_is_obj($transaction_obj_or_id) |
|
| 283 | + ); |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * Deletes "junk" transactions that were probably added by bots. There might be TONS |
|
| 288 | + * of these, so we are very careful to NOT select (which the models do even when deleting), |
|
| 289 | + * and so we only use wpdb directly and only do minimal joins. |
|
| 290 | + * Transactions are considered "junk" if they're failed for longer than a week. |
|
| 291 | + * Also, there is an extra check for payments related to the transaction, because if a transaction has a payment on |
|
| 292 | + * it, it's probably not junk (regardless of what status it has). |
|
| 293 | + * The downside to this approach is that is addons are listening for object deletions |
|
| 294 | + * on EEM_Base::delete() they won't be notified of this. However, there is an action that plugins can hook into |
|
| 295 | + * to catch these types of deletions. |
|
| 296 | + * |
|
| 297 | + * @global WPDB $wpdb |
|
| 298 | + * @return mixed |
|
| 299 | + */ |
|
| 300 | + public function delete_junk_transactions() |
|
| 301 | + { |
|
| 302 | + /** @type WPDB $wpdb */ |
|
| 303 | + global $wpdb; |
|
| 304 | + $deleted = false; |
|
| 305 | + $time_to_leave_alone = apply_filters( |
|
| 306 | + 'FHEE__EEM_Transaction__delete_junk_transactions__time_to_leave_alone' |
|
| 307 | + , WEEK_IN_SECONDS |
|
| 308 | + ); |
|
| 309 | + |
|
| 310 | + |
|
| 311 | + /** |
|
| 312 | + * This allows code to filter the query arguments used for retrieving the transaction IDs to delete. |
|
| 313 | + * Useful for plugins that want to exclude transactions matching certain query parameters. |
|
| 314 | + * The query parameters should be in the format accepted by the EEM_Base model queries. |
|
| 315 | + */ |
|
| 316 | + $ids_query = apply_filters( |
|
| 317 | + 'FHEE__EEM_Transaction__delete_junk_transactions__initial_query_args', |
|
| 318 | + array( |
|
| 319 | + 0 => array( |
|
| 320 | + 'STS_ID' => EEM_Transaction::failed_status_code, |
|
| 321 | + 'Payment.PAY_ID' => array( 'IS NULL' ), |
|
| 322 | + 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
| 323 | + ) |
|
| 324 | + ), |
|
| 325 | + $time_to_leave_alone |
|
| 326 | + ); |
|
| 327 | + |
|
| 328 | + |
|
| 329 | + /** |
|
| 330 | + * This filter is for when code needs to filter the list of transaction ids that represent transactions |
|
| 331 | + * about to be deleted based on some other criteria that isn't easily done via the query args filter. |
|
| 332 | + */ |
|
| 333 | + $txn_ids = apply_filters( |
|
| 334 | + 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
|
| 335 | + EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
| 336 | + $time_to_leave_alone |
|
| 337 | + ); |
|
| 338 | + //now that we have the ids to delete |
|
| 339 | + if (! empty($txn_ids) && is_array($txn_ids)) { |
|
| 340 | + // first, make sure these TXN's are removed the "ee_locked_transactions" array |
|
| 341 | + EEM_Transaction::unset_locked_transactions($txn_ids); |
|
| 342 | + // let's get deletin'... |
|
| 343 | + // Why no wpdb->prepare? Because the data is trusted. |
|
| 344 | + // We got the ids from the original query to get them FROM |
|
| 345 | + // the db (which is sanitized) so no need to prepare them again. |
|
| 346 | + $query = ' |
|
| 347 | 347 | DELETE |
| 348 | 348 | FROM ' . $this->table() . ' |
| 349 | 349 | WHERE |
| 350 | 350 | TXN_ID IN ( ' . implode(",", $txn_ids) . ')'; |
| 351 | - $deleted = $wpdb->query($query); |
|
| 352 | - } |
|
| 353 | - if ($deleted) { |
|
| 354 | - /** |
|
| 355 | - * Allows code to do something after the transactions have been deleted. |
|
| 356 | - */ |
|
| 357 | - do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - return $deleted; |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - |
|
| 364 | - /** |
|
| 365 | - * @param array $transaction_IDs |
|
| 366 | - * |
|
| 367 | - * @return bool |
|
| 368 | - */ |
|
| 369 | - public static function unset_locked_transactions(array $transaction_IDs) |
|
| 370 | - { |
|
| 371 | - $locked_transactions = get_option('ee_locked_transactions', array()); |
|
| 372 | - $update = false; |
|
| 373 | - foreach ($transaction_IDs as $TXN_ID) { |
|
| 374 | - if (isset($locked_transactions[$TXN_ID])) { |
|
| 375 | - unset($locked_transactions[$TXN_ID]); |
|
| 376 | - $update = true; |
|
| 377 | - } |
|
| 378 | - } |
|
| 379 | - if ($update) { |
|
| 380 | - update_option('ee_locked_transactions', $locked_transactions); |
|
| 381 | - } |
|
| 382 | - |
|
| 383 | - return $update; |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - |
|
| 387 | - |
|
| 388 | - /** |
|
| 389 | - * returns an array of EE_Transaction objects whose timestamp is less than |
|
| 390 | - * the current time minus the session lifespan, which defaults to 60 minutes |
|
| 391 | - * |
|
| 392 | - * @return EE_Base_Class[]|EE_Transaction[] |
|
| 393 | - * @throws \EE_Error |
|
| 394 | - */ |
|
| 395 | - public function get_transactions_in_progress() |
|
| 396 | - { |
|
| 397 | - return $this->get_all( |
|
| 398 | - array( |
|
| 399 | - array( |
|
| 400 | - 'TXN_timestamp' => array( |
|
| 401 | - '>', |
|
| 402 | - time() - EE_Registry::instance()->SSN->lifespan() |
|
| 403 | - ), |
|
| 404 | - 'STS_ID' => array( |
|
| 405 | - '!=', |
|
| 406 | - EEM_Transaction::complete_status_code |
|
| 407 | - ), |
|
| 408 | - ) |
|
| 409 | - ) |
|
| 410 | - ); |
|
| 411 | - } |
|
| 351 | + $deleted = $wpdb->query($query); |
|
| 352 | + } |
|
| 353 | + if ($deleted) { |
|
| 354 | + /** |
|
| 355 | + * Allows code to do something after the transactions have been deleted. |
|
| 356 | + */ |
|
| 357 | + do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + return $deleted; |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + |
|
| 364 | + /** |
|
| 365 | + * @param array $transaction_IDs |
|
| 366 | + * |
|
| 367 | + * @return bool |
|
| 368 | + */ |
|
| 369 | + public static function unset_locked_transactions(array $transaction_IDs) |
|
| 370 | + { |
|
| 371 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
| 372 | + $update = false; |
|
| 373 | + foreach ($transaction_IDs as $TXN_ID) { |
|
| 374 | + if (isset($locked_transactions[$TXN_ID])) { |
|
| 375 | + unset($locked_transactions[$TXN_ID]); |
|
| 376 | + $update = true; |
|
| 377 | + } |
|
| 378 | + } |
|
| 379 | + if ($update) { |
|
| 380 | + update_option('ee_locked_transactions', $locked_transactions); |
|
| 381 | + } |
|
| 382 | + |
|
| 383 | + return $update; |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + |
|
| 387 | + |
|
| 388 | + /** |
|
| 389 | + * returns an array of EE_Transaction objects whose timestamp is less than |
|
| 390 | + * the current time minus the session lifespan, which defaults to 60 minutes |
|
| 391 | + * |
|
| 392 | + * @return EE_Base_Class[]|EE_Transaction[] |
|
| 393 | + * @throws \EE_Error |
|
| 394 | + */ |
|
| 395 | + public function get_transactions_in_progress() |
|
| 396 | + { |
|
| 397 | + return $this->get_all( |
|
| 398 | + array( |
|
| 399 | + array( |
|
| 400 | + 'TXN_timestamp' => array( |
|
| 401 | + '>', |
|
| 402 | + time() - EE_Registry::instance()->SSN->lifespan() |
|
| 403 | + ), |
|
| 404 | + 'STS_ID' => array( |
|
| 405 | + '!=', |
|
| 406 | + EEM_Transaction::complete_status_code |
|
| 407 | + ), |
|
| 408 | + ) |
|
| 409 | + ) |
|
| 410 | + ); |
|
| 411 | + } |
|
| 412 | 412 | |
| 413 | 413 | |
| 414 | 414 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | 5 | } |
| 6 | -require_once(EE_MODELS . 'EEM_Base.model.php'); |
|
| 6 | +require_once(EE_MODELS.'EEM_Base.model.php'); |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | __('Registration Steps', 'event_espresso'), false, array()), |
| 108 | 108 | ) |
| 109 | 109 | ); |
| 110 | - $this->_model_relations = array( |
|
| 110 | + $this->_model_relations = array( |
|
| 111 | 111 | 'Registration' => new EE_Has_Many_Relation(), |
| 112 | 112 | 'Payment' => new EE_Has_Many_Relation(), |
| 113 | 113 | 'Status' => new EE_Belongs_To_Relation(), |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | ), |
| 170 | 170 | OBJECT, |
| 171 | 171 | array( |
| 172 | - 'txnDate' => array('DATE(' . $query_interval . ')', '%s'), |
|
| 172 | + 'txnDate' => array('DATE('.$query_interval.')', '%s'), |
|
| 173 | 173 | 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
| 174 | 174 | ) |
| 175 | 175 | ); |
@@ -189,17 +189,17 @@ discard block |
||
| 189 | 189 | public function get_revenue_per_event_report($period = '-1 month') |
| 190 | 190 | { |
| 191 | 191 | global $wpdb; |
| 192 | - $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
| 193 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
| 194 | - $registration_payment_table = $wpdb->prefix . 'esp_registration_payment'; |
|
| 192 | + $transaction_table = $wpdb->prefix.'esp_transaction'; |
|
| 193 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
| 194 | + $registration_payment_table = $wpdb->prefix.'esp_registration_payment'; |
|
| 195 | 195 | $event_table = $wpdb->posts; |
| 196 | - $payment_table = $wpdb->prefix . 'esp_payment'; |
|
| 196 | + $payment_table = $wpdb->prefix.'esp_payment'; |
|
| 197 | 197 | $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
| 198 | 198 | $approved_payment_status = EEM_Payment::status_id_approved; |
| 199 | 199 | $extra_event_on_join = ''; |
| 200 | 200 | //exclude events not authored by user if permissions in effect |
| 201 | 201 | if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
| 202 | - $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
| 202 | + $extra_event_on_join = ' AND Event.post_author = '.get_current_user_id(); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | return $wpdb->get_results( |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | public function update_based_on_payments($transaction_obj_or_id, $save_txn = true) |
| 271 | 271 | { |
| 272 | 272 | EE_Error::doing_it_wrong( |
| 273 | - __CLASS__ . '::' . __FUNCTION__, |
|
| 273 | + __CLASS__.'::'.__FUNCTION__, |
|
| 274 | 274 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
| 275 | 275 | 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
| 276 | 276 | '4.6.0' |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | array( |
| 319 | 319 | 0 => array( |
| 320 | 320 | 'STS_ID' => EEM_Transaction::failed_status_code, |
| 321 | - 'Payment.PAY_ID' => array( 'IS NULL' ), |
|
| 321 | + 'Payment.PAY_ID' => array('IS NULL'), |
|
| 322 | 322 | 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
| 323 | 323 | ) |
| 324 | 324 | ), |
@@ -336,18 +336,18 @@ discard block |
||
| 336 | 336 | $time_to_leave_alone |
| 337 | 337 | ); |
| 338 | 338 | //now that we have the ids to delete |
| 339 | - if (! empty($txn_ids) && is_array($txn_ids)) { |
|
| 339 | + if ( ! empty($txn_ids) && is_array($txn_ids)) { |
|
| 340 | 340 | // first, make sure these TXN's are removed the "ee_locked_transactions" array |
| 341 | 341 | EEM_Transaction::unset_locked_transactions($txn_ids); |
| 342 | 342 | // let's get deletin'... |
| 343 | 343 | // Why no wpdb->prepare? Because the data is trusted. |
| 344 | 344 | // We got the ids from the original query to get them FROM |
| 345 | 345 | // the db (which is sanitized) so no need to prepare them again. |
| 346 | - $query = ' |
|
| 346 | + $query = ' |
|
| 347 | 347 | DELETE |
| 348 | - FROM ' . $this->table() . ' |
|
| 348 | + FROM ' . $this->table().' |
|
| 349 | 349 | WHERE |
| 350 | - TXN_ID IN ( ' . implode(",", $txn_ids) . ')'; |
|
| 350 | + TXN_ID IN ( ' . implode(",", $txn_ids).')'; |
|
| 351 | 351 | $deleted = $wpdb->query($query); |
| 352 | 352 | } |
| 353 | 353 | if ($deleted) { |
@@ -125,14 +125,14 @@ |
||
| 125 | 125 | public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){ |
| 126 | 126 | $field_name = NULL; |
| 127 | 127 | $value = NULL; |
| 128 | - //backward compat: we still want to find the question's ID |
|
| 129 | - if( is_numeric( $question_system_id ) ) { |
|
| 130 | - //find this question's QST_system value |
|
| 131 | - $question_id = $question_system_id; |
|
| 132 | - $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
| 133 | - } else { |
|
| 134 | - $question_id = (int) EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ); |
|
| 135 | - } |
|
| 128 | + //backward compat: we still want to find the question's ID |
|
| 129 | + if( is_numeric( $question_system_id ) ) { |
|
| 130 | + //find this question's QST_system value |
|
| 131 | + $question_id = $question_system_id; |
|
| 132 | + $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
| 133 | + } else { |
|
| 134 | + $question_id = (int) EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ); |
|
| 135 | + } |
|
| 136 | 136 | //only bother checking if the registration has an attendee |
| 137 | 137 | if( $registration->attendee() instanceof EE_Attendee ) { |
| 138 | 138 | $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id ); |
@@ -51,18 +51,18 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * constructor |
| 53 | 53 | */ |
| 54 | - protected function __construct( $timezone = NULL ){ |
|
| 55 | - $this->singular_item = __('Answer','event_espresso'); |
|
| 56 | - $this->plural_item = __('Answers','event_espresso'); |
|
| 54 | + protected function __construct($timezone = NULL) { |
|
| 55 | + $this->singular_item = __('Answer', 'event_espresso'); |
|
| 56 | + $this->plural_item = __('Answers', 'event_espresso'); |
|
| 57 | 57 | $this->_tables = array( |
| 58 | 58 | 'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID') |
| 59 | 59 | ); |
| 60 | 60 | $this->_fields = array( |
| 61 | 61 | 'Answer'=>array( |
| 62 | - 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')), |
|
| 63 | - 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'), |
|
| 64 | - 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'), |
|
| 65 | - 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value','event_espresso'), false, '') |
|
| 62 | + 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')), |
|
| 63 | + 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'), |
|
| 64 | + 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), |
|
| 65 | + 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '') |
|
| 66 | 66 | )); |
| 67 | 67 | $this->_model_relations = array( |
| 68 | 68 | 'Registration'=>new EE_Belongs_To_Relation(), |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | ); |
| 71 | 71 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
| 72 | 72 | $this->_caps_slug = 'registrations'; |
| 73 | - parent::__construct( $timezone ); |
|
| 73 | + parent::__construct($timezone); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -83,19 +83,19 @@ discard block |
||
| 83 | 83 | * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value' |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | - public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){ |
|
| 87 | - $value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer ); |
|
| 88 | - if ( $value === NULL ){ |
|
| 89 | - $answer_obj = $this->get_registration_question_answer_object( $registration, $question_id); |
|
| 90 | - if( $answer_obj instanceof EE_Answer ){ |
|
| 91 | - if($pretty_answer){ |
|
| 86 | + public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) { |
|
| 87 | + $value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer); |
|
| 88 | + if ($value === NULL) { |
|
| 89 | + $answer_obj = $this->get_registration_question_answer_object($registration, $question_id); |
|
| 90 | + if ($answer_obj instanceof EE_Answer) { |
|
| 91 | + if ($pretty_answer) { |
|
| 92 | 92 | $value = $answer_obj->pretty_value(); |
| 93 | - }else{ |
|
| 93 | + } else { |
|
| 94 | 94 | $value = $answer_obj->value(); |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | - return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id ); |
|
| 98 | + return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | * @param int $question_id |
| 107 | 107 | * @return EE_Answer |
| 108 | 108 | */ |
| 109 | - public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){ |
|
| 110 | - $answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() ))); |
|
| 111 | - return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id ); |
|
| 109 | + public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) { |
|
| 110 | + $answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID()))); |
|
| 111 | + return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
@@ -122,39 +122,39 @@ discard block |
||
| 122 | 122 | * @return string|null (if the registration has no attendee, or the question_system_id is not a QST_ID or QST_system for |
| 123 | 123 | * a question corresponding to an attendee field, returns null) |
| 124 | 124 | */ |
| 125 | - public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){ |
|
| 125 | + public function get_attendee_property_answer_value(EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE) { |
|
| 126 | 126 | $field_name = NULL; |
| 127 | 127 | $value = NULL; |
| 128 | 128 | //backward compat: we still want to find the question's ID |
| 129 | - if( is_numeric( $question_system_id ) ) { |
|
| 129 | + if (is_numeric($question_system_id)) { |
|
| 130 | 130 | //find this question's QST_system value |
| 131 | 131 | $question_id = $question_system_id; |
| 132 | - $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
| 132 | + $question_system_id = EEM_Question::instance()->get_var(array(array('QST_ID' => $question_system_id)), 'QST_system'); |
|
| 133 | 133 | } else { |
| 134 | - $question_id = (int) EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ); |
|
| 134 | + $question_id = (int) EEM_Question::instance()->get_var(array(array('QST_system' => $question_system_id)), 'QST_ID'); |
|
| 135 | 135 | } |
| 136 | 136 | //only bother checking if the registration has an attendee |
| 137 | - if( $registration->attendee() instanceof EE_Attendee ) { |
|
| 138 | - $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id ); |
|
| 139 | - if( $field_name ) { |
|
| 140 | - if( $pretty_answer ) { |
|
| 141 | - if( $field_name === 'STA_ID' ) { |
|
| 137 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
| 138 | + $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question($question_system_id); |
|
| 139 | + if ($field_name) { |
|
| 140 | + if ($pretty_answer) { |
|
| 141 | + if ($field_name === 'STA_ID') { |
|
| 142 | 142 | $state = $registration->attendee()->state_obj(); |
| 143 | - $value = $state instanceof EE_State ? $state->name() : sprintf( __('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID() ); |
|
| 144 | - } else if($field_name === 'CNT_ISO') { |
|
| 143 | + $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID()); |
|
| 144 | + } else if ($field_name === 'CNT_ISO') { |
|
| 145 | 145 | $country = $registration->attendee()->country_obj(); |
| 146 | - $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID()); |
|
| 146 | + $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID()); |
|
| 147 | 147 | } else { |
| 148 | - $value = $registration->attendee()->get_pretty( $field_name ); |
|
| 148 | + $value = $registration->attendee()->get_pretty($field_name); |
|
| 149 | 149 | } |
| 150 | 150 | //if field name is blank, leave the value as null too |
| 151 | - }else{ |
|
| 152 | - $value = $registration->attendee()->get( $field_name ); |
|
| 151 | + } else { |
|
| 152 | + $value = $registration->attendee()->get($field_name); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | //if no field was found, leave value blank |
| 156 | 156 | } |
| 157 | - return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id ); |
|
| 157 | + return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | public function previous(); |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * Returns the index of a given object, or false if not found |
|
| 117 | - * |
|
| 118 | - * @see http://stackoverflow.com/a/8736013 |
|
| 119 | - * @param $object |
|
| 120 | - * @return boolean|int|string |
|
| 121 | - */ |
|
| 116 | + * Returns the index of a given object, or false if not found |
|
| 117 | + * |
|
| 118 | + * @see http://stackoverflow.com/a/8736013 |
|
| 119 | + * @param $object |
|
| 120 | + * @return boolean|int|string |
|
| 121 | + */ |
|
| 122 | 122 | public function indexOf( $object ); |
| 123 | 123 | |
| 124 | 124 | |
@@ -160,17 +160,17 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | |
| 162 | 162 | |
| 163 | - /** |
|
| 164 | - * detaches ALL objects from the Collection |
|
| 165 | - */ |
|
| 166 | - public function detachAll(); |
|
| 163 | + /** |
|
| 164 | + * detaches ALL objects from the Collection |
|
| 165 | + */ |
|
| 166 | + public function detachAll(); |
|
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | |
| 170 | - /** |
|
| 171 | - * unsets and detaches ALL objects from the Collection |
|
| 172 | - */ |
|
| 173 | - public function trashAndDetachAll(); |
|
| 170 | + /** |
|
| 171 | + * unsets and detaches ALL objects from the Collection |
|
| 172 | + */ |
|
| 173 | + public function trashAndDetachAll(); |
|
| 174 | 174 | |
| 175 | 175 | } |
| 176 | 176 | // End of file CollectionInterface.php |
@@ -83,7 +83,6 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * setIdentifier |
| 86 | - |
|
| 87 | 86 | * Sets the data associated with an object in the Collection |
| 88 | 87 | * if no $identifier is supplied, then the spl_object_hash() is used |
| 89 | 88 | * |
@@ -352,34 +351,34 @@ discard block |
||
| 352 | 351 | |
| 353 | 352 | |
| 354 | 353 | |
| 355 | - /** |
|
| 356 | - * detaches ALL objects from the Collection |
|
| 357 | - */ |
|
| 358 | - public function detachAll() |
|
| 359 | - { |
|
| 360 | - $this->rewind(); |
|
| 361 | - while ($this->valid()) { |
|
| 362 | - $object = $this->current(); |
|
| 363 | - $this->next(); |
|
| 364 | - $this->detach($object); |
|
| 365 | - } |
|
| 366 | - } |
|
| 367 | - |
|
| 368 | - |
|
| 369 | - |
|
| 370 | - /** |
|
| 371 | - * unsets and detaches ALL objects from the Collection |
|
| 372 | - */ |
|
| 373 | - public function trashAndDetachAll() |
|
| 374 | - { |
|
| 375 | - $this->rewind(); |
|
| 376 | - while ($this->valid()) { |
|
| 377 | - $object = $this->current(); |
|
| 378 | - $this->next(); |
|
| 379 | - $this->detach($object); |
|
| 380 | - unset($object); |
|
| 381 | - } |
|
| 382 | - } |
|
| 354 | + /** |
|
| 355 | + * detaches ALL objects from the Collection |
|
| 356 | + */ |
|
| 357 | + public function detachAll() |
|
| 358 | + { |
|
| 359 | + $this->rewind(); |
|
| 360 | + while ($this->valid()) { |
|
| 361 | + $object = $this->current(); |
|
| 362 | + $this->next(); |
|
| 363 | + $this->detach($object); |
|
| 364 | + } |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + |
|
| 368 | + |
|
| 369 | + /** |
|
| 370 | + * unsets and detaches ALL objects from the Collection |
|
| 371 | + */ |
|
| 372 | + public function trashAndDetachAll() |
|
| 373 | + { |
|
| 374 | + $this->rewind(); |
|
| 375 | + while ($this->valid()) { |
|
| 376 | + $object = $this->current(); |
|
| 377 | + $this->next(); |
|
| 378 | + $this->detach($object); |
|
| 379 | + unset($object); |
|
| 380 | + } |
|
| 381 | + } |
|
| 383 | 382 | |
| 384 | 383 | |
| 385 | 384 | |
@@ -79,37 +79,37 @@ |
||
| 79 | 79 | class LoaderFactory |
| 80 | 80 | { |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * @var LoaderInterface $loader ; |
|
| 84 | - */ |
|
| 85 | - private static $loader; |
|
| 82 | + /** |
|
| 83 | + * @var LoaderInterface $loader ; |
|
| 84 | + */ |
|
| 85 | + private static $loader; |
|
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @param mixed $generator provided during very first instantiation in |
|
| 91 | - * EE_Load_Espresso_Core::handle_request() |
|
| 92 | - * otherwise can be left null |
|
| 93 | - * @return LoaderInterface |
|
| 94 | - * @throws InvalidArgumentException |
|
| 95 | - * @throws InvalidInterfaceException |
|
| 96 | - * @throws InvalidDataTypeException |
|
| 97 | - */ |
|
| 98 | - public static function getLoader($generator = null) |
|
| 99 | - { |
|
| 100 | - if (! LoaderFactory::$loader instanceof LoaderInterface) { |
|
| 101 | - $generator = $generator !== null ? $generator : EE_Registry::instance(); |
|
| 102 | - $core_loader = new CoreLoader($generator); |
|
| 103 | - LoaderFactory::$loader = new Loader( |
|
| 104 | - $core_loader, |
|
| 105 | - new CachingLoader( |
|
| 106 | - $core_loader, |
|
| 107 | - new LooseCollection('') |
|
| 108 | - ) |
|
| 109 | - ); |
|
| 110 | - } |
|
| 111 | - return LoaderFactory::$loader; |
|
| 112 | - } |
|
| 89 | + /** |
|
| 90 | + * @param mixed $generator provided during very first instantiation in |
|
| 91 | + * EE_Load_Espresso_Core::handle_request() |
|
| 92 | + * otherwise can be left null |
|
| 93 | + * @return LoaderInterface |
|
| 94 | + * @throws InvalidArgumentException |
|
| 95 | + * @throws InvalidInterfaceException |
|
| 96 | + * @throws InvalidDataTypeException |
|
| 97 | + */ |
|
| 98 | + public static function getLoader($generator = null) |
|
| 99 | + { |
|
| 100 | + if (! LoaderFactory::$loader instanceof LoaderInterface) { |
|
| 101 | + $generator = $generator !== null ? $generator : EE_Registry::instance(); |
|
| 102 | + $core_loader = new CoreLoader($generator); |
|
| 103 | + LoaderFactory::$loader = new Loader( |
|
| 104 | + $core_loader, |
|
| 105 | + new CachingLoader( |
|
| 106 | + $core_loader, |
|
| 107 | + new LooseCollection('') |
|
| 108 | + ) |
|
| 109 | + ); |
|
| 110 | + } |
|
| 111 | + return LoaderFactory::$loader; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | } |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | */ |
| 98 | 98 | public static function getLoader($generator = null) |
| 99 | 99 | { |
| 100 | - if (! LoaderFactory::$loader instanceof LoaderInterface) { |
|
| 100 | + if ( ! LoaderFactory::$loader instanceof LoaderInterface) { |
|
| 101 | 101 | $generator = $generator !== null ? $generator : EE_Registry::instance(); |
| 102 | 102 | $core_loader = new CoreLoader($generator); |
| 103 | 103 | LoaderFactory::$loader = new Loader( |
@@ -32,51 +32,51 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * get_event |
|
| 37 | - * attempts to retrieve an EE_Event object any way it can |
|
| 38 | - * |
|
| 39 | - * @param int|WP_Post $EVT_ID |
|
| 40 | - * @return EE_Event|null |
|
| 41 | - * @throws \EE_Error |
|
| 42 | - */ |
|
| 43 | - public static function get_event($EVT_ID = 0) |
|
| 44 | - { |
|
| 45 | - // international newspaper? |
|
| 46 | - global $post; |
|
| 47 | - $EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events' |
|
| 48 | - ? $EVT_ID->ID |
|
| 49 | - : absint($EVT_ID); |
|
| 50 | - // do we already have the Event you are looking for? |
|
| 51 | - if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) { |
|
| 52 | - return EEH_Event_View::$_event; |
|
| 53 | - } |
|
| 54 | - //reset property so that the new event is cached. |
|
| 55 | - EEH_Event_View::$_event = null; |
|
| 56 | - if (! $EVT_ID && $post instanceof EE_Event) { |
|
| 57 | - EEH_Event_View::$_event = $post; |
|
| 58 | - return EEH_Event_View::$_event; |
|
| 59 | - } |
|
| 60 | - //if the post type is for an event and it has a cached event and we don't have a different incoming $EVT_ID |
|
| 61 | - //then let's just use that cached event on the $post object. |
|
| 62 | - if ( |
|
| 63 | - $post instanceof WP_Post |
|
| 64 | - && $post->post_type === 'espresso_events' |
|
| 65 | - && isset($post->EE_Event) |
|
| 66 | - && ( |
|
| 67 | - $EVT_ID === 0 |
|
| 68 | - || $EVT_ID === $post->ID |
|
| 69 | - ) |
|
| 70 | - ) { |
|
| 71 | - EEH_Event_View::$_event = $post->EE_Event; |
|
| 72 | - return EEH_Event_View::$_event; |
|
| 73 | - } |
|
| 74 | - //If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID. |
|
| 75 | - if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
| 76 | - EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
| 77 | - } |
|
| 78 | - return EEH_Event_View::$_event; |
|
| 79 | - } |
|
| 35 | + /** |
|
| 36 | + * get_event |
|
| 37 | + * attempts to retrieve an EE_Event object any way it can |
|
| 38 | + * |
|
| 39 | + * @param int|WP_Post $EVT_ID |
|
| 40 | + * @return EE_Event|null |
|
| 41 | + * @throws \EE_Error |
|
| 42 | + */ |
|
| 43 | + public static function get_event($EVT_ID = 0) |
|
| 44 | + { |
|
| 45 | + // international newspaper? |
|
| 46 | + global $post; |
|
| 47 | + $EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events' |
|
| 48 | + ? $EVT_ID->ID |
|
| 49 | + : absint($EVT_ID); |
|
| 50 | + // do we already have the Event you are looking for? |
|
| 51 | + if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) { |
|
| 52 | + return EEH_Event_View::$_event; |
|
| 53 | + } |
|
| 54 | + //reset property so that the new event is cached. |
|
| 55 | + EEH_Event_View::$_event = null; |
|
| 56 | + if (! $EVT_ID && $post instanceof EE_Event) { |
|
| 57 | + EEH_Event_View::$_event = $post; |
|
| 58 | + return EEH_Event_View::$_event; |
|
| 59 | + } |
|
| 60 | + //if the post type is for an event and it has a cached event and we don't have a different incoming $EVT_ID |
|
| 61 | + //then let's just use that cached event on the $post object. |
|
| 62 | + if ( |
|
| 63 | + $post instanceof WP_Post |
|
| 64 | + && $post->post_type === 'espresso_events' |
|
| 65 | + && isset($post->EE_Event) |
|
| 66 | + && ( |
|
| 67 | + $EVT_ID === 0 |
|
| 68 | + || $EVT_ID === $post->ID |
|
| 69 | + ) |
|
| 70 | + ) { |
|
| 71 | + EEH_Event_View::$_event = $post->EE_Event; |
|
| 72 | + return EEH_Event_View::$_event; |
|
| 73 | + } |
|
| 74 | + //If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID. |
|
| 75 | + if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
| 76 | + EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
| 77 | + } |
|
| 78 | + return EEH_Event_View::$_event; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | |
@@ -152,58 +152,58 @@ discard block |
||
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | 154 | public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
| 155 | - global $post; |
|
| 155 | + global $post; |
|
| 156 | 156 | ob_start(); |
| 157 | 157 | if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
| 158 | 158 | // admin has chosen "full description" |
| 159 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
| 159 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
| 160 | 160 | the_content(); |
| 161 | 161 | } else if (( is_archive() && espresso_display_excerpt_in_event_list() ) ) { |
| 162 | - if ( has_excerpt( $post->ID )) { |
|
| 163 | - // admin has chosen "excerpt (short desc)" |
|
| 164 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
| 165 | - // AND an excerpt actually exists |
|
| 166 | - the_excerpt(); |
|
| 167 | - } else { |
|
| 168 | - // admin has chosen "excerpt (short desc)" |
|
| 169 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
| 170 | - // but NO excerpt actually exists, so we need to create one |
|
| 171 | - if ( ! empty( $num_words )) { |
|
| 172 | - if ( empty( $more )) { |
|
| 173 | - $more_link_text = __( '(more…)' ); |
|
| 174 | - $more = ' <a href="' . get_permalink() . '"'; |
|
| 175 | - $more .= ' class="more-link"'; |
|
| 176 | - $more .= \EED_Events_Archive::link_target(); |
|
| 177 | - $more .= '>' . $more_link_text . '</a>'; |
|
| 178 | - $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
| 179 | - } |
|
| 180 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
| 181 | - |
|
| 182 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
| 183 | - } else { |
|
| 184 | - $content = get_the_content(); |
|
| 185 | - } |
|
| 186 | - global $allowedtags; |
|
| 187 | - // make sure links are allowed |
|
| 188 | - $allowedtags['a'] = isset($allowedtags['a']) |
|
| 189 | - ? $allowedtags['a'] |
|
| 190 | - : array(); |
|
| 191 | - // as well as target attribute |
|
| 192 | - $allowedtags['a']['target'] = isset($allowedtags['a']['target']) |
|
| 193 | - ? $allowedtags['a']['target'] |
|
| 194 | - : false; |
|
| 195 | - // but get previous value so we can reset it |
|
| 196 | - $prev_value = $allowedtags['a']['target']; |
|
| 197 | - $allowedtags['a']['target'] = true; |
|
| 198 | - $content = wp_kses( $content, $allowedtags ); |
|
| 199 | - $content = strip_shortcodes( $content ); |
|
| 200 | - echo apply_filters( 'the_content', $content ); |
|
| 201 | - $allowedtags['a']['target'] = $prev_value; |
|
| 202 | - } |
|
| 203 | - } else { |
|
| 204 | - // admin has chosen "none" |
|
| 205 | - // for the "Event Espresso - Events > Templates > Display Description" option |
|
| 206 | - echo apply_filters( 'the_content', '' ); |
|
| 162 | + if ( has_excerpt( $post->ID )) { |
|
| 163 | + // admin has chosen "excerpt (short desc)" |
|
| 164 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
| 165 | + // AND an excerpt actually exists |
|
| 166 | + the_excerpt(); |
|
| 167 | + } else { |
|
| 168 | + // admin has chosen "excerpt (short desc)" |
|
| 169 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
| 170 | + // but NO excerpt actually exists, so we need to create one |
|
| 171 | + if ( ! empty( $num_words )) { |
|
| 172 | + if ( empty( $more )) { |
|
| 173 | + $more_link_text = __( '(more…)' ); |
|
| 174 | + $more = ' <a href="' . get_permalink() . '"'; |
|
| 175 | + $more .= ' class="more-link"'; |
|
| 176 | + $more .= \EED_Events_Archive::link_target(); |
|
| 177 | + $more .= '>' . $more_link_text . '</a>'; |
|
| 178 | + $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
| 179 | + } |
|
| 180 | + $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
| 181 | + |
|
| 182 | + $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
| 183 | + } else { |
|
| 184 | + $content = get_the_content(); |
|
| 185 | + } |
|
| 186 | + global $allowedtags; |
|
| 187 | + // make sure links are allowed |
|
| 188 | + $allowedtags['a'] = isset($allowedtags['a']) |
|
| 189 | + ? $allowedtags['a'] |
|
| 190 | + : array(); |
|
| 191 | + // as well as target attribute |
|
| 192 | + $allowedtags['a']['target'] = isset($allowedtags['a']['target']) |
|
| 193 | + ? $allowedtags['a']['target'] |
|
| 194 | + : false; |
|
| 195 | + // but get previous value so we can reset it |
|
| 196 | + $prev_value = $allowedtags['a']['target']; |
|
| 197 | + $allowedtags['a']['target'] = true; |
|
| 198 | + $content = wp_kses( $content, $allowedtags ); |
|
| 199 | + $content = strip_shortcodes( $content ); |
|
| 200 | + echo apply_filters( 'the_content', $content ); |
|
| 201 | + $allowedtags['a']['target'] = $prev_value; |
|
| 202 | + } |
|
| 203 | + } else { |
|
| 204 | + // admin has chosen "none" |
|
| 205 | + // for the "Event Espresso - Events > Templates > Display Description" option |
|
| 206 | + echo apply_filters( 'the_content', '' ); |
|
| 207 | 207 | } |
| 208 | 208 | return ob_get_clean(); |
| 209 | 209 | } |
@@ -250,11 +250,11 @@ discard block |
||
| 250 | 250 | $url = get_term_link( $term, 'espresso_venue_categories' ); |
| 251 | 251 | if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
| 252 | 252 | $category_links[] = '<a href="' . esc_url( $url ) |
| 253 | - . '" rel="tag"' |
|
| 254 | - . \EED_Events_Archive::link_target() |
|
| 255 | - .'>' |
|
| 256 | - . $term->name |
|
| 257 | - . '</a>'; |
|
| 253 | + . '" rel="tag"' |
|
| 254 | + . \EED_Events_Archive::link_target() |
|
| 255 | + .'>' |
|
| 256 | + . $term->name |
|
| 257 | + . '</a>'; |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | //reset property so that the new event is cached. |
| 55 | 55 | EEH_Event_View::$_event = null; |
| 56 | - if (! $EVT_ID && $post instanceof EE_Event) { |
|
| 56 | + if ( ! $EVT_ID && $post instanceof EE_Event) { |
|
| 57 | 57 | EEH_Event_View::$_event = $post; |
| 58 | 58 | return EEH_Event_View::$_event; |
| 59 | 59 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | return EEH_Event_View::$_event; |
| 73 | 73 | } |
| 74 | 74 | //If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID. |
| 75 | - if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
| 75 | + if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
| 76 | 76 | EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
| 77 | 77 | } |
| 78 | 78 | return EEH_Event_View::$_event; |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | * @param int $EVT_ID |
| 88 | 88 | * @return boolean |
| 89 | 89 | */ |
| 90 | - public static function display_ticket_selector( $EVT_ID = 0 ) { |
|
| 91 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 90 | + public static function display_ticket_selector($EVT_ID = 0) { |
|
| 91 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 92 | 92 | return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | * @param int $EVT_ID |
| 102 | 102 | * @return string |
| 103 | 103 | */ |
| 104 | - public static function event_status( $EVT_ID = 0 ) { |
|
| 105 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 106 | - return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : ''; |
|
| 104 | + public static function event_status($EVT_ID = 0) { |
|
| 105 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 106 | + return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : ''; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | * @param int $EVT_ID |
| 116 | 116 | * @return string |
| 117 | 117 | */ |
| 118 | - public static function event_active_status( $EVT_ID = 0 ) { |
|
| 119 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 118 | + public static function event_active_status($EVT_ID = 0) { |
|
| 119 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 120 | 120 | return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive'; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | * @param int $EVT_ID |
| 130 | 130 | * @return string |
| 131 | 131 | */ |
| 132 | - public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
|
| 133 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 132 | + public static function event_has_content_or_excerpt($EVT_ID = 0) { |
|
| 133 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 134 | 134 | $has_content_or_excerpt = FALSE; |
| 135 | - if ( $event instanceof EE_Event ) { |
|
| 136 | - $has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE; |
|
| 135 | + if ($event instanceof EE_Event) { |
|
| 136 | + $has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE; |
|
| 137 | 137 | } |
| 138 | - if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) { |
|
| 138 | + if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) { |
|
| 139 | 139 | $has_content_or_excerpt = FALSE; |
| 140 | 140 | } |
| 141 | 141 | return $has_content_or_excerpt; |
@@ -151,15 +151,15 @@ discard block |
||
| 151 | 151 | * @param null $more |
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | - public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
|
| 154 | + public static function event_content_or_excerpt($num_words = NULL, $more = NULL) { |
|
| 155 | 155 | global $post; |
| 156 | 156 | ob_start(); |
| 157 | - if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
|
| 157 | + if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) { |
|
| 158 | 158 | // admin has chosen "full description" |
| 159 | 159 | // for the "Event Espresso - Events > Templates > Display Description" option |
| 160 | 160 | the_content(); |
| 161 | - } else if (( is_archive() && espresso_display_excerpt_in_event_list() ) ) { |
|
| 162 | - if ( has_excerpt( $post->ID )) { |
|
| 161 | + } else if ((is_archive() && espresso_display_excerpt_in_event_list())) { |
|
| 162 | + if (has_excerpt($post->ID)) { |
|
| 163 | 163 | // admin has chosen "excerpt (short desc)" |
| 164 | 164 | // for the "Event Espresso - Events > Templates > Display Description" option |
| 165 | 165 | // AND an excerpt actually exists |
@@ -168,20 +168,20 @@ discard block |
||
| 168 | 168 | // admin has chosen "excerpt (short desc)" |
| 169 | 169 | // for the "Event Espresso - Events > Templates > Display Description" option |
| 170 | 170 | // but NO excerpt actually exists, so we need to create one |
| 171 | - if ( ! empty( $num_words )) { |
|
| 172 | - if ( empty( $more )) { |
|
| 173 | - $more_link_text = __( '(more…)' ); |
|
| 174 | - $more = ' <a href="' . get_permalink() . '"'; |
|
| 171 | + if ( ! empty($num_words)) { |
|
| 172 | + if (empty($more)) { |
|
| 173 | + $more_link_text = __('(more…)'); |
|
| 174 | + $more = ' <a href="'.get_permalink().'"'; |
|
| 175 | 175 | $more .= ' class="more-link"'; |
| 176 | 176 | $more .= \EED_Events_Archive::link_target(); |
| 177 | - $more .= '>' . $more_link_text . '</a>'; |
|
| 178 | - $more = apply_filters( 'the_content_more_link', $more, $more_link_text ); |
|
| 177 | + $more .= '>'.$more_link_text.'</a>'; |
|
| 178 | + $more = apply_filters('the_content_more_link', $more, $more_link_text); |
|
| 179 | 179 | } |
| 180 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
| 180 | + $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK')); |
|
| 181 | 181 | |
| 182 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
| 182 | + $content = wp_trim_words($content, $num_words, ' ').$more; |
|
| 183 | 183 | } else { |
| 184 | - $content = get_the_content(); |
|
| 184 | + $content = get_the_content(); |
|
| 185 | 185 | } |
| 186 | 186 | global $allowedtags; |
| 187 | 187 | // make sure links are allowed |
@@ -195,15 +195,15 @@ discard block |
||
| 195 | 195 | // but get previous value so we can reset it |
| 196 | 196 | $prev_value = $allowedtags['a']['target']; |
| 197 | 197 | $allowedtags['a']['target'] = true; |
| 198 | - $content = wp_kses( $content, $allowedtags ); |
|
| 199 | - $content = strip_shortcodes( $content ); |
|
| 200 | - echo apply_filters( 'the_content', $content ); |
|
| 198 | + $content = wp_kses($content, $allowedtags); |
|
| 199 | + $content = strip_shortcodes($content); |
|
| 200 | + echo apply_filters('the_content', $content); |
|
| 201 | 201 | $allowedtags['a']['target'] = $prev_value; |
| 202 | 202 | } |
| 203 | 203 | } else { |
| 204 | 204 | // admin has chosen "none" |
| 205 | 205 | // for the "Event Espresso - Events > Templates > Display Description" option |
| 206 | - echo apply_filters( 'the_content', '' ); |
|
| 206 | + echo apply_filters('the_content', ''); |
|
| 207 | 207 | } |
| 208 | 208 | return ob_get_clean(); |
| 209 | 209 | } |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | * @param int $EVT_ID |
| 218 | 218 | * @return EE_Ticket[] |
| 219 | 219 | */ |
| 220 | - public static function event_tickets_available( $EVT_ID = 0 ) { |
|
| 221 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 220 | + public static function event_tickets_available($EVT_ID = 0) { |
|
| 221 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 222 | 222 | $tickets_available_for_purchase = array(); |
| 223 | - if( $event instanceof EE_Event ) { |
|
| 224 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE ); |
|
| 225 | - foreach( $datetimes as $datetime ) { |
|
| 226 | - $tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() ); |
|
| 223 | + if ($event instanceof EE_Event) { |
|
| 224 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE); |
|
| 225 | + foreach ($datetimes as $datetime) { |
|
| 226 | + $tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase()); |
|
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | return $tickets_available_for_purchase; |
@@ -239,17 +239,17 @@ discard block |
||
| 239 | 239 | * @param bool $hide_uncategorized |
| 240 | 240 | * @return string |
| 241 | 241 | */ |
| 242 | - public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) { |
|
| 242 | + public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) { |
|
| 243 | 243 | $category_links = array(); |
| 244 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 245 | - if ( $event instanceof EE_Event ) { |
|
| 246 | - $event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' ); |
|
| 247 | - if ( $event_categories ) { |
|
| 244 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 245 | + if ($event instanceof EE_Event) { |
|
| 246 | + $event_categories = get_the_terms($event->ID(), 'espresso_event_categories'); |
|
| 247 | + if ($event_categories) { |
|
| 248 | 248 | // loop thru terms and create links |
| 249 | - foreach ( $event_categories as $term ) { |
|
| 250 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
| 251 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
| 252 | - $category_links[] = '<a href="' . esc_url( $url ) |
|
| 249 | + foreach ($event_categories as $term) { |
|
| 250 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
| 251 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
| 252 | + $category_links[] = '<a href="'.esc_url($url) |
|
| 253 | 253 | . '" rel="tag"' |
| 254 | 254 | . \EED_Events_Archive::link_target() |
| 255 | 255 | .'>' |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | - return implode( ', ', $category_links ); |
|
| 262 | + return implode(', ', $category_links); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | |
@@ -273,10 +273,10 @@ discard block |
||
| 273 | 273 | * @param int $EVT_ID |
| 274 | 274 | * @return string |
| 275 | 275 | */ |
| 276 | - public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 277 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
| 278 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
| 279 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
| 276 | + public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 277 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
| 278 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
| 279 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | * @param int $EVT_ID |
| 291 | 291 | * @return string |
| 292 | 292 | */ |
| 293 | - public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 294 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
| 295 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
| 296 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
| 293 | + public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 294 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
| 295 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
| 296 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | * @param int $EVT_ID |
| 308 | 308 | * @return string |
| 309 | 309 | */ |
| 310 | - public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 311 | - $datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID ); |
|
| 312 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
| 313 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_start', $format ) : ''; |
|
| 310 | + public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 311 | + $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID); |
|
| 312 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
| 313 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : ''; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | * @param int $EVT_ID |
| 325 | 325 | * @return string |
| 326 | 326 | */ |
| 327 | - public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 328 | - $datetime = EEH_Event_View::get_latest_date_obj( $EVT_ID ); |
|
| 329 | - $format = ! empty( $dt_frmt ) && ! empty( $tm_frmt ) ? $dt_frmt . ' ' . $tm_frmt : $dt_frmt . $tm_frmt; |
|
| 330 | - return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime( 'DTT_EVT_end', $format ) : ''; |
|
| 327 | + public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 328 | + $datetime = EEH_Event_View::get_latest_date_obj($EVT_ID); |
|
| 329 | + $format = ! empty($dt_frmt) && ! empty($tm_frmt) ? $dt_frmt.' '.$tm_frmt : $dt_frmt.$tm_frmt; |
|
| 330 | + return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : ''; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | |
@@ -339,13 +339,13 @@ discard block |
||
| 339 | 339 | * @param int $EVT_ID |
| 340 | 340 | * @return string |
| 341 | 341 | */ |
| 342 | - public static function event_date_as_calendar_page( $EVT_ID = 0 ) { |
|
| 343 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
| 344 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 342 | + public static function event_date_as_calendar_page($EVT_ID = 0) { |
|
| 343 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
| 344 | + if ($datetime instanceof EE_Datetime) { |
|
| 345 | 345 | ?> |
| 346 | 346 | <div class="event-date-calendar-page-dv"> |
| 347 | - <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime( 'DTT_EVT_start', 'M' );?></div> |
|
| 348 | - <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div> |
|
| 347 | + <div class="event-date-calendar-page-month-dv"><?php echo $datetime->get_i18n_datetime('DTT_EVT_start', 'M'); ?></div> |
|
| 348 | + <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div> |
|
| 349 | 349 | </div> |
| 350 | 350 | <?php |
| 351 | 351 | } |
@@ -360,17 +360,17 @@ discard block |
||
| 360 | 360 | * @param int $EVT_ID |
| 361 | 361 | * @return string |
| 362 | 362 | */ |
| 363 | - public static function get_primary_date_obj( $EVT_ID = 0 ) { |
|
| 364 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 365 | - if ( $event instanceof EE_Event ) { |
|
| 363 | + public static function get_primary_date_obj($EVT_ID = 0) { |
|
| 364 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 365 | + if ($event instanceof EE_Event) { |
|
| 366 | 366 | $datetimes = $event->get_many_related( |
| 367 | 367 | 'Datetime', |
| 368 | 368 | array( |
| 369 | 369 | 'limit' => 1, |
| 370 | - 'order_by' => array( 'DTT_order' => 'ASC' ) |
|
| 370 | + 'order_by' => array('DTT_order' => 'ASC') |
|
| 371 | 371 | ) |
| 372 | 372 | ); |
| 373 | - return reset( $datetimes ); |
|
| 373 | + return reset($datetimes); |
|
| 374 | 374 | } else { |
| 375 | 375 | return FALSE; |
| 376 | 376 | } |
@@ -385,17 +385,17 @@ discard block |
||
| 385 | 385 | * @param int $EVT_ID |
| 386 | 386 | * @return string |
| 387 | 387 | */ |
| 388 | - public static function get_last_date_obj( $EVT_ID = 0 ) { |
|
| 389 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 390 | - if ( $event instanceof EE_Event ) { |
|
| 388 | + public static function get_last_date_obj($EVT_ID = 0) { |
|
| 389 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 390 | + if ($event instanceof EE_Event) { |
|
| 391 | 391 | $datetimes = $event->get_many_related( |
| 392 | 392 | 'Datetime', |
| 393 | 393 | array( |
| 394 | 394 | 'limit' => 1, |
| 395 | - 'order_by' => array( 'DTT_order' => 'DESC' ) |
|
| 395 | + 'order_by' => array('DTT_order' => 'DESC') |
|
| 396 | 396 | ) |
| 397 | 397 | ); |
| 398 | - return end( $datetimes ); |
|
| 398 | + return end($datetimes); |
|
| 399 | 399 | } else { |
| 400 | 400 | return FALSE; |
| 401 | 401 | } |
@@ -410,17 +410,17 @@ discard block |
||
| 410 | 410 | * @param int $EVT_ID |
| 411 | 411 | * @return string |
| 412 | 412 | */ |
| 413 | - public static function get_earliest_date_obj( $EVT_ID = 0 ) { |
|
| 414 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 415 | - if ( $event instanceof EE_Event ) { |
|
| 413 | + public static function get_earliest_date_obj($EVT_ID = 0) { |
|
| 414 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 415 | + if ($event instanceof EE_Event) { |
|
| 416 | 416 | $datetimes = $event->get_many_related( |
| 417 | 417 | 'Datetime', |
| 418 | 418 | array( |
| 419 | 419 | 'limit' => 1, |
| 420 | - 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) |
|
| 420 | + 'order_by' => array('DTT_EVT_start' => 'ASC') |
|
| 421 | 421 | ) |
| 422 | 422 | ); |
| 423 | - return reset( $datetimes ); |
|
| 423 | + return reset($datetimes); |
|
| 424 | 424 | } else { |
| 425 | 425 | return FALSE; |
| 426 | 426 | } |
@@ -435,17 +435,17 @@ discard block |
||
| 435 | 435 | * @param int $EVT_ID |
| 436 | 436 | * @return string |
| 437 | 437 | */ |
| 438 | - public static function get_latest_date_obj( $EVT_ID = 0 ) { |
|
| 439 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 440 | - if ( $event instanceof EE_Event ) { |
|
| 438 | + public static function get_latest_date_obj($EVT_ID = 0) { |
|
| 439 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 440 | + if ($event instanceof EE_Event) { |
|
| 441 | 441 | $datetimes = $event->get_many_related( |
| 442 | 442 | 'Datetime', |
| 443 | 443 | array( |
| 444 | 444 | 'limit' => 1, |
| 445 | - 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) |
|
| 445 | + 'order_by' => array('DTT_EVT_start' => 'DESC') |
|
| 446 | 446 | ) |
| 447 | 447 | ); |
| 448 | - return end( $datetimes ); |
|
| 448 | + return end($datetimes); |
|
| 449 | 449 | } else { |
| 450 | 450 | return FALSE; |
| 451 | 451 | } |
@@ -463,17 +463,17 @@ discard block |
||
| 463 | 463 | * @param null $limit |
| 464 | 464 | * @return EE_Datetime[] |
| 465 | 465 | */ |
| 466 | - public static function get_all_date_obj( $EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL ) { |
|
| 467 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 468 | - if($include_expired === null){ |
|
| 469 | - if($event instanceof EE_Event && $event->is_expired()){ |
|
| 466 | + public static function get_all_date_obj($EVT_ID = 0, $include_expired = null, $include_deleted = false, $limit = NULL) { |
|
| 467 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 468 | + if ($include_expired === null) { |
|
| 469 | + if ($event instanceof EE_Event && $event->is_expired()) { |
|
| 470 | 470 | $include_expired = true; |
| 471 | - }else{ |
|
| 471 | + } else { |
|
| 472 | 472 | $include_expired = false; |
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - if ( $event instanceof EE_Event ) { |
|
| 476 | + if ($event instanceof EE_Event) { |
|
| 477 | 477 | return $event->datetimes_ordered($include_expired, $include_deleted, $limit); |
| 478 | 478 | } else { |
| 479 | 479 | return array(); |
@@ -489,11 +489,11 @@ discard block |
||
| 489 | 489 | * @param int $EVT_ID |
| 490 | 490 | * @return string |
| 491 | 491 | */ |
| 492 | - public static function event_link_url( $EVT_ID = 0 ) { |
|
| 493 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 494 | - if ( $event instanceof EE_Event ) { |
|
| 495 | - $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() ); |
|
| 496 | - return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url; |
|
| 492 | + public static function event_link_url($EVT_ID = 0) { |
|
| 493 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 494 | + if ($event instanceof EE_Event) { |
|
| 495 | + $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID()); |
|
| 496 | + return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url; |
|
| 497 | 497 | } |
| 498 | 498 | return NULL; |
| 499 | 499 | } |
@@ -507,10 +507,10 @@ discard block |
||
| 507 | 507 | * @param int $EVT_ID |
| 508 | 508 | * @return string |
| 509 | 509 | */ |
| 510 | - public static function event_phone( $EVT_ID = 0 ) { |
|
| 511 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 512 | - if ( $event instanceof EE_Event ) { |
|
| 513 | - return EEH_Schema::telephone( $event->phone() ); |
|
| 510 | + public static function event_phone($EVT_ID = 0) { |
|
| 511 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 512 | + if ($event instanceof EE_Event) { |
|
| 513 | + return EEH_Schema::telephone($event->phone()); |
|
| 514 | 514 | } |
| 515 | 515 | return NULL; |
| 516 | 516 | } |
@@ -527,26 +527,26 @@ discard block |
||
| 527 | 527 | * @param string $after |
| 528 | 528 | * @return string |
| 529 | 529 | */ |
| 530 | - public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) { |
|
| 531 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 532 | - if ( $event instanceof EE_Event ) { |
|
| 530 | + public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') { |
|
| 531 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 532 | + if ($event instanceof EE_Event) { |
|
| 533 | 533 | // can the user edit this post ? |
| 534 | - if ( current_user_can( 'edit_post', $event->ID() )) { |
|
| 534 | + if (current_user_can('edit_post', $event->ID())) { |
|
| 535 | 535 | // set link text |
| 536 | - $link_text = ! empty( $link ) ? $link : __('edit this event'); |
|
| 536 | + $link_text = ! empty($link) ? $link : __('edit this event'); |
|
| 537 | 537 | // generate nonce |
| 538 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
| 538 | + $nonce = wp_create_nonce('edit_nonce'); |
|
| 539 | 539 | // generate url to event editor for this event |
| 540 | - $url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() ); |
|
| 540 | + $url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url()); |
|
| 541 | 541 | // get edit CPT text |
| 542 | - $post_type_obj = get_post_type_object( 'espresso_events' ); |
|
| 542 | + $post_type_obj = get_post_type_object('espresso_events'); |
|
| 543 | 543 | // build final link html |
| 544 | - $link = '<a class="post-edit-link" href="' . $url . '" '; |
|
| 545 | - $link .= ' title="' . esc_attr( $post_type_obj->labels->edit_item ) . '"'; |
|
| 544 | + $link = '<a class="post-edit-link" href="'.$url.'" '; |
|
| 545 | + $link .= ' title="'.esc_attr($post_type_obj->labels->edit_item).'"'; |
|
| 546 | 546 | $link .= \EED_Events_Archive::link_target(); |
| 547 | - $link .='>' . $link_text . '</a>'; |
|
| 547 | + $link .= '>'.$link_text.'</a>'; |
|
| 548 | 548 | // put it all together |
| 549 | - return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after; |
|
| 549 | + return $before.apply_filters('edit_post_link', $link, $event->ID()).$after; |
|
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | return ''; |
@@ -206,7 +206,7 @@ |
||
| 206 | 206 | function espresso_ticket_selector( $event = NULL ) { |
| 207 | 207 | if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
| 208 | 208 | espresso_load_ticket_selector(); |
| 209 | - \EED_Ticket_Selector::set_definitions(); |
|
| 209 | + \EED_Ticket_Selector::set_definitions(); |
|
| 210 | 210 | echo EED_Ticket_Selector::display_ticket_selector( $event ); |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -14,12 +14,12 @@ discard block |
||
| 14 | 14 | * @param int | \EE_Event $event |
| 15 | 15 | * @return bool |
| 16 | 16 | */ |
| 17 | -function is_espresso_event( $event = NULL ) { |
|
| 18 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
| 17 | +function is_espresso_event($event = NULL) { |
|
| 18 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 19 | 19 | // extract EE_Event object from passed param regardless of what it is (within reason of course) |
| 20 | - $event = EEH_Event_View::get_event( $event ); |
|
| 20 | + $event = EEH_Event_View::get_event($event); |
|
| 21 | 21 | // do we have a valid event ? |
| 22 | - return $event instanceof EE_Event ? TRUE : FALSE; |
|
| 22 | + return $event instanceof EE_Event ? TRUE : FALSE; |
|
| 23 | 23 | } |
| 24 | 24 | return FALSE; |
| 25 | 25 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return bool |
| 32 | 32 | */ |
| 33 | 33 | function is_espresso_event_single() { |
| 34 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
| 34 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 35 | 35 | global $wp_query; |
| 36 | 36 | // return conditionals set by CPTs |
| 37 | 37 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : FALSE; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @return bool |
| 47 | 47 | */ |
| 48 | 48 | function is_espresso_event_archive() { |
| 49 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
| 49 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 50 | 50 | global $wp_query; |
| 51 | 51 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : FALSE; |
| 52 | 52 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @return bool |
| 61 | 61 | */ |
| 62 | 62 | function is_espresso_event_taxonomy() { |
| 63 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
| 63 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 64 | 64 | global $wp_query; |
| 65 | 65 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : FALSE; |
| 66 | 66 | } |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | * @param int | \EE_Venue $venue |
| 75 | 75 | * @return bool |
| 76 | 76 | */ |
| 77 | -function is_espresso_venue( $venue = NULL ) { |
|
| 78 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
| 77 | +function is_espresso_venue($venue = NULL) { |
|
| 78 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 79 | 79 | // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
| 80 | - $venue = EEH_Venue_View::get_venue( $venue, FALSE ); |
|
| 80 | + $venue = EEH_Venue_View::get_venue($venue, FALSE); |
|
| 81 | 81 | // do we have a valid event ? |
| 82 | 82 | return $venue instanceof EE_Venue ? TRUE : FALSE; |
| 83 | 83 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @return bool |
| 92 | 92 | */ |
| 93 | 93 | function is_espresso_venue_single() { |
| 94 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
| 94 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 95 | 95 | global $wp_query; |
| 96 | 96 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : FALSE; |
| 97 | 97 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @return bool |
| 106 | 106 | */ |
| 107 | 107 | function is_espresso_venue_archive() { |
| 108 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
| 108 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 109 | 109 | global $wp_query; |
| 110 | 110 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : FALSE; |
| 111 | 111 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @return bool |
| 120 | 120 | */ |
| 121 | 121 | function is_espresso_venue_taxonomy() { |
| 122 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
| 122 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
| 123 | 123 | global $wp_query; |
| 124 | 124 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : FALSE; |
| 125 | 125 | } |
@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | * @param $conditional_tag |
| 134 | 134 | * @return bool |
| 135 | 135 | */ |
| 136 | -function can_use_espresso_conditionals( $conditional_tag ) { |
|
| 137 | - if ( ! did_action( 'AHEE__EE_System__initialize' )) { |
|
| 136 | +function can_use_espresso_conditionals($conditional_tag) { |
|
| 137 | + if ( ! did_action('AHEE__EE_System__initialize')) { |
|
| 138 | 138 | EE_Error::doing_it_wrong( |
| 139 | 139 | __FUNCTION__, |
| 140 | 140 | sprintf( |
| 141 | - __( 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.','event_espresso'), |
|
| 141 | + __('The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', 'event_espresso'), |
|
| 142 | 142 | $conditional_tag |
| 143 | 143 | ), |
| 144 | 144 | '4.4.0' |
@@ -153,13 +153,13 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | /*************************** Event Queries ***************************/ |
| 155 | 155 | |
| 156 | -if ( ! function_exists( 'espresso_get_events' )) { |
|
| 156 | +if ( ! function_exists('espresso_get_events')) { |
|
| 157 | 157 | /** |
| 158 | 158 | * espresso_get_events |
| 159 | 159 | * @param array $params |
| 160 | 160 | * @return array |
| 161 | 161 | */ |
| 162 | - function espresso_get_events( $params = array() ) { |
|
| 162 | + function espresso_get_events($params = array()) { |
|
| 163 | 163 | //set default params |
| 164 | 164 | $default_espresso_events_params = array( |
| 165 | 165 | 'limit' => 10, |
@@ -170,18 +170,18 @@ discard block |
||
| 170 | 170 | 'sort' => 'ASC' |
| 171 | 171 | ); |
| 172 | 172 | // allow the defaults to be filtered |
| 173 | - $default_espresso_events_params = apply_filters( 'espresso_get_events__default_espresso_events_params', $default_espresso_events_params ); |
|
| 173 | + $default_espresso_events_params = apply_filters('espresso_get_events__default_espresso_events_params', $default_espresso_events_params); |
|
| 174 | 174 | // grab params and merge with defaults, then extract |
| 175 | - $params = array_merge( $default_espresso_events_params, $params ); |
|
| 175 | + $params = array_merge($default_espresso_events_params, $params); |
|
| 176 | 176 | // run the query |
| 177 | - $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery( $params ); |
|
| 177 | + $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params); |
|
| 178 | 178 | // assign results to a variable so we can return it |
| 179 | 179 | $events = $events_query->have_posts() ? $events_query->posts : array(); |
| 180 | 180 | // but first reset the query and postdata |
| 181 | 181 | wp_reset_query(); |
| 182 | 182 | wp_reset_postdata(); |
| 183 | 183 | EED_Events_Archive::remove_all_events_archive_filters(); |
| 184 | - unset( $events_query ); |
|
| 184 | + unset($events_query); |
|
| 185 | 185 | return $events; |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -195,33 +195,33 @@ discard block |
||
| 195 | 195 | * espresso_load_ticket_selector |
| 196 | 196 | */ |
| 197 | 197 | function espresso_load_ticket_selector() { |
| 198 | - EE_Registry::instance()->load_file( EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module' ); |
|
| 198 | + EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | -if ( ! function_exists( 'espresso_ticket_selector' )) { |
|
| 201 | +if ( ! function_exists('espresso_ticket_selector')) { |
|
| 202 | 202 | /** |
| 203 | 203 | * espresso_ticket_selector |
| 204 | 204 | * @param null $event |
| 205 | 205 | */ |
| 206 | - function espresso_ticket_selector( $event = NULL ) { |
|
| 207 | - if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
|
| 206 | + function espresso_ticket_selector($event = NULL) { |
|
| 207 | + if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', FALSE)) { |
|
| 208 | 208 | espresso_load_ticket_selector(); |
| 209 | 209 | \EED_Ticket_Selector::set_definitions(); |
| 210 | - echo EED_Ticket_Selector::display_ticket_selector( $event ); |
|
| 210 | + echo EED_Ticket_Selector::display_ticket_selector($event); |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | |
| 216 | - if ( ! function_exists( 'espresso_view_details_btn' )) { |
|
| 216 | + if ( ! function_exists('espresso_view_details_btn')) { |
|
| 217 | 217 | /** |
| 218 | 218 | * espresso_view_details_btn |
| 219 | 219 | * @param null $event |
| 220 | 220 | */ |
| 221 | - function espresso_view_details_btn( $event = NULL ) { |
|
| 222 | - if ( ! apply_filters( 'FHEE_disable_espresso_view_details_btn', FALSE ) ) { |
|
| 221 | + function espresso_view_details_btn($event = NULL) { |
|
| 222 | + if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', FALSE)) { |
|
| 223 | 223 | espresso_load_ticket_selector(); |
| 224 | - echo EED_Ticket_Selector::display_ticket_selector( $event, TRUE ); |
|
| 224 | + echo EED_Ticket_Selector::display_ticket_selector($event, TRUE); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | /*************************** EEH_Event_View ***************************/ |
| 233 | 233 | |
| 234 | -if ( ! function_exists( 'espresso_load_event_list_assets' )) { |
|
| 234 | +if ( ! function_exists('espresso_load_event_list_assets')) { |
|
| 235 | 235 | /** |
| 236 | 236 | * espresso_load_event_list_assets |
| 237 | 237 | * ensures that event list styles and scripts are loaded |
@@ -240,13 +240,13 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | function espresso_load_event_list_assets() { |
| 242 | 242 | $event_list = EED_Events_Archive::instance(); |
| 243 | - add_action( 'AHEE__EE_System__initialize_last', array( $event_list, 'load_event_list_assets' ), 10 ); |
|
| 244 | - add_filter( 'FHEE_enable_default_espresso_css', '__return_true' ); |
|
| 243 | + add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10); |
|
| 244 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
| 249 | -if ( ! function_exists( 'espresso_event_reg_button' )) { |
|
| 249 | +if ( ! function_exists('espresso_event_reg_button')) { |
|
| 250 | 250 | /** |
| 251 | 251 | * espresso_event_reg_button |
| 252 | 252 | * returns the "Register Now" button if event is active, |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | * @param bool $EVT_ID |
| 259 | 259 | * @return string |
| 260 | 260 | */ |
| 261 | - function espresso_event_reg_button( $btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE ) { |
|
| 262 | - $event_status = EEH_Event_View::event_active_status( $EVT_ID ); |
|
| 263 | - switch ( $event_status ) { |
|
| 261 | + function espresso_event_reg_button($btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE) { |
|
| 262 | + $event_status = EEH_Event_View::event_active_status($EVT_ID); |
|
| 263 | + switch ($event_status) { |
|
| 264 | 264 | case EE_Datetime::sold_out : |
| 265 | 265 | $btn_text = __('Sold Out', 'event_espresso'); |
| 266 | 266 | $class = 'ee-pink'; |
@@ -276,10 +276,10 @@ discard block |
||
| 276 | 276 | case EE_Datetime::upcoming : |
| 277 | 277 | case EE_Datetime::active : |
| 278 | 278 | default : |
| 279 | - $btn_text =! empty( $btn_text_if_active ) ? $btn_text_if_active : __( 'Register Now', 'event_espresso' ); |
|
| 279 | + $btn_text = ! empty($btn_text_if_active) ? $btn_text_if_active : __('Register Now', 'event_espresso'); |
|
| 280 | 280 | $class = 'ee-green'; |
| 281 | 281 | } |
| 282 | - if ( $event_status < 1 && ! empty( $btn_text_if_inactive )) { |
|
| 282 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
| 283 | 283 | $btn_text = $btn_text_if_inactive; |
| 284 | 284 | $class = 'ee-grey'; |
| 285 | 285 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | |
| 295 | 295 | |
| 296 | -if ( ! function_exists( 'espresso_display_ticket_selector' )) { |
|
| 296 | +if ( ! function_exists('espresso_display_ticket_selector')) { |
|
| 297 | 297 | /** |
| 298 | 298 | * espresso_display_ticket_selector |
| 299 | 299 | * whether or not to display the Ticket Selector for an event |
@@ -301,14 +301,14 @@ discard block |
||
| 301 | 301 | * @param bool $EVT_ID |
| 302 | 302 | * @return boolean |
| 303 | 303 | */ |
| 304 | - function espresso_display_ticket_selector( $EVT_ID = FALSE ) { |
|
| 305 | - return EEH_Event_View::display_ticket_selector( $EVT_ID ); |
|
| 304 | + function espresso_display_ticket_selector($EVT_ID = FALSE) { |
|
| 305 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | |
| 310 | 310 | |
| 311 | -if ( ! function_exists( 'espresso_event_status_banner' )) { |
|
| 311 | +if ( ! function_exists('espresso_event_status_banner')) { |
|
| 312 | 312 | /** |
| 313 | 313 | * espresso_event_status |
| 314 | 314 | * returns a banner showing the event status if it is sold out, expired, or inactive |
@@ -316,13 +316,13 @@ discard block |
||
| 316 | 316 | * @param bool $EVT_ID |
| 317 | 317 | * @return string |
| 318 | 318 | */ |
| 319 | - function espresso_event_status_banner( $EVT_ID = FALSE ) { |
|
| 320 | - return EEH_Event_View::event_status( $EVT_ID ); |
|
| 319 | + function espresso_event_status_banner($EVT_ID = FALSE) { |
|
| 320 | + return EEH_Event_View::event_status($EVT_ID); |
|
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | |
| 325 | -if ( ! function_exists( 'espresso_event_status' )) { |
|
| 325 | +if ( ! function_exists('espresso_event_status')) { |
|
| 326 | 326 | /** |
| 327 | 327 | * espresso_event_status |
| 328 | 328 | * returns the event status if it is sold out, expired, or inactive |
@@ -331,17 +331,17 @@ discard block |
||
| 331 | 331 | * @param bool $echo |
| 332 | 332 | * @return string |
| 333 | 333 | */ |
| 334 | - function espresso_event_status( $EVT_ID = 0, $echo = TRUE ) { |
|
| 335 | - if ( $echo ) { |
|
| 336 | - echo EEH_Event_View::event_active_status( $EVT_ID ); |
|
| 334 | + function espresso_event_status($EVT_ID = 0, $echo = TRUE) { |
|
| 335 | + if ($echo) { |
|
| 336 | + echo EEH_Event_View::event_active_status($EVT_ID); |
|
| 337 | 337 | return ''; |
| 338 | 338 | } |
| 339 | - return EEH_Event_View::event_active_status( $EVT_ID ); |
|
| 339 | + return EEH_Event_View::event_active_status($EVT_ID); |
|
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | |
| 344 | -if ( ! function_exists( 'espresso_event_categories' )) { |
|
| 344 | +if ( ! function_exists('espresso_event_categories')) { |
|
| 345 | 345 | /** |
| 346 | 346 | * espresso_event_categories |
| 347 | 347 | * returns the terms associated with an event |
@@ -351,17 +351,17 @@ discard block |
||
| 351 | 351 | * @param bool $echo |
| 352 | 352 | * @return string |
| 353 | 353 | */ |
| 354 | - function espresso_event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
| 355 | - if ( $echo ) { |
|
| 356 | - echo EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
| 354 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
| 355 | + if ($echo) { |
|
| 356 | + echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
| 357 | 357 | return ''; |
| 358 | 358 | } |
| 359 | - return EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
| 359 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | |
| 364 | -if ( ! function_exists( 'espresso_event_tickets_available' )) { |
|
| 364 | +if ( ! function_exists('espresso_event_tickets_available')) { |
|
| 365 | 365 | /** |
| 366 | 366 | * espresso_event_tickets_available |
| 367 | 367 | * returns the ticket types available for purchase for an event |
@@ -371,26 +371,26 @@ discard block |
||
| 371 | 371 | * @param bool $format |
| 372 | 372 | * @return string |
| 373 | 373 | */ |
| 374 | - function espresso_event_tickets_available( $EVT_ID = 0, $echo = TRUE, $format = TRUE ) { |
|
| 375 | - $tickets = EEH_Event_View::event_tickets_available( $EVT_ID ); |
|
| 376 | - if ( is_array( $tickets ) && ! empty( $tickets )) { |
|
| 374 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) { |
|
| 375 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
| 376 | + if (is_array($tickets) && ! empty($tickets)) { |
|
| 377 | 377 | // if formatting then $html will be a string, else it will be an array of ticket objects |
| 378 | - $html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array(); |
|
| 379 | - foreach ( $tickets as $ticket ) { |
|
| 380 | - if ( $ticket instanceof EE_Ticket ) { |
|
| 381 | - if ( $format ) { |
|
| 382 | - $html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">'; |
|
| 383 | - $html .= $ticket->name() . ' ' . EEH_Template::format_currency( $ticket->get_ticket_total_with_taxes() ); |
|
| 378 | + $html = $format ? '<ul id="ee-event-tickets-ul-'.$EVT_ID.'" class="ee-event-tickets-ul">' : array(); |
|
| 379 | + foreach ($tickets as $ticket) { |
|
| 380 | + if ($ticket instanceof EE_Ticket) { |
|
| 381 | + if ($format) { |
|
| 382 | + $html .= '<li id="ee-event-tickets-li-'.$ticket->ID().'" class="ee-event-tickets-li">'; |
|
| 383 | + $html .= $ticket->name().' '.EEH_Template::format_currency($ticket->get_ticket_total_with_taxes()); |
|
| 384 | 384 | $html .= '</li>'; |
| 385 | 385 | } else { |
| 386 | 386 | $html[] = $ticket; |
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | - if ( $format ) { |
|
| 390 | + if ($format) { |
|
| 391 | 391 | $html .= '</ul>'; |
| 392 | 392 | } |
| 393 | - if ( $echo && ! $format ) { |
|
| 393 | + if ($echo && ! $format) { |
|
| 394 | 394 | echo $html; |
| 395 | 395 | return ''; |
| 396 | 396 | } |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | -if ( ! function_exists( 'espresso_event_date_obj' )) { |
|
| 403 | +if ( ! function_exists('espresso_event_date_obj')) { |
|
| 404 | 404 | /** |
| 405 | 405 | * espresso_event_date_obj |
| 406 | 406 | * returns the primary date object for an event |
@@ -408,13 +408,13 @@ discard block |
||
| 408 | 408 | * @param bool $EVT_ID |
| 409 | 409 | * @return object |
| 410 | 410 | */ |
| 411 | - function espresso_event_date_obj( $EVT_ID = FALSE ) { |
|
| 412 | - return EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
| 411 | + function espresso_event_date_obj($EVT_ID = FALSE) { |
|
| 412 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | |
| 417 | -if ( ! function_exists( 'espresso_event_date' )) { |
|
| 417 | +if ( ! function_exists('espresso_event_date')) { |
|
| 418 | 418 | /** |
| 419 | 419 | * espresso_event_date |
| 420 | 420 | * returns the primary date for an event |
@@ -425,22 +425,22 @@ discard block |
||
| 425 | 425 | * @param bool $echo |
| 426 | 426 | * @return string |
| 427 | 427 | */ |
| 428 | - function espresso_event_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
| 429 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
| 430 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
| 431 | - $date_format = apply_filters( 'FHEE__espresso_event_date__date_format', $date_format ); |
|
| 432 | - $time_format = apply_filters( 'FHEE__espresso_event_date__time_format', $time_format ); |
|
| 433 | - if($echo){ |
|
| 434 | - echo EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
| 428 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
| 429 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 430 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 431 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
| 432 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
| 433 | + if ($echo) { |
|
| 434 | + echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
| 435 | 435 | return ''; |
| 436 | 436 | } |
| 437 | - return EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
| 437 | + return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
| 438 | 438 | |
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | |
| 443 | -if ( ! function_exists( 'espresso_list_of_event_dates' )) { |
|
| 443 | +if ( ! function_exists('espresso_list_of_event_dates')) { |
|
| 444 | 444 | /** |
| 445 | 445 | * espresso_list_of_event_dates |
| 446 | 446 | * returns a unordered list of dates for an event |
@@ -455,40 +455,40 @@ discard block |
||
| 455 | 455 | * @param null $limit |
| 456 | 456 | * @return string |
| 457 | 457 | */ |
| 458 | - function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL ) { |
|
| 459 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
| 460 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
| 461 | - $date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format ); |
|
| 462 | - $time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format ); |
|
| 463 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired, FALSE, $limit ); |
|
| 464 | - if ( ! $format ) { |
|
| 465 | - return apply_filters( 'FHEE__espresso_list_of_event_dates__datetimes', $datetimes ); |
|
| 458 | + function espresso_list_of_event_dates($EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL) { |
|
| 459 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 460 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 461 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
| 462 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
| 463 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, FALSE, $limit); |
|
| 464 | + if ( ! $format) { |
|
| 465 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
| 466 | 466 | } |
| 467 | 467 | //d( $datetimes ); |
| 468 | - if ( is_array( $datetimes ) && ! empty( $datetimes )) { |
|
| 468 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
| 469 | 469 | global $post; |
| 470 | - $html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul ee-clearfix">' : ''; |
|
| 471 | - foreach ( $datetimes as $datetime ) { |
|
| 472 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 473 | - $html .= '<li id="ee-event-datetimes-li-' . $datetime->ID(); |
|
| 474 | - $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-' . $datetime->get_active_status() . '">'; |
|
| 470 | + $html = $format ? '<ul id="ee-event-datetimes-ul-'.$post->ID.'" class="ee-event-datetimes-ul ee-clearfix">' : ''; |
|
| 471 | + foreach ($datetimes as $datetime) { |
|
| 472 | + if ($datetime instanceof EE_Datetime) { |
|
| 473 | + $html .= '<li id="ee-event-datetimes-li-'.$datetime->ID(); |
|
| 474 | + $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-'.$datetime->get_active_status().'">'; |
|
| 475 | 475 | $datetime_name = $datetime->name(); |
| 476 | - $html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : ''; |
|
| 477 | - $html .= ! empty( $datetime_name ) && $add_breaks ? '<br />' : ''; |
|
| 478 | - $html .= '<span class="dashicons dashicons-calendar"></span><span class="ee-event-datetimes-li-daterange">' . $datetime->date_range( $date_format ) . '</span><br/>'; |
|
| 479 | - $html .= '<span class="dashicons dashicons-clock"></span><span class="ee-event-datetimes-li-timerange">' . $datetime->time_range( $time_format ) . '</span>'; |
|
| 476 | + $html .= ! empty($datetime_name) ? '<strong>'.$datetime_name.'</strong>' : ''; |
|
| 477 | + $html .= ! empty($datetime_name) && $add_breaks ? '<br />' : ''; |
|
| 478 | + $html .= '<span class="dashicons dashicons-calendar"></span><span class="ee-event-datetimes-li-daterange">'.$datetime->date_range($date_format).'</span><br/>'; |
|
| 479 | + $html .= '<span class="dashicons dashicons-clock"></span><span class="ee-event-datetimes-li-timerange">'.$datetime->time_range($time_format).'</span>'; |
|
| 480 | 480 | $datetime_description = $datetime->description(); |
| 481 | - $html .= ! empty( $datetime_description ) && $add_breaks ? '<br />' : ''; |
|
| 482 | - $html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : ''; |
|
| 483 | - $html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime ); |
|
| 481 | + $html .= ! empty($datetime_description) && $add_breaks ? '<br />' : ''; |
|
| 482 | + $html .= ! empty($datetime_description) ? ' - '.$datetime_description : ''; |
|
| 483 | + $html = apply_filters('FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime); |
|
| 484 | 484 | $html .= '</li>'; |
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | 487 | $html .= $format ? '</ul>' : ''; |
| 488 | 488 | } else { |
| 489 | - $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : ''; |
|
| 489 | + $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>'.__('There are no upcoming dates for this event.', 'event_espresso').'</p><br/>' : ''; |
|
| 490 | 490 | } |
| 491 | - if ( $echo ) { |
|
| 491 | + if ($echo) { |
|
| 492 | 492 | echo $html; |
| 493 | 493 | return ''; |
| 494 | 494 | } |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | |
| 500 | -if ( ! function_exists( 'espresso_event_end_date' )) { |
|
| 500 | +if ( ! function_exists('espresso_event_end_date')) { |
|
| 501 | 501 | /** |
| 502 | 502 | * espresso_event_end_date |
| 503 | 503 | * returns the last date for an event |
@@ -508,20 +508,20 @@ discard block |
||
| 508 | 508 | * @param bool $echo |
| 509 | 509 | * @return string |
| 510 | 510 | */ |
| 511 | - function espresso_event_end_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
| 512 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
| 513 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
| 514 | - $date_format = apply_filters( 'FHEE__espresso_event_end_date__date_format', $date_format ); |
|
| 515 | - $time_format = apply_filters( 'FHEE__espresso_event_end_date__time_format', $time_format ); |
|
| 516 | - if($echo){ |
|
| 517 | - echo EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
| 511 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
| 512 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 513 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 514 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
| 515 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
| 516 | + if ($echo) { |
|
| 517 | + echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
| 518 | 518 | return ''; |
| 519 | 519 | } |
| 520 | - return EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
| 520 | + return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | -if ( ! function_exists( 'espresso_event_date_range' )) { |
|
| 524 | +if ( ! function_exists('espresso_event_date_range')) { |
|
| 525 | 525 | /** |
| 526 | 526 | * espresso_event_date_range |
| 527 | 527 | * returns the first and last chronologically ordered dates for an event (if different) |
@@ -534,31 +534,31 @@ discard block |
||
| 534 | 534 | * @param bool $echo |
| 535 | 535 | * @return string |
| 536 | 536 | */ |
| 537 | - function espresso_event_date_range( $date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
| 537 | + function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
| 538 | 538 | // set and filter date and time formats when a range is returned |
| 539 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
| 540 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', $date_format ); |
|
| 539 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
| 540 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
| 541 | 541 | // get the start and end date with NO time portion |
| 542 | - $the_event_date = EEH_Event_View::the_earliest_event_date( $date_format, '', $EVT_ID ); |
|
| 543 | - $the_event_end_date = EEH_Event_View::the_latest_event_date( $date_format, '', $EVT_ID ); |
|
| 542 | + $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
| 543 | + $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
| 544 | 544 | // now we can determine if date range spans more than one day |
| 545 | - if ( $the_event_date != $the_event_end_date ) { |
|
| 546 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
| 547 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', $time_format ); |
|
| 545 | + if ($the_event_date != $the_event_end_date) { |
|
| 546 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
| 547 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
| 548 | 548 | $html = sprintf( |
| 549 | - __( '%1$s - %2$s', 'event_espresso' ), |
|
| 550 | - EEH_Event_View::the_earliest_event_date( $date_format, $time_format, $EVT_ID ), |
|
| 551 | - EEH_Event_View::the_latest_event_date( $date_format, $time_format, $EVT_ID ) |
|
| 549 | + __('%1$s - %2$s', 'event_espresso'), |
|
| 550 | + EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
| 551 | + EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
| 552 | 552 | ); |
| 553 | 553 | } else { |
| 554 | 554 | // set and filter date and time formats when only a single datetime is returned |
| 555 | - $single_date_format = ! empty( $single_date_format ) ? $single_date_format : get_option( 'date_format' ); |
|
| 556 | - $single_time_format = ! empty( $single_time_format ) ? $single_time_format : get_option( 'time_format' ); |
|
| 557 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', $single_date_format ); |
|
| 558 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', $single_time_format ); |
|
| 559 | - $html = EEH_Event_View::the_earliest_event_date( $single_date_format, $single_time_format, $EVT_ID ); |
|
| 555 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
| 556 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
| 557 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
| 558 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
| 559 | + $html = EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
| 560 | 560 | } |
| 561 | - if ( $echo ) { |
|
| 561 | + if ($echo) { |
|
| 562 | 562 | echo $html; |
| 563 | 563 | return ''; |
| 564 | 564 | } |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | |
| 570 | -if ( ! function_exists( 'espresso_event_date_as_calendar_page' )) { |
|
| 570 | +if ( ! function_exists('espresso_event_date_as_calendar_page')) { |
|
| 571 | 571 | /** |
| 572 | 572 | * espresso_event_date_as_calendar_page |
| 573 | 573 | * returns the primary date for an event, stylized to appear as the page of a calendar |
@@ -575,15 +575,15 @@ discard block |
||
| 575 | 575 | * @param bool $EVT_ID |
| 576 | 576 | * @return string |
| 577 | 577 | */ |
| 578 | - function espresso_event_date_as_calendar_page( $EVT_ID = FALSE ) { |
|
| 579 | - EEH_Event_View::event_date_as_calendar_page( $EVT_ID ); |
|
| 578 | + function espresso_event_date_as_calendar_page($EVT_ID = FALSE) { |
|
| 579 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | |
| 584 | 584 | |
| 585 | 585 | |
| 586 | -if ( ! function_exists( 'espresso_event_link_url' )) { |
|
| 586 | +if ( ! function_exists('espresso_event_link_url')) { |
|
| 587 | 587 | /** |
| 588 | 588 | * espresso_event_link_url |
| 589 | 589 | * |
@@ -591,18 +591,18 @@ discard block |
||
| 591 | 591 | * @param bool $echo |
| 592 | 592 | * @return string |
| 593 | 593 | */ |
| 594 | - function espresso_event_link_url( $EVT_ID = 0, $echo = TRUE ) { |
|
| 595 | - if ( $echo ) { |
|
| 596 | - echo EEH_Event_View::event_link_url( $EVT_ID ); |
|
| 594 | + function espresso_event_link_url($EVT_ID = 0, $echo = TRUE) { |
|
| 595 | + if ($echo) { |
|
| 596 | + echo EEH_Event_View::event_link_url($EVT_ID); |
|
| 597 | 597 | return ''; |
| 598 | 598 | } |
| 599 | - return EEH_Event_View::event_link_url( $EVT_ID ); |
|
| 599 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | |
| 604 | 604 | |
| 605 | -if ( ! function_exists( 'espresso_event_has_content_or_excerpt' )) { |
|
| 605 | +if ( ! function_exists('espresso_event_has_content_or_excerpt')) { |
|
| 606 | 606 | /** |
| 607 | 607 | * espresso_event_has_content_or_excerpt |
| 608 | 608 | * |
@@ -610,15 +610,15 @@ discard block |
||
| 610 | 610 | * @param bool $EVT_ID |
| 611 | 611 | * @return boolean |
| 612 | 612 | */ |
| 613 | - function espresso_event_has_content_or_excerpt( $EVT_ID = FALSE ) { |
|
| 614 | - return EEH_Event_View::event_has_content_or_excerpt( $EVT_ID ); |
|
| 613 | + function espresso_event_has_content_or_excerpt($EVT_ID = FALSE) { |
|
| 614 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
| 615 | 615 | } |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | |
| 619 | 619 | |
| 620 | 620 | |
| 621 | -if ( ! function_exists( 'espresso_event_content_or_excerpt' )) { |
|
| 621 | +if ( ! function_exists('espresso_event_content_or_excerpt')) { |
|
| 622 | 622 | /** |
| 623 | 623 | * espresso_event_content_or_excerpt |
| 624 | 624 | * |
@@ -627,18 +627,18 @@ discard block |
||
| 627 | 627 | * @param bool $echo |
| 628 | 628 | * @return string |
| 629 | 629 | */ |
| 630 | - function espresso_event_content_or_excerpt( $num_words = 55, $more = NULL, $echo = TRUE ) { |
|
| 631 | - if ( $echo ) { |
|
| 632 | - echo EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
| 630 | + function espresso_event_content_or_excerpt($num_words = 55, $more = NULL, $echo = TRUE) { |
|
| 631 | + if ($echo) { |
|
| 632 | + echo EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
| 633 | 633 | return ''; |
| 634 | 634 | } |
| 635 | - return EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
| 635 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | |
| 640 | 640 | |
| 641 | -if ( ! function_exists( 'espresso_event_phone' )) { |
|
| 641 | +if ( ! function_exists('espresso_event_phone')) { |
|
| 642 | 642 | /** |
| 643 | 643 | * espresso_event_phone |
| 644 | 644 | * |
@@ -646,18 +646,18 @@ discard block |
||
| 646 | 646 | * @param bool $echo |
| 647 | 647 | * @return string |
| 648 | 648 | */ |
| 649 | - function espresso_event_phone( $EVT_ID = 0, $echo = TRUE ) { |
|
| 650 | - if ( $echo ) { |
|
| 651 | - echo EEH_Event_View::event_phone( $EVT_ID ); |
|
| 649 | + function espresso_event_phone($EVT_ID = 0, $echo = TRUE) { |
|
| 650 | + if ($echo) { |
|
| 651 | + echo EEH_Event_View::event_phone($EVT_ID); |
|
| 652 | 652 | return ''; |
| 653 | 653 | } |
| 654 | - return EEH_Event_View::event_phone( $EVT_ID ); |
|
| 654 | + return EEH_Event_View::event_phone($EVT_ID); |
|
| 655 | 655 | } |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | |
| 659 | 659 | |
| 660 | -if ( ! function_exists( 'espresso_edit_event_link' )) { |
|
| 660 | +if ( ! function_exists('espresso_edit_event_link')) { |
|
| 661 | 661 | /** |
| 662 | 662 | * espresso_edit_event_link |
| 663 | 663 | * returns a link to edit an event |
@@ -666,39 +666,39 @@ discard block |
||
| 666 | 666 | * @param bool $echo |
| 667 | 667 | * @return string |
| 668 | 668 | */ |
| 669 | - function espresso_edit_event_link( $EVT_ID = 0, $echo = TRUE ) { |
|
| 670 | - if ( $echo ) { |
|
| 671 | - echo EEH_Event_View::edit_event_link( $EVT_ID ); |
|
| 669 | + function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) { |
|
| 670 | + if ($echo) { |
|
| 671 | + echo EEH_Event_View::edit_event_link($EVT_ID); |
|
| 672 | 672 | return ''; |
| 673 | 673 | } |
| 674 | - return EEH_Event_View::edit_event_link( $EVT_ID ); |
|
| 674 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
| 675 | 675 | } |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | |
| 679 | -if ( ! function_exists( 'espresso_organization_name' )) { |
|
| 679 | +if ( ! function_exists('espresso_organization_name')) { |
|
| 680 | 680 | /** |
| 681 | 681 | * espresso_organization_name |
| 682 | 682 | * @param bool $echo |
| 683 | 683 | * @return string |
| 684 | 684 | */ |
| 685 | 685 | function espresso_organization_name($echo = TRUE) { |
| 686 | - if($echo){ |
|
| 687 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
| 686 | + if ($echo) { |
|
| 687 | + echo EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
| 688 | 688 | return ''; |
| 689 | 689 | } |
| 690 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
| 690 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | -if ( ! function_exists( 'espresso_organization_address' )) { |
|
| 694 | +if ( ! function_exists('espresso_organization_address')) { |
|
| 695 | 695 | /** |
| 696 | 696 | * espresso_organization_address |
| 697 | 697 | * @param string $type |
| 698 | 698 | * @return string |
| 699 | 699 | */ |
| 700 | - function espresso_organization_address( $type = 'inline' ) { |
|
| 701 | - if ( EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ) { |
|
| 700 | + function espresso_organization_address($type = 'inline') { |
|
| 701 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
| 702 | 702 | $address = new EventEspresso\core\domain\entities\GenericAddress( |
| 703 | 703 | EE_Registry::instance()->CFG->organization->address_1, |
| 704 | 704 | EE_Registry::instance()->CFG->organization->address_2, |
@@ -707,129 +707,129 @@ discard block |
||
| 707 | 707 | EE_Registry::instance()->CFG->organization->zip, |
| 708 | 708 | EE_Registry::instance()->CFG->organization->CNT_ISO |
| 709 | 709 | ); |
| 710 | - return EEH_Address::format( $address, $type ); |
|
| 710 | + return EEH_Address::format($address, $type); |
|
| 711 | 711 | } |
| 712 | 712 | return ''; |
| 713 | 713 | } |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | -if ( ! function_exists( 'espresso_organization_email' )) { |
|
| 716 | +if ( ! function_exists('espresso_organization_email')) { |
|
| 717 | 717 | /** |
| 718 | 718 | * espresso_organization_email |
| 719 | 719 | * @param bool $echo |
| 720 | 720 | * @return string |
| 721 | 721 | */ |
| 722 | - function espresso_organization_email( $echo = TRUE ) { |
|
| 723 | - if($echo){ |
|
| 724 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
| 722 | + function espresso_organization_email($echo = TRUE) { |
|
| 723 | + if ($echo) { |
|
| 724 | + echo EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
| 725 | 725 | return ''; |
| 726 | 726 | } |
| 727 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
| 727 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
| 728 | 728 | } |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | -if ( ! function_exists( 'espresso_organization_logo_url' )) { |
|
| 731 | +if ( ! function_exists('espresso_organization_logo_url')) { |
|
| 732 | 732 | /** |
| 733 | 733 | * espresso_organization_logo_url |
| 734 | 734 | * @param bool $echo |
| 735 | 735 | * @return string |
| 736 | 736 | */ |
| 737 | - function espresso_organization_logo_url( $echo = TRUE ) { |
|
| 738 | - if($echo){ |
|
| 739 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
| 737 | + function espresso_organization_logo_url($echo = TRUE) { |
|
| 738 | + if ($echo) { |
|
| 739 | + echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
| 740 | 740 | return ''; |
| 741 | 741 | } |
| 742 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
| 742 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
| 743 | 743 | } |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | -if ( ! function_exists( 'espresso_organization_facebook' )) { |
|
| 746 | +if ( ! function_exists('espresso_organization_facebook')) { |
|
| 747 | 747 | /** |
| 748 | 748 | * espresso_organization_facebook |
| 749 | 749 | * @param bool $echo |
| 750 | 750 | * @return string |
| 751 | 751 | */ |
| 752 | - function espresso_organization_facebook( $echo = TRUE ) { |
|
| 753 | - if($echo){ |
|
| 754 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
| 752 | + function espresso_organization_facebook($echo = TRUE) { |
|
| 753 | + if ($echo) { |
|
| 754 | + echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
| 755 | 755 | return ''; |
| 756 | 756 | } |
| 757 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
| 757 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
| 758 | 758 | } |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | -if ( ! function_exists( 'espresso_organization_twitter' )) { |
|
| 761 | +if ( ! function_exists('espresso_organization_twitter')) { |
|
| 762 | 762 | /** |
| 763 | 763 | * espresso_organization_twitter |
| 764 | 764 | * @param bool $echo |
| 765 | 765 | * @return string |
| 766 | 766 | */ |
| 767 | - function espresso_organization_twitter( $echo = TRUE ) { |
|
| 768 | - if($echo){ |
|
| 769 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
| 767 | + function espresso_organization_twitter($echo = TRUE) { |
|
| 768 | + if ($echo) { |
|
| 769 | + echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
| 770 | 770 | return ''; |
| 771 | 771 | } |
| 772 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
| 772 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | -if ( ! function_exists( 'espresso_organization_linkedin' )) { |
|
| 776 | +if ( ! function_exists('espresso_organization_linkedin')) { |
|
| 777 | 777 | /** |
| 778 | 778 | * espresso_organization_linkedin |
| 779 | 779 | * @param bool $echo |
| 780 | 780 | * @return string |
| 781 | 781 | */ |
| 782 | - function espresso_organization_linkedin( $echo = TRUE ) { |
|
| 783 | - if($echo){ |
|
| 784 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
| 782 | + function espresso_organization_linkedin($echo = TRUE) { |
|
| 783 | + if ($echo) { |
|
| 784 | + echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
| 785 | 785 | return ''; |
| 786 | 786 | } |
| 787 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
| 787 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
| 788 | 788 | } |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | -if ( ! function_exists( 'espresso_organization_pinterest' )) { |
|
| 791 | +if ( ! function_exists('espresso_organization_pinterest')) { |
|
| 792 | 792 | /** |
| 793 | 793 | * espresso_organization_pinterest |
| 794 | 794 | * @param bool $echo |
| 795 | 795 | * @return string |
| 796 | 796 | */ |
| 797 | - function espresso_organization_pinterest( $echo = TRUE ) { |
|
| 798 | - if($echo){ |
|
| 799 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
| 797 | + function espresso_organization_pinterest($echo = TRUE) { |
|
| 798 | + if ($echo) { |
|
| 799 | + echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
| 800 | 800 | return ''; |
| 801 | 801 | } |
| 802 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
| 802 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
| 803 | 803 | } |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | -if ( ! function_exists( 'espresso_organization_google' )) { |
|
| 806 | +if ( ! function_exists('espresso_organization_google')) { |
|
| 807 | 807 | /** |
| 808 | 808 | * espresso_organization_google |
| 809 | 809 | * @param bool $echo |
| 810 | 810 | * @return string |
| 811 | 811 | */ |
| 812 | - function espresso_organization_google( $echo = TRUE ) { |
|
| 813 | - if($echo){ |
|
| 814 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
| 812 | + function espresso_organization_google($echo = TRUE) { |
|
| 813 | + if ($echo) { |
|
| 814 | + echo EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
| 815 | 815 | return ''; |
| 816 | 816 | } |
| 817 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
| 817 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
| 818 | 818 | } |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | -if ( ! function_exists( 'espresso_organization_instagram' )) { |
|
| 821 | +if ( ! function_exists('espresso_organization_instagram')) { |
|
| 822 | 822 | /** |
| 823 | 823 | * espresso_organization_instagram |
| 824 | 824 | * @param bool $echo |
| 825 | 825 | * @return string |
| 826 | 826 | */ |
| 827 | - function espresso_organization_instagram( $echo = TRUE ) { |
|
| 828 | - if($echo){ |
|
| 829 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
| 827 | + function espresso_organization_instagram($echo = TRUE) { |
|
| 828 | + if ($echo) { |
|
| 829 | + echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
| 830 | 830 | return ''; |
| 831 | 831 | } |
| 832 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
| 832 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
| 833 | 833 | } |
| 834 | 834 | } |
| 835 | 835 | |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | |
| 840 | 840 | |
| 841 | 841 | |
| 842 | -if ( ! function_exists( 'espresso_event_venues' )) { |
|
| 842 | +if ( ! function_exists('espresso_event_venues')) { |
|
| 843 | 843 | /** |
| 844 | 844 | * espresso_event_venues |
| 845 | 845 | * |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | |
| 854 | 854 | |
| 855 | 855 | |
| 856 | -if ( ! function_exists( 'espresso_venue_id' )) { |
|
| 856 | +if ( ! function_exists('espresso_venue_id')) { |
|
| 857 | 857 | /** |
| 858 | 858 | * espresso_venue_name |
| 859 | 859 | * |
@@ -861,15 +861,15 @@ discard block |
||
| 861 | 861 | * @param int $EVT_ID |
| 862 | 862 | * @return string |
| 863 | 863 | */ |
| 864 | - function espresso_venue_id( $EVT_ID = 0 ) { |
|
| 865 | - $venue = EEH_Venue_View::get_venue( $EVT_ID ); |
|
| 864 | + function espresso_venue_id($EVT_ID = 0) { |
|
| 865 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
| 866 | 866 | return $venue instanceof EE_Venue ? $venue->ID() : 0; |
| 867 | 867 | } |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | |
| 871 | 871 | |
| 872 | -if ( ! function_exists( 'espresso_is_venue_private' ) ) { |
|
| 872 | +if ( ! function_exists('espresso_is_venue_private')) { |
|
| 873 | 873 | /** |
| 874 | 874 | * Return whether a venue is private or not. |
| 875 | 875 | * @see EEH_Venue_View::get_venue() for more info on expected return results. |
@@ -878,45 +878,45 @@ discard block |
||
| 878 | 878 | * |
| 879 | 879 | * @return bool | null |
| 880 | 880 | */ |
| 881 | - function espresso_is_venue_private( $VNU_ID = 0 ) { |
|
| 882 | - return EEH_Venue_View::is_venue_private( $VNU_ID ); |
|
| 881 | + function espresso_is_venue_private($VNU_ID = 0) { |
|
| 882 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
| 883 | 883 | } |
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | |
| 887 | 887 | |
| 888 | -if ( ! function_exists( 'espresso_venue_is_password_protected' ) ) { |
|
| 888 | +if ( ! function_exists('espresso_venue_is_password_protected')) { |
|
| 889 | 889 | /** |
| 890 | 890 | * returns true or false if a venue is password protected or not |
| 891 | 891 | * |
| 892 | 892 | * @param int $VNU_ID optional, the venue id to check. |
| 893 | 893 | * @return string |
| 894 | 894 | */ |
| 895 | - function espresso_venue_is_password_protected( $VNU_ID = 0 ) { |
|
| 896 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
| 897 | - return EEH_Venue_View::is_venue_password_protected( $VNU_ID ); |
|
| 895 | + function espresso_venue_is_password_protected($VNU_ID = 0) { |
|
| 896 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
| 897 | + return EEH_Venue_View::is_venue_password_protected($VNU_ID); |
|
| 898 | 898 | } |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | |
| 902 | 902 | |
| 903 | -if ( ! function_exists( 'espresso_password_protected_venue_form' ) ) { |
|
| 903 | +if ( ! function_exists('espresso_password_protected_venue_form')) { |
|
| 904 | 904 | /** |
| 905 | 905 | * Returns a password form if venue is password protected. |
| 906 | 906 | * |
| 907 | 907 | * @param int $VNU_ID optional, the venue id to check. |
| 908 | 908 | * @return string |
| 909 | 909 | */ |
| 910 | - function espresso_password_protected_venue_form( $VNU_ID = 0 ) { |
|
| 911 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
| 912 | - return EEH_Venue_View::password_protected_venue_form( $VNU_ID ); |
|
| 910 | + function espresso_password_protected_venue_form($VNU_ID = 0) { |
|
| 911 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
| 912 | + return EEH_Venue_View::password_protected_venue_form($VNU_ID); |
|
| 913 | 913 | } |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | |
| 917 | 917 | |
| 918 | 918 | |
| 919 | -if ( ! function_exists( 'espresso_venue_name' )) { |
|
| 919 | +if ( ! function_exists('espresso_venue_name')) { |
|
| 920 | 920 | /** |
| 921 | 921 | * espresso_venue_name |
| 922 | 922 | * |
@@ -926,19 +926,19 @@ discard block |
||
| 926 | 926 | * @param bool $echo |
| 927 | 927 | * @return string |
| 928 | 928 | */ |
| 929 | - function espresso_venue_name( $VNU_ID = 0, $link_to = 'details', $echo = TRUE ) { |
|
| 930 | - if($echo){ |
|
| 931 | - echo EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
| 929 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = TRUE) { |
|
| 930 | + if ($echo) { |
|
| 931 | + echo EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
| 932 | 932 | return ''; |
| 933 | 933 | } |
| 934 | - return EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
| 934 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
| 935 | 935 | } |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | |
| 939 | 939 | |
| 940 | 940 | |
| 941 | -if ( ! function_exists( 'espresso_venue_link' )) { |
|
| 941 | +if ( ! function_exists('espresso_venue_link')) { |
|
| 942 | 942 | /** |
| 943 | 943 | * espresso_venue_link |
| 944 | 944 | * |
@@ -947,14 +947,14 @@ discard block |
||
| 947 | 947 | * @param string $text |
| 948 | 948 | * @return string |
| 949 | 949 | */ |
| 950 | - function espresso_venue_link( $VNU_ID = 0, $text = '' ) { |
|
| 951 | - return EEH_Venue_View::venue_details_link( $VNU_ID, $text ); |
|
| 950 | + function espresso_venue_link($VNU_ID = 0, $text = '') { |
|
| 951 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | |
| 956 | 956 | |
| 957 | -if ( ! function_exists( 'espresso_venue_description' )) { |
|
| 957 | +if ( ! function_exists('espresso_venue_description')) { |
|
| 958 | 958 | /** |
| 959 | 959 | * espresso_venue_description |
| 960 | 960 | * |
@@ -963,17 +963,17 @@ discard block |
||
| 963 | 963 | * @param bool $echo |
| 964 | 964 | * @return string |
| 965 | 965 | */ |
| 966 | - function espresso_venue_description( $VNU_ID = FALSE, $echo = TRUE ) { |
|
| 967 | - if($echo){ |
|
| 968 | - echo EEH_Venue_View::venue_description( $VNU_ID ); |
|
| 966 | + function espresso_venue_description($VNU_ID = FALSE, $echo = TRUE) { |
|
| 967 | + if ($echo) { |
|
| 968 | + echo EEH_Venue_View::venue_description($VNU_ID); |
|
| 969 | 969 | return ''; |
| 970 | 970 | } |
| 971 | - return EEH_Venue_View::venue_description( $VNU_ID ); |
|
| 971 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
| 972 | 972 | } |
| 973 | 973 | } |
| 974 | 974 | |
| 975 | 975 | |
| 976 | -if ( ! function_exists( 'espresso_venue_excerpt' )) { |
|
| 976 | +if ( ! function_exists('espresso_venue_excerpt')) { |
|
| 977 | 977 | /** |
| 978 | 978 | * espresso_venue_excerpt |
| 979 | 979 | * |
@@ -982,18 +982,18 @@ discard block |
||
| 982 | 982 | * @param bool $echo |
| 983 | 983 | * @return string |
| 984 | 984 | */ |
| 985 | - function espresso_venue_excerpt( $VNU_ID = 0, $echo = TRUE ) { |
|
| 986 | - if ( $echo ) { |
|
| 987 | - echo EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
| 985 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = TRUE) { |
|
| 986 | + if ($echo) { |
|
| 987 | + echo EEH_Venue_View::venue_excerpt($VNU_ID); |
|
| 988 | 988 | return ''; |
| 989 | 989 | } |
| 990 | - return EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
| 990 | + return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
| 991 | 991 | } |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | |
| 995 | 995 | |
| 996 | -if ( ! function_exists( 'espresso_venue_categories' )) { |
|
| 996 | +if ( ! function_exists('espresso_venue_categories')) { |
|
| 997 | 997 | /** |
| 998 | 998 | * espresso_venue_categories |
| 999 | 999 | * returns the terms associated with a venue |
@@ -1003,17 +1003,17 @@ discard block |
||
| 1003 | 1003 | * @param bool $echo |
| 1004 | 1004 | * @return string |
| 1005 | 1005 | */ |
| 1006 | - function espresso_venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
| 1007 | - if ( $echo ) { |
|
| 1008 | - echo EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
| 1006 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
| 1007 | + if ($echo) { |
|
| 1008 | + echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
| 1009 | 1009 | return ''; |
| 1010 | 1010 | } |
| 1011 | - return EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
| 1011 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
| 1012 | 1012 | } |
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | |
| 1016 | -if ( ! function_exists( 'espresso_venue_address' )) { |
|
| 1016 | +if ( ! function_exists('espresso_venue_address')) { |
|
| 1017 | 1017 | /** |
| 1018 | 1018 | * espresso_venue_address |
| 1019 | 1019 | * returns a formatted block of html for displaying a venue's address |
@@ -1023,17 +1023,17 @@ discard block |
||
| 1023 | 1023 | * @param bool $echo |
| 1024 | 1024 | * @return string |
| 1025 | 1025 | */ |
| 1026 | - function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
| 1027 | - if ( $echo ) { |
|
| 1028 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
| 1026 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
| 1027 | + if ($echo) { |
|
| 1028 | + echo EEH_Venue_View::venue_address($type, $VNU_ID); |
|
| 1029 | 1029 | return ''; |
| 1030 | 1030 | } |
| 1031 | - return EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
| 1031 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
| 1032 | 1032 | } |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | |
| 1036 | -if ( ! function_exists( 'espresso_venue_raw_address' )) { |
|
| 1036 | +if ( ! function_exists('espresso_venue_raw_address')) { |
|
| 1037 | 1037 | /** |
| 1038 | 1038 | * espresso_venue_address |
| 1039 | 1039 | * returns an UN-formatted string containing a venue's address |
@@ -1043,17 +1043,17 @@ discard block |
||
| 1043 | 1043 | * @param bool $echo |
| 1044 | 1044 | * @return string |
| 1045 | 1045 | */ |
| 1046 | - function espresso_venue_raw_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
| 1047 | - if ( $echo ) { |
|
| 1048 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
| 1046 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
| 1047 | + if ($echo) { |
|
| 1048 | + echo EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
| 1049 | 1049 | return ''; |
| 1050 | 1050 | } |
| 1051 | - return EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
| 1051 | + return EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
| 1052 | 1052 | } |
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | |
| 1056 | -if ( ! function_exists( 'espresso_venue_has_address' )) { |
|
| 1056 | +if ( ! function_exists('espresso_venue_has_address')) { |
|
| 1057 | 1057 | /** |
| 1058 | 1058 | * espresso_venue_has_address |
| 1059 | 1059 | * returns TRUE or FALSE if a Venue has address information |
@@ -1061,13 +1061,13 @@ discard block |
||
| 1061 | 1061 | * @param int $VNU_ID |
| 1062 | 1062 | * @return bool |
| 1063 | 1063 | */ |
| 1064 | - function espresso_venue_has_address( $VNU_ID = 0 ) { |
|
| 1065 | - return EEH_Venue_View::venue_has_address( $VNU_ID ); |
|
| 1064 | + function espresso_venue_has_address($VNU_ID = 0) { |
|
| 1065 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
| 1066 | 1066 | } |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | |
| 1070 | -if ( ! function_exists( 'espresso_venue_gmap' )) { |
|
| 1070 | +if ( ! function_exists('espresso_venue_gmap')) { |
|
| 1071 | 1071 | /** |
| 1072 | 1072 | * espresso_venue_gmap |
| 1073 | 1073 | * returns a google map for the venue address |
@@ -1078,17 +1078,17 @@ discard block |
||
| 1078 | 1078 | * @param bool $echo |
| 1079 | 1079 | * @return string |
| 1080 | 1080 | */ |
| 1081 | - function espresso_venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE ) { |
|
| 1082 | - if ( $echo ) { |
|
| 1083 | - echo EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
| 1081 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE) { |
|
| 1082 | + if ($echo) { |
|
| 1083 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
| 1084 | 1084 | return ''; |
| 1085 | 1085 | } |
| 1086 | - return EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
| 1086 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
| 1087 | 1087 | } |
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | |
| 1091 | -if ( ! function_exists( 'espresso_venue_phone' )) { |
|
| 1091 | +if ( ! function_exists('espresso_venue_phone')) { |
|
| 1092 | 1092 | /** |
| 1093 | 1093 | * espresso_venue_phone |
| 1094 | 1094 | * |
@@ -1096,18 +1096,18 @@ discard block |
||
| 1096 | 1096 | * @param bool $echo |
| 1097 | 1097 | * @return string |
| 1098 | 1098 | */ |
| 1099 | - function espresso_venue_phone( $VNU_ID = 0, $echo = TRUE ) { |
|
| 1100 | - if ( $echo ) { |
|
| 1101 | - echo EEH_Venue_View::venue_phone( $VNU_ID ); |
|
| 1099 | + function espresso_venue_phone($VNU_ID = 0, $echo = TRUE) { |
|
| 1100 | + if ($echo) { |
|
| 1101 | + echo EEH_Venue_View::venue_phone($VNU_ID); |
|
| 1102 | 1102 | return ''; |
| 1103 | 1103 | } |
| 1104 | - return EEH_Venue_View::venue_phone( $VNU_ID ); |
|
| 1104 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
| 1105 | 1105 | } |
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | 1108 | |
| 1109 | 1109 | |
| 1110 | -if ( ! function_exists( 'espresso_venue_website' )) { |
|
| 1110 | +if ( ! function_exists('espresso_venue_website')) { |
|
| 1111 | 1111 | /** |
| 1112 | 1112 | * espresso_venue_website |
| 1113 | 1113 | * |
@@ -1115,18 +1115,18 @@ discard block |
||
| 1115 | 1115 | * @param bool $echo |
| 1116 | 1116 | * @return string |
| 1117 | 1117 | */ |
| 1118 | - function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) { |
|
| 1119 | - if ( $echo ) { |
|
| 1120 | - echo EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
| 1118 | + function espresso_venue_website($VNU_ID = 0, $echo = TRUE) { |
|
| 1119 | + if ($echo) { |
|
| 1120 | + echo EEH_Venue_View::venue_website_link($VNU_ID); |
|
| 1121 | 1121 | return ''; |
| 1122 | 1122 | } |
| 1123 | - return EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
| 1123 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
| 1124 | 1124 | } |
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | 1127 | |
| 1128 | 1128 | |
| 1129 | -if ( ! function_exists( 'espresso_edit_venue_link' )) { |
|
| 1129 | +if ( ! function_exists('espresso_edit_venue_link')) { |
|
| 1130 | 1130 | /** |
| 1131 | 1131 | * espresso_edit_venue_link |
| 1132 | 1132 | * |
@@ -1134,12 +1134,12 @@ discard block |
||
| 1134 | 1134 | * @param bool $echo |
| 1135 | 1135 | * @return string |
| 1136 | 1136 | */ |
| 1137 | - function espresso_edit_venue_link( $VNU_ID = 0, $echo = TRUE ) { |
|
| 1138 | - if($echo){ |
|
| 1139 | - echo EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
| 1137 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = TRUE) { |
|
| 1138 | + if ($echo) { |
|
| 1139 | + echo EEH_Venue_View::edit_venue_link($VNU_ID); |
|
| 1140 | 1140 | return ''; |
| 1141 | 1141 | } |
| 1142 | - return EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
| 1142 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
| 1143 | 1143 | } |
| 1144 | 1144 | } |
| 1145 | 1145 | |
@@ -22,15 +22,15 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | class EED_Ticket_Selector extends EED_Module { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector |
|
| 27 | - */ |
|
| 28 | - private static $ticket_selector; |
|
| 25 | + /** |
|
| 26 | + * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector |
|
| 27 | + */ |
|
| 28 | + private static $ticket_selector; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton $iframe_embed_button |
|
| 32 | - */ |
|
| 33 | - private static $iframe_embed_button; |
|
| 30 | + /** |
|
| 31 | + * @var EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton $iframe_embed_button |
|
| 32 | + */ |
|
| 33 | + private static $iframe_embed_button; |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | // routing |
| 62 | 62 | EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
| 63 | 63 | EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
| 64 | - EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections'); |
|
| 65 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
| 64 | + EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections'); |
|
| 65 | + add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
| 66 | 66 | add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
| 67 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'translate_js_strings' ), 0 ); |
|
| 68 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
| 69 | - EED_Ticket_Selector::loadIframeAssets(); |
|
| 70 | - } |
|
| 67 | + add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'translate_js_strings' ), 0 ); |
|
| 68 | + add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
| 69 | + EED_Ticket_Selector::loadIframeAssets(); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | |
@@ -86,16 +86,16 @@ discard block |
||
| 86 | 86 | 10 |
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * Make sure assets for the ticket selector are loaded on the espresso registrations route so admin side |
|
| 91 | - * registrations work. |
|
| 92 | - */ |
|
| 89 | + /** |
|
| 90 | + * Make sure assets for the ticket selector are loaded on the espresso registrations route so admin side |
|
| 91 | + * registrations work. |
|
| 92 | + */ |
|
| 93 | 93 | add_action( |
| 94 | - 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_registrations__new_registration', |
|
| 95 | - array('EED_Ticket_Selector', 'set_definitions'), |
|
| 96 | - 10 |
|
| 97 | - ); |
|
| 98 | - } |
|
| 94 | + 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_registrations__new_registration', |
|
| 95 | + array('EED_Ticket_Selector', 'set_definitions'), |
|
| 96 | + 10 |
|
| 97 | + ); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | |
@@ -106,34 +106,34 @@ discard block |
||
| 106 | 106 | * @return void |
| 107 | 107 | */ |
| 108 | 108 | public static function set_definitions() { |
| 109 | - // don't do this twice |
|
| 110 | - if(defined('TICKET_SELECTOR_ASSETS_URL')) { |
|
| 111 | - return; |
|
| 112 | - } |
|
| 109 | + // don't do this twice |
|
| 110 | + if(defined('TICKET_SELECTOR_ASSETS_URL')) { |
|
| 111 | + return; |
|
| 112 | + } |
|
| 113 | 113 | define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
| 114 | 114 | define( |
| 115 | - 'TICKET_SELECTOR_TEMPLATES_PATH', |
|
| 116 | - str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS |
|
| 117 | - ); |
|
| 115 | + 'TICKET_SELECTOR_TEMPLATES_PATH', |
|
| 116 | + str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS |
|
| 117 | + ); |
|
| 118 | 118 | //if config is not set, initialize |
| 119 | 119 | if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) { |
| 120 | - \EED_Ticket_Selector::instance()->set_config(); |
|
| 121 | - \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config(); |
|
| 120 | + \EED_Ticket_Selector::instance()->set_config(); |
|
| 121 | + \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config(); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | - * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector |
|
| 129 | - */ |
|
| 130 | - public static function ticketSelector() |
|
| 131 | - { |
|
| 132 | - if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) { |
|
| 133 | - EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector(); |
|
| 134 | - } |
|
| 135 | - return EED_Ticket_Selector::$ticket_selector; |
|
| 136 | - } |
|
| 128 | + * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector |
|
| 129 | + */ |
|
| 130 | + public static function ticketSelector() |
|
| 131 | + { |
|
| 132 | + if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) { |
|
| 133 | + EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector(); |
|
| 134 | + } |
|
| 135 | + return EED_Ticket_Selector::$ticket_selector; |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -186,15 +186,15 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | |
| 189 | - /** |
|
| 190 | - * creates buttons for selecting number of attendees for an event |
|
| 191 | - * |
|
| 192 | - * @access public |
|
| 193 | - * @param WP_Post|int $event |
|
| 194 | - * @param bool $view_details |
|
| 195 | - * @return string |
|
| 196 | - * @throws \EE_Error |
|
| 197 | - */ |
|
| 189 | + /** |
|
| 190 | + * creates buttons for selecting number of attendees for an event |
|
| 191 | + * |
|
| 192 | + * @access public |
|
| 193 | + * @param WP_Post|int $event |
|
| 194 | + * @param bool $view_details |
|
| 195 | + * @return string |
|
| 196 | + * @throws \EE_Error |
|
| 197 | + */ |
|
| 198 | 198 | public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
| 199 | 199 | return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details ); |
| 200 | 200 | } |
@@ -215,244 +215,244 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | |
| 218 | - /** |
|
| 219 | - * cancel_ticket_selections |
|
| 220 | - * |
|
| 221 | - * @access public |
|
| 222 | - * @return string |
|
| 223 | - */ |
|
| 224 | - public static function cancel_ticket_selections() |
|
| 225 | - { |
|
| 226 | - $form = new ProcessTicketSelector(); |
|
| 227 | - return $form->cancelTicketSelections(); |
|
| 228 | - } |
|
| 218 | + /** |
|
| 219 | + * cancel_ticket_selections |
|
| 220 | + * |
|
| 221 | + * @access public |
|
| 222 | + * @return string |
|
| 223 | + */ |
|
| 224 | + public static function cancel_ticket_selections() |
|
| 225 | + { |
|
| 226 | + $form = new ProcessTicketSelector(); |
|
| 227 | + return $form->cancelTicketSelections(); |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | - * @return void |
|
| 234 | - */ |
|
| 233 | + * @return void |
|
| 234 | + */ |
|
| 235 | 235 | public static function translate_js_strings() { |
| 236 | - EE_Registry::$i18n_js_strings['please_select_date_filter_notice'] = esc_html__( |
|
| 237 | - 'please select a datetime', 'event_espresso' |
|
| 238 | - ); |
|
| 239 | - } |
|
| 236 | + EE_Registry::$i18n_js_strings['please_select_date_filter_notice'] = esc_html__( |
|
| 237 | + 'please select a datetime', 'event_espresso' |
|
| 238 | + ); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | 241 | |
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | - * load js |
|
| 245 | - * |
|
| 246 | - * @access public |
|
| 247 | - * @return void |
|
| 248 | - */ |
|
| 244 | + * load js |
|
| 245 | + * |
|
| 246 | + * @access public |
|
| 247 | + * @return void |
|
| 248 | + */ |
|
| 249 | 249 | public static function load_tckt_slctr_assets() { |
| 250 | 250 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
| 251 | - // add some style |
|
| 252 | - wp_register_style( |
|
| 253 | - 'ticket_selector', |
|
| 254 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css', |
|
| 255 | - array(), |
|
| 256 | - EVENT_ESPRESSO_VERSION |
|
| 257 | - ); |
|
| 258 | - wp_enqueue_style('ticket_selector'); |
|
| 259 | - // make it dance |
|
| 260 | - wp_register_script( |
|
| 261 | - 'ticket_selector', |
|
| 262 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', |
|
| 263 | - array('espresso_core'), |
|
| 264 | - EVENT_ESPRESSO_VERSION, |
|
| 265 | - TRUE |
|
| 266 | - ); |
|
| 251 | + // add some style |
|
| 252 | + wp_register_style( |
|
| 253 | + 'ticket_selector', |
|
| 254 | + TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css', |
|
| 255 | + array(), |
|
| 256 | + EVENT_ESPRESSO_VERSION |
|
| 257 | + ); |
|
| 258 | + wp_enqueue_style('ticket_selector'); |
|
| 259 | + // make it dance |
|
| 260 | + wp_register_script( |
|
| 261 | + 'ticket_selector', |
|
| 262 | + TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', |
|
| 263 | + array('espresso_core'), |
|
| 264 | + EVENT_ESPRESSO_VERSION, |
|
| 265 | + TRUE |
|
| 266 | + ); |
|
| 267 | 267 | wp_enqueue_script('ticket_selector'); |
| 268 | - require_once( EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php'); |
|
| 269 | - \EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
|
| 270 | - } |
|
| 268 | + require_once( EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php'); |
|
| 269 | + \EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
|
| 270 | + } |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * @return void |
|
| 277 | + */ |
|
| 278 | + public static function loadIframeAssets() |
|
| 279 | + { |
|
| 280 | + // for event lists |
|
| 281 | + add_filter( |
|
| 282 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
| 283 | + array('EED_Ticket_Selector', 'iframeCss') |
|
| 284 | + ); |
|
| 285 | + add_filter( |
|
| 286 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
| 287 | + array('EED_Ticket_Selector', 'iframeJs') |
|
| 288 | + ); |
|
| 289 | + // for ticket selectors |
|
| 290 | + add_filter( |
|
| 291 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
| 292 | + array('EED_Ticket_Selector', 'iframeCss') |
|
| 293 | + ); |
|
| 294 | + add_filter( |
|
| 295 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
| 296 | + array('EED_Ticket_Selector', 'iframeJs') |
|
| 297 | + ); |
|
| 298 | + } |
|
| 299 | + |
|
| 300 | + |
|
| 301 | + |
|
| 302 | + /** |
|
| 303 | + * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
| 304 | + * |
|
| 305 | + * @param array $iframe_css |
|
| 306 | + * @return array |
|
| 307 | + */ |
|
| 308 | + public static function iframeCss(array $iframe_css) |
|
| 309 | + { |
|
| 310 | + $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'; |
|
| 311 | + return $iframe_css; |
|
| 271 | 312 | } |
| 272 | 313 | |
| 273 | 314 | |
| 274 | 315 | |
| 275 | - /** |
|
| 276 | - * @return void |
|
| 277 | - */ |
|
| 278 | - public static function loadIframeAssets() |
|
| 279 | - { |
|
| 280 | - // for event lists |
|
| 281 | - add_filter( |
|
| 282 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
| 283 | - array('EED_Ticket_Selector', 'iframeCss') |
|
| 284 | - ); |
|
| 285 | - add_filter( |
|
| 286 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
| 287 | - array('EED_Ticket_Selector', 'iframeJs') |
|
| 288 | - ); |
|
| 289 | - // for ticket selectors |
|
| 290 | - add_filter( |
|
| 291 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
| 292 | - array('EED_Ticket_Selector', 'iframeCss') |
|
| 293 | - ); |
|
| 294 | - add_filter( |
|
| 295 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
| 296 | - array('EED_Ticket_Selector', 'iframeJs') |
|
| 297 | - ); |
|
| 298 | - } |
|
| 299 | - |
|
| 300 | - |
|
| 301 | - |
|
| 302 | - /** |
|
| 303 | - * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
| 304 | - * |
|
| 305 | - * @param array $iframe_css |
|
| 306 | - * @return array |
|
| 307 | - */ |
|
| 308 | - public static function iframeCss(array $iframe_css) |
|
| 309 | - { |
|
| 310 | - $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'; |
|
| 311 | - return $iframe_css; |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - |
|
| 315 | - |
|
| 316 | - /** |
|
| 317 | - * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
| 318 | - * |
|
| 319 | - * @param array $iframe_js |
|
| 320 | - * @return array |
|
| 321 | - */ |
|
| 322 | - public static function iframeJs(array $iframe_js) |
|
| 323 | - { |
|
| 324 | - $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js'; |
|
| 325 | - return $iframe_js; |
|
| 326 | - } |
|
| 316 | + /** |
|
| 317 | + * Informs the rest of the forms system what CSS and JS is needed to display the input |
|
| 318 | + * |
|
| 319 | + * @param array $iframe_js |
|
| 320 | + * @return array |
|
| 321 | + */ |
|
| 322 | + public static function iframeJs(array $iframe_js) |
|
| 323 | + { |
|
| 324 | + $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js'; |
|
| 325 | + return $iframe_js; |
|
| 326 | + } |
|
| 327 | 327 | |
| 328 | 328 | |
| 329 | 329 | /****************************** DEPRECATED ******************************/ |
| 330 | 330 | |
| 331 | 331 | |
| 332 | 332 | |
| 333 | - /** |
|
| 334 | - * @deprecated |
|
| 335 | - * @return string |
|
| 336 | - * @throws \EE_Error |
|
| 337 | - */ |
|
| 338 | - public static function display_view_details_btn() |
|
| 339 | - { |
|
| 340 | - // todo add doing_it_wrong() notice during next major version |
|
| 341 | - return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton(); |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - |
|
| 345 | - |
|
| 346 | - /** |
|
| 347 | - * @deprecated |
|
| 348 | - * @return string |
|
| 349 | - * @throws \EE_Error |
|
| 350 | - */ |
|
| 351 | - public static function display_ticket_selector_submit() |
|
| 352 | - { |
|
| 353 | - // todo add doing_it_wrong() notice during next major version |
|
| 354 | - return EED_Ticket_Selector::ticketSelector()->displaySubmitButton(); |
|
| 355 | - } |
|
| 356 | - |
|
| 357 | - |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * @deprecated |
|
| 361 | - * @param string $permalink_string |
|
| 362 | - * @param int $id |
|
| 363 | - * @param string $new_title |
|
| 364 | - * @param string $new_slug |
|
| 365 | - * @return string |
|
| 366 | - */ |
|
| 367 | - public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '') |
|
| 368 | - { |
|
| 369 | - // todo add doing_it_wrong() notice during next major version |
|
| 370 | - if ( |
|
| 371 | - \EE_Registry::instance()->REQ->get('page') === 'espresso_events' |
|
| 372 | - && \EE_Registry::instance()->REQ->get('action') === 'edit' |
|
| 373 | - ) { |
|
| 374 | - $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
| 375 | - $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
| 376 | - } |
|
| 377 | - return ''; |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - |
|
| 381 | - |
|
| 382 | - /** |
|
| 383 | - * @deprecated |
|
| 384 | - * @param int $ID |
|
| 385 | - * @param string $external_url |
|
| 386 | - * @return string |
|
| 387 | - */ |
|
| 388 | - public static function ticket_selector_form_open($ID = 0, $external_url = '') |
|
| 389 | - { |
|
| 390 | - // todo add doing_it_wrong() notice during next major version |
|
| 391 | - return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url); |
|
| 392 | - } |
|
| 393 | - |
|
| 394 | - |
|
| 395 | - |
|
| 396 | - /** |
|
| 397 | - * @deprecated |
|
| 398 | - * @return string |
|
| 399 | - */ |
|
| 400 | - public static function ticket_selector_form_close() |
|
| 401 | - { |
|
| 402 | - // todo add doing_it_wrong() notice during next major version |
|
| 403 | - return EED_Ticket_Selector::ticketSelector()->formClose(); |
|
| 404 | - } |
|
| 405 | - |
|
| 406 | - |
|
| 407 | - |
|
| 408 | - /** |
|
| 409 | - * @deprecated |
|
| 410 | - * @return string |
|
| 411 | - */ |
|
| 412 | - public static function no_tkt_slctr_end_dv() |
|
| 413 | - { |
|
| 414 | - // todo add doing_it_wrong() notice during next major version |
|
| 415 | - return EED_Ticket_Selector::ticketSelector()->ticketSelectorEndDiv(); |
|
| 416 | - } |
|
| 417 | - |
|
| 418 | - |
|
| 419 | - |
|
| 420 | - /** |
|
| 421 | - * @deprecated 4.9.13 |
|
| 422 | - * @return string |
|
| 423 | - */ |
|
| 424 | - public static function tkt_slctr_end_dv() |
|
| 425 | - { |
|
| 426 | - return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
| 427 | - } |
|
| 428 | - |
|
| 429 | - |
|
| 430 | - |
|
| 431 | - /** |
|
| 432 | - * @deprecated |
|
| 433 | - * @return string |
|
| 434 | - */ |
|
| 435 | - public static function clear_tkt_slctr() |
|
| 436 | - { |
|
| 437 | - return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
| 438 | - } |
|
| 439 | - |
|
| 440 | - |
|
| 441 | - |
|
| 442 | - /** |
|
| 443 | - * @deprecated |
|
| 444 | - */ |
|
| 445 | - public static function load_tckt_slctr_assets_admin() |
|
| 446 | - { |
|
| 447 | - // todo add doing_it_wrong() notice during next major version |
|
| 448 | - if ( |
|
| 449 | - \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events' |
|
| 450 | - && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
|
| 451 | - ) { |
|
| 452 | - $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
| 453 | - $iframe_embed_button->embedButtonAssets(); |
|
| 454 | - } |
|
| 455 | - } |
|
| 333 | + /** |
|
| 334 | + * @deprecated |
|
| 335 | + * @return string |
|
| 336 | + * @throws \EE_Error |
|
| 337 | + */ |
|
| 338 | + public static function display_view_details_btn() |
|
| 339 | + { |
|
| 340 | + // todo add doing_it_wrong() notice during next major version |
|
| 341 | + return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton(); |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + |
|
| 345 | + |
|
| 346 | + /** |
|
| 347 | + * @deprecated |
|
| 348 | + * @return string |
|
| 349 | + * @throws \EE_Error |
|
| 350 | + */ |
|
| 351 | + public static function display_ticket_selector_submit() |
|
| 352 | + { |
|
| 353 | + // todo add doing_it_wrong() notice during next major version |
|
| 354 | + return EED_Ticket_Selector::ticketSelector()->displaySubmitButton(); |
|
| 355 | + } |
|
| 356 | + |
|
| 357 | + |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * @deprecated |
|
| 361 | + * @param string $permalink_string |
|
| 362 | + * @param int $id |
|
| 363 | + * @param string $new_title |
|
| 364 | + * @param string $new_slug |
|
| 365 | + * @return string |
|
| 366 | + */ |
|
| 367 | + public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '') |
|
| 368 | + { |
|
| 369 | + // todo add doing_it_wrong() notice during next major version |
|
| 370 | + if ( |
|
| 371 | + \EE_Registry::instance()->REQ->get('page') === 'espresso_events' |
|
| 372 | + && \EE_Registry::instance()->REQ->get('action') === 'edit' |
|
| 373 | + ) { |
|
| 374 | + $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
| 375 | + $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
| 376 | + } |
|
| 377 | + return ''; |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + |
|
| 381 | + |
|
| 382 | + /** |
|
| 383 | + * @deprecated |
|
| 384 | + * @param int $ID |
|
| 385 | + * @param string $external_url |
|
| 386 | + * @return string |
|
| 387 | + */ |
|
| 388 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') |
|
| 389 | + { |
|
| 390 | + // todo add doing_it_wrong() notice during next major version |
|
| 391 | + return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url); |
|
| 392 | + } |
|
| 393 | + |
|
| 394 | + |
|
| 395 | + |
|
| 396 | + /** |
|
| 397 | + * @deprecated |
|
| 398 | + * @return string |
|
| 399 | + */ |
|
| 400 | + public static function ticket_selector_form_close() |
|
| 401 | + { |
|
| 402 | + // todo add doing_it_wrong() notice during next major version |
|
| 403 | + return EED_Ticket_Selector::ticketSelector()->formClose(); |
|
| 404 | + } |
|
| 405 | + |
|
| 406 | + |
|
| 407 | + |
|
| 408 | + /** |
|
| 409 | + * @deprecated |
|
| 410 | + * @return string |
|
| 411 | + */ |
|
| 412 | + public static function no_tkt_slctr_end_dv() |
|
| 413 | + { |
|
| 414 | + // todo add doing_it_wrong() notice during next major version |
|
| 415 | + return EED_Ticket_Selector::ticketSelector()->ticketSelectorEndDiv(); |
|
| 416 | + } |
|
| 417 | + |
|
| 418 | + |
|
| 419 | + |
|
| 420 | + /** |
|
| 421 | + * @deprecated 4.9.13 |
|
| 422 | + * @return string |
|
| 423 | + */ |
|
| 424 | + public static function tkt_slctr_end_dv() |
|
| 425 | + { |
|
| 426 | + return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
| 427 | + } |
|
| 428 | + |
|
| 429 | + |
|
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * @deprecated |
|
| 433 | + * @return string |
|
| 434 | + */ |
|
| 435 | + public static function clear_tkt_slctr() |
|
| 436 | + { |
|
| 437 | + return EED_Ticket_Selector::ticketSelector()->clearTicketSelector(); |
|
| 438 | + } |
|
| 439 | + |
|
| 440 | + |
|
| 441 | + |
|
| 442 | + /** |
|
| 443 | + * @deprecated |
|
| 444 | + */ |
|
| 445 | + public static function load_tckt_slctr_assets_admin() |
|
| 446 | + { |
|
| 447 | + // todo add doing_it_wrong() notice during next major version |
|
| 448 | + if ( |
|
| 449 | + \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events' |
|
| 450 | + && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
|
| 451 | + ) { |
|
| 452 | + $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
| 453 | + $iframe_embed_button->embedButtonAssets(); |
|
| 454 | + } |
|
| 455 | + } |
|
| 456 | 456 | |
| 457 | 457 | |
| 458 | 458 | } |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | use EventEspresso\modules\ticket_selector\TicketSelectorIframe; |
| 4 | 4 | use EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton; |
| 5 | 5 | |
| 6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 7 | - exit( 'No direct script access allowed' ); |
|
| 6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 7 | + exit('No direct script access allowed'); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | |
@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | * @return EED_Ticket_Selector |
| 39 | 39 | */ |
| 40 | 40 | public static function instance() { |
| 41 | - return parent::get_instance( __CLASS__ ); |
|
| 41 | + return parent::get_instance(__CLASS__); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | |
| 46 | - protected function set_config(){ |
|
| 47 | - $this->set_config_section( 'template_settings' ); |
|
| 48 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
| 49 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
| 46 | + protected function set_config() { |
|
| 47 | + $this->set_config_section('template_settings'); |
|
| 48 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
| 49 | + $this->set_config_name('EED_Ticket_Selector'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public static function set_hooks() { |
| 61 | 61 | // routing |
| 62 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
| 63 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
| 62 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
| 63 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
| 64 | 64 | EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections'); |
| 65 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
| 66 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
| 67 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'translate_js_strings' ), 0 ); |
|
| 68 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
| 65 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
| 66 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
| 67 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'translate_js_strings'), 0); |
|
| 68 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
| 69 | 69 | EED_Ticket_Selector::loadIframeAssets(); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | // to load assets for "espresso_events" page on the "edit" route (action) |
| 83 | 83 | add_action( |
| 84 | 84 | 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__edit', |
| 85 | - array( 'EED_Ticket_Selector', 'ticket_selector_iframe_embed_button' ), |
|
| 85 | + array('EED_Ticket_Selector', 'ticket_selector_iframe_embed_button'), |
|
| 86 | 86 | 10 |
| 87 | 87 | ); |
| 88 | 88 | |
@@ -107,16 +107,16 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public static function set_definitions() { |
| 109 | 109 | // don't do this twice |
| 110 | - if(defined('TICKET_SELECTOR_ASSETS_URL')) { |
|
| 110 | + if (defined('TICKET_SELECTOR_ASSETS_URL')) { |
|
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
| 113 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
| 114 | 114 | define( |
| 115 | 115 | 'TICKET_SELECTOR_TEMPLATES_PATH', |
| 116 | - str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS |
|
| 116 | + str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS |
|
| 117 | 117 | ); |
| 118 | 118 | //if config is not set, initialize |
| 119 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) { |
|
| 119 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config) { |
|
| 120 | 120 | \EED_Ticket_Selector::instance()->set_config(); |
| 121 | 121 | \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config(); |
| 122 | 122 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param WP $WP |
| 144 | 144 | * @return void |
| 145 | 145 | */ |
| 146 | - public function run( $WP ) {} |
|
| 146 | + public function run($WP) {} |
|
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @return \EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton |
| 152 | 152 | */ |
| 153 | 153 | public static function getIframeEmbedButton() { |
| 154 | - if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton ) { |
|
| 154 | + if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton) { |
|
| 155 | 155 | self::$iframe_embed_button = new TicketSelectorIframeEmbedButton(); |
| 156 | 156 | } |
| 157 | 157 | return self::$iframe_embed_button; |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | * @return string |
| 196 | 196 | * @throws \EE_Error |
| 197 | 197 | */ |
| 198 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
| 199 | - return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details ); |
|
| 198 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
| 199 | + return EED_Ticket_Selector::ticketSelector()->display($event, $view_details); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | * @return void |
| 248 | 248 | */ |
| 249 | 249 | public static function load_tckt_slctr_assets() { |
| 250 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
| 250 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
| 251 | 251 | // add some style |
| 252 | 252 | wp_register_style( |
| 253 | 253 | 'ticket_selector', |
| 254 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css', |
|
| 254 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css', |
|
| 255 | 255 | array(), |
| 256 | 256 | EVENT_ESPRESSO_VERSION |
| 257 | 257 | ); |
@@ -259,13 +259,13 @@ discard block |
||
| 259 | 259 | // make it dance |
| 260 | 260 | wp_register_script( |
| 261 | 261 | 'ticket_selector', |
| 262 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', |
|
| 262 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.js', |
|
| 263 | 263 | array('espresso_core'), |
| 264 | 264 | EVENT_ESPRESSO_VERSION, |
| 265 | 265 | TRUE |
| 266 | 266 | ); |
| 267 | 267 | wp_enqueue_script('ticket_selector'); |
| 268 | - require_once( EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php'); |
|
| 268 | + require_once(EE_LIBRARIES.'form_sections/strategies/display/EE_Checkbox_Dropdown_Selector_Display_Strategy.strategy.php'); |
|
| 269 | 269 | \EE_Checkbox_Dropdown_Selector_Display_Strategy::enqueue_styles_and_scripts(); |
| 270 | 270 | } |
| 271 | 271 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | public static function iframeCss(array $iframe_css) |
| 309 | 309 | { |
| 310 | - $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'; |
|
| 310 | + $iframe_css['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'; |
|
| 311 | 311 | return $iframe_css; |
| 312 | 312 | } |
| 313 | 313 | |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | public static function iframeJs(array $iframe_js) |
| 323 | 323 | { |
| 324 | - $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js'; |
|
| 324 | + $iframe_js['ticket_selector'] = TICKET_SELECTOR_ASSETS_URL.'ticket_selector.js'; |
|
| 325 | 325 | return $iframe_js; |
| 326 | 326 | } |
| 327 | 327 | |
@@ -446,8 +446,8 @@ discard block |
||
| 446 | 446 | { |
| 447 | 447 | // todo add doing_it_wrong() notice during next major version |
| 448 | 448 | if ( |
| 449 | - \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events' |
|
| 450 | - && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
|
| 449 | + \EE_Registry::instance()->REQ->get('page') === 'espresso_events' |
|
| 450 | + && \EE_Registry::instance()->REQ->get('action') === 'edit' |
|
| 451 | 451 | ) { |
| 452 | 452 | $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
| 453 | 453 | $iframe_embed_button->embedButtonAssets(); |