@@ -11,42 +11,42 @@  | 
                                                    ||
| 11 | 11 | class EE_CVV_Input extends EE_Text_Input  | 
                                                        
| 12 | 12 |  { | 
                                                        
| 13 | 13 | |
| 14 | - /**  | 
                                                        |
| 15 | -     * @param array $input_settings { | 
                                                        |
| 16 | - * @type boolean $include_whats_this_link defaults to true  | 
                                                        |
| 17 | - * }  | 
                                                        |
| 18 | - */  | 
                                                        |
| 19 | - public function __construct($input_settings = array())  | 
                                                        |
| 20 | -    { | 
                                                        |
| 21 | - $this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal());  | 
                                                        |
| 22 | - $this->_add_validation_strategy(  | 
                                                        |
| 23 | - new EE_Text_Validation_Strategy(  | 
                                                        |
| 24 | - isset($input_settings['validation_error_message'])  | 
                                                        |
| 25 | - ? $input_settings['validation_error_message']  | 
                                                        |
| 26 | - : esc_html__(  | 
                                                        |
| 27 | - 'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front',  | 
                                                        |
| 28 | - 'event_espresso'  | 
                                                        |
| 29 | - ),  | 
                                                        |
| 30 | -                '~^\d{3,4}$~' | 
                                                        |
| 31 | - )  | 
                                                        |
| 32 | - );  | 
                                                        |
| 33 | - parent::__construct($input_settings);  | 
                                                        |
| 34 | - if (! isset($input_settings['include_whats_this_link'])  | 
                                                        |
| 35 | - || (  | 
                                                        |
| 36 | - isset($input_settings['include_whats_this_link'])  | 
                                                        |
| 37 | - && $input_settings['include_whats_this_link'] === true  | 
                                                        |
| 38 | - )  | 
                                                        |
| 39 | -        ) { | 
                                                        |
| 40 | - $this->_html_label_text = sprintf(  | 
                                                        |
| 41 | - esc_html_x(  | 
                                                        |
| 42 | - '%1$s %2$s(What\'s this?)%3$s',  | 
                                                        |
| 43 | - 'CVV (What\'s this?)',  | 
                                                        |
| 44 | - 'event_espresso'  | 
                                                        |
| 45 | - ),  | 
                                                        |
| 46 | - $this->_html_label_text,  | 
                                                        |
| 47 | - '<a href="https://www.cvvnumber.com/" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 48 | - '</a>'  | 
                                                        |
| 49 | - );  | 
                                                        |
| 50 | - }  | 
                                                        |
| 51 | - }  | 
                                                        |
| 14 | + /**  | 
                                                        |
| 15 | +	 * @param array $input_settings { | 
                                                        |
| 16 | + * @type boolean $include_whats_this_link defaults to true  | 
                                                        |
| 17 | + * }  | 
                                                        |
| 18 | + */  | 
                                                        |
| 19 | + public function __construct($input_settings = array())  | 
                                                        |
| 20 | +	{ | 
                                                        |
| 21 | + $this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal());  | 
                                                        |
| 22 | + $this->_add_validation_strategy(  | 
                                                        |
| 23 | + new EE_Text_Validation_Strategy(  | 
                                                        |
| 24 | + isset($input_settings['validation_error_message'])  | 
                                                        |
| 25 | + ? $input_settings['validation_error_message']  | 
                                                        |
| 26 | + : esc_html__(  | 
                                                        |
| 27 | + 'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front',  | 
                                                        |
| 28 | + 'event_espresso'  | 
                                                        |
| 29 | + ),  | 
                                                        |
| 30 | +				'~^\d{3,4}$~' | 
                                                        |
| 31 | + )  | 
                                                        |
| 32 | + );  | 
                                                        |
| 33 | + parent::__construct($input_settings);  | 
                                                        |
| 34 | + if (! isset($input_settings['include_whats_this_link'])  | 
                                                        |
| 35 | + || (  | 
                                                        |
| 36 | + isset($input_settings['include_whats_this_link'])  | 
                                                        |
| 37 | + && $input_settings['include_whats_this_link'] === true  | 
                                                        |
| 38 | + )  | 
                                                        |
| 39 | +		) { | 
                                                        |
| 40 | + $this->_html_label_text = sprintf(  | 
                                                        |
| 41 | + esc_html_x(  | 
                                                        |
| 42 | + '%1$s %2$s(What\'s this?)%3$s',  | 
                                                        |
| 43 | + 'CVV (What\'s this?)',  | 
                                                        |
| 44 | + 'event_espresso'  | 
                                                        |
| 45 | + ),  | 
                                                        |
| 46 | + $this->_html_label_text,  | 
                                                        |
| 47 | + '<a href="https://www.cvvnumber.com/" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 48 | + '</a>'  | 
                                                        |
| 49 | + );  | 
                                                        |
| 50 | + }  | 
                                                        |
| 51 | + }  | 
                                                        |
| 52 | 52 | }  | 
                                                        
@@ -22,7 +22,7 @@ discard block  | 
                                                    ||
| 22 | 22 | $this->_add_validation_strategy(  | 
                                                        
| 23 | 23 | new EE_Text_Validation_Strategy(  | 
                                                        
| 24 | 24 | isset($input_settings['validation_error_message'])  | 
                                                        
| 25 | - ? $input_settings['validation_error_message']  | 
                                                        |
| 25 | + ? $input_settings['validation_error_message']  | 
                                                        |
| 26 | 26 | : esc_html__(  | 
                                                        
| 27 | 27 | 'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front',  | 
                                                        
| 28 | 28 | 'event_espresso'  | 
                                                        
@@ -31,7 +31,7 @@ discard block  | 
                                                    ||
| 31 | 31 | )  | 
                                                        
| 32 | 32 | );  | 
                                                        
| 33 | 33 | parent::__construct($input_settings);  | 
                                                        
| 34 | - if (! isset($input_settings['include_whats_this_link'])  | 
                                                        |
| 34 | + if ( ! isset($input_settings['include_whats_this_link'])  | 
                                                        |
| 35 | 35 | || (  | 
                                                        
| 36 | 36 | isset($input_settings['include_whats_this_link'])  | 
                                                        
| 37 | 37 | && $input_settings['include_whats_this_link'] === true  | 
                                                        
@@ -12,173 +12,173 @@  | 
                                                    ||
| 12 | 12 | class EEH_Maps  | 
                                                        
| 13 | 13 |  { | 
                                                        
| 14 | 14 | |
| 15 | - // array of map settings  | 
                                                        |
| 16 | - public static $gmap_vars = array();  | 
                                                        |
| 17 | -  | 
                                                        |
| 18 | -  | 
                                                        |
| 19 | - /**  | 
                                                        |
| 20 | - * google_map - creates a Google Map Link  | 
                                                        |
| 21 | - *  | 
                                                        |
| 22 | - * @param array $ee_gmaps_opts array of attributes required for the map link generation  | 
                                                        |
| 23 | - * @return string (link to map!)  | 
                                                        |
| 24 | - */  | 
                                                        |
| 25 | - public static function google_map($ee_gmaps_opts)  | 
                                                        |
| 26 | -    { | 
                                                        |
| 27 | -  | 
                                                        |
| 28 | - $ee_map_width = ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300';  | 
                                                        |
| 29 | - $ee_map_height = ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185';  | 
                                                        |
| 30 | - $ee_map_zoom = ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12';  | 
                                                        |
| 31 | - $ee_map_nav_display = ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false';  | 
                                                        |
| 32 | - $ee_map_nav_size = ! empty($ee_gmaps_opts['ee_map_nav_size'])  | 
                                                        |
| 33 | - ? $ee_gmaps_opts['ee_map_nav_size']  | 
                                                        |
| 34 | - : 'default';  | 
                                                        |
| 35 | - $ee_map_type_control = ! empty($ee_gmaps_opts['ee_map_type_control'])  | 
                                                        |
| 36 | - ? $ee_gmaps_opts['ee_map_type_control']  | 
                                                        |
| 37 | - : 'default';  | 
                                                        |
| 38 | - $static_url = ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : false;  | 
                                                        |
| 39 | -  | 
                                                        |
| 40 | -        if (! empty($ee_gmaps_opts['ee_map_align'])) { | 
                                                        |
| 41 | -            switch ($ee_gmaps_opts['ee_map_align']) { | 
                                                        |
| 42 | - case "left":  | 
                                                        |
| 43 | - $map_align = 'ee-gmap-align-left left';  | 
                                                        |
| 44 | - break;  | 
                                                        |
| 45 | - case "right":  | 
                                                        |
| 46 | - $map_align = 'ee-gmap-align-right right';  | 
                                                        |
| 47 | - break;  | 
                                                        |
| 48 | - case "center":  | 
                                                        |
| 49 | - $map_align = 'ee-gmap-align-center center';  | 
                                                        |
| 50 | - break;  | 
                                                        |
| 51 | - case "none":  | 
                                                        |
| 52 | - default:  | 
                                                        |
| 53 | - $map_align = 'ee-gmap-align-none';  | 
                                                        |
| 54 | - }  | 
                                                        |
| 55 | -        } else { | 
                                                        |
| 56 | - $map_align = 'ee-gmap-align-none';  | 
                                                        |
| 57 | - }  | 
                                                        |
| 58 | -  | 
                                                        |
| 59 | -  | 
                                                        |
| 60 | - // Determine whether user has set a hardoded url to use and  | 
                                                        |
| 61 | - // if so display a Google static iframe map else run V3 api  | 
                                                        |
| 62 | -        if ($static_url) { | 
                                                        |
| 63 | - $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">';  | 
                                                        |
| 64 | - $html .= '<iframe src="' . $static_url . '&output=embed"'  | 
                                                        |
| 65 | - . ' style="width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;"'  | 
                                                        |
| 66 | - . ' frameborder="0" scrolling="no">';  | 
                                                        |
| 67 | - $html .= '</iframe>';  | 
                                                        |
| 68 | - $html .= '<a href="' . $static_url . '">View Large map</a>';  | 
                                                        |
| 69 | - $html .= '</div>';  | 
                                                        |
| 70 | - return $html;  | 
                                                        |
| 71 | -        } else { | 
                                                        |
| 72 | - EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array(  | 
                                                        |
| 73 | - 'map_ID' => $ee_gmaps_opts['map_ID'],  | 
                                                        |
| 74 | - 'ee_map_zoom' => $ee_map_zoom,  | 
                                                        |
| 75 | - 'ee_map_nav_display' => $ee_map_nav_display,  | 
                                                        |
| 76 | - 'ee_map_nav_size' => $ee_map_nav_size,  | 
                                                        |
| 77 | - 'ee_map_type_control' => $ee_map_type_control,  | 
                                                        |
| 78 | - 'location' => $ee_gmaps_opts['location'],  | 
                                                        |
| 79 | - );  | 
                                                        |
| 80 | -  | 
                                                        |
| 81 | - $style = 'width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;';  | 
                                                        |
| 82 | - $html = '<div class="ee-gmap-wrapper ' . $map_align . '">'  | 
                                                        |
| 83 | - . '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] . '"'  | 
                                                        |
| 84 | - . ' style="' . $style . '"></div>'  | 
                                                        |
| 85 | - . '</div>';  | 
                                                        |
| 86 | -  | 
                                                        |
| 87 | -            wp_enqueue_script('gmap_api'); | 
                                                        |
| 88 | -            wp_enqueue_script('ee_gmap'); | 
                                                        |
| 89 | -            add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script')); | 
                                                        |
| 90 | -  | 
                                                        |
| 91 | - return $html;  | 
                                                        |
| 92 | - } // end auto map or static url map check  | 
                                                        |
| 93 | - }  | 
                                                        |
| 94 | -  | 
                                                        |
| 95 | -  | 
                                                        |
| 96 | - /**  | 
                                                        |
| 97 | - * enqueue_script  | 
                                                        |
| 98 | - *  | 
                                                        |
| 99 | - * @return void  | 
                                                        |
| 100 | - */  | 
                                                        |
| 101 | - public static function footer_enqueue_script()  | 
                                                        |
| 102 | -    { | 
                                                        |
| 103 | -        wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars); | 
                                                        |
| 104 | - }  | 
                                                        |
| 105 | -  | 
                                                        |
| 106 | -  | 
                                                        |
| 107 | - /**  | 
                                                        |
| 108 | - * registers scripts for maps  | 
                                                        |
| 109 | - */  | 
                                                        |
| 110 | - public static function espresso_google_map_js()  | 
                                                        |
| 111 | -    { | 
                                                        |
| 112 | - $api_url = sprintf(  | 
                                                        |
| 113 | - "https://maps.googleapis.com/maps/api/js?key=%s",  | 
                                                        |
| 114 | - apply_filters(  | 
                                                        |
| 115 | - 'FHEE__EEH_Maps__espresso_google_maps_js__api_key',  | 
                                                        |
| 116 | - EE_Registry::instance()->CFG->map_settings->google_map_api_key  | 
                                                        |
| 117 | - )  | 
                                                        |
| 118 | - );  | 
                                                        |
| 119 | -        wp_register_script('gmap_api', $api_url, array('jquery'), null, true); | 
                                                        |
| 120 | -        wp_register_script('ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', true); | 
                                                        |
| 121 | - }  | 
                                                        |
| 122 | -  | 
                                                        |
| 123 | - /**  | 
                                                        |
| 124 | - * creates a Google Map Link  | 
                                                        |
| 125 | - *  | 
                                                        |
| 126 | - * @param array $atts array of attributes required for the map link generation  | 
                                                        |
| 127 | - * @return string (link to map!)  | 
                                                        |
| 128 | - */  | 
                                                        |
| 129 | - public static function google_map_link($atts)  | 
                                                        |
| 130 | -    { | 
                                                        |
| 131 | -        do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 132 | - extract($atts);  | 
                                                        |
| 133 | - /** @var string $address */  | 
                                                        |
| 134 | - /** @var string $city */  | 
                                                        |
| 135 | - /** @var string $state */  | 
                                                        |
| 136 | - /** @var string $zip */  | 
                                                        |
| 137 | - /** @var string $country */  | 
                                                        |
| 138 | -        $address         = "{$address}"; | 
                                                        |
| 139 | -        $city            = "{$city}"; | 
                                                        |
| 140 | -        $state           = "{$state}"; | 
                                                        |
| 141 | -        $zip             = "{$zip}"; | 
                                                        |
| 142 | -        $country         = "{$country}"; | 
                                                        |
| 143 | -        $text            = isset($text) ? "{$text}" : ""; | 
                                                        |
| 144 | -        $type            = isset($type) ? "{$type}" : ""; | 
                                                        |
| 145 | -        $map_w           = isset($map_w) ? "{$map_w}" : 400; | 
                                                        |
| 146 | -        $map_h           = isset($map_h) ? "{$map_h}" : 400; | 
                                                        |
| 147 | - $id = isset($id) ? $id : 'not_set';  | 
                                                        |
| 148 | - $map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view';  | 
                                                        |
| 149 | -  | 
                                                        |
| 150 | - $address_string = ($address != '' ? $address : '')  | 
                                                        |
| 151 | - . ($city != '' ? ',' . $city : '')  | 
                                                        |
| 152 | - . ($state != '' ? ',' . $state : '')  | 
                                                        |
| 153 | - . ($zip != '' ? ',' . $zip : '')  | 
                                                        |
| 154 | - . ($country != '' ? ',' . $country : '');  | 
                                                        |
| 155 | -  | 
                                                        |
| 156 | -        $google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode($address_string)); | 
                                                        |
| 157 | -  | 
                                                        |
| 158 | -        switch ($type) { | 
                                                        |
| 159 | - case 'text':  | 
                                                        |
| 160 | - default:  | 
                                                        |
| 161 | -                $text = $text == '' ? esc_html__('Map and Directions', 'event_espresso') : $text; | 
                                                        |
| 162 | - break;  | 
                                                        |
| 163 | -  | 
                                                        |
| 164 | - case 'url_only':  | 
                                                        |
| 165 | - case 'url':  | 
                                                        |
| 166 | - $text = $google_map;  | 
                                                        |
| 167 | - break;  | 
                                                        |
| 168 | -  | 
                                                        |
| 169 | - case 'map':  | 
                                                        |
| 170 | - $scheme = is_ssl() ? 'https://' : 'http://';  | 
                                                        |
| 171 | -  | 
                                                        |
| 172 | - $api_key = apply_filters(  | 
                                                        |
| 173 | - 'FHEE__EEH_Maps__espresso_google_maps_link__api_key',  | 
                                                        |
| 174 | - EE_Registry::instance()->CFG->map_settings->google_map_api_key  | 
                                                        |
| 175 | - );  | 
                                                        |
| 176 | -  | 
                                                        |
| 177 | - return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2($scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode($address_string) . '&zoom=14&size=' . $map_w . 'x' . $map_h . '&markers=color:green|label:|' . urlencode($address_string) . '&sensor=false&key=' . $api_key) . '" /></a>';  | 
                                                        |
| 178 | - }  | 
                                                        |
| 179 | -  | 
                                                        |
| 180 | - return $type === 'url_only'  | 
                                                        |
| 181 | - ? $text  | 
                                                        |
| 182 | - : '<a href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . $text . '</a>';  | 
                                                        |
| 183 | - }  | 
                                                        |
| 15 | + // array of map settings  | 
                                                        |
| 16 | + public static $gmap_vars = array();  | 
                                                        |
| 17 | +  | 
                                                        |
| 18 | +  | 
                                                        |
| 19 | + /**  | 
                                                        |
| 20 | + * google_map - creates a Google Map Link  | 
                                                        |
| 21 | + *  | 
                                                        |
| 22 | + * @param array $ee_gmaps_opts array of attributes required for the map link generation  | 
                                                        |
| 23 | + * @return string (link to map!)  | 
                                                        |
| 24 | + */  | 
                                                        |
| 25 | + public static function google_map($ee_gmaps_opts)  | 
                                                        |
| 26 | +	{ | 
                                                        |
| 27 | +  | 
                                                        |
| 28 | + $ee_map_width = ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300';  | 
                                                        |
| 29 | + $ee_map_height = ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185';  | 
                                                        |
| 30 | + $ee_map_zoom = ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12';  | 
                                                        |
| 31 | + $ee_map_nav_display = ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false';  | 
                                                        |
| 32 | + $ee_map_nav_size = ! empty($ee_gmaps_opts['ee_map_nav_size'])  | 
                                                        |
| 33 | + ? $ee_gmaps_opts['ee_map_nav_size']  | 
                                                        |
| 34 | + : 'default';  | 
                                                        |
| 35 | + $ee_map_type_control = ! empty($ee_gmaps_opts['ee_map_type_control'])  | 
                                                        |
| 36 | + ? $ee_gmaps_opts['ee_map_type_control']  | 
                                                        |
| 37 | + : 'default';  | 
                                                        |
| 38 | + $static_url = ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : false;  | 
                                                        |
| 39 | +  | 
                                                        |
| 40 | +		if (! empty($ee_gmaps_opts['ee_map_align'])) { | 
                                                        |
| 41 | +			switch ($ee_gmaps_opts['ee_map_align']) { | 
                                                        |
| 42 | + case "left":  | 
                                                        |
| 43 | + $map_align = 'ee-gmap-align-left left';  | 
                                                        |
| 44 | + break;  | 
                                                        |
| 45 | + case "right":  | 
                                                        |
| 46 | + $map_align = 'ee-gmap-align-right right';  | 
                                                        |
| 47 | + break;  | 
                                                        |
| 48 | + case "center":  | 
                                                        |
| 49 | + $map_align = 'ee-gmap-align-center center';  | 
                                                        |
| 50 | + break;  | 
                                                        |
| 51 | + case "none":  | 
                                                        |
| 52 | + default:  | 
                                                        |
| 53 | + $map_align = 'ee-gmap-align-none';  | 
                                                        |
| 54 | + }  | 
                                                        |
| 55 | +		} else { | 
                                                        |
| 56 | + $map_align = 'ee-gmap-align-none';  | 
                                                        |
| 57 | + }  | 
                                                        |
| 58 | +  | 
                                                        |
| 59 | +  | 
                                                        |
| 60 | + // Determine whether user has set a hardoded url to use and  | 
                                                        |
| 61 | + // if so display a Google static iframe map else run V3 api  | 
                                                        |
| 62 | +		if ($static_url) { | 
                                                        |
| 63 | + $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">';  | 
                                                        |
| 64 | + $html .= '<iframe src="' . $static_url . '&output=embed"'  | 
                                                        |
| 65 | + . ' style="width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;"'  | 
                                                        |
| 66 | + . ' frameborder="0" scrolling="no">';  | 
                                                        |
| 67 | + $html .= '</iframe>';  | 
                                                        |
| 68 | + $html .= '<a href="' . $static_url . '">View Large map</a>';  | 
                                                        |
| 69 | + $html .= '</div>';  | 
                                                        |
| 70 | + return $html;  | 
                                                        |
| 71 | +		} else { | 
                                                        |
| 72 | + EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array(  | 
                                                        |
| 73 | + 'map_ID' => $ee_gmaps_opts['map_ID'],  | 
                                                        |
| 74 | + 'ee_map_zoom' => $ee_map_zoom,  | 
                                                        |
| 75 | + 'ee_map_nav_display' => $ee_map_nav_display,  | 
                                                        |
| 76 | + 'ee_map_nav_size' => $ee_map_nav_size,  | 
                                                        |
| 77 | + 'ee_map_type_control' => $ee_map_type_control,  | 
                                                        |
| 78 | + 'location' => $ee_gmaps_opts['location'],  | 
                                                        |
| 79 | + );  | 
                                                        |
| 80 | +  | 
                                                        |
| 81 | + $style = 'width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;';  | 
                                                        |
| 82 | + $html = '<div class="ee-gmap-wrapper ' . $map_align . '">'  | 
                                                        |
| 83 | + . '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] . '"'  | 
                                                        |
| 84 | + . ' style="' . $style . '"></div>'  | 
                                                        |
| 85 | + . '</div>';  | 
                                                        |
| 86 | +  | 
                                                        |
| 87 | +			wp_enqueue_script('gmap_api'); | 
                                                        |
| 88 | +			wp_enqueue_script('ee_gmap'); | 
                                                        |
| 89 | +			add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script')); | 
                                                        |
| 90 | +  | 
                                                        |
| 91 | + return $html;  | 
                                                        |
| 92 | + } // end auto map or static url map check  | 
                                                        |
| 93 | + }  | 
                                                        |
| 94 | +  | 
                                                        |
| 95 | +  | 
                                                        |
| 96 | + /**  | 
                                                        |
| 97 | + * enqueue_script  | 
                                                        |
| 98 | + *  | 
                                                        |
| 99 | + * @return void  | 
                                                        |
| 100 | + */  | 
                                                        |
| 101 | + public static function footer_enqueue_script()  | 
                                                        |
| 102 | +	{ | 
                                                        |
| 103 | +		wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars); | 
                                                        |
| 104 | + }  | 
                                                        |
| 105 | +  | 
                                                        |
| 106 | +  | 
                                                        |
| 107 | + /**  | 
                                                        |
| 108 | + * registers scripts for maps  | 
                                                        |
| 109 | + */  | 
                                                        |
| 110 | + public static function espresso_google_map_js()  | 
                                                        |
| 111 | +	{ | 
                                                        |
| 112 | + $api_url = sprintf(  | 
                                                        |
| 113 | + "https://maps.googleapis.com/maps/api/js?key=%s",  | 
                                                        |
| 114 | + apply_filters(  | 
                                                        |
| 115 | + 'FHEE__EEH_Maps__espresso_google_maps_js__api_key',  | 
                                                        |
| 116 | + EE_Registry::instance()->CFG->map_settings->google_map_api_key  | 
                                                        |
| 117 | + )  | 
                                                        |
| 118 | + );  | 
                                                        |
| 119 | +		wp_register_script('gmap_api', $api_url, array('jquery'), null, true); | 
                                                        |
| 120 | +		wp_register_script('ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', true); | 
                                                        |
| 121 | + }  | 
                                                        |
| 122 | +  | 
                                                        |
| 123 | + /**  | 
                                                        |
| 124 | + * creates a Google Map Link  | 
                                                        |
| 125 | + *  | 
                                                        |
| 126 | + * @param array $atts array of attributes required for the map link generation  | 
                                                        |
| 127 | + * @return string (link to map!)  | 
                                                        |
| 128 | + */  | 
                                                        |
| 129 | + public static function google_map_link($atts)  | 
                                                        |
| 130 | +	{ | 
                                                        |
| 131 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 132 | + extract($atts);  | 
                                                        |
| 133 | + /** @var string $address */  | 
                                                        |
| 134 | + /** @var string $city */  | 
                                                        |
| 135 | + /** @var string $state */  | 
                                                        |
| 136 | + /** @var string $zip */  | 
                                                        |
| 137 | + /** @var string $country */  | 
                                                        |
| 138 | +		$address         = "{$address}"; | 
                                                        |
| 139 | +		$city            = "{$city}"; | 
                                                        |
| 140 | +		$state           = "{$state}"; | 
                                                        |
| 141 | +		$zip             = "{$zip}"; | 
                                                        |
| 142 | +		$country         = "{$country}"; | 
                                                        |
| 143 | +		$text            = isset($text) ? "{$text}" : ""; | 
                                                        |
| 144 | +		$type            = isset($type) ? "{$type}" : ""; | 
                                                        |
| 145 | +		$map_w           = isset($map_w) ? "{$map_w}" : 400; | 
                                                        |
| 146 | +		$map_h           = isset($map_h) ? "{$map_h}" : 400; | 
                                                        |
| 147 | + $id = isset($id) ? $id : 'not_set';  | 
                                                        |
| 148 | + $map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view';  | 
                                                        |
| 149 | +  | 
                                                        |
| 150 | + $address_string = ($address != '' ? $address : '')  | 
                                                        |
| 151 | + . ($city != '' ? ',' . $city : '')  | 
                                                        |
| 152 | + . ($state != '' ? ',' . $state : '')  | 
                                                        |
| 153 | + . ($zip != '' ? ',' . $zip : '')  | 
                                                        |
| 154 | + . ($country != '' ? ',' . $country : '');  | 
                                                        |
| 155 | +  | 
                                                        |
| 156 | +		$google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode($address_string)); | 
                                                        |
| 157 | +  | 
                                                        |
| 158 | +		switch ($type) { | 
                                                        |
| 159 | + case 'text':  | 
                                                        |
| 160 | + default:  | 
                                                        |
| 161 | +				$text = $text == '' ? esc_html__('Map and Directions', 'event_espresso') : $text; | 
                                                        |
| 162 | + break;  | 
                                                        |
| 163 | +  | 
                                                        |
| 164 | + case 'url_only':  | 
                                                        |
| 165 | + case 'url':  | 
                                                        |
| 166 | + $text = $google_map;  | 
                                                        |
| 167 | + break;  | 
                                                        |
| 168 | +  | 
                                                        |
| 169 | + case 'map':  | 
                                                        |
| 170 | + $scheme = is_ssl() ? 'https://' : 'http://';  | 
                                                        |
| 171 | +  | 
                                                        |
| 172 | + $api_key = apply_filters(  | 
                                                        |
| 173 | + 'FHEE__EEH_Maps__espresso_google_maps_link__api_key',  | 
                                                        |
| 174 | + EE_Registry::instance()->CFG->map_settings->google_map_api_key  | 
                                                        |
| 175 | + );  | 
                                                        |
| 176 | +  | 
                                                        |
| 177 | + return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2($scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode($address_string) . '&zoom=14&size=' . $map_w . 'x' . $map_h . '&markers=color:green|label:|' . urlencode($address_string) . '&sensor=false&key=' . $api_key) . '" /></a>';  | 
                                                        |
| 178 | + }  | 
                                                        |
| 179 | +  | 
                                                        |
| 180 | + return $type === 'url_only'  | 
                                                        |
| 181 | + ? $text  | 
                                                        |
| 182 | + : '<a href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . $text . '</a>';  | 
                                                        |
| 183 | + }  | 
                                                        |
| 184 | 184 | }  | 
                                                        
@@ -37,7 +37,7 @@ discard block  | 
                                                    ||
| 37 | 37 | : 'default';  | 
                                                        
| 38 | 38 | $static_url = ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : false;  | 
                                                        
| 39 | 39 | |
| 40 | -        if (! empty($ee_gmaps_opts['ee_map_align'])) { | 
                                                        |
| 40 | +        if ( ! empty($ee_gmaps_opts['ee_map_align'])) { | 
                                                        |
| 41 | 41 |              switch ($ee_gmaps_opts['ee_map_align']) { | 
                                                        
| 42 | 42 | case "left":  | 
                                                        
| 43 | 43 | $map_align = 'ee-gmap-align-left left';  | 
                                                        
@@ -60,16 +60,16 @@ discard block  | 
                                                    ||
| 60 | 60 | // Determine whether user has set a hardoded url to use and  | 
                                                        
| 61 | 61 | // if so display a Google static iframe map else run V3 api  | 
                                                        
| 62 | 62 |          if ($static_url) { | 
                                                        
| 63 | - $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">';  | 
                                                        |
| 64 | - $html .= '<iframe src="' . $static_url . '&output=embed"'  | 
                                                        |
| 65 | - . ' style="width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;"'  | 
                                                        |
| 63 | + $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper '.$map_align.'">';  | 
                                                        |
| 64 | + $html .= '<iframe src="'.$static_url.'&output=embed"'  | 
                                                        |
| 65 | + . ' style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"'  | 
                                                        |
| 66 | 66 | . ' frameborder="0" scrolling="no">';  | 
                                                        
| 67 | 67 | $html .= '</iframe>';  | 
                                                        
| 68 | - $html .= '<a href="' . $static_url . '">View Large map</a>';  | 
                                                        |
| 68 | + $html .= '<a href="'.$static_url.'">View Large map</a>';  | 
                                                        |
| 69 | 69 | $html .= '</div>';  | 
                                                        
| 70 | 70 | return $html;  | 
                                                        
| 71 | 71 |          } else { | 
                                                        
| 72 | - EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array(  | 
                                                        |
| 72 | + EEH_Maps::$gmap_vars[$ee_gmaps_opts['map_ID']] = array(  | 
                                                        |
| 73 | 73 | 'map_ID' => $ee_gmaps_opts['map_ID'],  | 
                                                        
| 74 | 74 | 'ee_map_zoom' => $ee_map_zoom,  | 
                                                        
| 75 | 75 | 'ee_map_nav_display' => $ee_map_nav_display,  | 
                                                        
@@ -78,10 +78,10 @@ discard block  | 
                                                    ||
| 78 | 78 | 'location' => $ee_gmaps_opts['location'],  | 
                                                        
| 79 | 79 | );  | 
                                                        
| 80 | 80 | |
| 81 | - $style = 'width: ' . $ee_map_width . 'px; height: ' . $ee_map_height . 'px;';  | 
                                                        |
| 82 | - $html = '<div class="ee-gmap-wrapper ' . $map_align . '">'  | 
                                                        |
| 83 | - . '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] . '"'  | 
                                                        |
| 84 | - . ' style="' . $style . '"></div>'  | 
                                                        |
| 81 | + $style = 'width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;';  | 
                                                        |
| 82 | + $html = '<div class="ee-gmap-wrapper '.$map_align.'">'  | 
                                                        |
| 83 | + . '<div class="ee-gmap" id="map_canvas_'.$ee_gmaps_opts['map_ID'].'"'  | 
                                                        |
| 84 | + . ' style="'.$style.'"></div>'  | 
                                                        |
| 85 | 85 | . '</div>';  | 
                                                        
| 86 | 86 | |
| 87 | 87 |              wp_enqueue_script('gmap_api'); | 
                                                        
@@ -117,7 +117,7 @@ discard block  | 
                                                    ||
| 117 | 117 | )  | 
                                                        
| 118 | 118 | );  | 
                                                        
| 119 | 119 |          wp_register_script('gmap_api', $api_url, array('jquery'), null, true); | 
                                                        
| 120 | -        wp_register_script('ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', true); | 
                                                        |
| 120 | +        wp_register_script('ee_gmap', plugin_dir_url(__FILE__).'assets/ee_gmap.js', array('gmap_api'), '1.0', true); | 
                                                        |
| 121 | 121 | }  | 
                                                        
| 122 | 122 | |
| 123 | 123 | /**  | 
                                                        
@@ -148,12 +148,12 @@ discard block  | 
                                                    ||
| 148 | 148 | $map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view';  | 
                                                        
| 149 | 149 | |
| 150 | 150 | $address_string = ($address != '' ? $address : '')  | 
                                                        
| 151 | - . ($city != '' ? ',' . $city : '')  | 
                                                        |
| 152 | - . ($state != '' ? ',' . $state : '')  | 
                                                        |
| 153 | - . ($zip != '' ? ',' . $zip : '')  | 
                                                        |
| 154 | - . ($country != '' ? ',' . $country : '');  | 
                                                        |
| 151 | + . ($city != '' ? ','.$city : '')  | 
                                                        |
| 152 | + . ($state != '' ? ','.$state : '')  | 
                                                        |
| 153 | + . ($zip != '' ? ','.$zip : '')  | 
                                                        |
| 154 | + . ($country != '' ? ','.$country : '');  | 
                                                        |
| 155 | 155 | |
| 156 | -        $google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode($address_string)); | 
                                                        |
| 156 | +        $google_map = htmlentities2('http://maps.google.com/maps?q='.urlencode($address_string)); | 
                                                        |
| 157 | 157 | |
| 158 | 158 |          switch ($type) { | 
                                                        
| 159 | 159 | case 'text':  | 
                                                        
@@ -174,11 +174,11 @@ discard block  | 
                                                    ||
| 174 | 174 | EE_Registry::instance()->CFG->map_settings->google_map_api_key  | 
                                                        
| 175 | 175 | );  | 
                                                        
| 176 | 176 | |
| 177 | - return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2($scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode($address_string) . '&zoom=14&size=' . $map_w . 'x' . $map_h . '&markers=color:green|label:|' . urlencode($address_string) . '&sensor=false&key=' . $api_key) . '" /></a>';  | 
                                                        |
| 177 | + return '<a class="a_map_image_link" href="'.$google_map.'" target="_blank" rel="noopener noreferrer">'.'<img class="map_image_link" id="venue_map_'.$id.'" '.$map_image_class.' src="'.htmlentities2($scheme.'maps.googleapis.com/maps/api/staticmap?center='.urlencode($address_string).'&zoom=14&size='.$map_w.'x'.$map_h.'&markers=color:green|label:|'.urlencode($address_string).'&sensor=false&key='.$api_key).'" /></a>';  | 
                                                        |
| 178 | 178 | }  | 
                                                        
| 179 | 179 | |
| 180 | 180 | return $type === 'url_only'  | 
                                                        
| 181 | 181 | ? $text  | 
                                                        
| 182 | - : '<a href="' . $google_map . '" target="_blank" rel="noopener noreferrer">' . $text . '</a>';  | 
                                                        |
| 182 | + : '<a href="'.$google_map.'" target="_blank" rel="noopener noreferrer">'.$text.'</a>';  | 
                                                        |
| 183 | 183 | }  | 
                                                        
| 184 | 184 | }  | 
                                                        
@@ -14,1323 +14,1323 @@  | 
                                                    ||
| 14 | 14 | class Extend_Registration_Form_Admin_Page extends Registration_Form_Admin_Page  | 
                                                        
| 15 | 15 |  { | 
                                                        
| 16 | 16 | |
| 17 | - /**  | 
                                                        |
| 18 | - * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.  | 
                                                        |
| 19 | - */  | 
                                                        |
| 20 | - public function __construct($routing = true)  | 
                                                        |
| 21 | -    { | 
                                                        |
| 22 | -        define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS); | 
                                                        |
| 23 | -        define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS); | 
                                                        |
| 24 | -        define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/'); | 
                                                        |
| 25 | -        define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS); | 
                                                        |
| 26 | -        define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/'); | 
                                                        |
| 27 | - parent::__construct($routing);  | 
                                                        |
| 28 | - }  | 
                                                        |
| 29 | -  | 
                                                        |
| 30 | -  | 
                                                        |
| 31 | - /**  | 
                                                        |
| 32 | - * @return void  | 
                                                        |
| 33 | - */  | 
                                                        |
| 34 | - protected function _extend_page_config()  | 
                                                        |
| 35 | -    { | 
                                                        |
| 36 | - $this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN;  | 
                                                        |
| 37 | - $qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID'])  | 
                                                        |
| 38 | - ? $this->_req_data['QST_ID'] : 0;  | 
                                                        |
| 39 | - $qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID'])  | 
                                                        |
| 40 | - ? $this->_req_data['QSG_ID'] : 0;  | 
                                                        |
| 41 | -  | 
                                                        |
| 42 | - $new_page_routes = array(  | 
                                                        |
| 43 | - 'question_groups' => array(  | 
                                                        |
| 44 | - 'func' => '_question_groups_overview_list_table',  | 
                                                        |
| 45 | - 'capability' => 'ee_read_question_groups',  | 
                                                        |
| 46 | - ),  | 
                                                        |
| 47 | - 'add_question' => array(  | 
                                                        |
| 48 | - 'func' => '_edit_question',  | 
                                                        |
| 49 | - 'capability' => 'ee_edit_questions',  | 
                                                        |
| 50 | - ),  | 
                                                        |
| 51 | - 'insert_question' => array(  | 
                                                        |
| 52 | - 'func' => '_insert_or_update_question',  | 
                                                        |
| 53 | -                'args'       => array('new_question' => true), | 
                                                        |
| 54 | - 'capability' => 'ee_edit_questions',  | 
                                                        |
| 55 | - 'noheader' => true,  | 
                                                        |
| 56 | - ),  | 
                                                        |
| 57 | - 'duplicate_question' => array(  | 
                                                        |
| 58 | - 'func' => '_duplicate_question',  | 
                                                        |
| 59 | - 'capability' => 'ee_edit_questions',  | 
                                                        |
| 60 | - 'noheader' => true,  | 
                                                        |
| 61 | - ),  | 
                                                        |
| 62 | - 'trash_question' => array(  | 
                                                        |
| 63 | - 'func' => '_trash_question',  | 
                                                        |
| 64 | - 'capability' => 'ee_delete_question',  | 
                                                        |
| 65 | - 'obj_id' => $qst_id,  | 
                                                        |
| 66 | - 'noheader' => true,  | 
                                                        |
| 67 | - ),  | 
                                                        |
| 68 | -  | 
                                                        |
| 69 | - 'restore_question' => array(  | 
                                                        |
| 70 | - 'func' => '_trash_or_restore_questions',  | 
                                                        |
| 71 | - 'capability' => 'ee_delete_question',  | 
                                                        |
| 72 | - 'obj_id' => $qst_id,  | 
                                                        |
| 73 | -                'args'       => array('trash' => false), | 
                                                        |
| 74 | - 'noheader' => true,  | 
                                                        |
| 75 | - ),  | 
                                                        |
| 76 | -  | 
                                                        |
| 77 | - 'delete_question' => array(  | 
                                                        |
| 78 | - 'func' => '_delete_question',  | 
                                                        |
| 79 | - 'capability' => 'ee_delete_question',  | 
                                                        |
| 80 | - 'obj_id' => $qst_id,  | 
                                                        |
| 81 | - 'noheader' => true,  | 
                                                        |
| 82 | - ),  | 
                                                        |
| 83 | -  | 
                                                        |
| 84 | - 'trash_questions' => array(  | 
                                                        |
| 85 | - 'func' => '_trash_or_restore_questions',  | 
                                                        |
| 86 | - 'capability' => 'ee_delete_questions',  | 
                                                        |
| 87 | -                'args'       => array('trash' => true), | 
                                                        |
| 88 | - 'noheader' => true,  | 
                                                        |
| 89 | - ),  | 
                                                        |
| 90 | -  | 
                                                        |
| 91 | - 'restore_questions' => array(  | 
                                                        |
| 92 | - 'func' => '_trash_or_restore_questions',  | 
                                                        |
| 93 | - 'capability' => 'ee_delete_questions',  | 
                                                        |
| 94 | -                'args'       => array('trash' => false), | 
                                                        |
| 95 | - 'noheader' => true,  | 
                                                        |
| 96 | - ),  | 
                                                        |
| 97 | -  | 
                                                        |
| 98 | - 'delete_questions' => array(  | 
                                                        |
| 99 | - 'func' => '_delete_questions',  | 
                                                        |
| 100 | - 'args' => array(),  | 
                                                        |
| 101 | - 'capability' => 'ee_delete_questions',  | 
                                                        |
| 102 | - 'noheader' => true,  | 
                                                        |
| 103 | - ),  | 
                                                        |
| 104 | -  | 
                                                        |
| 105 | - 'add_question_group' => array(  | 
                                                        |
| 106 | - 'func' => '_edit_question_group',  | 
                                                        |
| 107 | - 'capability' => 'ee_edit_question_groups',  | 
                                                        |
| 108 | - ),  | 
                                                        |
| 109 | -  | 
                                                        |
| 110 | - 'edit_question_group' => array(  | 
                                                        |
| 111 | - 'func' => '_edit_question_group',  | 
                                                        |
| 112 | - 'capability' => 'ee_edit_question_group',  | 
                                                        |
| 113 | - 'obj_id' => $qsg_id,  | 
                                                        |
| 114 | -                'args'       => array('edit'), | 
                                                        |
| 115 | - ),  | 
                                                        |
| 116 | -  | 
                                                        |
| 117 | - 'delete_question_groups' => array(  | 
                                                        |
| 118 | - 'func' => '_delete_question_groups',  | 
                                                        |
| 119 | - 'capability' => 'ee_delete_question_groups',  | 
                                                        |
| 120 | - 'noheader' => true,  | 
                                                        |
| 121 | - ),  | 
                                                        |
| 122 | -  | 
                                                        |
| 123 | - 'delete_question_group' => array(  | 
                                                        |
| 124 | - 'func' => '_delete_question_groups',  | 
                                                        |
| 125 | - 'capability' => 'ee_delete_question_group',  | 
                                                        |
| 126 | - 'obj_id' => $qsg_id,  | 
                                                        |
| 127 | - 'noheader' => true,  | 
                                                        |
| 128 | - ),  | 
                                                        |
| 129 | -  | 
                                                        |
| 130 | - 'trash_question_group' => array(  | 
                                                        |
| 131 | - 'func' => '_trash_or_restore_question_groups',  | 
                                                        |
| 132 | -                'args'       => array('trash' => true), | 
                                                        |
| 133 | - 'capability' => 'ee_delete_question_group',  | 
                                                        |
| 134 | - 'obj_id' => $qsg_id,  | 
                                                        |
| 135 | - 'noheader' => true,  | 
                                                        |
| 136 | - ),  | 
                                                        |
| 137 | -  | 
                                                        |
| 138 | - 'restore_question_group' => array(  | 
                                                        |
| 139 | - 'func' => '_trash_or_restore_question_groups',  | 
                                                        |
| 140 | -                'args'       => array('trash' => false), | 
                                                        |
| 141 | - 'capability' => 'ee_delete_question_group',  | 
                                                        |
| 142 | - 'obj_id' => $qsg_id,  | 
                                                        |
| 143 | - 'noheader' => true,  | 
                                                        |
| 144 | - ),  | 
                                                        |
| 145 | -  | 
                                                        |
| 146 | - 'insert_question_group' => array(  | 
                                                        |
| 147 | - 'func' => '_insert_or_update_question_group',  | 
                                                        |
| 148 | -                'args'       => array('new_question_group' => true), | 
                                                        |
| 149 | - 'capability' => 'ee_edit_question_groups',  | 
                                                        |
| 150 | - 'noheader' => true,  | 
                                                        |
| 151 | - ),  | 
                                                        |
| 152 | -  | 
                                                        |
| 153 | - 'update_question_group' => array(  | 
                                                        |
| 154 | - 'func' => '_insert_or_update_question_group',  | 
                                                        |
| 155 | -                'args'       => array('new_question_group' => false), | 
                                                        |
| 156 | - 'capability' => 'ee_edit_question_group',  | 
                                                        |
| 157 | - 'obj_id' => $qsg_id,  | 
                                                        |
| 158 | - 'noheader' => true,  | 
                                                        |
| 159 | - ),  | 
                                                        |
| 160 | -  | 
                                                        |
| 161 | - 'trash_question_groups' => array(  | 
                                                        |
| 162 | - 'func' => '_trash_or_restore_question_groups',  | 
                                                        |
| 163 | -                'args'       => array('trash' => true), | 
                                                        |
| 164 | - 'capability' => 'ee_delete_question_groups',  | 
                                                        |
| 165 | -                'noheader'   => array('trash' => false), | 
                                                        |
| 166 | - ),  | 
                                                        |
| 167 | -  | 
                                                        |
| 168 | - 'restore_question_groups' => array(  | 
                                                        |
| 169 | - 'func' => '_trash_or_restore_question_groups',  | 
                                                        |
| 170 | -                'args'       => array('trash' => false), | 
                                                        |
| 171 | - 'capability' => 'ee_delete_question_groups',  | 
                                                        |
| 172 | - 'noheader' => true,  | 
                                                        |
| 173 | - ),  | 
                                                        |
| 174 | -  | 
                                                        |
| 175 | -  | 
                                                        |
| 176 | - 'espresso_update_question_group_order' => array(  | 
                                                        |
| 177 | - 'func' => 'update_question_group_order',  | 
                                                        |
| 178 | - 'capability' => 'ee_edit_question_groups',  | 
                                                        |
| 179 | - 'noheader' => true,  | 
                                                        |
| 180 | - ),  | 
                                                        |
| 181 | -  | 
                                                        |
| 182 | - 'view_reg_form_settings' => array(  | 
                                                        |
| 183 | - 'func' => '_reg_form_settings',  | 
                                                        |
| 184 | - 'capability' => 'manage_options',  | 
                                                        |
| 185 | - ),  | 
                                                        |
| 186 | -  | 
                                                        |
| 187 | - 'update_reg_form_settings' => array(  | 
                                                        |
| 188 | - 'func' => '_update_reg_form_settings',  | 
                                                        |
| 189 | - 'capability' => 'manage_options',  | 
                                                        |
| 190 | - 'noheader' => true,  | 
                                                        |
| 191 | - ),  | 
                                                        |
| 192 | - );  | 
                                                        |
| 193 | - $this->_page_routes = array_merge($this->_page_routes, $new_page_routes);  | 
                                                        |
| 194 | -  | 
                                                        |
| 195 | - $new_page_config = array(  | 
                                                        |
| 196 | -  | 
                                                        |
| 197 | - 'question_groups' => array(  | 
                                                        |
| 198 | - 'nav' => array(  | 
                                                        |
| 199 | -                    'label' => esc_html__('Question Groups', 'event_espresso'), | 
                                                        |
| 200 | - 'order' => 20,  | 
                                                        |
| 201 | - ),  | 
                                                        |
| 202 | - 'list_table' => 'Registration_Form_Question_Groups_Admin_List_Table',  | 
                                                        |
| 203 | - 'help_tabs' => array(  | 
                                                        |
| 204 | - 'registration_form_question_groups_help_tab' => array(  | 
                                                        |
| 205 | -                        'title'    => esc_html__('Question Groups', 'event_espresso'), | 
                                                        |
| 206 | - 'filename' => 'registration_form_question_groups',  | 
                                                        |
| 207 | - ),  | 
                                                        |
| 208 | - 'registration_form_question_groups_table_column_headings_help_tab' => array(  | 
                                                        |
| 209 | -                        'title'    => esc_html__('Question Groups Table Column Headings', 'event_espresso'), | 
                                                        |
| 210 | - 'filename' => 'registration_form_question_groups_table_column_headings',  | 
                                                        |
| 211 | - ),  | 
                                                        |
| 212 | - 'registration_form_question_groups_views_bulk_actions_search_help_tab' => array(  | 
                                                        |
| 213 | -                        'title'    => esc_html__('Question Groups Views & Bulk Actions & Search', 'event_espresso'), | 
                                                        |
| 214 | - 'filename' => 'registration_form_question_groups_views_bulk_actions_search',  | 
                                                        |
| 215 | - ),  | 
                                                        |
| 216 | - ),  | 
                                                        |
| 217 | -                'help_tour'     => array('Registration_Form_Question_Groups_Help_Tour'), | 
                                                        |
| 218 | - 'metaboxes' => $this->_default_espresso_metaboxes,  | 
                                                        |
| 219 | - 'require_nonce' => false,  | 
                                                        |
| 220 | - 'qtips' => array(  | 
                                                        |
| 221 | - 'EE_Registration_Form_Tips',  | 
                                                        |
| 222 | - ),  | 
                                                        |
| 223 | - ),  | 
                                                        |
| 224 | -  | 
                                                        |
| 225 | - 'add_question' => array(  | 
                                                        |
| 226 | - 'nav' => array(  | 
                                                        |
| 227 | -                    'label'      => esc_html__('Add Question', 'event_espresso'), | 
                                                        |
| 228 | - 'order' => 5,  | 
                                                        |
| 229 | - 'persistent' => false,  | 
                                                        |
| 230 | - ),  | 
                                                        |
| 231 | -                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 232 | - 'help_tabs' => array(  | 
                                                        |
| 233 | - 'registration_form_add_question_help_tab' => array(  | 
                                                        |
| 234 | -                        'title'    => esc_html__('Add Question', 'event_espresso'), | 
                                                        |
| 235 | - 'filename' => 'registration_form_add_question',  | 
                                                        |
| 236 | - ),  | 
                                                        |
| 237 | - ),  | 
                                                        |
| 238 | -                'help_tour'     => array('Registration_Form_Add_Question_Help_Tour'), | 
                                                        |
| 239 | - 'require_nonce' => false,  | 
                                                        |
| 240 | - ),  | 
                                                        |
| 241 | -  | 
                                                        |
| 242 | - 'add_question_group' => array(  | 
                                                        |
| 243 | - 'nav' => array(  | 
                                                        |
| 244 | -                    'label'      => esc_html__('Add Question Group', 'event_espresso'), | 
                                                        |
| 245 | - 'order' => 5,  | 
                                                        |
| 246 | - 'persistent' => false,  | 
                                                        |
| 247 | - ),  | 
                                                        |
| 248 | -                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 249 | - 'help_tabs' => array(  | 
                                                        |
| 250 | - 'registration_form_add_question_group_help_tab' => array(  | 
                                                        |
| 251 | -                        'title'    => esc_html__('Add Question Group', 'event_espresso'), | 
                                                        |
| 252 | - 'filename' => 'registration_form_add_question_group',  | 
                                                        |
| 253 | - ),  | 
                                                        |
| 254 | - ),  | 
                                                        |
| 255 | -                'help_tour'     => array('Registration_Form_Add_Question_Group_Help_Tour'), | 
                                                        |
| 256 | - 'require_nonce' => false,  | 
                                                        |
| 257 | - ),  | 
                                                        |
| 258 | -  | 
                                                        |
| 259 | - 'edit_question_group' => array(  | 
                                                        |
| 260 | - 'nav' => array(  | 
                                                        |
| 261 | -                    'label'      => esc_html__('Edit Question Group', 'event_espresso'), | 
                                                        |
| 262 | - 'order' => 5,  | 
                                                        |
| 263 | - 'persistent' => false,  | 
                                                        |
| 264 | - 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(  | 
                                                        |
| 265 | -                        array('question_group_id' => $this->_req_data['question_group_id']), | 
                                                        |
| 266 | - $this->_current_page_view_url  | 
                                                        |
| 267 | - ) : $this->_admin_base_url,  | 
                                                        |
| 268 | - ),  | 
                                                        |
| 269 | -                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 270 | - 'help_tabs' => array(  | 
                                                        |
| 271 | - 'registration_form_edit_question_group_help_tab' => array(  | 
                                                        |
| 272 | -                        'title'    => esc_html__('Edit Question Group', 'event_espresso'), | 
                                                        |
| 273 | - 'filename' => 'registration_form_edit_question_group',  | 
                                                        |
| 274 | - ),  | 
                                                        |
| 275 | - ),  | 
                                                        |
| 276 | -                'help_tour'     => array('Registration_Form_Edit_Question_Group_Help_Tour'), | 
                                                        |
| 277 | - 'require_nonce' => false,  | 
                                                        |
| 278 | - ),  | 
                                                        |
| 279 | -  | 
                                                        |
| 280 | - 'view_reg_form_settings' => array(  | 
                                                        |
| 281 | - 'nav' => array(  | 
                                                        |
| 282 | -                    'label' => esc_html__('Reg Form Settings', 'event_espresso'), | 
                                                        |
| 283 | - 'order' => 40,  | 
                                                        |
| 284 | - ),  | 
                                                        |
| 285 | - 'labels' => array(  | 
                                                        |
| 286 | -                    'publishbox' => esc_html__('Update Settings', 'event_espresso'), | 
                                                        |
| 287 | - ),  | 
                                                        |
| 288 | -                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 289 | - 'help_tabs' => array(  | 
                                                        |
| 290 | - 'registration_form_reg_form_settings_help_tab' => array(  | 
                                                        |
| 291 | -                        'title'    => esc_html__('Registration Form Settings', 'event_espresso'), | 
                                                        |
| 292 | - 'filename' => 'registration_form_reg_form_settings',  | 
                                                        |
| 293 | - ),  | 
                                                        |
| 294 | - ),  | 
                                                        |
| 295 | -                'help_tour'     => array('Registration_Form_Settings_Help_Tour'), | 
                                                        |
| 296 | - 'require_nonce' => false,  | 
                                                        |
| 297 | - ),  | 
                                                        |
| 298 | -  | 
                                                        |
| 299 | - );  | 
                                                        |
| 300 | - $this->_page_config = array_merge($this->_page_config, $new_page_config);  | 
                                                        |
| 301 | -  | 
                                                        |
| 302 | - // change the list table we're going to use so it's the NEW list table!  | 
                                                        |
| 303 | - $this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table';  | 
                                                        |
| 304 | -  | 
                                                        |
| 305 | -  | 
                                                        |
| 306 | - // additional labels  | 
                                                        |
| 307 | - $new_labels = array(  | 
                                                        |
| 308 | -            'add_question'          => esc_html__('Add New Question', 'event_espresso'), | 
                                                        |
| 309 | -            'delete_question'       => esc_html__('Delete Question', 'event_espresso'), | 
                                                        |
| 310 | -            'add_question_group'    => esc_html__('Add New Question Group', 'event_espresso'), | 
                                                        |
| 311 | -            'edit_question_group'   => esc_html__('Edit Question Group', 'event_espresso'), | 
                                                        |
| 312 | -            'delete_question_group' => esc_html__('Delete Question Group', 'event_espresso'), | 
                                                        |
| 313 | - );  | 
                                                        |
| 314 | - $this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels);  | 
                                                        |
| 315 | - }  | 
                                                        |
| 316 | -  | 
                                                        |
| 317 | -  | 
                                                        |
| 318 | - /**  | 
                                                        |
| 319 | - * @return void  | 
                                                        |
| 320 | - */  | 
                                                        |
| 321 | - protected function _ajax_hooks()  | 
                                                        |
| 322 | -    { | 
                                                        |
| 323 | -        add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order')); | 
                                                        |
| 324 | - }  | 
                                                        |
| 325 | -  | 
                                                        |
| 326 | -  | 
                                                        |
| 327 | - /**  | 
                                                        |
| 328 | - * @return void  | 
                                                        |
| 329 | - */  | 
                                                        |
| 330 | - public function load_scripts_styles_question_groups()  | 
                                                        |
| 331 | -    { | 
                                                        |
| 332 | -        wp_enqueue_script('espresso_ajax_table_sorting'); | 
                                                        |
| 333 | - }  | 
                                                        |
| 334 | -  | 
                                                        |
| 335 | -  | 
                                                        |
| 336 | - /**  | 
                                                        |
| 337 | - * @return void  | 
                                                        |
| 338 | - */  | 
                                                        |
| 339 | - public function load_scripts_styles_add_question_group()  | 
                                                        |
| 340 | -    { | 
                                                        |
| 341 | - $this->load_scripts_styles_forms();  | 
                                                        |
| 342 | - $this->load_sortable_question_script();  | 
                                                        |
| 343 | - }  | 
                                                        |
| 344 | -  | 
                                                        |
| 345 | -  | 
                                                        |
| 346 | - /**  | 
                                                        |
| 347 | - * @return void  | 
                                                        |
| 348 | - */  | 
                                                        |
| 349 | - public function load_scripts_styles_edit_question_group()  | 
                                                        |
| 350 | -    { | 
                                                        |
| 351 | - $this->load_scripts_styles_forms();  | 
                                                        |
| 352 | - $this->load_sortable_question_script();  | 
                                                        |
| 353 | - }  | 
                                                        |
| 354 | -  | 
                                                        |
| 355 | -  | 
                                                        |
| 356 | - /**  | 
                                                        |
| 357 | - * registers and enqueues script for questions  | 
                                                        |
| 358 | - *  | 
                                                        |
| 359 | - * @return void  | 
                                                        |
| 360 | - */  | 
                                                        |
| 361 | - public function load_sortable_question_script()  | 
                                                        |
| 362 | -    { | 
                                                        |
| 363 | - wp_register_script(  | 
                                                        |
| 364 | - 'ee-question-sortable',  | 
                                                        |
| 365 | - REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js',  | 
                                                        |
| 366 | -            array('jquery-ui-sortable'), | 
                                                        |
| 367 | - EVENT_ESPRESSO_VERSION,  | 
                                                        |
| 368 | - true  | 
                                                        |
| 369 | - );  | 
                                                        |
| 370 | -        wp_enqueue_script('ee-question-sortable'); | 
                                                        |
| 371 | - }  | 
                                                        |
| 372 | -  | 
                                                        |
| 373 | -  | 
                                                        |
| 374 | - /**  | 
                                                        |
| 375 | - * @return void  | 
                                                        |
| 376 | - */  | 
                                                        |
| 377 | - protected function _set_list_table_views_default()  | 
                                                        |
| 378 | -    { | 
                                                        |
| 379 | - $this->_views = array(  | 
                                                        |
| 380 | - 'all' => array(  | 
                                                        |
| 381 | - 'slug' => 'all',  | 
                                                        |
| 382 | -                'label'       => esc_html__('View All Questions', 'event_espresso'), | 
                                                        |
| 383 | - 'count' => 0,  | 
                                                        |
| 384 | - 'bulk_action' => array(  | 
                                                        |
| 385 | -                    'trash_questions' => esc_html__('Trash', 'event_espresso'), | 
                                                        |
| 386 | - ),  | 
                                                        |
| 387 | - ),  | 
                                                        |
| 388 | - );  | 
                                                        |
| 389 | -  | 
                                                        |
| 390 | - if (EE_Registry::instance()->CAP->current_user_can(  | 
                                                        |
| 391 | - 'ee_delete_questions',  | 
                                                        |
| 392 | - 'espresso_registration_form_trash_questions'  | 
                                                        |
| 393 | - )  | 
                                                        |
| 394 | -        ) { | 
                                                        |
| 395 | - $this->_views['trash'] = array(  | 
                                                        |
| 396 | - 'slug' => 'trash',  | 
                                                        |
| 397 | -                'label'       => esc_html__('Trash', 'event_espresso'), | 
                                                        |
| 398 | - 'count' => 0,  | 
                                                        |
| 399 | - 'bulk_action' => array(  | 
                                                        |
| 400 | -                    'delete_questions'  => esc_html__('Delete Permanently', 'event_espresso'), | 
                                                        |
| 401 | -                    'restore_questions' => esc_html__('Restore', 'event_espresso'), | 
                                                        |
| 402 | - ),  | 
                                                        |
| 403 | - );  | 
                                                        |
| 404 | - }  | 
                                                        |
| 405 | - }  | 
                                                        |
| 406 | -  | 
                                                        |
| 407 | -  | 
                                                        |
| 408 | - /**  | 
                                                        |
| 409 | - * @return void  | 
                                                        |
| 410 | - */  | 
                                                        |
| 411 | - protected function _set_list_table_views_question_groups()  | 
                                                        |
| 412 | -    { | 
                                                        |
| 413 | - $this->_views = array(  | 
                                                        |
| 414 | - 'all' => array(  | 
                                                        |
| 415 | - 'slug' => 'all',  | 
                                                        |
| 416 | -                'label'       => esc_html__('All', 'event_espresso'), | 
                                                        |
| 417 | - 'count' => 0,  | 
                                                        |
| 418 | - 'bulk_action' => array(  | 
                                                        |
| 419 | -                    'trash_question_groups' => esc_html__('Trash', 'event_espresso'), | 
                                                        |
| 420 | - ),  | 
                                                        |
| 421 | - ),  | 
                                                        |
| 422 | - );  | 
                                                        |
| 423 | -  | 
                                                        |
| 424 | - if (EE_Registry::instance()->CAP->current_user_can(  | 
                                                        |
| 425 | - 'ee_delete_question_groups',  | 
                                                        |
| 426 | - 'espresso_registration_form_trash_question_groups'  | 
                                                        |
| 427 | - )  | 
                                                        |
| 428 | -        ) { | 
                                                        |
| 429 | - $this->_views['trash'] = array(  | 
                                                        |
| 430 | - 'slug' => 'trash',  | 
                                                        |
| 431 | -                'label'       => esc_html__('Trash', 'event_espresso'), | 
                                                        |
| 432 | - 'count' => 0,  | 
                                                        |
| 433 | - 'bulk_action' => array(  | 
                                                        |
| 434 | -                    'delete_question_groups'  => esc_html__('Delete Permanently', 'event_espresso'), | 
                                                        |
| 435 | -                    'restore_question_groups' => esc_html__('Restore', 'event_espresso'), | 
                                                        |
| 436 | - ),  | 
                                                        |
| 437 | - );  | 
                                                        |
| 438 | - }  | 
                                                        |
| 439 | - }  | 
                                                        |
| 440 | -  | 
                                                        |
| 441 | -  | 
                                                        |
| 442 | - /**  | 
                                                        |
| 443 | - * @return void  | 
                                                        |
| 444 | - * @throws EE_Error  | 
                                                        |
| 445 | - * @throws InvalidArgumentException  | 
                                                        |
| 446 | - * @throws InvalidDataTypeException  | 
                                                        |
| 447 | - * @throws InvalidInterfaceException  | 
                                                        |
| 448 | - */  | 
                                                        |
| 449 | - protected function _questions_overview_list_table()  | 
                                                        |
| 450 | -    { | 
                                                        |
| 451 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(  | 
                                                        |
| 452 | - 'add_question',  | 
                                                        |
| 453 | - 'add_question',  | 
                                                        |
| 454 | - array(),  | 
                                                        |
| 455 | - 'add-new-h2'  | 
                                                        |
| 456 | - );  | 
                                                        |
| 457 | - parent::_questions_overview_list_table();  | 
                                                        |
| 458 | - }  | 
                                                        |
| 459 | -  | 
                                                        |
| 460 | -  | 
                                                        |
| 461 | - /**  | 
                                                        |
| 462 | - * @return void  | 
                                                        |
| 463 | - * @throws DomainException  | 
                                                        |
| 464 | - * @throws EE_Error  | 
                                                        |
| 465 | - * @throws InvalidArgumentException  | 
                                                        |
| 466 | - * @throws InvalidDataTypeException  | 
                                                        |
| 467 | - * @throws InvalidInterfaceException  | 
                                                        |
| 468 | - */  | 
                                                        |
| 469 | - protected function _question_groups_overview_list_table()  | 
                                                        |
| 470 | -    { | 
                                                        |
| 471 | -        $this->_search_btn_label = esc_html__('Question Groups', 'event_espresso'); | 
                                                        |
| 472 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(  | 
                                                        |
| 473 | - 'add_question_group',  | 
                                                        |
| 474 | - 'add_question_group',  | 
                                                        |
| 475 | - array(),  | 
                                                        |
| 476 | - 'add-new-h2'  | 
                                                        |
| 477 | - );  | 
                                                        |
| 478 | - $this->display_admin_list_table_page_with_sidebar();  | 
                                                        |
| 479 | - }  | 
                                                        |
| 480 | -  | 
                                                        |
| 481 | -  | 
                                                        |
| 482 | - /**  | 
                                                        |
| 483 | - * @return void  | 
                                                        |
| 484 | - * @throws EE_Error  | 
                                                        |
| 485 | - * @throws InvalidArgumentException  | 
                                                        |
| 486 | - * @throws InvalidDataTypeException  | 
                                                        |
| 487 | - * @throws InvalidInterfaceException  | 
                                                        |
| 488 | - */  | 
                                                        |
| 489 | - protected function _delete_question()  | 
                                                        |
| 490 | -    { | 
                                                        |
| 491 | - $success = $this->_delete_items($this->_question_model);  | 
                                                        |
| 492 | - $this->_redirect_after_action(  | 
                                                        |
| 493 | - $success,  | 
                                                        |
| 494 | - $this->_question_model->item_name($success),  | 
                                                        |
| 495 | - 'deleted',  | 
                                                        |
| 496 | -            array('action' => 'default', 'status' => 'all') | 
                                                        |
| 497 | - );  | 
                                                        |
| 498 | - }  | 
                                                        |
| 499 | -  | 
                                                        |
| 500 | -  | 
                                                        |
| 501 | - /**  | 
                                                        |
| 502 | - * @return void  | 
                                                        |
| 503 | - * @throws EE_Error  | 
                                                        |
| 504 | - * @throws InvalidArgumentException  | 
                                                        |
| 505 | - * @throws InvalidDataTypeException  | 
                                                        |
| 506 | - * @throws InvalidInterfaceException  | 
                                                        |
| 507 | - */  | 
                                                        |
| 508 | - protected function _delete_questions()  | 
                                                        |
| 509 | -    { | 
                                                        |
| 510 | - $success = $this->_delete_items($this->_question_model);  | 
                                                        |
| 511 | - $this->_redirect_after_action(  | 
                                                        |
| 512 | - $success,  | 
                                                        |
| 513 | - $this->_question_model->item_name($success),  | 
                                                        |
| 514 | - 'deleted permanently',  | 
                                                        |
| 515 | -            array('action' => 'default', 'status' => 'trash') | 
                                                        |
| 516 | - );  | 
                                                        |
| 517 | - }  | 
                                                        |
| 518 | -  | 
                                                        |
| 519 | -  | 
                                                        |
| 520 | - /**  | 
                                                        |
| 521 | - * Performs the deletion of a single or multiple questions or question groups.  | 
                                                        |
| 522 | - *  | 
                                                        |
| 523 | - * @param EEM_Soft_Delete_Base $model  | 
                                                        |
| 524 | - * @return int number of items deleted permanently  | 
                                                        |
| 525 | - * @throws EE_Error  | 
                                                        |
| 526 | - * @throws InvalidArgumentException  | 
                                                        |
| 527 | - * @throws InvalidDataTypeException  | 
                                                        |
| 528 | - * @throws InvalidInterfaceException  | 
                                                        |
| 529 | - */  | 
                                                        |
| 530 | - private function _delete_items(EEM_Soft_Delete_Base $model)  | 
                                                        |
| 531 | -    { | 
                                                        |
| 532 | - $success = 0;  | 
                                                        |
| 533 | -        do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 534 | -        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { | 
                                                        |
| 535 | - // if array has more than one element than success message should be plural  | 
                                                        |
| 536 | - $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;  | 
                                                        |
| 537 | - // cycle thru bulk action checkboxes  | 
                                                        |
| 538 | -            while (list($ID, $value) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 539 | -                if (! $this->_delete_item($ID, $model)) { | 
                                                        |
| 540 | - $success = 0;  | 
                                                        |
| 541 | - }  | 
                                                        |
| 542 | - }  | 
                                                        |
| 543 | -        } elseif (! empty($this->_req_data['QSG_ID'])) { | 
                                                        |
| 544 | - $success = $this->_delete_item($this->_req_data['QSG_ID'], $model);  | 
                                                        |
| 545 | -        } elseif (! empty($this->_req_data['QST_ID'])) { | 
                                                        |
| 546 | - $success = $this->_delete_item($this->_req_data['QST_ID'], $model);  | 
                                                        |
| 547 | -        } else { | 
                                                        |
| 548 | - EE_Error::add_error(  | 
                                                        |
| 549 | - sprintf(  | 
                                                        |
| 550 | - esc_html__(  | 
                                                        |
| 551 | - "No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.",  | 
                                                        |
| 552 | - "event_espresso"  | 
                                                        |
| 553 | - )  | 
                                                        |
| 554 | - ),  | 
                                                        |
| 555 | - __FILE__,  | 
                                                        |
| 556 | - __FUNCTION__,  | 
                                                        |
| 557 | - __LINE__  | 
                                                        |
| 558 | - );  | 
                                                        |
| 559 | - }  | 
                                                        |
| 560 | - return $success;  | 
                                                        |
| 561 | - }  | 
                                                        |
| 562 | -  | 
                                                        |
| 563 | -  | 
                                                        |
| 564 | - /**  | 
                                                        |
| 565 | - * Deletes the specified question (and its associated question options) or question group  | 
                                                        |
| 566 | - *  | 
                                                        |
| 567 | - * @param int $id  | 
                                                        |
| 568 | - * @param EEM_Soft_Delete_Base $model  | 
                                                        |
| 569 | - * @return boolean  | 
                                                        |
| 570 | - * @throws EE_Error  | 
                                                        |
| 571 | - * @throws InvalidArgumentException  | 
                                                        |
| 572 | - * @throws InvalidDataTypeException  | 
                                                        |
| 573 | - * @throws InvalidInterfaceException  | 
                                                        |
| 574 | - */  | 
                                                        |
| 575 | - protected function _delete_item($id, $model)  | 
                                                        |
| 576 | -    { | 
                                                        |
| 577 | -        if ($model instanceof EEM_Question) { | 
                                                        |
| 578 | -            EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id)))); | 
                                                        |
| 579 | - }  | 
                                                        |
| 580 | - return $model->delete_permanently_by_ID(absint($id));  | 
                                                        |
| 581 | - }  | 
                                                        |
| 582 | -  | 
                                                        |
| 583 | -  | 
                                                        |
| 584 | - /****************************** QUESTION GROUPS ******************************/  | 
                                                        |
| 585 | -  | 
                                                        |
| 586 | -  | 
                                                        |
| 587 | - /**  | 
                                                        |
| 588 | - * @param string $type  | 
                                                        |
| 589 | - * @return void  | 
                                                        |
| 590 | - * @throws DomainException  | 
                                                        |
| 591 | - * @throws EE_Error  | 
                                                        |
| 592 | - * @throws InvalidArgumentException  | 
                                                        |
| 593 | - * @throws InvalidDataTypeException  | 
                                                        |
| 594 | - * @throws InvalidInterfaceException  | 
                                                        |
| 595 | - */  | 
                                                        |
| 596 | - protected function _edit_question_group($type = 'add')  | 
                                                        |
| 597 | -    { | 
                                                        |
| 598 | -        do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 599 | - $ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID'])  | 
                                                        |
| 600 | - ? absint($this->_req_data['QSG_ID'])  | 
                                                        |
| 601 | - : false;  | 
                                                        |
| 602 | -  | 
                                                        |
| 603 | -        switch ($this->_req_action) { | 
                                                        |
| 604 | - case 'add_question_group':  | 
                                                        |
| 605 | -                $this->_admin_page_title = esc_html__('Add Question Group', 'event_espresso'); | 
                                                        |
| 606 | - break;  | 
                                                        |
| 607 | - case 'edit_question_group':  | 
                                                        |
| 608 | -                $this->_admin_page_title = esc_html__('Edit Question Group', 'event_espresso'); | 
                                                        |
| 609 | - break;  | 
                                                        |
| 610 | - default:  | 
                                                        |
| 611 | -                $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); | 
                                                        |
| 612 | - }  | 
                                                        |
| 613 | - // add ID to title if editing  | 
                                                        |
| 614 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;  | 
                                                        |
| 615 | -        if ($ID) { | 
                                                        |
| 616 | - /** @var EE_Question_Group $questionGroup */  | 
                                                        |
| 617 | - $questionGroup = $this->_question_group_model->get_one_by_ID($ID);  | 
                                                        |
| 618 | -            $additional_hidden_fields = array('QSG_ID' => array('type' => 'hidden', 'value' => $ID)); | 
                                                        |
| 619 | -            $this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields); | 
                                                        |
| 620 | -        } else { | 
                                                        |
| 621 | - /** @var EE_Question_Group $questionGroup */  | 
                                                        |
| 622 | - $questionGroup = EEM_Question_Group::instance()->create_default_object();  | 
                                                        |
| 623 | - $questionGroup->set_order_to_latest();  | 
                                                        |
| 624 | -            $this->_set_add_edit_form_tags('insert_question_group'); | 
                                                        |
| 625 | - }  | 
                                                        |
| 626 | - $this->_template_args['values'] = $this->_yes_no_values;  | 
                                                        |
| 627 | - $this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group();  | 
                                                        |
| 628 | - $this->_template_args['QSG_ID'] = $ID ? $ID : true;  | 
                                                        |
| 629 | - $this->_template_args['question_group'] = $questionGroup;  | 
                                                        |
| 630 | -  | 
                                                        |
| 631 | -        $redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url); | 
                                                        |
| 632 | -        $this->_set_publish_post_box_vars('id', $ID, false, $redirect_URL); | 
                                                        |
| 633 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(  | 
                                                        |
| 634 | - REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php',  | 
                                                        |
| 635 | - $this->_template_args,  | 
                                                        |
| 636 | - true  | 
                                                        |
| 637 | - );  | 
                                                        |
| 638 | -  | 
                                                        |
| 639 | - // the details template wrapper  | 
                                                        |
| 640 | - $this->display_admin_page_with_sidebar();  | 
                                                        |
| 641 | - }  | 
                                                        |
| 642 | -  | 
                                                        |
| 643 | -  | 
                                                        |
| 644 | - /**  | 
                                                        |
| 645 | - * @return void  | 
                                                        |
| 646 | - * @throws EE_Error  | 
                                                        |
| 647 | - * @throws InvalidArgumentException  | 
                                                        |
| 648 | - * @throws InvalidDataTypeException  | 
                                                        |
| 649 | - * @throws InvalidInterfaceException  | 
                                                        |
| 650 | - */  | 
                                                        |
| 651 | - protected function _delete_question_groups()  | 
                                                        |
| 652 | -    { | 
                                                        |
| 653 | - $success = $this->_delete_items($this->_question_group_model);  | 
                                                        |
| 654 | - $this->_redirect_after_action(  | 
                                                        |
| 655 | - $success,  | 
                                                        |
| 656 | - $this->_question_group_model->item_name($success),  | 
                                                        |
| 657 | - 'deleted permanently',  | 
                                                        |
| 658 | -            array('action' => 'question_groups', 'status' => 'trash') | 
                                                        |
| 659 | - );  | 
                                                        |
| 660 | - }  | 
                                                        |
| 661 | -  | 
                                                        |
| 662 | -  | 
                                                        |
| 663 | - /**  | 
                                                        |
| 664 | - * @param bool $new_question_group  | 
                                                        |
| 665 | - * @throws EE_Error  | 
                                                        |
| 666 | - * @throws InvalidArgumentException  | 
                                                        |
| 667 | - * @throws InvalidDataTypeException  | 
                                                        |
| 668 | - * @throws InvalidInterfaceException  | 
                                                        |
| 669 | - */  | 
                                                        |
| 670 | - protected function _insert_or_update_question_group($new_question_group = true)  | 
                                                        |
| 671 | -    { | 
                                                        |
| 672 | -        do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 673 | - $set_column_values = $this->_set_column_values_for($this->_question_group_model);  | 
                                                        |
| 674 | -        if ($new_question_group) { | 
                                                        |
| 675 | - // make sure identifier is unique  | 
                                                        |
| 676 | - $identifier_value = isset($set_column_values['QSG_identifier']) ? $set_column_values['QSG_identifier'] : '';  | 
                                                        |
| 677 | - $identifier_exists = ! empty($identifier_value)  | 
                                                        |
| 678 | - ? $this->_question_group_model->count([['QSG_identifier' => $set_column_values['QSG_identifier']]]) > 0  | 
                                                        |
| 679 | - : false;  | 
                                                        |
| 680 | -            if ($identifier_exists) { | 
                                                        |
| 681 | -                $set_column_values['QSG_identifier'] .= uniqid('id', true); | 
                                                        |
| 682 | - }  | 
                                                        |
| 683 | - $QSG_ID = $this->_question_group_model->insert($set_column_values);  | 
                                                        |
| 684 | - $success = $QSG_ID ? 1 : 0;  | 
                                                        |
| 685 | -            if ($success === 0) { | 
                                                        |
| 686 | - EE_Error::add_error(  | 
                                                        |
| 687 | -                    esc_html__('Something went wrong saving the question group.', 'event_espresso'), | 
                                                        |
| 688 | - __FILE__,  | 
                                                        |
| 689 | - __FUNCTION__,  | 
                                                        |
| 690 | - __LINE__  | 
                                                        |
| 691 | - );  | 
                                                        |
| 692 | - $this->_redirect_after_action(  | 
                                                        |
| 693 | - false,  | 
                                                        |
| 694 | - '',  | 
                                                        |
| 695 | - '',  | 
                                                        |
| 696 | -                    array('action' => 'edit_question_group', 'QSG_ID' => $QSG_ID), | 
                                                        |
| 697 | - true  | 
                                                        |
| 698 | - );  | 
                                                        |
| 699 | - }  | 
                                                        |
| 700 | -        } else { | 
                                                        |
| 701 | - $QSG_ID = absint($this->_req_data['QSG_ID']);  | 
                                                        |
| 702 | - unset($set_column_values['QSG_ID']);  | 
                                                        |
| 703 | -            $success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID))); | 
                                                        |
| 704 | - }  | 
                                                        |
| 705 | -  | 
                                                        |
| 706 | - $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(  | 
                                                        |
| 707 | - EEM_Attendee::system_question_phone  | 
                                                        |
| 708 | - );  | 
                                                        |
| 709 | - // update the existing related questions  | 
                                                        |
| 710 | - // BUT FIRST... delete the phone question from the Question_Group_Question  | 
                                                        |
| 711 | - // if it is being added to this question group (therefore removed from the existing group)  | 
                                                        |
| 712 | -        if (isset($this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ])) { | 
                                                        |
| 713 | - // delete where QST ID = system phone question ID and Question Group ID is NOT this group  | 
                                                        |
| 714 | - EEM_Question_Group_Question::instance()->delete(  | 
                                                        |
| 715 | - array(  | 
                                                        |
| 716 | - array(  | 
                                                        |
| 717 | - 'QST_ID' => $phone_question_id,  | 
                                                        |
| 718 | -                        'QSG_ID' => array('!=', $QSG_ID), | 
                                                        |
| 719 | - ),  | 
                                                        |
| 720 | - )  | 
                                                        |
| 721 | - );  | 
                                                        |
| 722 | - }  | 
                                                        |
| 723 | - /** @type EE_Question_Group $question_group */  | 
                                                        |
| 724 | - $question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);  | 
                                                        |
| 725 | - $questions = $question_group->questions();  | 
                                                        |
| 726 | - // make sure system phone question is added to list of questions for this group  | 
                                                        |
| 727 | -        if (! isset($questions[ $phone_question_id ])) { | 
                                                        |
| 728 | - $questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID($phone_question_id);  | 
                                                        |
| 729 | - }  | 
                                                        |
| 730 | -  | 
                                                        |
| 731 | -        foreach ($questions as $question_ID => $question) { | 
                                                        |
| 732 | - // first we always check for order.  | 
                                                        |
| 733 | -            if (! empty($this->_req_data['question_orders'][ $question_ID ])) { | 
                                                        |
| 734 | - // update question order  | 
                                                        |
| 735 | - $question_group->update_question_order(  | 
                                                        |
| 736 | - $question_ID,  | 
                                                        |
| 737 | - $this->_req_data['question_orders'][ $question_ID ]  | 
                                                        |
| 738 | - );  | 
                                                        |
| 739 | - }  | 
                                                        |
| 740 | -  | 
                                                        |
| 741 | - // then we always check if adding or removing.  | 
                                                        |
| 742 | -            if (isset($this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ])) { | 
                                                        |
| 743 | - $question_group->add_question($question_ID);  | 
                                                        |
| 744 | -            } else { | 
                                                        |
| 745 | - // not found, remove it (but only if not a system question for the personal group  | 
                                                        |
| 746 | - // with the exception of lname system question - we allow removal of it)  | 
                                                        |
| 747 | - if (in_array(  | 
                                                        |
| 748 | - $question->system_ID(),  | 
                                                        |
| 749 | - EEM_Question::instance()->required_system_questions_in_system_question_group(  | 
                                                        |
| 750 | - $question_group->system_group()  | 
                                                        |
| 751 | - )  | 
                                                        |
| 752 | -                )) { | 
                                                        |
| 753 | - continue;  | 
                                                        |
| 754 | -                } else { | 
                                                        |
| 755 | - $question_group->remove_question($question_ID);  | 
                                                        |
| 756 | - }  | 
                                                        |
| 757 | - }  | 
                                                        |
| 758 | - }  | 
                                                        |
| 759 | - // save new related questions  | 
                                                        |
| 760 | -        if (isset($this->_req_data['questions'])) { | 
                                                        |
| 761 | -            foreach ($this->_req_data['questions'] as $QST_ID) { | 
                                                        |
| 762 | - $question_group->add_question($QST_ID);  | 
                                                        |
| 763 | -                if (isset($this->_req_data['question_orders'][ $QST_ID ])) { | 
                                                        |
| 764 | - $question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][ $QST_ID ]);  | 
                                                        |
| 765 | - }  | 
                                                        |
| 766 | - }  | 
                                                        |
| 767 | - }  | 
                                                        |
| 768 | -  | 
                                                        |
| 769 | -        if ($success !== false) { | 
                                                        |
| 770 | - $msg = $new_question_group  | 
                                                        |
| 771 | - ? sprintf(  | 
                                                        |
| 772 | -                    esc_html__('The %s has been created', 'event_espresso'), | 
                                                        |
| 773 | - $this->_question_group_model->item_name()  | 
                                                        |
| 774 | - )  | 
                                                        |
| 775 | - : sprintf(  | 
                                                        |
| 776 | - esc_html__(  | 
                                                        |
| 777 | - 'The %s has been updated',  | 
                                                        |
| 778 | - 'event_espresso'  | 
                                                        |
| 779 | - ),  | 
                                                        |
| 780 | - $this->_question_group_model->item_name()  | 
                                                        |
| 781 | - );  | 
                                                        |
| 782 | - EE_Error::add_success($msg);  | 
                                                        |
| 783 | - }  | 
                                                        |
| 784 | - $this->_redirect_after_action(  | 
                                                        |
| 785 | - false,  | 
                                                        |
| 786 | - '',  | 
                                                        |
| 787 | - '',  | 
                                                        |
| 788 | -            array('action' => 'edit_question_group', 'QSG_ID' => $QSG_ID), | 
                                                        |
| 789 | - true  | 
                                                        |
| 790 | - );  | 
                                                        |
| 791 | - }  | 
                                                        |
| 792 | -  | 
                                                        |
| 793 | -  | 
                                                        |
| 794 | - /**  | 
                                                        |
| 795 | - * duplicates a question and all its question options and redirects to the new question.  | 
                                                        |
| 796 | - *  | 
                                                        |
| 797 | - * @return void  | 
                                                        |
| 798 | - * @throws EE_Error  | 
                                                        |
| 799 | - * @throws InvalidArgumentException  | 
                                                        |
| 800 | - * @throws ReflectionException  | 
                                                        |
| 801 | - * @throws InvalidDataTypeException  | 
                                                        |
| 802 | - * @throws InvalidInterfaceException  | 
                                                        |
| 803 | - */  | 
                                                        |
| 804 | - public function _duplicate_question()  | 
                                                        |
| 805 | -    { | 
                                                        |
| 806 | - $question_ID = (int) $this->_req_data['QST_ID'];  | 
                                                        |
| 807 | - $question = EEM_Question::instance()->get_one_by_ID($question_ID);  | 
                                                        |
| 808 | -        if ($question instanceof EE_Question) { | 
                                                        |
| 809 | - $new_question = $question->duplicate();  | 
                                                        |
| 810 | -            if ($new_question instanceof EE_Question) { | 
                                                        |
| 811 | - $this->_redirect_after_action(  | 
                                                        |
| 812 | - true,  | 
                                                        |
| 813 | -                    esc_html__('Question', 'event_espresso'), | 
                                                        |
| 814 | -                    esc_html__('Duplicated', 'event_espresso'), | 
                                                        |
| 815 | -                    array('action' => 'edit_question', 'QST_ID' => $new_question->ID()), | 
                                                        |
| 816 | - true  | 
                                                        |
| 817 | - );  | 
                                                        |
| 818 | -            } else { | 
                                                        |
| 819 | - global $wpdb;  | 
                                                        |
| 820 | - EE_Error::add_error(  | 
                                                        |
| 821 | - sprintf(  | 
                                                        |
| 822 | - esc_html__(  | 
                                                        |
| 823 | - 'Could not duplicate question with ID %1$d because: %2$s',  | 
                                                        |
| 824 | - 'event_espresso'  | 
                                                        |
| 825 | - ),  | 
                                                        |
| 826 | - $question_ID,  | 
                                                        |
| 827 | - $wpdb->last_error  | 
                                                        |
| 828 | - ),  | 
                                                        |
| 829 | - __FILE__,  | 
                                                        |
| 830 | - __FUNCTION__,  | 
                                                        |
| 831 | - __LINE__  | 
                                                        |
| 832 | - );  | 
                                                        |
| 833 | -                $this->_redirect_after_action(false, '', '', array('action' => 'default'), false); | 
                                                        |
| 834 | - }  | 
                                                        |
| 835 | -        } else { | 
                                                        |
| 836 | - EE_Error::add_error(  | 
                                                        |
| 837 | - sprintf(  | 
                                                        |
| 838 | - esc_html__(  | 
                                                        |
| 839 | - 'Could not duplicate question with ID %d because it didn\'t exist!',  | 
                                                        |
| 840 | - 'event_espresso'  | 
                                                        |
| 841 | - ),  | 
                                                        |
| 842 | - $question_ID  | 
                                                        |
| 843 | - ),  | 
                                                        |
| 844 | - __FILE__,  | 
                                                        |
| 845 | - __FUNCTION__,  | 
                                                        |
| 846 | - __LINE__  | 
                                                        |
| 847 | - );  | 
                                                        |
| 848 | -            $this->_redirect_after_action(false, '', '', array('action' => 'default'), false); | 
                                                        |
| 849 | - }  | 
                                                        |
| 850 | - }  | 
                                                        |
