11<?php
22/**
3- * Settings API class .
3+ * Settings API.
44 *
5- * @package WebberZone\Better_Search\Admin\Settings
5+ * Functions to register, read, write and update settings.
6+ * Portions of this code have been inspired by Easy Digital Downloads, WordPress Settings Sandbox, WordPress Settings API class, etc.
7+ *
8+ * @package WebberZone\Better_Search
69 */
710
811namespace WebberZone \Better_Search \Admin \Settings ;
@@ -24,7 +27,7 @@ class Settings_API {
2427 *
2528 * @var string
2629 */
27- public const VERSION = '2.7.1 ' ;
30+ public const VERSION = '2.7.2 ' ;
2831
2932 /**
3033 * Settings Key.
@@ -542,14 +545,16 @@ public function admin_enqueue_scripts( $hook ) {
542545 );
543546
544547 if ( $ hook === $ this ->settings_page ) {
545- $ this ->enqueue_scripts_styles ( );
548+ self :: enqueue_scripts_styles ( $ this ->prefix );
546549 }
547550 }
548551
549552 /**
550553 * Enqueues all scripts, styles, settings, and templates necessary to use the Settings API.
554+ *
555+ * @param string $prefix Prefix which is used for creating the unique filters and actions.
551556 */
552- public function enqueue_scripts_styles () {
557+ public static function enqueue_scripts_styles ( $ prefix ) {
553558
554559 wp_enqueue_style ( 'wp-color-picker ' );
555560
@@ -569,28 +574,28 @@ public function enqueue_scripts_styles() {
569574 )
570575 );
571576
572- wp_enqueue_script ( 'wz- ' . $ this -> prefix . '-admin ' );
573- wp_enqueue_script ( 'wz- ' . $ this -> prefix . '-codemirror ' );
574- wp_enqueue_script ( 'wz- ' . $ this -> prefix . '-taxonomy-suggest ' );
575- wp_enqueue_script ( 'wz- ' . $ this -> prefix . '-media-selector ' );
577+ wp_enqueue_script ( 'wz- ' . $ prefix . '-admin ' );
578+ wp_enqueue_script ( 'wz- ' . $ prefix . '-codemirror ' );
579+ wp_enqueue_script ( 'wz- ' . $ prefix . '-taxonomy-suggest ' );
580+ wp_enqueue_script ( 'wz- ' . $ prefix . '-media-selector ' );
576581
577582 // Enqueue Tom Select.
578- wp_enqueue_style ( 'wz- ' . $ this -> prefix . '-tom-select ' );
579- wp_enqueue_script ( 'wz- ' . $ this -> prefix . '-tom-select ' );
583+ wp_enqueue_style ( 'wz- ' . $ prefix . '-tom-select ' );
584+ wp_enqueue_script ( 'wz- ' . $ prefix . '-tom-select ' );
580585
581586 // Localize Tom Select settings.
582587 wp_localize_script (
583- 'wz- ' . $ this -> prefix . '-tom-select-init ' ,
588+ 'wz- ' . $ prefix . '-tom-select-init ' ,
584589 'WZTomSelectSettings ' ,
585590 array (
586- 'action ' => $ this -> prefix . '_taxonomy_search_tom_select ' ,
587- 'nonce ' => wp_create_nonce ( $ this -> prefix . '_taxonomy_search_tom_select ' ),
591+ 'action ' => $ prefix . '_taxonomy_search_tom_select ' ,
592+ 'nonce ' => wp_create_nonce ( $ prefix . '_taxonomy_search_tom_select ' ),
588593 'endpoint ' => 'forms ' ,
589594 )
590595 );
591- wp_enqueue_script ( 'wz- ' . $ this -> prefix . '-tom-select-init ' );
596+ wp_enqueue_script ( 'wz- ' . $ prefix . '-tom-select-init ' );
592597
593- wp_enqueue_style ( 'wz- ' . $ this -> prefix . '-admin ' );
598+ wp_enqueue_style ( 'wz- ' . $ prefix . '-admin ' );
594599 }
595600
596601 /**
0 commit comments