@@ -1,69 +1,69 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; |
| 3 | 3 | if ( |
| 4 | - ( is_single() && espresso_display_venue_in_event_details() ) |
|
| 5 | - || ( is_archive() && espresso_display_venue_in_event_list() ) |
|
| 4 | + (is_single() && espresso_display_venue_in_event_details()) |
|
| 5 | + || (is_archive() && espresso_display_venue_in_event_list()) |
|
| 6 | 6 | ) : |
| 7 | 7 | global $post; |
| 8 | - do_action( 'AHEE_event_details_before_venue_details', $post ); |
|
| 9 | - $venue_name = espresso_venue_name( 0, 'details', FALSE ); |
|
| 10 | - if ( empty( $venue_name ) && espresso_is_venue_private() ) { |
|
| 11 | - do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
| 8 | + do_action('AHEE_event_details_before_venue_details', $post); |
|
| 9 | + $venue_name = espresso_venue_name(0, 'details', FALSE); |
|
| 10 | + if (empty($venue_name) && espresso_is_venue_private()) { |
|
| 11 | + do_action('AHEE_event_details_after_venue_details', $post); |
|
| 12 | 12 | return ''; |
| 13 | 13 | } |
| 14 | 14 | ?> |
| 15 | 15 | |
| 16 | 16 | <div class="espresso-venue-dv<?php echo espresso_is_venue_private() ? ' espresso-private-venue-dv' : ''; ?>"> |
| 17 | 17 | <h3 class="event-venues-h3 ee-event-h3"> |
| 18 | - <?php _e( 'Location', 'event_espresso' ); ?> |
|
| 18 | + <?php _e('Location', 'event_espresso'); ?> |
|
| 19 | 19 | </h3> |
| 20 | - <h4><strong><?php _e( 'Venue:', 'event_espresso' ); ?></strong> <strong> <?php echo $venue_name; ?></strong></h4> |
|
| 20 | + <h4><strong><?php _e('Venue:', 'event_espresso'); ?></strong> <strong> <?php echo $venue_name; ?></strong></h4> |
|
| 21 | 21 | <p><span class="smaller-text tags-links"><?php echo espresso_venue_categories(); ?></span></p> |
| 22 | -<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?> |
|
| 22 | +<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?> |
|
| 23 | 23 | <p> |
| 24 | - <span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?></strong></span> <?php echo $venue_phone; ?> |
|
| 24 | + <span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?></strong></span> <?php echo $venue_phone; ?> |
|
| 25 | 25 | </p> |
| 26 | -<?php endif; ?> |
|
| 27 | -<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?> |
|
| 26 | +<?php endif; ?> |
|
| 27 | +<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?> |
|
| 28 | 28 | <p> |
| 29 | - <span class="small-text"><strong><?php _e( 'Venue Website:', 'event_espresso' ); ?></strong></span> <?php echo $venue_website; ?> |
|
| 29 | + <span class="small-text"><strong><?php _e('Venue Website:', 'event_espresso'); ?></strong></span> <?php echo $venue_website; ?> |
|
| 30 | 30 | </p> |
| 31 | 31 | <?php endif; ?> |
| 32 | -<?php if ( espresso_venue_has_address( $post->ID )) : ?> |
|
| 33 | - <strong><span class="dashicons dashicons-location-alt"></span><?php _e( 'Address:', 'event_espresso' ); ?></strong> |
|
| 34 | - <?php espresso_venue_address( 'inline' ); ?> |
|
| 35 | - <?php espresso_venue_gmap( $post->ID ); ?> |
|
| 32 | +<?php if (espresso_venue_has_address($post->ID)) : ?> |
|
| 33 | + <strong><span class="dashicons dashicons-location-alt"></span><?php _e('Address:', 'event_espresso'); ?></strong> |
|
| 34 | + <?php espresso_venue_address('inline'); ?> |
|
| 35 | + <?php espresso_venue_gmap($post->ID); ?> |
|
| 36 | 36 | <div class="clear"><br/></div> |
| 37 | -<?php endif; ?> |
|
| 37 | +<?php endif; ?> |
|
| 38 | 38 | |
| 39 | - <?php $VNU_ID = espresso_venue_id( $post->ID ); ?> |
|
| 40 | - <?php if ( is_single() ) : ?> |
|
| 41 | - <?php $venue_description = espresso_venue_description( $VNU_ID, FALSE ); ?> |
|
| 42 | - <?php if ( $venue_description ) : ?> |
|
| 39 | + <?php $VNU_ID = espresso_venue_id($post->ID); ?> |
|
| 40 | + <?php if (is_single()) : ?> |
|
| 41 | + <?php $venue_description = espresso_venue_description($VNU_ID, FALSE); ?> |
|
| 42 | + <?php if ($venue_description) : ?> |
|
| 43 | 43 | <p> |
| 44 | - <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
| 45 | - <?php echo do_shortcode( $venue_description ); ?> |
|
| 44 | + <strong><?php _e('Description:', 'event_espresso'); ?></strong><br/> |
|
| 45 | + <?php echo do_shortcode($venue_description); ?> |
|
| 46 | 46 | </p> |
| 47 | - <?php endif; ?> |
|
| 47 | + <?php endif; ?> |
|
| 48 | 48 | <?php else : ?> |
| 49 | - <?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?> |
|
| 50 | - <?php if ( $venue_excerpt ) : ?> |
|
| 49 | + <?php $venue_excerpt = espresso_venue_excerpt($VNU_ID, FALSE); ?> |
|
| 50 | + <?php if ($venue_excerpt) : ?> |
|
| 51 | 51 | <p> |
| 52 | - <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
| 52 | + <strong><?php _e('Description:', 'event_espresso'); ?></strong><br/> |
|
| 53 | 53 | <?php echo $venue_excerpt; ?> |
| 54 | 54 | </p> |
| 55 | - <?php endif; ?> |
|
| 56 | - <?php endif; ?> |
|
| 55 | + <?php endif; ?> |
|
| 56 | + <?php endif; ?> |
|
| 57 | 57 | </div> |
| 58 | 58 | <!-- .espresso-venue-dv --> |
| 59 | 59 | <?php |
| 60 | -do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
| 60 | +do_action('AHEE_event_details_after_venue_details', $post); |
|
| 61 | 61 | else : |
| 62 | - if ( espresso_venue_is_password_protected() ) : |
|
| 62 | + if (espresso_venue_is_password_protected()) : |
|
| 63 | 63 | ?> |
| 64 | 64 | <div class="espresso-venue-dv espresso-password-protected-venue-dv" > |
| 65 | 65 | <h3 class="event-venues-h3 ee-event-h3"> |
| 66 | - <?php _e( 'Location', 'event_espresso' );?> |
|
| 66 | + <?php _e('Location', 'event_espresso'); ?> |
|
| 67 | 67 | </h3> |
| 68 | 68 | <?php echo espresso_password_protected_venue_form(); ?> |
| 69 | 69 | </div> |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | $closing_tag = '</a>'; |
| 3 | 3 | //if this is decaf, which is put on WordPress.org, we need to inform users that |
| 4 | 4 | //we just put an affiliate link there. See https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/ section 12 |
| 5 | -if( apply_filters( 'FHEE__ee_show_affiliate_links', true ) ) { |
|
| 6 | - $closing_tag .= esc_html__( ' (affiliate link)', 'event_espresso' ); |
|
| 5 | +if (apply_filters('FHEE__ee_show_affiliate_links', true)) { |
|
| 6 | + $closing_tag .= esc_html__(' (affiliate link)', 'event_espresso'); |
|
| 7 | 7 | } |
| 8 | -printf( esc_html__('PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">', $closing_tag ); |
|
| 9 | 8 | \ No newline at end of file |
| 9 | +printf(esc_html__('PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">', $closing_tag); |
|
| 10 | 10 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | 5 | /** |
| 6 | 6 | * Event Espresso |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * ------------------------------------------------------------------------ |
| 26 | 26 | */ |
| 27 | 27 | ?> |
| 28 | -<strong style="color:#F00"><?php esc_html_e('Please Note:','event_espresso')?></strong> <?php esc_html_e("You will need a PayPal Premier or Business account for the PayPal IPN to work correctly.", 'event_espresso'); |
|
| 28 | +<strong style="color:#F00"><?php esc_html_e('Please Note:', 'event_espresso')?></strong> <?php esc_html_e("You will need a PayPal Premier or Business account for the PayPal IPN to work correctly.", 'event_espresso'); |
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | // End of file paypal_standard_settings_before_form.template.php |
| 32 | 32 | \ No newline at end of file |
@@ -1,7 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | +} |
|
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
| 7 | 8 | * |
@@ -3,27 +3,27 @@ |
||
| 3 | 3 | if (!defined('EVENT_ESPRESSO_VERSION')) |
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | 5 | /** |
| 6 | - * Event Espresso |
|
| 7 | - * |
|
| 8 | - * Event Registration and Management Plugin for WordPress |
|
| 9 | - * |
|
| 10 | - * @ package Event Espresso |
|
| 11 | - * @ author Seth Shoultes |
|
| 12 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
| 13 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 14 | - * @ link http://www.eventespresso.com |
|
| 15 | - * @ version 4.3 |
|
| 16 | - * |
|
| 17 | - * ------------------------------------------------------------------------ |
|
| 18 | - * |
|
| 19 | - * paypal_standard_settings_before_form |
|
| 20 | - * |
|
| 21 | - * @package Event Espresso |
|
| 22 | - * @subpackage |
|
| 23 | - * @author Mike Nelson |
|
| 24 | - * |
|
| 25 | - * ------------------------------------------------------------------------ |
|
| 26 | - */ |
|
| 6 | + * Event Espresso |
|
| 7 | + * |
|
| 8 | + * Event Registration and Management Plugin for WordPress |
|
| 9 | + * |
|
| 10 | + * @ package Event Espresso |
|
| 11 | + * @ author Seth Shoultes |
|
| 12 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
| 13 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
| 14 | + * @ link http://www.eventespresso.com |
|
| 15 | + * @ version 4.3 |
|
| 16 | + * |
|
| 17 | + * ------------------------------------------------------------------------ |
|
| 18 | + * |
|
| 19 | + * paypal_standard_settings_before_form |
|
| 20 | + * |
|
| 21 | + * @package Event Espresso |
|
| 22 | + * @subpackage |
|
| 23 | + * @author Mike Nelson |
|
| 24 | + * |
|
| 25 | + * ------------------------------------------------------------------------ |
|
| 26 | + */ |
|
| 27 | 27 | ?> |
| 28 | 28 | <strong style="color:#F00"><?php esc_html_e('Please Note:','event_espresso')?></strong> <?php esc_html_e("You will need a PayPal Premier or Business account for the PayPal IPN to work correctly.", 'event_espresso'); |
| 29 | 29 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('ABSPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /* |
| 5 | 5 | Plugin Name: Event Espresso |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | */ |
| 43 | 43 | |
| 44 | -if ( function_exists( 'espresso_version' ) ) { |
|
| 44 | +if (function_exists('espresso_version')) { |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * espresso_duplicate_plugin_error |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | function espresso_duplicate_plugin_error() { |
| 51 | 51 | ?> |
| 52 | 52 | <div class="error"> |
| 53 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
| 53 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
| 54 | 54 | </div> |
| 55 | 55 | <?php |
| 56 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
| 56 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 57 | 57 | } |
| 58 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
| 58 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 59 | 59 | |
| 60 | 60 | } else { |
| 61 | 61 | |
@@ -66,103 +66,103 @@ discard block |
||
| 66 | 66 | * @return string |
| 67 | 67 | */ |
| 68 | 68 | function espresso_version() { |
| 69 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.5.rc.007' ); |
|
| 69 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.5.rc.007'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // define versions |
| 73 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
| 74 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
| 75 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
| 76 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
| 77 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
| 78 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
| 79 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
| 73 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
| 74 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
| 75 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
| 76 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
| 77 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
| 78 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
| 79 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 80 | 80 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
| 81 | - if ( ! defined( 'DS' ) ) { |
|
| 82 | - define( 'DS', '/' ); |
|
| 81 | + if ( ! defined('DS')) { |
|
| 82 | + define('DS', '/'); |
|
| 83 | 83 | } |
| 84 | - if ( ! defined( 'PS' ) ) { |
|
| 85 | - define( 'PS', PATH_SEPARATOR ); |
|
| 84 | + if ( ! defined('PS')) { |
|
| 85 | + define('PS', PATH_SEPARATOR); |
|
| 86 | 86 | } |
| 87 | - if ( ! defined( 'SP' ) ) { |
|
| 88 | - define( 'SP', ' ' ); |
|
| 87 | + if ( ! defined('SP')) { |
|
| 88 | + define('SP', ' '); |
|
| 89 | 89 | } |
| 90 | - if ( ! defined( 'EENL' ) ) { |
|
| 91 | - define( 'EENL', "\n" ); |
|
| 90 | + if ( ! defined('EENL')) { |
|
| 91 | + define('EENL', "\n"); |
|
| 92 | 92 | } |
| 93 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
| 93 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
| 94 | 94 | // define the plugin directory and URL |
| 95 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
| 96 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
| 97 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
| 95 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 96 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 97 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
| 98 | 98 | // main root folder paths |
| 99 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
| 100 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
| 101 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
| 102 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
| 103 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
| 104 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
| 105 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
| 106 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
| 99 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
| 100 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
| 101 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
| 102 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
| 103 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
| 104 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
| 105 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
| 106 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
| 107 | 107 | // core system paths |
| 108 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
| 109 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
| 110 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
| 111 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
| 112 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
| 113 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
| 114 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
| 115 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
| 116 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
| 117 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
| 118 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
| 119 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
| 108 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
| 109 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
| 110 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
| 111 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
| 112 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
| 113 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
| 114 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
| 115 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
| 116 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
| 117 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
| 118 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
| 119 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
| 120 | 120 | // gateways |
| 121 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
| 122 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
| 121 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
| 122 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
| 123 | 123 | // asset URL paths |
| 124 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
| 125 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
| 126 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
| 127 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
| 128 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
| 129 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
| 124 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
| 125 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
| 126 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
| 127 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
| 128 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
| 129 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
| 130 | 130 | // define upload paths |
| 131 | 131 | $uploads = wp_upload_dir(); |
| 132 | 132 | // define the uploads directory and URL |
| 133 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
| 134 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
| 133 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
| 134 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
| 135 | 135 | // define the templates directory and URL |
| 136 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
| 137 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
| 136 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
| 137 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
| 138 | 138 | // define the gateway directory and URL |
| 139 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
| 140 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
| 139 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
| 140 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
| 141 | 141 | // languages folder/path |
| 142 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
| 143 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
| 142 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
| 143 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
| 144 | 144 | //check for dompdf fonts in uploads |
| 145 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
| 146 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
| 145 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
| 146 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
| 147 | 147 | } |
| 148 | 148 | //ajax constants |
| 149 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
| 150 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
| 149 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
| 150 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
| 151 | 151 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
| 152 | 152 | //you're better to use this than its straight value (currently -1) in case you ever |
| 153 | 153 | //want to change its default value! or find when -1 means infinity |
| 154 | - define( 'EE_INF_IN_DB', -1 ); |
|
| 155 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
| 156 | - define( 'EE_DEBUG', false ); |
|
| 154 | + define('EE_INF_IN_DB', -1); |
|
| 155 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
| 156 | + define('EE_DEBUG', false); |
|
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | 159 | * espresso_plugin_activation |
| 160 | 160 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
| 161 | 161 | */ |
| 162 | 162 | function espresso_plugin_activation() { |
| 163 | - update_option( 'ee_espresso_activation', true ); |
|
| 163 | + update_option('ee_espresso_activation', true); |
|
| 164 | 164 | } |
| 165 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
| 165 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 166 | 166 | |
| 167 | 167 | |
| 168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | // } |
| 177 | 177 | // |
| 178 | 178 | } |
| 179 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
| 179 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
| 180 | 180 | |
| 181 | 181 | |
| 182 | 182 | |
@@ -186,15 +186,15 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | function espresso_load_error_handling() { |
| 188 | 188 | // load debugging tools |
| 189 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
| 190 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
| 189 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
| 190 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
| 191 | 191 | EEH_Debug_Tools::instance(); |
| 192 | 192 | } |
| 193 | 193 | // load error handling |
| 194 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
| 195 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
| 194 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
| 195 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
| 196 | 196 | } else { |
| 197 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
| 197 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
@@ -208,25 +208,25 @@ discard block |
||
| 208 | 208 | * @param string $full_path_to_file |
| 209 | 209 | * @throws EE_Error |
| 210 | 210 | */ |
| 211 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
| 211 | + function espresso_load_required($classname, $full_path_to_file) { |
|
| 212 | 212 | static $error_handling_loaded = false; |
| 213 | - if ( ! $error_handling_loaded ) { |
|
| 213 | + if ( ! $error_handling_loaded) { |
|
| 214 | 214 | espresso_load_error_handling(); |
| 215 | 215 | $error_handling_loaded = true; |
| 216 | 216 | } |
| 217 | - if ( is_readable( $full_path_to_file ) ) { |
|
| 218 | - require_once( $full_path_to_file ); |
|
| 217 | + if (is_readable($full_path_to_file)) { |
|
| 218 | + require_once($full_path_to_file); |
|
| 219 | 219 | } else { |
| 220 | - throw new EE_Error ( sprintf( |
|
| 221 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
| 220 | + throw new EE_Error(sprintf( |
|
| 221 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
| 222 | 222 | $classname |
| 223 | - ) ); |
|
| 223 | + )); |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
| 228 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
| 229 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
| 227 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
| 228 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
| 229 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
| 230 | 230 | new EE_Bootstrap(); |
| 231 | 231 | |
| 232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | |
| 237 | 237 | |
| 238 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
| 238 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
| 239 | 239 | /** |
| 240 | 240 | * deactivate_plugin |
| 241 | 241 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -244,12 +244,12 @@ discard block |
||
| 244 | 244 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
| 245 | 245 | * @return void |
| 246 | 246 | */ |
| 247 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
| 248 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
| 249 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
| 247 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
| 248 | + if ( ! function_exists('deactivate_plugins')) { |
|
| 249 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
| 250 | 250 | } |
| 251 | - unset( $_GET[ 'activate' ] ); |
|
| 252 | - unset( $_REQUEST[ 'activate' ] ); |
|
| 253 | - deactivate_plugins( $plugin_basename ); |
|
| 251 | + unset($_GET['activate']); |
|
| 252 | + unset($_REQUEST['activate']); |
|
| 253 | + deactivate_plugins($plugin_basename); |
|
| 254 | 254 | } |
| 255 | 255 | } |
@@ -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 | |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | * ------------------------------------------------------------------------ |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | -if ( ! class_exists( 'WP_List_Table' )) { |
|
| 35 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 34 | +if ( ! class_exists('WP_List_Table')) { |
|
| 35 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | abstract class EE_Admin_List_Table extends WP_List_Table { |
@@ -244,16 +244,16 @@ discard block |
||
| 244 | 244 | * constructor |
| 245 | 245 | * @param EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table. |
| 246 | 246 | */ |
| 247 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
| 247 | + public function __construct(EE_Admin_Page $admin_page) { |
|
| 248 | 248 | $this->_admin_page = $admin_page; |
| 249 | 249 | $this->_req_data = $this->_admin_page->get_request_data(); |
| 250 | 250 | $this->_view = $this->_admin_page->get_view(); |
| 251 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
| 251 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
| 252 | 252 | $this->_current_page = $this->get_pagenum(); |
| 253 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
| 254 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
| 253 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
| 254 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
| 255 | 255 | |
| 256 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
| 256 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
| 257 | 257 | |
| 258 | 258 | $this->_setup_data(); |
| 259 | 259 | $this->_add_view_counts(); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $this->_set_properties(); |
| 264 | 264 | |
| 265 | 265 | //set primary column |
| 266 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) ); |
|
| 266 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
| 267 | 267 | |
| 268 | 268 | //set parent defaults |
| 269 | 269 | parent::__construct($this->_wp_list_args); |
@@ -339,17 +339,17 @@ discard block |
||
| 339 | 339 | * @return string |
| 340 | 340 | */ |
| 341 | 341 | protected function _get_hidden_fields() { |
| 342 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
| 343 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
| 342 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
| 343 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
| 344 | 344 | //if action is STILL empty, then we set it to default |
| 345 | - $action = empty( $action ) ? 'default' : $action; |
|
| 346 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
| 347 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
| 348 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
| 345 | + $action = empty($action) ? 'default' : $action; |
|
| 346 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
| 347 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
| 348 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
| 349 | 349 | |
| 350 | 350 | $bulk_actions = $this->_get_bulk_actions(); |
| 351 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
| 352 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
| 351 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
| 352 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | return $field; |
@@ -379,15 +379,15 @@ discard block |
||
| 379 | 379 | * |
| 380 | 380 | * @var array |
| 381 | 381 | */ |
| 382 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
| 382 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
| 383 | 383 | |
| 384 | 384 | $sortable = array(); |
| 385 | - foreach ( $_sortable as $id => $data ) { |
|
| 386 | - if ( empty( $data ) ) |
|
| 385 | + foreach ($_sortable as $id => $data) { |
|
| 386 | + if (empty($data)) |
|
| 387 | 387 | continue; |
| 388 | 388 | |
| 389 | 389 | //fix for offset errors with WP_List_Table default get_columninfo() |
| 390 | - if ( is_array($data) ) { |
|
| 390 | + if (is_array($data)) { |
|
| 391 | 391 | $_data[0] = key($data); |
| 392 | 392 | $_data[1] = isset($data[1]) ? $data[1] : false; |
| 393 | 393 | } else { |
@@ -396,14 +396,14 @@ discard block |
||
| 396 | 396 | |
| 397 | 397 | $data = (array) $data; |
| 398 | 398 | |
| 399 | - if ( !isset( $data[1] ) ) |
|
| 399 | + if ( ! isset($data[1])) |
|
| 400 | 400 | $_data[1] = false; |
| 401 | 401 | |
| 402 | 402 | |
| 403 | 403 | $sortable[$id] = $_data; |
| 404 | 404 | } |
| 405 | 405 | $primary = $this->get_primary_column_name(); |
| 406 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); |
|
| 406 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | |
@@ -412,8 +412,8 @@ discard block |
||
| 412 | 412 | * @return string |
| 413 | 413 | */ |
| 414 | 414 | protected function get_primary_column_name() { |
| 415 | - foreach( class_parents( $this ) as $parent ) { |
|
| 416 | - if ( method_exists( $parent, 'get_primary_column_name' ) && $parent == 'WP_List_Table' ) { |
|
| 415 | + foreach (class_parents($this) as $parent) { |
|
| 416 | + if (method_exists($parent, 'get_primary_column_name') && $parent == 'WP_List_Table') { |
|
| 417 | 417 | return parent::get_primary_column_name(); |
| 418 | 418 | } |
| 419 | 419 | } |
@@ -430,10 +430,10 @@ discard block |
||
| 430 | 430 | * @param string $primary |
| 431 | 431 | * @return string |
| 432 | 432 | */ |
| 433 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
| 434 | - foreach( class_parents( $this ) as $parent ) { |
|
| 435 | - if ( method_exists( $parent, 'handle_row_actions' ) && $parent == 'WP_List_Table' ) { |
|
| 436 | - return parent::handle_row_actions( $item, $column_name, $primary ); |
|
| 433 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
| 434 | + foreach (class_parents($this) as $parent) { |
|
| 435 | + if (method_exists($parent, 'handle_row_actions') && $parent == 'WP_List_Table') { |
|
| 436 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | return ''; |
@@ -451,11 +451,11 @@ discard block |
||
| 451 | 451 | protected function _get_bulk_actions() { |
| 452 | 452 | $actions = array(); |
| 453 | 453 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
| 454 | - foreach ( $this->_views as $view => $args) { |
|
| 455 | - if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) |
|
| 454 | + foreach ($this->_views as $view => $args) { |
|
| 455 | + if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view) |
|
| 456 | 456 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
| 457 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
| 458 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
| 457 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
| 458 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
| 459 | 459 | $actions[$route] = $label; |
| 460 | 460 | } |
| 461 | 461 | } |
@@ -473,18 +473,18 @@ discard block |
||
| 473 | 473 | */ |
| 474 | 474 | private function _filters() { |
| 475 | 475 | $classname = get_class($this); |
| 476 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
| 476 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
| 477 | 477 | |
| 478 | - if ( empty( $filters )) { |
|
| 478 | + if (empty($filters)) { |
|
| 479 | 479 | return; |
| 480 | 480 | } |
| 481 | - foreach ( $filters as $filter ) { |
|
| 481 | + foreach ($filters as $filter) { |
|
| 482 | 482 | echo $filter; |
| 483 | 483 | } |
| 484 | 484 | //add filter button at end |
| 485 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
| 485 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
| 486 | 486 | //add reset filters button at end |
| 487 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
| 487 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | |
@@ -498,8 +498,8 @@ discard block |
||
| 498 | 498 | * @param string $column_name |
| 499 | 499 | * @return string |
| 500 | 500 | */ |
| 501 | - public function set_primary_column( $column_name ) { |
|
| 502 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name; |
|
| 501 | + public function set_primary_column($column_name) { |
|
| 502 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | array( |
| 519 | 519 | 'total_items' => $total_items, |
| 520 | 520 | 'per_page' => $this->_per_page, |
| 521 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
| 521 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
| 522 | 522 | ) |
| 523 | 523 | ); |
| 524 | 524 | } |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | * |
| 535 | 535 | * @return string html content for the column |
| 536 | 536 | */ |
| 537 | - public function column_default( $item, $column_name ) { |
|
| 537 | + public function column_default($item, $column_name) { |
|
| 538 | 538 | /** |
| 539 | 539 | * Dynamic hook allowing for adding additional column content in this list table. |
| 540 | 540 | * Note that $this->screen->id is in the format |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | * hook prefix ("event-espresso") will be different. |
| 545 | 545 | * |
| 546 | 546 | */ |
| 547 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
| 547 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | * |
| 561 | 561 | * @var array |
| 562 | 562 | */ |
| 563 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
| 563 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
| 564 | 564 | return $columns; |
| 565 | 565 | } |
| 566 | 566 | |
@@ -572,18 +572,18 @@ discard block |
||
| 572 | 572 | $views = $this->get_views(); |
| 573 | 573 | $assembled_views = ''; |
| 574 | 574 | |
| 575 | - if ( empty( $views )) { |
|
| 575 | + if (empty($views)) { |
|
| 576 | 576 | return; |
| 577 | 577 | } |
| 578 | 578 | echo "<ul class='subsubsub'>\n"; |
| 579 | - foreach ( $views as $view ) { |
|
| 580 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
| 581 | - if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) { |
|
| 582 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
| 579 | + foreach ($views as $view) { |
|
| 580 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
| 581 | + if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) { |
|
| 582 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
| 583 | 583 | } |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
| 586 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
| 587 | 587 | echo "</ul>"; |
| 588 | 588 | } |
| 589 | 589 | |
@@ -596,10 +596,10 @@ discard block |
||
| 596 | 596 | * |
| 597 | 597 | * @param object $item The current item |
| 598 | 598 | */ |
| 599 | - public function single_row( $item ) { |
|
| 600 | - $row_class = $this->_get_row_class( $item ); |
|
| 601 | - echo '<tr class="' . esc_attr( $row_class ) . '">'; |
|
| 602 | - $this->single_row_columns( $item ); |
|
| 599 | + public function single_row($item) { |
|
| 600 | + $row_class = $this->_get_row_class($item); |
|
| 601 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
| 602 | + $this->single_row_columns($item); |
|
| 603 | 603 | echo '</tr>'; |
| 604 | 604 | } |
| 605 | 605 | |
@@ -610,13 +610,13 @@ discard block |
||
| 610 | 610 | * @param object $item the current item |
| 611 | 611 | * @return string |
| 612 | 612 | */ |
| 613 | - protected function _get_row_class( $item ) { |
|
| 613 | + protected function _get_row_class($item) { |
|
| 614 | 614 | static $row_class = ''; |
| 615 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
| 615 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
| 616 | 616 | |
| 617 | 617 | $new_row_class = $row_class; |
| 618 | 618 | |
| 619 | - if ( !empty($this->_ajax_sorting_callback) ) { |
|
| 619 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
| 620 | 620 | $new_row_class .= ' rowsortable'; |
| 621 | 621 | } |
| 622 | 622 | |
@@ -635,13 +635,13 @@ discard block |
||
| 635 | 635 | |
| 636 | 636 | public function get_hidden_columns() { |
| 637 | 637 | $user_id = get_current_user_id(); |
| 638 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
| 639 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
| 640 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
| 641 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
| 638 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
| 639 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
| 640 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
| 641 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
| 642 | 642 | } |
| 643 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
| 644 | - $saved_columns = (array) get_user_option( $ref, $user_id ); |
|
| 643 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
| 644 | + $saved_columns = (array) get_user_option($ref, $user_id); |
|
| 645 | 645 | return $saved_columns; |
| 646 | 646 | } |
| 647 | 647 | |
@@ -656,47 +656,47 @@ discard block |
||
| 656 | 656 | * |
| 657 | 657 | * @param object $item The current item |
| 658 | 658 | */ |
| 659 | - public function single_row_columns( $item ) { |
|
| 660 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
| 659 | + public function single_row_columns($item) { |
|
| 660 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
| 661 | 661 | |
| 662 | 662 | global $wp_version; |
| 663 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' ); |
|
| 663 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
| 664 | 664 | |
| 665 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
| 665 | + foreach ($columns as $column_name => $column_display_name) { |
|
| 666 | 666 | |
| 667 | 667 | /** |
| 668 | 668 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are |
| 669 | 669 | * hidden or not instead of using "display:none;". This bit of code provides backward compat. |
| 670 | 670 | */ |
| 671 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : ''; |
|
| 672 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : ''; |
|
| 671 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
| 672 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
| 673 | 673 | |
| 674 | - $classes = $column_name . ' column-' . $column_name.$hidden_class; |
|
| 675 | - if ( $primary == $column_name ) { |
|
| 674 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
| 675 | + if ($primary == $column_name) { |
|
| 676 | 676 | $classes .= ' has-row-actions column-primary'; |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
| 679 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
| 680 | 680 | |
| 681 | 681 | $class = "class='$classes'"; |
| 682 | 682 | |
| 683 | 683 | $attributes = "$class$style$data"; |
| 684 | 684 | |
| 685 | - if ( 'cb' === $column_name ) { |
|
| 685 | + if ('cb' === $column_name) { |
|
| 686 | 686 | echo '<th scope="row" class="check-column">'; |
| 687 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
| 687 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
| 688 | 688 | echo '</th>'; |
| 689 | 689 | } |
| 690 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
| 690 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
| 691 | 691 | echo "<td $attributes>"; |
| 692 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
| 693 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
| 692 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
| 693 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
| 694 | 694 | echo "</td>"; |
| 695 | 695 | } |
| 696 | 696 | else { |
| 697 | 697 | echo "<td $attributes>"; |
| 698 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
| 699 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
| 698 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
| 699 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
| 700 | 700 | echo "</td>"; |
| 701 | 701 | } |
| 702 | 702 | } |
@@ -704,19 +704,19 @@ discard block |
||
| 704 | 704 | |
| 705 | 705 | |
| 706 | 706 | |
| 707 | - public function extra_tablenav( $which ) { |
|
| 708 | - if ( $which == 'top' ) { |
|
| 707 | + public function extra_tablenav($which) { |
|
| 708 | + if ($which == 'top') { |
|
| 709 | 709 | $this->_filters(); |
| 710 | 710 | echo $this->_get_hidden_fields(); |
| 711 | 711 | echo '<br class="clear">'; |
| 712 | - }else{ |
|
| 712 | + } else { |
|
| 713 | 713 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
| 714 | - foreach($this->_bottom_buttons as $type => $action){ |
|
| 715 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
| 716 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
| 714 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
| 715 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
| 716 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
| 717 | 717 | echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request); |
| 718 | 718 | } |
| 719 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
| 719 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
| 720 | 720 | echo '</div>'; |
| 721 | 721 | } |
| 722 | 722 | //echo $this->_entries_per_page_dropdown; |
@@ -766,13 +766,13 @@ discard block |
||
| 766 | 766 | * |
| 767 | 767 | * @return string The assembled action elements container. |
| 768 | 768 | */ |
| 769 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
| 769 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
| 770 | 770 | $content = ''; |
| 771 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
| 772 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
| 773 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
| 774 | - $content .= apply_filters( 'FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this ); |
|
| 775 | - $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
|
| 771 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
| 772 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
| 773 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
| 774 | + $content .= apply_filters('FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this); |
|
| 775 | + $content .= ! empty($action_container) ? '</'.$action_container.'>' : ''; |
|
| 776 | 776 | return $content; |
| 777 | 777 | } |
| 778 | 778 | } |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -656,8 +656,6 @@ |
||
| 656 | 656 | * converts it into a "remote" filepath (the filepath the currently-in-use |
| 657 | 657 | * $wp_filesystem needs to use access the folder or file). |
| 658 | 658 | * See http://wordpress.stackexchange.com/questions/124900/using-wp-filesystem-in-plugins |
| 659 | - * @param WP_Filesystem_Base $wp_filesystem we aren't initially sure which one |
|
| 660 | - * is in use, so you need to provide it |
|
| 661 | 659 | * @param string $local_filepath the filepath to the folder/file locally |
| 662 | 660 | * @throws EE_Error if filesystem credentials are required |
| 663 | 661 | * @return string the remote filepath (eg the filepath the filesystem method, eg |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | * @ version 4.0 |
| 13 | 13 | * |
| 14 | 14 | */ |
| 15 | -require_once( EE_HELPERS . 'EEH_Base.helper.php' ); |
|
| 16 | -require_once( EE_INTERFACES . 'EEI_Interfaces.php' ); |
|
| 15 | +require_once(EE_HELPERS.'EEH_Base.helper.php'); |
|
| 16 | +require_once(EE_INTERFACES.'EEI_Interfaces.php'); |
|
| 17 | 17 | /** |
| 18 | 18 | * |
| 19 | 19 | * Class EEH_File |
@@ -52,30 +52,30 @@ discard block |
||
| 52 | 52 | * @throws EE_Error if filesystem credentials are required |
| 53 | 53 | * @return WP_Filesystem_Base |
| 54 | 54 | */ |
| 55 | - private static function _get_wp_filesystem( $filepath = null) { |
|
| 56 | - if( apply_filters( |
|
| 55 | + private static function _get_wp_filesystem($filepath = null) { |
|
| 56 | + if (apply_filters( |
|
| 57 | 57 | 'FHEE__EEH_File___get_wp_filesystem__allow_using_filesystem_direct', |
| 58 | - $filepath && EEH_File::is_in_uploads_folder( $filepath ), |
|
| 59 | - $filepath ) ) { |
|
| 60 | - if( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct ) { |
|
| 61 | - require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); |
|
| 58 | + $filepath && EEH_File::is_in_uploads_folder($filepath), |
|
| 59 | + $filepath )) { |
|
| 60 | + if ( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct) { |
|
| 61 | + require_once(ABSPATH.'wp-admin/includes/class-wp-filesystem-base.php'); |
|
| 62 | 62 | $method = 'direct'; |
| 63 | - $wp_filesystem_direct_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method ); |
|
| 63 | + $wp_filesystem_direct_file = apply_filters('filesystem_method_file', ABSPATH.'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method); |
|
| 64 | 64 | //check constants defined, just like in wp-admin/includes/file.php's WP_Filesystem() |
| 65 | - if ( ! defined('FS_CHMOD_DIR') ) { |
|
| 66 | - define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) ); |
|
| 65 | + if ( ! defined('FS_CHMOD_DIR')) { |
|
| 66 | + define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0777 | 0755)); |
|
| 67 | 67 | } |
| 68 | - if ( ! defined('FS_CHMOD_FILE') ) { |
|
| 69 | - define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) ); |
|
| 68 | + if ( ! defined('FS_CHMOD_FILE')) { |
|
| 69 | + define('FS_CHMOD_FILE', (fileperms(ABSPATH.'index.php') & 0777 | 0644)); |
|
| 70 | 70 | } |
| 71 | - require_once( $wp_filesystem_direct_file ); |
|
| 72 | - EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct( array() ); |
|
| 71 | + require_once($wp_filesystem_direct_file); |
|
| 72 | + EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct(array()); |
|
| 73 | 73 | } |
| 74 | 74 | return EEH_File::$_wp_filesystem_direct; |
| 75 | 75 | } |
| 76 | 76 | global $wp_filesystem; |
| 77 | 77 | // no filesystem setup ??? |
| 78 | - if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) { |
|
| 78 | + if ( ! $wp_filesystem instanceof WP_Filesystem_Base) { |
|
| 79 | 79 | // if some eager beaver's just trying to get in there too early... |
| 80 | 80 | // let them do it, because we are one of those eager beavers! :P |
| 81 | 81 | /** |
@@ -88,34 +88,34 @@ discard block |
||
| 88 | 88 | * and there may be troubles if the WP files are owned by a different user |
| 89 | 89 | * than the server user. But both of these issues should exist in 4.4 and earlier too |
| 90 | 90 | */ |
| 91 | - if ( FALSE && ! did_action( 'wp_loaded' )) { |
|
| 91 | + if (FALSE && ! did_action('wp_loaded')) { |
|
| 92 | 92 | $msg = __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'); |
| 93 | - if ( WP_DEBUG ) { |
|
| 94 | - $msg .= '<br />' . __('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso'); |
|
| 93 | + if (WP_DEBUG) { |
|
| 94 | + $msg .= '<br />'.__('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso'); |
|
| 95 | 95 | } |
| 96 | - throw new EE_Error( $msg ); |
|
| 96 | + throw new EE_Error($msg); |
|
| 97 | 97 | } else { |
| 98 | 98 | // should be loaded if we are past the wp_loaded hook... |
| 99 | - if ( ! function_exists( 'WP_Filesystem' )) { |
|
| 100 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
| 101 | - require_once( ABSPATH . 'wp-admin/includes/template.php' ); |
|
| 99 | + if ( ! function_exists('WP_Filesystem')) { |
|
| 100 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 101 | + require_once(ABSPATH.'wp-admin/includes/template.php'); |
|
| 102 | 102 | } |
| 103 | 103 | // turn on output buffering so that we can capture the credentials form |
| 104 | 104 | ob_start(); |
| 105 | - $credentials = request_filesystem_credentials( '' ); |
|
| 105 | + $credentials = request_filesystem_credentials(''); |
|
| 106 | 106 | // store credentials form for the time being |
| 107 | 107 | EEH_File::$_credentials_form = ob_get_clean(); |
| 108 | 108 | // basically check for direct or previously configured access |
| 109 | - if ( ! WP_Filesystem( $credentials ) ) { |
|
| 109 | + if ( ! WP_Filesystem($credentials)) { |
|
| 110 | 110 | // if credentials do NOT exist |
| 111 | - if ( $credentials === FALSE ) { |
|
| 112 | - add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 ); |
|
| 113 | - throw new EE_Error( __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso')); |
|
| 114 | - } elseif( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) { |
|
| 115 | - add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 ); |
|
| 111 | + if ($credentials === FALSE) { |
|
| 112 | + add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999); |
|
| 113 | + throw new EE_Error(__('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso')); |
|
| 114 | + } elseif (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) { |
|
| 115 | + add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999); |
|
| 116 | 116 | throw new EE_Error( |
| 117 | 117 | sprintf( |
| 118 | - __( 'WP Filesystem Error: $1%s', 'event_espresso' ), |
|
| 118 | + __('WP Filesystem Error: $1%s', 'event_espresso'), |
|
| 119 | 119 | $wp_filesystem->errors->get_error_message() ) ); |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | * display_request_filesystem_credentials_form |
| 129 | 129 | */ |
| 130 | 130 | public static function display_request_filesystem_credentials_form() { |
| 131 | - if ( ! empty( EEH_File::$_credentials_form )) { |
|
| 132 | - echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>'; |
|
| 131 | + if ( ! empty(EEH_File::$_credentials_form)) { |
|
| 132 | + echo '<div class="updated espresso-notices-attention"><p>'.EEH_File::$_credentials_form.'</p></div>'; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -147,29 +147,29 @@ discard block |
||
| 147 | 147 | * @throws EE_Error if filesystem credentials are required |
| 148 | 148 | * @return bool |
| 149 | 149 | */ |
| 150 | - public static function verify_filepath_and_permissions( $full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '' ) { |
|
| 150 | + public static function verify_filepath_and_permissions($full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '') { |
|
| 151 | 151 | // load WP_Filesystem and set file permissions |
| 152 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
| 153 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
| 154 | - if ( ! $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) )) { |
|
| 155 | - $file_name = ! empty( $type_of_file ) ? $file_name . ' ' . $type_of_file : $file_name; |
|
| 156 | - $file_name .= ! empty( $file_ext ) ? ' file' : ' folder'; |
|
| 152 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
| 153 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
| 154 | + if ( ! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
| 155 | + $file_name = ! empty($type_of_file) ? $file_name.' '.$type_of_file : $file_name; |
|
| 156 | + $file_name .= ! empty($file_ext) ? ' file' : ' folder'; |
|
| 157 | 157 | $msg = sprintf( |
| 158 | - __( 'The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso' ), |
|
| 158 | + __('The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso'), |
|
| 159 | 159 | $file_name, |
| 160 | 160 | '<br />' |
| 161 | 161 | ); |
| 162 | - if ( EEH_File::exists( $full_file_path )) { |
|
| 163 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, $type_of_file ); |
|
| 162 | + if (EEH_File::exists($full_file_path)) { |
|
| 163 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, $type_of_file); |
|
| 164 | 164 | } else { |
| 165 | 165 | // no file permissions means the file was not found |
| 166 | 166 | $msg .= sprintf( |
| 167 | - __( 'Please ensure the following path is correct: "%s".', 'event_espresso' ), |
|
| 167 | + __('Please ensure the following path is correct: "%s".', 'event_espresso'), |
|
| 168 | 168 | $full_file_path |
| 169 | 169 | ); |
| 170 | 170 | } |
| 171 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 172 | - throw new EE_Error( $msg . '||' . $msg ); |
|
| 171 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 172 | + throw new EE_Error($msg.'||'.$msg); |
|
| 173 | 173 | } |
| 174 | 174 | return FALSE; |
| 175 | 175 | } |
@@ -187,24 +187,24 @@ discard block |
||
| 187 | 187 | * @throws EE_Error if filesystem credentials are required |
| 188 | 188 | * @return string |
| 189 | 189 | */ |
| 190 | - private static function _permissions_error_for_unreadable_filepath( $full_file_path = '', $type_of_file = '' ){ |
|
| 190 | + private static function _permissions_error_for_unreadable_filepath($full_file_path = '', $type_of_file = '') { |
|
| 191 | 191 | // load WP_Filesystem and set file permissions |
| 192 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
| 192 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
| 193 | 193 | // check file permissions |
| 194 | - $perms = $wp_filesystem->getchmod( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ); |
|
| 195 | - if ( $perms ) { |
|
| 194 | + $perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
| 195 | + if ($perms) { |
|
| 196 | 196 | // file permissions exist, but way be set incorrectly |
| 197 | - $type_of_file = ! empty( $type_of_file ) ? $type_of_file . ' ' : ''; |
|
| 198 | - $type_of_file .= ! empty( $type_of_file ) ? 'file' : 'folder'; |
|
| 197 | + $type_of_file = ! empty($type_of_file) ? $type_of_file.' ' : ''; |
|
| 198 | + $type_of_file .= ! empty($type_of_file) ? 'file' : 'folder'; |
|
| 199 | 199 | return sprintf( |
| 200 | - __( 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso' ), |
|
| 200 | + __('File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso'), |
|
| 201 | 201 | $type_of_file, |
| 202 | 202 | $perms |
| 203 | 203 | ); |
| 204 | 204 | } else { |
| 205 | 205 | // file exists but file permissions could not be read ?!?! |
| 206 | 206 | return sprintf( |
| 207 | - __( 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso' ), |
|
| 207 | + __('Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso'), |
|
| 208 | 208 | $full_file_path |
| 209 | 209 | ); |
| 210 | 210 | } |
@@ -222,35 +222,35 @@ discard block |
||
| 222 | 222 | * can't write to it |
| 223 | 223 | * @return bool false if folder isn't writable; true if it exists and is writeable, |
| 224 | 224 | */ |
| 225 | - public static function ensure_folder_exists_and_is_writable( $folder = '' ){ |
|
| 226 | - if ( empty( $folder )) { |
|
| 225 | + public static function ensure_folder_exists_and_is_writable($folder = '') { |
|
| 226 | + if (empty($folder)) { |
|
| 227 | 227 | return false; |
| 228 | 228 | } |
| 229 | 229 | // remove ending DS |
| 230 | - $folder = EEH_File::standardise_directory_separators( rtrim( $folder, '/\\' )); |
|
| 231 | - $parent_folder = EEH_File::get_parent_folder( $folder ); |
|
| 230 | + $folder = EEH_File::standardise_directory_separators(rtrim($folder, '/\\')); |
|
| 231 | + $parent_folder = EEH_File::get_parent_folder($folder); |
|
| 232 | 232 | // add DS to folder |
| 233 | - $folder = EEH_File::end_with_directory_separator( $folder ); |
|
| 234 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $folder ); |
|
| 235 | - if ( ! $wp_filesystem->is_dir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) { |
|
| 233 | + $folder = EEH_File::end_with_directory_separator($folder); |
|
| 234 | + $wp_filesystem = EEH_File::_get_wp_filesystem($folder); |
|
| 235 | + if ( ! $wp_filesystem->is_dir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) { |
|
| 236 | 236 | //ok so it doesn't exist. Does its parent? Can we write to it? |
| 237 | - if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) { |
|
| 237 | + if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
| 238 | 238 | return false; |
| 239 | 239 | } |
| 240 | - if ( ! EEH_File::verify_is_writable( $parent_folder, 'folder' )) { |
|
| 240 | + if ( ! EEH_File::verify_is_writable($parent_folder, 'folder')) { |
|
| 241 | 241 | return false; |
| 242 | 242 | } else { |
| 243 | - if ( ! $wp_filesystem->mkdir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) { |
|
| 244 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 245 | - $msg = sprintf( __( '"%s" could not be created.', 'event_espresso' ), $folder ); |
|
| 246 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $folder ); |
|
| 247 | - throw new EE_Error( $msg ); |
|
| 243 | + if ( ! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) { |
|
| 244 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 245 | + $msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder); |
|
| 246 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder); |
|
| 247 | + throw new EE_Error($msg); |
|
| 248 | 248 | } |
| 249 | 249 | return false; |
| 250 | 250 | } |
| 251 | - EEH_File::add_index_file( $folder ); |
|
| 251 | + EEH_File::add_index_file($folder); |
|
| 252 | 252 | } |
| 253 | - } elseif ( ! EEH_File::verify_is_writable( $folder, 'folder' )) { |
|
| 253 | + } elseif ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
| 254 | 254 | return false; |
| 255 | 255 | } |
| 256 | 256 | return true; |
@@ -265,15 +265,15 @@ discard block |
||
| 265 | 265 | * @throws EE_Error if filesystem credentials are required |
| 266 | 266 | * @return bool |
| 267 | 267 | */ |
| 268 | - public static function verify_is_writable( $full_path = '', $file_or_folder = 'folder' ){ |
|
| 268 | + public static function verify_is_writable($full_path = '', $file_or_folder = 'folder') { |
|
| 269 | 269 | // load WP_Filesystem and set file permissions |
| 270 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_path ); |
|
| 271 | - $full_path = EEH_File::standardise_directory_separators( $full_path ); |
|
| 272 | - if ( ! $wp_filesystem->is_writable( EEH_File::convert_local_filepath_to_remote_filepath( $full_path ) ) ) { |
|
| 273 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 274 | - $msg = sprintf( __( 'The "%1$s" %2$s is not writable.', 'event_espresso' ), $full_path, $file_or_folder ); |
|
| 275 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_path ); |
|
| 276 | - throw new EE_Error( $msg ); |
|
| 270 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_path); |
|
| 271 | + $full_path = EEH_File::standardise_directory_separators($full_path); |
|
| 272 | + if ( ! $wp_filesystem->is_writable(EEH_File::convert_local_filepath_to_remote_filepath($full_path))) { |
|
| 273 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 274 | + $msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder); |
|
| 275 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path); |
|
| 276 | + throw new EE_Error($msg); |
|
| 277 | 277 | } |
| 278 | 278 | return FALSE; |
| 279 | 279 | } |
@@ -290,25 +290,25 @@ discard block |
||
| 290 | 290 | * @throws EE_Error if filesystem credentials are required |
| 291 | 291 | * @return bool |
| 292 | 292 | */ |
| 293 | - public static function ensure_file_exists_and_is_writable( $full_file_path = '' ) { |
|
| 293 | + public static function ensure_file_exists_and_is_writable($full_file_path = '') { |
|
| 294 | 294 | // load WP_Filesystem and set file permissions |
| 295 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
| 296 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
| 297 | - $parent_folder = EEH_File::get_parent_folder( $full_file_path ); |
|
| 298 | - if ( ! EEH_File::exists( $full_file_path )) { |
|
| 299 | - if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) { |
|
| 295 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
| 296 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
| 297 | + $parent_folder = EEH_File::get_parent_folder($full_file_path); |
|
| 298 | + if ( ! EEH_File::exists($full_file_path)) { |
|
| 299 | + if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
| 300 | 300 | return false; |
| 301 | 301 | } |
| 302 | - if ( ! $wp_filesystem->touch( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) { |
|
| 303 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 304 | - $msg = sprintf( __( 'The "%s" file could not be created.', 'event_espresso' ), $full_file_path ); |
|
| 305 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path ); |
|
| 306 | - throw new EE_Error( $msg ); |
|
| 302 | + if ( ! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
| 303 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 304 | + $msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path); |
|
| 305 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
|
| 306 | + throw new EE_Error($msg); |
|
| 307 | 307 | } |
| 308 | 308 | return false; |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | - if ( ! EEH_File::verify_is_writable( $full_file_path, 'file' )) { |
|
| 311 | + if ( ! EEH_File::verify_is_writable($full_file_path, 'file')) { |
|
| 312 | 312 | return false; |
| 313 | 313 | } |
| 314 | 314 | return true; |
@@ -320,15 +320,15 @@ discard block |
||
| 320 | 320 | * @param string $file_or_folder_path |
| 321 | 321 | * @return string parent folder, ENDING with a directory separator |
| 322 | 322 | */ |
| 323 | - public static function get_parent_folder( $file_or_folder_path ) { |
|
| 323 | + public static function get_parent_folder($file_or_folder_path) { |
|
| 324 | 324 | //find the last DS, ignoring a DS on the very end |
| 325 | 325 | //eg if given "/var/something/somewhere/", we want to get "somewhere"'s |
| 326 | 326 | //parent folder, "/var/something/" |
| 327 | - $ds = strrpos( $file_or_folder_path, DS, -2 ); |
|
| 328 | - return substr( $file_or_folder_path, 0, $ds + 1 ); |
|
| 327 | + $ds = strrpos($file_or_folder_path, DS, -2); |
|
| 328 | + return substr($file_or_folder_path, 0, $ds + 1); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - public static function ensure_folder_exists_recursively( $folder ) { |
|
| 331 | + public static function ensure_folder_exists_recursively($folder) { |
|
| 332 | 332 | |
| 333 | 333 | } |
| 334 | 334 | |
@@ -340,12 +340,12 @@ discard block |
||
| 340 | 340 | * @throws EE_Error if filesystem credentials are required |
| 341 | 341 | * @return string |
| 342 | 342 | */ |
| 343 | - public static function get_file_contents( $full_file_path = '' ){ |
|
| 344 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
| 345 | - if ( EEH_File::verify_filepath_and_permissions( $full_file_path, EEH_File::get_filename_from_filepath( $full_file_path ) , EEH_File::get_file_extension( $full_file_path ))) { |
|
| 343 | + public static function get_file_contents($full_file_path = '') { |
|
| 344 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
| 345 | + if (EEH_File::verify_filepath_and_permissions($full_file_path, EEH_File::get_filename_from_filepath($full_file_path), EEH_File::get_file_extension($full_file_path))) { |
|
| 346 | 346 | // load WP_Filesystem and set file permissions |
| 347 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
| 348 | - return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ); |
|
| 347 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
| 348 | + return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
| 349 | 349 | } |
| 350 | 350 | return ''; |
| 351 | 351 | } |
@@ -360,26 +360,26 @@ discard block |
||
| 360 | 360 | * @throws EE_Error if filesystem credentials are required |
| 361 | 361 | * @return bool |
| 362 | 362 | */ |
| 363 | - public static function write_to_file( $full_file_path = '', $file_contents = '', $file_type = '' ){ |
|
| 364 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
| 365 | - $file_type = ! empty( $file_type ) ? rtrim( $file_type, ' ' ) . ' ' : ''; |
|
| 366 | - $folder = EEH_File::remove_filename_from_filepath( $full_file_path ); |
|
| 367 | - if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) { |
|
| 368 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 369 | - $msg = sprintf( __( 'The %1$sfile located at "%2$s" is not writable.', 'event_espresso' ), $file_type, $full_file_path ); |
|
| 370 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path ); |
|
| 371 | - throw new EE_Error( $msg ); |
|
| 363 | + public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') { |
|
| 364 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
| 365 | + $file_type = ! empty($file_type) ? rtrim($file_type, ' ').' ' : ''; |
|
| 366 | + $folder = EEH_File::remove_filename_from_filepath($full_file_path); |
|
| 367 | + if ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
| 368 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 369 | + $msg = sprintf(__('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), $file_type, $full_file_path); |
|
| 370 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
|
| 371 | + throw new EE_Error($msg); |
|
| 372 | 372 | } |
| 373 | 373 | return FALSE; |
| 374 | 374 | } |
| 375 | 375 | // load WP_Filesystem and set file permissions |
| 376 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
| 376 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
| 377 | 377 | // write the file |
| 378 | - if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ), $file_contents )) { |
|
| 379 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 380 | - $msg = sprintf( __( 'The %1$sfile located at "%2$s" could not be written to.', 'event_espresso' ), $file_type, $full_file_path ); |
|
| 381 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, 'f' ); |
|
| 382 | - throw new EE_Error( $msg ); |
|
| 378 | + if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), $file_contents)) { |
|
| 379 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 380 | + $msg = sprintf(__('The %1$sfile located at "%2$s" could not be written to.', 'event_espresso'), $file_type, $full_file_path); |
|
| 381 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, 'f'); |
|
| 382 | + throw new EE_Error($msg); |
|
| 383 | 383 | } |
| 384 | 384 | return FALSE; |
| 385 | 385 | } |
@@ -395,9 +395,9 @@ discard block |
||
| 395 | 395 | * @throws EE_Error if filesystem credentials are required |
| 396 | 396 | * @return boolean |
| 397 | 397 | */ |
| 398 | - public static function delete( $filepath, $recursive = false, $type = false ) { |
|
| 398 | + public static function delete($filepath, $recursive = false, $type = false) { |
|
| 399 | 399 | $wp_filesystem = EEH_File::_get_wp_filesystem(); |
| 400 | - return $wp_filesystem->delete( $filepath, $recursive, $type ) ? TRUE : FALSE; |
|
| 400 | + return $wp_filesystem->delete($filepath, $recursive, $type) ? TRUE : FALSE; |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | |
@@ -409,9 +409,9 @@ discard block |
||
| 409 | 409 | * @throws EE_Error if filesystem credentials are required |
| 410 | 410 | * @return bool |
| 411 | 411 | */ |
| 412 | - public static function exists( $full_file_path = '' ) { |
|
| 413 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
| 414 | - return $wp_filesystem->exists( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ? TRUE : FALSE; |
|
| 412 | + public static function exists($full_file_path = '') { |
|
| 413 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
| 414 | + return $wp_filesystem->exists(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)) ? TRUE : FALSE; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | |
@@ -424,9 +424,9 @@ discard block |
||
| 424 | 424 | * @throws EE_Error if filesystem credentials are required |
| 425 | 425 | * @return bool |
| 426 | 426 | */ |
| 427 | - public static function is_readable( $full_file_path = '' ) { |
|
| 428 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
| 429 | - if( $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) { |
|
| 427 | + public static function is_readable($full_file_path = '') { |
|
| 428 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
| 429 | + if ($wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
| 430 | 430 | return true; |
| 431 | 431 | } else { |
| 432 | 432 | return false; |
@@ -442,8 +442,8 @@ discard block |
||
| 442 | 442 | * @param string $full_file_path |
| 443 | 443 | * @return string |
| 444 | 444 | */ |
| 445 | - public static function remove_filename_from_filepath( $full_file_path = '' ) { |
|
| 446 | - return pathinfo( $full_file_path, PATHINFO_DIRNAME ); |
|
| 445 | + public static function remove_filename_from_filepath($full_file_path = '') { |
|
| 446 | + return pathinfo($full_file_path, PATHINFO_DIRNAME); |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | |
@@ -453,8 +453,8 @@ discard block |
||
| 453 | 453 | * @param string $full_file_path |
| 454 | 454 | * @return string |
| 455 | 455 | */ |
| 456 | - public static function get_filename_from_filepath( $full_file_path = '' ) { |
|
| 457 | - return pathinfo( $full_file_path, PATHINFO_BASENAME ); |
|
| 456 | + public static function get_filename_from_filepath($full_file_path = '') { |
|
| 457 | + return pathinfo($full_file_path, PATHINFO_BASENAME); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | |
@@ -464,8 +464,8 @@ discard block |
||
| 464 | 464 | * @param string $full_file_path |
| 465 | 465 | * @return string |
| 466 | 466 | */ |
| 467 | - public static function get_file_extension( $full_file_path = '' ) { |
|
| 468 | - return pathinfo( $full_file_path, PATHINFO_EXTENSION ); |
|
| 467 | + public static function get_file_extension($full_file_path = '') { |
|
| 468 | + return pathinfo($full_file_path, PATHINFO_EXTENSION); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | |
@@ -476,10 +476,10 @@ discard block |
||
| 476 | 476 | * @throws EE_Error if filesystem credentials are required |
| 477 | 477 | * @return bool |
| 478 | 478 | */ |
| 479 | - public static function add_htaccess_deny_from_all( $folder = '' ) { |
|
| 480 | - $folder = EEH_File::standardise_and_end_with_directory_separator( $folder ); |
|
| 481 | - if ( ! EEH_File::exists( $folder . '.htaccess' ) ) { |
|
| 482 | - if ( ! EEH_File::write_to_file( $folder . '.htaccess', 'deny from all', '.htaccess' )) { |
|
| 479 | + public static function add_htaccess_deny_from_all($folder = '') { |
|
| 480 | + $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
| 481 | + if ( ! EEH_File::exists($folder.'.htaccess')) { |
|
| 482 | + if ( ! EEH_File::write_to_file($folder.'.htaccess', 'deny from all', '.htaccess')) { |
|
| 483 | 483 | return FALSE; |
| 484 | 484 | } |
| 485 | 485 | } |
@@ -493,10 +493,10 @@ discard block |
||
| 493 | 493 | * @throws EE_Error if filesystem credentials are required |
| 494 | 494 | * @return boolean |
| 495 | 495 | */ |
| 496 | - public static function add_index_file( $folder ) { |
|
| 497 | - $folder = EEH_File::standardise_and_end_with_directory_separator( $folder ); |
|
| 498 | - if ( ! EEH_File::exists( $folder . 'index.php' ) ) { |
|
| 499 | - if ( ! EEH_File::write_to_file( $folder . 'index.php', 'You are not permitted to read from this folder', '.php' )) { |
|
| 496 | + public static function add_index_file($folder) { |
|
| 497 | + $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
| 498 | + if ( ! EEH_File::exists($folder.'index.php')) { |
|
| 499 | + if ( ! EEH_File::write_to_file($folder.'index.php', 'You are not permitted to read from this folder', '.php')) { |
|
| 500 | 500 | return false; |
| 501 | 501 | } |
| 502 | 502 | } |
@@ -511,11 +511,11 @@ discard block |
||
| 511 | 511 | * @param string $file_path |
| 512 | 512 | * @return string |
| 513 | 513 | */ |
| 514 | - public static function get_classname_from_filepath_with_standard_filename( $file_path ){ |
|
| 514 | + public static function get_classname_from_filepath_with_standard_filename($file_path) { |
|
| 515 | 515 | //extract file from path |
| 516 | - $filename = basename( $file_path ); |
|
| 516 | + $filename = basename($file_path); |
|
| 517 | 517 | //now remove the first period and everything after |
| 518 | - $pos_of_first_period = strpos( $filename,'.' ); |
|
| 518 | + $pos_of_first_period = strpos($filename, '.'); |
|
| 519 | 519 | return substr($filename, 0, $pos_of_first_period); |
| 520 | 520 | } |
| 521 | 521 | |
@@ -527,8 +527,8 @@ discard block |
||
| 527 | 527 | * @param string $file_path |
| 528 | 528 | * @return string |
| 529 | 529 | */ |
| 530 | - public static function standardise_directory_separators( $file_path ){ |
|
| 531 | - return str_replace( array( '\\', '/' ), DS, $file_path ); |
|
| 530 | + public static function standardise_directory_separators($file_path) { |
|
| 531 | + return str_replace(array('\\', '/'), DS, $file_path); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | |
@@ -539,8 +539,8 @@ discard block |
||
| 539 | 539 | * @param string $file_path |
| 540 | 540 | * @return string |
| 541 | 541 | */ |
| 542 | - public static function end_with_directory_separator( $file_path ){ |
|
| 543 | - return rtrim( $file_path, '/\\' ) . DS; |
|
| 542 | + public static function end_with_directory_separator($file_path) { |
|
| 543 | + return rtrim($file_path, '/\\').DS; |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | |
@@ -550,8 +550,8 @@ discard block |
||
| 550 | 550 | * @param $file_path |
| 551 | 551 | * @return string |
| 552 | 552 | */ |
| 553 | - public static function standardise_and_end_with_directory_separator( $file_path ){ |
|
| 554 | - return self::end_with_directory_separator( self::standardise_directory_separators( $file_path )); |
|
| 553 | + public static function standardise_and_end_with_directory_separator($file_path) { |
|
| 554 | + return self::end_with_directory_separator(self::standardise_directory_separators($file_path)); |
|
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | |
@@ -568,21 +568,21 @@ discard block |
||
| 568 | 568 | * if $index_numerically == FALSE (Default) keys are what the class names SHOULD be; |
| 569 | 569 | * and values are their filepaths |
| 570 | 570 | */ |
| 571 | - public static function get_contents_of_folders( $folder_paths = array(), $index_numerically = FALSE ){ |
|
| 571 | + public static function get_contents_of_folders($folder_paths = array(), $index_numerically = FALSE) { |
|
| 572 | 572 | $class_to_folder_path = array(); |
| 573 | - foreach( $folder_paths as $folder_path ){ |
|
| 574 | - $folder_path = self::standardise_and_end_with_directory_separator( $folder_path ); |
|
| 573 | + foreach ($folder_paths as $folder_path) { |
|
| 574 | + $folder_path = self::standardise_and_end_with_directory_separator($folder_path); |
|
| 575 | 575 | // load WP_Filesystem and set file permissions |
| 576 | - $files_in_folder = glob( $folder_path . '*' ); |
|
| 576 | + $files_in_folder = glob($folder_path.'*'); |
|
| 577 | 577 | $class_to_folder_path = array(); |
| 578 | - if ( $files_in_folder ) { |
|
| 579 | - foreach( $files_in_folder as $file_path ){ |
|
| 578 | + if ($files_in_folder) { |
|
| 579 | + foreach ($files_in_folder as $file_path) { |
|
| 580 | 580 | //only add files, not folders |
| 581 | - if ( ! is_dir( $file_path )) { |
|
| 582 | - if ( $index_numerically ) { |
|
| 581 | + if ( ! is_dir($file_path)) { |
|
| 582 | + if ($index_numerically) { |
|
| 583 | 583 | $class_to_folder_path[] = $file_path; |
| 584 | 584 | } else { |
| 585 | - $classname = self::get_classname_from_filepath_with_standard_filename( $file_path ); |
|
| 585 | + $classname = self::get_classname_from_filepath_with_standard_filename($file_path); |
|
| 586 | 586 | $class_to_folder_path[$classname] = $file_path; |
| 587 | 587 | } |
| 588 | 588 | } |
@@ -602,39 +602,39 @@ discard block |
||
| 602 | 602 | * @throws EE_Error if filesystem credentials are required |
| 603 | 603 | * @return boolean success |
| 604 | 604 | */ |
| 605 | - public static function copy( $source_file, $destination_file, $overwrite = FALSE ){ |
|
| 606 | - $full_source_path = EEH_File::standardise_directory_separators( $source_file ); |
|
| 607 | - if( ! EEH_File::exists( $full_source_path ) ){ |
|
| 608 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 609 | - $msg = sprintf( __( 'The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso' ), $full_source_path ); |
|
| 610 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path ); |
|
| 611 | - throw new EE_Error( $msg ); |
|
| 605 | + public static function copy($source_file, $destination_file, $overwrite = FALSE) { |
|
| 606 | + $full_source_path = EEH_File::standardise_directory_separators($source_file); |
|
| 607 | + if ( ! EEH_File::exists($full_source_path)) { |
|
| 608 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 609 | + $msg = sprintf(__('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), $full_source_path); |
|
| 610 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path); |
|
| 611 | + throw new EE_Error($msg); |
|
| 612 | 612 | } |
| 613 | 613 | return FALSE; |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | - $full_dest_path = EEH_File::standardise_directory_separators( $destination_file ); |
|
| 617 | - $folder = EEH_File::remove_filename_from_filepath( $full_dest_path ); |
|
| 618 | - if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) { |
|
| 619 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 620 | - $msg = sprintf( __( 'The file located at "%2$s" is not writable.', 'event_espresso' ), $full_dest_path ); |
|
| 621 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_dest_path ); |
|
| 622 | - throw new EE_Error( $msg ); |
|
| 616 | + $full_dest_path = EEH_File::standardise_directory_separators($destination_file); |
|
| 617 | + $folder = EEH_File::remove_filename_from_filepath($full_dest_path); |
|
| 618 | + if ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
| 619 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 620 | + $msg = sprintf(__('The file located at "%2$s" is not writable.', 'event_espresso'), $full_dest_path); |
|
| 621 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path); |
|
| 622 | + throw new EE_Error($msg); |
|
| 623 | 623 | } |
| 624 | 624 | return FALSE; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | // load WP_Filesystem and set file permissions |
| 628 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $destination_file ); |
|
| 628 | + $wp_filesystem = EEH_File::_get_wp_filesystem($destination_file); |
|
| 629 | 629 | // write the file |
| 630 | 630 | if ( ! $wp_filesystem->copy( |
| 631 | - EEH_File::convert_local_filepath_to_remote_filepath( $full_source_path ), |
|
| 632 | - EEH_File::convert_local_filepath_to_remote_filepath( $full_dest_path ), |
|
| 631 | + EEH_File::convert_local_filepath_to_remote_filepath($full_source_path), |
|
| 632 | + EEH_File::convert_local_filepath_to_remote_filepath($full_dest_path), |
|
| 633 | 633 | $overwrite )) { |
| 634 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 635 | - $msg = sprintf( __( 'Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso' ), $full_source_path ); |
|
| 636 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path, 'f' ); |
|
| 637 | - throw new EE_Error( $msg ); |
|
| 634 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 635 | + $msg = sprintf(__('Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso'), $full_source_path); |
|
| 636 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path, 'f'); |
|
| 637 | + throw new EE_Error($msg); |
|
| 638 | 638 | } |
| 639 | 639 | return FALSE; |
| 640 | 640 | } |
@@ -646,9 +646,9 @@ discard block |
||
| 646 | 646 | * @param string $filepath |
| 647 | 647 | * @return boolean |
| 648 | 648 | */ |
| 649 | - public static function is_in_uploads_folder( $filepath ) { |
|
| 649 | + public static function is_in_uploads_folder($filepath) { |
|
| 650 | 650 | $uploads = wp_upload_dir(); |
| 651 | - return strpos( $filepath, $uploads[ 'basedir' ] ) === 0 ? true : false; |
|
| 651 | + return strpos($filepath, $uploads['basedir']) === 0 ? true : false; |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | /** |
@@ -663,9 +663,9 @@ discard block |
||
| 663 | 663 | * @return string the remote filepath (eg the filepath the filesystem method, eg |
| 664 | 664 | * ftp or ssh, will use to access the folder |
| 665 | 665 | */ |
| 666 | - public static function convert_local_filepath_to_remote_filepath( $local_filepath ) { |
|
| 667 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $local_filepath ); |
|
| 668 | - return str_replace( WP_CONTENT_DIR . DS, $wp_filesystem->wp_content_dir(), $local_filepath ); |
|
| 666 | + public static function convert_local_filepath_to_remote_filepath($local_filepath) { |
|
| 667 | + $wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath); |
|
| 668 | + return str_replace(WP_CONTENT_DIR.DS, $wp_filesystem->wp_content_dir(), $local_filepath); |
|
| 669 | 669 | } |
| 670 | 670 | } |
| 671 | 671 | // End of file EEH_File.helper.php |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | |
| 46 | - protected function _parser( $shortcode ) { |
|
| 47 | - switch ( $shortcode ) { |
|
| 46 | + protected function _parser($shortcode) { |
|
| 47 | + switch ($shortcode) { |
|
| 48 | 48 | |
| 49 | 49 | case '[PRIMARY_REGISTRANT_TICKET_LIST]' : |
| 50 | - return $this->_get_recipient_ticket_list( TRUE ); |
|
| 50 | + return $this->_get_recipient_ticket_list(TRUE); |
|
| 51 | 51 | break; |
| 52 | 52 | |
| 53 | 53 | case '[PRIMARY_REGISTRANT_DATETIME_LIST]' : |
| 54 | - return $this->_get_recipient_datetime_list( TRUE ); |
|
| 54 | + return $this->_get_recipient_datetime_list(TRUE); |
|
| 55 | 55 | break; |
| 56 | 56 | } |
| 57 | 57 | return ''; |
@@ -65,57 +65,57 @@ discard block |
||
| 65 | 65 | * @param boolean $primary whether we're getting the primary registrant ticket_list. |
| 66 | 66 | * @return string |
| 67 | 67 | */ |
| 68 | - private function _get_recipient_ticket_list( $primary = FALSE ) { |
|
| 68 | + private function _get_recipient_ticket_list($primary = FALSE) { |
|
| 69 | 69 | $this->_validate_list_requirements(); |
| 70 | 70 | |
| 71 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
| 72 | - return $this->_get_recipient_ticket_list_parsed( $this->_data['data'], $primary ); |
|
| 71 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) |
|
| 72 | + return $this->_get_recipient_ticket_list_parsed($this->_data['data'], $primary); |
|
| 73 | 73 | |
| 74 | - else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) |
|
| 75 | - return $this->_get_recipient_ticket_list_parsed( $this->_extra_data['data'], $primary ); |
|
| 74 | + else if ($this->_extra_data['data'] instanceof EE_Messages_Addressee) |
|
| 75 | + return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data'], $primary); |
|
| 76 | 76 | |
| 77 | 77 | else |
| 78 | 78 | return ''; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| 82 | - private function _get_recipient_ticket_list_parsed( EE_Messages_Addressee $data, $primary = FALSE ) { |
|
| 82 | + private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data, $primary = FALSE) { |
|
| 83 | 83 | $registration = $primary ? $data->primary_reg_obj : $data->reg_obj; |
| 84 | - if ( ! $registration instanceof EE_Registration ) return ''; |
|
| 84 | + if ( ! $registration instanceof EE_Registration) return ''; |
|
| 85 | 85 | //setup valid shortcodes depending on what the status of the $this->_data property is |
| 86 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
| 87 | - $valid_shortcodes = array('ticket', 'event_list', 'attendee_list','datetime_list', 'registration_details', 'attendee'); |
|
| 86 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 87 | + $valid_shortcodes = array('ticket', 'event_list', 'attendee_list', 'datetime_list', 'registration_details', 'attendee'); |
|
| 88 | 88 | $template = $this->_data['template']; |
| 89 | 89 | $tkts = array($data->registrations[$registration->ID()]['tkt_obj']); |
| 90 | 90 | $data = $this->_data; |
| 91 | - } elseif ( $this->_data['data'] instanceof EE_Event ) { |
|
| 91 | + } elseif ($this->_data['data'] instanceof EE_Event) { |
|
| 92 | 92 | $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee'); |
| 93 | - $template = is_array($this->_data['template'] ) && isset($this->_data['template']['ticket_list']) ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
| 93 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
| 94 | 94 | //let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
| 95 | 95 | $template = str_replace('[EVENT_LIST]', '', $template); |
| 96 | 96 | //data will be tickets for this event for this recipient. |
| 97 | - $tkts = $this->_get_tickets_from_event( $this->_data['data'], $registration ); |
|
| 97 | + $tkts = $this->_get_tickets_from_event($this->_data['data'], $registration); |
|
| 98 | 98 | $data = $this->_extra_data; |
| 99 | 99 | } else { |
| 100 | 100 | return ''; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $tktparsed = ''; |
| 104 | - foreach ( $tkts as $ticket ) { |
|
| 105 | - $tktparsed .= $this->_shortcode_helper->parse_ticket_list_template( $template, $ticket, $valid_shortcodes, $data ); |
|
| 104 | + foreach ($tkts as $ticket) { |
|
| 105 | + $tktparsed .= $this->_shortcode_helper->parse_ticket_list_template($template, $ticket, $valid_shortcodes, $data); |
|
| 106 | 106 | } |
| 107 | 107 | return $tktparsed; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | - private function _get_tickets_from_event( EE_Event $event, $reg = NULL ) { |
|
| 111 | + private function _get_tickets_from_event(EE_Event $event, $reg = NULL) { |
|
| 112 | 112 | $evt_tkts = isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID()]['tkt_objs'] : array(); |
| 113 | 113 | |
| 114 | - if ( $reg instanceof EE_Registration && $this->_extra_data['data'] instanceof EE_Messages_Addressee ) { |
|
| 114 | + if ($reg instanceof EE_Registration && $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 115 | 115 | $adj_tkts = array(); |
| 116 | 116 | //return only tickets for the given attendee |
| 117 | - foreach ( $evt_tkts as $tkt ) { |
|
| 118 | - if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj'] ) && $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj']->ID() == $tkt->ID() ) |
|
| 117 | + foreach ($evt_tkts as $tkt) { |
|
| 118 | + if (isset($this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj']) && $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj']->ID() == $tkt->ID()) |
|
| 119 | 119 | $adj_tkts[] = $tkt; |
| 120 | 120 | } |
| 121 | 121 | $evt_tkts = $adj_tkts; |
@@ -132,57 +132,57 @@ discard block |
||
| 132 | 132 | * @param boolean $primary whether we're getting the primary registrant ticket_list. |
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | - private function _get_recipient_datetime_list( $primary = FALSE ) { |
|
| 135 | + private function _get_recipient_datetime_list($primary = FALSE) { |
|
| 136 | 136 | $this->_validate_list_requirements(); |
| 137 | 137 | |
| 138 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
| 139 | - return $this->_get_recipient_datetime_list_parsed( $this->_data['data'], $primary ); |
|
| 138 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) |
|
| 139 | + return $this->_get_recipient_datetime_list_parsed($this->_data['data'], $primary); |
|
| 140 | 140 | |
| 141 | - else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) |
|
| 142 | - return $this->_get_recipient_datetime_list_parsed( $this->_extra_data['data'], $primary ); |
|
| 141 | + else if ($this->_extra_data['data'] instanceof EE_Messages_Addressee) |
|
| 142 | + return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data'], $primary); |
|
| 143 | 143 | |
| 144 | 144 | else |
| 145 | 145 | return ''; |
| 146 | 146 | |
| 147 | - return $this->_get_recipient_datetime_list_parsed( $this->_data['data'], $primary); |
|
| 147 | + return $this->_get_recipient_datetime_list_parsed($this->_data['data'], $primary); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
| 151 | - private function _get_recipient_datetime_list_parsed( EE_Messages_Addressee $data, $primary = FALSE ) { |
|
| 151 | + private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data, $primary = FALSE) { |
|
| 152 | 152 | $registration = $primary ? $data->primary_reg_obj : $data->reg_obj; |
| 153 | - if ( ! $registration instanceof EE_Registration ) return ''; |
|
| 153 | + if ( ! $registration instanceof EE_Registration) return ''; |
|
| 154 | 154 | //setup valid shortcodes depending on what the status of the $this->_data property is |
| 155 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
| 155 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 156 | 156 | $valid_shortcodes = array('datetime', 'attendee'); |
| 157 | 157 | $template = $this->_data['template']; |
| 158 | 158 | $dtts = $data->registrations[$registration->ID()]['dtt_objs']; |
| 159 | 159 | $data = $this->_data; |
| 160 | - } elseif ( $this->_data['data'] instanceof EE_Event ) { |
|
| 160 | + } elseif ($this->_data['data'] instanceof EE_Event) { |
|
| 161 | 161 | $valid_shortcodes = array('datetime', 'attendee'); |
| 162 | - $template = is_array($this->_data['template'] ) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
| 163 | - $dtts = $this->_get_datetimes_from_event( $this->_data['data'], $registration ); |
|
| 162 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
| 163 | + $dtts = $this->_get_datetimes_from_event($this->_data['data'], $registration); |
|
| 164 | 164 | $data = $this->_extra_data; |
| 165 | 165 | } else { |
| 166 | 166 | return ''; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $dtt_parsed = ''; |
| 170 | - foreach ( $dtts as $datetime ) { |
|
| 171 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( $template, $datetime, $valid_shortcodes, $this->_extra_data ); |
|
| 170 | + foreach ($dtts as $datetime) { |
|
| 171 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template($template, $datetime, $valid_shortcodes, $this->_extra_data); |
|
| 172 | 172 | } |
| 173 | 173 | return $dtt_parsed; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
| 177 | 177 | |
| 178 | - private function _get_datetimes_from_event( EE_Event $event, $reg = NULL ) { |
|
| 178 | + private function _get_datetimes_from_event(EE_Event $event, $reg = NULL) { |
|
| 179 | 179 | $evt_dtts = isset($this->_extra_data['data']->events) ? $this->_extra_data['data']->events[$event->ID()]['dtt_objs'] : array(); |
| 180 | 180 | |
| 181 | - if ( $reg instanceof EE_Registration && $this->_extra_data['data'] instanceof EE_Messages_Addressee ) { |
|
| 181 | + if ($reg instanceof EE_Registration && $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 182 | 182 | $adj_dtts = array(); |
| 183 | 183 | //return only dtts for the given attendee |
| 184 | - foreach ( $evt_dtts as $dtt ) { |
|
| 185 | - if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['dtt_objs'][$dtt->ID()] ) ) |
|
| 184 | + foreach ($evt_dtts as $dtt) { |
|
| 185 | + if (isset($this->_extra_data['data']->registrations[$reg->ID()]['dtt_objs'][$dtt->ID()])) |
|
| 186 | 186 | $adj_dtts[] = $dtt; |
| 187 | 187 | } |
| 188 | 188 | $evt_dtts = $adj_dtts; |
@@ -68,20 +68,21 @@ discard block |
||
| 68 | 68 | private function _get_recipient_ticket_list( $primary = FALSE ) { |
| 69 | 69 | $this->_validate_list_requirements(); |
| 70 | 70 | |
| 71 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
| 72 | - return $this->_get_recipient_ticket_list_parsed( $this->_data['data'], $primary ); |
|
| 73 | - |
|
| 74 | - else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) |
|
| 75 | - return $this->_get_recipient_ticket_list_parsed( $this->_extra_data['data'], $primary ); |
|
| 76 | - |
|
| 77 | - else |
|
| 78 | - return ''; |
|
| 71 | + if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
| 72 | + return $this->_get_recipient_ticket_list_parsed( $this->_data['data'], $primary ); |
|
| 73 | + } else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) { |
|
| 74 | + return $this->_get_recipient_ticket_list_parsed( $this->_extra_data['data'], $primary ); |
|
| 75 | + } else { |
|
| 76 | + return ''; |
|
| 77 | + } |
|
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | |
| 82 | 81 | private function _get_recipient_ticket_list_parsed( EE_Messages_Addressee $data, $primary = FALSE ) { |
| 83 | 82 | $registration = $primary ? $data->primary_reg_obj : $data->reg_obj; |
| 84 | - if ( ! $registration instanceof EE_Registration ) return ''; |
|
| 83 | + if ( ! $registration instanceof EE_Registration ) { |
|
| 84 | + return ''; |
|
| 85 | + } |
|
| 85 | 86 | //setup valid shortcodes depending on what the status of the $this->_data property is |
| 86 | 87 | if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
| 87 | 88 | $valid_shortcodes = array('ticket', 'event_list', 'attendee_list','datetime_list', 'registration_details', 'attendee'); |
@@ -115,8 +116,9 @@ discard block |
||
| 115 | 116 | $adj_tkts = array(); |
| 116 | 117 | //return only tickets for the given attendee |
| 117 | 118 | foreach ( $evt_tkts as $tkt ) { |
| 118 | - if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj'] ) && $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj']->ID() == $tkt->ID() ) |
|
| 119 | - $adj_tkts[] = $tkt; |
|
| 119 | + if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj'] ) && $this->_extra_data['data']->registrations[$reg->ID()]['tkt_obj']->ID() == $tkt->ID() ) { |
|
| 120 | + $adj_tkts[] = $tkt; |
|
| 121 | + } |
|
| 120 | 122 | } |
| 121 | 123 | $evt_tkts = $adj_tkts; |
| 122 | 124 | } |
@@ -135,14 +137,13 @@ discard block |
||
| 135 | 137 | private function _get_recipient_datetime_list( $primary = FALSE ) { |
| 136 | 138 | $this->_validate_list_requirements(); |
| 137 | 139 | |
| 138 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
| 139 | - return $this->_get_recipient_datetime_list_parsed( $this->_data['data'], $primary ); |
|
| 140 | - |
|
| 141 | - else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) |
|
| 142 | - return $this->_get_recipient_datetime_list_parsed( $this->_extra_data['data'], $primary ); |
|
| 143 | - |
|
| 144 | - else |
|
| 145 | - return ''; |
|
| 140 | + if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
| 141 | + return $this->_get_recipient_datetime_list_parsed( $this->_data['data'], $primary ); |
|
| 142 | + } else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) { |
|
| 143 | + return $this->_get_recipient_datetime_list_parsed( $this->_extra_data['data'], $primary ); |
|
| 144 | + } else { |
|
| 145 | + return ''; |
|
| 146 | + } |
|
| 146 | 147 | |
| 147 | 148 | return $this->_get_recipient_datetime_list_parsed( $this->_data['data'], $primary); |
| 148 | 149 | } |
@@ -150,7 +151,9 @@ discard block |
||
| 150 | 151 | |
| 151 | 152 | private function _get_recipient_datetime_list_parsed( EE_Messages_Addressee $data, $primary = FALSE ) { |
| 152 | 153 | $registration = $primary ? $data->primary_reg_obj : $data->reg_obj; |
| 153 | - if ( ! $registration instanceof EE_Registration ) return ''; |
|
| 154 | + if ( ! $registration instanceof EE_Registration ) { |
|
| 155 | + return ''; |
|
| 156 | + } |
|
| 154 | 157 | //setup valid shortcodes depending on what the status of the $this->_data property is |
| 155 | 158 | if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
| 156 | 159 | $valid_shortcodes = array('datetime', 'attendee'); |
@@ -182,8 +185,9 @@ discard block |
||
| 182 | 185 | $adj_dtts = array(); |
| 183 | 186 | //return only dtts for the given attendee |
| 184 | 187 | foreach ( $evt_dtts as $dtt ) { |
| 185 | - if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['dtt_objs'][$dtt->ID()] ) ) |
|
| 186 | - $adj_dtts[] = $dtt; |
|
| 188 | + if ( isset( $this->_extra_data['data']->registrations[$reg->ID()]['dtt_objs'][$dtt->ID()] ) ) { |
|
| 189 | + $adj_dtts[] = $dtt; |
|
| 190 | + } |
|
| 187 | 191 | } |
| 188 | 192 | $evt_dtts = $adj_dtts; |
| 189 | 193 | } |
@@ -57,11 +57,11 @@ |
||
| 57 | 57 | } |
| 58 | 58 | if( $field_obj instanceof \EE_Boolean_Field ) { |
| 59 | 59 | $datatype = 'Boolean'; |
| 60 | - }elseif( $field_obj->get_wpdb_data_type() == '%d' ) { |
|
| 60 | + } elseif( $field_obj->get_wpdb_data_type() == '%d' ) { |
|
| 61 | 61 | $datatype = 'Number'; |
| 62 | - }elseif( $field_name instanceof \EE_Serialized_Text_Field ) { |
|
| 62 | + } elseif( $field_name instanceof \EE_Serialized_Text_Field ) { |
|
| 63 | 63 | $datatype = 'Object'; |
| 64 | - }else{ |
|
| 64 | + } else{ |
|
| 65 | 65 | $datatype = 'String'; |
| 66 | 66 | } |
| 67 | 67 | $default_value = Model_Data_Translator::prepare_field_value_for_json( |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | use EventEspresso\core\libraries\rest_api\Model_Data_Translator; |
| 5 | 5 | |
| 6 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 7 | - exit( 'No direct script access allowed' ); |
|
| 6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 7 | + exit('No direct script access allowed'); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -25,20 +25,20 @@ discard block |
||
| 25 | 25 | * @param \WP_REST_Request $request |
| 26 | 26 | * @return array|\WP_REST_Response |
| 27 | 27 | */ |
| 28 | - public static function handle_request_models_meta( \WP_REST_Request $request ) { |
|
| 28 | + public static function handle_request_models_meta(\WP_REST_Request $request) { |
|
| 29 | 29 | $controller = new Meta(); |
| 30 | - try{ |
|
| 30 | + try { |
|
| 31 | 31 | $matches = $controller->parse_route( |
| 32 | 32 | $request->get_route(), |
| 33 | - '~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~', |
|
| 34 | - array( 'version' ) ); |
|
| 35 | - if( $matches instanceof \WP_REST_Response ) { |
|
| 33 | + '~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'resources~', |
|
| 34 | + array('version') ); |
|
| 35 | + if ($matches instanceof \WP_REST_Response) { |
|
| 36 | 36 | return $matches; |
| 37 | 37 | } |
| 38 | - $controller->set_requested_version( $matches[ 'version' ] ); |
|
| 39 | - return $controller->send_response( $controller->_get_models_metadata_entity() ); |
|
| 40 | - } catch( \Exception $e ) { |
|
| 41 | - return $controller->send_response( $e ); |
|
| 38 | + $controller->set_requested_version($matches['version']); |
|
| 39 | + return $controller->send_response($controller->_get_models_metadata_entity()); |
|
| 40 | + } catch (\Exception $e) { |
|
| 41 | + return $controller->send_response($e); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -46,22 +46,22 @@ discard block |
||
| 46 | 46 | * Gets the model metadata resource entity |
| 47 | 47 | * @return array for JSON response, describing all the models available in teh requested version |
| 48 | 48 | */ |
| 49 | - protected function _get_models_metadata_entity(){ |
|
| 49 | + protected function _get_models_metadata_entity() { |
|
| 50 | 50 | $response = array(); |
| 51 | - foreach( $this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname ){ |
|
| 52 | - $model = $this->get_model_version_info()->load_model( $model_name ); |
|
| 51 | + foreach ($this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname) { |
|
| 52 | + $model = $this->get_model_version_info()->load_model($model_name); |
|
| 53 | 53 | $fields_json = array(); |
| 54 | - foreach( $this->get_model_version_info()->fields_on_model_in_this_version( $model ) as $field_name => $field_obj ) { |
|
| 55 | - if( $this->get_model_version_info()->field_is_ignored( $field_obj ) ) { |
|
| 54 | + foreach ($this->get_model_version_info()->fields_on_model_in_this_version($model) as $field_name => $field_obj) { |
|
| 55 | + if ($this->get_model_version_info()->field_is_ignored($field_obj)) { |
|
| 56 | 56 | continue; |
| 57 | 57 | } |
| 58 | - if( $field_obj instanceof \EE_Boolean_Field ) { |
|
| 58 | + if ($field_obj instanceof \EE_Boolean_Field) { |
|
| 59 | 59 | $datatype = 'Boolean'; |
| 60 | - }elseif( $field_obj->get_wpdb_data_type() == '%d' ) { |
|
| 60 | + }elseif ($field_obj->get_wpdb_data_type() == '%d') { |
|
| 61 | 61 | $datatype = 'Number'; |
| 62 | - }elseif( $field_name instanceof \EE_Serialized_Text_Field ) { |
|
| 62 | + }elseif ($field_name instanceof \EE_Serialized_Text_Field) { |
|
| 63 | 63 | $datatype = 'Object'; |
| 64 | - }else{ |
|
| 64 | + } else { |
|
| 65 | 65 | $datatype = 'String'; |
| 66 | 66 | } |
| 67 | 67 | $default_value = Model_Data_Translator::prepare_field_value_for_json( |
@@ -72,30 +72,30 @@ discard block |
||
| 72 | 72 | $field_json = array( |
| 73 | 73 | 'name' => $field_name, |
| 74 | 74 | 'nicename' => $field_obj->get_nicename(), |
| 75 | - 'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format( $field_obj ), |
|
| 76 | - 'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format( $field_obj ), |
|
| 77 | - 'type' => str_replace('EE_', '', get_class( $field_obj ) ), |
|
| 75 | + 'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format($field_obj), |
|
| 76 | + 'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format($field_obj), |
|
| 77 | + 'type' => str_replace('EE_', '', get_class($field_obj)), |
|
| 78 | 78 | 'datatype' => $datatype, |
| 79 | 79 | 'nullable' => $field_obj->is_nullable(), |
| 80 | 80 | 'default' => $default_value, |
| 81 | 81 | 'table_alias' => $field_obj->get_table_alias(), |
| 82 | 82 | 'table_column' => $field_obj->get_table_column(), |
| 83 | 83 | ); |
| 84 | - $fields_json[ $field_json[ 'name' ] ] = $field_json; |
|
| 84 | + $fields_json[$field_json['name']] = $field_json; |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | - $fields_json = array_merge( $fields_json, $this->get_model_version_info()->extra_resource_properties_for_model( $model ) ); |
|
| 88 | - $response[ $model_name ]['fields'] = apply_filters( 'FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model ); |
|
| 87 | + $fields_json = array_merge($fields_json, $this->get_model_version_info()->extra_resource_properties_for_model($model)); |
|
| 88 | + $response[$model_name]['fields'] = apply_filters('FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model); |
|
| 89 | 89 | $relations_json = array(); |
| 90 | - foreach( $model->relation_settings() as $relation_name => $relation_obj ) { |
|
| 90 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
| 91 | 91 | $relation_json = array( |
| 92 | 92 | 'name' => $relation_name, |
| 93 | - 'type' => str_replace( 'EE_', '', get_class( $relation_obj ) ), |
|
| 93 | + 'type' => str_replace('EE_', '', get_class($relation_obj)), |
|
| 94 | 94 | 'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false, |
| 95 | 95 | ); |
| 96 | - $relations_json[ $relation_name ] = $relation_json; |
|
| 96 | + $relations_json[$relation_name] = $relation_json; |
|
| 97 | 97 | } |
| 98 | - $response[ $model_name ][ 'relations' ] = apply_filters( 'FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model ); |
|
| 98 | + $response[$model_name]['relations'] = apply_filters('FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model); |
|
| 99 | 99 | } |
| 100 | 100 | return $response; |
| 101 | 101 | } |
@@ -105,24 +105,24 @@ discard block |
||
| 105 | 105 | * @param \WP_REST_Response $rest_response_obj |
| 106 | 106 | * @return \WP_REST_Response |
| 107 | 107 | */ |
| 108 | - public static function filter_ee_metadata_into_index( \WP_REST_Response $rest_response_obj ) { |
|
| 108 | + public static function filter_ee_metadata_into_index(\WP_REST_Response $rest_response_obj) { |
|
| 109 | 109 | $response_data = $rest_response_obj->get_data(); |
| 110 | 110 | $addons = array(); |
| 111 | - foreach( \EE_Registry::instance()->addons as $addon){ |
|
| 111 | + foreach (\EE_Registry::instance()->addons as $addon) { |
|
| 112 | 112 | $addon_json = array( |
| 113 | 113 | 'name' => $addon->name(), |
| 114 | 114 | 'version' => $addon->version() |
| 115 | 115 | ); |
| 116 | - $addons[ $addon_json[ 'name' ] ] = $addon_json; |
|
| 116 | + $addons[$addon_json['name']] = $addon_json; |
|
| 117 | 117 | } |
| 118 | - $response_data[ 'ee' ] = array( |
|
| 118 | + $response_data['ee'] = array( |
|
| 119 | 119 | 'version' => \EEM_System_Status::instance()->get_ee_version(), |
| 120 | 120 | 'documentation_url' => 'https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API', |
| 121 | 121 | 'addons' => $addons, |
| 122 | 122 | 'maintenance_mode' => \EE_Maintenance_Mode::instance()->real_level(), |
| 123 | - 'served_core_versions' => array_keys( \EED_Core_Rest_Api::versions_served() ) |
|
| 123 | + 'served_core_versions' => array_keys(\EED_Core_Rest_Api::versions_served()) |
|
| 124 | 124 | ); |
| 125 | - $rest_response_obj->set_data( $response_data ); |
|
| 125 | + $rest_response_obj->set_data($response_data); |
|
| 126 | 126 | return $rest_response_obj; |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 3 | - exit( 'No direct script access allowed' ); |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | + exit('No direct script access allowed'); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -15,18 +15,18 @@ discard block |
||
| 15 | 15 | * @author Mike Nelson |
| 16 | 16 | * |
| 17 | 17 | */ |
| 18 | -class EE_Phone_Input extends EE_Text_Input{ |
|
| 18 | +class EE_Phone_Input extends EE_Text_Input { |
|
| 19 | 19 | /** |
| 20 | 20 | * @param array $options |
| 21 | 21 | */ |
| 22 | - function __construct($options = array()){ |
|
| 22 | + function __construct($options = array()) { |
|
| 23 | 23 | $this->_add_validation_strategy( |
| 24 | 24 | new EE_Text_Validation_Strategy( |
| 25 | - __( 'Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso' ), |
|
| 25 | + __('Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso'), |
|
| 26 | 26 | '~^(([\d]{10})|(^[\d]{3}-[\d]{3}-[\d]{4}))$~' |
| 27 | 27 | ) |
| 28 | 28 | ); |
| 29 | - parent::__construct( $options ); |
|
| 29 | + parent::__construct($options); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |