| @@ -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,11 +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(), |
| 79 | 81 | 'dropdown_hide_search' => WPUltimatePostGrid::option( 'filters_dropdown_hide_search', '0' ) == '1' ? true : false, |
| 82 | + 'link_class' => WPUltimatePostGrid::option( 'grid_links_class', '' ), | |
| 80 | 83 | ), |
| 81 | 84 | ) |
| 82 | 85 | ); |
| 83 | 86 | } |
| @@ -82,8 +85,21 @@ | ||
| 82 | 85 | ); |
| 83 | 86 | } |
| 84 | 87 | } |
| 85 | 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 | + | |
| 86 | 102 | public function default_admin_assets() |
| 87 | 103 | { |
| 88 | 104 | $this->add( |
| 89 | 105 | array( |
| @@ -136,8 +152,13 @@ | ||
| 136 | 152 | 'admin' => true, |
| 137 | 153 | 'deps' => array( |
| 138 | 154 | 'jquery', |
| 139 | 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 | + ), | |
| 140 | 161 | ), |
| 141 | 162 | array( |
| 142 | 163 | 'file' => '/js/admin_form.js', |
| 143 | 164 | 'admin' => true, |
| @@ -259,8 +280,12 @@ | ||
| 259 | 280 | $js_to_enqueue[] = $asset; |
| 260 | 281 | break; |
| 261 | 282 | } |
| 262 | 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 ); | |
| 263 | 288 | |
| 264 | 289 | // We've got the assets we need, enqueue them |
| 265 | 290 | if( count( $css_to_enqueue ) > 0 ) $this->enqueue_css( $css_to_enqueue ); |
| 266 | 291 | if( count( $js_to_enqueue ) > 0 ) $this->enqueue_js( $js_to_enqueue ); |