@@ -17,270 +17,270 @@ |
||
| 17 | 17 | { |
| 18 | 18 | |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var string $iframe_name |
|
| 22 | - */ |
|
| 23 | - private $iframe_name; |
|
| 20 | + /** |
|
| 21 | + * @var string $iframe_name |
|
| 22 | + */ |
|
| 23 | + private $iframe_name; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var string $route_name |
|
| 27 | - */ |
|
| 28 | - private $route_name; |
|
| 25 | + /** |
|
| 26 | + * @var string $route_name |
|
| 27 | + */ |
|
| 28 | + private $route_name; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var string $slug |
|
| 32 | - */ |
|
| 33 | - private $slug; |
|
| 30 | + /** |
|
| 31 | + * @var string $slug |
|
| 32 | + */ |
|
| 33 | + private $slug; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var boolean $append_filterable_content |
|
| 37 | - */ |
|
| 38 | - private $append_filterable_content; |
|
| 35 | + /** |
|
| 36 | + * @var boolean $append_filterable_content |
|
| 37 | + */ |
|
| 38 | + private $append_filterable_content; |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * IframeEmbedButton constructor. |
|
| 43 | - * |
|
| 44 | - * @param string $iframe_name i18n name for the iframe. This will be used in HTML |
|
| 45 | - * @param string $route_name the name of the registered route |
|
| 46 | - * @param string $slug URL slug used for the thing the iframe button is being embedded in. |
|
| 47 | - * will most likely be "event" since that's the only usage atm |
|
| 48 | - */ |
|
| 49 | - public function __construct($iframe_name, $route_name, $slug = 'event') |
|
| 50 | - { |
|
| 51 | - $this->iframe_name = $iframe_name; |
|
| 52 | - $this->route_name = $route_name; |
|
| 53 | - $this->slug = $slug; |
|
| 54 | - } |
|
| 41 | + /** |
|
| 42 | + * IframeEmbedButton constructor. |
|
| 43 | + * |
|
| 44 | + * @param string $iframe_name i18n name for the iframe. This will be used in HTML |
|
| 45 | + * @param string $route_name the name of the registered route |
|
| 46 | + * @param string $slug URL slug used for the thing the iframe button is being embedded in. |
|
| 47 | + * will most likely be "event" since that's the only usage atm |
|
| 48 | + */ |
|
| 49 | + public function __construct($iframe_name, $route_name, $slug = 'event') |
|
| 50 | + { |
|
| 51 | + $this->iframe_name = $iframe_name; |
|
| 52 | + $this->route_name = $route_name; |
|
| 53 | + $this->slug = $slug; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Adds an iframe embed code button to the Event editor. |
|
| 59 | - */ |
|
| 60 | - public function addEventEditorIframeEmbedButtonFilter() |
|
| 61 | - { |
|
| 62 | - // add button for iframe code to event editor. |
|
| 63 | - add_filter( |
|
| 64 | - 'get_sample_permalink_html', |
|
| 65 | - array($this, 'appendIframeEmbedButtonToSamplePermalinkHtml'), |
|
| 66 | - 10, |
|
| 67 | - 2 |
|
| 68 | - ); |
|
| 69 | - add_action( |
|
| 70 | - 'admin_enqueue_scripts', |
|
| 71 | - array($this, 'embedButtonAssets'), |
|
| 72 | - 10 |
|
| 73 | - ); |
|
| 74 | - } |
|
| 57 | + /** |
|
| 58 | + * Adds an iframe embed code button to the Event editor. |
|
| 59 | + */ |
|
| 60 | + public function addEventEditorIframeEmbedButtonFilter() |
|
| 61 | + { |
|
| 62 | + // add button for iframe code to event editor. |
|
| 63 | + add_filter( |
|
| 64 | + 'get_sample_permalink_html', |
|
| 65 | + array($this, 'appendIframeEmbedButtonToSamplePermalinkHtml'), |
|
| 66 | + 10, |
|
| 67 | + 2 |
|
| 68 | + ); |
|
| 69 | + add_action( |
|
| 70 | + 'admin_enqueue_scripts', |
|
| 71 | + array($this, 'embedButtonAssets'), |
|
| 72 | + 10 |
|
| 73 | + ); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * @param $permalink_string |
|
| 79 | - * @param $id |
|
| 80 | - * @return string |
|
| 81 | - */ |
|
| 82 | - public function appendIframeEmbedButtonToSamplePermalinkHtml($permalink_string, $id) |
|
| 83 | - { |
|
| 84 | - return $this->eventEditorIframeEmbedButton( |
|
| 85 | - $permalink_string, |
|
| 86 | - $id |
|
| 87 | - ); |
|
| 88 | - } |
|
| 77 | + /** |
|
| 78 | + * @param $permalink_string |
|
| 79 | + * @param $id |
|
| 80 | + * @return string |
|
| 81 | + */ |
|
| 82 | + public function appendIframeEmbedButtonToSamplePermalinkHtml($permalink_string, $id) |
|
| 83 | + { |
|
| 84 | + return $this->eventEditorIframeEmbedButton( |
|
| 85 | + $permalink_string, |
|
| 86 | + $id |
|
| 87 | + ); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * iframe embed code button to the Event editor. |
|
| 93 | - * |
|
| 94 | - * @param string $permalink_string |
|
| 95 | - * @param int $id |
|
| 96 | - * @return string |
|
| 97 | - */ |
|
| 98 | - public function eventEditorIframeEmbedButton( |
|
| 99 | - $permalink_string, |
|
| 100 | - $id |
|
| 101 | - ) { |
|
| 102 | - // make sure this is ONLY when editing and the event id has been set. |
|
| 103 | - if (! empty($id)) { |
|
| 104 | - $post = get_post($id); |
|
| 105 | - // if NOT event then let's get out. |
|
| 106 | - if ($post->post_type !== 'espresso_events') { |
|
| 107 | - return $permalink_string; |
|
| 108 | - } |
|
| 109 | - $permalink_string .= $this->embedButtonHtml([$this->slug => $id]); |
|
| 110 | - } |
|
| 111 | - return $permalink_string; |
|
| 112 | - } |
|
| 91 | + /** |
|
| 92 | + * iframe embed code button to the Event editor. |
|
| 93 | + * |
|
| 94 | + * @param string $permalink_string |
|
| 95 | + * @param int $id |
|
| 96 | + * @return string |
|
| 97 | + */ |
|
| 98 | + public function eventEditorIframeEmbedButton( |
|
| 99 | + $permalink_string, |
|
| 100 | + $id |
|
| 101 | + ) { |
|
| 102 | + // make sure this is ONLY when editing and the event id has been set. |
|
| 103 | + if (! empty($id)) { |
|
| 104 | + $post = get_post($id); |
|
| 105 | + // if NOT event then let's get out. |
|
| 106 | + if ($post->post_type !== 'espresso_events') { |
|
| 107 | + return $permalink_string; |
|
| 108 | + } |
|
| 109 | + $permalink_string .= $this->embedButtonHtml([$this->slug => $id]); |
|
| 110 | + } |
|
| 111 | + return $permalink_string; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Adds an iframe embed code button via a WP do_action() as determined by the first parameter |
|
| 117 | - * |
|
| 118 | - * @param string $action name of the WP do_action() to hook into |
|
| 119 | - */ |
|
| 120 | - public function addActionIframeEmbedButton($action) |
|
| 121 | - { |
|
| 122 | - // add button for iframe code to event editor. |
|
| 123 | - add_action( |
|
| 124 | - $action, |
|
| 125 | - array($this, 'addActionIframeEmbedButtonCallback'), |
|
| 126 | - 10, |
|
| 127 | - 2 |
|
| 128 | - ); |
|
| 129 | - } |
|
| 115 | + /** |
|
| 116 | + * Adds an iframe embed code button via a WP do_action() as determined by the first parameter |
|
| 117 | + * |
|
| 118 | + * @param string $action name of the WP do_action() to hook into |
|
| 119 | + */ |
|
| 120 | + public function addActionIframeEmbedButton($action) |
|
| 121 | + { |
|
| 122 | + // add button for iframe code to event editor. |
|
| 123 | + add_action( |
|
| 124 | + $action, |
|
| 125 | + array($this, 'addActionIframeEmbedButtonCallback'), |
|
| 126 | + 10, |
|
| 127 | + 2 |
|
| 128 | + ); |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * @return void |
|
| 134 | - */ |
|
| 135 | - public function addActionIframeEmbedButtonCallback() |
|
| 136 | - { |
|
| 137 | - echo $this->embedButtonHtml(); // already escaped |
|
| 138 | - } |
|
| 132 | + /** |
|
| 133 | + * @return void |
|
| 134 | + */ |
|
| 135 | + public function addActionIframeEmbedButtonCallback() |
|
| 136 | + { |
|
| 137 | + echo $this->embedButtonHtml(); // already escaped |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | 140 | |
| 141 | - /** |
|
| 142 | - * Adds an iframe embed code button via a WP apply_filters() as determined by the first parameter |
|
| 143 | - * |
|
| 144 | - * @param string $filter name of the WP apply_filters() to hook into |
|
| 145 | - * @param bool $append if true, will add iframe embed button to end of content, |
|
| 146 | - * else if false, will add to the beginning of the content |
|
| 147 | - */ |
|
| 148 | - public function addFilterIframeEmbedButton($filter, $append = true) |
|
| 149 | - { |
|
| 150 | - $this->append_filterable_content = $append; |
|
| 151 | - // add button for iframe code to event editor. |
|
| 152 | - add_filter( |
|
| 153 | - $filter, |
|
| 154 | - array($this, 'addFilterIframeEmbedButtonCallback'), |
|
| 155 | - 10 |
|
| 156 | - ); |
|
| 157 | - } |
|
| 141 | + /** |
|
| 142 | + * Adds an iframe embed code button via a WP apply_filters() as determined by the first parameter |
|
| 143 | + * |
|
| 144 | + * @param string $filter name of the WP apply_filters() to hook into |
|
| 145 | + * @param bool $append if true, will add iframe embed button to end of content, |
|
| 146 | + * else if false, will add to the beginning of the content |
|
| 147 | + */ |
|
| 148 | + public function addFilterIframeEmbedButton($filter, $append = true) |
|
| 149 | + { |
|
| 150 | + $this->append_filterable_content = $append; |
|
| 151 | + // add button for iframe code to event editor. |
|
| 152 | + add_filter( |
|
| 153 | + $filter, |
|
| 154 | + array($this, 'addFilterIframeEmbedButtonCallback'), |
|
| 155 | + 10 |
|
| 156 | + ); |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | 159 | |
| 160 | - /** |
|
| 161 | - * @param array|string $filterable_content |
|
| 162 | - * @return array|string |
|
| 163 | - */ |
|
| 164 | - public function addFilterIframeEmbedButtonCallback($filterable_content) |
|
| 165 | - { |
|
| 166 | - $embedButtonHtml = $this->embedButtonHtml(); |
|
| 167 | - if (is_array($filterable_content)) { |
|
| 168 | - $filterable_content = $this->append_filterable_content |
|
| 169 | - ? $filterable_content + array($this->route_name => $embedButtonHtml) |
|
| 170 | - : array($this->route_name => $embedButtonHtml) + $filterable_content; |
|
| 171 | - } else { |
|
| 172 | - $filterable_content = $this->append_filterable_content |
|
| 173 | - ? $filterable_content . $embedButtonHtml |
|
| 174 | - : $embedButtonHtml . $filterable_content; |
|
| 175 | - } |
|
| 176 | - return $filterable_content; |
|
| 177 | - } |
|
| 160 | + /** |
|
| 161 | + * @param array|string $filterable_content |
|
| 162 | + * @return array|string |
|
| 163 | + */ |
|
| 164 | + public function addFilterIframeEmbedButtonCallback($filterable_content) |
|
| 165 | + { |
|
| 166 | + $embedButtonHtml = $this->embedButtonHtml(); |
|
| 167 | + if (is_array($filterable_content)) { |
|
| 168 | + $filterable_content = $this->append_filterable_content |
|
| 169 | + ? $filterable_content + array($this->route_name => $embedButtonHtml) |
|
| 170 | + : array($this->route_name => $embedButtonHtml) + $filterable_content; |
|
| 171 | + } else { |
|
| 172 | + $filterable_content = $this->append_filterable_content |
|
| 173 | + ? $filterable_content . $embedButtonHtml |
|
| 174 | + : $embedButtonHtml . $filterable_content; |
|
| 175 | + } |
|
| 176 | + return $filterable_content; |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | 179 | |
| 180 | - /** |
|
| 181 | - * iframe_embed_html |
|
| 182 | - * |
|
| 183 | - * @param array $query_args |
|
| 184 | - * @param string $button_class |
|
| 185 | - * @return string |
|
| 186 | - */ |
|
| 187 | - public function embedButtonHtml($query_args = array(), $button_class = '') |
|
| 188 | - { |
|
| 189 | - // incoming args will replace the defaults listed here in the second array (union preserves first array) |
|
| 190 | - $query_args = (array) $query_args + array($this->route_name => 'iframe'); |
|
| 191 | - $query_args = (array) apply_filters( |
|
| 192 | - 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args', |
|
| 193 | - $query_args |
|
| 194 | - ); |
|
| 195 | - // add this route to our localized vars |
|
| 196 | - $iframe_module_routes = EE_Registry::$i18n_js_strings['iframe_module_routes'] ?? []; |
|
| 197 | - $iframe_module_routes[ $this->route_name ] = $this->route_name; |
|
| 198 | - EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes; |
|
| 199 | - return EEH_HTML::div( |
|
| 200 | - EEH_HTML::link( |
|
| 201 | - '#', |
|
| 202 | - sprintf(esc_html__('Embed %1$s', 'event_espresso'), $this->iframe_name), |
|
| 203 | - sprintf( |
|
| 204 | - esc_html__( |
|
| 205 | - 'click here to generate code for embedding %1$s iframe into another site.', |
|
| 206 | - 'event_espresso' |
|
| 207 | - ), |
|
| 208 | - EEH_Inflector::add_indefinite_article($this->iframe_name) |
|
| 209 | - ), |
|
| 210 | - esc_attr($this->route_name) . '-iframe-embed-trigger-js', |
|
| 211 | - 'iframe-embed-trigger-js button button--small button--secondary ' . esc_attr($button_class), |
|
| 212 | - '', |
|
| 213 | - ' data-iframe_embed_button="#' . esc_attr($this->route_name) . '-iframe-js" tabindex="-1"' |
|
| 214 | - ) |
|
| 215 | - . EEH_HTML::div( |
|
| 216 | - EEH_HTML::div( |
|
| 217 | - '<iframe src="' |
|
| 218 | - . esc_url_raw(add_query_arg($query_args, site_url())) |
|
| 219 | - . '" width="100%" height="100%"></iframe>', |
|
| 220 | - '', |
|
| 221 | - '', |
|
| 222 | - 'width:100%; height: 500px;' |
|
| 223 | - ), |
|
| 224 | - esc_attr($this->route_name) . '-iframe-js', |
|
| 225 | - 'iframe-embed-wrapper-js', |
|
| 226 | - 'display:none;' |
|
| 227 | - ), |
|
| 228 | - '', |
|
| 229 | - 'ee-admin-button-row ee-admin-button-row--align-start' |
|
| 230 | - ); |
|
| 231 | - } |
|
| 180 | + /** |
|
| 181 | + * iframe_embed_html |
|
| 182 | + * |
|
| 183 | + * @param array $query_args |
|
| 184 | + * @param string $button_class |
|
| 185 | + * @return string |
|
| 186 | + */ |
|
| 187 | + public function embedButtonHtml($query_args = array(), $button_class = '') |
|
| 188 | + { |
|
| 189 | + // incoming args will replace the defaults listed here in the second array (union preserves first array) |
|
| 190 | + $query_args = (array) $query_args + array($this->route_name => 'iframe'); |
|
| 191 | + $query_args = (array) apply_filters( |
|
| 192 | + 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args', |
|
| 193 | + $query_args |
|
| 194 | + ); |
|
| 195 | + // add this route to our localized vars |
|
| 196 | + $iframe_module_routes = EE_Registry::$i18n_js_strings['iframe_module_routes'] ?? []; |
|
| 197 | + $iframe_module_routes[ $this->route_name ] = $this->route_name; |
|
| 198 | + EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes; |
|
| 199 | + return EEH_HTML::div( |
|
| 200 | + EEH_HTML::link( |
|
| 201 | + '#', |
|
| 202 | + sprintf(esc_html__('Embed %1$s', 'event_espresso'), $this->iframe_name), |
|
| 203 | + sprintf( |
|
| 204 | + esc_html__( |
|
| 205 | + 'click here to generate code for embedding %1$s iframe into another site.', |
|
| 206 | + 'event_espresso' |
|
| 207 | + ), |
|
| 208 | + EEH_Inflector::add_indefinite_article($this->iframe_name) |
|
| 209 | + ), |
|
| 210 | + esc_attr($this->route_name) . '-iframe-embed-trigger-js', |
|
| 211 | + 'iframe-embed-trigger-js button button--small button--secondary ' . esc_attr($button_class), |
|
| 212 | + '', |
|
| 213 | + ' data-iframe_embed_button="#' . esc_attr($this->route_name) . '-iframe-js" tabindex="-1"' |
|
| 214 | + ) |
|
| 215 | + . EEH_HTML::div( |
|
| 216 | + EEH_HTML::div( |
|
| 217 | + '<iframe src="' |
|
| 218 | + . esc_url_raw(add_query_arg($query_args, site_url())) |
|
| 219 | + . '" width="100%" height="100%"></iframe>', |
|
| 220 | + '', |
|
| 221 | + '', |
|
| 222 | + 'width:100%; height: 500px;' |
|
| 223 | + ), |
|
| 224 | + esc_attr($this->route_name) . '-iframe-js', |
|
| 225 | + 'iframe-embed-wrapper-js', |
|
| 226 | + 'display:none;' |
|
| 227 | + ), |
|
| 228 | + '', |
|
| 229 | + 'ee-admin-button-row ee-admin-button-row--align-start' |
|
| 230 | + ); |
|
| 231 | + } |
|
| 232 | 232 | |
| 233 | 233 | |
| 234 | - /** |
|
| 235 | - * enqueue iframe button js |
|
| 236 | - */ |
|
| 237 | - public function embedButtonAssets() |
|
| 238 | - { |
|
| 239 | - EE_Registry::$i18n_js_strings['iframe_embed_title'] = esc_html__( |
|
| 240 | - 'copy and paste the following into any other site\'s content to display this event:', |
|
| 241 | - 'event_espresso' |
|
| 242 | - ); |
|
| 243 | - EE_Registry::$i18n_js_strings['iframe_embed_close_msg'] = esc_html__( |
|
| 244 | - 'click anywhere outside of this window to close it.', |
|
| 245 | - 'event_espresso' |
|
| 246 | - ); |
|
| 247 | - wp_register_script( |
|
| 248 | - 'iframe_embed_button', |
|
| 249 | - plugin_dir_url(__FILE__) . 'iframe-embed-button.js', |
|
| 250 | - array('ee-dialog'), |
|
| 251 | - EVENT_ESPRESSO_VERSION, |
|
| 252 | - true |
|
| 253 | - ); |
|
| 254 | - wp_enqueue_script('iframe_embed_button'); |
|
| 255 | - } |
|
| 234 | + /** |
|
| 235 | + * enqueue iframe button js |
|
| 236 | + */ |
|
| 237 | + public function embedButtonAssets() |
|
| 238 | + { |
|
| 239 | + EE_Registry::$i18n_js_strings['iframe_embed_title'] = esc_html__( |
|
| 240 | + 'copy and paste the following into any other site\'s content to display this event:', |
|
| 241 | + 'event_espresso' |
|
| 242 | + ); |
|
| 243 | + EE_Registry::$i18n_js_strings['iframe_embed_close_msg'] = esc_html__( |
|
| 244 | + 'click anywhere outside of this window to close it.', |
|
| 245 | + 'event_espresso' |
|
| 246 | + ); |
|
| 247 | + wp_register_script( |
|
| 248 | + 'iframe_embed_button', |
|
| 249 | + plugin_dir_url(__FILE__) . 'iframe-embed-button.js', |
|
| 250 | + array('ee-dialog'), |
|
| 251 | + EVENT_ESPRESSO_VERSION, |
|
| 252 | + true |
|
| 253 | + ); |
|
| 254 | + wp_enqueue_script('iframe_embed_button'); |
|
| 255 | + } |
|
| 256 | 256 | |
| 257 | 257 | |
| 258 | - /** |
|
| 259 | - * generates embed button sections for admin pages |
|
| 260 | - * |
|
| 261 | - * @param array $embed_buttons |
|
| 262 | - * @return string |
|
| 263 | - */ |
|
| 264 | - public function addIframeEmbedButtonsSection(array $embed_buttons) |
|
| 265 | - { |
|
| 266 | - $embed_buttons = (array) apply_filters( |
|
| 267 | - 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', |
|
| 268 | - $embed_buttons |
|
| 269 | - ); |
|
| 270 | - if (empty($embed_buttons)) { |
|
| 271 | - return ''; |
|
| 272 | - } |
|
| 273 | - // add button for iframe code to event editor. |
|
| 274 | - $html = EEH_HTML::div('', '', 'ee-admin-section ee-iframe-embed-buttons'); |
|
| 275 | - $html .= EEH_HTML::h3(esc_html__('iFrame Embed Code', 'event_espresso')); |
|
| 276 | - $html .= EEH_HTML::p( |
|
| 277 | - esc_html__( |
|
| 278 | - 'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.', |
|
| 279 | - 'event_espresso' |
|
| 280 | - ) |
|
| 281 | - ); |
|
| 282 | - $html .= ' ' . implode(' ', $embed_buttons) . ' '; |
|
| 283 | - $html .= EEH_HTML::divx(); |
|
| 284 | - return $html; |
|
| 285 | - } |
|
| 258 | + /** |
|
| 259 | + * generates embed button sections for admin pages |
|
| 260 | + * |
|
| 261 | + * @param array $embed_buttons |
|
| 262 | + * @return string |
|
| 263 | + */ |
|
| 264 | + public function addIframeEmbedButtonsSection(array $embed_buttons) |
|
| 265 | + { |
|
| 266 | + $embed_buttons = (array) apply_filters( |
|
| 267 | + 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', |
|
| 268 | + $embed_buttons |
|
| 269 | + ); |
|
| 270 | + if (empty($embed_buttons)) { |
|
| 271 | + return ''; |
|
| 272 | + } |
|
| 273 | + // add button for iframe code to event editor. |
|
| 274 | + $html = EEH_HTML::div('', '', 'ee-admin-section ee-iframe-embed-buttons'); |
|
| 275 | + $html .= EEH_HTML::h3(esc_html__('iFrame Embed Code', 'event_espresso')); |
|
| 276 | + $html .= EEH_HTML::p( |
|
| 277 | + esc_html__( |
|
| 278 | + 'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.', |
|
| 279 | + 'event_espresso' |
|
| 280 | + ) |
|
| 281 | + ); |
|
| 282 | + $html .= ' ' . implode(' ', $embed_buttons) . ' '; |
|
| 283 | + $html .= EEH_HTML::divx(); |
|
| 284 | + return $html; |
|
| 285 | + } |
|
| 286 | 286 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $id |
| 101 | 101 | ) { |
| 102 | 102 | // make sure this is ONLY when editing and the event id has been set. |
| 103 | - if (! empty($id)) { |
|
| 103 | + if ( ! empty($id)) { |
|
| 104 | 104 | $post = get_post($id); |
| 105 | 105 | // if NOT event then let's get out. |
| 106 | 106 | if ($post->post_type !== 'espresso_events') { |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | : array($this->route_name => $embedButtonHtml) + $filterable_content; |
| 171 | 171 | } else { |
| 172 | 172 | $filterable_content = $this->append_filterable_content |
| 173 | - ? $filterable_content . $embedButtonHtml |
|
| 174 | - : $embedButtonHtml . $filterable_content; |
|
| 173 | + ? $filterable_content.$embedButtonHtml |
|
| 174 | + : $embedButtonHtml.$filterable_content; |
|
| 175 | 175 | } |
| 176 | 176 | return $filterable_content; |
| 177 | 177 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | ); |
| 195 | 195 | // add this route to our localized vars |
| 196 | 196 | $iframe_module_routes = EE_Registry::$i18n_js_strings['iframe_module_routes'] ?? []; |
| 197 | - $iframe_module_routes[ $this->route_name ] = $this->route_name; |
|
| 197 | + $iframe_module_routes[$this->route_name] = $this->route_name; |
|
| 198 | 198 | EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes; |
| 199 | 199 | return EEH_HTML::div( |
| 200 | 200 | EEH_HTML::link( |
@@ -207,10 +207,10 @@ discard block |
||
| 207 | 207 | ), |
| 208 | 208 | EEH_Inflector::add_indefinite_article($this->iframe_name) |
| 209 | 209 | ), |
| 210 | - esc_attr($this->route_name) . '-iframe-embed-trigger-js', |
|
| 211 | - 'iframe-embed-trigger-js button button--small button--secondary ' . esc_attr($button_class), |
|
| 210 | + esc_attr($this->route_name).'-iframe-embed-trigger-js', |
|
| 211 | + 'iframe-embed-trigger-js button button--small button--secondary '.esc_attr($button_class), |
|
| 212 | 212 | '', |
| 213 | - ' data-iframe_embed_button="#' . esc_attr($this->route_name) . '-iframe-js" tabindex="-1"' |
|
| 213 | + ' data-iframe_embed_button="#'.esc_attr($this->route_name).'-iframe-js" tabindex="-1"' |
|
| 214 | 214 | ) |
| 215 | 215 | . EEH_HTML::div( |
| 216 | 216 | EEH_HTML::div( |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | '', |
| 222 | 222 | 'width:100%; height: 500px;' |
| 223 | 223 | ), |
| 224 | - esc_attr($this->route_name) . '-iframe-js', |
|
| 224 | + esc_attr($this->route_name).'-iframe-js', |
|
| 225 | 225 | 'iframe-embed-wrapper-js', |
| 226 | 226 | 'display:none;' |
| 227 | 227 | ), |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | ); |
| 247 | 247 | wp_register_script( |
| 248 | 248 | 'iframe_embed_button', |
| 249 | - plugin_dir_url(__FILE__) . 'iframe-embed-button.js', |
|
| 249 | + plugin_dir_url(__FILE__).'iframe-embed-button.js', |
|
| 250 | 250 | array('ee-dialog'), |
| 251 | 251 | EVENT_ESPRESSO_VERSION, |
| 252 | 252 | true |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | 'event_espresso' |
| 280 | 280 | ) |
| 281 | 281 | ); |
| 282 | - $html .= ' ' . implode(' ', $embed_buttons) . ' '; |
|
| 282 | + $html .= ' '.implode(' ', $embed_buttons).' '; |
|
| 283 | 283 | $html .= EEH_HTML::divx(); |
| 284 | 284 | return $html; |
| 285 | 285 | } |
@@ -14,50 +14,50 @@ |
||
| 14 | 14 | class EventListIframeEmbedButton extends IframeEmbedButton |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * EventListIframeEmbedButton constructor. |
|
| 19 | - */ |
|
| 20 | - public function __construct() |
|
| 21 | - { |
|
| 22 | - parent::__construct( |
|
| 23 | - esc_html__('Upcoming Event List', 'event_espresso'), |
|
| 24 | - 'event_list' |
|
| 25 | - ); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - |
|
| 29 | - public function addEmbedButton() |
|
| 30 | - { |
|
| 31 | - add_filter( |
|
| 32 | - 'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array', |
|
| 33 | - array($this, 'addEventListIframeEmbedButtonSection'), |
|
| 34 | - 20 |
|
| 35 | - ); |
|
| 36 | - add_action( |
|
| 37 | - 'admin_enqueue_scripts', |
|
| 38 | - array($this, 'embedButtonAssets'), |
|
| 39 | - 10 |
|
| 40 | - ); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Adds an iframe embed code button to the Event editor. |
|
| 46 | - * return string |
|
| 47 | - * |
|
| 48 | - * @param array $after_list_table |
|
| 49 | - * @return array |
|
| 50 | - */ |
|
| 51 | - public function addEventListIframeEmbedButtonSection(array $after_list_table) |
|
| 52 | - { |
|
| 53 | - return EEH_Array::insert_into_array( |
|
| 54 | - $after_list_table, |
|
| 55 | - [ |
|
| 56 | - 'iframe_embed_buttons' => $this->addIframeEmbedButtonsSection( |
|
| 57 | - ['event_list' => $this->embedButtonHtml()] |
|
| 58 | - ), |
|
| 59 | - ], |
|
| 60 | - 'legend' |
|
| 61 | - ); |
|
| 62 | - } |
|
| 17 | + /** |
|
| 18 | + * EventListIframeEmbedButton constructor. |
|
| 19 | + */ |
|
| 20 | + public function __construct() |
|
| 21 | + { |
|
| 22 | + parent::__construct( |
|
| 23 | + esc_html__('Upcoming Event List', 'event_espresso'), |
|
| 24 | + 'event_list' |
|
| 25 | + ); |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + |
|
| 29 | + public function addEmbedButton() |
|
| 30 | + { |
|
| 31 | + add_filter( |
|
| 32 | + 'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array', |
|
| 33 | + array($this, 'addEventListIframeEmbedButtonSection'), |
|
| 34 | + 20 |
|
| 35 | + ); |
|
| 36 | + add_action( |
|
| 37 | + 'admin_enqueue_scripts', |
|
| 38 | + array($this, 'embedButtonAssets'), |
|
| 39 | + 10 |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Adds an iframe embed code button to the Event editor. |
|
| 46 | + * return string |
|
| 47 | + * |
|
| 48 | + * @param array $after_list_table |
|
| 49 | + * @return array |
|
| 50 | + */ |
|
| 51 | + public function addEventListIframeEmbedButtonSection(array $after_list_table) |
|
| 52 | + { |
|
| 53 | + return EEH_Array::insert_into_array( |
|
| 54 | + $after_list_table, |
|
| 55 | + [ |
|
| 56 | + 'iframe_embed_buttons' => $this->addIframeEmbedButtonsSection( |
|
| 57 | + ['event_list' => $this->embedButtonHtml()] |
|
| 58 | + ), |
|
| 59 | + ], |
|
| 60 | + 'legend' |
|
| 61 | + ); |
|
| 62 | + } |
|
| 63 | 63 | } |