@@ -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 | /** |
@@ -46,22 +46,22 @@ discard block |
||
46 | 46 | * @return string the assembled html string containing the tabbed content for display. |
47 | 47 | * @throws \EE_Error |
48 | 48 | */ |
49 | - public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE ) { |
|
49 | + public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE) { |
|
50 | 50 | |
51 | 51 | //first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston |
52 | - if ( !empty( $tabs_names) && ( count( (array) $tabs_names) != count( (array) $tabs_content) ) ) { |
|
53 | - throw new EE_Error( __('The count for $tabs_names and $tabs_content does not match.', 'event_espresso') ); |
|
52 | + if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) { |
|
53 | + throw new EE_Error(__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | //make sure we've got incoming data setup properly |
57 | - $tabs = !empty( $tabs_names ) ? (array) $tabs_names : array_keys( (array) $tabs_contents ); |
|
58 | - $tabs_content = !empty( $tabs_names ) ? array_combine( (array) $tabs_names, (array) $tabs_content ) : $tabs_contents; |
|
57 | + $tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents); |
|
58 | + $tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents; |
|
59 | 59 | |
60 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
60 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
61 | 61 | $all_tabs_content = ''; |
62 | 62 | |
63 | 63 | $index = 0; |
64 | - foreach ( $tabs as $tab ) { |
|
64 | + foreach ($tabs as $tab) { |
|
65 | 65 | $active = $index === 0 ? true : false; |
66 | 66 | $all_tabs .= self::tab($tab, $active); |
67 | 67 | $all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs'; |
80 | 80 | |
81 | - return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>'; |
|
81 | + return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | * @throws \EE_Error |
103 | 103 | */ |
104 | 104 | public static function display_admin_nav_tabs($nav_tabs = array()) { |
105 | - if ( empty($nav_tabs) ) |
|
106 | - throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) ); |
|
105 | + if (empty($nav_tabs)) |
|
106 | + throw new EE_Error(__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso')); |
|
107 | 107 | |
108 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
109 | - foreach ( $nav_tabs as $slug => $tab ) { |
|
108 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
109 | + foreach ($nav_tabs as $slug => $tab) { |
|
110 | 110 | $all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']); |
111 | 111 | } |
112 | 112 | $all_tabs .= '</h2>'; |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | * @param bool|string $css If string given then the generated tab will include that as the class. |
123 | 123 | * @return string html for tab |
124 | 124 | */ |
125 | - private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE ) { |
|
125 | + private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE) { |
|
126 | 126 | $name = str_replace(' ', '-', $name); |
127 | 127 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
128 | - $class = $css ? $class . ' ' . $css : $class; |
|
129 | - $nice_name = $nice_name ? $nice_name : ucwords( preg_replace('/(-|_)/', ' ', $name) ); |
|
130 | - $url = $url ? $url : '#' . $name; |
|
131 | - $tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t"; |
|
128 | + $class = $css ? $class.' '.$css : $class; |
|
129 | + $nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name)); |
|
130 | + $url = $url ? $url : '#'.$name; |
|
131 | + $tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t"; |
|
132 | 132 | return $tab; |
133 | 133 | } |
134 | 134 | |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private static function tab_content($name, $tab_content, $active = false) { |
146 | 146 | $class = $active ? 'nav-tab-content' : 'nav-tab-content hidden'; |
147 | - $name = str_replace( ' ', '-', $name); |
|
148 | - $content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n"; |
|
149 | - $content .= "\t" . $tab_content . "\n"; |
|
147 | + $name = str_replace(' ', '-', $name); |
|
148 | + $content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n"; |
|
149 | + $content .= "\t".$tab_content."\n"; |
|
150 | 150 | $content .= '<div style="clear:both"></div></div>'; |
151 | 151 | return $content; |
152 | 152 | } |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | * @param string $default You can include a string for the item that will receive the "item_display" class for the js. |
173 | 173 | * @return string a html snippet of of all the formatted link elements. |
174 | 174 | */ |
175 | - public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) { |
|
176 | - $item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class ); |
|
177 | - if ( !is_array($item_array) || empty( $item_array ) ) |
|
175 | + public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') { |
|
176 | + $item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class); |
|
177 | + if ( ! is_array($item_array) || empty($item_array)) |
|
178 | 178 | return false; //get out we don't have even the basic thing we need! |
179 | 179 | |
180 | 180 | |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | 'title' => esc_attr__('Link for Item', 'event_espresso'), |
186 | 186 | 'slug' => 'item_slug' |
187 | 187 | ); |
188 | - $container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links'; |
|
189 | - $list = '<ul class="' . $container_class . '">'; |
|
188 | + $container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links'; |
|
189 | + $list = '<ul class="'.$container_class.'">'; |
|
190 | 190 | |
191 | 191 | $ci = 1; |
192 | - foreach ( $item_array as $item ) { |
|
193 | - $item = wp_parse_args( $item, $defaults ); |
|
194 | - $item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class']; |
|
192 | + foreach ($item_array as $item) { |
|
193 | + $item = wp_parse_args($item, $defaults); |
|
194 | + $item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class']; |
|
195 | 195 | $list .= self::_text_link_item($item); |
196 | - if ( !empty($sep) && $ci != count($item_array) ) |
|
196 | + if ( ! empty($sep) && $ci != count($item_array)) |
|
197 | 197 | $list .= self::_text_link_item($sep); |
198 | 198 | $ci++; |
199 | 199 | } |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | |
206 | 206 | |
207 | - private static function _text_link_item( $item ) { |
|
207 | + private static function _text_link_item($item) { |
|
208 | 208 | //if this isn't an array then we're doing a separator |
209 | - if ( !is_array( $item ) ) { |
|
209 | + if ( ! is_array($item)) { |
|
210 | 210 | $label = $item; |
211 | 211 | $class = 'ee-text-link-sep'; |
212 | 212 | $href = ''; |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | extract($item); |
216 | 216 | } |
217 | 217 | |
218 | - $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"'; |
|
218 | + $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"'; |
|
219 | 219 | |
220 | - $content = '<li ' . $class . '>'; |
|
221 | - $content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : ''; |
|
220 | + $content = '<li '.$class.'>'; |
|
221 | + $content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : ''; |
|
222 | 222 | $content .= $label; |
223 | - $content .= !empty($href) ? '</a>' : ''; |
|
223 | + $content .= ! empty($href) ? '</a>' : ''; |
|
224 | 224 | $content .= '</li>'; |
225 | 225 | return $content; |
226 | 226 | } |
@@ -1,4 +1,6 @@ discard block |
||
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 | * |
@@ -513,7 +515,7 @@ discard block |
||
513 | 515 | |
514 | 516 | if($count){ |
515 | 517 | return EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
516 | - }else{ |
|
518 | + } else{ |
|
517 | 519 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
518 | 520 | } |
519 | 521 | } |
@@ -943,7 +945,7 @@ discard block |
||
943 | 945 | 'limit'=>$limit); |
944 | 946 | if($count){ |
945 | 947 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
946 | - }else{ |
|
948 | + } else{ |
|
947 | 949 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
948 | 950 | } |
949 | 951 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function instance() { |
37 | 37 | // check if class object is instantiated, and instantiated properly |
38 | - if ( ! self::$_instance instanceof EE_Payment_Method_Manager ) { |
|
38 | + if ( ! self::$_instance instanceof EE_Payment_Method_Manager) { |
|
39 | 39 | self::$_instance = new self(); |
40 | 40 | } |
41 | 41 | EE_Registry::instance()->load_lib('PMT_Base'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * Resets the instance and returns a new one |
47 | 47 | * @return EE_Payment_Method_Manager |
48 | 48 | */ |
49 | - public static function reset(){ |
|
49 | + public static function reset() { |
|
50 | 50 | self::$_instance = NULL; |
51 | 51 | return self::instance(); |
52 | 52 | } |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | * or just re-use the PMTs we found last time we checked during this request (if |
58 | 58 | * we have not yet checked during this request, then we need to check anyways) |
59 | 59 | */ |
60 | - public function maybe_register_payment_methods( $force_recheck = FALSE ){ |
|
61 | - if( ! $this->_payment_method_types || $force_recheck ){ |
|
60 | + public function maybe_register_payment_methods($force_recheck = FALSE) { |
|
61 | + if ( ! $this->_payment_method_types || $force_recheck) { |
|
62 | 62 | $this->_register_payment_methods(); |
63 | 63 | //if in admin lets ensure caps are set. |
64 | - if ( is_admin() ) { |
|
65 | - add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( $this, 'add_payment_method_caps' ) ); |
|
64 | + if (is_admin()) { |
|
65 | + add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array($this, 'add_payment_method_caps')); |
|
66 | 66 | EE_Registry::instance()->CAP->init_caps(); |
67 | 67 | } |
68 | 68 | } |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function _register_payment_methods() { |
77 | 77 | // grab list of installed modules |
78 | - $pm_to_register = glob( EE_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
78 | + $pm_to_register = glob(EE_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
79 | 79 | // filter list of modules to register |
80 | - $pm_to_register = apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register ); |
|
80 | + $pm_to_register = apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register); |
|
81 | 81 | |
82 | 82 | // loop through folders |
83 | - foreach ( $pm_to_register as $pm_path ) { |
|
84 | - $this->register_payment_method( $pm_path ); |
|
83 | + foreach ($pm_to_register as $pm_path) { |
|
84 | + $this->register_payment_method($pm_path); |
|
85 | 85 | } |
86 | - do_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' ); |
|
86 | + do_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods'); |
|
87 | 87 | // filter list of installed modules |
88 | 88 | //keep them organized alphabetically by the payment method type's name |
89 | - ksort( $this->_payment_method_types ); |
|
90 | - return apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types ); |
|
89 | + ksort($this->_payment_method_types); |
|
90 | + return apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,35 +99,35 @@ discard block |
||
99 | 99 | * @param string $payment_method_path - full path up to and including payment method folder |
100 | 100 | * @return boolean |
101 | 101 | */ |
102 | - public function register_payment_method( $payment_method_path = '' ) { |
|
103 | - do_action( 'AHEE__EE_Payment_Method_Manager__register_payment_method__begin',$payment_method_path ); |
|
102 | + public function register_payment_method($payment_method_path = '') { |
|
103 | + do_action('AHEE__EE_Payment_Method_Manager__register_payment_method__begin', $payment_method_path); |
|
104 | 104 | $module_ext = '.pm.php'; |
105 | 105 | // make all separators match |
106 | - $payment_method_path = rtrim( str_replace( '/\\', DS, $payment_method_path ), DS ); |
|
106 | + $payment_method_path = rtrim(str_replace('/\\', DS, $payment_method_path), DS); |
|
107 | 107 | // grab and sanitize module name |
108 | - $module_dir = basename( $payment_method_path ); |
|
108 | + $module_dir = basename($payment_method_path); |
|
109 | 109 | // create classname from module directory name |
110 | - $module = str_replace( ' ', '_', str_replace( '_', ' ', $module_dir )); |
|
110 | + $module = str_replace(' ', '_', str_replace('_', ' ', $module_dir)); |
|
111 | 111 | // add class prefix |
112 | - $module_class = 'EE_PMT_' . $module; |
|
112 | + $module_class = 'EE_PMT_'.$module; |
|
113 | 113 | // does the module exist ? |
114 | - if ( ! is_readable( $payment_method_path . DS . $module_class . $module_ext )) { |
|
115 | - $msg = sprintf( __( 'The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
116 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
114 | + if ( ! is_readable($payment_method_path.DS.$module_class.$module_ext)) { |
|
115 | + $msg = sprintf(__('The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
116 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
117 | 117 | return FALSE; |
118 | 118 | } |
119 | - if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->start_timer(); } |
|
119 | + if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->start_timer(); } |
|
120 | 120 | // load the module class file |
121 | - require_once( $payment_method_path . DS . $module_class . $module_ext ); |
|
122 | - if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); } |
|
121 | + require_once($payment_method_path.DS.$module_class.$module_ext); |
|
122 | + if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); } |
|
123 | 123 | // verify that class exists |
124 | - if ( ! class_exists( $module_class )) { |
|
125 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
126 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
124 | + if ( ! class_exists($module_class)) { |
|
125 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
126 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
127 | 127 | return FALSE; |
128 | 128 | } |
129 | 129 | // add to array of registered modules |
130 | - $this->_payment_method_types[ $module ] = $payment_method_path . DS . $module_class . $module_ext; |
|
130 | + $this->_payment_method_types[$module] = $payment_method_path.DS.$module_class.$module_ext; |
|
131 | 131 | return TRUE; |
132 | 132 | } |
133 | 133 | /** |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | * @param boolean $force_recheck whether to force re-checking for new payment method types |
137 | 137 | * @return boolean |
138 | 138 | */ |
139 | - public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE){ |
|
140 | - if ( ! is_array( $this->_payment_method_types ) || ! isset( $this->_payment_method_types[$payment_method_name] ) |
|
141 | - || $force_recheck ) { |
|
139 | + public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE) { |
|
140 | + if ( ! is_array($this->_payment_method_types) || ! isset($this->_payment_method_types[$payment_method_name]) |
|
141 | + || $force_recheck) { |
|
142 | 142 | $this->maybe_register_payment_methods($force_recheck); |
143 | 143 | } |
144 | - if(isset($this->_payment_method_types[$payment_method_name])){ |
|
144 | + if (isset($this->_payment_method_types[$payment_method_name])) { |
|
145 | 145 | require_once($this->_payment_method_types[$payment_method_name]); |
146 | 146 | return true; |
147 | - }else{ |
|
147 | + } else { |
|
148 | 148 | return false; |
149 | 149 | } |
150 | 150 | } |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | * @param boolean $force_recheck whether to force re-checking for new payment method types |
156 | 156 | * @return array |
157 | 157 | */ |
158 | - public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE ){ |
|
158 | + public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE) { |
|
159 | 159 | $this->maybe_register_payment_methods($force_recheck); |
160 | - if($with_prefixes){ |
|
160 | + if ($with_prefixes) { |
|
161 | 161 | $classnames = array_keys($this->_payment_method_types); |
162 | 162 | $payment_methods = array(); |
163 | - foreach($classnames as $classname){ |
|
163 | + foreach ($classnames as $classname) { |
|
164 | 164 | $payment_methods[] = $this->payment_method_class_from_type($classname); |
165 | 165 | } |
166 | 166 | return $payment_methods; |
167 | - }else{ |
|
167 | + } else { |
|
168 | 168 | return array_keys($this->_payment_method_types); |
169 | 169 | } |
170 | 170 | } |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | * @param boolean $force_recheck whether to force re-checking for new payment method types |
175 | 175 | * @return EE_PMT_Base[] |
176 | 176 | */ |
177 | - public function payment_method_types( $force_recheck = FALSE ){ |
|
177 | + public function payment_method_types($force_recheck = FALSE) { |
|
178 | 178 | $this->maybe_register_payment_methods($force_recheck); |
179 | 179 | $pmt_objs = array(); |
180 | - foreach($this->payment_method_type_names(true) as $classname){ |
|
180 | + foreach ($this->payment_method_type_names(true) as $classname) { |
|
181 | 181 | $pmt_objs[] = new $classname; |
182 | 182 | } |
183 | 183 | return $pmt_objs; |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | * @param string $classname |
190 | 190 | * @return string |
191 | 191 | */ |
192 | - public function payment_method_type_sans_class_prefix($classname){ |
|
193 | - $pmt_name = str_replace("EE_PMT_","",$classname); |
|
192 | + public function payment_method_type_sans_class_prefix($classname) { |
|
193 | + $pmt_name = str_replace("EE_PMT_", "", $classname); |
|
194 | 194 | return $pmt_name; |
195 | 195 | } |
196 | 196 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @param string $type |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - public function payment_method_class_from_type($type){ |
|
202 | + public function payment_method_class_from_type($type) { |
|
203 | 203 | $this->maybe_register_payment_methods(); |
204 | 204 | return "EE_PMT_".$type; |
205 | 205 | } |
@@ -213,38 +213,38 @@ discard block |
||
213 | 213 | * @return \EE_Payment_Method |
214 | 214 | * @throws \EE_Error |
215 | 215 | */ |
216 | - public function activate_a_payment_method_of_type( $payment_method_type ){ |
|
216 | + public function activate_a_payment_method_of_type($payment_method_type) { |
|
217 | 217 | $payment_method = EEM_Payment_Method::instance()->get_one_of_type($payment_method_type); |
218 | - if( ! $payment_method instanceof EE_Payment_Method ){ |
|
218 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
219 | 219 | $pm_type_class = $this->payment_method_class_from_type($payment_method_type); |
220 | - if(class_exists($pm_type_class)){ |
|
220 | + if (class_exists($pm_type_class)) { |
|
221 | 221 | /** @var $pm_type_obj EE_PMT_Base */ |
222 | 222 | $pm_type_obj = new $pm_type_class; |
223 | 223 | $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($pm_type_obj->system_name()); |
224 | - if( ! $payment_method){ |
|
225 | - $payment_method = $this->create_payment_method_of_type( $pm_type_obj ); |
|
224 | + if ( ! $payment_method) { |
|
225 | + $payment_method = $this->create_payment_method_of_type($pm_type_obj); |
|
226 | 226 | } |
227 | - $payment_method->set_type( $payment_method_type ); |
|
228 | - $this->initialize_payment_method( $payment_method ); |
|
227 | + $payment_method->set_type($payment_method_type); |
|
228 | + $this->initialize_payment_method($payment_method); |
|
229 | 229 | } else { |
230 | 230 | throw new EE_Error( |
231 | 231 | sprintf( |
232 | - __( 'There is no payment method of type %1$s, so it could not be activated', 'event_espresso'), |
|
232 | + __('There is no payment method of type %1$s, so it could not be activated', 'event_espresso'), |
|
233 | 233 | $pm_type_class ) |
234 | 234 | ); |
235 | 235 | } |
236 | 236 | } |
237 | 237 | $payment_method->set_active(); |
238 | 238 | $payment_method->save(); |
239 | - $this->set_usable_currencies_on_payment_method( $payment_method ); |
|
240 | - if( $payment_method->type() == 'Invoice' ){ |
|
241 | - $messages = EE_Registry::instance()->load_lib( 'messages' ); |
|
242 | - $messages->ensure_message_type_is_active( 'invoice', 'html' ); |
|
243 | - $messages->ensure_messenger_is_active( 'pdf' ); |
|
239 | + $this->set_usable_currencies_on_payment_method($payment_method); |
|
240 | + if ($payment_method->type() == 'Invoice') { |
|
241 | + $messages = EE_Registry::instance()->load_lib('messages'); |
|
242 | + $messages->ensure_message_type_is_active('invoice', 'html'); |
|
243 | + $messages->ensure_messenger_is_active('pdf'); |
|
244 | 244 | EE_Error::add_attention( |
245 | 245 | sprintf( |
246 | - __( 'Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso' ), |
|
247 | - '<a href="' . admin_url( 'admin.php?page=espresso_messages') . '">', |
|
246 | + __('Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso'), |
|
247 | + '<a href="'.admin_url('admin.php?page=espresso_messages').'">', |
|
248 | 248 | '</a>' |
249 | 249 | ) |
250 | 250 | ); |
@@ -258,17 +258,17 @@ discard block |
||
258 | 258 | * @param EE_PMT_Base $pm_type_obj |
259 | 259 | * @return EE_Payment_Method |
260 | 260 | */ |
261 | - public function create_payment_method_of_type( $pm_type_obj ) { |
|
261 | + public function create_payment_method_of_type($pm_type_obj) { |
|
262 | 262 | global $current_user; |
263 | 263 | $payment_method = EE_Payment_Method::new_instance( |
264 | 264 | array( |
265 | 265 | 'PMD_type' => $pm_type_obj->system_name(), |
266 | 266 | 'PMD_name' => $pm_type_obj->pretty_name(), |
267 | 267 | 'PMD_admin_name' => $pm_type_obj->pretty_name(), |
268 | - 'PMD_slug' => $pm_type_obj->system_name(),//automatically converted to slug |
|
268 | + 'PMD_slug' => $pm_type_obj->system_name(), //automatically converted to slug |
|
269 | 269 | 'PMD_wp_user' => $current_user->ID, |
270 | 270 | 'PMD_order' => EEM_Payment_Method::instance()->count( |
271 | - array( array( 'PMD_type' => array( '!=', 'Admin_Only' ))) |
|
271 | + array(array('PMD_type' => array('!=', 'Admin_Only'))) |
|
272 | 272 | ) * 10, |
273 | 273 | ) |
274 | 274 | ); |
@@ -280,16 +280,16 @@ discard block |
||
280 | 280 | * @param EE_Payment_Method $payment_method |
281 | 281 | * @return EE_Payment_Method |
282 | 282 | */ |
283 | - public function initialize_payment_method( $payment_method ) { |
|
283 | + public function initialize_payment_method($payment_method) { |
|
284 | 284 | $pm_type_obj = $payment_method->type_obj(); |
285 | - $payment_method->set_description( $pm_type_obj->default_description() ); |
|
286 | - if( ! $payment_method->button_url() ){ |
|
287 | - $payment_method->set_button_url( $pm_type_obj->default_button_url() ); |
|
285 | + $payment_method->set_description($pm_type_obj->default_description()); |
|
286 | + if ( ! $payment_method->button_url()) { |
|
287 | + $payment_method->set_button_url($pm_type_obj->default_button_url()); |
|
288 | 288 | } |
289 | 289 | //now add setup its default extra meta properties |
290 | 290 | $extra_metas = $pm_type_obj->settings_form()->extra_meta_inputs(); |
291 | - foreach( $extra_metas as $meta_name => $input ){ |
|
292 | - $payment_method->update_extra_meta($meta_name, $input->raw_value() ); |
|
291 | + foreach ($extra_metas as $meta_name => $input) { |
|
292 | + $payment_method->update_extra_meta($meta_name, $input->raw_value()); |
|
293 | 293 | } |
294 | 294 | return $payment_method; |
295 | 295 | } |
@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | * @param EE_Payment_Method $payment_method |
300 | 300 | * @return EE_Payment_Method |
301 | 301 | */ |
302 | - public function set_usable_currencies_on_payment_method( $payment_method ) { |
|
303 | - foreach($payment_method->get_all_usable_currencies() as $currency_obj){ |
|
302 | + public function set_usable_currencies_on_payment_method($payment_method) { |
|
303 | + foreach ($payment_method->get_all_usable_currencies() as $currency_obj) { |
|
304 | 304 | $payment_method->_add_relation_to($currency_obj, 'Currency'); |
305 | 305 | } |
306 | 306 | return $payment_method; |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | * |
319 | 319 | * @return int count of rows updated. |
320 | 320 | */ |
321 | - public function deactivate_payment_method( $payment_method_slug ) { |
|
322 | - $count_updated = EEM_Payment_Method::instance()->update(array('PMD_scope'=>array()),array(array('PMD_slug'=>$payment_method_slug))); |
|
321 | + public function deactivate_payment_method($payment_method_slug) { |
|
322 | + $count_updated = EEM_Payment_Method::instance()->update(array('PMD_scope'=>array()), array(array('PMD_slug'=>$payment_method_slug))); |
|
323 | 323 | return $count_updated; |
324 | 324 | } |
325 | 325 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param array $caps capabilities being filtered |
333 | 333 | * @return array |
334 | 334 | */ |
335 | - public function add_payment_method_caps( $caps ) { |
|
335 | + public function add_payment_method_caps($caps) { |
|
336 | 336 | /* add dynamic caps from payment methods |
337 | 337 | * at the time of writing, october 20 2014, these are the caps added: |
338 | 338 | * ee_payment_method_admin_only |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * their related capability automatically added too, so long as they are |
348 | 348 | * registered properly using EE_Register_Payment_Method::register() |
349 | 349 | */ |
350 | - foreach( $this->payment_method_types() as $payment_method_type_obj ){ |
|
350 | + foreach ($this->payment_method_types() as $payment_method_type_obj) { |
|
351 | 351 | $caps['administrator'][] = $payment_method_type_obj->cap_name(); |
352 | 352 | } |
353 | 353 | return $caps; |
@@ -715,7 +715,7 @@ |
||
715 | 715 | } |
716 | 716 | } |
717 | 717 | } |
718 | - } |
|
718 | + } |
|
719 | 719 | /** |
720 | 720 | * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
721 | 721 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | 14 | $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | -foreach($stages as $filepath){ |
|
16 | +foreach ($stages as $filepath) { |
|
17 | 17 | $matches = array(); |
18 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
18 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | 19 | $class_to_filepath[$matches[1]] = $filepath; |
20 | 20 | } |
21 | 21 | //give addons a chance to autoload their stages too |
22 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath); |
|
22 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
|
23 | 23 | EEH_Autoloader::register_autoloader($class_to_filepath); |
24 | 24 | |
25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @since 4.6.0 |
36 | 36 | * |
37 | 37 | */ |
38 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
38 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * return EE_DMS_Core_4_8_0 |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function can_migrate_from_version($version_array) { |
64 | 64 | $version_string = $version_array['Core']; |
65 | - if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){ |
|
65 | + if ($version_string <= '4.8.0' && $version_string >= '4.7.0') { |
|
66 | 66 | // echo "$version_string can be migrated from"; |
67 | 67 | return true; |
68 | - }elseif( ! $version_string ){ |
|
68 | + }elseif ( ! $version_string) { |
|
69 | 69 | // echo "no version string provided: $version_string"; |
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | - }else{ |
|
71 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + } else { |
|
73 | 73 | // echo "$version_string doesnt apply"; |
74 | 74 | return false; |
75 | 75 | } |
@@ -90,18 +90,18 @@ discard block |
||
90 | 90 | * @return bool |
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | - $now_in_mysql = current_time( 'mysql', true ); |
|
93 | + $now_in_mysql = current_time('mysql', true); |
|
94 | 94 | |
95 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
96 | - $table_name='esp_answer'; |
|
97 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
95 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
96 | + $table_name = 'esp_answer'; |
|
97 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
98 | 98 | REG_ID INT UNSIGNED NOT NULL, |
99 | 99 | QST_ID INT UNSIGNED NOT NULL, |
100 | 100 | ANS_value TEXT NOT NULL, |
101 | 101 | PRIMARY KEY (ANS_ID), |
102 | 102 | KEY REG_ID (REG_ID), |
103 | 103 | KEY QST_ID (QST_ID)"; |
104 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
104 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
105 | 105 | |
106 | 106 | $table_name = 'esp_attendee_meta'; |
107 | 107 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | CNT_is_EU TINYINT(1) DEFAULT '0', |
142 | 142 | CNT_active TINYINT(1) DEFAULT '0', |
143 | 143 | PRIMARY KEY (CNT_ISO)"; |
144 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
144 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
145 | 145 | |
146 | 146 | $table_name = 'esp_currency'; |
147 | 147 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
152 | 152 | CUR_active TINYINT(1) DEFAULT '0', |
153 | 153 | PRIMARY KEY (CUR_code)"; |
154 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
154 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
155 | 155 | |
156 | 156 | |
157 | 157 | $table_name = 'esp_currency_payment_method'; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | KEY EVT_ID (EVT_ID), |
182 | 182 | KEY DTT_is_primary (DTT_is_primary)"; |
183 | 183 | |
184 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
184 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
185 | 185 | |
186 | 186 | $table_name = 'esp_event_meta'; |
187 | 187 | $sql = " |
@@ -200,44 +200,44 @@ discard block |
||
200 | 200 | EVT_donations TINYINT(1) NULL, |
201 | 201 | PRIMARY KEY (EVTM_ID), |
202 | 202 | KEY EVT_ID (EVT_ID)"; |
203 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
203 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
204 | 204 | |
205 | 205 | |
206 | 206 | |
207 | - $table_name='esp_event_question_group'; |
|
208 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
207 | + $table_name = 'esp_event_question_group'; |
|
208 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
209 | 209 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
210 | 210 | QSG_ID INT UNSIGNED NOT NULL, |
211 | 211 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
212 | 212 | PRIMARY KEY (EQG_ID), |
213 | 213 | KEY EVT_ID (EVT_ID), |
214 | 214 | KEY QSG_ID (QSG_ID)"; |
215 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
215 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
216 | 216 | |
217 | 217 | |
218 | 218 | |
219 | - $table_name='esp_event_venue'; |
|
220 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
219 | + $table_name = 'esp_event_venue'; |
|
220 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
221 | 221 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
222 | 222 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
223 | 223 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
224 | 224 | PRIMARY KEY (EVV_ID)"; |
225 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
225 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
226 | 226 | |
227 | 227 | |
228 | 228 | |
229 | - $table_name='esp_extra_meta'; |
|
230 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
229 | + $table_name = 'esp_extra_meta'; |
|
230 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
231 | 231 | OBJ_ID INT(11) DEFAULT NULL, |
232 | 232 | EXM_type VARCHAR(45) DEFAULT NULL, |
233 | 233 | EXM_key VARCHAR(45) DEFAULT NULL, |
234 | 234 | EXM_value TEXT, |
235 | 235 | PRIMARY KEY (EXM_ID), |
236 | 236 | KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))"; |
237 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
237 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
238 | 238 | |
239 | - $table_name='esp_line_item'; |
|
240 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
239 | + $table_name = 'esp_line_item'; |
|
240 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
241 | 241 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
242 | 242 | TXN_ID INT(11) DEFAULT NULL, |
243 | 243 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | PRIMARY KEY (LIN_ID), |
257 | 257 | KEY LIN_code (LIN_code(191)), |
258 | 258 | KEY TXN_ID (TXN_ID)"; |
259 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
259 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
260 | 260 | |
261 | 261 | $table_name = 'esp_log'; |
262 | 262 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
296 | 296 | PRIMARY KEY (GRP_ID), |
297 | 297 | KEY MTP_user_id (MTP_user_id)"; |
298 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
298 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
299 | 299 | |
300 | 300 | $table_name = 'esp_event_message_template'; |
301 | 301 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | PRIMARY KEY (EMT_ID), |
305 | 305 | KEY EVT_ID (EVT_ID), |
306 | 306 | KEY GRP_ID (GRP_ID)"; |
307 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
307 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
308 | 308 | |
309 | 309 | |
310 | 310 | $table_name = 'esp_payment'; |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | PRIMARY KEY (TTM_ID)"; |
378 | 378 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
379 | 379 | |
380 | - $table_name='esp_question'; |
|
381 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
380 | + $table_name = 'esp_question'; |
|
381 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
382 | 382 | QST_display_text TEXT NOT NULL, |
383 | 383 | QST_admin_label VARCHAR(255) NOT NULL, |
384 | 384 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -391,22 +391,22 @@ discard block |
||
391 | 391 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
392 | 392 | PRIMARY KEY (QST_ID), |
393 | 393 | KEY QST_order (QST_order)'; |
394 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
394 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
395 | 395 | |
396 | - $table_name='esp_question_group_question'; |
|
397 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
396 | + $table_name = 'esp_question_group_question'; |
|
397 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
398 | 398 | QSG_ID INT UNSIGNED NOT NULL, |
399 | 399 | QST_ID INT UNSIGNED NOT NULL, |
400 | 400 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
401 | 401 | PRIMARY KEY (QGQ_ID), |
402 | 402 | KEY QST_ID (QST_ID), |
403 | 403 | KEY QSG_ID_order (QSG_ID, QGQ_order)"; |
404 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
404 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
405 | 405 | |
406 | 406 | |
407 | 407 | |
408 | - $table_name='esp_question_option'; |
|
409 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
408 | + $table_name = 'esp_question_option'; |
|
409 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
410 | 410 | QSO_value VARCHAR(255) NOT NULL, |
411 | 411 | QSO_desc TEXT NOT NULL, |
412 | 412 | QST_ID INT UNSIGNED NOT NULL, |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | PRIMARY KEY (QSO_ID), |
417 | 417 | KEY QST_ID (QST_ID), |
418 | 418 | KEY QSO_order (QSO_order)"; |
419 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
419 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
420 | 420 | |
421 | 421 | |
422 | 422 | |
@@ -462,8 +462,8 @@ discard block |
||
462 | 462 | |
463 | 463 | |
464 | 464 | |
465 | - $table_name='esp_checkin'; |
|
466 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
465 | + $table_name = 'esp_checkin'; |
|
466 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
467 | 467 | REG_ID INT(10) UNSIGNED NOT NULL, |
468 | 468 | DTT_ID INT(10) UNSIGNED NOT NULL, |
469 | 469 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
559 | 559 | PRIMARY KEY (PRC_ID), |
560 | 560 | KEY PRT_ID (PRT_ID)"; |
561 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
561 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
562 | 562 | |
563 | 563 | $table_name = "esp_price_type"; |
564 | 564 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -596,10 +596,10 @@ discard block |
||
596 | 596 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
597 | 597 | PRIMARY KEY (TKT_ID), |
598 | 598 | KEY TKT_start_date (TKT_start_date)"; |
599 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
599 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
600 | 600 | |
601 | 601 | $table_name = 'esp_question_group'; |
602 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
602 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
603 | 603 | QSG_name VARCHAR(255) NOT NULL, |
604 | 604 | QSG_identifier VARCHAR(100) NOT NULL, |
605 | 605 | QSG_desc TEXT NULL, |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | PRIMARY KEY (QSG_ID), |
613 | 613 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC), |
614 | 614 | KEY QSG_order (QSG_order)'; |
615 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
615 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
616 | 616 | |
617 | 617 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
618 | 618 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | return $script_4_7_defaults->schema_changes_after_migration(); |
649 | 649 | } |
650 | 650 | |
651 | - public function migration_page_hooks(){ |
|
651 | + public function migration_page_hooks() { |
|
652 | 652 | |
653 | 653 | } |
654 | 654 | |
@@ -662,19 +662,19 @@ discard block |
||
662 | 662 | //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
663 | 663 | //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
664 | 664 | $newer_countries = array( |
665 | - array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ), |
|
666 | - array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
667 | - array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ), |
|
668 | - array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ), |
|
669 | - array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
670 | - array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
671 | - array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
672 | - array( 'MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0 ), |
|
673 | - array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ), |
|
674 | - array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ), |
|
675 | - array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ), |
|
676 | - array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ), |
|
677 | - array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ), |
|
665 | + array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
666 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
667 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
668 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
669 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
670 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
671 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
672 | + array('MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
673 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0), |
|
674 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
675 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
676 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0), |
|
677 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
678 | 678 | ); |
679 | 679 | global $wpdb; |
680 | 680 | $country_table = $wpdb->prefix."esp_country"; |
@@ -693,14 +693,14 @@ discard block |
||
693 | 693 | "CNT_is_EU" => '%d', |
694 | 694 | "CNT_active" => '%d', |
695 | 695 | ); |
696 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $country_table . "'") == $country_table ) { |
|
697 | - foreach( $newer_countries as $country ) { |
|
698 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ; |
|
696 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$country_table."'") == $country_table) { |
|
697 | + foreach ($newer_countries as $country) { |
|
698 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
699 | 699 | $countries = $wpdb->get_var($SQL); |
700 | - if ( ! $countries ) { |
|
700 | + if ( ! $countries) { |
|
701 | 701 | |
702 | - $wpdb->insert( $country_table, |
|
703 | - array_combine( array_keys( $country_format), $country ), |
|
702 | + $wpdb->insert($country_table, |
|
703 | + array_combine(array_keys($country_format), $country), |
|
704 | 704 | $country_format |
705 | 705 | ); |
706 | 706 | } |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
719 | 719 | //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
720 | 720 | $newer_currencies = array( |
721 | - array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ), |
|
721 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
722 | 722 | ); |
723 | 723 | global $wpdb; |
724 | 724 | $currency_table = $wpdb->prefix."esp_currency"; |
@@ -730,14 +730,14 @@ discard block |
||
730 | 730 | "CUR_dec_plc" => '%d', |
731 | 731 | "CUR_active" => '%d', |
732 | 732 | ); |
733 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $currency_table . "'") == $currency_table ) { |
|
734 | - foreach( $newer_currencies as $currency ) { |
|
735 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ; |
|
733 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$currency_table."'") == $currency_table) { |
|
734 | + foreach ($newer_currencies as $currency) { |
|
735 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
736 | 736 | $countries = $wpdb->get_var($SQL); |
737 | - if ( ! $countries ) { |
|
737 | + if ( ! $countries) { |
|
738 | 738 | |
739 | - $wpdb->insert( $currency_table, |
|
740 | - array_combine( array_keys( $currency_format), $currency ), |
|
739 | + $wpdb->insert($currency_table, |
|
740 | + array_combine(array_keys($currency_format), $currency), |
|
741 | 741 | $currency_format |
742 | 742 | ); |
743 | 743 | } |
@@ -749,9 +749,9 @@ discard block |
||
749 | 749 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
750 | 750 | * we should be able to stop doing this in 4.9 |
751 | 751 | */ |
752 | - public function fix_non_default_taxes(){ |
|
752 | + public function fix_non_default_taxes() { |
|
753 | 753 | global $wpdb; |
754 | - $query = $wpdb->prepare( "UPDATE |
|
754 | + $query = $wpdb->prepare("UPDATE |
|
755 | 755 | {$wpdb->prefix}esp_price p INNER JOIN |
756 | 756 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
757 | 757 | SET |
@@ -759,8 +759,8 @@ discard block |
||
759 | 759 | WHERE |
760 | 760 | p.PRC_is_default = 0 AND |
761 | 761 | pt.PBT_ID = %d |
762 | - ", EEM_Price_Type::base_type_tax ); |
|
763 | - $wpdb->query( $query ); |
|
762 | + ", EEM_Price_Type::base_type_tax); |
|
763 | + $wpdb->query($query); |
|
764 | 764 | } |
765 | 765 | } |
766 | 766 |
@@ -1,33 +1,33 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * EE_Admin |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /core/admin/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * EE_Admin |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /core/admin/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | final class EE_Admin { |
25 | 25 | |
26 | 26 | /** |
27 | - * EE_Admin Object |
|
28 | - * @private _instance |
|
29 | - * @private protected |
|
30 | - */ |
|
27 | + * EE_Admin Object |
|
28 | + * @private _instance |
|
29 | + * @private protected |
|
30 | + */ |
|
31 | 31 | private static $_instance = NULL; |
32 | 32 | |
33 | 33 | /** |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | |
58 | 58 | /** |
59 | - * class constructor |
|
60 | - */ |
|
59 | + * class constructor |
|
60 | + */ |
|
61 | 61 | protected function __construct() { |
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | |
169 | 169 | |
170 | 170 | /** |
171 | - * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
172 | - * |
|
173 | - * @access public |
|
174 | - * @return void |
|
175 | - */ |
|
171 | + * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
172 | + * |
|
173 | + * @access public |
|
174 | + * @return void |
|
175 | + */ |
|
176 | 176 | public function init() { |
177 | 177 | |
178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
466 | - * admin_init |
|
467 | - * |
|
468 | - * @access public |
|
469 | - * @return void |
|
470 | - */ |
|
466 | + * admin_init |
|
467 | + * |
|
468 | + * @access public |
|
469 | + * @return void |
|
470 | + */ |
|
471 | 471 | public function admin_init() { |
472 | 472 | |
473 | 473 | /** |
@@ -624,11 +624,11 @@ discard block |
||
624 | 624 | |
625 | 625 | |
626 | 626 | /** |
627 | - * dismiss_persistent_admin_notice |
|
628 | - * |
|
629 | - * @access public |
|
630 | - * @return void |
|
631 | - */ |
|
627 | + * dismiss_persistent_admin_notice |
|
628 | + * |
|
629 | + * @access public |
|
630 | + * @return void |
|
631 | + */ |
|
632 | 632 | public function dismiss_ee_nag_notice_callback() { |
633 | 633 | EE_Error::dismiss_persistent_admin_notice(); |
634 | 634 | } |
@@ -1,4 +1,6 @@ discard block |
||
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 | * |
@@ -220,8 +222,9 @@ discard block |
||
220 | 222 | */ |
221 | 223 | public function remove_pages_from_nav_menu( $post_type ) { |
222 | 224 | //if this isn't the "pages" post type let's get out |
223 | - if ( $post_type->name !== 'page' ) |
|
224 | - return $post_type; |
|
225 | + if ( $post_type->name !== 'page' ) { |
|
226 | + return $post_type; |
|
227 | + } |
|
225 | 228 | |
226 | 229 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
227 | 230 | |
@@ -296,8 +299,9 @@ discard block |
||
296 | 299 | * @return string the (maybe) modified link |
297 | 300 | */ |
298 | 301 | public function modify_edit_post_link( $link, $id, $context ) { |
299 | - if ( ! $post = get_post( $id ) ) |
|
300 | - return $link; |
|
302 | + if ( ! $post = get_post( $id ) ) { |
|
303 | + return $link; |
|
304 | + } |
|
301 | 305 | |
302 | 306 | if ( $post->post_type == 'espresso_attendees' ) { |
303 | 307 | $query_args = array( |
@@ -337,7 +341,10 @@ discard block |
||
337 | 341 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
338 | 342 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
339 | 343 | <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
340 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
344 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) { |
|
345 | + echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); |
|
346 | +} |
|
347 | +?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
341 | 348 | <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
342 | 349 | </a> |
343 | 350 | </li> |
@@ -870,8 +877,9 @@ discard block |
||
870 | 877 | */ |
871 | 878 | public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
872 | 879 | EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
873 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
874 | - $config['page_path'] = $page_path; |
|
880 | + if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
881 | + $config['page_path'] = $page_path; |
|
882 | + } |
|
875 | 883 | EE_Register_Admin_Page::register( $page_basename, $config ); |
876 | 884 | } |
877 | 885 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function instance() { |
49 | 49 | // check if class object is instantiated |
50 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
50 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
51 | 51 | self::$_instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$_instance; |
@@ -62,25 +62,25 @@ discard block |
||
62 | 62 | // define global EE_Admin constants |
63 | 63 | $this->_define_all_constants(); |
64 | 64 | // set autoloaders for our admin page classes based on included path information |
65 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
65 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
66 | 66 | // admin hooks |
67 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
67 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
68 | 68 | // load EE_Request_Handler early |
69 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
70 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
69 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
70 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
103 | - define( 'JQPLOT_URL', EE_GLOBAL_ASSETS_URL . 'scripts/jqplot/' ); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | + define('JQPLOT_URL', EE_GLOBAL_ASSETS_URL.'scripts/jqplot/'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,23 +113,23 @@ discard block |
||
113 | 113 | * @param string $plugin |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - public function filter_plugin_actions( $links, $plugin ) { |
|
116 | + public function filter_plugin_actions($links, $plugin) { |
|
117 | 117 | // set $main_file in stone |
118 | 118 | static $main_file; |
119 | 119 | // if $main_file is not set yet |
120 | - if ( ! $main_file ) { |
|
121 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
120 | + if ( ! $main_file) { |
|
121 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
122 | 122 | } |
123 | - if ( $plugin == $main_file ) { |
|
123 | + if ($plugin == $main_file) { |
|
124 | 124 | // compare current plugin to this one |
125 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
126 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
127 | - array_unshift( $links, $maintenance_link ); |
|
125 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
126 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
127 | + array_unshift($links, $maintenance_link); |
|
128 | 128 | } else { |
129 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
130 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
129 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
130 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
131 | 131 | // add before other links |
132 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
132 | + array_unshift($links, $org_settings_link, $events_link); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | return $links; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | * @return void |
145 | 145 | */ |
146 | 146 | public function get_request() { |
147 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
148 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
147 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
148 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @param array $admin_page_folder_names |
158 | 158 | * @return array |
159 | 159 | */ |
160 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
160 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
161 | 161 | return array( |
162 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
163 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
164 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
162 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
163 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
164 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
165 | 165 | ); |
166 | 166 | } |
167 | 167 | |
@@ -176,36 +176,36 @@ discard block |
||
176 | 176 | public function init() { |
177 | 177 | |
178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
179 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
179 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
180 | 180 | //ok so we want to enable the entire admin |
181 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
182 | - add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 ); |
|
183 | - add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 ); |
|
184 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
185 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
186 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
182 | + add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2); |
|
183 | + add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3); |
|
184 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
185 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
186 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
187 | 187 | //at a glance dashboard widget |
188 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 ); |
|
188 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
189 | 189 | //filter for get_edit_post_link used on comments for custom post types |
190 | - add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 ); |
|
190 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
194 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
194 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
195 | 195 | try { |
196 | 196 | //this loads the controller for the admin pages which will setup routing etc |
197 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
198 | - } catch ( EE_Error $e ) { |
|
197 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
198 | + } catch (EE_Error $e) { |
|
199 | 199 | $e->get_error(); |
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | 203 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
204 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
205 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
204 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
205 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
206 | 206 | |
207 | 207 | //exclude EE critical pages from all nav menus and wp_list_pages |
208 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
208 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | * @param object $post_type WP post type object |
219 | 219 | * @return object WP post type object |
220 | 220 | */ |
221 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
221 | + public function remove_pages_from_nav_menu($post_type) { |
|
222 | 222 | //if this isn't the "pages" post type let's get out |
223 | - if ( $post_type->name !== 'page' ) |
|
223 | + if ($post_type->name !== 'page') |
|
224 | 224 | return $post_type; |
225 | 225 | |
226 | 226 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -240,28 +240,28 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function enable_hidden_ee_nav_menu_metaboxes() { |
242 | 242 | global $wp_meta_boxes, $pagenow; |
243 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
243 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
244 | 244 | return; |
245 | 245 | } |
246 | 246 | $user = wp_get_current_user(); |
247 | 247 | //has this been done yet? |
248 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
248 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
249 | 249 | return; |
250 | 250 | } |
251 | 251 | |
252 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
253 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
252 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
253 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
254 | 254 | |
255 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
256 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
257 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
258 | - unset( $hidden_meta_boxes[ $key ] ); |
|
255 | + if (is_array($hidden_meta_boxes)) { |
|
256 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
257 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
258 | + unset($hidden_meta_boxes[$key]); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
264 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
263 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
264 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @return void |
281 | 281 | */ |
282 | 282 | public function register_custom_nav_menu_boxes() { |
283 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
283 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -297,17 +297,17 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return string the (maybe) modified link |
299 | 299 | */ |
300 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
301 | - if ( ! $post = get_post( $id ) ) |
|
300 | + public function modify_edit_post_link($link, $id, $context) { |
|
301 | + if ( ! $post = get_post($id)) |
|
302 | 302 | return $link; |
303 | 303 | |
304 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
304 | + if ($post->post_type == 'espresso_attendees') { |
|
305 | 305 | $query_args = array( |
306 | 306 | 'action' => 'edit_attendee', |
307 | 307 | 'post' => $id |
308 | 308 | ); |
309 | 309 | EE_Registry::instance()->load_helper('URL'); |
310 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
310 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
311 | 311 | } |
312 | 312 | return $link; |
313 | 313 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | global $nav_menu_selected_id; |
320 | 320 | |
321 | 321 | $db_fields = false; |
322 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
322 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
323 | 323 | $current_tab = 'event-archives'; |
324 | 324 | |
325 | 325 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -338,9 +338,9 @@ discard block |
||
338 | 338 | ?> |
339 | 339 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
340 | 340 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
341 | - <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
|
342 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
343 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
341 | + <li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>> |
|
342 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
343 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
344 | 344 | </a> |
345 | 345 | </li> |
346 | 346 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -358,13 +358,13 @@ discard block |
||
358 | 358 | <?php */ ?> |
359 | 359 | |
360 | 360 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
361 | - echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
361 | + echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
362 | 362 | ?>"> |
363 | 363 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
364 | 364 | <?php |
365 | 365 | $pages = $this->_get_extra_nav_menu_pages_items(); |
366 | 366 | $args['walker'] = $walker; |
367 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
367 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
368 | 368 | ?> |
369 | 369 | </ul> |
370 | 370 | </div><!-- /.tabs-panel --> |
@@ -372,18 +372,18 @@ discard block |
||
372 | 372 | <p class="button-controls"> |
373 | 373 | <span class="list-controls"> |
374 | 374 | <a href="<?php |
375 | - echo esc_url( add_query_arg( |
|
375 | + echo esc_url(add_query_arg( |
|
376 | 376 | array( |
377 | 377 | 'extra-nav-menu-pages-tab' => 'event-archives', |
378 | 378 | 'selectall' => 1, |
379 | 379 | ), |
380 | - remove_query_arg( $removed_args ) |
|
380 | + remove_query_arg($removed_args) |
|
381 | 381 | )); |
382 | 382 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
383 | 383 | </span> |
384 | 384 | |
385 | 385 | <span class="add-to-menu"> |
386 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
386 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
387 | 387 | <span class="spinner"></span> |
388 | 388 | </span> |
389 | 389 | </p> |
@@ -404,10 +404,10 @@ discard block |
||
404 | 404 | private function _get_extra_nav_menu_pages_items() { |
405 | 405 | $menuitems[] = array( |
406 | 406 | 'title' => __('Event List', 'event_espresso'), |
407 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
407 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
408 | 408 | 'description' => __('Archive page for all events.', 'event_espresso') |
409 | 409 | ); |
410 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
410 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @param $menuitem |
420 | 420 | * @return stdClass |
421 | 421 | */ |
422 | - private function _setup_extra_nav_menu_pages_items( $menuitem ) { |
|
422 | + private function _setup_extra_nav_menu_pages_items($menuitem) { |
|
423 | 423 | $menu_item = new stdClass(); |
424 | 424 | $keys = array( |
425 | 425 | 'ID' => 0, |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | 'xfn' => '' |
440 | 440 | ); |
441 | 441 | |
442 | - foreach ( $keys as $key => $value) { |
|
442 | + foreach ($keys as $key => $value) { |
|
443 | 443 | $menu_item->$key = isset($menuitem[$key]) ? $menuitem[$key] : $value; |
444 | 444 | } |
445 | 445 | return $menu_item; |
@@ -479,10 +479,10 @@ discard block |
||
479 | 479 | * - check if doing post processing of one of EE CPTs |
480 | 480 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
481 | 481 | */ |
482 | - if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) { |
|
483 | - if ( isset( $_POST['post_type'] ) ) { |
|
484 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
485 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
482 | + if (isset($_POST['action']) && $_POST['action'] == 'editpost') { |
|
483 | + if (isset($_POST['post_type'])) { |
|
484 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
485 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
@@ -492,8 +492,8 @@ discard block |
||
492 | 492 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
493 | 493 | */ |
494 | 494 | global $pagenow; |
495 | - if ( $pagenow == 'options-reading.php' ) { |
|
496 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
495 | + if ($pagenow == 'options-reading.php') { |
|
496 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | } |
@@ -505,25 +505,25 @@ discard block |
||
505 | 505 | * @param string $output Current output. |
506 | 506 | * @return string |
507 | 507 | */ |
508 | - public function modify_dropdown_pages( $output ) { |
|
508 | + public function modify_dropdown_pages($output) { |
|
509 | 509 | //get critical pages |
510 | 510 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
511 | 511 | |
512 | 512 | //split current output by line break for easier parsing. |
513 | - $split_output = explode( "\n", $output ); |
|
513 | + $split_output = explode("\n", $output); |
|
514 | 514 | |
515 | 515 | //loop through to remove any critical pages from the array. |
516 | - foreach ( $critical_pages as $page_id ) { |
|
517 | - $needle = 'value="' . $page_id . '"'; |
|
518 | - foreach( $split_output as $key => $haystack ) { |
|
519 | - if( strpos( $haystack, $needle ) !== false ) { |
|
520 | - unset( $split_output[$key] ); |
|
516 | + foreach ($critical_pages as $page_id) { |
|
517 | + $needle = 'value="'.$page_id.'"'; |
|
518 | + foreach ($split_output as $key => $haystack) { |
|
519 | + if (strpos($haystack, $needle) !== false) { |
|
520 | + unset($split_output[$key]); |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | 525 | //replace output with the new contents |
526 | - $output = implode( "\n", $split_output ); |
|
526 | + $output = implode("\n", $split_output); |
|
527 | 527 | |
528 | 528 | return $output; |
529 | 529 | } |
@@ -539,37 +539,37 @@ discard block |
||
539 | 539 | public function enqueue_admin_scripts() { |
540 | 540 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
541 | 541 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
542 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
542 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
543 | 543 | // register cookie script for future dependencies |
544 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
544 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
545 | 545 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
546 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
546 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
547 | 547 | // register jQuery Validate |
548 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
548 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
549 | 549 | } |
550 | 550 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
551 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
551 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
552 | 552 | //joyride style |
553 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
554 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
555 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
553 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
554 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
555 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
556 | 556 | //joyride JS |
557 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
557 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
558 | 558 | // wanna go for a joyride? |
559 | 559 | wp_enqueue_style('ee-joyride-css'); |
560 | 560 | wp_enqueue_script('jquery-joyride'); |
561 | 561 | } |
562 | 562 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
563 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
563 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
564 | 564 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
565 | 565 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
566 | 566 | } |
567 | 567 | //accounting.js library |
568 | 568 | // @link http://josscrowcroft.github.io/accounting.js/ |
569 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
570 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
571 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
572 | - wp_enqueue_script( 'ee-accounting' ); |
|
569 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
570 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
571 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
572 | + wp_enqueue_script('ee-accounting'); |
|
573 | 573 | // array of settings to get converted to JSON array via wp_localize_script |
574 | 574 | $currency_config = array( |
575 | 575 | 'currency' => array( |
@@ -616,11 +616,11 @@ discard block |
||
616 | 616 | public function get_persistent_admin_notices() { |
617 | 617 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
618 | 618 | $args = array( |
619 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
620 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
619 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
620 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
621 | 621 | ); |
622 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
623 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
622 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
623 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | |
@@ -641,26 +641,26 @@ discard block |
||
641 | 641 | * @param $elements |
642 | 642 | * @return array |
643 | 643 | */ |
644 | - public function dashboard_glance_items( $elements ) { |
|
644 | + public function dashboard_glance_items($elements) { |
|
645 | 645 | $events = EEM_Event::instance()->count(); |
646 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
647 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
646 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
647 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
648 | 648 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
649 | 649 | $registrations = EEM_Registration::instance()->count( |
650 | 650 | array( |
651 | 651 | array( |
652 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
652 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
653 | 653 | ) |
654 | 654 | ) |
655 | 655 | ); |
656 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
657 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
656 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
657 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
658 | 658 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
659 | 659 | |
660 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
660 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
661 | 661 | |
662 | - foreach ( $items as $type => $item_properties ) { |
|
663 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
662 | + foreach ($items as $type => $item_properties) { |
|
663 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
664 | 664 | } |
665 | 665 | return $elements; |
666 | 666 | } |
@@ -679,63 +679,63 @@ discard block |
||
679 | 679 | * @param $post |
680 | 680 | * @return void |
681 | 681 | */ |
682 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
682 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
683 | 683 | // default post types |
684 | - $post_types = array( 'post' => 0, 'page' => 1 ); |
|
684 | + $post_types = array('post' => 0, 'page' => 1); |
|
685 | 685 | // add CPTs |
686 | 686 | $CPTs = EE_Register_CPTs::get_CPTs(); |
687 | - $post_types = array_merge( $post_types, $CPTs ); |
|
687 | + $post_types = array_merge($post_types, $CPTs); |
|
688 | 688 | // for default or CPT posts... |
689 | - if ( isset( $post_types[ $post->post_type ] )) { |
|
689 | + if (isset($post_types[$post->post_type])) { |
|
690 | 690 | // post on frontpage ? |
691 | 691 | $page_for_posts = EE_Config::get_page_for_posts(); |
692 | 692 | $maybe_remove_from_posts = array(); |
693 | 693 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
694 | 694 | $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array(); |
695 | 695 | // array of shortcodes indexed by post name |
696 | - EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
696 | + EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
697 | 697 | // whether to proceed with update, if an entry already exists for this post, then we want to update |
698 | - $update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false; |
|
698 | + $update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false; |
|
699 | 699 | // empty both arrays |
700 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array(); |
|
700 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array(); |
|
701 | 701 | // check that posts page is already being tracked |
702 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
702 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
703 | 703 | // if not, then ensure that it is properly added |
704 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
704 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
705 | 705 | } |
706 | 706 | // loop thru shortcodes |
707 | - foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) { |
|
707 | + foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) { |
|
708 | 708 | // convert to UPPERCASE to get actual shortcode |
709 | - $EES_Shortcode = strtoupper( $EES_Shortcode ); |
|
709 | + $EES_Shortcode = strtoupper($EES_Shortcode); |
|
710 | 710 | // is the shortcode in the post_content ? |
711 | - if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) { |
|
711 | + if (strpos($post->post_content, $EES_Shortcode) !== FALSE) { |
|
712 | 712 | // map shortcode to post names and post IDs |
713 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID; |
|
713 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID; |
|
714 | 714 | // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE |
715 | - if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) { |
|
715 | + if ( ! in_array($EES_Shortcode, $critical_shortcodes)) { |
|
716 | 716 | // add shortcode to "Posts page" tracking |
717 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID; |
|
717 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID; |
|
718 | 718 | } |
719 | 719 | $update_post_shortcodes = TRUE; |
720 | - unset( $maybe_remove_from_posts[ $EES_Shortcode ] ); |
|
720 | + unset($maybe_remove_from_posts[$EES_Shortcode]); |
|
721 | 721 | } else { |
722 | - $maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID; |
|
722 | + $maybe_remove_from_posts[$EES_Shortcode] = $post_ID; |
|
723 | 723 | } |
724 | 724 | } |
725 | - if ( $update_post_shortcodes ) { |
|
725 | + if ($update_post_shortcodes) { |
|
726 | 726 | // remove shortcodes from $maybe_remove_from_posts that are still being used |
727 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) { |
|
728 | - if ( $post_name == $page_for_posts ) { |
|
727 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) { |
|
728 | + if ($post_name == $page_for_posts) { |
|
729 | 729 | continue; |
730 | 730 | } |
731 | 731 | // compute difference between active post_shortcodes array and $maybe_remove_from_posts array |
732 | - $maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes ); |
|
732 | + $maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes); |
|
733 | 733 | } |
734 | 734 | // now unset unused shortcodes from the $page_for_posts post_shortcodes |
735 | - foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) { |
|
736 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] ); |
|
735 | + foreach ($maybe_remove_from_posts as $shortcode => $post_ID) { |
|
736 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]); |
|
737 | 737 | } |
738 | - EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts ); |
|
738 | + EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts); |
|
739 | 739 | } |
740 | 740 | } |
741 | 741 | } |
@@ -753,32 +753,32 @@ discard block |
||
753 | 753 | * @throws EE_Error |
754 | 754 | * @return string |
755 | 755 | */ |
756 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
757 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
756 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
757 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
758 | 758 | // check for date_format or time_format |
759 | - switch ( $option ) { |
|
759 | + switch ($option) { |
|
760 | 760 | case 'date_format' : |
761 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
761 | + $date_time_format = $value.' '.get_option('time_format'); |
|
762 | 762 | break; |
763 | 763 | case 'time_format' : |
764 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
764 | + $date_time_format = get_option('date_format').' '.$value; |
|
765 | 765 | break; |
766 | 766 | default : |
767 | 767 | $date_time_format = FALSE; |
768 | 768 | } |
769 | 769 | // do we have a date_time format to check ? |
770 | - if ( $date_time_format ) { |
|
771 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
770 | + if ($date_time_format) { |
|
771 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
772 | 772 | |
773 | - if ( is_array( $error_msg ) ) { |
|
774 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
773 | + if (is_array($error_msg)) { |
|
774 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
775 | 775 | |
776 | 776 | |
777 | - foreach ( $error_msg as $error ) { |
|
778 | - $msg .= '<li>' . $error . '</li>'; |
|
777 | + foreach ($error_msg as $error) { |
|
778 | + $msg .= '<li>'.$error.'</li>'; |
|
779 | 779 | } |
780 | 780 | |
781 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
781 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
782 | 782 | |
783 | 783 | // trigger WP settings error |
784 | 784 | add_settings_error( |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | ); |
789 | 789 | |
790 | 790 | // set format to something valid |
791 | - switch ( $option ) { |
|
791 | + switch ($option) { |
|
792 | 792 | case 'date_format' : |
793 | 793 | $value = 'F j, Y'; |
794 | 794 | break; |
@@ -814,14 +814,14 @@ discard block |
||
814 | 814 | * @param $value |
815 | 815 | * @return void |
816 | 816 | */ |
817 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
818 | - if ( $option == 'page_for_posts' ) { |
|
817 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
818 | + if ($option == 'page_for_posts') { |
|
819 | 819 | global $wpdb; |
820 | - $SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
821 | - $old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts'; |
|
822 | - $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts'; |
|
823 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ]; |
|
824 | - EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts ); |
|
820 | + $SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
821 | + $old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts'; |
|
822 | + $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts'; |
|
823 | + EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts]; |
|
824 | + EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts); |
|
825 | 825 | } |
826 | 826 | } |
827 | 827 | |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | * @param $content |
835 | 835 | * @return string |
836 | 836 | */ |
837 | - public function its_eSpresso( $content ) { |
|
838 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
837 | + public function its_eSpresso($content) { |
|
838 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | |
@@ -848,9 +848,9 @@ discard block |
||
848 | 848 | */ |
849 | 849 | public function espresso_admin_footer() { |
850 | 850 | return sprintf( |
851 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
851 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
852 | 852 | '<a href="http://eventespresso.com/" title="', |
853 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
853 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
854 | 854 | ); |
855 | 855 | } |
856 | 856 | |
@@ -870,11 +870,11 @@ discard block |
||
870 | 870 | * @param array $config |
871 | 871 | * @return void |
872 | 872 | */ |
873 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
874 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
875 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
873 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
874 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
875 | + if (class_exists('EE_Register_Admin_Page')) |
|
876 | 876 | $config['page_path'] = $page_path; |
877 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
877 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 |
@@ -5,42 +5,42 @@ |
||
5 | 5 | <table class="admin-primary-mbox-tbl"> |
6 | 6 | <thead> |
7 | 7 | <tr> |
8 | - <th class="jst-left"><?php esc_html_e( 'Event Name', 'event_espresso' );?></th> |
|
9 | - <th class="jst-left"><?php esc_html_e( 'REG ID', 'event_espresso' );?></th> |
|
10 | - <th class="jst-left"><?php esc_html_e( 'TXN ID', 'event_espresso' );?></th> |
|
11 | - <th class="jst-left"><?php esc_html_e( 'Reg Code', 'event_espresso' );?></th> |
|
12 | - <th class="jst-rght"><?php esc_html_e( 'Ticket Price', 'event_espresso' );?></th> |
|
8 | + <th class="jst-left"><?php esc_html_e('Event Name', 'event_espresso'); ?></th> |
|
9 | + <th class="jst-left"><?php esc_html_e('REG ID', 'event_espresso'); ?></th> |
|
10 | + <th class="jst-left"><?php esc_html_e('TXN ID', 'event_espresso'); ?></th> |
|
11 | + <th class="jst-left"><?php esc_html_e('Reg Code', 'event_espresso'); ?></th> |
|
12 | + <th class="jst-rght"><?php esc_html_e('Ticket Price', 'event_espresso'); ?></th> |
|
13 | 13 | </tr> |
14 | 14 | </thead> |
15 | 15 | <tbody> |
16 | - <?php foreach( $registrations as $registration ) : ?> |
|
16 | + <?php foreach ($registrations as $registration) : ?> |
|
17 | 17 | <tr> |
18 | 18 | <td class="jst-left"> |
19 | 19 | <?php |
20 | - $event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' )); |
|
21 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ? '<a href="'. $event_url .'" title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name(); |
|
20 | + $event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events')); |
|
21 | + echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name(); |
|
22 | 22 | ?> |
23 | 23 | </td> |
24 | 24 | <td class="jst-left"> |
25 | 25 | <?php |
26 | - $reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
27 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
28 | - <a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . |
|
29 | - esc_html__( 'View Registration', 'event_espresso' ) . |
|
26 | + $reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
27 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
28 | + <a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. |
|
29 | + esc_html__('View Registration', 'event_espresso'). |
|
30 | 30 | '</a>' : $registration->ID(); |
31 | 31 | ?> |
32 | 32 | </td> |
33 | 33 | <td class="jst-left"> |
34 | 34 | <?php |
35 | - $txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL ); |
|
36 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
37 | - <a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . |
|
38 | - sprintf( esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID() ) . |
|
35 | + $txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL); |
|
36 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
37 | + <a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'. |
|
38 | + sprintf(esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID()). |
|
39 | 39 | '</a>' : $registration->transaction_ID(); |
40 | 40 | ?> |
41 | 41 | </td> |
42 | - <td class="jst-left"><?php echo $registration->reg_code();?></td> |
|
43 | - <td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td> |
|
42 | + <td class="jst-left"><?php echo $registration->reg_code(); ?></td> |
|
43 | + <td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td> |
|
44 | 44 | </tr> |
45 | 45 | <?php endforeach; ?> |
46 | 46 | </tbody> |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * |
283 | 283 | * given two paths, this determines if there is a common base path between the two |
284 | 284 | * |
285 | - * @param array $paths |
|
285 | + * @param string[] $paths |
|
286 | 286 | * @return string |
287 | 287 | */ |
288 | 288 | protected static function _find_common_base_path( $paths ) { |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @param bool|string $template_path server path to the file to be loaded, including file name and extension |
310 | 310 | * @param array $template_args an array of arguments to be extracted for use in the template |
311 | 311 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
312 | - * @return mixed string |
|
312 | + * @return string string |
|
313 | 313 | */ |
314 | 314 | public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
315 | 315 | //require the template validator for verifying variables are set according to how the template requires |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -171,26 +171,26 @@ discard block |
||
171 | 171 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
172 | 172 | * @return mixed |
173 | 173 | */ |
174 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
174 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
175 | 175 | // first use WP locate_template to check for template in the current theme folder |
176 | - $template_path = locate_template( $templates ); |
|
176 | + $template_path = locate_template($templates); |
|
177 | 177 | |
178 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
178 | + if ($check_if_custom && ! empty($template_path)) |
|
179 | 179 | return TRUE; |
180 | 180 | |
181 | 181 | // not in the theme |
182 | - if ( empty( $template_path )) { |
|
182 | + if (empty($template_path)) { |
|
183 | 183 | // not even a template to look for ? |
184 | - if ( empty( $templates )) { |
|
184 | + if (empty($templates)) { |
|
185 | 185 | // get post_type |
186 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
186 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
187 | 187 | // get array of EE Custom Post Types |
188 | 188 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
189 | 189 | // build template name based on request |
190 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
191 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
192 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
193 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
190 | + if (isset($EE_CPTs[$post_type])) { |
|
191 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
192 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
193 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | // currently active EE template theme |
@@ -199,80 +199,80 @@ discard block |
||
199 | 199 | // array of paths to folders that may contain templates |
200 | 200 | $template_folder_paths = array( |
201 | 201 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
202 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
202 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
203 | 203 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
204 | 204 | EVENT_ESPRESSO_TEMPLATE_DIR |
205 | 205 | ); |
206 | 206 | |
207 | 207 | //add core plugin folders for checking only if we're not $check_if_custom |
208 | - if ( ! $check_if_custom ) { |
|
208 | + if ( ! $check_if_custom) { |
|
209 | 209 | $core_paths = array( |
210 | 210 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
211 | - EE_PUBLIC . $current_theme, |
|
211 | + EE_PUBLIC.$current_theme, |
|
212 | 212 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
213 | - EE_TEMPLATES . $current_theme, |
|
213 | + EE_TEMPLATES.$current_theme, |
|
214 | 214 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
215 | 215 | EE_PLUGIN_DIR_PATH |
216 | 216 | ); |
217 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
217 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | // now filter that array |
221 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
222 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
223 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
221 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
222 | + $templates = is_array($templates) ? $templates : array($templates); |
|
223 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
224 | 224 | // array to hold all possible template paths |
225 | 225 | $full_template_paths = array(); |
226 | 226 | |
227 | 227 | EE_Registry::instance()->load_helper('File'); |
228 | 228 | // loop through $templates |
229 | - foreach ( $templates as $template ) { |
|
229 | + foreach ($templates as $template) { |
|
230 | 230 | // normalize directory separators |
231 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
232 | - $file_name = basename( $template ); |
|
233 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
231 | + $template = EEH_File::standardise_directory_separators($template); |
|
232 | + $file_name = basename($template); |
|
233 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
234 | 234 | // while looping through all template folder paths |
235 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
235 | + foreach ($template_folder_paths as $template_folder_path) { |
|
236 | 236 | // normalize directory separators |
237 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
237 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
238 | 238 | // determine if any common base path exists between the two paths |
239 | 239 | $common_base_path = EEH_Template::_find_common_base_path( |
240 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
240 | + array($template_folder_path, $template_path_minus_file_name) |
|
241 | 241 | ); |
242 | - if ( $common_base_path !== '' ) { |
|
242 | + if ($common_base_path !== '') { |
|
243 | 243 | // both paths have a common base, so just tack the filename onto our search path |
244 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
244 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
245 | 245 | } else { |
246 | 246 | // no common base path, so let's just concatenate |
247 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
247 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
248 | 248 | } |
249 | 249 | // build up our template locations array by adding our resolved paths |
250 | 250 | $full_template_paths[] = $resolved_path; |
251 | 251 | } |
252 | 252 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
253 | - array_unshift( $full_template_paths, $template ); |
|
253 | + array_unshift($full_template_paths, $template); |
|
254 | 254 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
255 | - array_unshift( $full_template_paths, get_template_directory() . DS . $file_name ); |
|
255 | + array_unshift($full_template_paths, get_template_directory().DS.$file_name); |
|
256 | 256 | } |
257 | 257 | // filter final array of full template paths |
258 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths ); |
|
258 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths); |
|
259 | 259 | // now loop through our final array of template location paths and check each location |
260 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
261 | - if ( is_readable( $full_template_path )) { |
|
262 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
260 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
261 | + if (is_readable($full_template_path)) { |
|
262 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
263 | 263 | break; |
264 | 264 | } |
265 | 265 | } |
266 | 266 | } |
267 | 267 | // if we got it and you want to see it... |
268 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
269 | - if ( $return_string ) { |
|
270 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
268 | + if ($template_path && $load && ! $check_if_custom) { |
|
269 | + if ($return_string) { |
|
270 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
271 | 271 | } else { |
272 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
272 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
273 | 273 | } |
274 | 274 | } |
275 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
275 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | * @param array $paths |
286 | 286 | * @return string |
287 | 287 | */ |
288 | - protected static function _find_common_base_path( $paths ) { |
|
288 | + protected static function _find_common_base_path($paths) { |
|
289 | 289 | $last_offset = 0; |
290 | 290 | $common_base_path = ''; |
291 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
291 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
292 | 292 | $dir_length = $index - $last_offset + 1; |
293 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
294 | - foreach ( $paths as $path ) { |
|
295 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
293 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
294 | + foreach ($paths as $path) { |
|
295 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
296 | 296 | return $common_base_path; |
297 | 297 | } |
298 | 298 | } |
299 | 299 | $common_base_path .= $directory; |
300 | 300 | $last_offset = $index + 1; |
301 | 301 | } |
302 | - return substr( $common_base_path, 0, -1 ); |
|
302 | + return substr($common_base_path, 0, -1); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
312 | 312 | * @return mixed string |
313 | 313 | */ |
314 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
314 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
315 | 315 | //require the template validator for verifying variables are set according to how the template requires |
316 | - EE_Registry::instance()->load_helper( 'Template_Validator' ); |
|
316 | + EE_Registry::instance()->load_helper('Template_Validator'); |
|
317 | 317 | |
318 | 318 | /** |
319 | 319 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -324,26 +324,26 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @since 4.6.0 |
326 | 326 | */ |
327 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
328 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
327 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
328 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
329 | 329 | |
330 | 330 | // you gimme nuttin - YOU GET NUTTIN !! |
331 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
331 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
332 | 332 | return ''; |
333 | 333 | } |
334 | 334 | // if $template_args are not in an array, then make it so |
335 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
336 | - $template_args = array( $template_args ); |
|
335 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
336 | + $template_args = array($template_args); |
|
337 | 337 | } |
338 | - extract( (array) $template_args); |
|
338 | + extract((array) $template_args); |
|
339 | 339 | |
340 | - if ( $return_string ) { |
|
340 | + if ($return_string) { |
|
341 | 341 | // because we want to return a string, we are going to capture the output |
342 | 342 | ob_start(); |
343 | - include( $template_path ); |
|
343 | + include($template_path); |
|
344 | 344 | return ob_get_clean(); |
345 | 345 | } else { |
346 | - include( $template_path ); |
|
346 | + include($template_path); |
|
347 | 347 | } |
348 | 348 | return ''; |
349 | 349 | } |
@@ -361,27 +361,27 @@ discard block |
||
361 | 361 | * @param string $suffix added to the end of the generated class |
362 | 362 | * @return string |
363 | 363 | */ |
364 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
364 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
365 | 365 | // in the beginning... |
366 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
366 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
367 | 367 | // da muddle |
368 | 368 | $class = ''; |
369 | 369 | // the end |
370 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
370 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
371 | 371 | // is the passed object an EE object ? |
372 | - if ( $object instanceof EE_Base_Class ) { |
|
372 | + if ($object instanceof EE_Base_Class) { |
|
373 | 373 | // grab the exact type of object |
374 | - $obj_class = get_class( $object ); |
|
374 | + $obj_class = get_class($object); |
|
375 | 375 | // depending on the type of object... |
376 | - switch ( $obj_class ) { |
|
376 | + switch ($obj_class) { |
|
377 | 377 | // no specifics just yet... |
378 | 378 | default : |
379 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
380 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
379 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
380 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
381 | 381 | |
382 | 382 | } |
383 | 383 | } |
384 | - return $prefix . $class . $suffix; |
|
384 | + return $prefix.$class.$suffix; |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
@@ -397,50 +397,50 @@ discard block |
||
397 | 397 | * @param string $cur_code_span_class |
398 | 398 | * @return string the html output for the formatted money value |
399 | 399 | */ |
400 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
400 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
401 | 401 | // ensure amount was received |
402 | - if ( is_null( $amount ) ) { |
|
403 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
404 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
402 | + if (is_null($amount)) { |
|
403 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
404 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
405 | 405 | return ''; |
406 | 406 | } |
407 | 407 | //ensure amount is float |
408 | 408 | $amount = (float) $amount; |
409 | 409 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
410 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
410 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
411 | 411 | // still a number or was amount converted to a string like "free" ? |
412 | - if ( is_float( $amount_formatted )) { |
|
412 | + if (is_float($amount_formatted)) { |
|
413 | 413 | // was a country ISO code passed ? if so generate currency config object for that country |
414 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
414 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
415 | 415 | // verify results |
416 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
416 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
417 | 417 | // set default config country currency settings |
418 | 418 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
419 | 419 | } |
420 | 420 | // format float |
421 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
421 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
422 | 422 | // add formatting ? |
423 | - if ( ! $return_raw ) { |
|
423 | + if ( ! $return_raw) { |
|
424 | 424 | // add currency sign |
425 | - if( $mny->sign_b4 ){ |
|
426 | - if( $amount >= 0 ){ |
|
427 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
428 | - }else{ |
|
429 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
425 | + if ($mny->sign_b4) { |
|
426 | + if ($amount >= 0) { |
|
427 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
428 | + } else { |
|
429 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
430 | 430 | } |
431 | 431 | |
432 | - }else{ |
|
433 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
432 | + } else { |
|
433 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | // add currency code ? |
437 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
437 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
438 | 438 | } |
439 | 439 | // filter results |
440 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
440 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
441 | 441 | } |
442 | 442 | // clean up vars |
443 | - unset( $mny ); |
|
443 | + unset($mny); |
|
444 | 444 | // return formatted currency amount |
445 | 445 | return $amount_formatted; |
446 | 446 | } |
@@ -455,11 +455,11 @@ discard block |
||
455 | 455 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
456 | 456 | * @return string The localized label for the status id. |
457 | 457 | */ |
458 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
458 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
459 | 459 | /** @type EEM_Status $EEM_Status */ |
460 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
461 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
462 | - return $status[ $status_id ]; |
|
460 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
461 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
462 | + return $status[$status_id]; |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | |
@@ -472,9 +472,9 @@ discard block |
||
472 | 472 | * @param string $icon |
473 | 473 | * @return string the html output for the button |
474 | 474 | */ |
475 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
476 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
477 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
475 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
476 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
477 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
478 | 478 | return $button; |
479 | 479 | } |
480 | 480 | |
@@ -491,21 +491,21 @@ discard block |
||
491 | 491 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
492 | 492 | * @return string generated link |
493 | 493 | */ |
494 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
494 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
495 | 495 | |
496 | - if ( ! $page ) |
|
497 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
496 | + if ( ! $page) |
|
497 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
498 | 498 | |
499 | - if ( ! $action ) |
|
500 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
499 | + if ( ! $action) |
|
500 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
501 | 501 | |
502 | 502 | $action = empty($action) ? 'default' : $action; |
503 | 503 | |
504 | 504 | |
505 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
506 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
507 | - $help_text = !$help_text ? '' : $help_text; |
|
508 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
505 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
506 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
507 | + $help_text = ! $help_text ? '' : $help_text; |
|
508 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -517,31 +517,31 @@ discard block |
||
517 | 517 | * @param EE_Help_Tour |
518 | 518 | * @return string html |
519 | 519 | */ |
520 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
520 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
521 | 521 | $id = $tour->get_slug(); |
522 | 522 | $stops = $tour->get_stops(); |
523 | 523 | |
524 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
524 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
525 | 525 | |
526 | - foreach ( $stops as $stop ) { |
|
527 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
528 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
526 | + foreach ($stops as $stop) { |
|
527 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
528 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
529 | 529 | |
530 | 530 | //if container is set to modal then let's make sure we set the options accordingly |
531 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
531 | + if (empty($data_id) && empty($data_class)) { |
|
532 | 532 | $stop['options']['modal'] = true; |
533 | 533 | $stop['options']['expose'] = true; |
534 | 534 | } |
535 | 535 | |
536 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
537 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
536 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
537 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
538 | 538 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
539 | 539 | |
540 | 540 | //options |
541 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
541 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
542 | 542 | $options = ' data-options="'; |
543 | - foreach ( $stop['options'] as $option => $value ) { |
|
544 | - $options .= $option . ':' . $value . ';'; |
|
543 | + foreach ($stop['options'] as $option => $value) { |
|
544 | + $options .= $option.':'.$value.';'; |
|
545 | 545 | } |
546 | 546 | $options .= '"'; |
547 | 547 | } else { |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | |
551 | 551 | //let's put all together |
552 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
552 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | $content .= '</ol>'; |
@@ -570,31 +570,31 @@ discard block |
||
570 | 570 | * @throws EE_Error |
571 | 571 | * @return string html structure for status. |
572 | 572 | */ |
573 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
574 | - if ( !is_array( $status_array ) ) |
|
575 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
573 | + public static function status_legend($status_array, $active_status = '') { |
|
574 | + if ( ! is_array($status_array)) |
|
575 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
576 | 576 | |
577 | 577 | $setup_array = array(); |
578 | - foreach ( $status_array as $item => $status ) { |
|
578 | + foreach ($status_array as $item => $status) { |
|
579 | 579 | $setup_array[$item] = array( |
580 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
581 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
580 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
581 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
582 | 582 | 'status' => $status |
583 | 583 | ); |
584 | 584 | } |
585 | 585 | |
586 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
587 | - $content .= '<h4>' . __('Status Legend', 'event_espresso') . '</h4>' . "\n"; |
|
588 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
589 | - foreach ( $setup_array as $item => $details ) { |
|
586 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
587 | + $content .= '<h4>'.__('Status Legend', 'event_espresso').'</h4>'."\n"; |
|
588 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
589 | + foreach ($setup_array as $item => $details) { |
|
590 | 590 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
591 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
592 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
593 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
594 | - $content .= '</dt>' . "\n"; |
|
591 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
592 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
593 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
594 | + $content .= '</dt>'."\n"; |
|
595 | 595 | } |
596 | - $content .= '</dl>' . "\n"; |
|
597 | - $content .= '</div>' . "\n"; |
|
596 | + $content .= '</dl>'."\n"; |
|
597 | + $content .= '</div>'."\n"; |
|
598 | 598 | return $content; |
599 | 599 | } |
600 | 600 | |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | * @return string |
608 | 608 | */ |
609 | 609 | public static function layout_array_as_table($data) { |
610 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
611 | - $data = (array)$data; |
|
610 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
611 | + $data = (array) $data; |
|
612 | 612 | } |
613 | 613 | EE_Registry::instance()->load_helper('Array'); |
614 | 614 | ob_start(); |
@@ -622,10 +622,10 @@ discard block |
||
622 | 622 | ?> |
623 | 623 | <tr> |
624 | 624 | <td> |
625 | - <?php echo $data_key;?> |
|
625 | + <?php echo $data_key; ?> |
|
626 | 626 | </td> |
627 | 627 | <td> |
628 | - <?php echo self::layout_array_as_table($data_values);?> |
|
628 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
629 | 629 | </td> |
630 | 630 | </tr> |
631 | 631 | <?php |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | <ul> |
640 | 640 | <?php |
641 | 641 | foreach ($data as $datum) { |
642 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
642 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
643 | 643 | }?> |
644 | 644 | </ul> |
645 | 645 | <?php |
@@ -669,8 +669,8 @@ discard block |
||
669 | 669 | * |
670 | 670 | * @return string |
671 | 671 | */ |
672 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
673 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
672 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
673 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | |
@@ -694,13 +694,13 @@ discard block |
||
694 | 694 | * ) |
695 | 695 | * @return string |
696 | 696 | */ |
697 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
697 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
698 | 698 | $page_links = array(); |
699 | 699 | $disable_first = $disable_last = ''; |
700 | 700 | $total_items = (int) $total_items; |
701 | 701 | $per_page = (int) $per_page; |
702 | 702 | $current = (int) $current; |
703 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
703 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
704 | 704 | |
705 | 705 | //filter items_label |
706 | 706 | $items_label = apply_filters( |
@@ -708,68 +708,68 @@ discard block |
||
708 | 708 | $items_label |
709 | 709 | ); |
710 | 710 | |
711 | - if ( empty( $items_label ) |
|
712 | - || ! is_array( $items_label ) |
|
713 | - || ! isset( $items_label['single'] ) |
|
714 | - || ! isset( $items_label['plural'] ) ) { |
|
711 | + if (empty($items_label) |
|
712 | + || ! is_array($items_label) |
|
713 | + || ! isset($items_label['single']) |
|
714 | + || ! isset($items_label['plural'])) { |
|
715 | 715 | $items_label = array( |
716 | - 'single' => __( '1 item', 'event_espresso' ), |
|
717 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
716 | + 'single' => __('1 item', 'event_espresso'), |
|
717 | + 'plural' => __('%s items', 'event_espresso') |
|
718 | 718 | ); |
719 | 719 | } else { |
720 | 720 | $items_label = array( |
721 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
722 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
721 | + 'single' => '1 '.esc_html($items_label['single']), |
|
722 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
723 | 723 | ); |
724 | 724 | } |
725 | 725 | |
726 | - $total_pages = ceil( $total_items / $per_page ); |
|
726 | + $total_pages = ceil($total_items / $per_page); |
|
727 | 727 | |
728 | - if ( $total_pages <= 1 ) |
|
728 | + if ($total_pages <= 1) |
|
729 | 729 | return ''; |
730 | 730 | |
731 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
731 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
732 | 732 | |
733 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
733 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
734 | 734 | |
735 | - if ( $current === 1 ) { |
|
735 | + if ($current === 1) { |
|
736 | 736 | $disable_first = ' disabled'; |
737 | 737 | } |
738 | - if ( $current == $total_pages ) { |
|
738 | + if ($current == $total_pages) { |
|
739 | 739 | $disable_last = ' disabled'; |
740 | 740 | } |
741 | 741 | |
742 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
743 | - 'first-page' . $disable_first, |
|
744 | - esc_attr__( 'Go to the first page' ), |
|
745 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
742 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
743 | + 'first-page'.$disable_first, |
|
744 | + esc_attr__('Go to the first page'), |
|
745 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
746 | 746 | '«' |
747 | 747 | ); |
748 | 748 | |
749 | 749 | $page_links[] = sprintf( |
750 | 750 | '<a class="%s" title="%s" href="%s">%s</a>', |
751 | - 'prev-page' . $disable_first, |
|
752 | - esc_attr__( 'Go to the previous page' ), |
|
753 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
751 | + 'prev-page'.$disable_first, |
|
752 | + esc_attr__('Go to the previous page'), |
|
753 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
754 | 754 | '‹' |
755 | 755 | ); |
756 | 756 | |
757 | - if ( ! $show_num_field ) { |
|
757 | + if ( ! $show_num_field) { |
|
758 | 758 | $html_current_page = $current; |
759 | 759 | } else { |
760 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
761 | - esc_attr__( 'Current page' ), |
|
760 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
761 | + esc_attr__('Current page'), |
|
762 | 762 | $current, |
763 | - strlen( $total_pages ) |
|
763 | + strlen($total_pages) |
|
764 | 764 | ); |
765 | 765 | } |
766 | 766 | |
767 | 767 | $html_total_pages = sprintf( |
768 | 768 | '<span class="total-pages">%s</span>', |
769 | - number_format_i18n( $total_pages ) |
|
769 | + number_format_i18n($total_pages) |
|
770 | 770 | ); |
771 | 771 | $page_links[] = sprintf( |
772 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
772 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
773 | 773 | $html_current_page, |
774 | 774 | $html_total_pages, |
775 | 775 | '<span class="paging-input">', |
@@ -778,29 +778,29 @@ discard block |
||
778 | 778 | |
779 | 779 | $page_links[] = sprintf( |
780 | 780 | '<a class="%s" title="%s" href="%s">%s</a>', |
781 | - 'next-page' . $disable_last, |
|
782 | - esc_attr__( 'Go to the next page' ), |
|
783 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
781 | + 'next-page'.$disable_last, |
|
782 | + esc_attr__('Go to the next page'), |
|
783 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
784 | 784 | '›' |
785 | 785 | ); |
786 | 786 | |
787 | 787 | $page_links[] = sprintf( |
788 | 788 | '<a class="%s" title="%s" href="%s">%s</a>', |
789 | - 'last-page' . $disable_last, |
|
790 | - esc_attr__( 'Go to the last page' ), |
|
791 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
789 | + 'last-page'.$disable_last, |
|
790 | + esc_attr__('Go to the last page'), |
|
791 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
792 | 792 | '»' |
793 | 793 | ); |
794 | 794 | |
795 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
795 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
796 | 796 | // set page class |
797 | - if ( $total_pages ) { |
|
797 | + if ($total_pages) { |
|
798 | 798 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
799 | 799 | } else { |
800 | 800 | $page_class = ' no-pages'; |
801 | 801 | } |
802 | 802 | |
803 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
803 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
804 | 804 | } |
805 | 805 | |
806 | 806 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | return array(); |
100 | 100 | } |
101 | 101 | if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
102 | - unset( $espresso_themes[ $key ] ); |
|
102 | + unset( $espresso_themes[ $key ] ); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | 105 | foreach ( $espresso_themes as $espresso_theme ) { |
@@ -709,9 +709,9 @@ discard block |
||
709 | 709 | ); |
710 | 710 | |
711 | 711 | if ( empty( $items_label ) |
712 | - || ! is_array( $items_label ) |
|
713 | - || ! isset( $items_label['single'] ) |
|
714 | - || ! isset( $items_label['plural'] ) ) { |
|
712 | + || ! is_array( $items_label ) |
|
713 | + || ! isset( $items_label['single'] ) |
|
714 | + || ! isset( $items_label['plural'] ) ) { |
|
715 | 715 | $items_label = array( |
716 | 716 | 'single' => __( '1 item', 'event_espresso' ), |
717 | 717 | 'plural' => __( '%s items', 'event_espresso' ) |
@@ -32,7 +32,6 @@ |
||
32 | 32 | /** |
33 | 33 | * |
34 | 34 | * @param string $model_name |
35 | - * @param string $comparison_model_name |
|
36 | 35 | * @param string $id_or_name_field should be the string 'ID' or 'name' only |
37 | 36 | * @return EE_Model_Field_Base |
38 | 37 | */ |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Joins any two models together via a has-and-belongs-to-many relation, using |
|
4 | - * the esp_extra_join table. |
|
5 | - */ |
|
3 | + * Joins any two models together via a has-and-belongs-to-many relation, using |
|
4 | + * the esp_extra_join table. |
|
5 | + */ |
|
6 | 6 | class EE_HABTM_Any_Relation extends EE_HABTM_Relation{ |
7 | 7 | /** |
8 | 8 | * |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Joins any two models together via a has-and-belongs-to-many relation, using |
4 | 4 | * the esp_extra_join table. |
5 | 5 | */ |
6 | -class EE_HABTM_Any_Relation extends EE_HABTM_Relation{ |
|
6 | +class EE_HABTM_Any_Relation extends EE_HABTM_Relation { |
|
7 | 7 | /** |
8 | 8 | * |
9 | 9 | * @var string |
@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | * @param boolean $block_deletes for this type of relation, we block by default for now. if there are related models across this relation, block (prevent and add an error) the deletion of this model |
18 | 18 | * @param type $blocking_delete_error_message a customized error message on blocking deletes instead of the default |
19 | 19 | */ |
20 | - function __construct( $block_deletes = true, $blocking_delete_error_message =''){ |
|
21 | - parent::__construct( 'Extra_Join', $block_deletes, $blocking_delete_error_message); |
|
20 | + function __construct($block_deletes = true, $blocking_delete_error_message = '') { |
|
21 | + parent::__construct('Extra_Join', $block_deletes, $blocking_delete_error_message); |
|
22 | 22 | } |
23 | - function _construct_finalize_set_models($this_model_name, $other_model_name){ |
|
24 | - if( $this_model_name < $other_model_name ) { |
|
23 | + function _construct_finalize_set_models($this_model_name, $other_model_name) { |
|
24 | + if ($this_model_name < $other_model_name) { |
|
25 | 25 | $this->_alphabetically_first_model_name = $this_model_name; |
26 | - } else{ |
|
26 | + } else { |
|
27 | 27 | $this->_alphabetically_first_model_name = $other_model_name; |
28 | 28 | } |
29 | - return parent::_construct_finalize_set_models( $this_model_name, $other_model_name ); |
|
29 | + return parent::_construct_finalize_set_models($this_model_name, $other_model_name); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -36,21 +36,21 @@ discard block |
||
36 | 36 | * @param string $id_or_name_field should be the string 'ID' or 'name' only |
37 | 37 | * @return EE_Model_Field_Base |
38 | 38 | */ |
39 | - function get_join_table_fk_field_to( $model_name, $id_or_name_field ) { |
|
39 | + function get_join_table_fk_field_to($model_name, $id_or_name_field) { |
|
40 | 40 | $order = null; |
41 | - if( $model_name === $this->_alphabetically_first_model_name ) { |
|
41 | + if ($model_name === $this->_alphabetically_first_model_name) { |
|
42 | 42 | $order = 'first'; |
43 | 43 | } else { |
44 | 44 | $order = 'second'; |
45 | 45 | } |
46 | - return $this->get_join_model()->field_settings_for( 'EXJ_' . $order . '_model_' . $id_or_name_field ); |
|
46 | + return $this->get_join_model()->field_settings_for('EXJ_'.$order.'_model_'.$id_or_name_field); |
|
47 | 47 | } |
48 | 48 | /** |
49 | 49 | * Gets the SQL string for joining the main model's table containing the pk to the join table. Eg "LEFT JOIN real_join_table AS join_table_alias ON this_table_alias.pk = join_table_alias.fk_to_this_table" |
50 | 50 | * @param string $model_relation_chain like 'Event.Event_Venue.Venue' |
51 | 51 | * @return string of SQL |
52 | 52 | */ |
53 | - function get_join_to_intermediate_model_statement($model_relation_chain){ |
|
53 | + function get_join_to_intermediate_model_statement($model_relation_chain) { |
|
54 | 54 | //create sql like |
55 | 55 | //LEFT JOIN join_table AS join_table_alias ON this_table_alias.this_table_pk = join_table_alias.join_table_fk_to_this |
56 | 56 | //LEFT JOIN other_table AS other_table_alias ON join_table_alias.join_table_fk_to_other = other_table_alias.other_table_pk |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | $field_with_model_name = $this->get_join_table_fk_field_to( |
65 | 65 | $this->get_this_model()->get_this_model_name(), |
66 | 66 | 'name' ); |
67 | - $this_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_this_model()->get_this_model_name()) . $this_table_pk_field->get_table_alias(); |
|
68 | - $join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_join_model()->get_this_model_name()) . $join_table_fk_field_to_this_table->get_table_alias(); |
|
67 | + $this_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_this_model()->get_this_model_name()).$this_table_pk_field->get_table_alias(); |
|
68 | + $join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_join_model()->get_this_model_name()).$join_table_fk_field_to_this_table->get_table_alias(); |
|
69 | 69 | $join_table = $this->get_join_model()->get_table_for_alias($join_table_alias); |
70 | 70 | //phew! ok, we have all the info we need, now we can create the SQL join string |
71 | 71 | $SQL = $this->_left_join( |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $join_table_fk_field_to_this_table->get_table_column(), |
75 | 75 | $this_table_alias, |
76 | 76 | $this_table_pk_field->get_table_column(), |
77 | - $field_with_model_name->get_qualified_column()."='".$this->get_this_model()->get_this_model_name()."'" ) . |
|
77 | + $field_with_model_name->get_qualified_column()."='".$this->get_this_model()->get_this_model_name()."'" ). |
|
78 | 78 | $this->get_join_model()->_construct_internal_join_to_table_with_alias($join_table_alias); |
79 | 79 | |
80 | 80 | return $SQL; |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | * @param string $model_relation_chain like 'Event.Event_Venue.Venue' |
88 | 88 | * @return string of SQL |
89 | 89 | */ |
90 | - function get_join_statement($model_relation_chain){ |
|
91 | - if( $this->_model_relation_chain_to_join_model === NULL ){ |
|
92 | - throw new EE_Error( sprintf( __( 'When using EE_HABTM_Relation to create a join, you must call get_join_to_intermediate_model_statement BEFORE get_join_statement', 'event_espresso' ))); |
|
90 | + function get_join_statement($model_relation_chain) { |
|
91 | + if ($this->_model_relation_chain_to_join_model === NULL) { |
|
92 | + throw new EE_Error(sprintf(__('When using EE_HABTM_Relation to create a join, you must call get_join_to_intermediate_model_statement BEFORE get_join_statement', 'event_espresso'))); |
|
93 | 93 | } |
94 | 94 | $join_table_fk_field_to_this_table = $this->get_join_table_fk_field_to( |
95 | 95 | $this->get_this_model()->get_this_model_name(), |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | $this->get_other_model()->get_this_model_name(), |
102 | 102 | 'name' ); |
103 | 103 | |
104 | - $join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($this->_model_relation_chain_to_join_model, $this->get_join_model()->get_this_model_name()) . $join_table_fk_field_to_this_table->get_table_alias(); |
|
104 | + $join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($this->_model_relation_chain_to_join_model, $this->get_join_model()->get_this_model_name()).$join_table_fk_field_to_this_table->get_table_alias(); |
|
105 | 105 | |
106 | 106 | $other_table_pk_field = $this->get_other_model()->get_primary_key_field(); |
107 | - $other_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_other_model()->get_this_model_name()) . $other_table_pk_field->get_table_alias(); |
|
107 | + $other_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_other_model()->get_this_model_name()).$other_table_pk_field->get_table_alias(); |
|
108 | 108 | $other_table = $this->get_other_model()->get_table_for_alias($other_table_alias); |
109 | 109 | |
110 | 110 | $SQL = $this->_left_join( |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $join_table_alias, |
115 | 115 | $join_table_fk_field_to_other_table->get_table_column(), |
116 | 116 | $field_with_other_model_name->get_qualified_column()."='".$this->get_other_model()->get_this_model_name()."'" |
117 | - ) . |
|
117 | + ). |
|
118 | 118 | $this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias); |
119 | 119 | return $SQL; |
120 | 120 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param array $extra_join_model_fields_n_values col=>val pairs that are used as extra conditions for checking existing values and for setting new rows if no exact matches. |
127 | 127 | * @return EE_Base_Class |
128 | 128 | */ |
129 | - function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array() ){ |
|
129 | + function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array()) { |
|
130 | 130 | $this_model_obj = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true); |
131 | 131 | $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true); |
132 | 132 | //check if such a relationship already exists |
@@ -143,31 +143,31 @@ discard block |
||
143 | 143 | $this->get_other_model()->get_this_model_name(), |
144 | 144 | 'name' ); |
145 | 145 | |
146 | - $cols_n_values = array( |
|
146 | + $cols_n_values = array( |
|
147 | 147 | $join_model_fk_to_this_model->get_name() => $this_model_obj->ID(), |
148 | 148 | $join_model_name_field_to_this_model->get_name() => $this_model_obj->get_model()->get_this_model_name(), |
149 | 149 | $join_model_fk_to_other_model->get_name() => $other_model_obj->ID(), |
150 | 150 | $join_model_name_field_to_other_model->get_name() => $other_model_obj->get_model()->get_this_model_name() ); |
151 | 151 | |
152 | 152 | //if $where_query exists lets add them to the query_params. |
153 | - if ( !empty( $extra_join_model_fields_n_values ) ) { |
|
153 | + if ( ! empty($extra_join_model_fields_n_values)) { |
|
154 | 154 | //make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name) |
155 | 155 | //make sure we strip THIS models name from the query param |
156 | - foreach ( $extra_join_model_fields_n_values as $query_param => $val ) { |
|
157 | - $query_param = str_replace($this->get_join_model()->get_this_model_name().".","", $query_param); |
|
156 | + foreach ($extra_join_model_fields_n_values as $query_param => $val) { |
|
157 | + $query_param = str_replace($this->get_join_model()->get_this_model_name().".", "", $query_param); |
|
158 | 158 | $parsed_query[$query_param] = $val; |
159 | 159 | } |
160 | - $cols_n_values = array_merge( $cols_n_values, $parsed_query ); |
|
160 | + $cols_n_values = array_merge($cols_n_values, $parsed_query); |
|
161 | 161 | } |
162 | 162 | |
163 | - $query_params = array( $cols_n_values ); |
|
163 | + $query_params = array($cols_n_values); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | $existing_entry_in_join_table = $this->get_join_model()->get_one($query_params); |
167 | 167 | //if there is already an entry in the join table, indicating a relationship, we're done |
168 | 168 | //again, if you want more sophisticated logic or insertions (handling more columns than just 2 foreign keys to |
169 | 169 | //the other tables, use the joining model directly! |
170 | - if( ! $existing_entry_in_join_table ){ |
|
170 | + if ( ! $existing_entry_in_join_table) { |
|
171 | 171 | $this->get_join_model()->insert($cols_n_values); |
172 | 172 | } |
173 | 173 | return $other_model_obj; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * * @param array $where_query col=>val pairs that are used as extra conditions for checking existing values and for removing existing rows if exact matches exist. |
180 | 180 | * @return EE_Base_Class |
181 | 181 | */ |
182 | - function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array() ){ |
|
182 | + function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array()) { |
|
183 | 183 | $this_model_obj = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true); |
184 | 184 | $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true); |
185 | 185 | //check if such a relationship already exists |
@@ -196,24 +196,24 @@ discard block |
||
196 | 196 | $this->get_other_model()->get_this_model_name(), |
197 | 197 | 'name' ); |
198 | 198 | |
199 | - $cols_n_values = array( |
|
199 | + $cols_n_values = array( |
|
200 | 200 | $join_model_fk_to_this_model->get_name() => $this_model_obj->ID(), |
201 | 201 | $join_model_name_field_to_this_model->get_name() => $this_model_obj->get_model()->get_this_model_name(), |
202 | 202 | $join_model_fk_to_other_model->get_name() => $other_model_obj->ID(), |
203 | 203 | $join_model_name_field_to_other_model->get_name() => $other_model_obj->get_model()->get_this_model_name() ); |
204 | 204 | |
205 | 205 | //if $where_query exists lets add them to the query_params. |
206 | - if ( !empty( $where_query ) ) { |
|
206 | + if ( ! empty($where_query)) { |
|
207 | 207 | //make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name) |
208 | 208 | //make sure we strip THIS models name from the query param |
209 | - foreach ( $where_query as $query_param => $val ) { |
|
210 | - $query_param = str_replace($this->get_join_model()->get_this_model_name().".","", $query_param); |
|
209 | + foreach ($where_query as $query_param => $val) { |
|
210 | + $query_param = str_replace($this->get_join_model()->get_this_model_name().".", "", $query_param); |
|
211 | 211 | $parsed_query[$query_param] = $val; |
212 | 212 | } |
213 | - $cols_n_values = array_merge( $cols_n_values, $parsed_query ); |
|
213 | + $cols_n_values = array_merge($cols_n_values, $parsed_query); |
|
214 | 214 | } |
215 | 215 | |
216 | - $existing_entry_in_join_table = $this->get_join_model()->delete( array($cols_n_values) ); |
|
216 | + $existing_entry_in_join_table = $this->get_join_model()->delete(array($cols_n_values)); |
|
217 | 217 | return $other_model_obj; |
218 | 218 | } |
219 | 219 | } |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param null $timezone |
23 | 23 | * @return EE_Event_Message_Template|mixed |
24 | 24 | */ |
25 | - public static function new_instance( $props_n_values = array(), $timezone = NULL ) { |
|
26 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
27 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
25 | + public static function new_instance($props_n_values = array(), $timezone = NULL) { |
|
26 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
27 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @param null $timezone |
35 | 35 | * @return EE_Event_Message_Template |
36 | 36 | */ |
37 | - public static function new_instance_from_db ( $props_n_values = array(), $timezone = NULL ) { |
|
38 | - return new self( $props_n_values, TRUE, $timezone ); |
|
37 | + public static function new_instance_from_db($props_n_values = array(), $timezone = NULL) { |
|
38 | + return new self($props_n_values, TRUE, $timezone); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | /** |
185 | 185 | * returns the text for displaying the question to users |
186 | 186 | * @access public |
187 | - * @return string |
|
187 | + * @return boolean |
|
188 | 188 | */ |
189 | 189 | public function display_text() { |
190 | 190 | return $this->get( 'QST_display_text' ); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | /** |
196 | 196 | * returns the text for the administrative label |
197 | 197 | * @access public |
198 | - * @return string |
|
198 | + * @return boolean |
|
199 | 199 | */ |
200 | 200 | public function admin_label() { |
201 | 201 | return $this->get( 'QST_admin_label' ); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * returns the attendee column name for this question |
208 | 208 | * @access public |
209 | - * @return string |
|
209 | + * @return boolean |
|
210 | 210 | */ |
211 | 211 | public function system_ID() { |
212 | 212 | return $this->get( 'QST_system' ); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * returns the text which should be displayed when a user |
230 | 230 | * doesn't answer this question in a form |
231 | 231 | * @access public |
232 | - * @return string |
|
232 | + * @return boolean |
|
233 | 233 | */ |
234 | 234 | public function required_text() { |
235 | 235 | return $this->get( 'QST_required_text' ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | /** |
241 | 241 | * returns the type of this question |
242 | 242 | * @access public |
243 | - * @return string |
|
243 | + * @return boolean |
|
244 | 244 | */ |
245 | 245 | public function type() { |
246 | 246 | return $this->get( 'QST_type' ); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * returns an integer showing where this question should |
253 | 253 | * be placed in a sequence of questions |
254 | 254 | * @access public |
255 | - * @return int |
|
255 | + * @return boolean |
|
256 | 256 | */ |
257 | 257 | public function order() { |
258 | 258 | return $this->get( 'QST_order' ); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | /** |
276 | 276 | * returns the id the wordpress user who created this question |
277 | 277 | * @access public |
278 | - * @return int |
|
278 | + * @return boolean |
|
279 | 279 | */ |
280 | 280 | public function wp_user() { |
281 | 281 | return $this->get( 'QST_wp_user' ); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * Adds an option for this question. Note: if the option were previously associated with a different |
370 | 370 | * Question, that relationship will be overwritten. |
371 | 371 | * @param EE_Question_Option $option |
372 | - * @return boolean success |
|
372 | + * @return EE_Base_Class success |
|
373 | 373 | */ |
374 | 374 | public function add_option( EE_Question_Option $option ) { |
375 | 375 | return $this->_add_relation_to( $option, 'Question_Option' ); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | /** |
393 | 393 | * Marks the option as deleted. |
394 | 394 | * @param EE_Question_Option $option |
395 | - * @return boolean success |
|
395 | + * @return EE_Base_Class success |
|
396 | 396 | */ |
397 | 397 | public function remove_option( EE_Question_Option $option ) { |
398 | 398 | return $this->_remove_relation_to( $option, 'Question_Option' ); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | |
462 | 462 | /** |
463 | 463 | * Returns the question's maximum allowed response size |
464 | - * @return int|float |
|
464 | + * @return boolean |
|
465 | 465 | */ |
466 | 466 | public function max() { |
467 | 467 | return $this->get( 'QST_max' ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | * date_format and the second value is the time format |
38 | 38 | * @return EE_Question |
39 | 39 | */ |
40 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
41 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
42 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
40 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
41 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
42 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * the website will be used. |
51 | 51 | * @return EE_Question |
52 | 52 | */ |
53 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
54 | - return new self( $props_n_values, TRUE, $timezone ); |
|
53 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
54 | + return new self($props_n_values, TRUE, $timezone); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @access public |
63 | 63 | * @param string $QST_display_text |
64 | 64 | */ |
65 | - public function set_display_text( $QST_display_text = '' ) { |
|
66 | - $this->set( 'QST_display_text', $QST_display_text ); |
|
65 | + public function set_display_text($QST_display_text = '') { |
|
66 | + $this->set('QST_display_text', $QST_display_text); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * @access public |
75 | 75 | * @param string $QST_admin_label |
76 | 76 | */ |
77 | - public function set_admin_label( $QST_admin_label = '' ) { |
|
78 | - $this->set( 'QST_admin_label', $QST_admin_label ); |
|
77 | + public function set_admin_label($QST_admin_label = '') { |
|
78 | + $this->set('QST_admin_label', $QST_admin_label); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * @access public |
87 | 87 | * @param mixed $QST_system |
88 | 88 | */ |
89 | - public function set_system_ID( $QST_system = '' ) { |
|
90 | - $this->set( 'QST_system', $QST_system ); |
|
89 | + public function set_system_ID($QST_system = '') { |
|
90 | + $this->set('QST_system', $QST_system); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * @access public |
99 | 99 | * @param string $QST_type |
100 | 100 | */ |
101 | - public function set_question_type( $QST_type = '' ) { |
|
102 | - $this->set( 'QST_type', $QST_type ); |
|
101 | + public function set_question_type($QST_type = '') { |
|
102 | + $this->set('QST_type', $QST_type); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | * @access public |
111 | 111 | * @param bool $QST_required |
112 | 112 | */ |
113 | - public function set_required( $QST_required = FALSE ) { |
|
114 | - $this->set( 'QST_required', $QST_required ); |
|
113 | + public function set_required($QST_required = FALSE) { |
|
114 | + $this->set('QST_required', $QST_required); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @access public |
123 | 123 | * @param string $QST_required_text |
124 | 124 | */ |
125 | - public function set_required_text( $QST_required_text = '' ) { |
|
126 | - $this->set( 'QST_required_text', $QST_required_text ); |
|
125 | + public function set_required_text($QST_required_text = '') { |
|
126 | + $this->set('QST_required_text', $QST_required_text); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | * @access public |
135 | 135 | * @param int $QST_order |
136 | 136 | */ |
137 | - public function set_order( $QST_order = 0 ) { |
|
138 | - $this->set( 'QST_order', $QST_order ); |
|
137 | + public function set_order($QST_order = 0) { |
|
138 | + $this->set('QST_order', $QST_order); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | * @access public |
147 | 147 | * @param bool $QST_admin_only |
148 | 148 | */ |
149 | - public function set_admin_only( $QST_admin_only = FALSE ) { |
|
150 | - $this->set( 'QST_admin_only', $QST_admin_only ); |
|
149 | + public function set_admin_only($QST_admin_only = FALSE) { |
|
150 | + $this->set('QST_admin_only', $QST_admin_only); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * @access public |
159 | 159 | * @param int $QST_wp_user |
160 | 160 | */ |
161 | - public function set_wp_user( $QST_wp_user = 1 ) { |
|
162 | - $this->set( 'QST_wp_user', $QST_wp_user ); |
|
161 | + public function set_wp_user($QST_wp_user = 1) { |
|
162 | + $this->set('QST_wp_user', $QST_wp_user); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | * @access public |
176 | 176 | * @param bool $QST_deleted |
177 | 177 | */ |
178 | - public function set_deleted( $QST_deleted = FALSE ) { |
|
179 | - $this->set( 'QST_deleted', $QST_deleted ); |
|
178 | + public function set_deleted($QST_deleted = FALSE) { |
|
179 | + $this->set('QST_deleted', $QST_deleted); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @return string |
188 | 188 | */ |
189 | 189 | public function display_text() { |
190 | - return $this->get( 'QST_display_text' ); |
|
190 | + return $this->get('QST_display_text'); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return string |
199 | 199 | */ |
200 | 200 | public function admin_label() { |
201 | - return $this->get( 'QST_admin_label' ); |
|
201 | + return $this->get('QST_admin_label'); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return string |
210 | 210 | */ |
211 | 211 | public function system_ID() { |
212 | - return $this->get( 'QST_system' ); |
|
212 | + return $this->get('QST_system'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return boolean |
221 | 221 | */ |
222 | 222 | public function required() { |
223 | - return $this->get( 'QST_required' ); |
|
223 | + return $this->get('QST_required'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return string |
233 | 233 | */ |
234 | 234 | public function required_text() { |
235 | - return $this->get( 'QST_required_text' ); |
|
235 | + return $this->get('QST_required_text'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @return string |
244 | 244 | */ |
245 | 245 | public function type() { |
246 | - return $this->get( 'QST_type' ); |
|
246 | + return $this->get('QST_type'); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @return int |
256 | 256 | */ |
257 | 257 | public function order() { |
258 | - return $this->get( 'QST_order' ); |
|
258 | + return $this->get('QST_order'); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @return boolean |
268 | 268 | */ |
269 | 269 | public function admin_only() { |
270 | - return $this->get( 'QST_admin_only' ); |
|
270 | + return $this->get('QST_admin_only'); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @return int |
279 | 279 | */ |
280 | 280 | public function wp_user() { |
281 | - return $this->get( 'QST_wp_user' ); |
|
281 | + return $this->get('QST_wp_user'); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @return boolean |
290 | 290 | */ |
291 | 291 | public function deleted() { |
292 | - return $this->get( 'QST_deleted' ); |
|
292 | + return $this->get('QST_deleted'); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @return EE_Answer[] |
300 | 300 | */ |
301 | 301 | public function answers() { |
302 | - return $this->get_many_related( 'Answer' ); |
|
302 | + return $this->get_many_related('Answer'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @return boolean true = has answers, false = no answers. |
310 | 310 | */ |
311 | 311 | public function has_answers() { |
312 | - return $this->count_related( 'Answer' ) > 0 ? TRUE : FALSE; |
|
312 | + return $this->count_related('Answer') > 0 ? TRUE : FALSE; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return EE_Question_Group[] |
320 | 320 | */ |
321 | 321 | public function question_groups() { |
322 | - return $this->get_many_related( 'Question_Group' ); |
|
322 | + return $this->get_many_related('Question_Group'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -333,24 +333,24 @@ discard block |
||
333 | 333 | * whether it was trashed or not. |
334 | 334 | * @return EE_Question_Option[] |
335 | 335 | */ |
336 | - public function options( $notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL ) { |
|
337 | - if ( ! $this->ID() ) { |
|
336 | + public function options($notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL) { |
|
337 | + if ( ! $this->ID()) { |
|
338 | 338 | return array(); |
339 | 339 | } |
340 | 340 | $query_params = array(); |
341 | - if ( $selected_value_to_always_include ) { |
|
342 | - if ( is_array( $selected_value_to_always_include ) ) { |
|
343 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_value' ] = array( 'IN', $selected_value_to_always_include ); |
|
341 | + if ($selected_value_to_always_include) { |
|
342 | + if (is_array($selected_value_to_always_include)) { |
|
343 | + $query_params[0]['OR*options-query']['QSO_value'] = array('IN', $selected_value_to_always_include); |
|
344 | 344 | } else { |
345 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_value' ] = $selected_value_to_always_include; |
|
345 | + $query_params[0]['OR*options-query']['QSO_value'] = $selected_value_to_always_include; |
|
346 | 346 | } |
347 | 347 | } |
348 | - if ( $notDeletedOptionsOnly ) { |
|
349 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_deleted' ] = FALSE; |
|
348 | + if ($notDeletedOptionsOnly) { |
|
349 | + $query_params[0]['OR*options-query']['QSO_deleted'] = FALSE; |
|
350 | 350 | } |
351 | 351 | //order by QSO_order |
352 | - $query_params[ 'order_by' ] = array( 'QSO_order' => 'ASC' ); |
|
353 | - return $this->get_many_related( 'Question_Option', $query_params ); |
|
352 | + $query_params['order_by'] = array('QSO_order' => 'ASC'); |
|
353 | + return $this->get_many_related('Question_Option', $query_params); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @return \EE_Question_Option[] |
361 | 361 | */ |
362 | 362 | public function temp_options() { |
363 | - return $this->_model_relations[ 'Question_Option' ]; |
|
363 | + return $this->_model_relations['Question_Option']; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | * @param EE_Question_Option $option |
372 | 372 | * @return boolean success |
373 | 373 | */ |
374 | - public function add_option( EE_Question_Option $option ) { |
|
375 | - return $this->_add_relation_to( $option, 'Question_Option' ); |
|
374 | + public function add_option(EE_Question_Option $option) { |
|
375 | + return $this->_add_relation_to($option, 'Question_Option'); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | * @param EE_Question_Option $option |
383 | 383 | * @return boolean success |
384 | 384 | */ |
385 | - public function add_temp_option( EE_Question_Option $option ) { |
|
386 | - $this->_model_relations[ 'Question_Option' ][ ] = $option; |
|
385 | + public function add_temp_option(EE_Question_Option $option) { |
|
386 | + $this->_model_relations['Question_Option'][] = $option; |
|
387 | 387 | return TRUE; |
388 | 388 | } |
389 | 389 | |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | * @param EE_Question_Option $option |
395 | 395 | * @return boolean success |
396 | 396 | */ |
397 | - public function remove_option( EE_Question_Option $option ) { |
|
398 | - return $this->_remove_relation_to( $option, 'Question_Option' ); |
|
397 | + public function remove_option(EE_Question_Option $option) { |
|
398 | + return $this->_remove_relation_to($option, 'Question_Option'); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -404,8 +404,8 @@ discard block |
||
404 | 404 | * @return bool |
405 | 405 | */ |
406 | 406 | public function is_system_question() { |
407 | - $system_ID = $this->get( 'QST_system' ); |
|
408 | - return ! empty( $system_ID ) ? TRUE : FALSE; |
|
407 | + $system_ID = $this->get('QST_system'); |
|
408 | + return ! empty($system_ID) ? TRUE : FALSE; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function set_order_to_latest() { |
420 | 420 | $latest_order = $this->get_model()->get_latest_question_order(); |
421 | - $latest_order ++; |
|
422 | - $this->set( 'QST_order', $latest_order ); |
|
421 | + $latest_order++; |
|
422 | + $this->set('QST_order', $latest_order); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | |
@@ -438,20 +438,20 @@ discard block |
||
438 | 438 | * Duplicates this question and its question options |
439 | 439 | * @return \EE_Question |
440 | 440 | */ |
441 | - public function duplicate( $options = array() ) { |
|
441 | + public function duplicate($options = array()) { |
|
442 | 442 | $new_question = clone $this; |
443 | - $new_question->set( 'QST_ID', null ); |
|
444 | - $new_question->set_display_text( sprintf( __( '%s **Duplicate**', 'event_espresso' ), $this->display_text() ) ); |
|
445 | - $new_question->set_admin_label( sprintf( __( '%s **Duplicate**', 'event_espresso' ), $this->admin_label() ) ); |
|
446 | - $new_question->set_system_ID( null ); |
|
447 | - $new_question->set_wp_user( get_current_user_id() ); |
|
443 | + $new_question->set('QST_ID', null); |
|
444 | + $new_question->set_display_text(sprintf(__('%s **Duplicate**', 'event_espresso'), $this->display_text())); |
|
445 | + $new_question->set_admin_label(sprintf(__('%s **Duplicate**', 'event_espresso'), $this->admin_label())); |
|
446 | + $new_question->set_system_ID(null); |
|
447 | + $new_question->set_wp_user(get_current_user_id()); |
|
448 | 448 | //if we're duplicating a trashed question, assume we don't want the new one to be trashed |
449 | - $new_question->set_deleted( false ); |
|
449 | + $new_question->set_deleted(false); |
|
450 | 450 | $success = $new_question->save(); |
451 | - if( $success ) { |
|
451 | + if ($success) { |
|
452 | 452 | //we don't totally want to duplicate the question options, because we want them to be for the NEW question |
453 | - foreach( $this->options() as $question_option ) { |
|
454 | - $question_option->duplicate( array( 'QST_ID' => $new_question->ID() ) ); |
|
453 | + foreach ($this->options() as $question_option) { |
|
454 | + $question_option->duplicate(array('QST_ID' => $new_question->ID())); |
|
455 | 455 | } |
456 | 456 | return $new_question; |
457 | 457 | } else { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @return int|float |
465 | 465 | */ |
466 | 466 | public function max() { |
467 | - return $this->get( 'QST_max' ); |
|
467 | + return $this->get('QST_max'); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | * @param int|float $new_max |
473 | 473 | * @return int|float |
474 | 474 | */ |
475 | - public function set_max( $new_max ) { |
|
476 | - return $this->set( 'QST_max', $new_max ); |
|
475 | + public function set_max($new_max) { |
|
476 | + return $this->set('QST_max', $new_max); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 |