Version Description
- Supported Transients API for cache (file cache is no longer in use)
- Improved to start rendering
- Fixed to use
get_locale()
instead ofWPLANG
Download this release
Release Info
Developer | makoto_kw |
Plugin | ![]() |
Version | 0.8 |
Comparing to | |
See all releases |
Version 0.8
- README.md +39 -0
- amazonjs-aws-params.php +668 -0
- amazonjs.php +987 -0
- components/js/jquery-tmpl/jquery.tmpl.min.js +10 -0
- css/amazonjs-force.css +128 -0
- css/amazonjs-options.css +6 -0
- css/amazonjs.css +128 -0
- css/media-upload-type-amazonjs.css +125 -0
- images/ajax-loader.gif +0 -0
- images/amazon-icon.png +0 -0
- images/amazonjs.png +0 -0
- images/noimage-large.jpg +0 -0
- images/noimage-medium.jpg +0 -0
- images/noimage-small.jpg +0 -0
- js/amazonjs.js +432 -0
- languages/amazonjs-ja.mo +0 -0
- languages/amazonjs-ja.po +657 -0
- languages/amazonjs.pot +619 -0
- lib/Services_JSON/JSON.php +806 -0
- lib/Services_JSON/LICENSE +21 -0
- lib/json.php +8 -0
- media-upload-type-amazonjs.php +405 -0
- readme.txt +202 -0
- screenshot-1.png +0 -0
README.md
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
AmazonJS (WordPress Plugin)
|
2 |
+
========
|
3 |
+
|
4 |
+
This repository is in progress and unstable version. Do not install except latest version dose not work.
|
5 |
+
|
6 |
+
You can install stable version from: [WordPress.org](http://wordpress.org/plugins/amazonjs/)
|
7 |
+
|
8 |
+
## Development
|
9 |
+
|
10 |
+
### Requirement
|
11 |
+
|
12 |
+
* Grunt
|
13 |
+
* Compass
|
14 |
+
|
15 |
+
### Build css
|
16 |
+
|
17 |
+
|
18 |
+
for debug
|
19 |
+
|
20 |
+
```
|
21 |
+
grunt debug
|
22 |
+
```
|
23 |
+
|
24 |
+
for production
|
25 |
+
|
26 |
+
```
|
27 |
+
grunt
|
28 |
+
```
|
29 |
+
|
30 |
+
|
31 |
+
### Translation
|
32 |
+
|
33 |
+
1. Execute ``grunt update-po``
|
34 |
+
1. Edit ``languages/amazonjs-*.po``
|
35 |
+
1. Execute ``grunt update-mo``
|
36 |
+
|
37 |
+
## Support
|
38 |
+
|
39 |
+
http://wordpress.org/support/plugin/amazonjs
|
amazonjs-aws-params.php
ADDED
@@ -0,0 +1,668 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
7 |
+
'All' => array(
|
8 |
+
'CA' => true,
|
9 |
+
'CN' => true,
|
10 |
+
'DE' => true,
|
11 |
+
'ES' => true,
|
12 |
+
'FR' => true,
|
13 |
+
'IT' => true,
|
14 |
+
'JP' => true,
|
15 |
+
'UK' => true,
|
16 |
+
'US' => true,
|
17 |
+
'label' => __( 'All', $amazonjs->text_domain ),
|
18 |
+
),
|
19 |
+
'Apparel' => array(
|
20 |
+
'CA' => false,
|
21 |
+
'CN' => true,
|
22 |
+
'DE' => true,
|
23 |
+
'ES' => false,
|
24 |
+
'FR' => true,
|
25 |
+
'IT' => false,
|
26 |
+
'JP' => true,
|
27 |
+
'UK' => true,
|
28 |
+
'US' => true,
|
29 |
+
'label' => __( 'Apparel', $amazonjs->text_domain ),
|
30 |
+
),
|
31 |
+
'Appliances' => array(
|
32 |
+
'CA' => false,
|
33 |
+
'CN' => true,
|
34 |
+
'DE' => false,
|
35 |
+
'ES' => false,
|
36 |
+
'FR' => false,
|
37 |
+
'IT' => false,
|
38 |
+
'JP' => true,
|
39 |
+
'UK' => false,
|
40 |
+
'US' => true,
|
41 |
+
'label' => __( 'Appliances', $amazonjs->text_domain ),
|
42 |
+
),
|
43 |
+
'ArtsAndCrafts' => array(
|
44 |
+
'CA' => false,
|
45 |
+
'CN' => false,
|
46 |
+
'DE' => false,
|
47 |
+
'ES' => false,
|
48 |
+
'FR' => false,
|
49 |
+
'IT' => false,
|
50 |
+
'JP' => false,
|
51 |
+
'UK' => false,
|
52 |
+
'US' => true,
|
53 |
+
'label' => __( 'ArtsAndCrafts', $amazonjs->text_domain ),
|
54 |
+
),
|
55 |
+
'Automotive' => array(
|
56 |
+
'CA' => false,
|
57 |
+
'CN' => true,
|
58 |
+
'DE' => true,
|
59 |
+
'ES' => false,
|
60 |
+
'FR' => false,
|
61 |
+
'IT' => false,
|
62 |
+
'JP' => true,
|
63 |
+
'UK' => true,
|
64 |
+
'US' => true,
|
65 |
+
'label' => __( 'Automotive', $amazonjs->text_domain ),
|
66 |
+
),
|
67 |
+
'Baby' => array(
|
68 |
+
'CA' => true,
|
69 |
+
'CN' => true,
|
70 |
+
'DE' => true,
|
71 |
+
'ES' => false,
|
72 |
+
'FR' => true,
|
73 |
+
'IT' => true,
|
74 |
+
'JP' => true,
|
75 |
+
'UK' => true,
|
76 |
+
'US' => true,
|
77 |
+
'label' => __( 'Baby', $amazonjs->text_domain ),
|
78 |
+
),
|
79 |
+
'Beauty' => array(
|
80 |
+
'CA' => false,
|
81 |
+
'CN' => true,
|
82 |
+
'DE' => true,
|
83 |
+
'ES' => false,
|
84 |
+
'FR' => true,
|
85 |
+
'IT' => false,
|
86 |
+
'JP' => true,
|
87 |
+
'UK' => true,
|
88 |
+
'US' => true,
|
89 |
+
'label' => __( 'Beauty', $amazonjs->text_domain ),
|
90 |
+
),
|
91 |
+
'Blended' => array(
|
92 |
+
'CA' => true,
|
93 |
+
'CN' => false,
|
94 |
+
'DE' => true,
|
95 |
+
'ES' => false,
|
96 |
+
'FR' => true,
|
97 |
+
'IT' => false,
|
98 |
+
'JP' => true,
|
99 |
+
'UK' => true,
|
100 |
+
'US' => true,
|
101 |
+
'label' => __( 'Blended', $amazonjs->text_domain ),
|
102 |
+
),
|
103 |
+
'Books' => array(
|
104 |
+
'CA' => true,
|
105 |
+
'CN' => true,
|
106 |
+
'DE' => true,
|
107 |
+
'ES' => true,
|
108 |
+
'FR' => true,
|
109 |
+
'IT' => true,
|
110 |
+
'JP' => true,
|
111 |
+
'UK' => true,
|
112 |
+
'US' => true,
|
113 |
+
'label' => __( 'Books', $amazonjs->text_domain ),
|
114 |
+
),
|
115 |
+
'Classical' => array(
|
116 |
+
'CA' => true,
|
117 |
+
'CN' => false,
|
118 |
+
'DE' => true,
|
119 |
+
'ES' => false,
|
120 |
+
'FR' => true,
|
121 |
+
'IT' => false,
|
122 |
+
'JP' => true,
|
123 |
+
'UK' => true,
|
124 |
+
'US' => true,
|
125 |
+
'label' => __( 'Classical', $amazonjs->text_domain ),
|
126 |
+
),
|
127 |
+
'DigitalMusic' => array(
|
128 |
+
'CA' => false,
|
129 |
+
'CN' => false,
|
130 |
+
'DE' => false,
|
131 |
+
'ES' => false,
|
132 |
+
'FR' => false,
|
133 |
+
'IT' => false,
|
134 |
+
'JP' => false,
|
135 |
+
'UK' => false,
|
136 |
+
'US' => true,
|
137 |
+
'label' => __( 'DigitalMusic', $amazonjs->text_domain ),
|
138 |
+
),
|
139 |
+
'DVD' => array(
|
140 |
+
'CA' => true,
|
141 |
+
'CN' => false,
|
142 |
+
'DE' => true,
|
143 |
+
'ES' => true,
|
144 |
+
'FR' => true,
|
145 |
+
'IT' => true,
|
146 |
+
'JP' => true,
|
147 |
+
'UK' => true,
|
148 |
+
'US' => true,
|
149 |
+
'label' => __( 'DVD', $amazonjs->text_domain ),
|
150 |
+
),
|
151 |
+
'Electronics' => array(
|
152 |
+
'CA' => true,
|
153 |
+
'CN' => true,
|
154 |
+
'DE' => true,
|
155 |
+
'ES' => true,
|
156 |
+
'FR' => true,
|
157 |
+
'IT' => true,
|
158 |
+
'JP' => true,
|
159 |
+
'UK' => true,
|
160 |
+
'US' => true,
|
161 |
+
'label' => __( 'Electronics', $amazonjs->text_domain ),
|
162 |
+
),
|
163 |
+
'ForeignBooks' => array(
|
164 |
+
'CA' => true,
|
165 |
+
'CN' => false,
|
166 |
+
'DE' => true,
|
167 |
+
'ES' => true,
|
168 |
+
'FR' => true,
|
169 |
+
'IT' => true,
|
170 |
+
'JP' => true,
|
171 |
+
'UK' => false,
|
172 |
+
'US' => false,
|
173 |
+
'label' => __( 'ForeignBooks', $amazonjs->text_domain ),
|
174 |
+
),
|
175 |
+
'Garden' => array(
|
176 |
+
'CA' => false,
|
177 |
+
'CN' => false,
|
178 |
+
'DE' => false,
|
179 |
+
'ES' => false,
|
180 |
+
'FR' => false,
|
181 |
+
'IT' => true,
|
182 |
+
'JP' => false,
|
183 |
+
'UK' => false,
|
184 |
+
'US' => false,
|
185 |
+
'label' => __( 'Garden', $amazonjs->text_domain ),
|
186 |
+
),
|
187 |
+
'GourmetFood' => array(
|
188 |
+
'CA' => false,
|
189 |
+
'CN' => false,
|
190 |
+
'DE' => false,
|
191 |
+
'ES' => false,
|
192 |
+
'FR' => false,
|
193 |
+
'IT' => false,
|
194 |
+
'JP' => false,
|
195 |
+
'UK' => false,
|
196 |
+
'US' => true,
|
197 |
+
'label' => __( 'GourmetFood', $amazonjs->text_domain ),
|
198 |
+
),
|
199 |
+
'Grocery' => array(
|
200 |
+
'CA' => false,
|
201 |
+
'CN' => true,
|
202 |
+
'DE' => true,
|
203 |
+
'ES' => false,
|
204 |
+
'FR' => false,
|
205 |
+
'IT' => false,
|
206 |
+
'JP' => true,
|
207 |
+
'UK' => true,
|
208 |
+
'US' => true,
|
209 |
+
'label' => __( 'Grocery', $amazonjs->text_domain ),
|
210 |
+
),
|
211 |
+
'HealthPersonalCare' => array(
|
212 |
+
'CA' => false,
|
213 |
+
'CN' => true,
|
214 |
+
'DE' => true,
|
215 |
+
'ES' => false,
|
216 |
+
'FR' => true,
|
217 |
+
'IT' => false,
|
218 |
+
'JP' => true,
|
219 |
+
'UK' => true,
|
220 |
+
'US' => true,
|
221 |
+
'label' => __( 'HealthPersonalCare', $amazonjs->text_domain ),
|
222 |
+
),
|
223 |
+
'Hobbies' => array(
|
224 |
+
'CA' => false,
|
225 |
+
'CN' => false,
|
226 |
+
'DE' => false,
|
227 |
+
'ES' => false,
|
228 |
+
'FR' => false,
|
229 |
+
'IT' => false,
|
230 |
+
'JP' => true,
|
231 |
+
'UK' => false,
|
232 |
+
'US' => false,
|
233 |
+
'label' => __( 'Hobbies', $amazonjs->text_domain ),
|
234 |
+
),
|
235 |
+
'Home' => array(
|
236 |
+
'CA' => false,
|
237 |
+
'CN' => true,
|
238 |
+
'DE' => false,
|
239 |
+
'ES' => false,
|
240 |
+
'FR' => false,
|
241 |
+
'IT' => false,
|
242 |
+
'JP' => false,
|
243 |
+
'UK' => false,
|
244 |
+
'US' => false,
|
245 |
+
'label' => __( 'Home', $amazonjs->text_domain ),
|
246 |
+
),
|
247 |
+
'HomeGarden' => array(
|
248 |
+
'CA' => false,
|
249 |
+
'CN' => false,
|
250 |
+
'DE' => true,
|
251 |
+
'ES' => false,
|
252 |
+
'FR' => false,
|
253 |
+
'IT' => false,
|
254 |
+
'JP' => false,
|
255 |
+
'UK' => true,
|
256 |
+
'US' => true,
|
257 |
+
'label' => __( 'HomeGarden', $amazonjs->text_domain ),
|
258 |
+
),
|
259 |
+
'HomeImprovement' => array(
|
260 |
+
'CA' => false,
|
261 |
+
'CN' => true,
|
262 |
+
'DE' => true,
|
263 |
+
'ES' => false,
|
264 |
+
'FR' => false,
|
265 |
+
'IT' => false,
|
266 |
+
'JP' => true,
|
267 |
+
'UK' => true,
|
268 |
+
'US' => false,
|
269 |
+
'label' => __( 'HomeImprovement', $amazonjs->text_domain ),
|
270 |
+
),
|
271 |
+
'Industrial' => array(
|
272 |
+
'CA' => false,
|
273 |
+
'CN' => false,
|
274 |
+
'DE' => false,
|
275 |
+
'ES' => false,
|
276 |
+
'FR' => false,
|
277 |
+
'IT' => false,
|
278 |
+
'JP' => false,
|
279 |
+
'UK' => false,
|
280 |
+
'US' => true,
|
281 |
+
'label' => __( 'Industrial', $amazonjs->text_domain ),
|
282 |
+
),
|
283 |
+
'Jewelry' => array(
|
284 |
+
'CA' => false,
|
285 |
+
'CN' => true,
|
286 |
+
'DE' => true,
|
287 |
+
'ES' => false,
|
288 |
+
'FR' => true,
|
289 |
+
'IT' => false,
|
290 |
+
'JP' => true,
|
291 |
+
'UK' => true,
|
292 |
+
'US' => true,
|
293 |
+
'label' => __( 'Jewelry', $amazonjs->text_domain ),
|
294 |
+
),
|
295 |
+
'KindleStore' => array(
|
296 |
+
'CA' => false,
|
297 |
+
'CN' => true,
|
298 |
+
'DE' => true,
|
299 |
+
'ES' => true,
|
300 |
+
'FR' => true,
|
301 |
+
'IT' => true,
|
302 |
+
'JP' => true, // fixed
|
303 |
+
'UK' => true,
|
304 |
+
'US' => true,
|
305 |
+
'label' => __( 'KindleStore', $amazonjs->text_domain ),
|
306 |
+
),
|
307 |
+
'Kitchen' => array(
|
308 |
+
'CA' => false,
|
309 |
+
'CN' => false,
|
310 |
+
'DE' => true,
|
311 |
+
'ES' => true,
|
312 |
+
'FR' => true,
|
313 |
+
'IT' => true,
|
314 |
+
'JP' => true,
|
315 |
+
'UK' => true,
|
316 |
+
'US' => true,
|
317 |
+
'label' => __( 'Kitchen', $amazonjs->text_domain ),
|
318 |
+
),
|
319 |
+
'LawnAndGarden' => array(
|
320 |
+
'CA' => false,
|
321 |
+
'CN' => false,
|
322 |
+
'DE' => false,
|
323 |
+
'ES' => false,
|
324 |
+
'FR' => false,
|
325 |
+
'IT' => false,
|
326 |
+
'JP' => false,
|
327 |
+
'UK' => false,
|
328 |
+
'US' => true,
|
329 |
+
'label' => __( 'LawnAndGarden', $amazonjs->text_domain ),
|
330 |
+
),
|
331 |
+
'Lighting' => array(
|
332 |
+
'CA' => false,
|
333 |
+
'CN' => false,
|
334 |
+
'DE' => true,
|
335 |
+
'ES' => false,
|
336 |
+
'FR' => true,
|
337 |
+
'IT' => true,
|
338 |
+
'JP' => false,
|
339 |
+
'UK' => true,
|
340 |
+
'US' => false,
|
341 |
+
'label' => __( 'Lighting', $amazonjs->text_domain ),
|
342 |
+
),
|
343 |
+
'Magazines' => array(
|
344 |
+
'CA' => false,
|
345 |
+
'CN' => false,
|
346 |
+
'DE' => true,
|
347 |
+
'ES' => false,
|
348 |
+
'FR' => false,
|
349 |
+
'IT' => false,
|
350 |
+
'JP' => false,
|
351 |
+
'UK' => false,
|
352 |
+
'US' => true,
|
353 |
+
'label' => __( 'Magazines', $amazonjs->text_domain ),
|
354 |
+
),
|
355 |
+
'Marketplace' => array(
|
356 |
+
'CA' => false,
|
357 |
+
'CN' => false,
|
358 |
+
'DE' => true,
|
359 |
+
'ES' => false,
|
360 |
+
'FR' => false,
|
361 |
+
'IT' => false,
|
362 |
+
'JP' => true,
|
363 |
+
'UK' => true,
|
364 |
+
'US' => true,
|
365 |
+
'label' => __( 'Marketplace', $amazonjs->text_domain ),
|
366 |
+
),
|
367 |
+
'Miscellaneous' => array(
|
368 |
+
'CA' => false,
|
369 |
+
'CN' => false,
|
370 |
+
'DE' => false,
|
371 |
+
'ES' => false,
|
372 |
+
'FR' => false,
|
373 |
+
'IT' => false,
|
374 |
+
'JP' => false,
|
375 |
+
'UK' => true,
|
376 |
+
'US' => false,
|
377 |
+
'label' => __( 'Miscellaneous', $amazonjs->text_domain ),
|
378 |
+
),
|
379 |
+
'MobileApps' => array(
|
380 |
+
'CA' => false,
|
381 |
+
'CN' => false,
|
382 |
+
'DE' => false,
|
383 |
+
'ES' => false,
|
384 |
+
'FR' => false,
|
385 |
+
'IT' => false,
|
386 |
+
'JP' => false,
|
387 |
+
'UK' => false,
|
388 |
+
'US' => true,
|
389 |
+
'label' => __( 'MobileApps', $amazonjs->text_domain ),
|
390 |
+
),
|
391 |
+
'MP3Downloads' => array(
|
392 |
+
'CA' => false,
|
393 |
+
'CN' => false,
|
394 |
+
'DE' => true,
|
395 |
+
'ES' => false,
|
396 |
+
'FR' => true,
|
397 |
+
'IT' => false,
|
398 |
+
'JP' => true,
|
399 |
+
'UK' => true,
|
400 |
+
'US' => true,
|
401 |
+
'label' => __( 'MP3Downloads', $amazonjs->text_domain ),
|
402 |
+
),
|
403 |
+
'Music' => array(
|
404 |
+
'CA' => true,
|
405 |
+
'CN' => true,
|
406 |
+
'DE' => true,
|
407 |
+
'ES' => true,
|
408 |
+
'FR' => true,
|
409 |
+
'IT' => true,
|
410 |
+
'JP' => true,
|
411 |
+
'UK' => true,
|
412 |
+
'US' => true,
|
413 |
+
'label' => __( 'Music', $amazonjs->text_domain ),
|
414 |
+
),
|
415 |
+
'MusicalInstruments' => array(
|
416 |
+
'CA' => false,
|
417 |
+
'CN' => false,
|
418 |
+
'DE' => true,
|
419 |
+
'ES' => false,
|
420 |
+
'FR' => true,
|
421 |
+
'IT' => false,
|
422 |
+
'JP' => true,
|
423 |
+
'UK' => true,
|
424 |
+
'US' => true,
|
425 |
+
'label' => __( 'MusicalInstruments', $amazonjs->text_domain ),
|
426 |
+
),
|
427 |
+
'MusicTracks' => array(
|
428 |
+
'CA' => false,
|
429 |
+
'CN' => false,
|
430 |
+
'DE' => true,
|
431 |
+
'ES' => false,
|
432 |
+
'FR' => true,
|
433 |
+
'IT' => false,
|
434 |
+
'JP' => true,
|
435 |
+
'UK' => true,
|
436 |
+
'US' => true,
|
437 |
+
'label' => __( 'MusicTracks', $amazonjs->text_domain ),
|
438 |
+
),
|
439 |
+
'OfficeProducts' => array(
|
440 |
+
'CA' => false,
|
441 |
+
'CN' => true,
|
442 |
+
'DE' => true,
|
443 |
+
'ES' => false,
|
444 |
+
'FR' => true,
|
445 |
+
'IT' => false,
|
446 |
+
'JP' => true,
|
447 |
+
'UK' => true,
|
448 |
+
'US' => true,
|
449 |
+
'label' => __( 'OfficeProducts', $amazonjs->text_domain ),
|
450 |
+
),
|
451 |
+
'OutdoorLiving' => array(
|
452 |
+
'CA' => false,
|
453 |
+
'CN' => false,
|
454 |
+
'DE' => true,
|
455 |
+
'ES' => false,
|
456 |
+
'FR' => false,
|
457 |
+
'IT' => false,
|
458 |
+
'JP' => false,
|
459 |
+
'UK' => true,
|
460 |
+
'US' => true,
|
461 |
+
'label' => __( 'OutdoorLiving', $amazonjs->text_domain ),
|
462 |
+
),
|
463 |
+
'Outlet' => array(
|
464 |
+
'CA' => false,
|
465 |
+
'CN' => false,
|
466 |
+
'DE' => true,
|
467 |
+
'ES' => false,
|
468 |
+
'FR' => false,
|
469 |
+
'IT' => false,
|
470 |
+
'JP' => false,
|
471 |
+
'UK' => true,
|
472 |
+
'US' => false,
|
473 |
+
'label' => __( 'Outlet', $amazonjs->text_domain ),
|
474 |
+
),
|
475 |
+
'PCHardware' => array(
|
476 |
+
'CA' => false,
|
477 |
+
'CN' => false,
|
478 |
+
'DE' => true,
|
479 |
+
'ES' => false,
|
480 |
+
'FR' => true,
|
481 |
+
'IT' => false,
|
482 |
+
'JP' => false,
|
483 |
+
'UK' => true,
|
484 |
+
'US' => true,
|
485 |
+
'label' => __( 'PCHardware', $amazonjs->text_domain ),
|
486 |
+
),
|
487 |
+
'PetSupplies' => array(
|
488 |
+
'CA' => false,
|
489 |
+
'CN' => false,
|
490 |
+
'DE' => false,
|
491 |
+
'ES' => false,
|
492 |
+
'FR' => false,
|
493 |
+
'IT' => false,
|
494 |
+
'JP' => false,
|
495 |
+
'UK' => false,
|
496 |
+
'US' => true,
|
497 |
+
'label' => __( 'PetSupplies', $amazonjs->text_domain ),
|
498 |
+
),
|
499 |
+
'Photo' => array(
|
500 |
+
'CA' => false,
|
501 |
+
'CN' => true,
|
502 |
+
'DE' => true,
|
503 |
+
'ES' => false,
|
504 |
+
'FR' => false,
|
505 |
+
'IT' => false,
|
506 |
+
'JP' => false,
|
507 |
+
'UK' => false,
|
508 |
+
'US' => true,
|
509 |
+
'label' => __( 'Photo', $amazonjs->text_domain ),
|
510 |
+
),
|
511 |
+
'Shoes' => array(
|
512 |
+
'CA' => false,
|
513 |
+
'CN' => true,
|
514 |
+
'DE' => true,
|
515 |
+
'ES' => false,
|
516 |
+
'FR' => true,
|
517 |
+
'IT' => true,
|
518 |
+
'JP' => true,
|
519 |
+
'UK' => true,
|
520 |
+
'US' => true,
|
521 |
+
'label' => __( 'Shoes', $amazonjs->text_domain ),
|
522 |
+
),
|
523 |
+
'Software' => array(
|
524 |
+
'CA' => true,
|
525 |
+
'CN' => true,
|
526 |
+
'DE' => true,
|
527 |
+
'ES' => true,
|
528 |
+
'FR' => true,
|
529 |
+
'IT' => true,
|
530 |
+
'JP' => true,
|
531 |
+
'UK' => true,
|
532 |
+
'US' => true,
|
533 |
+
'label' => __( 'Software', $amazonjs->text_domain ),
|
534 |
+
),
|
535 |
+
'SoftwareVideoGames' => array(
|
536 |
+
'CA' => true,
|
537 |
+
'CN' => false,
|
538 |
+
'DE' => true,
|
539 |
+
'ES' => false,
|
540 |
+
'FR' => true,
|
541 |
+
'IT' => false,
|
542 |
+
'JP' => false,
|
543 |
+
'UK' => true,
|
544 |
+
'US' => false,
|
545 |
+
'label' => __( 'SoftwareVideoGames', $amazonjs->text_domain ),
|
546 |
+
),
|
547 |
+
'SportingGoods' => array(
|
548 |
+
'CA' => false,
|
549 |
+
'CN' => true,
|
550 |
+
'DE' => true,
|
551 |
+
'ES' => false,
|
552 |
+
'FR' => true,
|
553 |
+
'IT' => false,
|
554 |
+
'JP' => true,
|
555 |
+
'UK' => true,
|
556 |
+
'US' => true,
|
557 |
+
'label' => __( 'SportingGoods', $amazonjs->text_domain ),
|
558 |
+
),
|
559 |
+
'Tools' => array(
|
560 |
+
'CA' => false,
|
561 |
+
'CN' => false,
|
562 |
+
'DE' => true,
|
563 |
+
'ES' => false,
|
564 |
+
'FR' => false,
|
565 |
+
'IT' => false,
|
566 |
+
'JP' => false,
|
567 |
+
'UK' => true,
|
568 |
+
'US' => true,
|
569 |
+
'label' => __( 'Tools', $amazonjs->text_domain ),
|
570 |
+
),
|
571 |
+
'Toys' => array(
|
572 |
+
'CA' => false,
|
573 |
+
'CN' => true,
|
574 |
+
'DE' => true,
|
575 |
+
'ES' => true,
|
576 |
+
'FR' => true,
|
577 |
+
'IT' => true,
|
578 |
+
'JP' => true,
|
579 |
+
'UK' => true,
|
580 |
+
'US' => true,
|
581 |
+
'label' => __( 'Toys', $amazonjs->text_domain ),
|
582 |
+
),
|
583 |
+
'UnboxVideo' => array(
|
584 |
+
'CA' => false,
|
585 |
+
'CN' => false,
|
586 |
+
'DE' => false,
|
587 |
+
'ES' => false,
|
588 |
+
'FR' => false,
|
589 |
+
'IT' => false,
|
590 |
+
'JP' => false,
|
591 |
+
'UK' => false,
|
592 |
+
'US' => true,
|
593 |
+
'label' => __( 'UnboxVideo', $amazonjs->text_domain ),
|
594 |
+
),
|
595 |
+
'VHS' => array(
|
596 |
+
'CA' => true,
|
597 |
+
'CN' => false,
|
598 |
+
'DE' => true,
|
599 |
+
'ES' => false,
|
600 |
+
'FR' => true,
|
601 |
+
'IT' => false,
|
602 |
+
'JP' => true,
|
603 |
+
'UK' => true,
|
604 |
+
'US' => true,
|
605 |
+
'label' => __( 'VHS', $amazonjs->text_domain ),
|
606 |
+
),
|
607 |
+
'Video' => array(
|
608 |
+
'CA' => true,
|
609 |
+
'CN' => true,
|
610 |
+
'DE' => true,
|
611 |
+
'ES' => false,
|
612 |
+
'FR' => true,
|
613 |
+
'IT' => false,
|
614 |
+
'JP' => true,
|
615 |
+
'UK' => true,
|
616 |
+
'US' => true,
|
617 |
+
'label' => __( 'Video', $amazonjs->text_domain ),
|
618 |
+
),
|
619 |
+
'VideoGames' => array(
|
620 |
+
'CA' => true,
|
621 |
+
'CN' => true,
|
622 |
+
'DE' => true,
|
623 |
+
'ES' => true,
|
624 |
+
'FR' => true,
|
625 |
+
'IT' => true,
|
626 |
+
'JP' => true,
|
627 |
+
'UK' => true,
|
628 |
+
'US' => true,
|
629 |
+
'label' => __( 'VideoGames', $amazonjs->text_domain ),
|
630 |
+
),
|
631 |
+
'Watches' => array(
|
632 |
+
'CA' => false,
|
633 |
+
'CN' => true,
|
634 |
+
'DE' => true,
|
635 |
+
'ES' => true,
|
636 |
+
'FR' => true,
|
637 |
+
'IT' => true,
|
638 |
+
'JP' => false,
|
639 |
+
'UK' => true,
|
640 |
+
'US' => true,
|
641 |
+
'label' => __( 'Watches', $amazonjs->text_domain ),
|
642 |
+
),
|
643 |
+
'Wireless' => array(
|
644 |
+
'CA' => false,
|
645 |
+
'CN' => false,
|
646 |
+
'DE' => false,
|
647 |
+
'ES' => false,
|
648 |
+
'FR' => false,
|
649 |
+
'IT' => false,
|
650 |
+
'JP' => false,
|
651 |
+
'UK' => false,
|
652 |
+
'US' => true,
|
653 |
+
'label' => __( 'Wireless', $amazonjs->text_domain ),
|
654 |
+
),
|
655 |
+
'WirelessAccessories' => array(
|
656 |
+
'CA' => false,
|
657 |
+
'CN' => false,
|
658 |
+
'DE' => false,
|
659 |
+
'ES' => false,
|
660 |
+
'FR' => false,
|
661 |
+
'IT' => false,
|
662 |
+
'JP' => false,
|
663 |
+
'UK' => false,
|
664 |
+
'US' => true,
|
665 |
+
'label' => __( 'WirelessAccessories', $amazonjs->text_domain ),
|
666 |
+
),
|
667 |
+
);
|
668 |
+
}
|
amazonjs.php
ADDED
@@ -0,0 +1,987 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: AmazonJS
|
4 |
+
Plugin URI: http://wordpress.org/extend/plugins/amazonjs/
|
5 |
+
Description: Easy to use interface to add an amazon product to your post and display it by using jQuery template.
|
6 |
+
Author: makoto_kw
|
7 |
+
Version: 0.8
|
8 |
+
Author URI: http://makotokw.com
|
9 |
+
Requires at least: 3.3
|
10 |
+
Tested up to: 4.5
|
11 |
+
License: GPLv2
|
12 |
+
Text Domain: amazonjs
|
13 |
+
Domain Path: /languages/
|
14 |
+
*/
|
15 |
+
/*
|
16 |
+
AmazonJS depends on
|
17 |
+
jQuery tmpl
|
18 |
+
PEAR Services_JSON: Michal Migurski <mike-json@teczno.com>
|
19 |
+
*/
|
20 |
+
|
21 |
+
// TODO: Fixed NoSilencedErrors.Discouraged
|
22 |
+
// @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged
|
23 |
+
|
24 |
+
require_once dirname( __FILE__ ) . '/lib/json.php';
|
25 |
+
|
26 |
+
class Amazonjs
|
27 |
+
{
|
28 |
+
const VERSION = '0.8';
|
29 |
+
const AWS_VERSION = '2011-08-01';
|
30 |
+
const CACHE_LIFETIME = 86400;
|
31 |
+
|
32 |
+
public $title;
|
33 |
+
public $url;
|
34 |
+
public $option_page_url;
|
35 |
+
public $plugin_rel_file;
|
36 |
+
public $option_page_name;
|
37 |
+
public $option_name;
|
38 |
+
public $setting_sections;
|
39 |
+
public $setting_fields;
|
40 |
+
public $default_settings;
|
41 |
+
public $settings;
|
42 |
+
public $text_domain;
|
43 |
+
|
44 |
+
public $media_type = 'amazonjs';
|
45 |
+
public $countries;
|
46 |
+
public $search_indexes;
|
47 |
+
public $display_items = array();
|
48 |
+
public $simple_template;
|
49 |
+
|
50 |
+
function __construct() {
|
51 |
+
$path = __FILE__;
|
52 |
+
$dir = dirname( $path );
|
53 |
+
$slug = basename( $dir );
|
54 |
+
$this->title = 'AmazonJS';
|
55 |
+
$this->plugin_rel_file = basename( $dir ) . DIRECTORY_SEPARATOR . basename( $path );
|
56 |
+
$this->option_page_name = basename( $dir );
|
57 |
+
$this->option_name = preg_replace( '/[\-\.]/', '_', $this->option_page_name ) . '_settings';
|
58 |
+
$this->url = plugins_url( '', $path );
|
59 |
+
$this->option_page_url = admin_url() . 'options-general.php?page=' . $this->option_page_name;
|
60 |
+
$this->text_domain = $slug;
|
61 |
+
load_plugin_textdomain( $this->text_domain, false, dirname( $this->plugin_rel_file ) . '/languages' );
|
62 |
+
|
63 |
+
$this->countries = array(
|
64 |
+
'US' => array(
|
65 |
+
'label' => __( 'United States', $this->text_domain ),
|
66 |
+
'domain' => 'Amazon.com',
|
67 |
+
'baseUri' => 'http://webservices.amazon.com',
|
68 |
+
'linkTemplate' => '<iframe src="http://rcm.amazon.com/e/cm?t=${t}&o=1&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}<1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
|
69 |
+
'associateTagSuffix' => '-20',
|
70 |
+
),
|
71 |
+
'UK' => array(
|
72 |
+
'label' => __( 'United Kingdom', $this->text_domain ),
|
73 |
+
'domain' => 'Amazon.co.uk',
|
74 |
+
'baseUri' => 'http://webservices.amazon.co.uk',
|
75 |
+
'linkTemplate' => '<iframe src="http://rcm-uk.amazon.co.uk/e/cm?t=${t}&o=2&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}<1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
|
76 |
+
'associateTagSuffix' => '-21',
|
77 |
+
),
|
78 |
+
'DE' => array(
|
79 |
+
'label' => __( 'Deutschland', $this->text_domain ),
|
80 |
+
'domain' => 'Amazon.de',
|
81 |
+
'baseUri' => 'http://webservices.amazon.de',
|
82 |
+
'linkTemplate' => '<iframe src="http://rcm-de.amazon.de/e/cm?t=${t}&o=3&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}<1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
|
83 |
+
'associateTagSuffix' => '04-21',
|
84 |
+
),
|
85 |
+
'FR' => array(
|
86 |
+
'label' => __( 'France', $this->text_domain ),
|
87 |
+
'domain' => 'Amazon.fr',
|
88 |
+
'baseUri' => 'http://webservices.amazon.fr',
|
89 |
+
'linkTemplate' => '<iframe src="http://rcm-fr.amazon.fr/e/cm?t=${t}&o=8&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}<1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
|
90 |
+
'associateTagSuffix' => '09-21',
|
91 |
+
),
|
92 |
+
'JP' => array(
|
93 |
+
'label' => __( 'Japan', $this->text_domain ),
|
94 |
+
'domain' => 'Amazon.co.jp',
|
95 |
+
'baseUri' => 'http://webservices.amazon.co.jp',
|
96 |
+
'linkTemplate' => '<iframe src="http://rcm-jp.amazon.co.jp/e/cm?t=${t}&o=9&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}<1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
|
97 |
+
'associateTagSuffix' => '-22',
|
98 |
+
),
|
99 |
+
'CA' => array(
|
100 |
+
'label' => __( 'Canada', $this->text_domain ),
|
101 |
+
'domain' => 'Amazon.ca',
|
102 |
+
'baseUri' => 'http://webservices.amazon.ca',
|
103 |
+
'linkTemplate' => '<iframe src="http://rcm-ca.amazon.ca/e/cm?t=${t}&o=15&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}<1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
|
104 |
+
'associateTagSuffix' => '0c-20',
|
105 |
+
),
|
106 |
+
'CN' => array(
|
107 |
+
'label' => __( 'China', $this->text_domain ),
|
108 |
+
'domain' => 'Amazon.cn',
|
109 |
+
'baseUri' => 'http://webservices.amazon.cn',
|
110 |
+
'linkTemplate' => '<iframe src="http://rcm-cn.amazon.cn/e/cm?t=${t}&o=28&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}<1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
|
111 |
+
'associateTagSuffix' => '-23',
|
112 |
+
),
|
113 |
+
'IT' => array(
|
114 |
+
'label' => __( 'Italia', $this->text_domain ),
|
115 |
+
'domain' => 'Amazon.it',
|
116 |
+
'baseUri' => 'http://webservices.amazon.it',
|
117 |
+
'linkTemplate' => '<iframe src="http://rcm-it.amazon.it/e/cm?t=${t}&o=29&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}<1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
|
118 |
+
'associateTagSuffix' => '-21',
|
119 |
+
),
|
120 |
+
'ES' => array(
|
121 |
+
'label' => __( 'España', $this->text_domain ),
|
122 |
+
'domain' => 'Amazon.es',
|
123 |
+
'baseUri' => 'http://webservices.amazon.es',
|
124 |
+
'linkTemplate' => '<iframe src="http://rcm-es.amazon.es/e/cm?t=${t}&o=30&p=8&l=as1&asins=${asins}&fc1=${fc1}&IS2=${IS2}<1=${lt1}&m=amazon&lc1=${lc1}&bc1=${bc1}&bg1=${bg1}&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>',
|
125 |
+
'associateTagSuffix' => '-21',
|
126 |
+
),
|
127 |
+
);
|
128 |
+
}
|
129 |
+
|
130 |
+
function clean() {
|
131 |
+
$this->delete_settings();
|
132 |
+
}
|
133 |
+
|
134 |
+
function init() {
|
135 |
+
$this->init_settings();
|
136 |
+
|
137 |
+
if ( is_admin() ) {
|
138 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
139 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
140 |
+
add_action( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
141 |
+
}
|
142 |
+
add_shortcode( 'amazonjs', array( $this, 'shortcode' ) );
|
143 |
+
if ( ! is_admin() ) {
|
144 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_styles' ) );
|
145 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
|
146 |
+
add_action( 'wp_footer', array( $this, 'wp_enqueue_scripts_for_footer' ), 1 );
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
function admin_init() {
|
151 |
+
add_action( 'media_buttons', array( $this, 'media_buttons' ), 20 );
|
152 |
+
add_action( 'media_upload_amazonjs', array( $this, 'media_upload_amazonjs' ) );
|
153 |
+
add_action( 'media_upload_amazonjs_keyword', array( $this, 'media_upload_amazonjs_keyword' ) );
|
154 |
+
add_action( 'media_upload_amazonjs_id', array( $this, 'media_upload_amazonjs_id' ) );
|
155 |
+
add_action( 'wp_ajax_amazonjs_search', array( $this, 'ajax_amazonjs_search' ) );
|
156 |
+
|
157 |
+
$page = $this->option_page_name;
|
158 |
+
register_setting( $this->option_name, $this->option_name, array( $this, 'validate_settings' ) );
|
159 |
+
if ( $this->setting_sections ) {
|
160 |
+
foreach ( $this->setting_sections as $key => $section ) {
|
161 |
+
add_settings_section( $page . '_' . $key, $section['label'], array( $this, $section['add'] ), $page );
|
162 |
+
}
|
163 |
+
}
|
164 |
+
foreach ( $this->setting_fields as $key => $field ) {
|
165 |
+
$label = ('checkbox' == $field['type']) ? '' : $field['label'];
|
166 |
+
add_settings_field(
|
167 |
+
$this->option_name . '_' . $key,
|
168 |
+
$label,
|
169 |
+
array( $this, 'add_settings_field' ),
|
170 |
+
$page,
|
171 |
+
$page . '_' . $field['section'],
|
172 |
+
array( $key, $field )
|
173 |
+
);
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
function admin_print_styles() {
|
178 |
+
global $wp_version;
|
179 |
+
// use dashicon
|
180 |
+
if ( version_compare( $wp_version, '3.8', '>=' ) ) {
|
181 |
+
wp_enqueue_style( 'amazonjs-options', $this->url . '/css/amazonjs-options.css', array(), self::VERSION );
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
function wp_enqueue_styles() {
|
186 |
+
if ( $this->settings['displayCustomerReview'] ) {
|
187 |
+
wp_enqueue_style( 'thickbox' );
|
188 |
+
}
|
189 |
+
|
190 |
+
if ( $this->settings['overrideThemeCss'] ) {
|
191 |
+
wp_enqueue_style( 'amazonjs', $this->url . '/css/amazonjs-force.css', array(), self::VERSION );
|
192 |
+
} else {
|
193 |
+
wp_enqueue_style( 'amazonjs', $this->url . '/css/amazonjs.css', array(), self::VERSION );
|
194 |
+
}
|
195 |
+
if ( $this->settings['customCss'] ) {
|
196 |
+
wp_enqueue_style( 'amazonjs-custom', get_stylesheet_directory_uri() . '/amazonjs.css' );
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
function wp_enqueue_scripts() {
|
201 |
+
wp_register_script( 'jquery-tmpl', $this->url . '/components/js/jquery-tmpl/jquery.tmpl.min.js', array( 'jquery' ), '1.0.0pre', true );
|
202 |
+
|
203 |
+
$depends = array( 'jquery-tmpl' );
|
204 |
+
if ( $this->settings['displayCustomerReview'] ) {
|
205 |
+
$depends[] = 'thickbox';
|
206 |
+
}
|
207 |
+
wp_register_script( 'amazonjs', $this->url . '/js/amazonjs.js', $depends, self::VERSION, true );
|
208 |
+
if ( $this->settings['customJs'] ) {
|
209 |
+
wp_register_script( 'amazonjs-custom', get_stylesheet_directory_uri() . '/amazonjs.js', array( 'amazonjs' ), self::VERSION, true );
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
function wp_enqueue_scripts_for_footer() {
|
214 |
+
$country_codes = array();
|
215 |
+
$items = array();
|
216 |
+
foreach ( $this->display_items as $country_code => $sub_items ) {
|
217 |
+
foreach ( $this->fetch_items( $country_code, $sub_items ) as $asin => $item ) {
|
218 |
+
$items[ $country_code . ':' . $asin ] = $item;
|
219 |
+
}
|
220 |
+
$country_codes[] = $country_code;
|
221 |
+
}
|
222 |
+
|
223 |
+
if ( count( $items ) == 0 ) {
|
224 |
+
return;
|
225 |
+
}
|
226 |
+
|
227 |
+
$this->enqueue_amazonjs_scripts( $items, $country_codes );
|
228 |
+
}
|
229 |
+
|
230 |
+
function enqueue_amazonjs_scripts( $items = array(), $country_codes = array() ) {
|
231 |
+
$wpurl = get_bloginfo( 'wpurl' );
|
232 |
+
|
233 |
+
$region = array();
|
234 |
+
foreach ( $this->countries as $code => $value ) {
|
235 |
+
if ( in_array( $code, $country_codes ) ) {
|
236 |
+
foreach ( array( 'linkTemplate' ) as $attr ) {
|
237 |
+
$region[ 'Link' . $code ] = $this->tmpl( $value[ $attr ], array( 't' => $this->settings[ 'associateTag' . $code ] ) );
|
238 |
+
}
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
$amazonVars = array(
|
243 |
+
'thickboxUrl' => $wpurl . '/wp-includes/js/thickbox/',
|
244 |
+
'regionTemplate' => $region,
|
245 |
+
'resource' => array(
|
246 |
+
'BookAuthor' => __( 'Author', $this->text_domain ),
|
247 |
+
'BookPublicationDate' => __( 'PublicationDate', $this->text_domain ),
|
248 |
+
'BookPublisher' => __( 'Publisher', $this->text_domain ),
|
249 |
+
'NumberOfPagesValue' => __( '${NumberOfPages} pages', $this->text_domain ),
|
250 |
+
'ListPrice' => __( 'List Price', $this->text_domain ),
|
251 |
+
'Price' => __( 'Price', $this->text_domain ),
|
252 |
+
'PriceUsage' => __( 'Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [amazon.com or endless.com, as applicable] at the time of purchase will apply to the purchase of this product.', $this->text_domain ),
|
253 |
+
'PublicationDate' => __( 'Publication Date', $this->text_domain ),
|
254 |
+
'ReleaseDate' => __( 'Release Date', $this->text_domain ),
|
255 |
+
'SalesRank' => __( 'SalesRank', $this->text_domain ),
|
256 |
+
'SalesRankValue' => __( '#${SalesRank}', $this->text_domain ),
|
257 |
+
'RunningTime' => __( 'Run Time', $this->text_domain ),
|
258 |
+
'RunningTimeValue' => __( '${RunningTime} minutes', $this->text_domain ),
|
259 |
+
'CustomerReviewTitle' => __( '${Title} Customer Review', $this->text_domain ),
|
260 |
+
'SeeCustomerReviews' => __( 'See Customer Reviews', $this->text_domain ),
|
261 |
+
'PriceUpdatedat' => __( '(at ${UpdatedDate})', $this->text_domain ),
|
262 |
+
),
|
263 |
+
'isCustomerReviewEnabled' => ($this->settings['displayCustomerReview']) ? true : false,
|
264 |
+
'isTrackEventEnabled' => ($this->settings['useTrackEvent']) ? true : false,
|
265 |
+
'isFadeInEnabled' => ($this->settings['useAnimation']) ? true : false,
|
266 |
+
'items' => array_values( $items ),
|
267 |
+
|
268 |
+
);
|
269 |
+
wp_localize_script( 'amazonjs', 'amazonjsVars', $amazonVars );
|
270 |
+
|
271 |
+
wp_enqueue_script( 'amazonjs' );
|
272 |
+
if ( $this->settings['customJs'] ) {
|
273 |
+
wp_enqueue_script( 'amazonjs-custom' );
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
function init_settings() {
|
278 |
+
// section
|
279 |
+
$this->setting_sections = array(
|
280 |
+
'api' => array(
|
281 |
+
'label' => __( 'Product Advertising API settings', $this->text_domain ),
|
282 |
+
'add' => 'add_api_setting_section',
|
283 |
+
),
|
284 |
+
'associate' => array(
|
285 |
+
'label' => __( 'Amazon Associates settings', $this->text_domain ),
|
286 |
+
'add' => 'add_associate_setting_section',
|
287 |
+
),
|
288 |
+
'appearance' => array(
|
289 |
+
'label' => __( 'Appearance settings', $this->text_domain ),
|
290 |
+
'add' => 'add_appearance_setting_section',
|
291 |
+
),
|
292 |
+
'analytics' => array(
|
293 |
+
'label' => __( 'Analytics settings', $this->text_domain ),
|
294 |
+
'add' => 'add_analytics_setting_section',
|
295 |
+
),
|
296 |
+
'customize' => array(
|
297 |
+
'label' => __( 'Customize', $this->text_domain ),
|
298 |
+
'add' => 'add_customize_setting_section',
|
299 |
+
),
|
300 |
+
);
|