| 851 | -  | 
                                                        |
| 852 | -  | 
                                                        |
| 853 | - /**  | 
                                                        |
| 854 | - * @param bool $trash  | 
                                                        |
| 855 | - * @throws EE_Error  | 
                                                        |
| 856 | - */  | 
                                                        |
| 857 | - protected function _trash_or_restore_question_groups($trash = true)  | 
                                                        |
| 858 | -    { | 
                                                        |
| 859 | - $this->_trash_or_restore_items($this->_question_group_model, $trash);  | 
                                                        |
| 860 | - }  | 
                                                        |
| 861 | -  | 
                                                        |
| 862 | -  | 
                                                        |
| 863 | - /**  | 
                                                        |
| 864 | - *_trash_question  | 
                                                        |
| 865 | - *  | 
                                                        |
| 866 | - * @return void  | 
                                                        |
| 867 | - * @throws EE_Error  | 
                                                        |
| 868 | - */  | 
                                                        |
| 869 | - protected function _trash_question()  | 
                                                        |
| 870 | -    { | 
                                                        |
| 871 | - $success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']);  | 
                                                        |
| 872 | -        $query_args = array('action' => 'default', 'status' => 'all'); | 
                                                        |
| 873 | - $this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args);  | 
                                                        |
| 874 | - }  | 
                                                        |
| 875 | -  | 
                                                        |
| 876 | -  | 
                                                        |
| 877 | - /**  | 
                                                        |
| 878 | - * @param bool $trash  | 
                                                        |
| 879 | - * @throws EE_Error  | 
                                                        |
| 880 | - */  | 
                                                        |
| 881 | - protected function _trash_or_restore_questions($trash = true)  | 
                                                        |
| 882 | -    { | 
                                                        |
| 883 | - $this->_trash_or_restore_items($this->_question_model, $trash);  | 
                                                        |
| 884 | - }  | 
                                                        |
| 885 | -  | 
                                                        |
| 886 | -  | 
                                                        |
| 887 | - /**  | 
                                                        |
| 888 | - * Internally used to delete or restore items, using the request data. Meant to be  | 
                                                        |
| 889 | - * flexible between question or question groups  | 
                                                        |
| 890 | - *  | 
                                                        |
| 891 | - * @param EEM_Soft_Delete_Base $model  | 
                                                        |
| 892 | - * @param boolean $trash whether to trash or restore  | 
                                                        |
| 893 | - * @throws EE_Error  | 
                                                        |
| 894 | - */  | 
                                                        |
| 895 | - private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = true)  | 
                                                        |
| 896 | -    { | 
                                                        |
| 897 | -  | 
                                                        |
| 898 | -        do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 899 | -  | 
                                                        |
| 900 | - $success = 1;  | 
                                                        |
| 901 | - // Checkboxes  | 
                                                        |
| 902 | - // echo "trash $trash";  | 
                                                        |
| 903 | - // var_dump($this->_req_data['checkbox']);die;  | 
                                                        |
| 904 | -        if (isset($this->_req_data['checkbox'])) { | 
                                                        |
| 905 | -            if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { | 
                                                        |
| 906 | - // if array has more than one element than success message should be plural  | 
                                                        |
| 907 | - $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;  | 
                                                        |
| 908 | - // cycle thru bulk action checkboxes  | 
                                                        |
| 909 | -                while (list($ID, $value) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 910 | -                    if (! $model->delete_or_restore_by_ID($trash, absint($ID))) { | 
                                                        |
| 911 | - $success = 0;  | 
                                                        |
| 912 | - }  | 
                                                        |
| 913 | - }  | 
                                                        |
| 914 | -            } else { | 
                                                        |
| 915 | - // grab single id and delete  | 
                                                        |
| 916 | - $ID = absint($this->_req_data['checkbox']);  | 
                                                        |
| 917 | -                if (! $model->delete_or_restore_by_ID($trash, $ID)) { | 
                                                        |
| 918 | - $success = 0;  | 
                                                        |
| 919 | - }  | 
                                                        |
| 920 | - }  | 
                                                        |
| 921 | -        } else { | 
                                                        |
| 922 | - // delete via trash link  | 
                                                        |
| 923 | - // grab single id and delete  | 
                                                        |
| 924 | - $ID = absint($this->_req_data[ $model->primary_key_name() ]);  | 
                                                        |
| 925 | -            if (! $model->delete_or_restore_by_ID($trash, $ID)) { | 
                                                        |
| 926 | - $success = 0;  | 
                                                        |
| 927 | - }  | 
                                                        |
| 928 | - }  | 
                                                        |
| 929 | -  | 
                                                        |
| 930 | -  | 
                                                        |
| 931 | - $action = $model instanceof EEM_Question ? 'default' : 'question_groups';// strtolower( $model->item_name(2) );  | 
                                                        |
| 932 | - // echo "action :$action";  | 
                                                        |
| 933 | - // $action = 'questions' ? 'default' : $action;  | 
                                                        |
| 934 | -        if ($trash) { | 
                                                        |
| 935 | - $action_desc = 'trashed';  | 
                                                        |
| 936 | - $status = 'trash';  | 
                                                        |
| 937 | -        } else { | 
                                                        |
| 938 | - $action_desc = 'restored';  | 
                                                        |
| 939 | - $status = 'all';  | 
                                                        |
| 940 | - }  | 
                                                        |
| 941 | - $this->_redirect_after_action(  | 
                                                        |
| 942 | - $success,  | 
                                                        |
| 943 | - $model->item_name($success),  | 
                                                        |
| 944 | - $action_desc,  | 
                                                        |
| 945 | -            array('action' => $action, 'status' => $status) | 
                                                        |
| 946 | - );  | 
                                                        |
| 947 | - }  | 
                                                        |
| 948 | -  | 
                                                        |
| 949 | -  | 
                                                        |
| 950 | - /**  | 
                                                        |
| 951 | - * @param $per_page  | 
                                                        |
| 952 | - * @param int $current_page  | 
                                                        |
| 953 | - * @param bool|false $count  | 
                                                        |
| 954 | - * @return EE_Soft_Delete_Base_Class[]|int  | 
                                                        |
| 955 | - * @throws EE_Error  | 
                                                        |
| 956 | - * @throws InvalidArgumentException  | 
                                                        |
| 957 | - * @throws InvalidDataTypeException  | 
                                                        |
| 958 | - * @throws InvalidInterfaceException  | 
                                                        |
| 959 | - */  | 
                                                        |
| 960 | - public function get_trashed_questions($per_page, $current_page = 1, $count = false)  | 
                                                        |
| 961 | -    { | 
                                                        |
| 962 | - $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);  | 
                                                        |
| 963 | -  | 
                                                        |
| 964 | -        if ($count) { | 
                                                        |
| 965 | - // note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items  | 
                                                        |
| 966 | - $where = isset($query_params[0]) ? array($query_params[0]) : array();  | 
                                                        |
| 967 | - $results = $this->_question_model->count_deleted($where);  | 
                                                        |
| 968 | -        } else { | 
                                                        |
| 969 | - // note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items  | 
                                                        |
| 970 | - $results = $this->_question_model->get_all_deleted($query_params);  | 
                                                        |
| 971 | - }  | 
                                                        |
| 972 | - return $results;  | 
                                                        |
| 973 | - }  | 
                                                        |
| 974 | -  | 
                                                        |
| 975 | -  | 
                                                        |
| 976 | - /**  | 
                                                        |
| 977 | - * @param $per_page  | 
                                                        |
| 978 | - * @param int $current_page  | 
                                                        |
| 979 | - * @param bool|false $count  | 
                                                        |
| 980 | - * @return EE_Soft_Delete_Base_Class[]|int  | 
                                                        |
| 981 | - * @throws EE_Error  | 
                                                        |
| 982 | - * @throws InvalidArgumentException  | 
                                                        |
| 983 | - * @throws InvalidDataTypeException  | 
                                                        |
| 984 | - * @throws InvalidInterfaceException  | 
                                                        |
| 985 | - */  | 
                                                        |
| 986 | - public function get_question_groups($per_page, $current_page = 1, $count = false)  | 
                                                        |
| 987 | -    { | 
                                                        |
| 988 | - $questionGroupModel = EEM_Question_Group::instance();  | 
                                                        |
| 989 | - $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);  | 
                                                        |
| 990 | -        if ($count) { | 
                                                        |
| 991 | - $where = isset($query_params[0]) ? array($query_params[0]) : array();  | 
                                                        |
| 992 | - $results = $questionGroupModel->count($where);  | 
                                                        |
| 993 | -        } else { | 
                                                        |
| 994 | - $results = $questionGroupModel->get_all($query_params);  | 
                                                        |
| 995 | - }  | 
                                                        |
| 996 | - return $results;  | 
                                                        |
| 997 | - }  | 
                                                        |
| 998 | -  | 
                                                        |
| 999 | -  | 
                                                        |
| 1000 | - /**  | 
                                                        |
| 1001 | - * @param $per_page  | 
                                                        |
| 1002 | - * @param int $current_page  | 
                                                        |
| 1003 | - * @param bool $count  | 
                                                        |
| 1004 | - * @return EE_Soft_Delete_Base_Class[]|int  | 
                                                        |
| 1005 | - * @throws EE_Error  | 
                                                        |
| 1006 | - * @throws InvalidArgumentException  | 
                                                        |
| 1007 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1008 | - * @throws InvalidInterfaceException  | 
                                                        |
| 1009 | - */  | 
                                                        |
| 1010 | - public function get_trashed_question_groups($per_page, $current_page = 1, $count = false)  | 
                                                        |
| 1011 | -    { | 
                                                        |
| 1012 | - $questionGroupModel = EEM_Question_Group::instance();  | 
                                                        |
| 1013 | - $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);  | 
                                                        |
| 1014 | -        if ($count) { | 
                                                        |
| 1015 | - $where = isset($query_params[0]) ? array($query_params[0]) : array();  | 
                                                        |
| 1016 | - $query_params['limit'] = null;  | 
                                                        |
| 1017 | - $results = $questionGroupModel->count_deleted($where);  | 
                                                        |
| 1018 | -        } else { | 
                                                        |
| 1019 | - $results = $questionGroupModel->get_all_deleted($query_params);  | 
                                                        |
| 1020 | - }  | 
                                                        |
| 1021 | - return $results;  | 
                                                        |
| 1022 | - }  | 
                                                        |
| 1023 | -  | 
                                                        |
| 1024 | -  | 
                                                        |
| 1025 | - /**  | 
                                                        |
| 1026 | - * method for performing updates to question order  | 
                                                        |
| 1027 | - *  | 
                                                        |
| 1028 | - * @return void results array  | 
                                                        |
| 1029 | - * @throws EE_Error  | 
                                                        |
| 1030 | - * @throws InvalidArgumentException  | 
                                                        |
| 1031 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1032 | - * @throws InvalidInterfaceException  | 
                                                        |
| 1033 | - */  | 
                                                        |
| 1034 | - public function update_question_group_order()  | 
                                                        |
| 1035 | -    { | 
                                                        |
| 1036 | -  | 
                                                        |
| 1037 | -        $success = esc_html__('Question group order was updated successfully.', 'event_espresso'); | 
                                                        |
| 1038 | -  | 
                                                        |
| 1039 | - // grab our row IDs  | 
                                                        |
| 1040 | - $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids'])  | 
                                                        |
| 1041 | -            ? explode(',', rtrim($this->_req_data['row_ids'], ',')) | 
                                                        |
| 1042 | - : array();  | 
                                                        |
| 1043 | -  | 
                                                        |
| 1044 | - $perpage = ! empty($this->_req_data['perpage'])  | 
                                                        |
| 1045 | - ? (int) $this->_req_data['perpage']  | 
                                                        |
| 1046 | - : null;  | 
                                                        |
| 1047 | - $curpage = ! empty($this->_req_data['curpage'])  | 
                                                        |
| 1048 | - ? (int) $this->_req_data['curpage']  | 
                                                        |
| 1049 | - : null;  | 
                                                        |
| 1050 | -  | 
                                                        |
| 1051 | -        if (! empty($row_ids)) { | 
                                                        |
| 1052 | - // figure out where we start the row_id count at for the current page.  | 
                                                        |
| 1053 | - $qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage;  | 
                                                        |
| 1054 | -  | 
                                                        |
| 1055 | - $row_count = count($row_ids);  | 
                                                        |
| 1056 | -            for ($i = 0; $i < $row_count; $i++) { | 
                                                        |
| 1057 | - // Update the questions when re-ordering  | 
                                                        |
| 1058 | - $updated = EEM_Question_Group::instance()->update(  | 
                                                        |
| 1059 | -                    array('QSG_order' => $qsgcount), | 
                                                        |
| 1060 | -                    array(array('QSG_ID' => $row_ids[ $i ])) | 
                                                        |
| 1061 | - );  | 
                                                        |
| 1062 | -                if ($updated === false) { | 
                                                        |
| 1063 | - $success = false;  | 
                                                        |
| 1064 | - }  | 
                                                        |
| 1065 | - $qsgcount++;  | 
                                                        |
| 1066 | - }  | 
                                                        |
| 1067 | -        } else { | 
                                                        |
| 1068 | - $success = false;  | 
                                                        |
| 1069 | - }  | 
                                                        |
| 1070 | -  | 
                                                        |
| 1071 | - $errors = ! $success  | 
                                                        |
| 1072 | -            ? esc_html__('An error occurred. The question group order was not updated.', 'event_espresso') | 
                                                        |
| 1073 | - : false;  | 
                                                        |
| 1074 | -  | 
                                                        |
| 1075 | -        echo wp_json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors)); | 
                                                        |
| 1076 | - die();  | 
                                                        |
| 1077 | - }  | 
                                                        |
| 1078 | -  | 
                                                        |
| 1079 | -  | 
                                                        |
| 1080 | -  | 
                                                        |
| 1081 | - /*************************************** REGISTRATION SETTINGS ***************************************/  | 
                                                        |
| 1082 | -  | 
                                                        |
| 1083 | -  | 
                                                        |
| 1084 | - /**  | 
                                                        |
| 1085 | - * @throws DomainException  | 
                                                        |
| 1086 | - * @throws EE_Error  | 
                                                        |
| 1087 | - * @throws InvalidArgumentException  | 
                                                        |
| 1088 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1089 | - * @throws InvalidInterfaceException  | 
                                                        |
| 1090 | - */  | 
                                                        |
| 1091 | - protected function _reg_form_settings()  | 
                                                        |
| 1092 | -    { | 
                                                        |
| 1093 | - $this->_template_args['values'] = $this->_yes_no_values;  | 
                                                        |
| 1094 | - add_action(  | 
                                                        |
| 1095 | - 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',  | 
                                                        |
| 1096 | - array($this, 'email_validation_settings_form'),  | 
                                                        |
| 1097 | - 2  | 
                                                        |
| 1098 | - );  | 
                                                        |
| 1099 | - $this->_template_args = (array) apply_filters(  | 
                                                        |
| 1100 | - 'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args',  | 
                                                        |
| 1101 | - $this->_template_args  | 
                                                        |
| 1102 | - );  | 
                                                        |
| 1103 | -        $this->_set_add_edit_form_tags('update_reg_form_settings'); | 
                                                        |
| 1104 | - $this->_set_publish_post_box_vars(null, false, false, null, false);  | 
                                                        |
| 1105 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(  | 
                                                        |
| 1106 | - REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php',  | 
                                                        |
| 1107 | - $this->_template_args,  | 
                                                        |
| 1108 | - true  | 
                                                        |
| 1109 | - );  | 
                                                        |
| 1110 | - $this->display_admin_page_with_sidebar();  | 
                                                        |
| 1111 | - }  | 
                                                        |
| 1112 | -  | 
                                                        |
| 1113 | -  | 
                                                        |
| 1114 | - /**  | 
                                                        |
| 1115 | - * @return void  | 
                                                        |
| 1116 | - * @throws EE_Error  | 
                                                        |
| 1117 | - * @throws InvalidArgumentException  | 
                                                        |
| 1118 | - * @throws ReflectionException  | 
                                                        |
| 1119 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1120 | - * @throws InvalidInterfaceException  | 
                                                        |
| 1121 | - */  | 
                                                        |
| 1122 | - protected function _update_reg_form_settings()  | 
                                                        |
| 1123 | -    { | 
                                                        |
| 1124 | - EE_Registry::instance()->CFG->registration = $this->update_email_validation_settings_form(  | 
                                                        |
| 1125 | - EE_Registry::instance()->CFG->registration  | 
                                                        |
| 1126 | - );  | 
                                                        |
| 1127 | - EE_Registry::instance()->CFG->registration = apply_filters(  | 
                                                        |
| 1128 | - 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',  | 
                                                        |
| 1129 | - EE_Registry::instance()->CFG->registration  | 
                                                        |
| 1130 | - );  | 
                                                        |
| 1131 | - $success = $this->_update_espresso_configuration(  | 
                                                        |
| 1132 | -            esc_html__('Registration Form Options', 'event_espresso'), | 
                                                        |
| 1133 | - EE_Registry::instance()->CFG,  | 
                                                        |
| 1134 | - __FILE__,  | 
                                                        |
| 1135 | - __FUNCTION__,  | 
                                                        |
| 1136 | - __LINE__  | 
                                                        |
| 1137 | - );  | 
                                                        |
| 1138 | - $this->_redirect_after_action(  | 
                                                        |
| 1139 | - $success,  | 
                                                        |
| 1140 | -            esc_html__('Registration Form Options', 'event_espresso'), | 
                                                        |
| 1141 | - 'updated',  | 
                                                        |
| 1142 | -            array('action' => 'view_reg_form_settings') | 
                                                        |
| 1143 | - );  | 
                                                        |
| 1144 | - }  | 
                                                        |
| 1145 | -  | 
                                                        |
| 1146 | -  | 
                                                        |
| 1147 | - /**  | 
                                                        |
| 1148 | - * @return void  | 
                                                        |
| 1149 | - * @throws EE_Error  | 
                                                        |
| 1150 | - * @throws InvalidArgumentException  | 
                                                        |
| 1151 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1152 | - * @throws InvalidInterfaceException  | 
                                                        |
| 1153 | - */  | 
                                                        |
| 1154 | - public function email_validation_settings_form()  | 
                                                        |
| 1155 | -    { | 
                                                        |
| 1156 | - echo $this->_email_validation_settings_form()->get_html();  | 
                                                        |
| 1157 | - }  | 
                                                        |
| 1158 | -  | 
                                                        |
| 1159 | -  | 
                                                        |
| 1160 | - /**  | 
                                                        |
| 1161 | - * _email_validation_settings_form  | 
                                                        |
| 1162 | - *  | 
                                                        |
| 1163 | - * @access protected  | 
                                                        |
| 1164 | - * @return EE_Form_Section_Proper  | 
                                                        |
| 1165 | - * @throws \EE_Error  | 
                                                        |
| 1166 | - */  | 
                                                        |
| 1167 | - protected function _email_validation_settings_form()  | 
                                                        |
| 1168 | -    { | 
                                                        |
| 1169 | - return new EE_Form_Section_Proper(  | 
                                                        |
| 1170 | - array(  | 
                                                        |
| 1171 | - 'name' => 'email_validation_settings',  | 
                                                        |
| 1172 | - 'html_id' => 'email_validation_settings',  | 
                                                        |
| 1173 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(),  | 
                                                        |
| 1174 | - 'subsections' => apply_filters(  | 
                                                        |
| 1175 | - 'FHEE__Extend_Registration_Form_Admin_Page___email_validation_settings_form__form_subsections',  | 
                                                        |
| 1176 | - array(  | 
                                                        |
| 1177 | - 'email_validation_hdr' => new EE_Form_Section_HTML(  | 
                                                        |
| 1178 | -                            EEH_HTML::h2(esc_html__('Email Validation Settings', 'event_espresso')) | 
                                                        |
| 1179 | - ),  | 
                                                        |
| 1180 | - 'email_validation_level' => new EE_Select_Input(  | 
                                                        |
| 1181 | - array(  | 
                                                        |
| 1182 | -                                'basic'      => esc_html__('Basic', 'event_espresso'), | 
                                                        |
| 1183 | -                                'wp_default' => esc_html__('WordPress Default', 'event_espresso'), | 
                                                        |
| 1184 | -                                'i18n'       => esc_html__('International', 'event_espresso'), | 
                                                        |
| 1185 | -                                'i18n_dns'   => esc_html__('International + DNS Check', 'event_espresso'), | 
                                                        |
| 1186 | - ),  | 
                                                        |
| 1187 | - array(  | 
                                                        |
| 1188 | -                                'html_label_text' => esc_html__('Email Validation Level', 'event_espresso') | 
                                                        |
| 1189 | -                                                     . EEH_Template::get_help_tab_link('email_validation_info'), | 
                                                        |
| 1190 | - 'html_help_text' => esc_html__(  | 
                                                        |
| 1191 | - 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.',  | 
                                                        |
| 1192 | - 'event_espresso'  | 
                                                        |
| 1193 | - ),  | 
                                                        |
| 1194 | - 'default' => isset(  | 
                                                        |
| 1195 | - EE_Registry::instance()->CFG->registration->email_validation_level  | 
                                                        |
| 1196 | - )  | 
                                                        |
| 1197 | - ? EE_Registry::instance()->CFG->registration->email_validation_level  | 
                                                        |
| 1198 | - : 'wp_default',  | 
                                                        |
| 1199 | - 'required' => false,  | 
                                                        |
| 1200 | - )  | 
                                                        |
| 1201 | - ),  | 
                                                        |
| 1202 | - )  | 
                                                        |
| 1203 | - ),  | 
                                                        |
| 1204 | - )  | 
                                                        |
| 1205 | - );  | 
                                                        |
| 1206 | - }  | 
                                                        |
| 1207 | -  | 
                                                        |
| 1208 | -  | 
                                                        |
| 1209 | - /**  | 
                                                        |
| 1210 | - * @param EE_Registration_Config $EE_Registration_Config  | 
                                                        |
| 1211 | - * @return EE_Registration_Config  | 
                                                        |
| 1212 | - * @throws EE_Error  | 
                                                        |
| 1213 | - * @throws InvalidArgumentException  | 
                                                        |
| 1214 | - * @throws ReflectionException  | 
                                                        |
| 1215 | - * @throws InvalidDataTypeException  | 
                                                        |
| 1216 | - * @throws InvalidInterfaceException  | 
                                                        |
| 1217 | - */  | 
                                                        |
| 1218 | - public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config)  | 
                                                        |
| 1219 | -    { | 
                                                        |
| 1220 | - $prev_email_validation_level = $EE_Registration_Config->email_validation_level;  | 
                                                        |
| 1221 | -        try { | 
                                                        |
| 1222 | - $email_validation_settings_form = $this->_email_validation_settings_form();  | 
                                                        |
| 1223 | - // if not displaying a form, then check for form submission  | 
                                                        |
| 1224 | -            if ($email_validation_settings_form->was_submitted()) { | 
                                                        |
| 1225 | - // capture form data  | 
                                                        |
| 1226 | - $email_validation_settings_form->receive_form_submission();  | 
                                                        |
| 1227 | - // validate form data  | 
                                                        |
| 1228 | -                if ($email_validation_settings_form->is_valid()) { | 
                                                        |
| 1229 | - // grab validated data from form  | 
                                                        |
| 1230 | - $valid_data = $email_validation_settings_form->valid_data();  | 
                                                        |
| 1231 | -                    if (isset($valid_data['email_validation_level'])) { | 
                                                        |
| 1232 | - $email_validation_level = $valid_data['email_validation_level'];  | 
                                                        |
| 1233 | - // now if they want to use international email addresses  | 
                                                        |
| 1234 | -                        if ($email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns') { | 
                                                        |
| 1235 | - // in case we need to reset their email validation level,  | 
                                                        |
| 1236 | - // make sure that the previous value wasn't already set to one of the i18n options.  | 
                                                        |
| 1237 | -                            if ($prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns') { | 
                                                        |
| 1238 | - // if so, then reset it back to "basic" since that is the only other option that,  | 
                                                        |
| 1239 | - // despite offering poor validation, supports i18n email addresses  | 
                                                        |
| 1240 | - $prev_email_validation_level = 'basic';  | 
                                                        |
| 1241 | - }  | 
                                                        |
| 1242 | - // confirm our i18n email validation will work on the server  | 
                                                        |
| 1243 | -                            if (! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) { | 
                                                        |
| 1244 | - // or reset email validation level to previous value  | 
                                                        |
| 1245 | - $email_validation_level = $prev_email_validation_level;  | 
                                                        |
| 1246 | - }  | 
                                                        |
| 1247 | - }  | 
                                                        |
| 1248 | - $EE_Registration_Config->email_validation_level = $email_validation_level;  | 
                                                        |
| 1249 | -                    } else { | 
                                                        |
| 1250 | - EE_Error::add_error(  | 
                                                        |
| 1251 | - esc_html__(  | 
                                                        |
| 1252 | - 'Invalid or missing Email Validation settings. Please refresh the form and try again.',  | 
                                                        |
| 1253 | - 'event_espresso'  | 
                                                        |
| 1254 | - ),  | 
                                                        |
| 1255 | - __FILE__,  | 
                                                        |
| 1256 | - __FUNCTION__,  | 
                                                        |
| 1257 | - __LINE__  | 
                                                        |
| 1258 | - );  | 
                                                        |
| 1259 | - }  | 
                                                        |
| 1260 | -                } else { | 
                                                        |
| 1261 | -                    if ($email_validation_settings_form->submission_error_message() !== '') { | 
                                                        |
| 1262 | - EE_Error::add_error(  | 
                                                        |
| 1263 | - $email_validation_settings_form->submission_error_message(),  | 
                                                        |
| 1264 | - __FILE__,  | 
                                                        |
| 1265 | - __FUNCTION__,  | 
                                                        |
| 1266 | - __LINE__  | 
                                                        |
| 1267 | - );  | 
                                                        |
| 1268 | - }  | 
                                                        |
| 1269 | - }  | 
                                                        |
| 1270 | - }  | 
                                                        |
| 1271 | -        } catch (EE_Error $e) { | 
                                                        |
| 1272 | - $e->get_error();  | 
                                                        |
| 1273 | - }  | 
                                                        |
| 1274 | - return $EE_Registration_Config;  | 
                                                        |
| 1275 | - }  | 
                                                        |
| 1276 | -  | 
                                                        |
| 1277 | -  | 
                                                        |
| 1278 | - /**  | 
                                                        |
| 1279 | - * confirms that the server's PHP version has the PCRE module enabled,  | 
                                                        |
| 1280 | - * and that the PCRE version works with our i18n email validation  | 
                                                        |
| 1281 | - *  | 
                                                        |
| 1282 | - * @param EE_Registration_Config $EE_Registration_Config  | 
                                                        |
| 1283 | - * @param string $email_validation_level  | 
                                                        |
| 1284 | - * @return bool  | 
                                                        |
| 1285 | - */  | 
                                                        |
| 1286 | - private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)  | 
                                                        |
| 1287 | -    { | 
                                                        |
| 1288 | - // first check that PCRE is enabled  | 
                                                        |
| 1289 | -        if (! defined('PREG_BAD_UTF8_ERROR')) { | 
                                                        |
| 1290 | - EE_Error::add_error(  | 
                                                        |
| 1291 | - sprintf(  | 
                                                        |
| 1292 | - esc_html__(  | 
                                                        |
| 1293 | - 'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.',  | 
                                                        |
| 1294 | - 'event_espresso'  | 
                                                        |
| 1295 | - ),  | 
                                                        |
| 1296 | - '<br />'  | 
                                                        |
| 1297 | - ),  | 
                                                        |
| 1298 | - __FILE__,  | 
                                                        |
| 1299 | - __FUNCTION__,  | 
                                                        |
| 1300 | - __LINE__  | 
                                                        |
| 1301 | - );  | 
                                                        |
| 1302 | - return false;  | 
                                                        |
| 1303 | -        } else { | 
                                                        |
| 1304 | - // PCRE support is enabled, but let's still  | 
                                                        |
| 1305 | - // perform a test to see if the server will support it.  | 
                                                        |
| 1306 | - // but first, save the updated validation level to the config,  | 
                                                        |
| 1307 | - // so that the validation strategy picks it up.  | 
                                                        |
| 1308 | - // this will get bumped back down if it doesn't work  | 
                                                        |
| 1309 | - $EE_Registration_Config->email_validation_level = $email_validation_level;  | 
                                                        |
| 1310 | -            try { | 
                                                        |
| 1311 | - $email_validator = new EE_Email_Validation_Strategy();  | 
                                                        |
| 1312 | - $i18n_email_address = apply_filters(  | 
                                                        |
| 1313 | - 'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address',  | 
                                                        |
| 1314 | - 'jägerjü[email protected]'  | 
                                                        |
| 1315 | - );  | 
                                                        |
| 1316 | - $email_validator->validate($i18n_email_address);  | 
                                                        |
| 1317 | -            } catch (Exception $e) { | 
                                                        |
| 1318 | - EE_Error::add_error(  | 
                                                        |
| 1319 | - sprintf(  | 
                                                        |
| 1320 | - esc_html__(  | 
                                                        |
| 1321 | - 'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s',  | 
                                                        |
| 1322 | - 'event_espresso'  | 
                                                        |
| 1323 | - ),  | 
                                                        |
| 1324 | - '<br />',  | 
                                                        |
| 1325 | - '<a href="http://php.net/manual/en/pcre.installation.php" target="_blank" rel="noopener noreferrer">http://php.net/manual/en/pcre.installation.php</a>'  | 
                                                        |
| 1326 | - ),  | 
                                                        |
| 1327 | - __FILE__,  | 
                                                        |
| 1328 | - __FUNCTION__,  | 
                                                        |
| 1329 | - __LINE__  | 
                                                        |
| 1330 | - );  | 
                                                        |
| 1331 | - return false;  | 
                                                        |
| 1332 | - }  | 
                                                        |
| 1333 | - }  | 
                                                        |
| 1334 | - return true;  | 
                                                        |
| 1335 | - }  | 
                                                        |
| 17 | + /**  | 
                                                        |
| 18 | + * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.  | 
                                                        |
| 19 | + */  | 
                                                        |
| 20 | + public function __construct($routing = true)  | 
                                                        |
| 21 | +	{ | 
                                                        |
| 22 | +		define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS); | 
                                                        |
| 23 | +		define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS); | 
                                                        |
| 24 | +		define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/'); | 
                                                        |
| 25 | +		define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS); | 
                                                        |
| 26 | +		define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/'); | 
                                                        |
| 27 | + parent::__construct($routing);  | 
                                                        |
| 28 | + }  | 
                                                        |
| 29 | +  | 
                                                        |
| 30 | +  | 
                                                        |
| 31 | + /**  | 
                                                        |
| 32 | + * @return void  | 
                                                        |
| 33 | + */  | 
                                                        |
| 34 | + protected function _extend_page_config()  | 
                                                        |
| 35 | +	{ | 
                                                        |
| 36 | + $this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN;  | 
                                                        |
| 37 | + $qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID'])  | 
                                                        |
| 38 | + ? $this->_req_data['QST_ID'] : 0;  | 
                                                        |
| 39 | + $qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID'])  | 
                                                        |
| 40 | + ? $this->_req_data['QSG_ID'] : 0;  | 
                                                        |
| 41 | +  | 
                                                        |
| 42 | + $new_page_routes = array(  | 
                                                        |
| 43 | + 'question_groups' => array(  | 
                                                        |
| 44 | + 'func' => '_question_groups_overview_list_table',  | 
                                                        |
| 45 | + 'capability' => 'ee_read_question_groups',  | 
                                                        |
| 46 | + ),  | 
                                                        |
| 47 | + 'add_question' => array(  | 
                                                        |
| 48 | + 'func' => '_edit_question',  | 
                                                        |
| 49 | + 'capability' => 'ee_edit_questions',  | 
                                                        |
| 50 | + ),  | 
                                                        |
| 51 | + 'insert_question' => array(  | 
                                                        |
| 52 | + 'func' => '_insert_or_update_question',  | 
                                                        |
| 53 | +				'args'       => array('new_question' => true), | 
                                                        |
| 54 | + 'capability' => 'ee_edit_questions',  | 
                                                        |
| 55 | + 'noheader' => true,  | 
                                                        |
| 56 | + ),  | 
                                                        |
| 57 | + 'duplicate_question' => array(  | 
                                                        |
| 58 | + 'func' => '_duplicate_question',  | 
                                                        |
| 59 | + 'capability' => 'ee_edit_questions',  | 
                                                        |
| 60 | + 'noheader' => true,  | 
                                                        |
| 61 | + ),  | 
                                                        |
| 62 | + 'trash_question' => array(  | 
                                                        |
| 63 | + 'func' => '_trash_question',  | 
                                                        |
| 64 | + 'capability' => 'ee_delete_question',  | 
                                                        |
| 65 | + 'obj_id' => $qst_id,  | 
                                                        |
| 66 | + 'noheader' => true,  | 
                                                        |
| 67 | + ),  | 
                                                        |
| 68 | +  | 
                                                        |
| 69 | + 'restore_question' => array(  | 
                                                        |
| 70 | + 'func' => '_trash_or_restore_questions',  | 
                                                        |
| 71 | + 'capability' => 'ee_delete_question',  | 
                                                        |
| 72 | + 'obj_id' => $qst_id,  | 
                                                        |
| 73 | +				'args'       => array('trash' => false), | 
                                                        |
| 74 | + 'noheader' => true,  | 
                                                        |
| 75 | + ),  | 
                                                        |
| 76 | +  | 
                                                        |
| 77 | + 'delete_question' => array(  | 
                                                        |
| 78 | + 'func' => '_delete_question',  | 
                                                        |
| 79 | + 'capability' => 'ee_delete_question',  | 
                                                        |
| 80 | + 'obj_id' => $qst_id,  | 
                                                        |
| 81 | + 'noheader' => true,  | 
                                                        |
| 82 | + ),  | 
                                                        |
| 83 | +  | 
                                                        |
| 84 | + 'trash_questions' => array(  | 
                                                        |
| 85 | + 'func' => '_trash_or_restore_questions',  | 
                                                        |
| 86 | + 'capability' => 'ee_delete_questions',  | 
                                                        |
| 87 | +				'args'       => array('trash' => true), | 
                                                        |
| 88 | + 'noheader' => true,  | 
                                                        |
| 89 | + ),  | 
                                                        |
| 90 | +  | 
                                                        |
| 91 | + 'restore_questions' => array(  | 
                                                        |
| 92 | + 'func' => '_trash_or_restore_questions',  | 
                                                        |
| 93 | + 'capability' => 'ee_delete_questions',  | 
                                                        |
| 94 | +				'args'       => array('trash' => false), | 
                                                        |
| 95 | + 'noheader' => true,  | 
                                                        |
| 96 | + ),  | 
                                                        |
| 97 | +  | 
                                                        |
| 98 | + 'delete_questions' => array(  | 
                                                        |
| 99 | + 'func' => '_delete_questions',  | 
                                                        |
| 100 | + 'args' => array(),  | 
                                                        |
| 101 | + 'capability' => 'ee_delete_questions',  | 
                                                        |
| 102 | + 'noheader' => true,  | 
                                                        |
| 103 | + ),  | 
                                                        |
| 104 | +  | 
                                                        |
| 105 | + 'add_question_group' => array(  | 
                                                        |
| 106 | + 'func' => '_edit_question_group',  | 
                                                        |
| 107 | + 'capability' => 'ee_edit_question_groups',  | 
                                                        |
| 108 | + ),  | 
                                                        |
| 109 | +  | 
                                                        |
| 110 | + 'edit_question_group' => array(  | 
                                                        |
| 111 | + 'func' => '_edit_question_group',  | 
                                                        |
| 112 | + 'capability' => 'ee_edit_question_group',  | 
                                                        |
| 113 | + 'obj_id' => $qsg_id,  | 
                                                        |
| 114 | +				'args'       => array('edit'), | 
                                                        |
| 115 | + ),  | 
                                                        |
| 116 | +  | 
                                                        |
| 117 | + 'delete_question_groups' => array(  | 
                                                        |
| 118 | + 'func' => '_delete_question_groups',  | 
                                                        |
| 119 | + 'capability' => 'ee_delete_question_groups',  | 
                                                        |
| 120 | + 'noheader' => true,  | 
                                                        |
| 121 | + ),  | 
                                                        |
| 122 | +  | 
                                                        |
| 123 | + 'delete_question_group' => array(  | 
                                                        |
| 124 | + 'func' => '_delete_question_groups',  | 
                                                        |
| 125 | + 'capability' => 'ee_delete_question_group',  | 
                                                        |
| 126 | + 'obj_id' => $qsg_id,  | 
                                                        |
| 127 | + 'noheader' => true,  | 
                                                        |
| 128 | + ),  | 
                                                        |
| 129 | +  | 
                                                        |
| 130 | + 'trash_question_group' => array(  | 
                                                        |
| 131 | + 'func' => '_trash_or_restore_question_groups',  | 
                                                        |
| 132 | +				'args'       => array('trash' => true), | 
                                                        |
| 133 | + 'capability' => 'ee_delete_question_group',  | 
                                                        |
| 134 | + 'obj_id' => $qsg_id,  | 
                                                        |
| 135 | + 'noheader' => true,  | 
                                                        |
| 136 | + ),  | 
                                                        |
| 137 | +  | 
                                                        |
| 138 | + 'restore_question_group' => array(  | 
                                                        |
| 139 | + 'func' => '_trash_or_restore_question_groups',  | 
                                                        |
| 140 | +				'args'       => array('trash' => false), | 
                                                        |
| 141 | + 'capability' => 'ee_delete_question_group',  | 
                                                        |
| 142 | + 'obj_id' => $qsg_id,  | 
                                                        |
| 143 | + 'noheader' => true,  | 
                                                        |
| 144 | + ),  | 
                                                        |
| 145 | +  | 
                                                        |
| 146 | + 'insert_question_group' => array(  | 
                                                        |
| 147 | + 'func' => '_insert_or_update_question_group',  | 
                                                        |
| 148 | +				'args'       => array('new_question_group' => true), | 
                                                        |
| 149 | + 'capability' => 'ee_edit_question_groups',  | 
                                                        |
| 150 | + 'noheader' => true,  | 
                                                        |
| 151 | + ),  | 
                                                        |
| 152 | +  | 
                                                        |
| 153 | + 'update_question_group' => array(  | 
                                                        |
| 154 | + 'func' => '_insert_or_update_question_group',  | 
                                                        |
| 155 | +				'args'       => array('new_question_group' => false), | 
                                                        |
| 156 | + 'capability' => 'ee_edit_question_group',  | 
                                                        |
| 157 | + 'obj_id' => $qsg_id,  | 
                                                        |
| 158 | + 'noheader' => true,  | 
                                                        |
| 159 | + ),  | 
                                                        |
| 160 | +  | 
                                                        |
| 161 | + 'trash_question_groups' => array(  | 
                                                        |
| 162 | + 'func' => '_trash_or_restore_question_groups',  | 
                                                        |
| 163 | +				'args'       => array('trash' => true), | 
                                                        |
| 164 | + 'capability' => 'ee_delete_question_groups',  | 
                                                        |
| 165 | +				'noheader'   => array('trash' => false), | 
                                                        |
| 166 | + ),  | 
                                                        |
| 167 | +  | 
                                                        |
| 168 | + 'restore_question_groups' => array(  | 
                                                        |
| 169 | + 'func' => '_trash_or_restore_question_groups',  | 
                                                        |
| 170 | +				'args'       => array('trash' => false), | 
                                                        |
| 171 | + 'capability' => 'ee_delete_question_groups',  | 
                                                        |
| 172 | + 'noheader' => true,  | 
                                                        |
| 173 | + ),  | 
                                                        |
| 174 | +  | 
                                                        |
| 175 | +  | 
                                                        |
| 176 | + 'espresso_update_question_group_order' => array(  | 
                                                        |
| 177 | + 'func' => 'update_question_group_order',  | 
                                                        |
| 178 | + 'capability' => 'ee_edit_question_groups',  | 
                                                        |
| 179 | + 'noheader' => true,  | 
                                                        |
| 180 | + ),  | 
                                                        |
| 181 | +  | 
                                                        |
| 182 | + 'view_reg_form_settings' => array(  | 
                                                        |
| 183 | + 'func' => '_reg_form_settings',  | 
                                                        |
| 184 | + 'capability' => 'manage_options',  | 
                                                        |
| 185 | + ),  | 
                                                        |
| 186 | +  | 
                                                        |
| 187 | + 'update_reg_form_settings' => array(  | 
                                                        |
| 188 | + 'func' => '_update_reg_form_settings',  | 
                                                        |
| 189 | + 'capability' => 'manage_options',  | 
                                                        |
| 190 | + 'noheader' => true,  | 
                                                        |
| 191 | + ),  | 
                                                        |
| 192 | + );  | 
                                                        |
| 193 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes);  | 
                                                        |
| 194 | +  | 
                                                        |
| 195 | + $new_page_config = array(  | 
                                                        |
| 196 | +  | 
                                                        |
| 197 | + 'question_groups' => array(  | 
                                                        |
| 198 | + 'nav' => array(  | 
                                                        |
| 199 | +					'label' => esc_html__('Question Groups', 'event_espresso'), | 
                                                        |
| 200 | + 'order' => 20,  | 
                                                        |
| 201 | + ),  | 
                                                        |
| 202 | + 'list_table' => 'Registration_Form_Question_Groups_Admin_List_Table',  | 
                                                        |
| 203 | + 'help_tabs' => array(  | 
                                                        |
| 204 | + 'registration_form_question_groups_help_tab' => array(  | 
                                                        |
| 205 | +						'title'    => esc_html__('Question Groups', 'event_espresso'), | 
                                                        |
| 206 | + 'filename' => 'registration_form_question_groups',  | 
                                                        |
| 207 | + ),  | 
                                                        |
| 208 | + 'registration_form_question_groups_table_column_headings_help_tab' => array(  | 
                                                        |
| 209 | +						'title'    => esc_html__('Question Groups Table Column Headings', 'event_espresso'), | 
                                                        |
| 210 | + 'filename' => 'registration_form_question_groups_table_column_headings',  | 
                                                        |
| 211 | + ),  | 
                                                        |
| 212 | + 'registration_form_question_groups_views_bulk_actions_search_help_tab' => array(  | 
                                                        |
| 213 | +						'title'    => esc_html__('Question Groups Views & Bulk Actions & Search', 'event_espresso'), | 
                                                        |
| 214 | + 'filename' => 'registration_form_question_groups_views_bulk_actions_search',  | 
                                                        |
| 215 | + ),  | 
                                                        |
| 216 | + ),  | 
                                                        |
| 217 | +				'help_tour'     => array('Registration_Form_Question_Groups_Help_Tour'), | 
                                                        |
| 218 | + 'metaboxes' => $this->_default_espresso_metaboxes,  | 
                                                        |
| 219 | + 'require_nonce' => false,  | 
                                                        |
| 220 | + 'qtips' => array(  | 
                                                        |
| 221 | + 'EE_Registration_Form_Tips',  | 
                                                        |
| 222 | + ),  | 
                                                        |
| 223 | + ),  | 
                                                        |
| 224 | +  | 
                                                        |
| 225 | + 'add_question' => array(  | 
                                                        |
| 226 | + 'nav' => array(  | 
                                                        |
| 227 | +					'label'      => esc_html__('Add Question', 'event_espresso'), | 
                                                        |
| 228 | + 'order' => 5,  | 
                                                        |
| 229 | + 'persistent' => false,  | 
                                                        |
| 230 | + ),  | 
                                                        |
| 231 | +				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 232 | + 'help_tabs' => array(  | 
                                                        |
| 233 | + 'registration_form_add_question_help_tab' => array(  | 
                                                        |
| 234 | +						'title'    => esc_html__('Add Question', 'event_espresso'), | 
                                                        |
| 235 | + 'filename' => 'registration_form_add_question',  | 
                                                        |
| 236 | + ),  | 
                                                        |
| 237 | + ),  | 
                                                        |
| 238 | +				'help_tour'     => array('Registration_Form_Add_Question_Help_Tour'), | 
                                                        |
| 239 | + 'require_nonce' => false,  | 
                                                        |
| 240 | + ),  | 
                                                        |
| 241 | +  | 
                                                        |
| 242 | + 'add_question_group' => array(  | 
                                                        |
| 243 | + 'nav' => array(  | 
                                                        |
| 244 | +					'label'      => esc_html__('Add Question Group', 'event_espresso'), | 
                                                        |
| 245 | + 'order' => 5,  | 
                                                        |
| 246 | + 'persistent' => false,  | 
                                                        |
| 247 | + ),  | 
                                                        |
| 248 | +				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 249 | + 'help_tabs' => array(  | 
                                                        |
| 250 | + 'registration_form_add_question_group_help_tab' => array(  | 
                                                        |
| 251 | +						'title'    => esc_html__('Add Question Group', 'event_espresso'), | 
                                                        |
| 252 | + 'filename' => 'registration_form_add_question_group',  | 
                                                        |
| 253 | + ),  | 
                                                        |
| 254 | + ),  | 
                                                        |
| 255 | +				'help_tour'     => array('Registration_Form_Add_Question_Group_Help_Tour'), | 
                                                        |
| 256 | + 'require_nonce' => false,  | 
                                                        |
| 257 | + ),  | 
                                                        |
| 258 | +  | 
                                                        |
| 259 | + 'edit_question_group' => array(  | 
                                                        |
| 260 | + 'nav' => array(  | 
                                                        |
| 261 | +					'label'      => esc_html__('Edit Question Group', 'event_espresso'), | 
                                                        |
| 262 | + 'order' => 5,  | 
                                                        |
| 263 | + 'persistent' => false,  | 
                                                        |
| 264 | + 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(  | 
                                                        |
| 265 | +						array('question_group_id' => $this->_req_data['question_group_id']), | 
                                                        |
| 266 | + $this->_current_page_view_url  | 
                                                        |
| 267 | + ) : $this->_admin_base_url,  | 
                                                        |
| 268 | + ),  | 
                                                        |
| 269 | +				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 270 | + 'help_tabs' => array(  | 
                                                        |
| 271 | + 'registration_form_edit_question_group_help_tab' => array(  | 
                                                        |
| 272 | +						'title'    => esc_html__('Edit Question Group', 'event_espresso'), | 
                                                        |
| 273 | + 'filename' => 'registration_form_edit_question_group',  | 
                                                        |
| 274 | + ),  | 
                                                        |
| 275 | + ),  | 
                                                        |
| 276 | +				'help_tour'     => array('Registration_Form_Edit_Question_Group_Help_Tour'), | 
                                                        |
| 277 | + 'require_nonce' => false,  | 
                                                        |
| 278 | + ),  | 
                                                        |
| 279 | +  | 
                                                        |
| 280 | + 'view_reg_form_settings' => array(  | 
                                                        |
| 281 | + 'nav' => array(  | 
                                                        |
| 282 | +					'label' => esc_html__('Reg Form Settings', 'event_espresso'), | 
                                                        |
| 283 | + 'order' => 40,  | 
                                                        |
| 284 | + ),  | 
                                                        |
| 285 | + 'labels' => array(  | 
                                                        |
| 286 | +					'publishbox' => esc_html__('Update Settings', 'event_espresso'), | 
                                                        |
| 287 | + ),  | 
                                                        |
| 288 | +				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), | 
                                                        |
| 289 | + 'help_tabs' => array(  | 
                                                        |
| 290 | + 'registration_form_reg_form_settings_help_tab' => array(  | 
                                                        |
| 291 | +						'title'    => esc_html__('Registration Form Settings', 'event_espresso'), | 
                                                        |
| 292 | + 'filename' => 'registration_form_reg_form_settings',  | 
                                                        |
| 293 | + ),  | 
                                                        |
| 294 | + ),  | 
                                                        |
| 295 | +				'help_tour'     => array('Registration_Form_Settings_Help_Tour'), | 
                                                        |
| 296 | + 'require_nonce' => false,  | 
                                                        |
| 297 | + ),  | 
                                                        |
| 298 | +  | 
                                                        |
| 299 | + );  | 
                                                        |
| 300 | + $this->_page_config = array_merge($this->_page_config, $new_page_config);  | 
                                                        |
| 301 | +  | 
                                                        |
| 302 | + // change the list table we're going to use so it's the NEW list table!  | 
                                                        |
| 303 | + $this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table';  | 
                                                        |
| 304 | +  | 
                                                        |
| 305 | +  | 
                                                        |
| 306 | + // additional labels  | 
                                                        |
| 307 | + $new_labels = array(  | 
                                                        |
| 308 | +			'add_question'          => esc_html__('Add New Question', 'event_espresso'), | 
                                                        |
| 309 | +			'delete_question'       => esc_html__('Delete Question', 'event_espresso'), | 
                                                        |
| 310 | +			'add_question_group'    => esc_html__('Add New Question Group', 'event_espresso'), | 
                                                        |
| 311 | +			'edit_question_group'   => esc_html__('Edit Question Group', 'event_espresso'), | 
                                                        |
| 312 | +			'delete_question_group' => esc_html__('Delete Question Group', 'event_espresso'), | 
                                                        |
| 313 | + );  | 
                                                        |
| 314 | + $this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels);  | 
                                                        |
| 315 | + }  | 
                                                        |
| 316 | +  | 
                                                        |
| 317 | +  | 
                                                        |
| 318 | + /**  | 
                                                        |
| 319 | + * @return void  | 
                                                        |
| 320 | + */  | 
                                                        |
| 321 | + protected function _ajax_hooks()  | 
                                                        |
| 322 | +	{ | 
                                                        |
| 323 | +		add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order')); | 
                                                        |
| 324 | + }  | 
                                                        |
| 325 | +  | 
                                                        |
| 326 | +  | 
                                                        |
| 327 | + /**  | 
                                                        |
| 328 | + * @return void  | 
                                                        |
| 329 | + */  | 
                                                        |
| 330 | + public function load_scripts_styles_question_groups()  | 
                                                        |
| 331 | +	{ | 
                                                        |
| 332 | +		wp_enqueue_script('espresso_ajax_table_sorting'); | 
                                                        |
| 333 | + }  | 
                                                        |
| 334 | +  | 
                                                        |
| 335 | +  | 
                                                        |
| 336 | + /**  | 
                                                        |
| 337 | + * @return void  | 
                                                        |
| 338 | + */  | 
                                                        |
| 339 | + public function load_scripts_styles_add_question_group()  | 
                                                        |
| 340 | +	{ | 
                                                        |
| 341 | + $this->load_scripts_styles_forms();  | 
                                                        |
| 342 | + $this->load_sortable_question_script();  | 
                                                        |
| 343 | + }  | 
                                                        |
| 344 | +  | 
                                                        |
| 345 | +  | 
                                                        |
| 346 | + /**  | 
                                                        |
| 347 | + * @return void  | 
                                                        |
| 348 | + */  | 
                                                        |
| 349 | + public function load_scripts_styles_edit_question_group()  | 
                                                        |
| 350 | +	{ | 
                                                        |
| 351 | + $this->load_scripts_styles_forms();  | 
                                                        |
| 352 | + $this->load_sortable_question_script();  | 
                                                        |
| 353 | + }  | 
                                                        |
| 354 | +  | 
                                                        |
| 355 | +  | 
                                                        |
| 356 | + /**  | 
                                                        |
| 357 | + * registers and enqueues script for questions  | 
                                                        |
| 358 | + *  | 
                                                        |
| 359 | + * @return void  | 
                                                        |
| 360 | + */  | 
                                                        |
| 361 | + public function load_sortable_question_script()  | 
                                                        |
| 362 | +	{ | 
                                                        |
| 363 | + wp_register_script(  | 
                                                        |
| 364 | + 'ee-question-sortable',  | 
                                                        |
| 365 | + REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js',  | 
                                                        |
| 366 | +			array('jquery-ui-sortable'), | 
                                                        |
| 367 | + EVENT_ESPRESSO_VERSION,  | 
                                                        |
| 368 | + true  | 
                                                        |
| 369 | + );  | 
                                                        |
| 370 | +		wp_enqueue_script('ee-question-sortable'); | 
                                                        |
| 371 | + }  | 
                                                        |
| 372 | +  | 
                                                        |
| 373 | +  | 
                                                        |
| 374 | + /**  | 
                                                        |
| 375 | + * @return void  | 
                                                        |
| 376 | + */  | 
                                                        |
| 377 | + protected function _set_list_table_views_default()  | 
                                                        |
| 378 | +	{ | 
                                                        |
| 379 | + $this->_views = array(  | 
                                                        |
| 380 | + 'all' => array(  | 
                                                        |
| 381 | + 'slug' => 'all',  | 
                                                        |
| 382 | +				'label'       => esc_html__('View All Questions', 'event_espresso'), | 
                                                        |
| 383 | + 'count' => 0,  | 
                                                        |
| 384 | + 'bulk_action' => array(  | 
                                                        |
| 385 | +					'trash_questions' => esc_html__('Trash', 'event_espresso'), | 
                                                        |
| 386 | + ),  | 
                                                        |
| 387 | + ),  | 
                                                        |
| 388 | + );  | 
                                                        |
| 389 | +  | 
                                                        |
| 390 | + if (EE_Registry::instance()->CAP->current_user_can(  | 
                                                        |
| 391 | + 'ee_delete_questions',  | 
                                                        |
| 392 | + 'espresso_registration_form_trash_questions'  | 
                                                        |
| 393 | + )  | 
                                                        |
| 394 | +		) { | 
                                                        |
| 395 | + $this->_views['trash'] = array(  | 
                                                        |
| 396 | + 'slug' => 'trash',  | 
                                                        |
| 397 | +				'label'       => esc_html__('Trash', 'event_espresso'), | 
                                                        |
| 398 | + 'count' => 0,  | 
                                                        |
| 399 | + 'bulk_action' => array(  | 
                                                        |
| 400 | +					'delete_questions'  => esc_html__('Delete Permanently', 'event_espresso'), | 
                                                        |
| 401 | +					'restore_questions' => esc_html__('Restore', 'event_espresso'), | 
                                                        |
| 402 | + ),  | 
                                                        |
| 403 | + );  | 
                                                        |
| 404 | + }  | 
                                                        |
| 405 | + }  | 
                                                        |
| 406 | +  | 
                                                        |
| 407 | +  | 
                                                        |
| 408 | + /**  | 
                                                        |
| 409 | + * @return void  | 
                                                        |
| 410 | + */  | 
                                                        |
| 411 | + protected function _set_list_table_views_question_groups()  | 
                                                        |
| 412 | +	{ | 
                                                        |
| 413 | + $this->_views = array(  | 
                                                        |
| 414 | + 'all' => array(  | 
                                                        |
| 415 | + 'slug' => 'all',  | 
                                                        |
| 416 | +				'label'       => esc_html__('All', 'event_espresso'), | 
                                                        |
| 417 | + 'count' => 0,  | 
                                                        |
| 418 | + 'bulk_action' => array(  | 
                                                        |
| 419 | +					'trash_question_groups' => esc_html__('Trash', 'event_espresso'), | 
                                                        |
| 420 | + ),  | 
                                                        |
| 421 | + ),  | 
                                                        |
| 422 | + );  | 
                                                        |
| 423 | +  | 
                                                        |
| 424 | + if (EE_Registry::instance()->CAP->current_user_can(  | 
                                                        |
| 425 | + 'ee_delete_question_groups',  | 
                                                        |
| 426 | + 'espresso_registration_form_trash_question_groups'  | 
                                                        |
| 427 | + )  | 
                                                        |
| 428 | +		) { | 
                                                        |
| 429 | + $this->_views['trash'] = array(  | 
                                                        |
| 430 | + 'slug' => 'trash',  | 
                                                        |
| 431 | +				'label'       => esc_html__('Trash', 'event_espresso'), | 
                                                        |
| 432 | + 'count' => 0,  | 
                                                        |
| 433 | + 'bulk_action' => array(  | 
                                                        |
| 434 | +					'delete_question_groups'  => esc_html__('Delete Permanently', 'event_espresso'), | 
                                                        |
| 435 | +					'restore_question_groups' => esc_html__('Restore', 'event_espresso'), | 
                                                        |
| 436 | + ),  | 
                                                        |
| 437 | + );  | 
                                                        |
| 438 | + }  | 
                                                        |
| 439 | + }  | 
                                                        |
| 440 | +  | 
                                                        |
| 441 | +  | 
                                                        |
| 442 | + /**  | 
                                                        |
| 443 | + * @return void  | 
                                                        |
| 444 | + * @throws EE_Error  | 
                                                        |
| 445 | + * @throws InvalidArgumentException  | 
                                                        |
| 446 | + * @throws InvalidDataTypeException  | 
                                                        |
| 447 | + * @throws InvalidInterfaceException  | 
                                                        |
| 448 | + */  | 
                                                        |
| 449 | + protected function _questions_overview_list_table()  | 
                                                        |
| 450 | +	{ | 
                                                        |
| 451 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(  | 
                                                        |
| 452 | + 'add_question',  | 
                                                        |
| 453 | + 'add_question',  | 
                                                        |
| 454 | + array(),  | 
                                                        |
| 455 | + 'add-new-h2'  | 
                                                        |
| 456 | + );  | 
                                                        |
| 457 | + parent::_questions_overview_list_table();  | 
                                                        |
| 458 | + }  | 
                                                        |
| 459 | +  | 
                                                        |
| 460 | +  | 
                                                        |
| 461 | + /**  | 
                                                        |
| 462 | + * @return void  | 
                                                        |
| 463 | + * @throws DomainException  | 
                                                        |
| 464 | + * @throws EE_Error  | 
                                                        |
| 465 | + * @throws InvalidArgumentException  | 
                                                        |
| 466 | + * @throws InvalidDataTypeException  | 
                                                        |
| 467 | + * @throws InvalidInterfaceException  | 
                                                        |
| 468 | + */  | 
                                                        |
