class-kirki-scripts-registry.php (1435B)
1 <?php 2 /** 3 * Instantiates all other needed scripts. 4 * 5 * @package Kirki 6 * @category Core 7 * @author Aristeides Stathopoulos 8 * @copyright Copyright (c) 2016, Aristeides Stathopoulos 9 * @license http://opensource.org/licenses/https://opensource.org/licenses/MIT 10 * @since 1.0 11 */ 12 13 // Exit if accessed directly. 14 if ( ! defined( 'ABSPATH' ) ) { 15 exit; 16 } 17 18 if ( ! class_exists( 'Kirki_Scripts_Registry' ) ) { 19 20 /** 21 * Instantiates dependent classes 22 */ 23 class Kirki_Scripts_Registry { 24 25 /** 26 * Dependencies 27 * 28 * @access public 29 * @var object Kirki_Enqueue. 30 */ 31 public $dependencies; 32 33 /** 34 * Tooltips 35 * 36 * @access public 37 * @var object Kirki_Scripts_Tooltips. 38 */ 39 public $tooltips; 40 41 /** 42 * Icons 43 * 44 * @access public 45 * @var object Kirki_Scripts_Icons. 46 */ 47 public $icons; 48 49 /** 50 * The main class constructor. 51 * Instantiates secondary classes. 52 */ 53 public function __construct() { 54 55 $this->dependencies = new Kirki_Enqueue(); 56 $this->tooltips = new Kirki_Scripts_Tooltips(); 57 $this->icons = new Kirki_Scripts_Icons(); 58 59 } 60 61 /** 62 * Prepares a script for echoing. 63 * Wraps it in <script> and jQuery. 64 * 65 * @param string $script The contents of the script. 66 * @return string 67 */ 68 public static function prepare( $script ) { 69 return '<script>jQuery(document).ready(function($) { "use strict"; ' . $script . '});</script>'; 70 } 71 } 72 }