PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.4.2
Shortcodes and extra features for Phlox theme v1.4.2
2.17.22 2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / admin / includes / admin-hooks.php
auxin-elements / admin / includes Last commit date
classes 9 years ago compatibility 9 years ago metaboxes 9 years ago modules 10 years ago admin-ajax.php 9 years ago admin-hooks.php 9 years ago admin-the-functions.php 9 years ago index.php 9 years ago
admin-hooks.php
583 lines
1 <?php
2
3
4
5
6 /*-----------------------------------------------------------------------------------*/
7 /* Add shortcode button to tinymce
8 /*-----------------------------------------------------------------------------------*/
9
10 function auxin_register_shortcode_button( $buttons ) {
11 array_push( $buttons, '|', 'phlox_shortcodes_button' );
12 return $buttons;
13 }
14
15 /**
16 * Add the shortcode button to TinyMCE
17 *
18 * @param array $plugin_array
19 * @return array
20 */
21 function auxin_add_elements_tinymce_plugin( $plugin_array ) {
22 $wp_version = get_bloginfo( 'version' );
23
24 $plugin_array['phlox_shortcodes_button'] = AUXELS_ADMIN_URL."/assets/js/tinymce/plugins/auxin-btns.js";
25
26 return $plugin_array;
27 }
28
29
30 function axion_init_shortcode_manager(){
31 if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
32 return;
33
34 add_filter( 'mce_external_plugins', 'auxin_add_elements_tinymce_plugin' );
35 add_filter( 'mce_buttons', 'auxin_register_shortcode_button' );
36 }
37 add_action("init", "axion_init_shortcode_manager");
38
39 /*-----------------------------------------------------------------------------------*/
40 /* Add Editor styles
41 /*-----------------------------------------------------------------------------------*/
42
43 function auxin_register_mce_buttons_style(){
44 wp_register_style('auxin_mce_buttons' , AUXELS_ADMIN_URL. '/assets/css/editor.css', NULL, '1.1');
45 wp_enqueue_style('auxin_mce_buttons');
46 }
47 add_action('admin_enqueue_scripts', 'auxin_register_mce_buttons_style');
48
49
50
51 /*-----------------------------------------------------------------------------------*/
52 /* Adds demos tab in theme about (welcome) page
53 /*-----------------------------------------------------------------------------------*/
54
55 function auxin_welcome_page_display_section_demos(){
56 // all the demos information should add into this array
57 $demos_list = auxin_get_demo_info_list();
58
59 if( ! empty( $demos_list ) ){
60 $wpnonce = wp_create_nonce( 'auxin-import' );
61 ?>
62 <h2 class="aux-featur"><?php _e('Choose the demo you want.', 'auxin-elements'); ?></h2>
63 <h4 class="aux-featur demos-subtitle"><?php _e('Please note that, it is recommended to import a demo on a clean WordPress installation.', 'auxin-elements'); ?></h4>
64 <div class="changelog feature-section three-col">
65 <?php
66 foreach( $demos_list as $demo_id => $demo_info ){
67 ?>
68 <div class="col" id="<?php echo esc_attr( $demo_info['id'] ); ?>">
69 <img class="demos-img" src="<?php echo esc_attr( $demo_info['thumb_url'] ); ?>" alt="<?php echo esc_attr( $demo_info['title'] ); ?>">
70 <h3><?php echo $demo_info['title']; ?></h3>
71 <p><?php echo $demo_info['desc' ]; ?></p>
72 <a href="<?php echo esc_url( $demo_info['preview_url'] ); ?>" class="button button-primary aux-button" target="_blank"><?php _e('Preview', 'auxin-elements'); ?></a>
73 <a href="<?php echo admin_url( 'import.php?import=auxin-importer&demo-id=' . $demo_id. '&_wpnonce=' . $wpnonce ); ?>" class="button button-primary aux-button import-demo">
74 <?php _e( 'Import Demo', 'auxin-elements' ); ?>
75 </a>
76 </div>
77 <?php
78 }
79 echo '</div>';
80 }
81 }
82
83 function auxin_welcome_add_section_demos( $sections ){
84
85 $sections['demos'] = array(
86 'label' => __( 'Demos', 'auxin-elements' ),
87 'description' => sprintf(__( 'you can see and import the %s demos in this section.', 'auxin-elements'), THEME_NAME_I18N ),
88 'callback' => 'auxin_welcome_page_display_section_demos'
89 );
90
91 return $sections;
92 }
93
94 add_filter( 'auxin_admin_welcome_sections', 'auxin_welcome_add_section_demos', 60 );
95
96 /*-----------------------------------------------------------------------------------*/
97 /* Adds system status tab in theme about (welcome) page
98 /*-----------------------------------------------------------------------------------*/
99
100 function auxin_about_system_status( $sections ){
101
102 $sections['status'] = array(
103 'label' => __( 'System Status', 'auxin-elements' ),
104 'description' => __( 'The informaition about your WordPress installation which can be helpful for debugging or monitoring your website.', 'auxin-elements'),
105 'callback' => 'auxin_get_about_system_status'
106 );
107
108 return $sections;
109 }
110
111 add_filter( 'auxin_admin_welcome_sections', 'auxin_about_system_status', 100 );
112
113
114 /*-----------------------------------------------------------------------------------*/
115 /* Adds feedback tab in theme about (welcome) page
116 /*-----------------------------------------------------------------------------------*/
117
118 function auxin_welcome_page_display_section_feedback(){
119 // the previous rate of the client
120 $previous_rate = auxin_get_option( 'user_rating' );
121 $support_tab_url = admin_url( 'themes.php?page=auxin-welcome&tab=support' );
122 ?>
123
124 <div class="changelog feature-section two-col feedback">
125
126 <form class="aux-feedback-form" action="<?php echo admin_url( 'admin.php?page=auxin-welcome&tab=feedback'); ?>" method="post" >
127
128 <div class="aux-rating-section">
129 <h2 class="aux-featur"><?php _e('How likely are you to recommend Phlox to a friend?', 'auxin-elements' ); ?></h2>
130 <div class="aux-theme-ratings">
131 <?php
132 for( $i = 1; $i <= 5; $i++ ){
133 printf(
134 '<div class="aux-rate-cell"><input type="radio" name="theme_rate" id="theme-rating%1$s" value="%1$s" %2$s/><label class="rating" for="theme-rating%1$s">%1$s</label></div>',
135 $i, checked( $previous_rate, $i, false )
136 );
137 }
138 ?>
139
140 </div>
141 <div class="aux-ratings-measure">
142 <p>Don't like it</p>
143 <p>Like it so much</p>
144 </div>
145 </div>
146
147 <div class="aux-feedback-section aux-hide">
148 <h2 class="aux-featur"><?php _e('Please explain why you gave this score (optional)', 'auxin-elements'); ?></h2>
149 <h4 class="aux-featur feedback-subtitle">
150 <?php
151 printf( __( 'Please do not use this form to get support, in this case please check the %s help section %s', 'auxin-elements' ),
152 '<a href="' . $support_tab_url . '">', '</a>' ); ?>
153 </h4>
154 <textarea placeholder="Enter your feedback here" rows="10" name="feedback" class="large-text"></textarea>
155 <input type="text" placeholder="Email address (Optional)" name="email" class="text-input" />
156 <?php wp_nonce_field( 'phlox_feedback' ); ?>
157
158 <input type="submit" class="button button-primary aux-button" value="Submit feedback" />
159
160 <div class="aux-sending-status">
161 <img class="ajax-progress aux-hide" src="<?php echo AUXIN_URL; ?>/css/images/elements/saving.gif" />
162 <span class="ajax-response aux-hide" ><?php _e( 'Submitting your feedback ..', 'auxin-elements' ); ?></span>
163 </div>
164
165 </div>
166
167 <?php auxin_send_feedback_mail(); ?>
168 </form>
169 </div>
170
171 <?php
172 }
173
174 function auxin_welcome_add_section_feedback( $sections ){
175
176 $sections['feedback'] = array(
177 'label' => __( 'Feedback', 'auxin-elements' ),
178 'description' => sprintf(__( 'Please leave a feedback and help us to improve %s theme.', 'auxin-elements'), THEME_NAME_I18N ),
179 'callback' => 'auxin_welcome_page_display_section_feedback'
180 );
181
182 return $sections;
183 }
184
185 add_filter( 'auxin_admin_welcome_sections', 'auxin_welcome_add_section_feedback', 90 );
186
187 function auxin_send_feedback_mail(){
188 if ( ! ( ! isset( $_POST['phlox_feedback'] ) || ! wp_verify_nonce( $_POST['phlox_feedback'], 'feedback_send') ) ) {
189
190 $email = ! empty( $_POST["email"] ) ? sanitize_email( $_POST["email"] ) : 'Empty';
191 $feedback = ! empty( $_POST["feedback"] ) ? esc_textarea( $_POST["feedback"] ) : '';
192
193 if( $feedback ){
194 wp_mail( 'info@averta.net', 'feedback from phlox dashboard', $feedback . chr(0x0D).chr(0x0A) . 'Email: ' . $email );
195 $text = __( 'Thanks for your feedback', 'auxin-elements' );
196 } else{
197 $text = __('Please try again and fill up at least the feedback field.', 'auxin-elements');
198 }
199
200 printf('<p class="notification">%s</p>', $text);
201 }
202 }
203
204 /*-----------------------------------------------------------------------------------*/
205 /* Adds subtitle meta field to 'Title setting' tab
206 /*-----------------------------------------------------------------------------------*/
207
208 function auxin_add_metabox_field_to_title_setting_tab( $fields, $id, $type ){
209
210 if( 'general-title' == $id ){
211 array_unshift(
212 $fields,
213 array(
214 'title' => __('Subtitle', 'auxin-elements'),
215 'description' => __('Second Title (optional). Note: You have to enable "Display Title Bar Section" option in order to display the subtitle.', 'auxin-elements'),
216 'id' => 'page_subtitle',
217 'type' => 'editor',
218 'default' => ''
219 )
220 );
221 }
222
223 return $fields;
224 }
225 add_filter( 'auxin_metabox_fields', 'auxin_add_metabox_field_to_title_setting_tab', 10, 3 );
226
227
228 /**
229 * Display changelogs on welcome page
230 *
231 * @param string $theme_id The theme ID that we intent to display the it's changelog
232 * @return void
233 */
234 function auxels_add_changelog_to_welcome_page( $theme_id ){
235
236
237 if( function_exists('auxin_get_remote_changelog') ){
238
239 // sanitize the theme id
240 $theme_id = esc_sql( $theme_id );
241
242 // get remote changelog
243 if( false === $changelog_info = get_transient( "auxin_{$theme_id}_remote_changelog" ) ){
244
245 $changelog = auxin_get_remote_changelog( $theme_id );
246
247 if( is_wp_error( $changelog ) ){
248 echo $changelog->get_error_message();
249 } else {
250 $changelog_info = json_decode( $changelog, true );
251 set_transient( "auxin_{$theme_id}_remote_changelog", $changelog_info, 2 * HOUR_IN_SECONDS );
252 }
253
254 }
255
256 // print the changelog
257 if( $changelog_info && ! empty( $changelog_info['version'] ) && ! empty( $changelog_info['changelog'] ) ){
258 echo '<a href="http://support.averta.net/en/changelog/'.$theme_id.'/" target="_blank"><h2 class="aux-featur">' . __( "What's New in version", 'auxin-elements') . ' '. $changelog_info['version'] . '</h2></a>';
259 echo '<div class="welcome-changelog">';
260 echo str_replace("\n", "<br />", $changelog_info['changelog'] );
261 echo '</div>';
262 }
263
264 }
265
266 }
267
268 add_action( 'auxin_welcome_page_after_feature_section', 'auxels_add_changelog_to_welcome_page' );
269
270 /*-----------------------------------------------------------------------------------*/
271 /* Adds Custom JavaScript meta field to 'Advanced setting' tab
272 /*-----------------------------------------------------------------------------------*/
273
274 function auxin_add_metabox_field_to_advanced_setting_tab( $fields, $id, $type ){
275
276 if( 'general-advanced' == $id ){
277 $fields[] = array(
278 'title' => __('Custom JavaScript Code', 'auxin-elements'),
279 'description' => __('Attention: The following custom JavaScript code will be applied ONLY to this page.', 'auxin-elements').'<br />'.
280 __('For defining global JavaScript roles, please use custom javaScript field on option panel.', 'auxin-elements' ),
281 'id' => 'aux_page_custom_js',
282 'type' => 'code',
283 'mode' => 'javascript',
284 'default' => ''
285 );
286 }
287 return $fields;
288 }
289 add_filter( 'auxin_metabox_fields', 'auxin_add_metabox_field_to_advanced_setting_tab', 10, 3 );
290
291
292
293 /*-----------------------------------------------------------------------------------*/
294 /* Define demo info list / for auxin-element plugin
295 /*-----------------------------------------------------------------------------------*/
296
297 /**
298 * Retrieves the list of available demos for current theme
299 *
300 * @return array List of demos
301 */
302 function auxels_add_to_demo_info_list( $default_demos ){
303
304 $demos_list = array(
305 'the-journey' => array(
306 'id' => 'the-journey',
307 'title' => __('The Journey', THEME_DOMAIN),
308 'desc' => __('Create your awesome Journey Website using this demo as a starter. Best choice for adventure looks.', THEME_DOMAIN),
309 'preview_url' => 'http://averta.net/phlox/demo/journey/',
310 'thumb_url' => AUXELS_URL . '/embeds/demos/journey-blog/banner.jpg',
311 'file' => AUXELS_DIR . '/embeds/demos/journey-blog/data.xml'
312 ),
313 'classic-blog' => array(
314 'id' => 'classic-blog',
315 'title' => __('Classic Blog', THEME_DOMAIN),
316 'desc' => __('Create your classic good looking Blog using this demo as a starter. Best choice for a classic blogger.', THEME_DOMAIN),
317 'preview_url' => 'http://averta.net/phlox/demo/classic-blog/',
318 'thumb_url' => AUXELS_URL . '/embeds/demos/classic-blog/banner.jpg',
319 'file' => AUXELS_DIR . '/embeds/demos/classic-blog/data.xml'
320 ),
321 'food-blog' => array(
322 'id' => 'food-blog',
323 'title' => __('Food Blog', THEME_DOMAIN),
324 'desc' => __('Create your awesome Food Website using this demo as a starter. Best choice for restaurant looks.', THEME_DOMAIN),
325 'preview_url' => 'http://averta.net/phlox/demo/food/',
326 'thumb_url' => AUXELS_URL . '/embeds/demos/food-blog/banner.jpg',
327 'file' => AUXELS_DIR . '/embeds/demos/food-blog/data.xml'
328 ),
329 'portfolio' => array(
330 'id' => 'portfolio',
331 'title' => __('Protfolio', THEME_DOMAIN),
332 'desc' => __('A stunning demo for Phlox portfolio that represents your projects in a modern and stylish way.', THEME_DOMAIN),
333 'preview_url' => 'http://averta.net/phlox/demo/portfolio/',
334 'thumb_url' => AUXELS_URL . '/embeds/demos/portfolio/banner.jpg',
335 'file' => AUXELS_DIR . '/embeds/demos/food-blog/data.xml'
336 ),
337 'default' => array(
338 'id' => 'default',
339 'title' => __('Default', THEME_DOMAIN),
340 'desc' => __('An excellent example to get familiar with all available layouts, elements, shortcodes and other features of Phlox.', THEME_DOMAIN),
341 'preview_url' => 'http://averta.net/phlox/demo/default/',
342 'thumb_url' => AUXELS_URL . '/embeds/demos/default/banner.jpg',
343 'file' => AUXELS_DIR . '/embeds/demos/default/data.xml'
344 )
345 );
346
347 return array_merge( $default_demos, $demos_list );
348 }
349
350 add_filter( 'auxin_get_demo_info_list', 'auxels_add_to_demo_info_list' );
351
352 /*-----------------------------------------------------------------------------------*/
353 /* Adding fallback for deprecated theme option name
354 /*-----------------------------------------------------------------------------------*/
355
356 function auxels_sync_deprecated_options(){
357
358 $old_theme_options = get_option( THEME_ID . '_formatted_options' );
359 if( false === $old_theme_options ){
360 return;
361 }
362
363 $new_theme_options = get_option( THEME_ID . '_theme_options' );
364 if( false === $new_theme_options ){
365 update_option( THEME_ID . '_theme_options', $old_theme_options );
366 }
367 }
368 add_action( 'admin_init', 'auxels_sync_deprecated_options' );
369
370 /*-----------------------------------------------------------------------------------*/
371 /* Add allowed custom mieme types
372 /*-----------------------------------------------------------------------------------*/
373
374 function auxin_mime_types( $mimes ) {
375 $mimes['svg'] = 'image/svg+xml';
376 return $mimes;
377 }
378
379 add_filter('upload_mimes', 'auxin_mime_types');
380
381
382 /*-----------------------------------------------------------------------------------*/
383 /* Add post format related metafields to post
384 /*-----------------------------------------------------------------------------------*/
385
386 function auxels_add_post_metabox_models( $models ){
387
388 // Load general metabox models
389 include_once( 'metaboxes/metabox-fields-post-audio.php' );
390 include_once( 'metaboxes/metabox-fields-post-gallery.php' );
391 include_once( 'metaboxes/metabox-fields-post-quote.php' );
392 include_once( 'metaboxes/metabox-fields-post-video.php' );
393
394 $models[] = array(
395 'model' => auxin_metabox_fields_post_gallery(),
396 'priority' => 20
397 );
398
399 $models[] = array(
400 'model' => auxin_metabox_fields_post_video(),
401 'priority' => 22
402 );
403
404 $models[] = array(
405 'model' => auxin_metabox_fields_post_audio(),
406 'priority' => 24
407 );
408
409 $models[] = array(
410 'model' => auxin_metabox_fields_post_quote(),
411 'priority' => 26
412 );
413
414 $models[] = array(
415 'model' => auxin_metabox_fields_general_advanced(),
416 'priority' => 36
417 );
418
419 return $models;
420 }
421
422 add_filter( 'auxin_admin_metabox_models_post', 'auxels_add_post_metabox_models' );
423
424 /*-----------------------------------------------------------------------------------*/
425 /* Add advanced metafields to page
426 /*-----------------------------------------------------------------------------------*/
427
428 function auxels_add_page_metabox_models( $models ){
429
430
431 $models[] = array(
432 'model' => auxin_metabox_fields_general_advanced(),
433 'priority' => 36
434 );
435
436 return $models;
437 }
438
439 add_filter( 'auxin_admin_metabox_models_page', 'auxels_add_page_metabox_models' );
440
441 /*-----------------------------------------------------------------------------------*/
442 /* Add theme tab in siteorigin page builder
443 /*-----------------------------------------------------------------------------------*/
444
445 function auxin_add_widget_tabs($tabs) {
446 $tabs[] = array(
447 'title' => THEME_NAME,
448 'filter' => array(
449 'groups' => array('auxin')
450 )
451 );
452
453 if (isset($tabs['recommended'])){
454 unset($tabs['recommended']);
455 }
456
457
458 return $tabs;
459 }
460 add_filter( 'siteorigin_panels_widget_dialog_tabs', 'auxin_add_widget_tabs', 20 );
461
462 // =============================================================================
463
464 function auxin_admin_footer_text( $footer_text ) {
465
466 // the admin pages that we intent to display theme footer text on
467 $admin_pages = array(
468 'toplevel_page_auxin',
469 'appearance_page_auxin',
470 'toplevel_page_auxin-welcome',
471 'appearance_page_auxin-welcome',
472 'page',
473 'post',
474 'widgets',
475 'dashboard',
476 'edit-post',
477 'edit-page',
478 'edit-portfolio'
479 );
480
481 if( ! ( function_exists('auxin_is_theme_admin_page') && auxin_is_theme_admin_page( $admin_pages ) ) ){
482 return $footer_text;
483 }
484
485 $welcome_tab_url = admin_url( 'themes.php?page=auxin-welcome&tab=' );
486
487 $auxin_text = sprintf(
488 __( 'Quick access to %sdashboard%s, %soptions%s, %ssupport%s and %sfeedback%s page.', 'auxin-elements' ),
489 '<a href="'. $welcome_tab_url .'features" title="Version ' . THEME_NAME_I18N . '" >' . THEME_NAME_I18N . ' ',
490 '</a>',
491 '<a href="'. admin_url( 'customize.php' ). '?url=' . $welcome_tab_url .'features" title="'. __('Theme Customizer', 'auxin-elements' ) .'" >',
492 '</a>',
493 '<a href="'. $welcome_tab_url .'support">',
494 '</a>',
495 '<a href="'. $welcome_tab_url .'feedback">',
496 '</a>'
497 );
498
499 return '<span id="footer-thankyou">' . $auxin_text . '</span>';
500 }
501 add_filter( 'admin_footer_text', 'auxin_admin_footer_text' );
502
503
504
505 /*-----------------------------------------------------------------------------------*/
506 /* Assign menus on start or after demo import
507 /*-----------------------------------------------------------------------------------*/
508
509 /**
510 * Automatically assigns the appropriate menus to menu locations
511 * Known Locations:
512 * - header-primary : There should be a menu with the word "Primary" Or "Mega" in its name
513 * - header-secondary: There should be a menu with the word "Secondary" in its name
514 * - footer : There should be a menu with the word "Footer" in its name
515 *
516 * @return bool True if at least one menu was assigned, false otherwise
517 */
518 function auxin_assign_default_menus(){
519
520 $assinged = false;
521 $locations = get_theme_mod('nav_menu_locations');
522 $nav_menus = wp_get_nav_menus();
523
524 foreach ( $nav_menus as $nav_menu ) {
525 $menu_name = strtolower( $nav_menu->name );
526
527 if( empty( $locations['header-secondary'] ) && preg_match( '(secondary)', $menu_name ) ){
528 $locations['header-secondary'] = $nav_menu->term_id;
529 $assinged = true;
530 } elseif( empty( $locations['header-primary'] ) && preg_match( '(primary|mega|header)', $menu_name ) ){
531 $locations['header-primary'] = $nav_menu->term_id;
532 $assinged = true;
533 } elseif( empty( $locations['footer'] ) && preg_match( '(footer)', $menu_name ) ){
534 $locations['footer'] = $nav_menu->term_id;
535 $assinged = true;
536 }
537 }
538
539 set_theme_mod( 'nav_menu_locations', $locations );
540 return $assinged;
541 }
542
543 add_action( 'after_switch_theme', 'auxin_assign_default_menus' ); // triggers when theme will be actived, WP 3.3
544 add_action( 'import_end', 'auxin_assign_default_menus' ); // triggers when the theme data was imported
545
546 /*-----------------------------------------------------------------------------------*/
547 /* Remove any script tag fromt custom js (if user used them in the script content)
548 /*-----------------------------------------------------------------------------------*/
549
550 /**
551 * Strip <script> tags
552 *
553 * @param string $js_string The custom js string
554 * @return string The sanitized custom js code
555 */
556 function auxels_strip_script_tags_from_custom_js( $js_string ){
557 if ( false !== stripos( $js_string, '</script>' ) ) {
558 $js_string = str_replace( array( "<script>", "</script>" ), array('', ''), $js_string );
559 }
560 return $js_string;
561 }
562 add_filter( 'auxin_custom_js_string', 'auxels_strip_script_tags_from_custom_js' );
563
564 /*-----------------------------------------------------------------------------------*/
565 /* Remove any style tag fromt custom css (if user used them in the style content)
566 /*-----------------------------------------------------------------------------------*/
567
568 /**
569 * Strip <style> tags
570 *
571 * @param string $css_string The custom css string
572 * @return string The sanitized custom css code
573 */
574 function auxels_strip_style_tags_from_custom_css( $css_string ){
575 if ( false !== stripos( $css_string, '</style>' ) ) {
576 $css_string = str_replace( array( "<style>", "</style>" ), array('', ''), $css_string );
577 }
578 return $css_string;
579 }
580 add_filter( 'auxin_custom_css_string', 'auxels_strip_style_tags_from_custom_css' );
581
582 /*-----------------------------------------------------------------------------------*/
583