@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * @author Mike Nelson |
| 14 | 14 | * |
| 15 | 15 | */ |
| 16 | -class EE_Restriction_Generator_Taxonomy_Protected extends EE_Restriction_Generator_Base{ |
|
| 16 | +class EE_Restriction_Generator_Taxonomy_Protected extends EE_Restriction_Generator_Base { |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Model chain/path to taxonomy model, including the term_taxonomy model itself |
@@ -24,28 +24,28 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @param string $path_to_taxonomy_model Model chain/path to taxonomy model, including the term_taxonomy model itself |
| 26 | 26 | */ |
| 27 | - public function __construct( $path_to_taxonomy_model ){ |
|
| 28 | - if( $path_to_taxonomy_model !== '' && substr( $path_to_taxonomy_model, -1, 1 ) != '.' ) { |
|
| 27 | + public function __construct($path_to_taxonomy_model) { |
|
| 28 | + if ($path_to_taxonomy_model !== '' && substr($path_to_taxonomy_model, -1, 1) != '.') { |
|
| 29 | 29 | $path_to_taxonomy_model .= '.'; |
| 30 | 30 | } |
| 31 | 31 | $this->_path_to_taxonomy_model = $path_to_taxonomy_model; |
| 32 | 32 | } |
| 33 | 33 | protected function _generate_restrictions() { |
| 34 | 34 | //if there are no standard caps for this model, then for allow full access |
| 35 | - if( ! $this->model()->cap_slug() ) { |
|
| 35 | + if ( ! $this->model()->cap_slug()) { |
|
| 36 | 36 | return array( |
| 37 | 37 | ); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return array( |
| 41 | - 'ee_manage_event_categories' => new EE_Default_Where_Conditions( array( |
|
| 42 | - $this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_event_categories' => array( '!=', 'espresso_event_categories' ) |
|
| 41 | + 'ee_manage_event_categories' => new EE_Default_Where_Conditions(array( |
|
| 42 | + $this->_path_to_taxonomy_model.'taxonomy*no_ee_manage_event_categories' => array('!=', 'espresso_event_categories') |
|
| 43 | 43 | )), |
| 44 | - 'ee_manage_venue_categories' => new EE_Default_Where_Conditions( array( |
|
| 45 | - $this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_venue_categories' => array( '!=', 'espresso_venue_categories' ) |
|
| 44 | + 'ee_manage_venue_categories' => new EE_Default_Where_Conditions(array( |
|
| 45 | + $this->_path_to_taxonomy_model.'taxonomy*no_ee_manage_venue_categories' => array('!=', 'espresso_venue_categories') |
|
| 46 | 46 | )), |
| 47 | - 'ee_manage_event_types' => new EE_Default_Where_Conditions( array( |
|
| 48 | - $this->_path_to_taxonomy_model . 'taxonomy*ee_manage_event_types' => array( '!=', 'espresso_event_types' ) |
|
| 47 | + 'ee_manage_event_types' => new EE_Default_Where_Conditions(array( |
|
| 48 | + $this->_path_to_taxonomy_model.'taxonomy*ee_manage_event_types' => array('!=', 'espresso_event_types') |
|
| 49 | 49 | )), |
| 50 | 50 | ); |
| 51 | 51 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @author Mike Nelson |
| 16 | 16 | * |
| 17 | 17 | */ |
| 18 | -class EE_Restriction_Generator_WP_User extends EE_Restriction_Generator_Base{ |
|
| 18 | +class EE_Restriction_Generator_WP_User extends EE_Restriction_Generator_Base { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @return \EE_Default_Where_Conditions |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | return array( |
| 26 | 26 | //if they can't access users, they can still access themselves |
| 27 | - EE_Restriction_Generator_Base::get_cap_name( $this->model(), $this->action() ) => new EE_Default_Where_Conditions( array( |
|
| 27 | + EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) => new EE_Default_Where_Conditions(array( |
|
| 28 | 28 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder |
| 29 | 29 | )), |
| 30 | 30 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -14,12 +14,12 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | */ |
| 16 | 16 | class EE_Return_None_Where_Conditions extends EE_Default_Where_Conditions { |
| 17 | - protected function _get_default_where_conditions(){ |
|
| 18 | - if( $this->_model->has_primary_key_field() ) { |
|
| 19 | - return array( $this->_model->primary_key_name() => array('<', 0 ) ); |
|
| 20 | - }else{ |
|
| 21 | - $fk_field = $this->_model->get_a_field_of_type( 'EE_Foreign_Key_Field_Base' ); |
|
| 22 | - return array( 'AND*impossible' => array( $fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL' ) ); |
|
| 17 | + protected function _get_default_where_conditions() { |
|
| 18 | + if ($this->_model->has_primary_key_field()) { |
|
| 19 | + return array($this->_model->primary_key_name() => array('<', 0)); |
|
| 20 | + } else { |
|
| 21 | + $fk_field = $this->_model->get_a_field_of_type('EE_Foreign_Key_Field_Base'); |
|
| 22 | + return array('AND*impossible' => array($fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL')); |
|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
| 91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
| 92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
| 93 | - }else{ |
|
| 93 | + } else{ |
|
| 94 | 94 | return parent::finalize_payment_for( $transaction ); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | /* |
| 4 | 4 | * Strategy specifically for adding where conditions specific to CPT models. |
| 5 | 5 | */ |
| 6 | -class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions{ |
|
| 6 | +class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions { |
|
| 7 | 7 | /** |
| 8 | 8 | * Strategy for setting default soft delete where conditions. This strategy will find |
| 9 | 9 | * the field of type 'EE_Trashed_Flag_Field', and add a condition that it be FALSE on all queries involving |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | * Eg, |
| 13 | 13 | * |
| 14 | 14 | */ |
| 15 | - function __construct(){} |
|
| 15 | + function __construct() {} |
|
| 16 | 16 | /** |
| 17 | 17 | * Gets the where default where conditions for a custom post type model |
| 18 | 18 | * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions) |
| 19 | 19 | */ |
| 20 | - protected function _get_default_where_conditions(){ |
|
| 20 | + protected function _get_default_where_conditions() { |
|
| 21 | 21 | $trashed_field_name = $this->deleted_field_name(); |
| 22 | 22 | return array( |
| 23 | 23 | $trashed_field_name => false |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | * @return string |
| 30 | 30 | * @throws EE_Error |
| 31 | 31 | */ |
| 32 | - private function deleted_field_name(){ |
|
| 32 | + private function deleted_field_name() { |
|
| 33 | 33 | $field = $this->_model->get_a_field_of_type('EE_Trashed_Flag_Field'); |
| 34 | - if($field){ |
|
| 34 | + if ($field) { |
|
| 35 | 35 | return $field->get_name(); |
| 36 | - }else{ |
|
| 37 | - throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this))); |
|
| 36 | + } else { |
|
| 37 | + throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this))); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
| 91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
| 92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
| 93 | - }else{ |
|
| 93 | + } else{ |
|
| 94 | 94 | return parent::finalize_payment_for( $transaction ); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -61,10 +61,10 @@ |
||
| 61 | 61 | $first_item = reset($arr); |
| 62 | 62 | if(is_array($first_item)){ |
| 63 | 63 | return true;//yep, there's at least 2 levels to this array |
| 64 | - }else{ |
|
| 64 | + } else{ |
|
| 65 | 65 | return false;//nope, only 1 level |
| 66 | 66 | } |
| 67 | - }else{ |
|
| 67 | + } else{ |
|
| 68 | 68 | return false;//its not an array at all! |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); } |
| 3 | 3 | |
| 4 | -require_once( EE_HELPERS . 'EEH_Base.helper.php' ); |
|
| 4 | +require_once(EE_HELPERS.'EEH_Base.helper.php'); |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * EE_Array |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | * @param array $array2 an array of objects |
| 27 | 27 | * @return array an array of objects found in array 1 that aren't found in array 2. |
| 28 | 28 | */ |
| 29 | - public static function object_array_diff( $array1, $array2 ) { |
|
| 30 | - return array_udiff( $array1, $array2, array('self', '_compare_objects' )); |
|
| 29 | + public static function object_array_diff($array1, $array2) { |
|
| 30 | + return array_udiff($array1, $array2, array('self', '_compare_objects')); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @param array $arr |
| 36 | 36 | * @return boolean |
| 37 | 37 | */ |
| 38 | - public static function is_associative_array($arr){ |
|
| 38 | + public static function is_associative_array($arr) { |
|
| 39 | 39 | return array_keys($arr) !== range(0, count($arr) - 1); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param array $arr |
| 46 | 46 | * @return mixed what ever is in the array |
| 47 | 47 | */ |
| 48 | - public static function get_one_item_from_array($arr){ |
|
| 48 | + public static function get_one_item_from_array($arr) { |
|
| 49 | 49 | $item = end($arr); |
| 50 | 50 | reset($arr); |
| 51 | 51 | return $item; |
@@ -56,16 +56,16 @@ discard block |
||
| 56 | 56 | * @param mixed $arr |
| 57 | 57 | * @return boolean |
| 58 | 58 | */ |
| 59 | - public static function is_multi_dimensional_array($arr){ |
|
| 60 | - if(is_array($arr)){ |
|
| 59 | + public static function is_multi_dimensional_array($arr) { |
|
| 60 | + if (is_array($arr)) { |
|
| 61 | 61 | $first_item = reset($arr); |
| 62 | - if(is_array($first_item)){ |
|
| 63 | - return true;//yep, there's at least 2 levels to this array |
|
| 64 | - }else{ |
|
| 65 | - return false;//nope, only 1 level |
|
| 62 | + if (is_array($first_item)) { |
|
| 63 | + return true; //yep, there's at least 2 levels to this array |
|
| 64 | + } else { |
|
| 65 | + return false; //nope, only 1 level |
|
| 66 | 66 | } |
| 67 | - }else{ |
|
| 68 | - return false;//its not an array at all! |
|
| 67 | + } else { |
|
| 68 | + return false; //its not an array at all! |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | * @param mixed $default |
| 77 | 77 | * @return mixed |
| 78 | 78 | */ |
| 79 | - public static function is_set( $arr, $index, $default ) { |
|
| 80 | - return isset( $arr[ $index ] ) ? $arr[ $index ] : $default; |
|
| 79 | + public static function is_set($arr, $index, $default) { |
|
| 80 | + return isset($arr[$index]) ? $arr[$index] : $default; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | * @param mixed $value usually a string, but could be an array or object |
| 86 | 86 | * @return mixed the UNserialized data |
| 87 | 87 | */ |
| 88 | - public static function maybe_unserialize( $value ) { |
|
| 88 | + public static function maybe_unserialize($value) { |
|
| 89 | 89 | $data = maybe_unserialize($value); |
| 90 | 90 | //it's possible that this still has serialized data if its the session. WP has a bug, http://core.trac.wordpress.org/ticket/26118 that doesnt' unserialize this automatically. |
| 91 | 91 | $token = 'C'; |
| 92 | 92 | $data = is_string($data) ? trim($data) : $data; |
| 93 | - if ( is_string($data) && strlen($data) > 1 && $data[0] == $token && preg_match( "/^{$token}:[0-9]+:/s", $data ) ) { |
|
| 93 | + if (is_string($data) && strlen($data) > 1 && $data[0] == $token && preg_match("/^{$token}:[0-9]+:/s", $data)) { |
|
| 94 | 94 | return unserialize($data); |
| 95 | 95 | } else { |
| 96 | 96 | return $data; |
@@ -109,30 +109,30 @@ discard block |
||
| 109 | 109 | * @param bool $preserve_keys whether or not to reset numerically indexed arrays |
| 110 | 110 | * @return array |
| 111 | 111 | */ |
| 112 | - public static function insert_into_array( $target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true ) { |
|
| 112 | + public static function insert_into_array($target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true) { |
|
| 113 | 113 | // ensure incoming arrays are actually arrays |
| 114 | - $target_array = (array)$target_array; |
|
| 115 | - $array_to_insert = (array)$array_to_insert; |
|
| 114 | + $target_array = (array) $target_array; |
|
| 115 | + $array_to_insert = (array) $array_to_insert; |
|
| 116 | 116 | // if no offset key was supplied |
| 117 | - if ( empty( $offset )) { |
|
| 117 | + if (empty($offset)) { |
|
| 118 | 118 | // use start or end of $target_array based on whether we are adding before or not |
| 119 | - $offset = $add_before ? 0 : count( $target_array ); |
|
| 119 | + $offset = $add_before ? 0 : count($target_array); |
|
| 120 | 120 | } |
| 121 | 121 | // if offset key is a string, then find the corresponding numeric location for that element |
| 122 | - $offset = is_int( $offset ) ? $offset : array_search( $offset, array_keys( $target_array ) ); |
|
| 122 | + $offset = is_int($offset) ? $offset : array_search($offset, array_keys($target_array)); |
|
| 123 | 123 | // add one to the offset if adding after |
| 124 | 124 | $offset = $add_before ? $offset : $offset + 1; |
| 125 | 125 | // but ensure offset does not exceed the length of the array |
| 126 | - $offset = $offset > count( $target_array ) ? count( $target_array ) : $offset; |
|
| 126 | + $offset = $offset > count($target_array) ? count($target_array) : $offset; |
|
| 127 | 127 | // reindex array ??? |
| 128 | - if ( $preserve_keys ) { |
|
| 128 | + if ($preserve_keys) { |
|
| 129 | 129 | // take a slice of the target array from the beginning till the offset, |
| 130 | 130 | // then add the new data |
| 131 | 131 | // then add another slice that starts at the offset and goes till the end |
| 132 | - return array_slice( $target_array, 0, $offset, true ) + $array_to_insert + array_slice( $target_array, $offset, null, true ); |
|
| 132 | + return array_slice($target_array, 0, $offset, true) + $array_to_insert + array_slice($target_array, $offset, null, true); |
|
| 133 | 133 | } else { |
| 134 | 134 | // since we don't want to preserve keys, we can use array_splice |
| 135 | - array_splice( $target_array, $offset, 0, $array_to_insert ); |
|
| 135 | + array_splice($target_array, $offset, 0, $array_to_insert); |
|
| 136 | 136 | return $target_array; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | private static $_instance = NULL; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * $_autoloaders |
|
| 27 | - * @var array $_autoloaders |
|
| 28 | - * @access private |
|
| 29 | - */ |
|
| 26 | + * $_autoloaders |
|
| 27 | + * @var array $_autoloaders |
|
| 28 | + * @access private |
|
| 29 | + */ |
|
| 30 | 30 | private static $_autoloaders; |
| 31 | 31 | |
| 32 | 32 | |
@@ -6,8 +6,9 @@ |
||
| 6 | 6 | * @package Event Espresso |
| 7 | 7 | * @subpackage messages |
| 8 | 8 | */ |
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 10 | 10 | exit('NO direct script access allowed'); |
| 11 | +} |
|
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | * @return \EEH_Autoloader |
| 41 | 41 | */ |
| 42 | 42 | private function __construct() { |
| 43 | - if ( self::$_autoloaders === null ) { |
|
| 43 | + if (self::$_autoloaders === null) { |
|
| 44 | 44 | self::$_autoloaders = array(); |
| 45 | 45 | $this->_register_custom_autoloaders(); |
| 46 | - spl_autoload_register( array( $this, 'espresso_autoloader' ) ); |
|
| 46 | + spl_autoload_register(array($this, 'espresso_autoloader')); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public static function instance() { |
| 57 | 57 | // check if class object is instantiated |
| 58 | - if ( ! self::$_instance instanceof EEH_Autoloader ) { |
|
| 58 | + if ( ! self::$_instance instanceof EEH_Autoloader) { |
|
| 59 | 59 | self::$_instance = new self(); |
| 60 | 60 | } |
| 61 | 61 | return self::$_instance; |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | * @internal param string $class_name - simple class name ie: session |
| 73 | 73 | * @return void |
| 74 | 74 | */ |
| 75 | - public static function espresso_autoloader( $class_name ) { |
|
| 76 | - if ( isset( self::$_autoloaders[ $class_name ] ) ) { |
|
| 77 | - require_once( self::$_autoloaders[ $class_name ] ); |
|
| 75 | + public static function espresso_autoloader($class_name) { |
|
| 76 | + if (isset(self::$_autoloaders[$class_name])) { |
|
| 77 | + require_once(self::$_autoloaders[$class_name]); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
@@ -90,26 +90,26 @@ discard block |
||
| 90 | 90 | * @return void |
| 91 | 91 | * @throws \EE_Error |
| 92 | 92 | */ |
| 93 | - public static function register_autoloader( $class_paths, $read_check = true, $debug = false ) { |
|
| 94 | - $class_paths = is_array( $class_paths ) ? $class_paths : array( $class_paths ); |
|
| 95 | - foreach ( $class_paths as $class => $path ) { |
|
| 93 | + public static function register_autoloader($class_paths, $read_check = true, $debug = false) { |
|
| 94 | + $class_paths = is_array($class_paths) ? $class_paths : array($class_paths); |
|
| 95 | + foreach ($class_paths as $class => $path) { |
|
| 96 | 96 | // don't give up! you gotta... |
| 97 | 97 | // get some class |
| 98 | - if ( empty( $class )) { |
|
| 99 | - throw new EE_Error ( sprintf( __( 'No Class name was specified while registering an autoloader for the following path: %s.','event_espresso' ), $path )); |
|
| 98 | + if (empty($class)) { |
|
| 99 | + throw new EE_Error(sprintf(__('No Class name was specified while registering an autoloader for the following path: %s.', 'event_espresso'), $path)); |
|
| 100 | 100 | } |
| 101 | 101 | // one day you will find the path young grasshopper |
| 102 | - if ( empty( $path )) { |
|
| 103 | - throw new EE_Error ( sprintf( __( 'No path was specified while registering an autoloader for the %s class.','event_espresso' ), $class )); |
|
| 102 | + if (empty($path)) { |
|
| 103 | + throw new EE_Error(sprintf(__('No path was specified while registering an autoloader for the %s class.', 'event_espresso'), $class)); |
|
| 104 | 104 | } |
| 105 | 105 | // is file readable ? |
| 106 | - if ( $read_check && ! is_readable( $path )) { |
|
| 107 | - throw new EE_Error ( sprintf( __( 'The file for the %s class could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s','event_espresso' ), $class, $path )); |
|
| 106 | + if ($read_check && ! is_readable($path)) { |
|
| 107 | + throw new EE_Error(sprintf(__('The file for the %s class could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), $class, $path)); |
|
| 108 | 108 | } |
| 109 | - if ( ! isset( self::$_autoloaders[ $class ] )) { |
|
| 110 | - self::$_autoloaders[ $class ] = str_replace( array( '/', '\\' ), DS, $path ); |
|
| 111 | - if ( WP_DEBUG && $debug ) { |
|
| 112 | - EEH_Debug_Tools::printr( self::$_autoloaders[ $class ], $class, __FILE__, __LINE__ ); |
|
| 109 | + if ( ! isset(self::$_autoloaders[$class])) { |
|
| 110 | + self::$_autoloaders[$class] = str_replace(array('/', '\\'), DS, $path); |
|
| 111 | + if (WP_DEBUG && $debug) { |
|
| 112 | + EEH_Debug_Tools::printr(self::$_autoloaders[$class], $class, __FILE__, __LINE__); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | * @return void |
| 139 | 139 | */ |
| 140 | 140 | private function _register_custom_autoloaders() { |
| 141 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'interfaces' ); |
|
| 142 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE ); |
|
| 143 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_INTERFACES, true ); |
|
| 144 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_MODELS, true ); |
|
| 145 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CLASSES ); |
|
| 146 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_FORM_SECTIONS, true ); |
|
| 141 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces'); |
|
| 142 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE); |
|
| 143 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_INTERFACES, true); |
|
| 144 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_MODELS, true); |
|
| 145 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CLASSES); |
|
| 146 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_FORM_SECTIONS, true); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @return void |
| 170 | 170 | */ |
| 171 | 171 | public static function register_line_item_display_autoloaders() { |
| 172 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'line_item_display' , true ); |
|
| 172 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_display', true); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @return void |
| 183 | 183 | */ |
| 184 | 184 | public static function register_line_item_filter_autoloaders() { |
| 185 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'line_item_filters' , true ); |
|
| 185 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_filters', true); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @return void |
| 196 | 196 | */ |
| 197 | 197 | public static function register_template_part_autoloaders() { |
| 198 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'template_parts', true ); |
|
| 198 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'template_parts', true); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | |
@@ -213,30 +213,30 @@ discard block |
||
| 213 | 213 | * @return void |
| 214 | 214 | * @throws \EE_Error |
| 215 | 215 | */ |
| 216 | - public static function register_autoloaders_for_each_file_in_folder( $folder, $recursive = false, $debug = false ){ |
|
| 216 | + public static function register_autoloaders_for_each_file_in_folder($folder, $recursive = false, $debug = false) { |
|
| 217 | 217 | // make sure last char is a / |
| 218 | - $folder .= $folder[strlen($folder)-1] != DS ? DS : ''; |
|
| 218 | + $folder .= $folder[strlen($folder) - 1] != DS ? DS : ''; |
|
| 219 | 219 | $class_to_filepath_map = array(); |
| 220 | - $exclude = array( 'index' ); |
|
| 220 | + $exclude = array('index'); |
|
| 221 | 221 | //get all the files in that folder that end in php |
| 222 | - $filepaths = glob( $folder.'*'); |
|
| 222 | + $filepaths = glob($folder.'*'); |
|
| 223 | 223 | |
| 224 | - if ( empty( $filepaths ) ) { |
|
| 224 | + if (empty($filepaths)) { |
|
| 225 | 225 | return; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - foreach( $filepaths as $filepath ) { |
|
| 229 | - if ( substr( $filepath, -4, 4 ) == '.php' ) { |
|
| 230 | - $class_name = EEH_File::get_classname_from_filepath_with_standard_filename( $filepath ); |
|
| 231 | - if ( ! in_array( $class_name, $exclude )) { |
|
| 232 | - $class_to_filepath_map [ $class_name ] = $filepath; |
|
| 228 | + foreach ($filepaths as $filepath) { |
|
| 229 | + if (substr($filepath, -4, 4) == '.php') { |
|
| 230 | + $class_name = EEH_File::get_classname_from_filepath_with_standard_filename($filepath); |
|
| 231 | + if ( ! in_array($class_name, $exclude)) { |
|
| 232 | + $class_to_filepath_map [$class_name] = $filepath; |
|
| 233 | 233 | } |
| 234 | - } else if ( $recursive ) { |
|
| 235 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $filepath, $recursive ); |
|
| 234 | + } else if ($recursive) { |
|
| 235 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($filepath, $recursive); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | // we remove the necessity to do a is_readable() check via the $read_check flag because glob by nature will not return non_readable files/directories. |
| 239 | - self::register_autoloader( $class_to_filepath_map, false, $debug ); |
|
| 239 | + self::register_autoloader($class_to_filepath_map, false, $debug); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | * @ override magic methods |
| 34 | 34 | * @ return void |
| 35 | 35 | */ |
| 36 | - public function __set($a,$b) { return FALSE; } |
|
| 36 | + public function __set($a, $b) { return FALSE; } |
|
| 37 | 37 | public function __get($a) { return FALSE; } |
| 38 | 38 | public function __isset($a) { return FALSE; } |
| 39 | 39 | public function __unset($a) { return FALSE; } |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -35,35 +35,35 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public static function get_called_class() { |
| 37 | 37 | $backtrace = debug_backtrace(); |
| 38 | - if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['class'] ) && ! isset( $backtrace[2]['file'] )) { |
|
| 38 | + if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['class']) && ! isset($backtrace[2]['file'])) { |
|
| 39 | 39 | return $backtrace[2]['class']; |
| 40 | - } else if ( isset( $backtrace[3] ) && is_array( $backtrace[3] ) && isset( $backtrace[3]['class'] ) && ! isset( $backtrace[3]['file'] )) { |
|
| 40 | + } else if (isset($backtrace[3]) && is_array($backtrace[3]) && isset($backtrace[3]['class']) && ! isset($backtrace[3]['file'])) { |
|
| 41 | 41 | return $backtrace[3]['class']; |
| 42 | - } else if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['file'] ) && isset( $backtrace[2]['line'] )) { |
|
| 43 | - if ( self::$file_line == $backtrace[2]['file'] . $backtrace[2]['line'] ) { |
|
| 42 | + } else if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['file']) && isset($backtrace[2]['line'])) { |
|
| 43 | + if (self::$file_line == $backtrace[2]['file'].$backtrace[2]['line']) { |
|
| 44 | 44 | self::$i++; |
| 45 | 45 | } else { |
| 46 | 46 | self::$i = 0; |
| 47 | - self::$file_line = $backtrace[2]['file'] . $backtrace[2]['line']; |
|
| 47 | + self::$file_line = $backtrace[2]['file'].$backtrace[2]['line']; |
|
| 48 | 48 | } |
| 49 | 49 | // was class method called via call_user_func ? |
| 50 | - if ( $backtrace[2]['function'] == 'call_user_func' && isset( $backtrace[2]['args'] ) && is_array( $backtrace[2]['args'] )){ |
|
| 51 | - if ( isset( $backtrace[2]['args'][0] ) && isset( $backtrace[2]['args'][0][0] )) { |
|
| 50 | + if ($backtrace[2]['function'] == 'call_user_func' && isset($backtrace[2]['args']) && is_array($backtrace[2]['args'])) { |
|
| 51 | + if (isset($backtrace[2]['args'][0]) && isset($backtrace[2]['args'][0][0])) { |
|
| 52 | 52 | $called_class = $backtrace[2]['args'][0][0]; |
| 53 | 53 | // is it an EE function ? |
| 54 | - if ( strpos( $called_class, 'EE' ) === 0 ) { |
|
| 55 | - $prefix_chars = strpos( $called_class, '_' ) + 1; |
|
| 56 | - $prefix = substr( $called_class, 0, $prefix_chars ); |
|
| 57 | - $classname = substr( $called_class, $prefix_chars, strlen( $called_class )); |
|
| 58 | - $classname = $prefix . str_replace( ' ', '_', ucwords( strtolower( str_replace( '_', ' ', $classname )))); |
|
| 54 | + if (strpos($called_class, 'EE') === 0) { |
|
| 55 | + $prefix_chars = strpos($called_class, '_') + 1; |
|
| 56 | + $prefix = substr($called_class, 0, $prefix_chars); |
|
| 57 | + $classname = substr($called_class, $prefix_chars, strlen($called_class)); |
|
| 58 | + $classname = $prefix.str_replace(' ', '_', ucwords(strtolower(str_replace('_', ' ', $classname)))); |
|
| 59 | 59 | return $classname; |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } else { |
| 63 | - $lines = file( $backtrace[2]['file'] ); |
|
| 64 | - preg_match_all( '/([a-zA-Z0-9\_]+)::' . $backtrace[2]['function'] . '/', $lines[$backtrace[2]['line']-1], $matches ); |
|
| 65 | - if ( isset( $matches[1] ) && isset( $matches[1][ self::$i ] )) { |
|
| 66 | - return $matches[1][ self::$i ]; |
|
| 63 | + $lines = file($backtrace[2]['file']); |
|
| 64 | + preg_match_all('/([a-zA-Z0-9\_]+)::'.$backtrace[2]['function'].'/', $lines[$backtrace[2]['line'] - 1], $matches); |
|
| 65 | + if (isset($matches[1]) && isset($matches[1][self::$i])) { |
|
| 66 | + return $matches[1][self::$i]; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -80,22 +80,22 @@ discard block |
||
| 80 | 80 | * @param string $hook |
| 81 | 81 | * @return array |
| 82 | 82 | */ |
| 83 | - public static function get_class_names_for_all_callbacks_on_hook( $hook = NULL ) { |
|
| 83 | + public static function get_class_names_for_all_callbacks_on_hook($hook = NULL) { |
|
| 84 | 84 | global $wp_filter; |
| 85 | 85 | $class_names = array(); |
| 86 | 86 | // are any callbacks registered for this hook ? |
| 87 | - if ( isset( $wp_filter[ $hook ] )) { |
|
| 87 | + if (isset($wp_filter[$hook])) { |
|
| 88 | 88 | // loop thru all of the callbacks attached to the deprecated hookpoint |
| 89 | - foreach( $wp_filter[ $hook ] as $priority ) { |
|
| 90 | - foreach( $priority as $callback ) { |
|
| 89 | + foreach ($wp_filter[$hook] as $priority) { |
|
| 90 | + foreach ($priority as $callback) { |
|
| 91 | 91 | // is the callback a non-static class method ? |
| 92 | - if ( isset( $callback['function'] ) && is_array( $callback['function'] )) { |
|
| 93 | - if ( isset( $callback['function'][0] ) && is_object( $callback['function'][0] )) { |
|
| 94 | - $class_names[] = get_class( $callback['function'][0] ); |
|
| 92 | + if (isset($callback['function']) && is_array($callback['function'])) { |
|
| 93 | + if (isset($callback['function'][0]) && is_object($callback['function'][0])) { |
|
| 94 | + $class_names[] = get_class($callback['function'][0]); |
|
| 95 | 95 | } |
| 96 | 96 | // test for static method |
| 97 | - } else if ( strpos( $callback['function'], '::' ) !== FALSE ) { |
|
| 98 | - $class = explode( '::', $callback['function'] ); |
|
| 97 | + } else if (strpos($callback['function'], '::') !== FALSE) { |
|
| 98 | + $class = explode('::', $callback['function']); |
|
| 99 | 99 | $class_names[] = $class[0]; |
| 100 | 100 | } else { |
| 101 | 101 | // just a function |
@@ -116,24 +116,24 @@ discard block |
||
| 116 | 116 | * @param string $property |
| 117 | 117 | * @return boolean |
| 118 | 118 | */ |
| 119 | - public static function has_property( $class = NULL, $property = NULL ) { |
|
| 119 | + public static function has_property($class = NULL, $property = NULL) { |
|
| 120 | 120 | // if $class or $property don't exist, then get out, cuz that would be like... fatal dude |
| 121 | - if ( empty( $class ) || empty( $property )) { |
|
| 121 | + if (empty($class) || empty($property)) { |
|
| 122 | 122 | return FALSE; |
| 123 | 123 | } |
| 124 | 124 | // if your hosting company doesn't cut the mustard |
| 125 | - if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) { |
|
| 125 | + if (version_compare(PHP_VERSION, '5.3.0') < 0) { |
|
| 126 | 126 | // just in case $class is an actual instantiated object |
| 127 | - if ( is_object( $class )) { |
|
| 128 | - return isset( $class->$property ) ? TRUE : FALSE; |
|
| 127 | + if (is_object($class)) { |
|
| 128 | + return isset($class->$property) ? TRUE : FALSE; |
|
| 129 | 129 | } else { |
| 130 | 130 | // use reflection for < PHP 5.3 to get details using just the class name |
| 131 | - $reflector = new ReflectionClass( $class ); |
|
| 132 | - return $reflector->hasProperty( $property ); |
|
| 131 | + $reflector = new ReflectionClass($class); |
|
| 132 | + return $reflector->hasProperty($property); |
|
| 133 | 133 | } |
| 134 | 134 | } else { |
| 135 | 135 | // or try regular property exists method which works as expected in PHP 5.3+ |
| 136 | - return property_exists( $class, $property ); |
|
| 136 | + return property_exists($class, $property); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | // if PHP version < 5.3 |
| 146 | -if ( ! function_exists( 'get_called_class' )) { |
|
| 146 | +if ( ! function_exists('get_called_class')) { |
|
| 147 | 147 | /** |
| 148 | 148 | * @return bool|string |
| 149 | 149 | */ |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -799,7 +799,6 @@ |
||
| 799 | 799 | |
| 800 | 800 | |
| 801 | 801 | /** |
| 802 | - |
|
| 803 | 802 | * |
| 804 | 803 | * If the the first date starts at midnight on one day, and the next date ends at midnight on the |
| 805 | 804 | * very next day then this method will return true. |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | * @return string |
| 54 | 54 | * @throws \EE_Error |
| 55 | 55 | */ |
| 56 | - public static function get_valid_timezone_string( $timezone_string = '' ) { |
|
| 56 | + public static function get_valid_timezone_string($timezone_string = '') { |
|
| 57 | 57 | // if passed a value, then use that, else get WP option |
| 58 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' ); |
|
| 58 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string'); |
|
| 59 | 59 | // value from above exists, use that, else get timezone string from gmt_offset |
| 60 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset(); |
|
| 61 | - EEH_DTT_Helper::validate_timezone( $timezone_string ); |
|
| 60 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset(); |
|
| 61 | + EEH_DTT_Helper::validate_timezone($timezone_string); |
|
| 62 | 62 | return $timezone_string; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -74,18 +74,18 @@ discard block |
||
| 74 | 74 | * @return bool |
| 75 | 75 | * @throws \EE_Error |
| 76 | 76 | */ |
| 77 | - public static function validate_timezone( $timezone_string, $throw_error = true ) { |
|
| 77 | + public static function validate_timezone($timezone_string, $throw_error = true) { |
|
| 78 | 78 | // easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it |
| 79 | 79 | try { |
| 80 | - new DateTimeZone( $timezone_string ); |
|
| 81 | - } catch ( Exception $e ) { |
|
| 80 | + new DateTimeZone($timezone_string); |
|
| 81 | + } catch (Exception $e) { |
|
| 82 | 82 | // sometimes we take exception to exceptions |
| 83 | - if ( ! $throw_error ) { |
|
| 83 | + if ( ! $throw_error) { |
|
| 84 | 84 | return false; |
| 85 | 85 | } |
| 86 | 86 | throw new EE_Error( |
| 87 | 87 | sprintf( |
| 88 | - __( 'The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ), |
|
| 88 | + __('The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'), |
|
| 89 | 89 | $timezone_string, |
| 90 | 90 | '<a href="http://www.php.net/manual/en/timezones.php">', |
| 91 | 91 | '</a>' |
@@ -104,19 +104,19 @@ discard block |
||
| 104 | 104 | * @param string $gmt_offset |
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | - public static function get_timezone_string_from_gmt_offset( $gmt_offset = '' ) { |
|
| 107 | + public static function get_timezone_string_from_gmt_offset($gmt_offset = '') { |
|
| 108 | 108 | $timezone_string = 'UTC'; |
| 109 | - $gmt_offset = ! empty( $gmt_offset ) ? $gmt_offset : get_option( 'gmt_offset' ); |
|
| 110 | - if ( $gmt_offset !== '' ) { |
|
| 109 | + $gmt_offset = ! empty($gmt_offset) ? $gmt_offset : get_option('gmt_offset'); |
|
| 110 | + if ($gmt_offset !== '') { |
|
| 111 | 111 | // convert GMT offset to seconds |
| 112 | 112 | $gmt_offset = $gmt_offset * HOUR_IN_SECONDS; |
| 113 | 113 | // account for WP offsets that aren't valid UTC |
| 114 | - $gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets( $gmt_offset ); |
|
| 114 | + $gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets($gmt_offset); |
|
| 115 | 115 | // although we don't know the TZ abbreviation, we know the UTC offset |
| 116 | - $timezone_string = timezone_name_from_abbr( null, $gmt_offset ); |
|
| 116 | + $timezone_string = timezone_name_from_abbr(null, $gmt_offset); |
|
| 117 | 117 | } |
| 118 | 118 | // better have a valid timezone string by now, but if not, sigh... loop thru the timezone_abbreviations_list()... |
| 119 | - $timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset ); |
|
| 119 | + $timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list($gmt_offset); |
|
| 120 | 120 | return $timezone_string; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | * @param int $gmt_offset |
| 130 | 130 | * @return int |
| 131 | 131 | */ |
| 132 | - public static function adjust_invalid_gmt_offsets( $gmt_offset = 0 ) { |
|
| 132 | + public static function adjust_invalid_gmt_offsets($gmt_offset = 0) { |
|
| 133 | 133 | //make sure $gmt_offset is int |
| 134 | 134 | $gmt_offset = (int) $gmt_offset; |
| 135 | - switch ( $gmt_offset ) { |
|
| 135 | + switch ($gmt_offset) { |
|
| 136 | 136 | |
| 137 | 137 | // case -30600 : |
| 138 | 138 | // $gmt_offset = -28800; |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | * @return string |
| 185 | 185 | * @throws \EE_Error |
| 186 | 186 | */ |
| 187 | - public static function get_timezone_string_from_abbreviations_list( $gmt_offset = 0 ) { |
|
| 187 | + public static function get_timezone_string_from_abbreviations_list($gmt_offset = 0) { |
|
| 188 | 188 | $abbreviations = timezone_abbreviations_list(); |
| 189 | - foreach ( $abbreviations as $abbreviation ) { |
|
| 190 | - foreach ( $abbreviation as $city ) { |
|
| 191 | - if ( $city['offset'] === $gmt_offset && $city['dst'] === FALSE ) { |
|
| 189 | + foreach ($abbreviations as $abbreviation) { |
|
| 190 | + foreach ($abbreviation as $city) { |
|
| 191 | + if ($city['offset'] === $gmt_offset && $city['dst'] === FALSE) { |
|
| 192 | 192 | // check if the timezone is valid but don't throw any errors if it isn't |
| 193 | - if ( EEH_DTT_Helper::validate_timezone( $city['timezone_id'], false ) ) { |
|
| 193 | + if (EEH_DTT_Helper::validate_timezone($city['timezone_id'], false)) { |
|
| 194 | 194 | return $city['timezone_id']; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | throw new EE_Error( |
| 200 | 200 | sprintf( |
| 201 | - __( 'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ), |
|
| 201 | + __('The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'), |
|
| 202 | 202 | $gmt_offset, |
| 203 | 203 | '<a href="http://www.php.net/manual/en/timezones.php">', |
| 204 | 204 | '</a>' |
@@ -212,23 +212,23 @@ discard block |
||
| 212 | 212 | * @access public |
| 213 | 213 | * @param string $timezone_string |
| 214 | 214 | */ |
| 215 | - public static function timezone_select_input( $timezone_string = '' ) { |
|
| 215 | + public static function timezone_select_input($timezone_string = '') { |
|
| 216 | 216 | // get WP date time format |
| 217 | - $datetime_format = get_option('date_format') . ' ' . get_option('time_format'); |
|
| 217 | + $datetime_format = get_option('date_format').' '.get_option('time_format'); |
|
| 218 | 218 | // if passed a value, then use that, else get WP option |
| 219 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' ); |
|
| 219 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string'); |
|
| 220 | 220 | // check if the timezone is valid but don't throw any errors if it isn't |
| 221 | - $timezone_string = EEH_DTT_Helper::validate_timezone( $timezone_string, false ); |
|
| 221 | + $timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false); |
|
| 222 | 222 | $gmt_offset = get_option('gmt_offset'); |
| 223 | 223 | |
| 224 | 224 | $check_zone_info = true; |
| 225 | - if ( empty( $timezone_string )) { |
|
| 225 | + if (empty($timezone_string)) { |
|
| 226 | 226 | // Create a UTC+- zone if no timezone string exists |
| 227 | 227 | $check_zone_info = false; |
| 228 | - if ( $gmt_offset > 0 ) { |
|
| 229 | - $timezone_string = 'UTC+' . $gmt_offset; |
|
| 230 | - } elseif ( $gmt_offset < 0 ) { |
|
| 231 | - $timezone_string = 'UTC' . $gmt_offset; |
|
| 228 | + if ($gmt_offset > 0) { |
|
| 229 | + $timezone_string = 'UTC+'.$gmt_offset; |
|
| 230 | + } elseif ($gmt_offset < 0) { |
|
| 231 | + $timezone_string = 'UTC'.$gmt_offset; |
|
| 232 | 232 | } else { |
| 233 | 233 | $timezone_string = 'UTC'; |
| 234 | 234 | } |
@@ -250,11 +250,11 @@ discard block |
||
| 250 | 250 | __('%1$sUTC%2$s time is %3$s'), |
| 251 | 251 | '<abbr title="Coordinated Universal Time">', |
| 252 | 252 | '</abbr>', |
| 253 | - '<code>' . date_i18n( $datetime_format , false, 'gmt') . '</code>' |
|
| 253 | + '<code>'.date_i18n($datetime_format, false, 'gmt').'</code>' |
|
| 254 | 254 | ); |
| 255 | 255 | ?></span> |
| 256 | - <?php if ( ! empty( $timezone_string ) || ! empty( $gmt_offset )) : ?> |
|
| 257 | - <br /><span><?php printf(__('Local time is %1$s'), '<code>' . date_i18n( $datetime_format ) . '</code>' ); ?></span> |
|
| 256 | + <?php if ( ! empty($timezone_string) || ! empty($gmt_offset)) : ?> |
|
| 257 | + <br /><span><?php printf(__('Local time is %1$s'), '<code>'.date_i18n($datetime_format).'</code>'); ?></span> |
|
| 258 | 258 | <?php endif; ?> |
| 259 | 259 | |
| 260 | 260 | <?php if ($check_zone_info && $timezone_string) : ?> |
@@ -286,10 +286,9 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | if ($found) { |
| 288 | 288 | $message = $tr['isdst'] ? |
| 289 | - __(' Daylight saving time begins on: %s.' ) : |
|
| 290 | - __(' Standard time begins on: %s.'); |
|
| 289 | + __(' Daylight saving time begins on: %s.') : __(' Standard time begins on: %s.'); |
|
| 291 | 290 | // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
| 292 | - printf( $message, '<code >' . date_i18n( $datetime_format, $tr['ts'] + ( $tz_offset - $tr['offset'] ) ). '</code >' ); |
|
| 291 | + printf($message, '<code >'.date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])).'</code >'); |
|
| 293 | 292 | } else { |
| 294 | 293 | _e('This timezone does not observe daylight saving time.'); |
| 295 | 294 | } |
@@ -319,14 +318,14 @@ discard block |
||
| 319 | 318 | * |
| 320 | 319 | * @return int $unix_timestamp with the offset applied for the given timezone. |
| 321 | 320 | */ |
| 322 | - public static function get_timestamp_with_offset( $unix_timestamp = 0, $timezone_string = '' ) { |
|
| 321 | + public static function get_timestamp_with_offset($unix_timestamp = 0, $timezone_string = '') { |
|
| 323 | 322 | $unix_timestamp = $unix_timestamp === 0 ? time() : (int) $unix_timestamp; |
| 324 | - $timezone_string = self::get_valid_timezone_string( $timezone_string ); |
|
| 325 | - $TimeZone = new DateTimeZone( $timezone_string ); |
|
| 323 | + $timezone_string = self::get_valid_timezone_string($timezone_string); |
|
| 324 | + $TimeZone = new DateTimeZone($timezone_string); |
|
| 326 | 325 | |
| 327 | - $DateTime = new DateTime( '@' . $unix_timestamp, $TimeZone ); |
|
| 328 | - $offset = timezone_offset_get( $TimeZone, $DateTime ); |
|
| 329 | - return (int)$DateTime->format( 'U' ) + (int)$offset; |
|
| 326 | + $DateTime = new DateTime('@'.$unix_timestamp, $TimeZone); |
|
| 327 | + $offset = timezone_offset_get($TimeZone, $DateTime); |
|
| 328 | + return (int) $DateTime->format('U') + (int) $offset; |
|
| 330 | 329 | } |
| 331 | 330 | |
| 332 | 331 | |
@@ -341,17 +340,17 @@ discard block |
||
| 341 | 340 | * @param string $datetime_field_name the datetime fieldname to be manipulated |
| 342 | 341 | * @return EE_Base_Class |
| 343 | 342 | */ |
| 344 | - protected static function _set_date_time_field( EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name ) { |
|
| 343 | + protected static function _set_date_time_field(EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name) { |
|
| 345 | 344 | // grab current datetime format |
| 346 | 345 | $current_format = $obj->get_format(); |
| 347 | 346 | // set new full timestamp format |
| 348 | - $obj->set_date_format( EE_Datetime_Field::mysql_date_format ); |
|
| 349 | - $obj->set_time_format( EE_Datetime_Field::mysql_time_format ); |
|
| 347 | + $obj->set_date_format(EE_Datetime_Field::mysql_date_format); |
|
| 348 | + $obj->set_time_format(EE_Datetime_Field::mysql_time_format); |
|
| 350 | 349 | // set the new date value using a full timestamp format so that no data is lost |
| 351 | - $obj->set( $datetime_field_name, $DateTime->format( EE_Datetime_Field::mysql_timestamp_format ) ); |
|
| 350 | + $obj->set($datetime_field_name, $DateTime->format(EE_Datetime_Field::mysql_timestamp_format)); |
|
| 352 | 351 | // reset datetime formats |
| 353 | - $obj->set_date_format( $current_format[0] ); |
|
| 354 | - $obj->set_time_format( $current_format[1] ); |
|
| 352 | + $obj->set_date_format($current_format[0]); |
|
| 353 | + $obj->set_time_format($current_format[1]); |
|
| 355 | 354 | return $obj; |
| 356 | 355 | } |
| 357 | 356 | |
@@ -368,11 +367,11 @@ discard block |
||
| 368 | 367 | * @param integer $value what you want to increment the time by |
| 369 | 368 | * @return EE_Base_Class return the EE_Base_Class object so right away you can do something with it (chaining) |
| 370 | 369 | */ |
| 371 | - public static function date_time_add( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) { |
|
| 370 | + public static function date_time_add(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) { |
|
| 372 | 371 | //get the raw UTC date. |
| 373 | - $DateTime = $obj->get_DateTime_object( $datetime_field_name ); |
|
| 374 | - $DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value ); |
|
| 375 | - return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name ); |
|
| 372 | + $DateTime = $obj->get_DateTime_object($datetime_field_name); |
|
| 373 | + $DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value); |
|
| 374 | + return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name); |
|
| 376 | 375 | } |
| 377 | 376 | |
| 378 | 377 | |
@@ -387,11 +386,11 @@ discard block |
||
| 387 | 386 | * @param int $value |
| 388 | 387 | * @return \EE_Base_Class |
| 389 | 388 | */ |
| 390 | - public static function date_time_subtract( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) { |
|
| 389 | + public static function date_time_subtract(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) { |
|
| 391 | 390 | //get the raw UTC date |
| 392 | - $DateTime = $obj->get_DateTime_object( $datetime_field_name ); |
|
| 393 | - $DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value, '-' ); |
|
| 394 | - return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name ); |
|
| 391 | + $DateTime = $obj->get_DateTime_object($datetime_field_name); |
|
| 392 | + $DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value, '-'); |
|
| 393 | + return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name); |
|
| 395 | 394 | } |
| 396 | 395 | |
| 397 | 396 | |
@@ -404,44 +403,44 @@ discard block |
||
| 404 | 403 | * @return \DateTime return whatever type came in. |
| 405 | 404 | * @throws \EE_Error |
| 406 | 405 | */ |
| 407 | - protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) { |
|
| 408 | - if ( ! $DateTime instanceof DateTime ) { |
|
| 406 | + protected static function _modify_datetime_object(DateTime $DateTime, $period = 'years', $value = 1, $operand = '+') { |
|
| 407 | + if ( ! $DateTime instanceof DateTime) { |
|
| 409 | 408 | throw new EE_Error( |
| 410 | 409 | sprintf( |
| 411 | - __( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ), |
|
| 412 | - print_r( $DateTime, true ) |
|
| 410 | + __('Expected a PHP DateTime object, but instead received %1$s', 'event_espresso'), |
|
| 411 | + print_r($DateTime, true) |
|
| 413 | 412 | ) |
| 414 | 413 | ); |
| 415 | 414 | } |
| 416 | - switch ( $period ) { |
|
| 415 | + switch ($period) { |
|
| 417 | 416 | case 'years' : |
| 418 | - $value = 'P' . $value . 'Y'; |
|
| 417 | + $value = 'P'.$value.'Y'; |
|
| 419 | 418 | break; |
| 420 | 419 | case 'months' : |
| 421 | - $value = 'P' . $value . 'M'; |
|
| 420 | + $value = 'P'.$value.'M'; |
|
| 422 | 421 | break; |
| 423 | 422 | case 'weeks' : |
| 424 | - $value = 'P' . $value . 'W'; |
|
| 423 | + $value = 'P'.$value.'W'; |
|
| 425 | 424 | break; |
| 426 | 425 | case 'days' : |
| 427 | - $value = 'P' . $value . 'D'; |
|
| 426 | + $value = 'P'.$value.'D'; |
|
| 428 | 427 | break; |
| 429 | 428 | case 'hours' : |
| 430 | - $value = 'PT' . $value . 'H'; |
|
| 429 | + $value = 'PT'.$value.'H'; |
|
| 431 | 430 | break; |
| 432 | 431 | case 'minutes' : |
| 433 | - $value = 'PT' . $value . 'M'; |
|
| 432 | + $value = 'PT'.$value.'M'; |
|
| 434 | 433 | break; |
| 435 | 434 | case 'seconds' : |
| 436 | - $value = 'PT' . $value . 'S'; |
|
| 435 | + $value = 'PT'.$value.'S'; |
|
| 437 | 436 | break; |
| 438 | 437 | } |
| 439 | - switch ( $operand ) { |
|
| 438 | + switch ($operand) { |
|
| 440 | 439 | case '+': |
| 441 | - $DateTime->add( new DateInterval( $value ) ); |
|
| 440 | + $DateTime->add(new DateInterval($value)); |
|
| 442 | 441 | break; |
| 443 | 442 | case '-': |
| 444 | - $DateTime->sub( new DateInterval( $value ) ); |
|
| 443 | + $DateTime->sub(new DateInterval($value)); |
|
| 445 | 444 | break; |
| 446 | 445 | } |
| 447 | 446 | return $DateTime; |
@@ -457,16 +456,16 @@ discard block |
||
| 457 | 456 | * @return \DateTime return whatever type came in. |
| 458 | 457 | * @throws \EE_Error |
| 459 | 458 | */ |
| 460 | - protected static function _modify_timestamp( $timestamp, $period = 'years', $value = 1, $operand = '+' ) { |
|
| 461 | - if ( ! preg_match( EE_Datetime_Field::unix_timestamp_regex, $timestamp ) ) { |
|
| 459 | + protected static function _modify_timestamp($timestamp, $period = 'years', $value = 1, $operand = '+') { |
|
| 460 | + if ( ! preg_match(EE_Datetime_Field::unix_timestamp_regex, $timestamp)) { |
|
| 462 | 461 | throw new EE_Error( |
| 463 | 462 | sprintf( |
| 464 | - __( 'Expected a Unix timestamp, but instead received %1$s', 'event_espresso' ), |
|
| 465 | - print_r( $timestamp, true ) |
|
| 463 | + __('Expected a Unix timestamp, but instead received %1$s', 'event_espresso'), |
|
| 464 | + print_r($timestamp, true) |
|
| 466 | 465 | ) |
| 467 | 466 | ); |
| 468 | 467 | } |
| 469 | - switch ( $period ) { |
|
| 468 | + switch ($period) { |
|
| 470 | 469 | case 'years' : |
| 471 | 470 | $value = YEAR_IN_SECONDS * $value; |
| 472 | 471 | break; |
@@ -486,9 +485,9 @@ discard block |
||
| 486 | 485 | $value = MINUTE_IN_SECONDS * $value; |
| 487 | 486 | break; |
| 488 | 487 | } |
| 489 | - switch ( $operand ) { |
|
| 488 | + switch ($operand) { |
|
| 490 | 489 | case '+': |
| 491 | - $timestamp += $value; |
|
| 490 | + $timestamp += $value; |
|
| 492 | 491 | break; |
| 493 | 492 | case '-': |
| 494 | 493 | $timestamp -= $value; |
@@ -508,11 +507,11 @@ discard block |
||
| 508 | 507 | * @param string $operand What operand you wish to use for the calculation |
| 509 | 508 | * @return mixed string|DateTime return whatever type came in. |
| 510 | 509 | */ |
| 511 | - public static function calc_date( $DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+' ) { |
|
| 512 | - if ( $DateTime_or_timestamp instanceof DateTime ) { |
|
| 513 | - return EEH_DTT_Helper::_modify_datetime_object( $DateTime_or_timestamp, $period, $value, $operand ); |
|
| 514 | - } else if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp )) { |
|
| 515 | - return EEH_DTT_Helper::_modify_timestamp( $DateTime_or_timestamp, $period, $value, $operand ); |
|
| 510 | + public static function calc_date($DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+') { |
|
| 511 | + if ($DateTime_or_timestamp instanceof DateTime) { |
|
| 512 | + return EEH_DTT_Helper::_modify_datetime_object($DateTime_or_timestamp, $period, $value, $operand); |
|
| 513 | + } else if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp)) { |
|
| 514 | + return EEH_DTT_Helper::_modify_timestamp($DateTime_or_timestamp, $period, $value, $operand); |
|
| 516 | 515 | } else { |
| 517 | 516 | //error |
| 518 | 517 | return $DateTime_or_timestamp; |
@@ -542,24 +541,24 @@ discard block |
||
| 542 | 541 | * 'moment' => //date and time format. |
| 543 | 542 | * ) |
| 544 | 543 | */ |
| 545 | - public static function convert_php_to_js_and_moment_date_formats( $date_format_string = null, $time_format_string = null ) { |
|
| 546 | - if ( $date_format_string === null ) { |
|
| 547 | - $date_format_string = get_option( 'date_format' ); |
|
| 544 | + public static function convert_php_to_js_and_moment_date_formats($date_format_string = null, $time_format_string = null) { |
|
| 545 | + if ($date_format_string === null) { |
|
| 546 | + $date_format_string = get_option('date_format'); |
|
| 548 | 547 | } |
| 549 | 548 | |
| 550 | - if ( $time_format_string === null ) { |
|
| 551 | - $time_format_string = get_option( 'time_format' ); |
|
| 549 | + if ($time_format_string === null) { |
|
| 550 | + $time_format_string = get_option('time_format'); |
|
| 552 | 551 | } |
| 553 | 552 | |
| 554 | - $date_format = self::_php_to_js_moment_converter( $date_format_string ); |
|
| 555 | - $time_format = self::_php_to_js_moment_converter( $time_format_string ); |
|
| 553 | + $date_format = self::_php_to_js_moment_converter($date_format_string); |
|
| 554 | + $time_format = self::_php_to_js_moment_converter($time_format_string); |
|
| 556 | 555 | |
| 557 | 556 | return array( |
| 558 | 557 | 'js' => array( |
| 559 | 558 | 'date' => $date_format['js'], |
| 560 | 559 | 'time' => $time_format['js'] |
| 561 | 560 | ), |
| 562 | - 'moment' => $date_format['moment'] . ' ' . $time_format['moment' ] |
|
| 561 | + 'moment' => $date_format['moment'].' '.$time_format['moment'] |
|
| 563 | 562 | ); |
| 564 | 563 | } |
| 565 | 564 | |
@@ -573,7 +572,7 @@ discard block |
||
| 573 | 572 | * |
| 574 | 573 | * @return array js and moment formats. |
| 575 | 574 | */ |
| 576 | - protected static function _php_to_js_moment_converter( $format_string ) { |
|
| 575 | + protected static function _php_to_js_moment_converter($format_string) { |
|
| 577 | 576 | /** |
| 578 | 577 | * This is a map of symbols for formats. |
| 579 | 578 | * The index is the php symbol, the equivalent values are in the array. |
@@ -730,15 +729,15 @@ discard block |
||
| 730 | 729 | $jquery_ui_format = ""; |
| 731 | 730 | $moment_format = ""; |
| 732 | 731 | $escaping = false; |
| 733 | - for ( $i = 0; $i < strlen($format_string); $i++ ) { |
|
| 732 | + for ($i = 0; $i < strlen($format_string); $i++) { |
|
| 734 | 733 | $char = $format_string[$i]; |
| 735 | - if ( $char === '\\' ) { // PHP date format escaping character |
|
| 734 | + if ($char === '\\') { // PHP date format escaping character |
|
| 736 | 735 | $i++; |
| 737 | - if ( $escaping ) { |
|
| 736 | + if ($escaping) { |
|
| 738 | 737 | $jquery_ui_format .= $format_string[$i]; |
| 739 | 738 | $moment_format .= $format_string[$i]; |
| 740 | 739 | } else { |
| 741 | - $jquery_ui_format .= '\'' . $format_string[$i]; |
|
| 740 | + $jquery_ui_format .= '\''.$format_string[$i]; |
|
| 742 | 741 | $moment_format .= $format_string[$i]; |
| 743 | 742 | } |
| 744 | 743 | $escaping = true; |
@@ -757,7 +756,7 @@ discard block |
||
| 757 | 756 | } |
| 758 | 757 | } |
| 759 | 758 | } |
| 760 | - return array( 'js' => $jquery_ui_format, 'moment' => $moment_format ); |
|
| 759 | + return array('js' => $jquery_ui_format, 'moment' => $moment_format); |
|
| 761 | 760 | } |
| 762 | 761 | |
| 763 | 762 | |
@@ -772,25 +771,25 @@ discard block |
||
| 772 | 771 | * errors is returned. So for client code calling, check for is_array() to |
| 773 | 772 | * indicate failed validations. |
| 774 | 773 | */ |
| 775 | - public static function validate_format_string( $format_string ) { |
|
| 774 | + public static function validate_format_string($format_string) { |
|
| 776 | 775 | $error_msg = array(); |
| 777 | 776 | //time format checks |
| 778 | - switch ( true ) { |
|
| 779 | - case strpos( $format_string, 'h' ) !== false : |
|
| 780 | - case strpos( $format_string, 'g' ) !== false : |
|
| 777 | + switch (true) { |
|
| 778 | + case strpos($format_string, 'h') !== false : |
|
| 779 | + case strpos($format_string, 'g') !== false : |
|
| 781 | 780 | /** |
| 782 | 781 | * if the time string has a lowercase 'h' which == 12 hour time format and there |
| 783 | 782 | * is not any ante meridiem format ('a' or 'A'). Then throw an error because its |
| 784 | 783 | * too ambiguous and PHP won't be able to figure out whether 1 = 1pm or 1am. |
| 785 | 784 | */ |
| 786 | - if ( strpos( strtoupper( $format_string ), 'A' ) === false ) { |
|
| 787 | - $error_msg[] = __('There is a time format for 12 hour time but no "a" or "A" to indicate am/pm. Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso' ); |
|
| 785 | + if (strpos(strtoupper($format_string), 'A') === false) { |
|
| 786 | + $error_msg[] = __('There is a time format for 12 hour time but no "a" or "A" to indicate am/pm. Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso'); |
|
| 788 | 787 | } |
| 789 | 788 | break; |
| 790 | 789 | |
| 791 | 790 | } |
| 792 | 791 | |
| 793 | - return empty( $error_msg ) ? true : $error_msg; |
|
| 792 | + return empty($error_msg) ? true : $error_msg; |
|
| 794 | 793 | } |
| 795 | 794 | |
| 796 | 795 | |
@@ -812,11 +811,11 @@ discard block |
||
| 812 | 811 | * @param mixed $date_2 |
| 813 | 812 | * @return bool |
| 814 | 813 | */ |
| 815 | - public static function dates_represent_one_24_hour_date( $date_1, $date_2 ) { |
|
| 814 | + public static function dates_represent_one_24_hour_date($date_1, $date_2) { |
|
| 816 | 815 | |
| 817 | 816 | if ( |
| 818 | - ( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime ) || |
|
| 819 | - ( $date_1->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' || $date_2->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' ) |
|
| 817 | + ( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime) || |
|
| 818 | + ($date_1->format(EE_Datetime_Field::mysql_time_format) != '00:00:00' || $date_2->format(EE_Datetime_Field::mysql_time_format) != '00:00:00') |
|
| 820 | 819 | ) { |
| 821 | 820 | return false; |
| 822 | 821 | } |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -264,10 +265,11 @@ discard block |
||
| 264 | 265 | // Set TZ so localtime works. |
| 265 | 266 | date_default_timezone_set($timezone_string); |
| 266 | 267 | $now = localtime(time(), true); |
| 267 | - if ($now['tm_isdst']) |
|
| 268 | - _e('This timezone is currently in daylight saving time.'); |
|
| 269 | - else |
|
| 270 | - _e('This timezone is currently in standard time.'); |
|
| 268 | + if ($now['tm_isdst']) { |
|
| 269 | + _e('This timezone is currently in daylight saving time.'); |
|
| 270 | + } else { |
|
| 271 | + _e('This timezone is currently in standard time.'); |
|
| 272 | + } |
|
| 271 | 273 | ?> |
| 272 | 274 | <br /> |
| 273 | 275 | <?php |