@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param array $arguments |
40 | 40 | * @return \EE_CPT_Attendee_Strategy |
41 | 41 | */ |
42 | - public function __construct( $arguments = array() ) { |
|
43 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
44 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
42 | + public function __construct($arguments = array()) { |
|
43 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
44 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
45 | 45 | // add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
46 | 46 | } |
47 | 47 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param WP_Query $wp_query |
56 | 56 | * @return void |
57 | 57 | */ |
58 | - public function the_posts( $posts, WP_Query $wp_query) { |
|
58 | + public function the_posts($posts, WP_Query $wp_query) { |
|
59 | 59 | //$EVT = EE_Registry::instance()->load_model( 'Event' ); |
60 | 60 | // EEH_Debug_Tools::printr( $EVT, '$EVT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
61 | 61 | // $EVT_IDs = array(); |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -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 | * Class EE_Base_Class_Repository |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * @param array $arguments arrays of arguments that will be passed to the object's save method |
40 | 40 | * @return bool | int |
41 | 41 | */ |
42 | - public function save( $arguments = array() ) { |
|
43 | - return $this->persist( 'save', $arguments ); |
|
42 | + public function save($arguments = array()) { |
|
43 | + return $this->persist('save', $arguments); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @return bool | int |
55 | 55 | */ |
56 | 56 | public function save_all() { |
57 | - return $this->persist_all( 'save' ); |
|
57 | + return $this->persist_all('save'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * @return bool |
69 | 69 | */ |
70 | 70 | public function delete() { |
71 | - $success = $this->_call_user_func_array_on_current( 'delete' ); |
|
72 | - $this->remove( $this->current() ); |
|
71 | + $success = $this->_call_user_func_array_on_current('delete'); |
|
72 | + $this->remove($this->current()); |
|
73 | 73 | return $success; |
74 | 74 | } |
75 | 75 | |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | public function delete_all() { |
87 | 87 | $success = true; |
88 | 88 | $this->rewind(); |
89 | - while ( $this->valid() ) { |
|
89 | + while ($this->valid()) { |
|
90 | 90 | // any db error will result in false being returned |
91 | - $success = $this->_call_user_func_array_on_current( 'delete' ) !== false ? $success : false; |
|
91 | + $success = $this->_call_user_func_array_on_current('delete') !== false ? $success : false; |
|
92 | 92 | // can't remove current object because valid() requires it |
93 | 93 | // so just capture current object temporarily |
94 | 94 | $object = $this->current(); |
95 | 95 | // advance the pointer |
96 | 96 | $this->next(); |
97 | 97 | // THEN remove the object from the repository |
98 | - $this->remove( $object ); |
|
98 | + $this->remove($object); |
|
99 | 99 | } |
100 | 100 | return $success; |
101 | 101 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | * @param string $previous_value |
114 | 114 | * @return bool | int |
115 | 115 | */ |
116 | - public function update_extra_meta( $meta_key, $meta_value, $previous_value = null ) { |
|
117 | - return $this->_call_user_func_array_on_current( 'update_extra_meta', array( $meta_key, $meta_value, $previous_value ) ); |
|
116 | + public function update_extra_meta($meta_key, $meta_value, $previous_value = null) { |
|
117 | + return $this->_call_user_func_array_on_current('update_extra_meta', array($meta_key, $meta_value, $previous_value)); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function &instance() { |
56 | 56 | // check if class object is instantiated |
57 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Data_Mapper )) { |
|
57 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Data_Mapper)) { |
|
58 | 58 | self::$_instance = new self(); |
59 | 59 | } |
60 | 60 | return self::$_instance; |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | * @ return void |
72 | 72 | */ |
73 | 73 | final function __destruct() {} |
74 | - final function __call($a,$b) {} |
|
75 | - public static function __callStatic($a,$b) {} |
|
74 | + final function __call($a, $b) {} |
|
75 | + public static function __callStatic($a, $b) {} |
|
76 | 76 | final function __get($a) {} |
77 | - final function __set($a,$b) {} |
|
77 | + final function __set($a, $b) {} |
|
78 | 78 | final function __isset($a) {} |
79 | 79 | final function __unset($a) {} |
80 | 80 | final function __sleep() { |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | |
30 | 30 | /** |
31 | - * instance of the EE_Data_Mapper Object |
|
32 | - * @private _instance |
|
33 | - */ |
|
31 | + * instance of the EE_Data_Mapper Object |
|
32 | + * @private _instance |
|
33 | + */ |
|
34 | 34 | private static $_instance = NULL; |
35 | 35 | |
36 | 36 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | } |
83 | 83 | final function __wakeup() {} |
84 | 84 | final function __toString() { |
85 | - return ''; |
|
86 | - } |
|
85 | + return ''; |
|
86 | + } |
|
87 | 87 | final function __invoke() {} |
88 | 88 | final static function __set_state() {} |
89 | 89 | final function __clone() {} |
@@ -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 | * |
@@ -60,12 +62,14 @@ discard block |
||
60 | 62 | */ |
61 | 63 | private static function _maybe_get_langfile() { |
62 | 64 | self::$_lang = get_locale(); |
63 | - if ( $has_check = get_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION ) || empty( self::$_lang ) ) |
|
64 | - return; |
|
65 | + if ( $has_check = get_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION ) || empty( self::$_lang ) ) { |
|
66 | + return; |
|
67 | + } |
|
65 | 68 | |
66 | 69 | //if lang is en_US or empty then lets just get out. (Event Espresso core is en_US) |
67 | - if ( empty( self::$_lang ) || self::$_lang == 'en_US' ) |
|
68 | - return; |
|
70 | + if ( empty( self::$_lang ) || self::$_lang == 'en_US' ) { |
|
71 | + return; |
|
72 | + } |
|
69 | 73 | |
70 | 74 | //made it here so let's get the file from the github repo |
71 | 75 | $sideloader_args = array( |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | public static function load_textdomain() { |
40 | 40 | self::_maybe_get_langfile(); |
41 | 41 | //now load the textdomain |
42 | - if ( ! empty( self::$_lang ) && is_readable( EE_LANGUAGES_SAFE_DIR . 'event_espresso-' . self::$_lang . '.mo' ) ) { |
|
42 | + if ( ! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR.'event_espresso-'.self::$_lang.'.mo')) { |
|
43 | 43 | load_plugin_textdomain('event_espresso', FALSE, EE_LANGUAGES_SAFE_LOC); |
44 | - } else if ( ! empty( self::$_lang ) && is_readable( EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo' ) ) { |
|
45 | - load_textdomain( 'event_espresso', EE_LANGUAGES_SAFE_DIR . 'event-espresso-4-' . self::$_lang . '.mo' ); |
|
44 | + } else if ( ! empty(self::$_lang) && is_readable(EE_LANGUAGES_SAFE_DIR.'event-espresso-4-'.self::$_lang.'.mo')) { |
|
45 | + load_textdomain('event_espresso', EE_LANGUAGES_SAFE_DIR.'event-espresso-4-'.self::$_lang.'.mo'); |
|
46 | 46 | } else { |
47 | - load_plugin_textdomain( 'event_espresso', FALSE, dirname( EE_PLUGIN_BASENAME ) . '/languages/'); |
|
47 | + load_plugin_textdomain('event_espresso', FALSE, dirname(EE_PLUGIN_BASENAME).'/languages/'); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -59,24 +59,24 @@ discard block |
||
59 | 59 | */ |
60 | 60 | private static function _maybe_get_langfile() { |
61 | 61 | self::$_lang = get_locale(); |
62 | - if ( $has_check = get_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION ) || empty( self::$_lang ) ) |
|
62 | + if ($has_check = get_option('ee_lang_check_'.self::$_lang.'_'.EVENT_ESPRESSO_VERSION) || empty(self::$_lang)) |
|
63 | 63 | return; |
64 | 64 | |
65 | 65 | //if lang is en_US or empty then lets just get out. (Event Espresso core is en_US) |
66 | - if ( empty( self::$_lang ) || self::$_lang == 'en_US' ) |
|
66 | + if (empty(self::$_lang) || self::$_lang == 'en_US') |
|
67 | 67 | return; |
68 | 68 | |
69 | 69 | //made it here so let's get the file from the github repo |
70 | 70 | $sideloader_args = array( |
71 | - '_upload_to' => EE_PLUGIN_DIR_PATH . 'languages/', |
|
72 | - '_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-' . self::$_lang . '.mo?raw=true', |
|
73 | - '_new_file_name' => 'event_espresso-' . self::$_lang . '.mo' |
|
71 | + '_upload_to' => EE_PLUGIN_DIR_PATH.'languages/', |
|
72 | + '_upload_from' => 'https://github.com/eventespresso/languages-ee4/blob/master/event_espresso-'.self::$_lang.'.mo?raw=true', |
|
73 | + '_new_file_name' => 'event_espresso-'.self::$_lang.'.mo' |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | |
77 | - $sideloader = EE_Registry::instance()->load_helper('Sideloader', $sideloader_args, FALSE ); |
|
77 | + $sideloader = EE_Registry::instance()->load_helper('Sideloader', $sideloader_args, FALSE); |
|
78 | 78 | |
79 | 79 | $sideloader->sideload(); |
80 | - update_option( 'ee_lang_check_' . self::$_lang . '_' . EVENT_ESPRESSO_VERSION, 1 ); |
|
80 | + update_option('ee_lang_check_'.self::$_lang.'_'.EVENT_ESPRESSO_VERSION, 1); |
|
81 | 81 | } |
82 | 82 | } //end EE_Load_Textdomain |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * |
4 | 6 | * Class EE_Log |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
2 | 2 | /** |
3 | 3 | * |
4 | 4 | * Class EE_Log |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return EE_Log |
63 | 63 | */ |
64 | 64 | public static function instance() { |
65 | - if ( ! self::$_instance instanceof EE_Log ) { |
|
65 | + if ( ! self::$_instance instanceof EE_Log) { |
|
66 | 66 | self::$_instance = new self(); |
67 | 67 | } |
68 | 68 | return self::$_instance; |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | */ |
75 | 75 | private function __construct() { |
76 | 76 | |
77 | - if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging ) { |
|
77 | + if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - $this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS; |
|
81 | + $this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS; |
|
82 | 82 | $this->_log_file = EE_Registry::instance()->CFG->admin->log_file_name(); |
83 | 83 | $this->_log = ''; |
84 | 84 | $this->_debug_file = EE_Registry::instance()->CFG->admin->debug_file_name(); |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url; |
87 | 87 | $this->_remote_log = ''; |
88 | 88 | |
89 | - add_action( 'admin_init', array( $this, 'verify_filesystem' ), -10 ); |
|
90 | - add_action( 'AHEE_log', array( $this, 'log' ), 10, 4 ); |
|
91 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging ) { |
|
92 | - add_action( 'shutdown', array( $this, 'write_log' ), 9999 ); |
|
89 | + add_action('admin_init', array($this, 'verify_filesystem'), -10); |
|
90 | + add_action('AHEE_log', array($this, 'log'), 10, 4); |
|
91 | + if (EE_Registry::instance()->CFG->admin->use_full_logging) { |
|
92 | + add_action('shutdown', array($this, 'write_log'), 9999); |
|
93 | 93 | // if WP_DEBUG |
94 | - add_action( 'shutdown', array( $this, 'write_debug' ), 9999 ); |
|
94 | + add_action('shutdown', array($this, 'write_debug'), 9999); |
|
95 | 95 | } |
96 | - if ( EE_Registry::instance()->CFG->admin->use_remote_logging ) { |
|
97 | - add_action( 'shutdown', array( $this, 'send_log' ), 9999 ); |
|
96 | + if (EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
97 | + add_action('shutdown', array($this, 'send_log'), 9999); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | } |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function verify_filesystem() { |
110 | 110 | try { |
111 | - EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file ); |
|
112 | - EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file ); |
|
113 | - EEH_File::add_htaccess_deny_from_all( $this->_logs_folder ); |
|
114 | - } catch( EE_Error $e ){ |
|
115 | - EE_Error::add_error( sprintf( __( 'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
111 | + EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file); |
|
112 | + EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file); |
|
113 | + EEH_File::add_htaccess_deny_from_all($this->_logs_folder); |
|
114 | + } catch (EE_Error $e) { |
|
115 | + EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | } |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | * @param string $type |
130 | 130 | * @return string |
131 | 131 | */ |
132 | - private function _format_message( $file = '', $function = '', $message = '', $type = '' ) { |
|
133 | - $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
134 | - $msg .= '[' . current_time( 'mysql' ) . '] '; |
|
135 | - $msg .= ! empty( $file ) ? basename( $file ) : ''; |
|
136 | - $msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : ''; |
|
137 | - $msg .= ! empty( $function ) ? $function . '()' : ''; |
|
132 | + private function _format_message($file = '', $function = '', $message = '', $type = '') { |
|
133 | + $msg = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
134 | + $msg .= '['.current_time('mysql').'] '; |
|
135 | + $msg .= ! empty($file) ? basename($file) : ''; |
|
136 | + $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
137 | + $msg .= ! empty($function) ? $function.'()' : ''; |
|
138 | 138 | $msg .= PHP_EOL; |
139 | - $type = ! empty( $type ) ? $type : 'log message'; |
|
140 | - $msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
139 | + $type = ! empty($type) ? $type : 'log message'; |
|
140 | + $msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : ''; |
|
141 | 141 | return $msg; |
142 | 142 | } |
143 | 143 | |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * @param string $message |
153 | 153 | * @param string $type |
154 | 154 | */ |
155 | - public function log( $file = '', $function = '', $message = '', $type = '' ) { |
|
156 | - $this->_log .= $this->_format_message( $file, $function, $message, $type ); |
|
155 | + public function log($file = '', $function = '', $message = '', $type = '') { |
|
156 | + $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | public function write_log() { |
166 | 166 | try { |
167 | 167 | //get existing log file and append new log info |
168 | - $this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log; |
|
169 | - EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' ); |
|
170 | - } catch( EE_Error $e ){ |
|
171 | - EE_Error::add_error( sprintf( __( 'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
168 | + $this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log; |
|
169 | + EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log'); |
|
170 | + } catch (EE_Error $e) { |
|
171 | + EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
172 | 172 | return; |
173 | 173 | } |
174 | 174 | } |
@@ -181,31 +181,31 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function send_log() { |
183 | 183 | |
184 | - if ( empty( $this->_remote_logging_url )) { |
|
184 | + if (empty($this->_remote_logging_url)) { |
|
185 | 185 | return; |
186 | 186 | } |
187 | 187 | |
188 | - $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
189 | - $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
190 | - $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
191 | - $data .= '&time=' . time(); |
|
192 | - $data .= '&remote_log=' . $this->_log; |
|
193 | - $data .= '&request_array=' . json_encode( $_REQUEST ); |
|
188 | + $data = 'domain='.$_SERVER['HTTP_HOST']; |
|
189 | + $data .= '&ip='.$_SERVER['SERVER_ADDR']; |
|
190 | + $data .= '&server_type='.$_SERVER['SERVER_SOFTWARE']; |
|
191 | + $data .= '&time='.time(); |
|
192 | + $data .= '&remote_log='.$this->_log; |
|
193 | + $data .= '&request_array='.json_encode($_REQUEST); |
|
194 | 194 | $data .= '&action=save'; |
195 | 195 | |
196 | - if ( defined( 'EELOGGING_PASS' )) { |
|
197 | - $data .= '&pass=' . EELOGGING_PASS; |
|
196 | + if (defined('EELOGGING_PASS')) { |
|
197 | + $data .= '&pass='.EELOGGING_PASS; |
|
198 | 198 | } |
199 | - if ( defined( 'EELOGGING_KEY' )) { |
|
200 | - $data .= '&key=' . EELOGGING_KEY; |
|
199 | + if (defined('EELOGGING_KEY')) { |
|
200 | + $data .= '&key='.EELOGGING_KEY; |
|
201 | 201 | } |
202 | 202 | |
203 | - $c = curl_init( $this->_remote_logging_url ); |
|
204 | - curl_setopt( $c, CURLOPT_POST, TRUE ); |
|
205 | - curl_setopt( $c, CURLOPT_POSTFIELDS, $data ); |
|
206 | - curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE ); |
|
207 | - curl_exec( $c ); |
|
208 | - curl_close( $c ); |
|
203 | + $c = curl_init($this->_remote_logging_url); |
|
204 | + curl_setopt($c, CURLOPT_POST, TRUE); |
|
205 | + curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
206 | + curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE); |
|
207 | + curl_exec($c); |
|
208 | + curl_close($c); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -216,18 +216,18 @@ discard block |
||
216 | 216 | * previous entries are overwritten |
217 | 217 | */ |
218 | 218 | public function write_debug() { |
219 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
219 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
220 | 220 | $this->_debug_log = ''; |
221 | - foreach ( $_GET as $key => $value ) { |
|
222 | - $this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL; |
|
221 | + foreach ($_GET as $key => $value) { |
|
222 | + $this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL; |
|
223 | 223 | } |
224 | - foreach ( $_POST as $key => $value ) { |
|
225 | - $this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL; |
|
224 | + foreach ($_POST as $key => $value) { |
|
225 | + $this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL; |
|
226 | 226 | } |
227 | 227 | try { |
228 | - EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' ); |
|
229 | - } catch( EE_Error $e ){ |
|
230 | - EE_Error::add_error( sprintf( __( 'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
228 | + EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log'); |
|
229 | + } catch (EE_Error $e) { |
|
230 | + EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
231 | 231 | return; |
232 | 232 | } |
233 | 233 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * __clone |
240 | 240 | */ |
241 | 241 | public function __clone() { |
242 | - trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR ); |
|
242 | + trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 |
@@ -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 | * Class EE_Object_Repository |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | * @param array $arguments arrays of arguments that will be passed to the object's callback method |
39 | 39 | * @return bool | int |
40 | 40 | */ |
41 | - protected function _call_user_func_array_on_current( $callback = '', $arguments = array() ) { |
|
42 | - if ( $callback !== '' && method_exists( $this->current(), $callback ) ) { |
|
43 | - return call_user_func_array( array( $this->current(), $callback ), $arguments ); |
|
41 | + protected function _call_user_func_array_on_current($callback = '', $arguments = array()) { |
|
42 | + if ($callback !== '' && method_exists($this->current(), $callback)) { |
|
43 | + return call_user_func_array(array($this->current(), $callback), $arguments); |
|
44 | 44 | } |
45 | 45 | return false; |
46 | 46 | } |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param string $callback name of method found on repository objects to be called |
57 | 57 | * @return bool | int |
58 | 58 | */ |
59 | - protected function _call_user_func_on_all( $callback = '' ) { |
|
59 | + protected function _call_user_func_on_all($callback = '') { |
|
60 | 60 | $success = true; |
61 | - if ( $this->valid() ) { |
|
61 | + if ($this->valid()) { |
|
62 | 62 | $this->rewind(); |
63 | - while ( $this->valid() ) { |
|
63 | + while ($this->valid()) { |
|
64 | 64 | // any negative result will toggle success to false |
65 | - $success = $this->_call_user_func_array_on_current( $callback ) ? $success : false; |
|
65 | + $success = $this->_call_user_func_array_on_current($callback) ? $success : false; |
|
66 | 66 | $this->next(); |
67 | 67 | } |
68 | 68 | $this->rewind(); |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * @param array $persistence_arguments arrays of arguments that will be passed to the object's persistence method |
87 | 87 | * @return bool | int |
88 | 88 | */ |
89 | - public function persist( $persistence_callback = '', $persistence_arguments = array() ) { |
|
90 | - $persistence_callback = ! empty( $persistence_callback ) ? $persistence_callback : $this->persist_method; |
|
91 | - return $this->_call_user_func_array_on_current( $persistence_callback, $persistence_arguments ); |
|
89 | + public function persist($persistence_callback = '', $persistence_arguments = array()) { |
|
90 | + $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method; |
|
91 | + return $this->_call_user_func_array_on_current($persistence_callback, $persistence_arguments); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | * @param string $persistence_callback name of method found on object that can be used for persisting the object |
103 | 103 | * @return bool | int |
104 | 104 | */ |
105 | - public function persist_all( $persistence_callback = '' ) { |
|
106 | - $persistence_callback = ! empty( $persistence_callback ) ? $persistence_callback : $this->persist_method; |
|
107 | - return $this->_call_user_func_on_all( $persistence_callback ); |
|
105 | + public function persist_all($persistence_callback = '') { |
|
106 | + $persistence_callback = ! empty($persistence_callback) ? $persistence_callback : $this->persist_method; |
|
107 | + return $this->_call_user_func_on_all($persistence_callback); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function do_initial_loads() { |
33 | 33 | //we want to use the corresponding admin page object (but not route it!). To do this we just set _routing to false. That way this page object is being loaded on all pages to make sure we hook into admin properly. But note... we are ONLY doing this if the given page is NOT pages we WANT to load ;) |
34 | 34 | //This is important because we have hooks that help redirect custom post type saves |
35 | - if ( !isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] != $this->_menu_map->menu_slug ) ) { |
|
35 | + if ( ! isset($_REQUEST['page']) || (isset($_REQUEST['page']) && $_REQUEST['page'] != $this->_menu_map->menu_slug)) { |
|
36 | 36 | $this->_routing = FALSE; |
37 | 37 | $this->_initialize_admin_page(); |
38 | 38 | } else { |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | $this->_initialize_admin_page(); |
41 | 41 | //added for 4.1 to completely disable autosave for our pages. This can be removed once we fully enable autosave functionality |
42 | 42 | remove_filter('wp_print_scripts', 'wp_just_in_time_script_localization'); |
43 | - add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100 ); |
|
43 | + add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100); |
|
44 | 44 | //end removal of autosave functionality. |
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | 48 | public function wp_just_in_time_script_localization() { |
49 | - wp_localize_script( 'autosave', 'autosaveL10n', array( |
|
49 | + wp_localize_script('autosave', 'autosaveL10n', array( |
|
50 | 50 | 'autosaveInterval' => 172800, |
51 | 51 | 'savingText' => __('Saving Draft…'), |
52 | 52 | 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.') |
53 | - ) ); |
|
53 | + )); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -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,7 +222,9 @@ discard block |
||
220 | 222 | public function initialize_admin_page() { |
221 | 223 | //let's check user access first |
222 | 224 | $this->_check_user_access(); |
223 | - if ( !is_object( $this->_loaded_page_object) ) return; |
|
225 | + if ( !is_object( $this->_loaded_page_object) ) { |
|
226 | + return; |
|
227 | + } |
|
224 | 228 | $this->_loaded_page_object->route_admin_request(); |
225 | 229 | return; |
226 | 230 | } |
@@ -232,7 +236,9 @@ discard block |
||
232 | 236 | |
233 | 237 | |
234 | 238 | public function set_page_dependencies($wp_page_slug) { |
235 | - if ( !$this->_load_page ) return; |
|
239 | + if ( !$this->_load_page ) { |
|
240 | + return; |
|
241 | + } |
|
236 | 242 | |
237 | 243 | if ( !is_object($this->_loaded_page_object) ) { |
238 | 244 | $msg[] = __('We can\'t load the page because we\'re missing a valid page object that tells us what to load', 'event_espresso'); |
@@ -249,8 +255,9 @@ discard block |
||
249 | 255 | $this->_loaded_page_object->set_wp_page_slug($wp_page_slug); |
250 | 256 | $page_hook = 'load-' . $wp_page_slug; |
251 | 257 | //hook into page load hook so all page specific stuff get's loaded. |
252 | - if ( !empty($wp_page_slug) ) |
|
253 | - add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') ); |
|
258 | + if ( !empty($wp_page_slug) ) { |
|
259 | + add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') ); |
|
260 | + } |
|
254 | 261 | } |
255 | 262 | |
256 | 263 | |
@@ -283,7 +290,9 @@ discard block |
||
283 | 290 | if ( isset( $values['class'] ) && $values['class'] == $class ) { |
284 | 291 | $file_index = $index - 1; |
285 | 292 | $this->_folder_name = basename(dirname($bt[$file_index]['file']) ); |
286 | - if ( !empty( $this->_folder_name ) ) break; |
|
293 | + if ( !empty( $this->_folder_name ) ) { |
|
294 | + break; |
|
295 | + } |
|
287 | 296 | } |
288 | 297 | } |
289 | 298 | |
@@ -337,8 +346,9 @@ discard block |
||
337 | 346 | $hook_paths[] = $file; |
338 | 347 | |
339 | 348 | //make sure we haven't already got a hook setup for this page path |
340 | - if ( in_array( $rel_admin, $this->_files_hooked ) ) |
|
341 | - continue; |
|
349 | + if ( in_array( $rel_admin, $this->_files_hooked ) ) { |
|
350 | + continue; |
|
351 | + } |
|
342 | 352 | |
343 | 353 | $this->hook_file = $hook_file; |
344 | 354 | $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin; |
@@ -367,8 +377,10 @@ discard block |
||
367 | 377 | protected function _initialize_admin_page() { |
368 | 378 | |
369 | 379 | //JUST CHECK WE'RE ON RIGHT PAGE. |
370 | - if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing ) |
|
371 | - return; //not on the right page so let's get out. |
|
380 | + if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing ) { |
|
381 | + return; |
|
382 | + } |
|
383 | + //not on the right page so let's get out. |
|
372 | 384 | $this->_load_page = TRUE; |
373 | 385 | |
374 | 386 | //let's set page specific autoloaders. Note that this just sets autoloaders for THIS set of admin pages. |
@@ -214,7 +214,6 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @access public |
216 | 216 | * @uses _initialize_admin_page() |
217 | - * @param string $dir_name directory name for specific admin_page being loaded. |
|
218 | 217 | * @return void |
219 | 218 | */ |
220 | 219 | public function initialize_admin_page() { |
@@ -231,6 +230,9 @@ discard block |
||
231 | 230 | |
232 | 231 | |
233 | 232 | |
233 | + /** |
|
234 | + * @param string $wp_page_slug |
|
235 | + */ |
|
234 | 236 | public function set_page_dependencies($wp_page_slug) { |
235 | 237 | if ( !$this->_load_page ) return; |
236 | 238 |
@@ -153,18 +153,18 @@ |
||
153 | 153 | |
154 | 154 | |
155 | 155 | /** |
156 | - * This loads scripts and styles for the EE_Admin system |
|
157 | - * that must be available on ALL WP admin pages (i.e. EE_menu items) |
|
158 | - * |
|
156 | + * This loads scripts and styles for the EE_Admin system |
|
157 | + * that must be available on ALL WP admin pages (i.e. EE_menu items) |
|
158 | + * |
|
159 | 159 | * @return void |
160 | 160 | */ |
161 | 161 | public function load_wp_global_scripts_styles() { |
162 | 162 | wp_register_style( |
163 | - 'espresso_menu', |
|
164 | - EE_ADMIN_URL . 'assets/admin-menu-styles.css', |
|
165 | - array('dashicons'), |
|
166 | - EVENT_ESPRESSO_VERSION |
|
167 | - ); |
|
163 | + 'espresso_menu', |
|
164 | + EE_ADMIN_URL . 'assets/admin-menu-styles.css', |
|
165 | + array('dashicons'), |
|
166 | + EVENT_ESPRESSO_VERSION |
|
167 | + ); |
|
168 | 168 | wp_enqueue_style('espresso_menu'); |
169 | 169 | } |
170 | 170 |
@@ -88,16 +88,16 @@ discard block |
||
88 | 88 | $this->_set_init_properties(); |
89 | 89 | |
90 | 90 | //global styles/scripts across all wp admin pages |
91 | - add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5 ); |
|
91 | + add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5); |
|
92 | 92 | |
93 | 93 | //load initial stuff. |
94 | 94 | $this->_set_file_and_folder_name(); |
95 | 95 | |
96 | 96 | $this->_set_menu_map(); |
97 | 97 | |
98 | - if ( empty( $this->_menu_map ) || is_array( $this->_menu_map ) ) |
|
98 | + if (empty($this->_menu_map) || is_array($this->_menu_map)) |
|
99 | 99 | { |
100 | - EE_Error::doing_it_wrong( get_class( $this ) . '::$_menu_map', sprintf( __('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core. Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso' ), get_class( $this ) ), '4.4.0' ); |
|
100 | + EE_Error::doing_it_wrong(get_class($this).'::$_menu_map', sprintf(__('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core. Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso'), get_class($this)), '4.4.0'); |
|
101 | 101 | return; |
102 | 102 | } |
103 | 103 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | public function load_wp_global_scripts_styles() { |
162 | 162 | wp_register_style( |
163 | 163 | 'espresso_menu', |
164 | - EE_ADMIN_URL . 'assets/admin-menu-styles.css', |
|
164 | + EE_ADMIN_URL.'assets/admin-menu-styles.css', |
|
165 | 165 | array('dashicons'), |
166 | 166 | EVENT_ESPRESSO_VERSION |
167 | 167 | ); |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | |
194 | 194 | |
195 | 195 | protected function _set_capability() { |
196 | - $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability; |
|
197 | - $this->capability = apply_filters( 'FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability ); |
|
196 | + $capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability; |
|
197 | + $this->capability = apply_filters('FHEE_'.$this->_menu_map->menu_slug.'_capability', $capability); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | public function initialize_admin_page() { |
213 | 213 | //let's check user access first |
214 | 214 | $this->_check_user_access(); |
215 | - if ( !is_object( $this->_loaded_page_object) ) return; |
|
215 | + if ( ! is_object($this->_loaded_page_object)) return; |
|
216 | 216 | $this->_loaded_page_object->route_admin_request(); |
217 | 217 | return; |
218 | 218 | } |
@@ -224,25 +224,25 @@ discard block |
||
224 | 224 | |
225 | 225 | |
226 | 226 | public function set_page_dependencies($wp_page_slug) { |
227 | - if ( !$this->_load_page ) return; |
|
227 | + if ( ! $this->_load_page) return; |
|
228 | 228 | |
229 | - if ( !is_object($this->_loaded_page_object) ) { |
|
229 | + if ( ! is_object($this->_loaded_page_object)) { |
|
230 | 230 | $msg[] = __('We can\'t load the page because we\'re missing a valid page object that tells us what to load', 'event_espresso'); |
231 | - $msg[] = $msg[0] . "\r\n" . sprintf( |
|
231 | + $msg[] = $msg[0]."\r\n".sprintf( |
|
232 | 232 | __('The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory', 'event_espresso'), |
233 | 233 | $this->_file_name, |
234 | 234 | $this->_file_name, |
235 | - $this->_folder_path . $this->_file_name, |
|
235 | + $this->_folder_path.$this->_file_name, |
|
236 | 236 | $this->_menu_map->menu_slug |
237 | 237 | ); |
238 | - throw new EE_Error( implode( '||', $msg) ); |
|
238 | + throw new EE_Error(implode('||', $msg)); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | $this->_loaded_page_object->set_wp_page_slug($wp_page_slug); |
242 | - $page_hook = 'load-' . $wp_page_slug; |
|
242 | + $page_hook = 'load-'.$wp_page_slug; |
|
243 | 243 | //hook into page load hook so all page specific stuff get's loaded. |
244 | - if ( !empty($wp_page_slug) ) |
|
245 | - add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') ); |
|
244 | + if ( ! empty($wp_page_slug)) |
|
245 | + add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies')); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function do_initial_loads() { |
255 | 255 | //no loading or initializing if menu map is setup incorrectly. |
256 | - if ( empty( $this->_menu_map ) || is_array( $this->_menu_map ) ) { |
|
256 | + if (empty($this->_menu_map) || is_array($this->_menu_map)) { |
|
257 | 257 | return; |
258 | 258 | } |
259 | 259 | $this->_initialize_admin_page(); |
@@ -270,19 +270,19 @@ discard block |
||
270 | 270 | $bt = debug_backtrace(); |
271 | 271 | //for more reliable determination of folder name |
272 | 272 | //we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this). Why? Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins) |
273 | - $class = get_class( $this ); |
|
274 | - foreach ( $bt as $index => $values ) { |
|
275 | - if ( isset( $values['class'] ) && $values['class'] == $class ) { |
|
273 | + $class = get_class($this); |
|
274 | + foreach ($bt as $index => $values) { |
|
275 | + if (isset($values['class']) && $values['class'] == $class) { |
|
276 | 276 | $file_index = $index - 1; |
277 | - $this->_folder_name = basename(dirname($bt[$file_index]['file']) ); |
|
278 | - if ( !empty( $this->_folder_name ) ) break; |
|
277 | + $this->_folder_name = basename(dirname($bt[$file_index]['file'])); |
|
278 | + if ( ! empty($this->_folder_name)) break; |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | - $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . DS; |
|
282 | + $this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.DS; |
|
283 | 283 | |
284 | - $this->_file_name = preg_replace( '/^ee/' , 'EE', $this->_folder_name ); |
|
285 | - $this->_file_name = ucwords( str_replace('_', ' ', $this->_file_name) ); |
|
284 | + $this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name); |
|
285 | + $this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name)); |
|
286 | 286 | $this->_file_name = str_replace(' ', '_', $this->_file_name); |
287 | 287 | } |
288 | 288 | |
@@ -294,19 +294,19 @@ discard block |
||
294 | 294 | * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks files/classes |
295 | 295 | * @return array |
296 | 296 | */ |
297 | - public function register_hooks( $extend = FALSE ) { |
|
297 | + public function register_hooks($extend = FALSE) { |
|
298 | 298 | |
299 | 299 | //get a list of files in the directory that have the "Hook" in their name an |
300 | 300 | |
301 | 301 | //if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property. Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf. |
302 | - if ( $extend ) { |
|
303 | - $hook_files_glob_path = apply_filters( 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . DS . '*' . $this->_file_name . '_Hooks_Extend.class.php' ); |
|
304 | - $this->_hook_paths = $this->_register_hook_files( $hook_files_glob_path, $extend ); |
|
302 | + if ($extend) { |
|
303 | + $hook_files_glob_path = apply_filters('FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.DS.'*'.$this->_file_name.'_Hooks_Extend.class.php'); |
|
304 | + $this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | //loop through decaf folders |
308 | - $hook_files_glob_path = apply_filters( 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' ); |
|
309 | - $this->_hook_paths = array_merge( $this->_register_hook_files( $hook_files_glob_path ), $this->_hook_paths ); //making sure any extended hook paths are later in the array than the core hook paths! |
|
308 | + $hook_files_glob_path = apply_filters('FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', $this->_folder_path.'*'.$this->_file_name.'_Hooks.class.php'); |
|
309 | + $this->_hook_paths = array_merge($this->_register_hook_files($hook_files_glob_path), $this->_hook_paths); //making sure any extended hook paths are later in the array than the core hook paths! |
|
310 | 310 | |
311 | 311 | return $this->_hook_paths; |
312 | 312 | |
@@ -314,27 +314,27 @@ discard block |
||
314 | 314 | |
315 | 315 | |
316 | 316 | |
317 | - protected function _register_hook_files( $hook_files_glob_path, $extend = FALSE ) { |
|
317 | + protected function _register_hook_files($hook_files_glob_path, $extend = FALSE) { |
|
318 | 318 | $hook_paths = array(); |
319 | - if ( $hook_files = glob( $hook_files_glob_path ) ) { |
|
320 | - if ( empty( $hook_files ) ) { |
|
319 | + if ($hook_files = glob($hook_files_glob_path)) { |
|
320 | + if (empty($hook_files)) { |
|
321 | 321 | return array(); |
322 | 322 | } |
323 | - foreach ( $hook_files as $file ) { |
|
323 | + foreach ($hook_files as $file) { |
|
324 | 324 | //lets get the linked admin. |
325 | - $hook_file = $extend ? str_replace( EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . DS, '', $file ) : str_replace($this->_folder_path, '', $file ); |
|
326 | - $replace = $extend ? '_' . $this->_file_name . '_Hooks_Extend.class.php' : '_' . $this->_file_name . '_Hooks.class.php'; |
|
327 | - $rel_admin = str_replace( $replace, '', $hook_file); |
|
325 | + $hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.DS, '', $file) : str_replace($this->_folder_path, '', $file); |
|
326 | + $replace = $extend ? '_'.$this->_file_name.'_Hooks_Extend.class.php' : '_'.$this->_file_name.'_Hooks.class.php'; |
|
327 | + $rel_admin = str_replace($replace, '', $hook_file); |
|
328 | 328 | $rel_admin = strtolower($rel_admin); |
329 | 329 | $hook_paths[] = $file; |
330 | 330 | |
331 | 331 | //make sure we haven't already got a hook setup for this page path |
332 | - if ( in_array( $rel_admin, $this->_files_hooked ) ) |
|
332 | + if (in_array($rel_admin, $this->_files_hooked)) |
|
333 | 333 | continue; |
334 | 334 | |
335 | 335 | $this->hook_file = $hook_file; |
336 | - $rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin; |
|
337 | - $filter = add_filter( $rel_admin_hook, array($this, 'load_admin_hook') ); |
|
336 | + $rel_admin_hook = 'FHEE_do_other_page_hooks_'.$rel_admin; |
|
337 | + $filter = add_filter($rel_admin_hook, array($this, 'load_admin_hook')); |
|
338 | 338 | $this->_files_hooked[] = $rel_admin; |
339 | 339 | } |
340 | 340 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | protected function _initialize_admin_page() { |
360 | 360 | |
361 | 361 | //JUST CHECK WE'RE ON RIGHT PAGE. |
362 | - if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing ) |
|
362 | + if (( ! isset($_REQUEST['page']) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing) |
|
363 | 363 | return; //not on the right page so let's get out. |
364 | 364 | $this->_load_page = TRUE; |
365 | 365 | |
@@ -367,30 +367,30 @@ discard block |
||
367 | 367 | // spl_autoload_register(array( $this, 'set_autoloaders') ); |
368 | 368 | |
369 | 369 | //we don't need to do a page_request check here because it's only called via WP menu system. |
370 | - $admin_page = $this->_file_name . '_Admin_Page'; |
|
371 | - $hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page; |
|
370 | + $admin_page = $this->_file_name.'_Admin_Page'; |
|
371 | + $hook_suffix = $this->_menu_map->menu_slug.'_'.$admin_page; |
|
372 | 372 | $admin_page = apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}", $admin_page); |
373 | 373 | |
374 | 374 | // define requested admin page class name then load the file and instantiate |
375 | - $path_to_file = str_replace( array( '\\', '/' ), DS, $this->_folder_path . $admin_page . '.core.php' ); |
|
376 | - $path_to_file=apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",$path_to_file );//so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page |
|
375 | + $path_to_file = str_replace(array('\\', '/'), DS, $this->_folder_path.$admin_page.'.core.php'); |
|
376 | + $path_to_file = apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}", $path_to_file); //so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page |
|
377 | 377 | |
378 | - if ( is_readable( $path_to_file )) { |
|
378 | + if (is_readable($path_to_file)) { |
|
379 | 379 | // This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place |
380 | - do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization' ); |
|
381 | - do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug ); |
|
382 | - require_once( $path_to_file ); |
|
383 | - $a = new ReflectionClass( $admin_page ); |
|
384 | - $this->_loaded_page_object = $a->newInstance( $this->_routing ); |
|
380 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization'); |
|
381 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_'.$this->_menu_map->menu_slug); |
|
382 | + require_once($path_to_file); |
|
383 | + $a = new ReflectionClass($admin_page); |
|
384 | + $this->_loaded_page_object = $a->newInstance($this->_routing); |
|
385 | 385 | } |
386 | - do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__after_initialization' ); |
|
387 | - do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug ); |
|
386 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization'); |
|
387 | + do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_'.$this->_menu_map->menu_slug); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | |
391 | 391 | |
392 | 392 | public function get_admin_page_name() { |
393 | - return $this->_file_name . '_Admin_Page'; |
|
393 | + return $this->_file_name.'_Admin_Page'; |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | * @return bool|die true if pass (or admin) wp_die if fail |
423 | 423 | */ |
424 | 424 | private function _check_user_access() { |
425 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $this->_menu_map->capability, $this->_menu_map->menu_slug ) ) { |
|
426 | - wp_die( __('You don\'t have access to this page.'), '', array( 'back_link' => true ) ); |
|
425 | + if ( ! EE_Registry::instance()->CAP->current_user_can($this->_menu_map->capability, $this->_menu_map->menu_slug)) { |
|
426 | + wp_die(__('You don\'t have access to this page.'), '', array('back_link' => true)); |
|
427 | 427 | } |
428 | 428 | return true; |
429 | 429 | } |
@@ -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 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'action' => 'admin_option_settings', |
61 | 61 | 'page' => 'espresso_general_settings' |
62 | 62 | ); |
63 | - return '<p>' . sprintf( __('That\'s it for the tour! At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons. There are help tours available on all Event Espresso Admin pages. If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="' . EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php') ) . '">', '</a>' ) . '</p>'; |
|
63 | + return '<p>'.sprintf(__('That\'s it for the tour! At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons. There are help tours available on all Event Espresso Admin pages. If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="'.EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')).'">', '</a>').'</p>'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
67 | 67 | \ No newline at end of file |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |