@@ -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 | /** |
@@ -35,15 +35,15 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function __construct() { |
| 37 | 37 | //define some page related constants |
| 38 | - define( 'EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings' ); |
|
| 39 | - define( 'EE_PAYMENTS_ADMIN_URL', admin_url( 'admin.php?page=' . EE_PAYMENTS_PG_SLUG )); |
|
| 40 | - define( 'EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments' . DS ); |
|
| 41 | - define( 'EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates' . DS ); |
|
| 42 | - define( 'EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/' ); |
|
| 38 | + define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings'); |
|
| 39 | + define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page='.EE_PAYMENTS_PG_SLUG)); |
|
| 40 | + define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES.'payments'.DS); |
|
| 41 | + define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN.'templates'.DS); |
|
| 42 | + define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL.'payments/assets/'); |
|
| 43 | 43 | |
| 44 | 44 | //check that there are active gateways on all admin page loads. but dont do it just yet |
| 45 | 45 | // echo "constructing payments admin page";die; |
| 46 | - add_action('admin_notices',array($this,'check_payment_gateway_setup')); |
|
| 46 | + add_action('admin_notices', array($this, 'check_payment_gateway_setup')); |
|
| 47 | 47 | parent::__construct(); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | protected function _set_menu_map() { |
| 55 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( array( |
|
| 55 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu(array( |
|
| 56 | 56 | 'menu_group' => 'settings', |
| 57 | 57 | 'menu_order' => 30, |
| 58 | 58 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
@@ -68,23 +68,23 @@ discard block |
||
| 68 | 68 | /** |
| 69 | 69 | * Checks that there is at least one active gateway. If not, add a notice |
| 70 | 70 | */ |
| 71 | - public function check_payment_gateway_setup(){ |
|
| 71 | + public function check_payment_gateway_setup() { |
|
| 72 | 72 | //ONLY do this check if models can query |
| 73 | 73 | //and avoid a bug where when we nuke EE4's data that this causes a fatal error |
| 74 | 74 | //because the tables are deleted just before this request runs. see https://events.codebasehq.com/projects/event-espresso/tickets/7539 |
| 75 | 75 | EE_Registry::instance()->load_helper('Activation'); |
| 76 | - if ( ! EE_Maintenance_Mode::instance()->models_can_query() || ! EEH_Activation::table_exists( EEM_Payment_Method::instance()->table() ) ) { |
|
| 76 | + if ( ! EE_Maintenance_Mode::instance()->models_can_query() || ! EEH_Activation::table_exists(EEM_Payment_Method::instance()->table())) { |
|
| 77 | 77 | return; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | // ensure Payment_Method model is loaded |
| 82 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
| 83 | - $actives = EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ); |
|
| 84 | - if( $actives < 1 ){ |
|
| 82 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
| 83 | + $actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart); |
|
| 84 | + if ($actives < 1) { |
|
| 85 | 85 | $url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_PAYMENTS_ADMIN_URL); |
| 86 | 86 | echo '<div class="error"> |
| 87 | - <p>'. sprintf(__("There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", "event_espresso"),"<a href='$url'>","</a>").'</p> |
|
| 87 | + <p>'. sprintf(__("There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", "event_espresso"), "<a href='$url'>", "</a>").'</p> |
|
| 88 | 88 | </div>'; |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -6,8 +6,9 @@ |
||
| 6 | 6 | * @package Event Espresso |
| 7 | 7 | * @subpackage messages |
| 8 | 8 | */ |
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 10 | 10 | exit('NO direct script access allowed'); |
| 11 | +} |
|
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * |
@@ -2,40 +2,40 @@ |
||
| 2 | 2 | <p> |
| 3 | 3 | <?php _e('This page shows all available payment methods for Event Espresso.', 'event_espresso'); ?> |
| 4 | 4 | </p> |
| 5 | -<h3><?php _e('Common Settings', 'event_espresso' )?></h3> |
|
| 5 | +<h3><?php _e('Common Settings', 'event_espresso')?></h3> |
|
| 6 | 6 | <ul> |
| 7 | 7 | <li> |
| 8 | - <strong><?php _e( 'Name', 'event_espresso' );?></strong><br> |
|
| 9 | - <?php _e( 'The name of the payment method as customers see it in the registration form, in emails, in receipts, etc.', 'event_espresso' );?> |
|
| 8 | + <strong><?php _e('Name', 'event_espresso'); ?></strong><br> |
|
| 9 | + <?php _e('The name of the payment method as customers see it in the registration form, in emails, in receipts, etc.', 'event_espresso'); ?> |
|
| 10 | 10 | </li> |
| 11 | 11 | <li> |
| 12 | - <strong><?php _e( 'Description', 'event_espresso' );?></strong><br/> |
|
| 13 | - <?php _e( 'The description of how to use the payment method as customers will see it. This is mostly only seen during registration.', 'event_espresso' );?> |
|
| 12 | + <strong><?php _e('Description', 'event_espresso'); ?></strong><br/> |
|
| 13 | + <?php _e('The description of how to use the payment method as customers will see it. This is mostly only seen during registration.', 'event_espresso'); ?> |
|
| 14 | 14 | </li> |
| 15 | - <li><strong><?php _e( 'Admin-Only Name', 'event_espresso' );?></strong><br/> |
|
| 16 | - <?php _e( 'The name of the payment method as seen internally by site administrators and staff.', 'event_espresso' );?> |
|
| 15 | + <li><strong><?php _e('Admin-Only Name', 'event_espresso'); ?></strong><br/> |
|
| 16 | + <?php _e('The name of the payment method as seen internally by site administrators and staff.', 'event_espresso'); ?> |
|
| 17 | 17 | </li> |
| 18 | 18 | <li> |
| 19 | - <strong><?php _e( 'Admin-Only Description', 'event_espresso' );?></strong><br/> |
|
| 20 | - <?php _e( 'The description of the payment method as seen internally by site administrators and staff.', 'event_espresso' );?> |
|
| 19 | + <strong><?php _e('Admin-Only Description', 'event_espresso'); ?></strong><br/> |
|
| 20 | + <?php _e('The description of the payment method as seen internally by site administrators and staff.', 'event_espresso'); ?> |
|
| 21 | 21 | </li> |
| 22 | 22 | <li> |
| 23 | - <strong><?php _e( 'Debug (sandbox) Mode', 'event_espresso' );?></strong><br/> |
|
| 24 | - <?php _e( 'Many payment methods have a debug/sandbox mode where payments are not processed but are only simulated. This is helpful when setup and debugging.', 'event_espresso' );?> |
|
| 23 | + <strong><?php _e('Debug (sandbox) Mode', 'event_espresso'); ?></strong><br/> |
|
| 24 | + <?php _e('Many payment methods have a debug/sandbox mode where payments are not processed but are only simulated. This is helpful when setup and debugging.', 'event_espresso'); ?> |
|
| 25 | 25 | </li> |
| 26 | 26 | <li> |
| 27 | - <strong><?php _e( 'Open by Default', 'event_espresso' );?></strong><br/> |
|
| 28 | - <?php _e( 'If checked, this payment method will be selected by default (assuming no other valid payment methods are also marked as open by default.)', 'event_espresso' );?> |
|
| 27 | + <strong><?php _e('Open by Default', 'event_espresso'); ?></strong><br/> |
|
| 28 | + <?php _e('If checked, this payment method will be selected by default (assuming no other valid payment methods are also marked as open by default.)', 'event_espresso'); ?> |
|
| 29 | 29 | </li> |
| 30 | 30 | <li> |
| 31 | - <strong><?php _e( 'Button URL', 'event_espresso' );?></strong><br/> |
|
| 32 | - <?php printf( __( 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', 'event_espresso' ), '<img src="' . admin_url('images/media-button-image.gif') . '">' );?> |
|
| 31 | + <strong><?php _e('Button URL', 'event_espresso'); ?></strong><br/> |
|
| 32 | + <?php printf(__('The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', 'event_espresso'), '<img src="'.admin_url('images/media-button-image.gif').'">'); ?> |
|
| 33 | 33 | </li> |
| 34 | - <li><strong><?php _e( 'Usable From', 'event_espresso' );?></strong><br/> |
|
| 35 | - <?php _e( 'Where this payment method can be used from.', 'event_espresso' );?> |
|
| 34 | + <li><strong><?php _e('Usable From', 'event_espresso'); ?></strong><br/> |
|
| 35 | + <?php _e('Where this payment method can be used from.', 'event_espresso'); ?> |
|
| 36 | 36 | <ul> |
| 37 | - <li><?php _e( 'Front-end Registration Page: the payment method will appear as an option during the normal registration process to customers and they can use it to process payments.', 'event_espresso' );?></li> |
|
| 38 | - <li><?php _e( 'Admin Registration Page: when recording payments made from the transaction admin page, the payment method will appear as an option. Note: currently payments can only be RECORDED from the admin, they cannot be PROCESSED.', 'event_espresso' );?></li> |
|
| 37 | + <li><?php _e('Front-end Registration Page: the payment method will appear as an option during the normal registration process to customers and they can use it to process payments.', 'event_espresso'); ?></li> |
|
| 38 | + <li><?php _e('Admin Registration Page: when recording payments made from the transaction admin page, the payment method will appear as an option. Note: currently payments can only be RECORDED from the admin, they cannot be PROCESSED.', 'event_espresso'); ?></li> |
|
| 39 | 39 | </ul> |
| 40 | 40 | </li> |
| 41 | 41 | </ul> |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | <?php _e('Mijireh Gateway', 'event_espresso'); ?> |
| 3 | 3 | </h3> |
| 4 | 4 | <p> |
| 5 | -<?php printf(__('Mijireh is basically a middle-man between Event Espresso and over 90 payment gateways. Most of the configuration occurs on %sMijireh\' website%s, where you configure your Mijireh store with the %spayment gateway of your choice%s.', 'event_espresso'),'<a href="http://www.mijireh.com/">','</a>','<a href="http://www.mijireh.com/docs/payment-gateways/">','</a>'); ?> |
|
| 5 | +<?php printf(__('Mijireh is basically a middle-man between Event Espresso and over 90 payment gateways. Most of the configuration occurs on %sMijireh\' website%s, where you configure your Mijireh store with the %spayment gateway of your choice%s.', 'event_espresso'), '<a href="http://www.mijireh.com/">', '</a>', '<a href="http://www.mijireh.com/docs/payment-gateways/">', '</a>'); ?> |
|
| 6 | 6 | </p> |
| 7 | 7 | <h3><?php _e('Mijireh Checkout Page Design', 'event_espresso'); ?></h3> |
| 8 | 8 | <p> |
| 9 | -<?php _e("As you're probably aware, when users pay with Mijireh Gateway, they are taken to a secure offsite page, hosted by Mijireh. This page can easily be made to have the look-and-feel of your website through a process called 'slurping', where Mijireh 'slurps' up your website's design and uses it on their checkout page. ", 'event_espresso');?> |
|
| 10 | -<?php printf(__("In order to do this, we automatically create a new WordPress page which is design to be slurped by Mijireh. You can customize the page like any other, but the page must contain Mijireh's special '{{mijireh-checkout-form}}' shortcode. Once you have finished designing the page, publish it, and %s then click the special 'slurp now' button%s. Mijireh may take several minutes to slurp the page. Once Mijireh is finished slurping, you can delete the page, or mark it as a draft. ", 'event_espresso'),'<a href="https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMdjREYUtGM18wSms/edit?usp=drivesdk">','</a>');?> |
|
| 9 | +<?php _e("As you're probably aware, when users pay with Mijireh Gateway, they are taken to a secure offsite page, hosted by Mijireh. This page can easily be made to have the look-and-feel of your website through a process called 'slurping', where Mijireh 'slurps' up your website's design and uses it on their checkout page. ", 'event_espresso'); ?> |
|
| 10 | +<?php printf(__("In order to do this, we automatically create a new WordPress page which is design to be slurped by Mijireh. You can customize the page like any other, but the page must contain Mijireh's special '{{mijireh-checkout-form}}' shortcode. Once you have finished designing the page, publish it, and %s then click the special 'slurp now' button%s. Mijireh may take several minutes to slurp the page. Once Mijireh is finished slurping, you can delete the page, or mark it as a draft. ", 'event_espresso'), '<a href="https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMdjREYUtGM18wSms/edit?usp=drivesdk">', '</a>'); ?> |
|
| 11 | 11 | </p> |
| 12 | 12 | \ No newline at end of file |
@@ -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 | /** |
@@ -68,21 +68,21 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | protected function _start() { |
| 71 | - $content = '<h3>' . __('Payment Methods', 'event_espresso') . '</h3>'; |
|
| 72 | - $content .= '<p>' . __('This tour of the Payment Methods page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>'; |
|
| 71 | + $content = '<h3>'.__('Payment Methods', 'event_espresso').'</h3>'; |
|
| 72 | + $content .= '<p>'.__('This tour of the Payment Methods page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>'; |
|
| 73 | 73 | return $content; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | protected function _gateway_links_stop() { |
| 77 | - return '<p>' . __('Available payment methods are shown here. Clicking on a payment method will provide you with an option to activate that payment gateway.', 'event_espresso') . '</p>'; |
|
| 77 | + return '<p>'.__('Available payment methods are shown here. Clicking on a payment method will provide you with an option to activate that payment gateway.', 'event_espresso').'</p>'; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | protected function _gateway_settings_metabox_stop() { |
| 81 | - return '<p>' . __('A payment gateway must first be enabled. You will then be able to configure the payment gateway. Be sure to save settings after configuring your payment gateway.', 'event_espresso') . '</p>'; |
|
| 81 | + return '<p>'.__('A payment gateway must first be enabled. You will then be able to configure the payment gateway. Be sure to save settings after configuring your payment gateway.', 'event_espresso').'</p>'; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | protected function _end_tour_stop() { |
| 85 | - return '<p>' . __('After configuring your payment gateway, go to the Event Editor to create your first event with Event Espresso.', 'event_espresso') . '</p>'; |
|
| 85 | + return '<p>'.__('After configuring your payment gateway, go to the Event Editor to create your first event with Event Espresso.', 'event_espresso').'</p>'; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | } |
| 89 | 89 | \ No newline at end of file |
@@ -6,8 +6,9 @@ |
||
| 6 | 6 | * @package Event Espresso |
| 7 | 7 | * @subpackage messages |
| 8 | 8 | */ |
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 10 | 10 | exit('NO direct script access allowed'); |
| 11 | +} |
|
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * |
@@ -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 | /** |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | protected function _start() { |
| 56 | - $content = '<h3>' . __('Payment Settings', 'event_espresso') . '</h3>'; |
|
| 57 | - $content .= '<p>' . __('This tour of the Payment Settings page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>'; |
|
| 56 | + $content = '<h3>'.__('Payment Settings', 'event_espresso').'</h3>'; |
|
| 57 | + $content .= '<p>'.__('This tour of the Payment Settings page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>'; |
|
| 58 | 58 | return $content; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | protected function _show_pending_options_stop() { |
| 62 | - return '<p>' . __('Specify whether to provide your registrants with the option to retry payments.', 'event_espresso') . '</p>'; |
|
| 62 | + return '<p>'.__('Specify whether to provide your registrants with the option to retry payments.', 'event_espresso').'</p>'; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | \ No newline at end of file |
@@ -6,8 +6,9 @@ |
||
| 6 | 6 | * @package Event Espresso |
| 7 | 7 | * @subpackage messages |
| 8 | 8 | */ |
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 10 | 10 | exit('NO direct script access allowed'); |
| 11 | +} |
|
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * |
@@ -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 | - * payment_log_details |
|
| 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 | + * payment_log_details |
|
| 20 | + * |
|
| 21 | + * @package Event Espresso |
|
| 22 | + * @subpackage |
|
| 23 | + * @author Mike Nelson |
|
| 24 | + * |
|
| 25 | + * ------------------------------------------------------------------------ |
|
| 26 | + */ |
|
| 27 | 27 | /*@var EE_Change_Log $payment_Log */ |
| 28 | 28 | /*@var EE_Payment_Method $payment_Method*/ |
| 29 | 29 | /*@var EE_Transaction $transaction*/ |
@@ -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 |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | </label> |
| 62 | 62 | </th> |
| 63 | 63 | <td> |
| 64 | - <?php echo $transaction ? $transaction->ID() : __("Could not be determined", 'event_espresso');?> |
|
| 64 | + <?php echo $transaction ? $transaction->ID() : __("Could not be determined", 'event_espresso'); ?> |
|
| 65 | 65 | |
| 66 | 66 | </td> |
| 67 | 67 | </tr> |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | </label> |
| 73 | 73 | </th> |
| 74 | 74 | <td> |
| 75 | - <?php echo $payment_log->e('LOG_message','as_table');//EEH_Template::layout_array_as_table($payment_log->content())?> |
|
| 75 | + <?php echo $payment_log->e('LOG_message', 'as_table'); //EEH_Template::layout_array_as_table($payment_log->content())?> |
|
| 76 | 76 | </td> |
| 77 | 77 | </tr> |
| 78 | 78 | </tbody> |
@@ -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 | * |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | <td> |
| 15 | 15 | |
| 16 | 16 | <a id="activate_<?php echo $payment_method->slug()?>" class="espresso-button-green button-primary" href="<?php echo $activate_url?>"> |
| 17 | - <?php printf(__("Activate %s Payment Method?", "event_espresso"),$payment_method->admin_name()); ?> |
|
| 17 | + <?php printf(__("Activate %s Payment Method?", "event_espresso"), $payment_method->admin_name()); ?> |
|
| 18 | 18 | </a> |
| 19 | 19 | </td> |
| 20 | 20 | </tr> |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | </label> |
| 10 | 10 | </th> |
| 11 | 11 | <td> |
| 12 | - <?php echo EEH_Form_Fields::select_input('show_pending_payment_options', $values, $show_pending_payment_options ); ?> |
|
| 12 | + <?php echo EEH_Form_Fields::select_input('show_pending_payment_options', $values, $show_pending_payment_options); ?> |
|
| 13 | 13 | |
| 14 | 14 | </td> |
| 15 | 15 | </tr> |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | ), |
| 140 | 140 | 'list_table' => 'Registration_Form_Questions_Admin_List_Table', |
| 141 | 141 | 'metaboxes' => $this->_default_espresso_metaboxes, |
| 142 | - 'help_tabs' => array( |
|
| 142 | + 'help_tabs' => array( |
|
| 143 | 143 | 'registration_form_questions_overview_help_tab' => array( |
| 144 | 144 | 'title' => __('Questions Overview', 'event_espresso'), |
| 145 | 145 | 'filename' => 'registration_form_questions_overview' |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | 'filename' => 'registration_form_edit_question' |
| 191 | 191 | ), |
| 192 | 192 | ), |
| 193 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
| 193 | + 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
| 194 | 194 | 'require_nonce' => FALSE |
| 195 | 195 | ), |
| 196 | 196 | ); |
@@ -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 | /** |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | |
| 61 | - public function __construct( $routing = TRUE ) { |
|
| 62 | - require_once( EE_MODELS . 'EEM_Question.model.php' ); |
|
| 63 | - require_once( EE_MODELS . 'EEM_Question_Group.model.php' ); |
|
| 64 | - $this->_question_model= EEM_Question::instance(); |
|
| 65 | - $this->_question_group_model=EEM_Question_Group::instance(); |
|
| 66 | - parent::__construct( $routing ); |
|
| 61 | + public function __construct($routing = TRUE) { |
|
| 62 | + require_once(EE_MODELS.'EEM_Question.model.php'); |
|
| 63 | + require_once(EE_MODELS.'EEM_Question_Group.model.php'); |
|
| 64 | + $this->_question_model = EEM_Question::instance(); |
|
| 65 | + $this->_question_group_model = EEM_Question_Group::instance(); |
|
| 66 | + parent::__construct($routing); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | protected function _set_page_routes() { |
| 100 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
| 100 | + $qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
| 101 | 101 | $this->_page_routes = array( |
| 102 | 102 | 'default' => array( |
| 103 | 103 | 'func' => '_questions_overview_list_table', |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | 'update_question' => array( |
| 120 | 120 | 'func' => '_insert_or_update_question', |
| 121 | - 'args' => array('new_question' => FALSE ), |
|
| 121 | + 'args' => array('new_question' => FALSE), |
|
| 122 | 122 | 'capability' => 'ee_edit_question', |
| 123 | 123 | 'obj_id' => $qst_id, |
| 124 | 124 | 'noheader' => TRUE, |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | 'filename' => 'registration_form_questions_overview_views_bulk_actions_search' |
| 154 | 154 | ) |
| 155 | 155 | ), |
| 156 | - 'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'), |
|
| 156 | + 'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'), |
|
| 157 | 157 | 'require_nonce' => FALSE, |
| 158 | 158 | 'qtips' => array( |
| 159 | 159 | 'EE_Registration_Form_Tips' |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | 'filename' => 'registration_form_question_groups' |
| 173 | 173 | ), |
| 174 | 174 | ), |
| 175 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
| 175 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
| 176 | 176 | 'require_nonce' => FALSE |
| 177 | 177 | ), |
| 178 | 178 | |
@@ -181,16 +181,16 @@ discard block |
||
| 181 | 181 | 'label' => __('Edit Question', 'event_espresso'), |
| 182 | 182 | 'order' => 15, |
| 183 | 183 | 'persistent' => FALSE, |
| 184 | - 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
| 184 | + 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
| 185 | 185 | ), |
| 186 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
| 186 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 187 | 187 | 'help_tabs' => array( |
| 188 | 188 | 'registration_form_edit_question_group_help_tab' => array( |
| 189 | 189 | 'title' => __('Edit Question', 'event_espresso'), |
| 190 | 190 | 'filename' => 'registration_form_edit_question' |
| 191 | 191 | ), |
| 192 | 192 | ), |
| 193 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
| 193 | + 'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'), |
|
| 194 | 194 | 'require_nonce' => FALSE |
| 195 | 195 | ), |
| 196 | 196 | ); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | //none of the below group are currently used for Event Categories |
| 219 | 219 | protected function _add_feature_pointers() {} |
| 220 | 220 | public function load_scripts_styles() { |
| 221 | - wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
| 221 | + wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
| 222 | 222 | wp_enqueue_style('espresso_registration'); |
| 223 | 223 | } |
| 224 | 224 | public function admin_init() {} |
@@ -234,20 +234,20 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | public function load_scripts_styles_add_question() { |
| 236 | 236 | $this->load_scripts_styles_forms(); |
| 237 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 238 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
| 237 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 238 | + wp_enqueue_script('espresso_registration_form_single'); |
|
| 239 | 239 | } |
| 240 | 240 | public function load_scripts_styles_edit_question() { |
| 241 | 241 | $this->load_scripts_styles_forms(); |
| 242 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 243 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
| 242 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 243 | + wp_enqueue_script('espresso_registration_form_single'); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
| 247 | 247 | |
| 248 | 248 | |
| 249 | 249 | public function recaptcha_info_help_tab() { |
| 250 | - $template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php'; |
|
| 250 | + $template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php'; |
|
| 251 | 251 | EEH_Template::display_template($template, array()); |
| 252 | 252 | } |
| 253 | 253 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | ) |
| 280 | 280 | ); |
| 281 | 281 | |
| 282 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
| 282 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
| 283 | 283 | $this->_views['trash'] = array( |
| 284 | 284 | 'slug' => 'trash', |
| 285 | 285 | 'label' => __('Trash', 'event_espresso'), |
@@ -297,9 +297,9 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | protected function _questions_groups_preview() { |
| 299 | 299 | $this->_admin_page_title = __('Question Groups (Preview)', 'event_espresso'); |
| 300 | - $this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="' . esc_attr__( 'Preview Question Groups Overview List Table screenshot', 'event_espresso' ) . '" />'; |
|
| 301 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso' ).'</strong>'; |
|
| 302 | - $this->display_admin_caf_preview_page( 'question_groups_tab' ); |
|
| 300 | + $this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'.esc_attr__('Preview Question Groups Overview List Table screenshot', 'event_espresso').'" />'; |
|
| 301 | + $this->_template_args['preview_text'] = '<strong>'.__('Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso').'</strong>'; |
|
| 302 | + $this->display_admin_caf_preview_page('question_groups_tab'); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | |
@@ -308,41 +308,41 @@ discard block |
||
| 308 | 308 | * Extracts the question field's values from the POST request to update or insert them |
| 309 | 309 | * @return array where each key is the name of a model's field/db column, and each value is its value. |
| 310 | 310 | */ |
| 311 | - protected function _set_column_values_for(EEM_Base $model){ |
|
| 312 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 313 | - $set_column_values=array(); |
|
| 311 | + protected function _set_column_values_for(EEM_Base $model) { |
|
| 312 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 313 | + $set_column_values = array(); |
|
| 314 | 314 | |
| 315 | 315 | //some initial checks for proper values. |
| 316 | 316 | //if QST_admin_only, then no matter what QST_required is we disable. |
| 317 | - if ( !empty( $this->_req_data['QST_admin_only'] ) ) { |
|
| 317 | + if ( ! empty($this->_req_data['QST_admin_only'])) { |
|
| 318 | 318 | $this->_req_data['QST_required'] = 0; |
| 319 | 319 | } |
| 320 | - foreach($model->field_settings() as $fieldName=>$settings){ |
|
| 320 | + foreach ($model->field_settings() as $fieldName=>$settings) { |
|
| 321 | 321 | // basically if QSG_identifier is empty or not set |
| 322 | - if ( $fieldName == 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) { |
|
| 323 | - $QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ; |
|
| 324 | - $set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid(); |
|
| 322 | + if ($fieldName == 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) { |
|
| 323 | + $QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : ''; |
|
| 324 | + $set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid(); |
|
| 325 | 325 | // dd($set_column_values); |
| 326 | 326 | } |
| 327 | 327 | //if the admin label is blank, use a slug version of the question text |
| 328 | - else if ( $fieldName == 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
|
| 329 | - $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
|
| 330 | - $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
|
| 328 | + else if ($fieldName == 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) { |
|
| 329 | + $QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : ''; |
|
| 330 | + $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10)); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | |
| 334 | - else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
| 334 | + else if ($fieldName == 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) { |
|
| 335 | 335 | $set_column_values[$fieldName] = 0; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | |
| 339 | 339 | //only add a property to the array if it's not null (otherwise the model should just use the default value) |
| 340 | - else if(isset($this->_req_data[$fieldName])){ |
|
| 341 | - $set_column_values[$fieldName]=$this->_req_data[$fieldName]; |
|
| 340 | + else if (isset($this->_req_data[$fieldName])) { |
|
| 341 | + $set_column_values[$fieldName] = $this->_req_data[$fieldName]; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | } |
| 345 | - return $set_column_values;//validation fo this data to be performed by the model before insertion. |
|
| 345 | + return $set_column_values; //validation fo this data to be performed by the model before insertion. |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | |
@@ -355,29 +355,29 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | |
| 357 | 357 | |
| 358 | - protected function _edit_question( $action= 'add' ) { |
|
| 359 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 360 | - $ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE; |
|
| 358 | + protected function _edit_question($action = 'add') { |
|
| 359 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 360 | + $ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE; |
|
| 361 | 361 | |
| 362 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
| 362 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
| 363 | 363 | // add PRC_ID to title if editing |
| 364 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
| 365 | - if($ID){ |
|
| 366 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
| 367 | - $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
| 364 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
| 365 | + if ($ID) { |
|
| 366 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
| 367 | + $additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
| 368 | 368 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
| 369 | - }else{ |
|
| 370 | - $question= EE_Question::new_instance(); |
|
| 369 | + } else { |
|
| 370 | + $question = EE_Question::new_instance(); |
|
| 371 | 371 | $question->set_order_to_latest(); |
| 372 | 372 | $this->_set_add_edit_form_tags('insert_question'); |
| 373 | 373 | } |
| 374 | - $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types(); |
|
| 375 | - $this->_template_args['QST_ID']=$ID; |
|
| 376 | - $this->_template_args['question']=$question; |
|
| 377 | - $this->_template_args['question_types']= $question_types;; |
|
| 374 | + $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types(); |
|
| 375 | + $this->_template_args['QST_ID'] = $ID; |
|
| 376 | + $this->_template_args['question'] = $question; |
|
| 377 | + $this->_template_args['question_types'] = $question_types; ; |
|
| 378 | 378 | |
| 379 | - $this->_set_publish_post_box_vars( 'id', $ID ); |
|
| 380 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
| 379 | + $this->_set_publish_post_box_vars('id', $ID); |
|
| 380 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE); |
|
| 381 | 381 | |
| 382 | 382 | // the details template wrapper |
| 383 | 383 | $this->display_admin_page_with_sidebar(); |
@@ -395,58 +395,58 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | |
| 397 | 397 | protected function _insert_or_update_question($new_question = TRUE) { |
| 398 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 399 | - $success=0; |
|
| 400 | - $set_column_values=$this->_set_column_values_for($this->_question_model); |
|
| 401 | - if($new_question){ |
|
| 402 | - $new_id=$this->_question_model->insert($set_column_values); |
|
| 403 | - if($new_id){ |
|
| 404 | - $success=1; |
|
| 405 | - $ID=$new_id; |
|
| 406 | - }else{ |
|
| 398 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 399 | + $success = 0; |
|
| 400 | + $set_column_values = $this->_set_column_values_for($this->_question_model); |
|
| 401 | + if ($new_question) { |
|
| 402 | + $new_id = $this->_question_model->insert($set_column_values); |
|
| 403 | + if ($new_id) { |
|
| 404 | + $success = 1; |
|
| 405 | + $ID = $new_id; |
|
| 406 | + } else { |
|
| 407 | 407 | $success = false; |
| 408 | 408 | } |
| 409 | - }else{ |
|
| 410 | - $ID=absint($this->_req_data['QST_ID']); |
|
| 411 | - $pk=$this->_question_model->primary_key_name(); |
|
| 412 | - $wheres=array($pk=>$ID); |
|
| 409 | + } else { |
|
| 410 | + $ID = absint($this->_req_data['QST_ID']); |
|
| 411 | + $pk = $this->_question_model->primary_key_name(); |
|
| 412 | + $wheres = array($pk=>$ID); |
|
| 413 | 413 | unset($set_column_values[$pk]); |
| 414 | - $success= $this->_question_model->update($set_column_values,array($wheres)); |
|
| 415 | - $action_desc='updated'; |
|
| 414 | + $success = $this->_question_model->update($set_column_values, array($wheres)); |
|
| 415 | + $action_desc = 'updated'; |
|
| 416 | 416 | } |
| 417 | - if ($ID){ |
|
| 417 | + if ($ID) { |
|
| 418 | 418 | //save the related options |
| 419 | 419 | //trash removed options, save old ones |
| 420 | 420 | //get list of all options |
| 421 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
| 422 | - $options=$question->options(); |
|
| 423 | - if(! empty($options)){ |
|
| 424 | - foreach($options as $option_ID=>$option){ |
|
| 425 | - $option_req_index=$this->_get_option_req_data_index($option_ID); |
|
| 426 | - if($option_req_index!==FALSE){ |
|
| 421 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
| 422 | + $options = $question->options(); |
|
| 423 | + if ( ! empty($options)) { |
|
| 424 | + foreach ($options as $option_ID=>$option) { |
|
| 425 | + $option_req_index = $this->_get_option_req_data_index($option_ID); |
|
| 426 | + if ($option_req_index !== FALSE) { |
|
| 427 | 427 | $option->save($this->_req_data['question_options'][$option_req_index]); |
| 428 | - }else{ |
|
| 428 | + } else { |
|
| 429 | 429 | //not found, remove it |
| 430 | 430 | $option->delete(); |
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | //save new related options |
| 435 | - foreach($this->_req_data['question_options'] as $index=>$option_req_data){ |
|
| 436 | - if( empty($option_req_data['QSO_ID'] ) && ( ( isset( $option_req_data['QSO_value'] ) && $option_req_data['QSO_value'] !== '' ) || ! empty( $option_req_data['QSO_desc'] ) ) ) {//no ID! save it! |
|
| 437 | - if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === '' ){ |
|
| 438 | - $option_req_data['QSO_value']=$option_req_data['QSO_desc']; |
|
| 435 | + foreach ($this->_req_data['question_options'] as $index=>$option_req_data) { |
|
| 436 | + if (empty($option_req_data['QSO_ID']) && ((isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '') || ! empty($option_req_data['QSO_desc']))) {//no ID! save it! |
|
| 437 | + if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') { |
|
| 438 | + $option_req_data['QSO_value'] = $option_req_data['QSO_desc']; |
|
| 439 | 439 | } |
| 440 | - $new_option=EE_Question_Option::new_instance( array( 'QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
| 440 | + $new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
| 441 | 441 | $new_option->save(); |
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | - $query_args=array('action'=>'edit_question','QST_ID'=>$question->ID()); |
|
| 445 | + $query_args = array('action'=>'edit_question', 'QST_ID'=>$question->ID()); |
|
| 446 | 446 | |
| 447 | - if ( $success !== FALSE ) { |
|
| 448 | - $msg = $new_question ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() ); |
|
| 449 | - EE_Error::add_success( $msg ); |
|
| 447 | + if ($success !== FALSE) { |
|
| 448 | + $msg = $new_question ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name()); |
|
| 449 | + EE_Error::add_success($msg); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
@@ -462,10 +462,10 @@ discard block |
||
| 462 | 462 | * @param int $ID of the question option to find |
| 463 | 463 | * @return int indexin in question_options array if successful, FALSE if unsuccessful |
| 464 | 464 | */ |
| 465 | - protected function _get_option_req_data_index($ID){ |
|
| 466 | - $req_data_for_question_options=$this->_req_data['question_options']; |
|
| 467 | - foreach($req_data_for_question_options as $num=>$option_data){ |
|
| 468 | - if(array_key_exists('QSO_ID',$option_data) && intval($option_data['QSO_ID'])==$ID){ |
|
| 465 | + protected function _get_option_req_data_index($ID) { |
|
| 466 | + $req_data_for_question_options = $this->_req_data['question_options']; |
|
| 467 | + foreach ($req_data_for_question_options as $num=>$option_data) { |
|
| 468 | + if (array_key_exists('QSO_ID', $option_data) && intval($option_data['QSO_ID']) == $ID) { |
|
| 469 | 469 | return $num; |
| 470 | 470 | } |
| 471 | 471 | } |
@@ -486,25 +486,25 @@ discard block |
||
| 486 | 486 | * @param EEM_Base $model either EEM_Question or EEM_Question_Group |
| 487 | 487 | * @return array lik EEM_Base::get_all's $query_params parameter |
| 488 | 488 | */ |
| 489 | - protected function get_query_params($model, $per_page=10,$current_page=10){ |
|
| 489 | + protected function get_query_params($model, $per_page = 10, $current_page = 10) { |
|
| 490 | 490 | $query_params = array(); |
| 491 | - $offset=($current_page-1)*$per_page; |
|
| 492 | - $query_params['limit']=array($offset,$per_page); |
|
| 493 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
| 491 | + $offset = ($current_page - 1) * $per_page; |
|
| 492 | + $query_params['limit'] = array($offset, $per_page); |
|
| 493 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
| 494 | 494 | $orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order'; |
| 495 | 495 | $field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby']; |
| 496 | - $query_params['order_by']=array( $field_to_order_by => $order ); |
|
| 497 | - $search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null; |
|
| 498 | - if(! empty($search_string)){ |
|
| 499 | - if($model instanceof EEM_Question_Group){ |
|
| 500 | - $query_params[0]=array( |
|
| 496 | + $query_params['order_by'] = array($field_to_order_by => $order); |
|
| 497 | + $search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null; |
|
| 498 | + if ( ! empty($search_string)) { |
|
| 499 | + if ($model instanceof EEM_Question_Group) { |
|
| 500 | + $query_params[0] = array( |
|
| 501 | 501 | 'OR'=>array( |
| 502 | - 'QSG_name'=>array('LIKE',"%$search_string%"), |
|
| 503 | - 'QSG_desc'=>array('LIKE',"%$search_string%")) |
|
| 502 | + 'QSG_name'=>array('LIKE', "%$search_string%"), |
|
| 503 | + 'QSG_desc'=>array('LIKE', "%$search_string%")) |
|
| 504 | 504 | ); |
| 505 | - }else{ |
|
| 506 | - $query_params[0]=array( |
|
| 507 | - 'QST_display_text'=>array('LIKE',"%$search_string%") |
|
| 505 | + } else { |
|
| 506 | + $query_params[0] = array( |
|
| 507 | + 'QST_display_text'=>array('LIKE', "%$search_string%") |
|
| 508 | 508 | ); |
| 509 | 509 | } |
| 510 | 510 | } |
@@ -546,13 +546,13 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | |
| 548 | 548 | |
| 549 | - public function get_questions( $per_page=10,$current_page = 1, $count = FALSE ) { |
|
| 549 | + public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) { |
|
| 550 | 550 | $QST = EEM_Question::instance(); |
| 551 | 551 | $query_params = $this->get_query_params($QST, $per_page, $current_page); |
| 552 | - if ($count){ |
|
| 553 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
| 552 | + if ($count) { |
|
| 553 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
| 554 | 554 | $results = $QST->count($where); |
| 555 | - }else{ |
|
| 555 | + } else { |
|
| 556 | 556 | $results = $QST->get_all($query_params); |
| 557 | 557 | } |
| 558 | 558 | return $results; |
@@ -561,19 +561,19 @@ discard block |
||
| 561 | 561 | |
| 562 | 562 | |
| 563 | 563 | |
| 564 | - public function get_trashed_questions( $per_page,$current_page = 1, $count = FALSE ) { |
|
| 565 | - $query_params=$this->get_query_params(EEM_Question::instance(),$per_page,$current_page); |
|
| 566 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
| 567 | - $questions=$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
| 564 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
| 565 | + $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
|
| 566 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
| 567 | + $questions = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
| 568 | 568 | return $questions; |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | |
| 572 | 572 | |
| 573 | - public function get_question_groups( $per_page,$current_page = 1, $count = FALSE ) { |
|
| 574 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
| 575 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page,$count); |
|
| 576 | - $questionGroups=$questionGroupModel->get_all($query_params);//note: this a subclass of EEM_Soft_Delete_Base, so thsi is actually only getting nontrashed items |
|
| 573 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
| 574 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
| 575 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page, $count); |
|
| 576 | + $questionGroups = $questionGroupModel->get_all($query_params); //note: this a subclass of EEM_Soft_Delete_Base, so thsi is actually only getting nontrashed items |
|
| 577 | 577 | return $questionGroups; |
| 578 | 578 | } |
| 579 | 579 | |
@@ -590,36 +590,36 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | $this->_template_args['values'] = $this->_yes_no_values; |
| 592 | 592 | |
| 593 | - $this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
| 594 | - $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': ''; |
|
| 593 | + $this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE; |
|
| 594 | + $this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : ''; |
|
| 595 | 595 | |
| 596 | - $this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''; |
|
| 597 | - $this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''; |
|
| 598 | - $this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500; |
|
| 596 | + $this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''; |
|
| 597 | + $this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''; |
|
| 598 | + $this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500; |
|
| 599 | 599 | |
| 600 | 600 | $this->_template_args['recaptcha_theme_options'] = array( |
| 601 | - array('id' => 'red','text'=> __('Red', 'event_espresso')), |
|
| 602 | - array('id' => 'white','text'=> __('White', 'event_espresso')), |
|
| 603 | - array('id' => 'blackglass','text'=> __('Blackglass', 'event_espresso')), |
|
| 604 | - array('id' => 'clean','text'=> __('Clean', 'event_espresso')) |
|
| 601 | + array('id' => 'red', 'text'=> __('Red', 'event_espresso')), |
|
| 602 | + array('id' => 'white', 'text'=> __('White', 'event_espresso')), |
|
| 603 | + array('id' => 'blackglass', 'text'=> __('Blackglass', 'event_espresso')), |
|
| 604 | + array('id' => 'clean', 'text'=> __('Clean', 'event_espresso')) |
|
| 605 | 605 | ); |
| 606 | - $this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->display_nice( 'recaptcha_theme' ) : 'clean'; |
|
| 606 | + $this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->display_nice('recaptcha_theme') : 'clean'; |
|
| 607 | 607 | |
| 608 | 608 | $this->_template_args['recaptcha_language_options'] = array( |
| 609 | - array('id' => 'en','text'=> __('English', 'event_espresso')), |
|
| 610 | - array('id' => 'es','text'=> __('Spanish', 'event_espresso')), |
|
| 611 | - array('id' => 'nl','text'=> __('Dutch', 'event_espresso')), |
|
| 612 | - array('id' => 'fr','text'=> __('French', 'event_espresso')), |
|
| 613 | - array('id' => 'de','text'=> __('German', 'event_espresso')), |
|
| 614 | - array('id' => 'pt','text'=> __('Portuguese', 'event_espresso')), |
|
| 615 | - array('id' => 'ru','text'=> __('Russian', 'event_espresso')), |
|
| 616 | - array('id' => 'tr','text'=> __('Turkish', 'event_espresso')) |
|
| 609 | + array('id' => 'en', 'text'=> __('English', 'event_espresso')), |
|
| 610 | + array('id' => 'es', 'text'=> __('Spanish', 'event_espresso')), |
|
| 611 | + array('id' => 'nl', 'text'=> __('Dutch', 'event_espresso')), |
|
| 612 | + array('id' => 'fr', 'text'=> __('French', 'event_espresso')), |
|
| 613 | + array('id' => 'de', 'text'=> __('German', 'event_espresso')), |
|
| 614 | + array('id' => 'pt', 'text'=> __('Portuguese', 'event_espresso')), |
|
| 615 | + array('id' => 'ru', 'text'=> __('Russian', 'event_espresso')), |
|
| 616 | + array('id' => 'tr', 'text'=> __('Turkish', 'event_espresso')) |
|
| 617 | 617 | ); |
| 618 | - $this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
| 618 | + $this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'; |
|
| 619 | 619 | |
| 620 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
| 621 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 622 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE ); |
|
| 620 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
| 621 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
| 622 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE); |
|
| 623 | 623 | $this->display_admin_page_with_sidebar(); |
| 624 | 624 | } |
| 625 | 625 | |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -328,10 +329,7 @@ discard block |
||
| 328 | 329 | else if ( $fieldName == 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
| 329 | 330 | $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
| 330 | 331 | $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
| 331 | - } |
|
| 332 | - |
|
| 333 | - |
|
| 334 | - else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
| 332 | + } else if ( $fieldName == 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
| 335 | 333 | $set_column_values[$fieldName] = 0; |
| 336 | 334 | } |
| 337 | 335 | |
@@ -366,7 +364,7 @@ discard block |
||
| 366 | 364 | $question=$this->_question_model->get_one_by_ID($ID); |
| 367 | 365 | $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
| 368 | 366 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
| 369 | - }else{ |
|
| 367 | + } else{ |
|
| 370 | 368 | $question= EE_Question::new_instance(); |
| 371 | 369 | $question->set_order_to_latest(); |
| 372 | 370 | $this->_set_add_edit_form_tags('insert_question'); |
@@ -403,10 +401,10 @@ discard block |
||
| 403 | 401 | if($new_id){ |
| 404 | 402 | $success=1; |
| 405 | 403 | $ID=$new_id; |
| 406 | - }else{ |
|
| 404 | + } else{ |
|
| 407 | 405 | $success = false; |
| 408 | 406 | } |
| 409 | - }else{ |
|
| 407 | + } else{ |
|
| 410 | 408 | $ID=absint($this->_req_data['QST_ID']); |
| 411 | 409 | $pk=$this->_question_model->primary_key_name(); |
| 412 | 410 | $wheres=array($pk=>$ID); |
@@ -425,7 +423,7 @@ discard block |
||
| 425 | 423 | $option_req_index=$this->_get_option_req_data_index($option_ID); |
| 426 | 424 | if($option_req_index!==FALSE){ |
| 427 | 425 | $option->save($this->_req_data['question_options'][$option_req_index]); |
| 428 | - }else{ |
|
| 426 | + } else{ |
|
| 429 | 427 | //not found, remove it |
| 430 | 428 | $option->delete(); |
| 431 | 429 | } |
@@ -502,7 +500,7 @@ discard block |
||
| 502 | 500 | 'QSG_name'=>array('LIKE',"%$search_string%"), |
| 503 | 501 | 'QSG_desc'=>array('LIKE',"%$search_string%")) |
| 504 | 502 | ); |
| 505 | - }else{ |
|
| 503 | + } else{ |
|
| 506 | 504 | $query_params[0]=array( |
| 507 | 505 | 'QST_display_text'=>array('LIKE',"%$search_string%") |
| 508 | 506 | ); |
@@ -552,7 +550,7 @@ discard block |
||
| 552 | 550 | if ($count){ |
| 553 | 551 | $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
| 554 | 552 | $results = $QST->count($where); |
| 555 | - }else{ |
|
| 553 | + } else{ |
|
| 556 | 554 | $results = $QST->get_all($query_params); |
| 557 | 555 | } |
| 558 | 556 | return $results; |