PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 2.35
Strong Testimonials v2.35
3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / includes / scripts.php
strong-testimonials / includes Last commit date
integrations 7 years ago class-strong-form.php 7 years ago class-strong-log.php 7 years ago class-strong-mail.php 7 years ago class-strong-templates.php 7 years ago class-strong-testimonials-order.php 7 years ago class-strong-testimonials-privacy.php 7 years ago class-strong-testimonials-render.php 7 years ago class-strong-testimonials-shortcode-average.php 7 years ago class-strong-testimonials-shortcode-count.php 7 years ago class-strong-testimonials-shortcode.php 7 years ago class-strong-view-display.php 7 years ago class-strong-view-form.php 7 years ago class-strong-view-slideshow.php 7 years ago class-strong-view.php 7 years ago class-walker-strong-category-checklist-front.php 7 years ago deprecated.php 7 years ago filters.php 7 years ago functions-activation.php 7 years ago functions-content.php 7 years ago functions-image.php 7 years ago functions-rating.php 7 years ago functions-template-form.php 7 years ago functions-template.php 7 years ago functions-views.php 7 years ago functions.php 7 years ago l10n-polylang.php 7 years ago l10n-wpml.php 7 years ago post-types.php 7 years ago retro.php 7 years ago scripts.php 7 years ago widget2.php 7 years ago
scripts.php
263 lines
1 <?php
2 /**
3 * Register scripts and styles.
4 */
5
6 function wpmtst_scripts() {
7
8 $plugin_version = get_option( 'wpmtst_plugin_version' );
9 $options = get_option( 'wpmtst_options' );
10 $compat_options = get_option( 'wpmtst_compat_options' );
11
12 $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
13
14 /**
15 * Page controller
16 *
17 * @since 2.28.0
18 */
19 wp_register_script(
20 'wpmtst-controller',
21 WPMTST_PUBLIC_URL . "js/controller{$min}.js",
22 array( 'jquery' ),
23 $plugin_version,
24 true
25 );
26
27 /**
28 * Key : Description
29 * -----------------------------------------------------------------
30 * (blank) : No Pjax support
31 * universal : Universal (timer)
32 * observer : Target nodes added + timer
33 * event : Event emitter
34 * - Pjax by MoOx @link https://github.com/MoOx/pjax
35 * script : Specific script
36 * - Barba @link http://barbajs.org/index.html
37 *
38 * Remember: array top level is converted to strings!
39 */
40 $ajax = $compat_options['ajax'];
41 $controller = $compat_options['controller'];
42
43 //TODO Use defaults + array_merge instead
44 $parms = array(
45 'initializeOn' => isset( $controller['initialize_on'] ) ? $controller['initialize_on'] : '',
46 'method' => isset( $ajax['method'] ) ? $ajax['method'] : '',
47 'universalTimer' => isset( $ajax['universal_timer'] ) ? $ajax['universal_timer'] * 1000 : 0,
48 'observerTimer' => isset( $ajax['observer_timer'] ) ? $ajax['observer_timer'] * 1000 : 0,
49 'event' => isset( $ajax['event'] ) ? $ajax['event'] : '',
50 'script' => isset( $ajax['script'] ) ? $ajax['script'] : '',
51 'containerId' => isset( $ajax['container_id'] ) ? $ajax['container_id'] : '',
52 'addedNodeId' => isset( $ajax['addednode_id'] ) ? $ajax['addednode_id'] : '',
53 'debug' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && apply_filters( 'debug_strong_controller', true ),
54 );
55 wp_localize_script( 'wpmtst-controller', 'strongControllerParms', $parms );
56
57 /**
58 * Fonts
59 */
60 wp_register_style(
61 'wpmtst-font-awesome',
62 WPMTST_PUBLIC_URL . 'fonts/font-awesome-4.6.3/css/font-awesome.min.css',
63 array(),
64 '4.6.3'
65 );
66
67 /**
68 * Simple pagination
69 */
70 wp_register_script(
71 'wpmtst-pager',
72 WPMTST_PUBLIC_URL . "js/lib/strongpager/jquery.strongpager{$min}.js",
73 array( 'jquery', 'imagesloaded' ),
74 false,
75 true
76 );
77
78 /**
79 * imagesLoaded, if less than WordPress 4.6
80 */
81 if ( ! wp_script_is( 'imagesloaded', 'registered' ) ) {
82 wp_register_script(
83 'imagesloaded',
84 WPMTST_PUBLIC_URL . 'js/lib/imagesloaded/imagesloaded.pkgd.min.js',
85 array(),
86 '3.2.0',
87 true
88 );
89 }
90
91 /**
92 * Masonry
93 */
94 wp_register_style(
95 'wpmtst-masonry-style',
96 WPMTST_PUBLIC_URL . 'css/masonry.css',
97 array(),
98 $plugin_version
99 );
100
101 /**
102 * Columns
103 */
104 wp_register_style(
105 'wpmtst-columns-style',
106 WPMTST_PUBLIC_URL . 'css/columns.css',
107 array(),
108 $plugin_version
109 );
110
111 /**
112 * Grid
113 */
114 wp_register_style(
115 'wpmtst-grid-style',
116 WPMTST_PUBLIC_URL . 'css/grid.css',
117 array(),
118 $plugin_version
119 );
120
121 /**
122 * Ratings
123 */
124 $deps = array();
125 if ( isset( $options['load_font_awesome'] ) && $options['load_font_awesome'] ) {
126 $deps = array( 'wpmtst-font-awesome' );
127 }
128
129 wp_register_style(
130 'wpmtst-rating-form',
131 WPMTST_PUBLIC_URL . 'css/rating-form.css',
132 $deps,
133 $plugin_version
134 );
135
136 wp_register_style(
137 'wpmtst-rating-display',
138 WPMTST_PUBLIC_URL . 'css/rating-display.css',
139 $deps,
140 $plugin_version
141 );
142
143 /**
144 * Form handling
145 */
146 wp_register_script(
147 'wpmtst-validation-plugin',
148 WPMTST_PUBLIC_URL . "js/lib/validate/jquery.validate{$min}.js",
149 array( 'jquery' ),
150 '1.16.0',
151 true
152 );
153
154 wp_register_script(
155 'wpmtst-form-validation',
156 WPMTST_PUBLIC_URL . "js/lib/form-validation/form-validation{$min}.js",
157 array( 'wpmtst-validation-plugin', 'jquery-form' ),
158 $plugin_version,
159 true
160 );
161
162 /**
163 * Localize jQuery Validate plugin.
164 *
165 * @since 1.16.0
166 */
167 $locale = get_locale();
168 if ( 'en_US' != $locale ) {
169
170 $lang_parts = explode( '_', $locale );
171
172 $lang_files = array(
173 'messages_' . $locale . '.min.js',
174 'messages_' . $lang_parts[0] . '.min.js',
175 );
176
177 foreach ( $lang_files as $file ) {
178 $path = WPMTST_PUBLIC . 'js/lib/validate/localization/' . $file;
179 $url = WPMTST_PUBLIC_URL . 'js/lib/validate/localization/' . $file;
180 if ( file_exists( $path ) ) {
181 wp_register_script( 'wpmtst-validation-lang', $url, array( 'wpmtst-validation-plugin' ), false, true );
182 break;
183 }
184 }
185 }
186
187 /**
188 * Slider
189 */
190 wp_register_script(
191 'jquery-actual',
192 WPMTST_PUBLIC_URL . "js/lib/actual/jquery.actual{$min}.js",
193 array( 'jquery' ),
194 '1.0.16',
195 true
196 );
197
198 wp_register_script(
199 'verge',
200 WPMTST_PUBLIC_URL . "js/lib/verge/verge{$min}.js",
201 array(),
202 '1.10.2',
203 true
204 );
205
206 wp_register_script(
207 'wpmtst-slider',
208 WPMTST_PUBLIC_URL . "js/lib/strongslider/jquery.strongslider{$min}.js",
209 array( 'jquery-actual', 'imagesloaded', 'underscore', 'verge' ),
210 $plugin_version,
211 true
212 );
213
214 /**
215 * Read more in place
216 */
217 wp_register_script(
218 'wpmtst-readmore',
219 WPMTST_PUBLIC_URL . "js/lib/readmore/readmore{$min}.js",
220 array(),
221 $plugin_version,
222 true
223 );
224
225 wp_register_style(
226 'wpmtst-animate',
227 WPMTST_PUBLIC_URL . 'css/animate.min.css',
228 array(),
229 ''
230 );
231
232 }
233 add_action( 'wp_enqueue_scripts', 'wpmtst_scripts' );
234
235 /**
236 * @param $tag
237 * @param $handle
238 *
239 * @return mixed
240 */
241 function wpmtst_defer_scripts( $tag, $handle ) {
242 $scripts_to_defer = array(
243 // pagination
244 'wpmtst-pager',
245 // form
246 'wpmtst-validation-plugin',
247 'wpmtst-validation-lang',
248 'wpmtst-form-validation',
249 // slider
250 'jquery-actual',
251 'verge',
252 'wpmtst-slider',
253 'wpmtst-readmore',
254 );
255
256 if ( in_array( $handle, $scripts_to_defer ) ) {
257 return str_replace( ' src', ' defer src', $tag );
258 }
259
260 return $tag;
261 }
262 add_filter( 'script_loader_tag', 'wpmtst_defer_scripts', 10, 2 );
263