@@ -6,11 +6,11 @@ |
||
| 6 | 6 | <li class="ticket-registration"> |
| 7 | 7 | <table class="registration-details"> |
| 8 | 8 | <tr class="odd"> |
| 9 | - <th><?php _e('Attendee', 'event_espresso');?></th> |
|
| 9 | + <th><?php _e('Attendee', 'event_espresso'); ?></th> |
|
| 10 | 10 | <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td> |
| 11 | 11 | </tr> |
| 12 | 12 | <tr> |
| 13 | - <th><?php _e("Registration Code:", "event_espresso");?></th> |
|
| 13 | + <th><?php _e("Registration Code:", "event_espresso"); ?></th> |
|
| 14 | 14 | <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td> |
| 15 | 15 | </tr> |
| 16 | 16 | <tr> |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | //remove unwanted transaction shortcode |
| 81 | 81 | foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
| 82 | 82 | if( ($key = array_search('transaction', $shortcodes) ) !== false) { |
| 83 | - unset($this->_valid_shortcodes[$context][$key]); |
|
| 83 | + unset($this->_valid_shortcodes[$context][$key]); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -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 | /** |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | parent::_set_valid_shortcodes(); |
| 79 | 79 | |
| 80 | 80 | //remove unwanted transaction shortcode |
| 81 | - foreach ( $this->_valid_shortcodes as $context => $shortcodes ) { |
|
| 82 | - if( ($key = array_search('transaction', $shortcodes) ) !== false) { |
|
| 81 | + foreach ($this->_valid_shortcodes as $context => $shortcodes) { |
|
| 82 | + if (($key = array_search('transaction', $shortcodes)) !== false) { |
|
| 83 | 83 | unset($this->_valid_shortcodes[$context][$key]); |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -1,6 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -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 | /** |
| 7 | 8 | * EE_Payment_Cancelled_message_type extends EE_message_type |
@@ -1,5 +1,5 @@ |
||
| 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 | /** |
@@ -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 | /** |
| 7 | 8 | * EE_Payment_Failed_message_type extends EE_message_type |
@@ -1,5 +1,5 @@ |
||
| 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 | /** |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | * @subpackage helpers |
| 6 | 6 | * @since 4.3.0 |
| 7 | 7 | */ |
| 8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 9 | + exit('No direct script access allowed'); |
|
| 10 | +} |
|
| 9 | 11 | |
| 10 | 12 | /** |
| 11 | 13 | * This is the library class for the "newsletter" group shortcodes. |
@@ -54,8 +56,9 @@ discard block |
||
| 54 | 56 | * @return array new validator config. |
| 55 | 57 | */ |
| 56 | 58 | public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) { |
| 57 | - if ( $messenger->name !== 'email' ) |
|
| 58 | - return $validator_config; |
|
| 59 | + if ( $messenger->name !== 'email' ) { |
|
| 60 | + return $validator_config; |
|
| 61 | + } |
|
| 59 | 62 | |
| 60 | 63 | $validator_config['content']['shortcodes'][] = 'newsletter'; |
| 61 | 64 | $validator_config['newsletter_content'] = array( |
@@ -82,8 +85,9 @@ discard block |
||
| 82 | 85 | * @return array new/modified template fields array. |
| 83 | 86 | */ |
| 84 | 87 | public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) { |
| 85 | - if ( $messenger->name !== 'email' ) |
|
| 86 | - return $template_fields; |
|
| 88 | + if ( $messenger->name !== 'email' ) { |
|
| 89 | + return $template_fields; |
|
| 90 | + } |
|
| 87 | 91 | |
| 88 | 92 | $template_fields['extra']['content']['newsletter_content'] = array( |
| 89 | 93 | 'input' => 'wp_editor', |
@@ -20,81 +20,81 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class EE_Newsletter_Shortcodes extends EE_Shortcodes { |
| 22 | 22 | |
| 23 | - protected function _init_props() { |
|
| 24 | - $this->label = __("Batch Messages Shortcodes", 'event_espresso'); |
|
| 25 | - $this->description = __('All shortcodes used for the batch message type', 'event_espresso'); |
|
| 26 | - $this->_shortcodes = array( |
|
| 27 | - '[NEWSLETTER_CONTENT]' => __('This will parse to whatever is found in the related [newsletter_content] field. Note that when triggering a batch message, whatever is added for the custom message will be inserted where this shortcode is placed.', 'event_espresso') |
|
| 28 | - ); |
|
| 29 | - } |
|
| 23 | + protected function _init_props() { |
|
| 24 | + $this->label = __("Batch Messages Shortcodes", 'event_espresso'); |
|
| 25 | + $this->description = __('All shortcodes used for the batch message type', 'event_espresso'); |
|
| 26 | + $this->_shortcodes = array( |
|
| 27 | + '[NEWSLETTER_CONTENT]' => __('This will parse to whatever is found in the related [newsletter_content] field. Note that when triggering a batch message, whatever is added for the custom message will be inserted where this shortcode is placed.', 'event_espresso') |
|
| 28 | + ); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | - protected function _parser( $shortcode ) { |
|
| 34 | - if ( $shortcode == '[NEWSLETTER_CONTENT]' ) { |
|
| 35 | - $this->_validate_list_requirements(); |
|
| 36 | - $valid_shortcodes = array('recipient_details', 'organization'); |
|
| 37 | - $template = $this->_data['template']['newsletter_content']; |
|
| 38 | - $data = $this->_data; |
|
| 39 | - return $this->_shortcode_helper->parse_message_template( $template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
| 40 | - } |
|
| 41 | - } |
|
| 33 | + protected function _parser( $shortcode ) { |
|
| 34 | + if ( $shortcode == '[NEWSLETTER_CONTENT]' ) { |
|
| 35 | + $this->_validate_list_requirements(); |
|
| 36 | + $valid_shortcodes = array('recipient_details', 'organization'); |
|
| 37 | + $template = $this->_data['template']['newsletter_content']; |
|
| 38 | + $data = $this->_data; |
|
| 39 | + return $this->_shortcode_helper->parse_message_template( $template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Callback set in args for EE_Register_Messages_Shortcode_Library::register for 'msgr_validator_callback'. |
|
| 46 | - * |
|
| 47 | - * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
| 48 | - * 'FHEE__EE_messenger__get_validator_config' filter. |
|
| 49 | - * |
|
| 50 | - * @since 4.3.0 |
|
| 51 | - * @param array $validator_config current validator configuration array |
|
| 52 | - * @param EE_messenger $messenger |
|
| 53 | - * @return array new validator config. |
|
| 54 | - */ |
|
| 55 | - public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) { |
|
| 56 | - if ( $messenger->name !== 'email' ) |
|
| 57 | - return $validator_config; |
|
| 44 | + /** |
|
| 45 | + * Callback set in args for EE_Register_Messages_Shortcode_Library::register for 'msgr_validator_callback'. |
|
| 46 | + * |
|
| 47 | + * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
| 48 | + * 'FHEE__EE_messenger__get_validator_config' filter. |
|
| 49 | + * |
|
| 50 | + * @since 4.3.0 |
|
| 51 | + * @param array $validator_config current validator configuration array |
|
| 52 | + * @param EE_messenger $messenger |
|
| 53 | + * @return array new validator config. |
|
| 54 | + */ |
|
| 55 | + public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) { |
|
| 56 | + if ( $messenger->name !== 'email' ) |
|
| 57 | + return $validator_config; |
|
| 58 | 58 | |
| 59 | - $validator_config['content']['shortcodes'][] = 'newsletter'; |
|
| 60 | - $validator_config['newsletter_content'] = array( |
|
| 61 | - 'shortcodes' => array('recipient_details', 'organization'), |
|
| 62 | - 'required' => array('[NEWSLETTER_CONTENT]') |
|
| 63 | - ); |
|
| 64 | - return $validator_config; |
|
| 65 | - } |
|
| 59 | + $validator_config['content']['shortcodes'][] = 'newsletter'; |
|
| 60 | + $validator_config['newsletter_content'] = array( |
|
| 61 | + 'shortcodes' => array('recipient_details', 'organization'), |
|
| 62 | + 'required' => array('[NEWSLETTER_CONTENT]') |
|
| 63 | + ); |
|
| 64 | + return $validator_config; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Callback set in args for EE_Register_Messages_Shortcode_Library::register for |
|
| 72 | - * 'msgr_template_fields_callback'. |
|
| 73 | - * |
|
| 74 | - * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
| 75 | - * FHEE__EE_messenger__get_template_fields filter. |
|
| 76 | - * |
|
| 77 | - * @since 4.3.0 |
|
| 78 | - * |
|
| 79 | - * @param array $template_fields current template fields setup array. |
|
| 80 | - * @param EE_messenger $messenger |
|
| 81 | - * @return array new/modified template fields array. |
|
| 82 | - */ |
|
| 83 | - public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) { |
|
| 84 | - if ( $messenger->name !== 'email' ) |
|
| 85 | - return $template_fields; |
|
| 70 | + /** |
|
| 71 | + * Callback set in args for EE_Register_Messages_Shortcode_Library::register for |
|
| 72 | + * 'msgr_template_fields_callback'. |
|
| 73 | + * |
|
| 74 | + * EE_Register_Messages_Shortcode_Library::register registers this callback with the |
|
| 75 | + * FHEE__EE_messenger__get_template_fields filter. |
|
| 76 | + * |
|
| 77 | + * @since 4.3.0 |
|
| 78 | + * |
|
| 79 | + * @param array $template_fields current template fields setup array. |
|
| 80 | + * @param EE_messenger $messenger |
|
| 81 | + * @return array new/modified template fields array. |
|
| 82 | + */ |
|
| 83 | + public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) { |
|
| 84 | + if ( $messenger->name !== 'email' ) |
|
| 85 | + return $template_fields; |
|
| 86 | 86 | |
| 87 | - $template_fields['extra']['content']['newsletter_content'] = array( |
|
| 88 | - 'input' => 'wp_editor', |
|
| 89 | - 'label' => '[NEWSLETTER_CONTENT]', |
|
| 90 | - 'type' => 'string', |
|
| 91 | - 'required' => TRUE, |
|
| 92 | - 'validation' => TRUE, |
|
| 93 | - 'format' => '%s', |
|
| 94 | - 'rows' => '15', |
|
| 95 | - 'shortcodes_required' => array('[NEWSLETTER_CONTENT]') |
|
| 96 | - ); |
|
| 97 | - return $template_fields; |
|
| 98 | - } |
|
| 87 | + $template_fields['extra']['content']['newsletter_content'] = array( |
|
| 88 | + 'input' => 'wp_editor', |
|
| 89 | + 'label' => '[NEWSLETTER_CONTENT]', |
|
| 90 | + 'type' => 'string', |
|
| 91 | + 'required' => TRUE, |
|
| 92 | + 'validation' => TRUE, |
|
| 93 | + 'format' => '%s', |
|
| 94 | + 'rows' => '15', |
|
| 95 | + 'shortcodes_required' => array('[NEWSLETTER_CONTENT]') |
|
| 96 | + ); |
|
| 97 | + return $template_fields; |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | 100 | } //end class EE_Newsletter_Shortcodes |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | - protected function _parser( $shortcode ) { |
|
| 34 | - if ( $shortcode == '[NEWSLETTER_CONTENT]' ) { |
|
| 33 | + protected function _parser($shortcode) { |
|
| 34 | + if ($shortcode == '[NEWSLETTER_CONTENT]') { |
|
| 35 | 35 | $this->_validate_list_requirements(); |
| 36 | 36 | $valid_shortcodes = array('recipient_details', 'organization'); |
| 37 | 37 | $template = $this->_data['template']['newsletter_content']; |
| 38 | 38 | $data = $this->_data; |
| 39 | - return $this->_shortcode_helper->parse_message_template( $template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
| 39 | + return $this->_shortcode_helper->parse_message_template($template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | * @param EE_messenger $messenger |
| 53 | 53 | * @return array new validator config. |
| 54 | 54 | */ |
| 55 | - public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) { |
|
| 56 | - if ( $messenger->name !== 'email' ) |
|
| 55 | + public static function messenger_validator_config($validator_config, EE_messenger $messenger) { |
|
| 56 | + if ($messenger->name !== 'email') |
|
| 57 | 57 | return $validator_config; |
| 58 | 58 | |
| 59 | 59 | $validator_config['content']['shortcodes'][] = 'newsletter'; |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @param EE_messenger $messenger |
| 81 | 81 | * @return array new/modified template fields array. |
| 82 | 82 | */ |
| 83 | - public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) { |
|
| 84 | - if ( $messenger->name !== 'email' ) |
|
| 83 | + public static function messenger_template_fields($template_fields, EE_messenger $messenger) { |
|
| 84 | + if ($messenger->name !== 'email') |
|
| 85 | 85 | return $template_fields; |
| 86 | 86 | |
| 87 | 87 | $template_fields['extra']['content']['newsletter_content'] = array( |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | - * Return true if the current page is the mijireh checkout page, otherwise return false. |
|
| 114 | - * |
|
| 115 | - * @return boolean |
|
| 116 | - */ |
|
| 113 | + * Return true if the current page is the mijireh checkout page, otherwise return false. |
|
| 114 | + * |
|
| 115 | + * @return boolean |
|
| 116 | + */ |
|
| 117 | 117 | public static function is_slurp_page() { |
| 118 | 118 | global $post; |
| 119 | 119 | $isSlurp = false; |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | - * adds the callback to adding the slurp page metabox, which shoudl only appear on a page with the {{mj-checkout-form}} "shortcode" |
|
| 134 | - * @return void |
|
| 135 | - */ |
|
| 133 | + * adds the callback to adding the slurp page metabox, which shoudl only appear on a page with the {{mj-checkout-form}} "shortcode" |
|
| 134 | + * @return void |
|
| 135 | + */ |
|
| 136 | 136 | public static function add_slurp_page_metabox() { |
| 137 | 137 | if(self::is_slurp_page() && EEM_Payment_Method::instance()->get_one_active( EEM_Payment_Method::scope_cart, array( array( 'PMD_type' => 'Mijireh' ) ) ) ){ |
| 138 | 138 | add_meta_box( |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * outputs HTML for displaying the slurping metabox |
|
| 151 | - * @param WP_Post $post |
|
| 152 | - * @return void echoes out html |
|
| 153 | - */ |
|
| 150 | + * outputs HTML for displaying the slurping metabox |
|
| 151 | + * @param WP_Post $post |
|
| 152 | + * @return void echoes out html |
|
| 153 | + */ |
|
| 154 | 154 | public static function slurp_page_metabox($post) { |
| 155 | 155 | global $wp; |
| 156 | 156 | $mijireh_payment_method = EEM_Payment_Method::instance()->get_one_of_type( 'Mijireh' ); |
@@ -168,10 +168,10 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | - * decides whether to slurp the post indicated by the $post global or not, based entirely |
|
| 172 | - * on a special arg being in the querystring |
|
| 173 | - * @return void |
|
| 174 | - */ |
|
| 171 | + * decides whether to slurp the post indicated by the $post global or not, based entirely |
|
| 172 | + * on a special arg being in the querystring |
|
| 173 | + * @return void |
|
| 174 | + */ |
|
| 175 | 175 | public static function slurp_or_not(){ |
| 176 | 176 | //check if this page has the right mijire 'shortcode' and if they've specified to slurp it |
| 177 | 177 | if(isset($_GET['mijireh_slurp_now']) && $_GET['mijireh_slurp_now'] == 'true' && EED_Mijireh_Slurper::is_slurp_page()){ |
@@ -180,9 +180,9 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * Sends a request to mijireh to slurp the current $post, and then redirects the user back to the current page without the |
|
| 184 | - * special querystring arg indicating to slurp. Also, should temporarily make the current post published, then revert it to its previous status |
|
| 185 | - */ |
|
| 183 | + * Sends a request to mijireh to slurp the current $post, and then redirects the user back to the current page without the |
|
| 184 | + * special querystring arg indicating to slurp. Also, should temporarily make the current post published, then revert it to its previous status |
|
| 185 | + */ |
|
| 186 | 186 | public static function slurp_now(){ |
| 187 | 187 | global $post; |
| 188 | 188 | if ( $post->post_status != 'publish' ) { |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -122,8 +124,7 @@ discard block |
||
| 122 | 124 | if( strpos($content, EED_Mijireh_Slurper::mijireh_slurper_shortcode ) !== false ) { |
| 123 | 125 | $isSlurp = true; |
| 124 | 126 | } |
| 125 | - } |
|
| 126 | - else { |
|
| 127 | + } else { |
|
| 127 | 128 | // echo '[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Check Slurp Page Failed: " . print_r($post, 1); |
| 128 | 129 | } |
| 129 | 130 | return $isSlurp; |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | 51 | public static function set_hooks_admin() { |
| 52 | - define('EED_MIJIREH_SLURPER_PATH',EE_CAFF_PATH.'modules'.DS.'mijireh_slurper'.DS); |
|
| 53 | - add_action('load-post.php',array('EED_Mijireh_Slurper','set_edit_post_page_hooks')); |
|
| 54 | - add_action('load-admin.php',array('EED_Mijireh_Slurper','check_for_edit_slurp_page')); |
|
| 55 | - add_action('AHEE__EE_Mijireh__settings_end',array('EED_Mijireh_Slurper','add_slurp_link_to_gateway')); |
|
| 52 | + define('EED_MIJIREH_SLURPER_PATH', EE_CAFF_PATH.'modules'.DS.'mijireh_slurper'.DS); |
|
| 53 | + add_action('load-post.php', array('EED_Mijireh_Slurper', 'set_edit_post_page_hooks')); |
|
| 54 | + add_action('load-admin.php', array('EED_Mijireh_Slurper', 'check_for_edit_slurp_page')); |
|
| 55 | + add_action('AHEE__EE_Mijireh__settings_end', array('EED_Mijireh_Slurper', 'add_slurp_link_to_gateway')); |
|
| 56 | 56 | } |
| 57 | 57 | /** |
| 58 | 58 | * Merely used to avoid even bothering to add these hooks on pages besides admin's post.php |
| 59 | 59 | */ |
| 60 | - public static function set_edit_post_page_hooks(){ |
|
| 61 | - add_action('add_meta_boxes',array('EED_Mijireh_Slurper','add_slurp_page_metabox')); |
|
| 62 | - add_action('posts_selection',array('EED_Mijireh_Slurper','slurp_or_not')); |
|
| 63 | - if(get_transient(EED_Mijireh_Slurper::slurp_started_transient_name)){ |
|
| 64 | - add_action( 'admin_notices', array('EED_Mijireh_Slurper', 'slurping_in_progress_notice') ); |
|
| 60 | + public static function set_edit_post_page_hooks() { |
|
| 61 | + add_action('add_meta_boxes', array('EED_Mijireh_Slurper', 'add_slurp_page_metabox')); |
|
| 62 | + add_action('posts_selection', array('EED_Mijireh_Slurper', 'slurp_or_not')); |
|
| 63 | + if (get_transient(EED_Mijireh_Slurper::slurp_started_transient_name)) { |
|
| 64 | + add_action('admin_notices', array('EED_Mijireh_Slurper', 'slurping_in_progress_notice')); |
|
| 65 | 65 | delete_transient(EED_Mijireh_Slurper::slurp_started_transient_name); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | * Adds the slurping content to the gateway's settings page, because I thought this was best suited to remain in the module's code (because |
| 71 | 71 | * the gateway works fine independent of this module) |
| 72 | 72 | */ |
| 73 | - public static function add_slurp_link_to_gateway($existing_content){ |
|
| 74 | - echo EEH_Template::display_template( EED_MIJIREH_SLURPER_PATH.'templates/additional_content_on_gateway.template.php', array(),true ) . $existing_content; |
|
| 73 | + public static function add_slurp_link_to_gateway($existing_content) { |
|
| 74 | + echo EEH_Template::display_template(EED_MIJIREH_SLURPER_PATH.'templates/additional_content_on_gateway.template.php', array(), true).$existing_content; |
|
| 75 | 75 | } |
| 76 | - public static function slurping_in_progress_notice(){ |
|
| 77 | - EEH_Template::display_template( EED_MIJIREH_SLURPER_PATH.'templates/slurping_in_progress_notice.template.php', array() ); |
|
| 76 | + public static function slurping_in_progress_notice() { |
|
| 77 | + EEH_Template::display_template(EED_MIJIREH_SLURPER_PATH.'templates/slurping_in_progress_notice.template.php', array()); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | * need to first make it). If the special arg is present, redirects the user to the slurp page's edit page |
| 84 | 84 | * @return void |
| 85 | 85 | */ |
| 86 | - public static function check_for_edit_slurp_page(){ |
|
| 87 | - if(isset($_GET['mijireh_edit_slurp_page']) && $_GET['mijireh_edit_slurp_page'] == 'true'){ |
|
| 86 | + public static function check_for_edit_slurp_page() { |
|
| 87 | + if (isset($_GET['mijireh_edit_slurp_page']) && $_GET['mijireh_edit_slurp_page'] == 'true') { |
|
| 88 | 88 | //check if we already have a slurping page |
| 89 | - if( ! $slurp_page_id = self::find_slurp_page() ){ |
|
| 89 | + if ( ! $slurp_page_id = self::find_slurp_page()) { |
|
| 90 | 90 | //if no slurp page yet, make one |
| 91 | 91 | $slurp_page_id = wp_insert_post( |
| 92 | 92 | array( |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | ) |
| 97 | 97 | ); |
| 98 | 98 | } |
| 99 | - wp_redirect(add_query_arg(array('post'=>$slurp_page_id,'action'=>'edit'),admin_url('post.php'))); |
|
| 99 | + wp_redirect(add_query_arg(array('post'=>$slurp_page_id, 'action'=>'edit'), admin_url('post.php'))); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * Gets the post id which has the {{mj-checkout-form}} "shortcode" in it, otherwise null |
| 105 | 105 | * @return int |
| 106 | 106 | */ |
| 107 | - public static function find_slurp_page(){ |
|
| 107 | + public static function find_slurp_page() { |
|
| 108 | 108 | global $wpdb; |
| 109 | 109 | return $wpdb->get_var("SELECT id FROM {$wpdb->posts} WHERE post_content LIKE '%".EED_Mijireh_Slurper::mijireh_slurper_shortcode."%'"); |
| 110 | 110 | } |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | public static function is_slurp_page() { |
| 118 | 118 | global $post; |
| 119 | 119 | $isSlurp = false; |
| 120 | - if(isset($post) && is_object($post)) { |
|
| 120 | + if (isset($post) && is_object($post)) { |
|
| 121 | 121 | $content = $post->post_content; |
| 122 | - if( strpos($content, EED_Mijireh_Slurper::mijireh_slurper_shortcode ) !== false ) { |
|
| 122 | + if (strpos($content, EED_Mijireh_Slurper::mijireh_slurper_shortcode) !== false) { |
|
| 123 | 123 | $isSlurp = true; |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @return void |
| 135 | 135 | */ |
| 136 | 136 | public static function add_slurp_page_metabox() { |
| 137 | - if(self::is_slurp_page() && EEM_Payment_Method::instance()->get_one_active( EEM_Payment_Method::scope_cart, array( array( 'PMD_type' => 'Mijireh' ) ) ) ){ |
|
| 137 | + if (self::is_slurp_page() && EEM_Payment_Method::instance()->get_one_active(EEM_Payment_Method::scope_cart, array(array('PMD_type' => 'Mijireh')))) { |
|
| 138 | 138 | add_meta_box( |
| 139 | 139 | 'slurp_meta_box', // $id |
| 140 | 140 | 'Mijireh Page Slurp', // $title |
@@ -153,15 +153,15 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public static function slurp_page_metabox($post) { |
| 155 | 155 | global $wp; |
| 156 | - $mijireh_payment_method = EEM_Payment_Method::instance()->get_one_of_type( 'Mijireh' ); |
|
| 157 | - if( $mijireh_payment_method ){ |
|
| 158 | - $access_key = $mijireh_payment_method->get_extra_meta( 'access_key', TRUE ); |
|
| 156 | + $mijireh_payment_method = EEM_Payment_Method::instance()->get_one_of_type('Mijireh'); |
|
| 157 | + if ($mijireh_payment_method) { |
|
| 158 | + $access_key = $mijireh_payment_method->get_extra_meta('access_key', TRUE); |
|
| 159 | 159 | EEH_Template::display_template( |
| 160 | 160 | EED_MIJIREH_SLURPER_PATH.'templates/mijireh_slurp_page_metabox.template.php', |
| 161 | 161 | array( |
| 162 | 162 | 'mijireh_image_url'=> $mijireh_payment_method->button_url(), |
| 163 | 163 | 'access_key'=>$access_key, |
| 164 | - 'slurp_action_link'=> esc_url_raw( add_query_arg('mijireh_slurp_now','true', add_query_arg( $wp->query_string, '', '?'.$_SERVER['QUERY_STRING'] ))) |
|
| 164 | + 'slurp_action_link'=> esc_url_raw(add_query_arg('mijireh_slurp_now', 'true', add_query_arg($wp->query_string, '', '?'.$_SERVER['QUERY_STRING']))) |
|
| 165 | 165 | ) |
| 166 | 166 | ); |
| 167 | 167 | } |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | * on a special arg being in the querystring |
| 173 | 173 | * @return void |
| 174 | 174 | */ |
| 175 | - public static function slurp_or_not(){ |
|
| 175 | + public static function slurp_or_not() { |
|
| 176 | 176 | //check if this page has the right mijire 'shortcode' and if they've specified to slurp it |
| 177 | - if(isset($_GET['mijireh_slurp_now']) && $_GET['mijireh_slurp_now'] == 'true' && EED_Mijireh_Slurper::is_slurp_page()){ |
|
| 177 | + if (isset($_GET['mijireh_slurp_now']) && $_GET['mijireh_slurp_now'] == 'true' && EED_Mijireh_Slurper::is_slurp_page()) { |
|
| 178 | 178 | EED_Mijireh_Slurper::slurp_now(); |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -183,22 +183,22 @@ discard block |
||
| 183 | 183 | * Sends a request to mijireh to slurp the current $post, and then redirects the user back to the current page without the |
| 184 | 184 | * special querystring arg indicating to slurp. Also, should temporarily make the current post published, then revert it to its previous status |
| 185 | 185 | */ |
| 186 | - public static function slurp_now(){ |
|
| 186 | + public static function slurp_now() { |
|
| 187 | 187 | global $post; |
| 188 | - if ( $post->post_status != 'publish' ) { |
|
| 188 | + if ($post->post_status != 'publish') { |
|
| 189 | 189 | //make sure the post is published at least while slurping |
| 190 | 190 | $post->post_status = 'publish'; |
| 191 | 191 | wp_update_post($post); |
| 192 | 192 | } |
| 193 | - $mijireh_gateway = EEM_Payment_Method::instance()->get_one_of_type( 'Mijireh' ); |
|
| 194 | - $access_key = $mijireh_gateway->get_extra_meta( 'access_key', TRUE ); |
|
| 193 | + $mijireh_gateway = EEM_Payment_Method::instance()->get_one_of_type('Mijireh'); |
|
| 194 | + $access_key = $mijireh_gateway->get_extra_meta('access_key', TRUE); |
|
| 195 | 195 | // 'slurp_url'=>get_permalink($post), |
| 196 | 196 | // 'page_id'=>$post->ID, |
| 197 | 197 | // 'return_url'=>$return_url |
| 198 | 198 | $url = 'https://secure.mijireh.com/api/1/slurps'; |
| 199 | 199 | $args = array( |
| 200 | 200 | 'headers' => array( |
| 201 | - 'Authorization' => 'Basic ' . base64_encode( $access_key . ':' ), |
|
| 201 | + 'Authorization' => 'Basic '.base64_encode($access_key.':'), |
|
| 202 | 202 | 'Accept'=>'application/json' |
| 203 | 203 | ), |
| 204 | 204 | 'body'=> wp_json_encode( |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | ) |
| 210 | 210 | ) |
| 211 | 211 | ); |
| 212 | - $response = wp_remote_post($url,$args); |
|
| 212 | + $response = wp_remote_post($url, $args); |
|
| 213 | 213 | //now redirect the user back to the same page |
| 214 | 214 | $redirect_args = $_GET; |
| 215 | 215 | unset($redirect_args['mijireh_slurp_now']); |
| 216 | - $url = add_query_arg($redirect_args,admin_url('post.php')); |
|
| 217 | - set_transient(EED_Mijireh_Slurper::slurp_started_transient_name,true); |
|
| 216 | + $url = add_query_arg($redirect_args, admin_url('post.php')); |
|
| 217 | + set_transient(EED_Mijireh_Slurper::slurp_started_transient_name, true); |
|
| 218 | 218 | // echo "redirect to $url"; |
| 219 | 219 | wp_redirect($url); |
| 220 | 220 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @access public |
| 226 | 226 | * @return void |
| 227 | 227 | */ |
| 228 | - public function run( $WP ) { |
|
| 228 | + public function run($WP) { |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <tr> |
| 2 | - <th><?php _e("Mijireh Checkout Page Design", 'event_espresso');?><?php echo EEH_Template::get_help_tab_link( 'ee_mijireh_help_tab' ); ?></th> |
|
| 2 | + <th><?php _e("Mijireh Checkout Page Design", 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('ee_mijireh_help_tab'); ?></th> |
|
| 3 | 3 | <td> |
| 4 | - <a href="?mijireh_edit_slurp_page=true"><?php _e("Edit Slurp Page", 'event_espresso');?></a> |
|
| 4 | + <a href="?mijireh_edit_slurp_page=true"><?php _e("Edit Slurp Page", 'event_espresso'); ?></a> |
|
| 5 | 5 | </td> |
| 6 | 6 | </tr> |
| 7 | 7 | \ No newline at end of file |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <div id='mijireh_notice' class='mijireh-info alert-message info' data-alert='alert'> |
| 2 | - <div class='mijireh-logo'><img src='<?php echo $mijireh_image_url;?>' alt='<?php printf( esc_attr__( '%s Checkout Logo', 'event_espresso' ), 'Mijereh' ); ?>'></div> |
|
| 2 | + <div class='mijireh-logo'><img src='<?php echo $mijireh_image_url; ?>' alt='<?php printf(esc_attr__('%s Checkout Logo', 'event_espresso'), 'Mijereh'); ?>'></div> |
|
| 3 | 3 | <div class='mijireh-blurb'> |
| 4 | - <h2><?php _e("Slurp Into Mijireh", 'event_espresso');?></h2> |
|
| 5 | - <p><?php printf(__("Design the page how you want, and be sure to include the special text {{mj-checkout-form}} to indicate where to place Mijireh's Checkout Form. You may want to read %s Mijireh's instructions on slurping%s.", 'event_espresso'),"<a href='http://www.mijireh.com/docs/what-is-page-slurp/'>","</a>");?> |
|
| 4 | + <h2><?php _e("Slurp Into Mijireh", 'event_espresso'); ?></h2> |
|
| 5 | + <p><?php printf(__("Design the page how you want, and be sure to include the special text {{mj-checkout-form}} to indicate where to place Mijireh's Checkout Form. You may want to read %s Mijireh's instructions on slurping%s.", 'event_espresso'), "<a href='http://www.mijireh.com/docs/what-is-page-slurp/'>", "</a>"); ?> |
|
| 6 | 6 | |
| 7 | 7 | <p class='aligncenter'><a href='<?php echo $slurp_action_link?>' id='page_slurp' class='button-primary'>Slurp This Page!</a></p> |
| 8 | 8 | <p class="aligncenter"><a class="nobold" href="https://secure.mijireh.com/checkout/<?php echo $access_key?>" id="view_slurp" target="_new">Preview Checkout Page</a></p> |
@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <div class="updated"> |
| 2 | - <p><?php _e( "Mijireh is currently slurping your content. This will usually take a few minutes. Please login to Mijireh to see the slurp's progress", 'event_espresso' ); ?></p> |
|
| 2 | + <p><?php _e("Mijireh is currently slurping your content. This will usually take a few minutes. Please login to Mijireh to see the slurp's progress", 'event_espresso'); ?></p> |
|
| 3 | 3 | </div> |
| 4 | 4 | \ No newline at end of file |