| 469 | + protected function _question_groups_overview_list_table()  | 
                                                        |
| 470 | +	{ | 
                                                        |
| 471 | +		$this->_search_btn_label = esc_html__('Question Groups', 'event_espresso'); | 
                                                        |
| 472 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(  | 
                                                        |
| 473 | + 'add_question_group',  | 
                                                        |
| 474 | + 'add_question_group',  | 
                                                        |
| 475 | + array(),  | 
                                                        |
| 476 | + 'add-new-h2'  | 
                                                        |
| 477 | + );  | 
                                                        |
| 478 | + $this->display_admin_list_table_page_with_sidebar();  | 
                                                        |
| 479 | + }  | 
                                                        |
| 480 | +  | 
                                                        |
| 481 | +  | 
                                                        |
| 482 | + /**  | 
                                                        |
| 483 | + * @return void  | 
                                                        |
| 484 | + * @throws EE_Error  | 
                                                        |
| 485 | + * @throws InvalidArgumentException  | 
                                                        |
| 486 | + * @throws InvalidDataTypeException  | 
                                                        |
| 487 | + * @throws InvalidInterfaceException  | 
                                                        |
| 488 | + */  | 
                                                        |
| 489 | + protected function _delete_question()  | 
                                                        |
| 490 | +	{ | 
                                                        |
| 491 | + $success = $this->_delete_items($this->_question_model);  | 
                                                        |
| 492 | + $this->_redirect_after_action(  | 
                                                        |
| 493 | + $success,  | 
                                                        |
| 494 | + $this->_question_model->item_name($success),  | 
                                                        |
| 495 | + 'deleted',  | 
                                                        |
| 496 | +			array('action' => 'default', 'status' => 'all') | 
                                                        |
| 497 | + );  | 
                                                        |
| 498 | + }  | 
                                                        |
| 499 | +  | 
                                                        |
| 500 | +  | 
                                                        |
| 501 | + /**  | 
                                                        |
| 502 | + * @return void  | 
                                                        |
| 503 | + * @throws EE_Error  | 
                                                        |
| 504 | + * @throws InvalidArgumentException  | 
                                                        |
| 505 | + * @throws InvalidDataTypeException  | 
                                                        |
| 506 | + * @throws InvalidInterfaceException  | 
                                                        |
| 507 | + */  | 
                                                        |
| 508 | + protected function _delete_questions()  | 
                                                        |
| 509 | +	{ | 
                                                        |
| 510 | + $success = $this->_delete_items($this->_question_model);  | 
                                                        |
| 511 | + $this->_redirect_after_action(  | 
                                                        |
| 512 | + $success,  | 
                                                        |
| 513 | + $this->_question_model->item_name($success),  | 
                                                        |
| 514 | + 'deleted permanently',  | 
                                                        |
| 515 | +			array('action' => 'default', 'status' => 'trash') | 
                                                        |
| 516 | + );  | 
                                                        |
| 517 | + }  | 
                                                        |
| 518 | +  | 
                                                        |
| 519 | +  | 
                                                        |
| 520 | + /**  | 
                                                        |
| 521 | + * Performs the deletion of a single or multiple questions or question groups.  | 
                                                        |
| 522 | + *  | 
                                                        |
| 523 | + * @param EEM_Soft_Delete_Base $model  | 
                                                        |
| 524 | + * @return int number of items deleted permanently  | 
                                                        |
| 525 | + * @throws EE_Error  | 
                                                        |
| 526 | + * @throws InvalidArgumentException  | 
                                                        |
| 527 | + * @throws InvalidDataTypeException  | 
                                                        |
| 528 | + * @throws InvalidInterfaceException  | 
                                                        |
| 529 | + */  | 
                                                        |
| 530 | + private function _delete_items(EEM_Soft_Delete_Base $model)  | 
                                                        |
| 531 | +	{ | 
                                                        |
| 532 | + $success = 0;  | 
                                                        |
| 533 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 534 | +		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { | 
                                                        |
| 535 | + // if array has more than one element than success message should be plural  | 
                                                        |
| 536 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;  | 
                                                        |
| 537 | + // cycle thru bulk action checkboxes  | 
                                                        |
| 538 | +			while (list($ID, $value) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 539 | +				if (! $this->_delete_item($ID, $model)) { | 
                                                        |
| 540 | + $success = 0;  | 
                                                        |
| 541 | + }  | 
                                                        |
| 542 | + }  | 
                                                        |
| 543 | +		} elseif (! empty($this->_req_data['QSG_ID'])) { | 
                                                        |
| 544 | + $success = $this->_delete_item($this->_req_data['QSG_ID'], $model);  | 
                                                        |
| 545 | +		} elseif (! empty($this->_req_data['QST_ID'])) { | 
                                                        |
| 546 | + $success = $this->_delete_item($this->_req_data['QST_ID'], $model);  | 
                                                        |
| 547 | +		} else { | 
                                                        |
| 548 | + EE_Error::add_error(  | 
                                                        |
| 549 | + sprintf(  | 
                                                        |
| 550 | + esc_html__(  | 
                                                        |
| 551 | + "No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.",  | 
                                                        |
| 552 | + "event_espresso"  | 
                                                        |
| 553 | + )  | 
                                                        |
| 554 | + ),  | 
                                                        |
| 555 | + __FILE__,  | 
                                                        |
| 556 | + __FUNCTION__,  | 
                                                        |
| 557 | + __LINE__  | 
                                                        |
| 558 | + );  | 
                                                        |
| 559 | + }  | 
                                                        |
| 560 | + return $success;  | 
                                                        |
| 561 | + }  | 
                                                        |
| 562 | +  | 
                                                        |
| 563 | +  | 
                                                        |
| 564 | + /**  | 
                                                        |
| 565 | + * Deletes the specified question (and its associated question options) or question group  | 
                                                        |
| 566 | + *  | 
                                                        |
| 567 | + * @param int $id  | 
                                                        |
| 568 | + * @param EEM_Soft_Delete_Base $model  | 
                                                        |
| 569 | + * @return boolean  | 
                                                        |
| 570 | + * @throws EE_Error  | 
                                                        |
| 571 | + * @throws InvalidArgumentException  | 
                                                        |
| 572 | + * @throws InvalidDataTypeException  | 
                                                        |
| 573 | + * @throws InvalidInterfaceException  | 
                                                        |
| 574 | + */  | 
                                                        |
| 575 | + protected function _delete_item($id, $model)  | 
                                                        |
| 576 | +	{ | 
                                                        |
| 577 | +		if ($model instanceof EEM_Question) { | 
                                                        |
| 578 | +			EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id)))); | 
                                                        |
| 579 | + }  | 
                                                        |
| 580 | + return $model->delete_permanently_by_ID(absint($id));  | 
                                                        |
| 581 | + }  | 
                                                        |
| 582 | +  | 
                                                        |
| 583 | +  | 
                                                        |
| 584 | + /****************************** QUESTION GROUPS ******************************/  | 
                                                        |
| 585 | +  | 
                                                        |
| 586 | +  | 
                                                        |
| 587 | + /**  | 
                                                        |
| 588 | + * @param string $type  | 
                                                        |
| 589 | + * @return void  | 
                                                        |
| 590 | + * @throws DomainException  | 
                                                        |
| 591 | + * @throws EE_Error  | 
                                                        |
| 592 | + * @throws InvalidArgumentException  | 
                                                        |
| 593 | + * @throws InvalidDataTypeException  | 
                                                        |
| 594 | + * @throws InvalidInterfaceException  | 
                                                        |
| 595 | + */  | 
                                                        |
| 596 | + protected function _edit_question_group($type = 'add')  | 
                                                        |
| 597 | +	{ | 
                                                        |
| 598 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 599 | + $ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID'])  | 
                                                        |
| 600 | + ? absint($this->_req_data['QSG_ID'])  | 
                                                        |
| 601 | + : false;  | 
                                                        |
| 602 | +  | 
                                                        |
| 603 | +		switch ($this->_req_action) { | 
                                                        |
| 604 | + case 'add_question_group':  | 
                                                        |
| 605 | +				$this->_admin_page_title = esc_html__('Add Question Group', 'event_espresso'); | 
                                                        |
| 606 | + break;  | 
                                                        |
| 607 | + case 'edit_question_group':  | 
                                                        |
| 608 | +				$this->_admin_page_title = esc_html__('Edit Question Group', 'event_espresso'); | 
                                                        |
| 609 | + break;  | 
                                                        |
| 610 | + default:  | 
                                                        |
| 611 | +				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); | 
                                                        |
| 612 | + }  | 
                                                        |
| 613 | + // add ID to title if editing  | 
                                                        |
| 614 | + $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;  | 
                                                        |
| 615 | +		if ($ID) { | 
                                                        |
| 616 | + /** @var EE_Question_Group $questionGroup */  | 
                                                        |
| 617 | + $questionGroup = $this->_question_group_model->get_one_by_ID($ID);  | 
                                                        |
| 618 | +			$additional_hidden_fields = array('QSG_ID' => array('type' => 'hidden', 'value' => $ID)); | 
                                                        |
| 619 | +			$this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields); | 
                                                        |
| 620 | +		} else { | 
                                                        |
| 621 | + /** @var EE_Question_Group $questionGroup */  | 
                                                        |
| 622 | + $questionGroup = EEM_Question_Group::instance()->create_default_object();  | 
                                                        |
| 623 | + $questionGroup->set_order_to_latest();  | 
                                                        |
| 624 | +			$this->_set_add_edit_form_tags('insert_question_group'); | 
                                                        |
| 625 | + }  | 
                                                        |
| 626 | + $this->_template_args['values'] = $this->_yes_no_values;  | 
                                                        |
| 627 | + $this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group();  | 
                                                        |
| 628 | + $this->_template_args['QSG_ID'] = $ID ? $ID : true;  | 
                                                        |
| 629 | + $this->_template_args['question_group'] = $questionGroup;  | 
                                                        |
| 630 | +  | 
                                                        |
| 631 | +		$redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url); | 
                                                        |
| 632 | +		$this->_set_publish_post_box_vars('id', $ID, false, $redirect_URL); | 
                                                        |
| 633 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(  | 
                                                        |
| 634 | + REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php',  | 
                                                        |
| 635 | + $this->_template_args,  | 
                                                        |
| 636 | + true  | 
                                                        |
| 637 | + );  | 
                                                        |
| 638 | +  | 
                                                        |
| 639 | + // the details template wrapper  | 
                                                        |
| 640 | + $this->display_admin_page_with_sidebar();  | 
                                                        |
| 641 | + }  | 
                                                        |
| 642 | +  | 
                                                        |
| 643 | +  | 
                                                        |
| 644 | + /**  | 
                                                        |
| 645 | + * @return void  | 
                                                        |
| 646 | + * @throws EE_Error  | 
                                                        |
| 647 | + * @throws InvalidArgumentException  | 
                                                        |
| 648 | + * @throws InvalidDataTypeException  | 
                                                        |
| 649 | + * @throws InvalidInterfaceException  | 
                                                        |
| 650 | + */  | 
                                                        |
| 651 | + protected function _delete_question_groups()  | 
                                                        |
| 652 | +	{ | 
                                                        |
| 653 | + $success = $this->_delete_items($this->_question_group_model);  | 
                                                        |
| 654 | + $this->_redirect_after_action(  | 
                                                        |
| 655 | + $success,  | 
                                                        |
| 656 | + $this->_question_group_model->item_name($success),  | 
                                                        |
| 657 | + 'deleted permanently',  | 
                                                        |
| 658 | +			array('action' => 'question_groups', 'status' => 'trash') | 
                                                        |
| 659 | + );  | 
                                                        |
| 660 | + }  | 
                                                        |
| 661 | +  | 
                                                        |
| 662 | +  | 
                                                        |
| 663 | + /**  | 
                                                        |
| 664 | + * @param bool $new_question_group  | 
                                                        |
| 665 | + * @throws EE_Error  | 
                                                        |
| 666 | + * @throws InvalidArgumentException  | 
                                                        |
| 667 | + * @throws InvalidDataTypeException  | 
                                                        |
| 668 | + * @throws InvalidInterfaceException  | 
                                                        |
| 669 | + */  | 
                                                        |
| 670 | + protected function _insert_or_update_question_group($new_question_group = true)  | 
                                                        |
| 671 | +	{ | 
                                                        |
| 672 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 673 | + $set_column_values = $this->_set_column_values_for($this->_question_group_model);  | 
                                                        |
| 674 | +		if ($new_question_group) { | 
                                                        |
| 675 | + // make sure identifier is unique  | 
                                                        |
| 676 | + $identifier_value = isset($set_column_values['QSG_identifier']) ? $set_column_values['QSG_identifier'] : '';  | 
                                                        |
| 677 | + $identifier_exists = ! empty($identifier_value)  | 
                                                        |
| 678 | + ? $this->_question_group_model->count([['QSG_identifier' => $set_column_values['QSG_identifier']]]) > 0  | 
                                                        |
| 679 | + : false;  | 
                                                        |
| 680 | +			if ($identifier_exists) { | 
                                                        |
| 681 | +				$set_column_values['QSG_identifier'] .= uniqid('id', true); | 
                                                        |
| 682 | + }  | 
                                                        |
| 683 | + $QSG_ID = $this->_question_group_model->insert($set_column_values);  | 
                                                        |
| 684 | + $success = $QSG_ID ? 1 : 0;  | 
                                                        |
| 685 | +			if ($success === 0) { | 
                                                        |
| 686 | + EE_Error::add_error(  | 
                                                        |
| 687 | +					esc_html__('Something went wrong saving the question group.', 'event_espresso'), | 
                                                        |
| 688 | + __FILE__,  | 
                                                        |
| 689 | + __FUNCTION__,  | 
                                                        |
| 690 | + __LINE__  | 
                                                        |
| 691 | + );  | 
                                                        |
| 692 | + $this->_redirect_after_action(  | 
                                                        |
| 693 | + false,  | 
                                                        |
| 694 | + '',  | 
                                                        |
| 695 | + '',  | 
                                                        |
| 696 | +					array('action' => 'edit_question_group', 'QSG_ID' => $QSG_ID), | 
                                                        |
| 697 | + true  | 
                                                        |
| 698 | + );  | 
                                                        |
| 699 | + }  | 
                                                        |
| 700 | +		} else { | 
                                                        |
| 701 | + $QSG_ID = absint($this->_req_data['QSG_ID']);  | 
                                                        |
| 702 | + unset($set_column_values['QSG_ID']);  | 
                                                        |
| 703 | +			$success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID))); | 
                                                        |
| 704 | + }  | 
                                                        |
| 705 | +  | 
                                                        |
| 706 | + $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(  | 
                                                        |
| 707 | + EEM_Attendee::system_question_phone  | 
                                                        |
| 708 | + );  | 
                                                        |
| 709 | + // update the existing related questions  | 
                                                        |
| 710 | + // BUT FIRST... delete the phone question from the Question_Group_Question  | 
                                                        |
| 711 | + // if it is being added to this question group (therefore removed from the existing group)  | 
                                                        |
| 712 | +		if (isset($this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ])) { | 
                                                        |
| 713 | + // delete where QST ID = system phone question ID and Question Group ID is NOT this group  | 
                                                        |
| 714 | + EEM_Question_Group_Question::instance()->delete(  | 
                                                        |
| 715 | + array(  | 
                                                        |
| 716 | + array(  | 
                                                        |
| 717 | + 'QST_ID' => $phone_question_id,  | 
                                                        |
| 718 | +						'QSG_ID' => array('!=', $QSG_ID), | 
                                                        |
| 719 | + ),  | 
                                                        |
| 720 | + )  | 
                                                        |
| 721 | + );  | 
                                                        |
| 722 | + }  | 
                                                        |
| 723 | + /** @type EE_Question_Group $question_group */  | 
                                                        |
| 724 | + $question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);  | 
                                                        |
| 725 | + $questions = $question_group->questions();  | 
                                                        |
| 726 | + // make sure system phone question is added to list of questions for this group  | 
                                                        |
| 727 | +		if (! isset($questions[ $phone_question_id ])) { | 
                                                        |
| 728 | + $questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID($phone_question_id);  | 
                                                        |
| 729 | + }  | 
                                                        |
| 730 | +  | 
                                                        |
| 731 | +		foreach ($questions as $question_ID => $question) { | 
                                                        |
| 732 | + // first we always check for order.  | 
                                                        |
| 733 | +			if (! empty($this->_req_data['question_orders'][ $question_ID ])) { | 
                                                        |
| 734 | + // update question order  | 
                                                        |
| 735 | + $question_group->update_question_order(  | 
                                                        |
| 736 | + $question_ID,  | 
                                                        |
| 737 | + $this->_req_data['question_orders'][ $question_ID ]  | 
                                                        |
| 738 | + );  | 
                                                        |
| 739 | + }  | 
                                                        |
| 740 | +  | 
                                                        |
| 741 | + // then we always check if adding or removing.  | 
                                                        |
| 742 | +			if (isset($this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ])) { | 
                                                        |
| 743 | + $question_group->add_question($question_ID);  | 
                                                        |
| 744 | +			} else { | 
                                                        |
| 745 | + // not found, remove it (but only if not a system question for the personal group  | 
                                                        |
| 746 | + // with the exception of lname system question - we allow removal of it)  | 
                                                        |
| 747 | + if (in_array(  | 
                                                        |
| 748 | + $question->system_ID(),  | 
                                                        |
| 749 | + EEM_Question::instance()->required_system_questions_in_system_question_group(  | 
                                                        |
| 750 | + $question_group->system_group()  | 
                                                        |
| 751 | + )  | 
                                                        |
| 752 | +				)) { | 
                                                        |
| 753 | + continue;  | 
                                                        |
| 754 | +				} else { | 
                                                        |
| 755 | + $question_group->remove_question($question_ID);  | 
                                                        |
| 756 | + }  | 
                                                        |
| 757 | + }  | 
                                                        |
| 758 | + }  | 
                                                        |
| 759 | + // save new related questions  | 
                                                        |
| 760 | +		if (isset($this->_req_data['questions'])) { | 
                                                        |
| 761 | +			foreach ($this->_req_data['questions'] as $QST_ID) { | 
                                                        |
| 762 | + $question_group->add_question($QST_ID);  | 
                                                        |
| 763 | +				if (isset($this->_req_data['question_orders'][ $QST_ID ])) { | 
                                                        |
| 764 | + $question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][ $QST_ID ]);  | 
                                                        |
| 765 | + }  | 
                                                        |
| 766 | + }  | 
                                                        |
| 767 | + }  | 
                                                        |
| 768 | +  | 
                                                        |
| 769 | +		if ($success !== false) { | 
                                                        |
| 770 | + $msg = $new_question_group  | 
                                                        |
| 771 | + ? sprintf(  | 
                                                        |
| 772 | +					esc_html__('The %s has been created', 'event_espresso'), | 
                                                        |
| 773 | + $this->_question_group_model->item_name()  | 
                                                        |
| 774 | + )  | 
                                                        |
| 775 | + : sprintf(  | 
                                                        |
| 776 | + esc_html__(  | 
                                                        |
| 777 | + 'The %s has been updated',  | 
                                                        |
| 778 | + 'event_espresso'  | 
                                                        |
| 779 | + ),  | 
                                                        |
| 780 | + $this->_question_group_model->item_name()  | 
                                                        |
| 781 | + );  | 
                                                        |
| 782 | + EE_Error::add_success($msg);  | 
                                                        |
| 783 | + }  | 
                                                        |
| 784 | + $this->_redirect_after_action(  | 
                                                        |
| 785 | + false,  | 
                                                        |
| 786 | + '',  | 
                                                        |
| 787 | + '',  | 
                                                        |
| 788 | +			array('action' => 'edit_question_group', 'QSG_ID' => $QSG_ID), | 
                                                        |
| 789 | + true  | 
                                                        |
| 790 | + );  | 
                                                        |
| 791 | + }  | 
                                                        |
| 792 | +  | 
                                                        |
| 793 | +  | 
                                                        |
| 794 | + /**  | 
                                                        |
| 795 | + * duplicates a question and all its question options and redirects to the new question.  | 
                                                        |
| 796 | + *  | 
                                                        |
| 797 | + * @return void  | 
                                                        |
| 798 | + * @throws EE_Error  | 
                                                        |
| 799 | + * @throws InvalidArgumentException  | 
                                                        |
| 800 | + * @throws ReflectionException  | 
                                                        |
| 801 | + * @throws InvalidDataTypeException  | 
                                                        |
| 802 | + * @throws InvalidInterfaceException  | 
                                                        |
| 803 | + */  | 
                                                        |
| 804 | + public function _duplicate_question()  | 
                                                        |
| 805 | +	{ | 
                                                        |
| 806 | + $question_ID = (int) $this->_req_data['QST_ID'];  | 
                                                        |
| 807 | + $question = EEM_Question::instance()->get_one_by_ID($question_ID);  | 
                                                        |
| 808 | +		if ($question instanceof EE_Question) { | 
                                                        |
| 809 | + $new_question = $question->duplicate();  | 
                                                        |
| 810 | +			if ($new_question instanceof EE_Question) { | 
                                                        |
| 811 | + $this->_redirect_after_action(  | 
                                                        |
| 812 | + true,  | 
                                                        |
| 813 | +					esc_html__('Question', 'event_espresso'), | 
                                                        |
| 814 | +					esc_html__('Duplicated', 'event_espresso'), | 
                                                        |
| 815 | +					array('action' => 'edit_question', 'QST_ID' => $new_question->ID()), | 
                                                        |
| 816 | + true  | 
                                                        |
| 817 | + );  | 
                                                        |
| 818 | +			} else { | 
                                                        |
| 819 | + global $wpdb;  | 
                                                        |
| 820 | + EE_Error::add_error(  | 
                                                        |
| 821 | + sprintf(  | 
                                                        |
| 822 | + esc_html__(  | 
                                                        |
| 823 | + 'Could not duplicate question with ID %1$d because: %2$s',  | 
                                                        |
| 824 | + 'event_espresso'  | 
                                                        |
| 825 | + ),  | 
                                                        |
| 826 | + $question_ID,  | 
                                                        |
| 827 | + $wpdb->last_error  | 
                                                        |
| 828 | + ),  | 
                                                        |
| 829 | + __FILE__,  | 
                                                        |
| 830 | + __FUNCTION__,  | 
                                                        |
| 831 | + __LINE__  | 
                                                        |
| 832 | + );  | 
                                                        |
| 833 | +				$this->_redirect_after_action(false, '', '', array('action' => 'default'), false); | 
                                                        |
| 834 | + }  | 
                                                        |
| 835 | +		} else { | 
                                                        |
| 836 | + EE_Error::add_error(  | 
                                                        |
| 837 | + sprintf(  | 
                                                        |
| 838 | + esc_html__(  | 
                                                        |
| 839 | + 'Could not duplicate question with ID %d because it didn\'t exist!',  | 
                                                        |
| 840 | + 'event_espresso'  | 
                                                        |
| 841 | + ),  | 
                                                        |
| 842 | + $question_ID  | 
                                                        |
| 843 | + ),  | 
                                                        |
| 844 | + __FILE__,  | 
                                                        |
| 845 | + __FUNCTION__,  | 
                                                        |
| 846 | + __LINE__  | 
                                                        |
| 847 | + );  | 
                                                        |
| 848 | +			$this->_redirect_after_action(false, '', '', array('action' => 'default'), false); | 
                                                        |
| 849 | + }  | 
                                                        |
| 850 | + }  | 
                                                        |
| 851 | +  | 
                                                        |
| 852 | +  | 
                                                        |
| 853 | + /**  | 
                                                        |
| 854 | + * @param bool $trash  | 
                                                        |
| 855 | + * @throws EE_Error  | 
                                                        |
| 856 | + */  | 
                                                        |
| 857 | + protected function _trash_or_restore_question_groups($trash = true)  | 
                                                        |
| 858 | +	{ | 
                                                        |
| 859 | + $this->_trash_or_restore_items($this->_question_group_model, $trash);  | 
                                                        |
| 860 | + }  | 
                                                        |
| 861 | +  | 
                                                        |
| 862 | +  | 
                                                        |
| 863 | + /**  | 
                                                        |
| 864 | + *_trash_question  | 
                                                        |
| 865 | + *  | 
                                                        |
| 866 | + * @return void  | 
                                                        |
| 867 | + * @throws EE_Error  | 
                                                        |
| 868 | + */  | 
                                                        |
| 869 | + protected function _trash_question()  | 
                                                        |
| 870 | +	{ | 
                                                        |
| 871 | + $success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']);  | 
                                                        |
| 872 | +		$query_args = array('action' => 'default', 'status' => 'all'); | 
                                                        |
| 873 | + $this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args);  | 
                                                        |
| 874 | + }  | 
                                                        |
| 875 | +  | 
                                                        |
| 876 | +  | 
                                                        |
| 877 | + /**  | 
                                                        |
| 878 | + * @param bool $trash  | 
                                                        |
| 879 | + * @throws EE_Error  | 
                                                        |
| 880 | + */  | 
                                                        |
| 881 | + protected function _trash_or_restore_questions($trash = true)  | 
                                                        |
| 882 | +	{ | 
                                                        |
| 883 | + $this->_trash_or_restore_items($this->_question_model, $trash);  | 
                                                        |
| 884 | + }  | 
                                                        |
| 885 | +  | 
                                                        |
| 886 | +  | 
                                                        |
| 887 | + /**  | 
                                                        |
| 888 | + * Internally used to delete or restore items, using the request data. Meant to be  | 
                                                        |
| 889 | + * flexible between question or question groups  | 
                                                        |
| 890 | + *  | 
                                                        |
| 891 | + * @param EEM_Soft_Delete_Base $model  | 
                                                        |
| 892 | + * @param boolean $trash whether to trash or restore  | 
                                                        |
| 893 | + * @throws EE_Error  | 
                                                        |
| 894 | + */  | 
                                                        |
| 895 | + private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = true)  | 
                                                        |
| 896 | +	{ | 
                                                        |
| 897 | +  | 
                                                        |
| 898 | +		do_action('AHEE_log', __FILE__, __FUNCTION__, ''); | 
                                                        |
| 899 | +  | 
                                                        |
| 900 | + $success = 1;  | 
                                                        |
| 901 | + // Checkboxes  | 
                                                        |
| 902 | + // echo "trash $trash";  | 
                                                        |
| 903 | + // var_dump($this->_req_data['checkbox']);die;  | 
                                                        |
| 904 | +		if (isset($this->_req_data['checkbox'])) { | 
                                                        |
| 905 | +			if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { | 
                                                        |
| 906 | + // if array has more than one element than success message should be plural  | 
                                                        |
| 907 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;  | 
                                                        |
| 908 | + // cycle thru bulk action checkboxes  | 
                                                        |
| 909 | +				while (list($ID, $value) = each($this->_req_data['checkbox'])) { | 
                                                        |
| 910 | +					if (! $model->delete_or_restore_by_ID($trash, absint($ID))) { | 
                                                        |
| 911 | + $success = 0;  | 
                                                        |
| 912 | + }  | 
                                                        |
| 913 | + }  | 
                                                        |
| 914 | +			} else { | 
                                                        |
| 915 | + // grab single id and delete  | 
                                                        |
| 916 | + $ID = absint($this->_req_data['checkbox']);  | 
                                                        |
| 917 | +				if (! $model->delete_or_restore_by_ID($trash, $ID)) { | 
                                                        |
| 918 | + $success = 0;  | 
                                                        |
| 919 | + }  | 
                                                        |
| 920 | + }  | 
                                                        |
| 921 | +		} else { | 
                                                        |
| 922 | + // delete via trash link  | 
                                                        |
| 923 | + // grab single id and delete  | 
                                                        |
| 924 | + $ID = absint($this->_req_data[ $model->primary_key_name() ]);  | 
                                                        |
| 925 | +			if (! $model->delete_or_restore_by_ID($trash, $ID)) { | 
                                                        |
| 926 | + $success = 0;  | 
                                                        |
| 927 | + }  | 
                                                        |
| 928 | + }  | 
                                                        |
| 929 | +  | 
                                                        |
| 930 | +  | 
                                                        |
| 931 | + $action = $model instanceof EEM_Question ? 'default' : 'question_groups';// strtolower( $model->item_name(2) );  | 
                                                        |
| 932 | + // echo "action :$action";  | 
                                                        |
| 933 | + // $action = 'questions' ? 'default' : $action;  | 
                                                        |
| 934 | +		if ($trash) { | 
                                                        |
| 935 | + $action_desc = 'trashed';  | 
                                                        |
| 936 | + $status = 'trash';  | 
                                                        |
| 937 | +		} else { | 
                                                        |
| 938 | + $action_desc = 'restored';  | 
                                                        |
| 939 | + $status = 'all';  | 
                                                        |
| 940 | + }  | 
                                                        |
| 941 | + $this->_redirect_after_action(  | 
                                                        |
| 942 | + $success,  | 
                                                        |
| 943 | + $model->item_name($success),  | 
                                                        |
| 944 | + $action_desc,  | 
                                                        |
| 945 | +			array('action' => $action, 'status' => $status) | 
                                                        |
| 946 | + );  | 
                                                        |
| 947 | + }  | 
                                                        |
