| @@ -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', |
| @@ -66,9 +66,9 @@ | ||
| 66 | 66 | 'name' => 'wpupg_grid', |
| 67 | 67 | 'public' => true, |
| 68 | 68 | 'deps' => array( |
| 69 | 69 | 'jquery', |
| 70 | - 'isotope', | |
| 70 | + 'isotopewpupg', | |
| 71 | 71 | 'imagesloaded', |
| 72 | 72 | ), |
| 73 | 73 | 'data' => array( |
| 74 | 74 | 'name' => 'wpupg_public', |
| @@ -73,10 +73,14 @@ | ||
| 73 | 73 | 'data' => array( |
| 74 | 74 | 'name' => 'wpupg_public', |
| 75 | 75 | 'ajax_url' => WPUltimatePostGrid::get()->helper('ajax')->url(), |
| 76 | 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' ) ), | |
| 77 | 79 | 'nonce' => wp_create_nonce( 'wpupg_grid' ), |
| 78 | 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', '' ), | |
| 79 | 83 | ), |
| 80 | 84 | ) |
| 81 | 85 | ); |
| 82 | 86 | } |
| @@ -81,8 +85,21 @@ | ||
| 81 | 85 | ); |
| 82 | 86 | } |
| 83 | 87 | } |
| 84 | 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 | + | |
| 85 | 102 | public function default_admin_assets() |
| 86 | 103 | { |
| 87 | 104 | $this->add( |
| 88 | 105 | array( |
| @@ -130,8 +147,20 @@ | ||
| 130 | 147 | 'jquery', |
| 131 | 148 | ) |
| 132 | 149 | ), |
| 133 | 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( | |
| 134 | 163 | 'file' => '/js/admin_form.js', |
| 135 | 164 | 'admin' => true, |
| 136 | 165 | 'page' => 'grid_form', |
| 137 | 166 | 'deps' => array( |
| @@ -251,8 +280,12 @@ | ||
| 251 | 280 | $js_to_enqueue[] = $asset; |
| 252 | 281 | break; |
| 253 | 282 | } |
| 254 | 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 ); | |
| 255 | 288 | |
| 256 | 289 | // We've got the assets we need, enqueue them |
| 257 | 290 | if( count( $css_to_enqueue ) > 0 ) $this->enqueue_css( $css_to_enqueue ); |
| 258 | 291 | if( count( $js_to_enqueue ) > 0 ) $this->enqueue_js( $js_to_enqueue ); |