@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | use EventEspressoBatchRequest\Helpers\JobParameters; |
| 18 | 18 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
| 19 | 19 | |
| 20 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 21 | - exit( 'No direct script access allowed' ); |
|
| 20 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 21 | + exit('No direct script access allowed'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @throws BatchRequestException |
| 35 | 35 | * @return JobStepResponse |
| 36 | 36 | */ |
| 37 | - abstract public function create_job( JobParameters $job_parameters ); |
|
| 37 | + abstract public function create_job(JobParameters $job_parameters); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Performs another step of the job |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @return JobStepResponse |
| 45 | 45 | * @throws BatchRequestException |
| 46 | 46 | */ |
| 47 | - abstract public function continue_job( JobParameters $job_parameters, $batch_size = 50 ); |
|
| 47 | + abstract public function continue_job(JobParameters $job_parameters, $batch_size = 50); |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
@@ -55,6 +55,6 @@ discard block |
||
| 55 | 55 | * @return JobStepResponse |
| 56 | 56 | * @throws BatchRequestException |
| 57 | 57 | */ |
| 58 | - abstract public function cleanup_job( JobParameters $job_parameters ); |
|
| 58 | + abstract public function cleanup_job(JobParameters $job_parameters); |
|
| 59 | 59 | } |
| 60 | 60 | |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | use EventEspressoBatchRequest\Helpers\BatchRequestException; |
| 18 | 18 | |
| 19 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 20 | - exit( 'No direct script access allowed' ); |
|
| 19 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 20 | + exit('No direct script access allowed'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | protected $_file_helper = null; |
| 31 | 31 | const temp_folder_name = 'batch_temp_folder'; |
| 32 | - public function __construct( EEHI_File $file_helper = null ) { |
|
| 33 | - if( ! $file_helper ) { |
|
| 32 | + public function __construct(EEHI_File $file_helper = null) { |
|
| 33 | + if ( ! $file_helper) { |
|
| 34 | 34 | $this->_file_helper = new \EEH_File(); |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -45,30 +45,30 @@ discard block |
||
| 45 | 45 | * @return string |
| 46 | 46 | * @throws BatchRequestException |
| 47 | 47 | */ |
| 48 | - public function create_file_from_job_with_name( $job_id, $filename ) { |
|
| 48 | + public function create_file_from_job_with_name($job_id, $filename) { |
|
| 49 | 49 | $filepath = ''; |
| 50 | - try{ |
|
| 50 | + try { |
|
| 51 | 51 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
| 52 | - EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name |
|
| 52 | + EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name |
|
| 53 | 53 | ); |
| 54 | - if ( $success ) { |
|
| 54 | + if ($success) { |
|
| 55 | 55 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
| 56 | - EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id |
|
| 56 | + EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id |
|
| 57 | 57 | ); |
| 58 | 58 | } |
| 59 | - if( $success ) { |
|
| 60 | - $filepath = EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename; |
|
| 61 | - $success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath ); |
|
| 59 | + if ($success) { |
|
| 60 | + $filepath = EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.$filename; |
|
| 61 | + $success = $this->_file_helper->ensure_file_exists_and_is_writable($filepath); |
|
| 62 | 62 | } |
| 63 | 63 | //those methods normally fail with an exception, but if not, let's do it |
| 64 | - if( ! $success ) { |
|
| 65 | - throw new \EE_Error( 'could_not_create_temp_file', |
|
| 66 | - __( 'An unknown error occurred', 'event_espresso' )); |
|
| 64 | + if ( ! $success) { |
|
| 65 | + throw new \EE_Error('could_not_create_temp_file', |
|
| 66 | + __('An unknown error occurred', 'event_espresso')); |
|
| 67 | 67 | } |
| 68 | - } catch( \EE_Error $e ) { |
|
| 68 | + } catch (\EE_Error $e) { |
|
| 69 | 69 | throw new BatchRequestException( |
| 70 | 70 | sprintf( |
| 71 | - __( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ), |
|
| 71 | + __('Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso'), |
|
| 72 | 72 | $job_id, |
| 73 | 73 | $e->getMessage() |
| 74 | 74 | ), |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | * @param string $filepath |
| 85 | 85 | * @return string url to file |
| 86 | 86 | */ |
| 87 | - public function get_url_to_file( $filepath ) { |
|
| 88 | - return str_replace( EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath ); |
|
| 87 | + public function get_url_to_file($filepath) { |
|
| 88 | + return str_replace(EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * |
|
| 4 | - * Class JobHandlerFile |
|
| 5 | - * |
|
| 6 | - * Base class for common implementations of JobHandlerInterface, but ones |
|
| 7 | - * which write to a temporary file |
|
| 8 | - * |
|
| 9 | - * @package Event Espresso |
|
| 10 | - * @subpackage batch |
|
| 11 | - * @author Mike Nelson |
|
| 12 | - * @since 4.8.26 |
|
| 13 | - * |
|
| 14 | - */ |
|
| 3 | + * |
|
| 4 | + * Class JobHandlerFile |
|
| 5 | + * |
|
| 6 | + * Base class for common implementations of JobHandlerInterface, but ones |
|
| 7 | + * which write to a temporary file |
|
| 8 | + * |
|
| 9 | + * @package Event Espresso |
|
| 10 | + * @subpackage batch |
|
| 11 | + * @author Mike Nelson |
|
| 12 | + * @since 4.8.26 |
|
| 13 | + * |
|
| 14 | + */ |
|
| 15 | 15 | namespace EventEspressoBatchRequest\JobHandlerBaseClasses; |
| 16 | 16 | |
| 17 | 17 | use EventEspressoBatchRequest\Helpers\BatchRequestException; |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | use EventEspressoBatchRequest\Helpers\JobParameters; |
| 21 | 21 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
| 22 | 22 | |
| 23 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 24 | - exit( 'No direct script access allowed' ); |
|
| 23 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 24 | + exit('No direct script access allowed'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @throws BatchRequestException |
| 36 | 36 | * @return JobStepResponse |
| 37 | 37 | */ |
| 38 | - public function create_job( JobParameters $job_parameters ); |
|
| 38 | + public function create_job(JobParameters $job_parameters); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Performs another step of the job |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @return JobStepResponse |
| 45 | 45 | * @throws BatchRequestException |
| 46 | 46 | */ |
| 47 | - public function continue_job( JobParameters $job_parameters, $batch_size = 50 ); |
|
| 47 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50); |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Performs any clean-up logic when we know the job is completed |
@@ -52,5 +52,5 @@ discard block |
||
| 52 | 52 | * @return JobStepResponse |
| 53 | 53 | * @throws BatchRequestException |
| 54 | 54 | */ |
| 55 | - public function cleanup_job( JobParameters $job_parameters ); |
|
| 55 | + public function cleanup_job(JobParameters $job_parameters); |
|
| 56 | 56 | } |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 2 | 2 | // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE ); |
| 3 | -if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) { |
|
| 4 | - set_error_handler( array( 'EE_Error', 'error_handler' )); |
|
| 5 | - register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' )); |
|
| 3 | +if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) { |
|
| 4 | + set_error_handler(array('EE_Error', 'error_handler')); |
|
| 5 | + register_shutdown_function(array('EE_Error', 'fatal_error_handler')); |
|
| 6 | 6 | } |
| 7 | 7 | /** |
| 8 | 8 | * |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @access private |
| 65 | 65 | * @var boolean |
| 66 | 66 | */ |
| 67 | - private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
|
| 67 | + private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE); |
|
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | * @access public |
| 76 | 76 | * @echo string |
| 77 | 77 | */ |
| 78 | - function __construct( $message, $code = 0, Exception $previous = NULL ) { |
|
| 79 | - if ( version_compare( phpversion(), '5.3.0', '<' )) { |
|
| 80 | - parent::__construct( $message, $code ); |
|
| 78 | + function __construct($message, $code = 0, Exception $previous = NULL) { |
|
| 79 | + if (version_compare(phpversion(), '5.3.0', '<')) { |
|
| 80 | + parent::__construct($message, $code); |
|
| 81 | 81 | } else { |
| 82 | - parent::__construct( $message, $code, $previous ); |
|
| 82 | + parent::__construct($message, $code, $previous); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | * @param $line |
| 95 | 95 | * @return void |
| 96 | 96 | */ |
| 97 | - public static function error_handler( $code, $message, $file, $line ) { |
|
| 98 | - $type = EE_Error::error_type( $code ); |
|
| 97 | + public static function error_handler($code, $message, $file, $line) { |
|
| 98 | + $type = EE_Error::error_type($code); |
|
| 99 | 99 | $site = site_url(); |
| 100 | - switch ( $site ) { |
|
| 100 | + switch ($site) { |
|
| 101 | 101 | case 'http://ee4.eventespresso.com/' : |
| 102 | 102 | case 'http://ee4decaf.eventespresso.com/' : |
| 103 | 103 | case 'http://ee4hf.eventespresso.com/' : |
@@ -110,16 +110,16 @@ discard block |
||
| 110 | 110 | $to = '[email protected]'; |
| 111 | 111 | break; |
| 112 | 112 | default : |
| 113 | - $to = get_option( 'admin_email' ); |
|
| 113 | + $to = get_option('admin_email'); |
|
| 114 | 114 | } |
| 115 | - $subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url(); |
|
| 116 | - $msg = EE_Error::_format_error( $type, $message, $file, $line ); |
|
| 117 | - if ( function_exists( 'wp_mail' )) { |
|
| 118 | - add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' )); |
|
| 119 | - wp_mail( $to, $subject, $msg ); |
|
| 115 | + $subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url(); |
|
| 116 | + $msg = EE_Error::_format_error($type, $message, $file, $line); |
|
| 117 | + if (function_exists('wp_mail')) { |
|
| 118 | + add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); |
|
| 119 | + wp_mail($to, $subject, $msg); |
|
| 120 | 120 | } |
| 121 | 121 | echo '<div id="message" class="espresso-notices error"><p>'; |
| 122 | - echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line; |
|
| 122 | + echo $type.': '.$message.'<br />'.$file.' line '.$line; |
|
| 123 | 123 | echo '<br /></p></div>'; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | * @param $code |
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | - public static function error_type( $code ) { |
|
| 136 | - switch( $code ) { |
|
| 135 | + public static function error_type($code) { |
|
| 136 | + switch ($code) { |
|
| 137 | 137 | case E_ERROR: // 1 // |
| 138 | 138 | return 'E_ERROR'; |
| 139 | 139 | case E_WARNING: // 2 // |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public static function fatal_error_handler() { |
| 181 | 181 | $last_error = error_get_last(); |
| 182 | - if ( $last_error['type'] === E_ERROR ) { |
|
| 183 | - EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] ); |
|
| 182 | + if ($last_error['type'] === E_ERROR) { |
|
| 183 | + EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @param $line |
| 196 | 196 | * @return string |
| 197 | 197 | */ |
| 198 | - private static function _format_error( $code, $message, $file, $line ) { |
|
| 198 | + private static function _format_error($code, $message, $file, $line) { |
|
| 199 | 199 | $html = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>"; |
| 200 | 200 | $html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>"; |
| 201 | 201 | $html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>"; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * @param $content_type |
| 214 | 214 | * @return string |
| 215 | 215 | */ |
| 216 | - public static function set_content_type( $content_type ) { |
|
| 216 | + public static function set_content_type($content_type) { |
|
| 217 | 217 | return 'text/html'; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -227,24 +227,24 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function get_error() { |
| 229 | 229 | |
| 230 | - if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
|
| 230 | + if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) { |
|
| 231 | 231 | throw $this; |
| 232 | 232 | } |
| 233 | 233 | // get separate user and developer messages if they exist |
| 234 | - $msg = explode( '||', $this->getMessage() ); |
|
| 234 | + $msg = explode('||', $this->getMessage()); |
|
| 235 | 235 | $user_msg = $msg[0]; |
| 236 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
| 236 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
| 237 | 237 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
| 238 | 238 | |
| 239 | 239 | // add details to _all_exceptions array |
| 240 | 240 | $x_time = time(); |
| 241 | - self::$_all_exceptions[ $x_time ]['name'] = get_class( $this ); |
|
| 242 | - self::$_all_exceptions[ $x_time ]['file'] = $this->getFile(); |
|
| 243 | - self::$_all_exceptions[ $x_time ]['line'] = $this->getLine(); |
|
| 244 | - self::$_all_exceptions[ $x_time ]['msg'] = $msg; |
|
| 245 | - self::$_all_exceptions[ $x_time ]['code'] = $this->getCode(); |
|
| 246 | - self::$_all_exceptions[ $x_time ]['trace'] = $this->getTrace(); |
|
| 247 | - self::$_all_exceptions[ $x_time ]['string'] = $this->getTraceAsString(); |
|
| 241 | + self::$_all_exceptions[$x_time]['name'] = get_class($this); |
|
| 242 | + self::$_all_exceptions[$x_time]['file'] = $this->getFile(); |
|
| 243 | + self::$_all_exceptions[$x_time]['line'] = $this->getLine(); |
|
| 244 | + self::$_all_exceptions[$x_time]['msg'] = $msg; |
|
| 245 | + self::$_all_exceptions[$x_time]['code'] = $this->getCode(); |
|
| 246 | + self::$_all_exceptions[$x_time]['trace'] = $this->getTrace(); |
|
| 247 | + self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString(); |
|
| 248 | 248 | self::$_error_count++; |
| 249 | 249 | |
| 250 | 250 | //add_action( 'shutdown', array( $this, 'display_errors' )); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | * @access public |
| 260 | 260 | * @return boolean |
| 261 | 261 | */ |
| 262 | - public static function has_error(){ |
|
| 262 | + public static function has_error() { |
|
| 263 | 263 | return self::$_error_count ? TRUE : FALSE; |
| 264 | 264 | } |
| 265 | 265 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @access public |
| 271 | 271 | * @echo string |
| 272 | 272 | */ |
| 273 | - public function display_errors(){ |
|
| 273 | + public function display_errors() { |
|
| 274 | 274 | |
| 275 | 275 | $trace_details = ''; |
| 276 | 276 | |
@@ -331,18 +331,18 @@ discard block |
||
| 331 | 331 | </style> |
| 332 | 332 | <div id="ee-error-message" class="error">'; |
| 333 | 333 | |
| 334 | - if ( ! WP_DEBUG ) { |
|
| 334 | + if ( ! WP_DEBUG) { |
|
| 335 | 335 | $output .= ' |
| 336 | 336 | <p>'; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | // cycle thru errors |
| 340 | - foreach ( self::$_all_exceptions as $time => $ex ) { |
|
| 340 | + foreach (self::$_all_exceptions as $time => $ex) { |
|
| 341 | 341 | |
| 342 | 342 | // process trace info |
| 343 | - if ( empty( $ex['trace'] )) { |
|
| 343 | + if (empty($ex['trace'])) { |
|
| 344 | 344 | |
| 345 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
| 345 | + $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso'); |
|
| 346 | 346 | |
| 347 | 347 | } else { |
| 348 | 348 | |
@@ -357,50 +357,50 @@ discard block |
||
| 357 | 357 | <th scope="col" align="left">Method( arguments )</th> |
| 358 | 358 | </tr>'; |
| 359 | 359 | |
| 360 | - $last_on_stack = count( $ex['trace'] ) - 1; |
|
| 360 | + $last_on_stack = count($ex['trace']) - 1; |
|
| 361 | 361 | // reverse array so that stack is in proper chronological order |
| 362 | - $sorted_trace = array_reverse( $ex['trace'] ); |
|
| 362 | + $sorted_trace = array_reverse($ex['trace']); |
|
| 363 | 363 | |
| 364 | - foreach ( $sorted_trace as $nmbr => $trace ) { |
|
| 364 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
| 365 | 365 | |
| 366 | - $file = isset( $trace['file'] ) ? $trace['file'] : '' ; |
|
| 367 | - $class = isset( $trace['class'] ) ? $trace['class'] : ''; |
|
| 368 | - $type = isset( $trace['type'] ) ? $trace['type'] : ''; |
|
| 369 | - $function = isset( $trace['function'] ) ? $trace['function'] : ''; |
|
| 370 | - $args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : ''; |
|
| 371 | - $line = isset( $trace['line'] ) ? $trace['line'] : ''; |
|
| 366 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
| 367 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
| 368 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
| 369 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
| 370 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
| 371 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
| 372 | 372 | $zebra = $nmbr % 2 ? ' odd' : ''; |
| 373 | 373 | |
| 374 | - if ( empty( $file ) && ! empty( $class )) { |
|
| 375 | - $a = new ReflectionClass( $class ); |
|
| 374 | + if (empty($file) && ! empty($class)) { |
|
| 375 | + $a = new ReflectionClass($class); |
|
| 376 | 376 | $file = $a->getFileName(); |
| 377 | - if ( empty( $line ) && ! empty( $function )) { |
|
| 378 | - $b = new ReflectionMethod( $class, $function ); |
|
| 377 | + if (empty($line) && ! empty($function)) { |
|
| 378 | + $b = new ReflectionMethod($class, $function); |
|
| 379 | 379 | $line = $b->getStartLine(); |
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if ( $nmbr == $last_on_stack ) { |
|
| 383 | + if ($nmbr == $last_on_stack) { |
|
| 384 | 384 | $file = $ex['file'] != '' ? $ex['file'] : $file; |
| 385 | 385 | $line = $ex['line'] != '' ? $ex['line'] : $line; |
| 386 | - $error_code = self::generate_error_code ( $file, $trace['function'], $line ); |
|
| 386 | + $error_code = self::generate_error_code($file, $trace['function'], $line); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - $nmbr_dsply = ! empty( $nmbr ) ? $nmbr : ' '; |
|
| 390 | - $line_dsply = ! empty( $line ) ? $line : ' '; |
|
| 391 | - $file_dsply = ! empty( $file ) ? $file : ' '; |
|
| 392 | - $class_dsply = ! empty( $class ) ? $class : ' '; |
|
| 393 | - $type_dsply = ! empty( $type ) ? $type : ' '; |
|
| 394 | - $function_dsply = ! empty( $function ) ? $function : ' '; |
|
| 395 | - $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
|
| 389 | + $nmbr_dsply = ! empty($nmbr) ? $nmbr : ' '; |
|
| 390 | + $line_dsply = ! empty($line) ? $line : ' '; |
|
| 391 | + $file_dsply = ! empty($file) ? $file : ' '; |
|
| 392 | + $class_dsply = ! empty($class) ? $class : ' '; |
|
| 393 | + $type_dsply = ! empty($type) ? $type : ' '; |
|
| 394 | + $function_dsply = ! empty($function) ? $function : ' '; |
|
| 395 | + $args_dsply = ! empty($args) ? '( '.$args.' )' : ''; |
|
| 396 | 396 | |
| 397 | 397 | $trace_details .= ' |
| 398 | 398 | <tr> |
| 399 | - <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
|
| 400 | - <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
|
| 401 | - <td align="left" class="' . $zebra . '">' . $file_dsply . '</td> |
|
| 402 | - <td align="left" class="' . $zebra . '">' . $class_dsply . '</td> |
|
| 403 | - <td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td> |
|
| 399 | + <td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td> |
|
| 400 | + <td align="right" class="' . $zebra.'">'.$line_dsply.'</td> |
|
| 401 | + <td align="left" class="' . $zebra.'">'.$file_dsply.'</td> |
|
| 402 | + <td align="left" class="' . $zebra.'">'.$class_dsply.'</td> |
|
| 403 | + <td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td> |
|
| 404 | 404 | </tr>'; |
| 405 | 405 | |
| 406 | 406 | |
@@ -415,9 +415,9 @@ discard block |
||
| 415 | 415 | $ex['code'] = $ex['code'] ? $ex['code'] : $error_code; |
| 416 | 416 | |
| 417 | 417 | // add generic non-identifying messages for non-privileged uesrs |
| 418 | - if ( ! WP_DEBUG ) { |
|
| 418 | + if ( ! WP_DEBUG) { |
|
| 419 | 419 | |
| 420 | - $output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] ) . '</span> <sup>' . $ex['code'] . '</sup><br />'; |
|
| 420 | + $output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> <sup>'.$ex['code'].'</sup><br />'; |
|
| 421 | 421 | |
| 422 | 422 | } else { |
| 423 | 423 | |
@@ -425,24 +425,24 @@ discard block |
||
| 425 | 425 | $output .= ' |
| 426 | 426 | <div class="ee-error-dev-msg-dv"> |
| 427 | 427 | <p class="ee-error-dev-msg-pg"> |
| 428 | - <strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong> <span>code: ' . $ex['code'] . '</span><br /> |
|
| 429 | - <span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/> |
|
| 430 | - <a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '"> |
|
| 431 | - ' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . ' |
|
| 428 | + <strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong> <span>code: '.$ex['code'].'</span><br /> |
|
| 429 | + <span class="big-text">"' . trim($ex['msg']).'"</span><br/> |
|
| 430 | + <a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'"> |
|
| 431 | + ' . __('click to view backtrace and class/method details', 'event_espresso').' |
|
| 432 | 432 | </a><br /> |
| 433 | 433 | <span class="small-text lt-grey-text">'.$ex['file'].' ( line no: '.$ex['line'].' )</span> |
| 434 | 434 | </p> |
| 435 | - <div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
| 435 | + <div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;"> |
|
| 436 | 436 | ' . $trace_details; |
| 437 | 437 | |
| 438 | - if ( ! empty( $class )) { |
|
| 438 | + if ( ! empty($class)) { |
|
| 439 | 439 | $output .= ' |
| 440 | 440 | <div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;"> |
| 441 | 441 | <div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;"> |
| 442 | 442 | <h3>Class Details</h3>'; |
| 443 | - $a = new ReflectionClass( $class ); |
|
| 443 | + $a = new ReflectionClass($class); |
|
| 444 | 444 | $output .= ' |
| 445 | - <pre>' . $a . '</pre> |
|
| 445 | + <pre>' . $a.'</pre> |
|
| 446 | 446 | </div> |
| 447 | 447 | </div>'; |
| 448 | 448 | } |
@@ -454,14 +454,14 @@ discard block |
||
| 454 | 454 | |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - $this->write_to_error_log( $time, $ex ); |
|
| 457 | + $this->write_to_error_log($time, $ex); |
|
| 458 | 458 | |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | // remove last linebreak |
| 462 | - $output = substr( $output, 0, ( count( $output ) - 7 )); |
|
| 462 | + $output = substr($output, 0, (count($output) - 7)); |
|
| 463 | 463 | |
| 464 | - if ( ! WP_DEBUG ) { |
|
| 464 | + if ( ! WP_DEBUG) { |
|
| 465 | 465 | $output .= ' |
| 466 | 466 | </p>'; |
| 467 | 467 | } |
@@ -469,10 +469,10 @@ discard block |
||
| 469 | 469 | $output .= ' |
| 470 | 470 | </div>'; |
| 471 | 471 | |
| 472 | - $output .= self::_print_scripts( TRUE ); |
|
| 472 | + $output .= self::_print_scripts(TRUE); |
|
| 473 | 473 | |
| 474 | - if ( defined( 'DOING_AJAX' )) { |
|
| 475 | - echo json_encode( array( 'error' => $output )); |
|
| 474 | + if (defined('DOING_AJAX')) { |
|
| 475 | + echo json_encode(array('error' => $output)); |
|
| 476 | 476 | exit(); |
| 477 | 477 | } |
| 478 | 478 | |
@@ -492,29 +492,29 @@ discard block |
||
| 492 | 492 | * @ param array $arguments |
| 493 | 493 | * @ return string |
| 494 | 494 | */ |
| 495 | - private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
|
| 495 | + private function _convert_args_to_string($arguments = array(), $array = FALSE) { |
|
| 496 | 496 | |
| 497 | 497 | $arg_string = ''; |
| 498 | - if ( ! empty( $arguments )) { |
|
| 498 | + if ( ! empty($arguments)) { |
|
| 499 | 499 | |
| 500 | 500 | $args = array(); |
| 501 | 501 | |
| 502 | - foreach ( $arguments as $arg ) { |
|
| 502 | + foreach ($arguments as $arg) { |
|
| 503 | 503 | |
| 504 | - if ( ! empty( $arg )) { |
|
| 504 | + if ( ! empty($arg)) { |
|
| 505 | 505 | |
| 506 | - if ( is_string( $arg )) { |
|
| 507 | - $args[] = " '" . $arg . "'"; |
|
| 508 | - } elseif ( is_array( $arg )) { |
|
| 509 | - $args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE ); |
|
| 510 | - } elseif ( is_null( $arg )) { |
|
| 506 | + if (is_string($arg)) { |
|
| 507 | + $args[] = " '".$arg."'"; |
|
| 508 | + } elseif (is_array($arg)) { |
|
| 509 | + $args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE); |
|
| 510 | + } elseif (is_null($arg)) { |
|
| 511 | 511 | $args[] = ' NULL'; |
| 512 | - } elseif ( is_bool( $arg )) { |
|
| 513 | - $args[] = ( $arg ) ? ' TRUE' : ' FALSE'; |
|
| 514 | - } elseif ( is_object( $arg )) { |
|
| 515 | - $args[] = ' OBJECT ' . get_class( $arg ); |
|
| 516 | - } elseif ( is_resource( $arg )) { |
|
| 517 | - $args[] = get_resource_type( $arg ); |
|
| 512 | + } elseif (is_bool($arg)) { |
|
| 513 | + $args[] = ($arg) ? ' TRUE' : ' FALSE'; |
|
| 514 | + } elseif (is_object($arg)) { |
|
| 515 | + $args[] = ' OBJECT '.get_class($arg); |
|
| 516 | + } elseif (is_resource($arg)) { |
|
| 517 | + $args[] = get_resource_type($arg); |
|
| 518 | 518 | } else { |
| 519 | 519 | $args[] = $arg; |
| 520 | 520 | } |
@@ -522,9 +522,9 @@ discard block |
||
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | } |
| 525 | - $arg_string = implode( ', ', $args ); |
|
| 525 | + $arg_string = implode(', ', $args); |
|
| 526 | 526 | } |
| 527 | - if ( $array ) { |
|
| 527 | + if ($array) { |
|
| 528 | 528 | $arg_string .= ' )'; |
| 529 | 529 | } |
| 530 | 530 | return $arg_string; |
@@ -544,8 +544,8 @@ discard block |
||
| 544 | 544 | * @param string $line the line number where the error occurred - just use __LINE__ |
| 545 | 545 | * @return void |
| 546 | 546 | */ |
| 547 | - public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
| 548 | - self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
|
| 547 | + public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
| 548 | + self::_add_notice('errors', $msg, $file, $func, $line); |
|
| 549 | 549 | self::$_error_count++; |
| 550 | 550 | } |
| 551 | 551 | |
@@ -563,8 +563,8 @@ discard block |
||
| 563 | 563 | * @param string $line the line number where the error occurred - just use __LINE__ |
| 564 | 564 | * @return void |
| 565 | 565 | */ |
| 566 | - public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
| 567 | - self::_add_notice ( 'success', $msg, $file, $func, $line ); |
|
| 566 | + public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
| 567 | + self::_add_notice('success', $msg, $file, $func, $line); |
|
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | |
@@ -581,8 +581,8 @@ discard block |
||
| 581 | 581 | * @param string $line the line number where the error occurred - just use __LINE__ |
| 582 | 582 | * @return void |
| 583 | 583 | */ |
| 584 | - public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
| 585 | - self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
|
| 584 | + public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
| 585 | + self::_add_notice('attention', $msg, $file, $func, $line); |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | |
@@ -600,12 +600,12 @@ discard block |
||
| 600 | 600 | * @param string $line the line number where the error occurred - just use __LINE__ |
| 601 | 601 | * @return void |
| 602 | 602 | */ |
| 603 | - private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
| 604 | - if ( empty( $msg )) { |
|
| 603 | + private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
| 604 | + if (empty($msg)) { |
|
| 605 | 605 | EE_Error::doing_it_wrong( |
| 606 | - 'EE_Error::add_' . $type . '()', |
|
| 606 | + 'EE_Error::add_'.$type.'()', |
|
| 607 | 607 | sprintf( |
| 608 | - __( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ), |
|
| 608 | + __('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'), |
|
| 609 | 609 | $type, |
| 610 | 610 | $file, |
| 611 | 611 | $line |
@@ -613,27 +613,27 @@ discard block |
||
| 613 | 613 | EVENT_ESPRESSO_VERSION |
| 614 | 614 | ); |
| 615 | 615 | } |
| 616 | - if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) { |
|
| 616 | + if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) { |
|
| 617 | 617 | EE_Error::doing_it_wrong( |
| 618 | 618 | 'EE_Error::add_error()', |
| 619 | - __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ), |
|
| 619 | + __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'), |
|
| 620 | 620 | EVENT_ESPRESSO_VERSION |
| 621 | 621 | ); |
| 622 | 622 | } |
| 623 | 623 | // get separate user and developer messages if they exist |
| 624 | - $msg = explode( '||', $msg ); |
|
| 624 | + $msg = explode('||', $msg); |
|
| 625 | 625 | $user_msg = $msg[0]; |
| 626 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
| 626 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
| 627 | 627 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
| 628 | 628 | // add notice if message exists |
| 629 | - if ( ! empty( $msg )) { |
|
| 629 | + if ( ! empty($msg)) { |
|
| 630 | 630 | // get error code, but only on error |
| 631 | - if ( WP_DEBUG && $type == 'errors' ) { |
|
| 632 | - $msg .= '<br/><span class="tiny-text">' . EE_Error::generate_error_code( $file, $func, $line ) . '</span>'; |
|
| 631 | + if (WP_DEBUG && $type == 'errors') { |
|
| 632 | + $msg .= '<br/><span class="tiny-text">'.EE_Error::generate_error_code($file, $func, $line).'</span>'; |
|
| 633 | 633 | } |
| 634 | 634 | // add notice |
| 635 | - self::$_espresso_notices[ $type ][] = $msg; |
|
| 636 | - add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 ); |
|
| 635 | + self::$_espresso_notices[$type][] = $msg; |
|
| 636 | + add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1); |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | } |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | * @access private |
| 688 | 688 | * @return void |
| 689 | 689 | */ |
| 690 | - public static function reset_notices(){ |
|
| 690 | + public static function reset_notices() { |
|
| 691 | 691 | self::$_espresso_notices['success'] = FALSE; |
| 692 | 692 | self::$_espresso_notices['attention'] = FALSE; |
| 693 | 693 | self::$_espresso_notices['errors'] = FALSE; |
@@ -700,14 +700,14 @@ discard block |
||
| 700 | 700 | * @access public |
| 701 | 701 | * @return int |
| 702 | 702 | */ |
| 703 | - public static function has_notices(){ |
|
| 703 | + public static function has_notices() { |
|
| 704 | 704 | $has_notices = 0; |
| 705 | 705 | // check for success messages |
| 706 | - $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
|
| 706 | + $has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices; |
|
| 707 | 707 | // check for attention messages |
| 708 | - $has_notices = self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ? 2 : $has_notices; |
|
| 708 | + $has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices; |
|
| 709 | 709 | // check for error messages |
| 710 | - $has_notices = self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ? 1 : $has_notices; |
|
| 710 | + $has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices; |
|
| 711 | 711 | return $has_notices; |
| 712 | 712 | } |
| 713 | 713 | |
@@ -722,8 +722,8 @@ discard block |
||
| 722 | 722 | * @param boolean $remove_empty whether or not to unset empty messages |
| 723 | 723 | * @return array |
| 724 | 724 | */ |
| 725 | - public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
|
| 726 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 725 | + public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) { |
|
| 726 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 727 | 727 | |
| 728 | 728 | $success_messages = ''; |
| 729 | 729 | $attention_messages = ''; |
@@ -733,44 +733,44 @@ discard block |
||
| 733 | 733 | // EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 734 | 734 | |
| 735 | 735 | // either save notices to the db |
| 736 | - if ( $save_to_transient ) { |
|
| 737 | - update_option( 'ee_notices', self::$_espresso_notices ); |
|
| 736 | + if ($save_to_transient) { |
|
| 737 | + update_option('ee_notices', self::$_espresso_notices); |
|
| 738 | 738 | return; |
| 739 | 739 | } |
| 740 | 740 | // grab any notices that have been previously saved |
| 741 | - if ( $notices = get_option( 'ee_notices', FALSE )) { |
|
| 742 | - foreach ( $notices as $type => $notice ) { |
|
| 743 | - if ( is_array( $notice ) && ! empty( $notice )) { |
|
| 741 | + if ($notices = get_option('ee_notices', FALSE)) { |
|
| 742 | + foreach ($notices as $type => $notice) { |
|
| 743 | + if (is_array($notice) && ! empty($notice)) { |
|
| 744 | 744 | // make sure that existsing notice type is an array |
| 745 | - self::$_espresso_notices[ $type ] = is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array(); |
|
| 745 | + self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array(); |
|
| 746 | 746 | // merge stored notices with any newly created ones |
| 747 | - self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice ); |
|
| 747 | + self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice); |
|
| 748 | 748 | $print_scripts = TRUE; |
| 749 | 749 | } |
| 750 | 750 | } |
| 751 | 751 | // now clear any stored notices |
| 752 | - update_option( 'ee_notices', FALSE ); |
|
| 752 | + update_option('ee_notices', FALSE); |
|
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | // check for success messages |
| 756 | - if ( self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] )) { |
|
| 756 | + if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) { |
|
| 757 | 757 | // combine messages |
| 758 | - $success_messages .= implode( self::$_espresso_notices['success'], '<br />' ); |
|
| 758 | + $success_messages .= implode(self::$_espresso_notices['success'], '<br />'); |
|
| 759 | 759 | $print_scripts = TRUE; |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | // check for attention messages |
| 763 | - if ( self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ) { |
|
| 763 | + if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) { |
|
| 764 | 764 | // combine messages |
| 765 | - $attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' ); |
|
| 765 | + $attention_messages .= implode(self::$_espresso_notices['attention'], '<br />'); |
|
| 766 | 766 | $print_scripts = TRUE; |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | // check for error messages |
| 770 | - if ( self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ) { |
|
| 771 | - $error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' ); |
|
| 770 | + if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) { |
|
| 771 | + $error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso'); |
|
| 772 | 772 | // combine messages |
| 773 | - $error_messages .= implode( self::$_espresso_notices['errors'], '<br />' ); |
|
| 773 | + $error_messages .= implode(self::$_espresso_notices['errors'], '<br />'); |
|
| 774 | 774 | $print_scripts = TRUE; |
| 775 | 775 | } |
| 776 | 776 | |
@@ -784,21 +784,21 @@ discard block |
||
| 784 | 784 | $css_id = is_admin() ? 'message' : 'espresso-notices-success'; |
| 785 | 785 | $css_class = is_admin() ? 'updated fade' : 'success fade-away'; |
| 786 | 786 | //showMessage( $success_messages ); |
| 787 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>'; |
|
| 787 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>'; |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | if ($attention_messages != '') { |
| 791 | 791 | $css_id = is_admin() ? 'message' : 'espresso-notices-attention'; |
| 792 | 792 | $css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away'; |
| 793 | 793 | //showMessage( $error_messages, TRUE ); |
| 794 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>'; |
|
| 794 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>'; |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | if ($error_messages != '') { |
| 798 | 798 | $css_id = is_admin() ? 'message' : 'espresso-notices-error'; |
| 799 | 799 | $css_class = is_admin() ? 'error' : 'error fade-away'; |
| 800 | 800 | //showMessage( $error_messages, TRUE ); |
| 801 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>'; |
|
| 801 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>'; |
|
| 802 | 802 | } |
| 803 | 803 | |
| 804 | 804 | $notices .= '</div>'; |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | 'errors' => $error_messages |
| 812 | 812 | ); |
| 813 | 813 | |
| 814 | - if ( $remove_empty ) { |
|
| 814 | + if ($remove_empty) { |
|
| 815 | 815 | // remove empty notices |
| 816 | 816 | foreach ($notices as $type => $notice) { |
| 817 | 817 | if (empty($notice)) { |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | - if ( $print_scripts ) { |
|
| 824 | + if ($print_scripts) { |
|
| 825 | 825 | self::_print_scripts(); |
| 826 | 826 | } |
| 827 | 827 | |
@@ -841,17 +841,17 @@ discard block |
||
| 841 | 841 | * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
| 842 | 842 | * @return void |
| 843 | 843 | */ |
| 844 | - public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
|
| 845 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
| 846 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
| 844 | + public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) { |
|
| 845 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
| 846 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
| 847 | 847 | //maybe initialize persistent_admin_notices |
| 848 | - if ( empty( $persistent_admin_notices )) { |
|
| 849 | - add_option( 'ee_pers_admin_notices', array(), '', 'no' ); |
|
| 848 | + if (empty($persistent_admin_notices)) { |
|
| 849 | + add_option('ee_pers_admin_notices', array(), '', 'no'); |
|
| 850 | 850 | } |
| 851 | - $pan_name = sanitize_key( $pan_name ); |
|
| 852 | - if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) { |
|
| 853 | - $persistent_admin_notices[ $pan_name ] = $pan_message; |
|
| 854 | - update_option( 'ee_pers_admin_notices', $persistent_admin_notices ); |
|
| 851 | + $pan_name = sanitize_key($pan_name); |
|
| 852 | + if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) { |
|
| 853 | + $persistent_admin_notices[$pan_name] = $pan_message; |
|
| 854 | + update_option('ee_pers_admin_notices', $persistent_admin_notices); |
|
| 855 | 855 | } |
| 856 | 856 | } |
| 857 | 857 | } |
@@ -867,34 +867,34 @@ discard block |
||
| 867 | 867 | * @param bool $return_immediately |
| 868 | 868 | * @return void |
| 869 | 869 | */ |
| 870 | - public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) { |
|
| 871 | - $pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name; |
|
| 872 | - if ( ! empty( $pan_name )) { |
|
| 873 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
| 870 | + public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) { |
|
| 871 | + $pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name; |
|
| 872 | + if ( ! empty($pan_name)) { |
|
| 873 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
| 874 | 874 | // check if notice we wish to dismiss is actually in the $persistent_admin_notices array |
| 875 | - if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) { |
|
| 875 | + if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) { |
|
| 876 | 876 | // completely delete nag notice, or just NULL message so that it can NOT be added again ? |
| 877 | - if ( $purge ) { |
|
| 878 | - unset( $persistent_admin_notices[ $pan_name ] ); |
|
| 877 | + if ($purge) { |
|
| 878 | + unset($persistent_admin_notices[$pan_name]); |
|
| 879 | 879 | } else { |
| 880 | - $persistent_admin_notices[ $pan_name ] = NULL; |
|
| 880 | + $persistent_admin_notices[$pan_name] = NULL; |
|
| 881 | 881 | } |
| 882 | - if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) { |
|
| 883 | - EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 882 | + if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) { |
|
| 883 | + EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__); |
|
| 884 | 884 | } |
| 885 | 885 | } |
| 886 | 886 | } |
| 887 | - if ( $return_immediately ) { |
|
| 887 | + if ($return_immediately) { |
|
| 888 | 888 | return; |
| 889 | - } else if ( EE_Registry::instance()->REQ->ajax ) { |
|
| 889 | + } else if (EE_Registry::instance()->REQ->ajax) { |
|
| 890 | 890 | // grab any notices and concatenate into string |
| 891 | - echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE )))); |
|
| 891 | + echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE)))); |
|
| 892 | 892 | exit(); |
| 893 | 893 | } else { |
| 894 | 894 | // save errors to a transient to be displayed on next request (after redirect) |
| 895 | - EE_Error::get_notices( FALSE, TRUE ); |
|
| 896 | - $return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : ''; |
|
| 897 | - wp_safe_redirect( urldecode( $return_url )); |
|
| 895 | + EE_Error::get_notices(FALSE, TRUE); |
|
| 896 | + $return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : ''; |
|
| 897 | + wp_safe_redirect(urldecode($return_url)); |
|
| 898 | 898 | } |
| 899 | 899 | } |
| 900 | 900 | |
@@ -909,20 +909,20 @@ discard block |
||
| 909 | 909 | * @param string $return_url URL to go back to aftger nag notice is dismissed |
| 910 | 910 | * @return string |
| 911 | 911 | */ |
| 912 | - public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
|
| 913 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
| 912 | + public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') { |
|
| 913 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
| 914 | 914 | $args = array( |
| 915 | 915 | 'nag_notice' => $pan_name, |
| 916 | - 'return_url' => urlencode( $return_url ), |
|
| 916 | + 'return_url' => urlencode($return_url), |
|
| 917 | 917 | 'ajax_url' => WP_AJAX_URL, |
| 918 | - 'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' ) |
|
| 918 | + 'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso') |
|
| 919 | 919 | ); |
| 920 | - wp_localize_script( 'espresso_core', 'ee_dismiss', $args ); |
|
| 920 | + wp_localize_script('espresso_core', 'ee_dismiss', $args); |
|
| 921 | 921 | return ' |
| 922 | - <div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
| 923 | - <p>' . $pan_message . '</p> |
|
| 924 | - <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '"> |
|
| 925 | - <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .' |
|
| 922 | + <div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
| 923 | + <p>' . $pan_message.'</p> |
|
| 924 | + <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'"> |
|
| 925 | + <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').' |
|
| 926 | 926 | </a> |
| 927 | 927 | <div style="clear:both;"></div> |
| 928 | 928 | </div>'; |
@@ -938,17 +938,17 @@ discard block |
||
| 938 | 938 | * @param string $return_url |
| 939 | 939 | * @return array |
| 940 | 940 | */ |
| 941 | - public static function get_persistent_admin_notices( $return_url = '' ) { |
|
| 941 | + public static function get_persistent_admin_notices($return_url = '') { |
|
| 942 | 942 | $notices = ''; |
| 943 | 943 | // check for persistent admin notices |
| 944 | - if ( $persistent_admin_notices = get_option( 'ee_pers_admin_notices', FALSE )) { |
|
| 944 | + if ($persistent_admin_notices = get_option('ee_pers_admin_notices', FALSE)) { |
|
| 945 | 945 | // load scripts |
| 946 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 947 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 948 | - wp_enqueue_script( 'ee_error_js' ); |
|
| 946 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 947 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 948 | + wp_enqueue_script('ee_error_js'); |
|
| 949 | 949 | // and display notices |
| 950 | - foreach( $persistent_admin_notices as $pan_name => $pan_message ) { |
|
| 951 | - $notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url ); |
|
| 950 | + foreach ($persistent_admin_notices as $pan_name => $pan_message) { |
|
| 951 | + $notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url); |
|
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | return $notices; |
@@ -963,26 +963,26 @@ discard block |
||
| 963 | 963 | * @param bool $force_print |
| 964 | 964 | * @return void |
| 965 | 965 | */ |
| 966 | - private static function _print_scripts( $force_print = FALSE ) { |
|
| 967 | - if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) { |
|
| 968 | - if ( wp_script_is( 'ee_error_js', 'enqueued' )) { |
|
| 966 | + private static function _print_scripts($force_print = FALSE) { |
|
| 967 | + if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) { |
|
| 968 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
| 969 | 969 | return; |
| 970 | - } else if ( wp_script_is( 'ee_error_js', 'registered' )) { |
|
| 971 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
| 972 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
| 973 | - wp_enqueue_script( 'ee_error_js' ); |
|
| 974 | - wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG )); |
|
| 970 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
| 971 | + add_filter('FHEE_load_css', '__return_true'); |
|
| 972 | + add_filter('FHEE_load_js', '__return_true'); |
|
| 973 | + wp_enqueue_script('ee_error_js'); |
|
| 974 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG)); |
|
| 975 | 975 | } |
| 976 | 976 | } else { |
| 977 | 977 | return ' |
| 978 | 978 | <script> |
| 979 | 979 | /* <![CDATA[ */ |
| 980 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
| 980 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
| 981 | 981 | /* ]]> */ |
| 982 | 982 | </script> |
| 983 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
| 984 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
| 985 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
| 983 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
| 984 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
| 985 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
| 986 | 986 | '; |
| 987 | 987 | |
| 988 | 988 | } |
@@ -1016,11 +1016,11 @@ discard block |
||
| 1016 | 1016 | * @ param string $line |
| 1017 | 1017 | * @ return string |
| 1018 | 1018 | */ |
| 1019 | - public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
|
| 1020 | - $file = explode( '.', basename( $file )); |
|
| 1021 | - $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
|
| 1022 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
| 1023 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
| 1019 | + public static function generate_error_code($file = '', $func = '', $line = '') { |
|
| 1020 | + $file = explode('.', basename($file)); |
|
| 1021 | + $error_code = ! empty($file[0]) ? $file[0] : ''; |
|
| 1022 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
| 1023 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
| 1024 | 1024 | return $error_code; |
| 1025 | 1025 | } |
| 1026 | 1026 | |
@@ -1036,37 +1036,37 @@ discard block |
||
| 1036 | 1036 | * @ param object $ex |
| 1037 | 1037 | * @ return void |
| 1038 | 1038 | */ |
| 1039 | - public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
|
| 1039 | + public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) { |
|
| 1040 | 1040 | |
| 1041 | - if ( ! $ex ) { |
|
| 1041 | + if ( ! $ex) { |
|
| 1042 | 1042 | return; |
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | - if ( ! $time ) { |
|
| 1045 | + if ( ! $time) { |
|
| 1046 | 1046 | $time = time(); |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | - $exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
| 1050 | - $exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . '] Exception Details' . PHP_EOL; |
|
| 1051 | - $exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL; |
|
| 1052 | - $exception_log .= 'Code: '. $ex['code'] . PHP_EOL; |
|
| 1053 | - $exception_log .= 'File: '. $ex['file'] . PHP_EOL; |
|
| 1054 | - $exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL; |
|
| 1055 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
| 1056 | - $exception_log .= $ex['string'] . PHP_EOL; |
|
| 1057 | - $exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
| 1058 | - |
|
| 1059 | - EE_Registry::instance()->load_helper( 'File' ); |
|
| 1049 | + $exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
| 1050 | + $exception_log .= '['.date('Y-m-d H:i:s', $time).'] Exception Details'.PHP_EOL; |
|
| 1051 | + $exception_log .= 'Message: '.$ex['msg'].PHP_EOL; |
|
| 1052 | + $exception_log .= 'Code: '.$ex['code'].PHP_EOL; |
|
| 1053 | + $exception_log .= 'File: '.$ex['file'].PHP_EOL; |
|
| 1054 | + $exception_log .= 'Line No: '.$ex['line'].PHP_EOL; |
|
| 1055 | + $exception_log .= 'Stack trace: '.PHP_EOL; |
|
| 1056 | + $exception_log .= $ex['string'].PHP_EOL; |
|
| 1057 | + $exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
| 1058 | + |
|
| 1059 | + EE_Registry::instance()->load_helper('File'); |
|
| 1060 | 1060 | try { |
| 1061 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ); |
|
| 1062 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); |
|
| 1063 | - if ( ! $clear ) { |
|
| 1061 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file); |
|
| 1062 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); |
|
| 1063 | + if ( ! $clear) { |
|
| 1064 | 1064 | //get existing log file and append new log info |
| 1065 | - $exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log; |
|
| 1065 | + $exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log; |
|
| 1066 | 1066 | } |
| 1067 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log ); |
|
| 1068 | - } catch( EE_Error $e ){ |
|
| 1069 | - EE_Error::add_error( sprintf( __( 'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() )); |
|
| 1067 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log); |
|
| 1068 | + } catch (EE_Error $e) { |
|
| 1069 | + EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage())); |
|
| 1070 | 1070 | return; |
| 1071 | 1071 | } |
| 1072 | 1072 | |
@@ -1090,10 +1090,10 @@ discard block |
||
| 1090 | 1090 | * @param int $error_type |
| 1091 | 1091 | * @return void |
| 1092 | 1092 | */ |
| 1093 | - public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) { |
|
| 1094 | - if ( defined('WP_DEBUG') && WP_DEBUG ) { |
|
| 1093 | + public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) { |
|
| 1094 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1095 | 1095 | EE_Registry::instance()->load_helper('Debug_Tools'); |
| 1096 | - EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type ); |
|
| 1096 | + EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type); |
|
| 1097 | 1097 | } |
| 1098 | 1098 | } |
| 1099 | 1099 | |
@@ -1113,13 +1113,13 @@ discard block |
||
| 1113 | 1113 | */ |
| 1114 | 1114 | function espresso_error_enqueue_scripts() { |
| 1115 | 1115 | // js for error handling |
| 1116 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
| 1117 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
| 1116 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE); |
|
| 1117 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE); |
|
| 1118 | 1118 | } |
| 1119 | -if ( is_admin() ) { |
|
| 1120 | - add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
| 1119 | +if (is_admin()) { |
|
| 1120 | + add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
| 1121 | 1121 | } else { |
| 1122 | - add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
| 1122 | + add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | 1125 | |
@@ -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,12 +108,12 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function verify_filesystem() { |
| 110 | 110 | try { |
| 111 | - EE_Registry::instance()->load_helper( 'File' ); |
|
| 112 | - EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file ); |
|
| 113 | - EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file ); |
|
| 114 | - EEH_File::add_htaccess_deny_from_all( $this->_logs_folder ); |
|
| 115 | - } catch( EE_Error $e ){ |
|
| 116 | - EE_Error::add_error( sprintf( __( 'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 111 | + EE_Registry::instance()->load_helper('File'); |
|
| 112 | + EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file); |
|
| 113 | + EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file); |
|
| 114 | + EEH_File::add_htaccess_deny_from_all($this->_logs_folder); |
|
| 115 | + } catch (EE_Error $e) { |
|
| 116 | + EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -130,15 +130,15 @@ discard block |
||
| 130 | 130 | * @param string $type |
| 131 | 131 | * @return string |
| 132 | 132 | */ |
| 133 | - private function _format_message( $file = '', $function = '', $message = '', $type = '' ) { |
|
| 134 | - $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
| 135 | - $msg .= '[' . current_time( 'mysql' ) . '] '; |
|
| 136 | - $msg .= ! empty( $file ) ? basename( $file ) : ''; |
|
| 137 | - $msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : ''; |
|
| 138 | - $msg .= ! empty( $function ) ? $function . '()' : ''; |
|
| 133 | + private function _format_message($file = '', $function = '', $message = '', $type = '') { |
|
| 134 | + $msg = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
| 135 | + $msg .= '['.current_time('mysql').'] '; |
|
| 136 | + $msg .= ! empty($file) ? basename($file) : ''; |
|
| 137 | + $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
| 138 | + $msg .= ! empty($function) ? $function.'()' : ''; |
|
| 139 | 139 | $msg .= PHP_EOL; |
| 140 | - $type = ! empty( $type ) ? $type : 'log message'; |
|
| 141 | - $msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
| 140 | + $type = ! empty($type) ? $type : 'log message'; |
|
| 141 | + $msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : ''; |
|
| 142 | 142 | return $msg; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | * @param string $message |
| 154 | 154 | * @param string $type |
| 155 | 155 | */ |
| 156 | - public function log( $file = '', $function = '', $message = '', $type = '' ) { |
|
| 157 | - $this->_log .= $this->_format_message( $file, $function, $message, $type ); |
|
| 156 | + public function log($file = '', $function = '', $message = '', $type = '') { |
|
| 157 | + $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | public function write_log() { |
| 167 | 167 | try { |
| 168 | 168 | //get existing log file and append new log info |
| 169 | - $this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log; |
|
| 170 | - EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' ); |
|
| 171 | - } catch( EE_Error $e ){ |
|
| 172 | - EE_Error::add_error( sprintf( __( 'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 169 | + $this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log; |
|
| 170 | + EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log'); |
|
| 171 | + } catch (EE_Error $e) { |
|
| 172 | + EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
| 173 | 173 | return; |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -182,31 +182,31 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function send_log() { |
| 184 | 184 | |
| 185 | - if ( empty( $this->_remote_logging_url )) { |
|
| 185 | + if (empty($this->_remote_logging_url)) { |
|
| 186 | 186 | return; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
| 190 | - $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
| 191 | - $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
| 192 | - $data .= '&time=' . time(); |
|
| 193 | - $data .= '&remote_log=' . $this->_log; |
|
| 194 | - $data .= '&request_array=' . json_encode( $_REQUEST ); |
|
| 189 | + $data = 'domain='.$_SERVER['HTTP_HOST']; |
|
| 190 | + $data .= '&ip='.$_SERVER['SERVER_ADDR']; |
|
| 191 | + $data .= '&server_type='.$_SERVER['SERVER_SOFTWARE']; |
|
| 192 | + $data .= '&time='.time(); |
|
| 193 | + $data .= '&remote_log='.$this->_log; |
|
| 194 | + $data .= '&request_array='.json_encode($_REQUEST); |
|
| 195 | 195 | $data .= '&action=save'; |
| 196 | 196 | |
| 197 | - if ( defined( 'EELOGGING_PASS' )) { |
|
| 198 | - $data .= '&pass=' . EELOGGING_PASS; |
|
| 197 | + if (defined('EELOGGING_PASS')) { |
|
| 198 | + $data .= '&pass='.EELOGGING_PASS; |
|
| 199 | 199 | } |
| 200 | - if ( defined( 'EELOGGING_KEY' )) { |
|
| 201 | - $data .= '&key=' . EELOGGING_KEY; |
|
| 200 | + if (defined('EELOGGING_KEY')) { |
|
| 201 | + $data .= '&key='.EELOGGING_KEY; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - $c = curl_init( $this->_remote_logging_url ); |
|
| 205 | - curl_setopt( $c, CURLOPT_POST, TRUE ); |
|
| 206 | - curl_setopt( $c, CURLOPT_POSTFIELDS, $data ); |
|
| 207 | - curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE ); |
|
| 208 | - curl_exec( $c ); |
|
| 209 | - curl_close( $c ); |
|
| 204 | + $c = curl_init($this->_remote_logging_url); |
|
| 205 | + curl_setopt($c, CURLOPT_POST, TRUE); |
|
| 206 | + curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
| 207 | + curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE); |
|
| 208 | + curl_exec($c); |
|
| 209 | + curl_close($c); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
@@ -217,18 +217,18 @@ discard block |
||
| 217 | 217 | * previous entries are overwritten |
| 218 | 218 | */ |
| 219 | 219 | public function write_debug() { |
| 220 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 220 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 221 | 221 | $this->_debug_log = ''; |
| 222 | - foreach ( $_GET as $key => $value ) { |
|
| 223 | - $this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL; |
|
| 222 | + foreach ($_GET as $key => $value) { |
|
| 223 | + $this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL; |
|
| 224 | 224 | } |
| 225 | - foreach ( $_POST as $key => $value ) { |
|
| 226 | - $this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL; |
|
| 225 | + foreach ($_POST as $key => $value) { |
|
| 226 | + $this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL; |
|
| 227 | 227 | } |
| 228 | 228 | try { |
| 229 | - EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' ); |
|
| 230 | - } catch( EE_Error $e ){ |
|
| 231 | - EE_Error::add_error( sprintf( __( 'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 229 | + EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log'); |
|
| 230 | + } catch (EE_Error $e) { |
|
| 231 | + EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
| 232 | 232 | return; |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * __clone |
| 241 | 241 | */ |
| 242 | 242 | public function __clone() { |
| 243 | - trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR ); |
|
| 243 | + trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 2 | 2 | /** |
| 3 | - * |
|
| 4 | - * Class EE_Log |
|
| 5 | - * |
|
| 6 | - * Singleton logging class. Can be called from anywhere in the plugin to log data to a log file. |
|
| 7 | - * Defaults to wp-content/uploads/espresso/logs/espresso_log.txt |
|
| 8 | - * Usage: |
|
| 9 | - * do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'logging message' ); |
|
| 10 | - * |
|
| 11 | - * @package Event Espresso |
|
| 12 | - * @subpackage core |
|
| 13 | - * @author Sidney Harrel, Brent Christensen |
|
| 14 | - * |
|
| 15 | - */ |
|
| 3 | + * |
|
| 4 | + * Class EE_Log |
|
| 5 | + * |
|
| 6 | + * Singleton logging class. Can be called from anywhere in the plugin to log data to a log file. |
|
| 7 | + * Defaults to wp-content/uploads/espresso/logs/espresso_log.txt |
|
| 8 | + * Usage: |
|
| 9 | + * do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'logging message' ); |
|
| 10 | + * |
|
| 11 | + * @package Event Espresso |
|
| 12 | + * @subpackage core |
|
| 13 | + * @author Sidney Harrel, Brent Christensen |
|
| 14 | + * |
|
| 15 | + */ |
|
| 16 | 16 | class EE_Log { |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -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 | /** |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
| 45 | 45 | * @return \Payments_Admin_Page |
| 46 | 46 | */ |
| 47 | - public function __construct( $routing = TRUE ) { |
|
| 48 | - parent::__construct( $routing ); |
|
| 47 | + public function __construct($routing = TRUE) { |
|
| 48 | + parent::__construct($routing); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -130,19 +130,19 @@ discard block |
||
| 130 | 130 | protected function _set_page_config() { |
| 131 | 131 | $payment_method_list_config = array( |
| 132 | 132 | 'nav' => array( |
| 133 | - 'label' => __( 'Payment Methods', 'event_espresso' ), |
|
| 133 | + 'label' => __('Payment Methods', 'event_espresso'), |
|
| 134 | 134 | 'order' => 10 |
| 135 | 135 | ), |
| 136 | 136 | 'metaboxes' => $this->_default_espresso_metaboxes, |
| 137 | 137 | 'help_tabs' => array_merge( |
| 138 | 138 | array( |
| 139 | 139 | 'payment_methods_overview_help_tab' => array( |
| 140 | - 'title' => __( 'Payment Methods Overview', 'event_espresso' ), |
|
| 140 | + 'title' => __('Payment Methods Overview', 'event_espresso'), |
|
| 141 | 141 | 'filename' => 'payment_methods_overview' |
| 142 | 142 | ) |
| 143 | 143 | ), |
| 144 | 144 | $this->_add_payment_method_help_tabs() ), |
| 145 | - 'help_tour' => array( 'Payment_Methods_Selection_Help_Tour' ), |
|
| 145 | + 'help_tour' => array('Payment_Methods_Selection_Help_Tour'), |
|
| 146 | 146 | 'require_nonce' => false |
| 147 | 147 | ); |
| 148 | 148 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | ) |
| 161 | 161 | ), |
| 162 | 162 | //'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ), |
| 163 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
| 163 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 164 | 164 | 'require_nonce' => FALSE |
| 165 | 165 | ), |
| 166 | 166 | 'payment_log'=>array( |
@@ -179,18 +179,18 @@ discard block |
||
| 179 | 179 | /** |
| 180 | 180 | * @return array |
| 181 | 181 | */ |
| 182 | - protected function _add_payment_method_help_tabs(){ |
|
| 182 | + protected function _add_payment_method_help_tabs() { |
|
| 183 | 183 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
| 184 | 184 | $payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types(); |
| 185 | 185 | $all_pmt_help_tabs_config = array(); |
| 186 | - foreach( $payment_method_types as $payment_method_type ){ |
|
| 187 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
| 186 | + foreach ($payment_method_types as $payment_method_type) { |
|
| 187 | + if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) { |
|
| 188 | 188 | continue; |
| 189 | 189 | } |
| 190 | - foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){ |
|
| 190 | + foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { |
|
| 191 | 191 | $all_pmt_help_tabs_config[$help_tab_name] = array( |
| 192 | 192 | 'title'=>$config['title'], |
| 193 | - 'content'=>EEH_Template::display_template( $payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true) |
|
| 193 | + 'content'=>EEH_Template::display_template($payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true) |
|
| 194 | 194 | ); |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 | public function load_scripts_styles() { |
| 214 | - wp_enqueue_script( 'ee_admin_js' ); |
|
| 215 | - wp_enqueue_script( 'ee-text-links' ); |
|
| 216 | - wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 214 | + wp_enqueue_script('ee_admin_js'); |
|
| 215 | + wp_enqueue_script('ee-text-links'); |
|
| 216 | + wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | public function load_scripts_styles_default() { |
| 224 | 224 | //styles |
| 225 | - wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION ); |
|
| 226 | - wp_enqueue_style( 'espresso_payments' ); |
|
| 227 | - wp_enqueue_style( 'ee-text-links' ); |
|
| 225 | + wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION); |
|
| 226 | + wp_enqueue_style('espresso_payments'); |
|
| 227 | + wp_enqueue_style('ee-text-links'); |
|
| 228 | 228 | //scripts |
| 229 | 229 | } |
| 230 | 230 | |
@@ -238,46 +238,46 @@ discard block |
||
| 238 | 238 | * to the loading process. However, people MUST setup the details for the payment method so its safe to do a |
| 239 | 239 | * recheck here. |
| 240 | 240 | */ |
| 241 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
| 241 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 242 | 242 | EEM_Payment_Method::instance()->verify_button_urls(); |
| 243 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' ); |
|
| 244 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
| 243 | + EE_Registry::instance()->load_helper('Tabbed_Content'); |
|
| 244 | + EE_Registry::instance()->load_helper('HTML'); |
|
| 245 | 245 | //setup tabs, one for each payment method type |
| 246 | 246 | $tabs = array(); |
| 247 | 247 | $payment_methods = array(); |
| 248 | - foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) { |
|
| 248 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
| 249 | 249 | // we don't want to show admin-only PMTs for now |
| 250 | - if ( $pmt_obj instanceof EE_PMT_Admin_Only ) { |
|
| 250 | + if ($pmt_obj instanceof EE_PMT_Admin_Only) { |
|
| 251 | 251 | continue; |
| 252 | 252 | } |
| 253 | 253 | //check access |
| 254 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
| 254 | + if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) { |
|
| 255 | 255 | continue; |
| 256 | 256 | } |
| 257 | 257 | //check for any active pms of that type |
| 258 | - $payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() ); |
|
| 259 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
| 258 | + $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); |
|
| 259 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
| 260 | 260 | $payment_method = EE_Payment_Method::new_instance( |
| 261 | 261 | array( |
| 262 | - 'PMD_slug' =>sanitize_key( $pmt_obj->system_name() ), |
|
| 262 | + 'PMD_slug' =>sanitize_key($pmt_obj->system_name()), |
|
| 263 | 263 | 'PMD_type' =>$pmt_obj->system_name(), |
| 264 | 264 | 'PMD_name' =>$pmt_obj->pretty_name(), |
| 265 | 265 | 'PMD_admin_name' =>$pmt_obj->pretty_name() |
| 266 | 266 | ) |
| 267 | 267 | ); |
| 268 | 268 | } |
| 269 | - $payment_methods[ $payment_method->slug() ] = $payment_method; |
|
| 269 | + $payment_methods[$payment_method->slug()] = $payment_method; |
|
| 270 | 270 | } |
| 271 | - $payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods ); |
|
| 272 | - foreach( $payment_methods as $payment_method ) { |
|
| 273 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
| 271 | + $payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods); |
|
| 272 | + foreach ($payment_methods as $payment_method) { |
|
| 273 | + if ($payment_method instanceof EE_Payment_Method) { |
|
| 274 | 274 | add_meta_box( |
| 275 | 275 | //html id |
| 276 | - 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
| 276 | + 'espresso_'.$payment_method->slug().'_payment_settings', |
|
| 277 | 277 | //title |
| 278 | - sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
| 278 | + sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()), |
|
| 279 | 279 | //callback |
| 280 | - array( $this, 'payment_method_settings_meta_box' ), |
|
| 280 | + array($this, 'payment_method_settings_meta_box'), |
|
| 281 | 281 | //post type |
| 282 | 282 | null, |
| 283 | 283 | //context |
@@ -285,19 +285,19 @@ discard block |
||
| 285 | 285 | //priority |
| 286 | 286 | 'default', |
| 287 | 287 | //callback args |
| 288 | - array( 'payment_method' => $payment_method ) |
|
| 288 | + array('payment_method' => $payment_method) |
|
| 289 | 289 | ); |
| 290 | 290 | //setup for tabbed content |
| 291 | - $tabs[ $payment_method->slug() ] = array( |
|
| 291 | + $tabs[$payment_method->slug()] = array( |
|
| 292 | 292 | 'label' => $payment_method->admin_name(), |
| 293 | 293 | 'class' => $payment_method->active() ? 'gateway-active' : '', |
| 294 | - 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
| 295 | - 'title' => __( 'Modify this Payment Method', 'event_espresso' ), |
|
| 294 | + 'href' => 'espresso_'.$payment_method->slug().'_payment_settings', |
|
| 295 | + 'title' => __('Modify this Payment Method', 'event_espresso'), |
|
| 296 | 296 | 'slug' => $payment_method->slug() |
| 297 | 297 | ); |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() ); |
|
| 300 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug()); |
|
| 301 | 301 | $this->display_admin_page_with_sidebar(); |
| 302 | 302 | |
| 303 | 303 | } |
@@ -308,20 +308,20 @@ discard block |
||
| 308 | 308 | * _get_active_payment_method_slug |
| 309 | 309 | * @return string |
| 310 | 310 | */ |
| 311 | - protected function _get_active_payment_method_slug(){ |
|
| 311 | + protected function _get_active_payment_method_slug() { |
|
| 312 | 312 | $payment_method_slug = FALSE; |
| 313 | 313 | //decide which payment method tab to open first, as dictated by the request's 'payment_method' |
| 314 | - if ( isset( $this->_req_data['payment_method'] )) { |
|
| 314 | + if (isset($this->_req_data['payment_method'])) { |
|
| 315 | 315 | // if they provided the current payment method, use it |
| 316 | - $payment_method_slug = sanitize_key( $this->_req_data['payment_method'] ); |
|
| 316 | + $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
| 317 | 317 | } |
| 318 | - $payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug ))); |
|
| 318 | + $payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); |
|
| 319 | 319 | // if that didn't work or wasn't provided, find another way to select the current pm |
| 320 | - if ( ! $this->_verify_payment_method( $payment_method )) { |
|
| 320 | + if ( ! $this->_verify_payment_method($payment_method)) { |
|
| 321 | 321 | // like, looking for an active one |
| 322 | - $payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' ); |
|
| 322 | + $payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); |
|
| 323 | 323 | // test that one as well |
| 324 | - if ( $this->_verify_payment_method( $payment_method )) { |
|
| 324 | + if ($this->_verify_payment_method($payment_method)) { |
|
| 325 | 325 | $payment_method_slug = $payment_method->slug(); |
| 326 | 326 | } else { |
| 327 | 327 | $payment_method_slug = 'paypal_standard'; |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | * @param \EE_Payment_Method $payment_method |
| 340 | 340 | * @return boolean |
| 341 | 341 | */ |
| 342 | - protected function _verify_payment_method( $payment_method ){ |
|
| 342 | + protected function _verify_payment_method($payment_method) { |
|
| 343 | 343 | if ( |
| 344 | 344 | $payment_method instanceof EE_Payment_Method && |
| 345 | 345 | $payment_method->type_obj() instanceof EE_PMT_Base && |
| 346 | - EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' ) |
|
| 346 | + EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access') |
|
| 347 | 347 | ) { |
| 348 | 348 | return TRUE; |
| 349 | 349 | } |
@@ -360,21 +360,21 @@ discard block |
||
| 360 | 360 | * @return string |
| 361 | 361 | * @throws EE_Error |
| 362 | 362 | */ |
| 363 | - public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){ |
|
| 364 | - $payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL; |
|
| 365 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
| 366 | - throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' ))); |
|
| 363 | + public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) { |
|
| 364 | + $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL; |
|
| 365 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
| 366 | + throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso'))); |
|
| 367 | 367 | } |
| 368 | 368 | $payment_method_scopes = $payment_method->active(); |
| 369 | 369 | // if the payment method really exists show its form, otherwise the activation template |
| 370 | - if ( $payment_method->ID() && ! empty( $payment_method_scopes )) { |
|
| 371 | - $form = $this->_generate_payment_method_settings_form( $payment_method ); |
|
| 372 | - if ( $form->form_data_present_in( $this->_req_data )) { |
|
| 373 | - $form->receive_form_submission( $this->_req_data ); |
|
| 370 | + if ($payment_method->ID() && ! empty($payment_method_scopes)) { |
|
| 371 | + $form = $this->_generate_payment_method_settings_form($payment_method); |
|
| 372 | + if ($form->form_data_present_in($this->_req_data)) { |
|
| 373 | + $form->receive_form_submission($this->_req_data); |
|
| 374 | 374 | } |
| 375 | - echo $form->form_open() . $form->get_html_and_js() . $form->form_close(); |
|
| 375 | + echo $form->form_open().$form->get_html_and_js().$form->form_close(); |
|
| 376 | 376 | } else { |
| 377 | - echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js(); |
|
| 377 | + echo $this->_activate_payment_method_button($payment_method)->get_html_and_js(); |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | |
@@ -387,14 +387,14 @@ discard block |
||
| 387 | 387 | * @param \EE_Payment_Method $payment_method |
| 388 | 388 | * @return \EE_Form_Section_Proper |
| 389 | 389 | */ |
| 390 | - protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) { |
|
| 391 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
| 390 | + protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) { |
|
| 391 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
| 392 | 392 | return new EE_Form_Section_Proper(); |
| 393 | 393 | } |
| 394 | 394 | return new EE_Form_Section_Proper( |
| 395 | 395 | array( |
| 396 | - 'name' => $payment_method->slug() . '_settings_form', |
|
| 397 | - 'html_id' => $payment_method->slug() . '_settings_form', |
|
| 396 | + 'name' => $payment_method->slug().'_settings_form', |
|
| 397 | + 'html_id' => $payment_method->slug().'_settings_form', |
|
| 398 | 398 | 'action' => EE_Admin_Page::add_query_args_and_nonce( |
| 399 | 399 | array( |
| 400 | 400 | 'action' => 'update_payment_method', |
@@ -406,12 +406,12 @@ discard block |
||
| 406 | 406 | 'subsections' => apply_filters( |
| 407 | 407 | 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', |
| 408 | 408 | array( |
| 409 | - 'pci_dss_compliance_' . $payment_method->slug() => $this->_pci_dss_compliance( $payment_method ), |
|
| 410 | - 'currency_support_' . $payment_method->slug() => $this->_currency_support( $payment_method ), |
|
| 411 | - 'payment_method_settings_' . $payment_method->slug() => $this->_payment_method_settings( $payment_method ), |
|
| 412 | - 'update_' . $payment_method->slug() => $this->_update_payment_method_button( $payment_method ), |
|
| 413 | - 'deactivate_' . $payment_method->slug() => $this->_deactivate_payment_method_button( $payment_method ), |
|
| 414 | - 'fine_print_' . $payment_method->slug() => $this->_fine_print() |
|
| 409 | + 'pci_dss_compliance_'.$payment_method->slug() => $this->_pci_dss_compliance($payment_method), |
|
| 410 | + 'currency_support_'.$payment_method->slug() => $this->_currency_support($payment_method), |
|
| 411 | + 'payment_method_settings_'.$payment_method->slug() => $this->_payment_method_settings($payment_method), |
|
| 412 | + 'update_'.$payment_method->slug() => $this->_update_payment_method_button($payment_method), |
|
| 413 | + 'deactivate_'.$payment_method->slug() => $this->_deactivate_payment_method_button($payment_method), |
|
| 414 | + 'fine_print_'.$payment_method->slug() => $this->_fine_print() |
|
| 415 | 415 | ), |
| 416 | 416 | $payment_method |
| 417 | 417 | ) |
@@ -428,19 +428,19 @@ discard block |
||
| 428 | 428 | * @param \EE_Payment_Method $payment_method |
| 429 | 429 | * @return \EE_Form_Section_Proper |
| 430 | 430 | */ |
| 431 | - protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { |
|
| 432 | - if ( $payment_method->type_obj()->requires_https() ) { |
|
| 431 | + protected function _pci_dss_compliance(EE_Payment_Method $payment_method) { |
|
| 432 | + if ($payment_method->type_obj()->requires_https()) { |
|
| 433 | 433 | return new EE_Form_Section_HTML( |
| 434 | 434 | EEH_HTML::tr( |
| 435 | 435 | EEH_HTML::th( |
| 436 | 436 | EEH_HTML::label( |
| 437 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
| 437 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
| 438 | 438 | ) |
| 439 | - ) . |
|
| 439 | + ). |
|
| 440 | 440 | EEH_HTML::td( |
| 441 | - EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) . |
|
| 442 | - EEH_HTML::br() . |
|
| 443 | - __( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' )) |
|
| 441 | + EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')). |
|
| 442 | + EEH_HTML::br(). |
|
| 443 | + __('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso')) |
|
| 444 | 444 | ) |
| 445 | 445 | ) |
| 446 | 446 | ); |
@@ -458,19 +458,19 @@ discard block |
||
| 458 | 458 | * @param \EE_Payment_Method $payment_method |
| 459 | 459 | * @return \EE_Form_Section_Proper |
| 460 | 460 | */ |
| 461 | - protected function _currency_support( EE_Payment_Method $payment_method ) { |
|
| 462 | - if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { |
|
| 461 | + protected function _currency_support(EE_Payment_Method $payment_method) { |
|
| 462 | + if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
| 463 | 463 | return new EE_Form_Section_HTML( |
| 464 | 464 | EEH_HTML::tr( |
| 465 | 465 | EEH_HTML::th( |
| 466 | 466 | EEH_HTML::label( |
| 467 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
| 467 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
| 468 | 468 | ) |
| 469 | - ) . |
|
| 469 | + ). |
|
| 470 | 470 | EEH_HTML::td( |
| 471 | 471 | EEH_HTML::strong( |
| 472 | 472 | sprintf( |
| 473 | - __( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
| 473 | + __('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
| 474 | 474 | EE_Config::instance()->currency->code |
| 475 | 475 | ) |
| 476 | 476 | ) |
@@ -490,9 +490,9 @@ discard block |
||
| 490 | 490 | * @param \EE_Payment_Method $payment_method |
| 491 | 491 | * @return \EE_Form_Section_HTML |
| 492 | 492 | */ |
| 493 | - protected function _payment_method_settings( EE_Payment_Method $payment_method ) { |
|
| 493 | + protected function _payment_method_settings(EE_Payment_Method $payment_method) { |
|
| 494 | 494 | //modify the form so we only have/show fields that will be implemented for this version |
| 495 | - return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() ); |
|
| 495 | + return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name()); |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | |
@@ -505,8 +505,8 @@ discard block |
||
| 505 | 505 | * @return \EE_Payment_Method_Form |
| 506 | 506 | * @throws \EE_Error |
| 507 | 507 | */ |
| 508 | - protected function _simplify_form( $form_section, $payment_method_name = '' ){ |
|
| 509 | - if ( $form_section instanceof EE_Payment_Method_Form ) { |
|
| 508 | + protected function _simplify_form($form_section, $payment_method_name = '') { |
|
| 509 | + if ($form_section instanceof EE_Payment_Method_Form) { |
|
| 510 | 510 | $form_section->exclude( |
| 511 | 511 | array( |
| 512 | 512 | 'PMD_type', //dont want them changing the type |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | ); |
| 518 | 518 | return $form_section; |
| 519 | 519 | } else { |
| 520 | - throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name )); |
|
| 520 | + throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name)); |
|
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | 523 | |
@@ -530,18 +530,18 @@ discard block |
||
| 530 | 530 | * @param \EE_Payment_Method $payment_method |
| 531 | 531 | * @return \EE_Form_Section_HTML |
| 532 | 532 | */ |
| 533 | - protected function _update_payment_method_button( EE_Payment_Method $payment_method ) { |
|
| 533 | + protected function _update_payment_method_button(EE_Payment_Method $payment_method) { |
|
| 534 | 534 | $update_button = new EE_Submit_Input( |
| 535 | 535 | array( |
| 536 | - 'html_id' => 'save_' . $payment_method->slug() . '_settings', |
|
| 537 | - 'default' => sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
| 536 | + 'html_id' => 'save_'.$payment_method->slug().'_settings', |
|
| 537 | + 'default' => sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()), |
|
| 538 | 538 | 'html_label' => EEH_HTML::nbsp() |
| 539 | 539 | ) |
| 540 | 540 | ); |
| 541 | 541 | return new EE_Form_Section_HTML( |
| 542 | - EEH_HTML::no_row( EEH_HTML::br(2) ) . |
|
| 542 | + EEH_HTML::no_row(EEH_HTML::br(2)). |
|
| 543 | 543 | EEH_HTML::tr( |
| 544 | - EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) . |
|
| 544 | + EEH_HTML::th(__('Update Settings', 'event_espresso')). |
|
| 545 | 545 | EEH_HTML::td( |
| 546 | 546 | $update_button->get_html_for_input() |
| 547 | 547 | ) |
@@ -558,11 +558,11 @@ discard block |
||
| 558 | 558 | * @param \EE_Payment_Method $payment_method |
| 559 | 559 | * @return \EE_Form_Section_Proper |
| 560 | 560 | */ |
| 561 | - protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
| 562 | - $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() ); |
|
| 561 | + protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) { |
|
| 562 | + $link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name()); |
|
| 563 | 563 | return new EE_Form_Section_HTML( |
| 564 | 564 | EEH_HTML::tr( |
| 565 | - EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) . |
|
| 565 | + EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')). |
|
| 566 | 566 | EEH_HTML::td( |
| 567 | 567 | EEH_HTML::link( |
| 568 | 568 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | ), |
| 575 | 575 | $link_text_and_title, |
| 576 | 576 | $link_text_and_title, |
| 577 | - 'deactivate_' . $payment_method->slug(), |
|
| 577 | + 'deactivate_'.$payment_method->slug(), |
|
| 578 | 578 | 'espresso-button button-secondary' |
| 579 | 579 | ) |
| 580 | 580 | ) |
@@ -590,12 +590,12 @@ discard block |
||
| 590 | 590 | * @param \EE_Payment_Method $payment_method |
| 591 | 591 | * @return \EE_Form_Section_Proper |
| 592 | 592 | */ |
| 593 | - protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
| 594 | - $link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() ); |
|
| 593 | + protected function _activate_payment_method_button(EE_Payment_Method $payment_method) { |
|
| 594 | + $link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name()); |
|
| 595 | 595 | return new EE_Form_Section_Proper( |
| 596 | 596 | array( |
| 597 | - 'name' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
| 598 | - 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
| 597 | + 'name' => 'activate_'.$payment_method->slug().'_settings_form', |
|
| 598 | + 'html_id' => 'activate_'.$payment_method->slug().'_settings_form', |
|
| 599 | 599 | 'action' => '#', |
| 600 | 600 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
| 601 | 601 | 'subsections' => apply_filters( |
@@ -604,8 +604,8 @@ discard block |
||
| 604 | 604 | new EE_Form_Section_HTML( |
| 605 | 605 | EEH_HTML::tr( |
| 606 | 606 | EEH_HTML::th( |
| 607 | - EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' )) |
|
| 608 | - ) . |
|
| 607 | + EEH_HTML::label(__('Click to Activate ', 'event_espresso')) |
|
| 608 | + ). |
|
| 609 | 609 | EEH_HTML::td( |
| 610 | 610 | EEH_HTML::link( |
| 611 | 611 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | ), |
| 618 | 618 | $link_text_and_title, |
| 619 | 619 | $link_text_and_title, |
| 620 | - 'activate_' . $payment_method->slug(), |
|
| 620 | + 'activate_'.$payment_method->slug(), |
|
| 621 | 621 | 'espresso-button-green button-primary' |
| 622 | 622 | ) |
| 623 | 623 | ) |
@@ -638,9 +638,9 @@ discard block |
||
| 638 | 638 | protected function _fine_print() { |
| 639 | 639 | return new EE_Form_Section_HTML( |
| 640 | 640 | EEH_HTML::tr( |
| 641 | - EEH_HTML::th() . |
|
| 641 | + EEH_HTML::th(). |
|
| 642 | 642 | EEH_HTML::td( |
| 643 | - EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ) |
|
| 643 | + EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') |
|
| 644 | 644 | ) |
| 645 | 645 | ) |
| 646 | 646 | ); |
@@ -652,15 +652,15 @@ discard block |
||
| 652 | 652 | * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far) |
| 653 | 653 | * @global WP_User $current_user |
| 654 | 654 | */ |
| 655 | - protected function _activate_payment_method(){ |
|
| 656 | - if(isset($this->_req_data['payment_method_type'])){ |
|
| 655 | + protected function _activate_payment_method() { |
|
| 656 | + if (isset($this->_req_data['payment_method_type'])) { |
|
| 657 | 657 | $payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']); |
| 658 | 658 | //see if one exists |
| 659 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
| 660 | - $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type ); |
|
| 659 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 660 | + $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type); |
|
| 661 | 661 | |
| 662 | - $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); |
|
| 663 | - }else{ |
|
| 662 | + $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug())); |
|
| 663 | + } else { |
|
| 664 | 664 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
| 665 | 665 | } |
| 666 | 666 | } |
@@ -668,14 +668,14 @@ discard block |
||
| 668 | 668 | /** |
| 669 | 669 | * Deactivates the payment method with the specified slug, and redirects. |
| 670 | 670 | */ |
| 671 | - protected function _deactivate_payment_method(){ |
|
| 672 | - if(isset($this->_req_data['payment_method'])){ |
|
| 671 | + protected function _deactivate_payment_method() { |
|
| 672 | + if (isset($this->_req_data['payment_method'])) { |
|
| 673 | 673 | $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
| 674 | 674 | //deactivate it |
| 675 | 675 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
| 676 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug ); |
|
| 677 | - $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); |
|
| 678 | - }else{ |
|
| 676 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug); |
|
| 677 | + $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug)); |
|
| 678 | + } else { |
|
| 679 | 679 | $this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); |
| 680 | 680 | } |
| 681 | 681 | } |
@@ -689,39 +689,39 @@ discard block |
||
| 689 | 689 | * subsequently called 'headers_sent_func' which is _payment_methods_list) |
| 690 | 690 | * @return void |
| 691 | 691 | */ |
| 692 | - protected function _update_payment_method(){ |
|
| 693 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
| 692 | + protected function _update_payment_method() { |
|
| 693 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 694 | 694 | //ok let's find which gateway form to use based on the form input |
| 695 | 695 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
| 696 | 696 | /** @var $correct_pmt_form_to_use EE_Payment_Method_Form */ |
| 697 | 697 | $correct_pmt_form_to_use = NULL; |
| 698 | 698 | $pmt_obj = NULL; |
| 699 | - foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){ |
|
| 699 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
| 700 | 700 | /** @var $pmt_obj EE_PMT_Base */ |
| 701 | 701 | //get the form and simplify it, like what we do when we display it |
| 702 | 702 | $pmt_form = $pmt_obj->settings_form(); |
| 703 | 703 | $this->_simplify_form($pmt_form); |
| 704 | - if($pmt_form->form_data_present_in($this->_req_data)){ |
|
| 704 | + if ($pmt_form->form_data_present_in($this->_req_data)) { |
|
| 705 | 705 | $correct_pmt_form_to_use = $pmt_form; |
| 706 | 706 | break; |
| 707 | 707 | } |
| 708 | 708 | } |
| 709 | 709 | //if we couldn't find the correct payment method type... |
| 710 | - if( ! $correct_pmt_form_to_use ){ |
|
| 710 | + if ( ! $correct_pmt_form_to_use) { |
|
| 711 | 711 | EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
| 712 | 712 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
| 713 | 713 | } |
| 714 | 714 | $correct_pmt_form_to_use->receive_form_submission($this->_req_data); |
| 715 | - if($correct_pmt_form_to_use->is_valid()){ |
|
| 715 | + if ($correct_pmt_form_to_use->is_valid()) { |
|
| 716 | 716 | $correct_pmt_form_to_use->save(); |
| 717 | 717 | $pm = $correct_pmt_form_to_use->get_model_object(); |
| 718 | 718 | /** @var $pm EE_Payment_Method */ |
| 719 | - $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); |
|
| 720 | - }else{ |
|
| 719 | + $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug())); |
|
| 720 | + } else { |
|
| 721 | 721 | EE_Error::add_error( |
| 722 | 722 | sprintf( |
| 723 | 723 | __('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), |
| 724 | - $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' ) |
|
| 724 | + $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso') |
|
| 725 | 725 | ), |
| 726 | 726 | __FILE__, |
| 727 | 727 | __FUNCTION__, |
@@ -738,11 +738,11 @@ discard block |
||
| 738 | 738 | protected function _payment_settings() { |
| 739 | 739 | |
| 740 | 740 | $this->_template_args['values'] = $this->_yes_no_values; |
| 741 | - $this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE; |
|
| 741 | + $this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE; |
|
| 742 | 742 | |
| 743 | - $this->_set_add_edit_form_tags( 'update_payment_settings' ); |
|
| 744 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 745 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE ); |
|
| 743 | + $this->_set_add_edit_form_tags('update_payment_settings'); |
|
| 744 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
| 745 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE); |
|
| 746 | 746 | $this->display_admin_page_with_sidebar(); |
| 747 | 747 | |
| 748 | 748 | } |
@@ -756,13 +756,13 @@ discard block |
||
| 756 | 756 | * @return array |
| 757 | 757 | */ |
| 758 | 758 | protected function _update_payment_settings() { |
| 759 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
| 760 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG ); |
|
| 759 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
| 760 | + EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG); |
|
| 761 | 761 | |
| 762 | 762 | |
| 763 | - $what = __('Payment Settings','event_espresso'); |
|
| 764 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 765 | - $this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) ); |
|
| 763 | + $what = __('Payment Settings', 'event_espresso'); |
|
| 764 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
| 765 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings')); |
|
| 766 | 766 | |
| 767 | 767 | } |
| 768 | 768 | protected function _payment_log_overview_list_table() { |
@@ -788,18 +788,18 @@ discard block |
||
| 788 | 788 | * @param bool $count |
| 789 | 789 | * @return array |
| 790 | 790 | */ |
| 791 | - public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){ |
|
| 792 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
| 791 | + public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) { |
|
| 792 | + EE_Registry::instance()->load_model('Change_Log'); |
|
| 793 | 793 | //we may need to do multiple queries (joining differently), so we actually wan tan array of query params |
| 794 | - $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
| 794 | + $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
| 795 | 795 | //check if they've selected a specific payment method |
| 796 | - if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){ |
|
| 796 | + if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') { |
|
| 797 | 797 | $query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'], |
| 798 | 798 | 'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']); |
| 799 | 799 | } |
| 800 | 800 | //take into account search |
| 801 | - if(isset($this->_req_data['s']) && $this->_req_data['s']){ |
|
| 802 | - $similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%'); |
|
| 801 | + if (isset($this->_req_data['s']) && $this->_req_data['s']) { |
|
| 802 | + $similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%'); |
|
| 803 | 803 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string; |
| 804 | 804 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string; |
| 805 | 805 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string; |
@@ -814,48 +814,48 @@ discard block |
||
| 814 | 814 | $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
| 815 | 815 | |
| 816 | 816 | } |
| 817 | - if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){ |
|
| 817 | + if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) { |
|
| 818 | 818 | //add date |
| 819 | - $start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ); |
|
| 820 | - $end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ); |
|
| 819 | + $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']); |
|
| 820 | + $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']); |
|
| 821 | 821 | //make sure our timestamps start and end right at the boundaries for each day |
| 822 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
| 823 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
| 822 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
| 823 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
| 824 | 824 | |
| 825 | 825 | //convert to timestamps |
| 826 | - $start_date = strtotime( $start_date ); |
|
| 827 | - $end_date = strtotime( $end_date ); |
|
| 826 | + $start_date = strtotime($start_date); |
|
| 827 | + $end_date = strtotime($end_date); |
|
| 828 | 828 | |
| 829 | 829 | //makes sure start date is the lowest value and vice versa |
| 830 | - $start_date = min( $start_date, $end_date ); |
|
| 831 | - $end_date = max( $start_date, $end_date ); |
|
| 830 | + $start_date = min($start_date, $end_date); |
|
| 831 | + $end_date = max($start_date, $end_date); |
|
| 832 | 832 | |
| 833 | 833 | //convert for query |
| 834 | - $start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
| 835 | - $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
| 834 | + $start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
| 835 | + $end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
| 836 | 836 | |
| 837 | - $query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date)); |
|
| 837 | + $query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date)); |
|
| 838 | 838 | |
| 839 | 839 | } |
| 840 | - if($count){ |
|
| 840 | + if ($count) { |
|
| 841 | 841 | return EEM_Change_Log::instance()->count($query_params); |
| 842 | 842 | } |
| 843 | - if(isset($this->_req_data['order'])){ |
|
| 844 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
| 843 | + if (isset($this->_req_data['order'])) { |
|
| 844 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
| 845 | 845 | $query_params['order_by'] = array('LOG_time' => $sort); |
| 846 | - }else{ |
|
| 846 | + } else { |
|
| 847 | 847 | $query_params['order_by'] = array('LOG_time' => 'DESC'); |
| 848 | 848 | } |
| 849 | - $offset = ($current_page-1)*$per_page; |
|
| 849 | + $offset = ($current_page - 1) * $per_page; |
|
| 850 | 850 | |
| 851 | - if( ! isset($this->_req_data['download_results'])){ |
|
| 852 | - $query_params['limit'] = array( $offset, $per_page ); |
|
| 851 | + if ( ! isset($this->_req_data['download_results'])) { |
|
| 852 | + $query_params['limit'] = array($offset, $per_page); |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | |
| 856 | 856 | |
| 857 | 857 | //now they've requested to instead just download the file instead of viewing it. |
| 858 | - if(isset($this->_req_data['download_results'])){ |
|
| 858 | + if (isset($this->_req_data['download_results'])) { |
|
| 859 | 859 | $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params); |
| 860 | 860 | header('Content-Disposition: attachment'); |
| 861 | 861 | header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url())); |
@@ -877,36 +877,36 @@ discard block |
||
| 877 | 877 | * @param EE_Change_Log $logB |
| 878 | 878 | * @return int |
| 879 | 879 | */ |
| 880 | - protected function _sort_logs_again($logA,$logB){ |
|
| 880 | + protected function _sort_logs_again($logA, $logB) { |
|
| 881 | 881 | $timeA = $logA->get_raw('LOG_time'); |
| 882 | 882 | $timeB = $logB->get_raw('LOG_time'); |
| 883 | - if($timeA == $timeB){ |
|
| 883 | + if ($timeA == $timeB) { |
|
| 884 | 884 | return 0; |
| 885 | 885 | } |
| 886 | 886 | $comparison = $timeA < $timeB ? -1 : 1; |
| 887 | - if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ |
|
| 887 | + if (strtoupper($this->_sort_logs_again_direction) == 'DESC') { |
|
| 888 | 888 | return $comparison * -1; |
| 889 | - }else{ |
|
| 889 | + } else { |
|
| 890 | 890 | return $comparison; |
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | protected function _payment_log_details() { |
| 895 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
| 895 | + EE_Registry::instance()->load_model('Change_Log'); |
|
| 896 | 896 | /** @var $payment_log EE_Change_Log */ |
| 897 | 897 | $payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']); |
| 898 | 898 | $payment_method = NULL; |
| 899 | 899 | $transaction = NULL; |
| 900 | - if( $payment_log instanceof EE_Change_Log ){ |
|
| 901 | - if( $payment_log->object() instanceof EE_Payment ){ |
|
| 900 | + if ($payment_log instanceof EE_Change_Log) { |
|
| 901 | + if ($payment_log->object() instanceof EE_Payment) { |
|
| 902 | 902 | $payment_method = $payment_log->object()->payment_method(); |
| 903 | 903 | $transaction = $payment_log->object()->transaction(); |
| 904 | - }elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
| 904 | + }elseif ($payment_log->object() instanceof EE_Payment_Method) { |
|
| 905 | 905 | $payment_method = $payment_log->object(); |
| 906 | 906 | } |
| 907 | 907 | } |
| 908 | 908 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
| 909 | - EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php', |
|
| 909 | + EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php', |
|
| 910 | 910 | array( |
| 911 | 911 | 'payment_log'=>$payment_log, |
| 912 | 912 | 'payment_method'=>$payment_method, |
@@ -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; |
@@ -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 | |