| 948 | +  | 
                                                        |
| 949 | +  | 
                                                        |
| 950 | + /**  | 
                                                        |
| 951 | + * @param $per_page  | 
                                                        |
| 952 | + * @param int $current_page  | 
                                                        |
| 953 | + * @param bool|false $count  | 
                                                        |
| 954 | + * @return EE_Soft_Delete_Base_Class[]|int  | 
                                                        |
| 955 | + * @throws EE_Error  | 
                                                        |
| 956 | + * @throws InvalidArgumentException  | 
                                                        |
| 957 | + * @throws InvalidDataTypeException  | 
                                                        |
| 958 | + * @throws InvalidInterfaceException  | 
                                                        |
| 959 | + */  | 
                                                        |
| 960 | + public function get_trashed_questions($per_page, $current_page = 1, $count = false)  | 
                                                        |
| 961 | +	{ | 
                                                        |
| 962 | + $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);  | 
                                                        |
| 963 | +  | 
                                                        |
| 964 | +		if ($count) { | 
                                                        |
| 965 | + // note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items  | 
                                                        |
| 966 | + $where = isset($query_params[0]) ? array($query_params[0]) : array();  | 
                                                        |
| 967 | + $results = $this->_question_model->count_deleted($where);  | 
                                                        |
| 968 | +		} else { | 
                                                        |
| 969 | + // note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items  | 
                                                        |
| 970 | + $results = $this->_question_model->get_all_deleted($query_params);  | 
                                                        |
| 971 | + }  | 
                                                        |
| 972 | + return $results;  | 
                                                        |
| 973 | + }  | 
                                                        |
| 974 | +  | 
                                                        |
| 975 | +  | 
                                                        |
| 976 | + /**  | 
                                                        |
| 977 | + * @param $per_page  | 
                                                        |
| 978 | + * @param int $current_page  | 
                                                        |
| 979 | + * @param bool|false $count  | 
                                                        |
| 980 | + * @return EE_Soft_Delete_Base_Class[]|int  | 
                                                        |
| 981 | + * @throws EE_Error  | 
                                                        |
| 982 | + * @throws InvalidArgumentException  | 
                                                        |
| 983 | + * @throws InvalidDataTypeException  | 
                                                        |
| 984 | + * @throws InvalidInterfaceException  | 
                                                        |
| 985 | + */  | 
                                                        |
| 986 | + public function get_question_groups($per_page, $current_page = 1, $count = false)  | 
                                                        |
| 987 | +	{ | 
                                                        |
| 988 | + $questionGroupModel = EEM_Question_Group::instance();  | 
                                                        |
| 989 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);  | 
                                                        |
| 990 | +		if ($count) { | 
                                                        |
| 991 | + $where = isset($query_params[0]) ? array($query_params[0]) : array();  | 
                                                        |
| 992 | + $results = $questionGroupModel->count($where);  | 
                                                        |
| 993 | +		} else { | 
                                                        |
| 994 | + $results = $questionGroupModel->get_all($query_params);  | 
                                                        |
| 995 | + }  | 
                                                        |
| 996 | + return $results;  | 
                                                        |
| 997 | + }  | 
                                                        |
| 998 | +  | 
                                                        |
| 999 | +  | 
                                                        |
| 1000 | + /**  | 
                                                        |
| 1001 | + * @param $per_page  | 
                                                        |
| 1002 | + * @param int $current_page  | 
                                                        |
| 1003 | + * @param bool $count  | 
                                                        |
| 1004 | + * @return EE_Soft_Delete_Base_Class[]|int  | 
                                                        |
| 1005 | + * @throws EE_Error  | 
                                                        |
| 1006 | + * @throws InvalidArgumentException  | 
                                                        |
| 1007 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1008 | + * @throws InvalidInterfaceException  | 
                                                        |
| 1009 | + */  | 
                                                        |
| 1010 | + public function get_trashed_question_groups($per_page, $current_page = 1, $count = false)  | 
                                                        |
| 1011 | +	{ | 
                                                        |
| 1012 | + $questionGroupModel = EEM_Question_Group::instance();  | 
                                                        |
| 1013 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);  | 
                                                        |
| 1014 | +		if ($count) { | 
                                                        |
| 1015 | + $where = isset($query_params[0]) ? array($query_params[0]) : array();  | 
                                                        |
| 1016 | + $query_params['limit'] = null;  | 
                                                        |
| 1017 | + $results = $questionGroupModel->count_deleted($where);  | 
                                                        |
| 1018 | +		} else { | 
                                                        |
| 1019 | + $results = $questionGroupModel->get_all_deleted($query_params);  | 
                                                        |
| 1020 | + }  | 
                                                        |
| 1021 | + return $results;  | 
                                                        |
| 1022 | + }  | 
                                                        |
| 1023 | +  | 
                                                        |
| 1024 | +  | 
                                                        |
| 1025 | + /**  | 
                                                        |
| 1026 | + * method for performing updates to question order  | 
                                                        |
| 1027 | + *  | 
                                                        |
| 1028 | + * @return void results array  | 
                                                        |
| 1029 | + * @throws EE_Error  | 
                                                        |
| 1030 | + * @throws InvalidArgumentException  | 
                                                        |
| 1031 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1032 | + * @throws InvalidInterfaceException  | 
                                                        |
| 1033 | + */  | 
                                                        |
| 1034 | + public function update_question_group_order()  | 
                                                        |
| 1035 | +	{ | 
                                                        |
| 1036 | +  | 
                                                        |
| 1037 | +		$success = esc_html__('Question group order was updated successfully.', 'event_espresso'); | 
                                                        |
| 1038 | +  | 
                                                        |
| 1039 | + // grab our row IDs  | 
                                                        |
| 1040 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids'])  | 
                                                        |
| 1041 | +			? explode(',', rtrim($this->_req_data['row_ids'], ',')) | 
                                                        |
| 1042 | + : array();  | 
                                                        |
| 1043 | +  | 
                                                        |
| 1044 | + $perpage = ! empty($this->_req_data['perpage'])  | 
                                                        |
| 1045 | + ? (int) $this->_req_data['perpage']  | 
                                                        |
| 1046 | + : null;  | 
                                                        |
| 1047 | + $curpage = ! empty($this->_req_data['curpage'])  | 
                                                        |
| 1048 | + ? (int) $this->_req_data['curpage']  | 
                                                        |
| 1049 | + : null;  | 
                                                        |
| 1050 | +  | 
                                                        |
| 1051 | +		if (! empty($row_ids)) { | 
                                                        |
| 1052 | + // figure out where we start the row_id count at for the current page.  | 
                                                        |
| 1053 | + $qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage;  | 
                                                        |
| 1054 | +  | 
                                                        |
| 1055 | + $row_count = count($row_ids);  | 
                                                        |
| 1056 | +			for ($i = 0; $i < $row_count; $i++) { | 
                                                        |
| 1057 | + // Update the questions when re-ordering  | 
                                                        |
| 1058 | + $updated = EEM_Question_Group::instance()->update(  | 
                                                        |
| 1059 | +					array('QSG_order' => $qsgcount), | 
                                                        |
| 1060 | +					array(array('QSG_ID' => $row_ids[ $i ])) | 
                                                        |
| 1061 | + );  | 
                                                        |
| 1062 | +				if ($updated === false) { | 
                                                        |
| 1063 | + $success = false;  | 
                                                        |
| 1064 | + }  | 
                                                        |
| 1065 | + $qsgcount++;  | 
                                                        |
| 1066 | + }  | 
                                                        |
| 1067 | +		} else { | 
                                                        |
| 1068 | + $success = false;  | 
                                                        |
| 1069 | + }  | 
                                                        |
| 1070 | +  | 
                                                        |
| 1071 | + $errors = ! $success  | 
                                                        |
| 1072 | +			? esc_html__('An error occurred. The question group order was not updated.', 'event_espresso') | 
                                                        |
| 1073 | + : false;  | 
                                                        |
| 1074 | +  | 
                                                        |
| 1075 | +		echo wp_json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors)); | 
                                                        |
| 1076 | + die();  | 
                                                        |
| 1077 | + }  | 
                                                        |
| 1078 | +  | 
                                                        |
| 1079 | +  | 
                                                        |
| 1080 | +  | 
                                                        |
| 1081 | + /*************************************** REGISTRATION SETTINGS ***************************************/  | 
                                                        |
| 1082 | +  | 
                                                        |
| 1083 | +  | 
                                                        |
| 1084 | + /**  | 
                                                        |
| 1085 | + * @throws DomainException  | 
                                                        |
| 1086 | + * @throws EE_Error  | 
                                                        |
| 1087 | + * @throws InvalidArgumentException  | 
                                                        |
| 1088 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1089 | + * @throws InvalidInterfaceException  | 
                                                        |
| 1090 | + */  | 
                                                        |
| 1091 | + protected function _reg_form_settings()  | 
                                                        |
| 1092 | +	{ | 
                                                        |
| 1093 | + $this->_template_args['values'] = $this->_yes_no_values;  | 
                                                        |
| 1094 | + add_action(  | 
                                                        |
| 1095 | + 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',  | 
                                                        |
| 1096 | + array($this, 'email_validation_settings_form'),  | 
                                                        |
| 1097 | + 2  | 
                                                        |
| 1098 | + );  | 
                                                        |
| 1099 | + $this->_template_args = (array) apply_filters(  | 
                                                        |
| 1100 | + 'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args',  | 
                                                        |
| 1101 | + $this->_template_args  | 
                                                        |
| 1102 | + );  | 
                                                        |
| 1103 | +		$this->_set_add_edit_form_tags('update_reg_form_settings'); | 
                                                        |
| 1104 | + $this->_set_publish_post_box_vars(null, false, false, null, false);  | 
                                                        |
| 1105 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(  | 
                                                        |
| 1106 | + REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php',  | 
                                                        |
| 1107 | + $this->_template_args,  | 
                                                        |
| 1108 | + true  | 
                                                        |
| 1109 | + );  | 
                                                        |
| 1110 | + $this->display_admin_page_with_sidebar();  | 
                                                        |
| 1111 | + }  | 
                                                        |
| 1112 | +  | 
                                                        |
| 1113 | +  | 
                                                        |
| 1114 | + /**  | 
                                                        |
| 1115 | + * @return void  | 
                                                        |
| 1116 | + * @throws EE_Error  | 
                                                        |
| 1117 | + * @throws InvalidArgumentException  | 
                                                        |
| 1118 | + * @throws ReflectionException  | 
                                                        |
| 1119 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1120 | + * @throws InvalidInterfaceException  | 
                                                        |
| 1121 | + */  | 
                                                        |
| 1122 | + protected function _update_reg_form_settings()  | 
                                                        |
| 1123 | +	{ | 
                                                        |
| 1124 | + EE_Registry::instance()->CFG->registration = $this->update_email_validation_settings_form(  | 
                                                        |
| 1125 | + EE_Registry::instance()->CFG->registration  | 
                                                        |
| 1126 | + );  | 
                                                        |
| 1127 | + EE_Registry::instance()->CFG->registration = apply_filters(  | 
                                                        |
| 1128 | + 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',  | 
                                                        |
| 1129 | + EE_Registry::instance()->CFG->registration  | 
                                                        |
| 1130 | + );  | 
                                                        |
| 1131 | + $success = $this->_update_espresso_configuration(  | 
                                                        |
| 1132 | +			esc_html__('Registration Form Options', 'event_espresso'), | 
                                                        |
| 1133 | + EE_Registry::instance()->CFG,  | 
                                                        |
| 1134 | + __FILE__,  | 
                                                        |
| 1135 | + __FUNCTION__,  | 
                                                        |
| 1136 | + __LINE__  | 
                                                        |
| 1137 | + );  | 
                                                        |
| 1138 | + $this->_redirect_after_action(  | 
                                                        |
| 1139 | + $success,  | 
                                                        |
| 1140 | +			esc_html__('Registration Form Options', 'event_espresso'), | 
                                                        |
| 1141 | + 'updated',  | 
                                                        |
| 1142 | +			array('action' => 'view_reg_form_settings') | 
                                                        |
| 1143 | + );  | 
                                                        |
| 1144 | + }  | 
                                                        |
| 1145 | +  | 
                                                        |
| 1146 | +  | 
                                                        |
| 1147 | + /**  | 
                                                        |
| 1148 | + * @return void  | 
                                                        |
| 1149 | + * @throws EE_Error  | 
                                                        |
| 1150 | + * @throws InvalidArgumentException  | 
                                                        |
| 1151 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1152 | + * @throws InvalidInterfaceException  | 
                                                        |
| 1153 | + */  | 
                                                        |
| 1154 | + public function email_validation_settings_form()  | 
                                                        |
| 1155 | +	{ | 
                                                        |
| 1156 | + echo $this->_email_validation_settings_form()->get_html();  | 
                                                        |
| 1157 | + }  | 
                                                        |
| 1158 | +  | 
                                                        |
| 1159 | +  | 
                                                        |
| 1160 | + /**  | 
                                                        |
| 1161 | + * _email_validation_settings_form  | 
                                                        |
| 1162 | + *  | 
                                                        |
| 1163 | + * @access protected  | 
                                                        |
| 1164 | + * @return EE_Form_Section_Proper  | 
                                                        |
| 1165 | + * @throws \EE_Error  | 
                                                        |
| 1166 | + */  | 
                                                        |
| 1167 | + protected function _email_validation_settings_form()  | 
                                                        |
| 1168 | +	{ | 
                                                        |
| 1169 | + return new EE_Form_Section_Proper(  | 
                                                        |
| 1170 | + array(  | 
                                                        |
| 1171 | + 'name' => 'email_validation_settings',  | 
                                                        |
| 1172 | + 'html_id' => 'email_validation_settings',  | 
                                                        |
| 1173 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(),  | 
                                                        |
| 1174 | + 'subsections' => apply_filters(  | 
                                                        |
| 1175 | + 'FHEE__Extend_Registration_Form_Admin_Page___email_validation_settings_form__form_subsections',  | 
                                                        |
| 1176 | + array(  | 
                                                        |
| 1177 | + 'email_validation_hdr' => new EE_Form_Section_HTML(  | 
                                                        |
| 1178 | +							EEH_HTML::h2(esc_html__('Email Validation Settings', 'event_espresso')) | 
                                                        |
| 1179 | + ),  | 
                                                        |
| 1180 | + 'email_validation_level' => new EE_Select_Input(  | 
                                                        |
| 1181 | + array(  | 
                                                        |
| 1182 | +								'basic'      => esc_html__('Basic', 'event_espresso'), | 
                                                        |
| 1183 | +								'wp_default' => esc_html__('WordPress Default', 'event_espresso'), | 
                                                        |
| 1184 | +								'i18n'       => esc_html__('International', 'event_espresso'), | 
                                                        |
| 1185 | +								'i18n_dns'   => esc_html__('International + DNS Check', 'event_espresso'), | 
                                                        |
| 1186 | + ),  | 
                                                        |
| 1187 | + array(  | 
                                                        |
| 1188 | +								'html_label_text' => esc_html__('Email Validation Level', 'event_espresso') | 
                                                        |
| 1189 | +													 . EEH_Template::get_help_tab_link('email_validation_info'), | 
                                                        |
| 1190 | + 'html_help_text' => esc_html__(  | 
                                                        |
| 1191 | + 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.',  | 
                                                        |
| 1192 | + 'event_espresso'  | 
                                                        |
| 1193 | + ),  | 
                                                        |
| 1194 | + 'default' => isset(  | 
                                                        |
| 1195 | + EE_Registry::instance()->CFG->registration->email_validation_level  | 
                                                        |
| 1196 | + )  | 
                                                        |
| 1197 | + ? EE_Registry::instance()->CFG->registration->email_validation_level  | 
                                                        |
| 1198 | + : 'wp_default',  | 
                                                        |
| 1199 | + 'required' => false,  | 
                                                        |
| 1200 | + )  | 
                                                        |
| 1201 | + ),  | 
                                                        |
| 1202 | + )  | 
                                                        |
| 1203 | + ),  | 
                                                        |
| 1204 | + )  | 
                                                        |
| 1205 | + );  | 
                                                        |
| 1206 | + }  | 
                                                        |
| 1207 | +  | 
                                                        |
| 1208 | +  | 
                                                        |
| 1209 | + /**  | 
                                                        |
| 1210 | + * @param EE_Registration_Config $EE_Registration_Config  | 
                                                        |
| 1211 | + * @return EE_Registration_Config  | 
                                                        |
| 1212 | + * @throws EE_Error  | 
                                                        |
| 1213 | + * @throws InvalidArgumentException  | 
                                                        |
| 1214 | + * @throws ReflectionException  | 
                                                        |
| 1215 | + * @throws InvalidDataTypeException  | 
                                                        |
| 1216 | + * @throws InvalidInterfaceException  | 
                                                        |
| 1217 | + */  | 
                                                        |
| 1218 | + public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config)  | 
                                                        |
| 1219 | +	{ | 
                                                        |
| 1220 | + $prev_email_validation_level = $EE_Registration_Config->email_validation_level;  | 
                                                        |
| 1221 | +		try { | 
                                                        |
| 1222 | + $email_validation_settings_form = $this->_email_validation_settings_form();  | 
                                                        |
| 1223 | + // if not displaying a form, then check for form submission  | 
                                                        |
| 1224 | +			if ($email_validation_settings_form->was_submitted()) { | 
                                                        |
| 1225 | + // capture form data  | 
                                                        |
| 1226 | + $email_validation_settings_form->receive_form_submission();  | 
                                                        |
| 1227 | + // validate form data  | 
                                                        |
| 1228 | +				if ($email_validation_settings_form->is_valid()) { | 
                                                        |
| 1229 | + // grab validated data from form  | 
                                                        |
| 1230 | + $valid_data = $email_validation_settings_form->valid_data();  | 
                                                        |
| 1231 | +					if (isset($valid_data['email_validation_level'])) { | 
                                                        |
| 1232 | + $email_validation_level = $valid_data['email_validation_level'];  | 
                                                        |
| 1233 | + // now if they want to use international email addresses  | 
                                                        |
| 1234 | +						if ($email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns') { | 
                                                        |
| 1235 | + // in case we need to reset their email validation level,  | 
                                                        |
| 1236 | + // make sure that the previous value wasn't already set to one of the i18n options.  | 
                                                        |
| 1237 | +							if ($prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns') { | 
                                                        |
| 1238 | + // if so, then reset it back to "basic" since that is the only other option that,  | 
                                                        |
| 1239 | + // despite offering poor validation, supports i18n email addresses  | 
                                                        |
| 1240 | + $prev_email_validation_level = 'basic';  | 
                                                        |
| 1241 | + }  | 
                                                        |
| 1242 | + // confirm our i18n email validation will work on the server  | 
                                                        |
| 1243 | +							if (! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) { | 
                                                        |
| 1244 | + // or reset email validation level to previous value  | 
                                                        |
| 1245 | + $email_validation_level = $prev_email_validation_level;  | 
                                                        |
| 1246 | + }  | 
                                                        |
| 1247 | + }  | 
                                                        |
| 1248 | + $EE_Registration_Config->email_validation_level = $email_validation_level;  | 
                                                        |
| 1249 | +					} else { | 
                                                        |
| 1250 | + EE_Error::add_error(  | 
                                                        |
| 1251 | + esc_html__(  | 
                                                        |
| 1252 | + 'Invalid or missing Email Validation settings. Please refresh the form and try again.',  | 
                                                        |
| 1253 | + 'event_espresso'  | 
                                                        |
| 1254 | + ),  | 
                                                        |
| 1255 | + __FILE__,  | 
                                                        |
| 1256 | + __FUNCTION__,  | 
                                                        |
| 1257 | + __LINE__  | 
                                                        |
| 1258 | + );  | 
                                                        |
| 1259 | + }  | 
                                                        |
| 1260 | +				} else { | 
                                                        |
| 1261 | +					if ($email_validation_settings_form->submission_error_message() !== '') { | 
                                                        |
| 1262 | + EE_Error::add_error(  | 
                                                        |
| 1263 | + $email_validation_settings_form->submission_error_message(),  | 
                                                        |
| 1264 | + __FILE__,  | 
                                                        |
| 1265 | + __FUNCTION__,  | 
                                                        |
| 1266 | + __LINE__  | 
                                                        |
| 1267 | + );  | 
                                                        |
| 1268 | + }  | 
                                                        |
| 1269 | + }  | 
                                                        |
| 1270 | + }  | 
                                                        |
| 1271 | +		} catch (EE_Error $e) { | 
                                                        |
| 1272 | + $e->get_error();  | 
                                                        |
| 1273 | + }  | 
                                                        |
| 1274 | + return $EE_Registration_Config;  | 
                                                        |
| 1275 | + }  | 
                                                        |
| 1276 | +  | 
                                                        |
| 1277 | +  | 
                                                        |
| 1278 | + /**  | 
                                                        |
| 1279 | + * confirms that the server's PHP version has the PCRE module enabled,  | 
                                                        |
| 1280 | + * and that the PCRE version works with our i18n email validation  | 
                                                        |
| 1281 | + *  | 
                                                        |
| 1282 | + * @param EE_Registration_Config $EE_Registration_Config  | 
                                                        |
| 1283 | + * @param string $email_validation_level  | 
                                                        |
| 1284 | + * @return bool  | 
                                                        |
| 1285 | + */  | 
                                                        |
| 1286 | + private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)  | 
                                                        |
| 1287 | +	{ | 
                                                        |
| 1288 | + // first check that PCRE is enabled  | 
                                                        |
| 1289 | +		if (! defined('PREG_BAD_UTF8_ERROR')) { | 
                                                        |
| 1290 | + EE_Error::add_error(  | 
                                                        |
| 1291 | + sprintf(  | 
                                                        |
| 1292 | + esc_html__(  | 
                                                        |
| 1293 | + 'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.',  | 
                                                        |
| 1294 | + 'event_espresso'  | 
                                                        |
| 1295 | + ),  | 
                                                        |
| 1296 | + '<br />'  | 
                                                        |
| 1297 | + ),  | 
                                                        |
| 1298 | + __FILE__,  | 
                                                        |
| 1299 | + __FUNCTION__,  | 
                                                        |
| 1300 | + __LINE__  | 
                                                        |
| 1301 | + );  | 
                                                        |
| 1302 | + return false;  | 
                                                        |
| 1303 | +		} else { | 
                                                        |
| 1304 | + // PCRE support is enabled, but let's still  | 
                                                        |
| 1305 | + // perform a test to see if the server will support it.  | 
                                                        |
| 1306 | + // but first, save the updated validation level to the config,  | 
                                                        |
| 1307 | + // so that the validation strategy picks it up.  | 
                                                        |
| 1308 | + // this will get bumped back down if it doesn't work  | 
                                                        |
| 1309 | + $EE_Registration_Config->email_validation_level = $email_validation_level;  | 
                                                        |
| 1310 | +			try { | 
                                                        |
| 1311 | + $email_validator = new EE_Email_Validation_Strategy();  | 
                                                        |
| 1312 | + $i18n_email_address = apply_filters(  | 
                                                        |
| 1313 | + 'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address',  | 
                                                        |
| 1314 | + 'jägerjü[email protected]'  | 
                                                        |
| 1315 | + );  | 
                                                        |
| 1316 | + $email_validator->validate($i18n_email_address);  | 
                                                        |
| 1317 | +			} catch (Exception $e) { | 
                                                        |
| 1318 | + EE_Error::add_error(  | 
                                                        |
| 1319 | + sprintf(  | 
                                                        |
| 1320 | + esc_html__(  | 
                                                        |
| 1321 | + 'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s',  | 
                                                        |
| 1322 | + 'event_espresso'  | 
                                                        |
| 1323 | + ),  | 
                                                        |
| 1324 | + '<br />',  | 
                                                        |
| 1325 | + '<a href="http://php.net/manual/en/pcre.installation.php" target="_blank" rel="noopener noreferrer">http://php.net/manual/en/pcre.installation.php</a>'  | 
                                                        |
| 1326 | + ),  | 
                                                        |
| 1327 | + __FILE__,  | 
                                                        |
| 1328 | + __FUNCTION__,  | 
                                                        |
| 1329 | + __LINE__  | 
                                                        |
| 1330 | + );  | 
                                                        |
| 1331 | + return false;  | 
                                                        |
| 1332 | + }  | 
                                                        |
| 1333 | + }  | 
                                                        |
| 1334 | + return true;  | 
                                                        |
| 1335 | + }  | 
                                                        |
| 1336 | 1336 | }  | 
                                                        
@@ -1,8 +1,8 @@  | 
                                                    ||
| 1 | 1 | <div class="padding">  | 
                                                        
| 2 | 2 | <p><?php  | 
                                                        
| 3 | - printf(  | 
                                                        |
| 4 | -            esc_html__('Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso'), | 
                                                        |
| 5 | - '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 6 | - '</a>'  | 
                                                        |
| 7 | - ); ?></p>  | 
                                                        |
| 3 | + printf(  | 
                                                        |
| 4 | +			esc_html__('Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso'), | 
                                                        |
| 5 | + '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 6 | + '</a>'  | 
                                                        |
| 7 | + ); ?></p>  | 
                                                        |
| 8 | 8 | </div>  | 
                                                        
| 9 | 9 | \ No newline at end of file  | 
                                                        
@@ -4,71 +4,71 @@  | 
                                                    ||
| 4 | 4 | </p>  | 
                                                        
| 5 | 5 | <p>  | 
                                                        
| 6 | 6 | <?php printf(  | 
                                                        
| 7 | -        __('See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso'), | 
                                                        |
| 8 | - "<a href='http://www.authorize.net/international/' target='_blank'>",  | 
                                                        |
| 9 | - "</a>"  | 
                                                        |
| 10 | - ); ?>  | 
                                                        |
| 7 | +		__('See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso'), | 
                                                        |
| 8 | + "<a href='http://www.authorize.net/international/' target='_blank'>",  | 
                                                        |
| 9 | + "</a>"  | 
                                                        |
| 10 | + ); ?>  | 
                                                        |
| 11 | 11 | </p>  | 
                                                        
| 12 | 12 |  <p><strong><?php esc_html_e('Authorize.net AIM Settings', 'event_espresso'); ?></strong></p> | 
                                                        
| 13 | 13 | <ul>  | 
                                                        
| 14 | 14 | <li>  | 
                                                        
| 15 | 15 |          <strong><?php esc_html_e('Authorize.net API Login ID', 'event_espresso'); ?></strong><br/> | 
                                                        
| 16 | 16 | <?php esc_html_e(  | 
                                                        
| 17 | - 'Enter your API Login ID for Authorize.net. Learn how to find your <a href="https://support.authorize.net/authkb/index?page=content&id=A405" target="_blank" rel="noopener noreferrer">API Login ID</a>.',  | 
                                                        |
| 18 | - 'event_espresso'  | 
                                                        |
| 19 | - ); ?>  | 
                                                        |
| 17 | + 'Enter your API Login ID for Authorize.net. Learn how to find your <a href="https://support.authorize.net/authkb/index?page=content&id=A405" target="_blank" rel="noopener noreferrer">API Login ID</a>.',  | 
                                                        |
| 18 | + 'event_espresso'  | 
                                                        |
| 19 | + ); ?>  | 
                                                        |
| 20 | 20 | </li>  | 
                                                        
| 21 | 21 | <li>  | 
                                                        
| 22 | 22 |          <strong><?php esc_html_e('Authorize.net Transaction Key', 'event_espresso'); ?></strong><br/> | 
                                                        
| 23 | 23 | <?php esc_html_e(  | 
                                                        
| 24 | - 'Enter your Transaction Key for Authorize.net. Learn how to find your <a href="https://support.authorize.net/authkb/index?page=content&id=A405" target="_blank" rel="noopener noreferrer">Transaction Key</a>.',  | 
                                                        |
| 25 | - 'event_espresso'  | 
                                                        |
| 26 | - ); ?>  | 
                                                        |
| 24 | + 'Enter your Transaction Key for Authorize.net. Learn how to find your <a href="https://support.authorize.net/authkb/index?page=content&id=A405" target="_blank" rel="noopener noreferrer">Transaction Key</a>.',  | 
                                                        |
| 25 | + 'event_espresso'  | 
                                                        |
| 26 | + ); ?>  | 
                                                        |
| 27 | 27 | </li>  | 
                                                        
| 28 | 28 | <li>  | 
                                                        
| 29 | 29 | <strong>  | 
                                                        
| 30 | 30 | <?php esc_html_e(  | 
                                                        
| 31 | - 'Is this an account on the Authorize.net development server?',  | 
                                                        |
| 32 | - 'event_espresso'  | 
                                                        |
| 33 | - ); ?></strong><br/>  | 
                                                        |
| 31 | + 'Is this an account on the Authorize.net development server?',  | 
                                                        |
