PluginProbe
WP Ultimate Post Grid / 2.4.0
WP Ultimate Post Grid v2.4.0
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
← All changes | helpers/assets.php +38 -4 1.62.4.0 View file →
@@ -33,9 +33,9 @@
33 33
34 34 public function default_public_assets()
35 35 {
36 36 if( !is_admin() ) {
37 - $base_layout = WPUltimatePostGrid::option( 'grid_template_force_style', '1' ) == '1' ? 'layout_base_forced.css' : 'layout_base.css';
37 + $base_layout = WPUltimatePostGrid::option( 'grid_template_force_style', '0' ) == '1' ? 'layout_base_forced.css' : 'layout_base.css';
38 38
39 39 $this->add(
40 40 array(
41 41 'file' => '/css/grid.css',
@@ -45,9 +45,9 @@
45 45 'file' => '/css/' . $base_layout,
46 46 'public' => true
47 47 ),
48 48 array(
49 - 'name' => 'isotope',
49 + 'name' => 'isotopewpupg',
50 50 'file' => '/vendor/isotope/isotope.pkgd.min.js',
51 51 'public' => true,
52 52 'deps' => array(
53 53 'jquery',
@@ -62,12 +62,13 @@
62 62 )
63 63 ),
64 64 array(
65 65 'file' => '/js/grid.js',
66 + 'name' => 'wpupg_grid',
66 67 'public' => true,
67 68 'deps' => array(
68 69 'jquery',
69 - 'isotope',
70 + 'isotopewpupg',
70 71 'imagesloaded',
71 72 ),
72 73 'data' => array(
73 74 'name' => 'wpupg_public',
@@ -72,9 +73,14 @@
72 73 'data' => array(
73 74 'name' => 'wpupg_public',
74 75 'ajax_url' => WPUltimatePostGrid::get()->helper('ajax')->url(),
75 76 'animationSpeed' => WPUltimatePostGrid::option( 'grid_animation_speed', '0.8' ) . 's',
77 + 'animationShow' => $this->animation_string_to_array( WPUltimatePostGrid::option( 'grid_animation_show', 'opacity: 1' ) ),
78 + 'animationHide' => $this->animation_string_to_array( WPUltimatePostGrid::option( 'grid_animation_hide', 'opacity: 0' ) ),
76 79 'nonce' => wp_create_nonce( 'wpupg_grid' ),
80 + 'rtl' => is_rtl(),
81 + 'dropdown_hide_search' => WPUltimatePostGrid::option( 'filters_dropdown_hide_search', '0' ) == '1' ? true : false,
82 + 'link_class' => WPUltimatePostGrid::option( 'grid_links_class', '' ),
77 83 ),
78 84 )
79 85 );
80 86 }
@@ -79,8 +85,21 @@
79 85 );
80 86 }
81 87 }
82 88
89 + private function animation_string_to_array( $string )
90 + {
91 + $array = array();
92 +
93 + $options = explode( ', ', $string );
94 + foreach( $options as $option ) {
95 + list( $k, $v ) = explode( ': ', $option );
96 + $array[$k] = $v;
97 + }
98 +
99 + return $array;
100 + }
101 +
83 102 public function default_admin_assets()
84 103 {
85 104 $this->add(
86 105 array(
@@ -89,9 +108,8 @@
89 108 ),
90 109 array(
91 110 'file' => '/css/admin_form.css',
92 111 'admin' => true,
93 - 'page' => 'grid_form',
94 112 ),
95 113 array(
96 114 'file' => 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css',
97 115 'direct' => true,
@@ -129,8 +147,20 @@
129 147 'jquery',
130 148 )
131 149 ),
132 150 array(
151 + 'file' => '/js/admin_post.js',
152 + 'admin' => true,
153 + 'deps' => array(
154 + 'jquery',
155 + ),
156 + 'data' => array(
157 + 'name' => 'wpupg_admin_post',
158 + 'text_add_grid_image' => __( 'Add Grid Image', 'wp-ultimate-post-grid' ),
159 + 'text_remove_grid_image' => __( 'Remove Grid Image', 'wp-ultimate-post-grid' ),
160 + ),
161 + ),
162 + array(
133 163 'file' => '/js/admin_form.js',
134 164 'admin' => true,
135 165 'page' => 'grid_form',
136 166 'deps' => array(
@@ -250,8 +280,12 @@
250 280 $js_to_enqueue[] = $asset;
251 281 break;
252 282 }
253 283 }
284 +
285 + // Hooks for assets
286 + $css_to_enqueue = apply_filters( 'wpupg_assets_css', $css_to_enqueue );
287 + $js_to_enqueue = apply_filters( 'wpupg_assets_js', $js_to_enqueue );
254 288
255 289 // We've got the assets we need, enqueue them
256 290 if( count( $css_to_enqueue ) > 0 ) $this->enqueue_css( $css_to_enqueue );
257 291 if( count( $js_to_enqueue ) > 0 ) $this->enqueue_js( $js_to_enqueue );