41 foreach ( $this->components() as $handle => $libs ) {
42 foreach ( $libs as $extension => $deps ) {
45 if (
'.js' == $extension ) {
46 $filename = sprintf(
'%s%s%s', WPDK_URI_JAVASCRIPT, $handle, $extension );
47 wp_register_script( $handle, $filename, $deps, WPDK_VERSION,
true );
51 elseif (
'.css' == $extension ) {
52 $filename = sprintf(
'%s%s%s', WPDK_URI_CSS, $handle, $extension );
53 wp_register_style( $handle, $filename, $deps, WPDK_VERSION );
68 private function components()
71 self::CONTROLS => array(
76 '.js' => array( self::CONTROLS, self::TRANSITION ),
77 '.css' => array( self::CONTROLS )
79 self::DYNAMIC_TABLE => array(
80 '.js' => array( self::CONTROLS, self::TOOLTIP ),
81 '.css' => array( self::CONTROLS, self::TOOLTIP )
83 self::TOOLTIP => array(
84 '.js' => array( self::TRANSITION ),
87 self::TRANSITION => array(
90 self::BUTTON => array(
91 '.js' => array( self::CONTROLS ),
92 '.css' => array( self::CONTROLS )
94 self::RIBBONIZE => array(
98 self::POPOVER => array(
99 '.js' => array( self::CONTROLS, self::TOOLTIP ),
100 '.css' => array( self::CONTROLS, self::TOOLTIP )
102 self::MODAL => array(
103 '.js' => array( self::CONTROLS, self::BUTTON, self::TRANSITION ),
104 '.css' => array( self::CONTROLS, self::BUTTON ) ),
105 self::PROGRESS => array(
109 self::PREFERENCES => array(
110 '.js' => array( self::CONTROLS ),
135 public static function enqueue( $component_handles )
138 $components = self::init()->components();
141 $handles = (array)$component_handles;
144 if( func_num_args() > 1 ) {
145 $handles = func_get_args();
149 foreach( $handles as $handle ) {
152 if ( in_array( $handle, array_keys( $components ) ) ) {
155 $component = $components[$handle];
158 if ( isset( $component[
'.js'] ) ) {
159 wp_enqueue_script( $handle );
163 if ( isset( $component[
'.css'] ) ) {
164 wp_enqueue_style( $handle );
179 static $instance = null;
180 if ( is_null( $instance ) ) {