| 32 | + 'event_espresso'  | 
                                                        |
| 33 | + ); ?></strong><br/>  | 
                                                        |
| 34 | 34 | <?php esc_html_e(  | 
                                                        
| 35 | - 'Specify whether this is a live/production account or a test account on the Authorize.net development server.',  | 
                                                        |
| 36 | - 'event_espresso'  | 
                                                        |
| 37 | - ); ?>  | 
                                                        |
| 35 | + 'Specify whether this is a live/production account or a test account on the Authorize.net development server.',  | 
                                                        |
| 36 | + 'event_espresso'  | 
                                                        |
| 37 | + ); ?>  | 
                                                        |
| 38 | 38 | </li>  | 
                                                        
| 39 | 39 | <li>  | 
                                                        
| 40 | 40 |          <strong><?php esc_html_e('Do you want to submit a test transaction?', 'event_espresso'); ?></strong><br/> | 
                                                        
| 41 | 41 | <?php esc_html_e(  | 
                                                        
| 42 | - 'Specify if you want to test the Authorize.net AIM payment gateway by submitting a test transaction. Be sure to turn this setting off when you are done testing.',  | 
                                                        |
| 43 | - 'event_espresso'  | 
                                                        |
| 44 | - ); ?>  | 
                                                        |
| 42 | + 'Specify if you want to test the Authorize.net AIM payment gateway by submitting a test transaction. Be sure to turn this setting off when you are done testing.',  | 
                                                        |
| 43 | + 'event_espresso'  | 
                                                        |
| 44 | + ); ?>  | 
                                                        |
| 45 | 45 | </li>  | 
                                                        
| 46 | 46 | <li>  | 
                                                        
| 47 | 47 |          <strong><?php esc_html_e('Excluded and Required Payment Form Fields', 'event_espresso'); ?></strong><br/> | 
                                                        
| 48 | 48 | <?php esc_html_e(  | 
                                                        
| 49 | - 'By logging into Authorize.net, you can change which payment fields are required by Authorize.net when processing payments. These settings affect both the Advanced Integration Method (AIM, this) and the Simple Integration Method (SIM, different). The payment method settings "Excluded Payment Form Fields" and "Required Payment Form Fields" allow you to change the billing form in Event Espresso to reflect your payment form settings in Authorize.net.',  | 
                                                        |
| 50 | - 'event_espresso'  | 
                                                        |
| 51 | - ); ?>  | 
                                                        |
| 49 | + 'By logging into Authorize.net, you can change which payment fields are required by Authorize.net when processing payments. These settings affect both the Advanced Integration Method (AIM, this) and the Simple Integration Method (SIM, different). The payment method settings "Excluded Payment Form Fields" and "Required Payment Form Fields" allow you to change the billing form in Event Espresso to reflect your payment form settings in Authorize.net.',  | 
                                                        |
| 50 | + 'event_espresso'  | 
                                                        |
| 51 | + ); ?>  | 
                                                        |
| 52 | 52 | <br>  | 
                                                        
| 53 | 53 | <?php  | 
                                                        
| 54 | - printf(  | 
                                                        |
| 55 | - esc_html__(  | 
                                                        |
| 56 | - 'To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.',  | 
                                                        |
| 57 | - 'event_espresso'  | 
                                                        |
| 58 | - ),  | 
                                                        |
| 59 | - '<a href="http://authorize.net" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 60 | - '</a>',  | 
                                                        |
| 61 | - '<a href="https://monosnap.com/file/nebVteOkEXcdDIos88SojStWOifP23" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 62 | - '<a href="https://monosnap.com/file/WyxGJtev87TcDmdGBEZ2oi1xaBIQAm" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 63 | - '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank" rel="noopener noreferrer">'  | 
                                                        |
| 64 | - ); ?>  | 
                                                        |
| 54 | + printf(  | 
                                                        |
| 55 | + esc_html__(  | 
                                                        |
| 56 | + 'To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.',  | 
                                                        |
| 57 | + 'event_espresso'  | 
                                                        |
| 58 | + ),  | 
                                                        |
| 59 | + '<a href="http://authorize.net" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 60 | + '</a>',  | 
                                                        |
| 61 | + '<a href="https://monosnap.com/file/nebVteOkEXcdDIos88SojStWOifP23" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 62 | + '<a href="https://monosnap.com/file/WyxGJtev87TcDmdGBEZ2oi1xaBIQAm" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 63 | + '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank" rel="noopener noreferrer">'  | 
                                                        |
| 64 | + ); ?>  | 
                                                        |
| 65 | 65 | </li>  | 
                                                        
| 66 | 66 | <li>  | 
                                                        
| 67 | 67 |          <strong><?php esc_html_e('Server', 'event_espresso'); ?></strong> | 
                                                        
| 68 | 68 | <?php esc_html_e(  | 
                                                        
| 69 | - 'Use this setting to change the server where Authorize.net AIM requests are sent. Change this to "Authorize.net/Akamai" before June 30th 2016 to verify your server wil work with Authorize.net\'s servers which will be in use after that date.',  | 
                                                        |
| 70 | - 'event_espresso'  | 
                                                        |
| 71 | - ); ?>  | 
                                                        |
| 69 | + 'Use this setting to change the server where Authorize.net AIM requests are sent. Change this to "Authorize.net/Akamai" before June 30th 2016 to verify your server wil work with Authorize.net\'s servers which will be in use after that date.',  | 
                                                        |
| 70 | + 'event_espresso'  | 
                                                        |
| 71 | + ); ?>  | 
                                                        |
| 72 | 72 | </li>  | 
                                                        
| 73 | 73 | <li>  | 
                                                        
| 74 | 74 |          <strong><?php esc_html_e('Button Image URL', 'event_espresso'); ?></strong><br/> | 
                                                        
@@ -75,7 +75,7 @@  | 
                                                    ||
| 75 | 75 |          <?php esc_html_e('Change the image that is used for this payment gateway.', 'event_espresso'); ?> | 
                                                        
| 76 | 76 | </li>  | 
                                                        
| 77 | 77 | <li>  | 
                                                        
| 78 | -        <strong><?php esc_html_e('Note About Special Characters', 'event_espresso');?></strong> | 
                                                        |
| 79 | -        <?php esc_html_e('If your event name, ticket name or ticket description contain special characters (eg emojis, foreign language characters, or curly quotes) they will be removed when sent to Authorize.net. This is because Authorize.net doesn\'t support them.', 'event_espresso');?></li> | 
                                                        |
| 78 | +        <strong><?php esc_html_e('Note About Special Characters', 'event_espresso'); ?></strong> | 
                                                        |
| 79 | +        <?php esc_html_e('If your event name, ticket name or ticket description contain special characters (eg emojis, foreign language characters, or curly quotes) they will be removed when sent to Authorize.net. This is because Authorize.net doesn\'t support them.', 'event_espresso'); ?></li> | 
                                                        |
| 80 | 80 | </li>  | 
                                                        
| 81 | 81 | </ul>  | 
                                                        
| 82 | 82 | \ No newline at end of file  | 
                                                        
@@ -16,39 +16,39 @@ discard block  | 
                                                    ||
| 16 | 16 | <div class="sandbox-panel">  | 
                                                        
| 17 | 17 |      <h2 class="section-title"><?php _e('PayPal Sandbox Mode', 'event_espresso'); ?></h2> | 
                                                        
| 18 | 18 | <h3 style="color:#ff0000;"><?php  | 
                                                        
| 19 | - _e(  | 
                                                        |
| 20 | - 'Debug Mode Is Turned On. Payments will not be processed',  | 
                                                        |
| 21 | - 'event_espresso'  | 
                                                        |
| 22 | - ); ?></h3>  | 
                                                        |
| 19 | + _e(  | 
                                                        |
| 20 | + 'Debug Mode Is Turned On. Payments will not be processed',  | 
                                                        |
| 21 | + 'event_espresso'  | 
                                                        |
| 22 | + ); ?></h3>  | 
                                                        |
| 23 | 23 | |
| 24 | 24 | <p class="test-credit-cards-info-pg" style="margin-bottom:0;">  | 
                                                        
| 25 | 25 |          <strong><?php _e('Testing Guidelines', 'event_espresso'); ?></strong> | 
                                                        
| 26 | 26 | </p>  | 
                                                        
| 27 | 27 | <ul style="margin:1em 2em 1.5em; line-height:1.2em;">  | 
                                                        
| 28 | 28 | <li><?php  | 
                                                        
| 29 | - _e(  | 
                                                        |
| 30 | - 'While testing, use the credit card number associated with your sandbox account.',  | 
                                                        |
| 31 | - 'event_espresso'  | 
                                                        |
| 32 | - ); ?></li>  | 
                                                        |
| 29 | + _e(  | 
                                                        |
| 30 | + 'While testing, use the credit card number associated with your sandbox account.',  | 
                                                        |
| 31 | + 'event_espresso'  | 
                                                        |
| 32 | + ); ?></li>  | 
                                                        |
| 33 | 33 | <li><?php  | 
                                                        
| 34 | - printf(  | 
                                                        |
| 35 | - __(  | 
                                                        |
| 36 | - 'To find the sandbox account\'s credit card, go to %1$s, then "Dashboard", then under Sandbox click "Accounts", then click your account and click "Profile", then in the popup that appears click on the "Funding" tab. Your testing card is listed there.',  | 
                                                        |
| 37 | - 'event_espresso'  | 
                                                        |
| 38 | - ),  | 
                                                        |
| 39 | - '<a href="http://developer.paypal.com">developer.paypal.com</a>'  | 
                                                        |
| 40 | - ); ?></li>  | 
                                                        |
| 34 | + printf(  | 
                                                        |
| 35 | + __(  | 
                                                        |
| 36 | + 'To find the sandbox account\'s credit card, go to %1$s, then "Dashboard", then under Sandbox click "Accounts", then click your account and click "Profile", then in the popup that appears click on the "Funding" tab. Your testing card is listed there.',  | 
                                                        |
| 37 | + 'event_espresso'  | 
                                                        |
| 38 | + ),  | 
                                                        |
| 39 | + '<a href="http://developer.paypal.com">developer.paypal.com</a>'  | 
                                                        |
| 40 | + ); ?></li>  | 
                                                        |
| 41 | 41 | <li><?php  | 
                                                        
| 42 | -            esc_html_e('CVV2 should be 115', 'event_espresso'); ?></li> | 
                                                        |
| 42 | +			esc_html_e('CVV2 should be 115', 'event_espresso'); ?></li> | 
                                                        |
| 43 | 43 | </ul>  | 
                                                        
| 44 | 44 | |
| 45 | 45 | <p class="test-credit-cards-info-pg">  | 
                                                        
| 46 | 46 |          <strong><?php _e('Credit Card Numbers Used for Testing', 'event_espresso'); ?></strong><br/> | 
                                                        
| 47 | 47 | <span class="small-text"><?php  | 
                                                        
| 48 | - _e(  | 
                                                        |
| 49 | - 'Use the following credit card numbers for testing. Any other card number produces a general failure.',  | 
                                                        |
| 50 | - 'event_espresso'  | 
                                                        |
| 51 | - ); ?></span>  | 
                                                        |
| 48 | + _e(  | 
                                                        |
| 49 | + 'Use the following credit card numbers for testing. Any other card number produces a general failure.',  | 
                                                        |
| 50 | + 'event_espresso'  | 
                                                        |
| 51 | + ); ?></span>  | 
                                                        |
| 52 | 52 | </p>  | 
                                                        
| 53 | 53 | |
| 54 | 54 | <div class="tbl-wrap">  | 
                                                        
@@ -72,18 +72,18 @@ discard block  | 
                                                    ||
| 72 | 72 | <p class="test-credit-cards-info-pg">  | 
                                                        
| 73 | 73 |          <strong><?php _e('Testing Result Code Responses', 'event_espresso'); ?></strong><br/> | 
                                                        
| 74 | 74 | <span class="small-text"><?php  | 
                                                        
| 75 | - printf(  | 
                                                        |
| 76 | - __(  | 
                                                        |
| 77 | - 'You can use the amount of the transaction to generate a particular result code (see %s PayPal\'s documentation%s). The table below lists the general guidelines for specifying amounts. IMPORTANT: before you attempt any of these, ensure your sandbox PayPal account has %s "Negative Testing" set to on%s. Also be aware that you can generate AVS errors by using certain strings in your address field, and CVV errors using certain CVV values. See %s this PayPal doc %s',  | 
                                                        |
| 78 | - 'event_espresso'  | 
                                                        |
| 79 | - ),  | 
                                                        |
| 80 | - "<a href='https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3GA00GR1' target='_blank'>",  | 
                                                        |
| 81 | - "</a>",  | 
                                                        |
| 82 | - "<a href='https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMNXNkZ2s5VUlHTUk/edit?usp=drivesdk' target='_blank'>",  | 
                                                        |
| 83 | - "</a>",  | 
                                                        |
| 84 | - "<a href='https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions' target='_blank'>",  | 
                                                        |
| 85 | - "</a>"  | 
                                                        |
| 86 | - ); ?></span>  | 
                                                        |
| 75 | + printf(  | 
                                                        |
| 76 | + __(  | 
                                                        |
| 77 | + 'You can use the amount of the transaction to generate a particular result code (see %s PayPal\'s documentation%s). The table below lists the general guidelines for specifying amounts. IMPORTANT: before you attempt any of these, ensure your sandbox PayPal account has %s "Negative Testing" set to on%s. Also be aware that you can generate AVS errors by using certain strings in your address field, and CVV errors using certain CVV values. See %s this PayPal doc %s',  | 
                                                        |
| 78 | + 'event_espresso'  | 
                                                        |
| 79 | + ),  | 
                                                        |
| 80 | + "<a href='https://developer.paypal.com/docs/classic/api/errorcodes/#id09C3GA00GR1' target='_blank'>",  | 
                                                        |
| 81 | + "</a>",  | 
                                                        |
| 82 | + "<a href='https://docs.google.com/a/eventespresso.com/file/d/0B5P8GXTvZgfMNXNkZ2s5VUlHTUk/edit?usp=drivesdk' target='_blank'>",  | 
                                                        |
| 83 | + "</a>",  | 
                                                        |
| 84 | + "<a href='https://cms.paypal.com/ca/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_testing_SBTestErrorConditions' target='_blank'>",  | 
                                                        |
| 85 | + "</a>"  | 
                                                        |
| 86 | + ); ?></span>  | 
                                                        |
| 87 | 87 | </p>  | 
                                                        
| 88 | 88 | |
| 89 | 89 | <div class="tbl-wrap">  | 
                                                        
@@ -4,10 +4,10 @@ discard block  | 
                                                    ||
| 4 | 4 | </p>  | 
                                                        
| 5 | 5 | <p>  | 
                                                        
| 6 | 6 | <?php printf(  | 
                                                        
| 7 | -        esc_html__('See %1$shere%2$s for list of currencies supported by Paypal Pro.', 'event_espresso'), | 
                                                        |
| 8 | - "<a href='https://www.paypal.com/multicurrency'>",  | 
                                                        |
| 9 | - "</a>"  | 
                                                        |
| 10 | - ); ?>  | 
                                                        |
| 7 | +		esc_html__('See %1$shere%2$s for list of currencies supported by Paypal Pro.', 'event_espresso'), | 
                                                        |
| 8 | + "<a href='https://www.paypal.com/multicurrency'>",  | 
                                                        |
| 9 | + "</a>"  | 
                                                        |
| 10 | + ); ?>  | 
                                                        |
| 11 | 11 | </p>  | 
                                                        
| 12 | 12 |  <p><strong><?php esc_html_e('PayPal Pro Settings', 'event_espresso'); ?></strong></p> | 
                                                        
| 13 | 13 | <ul>  | 
                                                        
@@ -18,30 +18,30 @@ discard block  | 
                                                    ||
| 18 | 18 | <li>  | 
                                                        
| 19 | 19 |          <strong><?php esc_html_e('PayPal API Username', 'event_espresso'); ?></strong><br/> | 
                                                        
| 20 | 20 | <?php esc_html_e(  | 
                                                        
| 21 | - 'Enter your API Username for PayPal. Learn how to find your <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=xpt/cps/merchant/wppro/WPProIntegrationSteps-outside#SectionB" target="_blank" rel="noopener noreferrer">API Username</a>.',  | 
                                                        |
| 22 | - 'event_espresso'  | 
                                                        |
| 23 | - ); ?>  | 
                                                        |
| 21 | + 'Enter your API Username for PayPal. Learn how to find your <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=xpt/cps/merchant/wppro/WPProIntegrationSteps-outside#SectionB" target="_blank" rel="noopener noreferrer">API Username</a>.',  | 
                                                        |
| 22 | + 'event_espresso'  | 
                                                        |
| 23 | + ); ?>  | 
                                                        |
| 24 | 24 | </li>  | 
                                                        
| 25 | 25 | <li>  | 
                                                        
| 26 | 26 |          <strong><?php esc_html_e('PayPal API Password', 'event_espresso'); ?></strong><br/> | 
                                                        
| 27 | 27 | <?php esc_html_e(  | 
                                                        
| 28 | - 'Enter your API Password for PayPal. Learn how to find your <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=xpt/cps/merchant/wppro/WPProIntegrationSteps-outside#SectionB" target="_blank" rel="noopener noreferrer">API Password</a>.',  | 
                                                        |
| 29 | - 'event_espresso'  | 
                                                        |
| 30 | - ); ?>  | 
                                                        |
| 28 | + 'Enter your API Password for PayPal. Learn how to find your <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=xpt/cps/merchant/wppro/WPProIntegrationSteps-outside#SectionB" target="_blank" rel="noopener noreferrer">API Password</a>.',  | 
                                                        |
| 29 | + 'event_espresso'  | 
                                                        |
| 30 | + ); ?>  | 
                                                        |
| 31 | 31 | </li>  | 
                                                        
| 32 | 32 | <li>  | 
                                                        
| 33 | 33 |          <strong><?php esc_html_e('PayPal API Signature', 'event_espresso'); ?></strong><br/> | 
                                                        
| 34 | 34 | <?php esc_html_e(  | 
                                                        
| 35 | - 'Enter your API Signature for PayPal. Learn how to find your <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=xpt/cps/merchant/wppro/WPProIntegrationSteps-outside#SectionB" target="_blank" rel="noopener noreferrer">API Signature</a>.',  | 
                                                        |
| 36 | - 'event_espresso'  | 
                                                        |
| 37 | - ); ?>  | 
                                                        |
| 35 | + 'Enter your API Signature for PayPal. Learn how to find your <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=xpt/cps/merchant/wppro/WPProIntegrationSteps-outside#SectionB" target="_blank" rel="noopener noreferrer">API Signature</a>.',  | 
                                                        |
| 36 | + 'event_espresso'  | 
                                                        |
| 37 | + ); ?>  | 
                                                        |
| 38 | 38 | </li>  | 
                                                        
| 39 | 39 | <li>  | 
                                                        
| 40 | 40 |          <strong><?php esc_html_e('Country Currency', 'event_espresso'); ?></strong><br/> | 
                                                        
| 41 | 41 | <?php esc_html_e(  | 
                                                        
| 42 | - 'Select the currency for your country. Payments will be accepted in this currency.',  | 
                                                        |
| 43 | - 'event_espresso'  | 
                                                        |
| 44 | - ); ?>  | 
                                                        |
| 42 | + 'Select the currency for your country. Payments will be accepted in this currency.',  | 
                                                        |
| 43 | + 'event_espresso'  | 
                                                        |
| 44 | + ); ?>  | 
                                                        |
| 45 | 45 | </li>  | 
                                                        
| 46 | 46 | <li>  | 
                                                        
| 47 | 47 |          <strong><?php esc_html_e('Accepted Card Types', 'event_espresso'); ?></strong><br/> | 
                                                        
@@ -50,9 +50,9 @@ discard block  | 
                                                    ||
| 50 | 50 | <li>  | 
                                                        
| 51 | 51 |          <strong><?php esc_html_e('Use the Debugging Feature and the PayPal Sandbox', 'event_espresso'); ?></strong><br/> | 
                                                        
| 52 | 52 | <?php esc_html_e(  | 
                                                        
| 53 | - 'Specify if you want to test the payment gateway by submitting a test transaction. If this option is enabled, be sure to enter your PayPal sandbox credentials in the fields above. Be sure to turn this setting off when you are done testing.',  | 
                                                        |
| 54 | - 'event_espresso'  | 
                                                        |
| 55 | - ); ?>  | 
                                                        |
| 53 | + 'Specify if you want to test the payment gateway by submitting a test transaction. If this option is enabled, be sure to enter your PayPal sandbox credentials in the fields above. Be sure to turn this setting off when you are done testing.',  | 
                                                        |
| 54 | + 'event_espresso'  | 
                                                        |
| 55 | + ); ?>  | 
                                                        |
| 56 | 56 | </li>  | 
                                                        
| 57 | 57 | <li>  | 
                                                        
| 58 | 58 |          <strong><?php esc_html_e('Button Image URL', 'event_espresso'); ?></strong><br/> | 
                                                        
@@ -4,37 +4,37 @@ discard block  | 
                                                    ||
| 4 | 4 | </p>  | 
                                                        
| 5 | 5 | <p>  | 
                                                        
| 6 | 6 | <?php  | 
                                                        
| 7 | - printf(  | 
                                                        |
| 8 | - esc_html__(  | 
                                                        |
| 9 | - 'Mijireh is basically a middle-man between Event Espresso and over 90 payment gateways. Most of the configuration occurs on %1$sMijireh\'s website%2$s, where you configure your Mijireh store with the %3$spayment gateway of your choice%4$s.',  | 
                                                        |
| 10 | - 'event_espresso'  | 
                                                        |
| 11 | - ),  | 
                                                        |
| 12 | - '<a href="http://www.mijireh.com/" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 13 | - '</a>',  | 
                                                        |
| 14 | - '<a href="http://www.mijireh.com/docs/payment-gateways/" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 15 | - '</a>'  | 
                                                        |
| 16 | - );  | 
                                                        |
| 17 | - ?>  | 
                                                        |
| 7 | + printf(  | 
                                                        |
| 8 | + esc_html__(  | 
                                                        |
| 9 | + 'Mijireh is basically a middle-man between Event Espresso and over 90 payment gateways. Most of the configuration occurs on %1$sMijireh\'s website%2$s, where you configure your Mijireh store with the %3$spayment gateway of your choice%4$s.',  | 
                                                        |
| 10 | + 'event_espresso'  | 
                                                        |
| 11 | + ),  | 
                                                        |
| 12 | + '<a href="http://www.mijireh.com/" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 13 | + '</a>',  | 
                                                        |
| 14 | + '<a href="http://www.mijireh.com/docs/payment-gateways/" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 15 | + '</a>'  | 
                                                        |
| 16 | + );  | 
                                                        |
| 17 | + ?>  | 
                                                        |
| 18 | 18 | </p>  | 
                                                        
| 19 | 19 | <p>  | 
                                                        
| 20 | 20 | <?php esc_html_e(  | 
                                                        
| 21 | - 'For information on what currencies you can use with Mijireh, please consult the payment gateway Mijireh is setup to use.',  | 
                                                        |
| 22 | - 'event_espresso'  | 
                                                        |
| 23 | - ) ?>  | 
                                                        |
| 21 | + 'For information on what currencies you can use with Mijireh, please consult the payment gateway Mijireh is setup to use.',  | 
                                                        |
| 22 | + 'event_espresso'  | 
                                                        |
| 23 | + ) ?>  | 
                                                        |
| 24 | 24 | </p>  | 
                                                        
| 25 | 25 | <ul>  | 
                                                        
| 26 | 26 | <li>  | 
                                                        
| 27 | 27 |          <strong><?php esc_html_e('Mijireh Access Key', 'event_espresso'); ?></strong><br/> | 
                                                        
| 28 | 28 | <?php  | 
                                                        
| 29 | - printf(  | 
                                                        |
| 30 | - esc_html__(  | 
                                                        |
| 31 | - 'Enter your Access Key for Mijireh. Your Access Key can be found in your %1$sMijireh account dashboard%2$s.',  | 
                                                        |
| 32 | - 'event_espresso'  | 
                                                        |
| 33 | - ),  | 
                                                        |
| 34 | - '<a href="https://secure.mijireh.com/login" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 35 | - '</a>'  | 
                                                        |
| 36 | - );  | 
                                                        |
| 37 | - ?>  | 
                                                        |
| 29 | + printf(  | 
                                                        |
| 30 | + esc_html__(  | 
                                                        |
| 31 | + 'Enter your Access Key for Mijireh. Your Access Key can be found in your %1$sMijireh account dashboard%2$s.',  | 
                                                        |
| 32 | + 'event_espresso'  | 
                                                        |
| 33 | + ),  | 
                                                        |
| 34 | + '<a href="https://secure.mijireh.com/login" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 35 | + '</a>'  | 
                                                        |
| 36 | + );  | 
                                                        |
| 37 | + ?>  | 
                                                        |
| 38 | 38 | </li>  | 
                                                        
| 39 | 39 | <li>  | 
                                                        
| 40 | 40 |          <strong><?php esc_html_e('Button Image URL', 'event_espresso'); ?></strong><br/> | 
                                                        
@@ -44,15 +44,15 @@ discard block  | 
                                                    ||
| 44 | 44 |  <p><strong><?php esc_html_e('Mijireh Checkout Page Design', 'event_espresso'); ?></strong></p> | 
                                                        
| 45 | 45 | <p>  | 
                                                        
| 46 | 46 | <?php esc_html_e(  | 
                                                        
| 47 | - "As you are probably aware, when users pay with Mijireh Payment Method, 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.",  | 
                                                        |
| 48 | - 'event_espresso'  | 
                                                        |
| 49 | - ); ?>  | 
                                                        |
| 47 | + "As you are probably aware, when users pay with Mijireh Payment Method, 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.",  | 
                                                        |
| 48 | + 'event_espresso'  | 
                                                        |
| 49 | + ); ?>  | 
                                                        |
| 50 | 50 | <?php printf(  | 
                                                        
| 51 | - esc_html__(  | 
                                                        |
| 52 | -            "In order to do this, we automatically create a new WordPress page which is designed 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.", | 
                                                        |
| 53 | - 'event_espresso'  | 
                                                        |
| 54 | - ),  | 
                                                        |
| 55 | - '<a href="http://ee-screenshots.s3.amazonaws.com/ee4/event-espresso-mijireh-slurp-page-example.jpg" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 56 | - '</a>'  | 
                                                        |
| 57 | - ); ?>  | 
                                                        |
| 51 | + esc_html__(  | 
                                                        |
| 52 | +			"In order to do this, we automatically create a new WordPress page which is designed 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.", | 
                                                        |
| 53 | + 'event_espresso'  | 
                                                        |
| 54 | + ),  | 
                                                        |
| 55 | + '<a href="http://ee-screenshots.s3.amazonaws.com/ee4/event-espresso-mijireh-slurp-page-example.jpg" target="_blank" rel="noopener noreferrer">',  | 
                                                        |
| 56 | + '</a>'  | 
                                                        |
| 57 | + ); ?>  | 
                                                        |
| 58 | 58 | </p>  | 
                                                        
| 59 | 59 | \ No newline at end of file  | 
                                                        
@@ -3,10 +3,10 @@  | 
                                                    ||
| 3 | 3 |  <?php esc_html_e('This page shows options for Email Validation, the EE "Bot Trap" and reCAPTCHA which can help prevent SPAM registrations on your site.', 'event_espresso'); ?> | 
                                                        
| 4 | 4 | </p>  | 
                                                        
| 5 | 5 | <div id="email_validation_info">  | 
                                                        
| 6 | -<p><strong><?php esc_html_e('Email Validation', 'event_espresso');?></strong></p> | 
                                                        |
| 6 | +<p><strong><?php esc_html_e('Email Validation', 'event_espresso'); ?></strong></p> | 
                                                        |
| 7 | 7 |  <p><?php esc_html_e("Validating an email address is extremely difficult to do correctly. Your server's configuration, as well as your own tolerances and needs, can affect the type of validation needed. We offer different types of validation so that you can control how strict your registration form responds to entered email addresses. If you are receiving too many bogus email addresses, then you can try the WordPress Default validation setting. If you find that the form validation is blocking a valid email address you can try the Basic setting, or if available, the International validation settings.", 'event_espresso'); ?> | 
                                                        
| 8 | 8 | </p>  | 
                                                        
| 9 | -<p><strong><?php esc_html_e('Validation Options:', 'event_espresso');?></strong></p> | 
                                                        |
| 9 | +<p><strong><?php esc_html_e('Validation Options:', 'event_espresso'); ?></strong></p> | 
                                                        |
| 10 | 10 | <ul>  | 
                                                        
| 11 | 11 | <li>  | 
                                                        
| 12 | 12 |      <?php esc_html_e('"Basic" - only checks that an email address follows the most basic structure guidelines ( ie: [email protected] ). Will work with the widest range of email addresses but will also allow the most garbage through.', 'event_espresso'); ?></li> |