Version Description
- Added more slider themes.
- Added responsive option.
- Added more transition effects.
- Major code refactor.
Download this release
Release Info
Developer | codeinwp |
Plugin | Slider by Nivo – Responsive WordPress Image Slider |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.6 to 2.0.0
- CHANGELOG.md +42 -20
- README.md +3 -0
- assets/css/admin.css +158 -11
- assets/css/nivo-slider.css +80 -61
- assets/images/nivo.png +0 -0
- assets/js/admin.js +22 -26
- assets/js/core-admin.js +316 -0
- assets/js/image-admin.js +361 -0
- assets/js/tinymce.js +31 -32
- assets/themes/bar/bar.css +89 -69
- assets/themes/dark/dark.css +52 -42
- assets/themes/default/default.css +49 -39
- assets/themes/light/light.css +52 -42
- includes/abstract/class-nivo-core-abstract.php +300 -0
- includes/abstract/class-nivo-core-settings-abstract.php +53 -0
- includes/abstract/class-nivo-model-abstract.php +177 -0
- includes/admin/class-nivo-slider-admin.php +662 -0
- includes/admin/libs/class-nivo-core-admin-ajax.php +193 -0
- includes/admin/libs/class-nivo-core-admin-edit.php +827 -0
- includes/{core/includes/admin-images.php → admin/libs/class-nivo-core-admin-images.php} +74 -84
- includes/{core/includes/images.php → admin/libs/class-nivo-core-images.php} +235 -290
- includes/admin/libs/class-nivo-core-model.php +76 -0
- includes/admin/libs/class-nivo-core-shortcode.php +508 -0
- includes/admin/libs/class-nivo-plugin-settings.php +101 -0
- includes/admin/libs/class-nivo-slider-widget.php +128 -0
- includes/class-nivo-slider-activator.php +36 -0
- includes/class-nivo-slider-deactivator.php +36 -0
- includes/class-nivo-slider-i18n.php +47 -0
- includes/class-nivo-slider-loader.php +129 -0
- includes/class-nivo-slider.php +252 -0
- includes/core/README.md +0 -11
- includes/core/assets/css/admin.css +0 -55
- includes/core/assets/js/admin.js +0 -303
- includes/core/assets/js/image-admin.js +0 -359
- includes/core/includes/admin-ajax.php +0 -291
- includes/core/includes/admin-edit.php +0 -513
- includes/core/includes/admin-settings.php +0 -382
- includes/core/includes/admin-view.php +0 -138
- includes/core/includes/assets.php +0 -147
- includes/core/includes/core.php +0 -64
- includes/core/includes/edd_sl_plugin_updater.php +0 -339
- includes/core/includes/functions.php +0 -201
- includes/core/includes/post-type.php +0 -169
- includes/core/includes/shortcode.php +0 -302
- includes/core/plugin.php +0 -174
- includes/interface/class-nivo-library-interface.php +28 -0
- includes/interface/class-nivo-settings-interface.php +27 -0
- includes/plugin.php +0 -830
- install.txt +9 -0
- languages/nivo-slider.pot +607 -0
- nivo-slider-lite.php +110 -54
- readme.txt +28 -7
- vendor/autoload.php +7 -0
- vendor/autoload_52.php +7 -0
- vendor/codeinwp/themeisle-sdk/LICENSE +674 -0
- vendor/codeinwp/themeisle-sdk/README.md +2 -0
- vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php +660 -0
- vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php +86 -0
- vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php +80 -0
- vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php +265 -0
- vendor/codeinwp/themeisle-sdk/composer.json +27 -0
- vendor/codeinwp/themeisle-sdk/index.php +5 -0
- vendor/codeinwp/themeisle-sdk/phpcs.xml +34 -0
- vendor/composer/ClassLoader.php +413 -0
- vendor/composer/ClassLoader52.php +271 -0
- vendor/composer/LICENSE +21 -0
- vendor/composer/autoload_classmap.php +13 -0
- vendor/composer/autoload_namespaces.php +10 -0
- vendor/composer/autoload_psr4.php +9 -0
- vendor/composer/autoload_real.php +45 -0
- vendor/composer/autoload_real_52.php +44 -0
- vendor/composer/installed.json +81 -0
- vendor/xrstf/composer-php52/LICENSE +19 -0
- vendor/xrstf/composer-php52/README.md +37 -0
- vendor/xrstf/composer-php52/composer.json +26 -0
- vendor/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php +346 -0
- vendor/xrstf/composer-php52/lib/xrstf/Composer52/ClassLoader.php +271 -0
- vendor/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php +39 -0
CHANGELOG.md
CHANGED
@@ -1,17 +1,43 @@
|
|
1 |
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
+
### v2.0.0 - 2017-05-02
|
3 |
+
**Changes:**
|
4 |
+
### v2.0.1 - 2017-05-02
|
5 |
+
|
6 |
+
**Changes:**
|
7 |
+
|
8 |
+
- Fixed an issue with style loading for other post types.
|
9 |
+
|
10 |
+
### v2.0.0 - 2017-04-28
|
11 |
+
|
12 |
+
**Changes:**
|
13 |
+
|
14 |
+
- Added more slider themes.
|
15 |
+
- Added responsive option.
|
16 |
+
- Added more transition effects.
|
17 |
+
- Major code refactor.
|
18 |
+
|
19 |
+
### 3.0.0 - 17/02/2017
|
20 |
+
|
21 |
+
**Changes:**
|
22 |
+
|
23 |
+
- Refactored code base
|
24 |
+
|
25 |
+
### 2.5.1 - 12/12/2016
|
26 |
+
|
27 |
+
**Changes:**
|
28 |
+
|
29 |
+
- added backward compat for license
|
30 |
+
|
31 |
+
|
32 |
+
### 2.5.0 - 21/11/2016
|
33 |
+
|
34 |
+
**Changes:**
|
35 |
+
|
36 |
+
- Added plugin to themeisle system
|
37 |
+
|
38 |
+
|
39 |
+
### 2.5.0 - 21/11/2016
|
40 |
+
|
41 |
+
**Changes:**
|
42 |
+
|
43 |
+
- Added plugin into themeisle system
|
README.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
# Nivo Slider
|
2 |
+
|
3 |
+
Started new branch `refactor`
|
assets/css/admin.css
CHANGED
@@ -1,18 +1,165 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
display: block;
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
font-weight: bold;
|
13 |
}
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
margin:
|
|
|
18 |
}
|
1 |
+
#edit-slug-box,
|
2 |
+
#postimagediv,
|
3 |
+
#minor-publishing,
|
4 |
+
.nivo_type,
|
5 |
+
.manual.description {
|
6 |
+
display: none;
|
7 |
+
}
|
8 |
+
|
9 |
+
.useful-links a {
|
10 |
+
float: right;
|
11 |
+
}
|
12 |
|
13 |
+
.nivo-plugin-images li {
|
14 |
+
display: inline-block;
|
15 |
+
position: relative;
|
16 |
+
margin: 0;
|
17 |
+
}
|
18 |
+
|
19 |
+
.nivo-plugin-images li .spinner {
|
20 |
display: block;
|
21 |
+
float: left;
|
22 |
+
}
|
23 |
+
|
24 |
+
.nivo-plugin-images li img {
|
25 |
+
max-width: 300px;
|
26 |
+
margin: 0 10px 10px 0;
|
27 |
+
padding: 3px;
|
28 |
+
border: 1px solid #dfdfdf;
|
29 |
+
background: none repeat scroll 0 0 #fff;
|
30 |
+
}
|
31 |
+
|
32 |
+
.nivo_plugin-thumbs {
|
33 |
+
margin: 0;
|
34 |
+
padding: 3px 0 0;
|
35 |
+
list-style: none outside none;
|
36 |
}
|
37 |
+
|
38 |
+
.nivo_plugin-thumbs li {
|
39 |
+
display: inline-block;
|
40 |
+
position: relative;
|
41 |
+
margin: 0;
|
42 |
+
}
|
43 |
+
|
44 |
+
.nivo_plugin-thumbs li img {
|
45 |
+
margin: 0 10px 5px 0;
|
46 |
+
padding: 2px;
|
47 |
+
border: 1px solid #dfdfdf;
|
48 |
+
background: none repeat scroll 0 0 #fff;
|
49 |
+
}
|
50 |
+
|
51 |
+
#nivo_license .spinner,
|
52 |
+
#nivo_license #deactivate-license,
|
53 |
+
#nivo_license #activate-license,
|
54 |
+
.reattach-spinner {
|
55 |
+
float: left;
|
56 |
+
}
|
57 |
+
|
58 |
+
.nivo-upsell-box {
|
59 |
+
text-align: center;
|
60 |
+
}
|
61 |
+
.nivo-upsell-box h3{
|
62 |
+
text-align: left;
|
63 |
+
}
|
64 |
+
.nivo-upsell-box ul{
|
65 |
+
text-align: left;
|
66 |
+
list-style-type: disc;
|
67 |
+
padding-left: 10px;
|
68 |
+
}
|
69 |
+
.nivo-upsell-box{
|
70 |
+
padding-left:20px;
|
71 |
+
}
|
72 |
+
|
73 |
+
/* The switch - the box around the slider */
|
74 |
+
.nivo-switch {
|
75 |
+
margin-left: 20px;
|
76 |
+
display: inline-block;
|
77 |
+
position: relative;
|
78 |
+
width: 30px;
|
79 |
+
height: 18px;
|
80 |
+
}
|
81 |
+
|
82 |
+
/* Hide default HTML checkbox */
|
83 |
+
.nivo-switch input {
|
84 |
+
display: none;
|
85 |
+
}
|
86 |
+
|
87 |
+
/* The slider */
|
88 |
+
.nivo-tracking sup {
|
89 |
+
vertical-align: 3px;
|
90 |
+
}
|
91 |
+
|
92 |
+
.nivo-slider {
|
93 |
+
position: absolute;
|
94 |
+
top: 0;
|
95 |
+
right: 0;
|
96 |
+
bottom: 0;
|
97 |
+
left: 0;
|
98 |
+
background-color: #ccc;
|
99 |
+
cursor: pointer;
|
100 |
+
-webkit-transition: 0.4s;
|
101 |
+
transition: 0.4s;
|
102 |
+
}
|
103 |
+
|
104 |
+
.nivo-slider:before {
|
105 |
+
position: absolute;
|
106 |
+
bottom: 1.5px;
|
107 |
+
left: 2px;
|
108 |
+
width: 15px;
|
109 |
+
height: 15px;
|
110 |
+
background-color: white;
|
111 |
+
content: "";
|
112 |
+
-webkit-transition: 0.4s;
|
113 |
+
transition: 0.4s;
|
114 |
+
}
|
115 |
+
|
116 |
+
input:checked + .nivo-slider {
|
117 |
+
background-color: #0085ba;
|
118 |
+
}
|
119 |
+
|
120 |
+
input:focus + .nivo-slider {
|
121 |
+
-webkit-box-shadow: 0 0 1px #0085ba;
|
122 |
+
box-shadow: 0 0 1px #0085ba;
|
123 |
+
}
|
124 |
+
|
125 |
+
input:checked + .nivo-slider:before {
|
126 |
+
-webkit-transform: translateX(11px);
|
127 |
+
-ms-transform: translateX(11px);
|
128 |
+
transform: translateX(11px);
|
129 |
+
}
|
130 |
+
|
131 |
+
/* Rounded sliders */
|
132 |
+
.nivo-slider.visualizer-round {
|
133 |
+
border-radius: 34px;
|
134 |
+
}
|
135 |
+
|
136 |
+
.nivo-slider.visualizer-round:before {
|
137 |
+
border-radius: 50%;
|
138 |
+
}
|
139 |
+
|
140 |
+
.nivo-tracking p small sup {
|
141 |
+
margin-left: -3px;
|
142 |
+
}
|
143 |
+
|
144 |
+
.nivo-tracking p {
|
145 |
+
padding-left: 14px;
|
146 |
+
color: #23282d;
|
147 |
+
font-size: 12px;
|
148 |
+
line-height: 12px;
|
149 |
+
text-align: left;
|
150 |
+
}
|
151 |
+
|
152 |
+
.nivo-tracking span {
|
153 |
+
margin-left: 10px;
|
154 |
+
color: #23282d;
|
155 |
+
background: none;
|
156 |
+
font-size: 14px;
|
157 |
font-weight: bold;
|
158 |
}
|
159 |
+
.nivo-plugin-thumbs li{
|
160 |
|
161 |
+
display: inline-block;
|
162 |
+
float: left;
|
163 |
+
margin-left: 3px;
|
164 |
+
border: 1px #ccc solid;
|
165 |
}
|
assets/css/nivo-slider.css
CHANGED
@@ -1,115 +1,134 @@
|
|
1 |
/*
|
2 |
* jQuery Nivo Slider v3.2
|
3 |
* http://nivo.dev7studios.com
|
4 |
-
*
|
5 |
* Copyright 2012, Dev7studios
|
6 |
* Free to use and abuse under the MIT license.
|
7 |
* http://www.opensource.org/licenses/mit-license.php
|
8 |
*/
|
9 |
-
|
10 |
/* The Nivo Slider styles */
|
11 |
.nivoSlider {
|
12 |
-
position:relative;
|
13 |
-
width:100%;
|
14 |
-
height:auto;
|
15 |
overflow: hidden;
|
|
|
|
|
|
|
16 |
}
|
|
|
17 |
.nivoSlider img {
|
18 |
-
position:absolute;
|
19 |
-
top:0px;
|
20 |
-
left:0px;
|
21 |
-
max-width: none !important;
|
22 |
display: none;
|
|
|
|
|
|
|
|
|
23 |
}
|
|
|
24 |
.nivo-main-image {
|
25 |
display: block !important;
|
26 |
-
position: relative !important;
|
27 |
width: 100% !important;
|
28 |
}
|
29 |
|
30 |
/* If an image is wrapped in a link */
|
31 |
.nivoSlider a.nivo-imageLink {
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
margin:0;
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
45 |
}
|
|
|
46 |
/* The slices and boxes in the Slider */
|
47 |
.nivo-slice {
|
48 |
-
display:block;
|
49 |
-
position:absolute;
|
50 |
-
z-index:5;
|
51 |
-
|
52 |
-
|
53 |
}
|
|
|
54 |
.nivo-box {
|
55 |
-
display:block;
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
-
.nivo-box img { display:block; }
|
61 |
|
62 |
/* Caption styles */
|
63 |
.nivo-caption {
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
71 |
padding: 5px 10px;
|
72 |
opacity: 0.8;
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
filter:alpha(opacity=8);
|
77 |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
|
78 |
-
|
79 |
-
-moz-
|
80 |
-
|
81 |
}
|
|
|
82 |
.nivo-caption p {
|
83 |
-
|
84 |
-
|
85 |
}
|
|
|
86 |
.nivo-caption a {
|
87 |
-
display:inline !important;
|
88 |
}
|
|
|
89 |
.nivo-html-caption {
|
90 |
-
|
91 |
}
|
|
|
92 |
/* Direction nav styles (e.g. Next & Prev) */
|
93 |
.nivo-directionNav a {
|
94 |
-
position:absolute;
|
95 |
-
|
96 |
-
|
97 |
-
cursor:pointer;
|
98 |
}
|
|
|
99 |
.nivo-prevNav {
|
100 |
-
left:
|
101 |
}
|
|
|
102 |
.nivo-nextNav {
|
103 |
-
right:
|
104 |
}
|
|
|
105 |
/* Control nav styles (e.g. 1,2,3...) */
|
106 |
.nivo-controlNav {
|
107 |
-
text-align:center;
|
108 |
padding: 15px 0;
|
|
|
109 |
}
|
|
|
110 |
.nivo-controlNav a {
|
111 |
-
cursor:pointer;
|
112 |
}
|
|
|
113 |
.nivo-controlNav a.active {
|
114 |
-
font-weight:bold;
|
115 |
-
}
|
1 |
/*
|
2 |
* jQuery Nivo Slider v3.2
|
3 |
* http://nivo.dev7studios.com
|
4 |
+
* Version: 2.0.0
|
5 |
* Copyright 2012, Dev7studios
|
6 |
* Free to use and abuse under the MIT license.
|
7 |
* http://www.opensource.org/licenses/mit-license.php
|
8 |
*/
|
9 |
+
|
10 |
/* The Nivo Slider styles */
|
11 |
.nivoSlider {
|
|
|
|
|
|
|
12 |
overflow: hidden;
|
13 |
+
position: relative;
|
14 |
+
width: 100%;
|
15 |
+
height: auto;
|
16 |
}
|
17 |
+
|
18 |
.nivoSlider img {
|
|
|
|
|
|
|
|
|
19 |
display: none;
|
20 |
+
position: absolute;
|
21 |
+
top: 0;
|
22 |
+
left: 0;
|
23 |
+
max-width: none !important;
|
24 |
}
|
25 |
+
|
26 |
.nivo-main-image {
|
27 |
display: block !important;
|
28 |
+
position: relative !important;
|
29 |
width: 100% !important;
|
30 |
}
|
31 |
|
32 |
/* If an image is wrapped in a link */
|
33 |
.nivoSlider a.nivo-imageLink {
|
34 |
+
display: none;
|
35 |
+
position: absolute;
|
36 |
+
z-index: 6;
|
37 |
+
top: 0;
|
38 |
+
left: 0;
|
39 |
+
width: 100%;
|
40 |
+
height: 100%;
|
41 |
+
margin: 0;
|
42 |
+
padding: 0;
|
43 |
+
border: 0;
|
44 |
+
opacity: 0;
|
45 |
+
background: white;
|
46 |
+
|
47 |
+
filter: alpha(opacity=0);
|
48 |
}
|
49 |
+
|
50 |
/* The slices and boxes in the Slider */
|
51 |
.nivo-slice {
|
52 |
+
display: block;
|
53 |
+
position: absolute;
|
54 |
+
z-index: 5;
|
55 |
+
top: 0;
|
56 |
+
height: 100%;
|
57 |
}
|
58 |
+
|
59 |
.nivo-box {
|
60 |
+
display: block;
|
61 |
+
overflow: hidden;
|
62 |
+
position: absolute;
|
63 |
+
z-index: 5;
|
64 |
+
}
|
65 |
+
|
66 |
+
.nivo-box img {
|
67 |
+
display: block;
|
68 |
}
|
|
|
69 |
|
70 |
/* Caption styles */
|
71 |
.nivo-caption {
|
72 |
+
display: none;
|
73 |
+
overflow: hidden;
|
74 |
+
position: absolute;
|
75 |
+
z-index: 8;
|
76 |
+
bottom: 0;
|
77 |
+
left: 0;
|
78 |
+
-webkit-box-sizing: border-box;
|
79 |
+
/* Safari/Chrome, other WebKit */ /* Firefox, other Gecko */
|
80 |
+
box-sizing: border-box;
|
81 |
+
width: 100%;
|
82 |
padding: 5px 10px;
|
83 |
opacity: 0.8;
|
84 |
+
color: #fff;
|
85 |
+
background: #000;
|
86 |
+
|
|
|
87 |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
|
88 |
+
filter: alpha(opacity=8);
|
89 |
+
-moz-opacity: 0.8;
|
90 |
+
/* Opera/IE 8+ */
|
91 |
}
|
92 |
+
|
93 |
.nivo-caption p {
|
94 |
+
margin: 0;
|
95 |
+
padding: 5px;
|
96 |
}
|
97 |
+
|
98 |
.nivo-caption a {
|
99 |
+
display: inline !important;
|
100 |
}
|
101 |
+
|
102 |
.nivo-html-caption {
|
103 |
+
display: none;
|
104 |
}
|
105 |
+
|
106 |
/* Direction nav styles (e.g. Next & Prev) */
|
107 |
.nivo-directionNav a {
|
108 |
+
position: absolute;
|
109 |
+
z-index: 9;
|
110 |
+
top: 45%;
|
111 |
+
cursor: pointer;
|
112 |
}
|
113 |
+
|
114 |
.nivo-prevNav {
|
115 |
+
left: 0;
|
116 |
}
|
117 |
+
|
118 |
.nivo-nextNav {
|
119 |
+
right: 0;
|
120 |
}
|
121 |
+
|
122 |
/* Control nav styles (e.g. 1,2,3...) */
|
123 |
.nivo-controlNav {
|
|
|
124 |
padding: 15px 0;
|
125 |
+
text-align: center;
|
126 |
}
|
127 |
+
|
128 |
.nivo-controlNav a {
|
129 |
+
cursor: pointer;
|
130 |
}
|
131 |
+
|
132 |
.nivo-controlNav a.active {
|
133 |
+
font-weight: bold;
|
134 |
+
}
|
assets/images/nivo.png
ADDED
Binary file
|
assets/js/admin.js
CHANGED
@@ -1,33 +1,29 @@
|
|
1 |
-
jQuery(document).ready(function($){
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
*
|
10 |
-
**/
|
11 |
|
12 |
-
|
13 |
-
nivo_theme_thumbs_enabled();
|
14 |
-
});
|
15 |
|
16 |
-
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
if(dev7plugin.themes[current_theme] != undefined){
|
24 |
-
if(dev7plugin.themes[current_theme].theme_details.SupportsThumbs == 'false'){
|
25 |
-
controlNavThumbs.attr('checked', false);
|
26 |
-
$('.dev7_thumb_nav,.dev7_thumb_size').hide();
|
27 |
-
}
|
28 |
-
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
});
|
1 |
+
jQuery( document ).ready(function($){
|
2 |
|
3 |
+
/**
|
4 |
+
* Nivo Themes
|
5 |
+
*
|
6 |
+
*
|
7 |
+
**/
|
8 |
|
9 |
+
$( 'select[name="nivo_settings[theme]"]' ).change(function(){
|
10 |
+
nivo_theme_thumbs_enabled();
|
11 |
+
});
|
|
|
|
|
12 |
|
13 |
+
nivo_theme_thumbs_enabled();
|
|
|
|
|
14 |
|
15 |
+
function nivo_theme_thumbs_enabled(){
|
16 |
+
var current_theme = $( 'select[name="nivo_settings[theme]"] option:selected' ).val();
|
17 |
+
var controlNavThumbs = $( 'input[name="nivo_settings[controlNavThumbs]"]' );
|
18 |
|
19 |
+
$( '.nivo_thumb_nav,.nivo_thumb_size' ).show();
|
20 |
+
if (nivo_plugin.themes[current_theme] != undefined) {
|
21 |
+
if (nivo_plugin.themes[current_theme].theme_details.SupportsThumbs == 'false') {
|
22 |
+
controlNavThumbs.attr( 'checked', false );
|
23 |
+
$( '.nivo_thumb_nav,.nivo_thumb_size' ).hide();
|
24 |
+
}
|
25 |
+
}
|
26 |
|
27 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
+
});
|
|
|
|
|
|
assets/js/core-admin.js
ADDED
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function ($) {
|
2 |
+
$('.nivo-switch input').on('change', function () {
|
3 |
+
var status = $(this).is(':checked');
|
4 |
+
status = (status) ? 'yes' : 'no';
|
5 |
+
$.ajax({
|
6 |
+
url: nivo_plugin.track_url,
|
7 |
+
data: {status: status},
|
8 |
+
method: "get",
|
9 |
+
success: function (data, textStatus, jqXHR) {
|
10 |
+
}
|
11 |
+
});
|
12 |
+
});
|
13 |
+
function get_image_source_setting() {
|
14 |
+
return $('select[name="' + nivo_plugin.labels.post_meta_key + '[' + nivo_plugin.labels.source_name + ']"] option:selected').val();
|
15 |
+
}
|
16 |
+
|
17 |
+
// Edit screen Images
|
18 |
+
if (nivo_plugin.post_id != '') {
|
19 |
+
load_image_source(); // Initial load
|
20 |
+
}
|
21 |
+
|
22 |
+
$('select[name="' + nivo_plugin.labels.post_meta_key + '[' + nivo_plugin.labels.source_name + ']"]').change(function () {
|
23 |
+
load_image_source();
|
24 |
+
display_params();
|
25 |
+
});
|
26 |
+
|
27 |
+
$('select[name="' + nivo_plugin.labels.post_meta_key + '[' + nivo_plugin.labels.type_name + '_gallery]"]').change(function () {
|
28 |
+
load_image_source();
|
29 |
+
});
|
30 |
+
|
31 |
+
$('select[name="' + nivo_plugin.labels.post_meta_key + '[' + nivo_plugin.labels.type_name + '_category]"]').change(function () {
|
32 |
+
load_image_source();
|
33 |
+
});
|
34 |
+
|
35 |
+
function escapeHTML(unsafe_str) {
|
36 |
+
return unsafe_str
|
37 |
+
.replace(/&/g, '&')
|
38 |
+
.replace(/</g, '<')
|
39 |
+
.replace(/>/g, '>')
|
40 |
+
.replace(/\"/g, '"')
|
41 |
+
.replace(/\'/g, '''); // ''' is not valid HTML 4
|
42 |
+
}
|
43 |
+
|
44 |
+
function load_images() {
|
45 |
+
var image_source = $('select[name="' + nivo_plugin.labels.post_meta_key + '[' + nivo_plugin.labels.source_name + ']"] option:selected').val();
|
46 |
+
var image_method = $('select[name="' + nivo_plugin.labels.post_meta_key + '[' + image_source + '_type]"] option:selected').val();
|
47 |
+
var image_param = $('#' + image_source + '_' + image_method).val();
|
48 |
+
|
49 |
+
var number_images = $('input[name="' + nivo_plugin.labels.post_meta_key + '[number_images]"]').val();
|
50 |
+
|
51 |
+
if (image_param != '') {
|
52 |
+
$('#' + nivo_plugin.labels.post_type + '-images').html('<li class="loading"><div class="spinner"></div></li>');
|
53 |
+
$.ajax({
|
54 |
+
url: ajaxurl,
|
55 |
+
type: 'POST',
|
56 |
+
dataType: 'json',
|
57 |
+
data: {
|
58 |
+
action: nivo_plugin.labels.post_type + '_load_images',
|
59 |
+
id: nivo_plugin.post_id,
|
60 |
+
nonce: nivo_plugin.nonce,
|
61 |
+
source: image_source,
|
62 |
+
gallery: $('select[name="' + nivo_plugin.labels.post_meta_key + '[' + nivo_plugin.labels.type_name + '_gallery]"] option:selected').val(),
|
63 |
+
category: $('select[name="' + nivo_plugin.labels.post_meta_key + '[' + nivo_plugin.labels.type_name + '_category]"] option:selected').val(),
|
64 |
+
method: image_method,
|
65 |
+
param: image_param,
|
66 |
+
number_images: number_images
|
67 |
+
},
|
68 |
+
success: function (response) {
|
69 |
+
if (response.error) {
|
70 |
+
$('#' + nivo_plugin.labels.post_type + '-images').html('');
|
71 |
+
alert(response.message);
|
72 |
+
} else {
|
73 |
+
$('#' + nivo_plugin.labels.post_type + '-images').html('');
|
74 |
+
for (var i in response.images) {
|
75 |
+
var image = response.images[i];
|
76 |
+
var output = '<li id="attachment-' + image.id + '">' +
|
77 |
+
'<img src="' + image.image_src + '" alt="' + escapeHTML(image.post_title) + '" title="' + escapeHTML(image.post_title) + '" class="attachment-thumbnail" />' +
|
78 |
+
'</li>';
|
79 |
+
$('#' + nivo_plugin.labels.post_type + '-images').append(output);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
},
|
83 |
+
error: function (response, status, error) {
|
84 |
+
$('#' + nivo_plugin.labels.post_type + '-images').html('<li class="loading">Error ' + error.replace(/(<([^>]+)>)/ig, "") + '</li>');
|
85 |
+
//alert('Error: ' + error.replace(/(<([^>]+)>)/ig,""));
|
86 |
+
}
|
87 |
+
});
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
function load_image_source() {
|
92 |
+
var selected_source = get_image_source_setting();
|
93 |
+
$('.nivo_type').hide();
|
94 |
+
if (selected_source != nivo_plugin.labels.manual_name) {
|
95 |
+
$('#nivo_type_' + selected_source).show();
|
96 |
+
$('.manual.description').hide();
|
97 |
+
$('.nivo_non_manual').show();
|
98 |
+
$('#manual_images_upload').hide();
|
99 |
+
} else {
|
100 |
+
$('.manual.description').show();
|
101 |
+
$('.nivo_non_manual').hide();
|
102 |
+
$('#manual_images_upload').show();
|
103 |
+
}
|
104 |
+
|
105 |
+
if (selected_source == 'category' || selected_source == 'sticky' || selected_source == 'custom') {
|
106 |
+
$('tr.nivo_captions').show();
|
107 |
+
} else {
|
108 |
+
$('tr.nivo_captions').hide();
|
109 |
+
}
|
110 |
+
|
111 |
+
if (selected_source == 'category' ||
|
112 |
+
selected_source == 'gallery' ||
|
113 |
+
selected_source == 'sticky' ||
|
114 |
+
selected_source == 'custom' ||
|
115 |
+
selected_source == nivo_plugin.labels.manual_name
|
116 |
+
) {
|
117 |
+
$('tr.wp-image-size').show();
|
118 |
+
} else {
|
119 |
+
$('tr.wp-image-size').hide();
|
120 |
+
}
|
121 |
+
|
122 |
+
load_images();
|
123 |
+
}
|
124 |
+
|
125 |
+
// Dependant Select visibilty
|
126 |
+
$('#' + nivo_plugin.labels.post_type + '-settings select').each(function (index, element) {
|
127 |
+
dependant_visible(this);
|
128 |
+
});
|
129 |
+
|
130 |
+
$('#' + nivo_plugin.labels.post_type + '-settings').on('change', 'select', function () {
|
131 |
+
dependant_visible(this);
|
132 |
+
});
|
133 |
+
|
134 |
+
$('#' + nivo_plugin.labels.post_type + '-settings input:checkbox').each(function (index, element) {
|
135 |
+
dependant_visible(this);
|
136 |
+
});
|
137 |
+
|
138 |
+
$('#' + nivo_plugin.labels.post_type + '-settings').on('change', 'input:checkbox', function () {
|
139 |
+
dependant_visible(this);
|
140 |
+
});
|
141 |
+
|
142 |
+
function dependant_visible(element) {
|
143 |
+
var id = $(element).attr('id');
|
144 |
+
if ($('tr.parent-' + id).length > 0) {
|
145 |
+
|
146 |
+
if ($(element).is(':checkbox')) {
|
147 |
+
var value = ( $(element).is(':checked') ) ? 'on' : 'off';
|
148 |
+
} else if ($(element).is('select')) {
|
149 |
+
var value = $('option:selected', element).val();
|
150 |
+
}
|
151 |
+
$('tr.parent-' + id).hide();
|
152 |
+
$('tr.parent-' + id + '.' + value).show();
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
// Reload images
|
157 |
+
$('#' + nivo_plugin.labels.post_type + '-settings').on('change', 'input.reload', function () {
|
158 |
+
load_images();
|
159 |
+
});
|
160 |
+
|
161 |
+
$('#' + nivo_plugin.labels.post_type + '-settings').on('change', 'select.reload', function () {
|
162 |
+
load_images();
|
163 |
+
});
|
164 |
+
|
165 |
+
/**
|
166 |
+
* MMP integration
|
167 |
+
*
|
168 |
+
*/
|
169 |
+
|
170 |
+
function display_params() {
|
171 |
+
var source = $('select[name="' + nivo_plugin.labels.post_meta_key + '[' + nivo_plugin.labels.source_name + ']"] option:selected').val();
|
172 |
+
var method = $('select[name="' + nivo_plugin.labels.post_meta_key + '[' + source + '_type]"] option:selected').val();
|
173 |
+
$('.image_source_param').hide();
|
174 |
+
if (typeof method != 'undefined') {
|
175 |
+
$('#' + source + '_param_' + method).show();
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
display_params();
|
180 |
+
|
181 |
+
$('#' + nivo_plugin.labels.post_type + '-settings').on('change', 'select.image_source_type', function () {
|
182 |
+
display_params();
|
183 |
+
load_images();
|
184 |
+
});
|
185 |
+
|
186 |
+
$('#' + nivo_plugin.labels.post_type + '-settings').on('change', '.image_source_param', function () {
|
187 |
+
load_images();
|
188 |
+
});
|
189 |
+
|
190 |
+
$('.image_source_param').keydown(function (e) {
|
191 |
+
if (e.which == 13) {
|
192 |
+
e.preventDefault();
|
193 |
+
load_images();
|
194 |
+
}
|
195 |
+
});
|
196 |
+
|
197 |
+
$('input.reload').keydown(function (e) {
|
198 |
+
if (e.which == 13) {
|
199 |
+
e.preventDefault();
|
200 |
+
load_images();
|
201 |
+
}
|
202 |
+
});
|
203 |
+
|
204 |
+
$('.reattach-images').on('click', function (e) {
|
205 |
+
e.preventDefault();
|
206 |
+
var post_id = $(this).attr('data-post');
|
207 |
+
$spinner = $(this).next('.spinner');
|
208 |
+
if (post_id != '') {
|
209 |
+
$spinner.show();
|
210 |
+
$(this).hide();
|
211 |
+
$.ajax({
|
212 |
+
url: ajaxurl,
|
213 |
+
type: 'POST',
|
214 |
+
dataType: 'json',
|
215 |
+
data: {
|
216 |
+
action: nivo_plugin.labels.post_type + '_reattach_images',
|
217 |
+
nonce: nivo_plugin.nonce,
|
218 |
+
post_id: post_id
|
219 |
+
},
|
220 |
+
success: function (response) {
|
221 |
+
if (response.error) {
|
222 |
+
alert(response.message);
|
223 |
+
$spinner.hide();
|
224 |
+
} else {
|
225 |
+
// images attached
|
226 |
+
window.location = response.redirect;
|
227 |
+
}
|
228 |
+
},
|
229 |
+
error: function (response, status, error) {
|
230 |
+
alert('Error: ' + error.replace(/(<([^>]+)>)/ig, ""));
|
231 |
+
$spinner.hide();
|
232 |
+
}
|
233 |
+
});
|
234 |
+
}
|
235 |
+
});
|
236 |
+
|
237 |
+
/**
|
238 |
+
* License Calls
|
239 |
+
*
|
240 |
+
*
|
241 |
+
**/
|
242 |
+
|
243 |
+
var license_input = nivo_plugin.labels.options_key + '[license_key]';
|
244 |
+
var license_status = nivo_plugin.labels.options_key + '[license_status]';
|
245 |
+
$('#activate-license').on('click', function () {
|
246 |
+
var license_key = $('input[name="' + license_input + '"]').val();
|
247 |
+
if (license_key != '') {
|
248 |
+
$('#nivo_license .spinner').show();
|
249 |
+
document.getElementById("activate-license").disabled = true;
|
250 |
+
$.ajax({
|
251 |
+
url: ajaxurl,
|
252 |
+
type: 'POST',
|
253 |
+
dataType: 'json',
|
254 |
+
data: {
|
255 |
+
action: nivo_plugin.labels.post_type + '_activate_license',
|
256 |
+
nonce: nivo_plugin.nonce,
|
257 |
+
license_key: license_key
|
258 |
+
},
|
259 |
+
success: function (response) {
|
260 |
+
if (response.error) {
|
261 |
+
alert(response.message);
|
262 |
+
$('#nivo_license .spinner').hide();
|
263 |
+
document.getElementById("activate-license").disabled = false;
|
264 |
+
} else {
|
265 |
+
$('input[name="' + license_status + '"]').val(response.license_status);
|
266 |
+
if (response.license_status == 'valid') {
|
267 |
+
window.location = response.redirect;
|
268 |
+
} else {
|
269 |
+
alert('License ' + response.license_status);
|
270 |
+
$('#nivo_license .spinner').hide();
|
271 |
+
document.getElementById("activate-license").disabled = false;
|
272 |
+
}
|
273 |
+
}
|
274 |
+
},
|
275 |
+
error: function (response, status, error) {
|
276 |
+
alert('Error: ' + error.replace(/(<([^>]+)>)/ig, ""));
|
277 |
+
$('#nivo_license .spinner').hide();
|
278 |
+
document.getElementById("activate-license").disabled = false;
|
279 |
+
}
|
280 |
+
});
|
281 |
+
}
|
282 |
+
});
|
283 |
+
|
284 |
+
$('#deactivate-license').on('click', function () {
|
285 |
+
$('#nivo_license .spinner').show();
|
286 |
+
document.getElementById("deactivate-license").disabled = true;
|
287 |
+
$.ajax({
|
288 |
+
url: ajaxurl,
|
289 |
+
type: 'POST',
|
290 |
+
dataType: 'json',
|
291 |
+
data: {
|
292 |
+
action: nivo_plugin.labels.post_type + '_deactivate_license',
|
293 |
+
nonce: nivo_plugin.nonce
|
294 |
+
},
|
295 |
+
success: function (response) {
|
296 |
+
if (response.error) {
|
297 |
+
alert(response.message);
|
298 |
+
$('#nivo_license .spinner').hide();
|
299 |
+
document.getElementById("deactivate-license").disabled = false;
|
300 |
+
} else {
|
301 |
+
if (response.license_status == 'deactivated') {
|
302 |
+
$('input[name="' + license_status + '"]').val('');
|
303 |
+
}
|
304 |
+
window.location = response.redirect;
|
305 |
+
}
|
306 |
+
},
|
307 |
+
error: function (response, status, error) {
|
308 |
+
alert('Error: ' + error.replace(/(<([^>]+)>)/ig, ""));
|
309 |
+
$('#nivo_license .spinner').hide();
|
310 |
+
document.getElementById("deactivate-license").disabled = false;
|
311 |
+
}
|
312 |
+
});
|
313 |
+
|
314 |
+
});
|
315 |
+
|
316 |
+
});
|
assets/js/image-admin.js
ADDED
@@ -0,0 +1,361 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery( document ).ready(function($){
|
2 |
+
|
3 |
+
if (typeof wp === 'undefined') { return;
|
4 |
+
}
|
5 |
+
|
6 |
+
if (typeof wp.media === 'undefined') { return;
|
7 |
+
}
|
8 |
+
|
9 |
+
var frame,
|
10 |
+
images = wp.media.view.l10n[nivo_plugin.labels.post_type + 'Images'],
|
11 |
+
selection = getImages( images );
|
12 |
+
|
13 |
+
if (typeof wp.media.view.Toolbar.UberMedia !== 'undefined') {
|
14 |
+
|
15 |
+
var UberImage = Backbone.Model.extend({
|
16 |
+
});
|
17 |
+
|
18 |
+
var UberImages = Backbone.Collection.extend({
|
19 |
+
model: UberImage
|
20 |
+
});
|
21 |
+
|
22 |
+
var SelectedImages = Backbone.Collection.extend({
|
23 |
+
model: UberImage
|
24 |
+
});
|
25 |
+
|
26 |
+
wp.media.view.Toolbar.UberMedia = wp.media.view.Toolbar.UberMedia.extend({
|
27 |
+
className: 'media-toolbar mmp-toolbar',
|
28 |
+
initialize: function() {
|
29 |
+
_.defaults( this.options, {
|
30 |
+
event: 'mmp_event_insert',
|
31 |
+
close: false,
|
32 |
+
items: {
|
33 |
+
mmp_event_insert: {
|
34 |
+
text: wp.media.view.l10n.ubermediaButton,
|
35 |
+
style: 'primary',
|
36 |
+
id: 'uber-button',
|
37 |
+
priority: 80,
|
38 |
+
requires: false,
|
39 |
+
click: this.insertAction
|
40 |
+
}
|
41 |
+
}
|
42 |
+
});
|
43 |
+
|
44 |
+
wp.media.view.Toolbar.prototype.initialize.apply( this, arguments );
|
45 |
+
},
|
46 |
+
|
47 |
+
insertAction: function(){
|
48 |
+
if ($( '#uber-button' ).is( '[disabled=disabled]' )) { return;
|
49 |
+
}
|
50 |
+
|
51 |
+
$( 'div.ubermedia' ).addClass( 'uber-media-overlay' );
|
52 |
+
$( '#method' ).attr( "disabled", 'disabled' );
|
53 |
+
$( '#param' ).attr( "disabled", 'disabled' );
|
54 |
+
$( '#pagination' ).attr( "disabled", 'disabled' );
|
55 |
+
|
56 |
+
$( '#uber-button' ).attr( "disabled", 'disabled' );
|
57 |
+
$( "#uber-button" ).text( 'Adding...' );
|
58 |
+
|
59 |
+
var selectedimages = this.controller.state().props.get( 'custom_data' );
|
60 |
+
var selection = new SelectedImages( selectedimages.models );
|
61 |
+
|
62 |
+
var that = this,
|
63 |
+
count = 0,
|
64 |
+
jqHXRs = [],
|
65 |
+
new_ids = '';
|
66 |
+
|
67 |
+
selection.each(function(model){
|
68 |
+
count++;
|
69 |
+
|
70 |
+
var modelAttr = model.attributes;
|
71 |
+
var fields = $.param( modelAttr );
|
72 |
+
data = 'action=uber_pre_insert&nonce=' + uber_media.nonce + '&imgsrc=' + encodeURI( model.get( 'data-full' ) ) + '&postid=' + $( '#post_ID' ).val() + '&nivo_plugin=' + nivo_plugin.labels.post_type + '&' + fields;
|
73 |
+
|
74 |
+
var full = model.get( 'data-full' );
|
75 |
+
var imgstr;
|
76 |
+
|
77 |
+
jqHXRs.push(
|
78 |
+
$.post(ajaxurl, data,
|
79 |
+
function(data){
|
80 |
+
if (data.message == 'success') {
|
81 |
+
new_ids += data.attachment_id + ',';
|
82 |
+
}
|
83 |
+
}
|
84 |
+
, 'json')
|
85 |
+
);
|
86 |
+
});
|
87 |
+
|
88 |
+
$.when.apply( this, jqHXRs ).done(function(){
|
89 |
+
|
90 |
+
that.controller.state().props.set( 'custom_data', '' );
|
91 |
+
that.controller.state().props.set( 'selected_id', '' );
|
92 |
+
that.controller.state().props.set( 'selected_image', '' );
|
93 |
+
|
94 |
+
new_ids = new_ids.substring( 0, new_ids.length - 1 );
|
95 |
+
var new_selection = getImages( new_ids );
|
96 |
+
|
97 |
+
var checkExist = setInterval(function() {
|
98 |
+
if (new_selection.length) {
|
99 |
+
var controller = that.controller,
|
100 |
+
state = controller.state(),
|
101 |
+
edit = controller.state( 'gallery-edit' );
|
102 |
+
edit.get( 'library' ).add( new_selection.models );
|
103 |
+
state.trigger( 'reset' );
|
104 |
+
controller.setState( 'gallery-edit' );
|
105 |
+
clearInterval( checkExist );
|
106 |
+
}
|
107 |
+
}, 100);
|
108 |
+
|
109 |
+
});
|
110 |
+
}
|
111 |
+
|
112 |
+
});
|
113 |
+
}
|
114 |
+
|
115 |
+
$( '#manual_images_upload' ).on('click', function(e) {
|
116 |
+
e.preventDefault();
|
117 |
+
|
118 |
+
var media = wp.media;
|
119 |
+
selection = getImages( $( '#_manual_image_ids' ).val() );
|
120 |
+
// Set options for 1st frame render
|
121 |
+
var options = {
|
122 |
+
state: 'gallery-edit',
|
123 |
+
frame: 'post',
|
124 |
+
selection: selection
|
125 |
+
};
|
126 |
+
|
127 |
+
// Set Links for image meta
|
128 |
+
$.ajax({
|
129 |
+
url: ajaxurl,
|
130 |
+
type: 'POST',
|
131 |
+
dataType: 'json',
|
132 |
+
data: { action: nivo_plugin.labels.post_type + '_get_meta_link', ids: images,
|
133 |
+
nonce: nivo_plugin.nonce },
|
134 |
+
success: function(response){
|
135 |
+
$.each(response.metalink, function(index, value) {
|
136 |
+
selection.get( index ).set( 'metalink', value );
|
137 |
+
});
|
138 |
+
},
|
139 |
+
error: function(response, status, error){
|
140 |
+
alert( 'Error: ' + error.replace( /(<([^>]+)>)/ig,"" ) );
|
141 |
+
}
|
142 |
+
});
|
143 |
+
|
144 |
+
overrideAttachmentDetails();
|
145 |
+
|
146 |
+
frame = wp.media( options ).open();
|
147 |
+
|
148 |
+
// Tweak views
|
149 |
+
frame.menu.get( 'view' ).unset( 'cancel' );
|
150 |
+
frame.menu.get( 'view' ).unset( 'separateCancel' );
|
151 |
+
|
152 |
+
frame.content.get( 'view' ).sidebar.unset( 'gallery' ); // Hide Gallery Settings in sidebar
|
153 |
+
|
154 |
+
// When we are editing a gallery
|
155 |
+
overrideGalleryInsert();
|
156 |
+
frame.on( 'toolbar:render:gallery-edit', function() {
|
157 |
+
overrideGalleryInsert();
|
158 |
+
});
|
159 |
+
|
160 |
+
frame.on( 'content:render:browse', function( browser ) {
|
161 |
+
if ( ! browser ) { return;
|
162 |
+
}
|
163 |
+
// Hide Gallery Settings in sidebar
|
164 |
+
browser.sidebar.on('ready', function(){
|
165 |
+
browser.sidebar.unset( 'gallery' );
|
166 |
+
});
|
167 |
+
// Hide filter/search as they don't work
|
168 |
+
browser.toolbar.on('ready', function(){
|
169 |
+
if (browser.toolbar.controller._state == 'gallery-library') {
|
170 |
+
browser.toolbar.$el.hide();
|
171 |
+
}
|
172 |
+
});
|
173 |
+
});
|
174 |
+
|
175 |
+
// Override Attachment Details
|
176 |
+
function overrideAttachmentDetails() {
|
177 |
+
|
178 |
+
media.view.Attachment.Details = media.view.Attachment.Details.extend({
|
179 |
+
tagName: 'div',
|
180 |
+
className: 'attachment-details',
|
181 |
+
template: media.template( 'attachment-details' ),
|
182 |
+
|
183 |
+
events: {
|
184 |
+
'change [data-setting]': 'updateSetting',
|
185 |
+
'change [data-setting] input': 'updateSetting',
|
186 |
+
'change [data-setting] select': 'updateSetting',
|
187 |
+
'change [data-setting] textarea': 'updateSetting',
|
188 |
+
'change [data-customsetting] input': 'updateCustomSetting',
|
189 |
+
'click .delete-attachment': 'deleteAttachment',
|
190 |
+
'click .edit-attachment': 'editAttachment',
|
191 |
+
'click .refresh-attachment': 'refreshAttachment'
|
192 |
+
},
|
193 |
+
|
194 |
+
initialize: function() {
|
195 |
+
this.focusManager = new media.view.FocusManager({
|
196 |
+
el: this.el
|
197 |
+
});
|
198 |
+
|
199 |
+
media.view.Attachment.prototype.initialize.apply( this, arguments );
|
200 |
+
},
|
201 |
+
|
202 |
+
render: function() {
|
203 |
+
media.view.Attachment.prototype.render.apply( this, arguments );
|
204 |
+
this.focusManager.focus();
|
205 |
+
return this;
|
206 |
+
},
|
207 |
+
|
208 |
+
deleteAttachment: function( event ) {
|
209 |
+
event.preventDefault();
|
210 |
+
|
211 |
+
if ( confirm( l10n.warnDelete ) ) {
|
212 |
+
this.model.destroy();
|
213 |
+
}
|
214 |
+
},
|
215 |
+
|
216 |
+
editAttachment: function( event ) {
|
217 |
+
this.$el.addClass( 'needs-refresh' );
|
218 |
+
},
|
219 |
+
|
220 |
+
refreshAttachment: function( event ) {
|
221 |
+
this.$el.removeClass( 'needs-refresh' );
|
222 |
+
event.preventDefault();
|
223 |
+
this.model.fetch();
|
224 |
+
},
|
225 |
+
|
226 |
+
updateCustomSetting: function( event ) {
|
227 |
+
|
228 |
+
var $setting = $( event.target ).closest( '[data-customsetting]' ),
|
229 |
+
setting, value;
|
230 |
+
|
231 |
+
if ( ! $setting.length ) {
|
232 |
+
return;
|
233 |
+
}
|
234 |
+
|
235 |
+
setting = $setting.data( 'customsetting' );
|
236 |
+
value = event.target.value;
|
237 |
+
|
238 |
+
if ( this.model.get( setting ) !== value ) {
|
239 |
+
this.model.set( setting, value );
|
240 |
+
$.ajax({
|
241 |
+
url: ajaxurl,
|
242 |
+
type: 'POST',
|
243 |
+
dataType: 'json',
|
244 |
+
data: { action: nivo_plugin.labels.post_type + '_set_meta_link',
|
245 |
+
id:this.model.id,
|
246 |
+
metalink: value,
|
247 |
+
nonce: nivo_plugin.nonce },
|
248 |
+
success: function(response){
|
249 |
+
},
|
250 |
+
error: function(response, status, error){
|
251 |
+
alert( 'Error: ' + error.replace( /(<([^>]+)>)/ig,"" ) );
|
252 |
+
}
|
253 |
+
});
|
254 |
+
|
255 |
+
}
|
256 |
+
|
257 |
+
}
|
258 |
+
|
259 |
+
});
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
// Override insert button
|
264 |
+
function overrideGalleryInsert() {
|
265 |
+
var editing = frame.state().get( 'editing' );
|
266 |
+
|
267 |
+
frame.toolbar.get( 'view' ).set({
|
268 |
+
insert: {
|
269 |
+
style: 'primary',
|
270 |
+
text: editing ? wp.media.view.l10n.updateGallery : wp.media.view.l10n.insertGallery,
|
271 |
+
|
272 |
+
click: function() {
|
273 |
+
var models = frame.state().get( 'library' ),
|
274 |
+
ids = '';
|
275 |
+
|
276 |
+
models.each( function( attachment ) {
|
277 |
+
ids += attachment.id + ','
|
278 |
+
});
|
279 |
+
ids = ids.substring( 0, ids.length - 1 );
|
280 |
+
|
281 |
+
this.el.innerHTML = 'Saving'; //'<?php _e("Saving...", "zilla"); ?>';
|
282 |
+
|
283 |
+
$( '#_manual_image_ids' ).val( ids );
|
284 |
+
frame.close();
|
285 |
+
|
286 |
+
$( '#' + nivo_plugin.labels.post_type + '-images' ).html( '<li class="loading"><div class="spinner"></div></li>' );
|
287 |
+
|
288 |
+
$.ajax({
|
289 |
+
url: ajaxurl,
|
290 |
+
type: 'POST',
|
291 |
+
dataType: 'json',
|
292 |
+
data: { action: nivo_plugin.labels.post_type + '_load_images',
|
293 |
+
id:nivo_plugin.post_id,
|
294 |
+
source: nivo_plugin.labels.manual_name,
|
295 |
+
image_ids: ids,
|
296 |
+
nonce: nivo_plugin.nonce },
|
297 |
+
success: function(response){
|
298 |
+
if (response.error) {
|
299 |
+
alert( response.message );
|
300 |
+
} else {
|
301 |
+
if (response.images) {
|
302 |
+
$( '#' + nivo_plugin.labels.post_type + '-images' ).html( '' );
|
303 |
+
for (var i in response.images) {
|
304 |
+
var image = response.images[i];
|
305 |
+
var output = '<li id="attachment-' + image.id + '">' +
|
306 |
+
'<img src="' + image.image_src + '" alt="' + image.post_title + '" title="' + image.post_title + '" class="attachment-thumbnail" />';
|
307 |
+
|
308 |
+
$( '#' + nivo_plugin.labels.post_type + '-images' ).append( output );
|
309 |
+
}
|
310 |
+
}
|
311 |
+
}
|
312 |
+
},
|
313 |
+
error: function(response, status, error){
|
314 |
+
alert( 'Error: ' + error.replace( /(<([^>]+)>)/ig,"" ) );
|
315 |
+
}
|
316 |
+
});
|
317 |
+
|
318 |
+
}
|
319 |
+
}
|
320 |
+
});
|
321 |
+
}
|
322 |
+
|
323 |
+
});
|
324 |
+
|
325 |
+
// Load images
|
326 |
+
function getImages(images) {
|
327 |
+
if ( ! images) { images = $( '#_manual_image_ids' ).val();
|
328 |
+
}
|
329 |
+
|
330 |
+
if ( images ) {
|
331 |
+
var shortcode = new wp.shortcode({
|
332 |
+
tag: 'gallery',
|
333 |
+
attrs: { ids: images },
|
334 |
+
type: 'single'
|
335 |
+
});
|
336 |
+
|
337 |
+
var attachments = wp.media.gallery.attachments( shortcode );
|
338 |
+
|
339 |
+
var selection = new wp.media.model.Selection( attachments.models, {
|
340 |
+
props: attachments.props.toJSON(),
|
341 |
+
multiple: true
|
342 |
+
});
|
343 |
+
|
344 |
+
selection.gallery = attachments.gallery;
|
345 |
+
|
346 |
+
// Fetch the query's attachments, and then break ties from the
|
347 |
+
// query to allow for sorting.
|
348 |
+
selection.more().done( function() {
|
349 |
+
// Break ties with the query.
|
350 |
+
selection.props.set( { query: false } );
|
351 |
+
selection.unmirror();
|
352 |
+
selection.props.unset( 'orderby' );
|
353 |
+
});
|
354 |
+
|
355 |
+
return selection;
|
356 |
+
}
|
357 |
+
|
358 |
+
return false;
|
359 |
+
}
|
360 |
+
|
361 |
+
});
|
assets/js/tinymce.js
CHANGED
@@ -3,10 +3,10 @@
|
|
3 |
init : function( editor ) {
|
4 |
editor.addButton('nivoslider', function() {
|
5 |
var galleries = nivoslider.galleries;
|
6 |
-
galleries = jQuery.parseJSON(galleries);
|
7 |
|
8 |
var items = []
|
9 |
-
for(var i in galleries){
|
10 |
items.push({
|
11 |
text: galleries[i].name,
|
12 |
value: galleries[i].id
|
@@ -19,7 +19,7 @@
|
|
19 |
values: items,
|
20 |
fixedWidth: true,
|
21 |
onselect: function(v) {
|
22 |
-
if(v != ''){
|
23 |
editor.insertContent( '[nivoslider id="' + this.value() + '"]' );
|
24 |
}
|
25 |
return false;
|
@@ -29,35 +29,34 @@
|
|
29 |
},
|
30 |
createControl : function(n, cm) {
|
31 |
switch (n) {
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
return {
|
53 |
longname : 'Nivo Slider Shortcode',
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
})();
|
63 |
-
|
3 |
init : function( editor ) {
|
4 |
editor.addButton('nivoslider', function() {
|
5 |
var galleries = nivoslider.galleries;
|
6 |
+
galleries = jQuery.parseJSON( galleries );
|
7 |
|
8 |
var items = []
|
9 |
+
for (var i in galleries) {
|
10 |
items.push({
|
11 |
text: galleries[i].name,
|
12 |
value: galleries[i].id
|
19 |
values: items,
|
20 |
fixedWidth: true,
|
21 |
onselect: function(v) {
|
22 |
+
if (v != '') {
|
23 |
editor.insertContent( '[nivoslider id="' + this.value() + '"]' );
|
24 |
}
|
25 |
return false;
|
29 |
},
|
30 |
createControl : function(n, cm) {
|
31 |
switch (n) {
|
32 |
+
case 'nivoslider':
|
33 |
+
var mlb = cm.createListBox( 'nivoslider' , {
|
34 |
+
title : 'Nivo Sliders',
|
35 |
+
onselect : function(v) {
|
36 |
+
if (v != '') {
|
37 |
+
tinyMCE.execCommand( 'mceInsertContent', false, '[nivoslider id="' + v + '"]' );
|
38 |
+
}
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
});
|
42 |
+
var galleries = nivoslider.galleries;
|
43 |
+
galleries = jQuery.parseJSON( galleries );
|
44 |
+
for (var i in galleries) {
|
45 |
+
mlb.add( galleries[i].name, galleries[i].id );
|
46 |
+
}
|
47 |
+
return mlb;
|
48 |
+
}
|
49 |
+
return null;
|
50 |
+
},
|
51 |
+
getInfo : function() {
|
52 |
return {
|
53 |
longname : 'Nivo Slider Shortcode',
|
54 |
+
author : 'ThemeIsle',
|
55 |
+
authorurl : 'http://www.themeisle.com',
|
56 |
+
infourl : 'http://www.themeisle.com/plugins/nivo-slider',
|
57 |
+
version : '3.0'
|
58 |
+
};
|
59 |
+
}
|
60 |
+
});
|
61 |
+
tinymce.PluginManager.add( 'nivoslider', tinymce.plugins.nivoslider );
|
62 |
})();
|
|
assets/themes/bar/bar.css
CHANGED
@@ -9,125 +9,145 @@ Supports Thumbs: false
|
|
9 |
*/
|
10 |
|
11 |
.theme-bar.slider-wrapper {
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
}
|
|
|
16 |
.theme-bar .nivoSlider {
|
17 |
-
position:relative;
|
18 |
-
background
|
19 |
}
|
|
|
20 |
.theme-bar .nivoSlider img {
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
max-width: none !important;
|
26 |
}
|
|
|
27 |
.theme-bar .nivoSlider a {
|
28 |
-
|
29 |
-
|
30 |
}
|
31 |
|
32 |
.theme-bar .nivo-controlNav {
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
text-align: center;
|
40 |
padding: 5px 0;
|
41 |
border-top: 1px solid #333;
|
|
|
|
|
42 |
background: #333;
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
55 |
}
|
|
|
56 |
.theme-bar:hover .nivo-controlNav {
|
57 |
-
|
58 |
-
|
59 |
}
|
|
|
60 |
.theme-bar .nivo-controlNav a {
|
61 |
-
display:inline-block;
|
62 |
-
width:22px;
|
63 |
-
height:22px;
|
64 |
-
background:url(bullets.png) no-repeat;
|
65 |
-
text-indent:-9999px;
|
66 |
-
border:0;
|
67 |
margin: 5px 2px 0 2px;
|
|
|
|
|
|
|
68 |
}
|
|
|
69 |
.theme-bar .nivo-controlNav a.active {
|
70 |
-
background-position:0 -22px;
|
71 |
}
|
72 |
|
73 |
.theme-bar .nivo-directionNav a {
|
74 |
-
display:block;
|
75 |
-
|
76 |
-
color: #fff;
|
77 |
-
text-transform: uppercase;
|
78 |
top: auto;
|
79 |
bottom: 10px;
|
80 |
-
|
|
|
|
|
81 |
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
82 |
font-size: 13px;
|
83 |
line-height: 20px;
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
-
|
91 |
-
.theme-bar a.nivo-
|
92 |
-
|
93 |
-
|
94 |
-
opacity: 1;
|
95 |
}
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
-
.theme-bar .nivo-directionNav a:hover { color: #ddd; }
|
101 |
|
102 |
.theme-bar .nivo-caption {
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
-o-transition: all 200ms ease-in-out;
|
107 |
-
transition: all 200ms ease-in-out;
|
108 |
}
|
|
|
109 |
.theme-bar:hover .nivo-caption {
|
110 |
-
|
111 |
}
|
|
|
112 |
.theme-bar .nivo-caption a {
|
113 |
-
|
114 |
-
|
115 |
}
|
|
|
116 |
.theme-bar .nivo-caption a:hover {
|
117 |
-
|
118 |
}
|
119 |
|
120 |
.theme-bar .nivo-controlNav.nivo-thumbs-enabled {
|
121 |
width: 100%;
|
122 |
}
|
|
|
123 |
.theme-bar .nivo-controlNav.nivo-thumbs-enabled a {
|
124 |
width: auto;
|
125 |
height: auto;
|
126 |
-
background: none;
|
127 |
margin-bottom: 5px;
|
|
|
128 |
}
|
|
|
129 |
.theme-bar .nivo-controlNav.nivo-thumbs-enabled img {
|
130 |
display: block;
|
131 |
width: 120px;
|
132 |
height: auto;
|
133 |
-
}
|
9 |
*/
|
10 |
|
11 |
.theme-bar.slider-wrapper {
|
12 |
+
overflow: hidden;
|
13 |
+
position: relative;
|
14 |
+
border: 1px solid #333;
|
15 |
}
|
16 |
+
|
17 |
.theme-bar .nivoSlider {
|
18 |
+
position: relative;
|
19 |
+
background: #fff url(loading.gif) no-repeat 50% 50%;
|
20 |
}
|
21 |
+
|
22 |
.theme-bar .nivoSlider img {
|
23 |
+
display: none;
|
24 |
+
position: absolute;
|
25 |
+
top: 0;
|
26 |
+
left: 0;
|
27 |
max-width: none !important;
|
28 |
}
|
29 |
+
|
30 |
.theme-bar .nivoSlider a {
|
31 |
+
display: block;
|
32 |
+
border: 0;
|
33 |
}
|
34 |
|
35 |
.theme-bar .nivo-controlNav {
|
36 |
+
position: absolute;
|
37 |
+
z-index: 10;
|
38 |
+
bottom: -41px;
|
39 |
+
left: 0;
|
40 |
+
width: 100%;
|
41 |
+
height: 30px;
|
|
|
42 |
padding: 5px 0;
|
43 |
border-top: 1px solid #333;
|
44 |
+
/* IE6-9 */
|
45 |
+
opacity: 0.5;
|
46 |
background: #333;
|
47 |
+
/* FF3.6+ */
|
48 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#565656), color-stop(100%,#333));
|
49 |
+
/* Chrome,Safari4+ */
|
50 |
+
background: -webkit-linear-gradient(top, #565656 0%,#333 100%);
|
51 |
+
/* Chrome10+,Safari5.1+ */ /* Opera 11.10+ */ /* IE10+ */
|
52 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#565656),to(#333));
|
53 |
+
background: linear-gradient(to bottom, #565656 0%,#333 100%);
|
54 |
+
text-align: center;
|
55 |
+
-webkit-transition: all 200ms ease-in-out;
|
56 |
+
transition: all 200ms ease-in-out;
|
57 |
+
/* W3C */
|
58 |
+
|
59 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#565656', endColorstr='#333333',GradientType=0 );
|
60 |
}
|
61 |
+
|
62 |
.theme-bar:hover .nivo-controlNav {
|
63 |
+
bottom: 0;
|
64 |
+
opacity: 1;
|
65 |
}
|
66 |
+
|
67 |
.theme-bar .nivo-controlNav a {
|
68 |
+
display: inline-block;
|
69 |
+
width: 22px;
|
70 |
+
height: 22px;
|
|
|
|
|
|
|
71 |
margin: 5px 2px 0 2px;
|
72 |
+
border: 0;
|
73 |
+
background: url(bullets.png) no-repeat;
|
74 |
+
text-indent: -9999px;
|
75 |
}
|
76 |
+
|
77 |
.theme-bar .nivo-controlNav a.active {
|
78 |
+
background-position: 0 -22px;
|
79 |
}
|
80 |
|
81 |
.theme-bar .nivo-directionNav a {
|
82 |
+
display: block;
|
83 |
+
z-index: 11;
|
|
|
|
|
84 |
top: auto;
|
85 |
bottom: 10px;
|
86 |
+
border: 0;
|
87 |
+
opacity: 0.5;
|
88 |
+
color: #fff;
|
89 |
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
90 |
font-size: 13px;
|
91 |
line-height: 20px;
|
92 |
+
text-transform: uppercase;
|
93 |
+
-webkit-transition: all 200ms ease-in-out;
|
94 |
+
transition: all 200ms ease-in-out;
|
95 |
+
}
|
96 |
+
|
97 |
+
.theme-bar a.nivo-nextNav {
|
98 |
+
right: -50px;
|
99 |
+
}
|
100 |
+
|
101 |
+
.theme-bar a.nivo-prevNav {
|
102 |
+
left: -50px;
|
103 |
}
|
104 |
+
|
105 |
+
.theme-bar:hover a.nivo-nextNav {
|
106 |
+
right: 15px;
|
107 |
+
opacity: 1;
|
|
|
108 |
}
|
109 |
+
|
110 |
+
.theme-bar:hover a.nivo-prevNav {
|
111 |
+
left: 15px;
|
112 |
+
opacity: 1;
|
113 |
+
}
|
114 |
+
|
115 |
+
.theme-bar .nivo-directionNav a:hover {
|
116 |
+
color: #ddd;
|
117 |
}
|
|
|
118 |
|
119 |
.theme-bar .nivo-caption {
|
120 |
+
font-family: Helvetica, Arial, sans-serif;
|
121 |
+
-webkit-transition: all 200ms ease-in-out;
|
122 |
+
transition: all 200ms ease-in-out;
|
|
|
|
|
123 |
}
|
124 |
+
|
125 |
.theme-bar:hover .nivo-caption {
|
126 |
+
bottom: 41px;
|
127 |
}
|
128 |
+
|
129 |
.theme-bar .nivo-caption a {
|
130 |
+
border-bottom: 1px dotted #fff;
|
131 |
+
color: #fff;
|
132 |
}
|
133 |
+
|
134 |
.theme-bar .nivo-caption a:hover {
|
135 |
+
color: #fff;
|
136 |
}
|
137 |
|
138 |
.theme-bar .nivo-controlNav.nivo-thumbs-enabled {
|
139 |
width: 100%;
|
140 |
}
|
141 |
+
|
142 |
.theme-bar .nivo-controlNav.nivo-thumbs-enabled a {
|
143 |
width: auto;
|
144 |
height: auto;
|
|
|
145 |
margin-bottom: 5px;
|
146 |
+
background: none;
|
147 |
}
|
148 |
+
|
149 |
.theme-bar .nivo-controlNav.nivo-thumbs-enabled img {
|
150 |
display: block;
|
151 |
width: 120px;
|
152 |
height: auto;
|
153 |
+
}
|
assets/themes/dark/dark.css
CHANGED
@@ -9,95 +9,105 @@ Supports Thumbs: true
|
|
9 |
*/
|
10 |
|
11 |
.theme-dark.slider-wrapper {
|
12 |
-
|
13 |
-
|
14 |
}
|
|
|
15 |
.theme-dark .nivoSlider {
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
}
|
|
|
21 |
.theme-dark .nivoSlider img {
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
max-width: none !important;
|
27 |
}
|
|
|
28 |
.theme-dark .nivoSlider a {
|
29 |
-
|
30 |
-
|
31 |
}
|
32 |
|
33 |
.theme-dark .nivo-controlNav {
|
34 |
-
text-align: left;
|
35 |
-
padding: 0;
|
36 |
position: relative;
|
37 |
z-index: 10;
|
|
|
|
|
38 |
}
|
|
|
39 |
.theme-dark .nivo-controlNav a {
|
40 |
-
display:inline-block;
|
41 |
-
width:10px;
|
42 |
-
height:10px;
|
43 |
-
background:url(bullets.png) no-repeat 0 2px;
|
44 |
-
text-indent:-9999px;
|
45 |
-
border:0;
|
46 |
margin: 0 2px;
|
|
|
|
|
|
|
47 |
}
|
|
|
48 |
.theme-dark .nivo-controlNav a.active {
|
49 |
-
background-position:0 100%;
|
50 |
}
|
51 |
|
52 |
.theme-dark .nivo-directionNav a {
|
53 |
-
display:block;
|
54 |
-
|
55 |
-
height:30px;
|
56 |
-
background: url(arrows.png) no-repeat;
|
57 |
-
text-indent:-9999px;
|
58 |
-
border:0;
|
59 |
top: auto;
|
60 |
bottom: -36px;
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
}
|
|
|
63 |
.theme-dark .nivo-directionNav a:hover {
|
64 |
-
|
65 |
-
|
66 |
-
-moz-border-radius: 2px;
|
67 |
-
border-radius: 2px;
|
68 |
}
|
|
|
69 |
.theme-dark a.nivo-nextNav {
|
70 |
-
|
71 |
-
|
72 |
}
|
|
|
73 |
.theme-dark a.nivo-prevNav {
|
74 |
-
background-position:11px 50%;
|
75 |
-
left: auto;
|
76 |
right: 35px;
|
|
|
|
|
77 |
}
|
78 |
|
79 |
.theme-dark .nivo-caption {
|
80 |
-
|
81 |
}
|
|
|
82 |
.theme-dark .nivo-caption a {
|
83 |
-
|
84 |
-
|
85 |
}
|
|
|
86 |
.theme-dark .nivo-caption a:hover {
|
87 |
-
|
88 |
}
|
89 |
|
90 |
.theme-dark .nivo-controlNav.nivo-thumbs-enabled {
|
91 |
width: 80%;
|
92 |
}
|
|
|
93 |
.theme-dark .nivo-controlNav.nivo-thumbs-enabled a {
|
94 |
width: auto;
|
95 |
height: auto;
|
96 |
-
background: none;
|
97 |
margin-bottom: 5px;
|
|
|
98 |
}
|
|
|
99 |
.theme-dark .nivo-controlNav.nivo-thumbs-enabled img {
|
100 |
display: block;
|
101 |
width: 120px;
|
102 |
height: auto;
|
103 |
-
}
|
9 |
*/
|
10 |
|
11 |
.theme-dark.slider-wrapper {
|
12 |
+
padding: 10px;
|
13 |
+
background: #222;
|
14 |
}
|
15 |
+
|
16 |
.theme-dark .nivoSlider {
|
17 |
+
overflow: visible;
|
18 |
+
position: relative;
|
19 |
+
margin-bottom: 10px;
|
20 |
+
background: #fff url(loading.gif) no-repeat 50% 50%;
|
21 |
}
|
22 |
+
|
23 |
.theme-dark .nivoSlider img {
|
24 |
+
display: none;
|
25 |
+
position: absolute;
|
26 |
+
top: 0;
|
27 |
+
left: 0;
|
28 |
max-width: none !important;
|
29 |
}
|
30 |
+
|
31 |
.theme-dark .nivoSlider a {
|
32 |
+
display: block;
|
33 |
+
border: 0;
|
34 |
}
|
35 |
|
36 |
.theme-dark .nivo-controlNav {
|
|
|
|
|
37 |
position: relative;
|
38 |
z-index: 10;
|
39 |
+
padding: 0;
|
40 |
+
text-align: left;
|
41 |
}
|
42 |
+
|
43 |
.theme-dark .nivo-controlNav a {
|
44 |
+
display: inline-block;
|
45 |
+
width: 10px;
|
46 |
+
height: 10px;
|
|
|
|
|
|
|
47 |
margin: 0 2px;
|
48 |
+
border: 0;
|
49 |
+
background: url(bullets.png) no-repeat 0 2px;
|
50 |
+
text-indent: -9999px;
|
51 |
}
|
52 |
+
|
53 |
.theme-dark .nivo-controlNav a.active {
|
54 |
+
background-position: 0 100%;
|
55 |
}
|
56 |
|
57 |
.theme-dark .nivo-directionNav a {
|
58 |
+
display: block;
|
59 |
+
z-index: 11;
|
|
|
|
|
|
|
|
|
60 |
top: auto;
|
61 |
bottom: -36px;
|
62 |
+
width: 30px;
|
63 |
+
height: 30px;
|
64 |
+
border: 0;
|
65 |
+
background: url(arrows.png) no-repeat;
|
66 |
+
text-indent: -9999px;
|
67 |
}
|
68 |
+
|
69 |
.theme-dark .nivo-directionNav a:hover {
|
70 |
+
border-radius: 2px;
|
71 |
+
background-color: #333;
|
|
|
|
|
72 |
}
|
73 |
+
|
74 |
.theme-dark a.nivo-nextNav {
|
75 |
+
right: 0;
|
76 |
+
background-position: -16px 50%;
|
77 |
}
|
78 |
+
|
79 |
.theme-dark a.nivo-prevNav {
|
|
|
|
|
80 |
right: 35px;
|
81 |
+
left: auto;
|
82 |
+
background-position: 11px 50%;
|
83 |
}
|
84 |
|
85 |
.theme-dark .nivo-caption {
|
86 |
+
font-family: Helvetica, Arial, sans-serif;
|
87 |
}
|
88 |
+
|
89 |
.theme-dark .nivo-caption a {
|
90 |
+
border-bottom: 1px dotted #fff;
|
91 |
+
color: #fff;
|
92 |
}
|
93 |
+
|
94 |
.theme-dark .nivo-caption a:hover {
|
95 |
+
color: #fff;
|
96 |
}
|
97 |
|
98 |
.theme-dark .nivo-controlNav.nivo-thumbs-enabled {
|
99 |
width: 80%;
|
100 |
}
|
101 |
+
|
102 |
.theme-dark .nivo-controlNav.nivo-thumbs-enabled a {
|
103 |
width: auto;
|
104 |
height: auto;
|
|
|
105 |
margin-bottom: 5px;
|
106 |
+
background: none;
|
107 |
}
|
108 |
+
|
109 |
.theme-dark .nivo-controlNav.nivo-thumbs-enabled img {
|
110 |
display: block;
|
111 |
width: 120px;
|
112 |
height: auto;
|
113 |
+
}
|
assets/themes/default/default.css
CHANGED
@@ -9,86 +9,96 @@ Supports Thumbs: true
|
|
9 |
*/
|
10 |
|
11 |
.theme-default .nivoSlider {
|
12 |
-
position:relative;
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
box-shadow: 0px 1px 5px 0px #4a4a4a;
|
18 |
}
|
|
|
19 |
.theme-default .nivoSlider img {
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
max-width: none !important;
|
25 |
}
|
|
|
26 |
.theme-default .nivoSlider a {
|
27 |
-
|
28 |
-
|
29 |
}
|
30 |
|
31 |
.theme-default .nivo-controlNav {
|
32 |
-
text-align: center;
|
33 |
padding: 20px 0;
|
|
|
34 |
}
|
|
|
35 |
.theme-default .nivo-controlNav a {
|
36 |
-
display:inline-block;
|
37 |
-
width:22px;
|
38 |
-
height:22px;
|
39 |
-
background:url(bullets.png) no-repeat;
|
40 |
-
text-indent:-9999px;
|
41 |
-
border:0;
|
42 |
margin: 0 2px;
|
|
|
|
|
|
|
43 |
}
|
|
|
44 |
.theme-default .nivo-controlNav a.active {
|
45 |
-
background-position:0 -22px;
|
46 |
}
|
47 |
|
48 |
.theme-default .nivo-directionNav a {
|
49 |
-
display:block;
|
50 |
-
width:30px;
|
51 |
-
height:30px;
|
52 |
-
|
53 |
-
text-indent:-9999px;
|
54 |
-
border:0;
|
55 |
opacity: 0;
|
|
|
|
|
56 |
-webkit-transition: all 200ms ease-in-out;
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
60 |
}
|
61 |
-
|
62 |
.theme-default a.nivo-nextNav {
|
63 |
-
|
64 |
-
|
65 |
}
|
|
|
66 |
.theme-default a.nivo-prevNav {
|
67 |
-
left:15px;
|
68 |
}
|
69 |
|
70 |
.theme-default .nivo-caption {
|
71 |
-
|
72 |
}
|
|
|
73 |
.theme-default .nivo-caption a {
|
74 |
-
|
75 |
-
|
76 |
}
|
|
|
77 |
.theme-default .nivo-caption a:hover {
|
78 |
-
|
79 |
}
|
80 |
|
81 |
.theme-default .nivo-controlNav.nivo-thumbs-enabled {
|
82 |
width: 100%;
|
83 |
}
|
|
|
84 |
.theme-default .nivo-controlNav.nivo-thumbs-enabled a {
|
85 |
width: auto;
|
86 |
height: auto;
|
87 |
-
background: none;
|
88 |
margin-bottom: 5px;
|
|
|
89 |
}
|
|
|
90 |
.theme-default .nivo-controlNav.nivo-thumbs-enabled img {
|
91 |
display: block;
|
92 |
width: 120px;
|
93 |
height: auto;
|
94 |
-
}
|
9 |
*/
|
10 |
|
11 |
.theme-default .nivoSlider {
|
12 |
+
position: relative;
|
13 |
+
margin-bottom: 10px;
|
14 |
+
background: #fff url(loading.gif) no-repeat 50% 50%;
|
15 |
+
-webkit-box-shadow: 0 1px 5px 0 #4a4a4a;
|
16 |
+
box-shadow: 0 1px 5px 0 #4a4a4a;
|
|
|
17 |
}
|
18 |
+
|
19 |
.theme-default .nivoSlider img {
|
20 |
+
display: none;
|
21 |
+
position: absolute;
|
22 |
+
top: 0;
|
23 |
+
left: 0;
|
24 |
max-width: none !important;
|
25 |
}
|
26 |
+
|
27 |
.theme-default .nivoSlider a {
|
28 |
+
display: block;
|
29 |
+
border: 0;
|
30 |
}
|
31 |
|
32 |
.theme-default .nivo-controlNav {
|
|
|
33 |
padding: 20px 0;
|
34 |
+
text-align: center;
|
35 |
}
|
36 |
+
|
37 |
.theme-default .nivo-controlNav a {
|
38 |
+
display: inline-block;
|
39 |
+
width: 22px;
|
40 |
+
height: 22px;
|
|
|
|
|
|
|
41 |
margin: 0 2px;
|
42 |
+
border: 0;
|
43 |
+
background: url(bullets.png) no-repeat;
|
44 |
+
text-indent: -9999px;
|
45 |
}
|
46 |
+
|
47 |
.theme-default .nivo-controlNav a.active {
|
48 |
+
background-position: 0 -22px;
|
49 |
}
|
50 |
|
51 |
.theme-default .nivo-directionNav a {
|
52 |
+
display: block;
|
53 |
+
width: 30px;
|
54 |
+
height: 30px;
|
55 |
+
border: 0;
|
|
|
|
|
56 |
opacity: 0;
|
57 |
+
background: url(arrows.png) no-repeat;
|
58 |
+
text-indent: -9999px;
|
59 |
-webkit-transition: all 200ms ease-in-out;
|
60 |
+
transition: all 200ms ease-in-out;
|
61 |
+
}
|
62 |
+
|
63 |
+
.theme-default:hover .nivo-directionNav a {
|
64 |
+
opacity: 1;
|
65 |
}
|
66 |
+
|
67 |
.theme-default a.nivo-nextNav {
|
68 |
+
right: 15px;
|
69 |
+
background-position: -30px 0;
|
70 |
}
|
71 |
+
|
72 |
.theme-default a.nivo-prevNav {
|
73 |
+
left: 15px;
|
74 |
}
|
75 |
|
76 |
.theme-default .nivo-caption {
|
77 |
+
font-family: Helvetica, Arial, sans-serif;
|
78 |
}
|
79 |
+
|
80 |
.theme-default .nivo-caption a {
|
81 |
+
border-bottom: 1px dotted #fff;
|
82 |
+
color: #fff;
|
83 |
}
|
84 |
+
|
85 |
.theme-default .nivo-caption a:hover {
|
86 |
+
color: #fff;
|
87 |
}
|
88 |
|
89 |
.theme-default .nivo-controlNav.nivo-thumbs-enabled {
|
90 |
width: 100%;
|
91 |
}
|
92 |
+
|
93 |
.theme-default .nivo-controlNav.nivo-thumbs-enabled a {
|
94 |
width: auto;
|
95 |
height: auto;
|
|
|
96 |
margin-bottom: 5px;
|
97 |
+
background: none;
|
98 |
}
|
99 |
+
|
100 |
.theme-default .nivo-controlNav.nivo-thumbs-enabled img {
|
101 |
display: block;
|
102 |
width: 120px;
|
103 |
height: auto;
|
104 |
+
}
|
assets/themes/light/light.css
CHANGED
@@ -9,95 +9,105 @@ Supports Thumbs: true
|
|
9 |
*/
|
10 |
|
11 |
.theme-light.slider-wrapper {
|
12 |
-
|
13 |
-
|
14 |
}
|
|
|
15 |
.theme-light .nivoSlider {
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
}
|
|
|
21 |
.theme-light .nivoSlider img {
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
max-width: none !important;
|
27 |
}
|
|
|
28 |
.theme-light .nivoSlider a {
|
29 |
-
|
30 |
-
|
31 |
}
|
32 |
|
33 |
.theme-light .nivo-controlNav {
|
34 |
-
text-align: left;
|
35 |
-
padding: 0;
|
36 |
position: relative;
|
37 |
z-index: 10;
|
|
|
|
|
38 |
}
|
|
|
39 |
.theme-light .nivo-controlNav a {
|
40 |
-
display:inline-block;
|
41 |
-
width:10px;
|
42 |
-
height:10px;
|
43 |
-
background:url(bullets.png) no-repeat;
|
44 |
-
text-indent:-9999px;
|
45 |
-
border:0;
|
46 |
margin: 0 2px;
|
|
|
|
|
|
|
47 |
}
|
|
|
48 |
.theme-light .nivo-controlNav a.active {
|
49 |
-
background-position:0 100%;
|
50 |
}
|
51 |
|
52 |
.theme-light .nivo-directionNav a {
|
53 |
-
display:block;
|
54 |
-
|
55 |
-
height:30px;
|
56 |
-
background: url(arrows.png) no-repeat;
|
57 |
-
text-indent:-9999px;
|
58 |
-
border:0;
|
59 |
top: auto;
|
60 |
bottom: -36px;
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
}
|
|
|
63 |
.theme-light .nivo-directionNav a:hover {
|
64 |
-
|
65 |
-
|
66 |
-
-moz-border-radius: 2px;
|
67 |
-
border-radius: 2px;
|
68 |
}
|
|
|
69 |
.theme-light a.nivo-nextNav {
|
70 |
-
|
71 |
-
|
72 |
}
|
|
|
73 |
.theme-light a.nivo-prevNav {
|
74 |
-
background-position:-60% 50%;
|
75 |
-
left: auto;
|
76 |
right: 35px;
|
|
|
|
|
77 |
}
|
78 |
|
79 |
.theme-light .nivo-caption {
|
80 |
-
|
81 |
}
|
|
|
82 |
.theme-light .nivo-caption a {
|
83 |
-
|
84 |
-
|
85 |
}
|
|
|
86 |
.theme-light .nivo-caption a:hover {
|
87 |
-
|
88 |
}
|
89 |
|
90 |
.theme-light .nivo-controlNav.nivo-thumbs-enabled {
|
91 |
width: 80%;
|
92 |
}
|
|
|
93 |
.theme-light .nivo-controlNav.nivo-thumbs-enabled a {
|
94 |
width: auto;
|
95 |
height: auto;
|
96 |
-
background: none;
|
97 |
margin-bottom: 5px;
|
|
|
98 |
}
|
|
|
99 |
.theme-light .nivo-controlNav.nivo-thumbs-enabled img {
|
100 |
display: block;
|
101 |
width: 120px;
|
102 |
height: auto;
|
103 |
-
}
|
9 |
*/
|
10 |
|
11 |
.theme-light.slider-wrapper {
|
12 |
+
padding: 10px;
|
13 |
+
background: #fff;
|
14 |
}
|
15 |
+
|
16 |
.theme-light .nivoSlider {
|
17 |
+
overflow: visible;
|
18 |
+
position: relative;
|
19 |
+
margin-bottom: 10px;
|
20 |
+
background: #fff url(loading.gif) no-repeat 50% 50%;
|
21 |
}
|
22 |
+
|
23 |
.theme-light .nivoSlider img {
|
24 |
+
display: none;
|
25 |
+
position: absolute;
|
26 |
+
top: 0;
|
27 |
+
left: 0;
|
28 |
max-width: none !important;
|
29 |
}
|
30 |
+
|
31 |
.theme-light .nivoSlider a {
|
32 |
+
display: block;
|
33 |
+
border: 0;
|
34 |
}
|
35 |
|
36 |
.theme-light .nivo-controlNav {
|
|
|
|
|
37 |
position: relative;
|
38 |
z-index: 10;
|
39 |
+
padding: 0;
|
40 |
+
text-align: left;
|
41 |
}
|
42 |
+
|
43 |
.theme-light .nivo-controlNav a {
|
44 |
+
display: inline-block;
|
45 |
+
width: 10px;
|
46 |
+
height: 10px;
|
|
|
|
|
|
|
47 |
margin: 0 2px;
|
48 |
+
border: 0;
|
49 |
+
background: url(bullets.png) no-repeat;
|
50 |
+
text-indent: -9999px;
|
51 |
}
|
52 |
+
|
53 |
.theme-light .nivo-controlNav a.active {
|
54 |
+
background-position: 0 100%;
|
55 |
}
|
56 |
|
57 |
.theme-light .nivo-directionNav a {
|
58 |
+
display: block;
|
59 |
+
z-index: 11;
|
|
|
|
|
|
|
|
|
60 |
top: auto;
|
61 |
bottom: -36px;
|
62 |
+
width: 30px;
|
63 |
+
height: 30px;
|
64 |
+
border: 0;
|
65 |
+
background: url(arrows.png) no-repeat;
|
66 |
+
text-indent: -9999px;
|
67 |
}
|
68 |
+
|
69 |
.theme-light .nivo-directionNav a:hover {
|
70 |
+
border-radius: 2px;
|
71 |
+
background-color: #eee;
|
|
|
|
|
72 |
}
|
73 |
+
|
74 |
.theme-light a.nivo-nextNav {
|
75 |
+
right: 0;
|
76 |
+
background-position: 160% 50%;
|
77 |
}
|
78 |
+
|
79 |
.theme-light a.nivo-prevNav {
|
|
|
|
|
80 |
right: 35px;
|
81 |
+
left: auto;
|
82 |
+
background-position: -60% 50%;
|
83 |
}
|
84 |
|
85 |
.theme-light .nivo-caption {
|
86 |
+
font-family: Helvetica, Arial, sans-serif;
|
87 |
}
|
88 |
+
|
89 |
.theme-light .nivo-caption a {
|
90 |
+
border-bottom: 1px dotted #fff;
|
91 |
+
color: #fff;
|
92 |
}
|
93 |
+
|
94 |
.theme-light .nivo-caption a:hover {
|
95 |
+
color: #fff;
|
96 |
}
|
97 |
|
98 |
.theme-light .nivo-controlNav.nivo-thumbs-enabled {
|
99 |
width: 80%;
|
100 |
}
|
101 |
+
|
102 |
.theme-light .nivo-controlNav.nivo-thumbs-enabled a {
|
103 |
width: auto;
|
104 |
height: auto;
|
|
|
105 |
margin-bottom: 5px;
|
106 |
+
background: none;
|
107 |
}
|
108 |
+
|
109 |
.theme-light .nivo-controlNav.nivo-thumbs-enabled img {
|
110 |
display: block;
|
111 |
width: 120px;
|
112 |
height: auto;
|
113 |
+
}
|
includes/abstract/class-nivo-core-abstract.php
ADDED
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The Core Abstract Class for Nivo.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/abstract
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The abstract core functionality of the plugin.
|
14 |
+
*
|
15 |
+
* Defines the plugin name, version, and two examples hooks for how to
|
16 |
+
* enqueue the admin-specific stylesheet and JavaScript.
|
17 |
+
*
|
18 |
+
* @package nivo-slider
|
19 |
+
* @subpackage nivo-slider/includes/abstract
|
20 |
+
* @author ThemeIsle <friends@themeisle.com>
|
21 |
+
*/
|
22 |
+
abstract class Nivo_Core_Abstract extends Nivo_Core_Settings_Abstract {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @since 3.0.0
|
26 |
+
* @access protected
|
27 |
+
* @var $labels The labels array defined in $plugin_settings.
|
28 |
+
*/
|
29 |
+
protected $labels;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @since 3.0.0
|
33 |
+
* @access protected
|
34 |
+
* @var $is_lite The lite flag defined in $plugin_settings.
|
35 |
+
*/
|
36 |
+
protected $is_lite;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Main construct
|
40 |
+
*
|
41 |
+
* @since 3.0.0
|
42 |
+
* @access public
|
43 |
+
*/
|
44 |
+
public function __construct() {
|
45 |
+
$plugin_settings = self::get_plugin_settings();
|
46 |
+
$labels = $plugin_settings->get_labels();
|
47 |
+
if ( isset( $plugin_settings ) && ! empty( $labels ) ) {
|
48 |
+
$this->labels = $plugin_settings->get_labels();
|
49 |
+
$this->is_lite = $plugin_settings->get_lite();
|
50 |
+
}
|
51 |
+
$this->after_core_construct();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Use this instead of overriding __construct
|
56 |
+
*
|
57 |
+
* @since 3.0.0
|
58 |
+
* @access public
|
59 |
+
*/
|
60 |
+
public function after_core_construct() {}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Checks if Media Manager Plus is installed and active
|
64 |
+
*
|
65 |
+
* @since 2.2.*
|
66 |
+
* @access public
|
67 |
+
* @return boolean
|
68 |
+
*/
|
69 |
+
public function nivo_mmp_active() {
|
70 |
+
$mmp_path = 'uber-media/uber-media.php';
|
71 |
+
|
72 |
+
return $this->nivo_plugin_is_active( $mmp_path );
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Default value helper function
|
77 |
+
*
|
78 |
+
* @since 2.2.*
|
79 |
+
* @access public
|
80 |
+
* @param array $options The options array.
|
81 |
+
* @param mixed $value The value of options.
|
82 |
+
* @param string $default The default.
|
83 |
+
*
|
84 |
+
* @return string
|
85 |
+
*/
|
86 |
+
public function nivo_default_val( $options, $value, $default = '' ) {
|
87 |
+
if ( ! isset( $options[ $value ] ) ) {
|
88 |
+
return $default;
|
89 |
+
} else {
|
90 |
+
return $options[ $value ];
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Checks if a plugin is installed and active
|
96 |
+
*
|
97 |
+
* @since 2.2.*
|
98 |
+
* @access public
|
99 |
+
* @param array $plugin The plugins array.
|
100 |
+
* @return boolean
|
101 |
+
*/
|
102 |
+
public function nivo_plugin_is_active( $plugin ) {
|
103 |
+
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) );
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Checks if a license for the plugin has been set as a constant
|
108 |
+
*
|
109 |
+
* @since 2.2.*
|
110 |
+
* @access public
|
111 |
+
* @return boolean
|
112 |
+
*/
|
113 |
+
public function nivo_license_constant( $post_type ) {
|
114 |
+
return apply_filters( $post_type . '_check_license_constant', false );
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Returns the license key for the plugin
|
119 |
+
*
|
120 |
+
* @since 2.2.*
|
121 |
+
* @access public
|
122 |
+
* @param string $post_type The post type slug.
|
123 |
+
* @param array $options The options array.
|
124 |
+
* @return string
|
125 |
+
*/
|
126 |
+
public function nivo_get_license_key( $post_type, $options ) {
|
127 |
+
if ( $this->nivo_license_constant( $post_type ) ) {
|
128 |
+
$license = apply_filters( $post_type . '_get_license_constant', '' );
|
129 |
+
} else {
|
130 |
+
$license = $this->nivo_default_val( $options, 'license_key', '' );
|
131 |
+
}
|
132 |
+
return trim( $license );
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Checks to see if content has the plugin shortcode
|
137 |
+
*
|
138 |
+
* @since 2.2.*
|
139 |
+
* @access public
|
140 |
+
* @param string $content The content to check.
|
141 |
+
* @param string $shortcode The shortcode to look for.
|
142 |
+
* @return boolean
|
143 |
+
*/
|
144 |
+
public function nivo_has_shortcode_wrap( $content, $shortcode = '' ) {
|
145 |
+
|
146 |
+
if ( function_exists( 'has_shortcode' ) ) {
|
147 |
+
return has_shortcode( $content, $shortcode );
|
148 |
+
}
|
149 |
+
|
150 |
+
$found = false;
|
151 |
+
|
152 |
+
if ( ! $shortcode ) {
|
153 |
+
return $found;
|
154 |
+
}
|
155 |
+
|
156 |
+
if ( stripos( $content, '[' . $shortcode ) !== false ) {
|
157 |
+
$found = true;
|
158 |
+
}
|
159 |
+
|
160 |
+
return $found;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Returns the images attached to a [gallery] post
|
165 |
+
*
|
166 |
+
* @since 2.2.*
|
167 |
+
* @access public
|
168 |
+
* @param string $post_id The post ID.
|
169 |
+
* @param integer $limit The limit param.
|
170 |
+
* @return array
|
171 |
+
*/
|
172 |
+
public function nivo_get_attached_images( $post_id, $limit ) {
|
173 |
+
$args = array(
|
174 |
+
'orderby' => 'menu_order ID',
|
175 |
+
'order' => 'ASC',
|
176 |
+
'post_type' => 'attachment',
|
177 |
+
'post_parent' => $post_id,
|
178 |
+
'post_mime_type' => 'image',
|
179 |
+
'post_status' => null,
|
180 |
+
'numberposts' => $limit,
|
181 |
+
);
|
182 |
+
|
183 |
+
return get_posts( $args );
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Gets the [gallery] images attached as a gallery or just attached the to the post
|
188 |
+
*
|
189 |
+
* @since 2.2.*
|
190 |
+
* @access public
|
191 |
+
* @param string $post The post ID.
|
192 |
+
* @param integer $limit The limit param.
|
193 |
+
* @return array
|
194 |
+
*/
|
195 |
+
public function nivo_grab_attachment_ids_from_gallery( $post, $limit ) {
|
196 |
+
if ( ! $post = get_post( $post ) ) {
|
197 |
+
return array();
|
198 |
+
}
|
199 |
+
|
200 |
+
if ( ! $this->nivo_has_shortcode_wrap( $post->post_content, 'gallery' ) ) {
|
201 |
+
return $this->nivo_get_attached_images( $post->ID, $limit );
|
202 |
+
}
|
203 |
+
|
204 |
+
$count = 0;
|
205 |
+
$attachments = array();
|
206 |
+
if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER ) ) {
|
207 |
+
foreach ( $matches as $shortcode ) {
|
208 |
+
if ( 'gallery' === $shortcode[2] ) {
|
209 |
+
$atts = shortcode_parse_atts( $shortcode[3] );
|
210 |
+
if ( isset( $atts['ids'] ) ) {
|
211 |
+
$attachment_ids = explode( ',', $atts['ids'] );
|
212 |
+
}
|
213 |
+
foreach ( $attachment_ids as $att_id ) {
|
214 |
+
$count ++;
|
215 |
+
if ( $limit != - 1 && $count > $limit ) {
|
216 |
+
break;
|
217 |
+
}
|
218 |
+
$attachment = new stdClass();
|
219 |
+
$attachment->ID = $att_id;
|
220 |
+
$attachments[] = $attachment;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
return $attachments;
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Get Nivo themes and any custom themes from uploads/nivo-themes/
|
231 |
+
*
|
232 |
+
* @since 2.2.*
|
233 |
+
* @access protected
|
234 |
+
* @param bool $select A flag to toggle select.
|
235 |
+
* @return array
|
236 |
+
*/
|
237 |
+
protected function get_themes( $select = false ) {
|
238 |
+
$nivo_theme_specs = array(
|
239 |
+
'SkinName' => 'Skin Name',
|
240 |
+
'SkinURI' => 'Skin URI',
|
241 |
+
'Description' => 'Description',
|
242 |
+
'Version' => 'Version',
|
243 |
+
'Author' => 'Author',
|
244 |
+
'AuthorURI' => 'Author URI',
|
245 |
+
'SupportsThumbs' => 'Supports Thumbs',
|
246 |
+
);
|
247 |
+
|
248 |
+
$plugin_themes = glob( NIVO_SLIDER_PLUGIN_DIR . '/assets/themes/*', GLOB_ONLYDIR );
|
249 |
+
|
250 |
+
$upload_dir = wp_upload_dir();
|
251 |
+
$upload_path = $upload_dir['basedir'];
|
252 |
+
$upload_url = $upload_dir['baseurl'];
|
253 |
+
|
254 |
+
if ( strpos( $upload_path, 'uploads/sites/' ) !== false && is_multisite() ) {
|
255 |
+
$upload_path = substr( $upload_path, 0, strpos( $upload_path, '/sites/' ) );
|
256 |
+
$upload_url = substr( $upload_url, 0, strpos( $upload_url, '/sites/' ) );
|
257 |
+
}
|
258 |
+
$custom_themes = glob( $upload_path . '/nivo-themes/*', GLOB_ONLYDIR );
|
259 |
+
|
260 |
+
if ( ! is_array( $plugin_themes ) ) {
|
261 |
+
$plugin_themes = array();
|
262 |
+
}
|
263 |
+
if ( ! is_array( $custom_themes ) ) {
|
264 |
+
$custom_themes = array();
|
265 |
+
}
|
266 |
+
$nivo_themes = array_merge( $plugin_themes, $custom_themes );
|
267 |
+
|
268 |
+
$themes = array();
|
269 |
+
if ( $nivo_themes ) {
|
270 |
+
foreach ( $nivo_themes as $theme_dir ) {
|
271 |
+
$theme_name = basename( $theme_dir );
|
272 |
+
$theme_path = $theme_dir . '/' . $theme_name . '.css';
|
273 |
+
if ( file_exists( $theme_path ) ) {
|
274 |
+
if ( strpos( $theme_dir, 'uploads/nivo-themes' ) !== false ) {
|
275 |
+
$theme_url = $upload_url . '/nivo-themes/' . $theme_name . '/' . $theme_name . '.css';
|
276 |
+
} else {
|
277 |
+
$theme_url = plugins_url( 'assets/themes/' . $theme_name . '/' . $theme_name . '.css', NIVO_SLIDER_PLUGIN_FILE );
|
278 |
+
}
|
279 |
+
$themes[ $theme_name ] = array(
|
280 |
+
'theme_name' => $theme_name,
|
281 |
+
'theme_path' => $theme_path,
|
282 |
+
'theme_url' => $theme_url,
|
283 |
+
'theme_details' => get_file_data( $theme_path, $nivo_theme_specs ),
|
284 |
+
);
|
285 |
+
}
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
if ( $select ) {
|
290 |
+
$options = array();
|
291 |
+
foreach ( $themes as $theme ) {
|
292 |
+
$options[ $theme['theme_name'] ] = $theme['theme_details']['SkinName'];
|
293 |
+
}
|
294 |
+
|
295 |
+
return $options;
|
296 |
+
}
|
297 |
+
|
298 |
+
return $themes;
|
299 |
+
}
|
300 |
+
}
|
includes/abstract/class-nivo-core-settings-abstract.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The Abstract Model functionality of the plugin.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/abstract
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The Abstract Core Settings functionality of the plugin.
|
14 |
+
*
|
15 |
+
* Provides a set of methods to interact with the core settings
|
16 |
+
* defined during initialization.
|
17 |
+
*
|
18 |
+
* @package nivo-slider
|
19 |
+
* @subpackage nivo-slider/includes/abstract
|
20 |
+
* @author ThemeIsle <friends@themeisle.com>
|
21 |
+
*/
|
22 |
+
abstract class Nivo_Core_Settings_Abstract {
|
23 |
+
/**
|
24 |
+
* All of the specific plugin data
|
25 |
+
*
|
26 |
+
* @since 3.0.0
|
27 |
+
* @access protected
|
28 |
+
* @var Nivo_Settings_Interface $plugin_settings Store shared plugin settings.
|
29 |
+
*/
|
30 |
+
protected static $plugin_settings;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Utility method to define the plugin settings.
|
34 |
+
*
|
35 |
+
* @since 3.0.0
|
36 |
+
* @access public
|
37 |
+
* @param Nivo_Settings_Interface $plugin_settings The plugin settings object.
|
38 |
+
*/
|
39 |
+
public static function set_plugin_settings( $plugin_settings ) {
|
40 |
+
self::$plugin_settings = $plugin_settings;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Utility method to retrieve plugin settings.
|
45 |
+
*
|
46 |
+
* @since 3.0.0
|
47 |
+
* @access public
|
48 |
+
* @return Nivo_Settings_Interface
|
49 |
+
*/
|
50 |
+
public static function get_plugin_settings() {
|
51 |
+
return self::$plugin_settings;
|
52 |
+
}
|
53 |
+
}
|
includes/abstract/class-nivo-model-abstract.php
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The Abstract Model functionality of the plugin.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/abstract
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The Abstract Model functionality of the plugin.
|
14 |
+
*
|
15 |
+
* Provides a set of methods to interact with a defined Model
|
16 |
+
* for Nivo Post Type.
|
17 |
+
*
|
18 |
+
* @package nivo-slider
|
19 |
+
* @subpackage nivo-slider/includes/abstract
|
20 |
+
* @author ThemeIsle <friends@themeisle.com>
|
21 |
+
*/
|
22 |
+
abstract class Nivo_Model_Abstract extends Nivo_Core_Settings_Abstract {
|
23 |
+
public $item;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @since 3.0.0
|
27 |
+
* @access protected
|
28 |
+
* @var $labels The labels array defined in $plugin_settings.
|
29 |
+
*/
|
30 |
+
protected $labels;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Nivo_Model_Abstract constructor.
|
34 |
+
* @since 3.0.0
|
35 |
+
* @access public
|
36 |
+
*/
|
37 |
+
public function __construct() {
|
38 |
+
$plugin_settings = self::get_plugin_settings();
|
39 |
+
$labels = $plugin_settings->get_labels();
|
40 |
+
if ( isset( $plugin_settings ) && ! empty( $labels ) ) {
|
41 |
+
$this->labels = $plugin_settings->get_labels();
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Register the custom post type and taxonomy.
|
47 |
+
*
|
48 |
+
* @since 3.0.0
|
49 |
+
* @access public
|
50 |
+
*/
|
51 |
+
public function register() {
|
52 |
+
$defaults = $this->labels;
|
53 |
+
$labels = array(
|
54 |
+
'name' => '%2$s',
|
55 |
+
'singular_name' => '%1$s',
|
56 |
+
'add_new' => __( 'Add New', 'nivo-slider' ),
|
57 |
+
'add_new_item' => __( 'Add New %1$s', 'nivo-slider' ),
|
58 |
+
'edit_item' => __( 'Edit %1$s', 'nivo-slider' ),
|
59 |
+
'new_item' => __( 'New %1$s', 'nivo-slider' ),
|
60 |
+
'all_items' => __( 'All %2$s', 'nivo-slider' ),
|
61 |
+
'view_item' => __( 'View %1$s', 'nivo-slider' ),
|
62 |
+
'search_items' => __( 'Search %2$s', 'nivo-slider' ),
|
63 |
+
'not_found' => __( 'No %2$s found', 'nivo-slider' ),
|
64 |
+
'not_found_in_trash' => __( 'No %2$s found in Trash', 'nivo-slider' ),
|
65 |
+
'parent_item_colon' => '',
|
66 |
+
'menu_name' => '%2$s',
|
67 |
+
);
|
68 |
+
foreach ( $labels as $key => $value ) {
|
69 |
+
$labels[ $key ] = sprintf( $value, $defaults['singular'], $defaults['plural'] );
|
70 |
+
}
|
71 |
+
$labels = apply_filters( $defaults['post_type'] . '_post_type_labels', $labels );
|
72 |
+
$supports = array( 'title', 'thumbnail' );
|
73 |
+
$supports = array_merge( $supports, apply_filters( 'nivo_post_type_supports', array() ) );
|
74 |
+
$post_type_args = array(
|
75 |
+
'labels' => $labels,
|
76 |
+
'public' => false,
|
77 |
+
'show_ui' => true,
|
78 |
+
'menu_position' => apply_filters( $defaults['post_type'] . '_post_type_menu_position', 100 ),
|
79 |
+
'supports' => $supports,
|
80 |
+
'menu_icon' => apply_filters( $defaults['post_type'] . '_post_type_menu_icon', '' ),
|
81 |
+
);
|
82 |
+
register_post_type(
|
83 |
+
$this->labels['post_type'],
|
84 |
+
apply_filters(
|
85 |
+
$defaults['post_type'] . '_post_type_args',
|
86 |
+
$post_type_args
|
87 |
+
)
|
88 |
+
);
|
89 |
+
register_taxonomy(
|
90 |
+
$defaults['taxonomy'],
|
91 |
+
$defaults['post_type'],
|
92 |
+
array(
|
93 |
+
'label' => $defaults['singular'],
|
94 |
+
'public' => false,
|
95 |
+
'rewrite' => false,
|
96 |
+
'hierarchical' => true,
|
97 |
+
)
|
98 |
+
);
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Amend the settings of the [gallery] post before saving
|
103 |
+
*
|
104 |
+
* @since 2.2.*
|
105 |
+
* @updated 3.0.0
|
106 |
+
* @access public
|
107 |
+
*
|
108 |
+
* @param integer $post_id Post ID.
|
109 |
+
*
|
110 |
+
* @return boolean
|
111 |
+
*/
|
112 |
+
public function save_post( $post_id ) {
|
113 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
114 |
+
return false;
|
115 |
+
} elseif ( ! isset( $_POST[ $this->labels['post_type'] . '_noncename' ] ) || ! wp_verify_nonce( $_POST[ $this->labels['post_type'] . '_noncename' ], $this->labels['plugin_name'] ) ) {
|
116 |
+
return false;
|
117 |
+
} elseif ( 'page' == $_POST['post_type'] && ! current_user_can( 'edit_page', $post_id ) ) {
|
118 |
+
return false;
|
119 |
+
} elseif ( ! current_user_can( 'edit_post', $post_id ) ) {
|
120 |
+
return false;
|
121 |
+
} else {
|
122 |
+
// Good to go
|
123 |
+
$settings = $_POST[ $this->labels['post_meta_key'] ];
|
124 |
+
$settings = apply_filters( $this->labels['post_type'] . '_post_meta_save', $settings );
|
125 |
+
update_post_meta( $post_id, $this->labels['post_meta_key'], $settings );
|
126 |
+
|
127 |
+
return true;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Custom post-meta settings saving logic.
|
133 |
+
* Inherited from v2.2.*.
|
134 |
+
*
|
135 |
+
* @since 3.0.0
|
136 |
+
* @access public
|
137 |
+
*
|
138 |
+
* @param array $settings The settings array.
|
139 |
+
*
|
140 |
+
* @return array
|
141 |
+
*/
|
142 |
+
public function save_post_meta( $settings ) {
|
143 |
+
if ( ! is_numeric( $settings['dim_x'] ) || $settings['dim_x'] <= 0 ) {
|
144 |
+
$settings['dim_x'] = 400;
|
145 |
+
}
|
146 |
+
if ( ! is_numeric( $settings['dim_y'] ) || $settings['dim_y'] <= 0 ) {
|
147 |
+
$settings['dim_y'] = 150;
|
148 |
+
}
|
149 |
+
if ( ! is_numeric( $settings['slices'] ) || $settings['slices'] <= 0 ) {
|
150 |
+
$settings['slices'] = 15;
|
151 |
+
}
|
152 |
+
if ( ! is_numeric( $settings['boxCols'] ) || $settings['boxCols'] <= 0 ) {
|
153 |
+
$settings['boxCols'] = 8;
|
154 |
+
}
|
155 |
+
if ( ! is_numeric( $settings['boxRows'] ) || $settings['boxRows'] <= 0 ) {
|
156 |
+
$settings['boxRows'] = 4;
|
157 |
+
}
|
158 |
+
if ( ! is_numeric( $settings['animSpeed'] ) || $settings['animSpeed'] <= 0 ) {
|
159 |
+
$settings['animSpeed'] = 500;
|
160 |
+
}
|
161 |
+
if ( ! is_numeric( $settings['pauseTime'] ) || $settings['pauseTime'] <= 0 ) {
|
162 |
+
$settings['pauseTime'] = 3000;
|
163 |
+
}
|
164 |
+
if ( ! is_numeric( $settings['startSlide'] ) || $settings['startSlide'] < 0 ) {
|
165 |
+
$settings['startSlide'] = 0;
|
166 |
+
}
|
167 |
+
if ( ! is_numeric( $settings['thumbSizeWidth'] ) || $settings['thumbSizeWidth'] <= 0 ) {
|
168 |
+
$settings['thumbSizeWidth'] = 70;
|
169 |
+
}
|
170 |
+
if ( ! is_numeric( $settings['thumbSizeHeight'] ) || $settings['thumbSizeHeight'] <= 0 ) {
|
171 |
+
$settings['thumbSizeHeight'] = 50;
|
172 |
+
}
|
173 |
+
|
174 |
+
return $settings;
|
175 |
+
}
|
176 |
+
|
177 |
+
}
|
includes/admin/class-nivo-slider-admin.php
ADDED
@@ -0,0 +1,662 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The admin-specific functionality of the plugin.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/admin
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The admin-specific functionality of the plugin.
|
14 |
+
*
|
15 |
+
* Defines the plugin name, version, and two examples hooks for how to
|
16 |
+
* enqueue the admin-specific stylesheet and JavaScript.
|
17 |
+
*
|
18 |
+
* @package nivo-slider
|
19 |
+
* @subpackage nivo-slider/includes/admin
|
20 |
+
* @author ThemeIsle <friends@themeisle.com>
|
21 |
+
*/
|
22 |
+
class Nivo_Slider_Admin extends Nivo_Core_Abstract {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The ID of this plugin.
|
26 |
+
*
|
27 |
+
* @since 3.0.0
|
28 |
+
* @access private
|
29 |
+
* @var string $plugin_name The ID of this plugin.
|
30 |
+
*/
|
31 |
+
private $plugin_name;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The version of this plugin.
|
35 |
+
*
|
36 |
+
* @since 3.0.0
|
37 |
+
* @access private
|
38 |
+
* @var string $version The current version of this plugin.
|
39 |
+
*/
|
40 |
+
private $version;
|
41 |
+
|
42 |
+
private $options;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Initialize the class and set its properties.
|
46 |
+
*
|
47 |
+
* @since 3.0.0
|
48 |
+
* @access public
|
49 |
+
*
|
50 |
+
* @param string $plugin_name The name of this plugin.
|
51 |
+
* @param string $version The version of this plugin.
|
52 |
+
*/
|
53 |
+
public function __construct( $plugin_name, $version ) {
|
54 |
+
$this->plugin_name = $plugin_name;
|
55 |
+
$this->version = $version;
|
56 |
+
$plugin_settings = new Nivo_Plugin_Settings();
|
57 |
+
$plugin_settings->set_labels( $labels = $this->default_labels() );
|
58 |
+
$plugin_settings->set_lite( $is_lite = $this->default_lite() );
|
59 |
+
self::set_plugin_settings( $plugin_settings );
|
60 |
+
parent::__construct();
|
61 |
+
$this->options = get_option( $this->labels['options_key'] );
|
62 |
+
}
|
63 |
+
|
64 |
+
private function default_labels() {
|
65 |
+
// TODO maybe simplify the labels array?
|
66 |
+
return array(
|
67 |
+
'nivo_item_name' => 'Nivo Slider WordPress Plugin',
|
68 |
+
'plugin_name' => $this->plugin_name,
|
69 |
+
'plugin_version' => $this->version,
|
70 |
+
'plugin_file' => NIVO_SLIDER_PLUGIN_FILE,
|
71 |
+
'plugin_basename' => NIVO_SLIDER_PLUGIN_BASENAME,
|
72 |
+
'plugin_url' => NIVO_SLIDER_PLUGIN_URL,
|
73 |
+
'post_type' => 'nivoslider',
|
74 |
+
'shortcode' => 'nivoslider',
|
75 |
+
'function' => 'nivo_slider',
|
76 |
+
'slug' => 'nivo-slider',
|
77 |
+
'taxonomy' => 'nivo-slider',
|
78 |
+
'post_meta_key' => 'nivo_settings',
|
79 |
+
'options_key' => 'nivoslider_settings',
|
80 |
+
'source_name' => 'type',
|
81 |
+
'manual_name' => 'manual',
|
82 |
+
'type_name' => 'type',
|
83 |
+
'singular' => __( 'Nivo Slider', 'nivo-slider' ),
|
84 |
+
'plural' => __( 'Nivo Sliders', 'nivo-slider' ),
|
85 |
+
);
|
86 |
+
}
|
87 |
+
|
88 |
+
private function default_lite() {
|
89 |
+
return false;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Track the nivo slider usage.
|
94 |
+
*
|
95 |
+
* @return bool Either we should track or not.
|
96 |
+
*/
|
97 |
+
public function check_logger() {
|
98 |
+
return ( get_option( 'nivo_logger_flag', 'no' ) === 'yes' );
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Registers the TinyMCE plugins
|
103 |
+
*
|
104 |
+
* @since 3.0.0
|
105 |
+
* @access public
|
106 |
+
*/
|
107 |
+
public function init_tinymce() {
|
108 |
+
if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) && get_user_option( 'rich_editing' ) == 'true' ) {
|
109 |
+
add_filter( 'mce_external_plugins', array( $this, 'mce_add_plugin' ) );
|
110 |
+
add_filter( 'mce_buttons_2', array( $this, 'mce_register_button' ) );
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Registers the TinyMCE script
|
116 |
+
*
|
117 |
+
* @since 3.0.0
|
118 |
+
* @access public
|
119 |
+
*/
|
120 |
+
public function mce_add_plugin( $plugin_array ) {
|
121 |
+
$plugin_array[ $this->labels['post_type'] ] = plugins_url( 'assets/js/tinymce.js', $this->labels['plugin_file'] );
|
122 |
+
|
123 |
+
return $plugin_array;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Registers the TinyMCE button
|
128 |
+
*
|
129 |
+
* @since 3.0.0
|
130 |
+
* @access public
|
131 |
+
*/
|
132 |
+
public function mce_register_button( $buttons ) {
|
133 |
+
array_push( $buttons, '|', $this->labels['post_type'] );
|
134 |
+
|
135 |
+
return $buttons;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Prints the [galleries] as javascript to be used by the TinyMCE plugin
|
140 |
+
* and localize scripts.
|
141 |
+
*
|
142 |
+
* @since 3.0.0
|
143 |
+
* @access public
|
144 |
+
*/
|
145 |
+
public function admin_print_scripts() {
|
146 |
+
// Bellow was added to this function from 2.2
|
147 |
+
global $post;
|
148 |
+
$settings = array(
|
149 |
+
'post_id' => ( isset( $post->ID ) ) ? $post->ID : '',
|
150 |
+
'labels' => $this->labels,
|
151 |
+
'track_url' => add_query_arg( array(
|
152 |
+
'nonce' => wp_create_nonce( 'nivo-track' ),
|
153 |
+
'action' => 'track_url',
|
154 |
+
), admin_url( 'admin-ajax.php' ) ),
|
155 |
+
'nonce' => wp_create_nonce( $this->labels['post_type'] ),
|
156 |
+
);
|
157 |
+
$settings = apply_filters( $this->labels['post_type'] . '_script_settings', $settings );
|
158 |
+
wp_localize_script( $this->labels['plugin_name'] . '_core_admin', 'nivo_plugin', $settings );
|
159 |
+
wp_localize_script( $this->labels['plugin_name'] . '_admin', 'nivo_plugin', $settings );
|
160 |
+
wp_localize_script( $this->labels['plugin_name'] . '_image_admin', 'nivo_plugin', $settings );
|
161 |
+
// Addition ends here.
|
162 |
+
// Galleries list for TinyMCE dropdown
|
163 |
+
$galleries = get_posts( array(
|
164 |
+
'post_type' => $this->labels['post_type'],
|
165 |
+
'posts_per_page' => - 1,
|
166 |
+
) );
|
167 |
+
$list = array();
|
168 |
+
foreach ( $galleries as $gallery ) {
|
169 |
+
$list[] = array(
|
170 |
+
'id' => $gallery->ID,
|
171 |
+
'name' => $gallery->post_title,
|
172 |
+
);
|
173 |
+
}
|
174 |
+
$settings = array(
|
175 |
+
'galleries' => json_encode( $list ),
|
176 |
+
);
|
177 |
+
$html = "<script type='text/javascript'>\n";
|
178 |
+
$html .= 'var ' . $this->labels['post_type'] . ' = ' . json_encode( $settings ) . '';
|
179 |
+
$html .= "\n</script>";
|
180 |
+
echo $html;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Custom post type menu icon url
|
185 |
+
*
|
186 |
+
* @since 2.2.*
|
187 |
+
* @updated 3.0.0
|
188 |
+
* @access public
|
189 |
+
* @return string
|
190 |
+
*/
|
191 |
+
public function menu_icon() {
|
192 |
+
return NIVO_SLIDER_PLUGIN_URL . 'assets/images/nivo.png';
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Custom post type labels
|
197 |
+
*
|
198 |
+
* @since 3.0.0
|
199 |
+
* @access public
|
200 |
+
*
|
201 |
+
* @param array $labels
|
202 |
+
*
|
203 |
+
* @return array $labels
|
204 |
+
*/
|
205 |
+
public function plugin_labels( $labels ) {
|
206 |
+
$name = __( 'Nivo Slider', 'nivo-slider' );
|
207 |
+
$labels['name'] = $labels['singular_name'] = $labels['menu_name'] = $name;
|
208 |
+
|
209 |
+
return $labels;
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Adds a new menu item under the plugin post type
|
214 |
+
*
|
215 |
+
* @since 2.2.*
|
216 |
+
* @access public
|
217 |
+
*/
|
218 |
+
public function admin_menu() {
|
219 |
+
add_submenu_page(
|
220 |
+
'edit.php?post_type=' . $this->labels['post_type'], 'Settings', 'Settings', 'manage_options', $this->labels['post_type'] . '-settings', array(
|
221 |
+
$this,
|
222 |
+
'settings_page',
|
223 |
+
)
|
224 |
+
);
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Controls the visibility of the plugin menu. Can be filtered.
|
229 |
+
*
|
230 |
+
* @since 2.2.*
|
231 |
+
* @access public
|
232 |
+
*/
|
233 |
+
public function remove_admin_menu() {
|
234 |
+
$options = $this->options;
|
235 |
+
if ( isset( $options['custom-roles'] ) ) {
|
236 |
+
$custom_roles = $options['custom-roles'];
|
237 |
+
if ( $custom_roles ) {
|
238 |
+
$allowed_roles = apply_filters( $this->labels['post_type'] . '_allowed_roles', $custom_roles );
|
239 |
+
global $current_user;
|
240 |
+
$user_roles = $current_user->roles;
|
241 |
+
$show = false;
|
242 |
+
foreach ( $allowed_roles as $role ) {
|
243 |
+
if ( in_array( $role, $user_roles ) ) {
|
244 |
+
$show = true;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
if ( ! $show ) {
|
248 |
+
remove_menu_page( 'edit.php?post_type=' . $this->labels['post_type'] );
|
249 |
+
}
|
250 |
+
}
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Renders the settings page for the plugin
|
256 |
+
*
|
257 |
+
* @since 2.2.*
|
258 |
+
* @access public
|
259 |
+
* @return mixed
|
260 |
+
*/
|
261 |
+
public function settings_page() {
|
262 |
+
?>
|
263 |
+
<div id="<?php echo $this->labels['post_type']; ?>-wrap" class="wrap">
|
264 |
+
<div id="icon-options-general" class="icon32"></div>
|
265 |
+
<h2><?php echo apply_filters( $this->labels['post_type'] . '_settings_page_header', 'Settings' ); ?></h2>
|
266 |
+
|
267 |
+
<form action="options.php" method="post">
|
268 |
+
<?php settings_fields( $this->labels['post_type'] . '-settings' ); ?>
|
269 |
+
<?php do_settings_sections( $this->labels['post_type'] . '-settings' ); ?>
|
270 |
+
<p class="submit">
|
271 |
+
<input type="submit" name="submit" id="submit" class="button-primary"
|
272 |
+
value="<?php _e( 'Save Changes', 'nivo-slider' ); ?>">
|
273 |
+
</p>
|
274 |
+
</form>
|
275 |
+
</div>
|
276 |
+
<?php
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Registers the settings and sections
|
281 |
+
*
|
282 |
+
* @since 2.2.*
|
283 |
+
* @access public
|
284 |
+
*/
|
285 |
+
public function register_settings() {
|
286 |
+
register_setting(
|
287 |
+
$this->labels['post_type'] . '-settings', $this->labels['options_key'], array(
|
288 |
+
$this,
|
289 |
+
'settings_validate',
|
290 |
+
)
|
291 |
+
);
|
292 |
+
add_settings_section(
|
293 |
+
$this->labels['post_type'] . '-settings', '', array(
|
294 |
+
$this,
|
295 |
+
'display_settings_intro',
|
296 |
+
), $this->labels['post_type'] . '-settings'
|
297 |
+
);
|
298 |
+
$settings[] = array(
|
299 |
+
'slug' => 'custom-roles',
|
300 |
+
'title' => __( 'Management Roles', 'nivo-slider' ),
|
301 |
+
);
|
302 |
+
$settings = apply_filters( $this->labels['post_type'] . '_register_settings', $settings );
|
303 |
+
foreach ( $settings as $setting ) {
|
304 |
+
$scope = ( isset( $setting['scope'] ) ) ? $setting['scope'] : $this;
|
305 |
+
$function = 'setting_' . str_replace( '-', '_', $setting['slug'] );
|
306 |
+
add_settings_field(
|
307 |
+
$setting['slug'], $setting['title'], array(
|
308 |
+
$scope,
|
309 |
+
$function,
|
310 |
+
), $this->labels['post_type'] . '-settings', $this->labels['post_type'] . '-settings'
|
311 |
+
);
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Settings helper to render HTML settings
|
317 |
+
*
|
318 |
+
* @since 2.2.*
|
319 |
+
* @access public
|
320 |
+
*
|
321 |
+
* @param array $args Settings array.
|
322 |
+
*
|
323 |
+
* @return mixed
|
324 |
+
*/
|
325 |
+
public function settings_helper( $args ) {
|
326 |
+
$element_name = $this->labels['options_key'] . '[' . $args['name'] . ']';
|
327 |
+
$element_default = ( isset( $args['default'] ) ) ? $args['default'] : '';
|
328 |
+
$element_value = $this->nivo_default_val( $this->options, $args['name'], $element_default );
|
329 |
+
$element_class = ( isset( $args['class'] ) ) ? $args['class'] : '';
|
330 |
+
switch ( $args['type'] ) {
|
331 |
+
case 'text':
|
332 |
+
?>
|
333 |
+
<input type="text" name="<?php echo $element_name; ?>" value="<?php echo $element_value; ?>"
|
334 |
+
class="<?php echo $element_class; ?> "/>
|
335 |
+
<?php
|
336 |
+
break;
|
337 |
+
case 'textarea':
|
338 |
+
$rows = ( isset( $args['rows'] ) ) ? $args['rows'] : 5;
|
339 |
+
$cols = ( isset( $args['cols'] ) ) ? $args['cols'] : 80;
|
340 |
+
?>
|
341 |
+
<textarea class="<?php echo $element_class; ?>" name="<?php echo $element_name; ?>"
|
342 |
+
rows="<?php echo $rows; ?>"
|
343 |
+
cols="<?php echo $cols; ?>"><?php echo $element_value; ?></textarea>
|
344 |
+
<?php
|
345 |
+
break;
|
346 |
+
case 'number':
|
347 |
+
?>
|
348 |
+
<input type="number" name="<?php echo $element_name; ?>" value="<?php echo $element_value; ?>"
|
349 |
+
class="<?php echo $element_class; ?> "/>
|
350 |
+
<?php
|
351 |
+
break;
|
352 |
+
case 'checkbox':
|
353 |
+
?>
|
354 |
+
<input type="hidden" name="<?php echo $element_name; ?>" value="off"/>
|
355 |
+
<input type="checkbox" name="<?php echo $element_name; ?>"
|
356 |
+
value="on"<?php if ( $element_value == 'on' ) {
|
357 |
+
echo ' checked="checked"';
|
358 |
+
} ?> class="<?php echo $element_class; ?> "/>
|
359 |
+
<?php
|
360 |
+
break;
|
361 |
+
case 'select':
|
362 |
+
?>
|
363 |
+
<select name="<?php echo $element_name; ?>" class="<?php echo $element_class; ?> ">
|
364 |
+
<?php
|
365 |
+
foreach ( $args['options'] as $value => $name ) {
|
366 |
+
?>
|
367 |
+
<option value="<?php echo $value; ?>"<?php if ( $value == $element_value ) {
|
368 |
+
echo ' selected="selected"';
|
369 |
+
} ?>><?php echo $name; ?></option>
|
370 |
+
<?php } ?>
|
371 |
+
</select>
|
372 |
+
<?php
|
373 |
+
break;
|
374 |
+
}
|
375 |
+
if ( isset( $args['descp'] ) && $args['descp'] != '' ) {
|
376 |
+
?>
|
377 |
+
<span class="description"><?php echo $args['descp']; ?></span>
|
378 |
+
<?php
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Displays the introduction on the settings page
|
384 |
+
*
|
385 |
+
* @since 2.2.*
|
386 |
+
* @access public
|
387 |
+
* @return string
|
388 |
+
*/
|
389 |
+
public function display_settings_intro() {
|
390 |
+
echo apply_filters( $this->labels['post_type'] . '_settings_intro', '' );
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Validation of settings on save.
|
395 |
+
*
|
396 |
+
* @since 2.2.*
|
397 |
+
* @access public
|
398 |
+
*
|
399 |
+
* @param array $input The input array.
|
400 |
+
*
|
401 |
+
* @return array
|
402 |
+
*/
|
403 |
+
public function settings_validate( $input ) {
|
404 |
+
$options = $this->options;
|
405 |
+
if ( $options && is_array( $options ) ) {
|
406 |
+
foreach ( $options as $key => $option ) {
|
407 |
+
if ( ! array_key_exists( $key, $input ) && $key != 'license_status' && $key != 'license_key' ) {
|
408 |
+
$input[ $key ] = $option;
|
409 |
+
}
|
410 |
+
}
|
411 |
+
}
|
412 |
+
$input = $this->save_custom_roles( $input );
|
413 |
+
|
414 |
+
return apply_filters( $this->labels['post_type'] . '_settings_validate', $input );
|
415 |
+
}
|
416 |
+
|
417 |
+
/**
|
418 |
+
* Custom save method for saving custom roles
|
419 |
+
*
|
420 |
+
* @since 2.2.*
|
421 |
+
* @access private
|
422 |
+
*
|
423 |
+
* @param array $input The input array.
|
424 |
+
*
|
425 |
+
* @return array
|
426 |
+
*/
|
427 |
+
private function save_custom_roles( $input ) {
|
428 |
+
if ( $input && is_array( $input ) && isset( $input['roles'] ) ) {
|
429 |
+
$custom_roles = array();
|
430 |
+
global $wp_roles;
|
431 |
+
$role_names = $wp_roles->get_names();
|
432 |
+
$roles = array();
|
433 |
+
foreach ( $role_names as $key => $value ) {
|
434 |
+
if ( $key != 'administrator' ) {
|
435 |
+
$roles[ $key ] = get_role( $key );
|
436 |
+
$roles[ $key ]->display_name = $value;
|
437 |
+
}
|
438 |
+
}
|
439 |
+
foreach ( $input as $key => $value ) {
|
440 |
+
if ( array_key_exists( $key, $roles ) ) {
|
441 |
+
$custom_roles[] = $key;
|
442 |
+
unset( $input[ $key ] );
|
443 |
+
}
|
444 |
+
}
|
445 |
+
unset( $input['roles'] );
|
446 |
+
$custom_roles[] = 'administrator';
|
447 |
+
$input['custom-roles'] = $custom_roles;
|
448 |
+
}
|
449 |
+
|
450 |
+
return $input;
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Renders setting for custom roles
|
455 |
+
*
|
456 |
+
* @since 2.2.*
|
457 |
+
* @access public
|
458 |
+
* @return mixed
|
459 |
+
*/
|
460 |
+
public function setting_custom_roles() {
|
461 |
+
$options = $this->options;
|
462 |
+
global $wp_roles;
|
463 |
+
$role_names = $wp_roles->get_names();
|
464 |
+
if ( ! isset( $options['custom-roles'] ) ) {
|
465 |
+
$defaults = array();
|
466 |
+
foreach ( $role_names as $key => $value ) {
|
467 |
+
if ( $key != 'administrator' ) {
|
468 |
+
$defaults[] = $key;
|
469 |
+
}
|
470 |
+
}
|
471 |
+
$options['custom-roles'] = $defaults;
|
472 |
+
}
|
473 |
+
$roles = array();
|
474 |
+
foreach ( $role_names as $key => $value ) {
|
475 |
+
if ( $key != 'administrator' ) {
|
476 |
+
$roles[ $key ] = get_role( $key );
|
477 |
+
$roles[ $key ]->display_name = $value;
|
478 |
+
if ( in_array( $roles[ $key ]->name, $options['custom-roles'] ) ) {
|
479 |
+
$roles[ $key ]->selected = true;
|
480 |
+
}
|
481 |
+
}
|
482 |
+
}
|
483 |
+
echo '<input type="hidden" name="' . $this->labels['options_key'] . '[roles]" value="roles">';
|
484 |
+
foreach ( $roles as $role ) :
|
485 |
+
echo '<input type="checkbox" id="' . $role->name . '" name="' . $this->labels['options_key'] . '[' . $role->name . ']" ' . ( isset( $role->selected ) && ( $role->selected ) ? ' checked="checked"' : '' ) . '/> ';
|
486 |
+
echo $role->display_name . '<br/>';
|
487 |
+
endforeach;
|
488 |
+
}
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Renders setting for license
|
492 |
+
*
|
493 |
+
* @since 2.2.*
|
494 |
+
* @access public
|
495 |
+
* @return mixed
|
496 |
+
*/
|
497 |
+
public function setting_license_settings() {
|
498 |
+
$license_key = $this->nivo_get_license_key( $this->labels['post_type'], $this->options );
|
499 |
+
$status = $this->nivo_default_val( $this->options, 'license_status', false );
|
500 |
+
echo '<div id="nivo_license">';
|
501 |
+
echo '<input type="hidden" name="' . $this->labels['options_key'] . '[license_status]" value="' . $status . '">';
|
502 |
+
if ( $status !== false && $status == 'valid' ) {
|
503 |
+
echo '<input type="hidden" name="' . $this->labels['options_key'] . '[license_key]" value="' . $license_key . '">';
|
504 |
+
echo '<span style="color:green;">' . __( 'Active: ', 'nivo-slider' ) . '</span>';
|
505 |
+
echo '<span class="regular-text">' . $license_key . '</span><br> ';
|
506 |
+
echo '<input id="deactivate-license" type="button" class="button-secondary" value="' . __( 'Deactivate License', 'nivo-slider' ) . '"/>';
|
507 |
+
} else {
|
508 |
+
if ( $this->nivo_license_constant( $this->labels['post_type'] ) ) {
|
509 |
+
echo '<input type="hidden" name="' . $this->labels['options_key'] . '[license_key]" value="' . $license_key . '">';
|
510 |
+
echo '<span class="regular-text">' . $license_key . '</span><br> ';
|
511 |
+
echo '<label class="description">' . __( 'Activate this license key to enable automatic upgrades', 'nivo-slider' ) . '</label><br>';
|
512 |
+
} else {
|
513 |
+
echo '<input type="text" name="' . $this->labels['options_key'] . '[license_key]" class="regular-text" value="' . $license_key . '"><br> ';
|
514 |
+
echo '<label class="description">' . __( 'Enter a valid license key to enable automatic upgrades', 'nivo-slider' ) . '</label><br>';
|
515 |
+
}
|
516 |
+
echo '<input id="activate-license" type="button" class="button-primary" value="' . __( 'Activate License', 'nivo-slider' ) . '"/>';
|
517 |
+
}
|
518 |
+
echo '<span class="spinner"></span></div>';
|
519 |
+
}
|
520 |
+
|
521 |
+
/**
|
522 |
+
* Displays a custom message about license activation in the plugin table list
|
523 |
+
*
|
524 |
+
* @since 2.2.*
|
525 |
+
* @access public
|
526 |
+
* @return mixed
|
527 |
+
*/
|
528 |
+
public function plugin_row() {
|
529 |
+
$license_key = $this->nivo_get_license_key( $this->labels['post_type'], $this->options );
|
530 |
+
$status = $this->nivo_default_val( $this->options, 'license_status', 'invalid' );
|
531 |
+
if ( ( empty( $license_key ) || $license_key == '' ) || $status == 'invalid' ) {
|
532 |
+
$settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=' . $this->labels['post_type'] . '&page=' . $this->labels['post_type'] . '-settings' ), __( 'Settings', 'nivo-slider' ) );
|
533 |
+
$message = 'To finish activating ' . $this->labels['plugin_name'] . ', please go to ' . $settings_link . ' and enter your license key and activate it to enable automatic updates.';
|
534 |
+
} else {
|
535 |
+
return;
|
536 |
+
}
|
537 |
+
?>
|
538 |
+
<tr class="plugin-update-tr nivo-custom">
|
539 |
+
<td colspan="3" class="plugin-update">
|
540 |
+
<div class="update-message">
|
541 |
+
<?php echo $message; ?>
|
542 |
+
</div>
|
543 |
+
</td>
|
544 |
+
</tr>
|
545 |
+
<?php
|
546 |
+
}
|
547 |
+
|
548 |
+
/**
|
549 |
+
* Adds a new link to the plugin settings on the plugin table list
|
550 |
+
*
|
551 |
+
* @since 2.2
|
552 |
+
* @access public
|
553 |
+
*/
|
554 |
+
public function plugin_action_links( $links, $file ) {
|
555 |
+
if ( $file == $this->labels['plugin_basename'] ) {
|
556 |
+
$settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=' . $this->labels['post_type'] . '&page=' . $this->labels['post_type'] . '-settings' ), __( 'Settings', 'nivo-slider' ) );
|
557 |
+
array_unshift( $links, $settings_link );
|
558 |
+
}
|
559 |
+
|
560 |
+
return $links;
|
561 |
+
}
|
562 |
+
|
563 |
+
/**
|
564 |
+
* Adds custom settings to the plugin's printed javascript object
|
565 |
+
*
|
566 |
+
* @since 3.0.0
|
567 |
+
* @access public
|
568 |
+
*
|
569 |
+
* @param array $settings
|
570 |
+
*
|
571 |
+
* @return array
|
572 |
+
*/
|
573 |
+
public function script_settings( $settings ) {
|
574 |
+
$themes = $this->get_themes();
|
575 |
+
$settings['themes'] = $themes;
|
576 |
+
|
577 |
+
return $settings;
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* Checks if a license key has been defined
|
582 |
+
*
|
583 |
+
* @since 2.2.*
|
584 |
+
* @access public
|
585 |
+
* @return boolean
|
586 |
+
*/
|
587 |
+
public function check_license_constant() {
|
588 |
+
return defined( 'NIVOSLIDER_LICENSE' );
|
589 |
+
}
|
590 |
+
|
591 |
+
/**
|
592 |
+
* Gets the defined license key
|
593 |
+
*
|
594 |
+
* @since 2.2.*
|
595 |
+
* @access public
|
596 |
+
* @return string
|
597 |
+
*/
|
598 |
+
public function get_license_constant() {
|
599 |
+
return NIVOSLIDER_LICENSE;
|
600 |
+
}
|
601 |
+
|
602 |
+
/**
|
603 |
+
* Register the stylesheets for the admin area.
|
604 |
+
*
|
605 |
+
* @since 3.0.0
|
606 |
+
* @access public
|
607 |
+
*/
|
608 |
+
public function enqueue_styles() {
|
609 |
+
/**
|
610 |
+
* This function is provided for demonstration purposes only.
|
611 |
+
*
|
612 |
+
* An instance of this class should be passed to the run() function
|
613 |
+
* defined in Nivo_Slider_Loader as all of the hooks are defined
|
614 |
+
* in that particular class.
|
615 |
+
*
|
616 |
+
* The Nivo_Slider_Loader will then create the relationship
|
617 |
+
* between the defined hooks and the functions defined in this
|
618 |
+
* class.
|
619 |
+
*/
|
620 |
+
wp_enqueue_style( $this->plugin_name . '_nivo_css', NIVO_SLIDER_PLUGIN_URL . 'assets/css/nivo-slider.css', array(), $this->version, 'all' );
|
621 |
+
if( get_post_type() == $this->labels['post_type'] ) {
|
622 |
+
wp_enqueue_style( $this->plugin_name . '_admin_css', NIVO_SLIDER_PLUGIN_URL . 'assets/css/admin.css', array(), $this->version, 'all' );
|
623 |
+
}
|
624 |
+
|
625 |
+
}
|
626 |
+
|
627 |
+
/**
|
628 |
+
* Register the JavaScript for the admin area.
|
629 |
+
*
|
630 |
+
* @since 3.0.0
|
631 |
+
* @access public
|
632 |
+
*/
|
633 |
+
public function enqueue_scripts() {
|
634 |
+
/**
|
635 |
+
* This function is provided for demonstration purposes only.
|
636 |
+
*
|
637 |
+
* An instance of this class should be passed to the run() function
|
638 |
+
* defined in Nivo_Slider_Loader as all of the hooks are defined
|
639 |
+
* in that particular class.
|
640 |
+
*
|
641 |
+
* The Nivo_Slider_Loader will then create the relationship
|
642 |
+
* between the defined hooks and the functions defined in this
|
643 |
+
* class.
|
644 |
+
*/
|
645 |
+
wp_enqueue_script( $this->plugin_name . '_core_admin', NIVO_SLIDER_PLUGIN_URL . 'assets/js/core-admin.js', array( 'jquery' ), $this->version, false );
|
646 |
+
//wp_enqueue_script( $this->plugin_name . '_admin', NIVO_SLIDER_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery' ), $this->version, false );
|
647 |
+
wp_enqueue_script( $this->plugin_name . '_image_admin', NIVO_SLIDER_PLUGIN_URL . 'assets/js/image-admin.js', array( 'jquery' ), $this->version, false );
|
648 |
+
|
649 |
+
}
|
650 |
+
|
651 |
+
/**
|
652 |
+
* Returns the upsell message for specific area.
|
653 |
+
*/
|
654 |
+
public function add_upsell( $type ) {
|
655 |
+
switch ( $type ) {
|
656 |
+
case 'slider_type':
|
657 |
+
return '<span class="nivo-field-upsell">' . sprintf( __( 'You can automatically build slider from post galleries, categories and sticky posts using the %1$s FULL%2$s version.', 'nivo-slider' ), '<a href="' . NIVO_PRO_UPSELL . '" target="_blank">', '</a>' ) . '</span>';
|
658 |
+
break;
|
659 |
+
}
|
660 |
+
}
|
661 |
+
|
662 |
+
}
|
includes/admin/libs/class-nivo-core-admin-ajax.php
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The admin-ajax functionality of the plugin.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/admin/libs
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The admin-ajax functionality of the plugin.
|
14 |
+
*
|
15 |
+
* TODO WRITE DESCRIPTION
|
16 |
+
*
|
17 |
+
* @package nivo-slider
|
18 |
+
* @subpackage nivo-slider/includes/admin/libs
|
19 |
+
* @author ThemeIsle <friends@themeisle.com>
|
20 |
+
*/
|
21 |
+
class Nivo_Core_Admin_Ajax extends Nivo_Core_Abstract implements Nivo_Library_Interface {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Instance of Nivo Images Core Class
|
25 |
+
*
|
26 |
+
* @var object
|
27 |
+
* @access private
|
28 |
+
* @since 2.2.*
|
29 |
+
*/
|
30 |
+
private $core_images;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Plugin options
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
* @access private
|
37 |
+
* @since 2.2.*
|
38 |
+
*/
|
39 |
+
private $options;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Use this instead of overriding __construct
|
43 |
+
*
|
44 |
+
* @since 3.0.0
|
45 |
+
* @access public
|
46 |
+
*/
|
47 |
+
public function after_core_construct() {
|
48 |
+
$this->options = get_option( $this->labels['options_key'] );
|
49 |
+
$this->core_images = new Nivo_Core_Images( self::get_plugin_settings() );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Sends to the media modal the link for an image
|
54 |
+
*
|
55 |
+
* @since 2.2.*
|
56 |
+
* @access public
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function get_meta_link() {
|
60 |
+
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], plugin_basename( $this->labels['post_type'] ) ) ) {
|
61 |
+
return 0;
|
62 |
+
}
|
63 |
+
if ( ! isset( $_POST['ids'] ) ) {
|
64 |
+
return 0;
|
65 |
+
}
|
66 |
+
$attachments = explode( ',', $_POST['ids'] );
|
67 |
+
$links = array();
|
68 |
+
if ( $attachments ) {
|
69 |
+
foreach ( $attachments as $attachment ) {
|
70 |
+
$link = get_post_meta( $attachment, '_wp_attachment_image_link', true );
|
71 |
+
if ( $link != '' ) {
|
72 |
+
$links[ $attachment ] = $link;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
$response = array(
|
77 |
+
'metalink' => $links,
|
78 |
+
);
|
79 |
+
echo json_encode( $response );
|
80 |
+
die;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Saves the link for an image when entered in the media modal
|
85 |
+
*
|
86 |
+
* @since 2.2.*
|
87 |
+
* @access public
|
88 |
+
* @return string
|
89 |
+
*/
|
90 |
+
public function set_meta_link() {
|
91 |
+
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], plugin_basename( $this->labels['post_type'] ) ) ) {
|
92 |
+
return 0;
|
93 |
+
}
|
94 |
+
if ( ! isset( $_POST['id'] ) || ! isset( $_POST['metalink'] ) ) {
|
95 |
+
return 0;
|
96 |
+
}
|
97 |
+
$link = get_post_meta( $_POST['id'], '_wp_attachment_image_link', true );
|
98 |
+
$new_link = stripslashes( $_POST['metalink'] );
|
99 |
+
if ( $link != $new_link ) {
|
100 |
+
$new_link = wp_strip_all_tags( $new_link, true );
|
101 |
+
$result = update_post_meta( $_POST['id'], '_wp_attachment_image_link', addslashes( $new_link ) );
|
102 |
+
}
|
103 |
+
$response = array();
|
104 |
+
echo json_encode( $response );
|
105 |
+
die;
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Retrieves images associated with the [gallery]
|
110 |
+
*
|
111 |
+
* @since 2.2.*
|
112 |
+
* @access public
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
public function load_images() {
|
116 |
+
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], $this->labels['post_type'] ) || ! isset( $_POST['source'] ) ) {
|
117 |
+
return 0;
|
118 |
+
}
|
119 |
+
$response['error'] = false;
|
120 |
+
$response['message'] = '';
|
121 |
+
$response['images'] = array();
|
122 |
+
$number_images = ( isset( $_POST['number_images'] ) && $_POST['number_images'] != '' ) ? $_POST['number_images'] : - 1;
|
123 |
+
$method = ( ( isset( $_POST['method'] ) && $_POST['method'] != '' ) ) ? $_POST['method'] : null;
|
124 |
+
$param = ( ( isset( $_POST['param'] ) && $_POST['param'] != '' ) ) ? $_POST['param'] : null;
|
125 |
+
$gallery = ( ( isset( $_POST['gallery'] ) && $_POST['gallery'] != '' ) ) ? $_POST['gallery'] : null;
|
126 |
+
$category = ( ( isset( $_POST['category'] ) && $_POST['category'] != '' ) ) ? $_POST['category'] : null;
|
127 |
+
$custom = ( ( isset( $_POST['custom'] ) && $_POST['custom'] != '' ) ) ? $_POST['custom'] : null;
|
128 |
+
$image_ids = ( ( isset( $_POST['image_ids'] ) && $_POST['image_ids'] != '' ) ) ? $_POST['image_ids'] : null;
|
129 |
+
$response['images'] = $this->core_images->get_images(
|
130 |
+
$_POST['id'],
|
131 |
+
'thumbnail',
|
132 |
+
$number_images,
|
133 |
+
$_POST['source'],
|
134 |
+
$method,
|
135 |
+
$param,
|
136 |
+
$gallery,
|
137 |
+
$category,
|
138 |
+
$custom,
|
139 |
+
$image_ids
|
140 |
+
);
|
141 |
+
echo json_encode( $response );
|
142 |
+
die;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Ajax endpoint for url tracking.
|
147 |
+
*/
|
148 |
+
public function track_url() {
|
149 |
+
check_admin_referer( 'nivo-track', 'nonce' );
|
150 |
+
$status = $_GET['status'];
|
151 |
+
if ( $status == 'yes' ) {
|
152 |
+
update_option( 'nivo_logger_flag', 'yes' );
|
153 |
+
} else {
|
154 |
+
update_option( 'nivo_logger_flag', 'no' );
|
155 |
+
}
|
156 |
+
wp_send_json_success( array(
|
157 |
+
'status' => $status,
|
158 |
+
) );
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Reattaches images to a manual gallery when the manual image ids are not set
|
163 |
+
*
|
164 |
+
* @since 2.2.*
|
165 |
+
* @access public
|
166 |
+
* @return string
|
167 |
+
*/
|
168 |
+
public function reattach_images() {
|
169 |
+
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], plugin_basename( $this->labels['post_type'] ) ) ) {
|
170 |
+
return 0;
|
171 |
+
}
|
172 |
+
if ( ! isset( $_POST['post_id'] ) ) {
|
173 |
+
return 0;
|
174 |
+
}
|
175 |
+
$ajax_response['error'] = false;
|
176 |
+
$ajax_response['message'] = '';
|
177 |
+
$options = get_post_meta( $_POST['post_id'], $this->labels['post_meta_key'], true );
|
178 |
+
;
|
179 |
+
$images = $this->nivo_get_attached_images( $_POST['post_id'], - 1 );
|
180 |
+
if ( ! $images || count( $images ) == 0 ) {
|
181 |
+
$ajax_response['error'] = true;
|
182 |
+
$ajax_response['message'] = 'No images to attach';
|
183 |
+
} else {
|
184 |
+
$ids = wp_list_pluck( $images, 'ID' );
|
185 |
+
$manual_image_ids = implode( ',', $ids );
|
186 |
+
$options['manual_image_ids'] = $manual_image_ids;
|
187 |
+
$ajax_response['redirect'] = admin_url( 'edit.php?post_type=' . $this->labels['post_type'] );
|
188 |
+
update_post_meta( $_POST['post_id'], $this->labels['post_meta_key'], $options );
|
189 |
+
}
|
190 |
+
echo json_encode( $ajax_response );
|
191 |
+
die;
|
192 |
+
}
|
193 |
+
}
|
includes/admin/libs/class-nivo-core-admin-edit.php
ADDED
@@ -0,0 +1,827 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The admin-edit functionality of the plugin.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/admin/libs
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The admin-edit functionality of the plugin.
|
14 |
+
*
|
15 |
+
* TODO WRITE DESCRIPTION
|
16 |
+
*
|
17 |
+
* @package nivo-slider
|
18 |
+
* @subpackage nivo-slider/includes/admin/libs
|
19 |
+
* @author ThemeIsle <friends@themeisle.com>
|
20 |
+
*/
|
21 |
+
class Nivo_Core_Admin_Edit extends Nivo_Core_Abstract implements Nivo_Library_Interface {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Plugin options
|
25 |
+
*
|
26 |
+
* @var array
|
27 |
+
* @access private
|
28 |
+
* @since 2.2.*
|
29 |
+
*/
|
30 |
+
private $options;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Instance of Nivo Images Core Class
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
* @access private
|
37 |
+
* @since 2.2.*
|
38 |
+
*/
|
39 |
+
private $core_images;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Use this instead of overriding __construct
|
43 |
+
*
|
44 |
+
* @since 3.0.0
|
45 |
+
* @access public
|
46 |
+
*/
|
47 |
+
public function after_core_construct() {
|
48 |
+
$this->core_images = new Nivo_Core_Images( self::get_plugin_settings() );
|
49 |
+
$this->options = get_option( self::get_plugin_settings()->get_label( 'options_key' ) );
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Post edit screen settings
|
54 |
+
*
|
55 |
+
* @since 2.2.*
|
56 |
+
* @access public
|
57 |
+
*
|
58 |
+
* @param array $settings The settings array.
|
59 |
+
*
|
60 |
+
* @return array
|
61 |
+
*/
|
62 |
+
public function admin_edit_settings( $settings ) {
|
63 |
+
$settings = array();
|
64 |
+
$settings[] = array(
|
65 |
+
'name' => 'enable_captions',
|
66 |
+
'default' => 'on',
|
67 |
+
'type' => 'checkbox',
|
68 |
+
'title' => __( 'Enable Captions', 'nivo-slider' ),
|
69 |
+
'descp' => __( 'Enable automatic captions from post titles', 'nivo-slider' ),
|
70 |
+
'sub' => true,
|
71 |
+
'tr_class' => 'nivo_captions',
|
72 |
+
);
|
73 |
+
$settings[] = array(
|
74 |
+
'name' => 'number_images',
|
75 |
+
'default' => '',
|
76 |
+
'type' => 'text',
|
77 |
+
'title' => __( 'Number of Images', 'nivo-slider' ),
|
78 |
+
'descp' => __( 'The number of images to use in the slider. Leave blank for all images. External sources default to 20', 'nivo-slider' ),
|
79 |
+
'sub' => true,
|
80 |
+
'tr_class' => 'nivo_non_manual',
|
81 |
+
'reload' => true,
|
82 |
+
);
|
83 |
+
$settings[] = array(
|
84 |
+
'name' => 'sizing',
|
85 |
+
'default' => 'responsive',
|
86 |
+
'type' => 'select',
|
87 |
+
'title' => __( 'Slider Sizing', 'nivo-slider' ),
|
88 |
+
'descp' => __( 'Responsive sliders will fill the width of the container', 'nivo-slider' ),
|
89 |
+
'options' => array(
|
90 |
+
'responsive' => __( 'Responsive', 'nivo-slider' ),
|
91 |
+
'fixed' => __( 'Fixed Size', 'nivo-slider' ),
|
92 |
+
),
|
93 |
+
);
|
94 |
+
$settings[] = array(
|
95 |
+
'name' => 'wp_image_size',
|
96 |
+
'default' => 'full',
|
97 |
+
'type' => 'select',
|
98 |
+
'title' => __( 'Image Size', 'nivo-slider' ),
|
99 |
+
'descp' => __( 'Select the size of image from the WordPress media library', 'nivo-slider' ),
|
100 |
+
'options' => $this->core_images->get_image_sizes(),
|
101 |
+
'tr_class' => 'wp-image-size',
|
102 |
+
);
|
103 |
+
$settings[] = array(
|
104 |
+
'name' => array( 'dim_x', 'dim_y' ),
|
105 |
+
'default' => array( 400, 150 ),
|
106 |
+
'type' => 'number',
|
107 |
+
'title' => __( 'Slider Size', 'nivo-slider' ),
|
108 |
+
'descp' => __( '(Size in px) Images will be cropped to these dimensions (eg 400 x 150)', 'nivo-slider' ),
|
109 |
+
'connect' => ' x ',
|
110 |
+
'parent' => 'sizing',
|
111 |
+
'visible' => 'fixed',
|
112 |
+
);
|
113 |
+
$themes = $this->get_themes( true );
|
114 |
+
$themes = array_merge( array(
|
115 |
+
'' => 'None',
|
116 |
+
), (array) $themes );
|
117 |
+
$settings[] = array(
|
118 |
+
'name' => 'theme',
|
119 |
+
'default' => '',
|
120 |
+
'type' => 'select',
|
121 |
+
'title' => __( 'Slider Theme', 'nivo-slider' ),
|
122 |
+
'descp' => __( 'Use a pre-built theme or provide your own styles.', 'nivo-slider' ),
|
123 |
+
'options' => $themes,
|
124 |
+
);
|
125 |
+
$effects = array(
|
126 |
+
'random' => __( 'Random', 'nivo-slider' ),
|
127 |
+
'fade' => __( 'Fade', 'nivo-slider' ),
|
128 |
+
'fold' => __( 'Fold', 'nivo-slider' ),
|
129 |
+
'sliceDown' => __( 'Slice Down', 'nivo-slider' ),
|
130 |
+
'sliceDownLeft' => __( 'Slice Down (Left)', 'nivo-slider' ),
|
131 |
+
'sliceUp' => __( 'Slice Up', 'nivo-slider' ),
|
132 |
+
'sliceUpLeft' => __( 'Slice Up (Left)', 'nivo-slider' ),
|
133 |
+
'sliceUpDown' => __( 'Slice Up/Down', 'nivo-slider' ),
|
134 |
+
'sliceUpDownLeft' => __( 'Slice Up/Down (Left)', 'nivo-slider' ),
|
135 |
+
'slideInRight' => __( 'Slide In (Right)', 'nivo-slider' ),
|
136 |
+
'slideInLeft' => __( 'Slide In (Left)', 'nivo-slider' ),
|
137 |
+
'boxRandom' => __( 'Box Random', 'nivo-slider' ),
|
138 |
+
'boxRain' => __( 'Box Rain', 'nivo-slider' ),
|
139 |
+
'boxRainReverse' => __( 'Box Rain (Reverse)', 'nivo-slider' ),
|
140 |
+
'boxRainGrow' => __( 'Box Rain Grow', 'nivo-slider' ),
|
141 |
+
'boxRainGrowReverse' => __( 'Box Rain Grow (Reverse)', 'nivo-slider' ),
|
142 |
+
);
|
143 |
+
$settings[] = array(
|
144 |
+
'name' => 'effect',
|
145 |
+
'default' => 'fade',
|
146 |
+
'type' => 'select',
|
147 |
+
'title' => __( 'Transition Effect', 'nivo-slider' ),
|
148 |
+
'options' => $effects,
|
149 |
+
);
|
150 |
+
$settings[] = array(
|
151 |
+
'name' => 'slices',
|
152 |
+
'default' => '15',
|
153 |
+
'type' => 'number',
|
154 |
+
'title' => __( 'Slices', 'nivo-slider' ),
|
155 |
+
'descp' => __( 'The number of slices to use in the "Slice" transitions (eg 15)', 'nivo-slider' ),
|
156 |
+
);
|
157 |
+
$settings[] = array(
|
158 |
+
'name' => array( 'boxCols', 'boxRows' ),
|
159 |
+
'default' => array( 8, 4 ),
|
160 |
+
'type' => 'number',
|
161 |
+
'title' => __( 'Box (Cols x Rows)', 'nivo-slider' ),
|
162 |
+
'descp' => __( 'The number of columns and rows to use in the "Box" transitions (eg 8 x 4)', 'nivo-slider' ),
|
163 |
+
'connect' => ' x ',
|
164 |
+
);
|
165 |
+
$settings[] = array(
|
166 |
+
'name' => 'animSpeed',
|
167 |
+
'default' => '500',
|
168 |
+
'type' => 'number',
|
169 |
+
'title' => __( 'Animation Speed', 'nivo-slider' ),
|
170 |
+
'descp' => __( 'The speed of the transition animation in milliseconds (eg 500)', 'nivo-slider' ),
|
171 |
+
);
|
172 |
+
$settings[] = array(
|
173 |
+
'name' => 'controlNavThumbs',
|
174 |
+
'default' => 'off',
|
175 |
+
'type' => 'checkbox',
|
176 |
+
'title' => __( 'Enable Thumbnail Navigation', 'nivo-slider' ),
|
177 |
+
'tr_class' => 'nivo_thumb_nav',
|
178 |
+
);
|
179 |
+
$settings[] = array(
|
180 |
+
'name' => array( 'thumbSizeWidth', 'thumbSizeHeight' ),
|
181 |
+
'default' => array( 70, 50 ),
|
182 |
+
'type' => 'number',
|
183 |
+
'title' => __( 'Thumbnail Size', 'nivo-slider' ),
|
184 |
+
'descp' => __( 'The width and height of the thumbnails', 'nivo-slider' ),
|
185 |
+
'connect' => ' x ',
|
186 |
+
'tr_class' => 'nivo_thumb_size',
|
187 |
+
);
|
188 |
+
$settings[] = array(
|
189 |
+
'name' => 'pauseTime',
|
190 |
+
'default' => '3000',
|
191 |
+
'type' => 'number',
|
192 |
+
'title' => __( 'Pause Time', 'nivo-slider' ),
|
193 |
+
'descp' => __( 'The amount of time to show each slide in milliseconds (eg 3000)', 'nivo-slider' ),
|
194 |
+
);
|
195 |
+
$settings[] = array(
|
196 |
+
'name' => 'startSlide',
|
197 |
+
'default' => '0',
|
198 |
+
'type' => 'number',
|
199 |
+
'title' => __( 'Start Slide', 'nivo-slider' ),
|
200 |
+
'descp' => __( 'Set which slide the slider starts from (zero based index: usually 0)', 'nivo-slider' ),
|
201 |
+
);
|
202 |
+
$settings[] = array(
|
203 |
+
'name' => 'directionNav',
|
204 |
+
'default' => 'on',
|
205 |
+
'type' => 'checkbox',
|
206 |
+
'title' => __( 'Enable Direction Navigation', 'nivo-slider' ),
|
207 |
+
'descp' => __( 'Prev & Next arrows', 'nivo-slider' ),
|
208 |
+
);
|
209 |
+
$settings[] = array(
|
210 |
+
'name' => 'controlNav',
|
211 |
+
'default' => 'on',
|
212 |
+
'type' => 'checkbox',
|
213 |
+
'title' => __( 'Enable Control Navigation', 'nivo-slider' ),
|
214 |
+
'descp' => __( 'eg 1,2,3...', 'nivo-slider' ),
|
215 |
+
);
|
216 |
+
$settings[] = array(
|
217 |
+
'name' => 'imageLink',
|
218 |
+
'default' => 'on',
|
219 |
+
'type' => 'checkbox',
|
220 |
+
'title' => __( 'Enable Images Links', 'nivo-slider' ),
|
221 |
+
'descp' => __( 'If a link has been added to an image when configuring, the image links to the url.', 'nivo-slider' ),
|
222 |
+
);
|
223 |
+
$settings[] = array(
|
224 |
+
'name' => 'targetBlank',
|
225 |
+
'default' => 'on',
|
226 |
+
'type' => 'checkbox',
|
227 |
+
'title' => __( 'Open Links in New Window', 'nivo-slider' ),
|
228 |
+
'descp' => __( 'Open the links in a new window.', 'nivo-slider' ),
|
229 |
+
'parent' => 'imageLink',
|
230 |
+
'visible' => 'on',
|
231 |
+
);
|
232 |
+
$settings[] = array(
|
233 |
+
'name' => 'pauseOnHover',
|
234 |
+
'default' => 'on',
|
235 |
+
'type' => 'checkbox',
|
236 |
+
'title' => __( 'Pause the Slider on Hover', 'nivo-slider' ),
|
237 |
+
);
|
238 |
+
$settings[] = array(
|
239 |
+
'name' => 'manualAdvance',
|
240 |
+
'default' => 'off',
|
241 |
+
'type' => 'checkbox',
|
242 |
+
'title' => __( 'Manual Transitions', 'nivo-slider' ),
|
243 |
+
'descp' => __( 'Slider is always paused', 'nivo-slider' ),
|
244 |
+
);
|
245 |
+
$settings[] = array(
|
246 |
+
'name' => 'randomStart',
|
247 |
+
'default' => 'off',
|
248 |
+
'type' => 'checkbox',
|
249 |
+
'title' => __( 'Random Start Slide', 'nivo-slider' ),
|
250 |
+
'descp' => __( 'Overrides Start Slide value', 'nivo-slider' ),
|
251 |
+
);
|
252 |
+
|
253 |
+
return $settings;
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Displays the introduction on the settings page
|
258 |
+
*
|
259 |
+
* @since 2.2.*
|
260 |
+
* @access public
|
261 |
+
* @return mixed
|
262 |
+
*/
|
263 |
+
public function display_settings_intro() {
|
264 |
+
echo apply_filters( $this->labels['post_type'] . '_settings_intro', '' );
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Adds meta boxes to the edit screen
|
269 |
+
*
|
270 |
+
* @since 2.2.*
|
271 |
+
* @access public
|
272 |
+
*/
|
273 |
+
public function admin_init() {
|
274 |
+
add_meta_box(
|
275 |
+
$this->labels['post_type'] . '_upload_box', sprintf( __( '%1$s Images', 'nivo-slider' ), $this->labels['singular'] ), array(
|
276 |
+
$this,
|
277 |
+
'meta_box_upload',
|
278 |
+
), $this->labels['post_type'], 'normal'
|
279 |
+
);
|
280 |
+
add_meta_box(
|
281 |
+
$this->labels['post_type'] . '_settings_box', __( 'Settings', 'nivo-slider' ), array(
|
282 |
+
$this,
|
283 |
+
'meta_box_settings',
|
284 |
+
), $this->labels['post_type'], 'normal'
|
285 |
+
);
|
286 |
+
add_meta_box(
|
287 |
+
$this->labels['post_type'] . '_shortcode_box', sprintf( __( 'Using this %1$s', 'nivo-slider' ), $this->labels['singular'] ), array(
|
288 |
+
$this,
|
289 |
+
'meta_box_shortcode',
|
290 |
+
), $this->labels['post_type'], 'side'
|
291 |
+
);
|
292 |
+
if ( ! defined( 'NIVO_SLIDER_PRO' ) ) {
|
293 |
+
add_meta_box(
|
294 |
+
$this->labels['post_type'] . '_usefullinks_box', __( 'Full Version', 'nivo-slider' ), array(
|
295 |
+
$this,
|
296 |
+
'meta_box_full_version',
|
297 |
+
), $this->labels['post_type'], 'side'
|
298 |
+
);
|
299 |
+
add_meta_box(
|
300 |
+
$this->labels['post_type'] . '_enable_tracking', __( 'Contribute to Nivo', 'nivo-slider' ), array(
|
301 |
+
$this,
|
302 |
+
'enable_tracking',
|
303 |
+
), $this->labels['post_type'], 'side'
|
304 |
+
);
|
305 |
+
}
|
306 |
+
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Adds the Shortcode meta box to the edit screen
|
311 |
+
*
|
312 |
+
* @since 2.2.*
|
313 |
+
* @access public
|
314 |
+
*/
|
315 |
+
public function meta_box_shortcode() {
|
316 |
+
global $post;
|
317 |
+
echo '<p>' . sprintf( __( 'To use this %1$s in your posts or pages use the following shortcode:', 'nivo-slider' ), strtolower( $this->labels['singular'] ) ) . '</p>
|
318 |
+
<p><code>[' . $this->labels['shortcode'] . ' id="' . $post->ID . '"]</code>';
|
319 |
+
if ( $post->post_name != '' && $post->post_name <> $post->ID ) {
|
320 |
+
echo 'or</p><p><code>[' . $this->labels['shortcode'] . ' slug="' . $post->post_name . '"]</code>';
|
321 |
+
}
|
322 |
+
echo '</p>';
|
323 |
+
echo '<p>' . sprintf( __( 'To use this %1$s in a theme template file use the following code:', 'nivo-slider' ), strtolower( $this->labels['singular'] ) ) . '</p>
|
324 |
+
<p><code><?php ' . $this->labels['function'] . '( ' . $post->ID . ' ); ?></code>';
|
325 |
+
if ( $post->post_name != '' && $post->post_name <> $post->ID ) {
|
326 |
+
echo ' or</p><p><code><?php ' . $this->labels['function'] . '( "' . $post->post_name . '" ); ?></code>';
|
327 |
+
}
|
328 |
+
echo '</p>';
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* Adds upsell box to the edit screen
|
333 |
+
*
|
334 |
+
* @since 2.2.*
|
335 |
+
* @access public
|
336 |
+
*/
|
337 |
+
public function meta_box_full_version() {
|
338 |
+
?>
|
339 |
+
<div class="nivo-upsell-box">
|
340 |
+
<h3><?php _e( ' Extend Nivo Slider ', 'nivo-slider' ); ?></h3>
|
341 |
+
<ul>
|
342 |
+
<li><?php _e( 'More slider types', 'nivo-slider' ); ?></li>
|
343 |
+
<li><?php _e( 'Build carousels', 'nivo-slider' ); ?></li>
|
344 |
+
<li><?php _e( 'Create lightboxes', 'nivo-slider' ); ?> </li>
|
345 |
+
<li><?php _e( 'Automatic updates', 'nivo-slider' ); ?></li>
|
346 |
+
<li><?php _e( 'Priority support', 'nivo-slider' ); ?></li>
|
347 |
+
</ul>
|
348 |
+
<a href="<?php echo NIVO_PRO_UPSELL; ?>" target="_blank" class="button button-primary">View more
|
349 |
+
features</a></div>
|
350 |
+
<?php
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Adds tracking box to the edit screen
|
355 |
+
*
|
356 |
+
* @since 2.2.*
|
357 |
+
* @access public
|
358 |
+
*/
|
359 |
+
public function enable_tracking() {
|
360 |
+
$checked = get_option( 'nivo_logger_flag', 'no' ) === 'yes' ? 'checked' : '';
|
361 |
+
?>
|
362 |
+
<div class=" nivo-tracking"><label class="nivo-switch" ><input type="checkbox" <?php echo $checked; ?>>
|
363 |
+
<div class="nivo-slider visualizer-round"></div>
|
364 |
+
</label><span><?php _e( 'Enable Tracking', 'nivo-slider' ); ?> <sup>*</sup></span>
|
365 |
+
<p>
|
366 |
+
<small><sup>*</sup><?php _e( 'Allow Nivo to anonymously track how this plugin is used and help us make the
|
367 |
+
plugin better. No sensitive data is tracked.', 'nivo-slider' ); ?>
|
368 |
+
</small>
|
369 |
+
</p>
|
370 |
+
</div>
|
371 |
+
<?php
|
372 |
+
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* Adds the Image Upload meta box to the edit screen to configure the [gallery]
|
376 |
+
*
|
377 |
+
* @since 2.2.*
|
378 |
+
* @access public
|
379 |
+
*/
|
380 |
+
public function meta_box_upload() {
|
381 |
+
global $post;
|
382 |
+
$options = get_post_meta( $post->ID, $this->labels['post_meta_key'], true );
|
383 |
+
?>
|
384 |
+
<a id="manual_images_upload" href="#" class="button">Configure</a>
|
385 |
+
<input type="hidden" id="_manual_image_ids"
|
386 |
+
name="<?php echo $this->labels['post_meta_key']; ?>[manual_image_ids]"
|
387 |
+
value="<?php echo $this->nivo_default_val( $options, 'manual_image_ids', '' ); ?>">
|
388 |
+
<ul id="<?php echo $this->labels['post_type']; ?>-images" class="nivo-plugin-images"></ul>
|
389 |
+
<?php
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Adds the [gallery] Settings meta box to the edit screen
|
394 |
+
*
|
395 |
+
* @since 2.2.*
|
396 |
+
* @access public
|
397 |
+
*/
|
398 |
+
public function meta_box_settings() {
|
399 |
+
global $post;
|
400 |
+
$options = get_post_meta( $post->ID, $this->labels['post_meta_key'], true );
|
401 |
+
wp_nonce_field( $this->labels['plugin_name'], $this->labels['post_type'] . '_noncename' );
|
402 |
+
?>
|
403 |
+
<table id="<?php echo $this->labels['post_type']; ?>-settings" class="form-table">
|
404 |
+
<tr valign="top">
|
405 |
+
<th scope="row"><?php echo sprintf( __( ' %1$s Type', 'nivo-slider' ), $this->labels['singular'] ) ?></th>
|
406 |
+
<td>
|
407 |
+
<select
|
408 |
+
name="<?php echo $this->labels['post_meta_key']; ?>[<?php echo $this->labels['source_name']; ?>]">
|
409 |
+
<?php
|
410 |
+
$selected_source = $this->nivo_default_val( $options, $this->labels['source_name'], $this->core_images->image_source_default() );
|
411 |
+
$images_sources = $this->core_images->get_image_sources();
|
412 |
+
if ( $images_sources ) {
|
413 |
+
foreach ( $images_sources as $source => $value ) {
|
414 |
+
$disabled = '';
|
415 |
+
if ( strpos( $source, 'disabled' ) !== false ) {
|
416 |
+
$disabled = 'disabled';
|
417 |
+
}
|
418 |
+
echo ' <option value="' . $source . '"';
|
419 |
+
if ( $selected_source == $source ) {
|
420 |
+
echo ' selected="selected"';
|
421 |
+
}
|
422 |
+
echo $disabled . ' > ' . $value . '</option > ';
|
423 |
+
}
|
424 |
+
} else {
|
425 |
+
echo '<option value="none" > ' . __( 'No Sources', 'nivo-slider' ) . ' </option > ';
|
426 |
+
} ?>
|
427 |
+
</select>
|
428 |
+
<br>
|
429 |
+
<span class="manual description">
|
430 |
+
<?php _e( 'Choose to manually upload images or use images from the media library . ', 'nivo-slider' ); ?>
|
431 |
+
<br>
|
432 |
+
<?php echo apply_filters( 'nivo_field_upsell', 'slider_type' ); ?>
|
433 |
+
</span></td>
|
434 |
+
</tr>
|
435 |
+
<tr valign="top" id="nivo_type_gallery" class="nivo_type">
|
436 |
+
<th scope="row">- <?php _e( 'Gallery Location', 'nivo-slider' ); ?></th>
|
437 |
+
<td>
|
438 |
+
<select
|
439 |
+
name="<?php echo $this->labels['post_meta_key']; ?>[<?php echo $this->labels['type_name']; ?>_gallery]">
|
440 |
+
<?php
|
441 |
+
$args = array(
|
442 |
+
'public' => true,
|
443 |
+
);
|
444 |
+
$post_types = get_post_types( $args, 'objects' );
|
445 |
+
foreach ( $post_types as $post_key => $post_type ) {
|
446 |
+
if ( $post_key == 'attachment' ) {
|
447 |
+
continue;
|
448 |
+
}
|
449 |
+
echo '<optgroup label="' . $post_type->labels->name . '">';
|
450 |
+
$posts = get_posts( array(
|
451 |
+
'numberposts' => - 1,
|
452 |
+
'post_type' => $post_key,
|
453 |
+
) );
|
454 |
+
foreach ( $posts as $post_item ) {
|
455 |
+
echo '<option value="' . $post_item->ID . '"';
|
456 |
+
if ( $this->nivo_default_val( $options, $this->labels['type_name'] . '_gallery' ) == $post_item->ID ) {
|
457 |
+
echo ' selected="selected"';
|
458 |
+
}
|
459 |
+
echo '>' . $post_item->post_title . '</option>';
|
460 |
+
}
|
461 |
+
echo ' </optgroup>';
|
462 |
+
}
|
463 |
+
?>
|
464 |
+
</select><br/>
|
465 |
+
<span
|
466 |
+
class="description"><?php _e( 'Select the post gallery you want to use', 'nivo-slider' ); ?></span>
|
467 |
+
</td>
|
468 |
+
</tr>
|
469 |
+
<tr valign="top" id="nivo_type_category" class="nivo_type">
|
470 |
+
<th scope="row">- <?php _e( 'Category', 'nivo-slider' ); ?></th>
|
471 |
+
<td>
|
472 |
+
<select
|
473 |
+
name="<?php echo $this->labels['post_meta_key']; ?>[<?php echo $this->labels['type_name']; ?>_category]">
|
474 |
+
<?php
|
475 |
+
$categories = get_categories();
|
476 |
+
foreach ( $categories as $category ) {
|
477 |
+
echo '<option value="' . $category->cat_ID . '"';
|
478 |
+
if ( $this->nivo_default_val( $options, $this->labels['type_name'] . '_category' ) == $category->cat_ID ) {
|
479 |
+
echo ' selected="selected"';
|
480 |
+
}
|
481 |
+
echo '>' . $category->name . '</option>';
|
482 |
+
}
|
483 |
+
?>
|
484 |
+
</select><br/>
|
485 |
+
<span
|
486 |
+
class="description"><?php _e( 'Select the category you want to use for post thumbnails', 'nivo-slider' ); ?></span>
|
487 |
+
</td>
|
488 |
+
</tr>
|
489 |
+
<tr valign="top" id="nivo_type_custom" class="nivo_type">
|
490 |
+
<th scope="row">- <?php _e( 'Custom Post Type', 'nivo-slider' ); ?></th>
|
491 |
+
<td>
|
492 |
+
<select
|
493 |
+
name="<?php echo $this->labels['post_meta_key']; ?>[<?php echo $this->labels['type_name']; ?>_custom]">
|
494 |
+
<?php
|
495 |
+
$post_types = get_post_types( array(
|
496 |
+
'public' => true,
|
497 |
+
'_builtin' => false,
|
498 |
+
), 'objects' );
|
499 |
+
foreach ( $post_types as $post_type ) {
|
500 |
+
echo '<option value="' . $post_type->name . '"';
|
501 |
+
if ( $this->nivo_default_val( $options, $this->labels['type_name'] . '_custom' ) == $post_type->name ) {
|
502 |
+
echo ' selected="selected"';
|
503 |
+
}
|
504 |
+
echo '>' . $post_type->labels->name . '</option>';
|
505 |
+
}
|
506 |
+
?>
|
507 |
+
</select><br/>
|
508 |
+
<span
|
509 |
+
class="description"><?php _e( 'Select the custom post type you want to use for post thumbnails', 'nivo-slider' ); ?></span>
|
510 |
+
</td>
|
511 |
+
</tr>
|
512 |
+
<?php
|
513 |
+
// MMP settings for sources
|
514 |
+
$images_sources = $this->core_images->get_image_sources();
|
515 |
+
if ( $images_sources ) {
|
516 |
+
foreach ( $images_sources as $source => $value ) {
|
517 |
+
echo $this->get_image_source_details( $source, $selected_source );
|
518 |
+
}
|
519 |
+
}
|
520 |
+
// Plugin settings
|
521 |
+
$settings = apply_filters( $this->labels['post_type'] . '_admin_edit_settings', array() );
|
522 |
+
foreach ( $settings as $setting ) {
|
523 |
+
$setting = (object) $setting;
|
524 |
+
$class = '';
|
525 |
+
$class .= ( isset( $setting->tr_class ) ) ? $setting->tr_class . ' ' : '';
|
526 |
+
if ( isset( $setting->parent ) ) {
|
527 |
+
if ( ! is_array( $setting->parent ) ) {
|
528 |
+
$parents = array( $setting->parent );
|
529 |
+
} else {
|
530 |
+
$parents = $setting->parent;
|
531 |
+
}
|
532 |
+
foreach ( $parents as $parent ) {
|
533 |
+
$class .= 'parent-' . $parent . ' ';
|
534 |
+
}
|
535 |
+
$class .= ( isset( $setting->visible ) ) ? ' ' . $setting->visible . ' ' : '';
|
536 |
+
}
|
537 |
+
$id = ( isset( $setting->id ) ) ? $setting->id : '';
|
538 |
+
?>
|
539 |
+
<tr valign="top" id="<?php echo $id; ?>" class="<?php echo $class; ?>">
|
540 |
+
<th scope="row"><?php echo ( isset( $setting->sub ) && $setting->sub ) ? '- ' : ''; ?><?php echo $setting->title; ?></th>
|
541 |
+
<td>
|
542 |
+
<?php
|
543 |
+
if ( ! is_array( $setting->name ) ) {
|
544 |
+
$setting->name = array( $setting->name );
|
545 |
+
}
|
546 |
+
foreach ( $setting->name as $setting_key => $setting_name ) {
|
547 |
+
$setting->default = ( isset( $setting->default ) ) ? $setting->default : '';
|
548 |
+
if ( ! is_array( $setting->default ) ) {
|
549 |
+
$setting->default = array( $setting->default );
|
550 |
+
}
|
551 |
+
$element_id = $setting_name;
|
552 |
+
$element_name = $this->labels['post_meta_key'] . '[' . $setting_name . ']';
|
553 |
+
$element_default = ( isset( $setting->default[ $setting_key ] ) ) ? $setting->default[ $setting_key ] : $setting->default[0];
|
554 |
+
$element_value = $this->nivo_default_val( $options, $setting_name, $element_default );
|
555 |
+
$element_class = '';
|
556 |
+
$element_class .= ( isset( $setting->reload ) ) ? 'reload' : '';
|
557 |
+
if ( isset( $setting->pre_element ) && $setting->pre_element != '' ) {
|
558 |
+
echo $setting->pre_element;
|
559 |
+
}
|
560 |
+
switch ( $setting->type ) {
|
561 |
+
case 'text':
|
562 |
+
?>
|
563 |
+
<input type="text" name="<?php echo $element_name; ?>"
|
564 |
+
value="<?php echo $element_value; ?>" class="<?php echo $element_class; ?>"/>
|
565 |
+
<?php
|
566 |
+
break;
|
567 |
+
case 'number':
|
568 |
+
?>
|
569 |
+
<input type="number" name="<?php echo $element_name; ?>"
|
570 |
+
value="<?php echo $element_value; ?>" class="<?php echo $element_class; ?>"/>
|
571 |
+
<?php
|
572 |
+
break;
|
573 |
+
case 'textarea':
|
574 |
+
$rows = ( isset( $setting->rows ) ) ? $setting->rows : 20;
|
575 |
+
$cols = ( isset( $setting->cols ) ) ? $setting->cols : 80;
|
576 |
+
?>
|
577 |
+
<textarea class="<?php echo $element_class; ?>" name="<?php echo $element_name; ?>"
|
578 |
+
rows="<?php echo $rows; ?>"
|
579 |
+
cols="<?php echo $cols; ?>"><?php echo $element_value; ?></textarea>
|
580 |
+
<?php
|
581 |
+
break;
|
582 |
+
case 'checkbox':
|
583 |
+
?>
|
584 |
+
<input type="hidden" name="<?php echo $element_name; ?>" value="off"/>
|
585 |
+
<input id="<?php echo $element_id; ?>" type="checkbox"
|
586 |
+
name="<?php echo $element_name; ?>"
|
587 |
+
value="on"<?php if ( $element_value == 'on' ) {
|
588 |
+
echo ' checked="checked"';
|
589 |
+
} ?>/>
|
590 |
+
<?php
|
591 |
+
break;
|
592 |
+
case 'select':
|
593 |
+
?>
|
594 |
+
<select id="<?php echo $element_id; ?>" name="<?php echo $element_name; ?>"
|
595 |
+
class="<?php echo $element_class; ?>">
|
596 |
+
<?php
|
597 |
+
foreach ( $setting->options as $value => $name ) {
|
598 |
+
?>
|
599 |
+
<option value="<?php echo $value; ?>"<?php if ( $value == $element_value ) {
|
600 |
+
echo ' selected="selected"';
|
601 |
+
} ?>><?php echo $name; ?></option>
|
602 |
+
<?php } ?>
|
603 |
+
</select>
|
604 |
+
<?php
|
605 |
+
break;
|
606 |
+
case 'custom':
|
607 |
+
echo isset( $setting->custom ) ? $setting->custom : '';
|
608 |
+
break;
|
609 |
+
|
610 |
+
}
|
611 |
+
if ( isset( $setting->connect ) && ( $setting_key + 1 ) < count( $setting->name ) ) {
|
612 |
+
echo $setting->connect;
|
613 |
+
}
|
614 |
+
if ( isset( $setting->post_element ) && $setting->post_element != '' ) {
|
615 |
+
echo $setting->post_element;
|
616 |
+
}
|
617 |
+
if ( ( $setting_key + 1 ) == count( $setting->name ) && $setting->type != 'checkbox' ) {
|
618 |
+
echo '<br>';
|
619 |
+
}
|
620 |
+
}
|
621 |
+
if ( isset( $setting->descp ) && $setting->descp != '' ) {
|
622 |
+
?>
|
623 |
+
<span class="description"><?php echo $setting->descp; ?></span>
|
624 |
+
<?php
|
625 |
+
}
|
626 |
+
if ( isset( $setting->post_descp ) && $setting->post_descp != '' ) {
|
627 |
+
echo $setting->post_descp;
|
628 |
+
}
|
629 |
+
?>
|
630 |
+
</td>
|
631 |
+
</tr>
|
632 |
+
<?php
|
633 |
+
}
|
634 |
+
?>
|
635 |
+
</table>
|
636 |
+
<?php
|
637 |
+
}
|
638 |
+
|
639 |
+
/**
|
640 |
+
* Amend the settings of the [gallery] post before saving
|
641 |
+
*
|
642 |
+
* @since 2.2.*
|
643 |
+
* @access public
|
644 |
+
*
|
645 |
+
* @param string $image_source Source of the [gallery] images
|
646 |
+
* @param string $selected_source Selected source of the [gallery] images
|
647 |
+
*
|
648 |
+
* @return string
|
649 |
+
*/
|
650 |
+
public function get_image_source_details( $image_source, $selected_source ) {
|
651 |
+
if ( ! $this->nivo_mmp_active() ) {
|
652 |
+
return '';
|
653 |
+
}
|
654 |
+
$defaults = $this->core_images->image_sources_defaults();
|
655 |
+
if ( ! array_key_exists( $image_source, $defaults ) ) {
|
656 |
+
$var = 'media_manager_plus_source_' . $image_source;
|
657 |
+
$obj = new $var();
|
658 |
+
$settings = $obj->show_details();
|
659 |
+
global $post;
|
660 |
+
$options = get_post_meta( $post->ID, $this->labels['post_meta_key'], true );
|
661 |
+
$display = ( $image_source != $selected_source ) ? 'style="display: none;"' : '';
|
662 |
+
$header = '<tr valign="top" id="nivo_type_' . $image_source . '" class="nivo_type image_source" ' . $display . '>';
|
663 |
+
$header .= '<th scope="row"> ' . ucfirst( $image_source ) . ' settings</th>';
|
664 |
+
$header .= '<td>';
|
665 |
+
$body = '<label>';
|
666 |
+
$body .= ' <select name="' . $this->labels['post_meta_key'] . '[' . $image_source . '_type]" class="image_source_type" >';
|
667 |
+
foreach ( $settings as $method => $value ) {
|
668 |
+
$selected = ( $this->nivo_default_val( $options, $image_source . '_type', '' ) ) == $method ? 'selected="selected"' : '';
|
669 |
+
$body .= '<option ' . $selected . ' value="' . $method . '">' . $value['name'] . '</option>';
|
670 |
+
}
|
671 |
+
$body .= ' </select><br>';
|
672 |
+
$body .= ' <span class="description">Choose the type of images from ' . ucfirst( $image_source ) . ' </span>';
|
673 |
+
$body .= '</label>';
|
674 |
+
foreach ( $settings as $method => $value ) {
|
675 |
+
if ( isset( $value['param_type'] ) ) {
|
676 |
+
$body .= '<div id="' . $image_source . '_param_' . $method . '" class="image_source_param">';
|
677 |
+
if ( $value['param_type'] == 'text' ) {
|
678 |
+
$body .= '<br><input id="' . $image_source . '_' . $method . '" type="text" value="' . $this->nivo_default_val( $options, $image_source . '_' . $method, '' ) . '" name="' . $this->labels['post_meta_key'] . '[' . $image_source . '_' . $method . ']">';
|
679 |
+
}
|
680 |
+
if ( $value['param_type'] == 'select' ) {
|
681 |
+
if ( $value['param_dynamic'] ) {
|
682 |
+
$mmp_options = get_option( 'ubermediasettings_settings', array() );
|
683 |
+
$mmp_sources = $this->nivo_default_val( $mmp_options, 'ubermediasettings_sources_available', array() );
|
684 |
+
$source_settings = $mmp_sources[ $image_source . '-settings' ];
|
685 |
+
$access_token = $source_settings['access-token'];
|
686 |
+
$param_obj = new $var( $access_token['oauth_token'], $access_token['oauth_token_secret'] );
|
687 |
+
$param_choices = $param_obj->get_param_choices( $method );
|
688 |
+
|
689 |
+
} else {
|
690 |
+
$param_choices = $value['param_choices'];
|
691 |
+
}
|
692 |
+
$body .= ' <select id="' . $image_source . '_' . $method . '" name="' . $this->labels['post_meta_key'] . '[' . $image_source . '_' . $method . ']">';
|
693 |
+
foreach ( $param_choices as $choice_key => $choice_value ) {
|
694 |
+
$selected = ( $this->nivo_default_val( $options, $image_source . '_' . $method, '' ) ) == $choice_key ? 'selected="selected"' : '';
|
695 |
+
$body .= '<option ' . $selected . ' value="' . $choice_key . '">' . $choice_value . '</option>';
|
696 |
+
}
|
697 |
+
$body .= ' </select>';
|
698 |
+
}
|
699 |
+
$body .= ( isset( $value['param_desc'] ) ) ? ' <span class="description">' . $value['param_desc'] . '</span>' : '';
|
700 |
+
$body .= '</div>';
|
701 |
+
}
|
702 |
+
}
|
703 |
+
$footer = '</td></tr>';
|
704 |
+
$html = $header . $body . $footer;
|
705 |
+
|
706 |
+
return $html;
|
707 |
+
}
|
708 |
+
}
|
709 |
+
|
710 |
+
/**
|
711 |
+
* Adds the custom columns to the post type admin index screen
|
712 |
+
*
|
713 |
+
* @since 2.2.*
|
714 |
+
* @access public
|
715 |
+
*
|
716 |
+
* @param array $columns The columns.
|
717 |
+
*
|
718 |
+
* @return array
|
719 |
+
*/
|
720 |
+
public function edit_columns( $columns ) {
|
721 |
+
$columns = array(
|
722 |
+
'cb' => '<input type="checkbox" />',
|
723 |
+
'title' => __( 'Title', 'nivo-slider' ),
|
724 |
+
'shortcode' => __( 'Shortcode', 'nivo-slider' ),
|
725 |
+
'source' => __( 'Source', 'nivo-slider' ),
|
726 |
+
'type' => __( 'Type', 'nivo-slider' ),
|
727 |
+
'images' => __( 'Images', 'nivo-slider' ),
|
728 |
+
'author' => __( 'Author', 'nivo-slider' ),
|
729 |
+
'date' => __( 'Date', 'nivo-slider' ),
|
730 |
+
);
|
731 |
+
|
732 |
+
return apply_filters( 'nivo_edit_columns', $columns );
|
733 |
+
}
|
734 |
+
|
735 |
+
/**
|
736 |
+
* Populates the data in the custom columns
|
737 |
+
*
|
738 |
+
* @since 2.2.*
|
739 |
+
* @access public
|
740 |
+
*
|
741 |
+
* @param string $column The column.
|
742 |
+
*
|
743 |
+
* @return mixed
|
744 |
+
*/
|
745 |
+
public function custom_columns( $column ) {
|
746 |
+
global $post;
|
747 |
+
if ( $post->post_type != $this->labels['post_type'] ) {
|
748 |
+
return;
|
749 |
+
}
|
750 |
+
$options = get_post_meta( $post->ID, $this->labels['post_meta_key'], true );
|
751 |
+
do_action( $this->labels['post_type'] . '_custom_column_switch', $post, $column, $options );
|
752 |
+
$version = substr( $this->nivo_default_val( $options, $this->labels['plugin_version'], '2.5.1' ), 0, 1 );
|
753 |
+
if ( $version < 3 ) {
|
754 |
+
$type = $this->nivo_default_val( $options, 'type', $this->core_images->image_source_default() );
|
755 |
+
} else {
|
756 |
+
$type = $this->nivo_default_val( $options, $this->labels['source_name'], $this->core_images->image_source_default() );
|
757 |
+
}
|
758 |
+
$types = $this->core_images->get_image_sources();
|
759 |
+
switch ( $column ) {
|
760 |
+
case 'images':
|
761 |
+
$limit = 5;
|
762 |
+
if ( isset( $_GET['mode'] ) && $_GET['mode'] == 'excerpt' ) {
|
763 |
+
$limit = 20;
|
764 |
+
}
|
765 |
+
$images = $this->core_images->get_images( $post->ID, 'thumbnail', $limit );
|
766 |
+
if ( $images ) {
|
767 |
+
echo '<ul class="nivo-plugin-thumbs">';
|
768 |
+
foreach ( $images as $image ) {
|
769 |
+
echo '<li><img src="' . $image['image_src'] . '" alt="' . $image['alt_text'] . '" style="width:32px;height:32px;" /></li>';
|
770 |
+
}
|
771 |
+
echo '</ul>';
|
772 |
+
} else {
|
773 |
+
if ( ( ! isset( $types[ $type ] ) || $type == $this->labels['manual_name'] ) && ( ! isset( $options['manual_image_ids'] ) || $options['manual_image_ids'] == '' ) ) {
|
774 |
+
$images = $this->nivo_get_attached_images( $post->ID, 1 );
|
775 |
+
if ( $images ) {
|
776 |
+
echo '<a class="reattach-images" data-post="' . $post->ID . '" href="#">Reattach Images</a><div class="reattach-spinner spinner"></div>';
|
777 |
+
} else {
|
778 |
+
echo 'No images attached';
|
779 |
+
}
|
780 |
+
}
|
781 |
+
}
|
782 |
+
break;
|
783 |
+
case 'shortcode':
|
784 |
+
echo '<code>[' . $this->labels['shortcode'] . ' id="' . $post->ID . '"]</code>';
|
785 |
+
if ( $post->post_name != '' ) {
|
786 |
+
echo '<br /><code>[' . $this->labels['shortcode'] . ' slug="' . $post->post_name . '"]</code>';
|
787 |
+
}
|
788 |
+
break;
|
789 |
+
case 'type':
|
790 |
+
echo 'slider';
|
791 |
+
// TODO add custom switch for custom taxonomy `nivo_type`
|
792 |
+
break;
|
793 |
+
case 'source':
|
794 |
+
echo isset( $types[ $type ] ) ? $types[ $type ] : 'Manual';
|
795 |
+
switch ( $type ) {
|
796 |
+
case 'gallery':
|
797 |
+
$gallery_post = get_the_title( $this->nivo_default_val( $options, $this->labels['type_name'] . '_gallery' ) );
|
798 |
+
echo '<br><em>' . $gallery_post . '</em>';
|
799 |
+
break;
|
800 |
+
case 'category':
|
801 |
+
$category = get_category( $this->nivo_default_val( $options, $this->labels['type_name'] . '_category' ) );
|
802 |
+
echo '<br><em>' . $category->name . '</em>';
|
803 |
+
break;
|
804 |
+
case 'custom':
|
805 |
+
$post_type = get_post_type_object( $this->nivo_default_val( $options, $this->labels['type_name'] . '_custom' ) );
|
806 |
+
echo '<br><em>' . ( ( isset( $post_type->labels->name ) ) ? $post_type->labels->name : ucfirst( $post_type ) ) . '</em>';
|
807 |
+
break;
|
808 |
+
}
|
809 |
+
break;
|
810 |
+
}
|
811 |
+
}
|
812 |
+
|
813 |
+
/**
|
814 |
+
* Get the documentation link
|
815 |
+
*
|
816 |
+
* @since 2.2.*
|
817 |
+
* @access private
|
818 |
+
* @return string
|
819 |
+
*/
|
820 |
+
private function get_documentation_link() {
|
821 |
+
if ( isset( $this->labels['documentation'] ) && $this->labels['documentation'] ) {
|
822 |
+
return $this->labels['documentation'];
|
823 |
+
}
|
824 |
+
|
825 |
+
return 'http://docs.themeisle.com';
|
826 |
+
}
|
827 |
+
}
|
includes/{core/includes/admin-images.php → admin/libs/class-nivo-core-admin-images.php}
RENAMED
@@ -1,42 +1,38 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
*
|
8 |
-
* @
|
9 |
-
* @
|
10 |
*/
|
11 |
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
/**
|
18 |
-
*
|
19 |
*
|
20 |
-
*
|
|
|
|
|
|
|
|
|
21 |
*/
|
22 |
-
class
|
23 |
|
24 |
/**
|
25 |
-
*
|
|
|
|
|
|
|
26 |
*/
|
27 |
-
|
28 |
-
add_action( 'after_setup_theme', array( $this, 'theme_support_check' ), 999 );
|
29 |
-
add_filter( 'media_view_strings', array( $this, 'custom_media_string' ), 11, 2 );
|
30 |
-
add_filter( 'uber_media_pre_insert', array( $this, 'mmp_pre_insert' ) );
|
31 |
-
add_action( 'admin_footer', array( $this, 'print_media_templates' ) );
|
32 |
-
}
|
33 |
|
34 |
/**
|
35 |
* Checks for themes that haven't added 'post-thumbnails' support required and adds it.
|
36 |
*
|
37 |
-
* @since
|
38 |
-
*
|
39 |
-
* @access public
|
40 |
*/
|
41 |
public function theme_support_check() {
|
42 |
$support = get_theme_support( 'post-thumbnails' );
|
@@ -48,32 +44,30 @@ class Dev7_Core_Admin_Images extends Dev7_Core {
|
|
48 |
/**
|
49 |
* Apply custom strings to the Media View for integrating with Media Manager Plus
|
50 |
*
|
51 |
-
* @since
|
52 |
-
*
|
53 |
-
* @param
|
54 |
-
* @param
|
55 |
-
*
|
56 |
-
* @access public
|
57 |
-
* @return array $strings
|
58 |
*/
|
59 |
public function custom_media_string( $strings, $post ) {
|
60 |
-
if ( isset( $post->post_type ) && $post->post_type == $this->labels
|
61 |
-
$strings['createGalleryTitle'] = sprintf( __( 'Create %1$s', '
|
62 |
-
$strings['createNewGallery'] = sprintf( __( 'Create %1$s', '
|
63 |
-
$strings['addToGallery'] = sprintf( __( 'Add to %1$s', '
|
64 |
-
$strings['addToGalleryTitle'] = sprintf( __( 'Add to %1$s', '
|
65 |
-
$strings['editGalleryTitle'] = sprintf( __( 'Edit %1$s', '
|
66 |
-
$strings['insertGallery'] = sprintf( __( 'Save %1$s', '
|
67 |
-
$strings['updateGallery'] = sprintf( __( 'Update %1$s', '
|
68 |
-
$strings['nivoSideDetails'] = __( 'Slide Details', '
|
69 |
-
|
70 |
-
$strings['ubermediaButton'] = sprintf( __( 'Add to %1$s', '
|
71 |
$strings['mmp_menu'] = 'gallery';
|
72 |
-
$strings['mmp_menu_prefix'] = __( 'Add from ', '
|
73 |
-
sprintf( __( 'Update %1$s', '
|
74 |
|
75 |
-
$options = get_post_meta( $post->ID, $this->labels
|
76 |
-
$strings[$this->labels
|
77 |
}
|
78 |
|
79 |
return $strings;
|
@@ -82,20 +76,21 @@ class Dev7_Core_Admin_Images extends Dev7_Core {
|
|
82 |
/**
|
83 |
* Print custom media templates for integrating with Media Manager Plus
|
84 |
*
|
85 |
-
* @since
|
86 |
-
* @
|
87 |
-
* @
|
|
|
88 |
*/
|
89 |
public function print_media_templates() {
|
90 |
global $post;
|
91 |
-
if ( isset( $post->post_type ) && $post->post_type == $this->labels
|
92 |
?>
|
93 |
<script type="text/html" id="tmpl-attachment-details">
|
94 |
<h3>
|
95 |
-
|
96 |
-
|
97 |
<span class="spinner"></span>
|
98 |
-
<span class="saved"><?php esc_html_e('Saved.'); ?></span>
|
99 |
</span>
|
100 |
</h3>
|
101 |
<div class="attachment-info">
|
@@ -113,17 +108,17 @@ class Dev7_Core_Admin_Images extends Dev7_Core {
|
|
113 |
</div>
|
114 |
<# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
|
115 |
<label class="setting" data-setting="caption">
|
116 |
-
<span><?php _e( 'Caption', '
|
117 |
<textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
|
118 |
</label>
|
119 |
<# if ( 'image' === data.type ) { #>
|
120 |
<label class="setting" data-setting="alt">
|
121 |
-
<span><?php _e( 'Alt Text', '
|
122 |
<input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
|
123 |
</label>
|
124 |
<# } #>
|
125 |
<label class="setting" data-customsetting="metalink">
|
126 |
-
<span><?php _e( 'Link', '
|
127 |
<input type="text" value="{{ data.metalink }}" {{ maybeReadOnly }} />
|
128 |
</label>
|
129 |
</script>
|
@@ -137,38 +132,36 @@ class Dev7_Core_Admin_Images extends Dev7_Core {
|
|
137 |
<div class="thumbnail">
|
138 |
</div>
|
139 |
</div>
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
<span><?php _e( 'Title', '
|
148 |
<input id="title-uber" type="text" data-setting="title" value="{{{ data.selected_image.title }}}" />
|
149 |
<input name="original-title" type="hidden" value="{{{ data.selected_image.title }}}" />
|
150 |
</label>
|
151 |
<label class="setting alt-text">
|
152 |
-
<span><?php _e( 'Alt Text', '
|
153 |
<input id="alt-uber" type="text" data-setting="alt" value="{{{ data.selected_image.title }}}" />
|
154 |
</label>
|
155 |
</script>
|
156 |
-
|
157 |
}
|
158 |
}
|
159 |
|
160 |
/**
|
161 |
* Upload to the media library and attach images added to [gallery] via Media Manager Plus
|
162 |
*
|
163 |
-
* @since
|
164 |
-
*
|
165 |
-
* @param
|
166 |
-
*
|
167 |
-
* @access public
|
168 |
* @return array $response
|
169 |
*/
|
170 |
public function mmp_pre_insert( $response ) {
|
171 |
-
if ( isset( $response['fields']['
|
172 |
if ( ! isset( $response['fields']['id'] ) ) {
|
173 |
return $response;
|
174 |
}
|
@@ -188,16 +181,13 @@ class Dev7_Core_Admin_Images extends Dev7_Core {
|
|
188 |
/**
|
189 |
* Upload to the media library and attach images added to [gallery] via Media Manager Plus
|
190 |
*
|
191 |
-
* @since
|
192 |
-
*
|
193 |
-
* @param
|
194 |
-
* @param
|
195 |
-
* @param
|
196 |
-
* @param
|
197 |
-
*
|
198 |
-
* @access private
|
199 |
-
* @return int $id Attachment ID / string $src Attached image url
|
200 |
-
*
|
201 |
*/
|
202 |
private function attach_image( $url, $title, $post_id, $return_src = true ) {
|
203 |
$tmp = download_url( $url );
|
@@ -211,7 +201,7 @@ class Dev7_Core_Admin_Images extends Dev7_Core {
|
|
211 |
$file_name = $file_name . '.' . ( isset( $info['extension'] ) ? $info['extension'] : 'jpg' );
|
212 |
$file_array = array(
|
213 |
'name' => $file_name,
|
214 |
-
'tmp_name' => $tmp
|
215 |
);
|
216 |
|
217 |
if ( is_wp_error( $tmp ) ) {
|
@@ -236,4 +226,4 @@ class Dev7_Core_Admin_Images extends Dev7_Core {
|
|
236 |
return $id;
|
237 |
}
|
238 |
}
|
239 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* The admin-images functionality of the plugin.
|
4 |
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/admin/libs
|
10 |
*/
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
/**
|
13 |
+
* The admin-images functionality of the plugin.
|
14 |
*
|
15 |
+
* TODO WRITE DESCRIPTION
|
16 |
+
*
|
17 |
+
* @package nivo-slider
|
18 |
+
* @subpackage nivo-slider/includes/admin/libs
|
19 |
+
* @author ThemeIsle <friends@themeisle.com>
|
20 |
*/
|
21 |
+
class Nivo_Core_Admin_Images extends Nivo_Core_Abstract implements Nivo_Library_Interface {
|
22 |
|
23 |
/**
|
24 |
+
* Use this instead of overriding __construct
|
25 |
+
*
|
26 |
+
* @since 3.0.0
|
27 |
+
* @access public
|
28 |
*/
|
29 |
+
public function after_core_construct() {}
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
/**
|
32 |
* Checks for themes that haven't added 'post-thumbnails' support required and adds it.
|
33 |
*
|
34 |
+
* @since 2.3.2
|
35 |
+
* @access public
|
|
|
36 |
*/
|
37 |
public function theme_support_check() {
|
38 |
$support = get_theme_support( 'post-thumbnails' );
|
44 |
/**
|
45 |
* Apply custom strings to the Media View for integrating with Media Manager Plus
|
46 |
*
|
47 |
+
* @since 2.2.*
|
48 |
+
* @access public
|
49 |
+
* @param array $strings Media View strings
|
50 |
+
* @param object $post Current Post
|
51 |
+
* @return array
|
|
|
|
|
52 |
*/
|
53 |
public function custom_media_string( $strings, $post ) {
|
54 |
+
if ( isset( $post->post_type ) && $post->post_type == $this->labels['post_type'] ) {
|
55 |
+
$strings['createGalleryTitle'] = sprintf( __( 'Create %1$s', 'nivo-slider' ), $this->labels['singular'] );
|
56 |
+
$strings['createNewGallery'] = sprintf( __( 'Create %1$s', 'nivo-slider' ), strtolower( $this->labels['singular'] ) );
|
57 |
+
$strings['addToGallery'] = sprintf( __( 'Add to %1$s', 'nivo-slider' ), strtolower( $this->labels['singular'] ) );
|
58 |
+
$strings['addToGalleryTitle'] = sprintf( __( 'Add to %1$s', 'nivo-slider' ), $this->labels['singular'] );
|
59 |
+
$strings['editGalleryTitle'] = sprintf( __( 'Edit %1$s', 'nivo-slider' ), $this->labels['singular'] );
|
60 |
+
$strings['insertGallery'] = sprintf( __( 'Save %1$s', 'nivo-slider' ), $this->labels['singular'] );
|
61 |
+
$strings['updateGallery'] = sprintf( __( 'Update %1$s', 'nivo-slider' ), $this->labels['singular'] );
|
62 |
+
$strings['nivoSideDetails'] = __( 'Slide Details', 'nivo-slider' );
|
63 |
+
|
64 |
+
$strings['ubermediaButton'] = sprintf( __( 'Add to %1$s', 'nivo-slider' ), strtolower( $this->labels['singular'] ) );
|
65 |
$strings['mmp_menu'] = 'gallery';
|
66 |
+
$strings['mmp_menu_prefix'] = __( 'Add from ', 'nivo-slider' );
|
67 |
+
sprintf( __( 'Update %1$s', 'nivo-slider' ), $this->labels['singular'] );
|
68 |
|
69 |
+
$options = get_post_meta( $post->ID, $this->labels['post_meta_key'], true );
|
70 |
+
$strings[ $this->labels['post_type'] . 'Images' ] = $this->nivo_default_val( $options, 'manual_image_ids', '' );
|
71 |
}
|
72 |
|
73 |
return $strings;
|
76 |
/**
|
77 |
* Print custom media templates for integrating with Media Manager Plus
|
78 |
*
|
79 |
+
* @since 2.2.*
|
80 |
+
* @access public
|
81 |
+
* @global object $post WordPress Post
|
82 |
+
* @return mixed
|
83 |
*/
|
84 |
public function print_media_templates() {
|
85 |
global $post;
|
86 |
+
if ( isset( $post->post_type ) && $post->post_type == $this->labels['post_type'] ) {
|
87 |
?>
|
88 |
<script type="text/html" id="tmpl-attachment-details">
|
89 |
<h3>
|
90 |
+
<?php _e( 'Slide Details', 'nivo-slider' ); ?>
|
91 |
+
<span class="settings-save-status">
|
92 |
<span class="spinner"></span>
|
93 |
+
<span class="saved"><?php esc_html_e( 'Saved.', 'nivo-slider' ); ?></span>
|
94 |
</span>
|
95 |
</h3>
|
96 |
<div class="attachment-info">
|
108 |
</div>
|
109 |
<# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
|
110 |
<label class="setting" data-setting="caption">
|
111 |
+
<span><?php _e( 'Caption', 'nivo-slider' ); ?></span>
|
112 |
<textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
|
113 |
</label>
|
114 |
<# if ( 'image' === data.type ) { #>
|
115 |
<label class="setting" data-setting="alt">
|
116 |
+
<span><?php _e( 'Alt Text', 'nivo-slider' ); ?></span>
|
117 |
<input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
|
118 |
</label>
|
119 |
<# } #>
|
120 |
<label class="setting" data-customsetting="metalink">
|
121 |
+
<span><?php _e( 'Link', 'nivo-slider' ); ?></span>
|
122 |
<input type="text" value="{{ data.metalink }}" {{ maybeReadOnly }} />
|
123 |
</label>
|
124 |
</script>
|
132 |
<div class="thumbnail">
|
133 |
</div>
|
134 |
</div>
|
135 |
+
<?php if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
|
136 |
+
<label class="setting caption">
|
137 |
+
<span><?php _e( 'Caption', 'nivo-slider' ); ?></span>
|
138 |
+
<textarea id="caption-uber" data-setting="caption"></textarea>
|
139 |
+
</label>
|
140 |
+
<?php endif; ?>
|
141 |
+
<label class="setting alt-text">
|
142 |
+
<span><?php _e( 'Title', 'nivo-slider' ); ?></span>
|
143 |
<input id="title-uber" type="text" data-setting="title" value="{{{ data.selected_image.title }}}" />
|
144 |
<input name="original-title" type="hidden" value="{{{ data.selected_image.title }}}" />
|
145 |
</label>
|
146 |
<label class="setting alt-text">
|
147 |
+
<span><?php _e( 'Alt Text', 'nivo-slider' ); ?></span>
|
148 |
<input id="alt-uber" type="text" data-setting="alt" value="{{{ data.selected_image.title }}}" />
|
149 |
</label>
|
150 |
</script>
|
151 |
+
<?php
|
152 |
}
|
153 |
}
|
154 |
|
155 |
/**
|
156 |
* Upload to the media library and attach images added to [gallery] via Media Manager Plus
|
157 |
*
|
158 |
+
* @since 2.2.*
|
159 |
+
* @access public
|
160 |
+
* @param array $response MMP response
|
|
|
|
|
161 |
* @return array $response
|
162 |
*/
|
163 |
public function mmp_pre_insert( $response ) {
|
164 |
+
if ( isset( $response['fields']['nivo_plugin'] ) && $response['fields']['nivo_plugin'] == $this->labels['post_type'] ) {
|
165 |
if ( ! isset( $response['fields']['id'] ) ) {
|
166 |
return $response;
|
167 |
}
|
181 |
/**
|
182 |
* Upload to the media library and attach images added to [gallery] via Media Manager Plus
|
183 |
*
|
184 |
+
* @since 2.2.*
|
185 |
+
* @access private
|
186 |
+
* @param string $url external image url
|
187 |
+
* @param string $title external image caption
|
188 |
+
* @param int $post_id ID of [gallery] post to attach it to
|
189 |
+
* @param bool $return_src default false. True returns $src, false returns $id
|
190 |
+
* @return mixed
|
|
|
|
|
|
|
191 |
*/
|
192 |
private function attach_image( $url, $title, $post_id, $return_src = true ) {
|
193 |
$tmp = download_url( $url );
|
201 |
$file_name = $file_name . '.' . ( isset( $info['extension'] ) ? $info['extension'] : 'jpg' );
|
202 |
$file_array = array(
|
203 |
'name' => $file_name,
|
204 |
+
'tmp_name' => $tmp,
|
205 |
);
|
206 |
|
207 |
if ( is_wp_error( $tmp ) ) {
|
226 |
return $id;
|
227 |
}
|
228 |
}
|
229 |
+
}
|
includes/{core/includes/images.php → admin/libs/class-nivo-core-images.php}
RENAMED
@@ -1,204 +1,203 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
* @
|
6 |
-
* @
|
7 |
-
*
|
8 |
-
* @
|
9 |
-
* @
|
10 |
*/
|
11 |
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
/**
|
18 |
-
*
|
19 |
*
|
20 |
-
*
|
|
|
|
|
|
|
|
|
21 |
*/
|
22 |
-
class
|
23 |
|
24 |
/**
|
25 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
*
|
27 |
-
* @since 2.2
|
28 |
-
* @access public static
|
29 |
* @return array
|
30 |
*/
|
31 |
-
public static function
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
$
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
)
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
-
return
|
82 |
}
|
83 |
|
84 |
/**
|
85 |
-
*
|
86 |
*
|
87 |
-
* @since
|
88 |
-
* @access
|
89 |
-
* @return array $sources image sources
|
90 |
*/
|
91 |
-
function
|
92 |
-
$sources = $this->image_sources_defaults();
|
93 |
-
$exclude = apply_filters( 'mmp_feed_exclude', array() );
|
94 |
-
if ( dev7_mmp_active() ) {
|
95 |
-
$mmp_options = get_option( 'ubermediasettings_settings', array() );
|
96 |
-
$mmp_sources = dev7_default_val( $mmp_options, 'ubermediasettings_sources_available', array() );
|
97 |
-
if ( $mmp_sources ) {
|
98 |
-
foreach ( $mmp_sources as $mmp_source => $mmp_settings ) {
|
99 |
-
$mmp_source_name = str_replace( '-settings', '', $mmp_source );
|
100 |
-
if ( ! class_exists( 'media_manager_plus_source_' . $mmp_source_name ) ) {
|
101 |
-
continue;
|
102 |
-
}
|
103 |
-
if ( array_key_exists( $mmp_source_name, $exclude ) ) {
|
104 |
-
continue;
|
105 |
-
}
|
106 |
-
$sources[$mmp_source_name] = ucfirst( $mmp_source_name ) . ' Feed';
|
107 |
-
}
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
-
return apply_filters( $this->labels->post_type . '_get_image_sources', $sources );
|
112 |
}
|
113 |
|
114 |
/**
|
115 |
-
*
|
116 |
-
*
|
117 |
-
* @since 2.2
|
118 |
-
* @access private
|
119 |
-
*
|
120 |
-
* @param $url
|
121 |
*
|
122 |
-
* @
|
|
|
|
|
123 |
*/
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
-
return $
|
131 |
}
|
132 |
|
133 |
/**
|
134 |
* Returns the images for a [gallery]
|
135 |
*
|
136 |
-
* @since
|
|
|
137 |
*
|
138 |
-
* @param
|
139 |
-
* @param
|
140 |
-
* @param
|
141 |
-
* @param
|
142 |
-
* @param
|
143 |
-
* @param
|
144 |
-
* @param
|
145 |
-
* @param
|
146 |
-
* @param
|
147 |
-
* @param
|
148 |
*
|
149 |
-
* @
|
150 |
-
* @return array $images images
|
151 |
*/
|
152 |
-
public function get_images(
|
153 |
-
$post_id,
|
154 |
-
$size = '',
|
155 |
-
$limit = null,
|
156 |
-
$source = null,
|
157 |
-
$method = null,
|
158 |
-
$param = null,
|
159 |
-
$gallery = null,
|
160 |
-
$category = null,
|
161 |
-
$custom = null,
|
162 |
-
$image_ids = null
|
163 |
-
) {
|
164 |
-
|
165 |
-
$options = get_post_meta( $post_id, $this->labels->post_meta_key, true );
|
166 |
if ( ! $options ) {
|
167 |
$options = array();
|
168 |
}
|
169 |
-
|
170 |
if ( $size == '' ) {
|
171 |
-
$size =
|
172 |
}
|
173 |
-
|
174 |
-
$images = array();
|
175 |
-
|
176 |
$sources = $this->get_image_sources();
|
177 |
-
|
178 |
-
if ( ! isset( $options[$this->labels->source_name] ) || ! array_key_exists( $options[$this->labels->source_name], $sources ) ) {
|
179 |
$image_source = $this->image_source_default();
|
180 |
} else {
|
181 |
-
$image_source =
|
182 |
}
|
183 |
-
|
184 |
if ( $source ) {
|
185 |
$image_source = $source;
|
186 |
}
|
187 |
-
|
188 |
if ( $limit ) {
|
189 |
$limit = $limit;
|
190 |
} else {
|
191 |
$limit = ( isset( $options['number_images'] ) && $options['number_images'] != '' ) ? $options['number_images'] : - 1;
|
192 |
}
|
193 |
-
|
194 |
-
if ( $image_source == $this->labels->manual_name ) {
|
195 |
-
|
196 |
if ( $image_ids ) {
|
197 |
$attach_str = $image_ids;
|
198 |
$options['manual_image_ids'] = $attach_str;
|
199 |
-
update_post_meta( $post_id, $this->labels
|
200 |
} else {
|
201 |
-
$attach_str =
|
202 |
}
|
203 |
$attachments = explode( ',', $attach_str );
|
204 |
$count = 0;
|
@@ -209,28 +208,25 @@ class Dev7_Core_Images extends Dev7_Core {
|
|
209 |
}
|
210 |
$count ++;
|
211 |
$attachment = get_post( $attachment_id );
|
212 |
-
|
213 |
if ( $limit != '-1' && $count > $limit ) {
|
214 |
break;
|
215 |
}
|
216 |
$image = wp_get_attachment_image_src( $attachment->ID, $size );
|
217 |
$thumbnail = wp_get_attachment_image_src( $attachment->ID, 'thumbnail' );
|
218 |
-
|
219 |
-
$
|
220 |
-
|
221 |
-
$images[] = array(
|
222 |
'image_src' => $image[0],
|
223 |
'post_permalink' => $url,
|
224 |
'post_title' => wptexturize( $attachment->post_excerpt ),
|
225 |
'alt_text' => trim( strip_tags( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ) ) ),
|
226 |
'attachment_id' => $attachment->ID,
|
227 |
-
'thumbnail' => $thumbnail[0]
|
228 |
);
|
229 |
}
|
230 |
}
|
231 |
-
}
|
232 |
-
$gallery = ( $gallery ) ? $gallery : $options[$this->labels
|
233 |
-
$attachments =
|
234 |
if ( $attachments ) {
|
235 |
foreach ( $attachments as $attachment ) {
|
236 |
$image = wp_get_attachment_image_src( $attachment->ID, $size );
|
@@ -244,16 +240,16 @@ class Dev7_Core_Images extends Dev7_Core {
|
|
244 |
'post_title' => $caption,
|
245 |
'alt_text' => $caption,
|
246 |
'attachment_id' => $attachment->ID,
|
247 |
-
'thumbnail' => $thumbnail[0]
|
248 |
);
|
249 |
}
|
250 |
}
|
251 |
-
}
|
252 |
-
$category = ( $category ) ? $category : $options[$this->labels
|
253 |
$args = array(
|
254 |
'post_type' => 'post',
|
255 |
'numberposts' => $limit,
|
256 |
-
'category' => $category
|
257 |
);
|
258 |
$posts = get_posts( $args );
|
259 |
if ( $posts ) {
|
@@ -270,17 +266,17 @@ class Dev7_Core_Images extends Dev7_Core {
|
|
270 |
'post_title' => $title,
|
271 |
'alt_text' => $title,
|
272 |
'attachment_id' => $attachment_id,
|
273 |
-
'thumbnail' => $thumbnail[0]
|
274 |
);
|
275 |
}
|
276 |
}
|
277 |
}
|
278 |
-
}
|
279 |
$sticky = get_option( 'sticky_posts' );
|
280 |
$args = array(
|
281 |
'post_type' => 'post',
|
282 |
'numberposts' => $limit,
|
283 |
-
'post__in' => $sticky
|
284 |
);
|
285 |
$posts = get_posts( $args );
|
286 |
if ( $posts ) {
|
@@ -297,17 +293,17 @@ class Dev7_Core_Images extends Dev7_Core {
|
|
297 |
'post_title' => $title,
|
298 |
'alt_text' => $title,
|
299 |
'attachment_id' => $attachment_id,
|
300 |
-
'thumbnail' => $thumbnail[0]
|
301 |
);
|
302 |
}
|
303 |
}
|
304 |
}
|
305 |
} else {
|
306 |
if ( $image_source == 'custom' ) {
|
307 |
-
$custom = ( $custom ) ? $custom : $options[$this->labels
|
308 |
$args = array(
|
309 |
'post_type' => $custom,
|
310 |
-
'numberposts' => $limit
|
311 |
);
|
312 |
$posts = get_posts( $args );
|
313 |
if ( $posts ) {
|
@@ -324,61 +320,53 @@ class Dev7_Core_Images extends Dev7_Core {
|
|
324 |
'post_title' => $title,
|
325 |
'alt_text' => $title,
|
326 |
'attachment_id' => $attachment_id,
|
327 |
-
'thumbnail' => $thumbnail[0]
|
328 |
);
|
329 |
}
|
330 |
}
|
331 |
}
|
332 |
} else {
|
333 |
-
if ( !
|
334 |
return $images;
|
335 |
}
|
336 |
-
|
337 |
$mmp_options = get_option( 'ubermediasettings_settings', array() );
|
338 |
-
$mmp_sources =
|
339 |
-
|
340 |
-
|
341 |
-
$source_settings = $mmp_sources[$image_source . '-settings'];
|
342 |
$access_token = $source_settings['access-token'];
|
343 |
$var = 'media_manager_plus_source_' . $image_source;
|
344 |
$obj = new $var( $access_token['oauth_token'], $access_token['oauth_token_secret'] );
|
345 |
-
|
346 |
-
$method = ( $method ) ? $method : ( ( isset( $options[$image_source . '_type'] ) ) ? $options[$image_source . '_type'] : '' );
|
347 |
if ( $method == '' ) {
|
348 |
return $images;
|
349 |
}
|
350 |
-
|
351 |
$params = array();
|
352 |
if ( $param ) {
|
353 |
$params[] = $param;
|
354 |
} else {
|
355 |
-
if ( isset( $options[$image_source . '_' . $method] ) ) {
|
356 |
-
$params[] = $options[$image_source . '_' . $method];
|
357 |
}
|
358 |
}
|
359 |
$count = ( $limit == '-1' ) ? '20' : $limit;
|
360 |
if ( $count != '' ) {
|
361 |
$params['count'] = $count;
|
362 |
}
|
363 |
-
$params['page']
|
364 |
-
|
365 |
-
$safemode = dev7_default_val( $mmp_options, 'ubermediasettings_general_safe-mode', 1 );
|
366 |
$params['safemode'] = $safemode;
|
367 |
-
|
368 |
if ( $size != 'thumbnail' ) {
|
369 |
$size = 'full';
|
370 |
}
|
371 |
-
|
372 |
$source_images = call_user_func_array( array( $obj, $method ), $params );
|
373 |
-
|
374 |
if ( $source_images && isset( $source_images['images'] ) ) {
|
375 |
foreach ( $source_images['images'] as $mmp_image ) {
|
376 |
$images[] = array(
|
377 |
-
'image_src' => $mmp_image[$size],
|
378 |
'post_permalink' => $mmp_image['link'],
|
379 |
'post_title' => $mmp_image['caption'],
|
380 |
'alt_text' => $mmp_image['caption'],
|
381 |
-
'thumbnail' => $mmp_image['thumbnail']
|
382 |
);
|
383 |
|
384 |
}
|
@@ -390,125 +378,82 @@ class Dev7_Core_Images extends Dev7_Core {
|
|
390 |
return $images;
|
391 |
}
|
392 |
|
393 |
-
|
394 |
-
*
|
395 |
-
* Victor Teixeira
|
396 |
-
*
|
397 |
-
* php 5.2+
|
398 |
-
*
|
399 |
-
* Example usage:
|
400 |
-
*
|
401 |
-
* <?php
|
402 |
-
* $thumb = get_post_thumbnail_id();
|
403 |
-
* $image = resize_image( $thumb, '', 140, 110, true );
|
404 |
-
* ?>
|
405 |
-
* <img src="<?php echo $image[url]; ?>" width="<?php echo $image[width]; ?>" height="<?php echo $image[height]; ?>" />
|
406 |
*
|
407 |
-
* @
|
408 |
-
* @
|
409 |
-
* @param int $width
|
410 |
-
* @param int $height
|
411 |
-
* @param bool $crop
|
412 |
* @return array
|
413 |
*/
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
$
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
$orig_size = getimagesize( $file_path );
|
431 |
-
|
432 |
-
$image_src[0] = $img_url;
|
433 |
-
$image_src[1] = $orig_size[0];
|
434 |
-
$image_src[2] = $orig_size[1];
|
435 |
-
}
|
436 |
-
$file_info = pathinfo( $file_path );
|
437 |
-
$extension = '.' . $file_info['extension'];
|
438 |
-
// the image path without the extension
|
439 |
-
$no_ext_path = $file_info['dirname'] . '/' . $file_info['filename'];
|
440 |
-
$cropped_img_path = $no_ext_path . '-' . $width . 'x' . $height . strtolower( $extension );
|
441 |
-
// checking if the file size is larger than the target size
|
442 |
-
// if it is smaller or the same size, stop right here and return
|
443 |
-
if ( $image_src[1] > $width || $image_src[2] > $height ) {
|
444 |
-
// the file is larger, check if the resized version already exists (for $crop = true but will also work for $crop = false if the sizes match)
|
445 |
-
|
446 |
-
if ( file_exists( $cropped_img_path ) ) {
|
447 |
-
$cropped_img_url = str_replace( basename( $image_src[0] ), basename( $cropped_img_path ), $image_src[0] );
|
448 |
-
|
449 |
-
$vt_image = array(
|
450 |
-
'url' => $cropped_img_url,
|
451 |
-
'width' => $width,
|
452 |
-
'height' => $height
|
453 |
-
);
|
454 |
-
|
455 |
-
return $vt_image;
|
456 |
-
}
|
457 |
-
// $crop = false
|
458 |
-
if ( $crop == false ) {
|
459 |
-
|
460 |
-
// calculate the size proportionaly
|
461 |
-
$proportional_size = wp_constrain_dimensions( $image_src[1], $image_src[2], $width, $height );
|
462 |
-
$resized_img_path = $no_ext_path . '-' . $proportional_size[0] . 'x' . $proportional_size[1] . $extension;
|
463 |
-
// checking if the file already exists
|
464 |
-
if ( file_exists( $resized_img_path ) ) {
|
465 |
-
|
466 |
-
$resized_img_url = str_replace( basename( $image_src[0] ), basename( $resized_img_path ), $image_src[0] );
|
467 |
-
$vt_image = array(
|
468 |
-
'url' => $resized_img_url,
|
469 |
-
'width' => $proportional_size[0],
|
470 |
-
'height' => $proportional_size[1]
|
471 |
-
);
|
472 |
-
|
473 |
-
return $vt_image;
|
474 |
}
|
475 |
}
|
|
|
476 |
|
477 |
-
|
478 |
-
|
479 |
-
if ( is_wp_error( $editor ) )
|
480 |
-
return $editor;
|
481 |
-
|
482 |
-
$editor->set_quality( 90 );
|
483 |
-
|
484 |
-
$resized = $editor->resize( $width, $height, $crop );
|
485 |
-
if ( is_wp_error( $resized ) )
|
486 |
-
return $resized;
|
487 |
|
488 |
-
|
489 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
|
491 |
-
|
492 |
-
|
493 |
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
|
|
|
|
502 |
|
503 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
}
|
505 |
-
// default output - without resizing
|
506 |
-
$vt_image = array(
|
507 |
-
'url' => $image_src[0],
|
508 |
-
'width' => $image_src[1],
|
509 |
-
'height' => $image_src[2]
|
510 |
-
);
|
511 |
|
512 |
-
return $
|
513 |
}
|
514 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* The images functionality of the plugin.
|
4 |
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/admin/libs
|
10 |
*/
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
/**
|
13 |
+
* The images functionality of the plugin.
|
14 |
*
|
15 |
+
* TODO WRITE DESCRIPTION
|
16 |
+
*
|
17 |
+
* @package nivo-slider
|
18 |
+
* @subpackage nivo-slider/includes/admin/libs
|
19 |
+
* @author ThemeIsle <friends@themeisle.com>
|
20 |
*/
|
21 |
+
class Nivo_Core_Images extends Nivo_Core_Abstract implements Nivo_Library_Interface {
|
22 |
|
23 |
/**
|
24 |
+
* Resize images dynamically using wp built in functions
|
25 |
+
*
|
26 |
+
* @since 2.2.*
|
27 |
+
* @access public
|
28 |
+
*
|
29 |
+
* @param integer $attach_id
|
30 |
+
* @param string $img_url
|
31 |
+
* @param integer $width
|
32 |
+
* @param integer $height
|
33 |
+
* @param boolean $crop
|
34 |
*
|
|
|
|
|
35 |
* @return array
|
36 |
*/
|
37 |
+
public static function resize_image( $attach_id = null, $img_url = null, $width, $height, $crop = false ) {
|
38 |
+
if ( $attach_id ) { // this is an attachment, so we have the ID
|
39 |
+
$image_src = wp_get_attachment_image_src( $attach_id, 'full' );
|
40 |
+
$file_path = get_attached_file( $attach_id );
|
41 |
+
} elseif ( $img_url ) { // this is not an attachment, let's use the image url
|
42 |
+
$file_path = parse_url( $img_url );
|
43 |
+
$file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path'];
|
44 |
+
if ( ! file_exists( $file_path ) ) {
|
45 |
+
return new WP_Error( 'broke', __( 'File doesn\'t exist', 'nivo-slider' ) . ':' . $file_path );
|
46 |
+
}
|
47 |
+
$orig_size = getimagesize( $file_path );
|
48 |
+
$image_src[0] = $img_url;
|
49 |
+
$image_src[1] = $orig_size[0];
|
50 |
+
$image_src[2] = $orig_size[1];
|
51 |
}
|
52 |
+
$file_info = pathinfo( $file_path );
|
53 |
+
$extension = '.' . $file_info['extension'];
|
54 |
+
// the image path without the extension
|
55 |
+
$no_ext_path = $file_info['dirname'] . '/' . $file_info['filename'];
|
56 |
+
$cropped_img_path = $no_ext_path . '-' . $width . 'x' . $height . strtolower( $extension );
|
57 |
+
// checking if the file size is larger than the target size
|
58 |
+
// if it is smaller or the same size, stop right here and return
|
59 |
+
if ( $image_src[1] > $width || $image_src[2] > $height ) {
|
60 |
+
if ( file_exists( $cropped_img_path ) ) { // the file is larger, check if the resized version already exists (for $crop = true but will also work for $crop = false if the sizes match)
|
61 |
+
$cropped_img_url = str_replace( basename( $image_src[0] ), basename( $cropped_img_path ), $image_src[0] );
|
62 |
+
$vt_image = array(
|
63 |
+
'url' => $cropped_img_url,
|
64 |
+
'width' => $width,
|
65 |
+
'height' => $height,
|
66 |
+
);
|
67 |
|
68 |
+
return $vt_image;
|
69 |
+
}
|
70 |
+
if ( $crop == false ) {
|
71 |
+
// calculate the size proportionaly
|
72 |
+
$proportional_size = wp_constrain_dimensions( $image_src[1], $image_src[2], $width, $height );
|
73 |
+
$resized_img_path = $no_ext_path . '-' . $proportional_size[0] . 'x' . $proportional_size[1] . $extension;
|
74 |
+
if ( file_exists( $resized_img_path ) ) { // checking if the file already exists
|
75 |
+
$resized_img_url = str_replace( basename( $image_src[0] ), basename( $resized_img_path ), $image_src[0] );
|
76 |
+
$vt_image = array(
|
77 |
+
'url' => $resized_img_url,
|
78 |
+
'width' => $proportional_size[0],
|
79 |
+
'height' => $proportional_size[1],
|
80 |
+
);
|
81 |
|
82 |
+
return $vt_image;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
// no cache files - let's finally resize it
|
86 |
+
$editor = wp_get_image_editor( $file_path );
|
87 |
+
if ( is_wp_error( $editor ) ) {
|
88 |
+
return $editor;
|
89 |
+
}
|
90 |
+
$editor->set_quality( 90 );
|
91 |
+
$resized = $editor->resize( $width, $height, $crop );
|
92 |
+
if ( is_wp_error( $resized ) ) {
|
93 |
+
return $resized;
|
94 |
+
}
|
95 |
+
$new_img_path = $editor->generate_filename( $width . 'x' . $height, null );
|
96 |
+
$saved = $editor->save( $new_img_path );
|
97 |
+
if ( is_wp_error( $saved ) ) {
|
98 |
+
return $saved;
|
99 |
+
}
|
100 |
+
$new_img_size = getimagesize( $new_img_path );
|
101 |
+
$new_img = str_replace( basename( $image_src[0] ), basename( $new_img_path ), $image_src[0] );
|
102 |
+
// resized output
|
103 |
+
$vt_image = array(
|
104 |
+
'url' => $new_img,
|
105 |
+
'width' => $new_img_size[0],
|
106 |
+
'height' => $new_img_size[1],
|
107 |
+
);
|
108 |
+
|
109 |
+
return $vt_image;
|
110 |
}
|
111 |
+
// default output - without resizing
|
112 |
+
$vt_image = array(
|
113 |
+
'url' => $image_src[0],
|
114 |
+
'width' => $image_src[1],
|
115 |
+
'height' => $image_src[2],
|
116 |
+
);
|
117 |
|
118 |
+
return $vt_image;
|
119 |
}
|
120 |
|
121 |
/**
|
122 |
+
* Use this instead of overriding __construct
|
123 |
*
|
124 |
+
* @since 3.0.0
|
125 |
+
* @access public
|
|
|
126 |
*/
|
127 |
+
public function after_core_construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
/**
|
131 |
+
* Returns the images sizes for the site
|
|
|
|
|
|
|
|
|
|
|
132 |
*
|
133 |
+
* @since 2.2.*
|
134 |
+
* @access public
|
135 |
+
* @return array
|
136 |
*/
|
137 |
+
public function get_image_sizes() {
|
138 |
+
global $_wp_additional_image_sizes;
|
139 |
+
$image_sizes = array( 'thumbnail', 'medium', 'large', 'full' ); // Standard sizes
|
140 |
+
if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) {
|
141 |
+
$image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
|
142 |
+
}
|
143 |
+
$image_sizes = apply_filters( 'intermediate_image_sizes', $image_sizes );
|
144 |
+
$all_sizes = array();
|
145 |
+
foreach ( $image_sizes as $size ) {
|
146 |
+
$all_sizes[ $size ] = ucfirst( $size );
|
147 |
}
|
148 |
|
149 |
+
return $all_sizes;
|
150 |
}
|
151 |
|
152 |
/**
|
153 |
* Returns the images for a [gallery]
|
154 |
*
|
155 |
+
* @since 2.2.*
|
156 |
+
* @access public
|
157 |
*
|
158 |
+
* @param $post_id
|
159 |
+
* @param $size
|
160 |
+
* @param $limit
|
161 |
+
* @param $source
|
162 |
+
* @param $method
|
163 |
+
* @param $param
|
164 |
+
* @param $gallery
|
165 |
+
* @param $category
|
166 |
+
* @param $custom
|
167 |
+
* @param $image_ids
|
168 |
*
|
169 |
+
* @return array
|
|
|
170 |
*/
|
171 |
+
public function get_images( $post_id, $size = '', $limit = null, $source = null, $method = null, $param = null, $gallery = null, $category = null, $custom = null, $image_ids = null ) {
|
172 |
+
$options = get_post_meta( $post_id, $this->labels['post_meta_key'], true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
if ( ! $options ) {
|
174 |
$options = array();
|
175 |
}
|
|
|
176 |
if ( $size == '' ) {
|
177 |
+
$size = $this->nivo_default_val( $options, 'wp_image_size', 'full' );
|
178 |
}
|
179 |
+
$images = array();
|
|
|
|
|
180 |
$sources = $this->get_image_sources();
|
181 |
+
if ( ! isset( $options[ $this->labels['source_name'] ] ) || ! array_key_exists( $options[ $this->labels['source_name'] ], $sources ) ) {
|
|
|
182 |
$image_source = $this->image_source_default();
|
183 |
} else {
|
184 |
+
$image_source = $this->nivo_default_val( $options, $this->labels['source_name'], $this->image_source_default() );
|
185 |
}
|
|
|
186 |
if ( $source ) {
|
187 |
$image_source = $source;
|
188 |
}
|
|
|
189 |
if ( $limit ) {
|
190 |
$limit = $limit;
|
191 |
} else {
|
192 |
$limit = ( isset( $options['number_images'] ) && $options['number_images'] != '' ) ? $options['number_images'] : - 1;
|
193 |
}
|
194 |
+
if ( $image_source == $this->labels['manual_name'] ) {
|
|
|
|
|
195 |
if ( $image_ids ) {
|
196 |
$attach_str = $image_ids;
|
197 |
$options['manual_image_ids'] = $attach_str;
|
198 |
+
update_post_meta( $post_id, $this->labels['post_meta_key'], $options );
|
199 |
} else {
|
200 |
+
$attach_str = $this->nivo_default_val( $options, 'manual_image_ids', '' );
|
201 |
}
|
202 |
$attachments = explode( ',', $attach_str );
|
203 |
$count = 0;
|
208 |
}
|
209 |
$count ++;
|
210 |
$attachment = get_post( $attachment_id );
|
|
|
211 |
if ( $limit != '-1' && $count > $limit ) {
|
212 |
break;
|
213 |
}
|
214 |
$image = wp_get_attachment_image_src( $attachment->ID, $size );
|
215 |
$thumbnail = wp_get_attachment_image_src( $attachment->ID, 'thumbnail' );
|
216 |
+
$url = $this->prepare_attachment_link( get_post_meta( $attachment->ID, '_wp_attachment_image_link', true ) );
|
217 |
+
$images[] = array(
|
|
|
|
|
218 |
'image_src' => $image[0],
|
219 |
'post_permalink' => $url,
|
220 |
'post_title' => wptexturize( $attachment->post_excerpt ),
|
221 |
'alt_text' => trim( strip_tags( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ) ) ),
|
222 |
'attachment_id' => $attachment->ID,
|
223 |
+
'thumbnail' => $thumbnail[0],
|
224 |
);
|
225 |
}
|
226 |
}
|
227 |
+
} elseif ( $image_source == 'gallery' ) {
|
228 |
+
$gallery = ( $gallery ) ? $gallery : $options[ $this->labels['type_name'] . '_gallery' ];
|
229 |
+
$attachments = $this->nivo_grab_attachment_ids_from_gallery( $gallery, $limit );
|
230 |
if ( $attachments ) {
|
231 |
foreach ( $attachments as $attachment ) {
|
232 |
$image = wp_get_attachment_image_src( $attachment->ID, $size );
|
240 |
'post_title' => $caption,
|
241 |
'alt_text' => $caption,
|
242 |
'attachment_id' => $attachment->ID,
|
243 |
+
'thumbnail' => $thumbnail[0],
|
244 |
);
|
245 |
}
|
246 |
}
|
247 |
+
} elseif ( $image_source == 'category' ) {
|
248 |
+
$category = ( $category ) ? $category : $options[ $this->labels['type_name'] . '_category' ];
|
249 |
$args = array(
|
250 |
'post_type' => 'post',
|
251 |
'numberposts' => $limit,
|
252 |
+
'category' => $category,
|
253 |
);
|
254 |
$posts = get_posts( $args );
|
255 |
if ( $posts ) {
|
266 |
'post_title' => $title,
|
267 |
'alt_text' => $title,
|
268 |
'attachment_id' => $attachment_id,
|
269 |
+
'thumbnail' => $thumbnail[0],
|
270 |
);
|
271 |
}
|
272 |
}
|
273 |
}
|
274 |
+
} elseif ( $image_source == 'sticky' ) {
|
275 |
$sticky = get_option( 'sticky_posts' );
|
276 |
$args = array(
|
277 |
'post_type' => 'post',
|
278 |
'numberposts' => $limit,
|
279 |
+
'post__in' => $sticky,
|
280 |
);
|
281 |
$posts = get_posts( $args );
|
282 |
if ( $posts ) {
|
293 |
'post_title' => $title,
|
294 |
'alt_text' => $title,
|
295 |
'attachment_id' => $attachment_id,
|
296 |
+
'thumbnail' => $thumbnail[0],
|
297 |
);
|
298 |
}
|
299 |
}
|
300 |
}
|
301 |
} else {
|
302 |
if ( $image_source == 'custom' ) {
|
303 |
+
$custom = ( $custom ) ? $custom : $options[ $this->labels['type_name'] . '_custom' ];
|
304 |
$args = array(
|
305 |
'post_type' => $custom,
|
306 |
+
'numberposts' => $limit,
|
307 |
);
|
308 |
$posts = get_posts( $args );
|
309 |
if ( $posts ) {
|
320 |
'post_title' => $title,
|
321 |
'alt_text' => $title,
|
322 |
'attachment_id' => $attachment_id,
|
323 |
+
'thumbnail' => $thumbnail[0],
|
324 |
);
|
325 |
}
|
326 |
}
|
327 |
}
|
328 |
} else {
|
329 |
+
if ( ! $this->nivo_mmp_active() ) {
|
330 |
return $images;
|
331 |
}
|
|
|
332 |
$mmp_options = get_option( 'ubermediasettings_settings', array() );
|
333 |
+
$mmp_sources = $this->nivo_default_val( $mmp_options, 'ubermediasettings_sources_available', array() );
|
334 |
+
if ( isset( $mmp_sources[ $image_source . '-settings' ] ) ) {
|
335 |
+
$source_settings = $mmp_sources[ $image_source . '-settings' ];
|
|
|
336 |
$access_token = $source_settings['access-token'];
|
337 |
$var = 'media_manager_plus_source_' . $image_source;
|
338 |
$obj = new $var( $access_token['oauth_token'], $access_token['oauth_token_secret'] );
|
339 |
+
$method = ( $method ) ? $method : ( ( isset( $options[ $image_source . '_type' ] ) ) ? $options[ $image_source . '_type' ] : '' );
|
|
|
340 |
if ( $method == '' ) {
|
341 |
return $images;
|
342 |
}
|
|
|
343 |
$params = array();
|
344 |
if ( $param ) {
|
345 |
$params[] = $param;
|
346 |
} else {
|
347 |
+
if ( isset( $options[ $image_source . '_' . $method ] ) ) {
|
348 |
+
$params[] = $options[ $image_source . '_' . $method ];
|
349 |
}
|
350 |
}
|
351 |
$count = ( $limit == '-1' ) ? '20' : $limit;
|
352 |
if ( $count != '' ) {
|
353 |
$params['count'] = $count;
|
354 |
}
|
355 |
+
$params['page'] = 1;
|
356 |
+
$safemode = $this->nivo_default_val( $mmp_options, 'ubermediasettings_general_safe-mode', 1 );
|
|
|
357 |
$params['safemode'] = $safemode;
|
|
|
358 |
if ( $size != 'thumbnail' ) {
|
359 |
$size = 'full';
|
360 |
}
|
|
|
361 |
$source_images = call_user_func_array( array( $obj, $method ), $params );
|
|
|
362 |
if ( $source_images && isset( $source_images['images'] ) ) {
|
363 |
foreach ( $source_images['images'] as $mmp_image ) {
|
364 |
$images[] = array(
|
365 |
+
'image_src' => $mmp_image[ $size ],
|
366 |
'post_permalink' => $mmp_image['link'],
|
367 |
'post_title' => $mmp_image['caption'],
|
368 |
'alt_text' => $mmp_image['caption'],
|
369 |
+
'thumbnail' => $mmp_image['thumbnail'],
|
370 |
);
|
371 |
|
372 |
}
|
378 |
return $images;
|
379 |
}
|
380 |
|
381 |
+
/**
|
382 |
+
* Returns the images sources for the plugin available, including those from Media Manager Plus
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
*
|
384 |
+
* @since 2.2.*
|
385 |
+
* @access public
|
|
|
|
|
|
|
386 |
* @return array
|
387 |
*/
|
388 |
+
function get_image_sources() {
|
389 |
+
$sources = $this->image_sources_defaults();
|
390 |
+
$exclude = apply_filters( 'mmp_feed_exclude', array() );
|
391 |
+
if ( $this->nivo_mmp_active() ) {
|
392 |
+
$mmp_options = get_option( 'ubermediasettings_settings', array() );
|
393 |
+
$mmp_sources = $this->nivo_default_val( $mmp_options, 'ubermediasettings_sources_available', array() );
|
394 |
+
if ( $mmp_sources ) {
|
395 |
+
foreach ( $mmp_sources as $mmp_source => $mmp_settings ) {
|
396 |
+
$mmp_source_name = str_replace( '-settings', '', $mmp_source );
|
397 |
+
if ( ! class_exists( 'media_manager_plus_source_' . $mmp_source_name ) ) {
|
398 |
+
continue;
|
399 |
+
}
|
400 |
+
if ( array_key_exists( $mmp_source_name, $exclude ) ) {
|
401 |
+
continue;
|
402 |
+
}
|
403 |
+
$sources[ $mmp_source_name ] = ucfirst( $mmp_source_name ) . ' Feed';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
}
|
405 |
}
|
406 |
+
}
|
407 |
|
408 |
+
return apply_filters( $this->labels['post_type'] . '_get_image_sources', $sources );
|
409 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
|
411 |
+
/**
|
412 |
+
* Returns the default images sources for the plugin available
|
413 |
+
*
|
414 |
+
* @since 2.2.*
|
415 |
+
* @access public
|
416 |
+
* @return array
|
417 |
+
*/
|
418 |
+
public function image_sources_defaults() {
|
419 |
+
$defaults = array(
|
420 |
+
$this->labels['manual_name'] => __( 'Manual', 'nivo-slider' ),
|
421 |
+
);
|
422 |
+
$defaults['disabled-1'] = __( 'Gallery', 'nivo-slider' );
|
423 |
+
$defaults['disabled-2'] = __( 'Category', 'nivo-slider' );
|
424 |
+
$defaults['disabled-3'] = __( 'Sticky Posts', 'nivo-slider' );
|
425 |
+
$defaults['disabled-4'] = __( 'Custom Post Type', 'nivo-slider' );
|
426 |
|
427 |
+
return apply_filters( $this->labels['post_type'] . '_image_sources_defaults', $defaults );
|
428 |
+
}
|
429 |
|
430 |
+
/**
|
431 |
+
* Returns the default selected image source for the plugin
|
432 |
+
*
|
433 |
+
* @since 2.2.*
|
434 |
+
* @access public
|
435 |
+
* @return string
|
436 |
+
*/
|
437 |
+
public function image_source_default() {
|
438 |
+
return apply_filters( $this->labels['post_type'] . '_image_source_default', $this->labels['manual_name'] );
|
439 |
+
}
|
440 |
|
441 |
+
/**
|
442 |
+
* Prepares the attached image url
|
443 |
+
*
|
444 |
+
* @since 2.2.*
|
445 |
+
* @access private
|
446 |
+
*
|
447 |
+
* @param string $url The URL.
|
448 |
+
*
|
449 |
+
* @return string
|
450 |
+
*/
|
451 |
+
private function prepare_attachment_link( $url ) {
|
452 |
+
$url = trim( strip_tags( $url ) );
|
453 |
+
if ( false === strpos( $url, '://' ) && $url != '' ) {
|
454 |
+
$url = 'http://' . $url;
|
455 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
|
457 |
+
return $url;
|
458 |
}
|
459 |
+
}
|
includes/admin/libs/class-nivo-core-model.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The post-type functionality of the plugin.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/admin/libs
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The post-type functionality of the plugin.
|
14 |
+
*
|
15 |
+
* TODO WRITE DESCRIPTION
|
16 |
+
*
|
17 |
+
* @package nivo-slider
|
18 |
+
* @subpackage nivo-slider/includes/admin/libs
|
19 |
+
* @author ThemeIsle <friends@themeisle.com>
|
20 |
+
*/
|
21 |
+
class Nivo_Core_Model extends Nivo_Model_Abstract {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Nivo_Core_Model constructor.
|
25 |
+
* @since 3.0.0
|
26 |
+
* @access public
|
27 |
+
*/
|
28 |
+
public function __construct() {
|
29 |
+
parent::__construct();
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Setting message for post type update.
|
34 |
+
*
|
35 |
+
* @since 3.0.0
|
36 |
+
* @access public
|
37 |
+
* @param string $messages The message for post type update.
|
38 |
+
* @return mixed
|
39 |
+
*/
|
40 |
+
public function post_updated_messages( $messages ) {
|
41 |
+
$defaults = $this->labels;
|
42 |
+
global $post, $post_ID;
|
43 |
+
|
44 |
+
$message_data = array(
|
45 |
+
0 => '',
|
46 |
+
1 => __( '%1$s updated.', 'nivo-slider' ),
|
47 |
+
2 => __( 'Custom field updated.', 'nivo-slider' ),
|
48 |
+
3 => __( 'Custom field deleted.', 'nivo-slider' ),
|
49 |
+
4 => __( '%1$s updated.', 'nivo-slider' ),
|
50 |
+
5 => '',
|
51 |
+
6 => __( '%1$s published.', 'nivo-slider' ),
|
52 |
+
7 => __( '%1$s saved.', 'nivo-slider' ),
|
53 |
+
8 => __( '%1$s submitted.', 'nivo-slider' ),
|
54 |
+
9 => __( '%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" href="%2$s">Preview %1$s</a>', 'nivo-slider' ),
|
55 |
+
10 => __( '%1$s draft updated.', 'nivo-slider' ),
|
56 |
+
);
|
57 |
+
|
58 |
+
foreach ( $message_data as $key => $value ) {
|
59 |
+
if ( $key == 9 ) {
|
60 |
+
$value = sprintf( $value, $defaults['singular'], date_i18n( __( 'M j, Y @ G:i', 'nivo-slider' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ) );
|
61 |
+
} else {
|
62 |
+
if ( $key == 5 ) {
|
63 |
+
if ( isset( $_GET['revision'] ) ) {
|
64 |
+
$value = sprintf( __( '%1$s restored to revision from %2$s', 'nivo-slider' ), $defaults['singular'], wp_post_revision_title( (int) $_GET['revision'], false ) );
|
65 |
+
}
|
66 |
+
} else {
|
67 |
+
$value = sprintf( $value, $defaults['singular'] );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
$message_data[ $key ] = $value;
|
71 |
+
}
|
72 |
+
$messages[ $this->labels['post_type'] ] = apply_filters( $this->labels['post_type'] . '_post_type_messages', $message_data );
|
73 |
+
|
74 |
+
return $messages;
|
75 |
+
}
|
76 |
+
}
|
includes/admin/libs/class-nivo-core-shortcode.php
ADDED
@@ -0,0 +1,508 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The shortcode functionality of the plugin.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/admin/libs
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The shortcode functionality of the plugin.
|
14 |
+
*
|
15 |
+
* TODO WRITE DESCRIPTION
|
16 |
+
*
|
17 |
+
* @package nivo-slider
|
18 |
+
* @subpackage nivo-slider/includes/admin/libs
|
19 |
+
* @author ThemeIsle <friends@themeisle.com>
|
20 |
+
*/
|
21 |
+
class Nivo_Core_Shortcode extends Nivo_Core_Abstract implements Nivo_Library_Interface {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Shortcode core scripts
|
25 |
+
*
|
26 |
+
* @var array
|
27 |
+
* @access private
|
28 |
+
* @since 2.2.*
|
29 |
+
*/
|
30 |
+
private $core_scripts = array();
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Shortcode scripts
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
* @access private
|
37 |
+
* @since 2.2.*
|
38 |
+
*/
|
39 |
+
private $scripts = array();
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Shortcode core styles
|
43 |
+
*
|
44 |
+
* @var array
|
45 |
+
* @access private
|
46 |
+
* @since 2.2.*
|
47 |
+
*/
|
48 |
+
private $core_styles = array();
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Shortcode styles
|
52 |
+
*
|
53 |
+
* @var array
|
54 |
+
* @access private
|
55 |
+
* @since 2.2.*
|
56 |
+
*/
|
57 |
+
private $styles = array();
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Instance of Dev7 Images Core Class
|
61 |
+
*
|
62 |
+
* @var object
|
63 |
+
* @access private
|
64 |
+
* @since 2.2.*
|
65 |
+
*/
|
66 |
+
private $core_images;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Whether or not core styles and scripts have been enqueued
|
70 |
+
*
|
71 |
+
* @var boolean
|
72 |
+
* @access private
|
73 |
+
* @since 2.4.3
|
74 |
+
*/
|
75 |
+
private $core_enqueued = false;
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Use this instead of overriding __construct
|
79 |
+
*
|
80 |
+
* @since 3.0.0
|
81 |
+
* @access public
|
82 |
+
*/
|
83 |
+
public function after_core_construct() {
|
84 |
+
$this->core_images = new Nivo_Core_Images( self::get_plugin_settings() );
|
85 |
+
|
86 |
+
$this->core_scripts = $this->shortcode_core_scripts( $this->core_scripts );
|
87 |
+
$this->core_styles = $this->shortcode_core_styles( $this->core_styles );
|
88 |
+
|
89 |
+
$this->scripts = $this->shortcode_scripts( $this->scripts );
|
90 |
+
$this->styles = $this->shortcode_styles( $this->styles );
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Shortcode output for the plugin
|
95 |
+
*
|
96 |
+
* @since 2.2.*
|
97 |
+
* @access public
|
98 |
+
* @param array $atts The attributes array.
|
99 |
+
* @return string $output
|
100 |
+
*/
|
101 |
+
public function shortcode( $atts ) {
|
102 |
+
$sc = shortcode_atts(
|
103 |
+
array(
|
104 |
+
'id' => 0,
|
105 |
+
// Here for backwards compatibility, has the same function as force below.
|
106 |
+
'template' => false,
|
107 |
+
// To force the enqueue of core scripts, pass [... force="true"].
|
108 |
+
'force' => false,
|
109 |
+
'slug' => '',
|
110 |
+
), $atts
|
111 |
+
);
|
112 |
+
|
113 |
+
if ( ! $sc['id'] && ! $sc['slug'] ) {
|
114 |
+
return sprintf( __( 'Invalid %1$s', 'nivo-slider' ), $this->labels['singular'] );
|
115 |
+
}
|
116 |
+
|
117 |
+
if ( ! $sc['id'] ) {
|
118 |
+
$object = get_page_by_path( $sc['slug'], OBJECT, $this->labels['post_type'] );
|
119 |
+
if ( $object ) {
|
120 |
+
$sc['id'] = $object->ID;
|
121 |
+
} else {
|
122 |
+
return sprintf( __( 'Invalid %1$s Slug', 'nivo-slider' ), $this->labels['singular'] );
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
$output = '';
|
127 |
+
$options = get_post_meta( $sc['id'], $this->labels['post_meta_key'], true );
|
128 |
+
if ( isset( $options[ $this->labels['source_name'] ] ) ) {
|
129 |
+
$type = $options[ $this->labels['source_name'] ];
|
130 |
+
} else {
|
131 |
+
$type = $options[ $this->labels['type_name'] ]; // backwards compatibility for < v3.0.0
|
132 |
+
}
|
133 |
+
|
134 |
+
$defaults = $this->core_images->image_sources_defaults();
|
135 |
+
$slider_type = ( ! array_key_exists( $type, $defaults ) ) ? 'external' : '';
|
136 |
+
|
137 |
+
$images = $this->core_images->get_images( $sc['id'] );
|
138 |
+
|
139 |
+
// Force enqueue of core scripts (good for do_shortcode() in templates).
|
140 |
+
if ( $sc['template'] || $sc['force'] ) {
|
141 |
+
$this->enqueue_core_scripts( true );
|
142 |
+
$this->enqueue_core_styles( true );
|
143 |
+
}
|
144 |
+
|
145 |
+
$this->enqueue_scripts( $options );
|
146 |
+
$this->enqueue_styles( $options );
|
147 |
+
|
148 |
+
// generate unique prefix for $id to avoid clashes with multiple same shortcode use
|
149 |
+
$prefix = wp_generate_password( 5, false );
|
150 |
+
$sc['id'] = $prefix . '-' . $sc['id'];
|
151 |
+
|
152 |
+
if ( $images ) {
|
153 |
+
$output = apply_filters( $this->labels['post_type'] . '_shortcode_output', $sc['id'], $output, $options, $images, $slider_type );
|
154 |
+
}
|
155 |
+
|
156 |
+
return $output;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Tests each post for a specific shortcode and enqueues core styles and scripts.
|
161 |
+
*
|
162 |
+
* Because we can't always trust `global $post` on `is_home()` or `is_archive()`
|
163 |
+
* we use this method with the `the_posts` filter to test each post being shown
|
164 |
+
* for the shortcode and enqueue the core styles. This saves us from having
|
165 |
+
* to enqueue the core scripts when they are un-necessary.
|
166 |
+
*
|
167 |
+
* Any list of posts that does not use the shortcode will result in the core
|
168 |
+
* styles not being enqueued.
|
169 |
+
*
|
170 |
+
* @since 2.4.3
|
171 |
+
* @access public
|
172 |
+
* @param array $posts Posts sent from `the_posts` filter.
|
173 |
+
* @return object
|
174 |
+
*/
|
175 |
+
public function shortcode_enqueue_core( $posts ) {
|
176 |
+
foreach ( $posts as $post ) {
|
177 |
+
if ( ! $this->core_enqueued && $this->nivo_has_shortcode_wrap( $post->post_content, $this->labels['shortcode'] ) ) {
|
178 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_core_scripts' ) );
|
179 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_core_styles' ) );
|
180 |
+
|
181 |
+
// Tell this instance that it's been enqueued so we don't do this for every post.
|
182 |
+
$this->core_enqueued = true;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
return $posts;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Enqueues core shortcode scripts in <head>
|
190 |
+
*
|
191 |
+
* @since 2.2.*
|
192 |
+
* @access public
|
193 |
+
*/
|
194 |
+
public function enqueue_core_scripts() {
|
195 |
+
if ( $this->core_scripts && count( $this->core_scripts ) > 0 ) {
|
196 |
+
$required = array( 'jquery' );
|
197 |
+
|
198 |
+
// Enqueue our required scripts.
|
199 |
+
wp_enqueue_script( $required );
|
200 |
+
|
201 |
+
// Enqueue all the scripts.
|
202 |
+
foreach ( $this->core_scripts as $name => $url ) {
|
203 |
+
wp_enqueue_script( $name, $url, $required, $this->labels['plugin_version'] );
|
204 |
+
$required[] = $name;
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Enqueues core shortcode styles in <head>
|
211 |
+
*
|
212 |
+
* @since 2.2.*
|
213 |
+
* @access public
|
214 |
+
*/
|
215 |
+
public function enqueue_core_styles( $force = false ) {
|
216 |
+
if ( $this->core_styles && count( $this->core_styles ) > 0 ) {
|
217 |
+
foreach ( $this->core_styles as $name => $url ) {
|
218 |
+
wp_enqueue_style( $name, $url, array(), $this->labels['plugin_version'] );
|
219 |
+
}
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Enqueue shortcode scripts that are dependant on plugin options in <footer>
|
225 |
+
*
|
226 |
+
* @since 2.2.*
|
227 |
+
* @access private
|
228 |
+
* @param array $options
|
229 |
+
*/
|
230 |
+
private function enqueue_scripts( $options ) {
|
231 |
+
$scripts = apply_filters( $this->labels['post_type'] . '_shortcode_scripts_enqueue', $this->scripts, $options );
|
232 |
+
if ( $scripts && count( $scripts ) > 0 ) {
|
233 |
+
foreach ( $scripts as $name => $url ) {
|
234 |
+
wp_enqueue_script( $name );
|
235 |
+
}
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Enqueue shortcode styles
|
241 |
+
*
|
242 |
+
* @since 2.2.*
|
243 |
+
* @access private
|
244 |
+
* @param array $options The options array.
|
245 |
+
*/
|
246 |
+
private function enqueue_styles( $options ) {
|
247 |
+
$styles = apply_filters( $this->labels['post_type'] . '_shortcode_styles_enqueue', $this->styles, $options );
|
248 |
+
if ( $styles && count( $styles ) > 0 ) {
|
249 |
+
foreach ( $styles as $name => $url ) {
|
250 |
+
wp_enqueue_style( $name );
|
251 |
+
}
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Register shortcode scripts
|
257 |
+
*
|
258 |
+
* @since 2.2.*
|
259 |
+
* @access public
|
260 |
+
*/
|
261 |
+
public function register_scripts() {
|
262 |
+
if ( $this->scripts && count( $this->scripts ) > 0 ) {
|
263 |
+
$required = array( 'jquery' );
|
264 |
+
foreach ( $this->scripts as $name => $url ) {
|
265 |
+
wp_register_script( $name, $url, $required, $this->labels['plugin_version'] );
|
266 |
+
$required[] = $name;
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Register shortcode styles
|
273 |
+
*
|
274 |
+
* @since 2.2.*
|
275 |
+
* @access public
|
276 |
+
*/
|
277 |
+
public function register_styles() {
|
278 |
+
if ( $this->styles && count( $this->styles ) > 0 ) {
|
279 |
+
foreach ( $this->styles as $name => $url ) {
|
280 |
+
wp_register_style( $name, $url, array(), $this->labels['plugin_version'] );
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Adds custom styles to Shortcode style array for loading to <head>
|
287 |
+
*
|
288 |
+
* @since 2.2.*
|
289 |
+
* @access public
|
290 |
+
* @param array $scripts The scripts array.
|
291 |
+
* @return array
|
292 |
+
*/
|
293 |
+
public function shortcode_core_scripts( $scripts ) {
|
294 |
+
return $scripts;
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Adds custom styles to Shortcode style array for loading to <head>
|
299 |
+
*
|
300 |
+
* @since 2.2.*
|
301 |
+
* @access public
|
302 |
+
* @param array $styles The styles array.
|
303 |
+
* @return array
|
304 |
+
*/
|
305 |
+
public function shortcode_core_styles( $styles ) {
|
306 |
+
$styles['nivo-ns-nivoslider'] = NIVO_SLIDER_PLUGIN_URL . 'assets/css/nivo-slider.css';
|
307 |
+
return $styles;
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Adds custom styles to Shortcode style array for conditional loading
|
312 |
+
*
|
313 |
+
* @since 2.2.*
|
314 |
+
* @access public
|
315 |
+
* @param array $styles The styles array.
|
316 |
+
* @return array
|
317 |
+
*/
|
318 |
+
public function shortcode_styles( $styles ) {
|
319 |
+
$themes = $this->get_themes();
|
320 |
+
foreach ( $themes as $theme ) {
|
321 |
+
$styles[ 'nivoslider-theme-' . $theme['theme_name'] ] = $theme['theme_url'];
|
322 |
+
}
|
323 |
+
return $styles;
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Adds custom scripts to Shortcode script array for conditional loading
|
328 |
+
*
|
329 |
+
* @since 2.2.*
|
330 |
+
* @access public
|
331 |
+
* @param array $scripts The scripts array.
|
332 |
+
* @return array
|
333 |
+
*/
|
334 |
+
public function shortcode_scripts( $scripts ) {
|
335 |
+
$scripts['nivo-ns-nivoslider'] = NIVO_SLIDER_PLUGIN_URL . 'assets/js/jquery.nivo.slider.pack.js';
|
336 |
+
return $scripts;
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Custom shortcode enqueuing of scripts for selected Nivo theme
|
341 |
+
*
|
342 |
+
* @since 2.2.*
|
343 |
+
* @access public
|
344 |
+
* @param array $styles The styles array.
|
345 |
+
* @param array $options The short code options.
|
346 |
+
* @return array
|
347 |
+
*/
|
348 |
+
public function shortcode_styles_enqueue( $styles, $options ) {
|
349 |
+
$slider_theme = 'nivoslider-theme-' . $this->nivo_default_val( $options, 'theme' );
|
350 |
+
if ( $styles ) {
|
351 |
+
foreach ( $styles as $name => $url ) {
|
352 |
+
if ( substr( $name, 0, 17 ) == 'nivoslider-theme-' ) {
|
353 |
+
if ( $name != $slider_theme ) {
|
354 |
+
unset( $styles[ $name ] );
|
355 |
+
}
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
|
360 |
+
return $styles;
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Custom shortcode plugin output
|
365 |
+
*
|
366 |
+
* @since 2.2.*
|
367 |
+
* @access public
|
368 |
+
* @param int $id Short code ID.
|
369 |
+
* @param string $output The output string.
|
370 |
+
* @param array $options The short code options array.
|
371 |
+
* @param array $images The images array.
|
372 |
+
* @param string $slider_type The slider type.
|
373 |
+
* @return string
|
374 |
+
*/
|
375 |
+
public function shortcode_output( $id, $output, $options, $images, $slider_type ) {
|
376 |
+
|
377 |
+
if ( isset( $options[ $this->labels['source_name'] ] ) ) {
|
378 |
+
$type = $options[ $this->labels['source_name'] ];
|
379 |
+
} else {
|
380 |
+
$type = $options[ $this->labels['type_name'] ]; // backwards compatibility for < v3.0.0
|
381 |
+
}
|
382 |
+
|
383 |
+
$captions = array();
|
384 |
+
$output .= '<div class="slider-wrapper';
|
385 |
+
if ( isset( $options['theme'] ) && $options['theme'] != '' ) {
|
386 |
+
$output .= ' theme-' . $options['theme'];
|
387 |
+
}
|
388 |
+
if ( isset( $options['controlNavThumbs'] ) && $options['controlNavThumbs'] == 'on' ) {
|
389 |
+
$output .= ' controlnav-thumbs';
|
390 |
+
}
|
391 |
+
$output .= '"><div class="ribbon"></div>';
|
392 |
+
$output .= '<div id="nivoslider-' . $id . '" class="nivoSlider"';
|
393 |
+
if ( $options['sizing'] == 'fixed' ) {
|
394 |
+
$output .= ' style="width:' . $options['dim_x'] . 'px;height:' . $options['dim_y'] . 'px;"';
|
395 |
+
}
|
396 |
+
$output .= '>';
|
397 |
+
$i = 0;
|
398 |
+
foreach ( $images as $image ) {
|
399 |
+
|
400 |
+
$image_link = $this->nivo_default_val( $options, 'imageLink', 'on' );
|
401 |
+
$target_blank = $this->nivo_default_val( $options, 'targetBlank', 'on' );
|
402 |
+
if ( ( isset( $image['post_permalink'] ) && $image['post_permalink'] != '' ) && $image_link == 'on' ) {
|
403 |
+
$target = ( $target_blank == 'on' ) ? ' target="_blank"' : '';
|
404 |
+
$output .= '<a ' . $target . ' href="' . $image['post_permalink'] . '">';
|
405 |
+
}
|
406 |
+
|
407 |
+
if ( $options['sizing'] == 'fixed' && isset( $image['attachment_id'] ) ) {
|
408 |
+
$resized_image = $this->core_images->resize_image( $image['attachment_id'], '', $options['dim_x'], $options['dim_y'], true );
|
409 |
+
if ( is_wp_error( $resized_image ) ) {
|
410 |
+
echo '<p>Error: ' . $resized_image->get_error_message() . '</p>';
|
411 |
+
$output .= '<img src="" ';
|
412 |
+
} else {
|
413 |
+
$output .= '<img src="' . $resized_image['url'] . '" ';
|
414 |
+
}
|
415 |
+
} else {
|
416 |
+
$output .= '<img src="' . $image['image_src'] . '" ';
|
417 |
+
}
|
418 |
+
|
419 |
+
if ( ( $type == 'manual' || $type == 'gallery' ) && isset( $image['post_title'] ) && $image['post_title'] != '' ) {
|
420 |
+
$captions[] = $image['post_title'];
|
421 |
+
$output .= 'title="#nivoslider-' . $id . '-caption-' . $i . '" ';
|
422 |
+
$i ++;
|
423 |
+
}
|
424 |
+
if ( ( $type == 'category' || $type == 'sticky' || $type == 'custom' ) && $options['enable_captions'] == 'on' && isset( $image['post_title'] ) && $image['post_title'] != '' ) {
|
425 |
+
$captions[] = $image['post_title'];
|
426 |
+
$output .= 'title="#nivoslider-' . $id . '-caption-' . $i . '" ';
|
427 |
+
$i ++;
|
428 |
+
}
|
429 |
+
|
430 |
+
if ( isset( $options['controlNavThumbs'] ) && $options['controlNavThumbs'] == 'on' ) {
|
431 |
+
if ( isset( $image['thumbnail'] ) ) {
|
432 |
+
$output .= 'data-thumb="' . $image['thumbnail'] . '" ';
|
433 |
+
} else {
|
434 |
+
$resized_image = $this->core_images->resize_image( $image['attachment_id'], '', $options['thumbSizeWidth'], $options['thumbSizeHeight'], true );
|
435 |
+
if ( is_wp_error( $resized_image ) ) {
|
436 |
+
echo '<p>Error: ' . $resized_image->get_error_message() . '</p>';
|
437 |
+
$output .= 'data-thumb="" ';
|
438 |
+
} else {
|
439 |
+
$output .= 'data-thumb="' . $resized_image['url'] . '" ';
|
440 |
+
}
|
441 |
+
}
|
442 |
+
}
|
443 |
+
|
444 |
+
$output .= 'alt="' . $image['alt_text'] . '" />';
|
445 |
+
if ( isset( $image['post_permalink'] ) && $image['post_permalink'] != '' ) {
|
446 |
+
$output .= '</a>';
|
447 |
+
}
|
448 |
+
}
|
449 |
+
$output .= '</div></div>';
|
450 |
+
|
451 |
+
if ( isset( $options['controlNavThumbs'] ) && 'on' == $options['controlNavThumbs'] ) {
|
452 |
+
|
453 |
+
// Get the height and width.
|
454 |
+
$thumbnail_height = $options['thumbSizeHeight'];
|
455 |
+
$thumbnail_width = $options['thumbSizeWidth'];
|
456 |
+
|
457 |
+
// Force the height/width of thumbnails set in slider settings.
|
458 |
+
$output .= "<style type='text/css' media='screen'> \n";
|
459 |
+
$output .= ".theme-default .nivo-controlNav.nivo-thumbs-enabled img, \n";
|
460 |
+
$output .= ".nivo-thumbs-enabled img { \n";
|
461 |
+
$output .= " width: {$thumbnail_width}px !important; \n";
|
462 |
+
$output .= " height: {$thumbnail_height}px !important; \n";
|
463 |
+
$output .= "} \n";
|
464 |
+
$output .= "</style> \n";
|
465 |
+
}
|
466 |
+
|
467 |
+
$i = 0;
|
468 |
+
foreach ( $captions as $caption ) {
|
469 |
+
$output .= '<div id="nivoslider-' . $id . '-caption-' . $i . '" class="nivo-html-caption">';
|
470 |
+
$output .= $caption ;
|
471 |
+
$output .= '</div>';
|
472 |
+
$i ++;
|
473 |
+
}
|
474 |
+
|
475 |
+
if ( count( $images ) > 1 ) {
|
476 |
+
$output .= '<script type="text/javascript">' . "\n";
|
477 |
+
$output .= 'jQuery(window).load(function(){' . "\n";
|
478 |
+
$output .= ' jQuery("#nivoslider-' . $id . '").nivoSlider({' . "\n";
|
479 |
+
$output .= ' effect:"' . $options['effect'] . '",' . "\n";
|
480 |
+
$output .= ' slices:' . $options['slices'] . ',' . "\n";
|
481 |
+
$output .= ' boxCols:' . $options['boxCols'] . ',' . "\n";
|
482 |
+
$output .= ' boxRows:' . $options['boxRows'] . ',' . "\n";
|
483 |
+
$output .= ' animSpeed:' . $options['animSpeed'] . ',' . "\n";
|
484 |
+
$output .= ' pauseTime:' . $options['pauseTime'] . ',' . "\n";
|
485 |
+
if ( isset( $options['randomStart'] ) && $options['randomStart'] == 'on' ) {
|
486 |
+
$output .= ' startSlide:' . floor( rand( 0, count( $images ) ) ) . ',' . "\n";
|
487 |
+
} else {
|
488 |
+
$output .= ' startSlide:' . $options['startSlide'] . ',' . "\n";
|
489 |
+
}
|
490 |
+
$output .= ' directionNav:' . ( ( $options['directionNav'] == 'on' ) ? 'true' : 'false' ) . ',' . "\n";
|
491 |
+
$output .= ' controlNav:' . ( ( $options['controlNav'] == 'on' ) ? 'true' : 'false' ) . ',' . "\n";
|
492 |
+
$output .= ' controlNavThumbs:' . ( ( isset( $options['controlNavThumbs'] ) && $options['controlNavThumbs'] == 'on' ) ? 'true' : 'false' ) . ',' . "\n";
|
493 |
+
$output .= ' pauseOnHover:' . ( ( $options['pauseOnHover'] == 'on' ) ? 'true' : 'false' ) . ',' . "\n";
|
494 |
+
$output .= ' manualAdvance:' . ( ( $options['manualAdvance'] == 'on' ) ? 'true' : 'false' ) . "\n";
|
495 |
+
$output .= ' });' . "\n";
|
496 |
+
$output .= '});' . "\n";
|
497 |
+
$output .= '</script>' . "\n";
|
498 |
+
} else {
|
499 |
+
$output .= '<script type="text/javascript">' . "\n";
|
500 |
+
$output .= 'jQuery(window).load(function(){' . "\n";
|
501 |
+
$output .= ' jQuery("#nivoslider-' . $id . ' img").css("position","relative").show();' . "\n";
|
502 |
+
$output .= '});' . "\n";
|
503 |
+
$output .= '</script>' . "\n";
|
504 |
+
}
|
505 |
+
|
506 |
+
return $output;
|
507 |
+
}
|
508 |
+
}
|
includes/admin/libs/class-nivo-plugin-settings.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The admin-view functionality of the plugin.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/admin/libs
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The admin-view functionality of the plugin.
|
14 |
+
*
|
15 |
+
* Defines the plugin name, version, and two examples hooks for how to
|
16 |
+
* enqueue the admin-specific stylesheet and JavaScript.
|
17 |
+
*
|
18 |
+
* @package nivo-slider
|
19 |
+
* @subpackage nivo-slider/includes/admin/libs
|
20 |
+
* @author ThemeIsle <friends@themeisle.com>
|
21 |
+
*/
|
22 |
+
class Nivo_Plugin_Settings implements Nivo_Settings_Interface {
|
23 |
+
|
24 |
+
/**
|
25 |
+
* The labels shared by all classes.
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
* @since 3.0.0
|
29 |
+
* @access private
|
30 |
+
*/
|
31 |
+
private $labels;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The lite flag shared by all classes.
|
35 |
+
*
|
36 |
+
* @var boolean
|
37 |
+
* @since 3.0.0
|
38 |
+
* @access private
|
39 |
+
*/
|
40 |
+
private $is_lite;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Utility method to set labels.
|
44 |
+
*
|
45 |
+
* @since 3.0.0
|
46 |
+
* @access public
|
47 |
+
* @param array $labels The array to assign to labels.
|
48 |
+
*/
|
49 |
+
public function set_labels( $labels ) {
|
50 |
+
$this->labels = $labels;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Utility method to set is_lite.
|
55 |
+
*
|
56 |
+
* @since 3.0.0
|
57 |
+
* @access public
|
58 |
+
* @param boolean $is_lite The value to assign to is_lite.
|
59 |
+
*/
|
60 |
+
public function set_lite( $is_lite ) {
|
61 |
+
$this->is_lite = $is_lite;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Utility method to get labels.
|
66 |
+
*
|
67 |
+
* @since 3.0.0
|
68 |
+
* @access public
|
69 |
+
* @return array
|
70 |
+
*/
|
71 |
+
public function get_labels() {
|
72 |
+
return $this->labels;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Utility method to get specific label item.
|
77 |
+
*
|
78 |
+
* @since 3.0.0
|
79 |
+
* @access public
|
80 |
+
* @return mixed
|
81 |
+
*/
|
82 |
+
public function get_label( $name ) {
|
83 |
+
if ( isset( $this->labels[ $name ] ) ) {
|
84 |
+
return $this->labels[ $name ];
|
85 |
+
} else {
|
86 |
+
return '';
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Utility method to value of is_lite.
|
92 |
+
*
|
93 |
+
* @since 3.0.0
|
94 |
+
* @access public
|
95 |
+
* @return boolean
|
96 |
+
*/
|
97 |
+
public function get_lite() {
|
98 |
+
return $this->is_lite;
|
99 |
+
}
|
100 |
+
|
101 |
+
}
|
includes/admin/libs/class-nivo-slider-widget.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The widget functionality of the plugin.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/admin/libs
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The widget functionality of the plugin.
|
14 |
+
*
|
15 |
+
* TODO WRITE DESCRIPTION
|
16 |
+
*
|
17 |
+
* @package nivo-slider
|
18 |
+
* @subpackage nivo-slider/includes/admin/libs
|
19 |
+
* @author ThemeIsle <friends@themeisle.com>
|
20 |
+
*/
|
21 |
+
class Nivo_Slider_Widget extends WP_Widget {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Nivo_Slider_Widget constructor.
|
25 |
+
* @since 3.0.0
|
26 |
+
* @access public
|
27 |
+
*/
|
28 |
+
public function __construct() {
|
29 |
+
parent::__construct(
|
30 |
+
false,
|
31 |
+
__( 'Nivo Slider', 'nivo-slider' ),
|
32 |
+
array(
|
33 |
+
'description' => __( 'Display a Nivo Slider', 'nivo-slider' ),
|
34 |
+
)
|
35 |
+
);
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Register widget utility method.
|
40 |
+
*
|
41 |
+
* @since 3.0.0
|
42 |
+
* @access public
|
43 |
+
*/
|
44 |
+
public function register_widget() {
|
45 |
+
register_widget( 'nivo_slider_widget' );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Method to render widget.
|
50 |
+
*
|
51 |
+
* @since 3.0.0
|
52 |
+
* @access public
|
53 |
+
* @param array $args The widget arguments.
|
54 |
+
* @param object $instance The widget instance.
|
55 |
+
* @return mixed
|
56 |
+
*/
|
57 |
+
public function widget( $args, $instance ) {
|
58 |
+
extract( $args );
|
59 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
60 |
+
$id = $instance['nivo_slider_id'];
|
61 |
+
global $post;
|
62 |
+
|
63 |
+
echo $before_widget;
|
64 |
+
if ( $title ) {
|
65 |
+
echo $before_title . $title . $after_title;
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( $id ) {
|
69 |
+
echo do_shortcode( '[nivoslider id="' . $id . '" template="1"]' );
|
70 |
+
}
|
71 |
+
|
72 |
+
echo $after_widget;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Utility method to update widget.
|
77 |
+
*
|
78 |
+
* @since 3.0.0
|
79 |
+
* @access public
|
80 |
+
* @param object $new_instance The widget instance.
|
81 |
+
* @param object $old_instance The widget instance.
|
82 |
+
* @return mixed
|
83 |
+
*/
|
84 |
+
public function update( $new_instance, $old_instance ) {
|
85 |
+
$instance = $old_instance;
|
86 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
87 |
+
$instance['nivo_slider_id'] = isset( $new_instance['nivo_slider_id'] ) ? strip_tags( $new_instance['nivo_slider_id'] ) : '';
|
88 |
+
|
89 |
+
return $instance;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Method to render widget form.
|
94 |
+
*
|
95 |
+
* @since 3.0.0
|
96 |
+
* @acces public
|
97 |
+
* @param object $instance The widget instance.
|
98 |
+
* @return mixed
|
99 |
+
*/
|
100 |
+
public function form( $instance ) {
|
101 |
+
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
102 |
+
?>
|
103 |
+
<p>
|
104 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'nivo-slider' ); ?></label>
|
105 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>"
|
106 |
+
name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" />
|
107 |
+
</p>
|
108 |
+
<?php
|
109 |
+
$args = array(
|
110 |
+
'post_type' => 'nivoslider',
|
111 |
+
'posts_per_page' => - 1,
|
112 |
+
'post_status' => 'publish',
|
113 |
+
);
|
114 |
+
$galleries = get_posts( $args );
|
115 |
+
?>
|
116 |
+
<p>
|
117 |
+
<label for="<?php echo $this->get_field_id( 'nivo_slider_id' ); ?>">Nivo Slider</label>
|
118 |
+
<select class="widefat" name="<?php echo $this->get_field_name( 'nivo_slider_id' ); ?>" id="<?php echo $this->get_field_id( 'nivo_slider_id' ); ?>">
|
119 |
+
<option value=""><?php _e( 'Select Slider', 'nivo-slider' ); ?></option>
|
120 |
+
<?php foreach ( $galleries as $gallery ) {
|
121 |
+
$selected = ( isset( $instance['nivo_slider_id'] ) ) ? $instance['nivo_slider_id'] : ''; ?>
|
122 |
+
<option <?php selected( $selected, $gallery->ID ); ?> value="<?php echo $gallery->ID; ?>"><?php echo ( $gallery->post_title ) ? $gallery->post_title : $gallery->ID; ?></option>
|
123 |
+
<?php } ?>
|
124 |
+
</select>
|
125 |
+
</p>
|
126 |
+
<?php
|
127 |
+
}
|
128 |
+
}
|
includes/class-nivo-slider-activator.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired during plugin activation
|
5 |
+
*
|
6 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
7 |
+
* @since 3.0.0
|
8 |
+
*
|
9 |
+
* @package nivo-slider
|
10 |
+
* @subpackage nivo-slider/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Fired during plugin activation.
|
15 |
+
*
|
16 |
+
* This class defines all code necessary to run during the plugin's activation.
|
17 |
+
*
|
18 |
+
* @since 3.0.0
|
19 |
+
* @package nivo-slider
|
20 |
+
* @subpackage nivo-slider/includes
|
21 |
+
* @author ThemeIsle <friends@themeisle.com>
|
22 |
+
*/
|
23 |
+
class Nivo_Slider_Activator {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Short Description. (use period)
|
27 |
+
*
|
28 |
+
* Long Description.
|
29 |
+
*
|
30 |
+
* @since 3.0.0
|
31 |
+
*/
|
32 |
+
public static function activate() {
|
33 |
+
do_action( 'nivoslider_activate' );
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
includes/class-nivo-slider-deactivator.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired during plugin deactivation
|
5 |
+
*
|
6 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
7 |
+
* @since 3.0.0
|
8 |
+
*
|
9 |
+
* @package nivo-slider
|
10 |
+
* @subpackage nivo-slider/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Fired during plugin deactivation.
|
15 |
+
*
|
16 |
+
* This class defines all code necessary to run during the plugin's deactivation.
|
17 |
+
*
|
18 |
+
* @since 3.0.0
|
19 |
+
* @package nivo-slider
|
20 |
+
* @subpackage nivo-slider/includes
|
21 |
+
* @author ThemeIsle <friends@themeisle.com>
|
22 |
+
*/
|
23 |
+
class Nivo_Slider_Deactivator {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Short Description. (use period)
|
27 |
+
*
|
28 |
+
* Long Description.
|
29 |
+
*
|
30 |
+
* @since 3.0.0
|
31 |
+
*/
|
32 |
+
public static function deactivate() {
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
includes/class-nivo-slider-i18n.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Define the internationalization functionality
|
5 |
+
*
|
6 |
+
* Loads and defines the internationalization files for this plugin
|
7 |
+
* so that it is ready for translation.
|
8 |
+
*
|
9 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
10 |
+
* @since 3.0.0
|
11 |
+
*
|
12 |
+
* @package nivo-slider
|
13 |
+
* @subpackage nivo-slider/includes
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Define the internationalization functionality.
|
18 |
+
*
|
19 |
+
* Loads and defines the internationalization files for this plugin
|
20 |
+
* so that it is ready for translation.
|
21 |
+
*
|
22 |
+
* @since 3.0.0
|
23 |
+
* @package nivo-slider
|
24 |
+
* @subpackage nivo-slider/includes
|
25 |
+
* @author ThemeIsle <friends@themeisle.com>
|
26 |
+
*/
|
27 |
+
class Nivo_Slider_i18n {
|
28 |
+
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Load the plugin text domain for translation.
|
32 |
+
*
|
33 |
+
* @since 3.0.0
|
34 |
+
*/
|
35 |
+
public function load_plugin_textdomain() {
|
36 |
+
|
37 |
+
load_plugin_textdomain(
|
38 |
+
'nivo-slider',
|
39 |
+
false,
|
40 |
+
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
|
41 |
+
);
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
}
|
includes/class-nivo-slider-loader.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Register all actions and filters for the plugin
|
5 |
+
*
|
6 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
7 |
+
* @since 3.0.0
|
8 |
+
*
|
9 |
+
* @package nivo-slider
|
10 |
+
* @subpackage nivo-slider/includes
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Register all actions and filters for the plugin.
|
15 |
+
*
|
16 |
+
* Maintain a list of all hooks that are registered throughout
|
17 |
+
* the plugin, and register them with the WordPress API. Call the
|
18 |
+
* run function to execute the list of actions and filters.
|
19 |
+
*
|
20 |
+
* @package nivo-slider
|
21 |
+
* @subpackage nivo-slider/includes
|
22 |
+
* @author ThemeIsle <friends@themeisle.com>
|
23 |
+
*/
|
24 |
+
class Nivo_Slider_Loader {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* The array of actions registered with WordPress.
|
28 |
+
*
|
29 |
+
* @since 3.0.0
|
30 |
+
* @access protected
|
31 |
+
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
|
32 |
+
*/
|
33 |
+
protected $actions;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The array of filters registered with WordPress.
|
37 |
+
*
|
38 |
+
* @since 3.0.0
|
39 |
+
* @access protected
|
40 |
+
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
|
41 |
+
*/
|
42 |
+
protected $filters;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Initialize the collections used to maintain the actions and filters.
|
46 |
+
*
|
47 |
+
* @since 3.0.0
|
48 |
+
*/
|
49 |
+
public function __construct() {
|
50 |
+
|
51 |
+
$this->actions = array();
|
52 |
+
$this->filters = array();
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Add a new action to the collection to be registered with WordPress.
|
58 |
+
*
|
59 |
+
* @since 3.0.0
|
60 |
+
* @param string $hook The name of the WordPress action that is being registered.
|
61 |
+
* @param object $component A reference to the instance of the object on which the action is defined.
|
62 |
+
* @param string $callback The name of the function definition on the $component.
|
63 |
+
* @param int $priority Optional. he priority at which the function should be fired. Default is 10.
|
64 |
+
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
|
65 |
+
*/
|
66 |
+
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
67 |
+
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Add a new filter to the collection to be registered with WordPress.
|
72 |
+
*
|
73 |
+
* @since 3.0.0
|
74 |
+
* @param string $hook The name of the WordPress filter that is being registered.
|
75 |
+
* @param object $component A reference to the instance of the object on which the filter is defined.
|
76 |
+
* @param string $callback The name of the function definition on the $component.
|
77 |
+
* @param int $priority Optional. he priority at which the function should be fired. Default is 10.
|
78 |
+
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
|
79 |
+
*/
|
80 |
+
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
81 |
+
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* A utility function that is used to register the actions and hooks into a single
|
86 |
+
* collection.
|
87 |
+
*
|
88 |
+
* @since 3.0.0
|
89 |
+
* @access private
|
90 |
+
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
91 |
+
* @param string $hook The name of the WordPress filter that is being registered.
|
92 |
+
* @param object $component A reference to the instance of the object on which the filter is defined.
|
93 |
+
* @param string $callback The name of the function definition on the $component.
|
94 |
+
* @param int $priority The priority at which the function should be fired.
|
95 |
+
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
96 |
+
* @return array The collection of actions and filters registered with WordPress.
|
97 |
+
*/
|
98 |
+
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
99 |
+
|
100 |
+
$hooks[] = array(
|
101 |
+
'hook' => $hook,
|
102 |
+
'component' => $component,
|
103 |
+
'callback' => $callback,
|
104 |
+
'priority' => $priority,
|
105 |
+
'accepted_args' => $accepted_args,
|
106 |
+
);
|
107 |
+
|
108 |
+
return $hooks;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Register the filters and actions with WordPress.
|
114 |
+
*
|
115 |
+
* @since 3.0.0
|
116 |
+
*/
|
117 |
+
public function run() {
|
118 |
+
|
119 |
+
foreach ( $this->filters as $hook ) {
|
120 |
+
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
121 |
+
}
|
122 |
+
|
123 |
+
foreach ( $this->actions as $hook ) {
|
124 |
+
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
}
|
includes/class-nivo-slider.php
ADDED
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The file that defines the core plugin class
|
5 |
+
*
|
6 |
+
* A class definition that includes attributes and functions used across both the
|
7 |
+
* public-facing side of the site and the admin area.
|
8 |
+
*
|
9 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
10 |
+
* @since 3.0.0
|
11 |
+
*
|
12 |
+
* @package nivo-slider
|
13 |
+
* @subpackage nivo-slider/includes
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* The core plugin class.
|
18 |
+
*
|
19 |
+
* This is used to define internationalization, admin-specific hooks, and
|
20 |
+
* public-facing site hooks.
|
21 |
+
*
|
22 |
+
* Also maintains the unique identifier of this plugin as well as the current
|
23 |
+
* version of the plugin.
|
24 |
+
*
|
25 |
+
* @since 3.0.0
|
26 |
+
* @package nivo-slider
|
27 |
+
* @subpackage nivo-slider/includes
|
28 |
+
* @author ThemeIsle <friends@themeisle.com>
|
29 |
+
*/
|
30 |
+
class Nivo_Slider {
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The loader that's responsible for maintaining and registering all hooks that power
|
34 |
+
* the plugin.
|
35 |
+
*
|
36 |
+
* @since 3.0.0
|
37 |
+
* @access protected
|
38 |
+
* @var Nivo_Slider_Loader $loader Maintains and registers all hooks for the plugin.
|
39 |
+
*/
|
40 |
+
protected $loader;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* The unique identifier of this plugin.
|
44 |
+
*
|
45 |
+
* @since 3.0.0
|
46 |
+
* @access protected
|
47 |
+
* @var string $plugin_name The string used to uniquely identify this plugin.
|
48 |
+
*/
|
49 |
+
protected $plugin_name;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* The current version of the plugin.
|
53 |
+
*
|
54 |
+
* @since 3.0.0
|
55 |
+
* @access protected
|
56 |
+
* @var string $version The current version of the plugin.
|
57 |
+
*/
|
58 |
+
protected $version;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Define the core functionality of the plugin.
|
62 |
+
*
|
63 |
+
* Set the plugin name and the plugin version that can be used throughout the plugin.
|
64 |
+
* Load the dependencies, define the locale, and set the hooks for the admin area and
|
65 |
+
* the public-facing side of the site.
|
66 |
+
*
|
67 |
+
* @since 3.0.0
|
68 |
+
*/
|
69 |
+
public function __construct() {
|
70 |
+
|
71 |
+
$this->plugin_name = 'nivo-slider';
|
72 |
+
$this->version = '2.0.0';
|
73 |
+
|
74 |
+
$this->load_dependencies();
|
75 |
+
$this->set_locale();
|
76 |
+
$this->define_admin_hooks();
|
77 |
+
//$this->define_public_hooks();
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Load the required dependencies for this plugin.
|
83 |
+
*
|
84 |
+
* Include the following files that make up the plugin:
|
85 |
+
*
|
86 |
+
* - Nivo_Slider_Loader. Orchestrates the hooks of the plugin.
|
87 |
+
* - Nivo_Slider_i18n. Defines internationalization functionality.
|
88 |
+
* - Nivo_Slider_Admin. Defines all hooks for the admin area.
|
89 |
+
* - Nivo_Slider_Public. Defines all hooks for the public side of the site.
|
90 |
+
*
|
91 |
+
* Create an instance of the loader which will be used to register the hooks
|
92 |
+
* with WordPress.
|
93 |
+
*
|
94 |
+
* @since 3.0.0
|
95 |
+
* @access private
|
96 |
+
*/
|
97 |
+
private function load_dependencies() {
|
98 |
+
$this->loader = new Nivo_Slider_Loader();
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Define the locale for this plugin for internationalization.
|
103 |
+
*
|
104 |
+
* Uses the Nivo_Slider_i18n class in order to set the domain and to register the hook
|
105 |
+
* with WordPress.
|
106 |
+
*
|
107 |
+
* @since 3.0.0
|
108 |
+
* @access private
|
109 |
+
*/
|
110 |
+
private function set_locale() {
|
111 |
+
|
112 |
+
$plugin_i18n = new Nivo_Slider_i18n();
|
113 |
+
|
114 |
+
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Register all of the hooks related to the admin area functionality
|
120 |
+
* of the plugin.
|
121 |
+
*
|
122 |
+
* @since 3.0.0
|
123 |
+
* @access private
|
124 |
+
*/
|
125 |
+
private function define_admin_hooks() {
|
126 |
+
$plugin_admin = new Nivo_Slider_Admin( $this->get_plugin_name(), $this->get_version() );
|
127 |
+
$post_type = $plugin_admin::get_plugin_settings()->get_label( 'post_type' );
|
128 |
+
$plugin_shortcode_label = $plugin_admin::get_plugin_settings()->get_label( 'shortcode' );
|
129 |
+
// Actions Nivo_Slider_Admin
|
130 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
|
131 |
+
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
|
132 |
+
$this->loader->add_action( 'init', $plugin_admin, 'init_tinymce' );
|
133 |
+
$this->loader->add_action( 'admin_print_scripts', $plugin_admin, 'admin_print_scripts' );
|
134 |
+
$this->loader->add_action( 'after_plugin_row_' . $post_type, $plugin_admin, 'plugin_row', 11 );
|
135 |
+
$this->loader->add_action( 'admin_menu', $plugin_admin, 'admin_menu' );
|
136 |
+
$this->loader->add_action( 'admin_menu', $plugin_admin, 'remove_admin_menu' );
|
137 |
+
$this->loader->add_action( 'admin_init', $plugin_admin, 'register_settings' );
|
138 |
+
$this->loader->add_action( 'after_plugin_row_' . $this->get_plugin_name(), $plugin_admin, 'plugin_row', 11 );
|
139 |
+
// Filters Nivo_Slider_Admin
|
140 |
+
$this->loader->add_filter( $post_type . '_script_settings', $plugin_admin, 'script_settings' );
|
141 |
+
$this->loader->add_filter( $post_type . '_post_type_menu_icon', $plugin_admin, 'menu_icon' );
|
142 |
+
$this->loader->add_filter( $post_type . '_post_type_labels', $plugin_admin, 'plugin_labels' );
|
143 |
+
$this->loader->add_filter( $post_type . '_get_license_constant', $plugin_admin, 'get_license_constant' );
|
144 |
+
$this->loader->add_filter( $post_type . '_check_license_constant', $plugin_admin, 'check_license_constant' );
|
145 |
+
$this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'plugin_action_links', 10, 2 );
|
146 |
+
$this->loader->add_filter( 'nivo_field_upsell', $plugin_admin, 'add_upsell', 10, 2 );
|
147 |
+
$this->loader->add_filter( 'nivo_slider_lite_logger_flag', $plugin_admin, 'check_logger', 10, 2 );
|
148 |
+
|
149 |
+
$plugin_admin_edit = new Nivo_Core_Admin_Edit();
|
150 |
+
// Actions Nivo_Core_Admin_Edit
|
151 |
+
$this->loader->add_action( 'admin_init', $plugin_admin_edit, 'admin_init' );
|
152 |
+
$this->loader->add_action( 'manage_edit-' . $post_type . '_columns', $plugin_admin_edit, 'edit_columns' );
|
153 |
+
$this->loader->add_action( 'manage_' . $post_type . '_posts_custom_column', $plugin_admin_edit, 'custom_columns' );
|
154 |
+
// Filters Nivo_Core_Admin_Edit
|
155 |
+
$this->loader->add_filter( $post_type . '_admin_edit_settings', $plugin_admin_edit, 'admin_edit_settings' );
|
156 |
+
|
157 |
+
$plugin_admin_ajax = new Nivo_Core_Admin_Ajax();
|
158 |
+
// Actions Nivo_Core_Admin_Ajax
|
159 |
+
$this->loader->add_action( 'wp_ajax_' . $post_type . '_set_meta_link', $plugin_admin_ajax, 'set_meta_link' );
|
160 |
+
$this->loader->add_action( 'wp_ajax_' . $post_type . '_get_meta_link', $plugin_admin_ajax, 'get_meta_link' );
|
161 |
+
$this->loader->add_action( 'wp_ajax_' . $post_type . '_load_images', $plugin_admin_ajax, 'load_images' );
|
162 |
+
$this->loader->add_action( 'wp_ajax_' . $post_type . '_reattach_images', $plugin_admin_ajax, 'reattach_images' );
|
163 |
+
$this->loader->add_action( 'wp_ajax_track_url', $plugin_admin_ajax, 'track_url' );
|
164 |
+
|
165 |
+
$plugin_admin_images = new Nivo_Core_Admin_Images();
|
166 |
+
// Actions Nivo_Core_Admin_Images
|
167 |
+
$this->loader->add_action( 'after_setup_theme', $plugin_admin_images, 'theme_support_check', 999 );
|
168 |
+
$this->loader->add_action( 'admin_footer', $plugin_admin_images, 'print_media_templates' );
|
169 |
+
// Filters Nivo_Core_Admin_Images
|
170 |
+
$this->loader->add_filter( 'media_view_strings', $plugin_admin_images, 'custom_media_string', 11, 2 );
|
171 |
+
$this->loader->add_filter( 'uber_media_pre_insert', $plugin_admin_images, 'mmp_pre_insert' );
|
172 |
+
|
173 |
+
$plugin_model = new Nivo_Core_Model();
|
174 |
+
// Actions Nivo_Core_Model
|
175 |
+
$this->loader->add_action( 'init', $plugin_model, 'register' );
|
176 |
+
$this->loader->add_action( 'save_post', $plugin_model, 'save_post' );
|
177 |
+
// Filters Nivo_Core_Model
|
178 |
+
$this->loader->add_filter( 'post_updated_messages', $plugin_model, 'post_updated_messages' );
|
179 |
+
$this->loader->add_filter( $post_type . '_post_meta_save', $plugin_model, 'save_post_meta' );
|
180 |
+
|
181 |
+
$plugin_shortcode = new Nivo_Core_Shortcode();
|
182 |
+
add_shortcode( $plugin_shortcode_label, array( $plugin_shortcode, 'shortcode' ) );
|
183 |
+
// Actions Nivo_Core_Shortcode
|
184 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_shortcode, 'register_scripts' );
|
185 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_shortcode, 'register_styles' );
|
186 |
+
// Filters Nivo_Core_Shortcode
|
187 |
+
$this->loader->add_filter( 'the_posts', $plugin_shortcode, 'shortcode_enqueue_core' );
|
188 |
+
$this->loader->add_filter( 'nivo_slider', $plugin_shortcode, 'shortcode_enqueue_core' );
|
189 |
+
$this->loader->add_filter( $post_type . '_shortcode_styles_enqueue', $plugin_shortcode, 'shortcode_styles_enqueue', 10, 2 );
|
190 |
+
$this->loader->add_filter( $post_type . '_shortcode_output', $plugin_shortcode, 'shortcode_output', 10, 5 );
|
191 |
+
|
192 |
+
$plugin_widget = new Nivo_Slider_Widget();
|
193 |
+
// Actions Nivo_Core_Shortcode
|
194 |
+
$this->loader->add_action( 'widgets_init', $plugin_widget, 'register_widget' );
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Register all of the hooks related to the public-facing functionality
|
199 |
+
* of the plugin.
|
200 |
+
*
|
201 |
+
* @since 3.0.0
|
202 |
+
* @access private
|
203 |
+
*/
|
204 |
+
private function define_public_hooks() {
|
205 |
+
$plugin_public = new Nivo_Slider_Public( $this->get_plugin_name(), $this->get_version() );
|
206 |
+
|
207 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
|
208 |
+
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
|
209 |
+
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Run the loader to execute all of the hooks with WordPress.
|
214 |
+
*
|
215 |
+
* @since 3.0.0
|
216 |
+
*/
|
217 |
+
public function run() {
|
218 |
+
$this->loader->run();
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* The name of the plugin used to uniquely identify it within the context of
|
223 |
+
* WordPress and to define internationalization functionality.
|
224 |
+
*
|
225 |
+
* @since 3.0.0
|
226 |
+
* @return string The name of the plugin.
|
227 |
+
*/
|
228 |
+
public function get_plugin_name() {
|
229 |
+
return $this->plugin_name;
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* The reference to the class that orchestrates the hooks with the plugin.
|
234 |
+
*
|
235 |
+
* @since 3.0.0
|
236 |
+
* @return Nivo_Slider_Loader Orchestrates the hooks of the plugin.
|
237 |
+
*/
|
238 |
+
public function get_loader() {
|
239 |
+
return $this->loader;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Retrieve the version number of the plugin.
|
244 |
+
*
|
245 |
+
* @since 3.0.0
|
246 |
+
* @return string The version number of the plugin.
|
247 |
+
*/
|
248 |
+
public function get_version() {
|
249 |
+
return $this->version;
|
250 |
+
}
|
251 |
+
|
252 |
+
}
|
includes/core/README.md
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
### Add plugin-core to Dev7studios Plugin
|
2 |
-
|
3 |
-
```
|
4 |
-
git subtree add --prefix includes/core https://github.com/Dev7studios/plugin-core.git master --squash
|
5 |
-
```
|
6 |
-
|
7 |
-
### Update plugin-core from within Dev7studios Plugin
|
8 |
-
|
9 |
-
```
|
10 |
-
git subtree pull --prefix includes/core https://github.com/Dev7studios/plugin-core.git master --squash -m "Update plugin-core"
|
11 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/assets/css/admin.css
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
#edit-slug-box,
|
2 |
-
#postimagediv,
|
3 |
-
#minor-publishing,
|
4 |
-
.dev7_type,
|
5 |
-
.manual.description{
|
6 |
-
display:none;
|
7 |
-
}
|
8 |
-
|
9 |
-
.useful-links a {
|
10 |
-
float: right;
|
11 |
-
}
|
12 |
-
|
13 |
-
.dev7plugin-images li {
|
14 |
-
display: inline-block;
|
15 |
-
margin: 0;
|
16 |
-
position: relative;
|
17 |
-
}
|
18 |
-
|
19 |
-
.dev7plugin-images li .spinner {
|
20 |
-
float: left;
|
21 |
-
display: block;
|
22 |
-
}
|
23 |
-
|
24 |
-
.dev7plugin-images li img {
|
25 |
-
background: none repeat scroll 0 0 #FFFFFF;
|
26 |
-
border: 1px solid #DFDFDF;
|
27 |
-
margin: 0 10px 10px 0;
|
28 |
-
padding: 3px;
|
29 |
-
}
|
30 |
-
|
31 |
-
.dev7plugin-thumbs {
|
32 |
-
list-style: none outside none;
|
33 |
-
margin: 0;
|
34 |
-
padding: 3px 0 0;
|
35 |
-
}
|
36 |
-
|
37 |
-
.dev7plugin-thumbs li {
|
38 |
-
display: inline-block;
|
39 |
-
margin: 0;
|
40 |
-
position: relative;
|
41 |
-
}
|
42 |
-
|
43 |
-
.dev7plugin-thumbs li img {
|
44 |
-
background: none repeat scroll 0 0 #FFFFFF;
|
45 |
-
border: 1px solid #DFDFDF;
|
46 |
-
margin: 0 10px 5px 0;
|
47 |
-
padding: 2px;
|
48 |
-
}
|
49 |
-
|
50 |
-
#dev7license .spinner,
|
51 |
-
#dev7license #deactivate-license,
|
52 |
-
#dev7license #activate-license,
|
53 |
-
.reattach-spinner {
|
54 |
-
float: left;
|
55 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/assets/js/admin.js
DELETED
@@ -1,303 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($){
|
2 |
-
|
3 |
-
function get_image_source_setting() {
|
4 |
-
return $('select[name="' + dev7plugin.labels.post_meta_key + '[' + dev7plugin.labels.source_name + ']"] option:selected').val();
|
5 |
-
}
|
6 |
-
|
7 |
-
// Edit screen Images
|
8 |
-
if (dev7plugin.post_id != '') {
|
9 |
-
load_image_source(); // Initial load
|
10 |
-
}
|
11 |
-
|
12 |
-
$('select[name="' + dev7plugin.labels.post_meta_key + '[' + dev7plugin.labels.source_name + ']"]').change(function(){
|
13 |
-
load_image_source();
|
14 |
-
display_params();
|
15 |
-
});
|
16 |
-
|
17 |
-
$('select[name="' + dev7plugin.labels.post_meta_key + '[' + dev7plugin.labels.type_name + '_gallery]"]').change(function(){
|
18 |
-
load_image_source();
|
19 |
-
});
|
20 |
-
|
21 |
-
$('select[name="' + dev7plugin.labels.post_meta_key + '[' + dev7plugin.labels.type_name + '_category]"]').change(function(){
|
22 |
-
load_image_source();
|
23 |
-
});
|
24 |
-
|
25 |
-
function escapeHTML (unsafe_str) {
|
26 |
-
return unsafe_str
|
27 |
-
.replace(/&/g, '&')
|
28 |
-
.replace(/</g, '<')
|
29 |
-
.replace(/>/g, '>')
|
30 |
-
.replace(/\"/g, '"')
|
31 |
-
.replace(/\'/g, '''); // ''' is not valid HTML 4
|
32 |
-
}
|
33 |
-
|
34 |
-
function load_images( ){
|
35 |
-
var image_source = $('select[name="' + dev7plugin.labels.post_meta_key + '[' + dev7plugin.labels.source_name + ']"] option:selected').val();
|
36 |
-
var image_method = $('select[name="' + dev7plugin.labels.post_meta_key + '[' + image_source + '_type]"] option:selected').val();
|
37 |
-
var image_param = $('#' + image_source + '_' + image_method).val();
|
38 |
-
|
39 |
-
var number_images = $('input[name="' + dev7plugin.labels.post_meta_key + '[number_images]"]').val();
|
40 |
-
|
41 |
-
if (image_param != '') {
|
42 |
-
$('#' + dev7plugin.labels.post_type + '-images').html('<li class="loading"><div class="spinner"></div></li>');
|
43 |
-
$.ajax({
|
44 |
-
url: ajaxurl,
|
45 |
-
type: 'POST',
|
46 |
-
dataType: 'json',
|
47 |
-
data: { action: dev7plugin.labels.post_type + '_load_images',
|
48 |
-
id: dev7plugin.post_id,
|
49 |
-
nonce: dev7plugin.nonce,
|
50 |
-
source: image_source,
|
51 |
-
gallery:$('select[name="' + dev7plugin.labels.post_meta_key + '[' + dev7plugin.labels.type_name + '_gallery]"] option:selected').val(),
|
52 |
-
category:$('select[name="' + dev7plugin.labels.post_meta_key + '[' + dev7plugin.labels.type_name + '_category]"] option:selected').val(),
|
53 |
-
method:image_method,
|
54 |
-
param:image_param,
|
55 |
-
number_images:number_images
|
56 |
-
},
|
57 |
-
success: function(response){
|
58 |
-
if(response.error){
|
59 |
-
$('#' + dev7plugin.labels.post_type +'-images').html('');
|
60 |
-
alert(response.message);
|
61 |
-
} else {
|
62 |
-
$('#' + dev7plugin.labels.post_type +'-images').html('');
|
63 |
-
for(var i in response.images){
|
64 |
-
var image = response.images[i];
|
65 |
-
var output = '<li id="attachment-' + image.id + '">' +
|
66 |
-
'<img src="' + image.image_src + '" alt="' + escapeHTML( image.post_title ) + '" title="' + escapeHTML( image.post_title ) + '" class="attachment-thumbnail" />' +
|
67 |
-
'</li>';
|
68 |
-
$('#' + dev7plugin.labels.post_type +'-images').append(output);
|
69 |
-
}
|
70 |
-
}
|
71 |
-
},
|
72 |
-
error: function(response, status, error){
|
73 |
-
$('#' + dev7plugin.labels.post_type +'-images').html('<li class="loading">Error '+ error.replace(/(<([^>]+)>)/ig,"") +'</li>');
|
74 |
-
//alert('Error: ' + error.replace(/(<([^>]+)>)/ig,""));
|
75 |
-
}
|
76 |
-
});
|
77 |
-
}
|
78 |
-
}
|
79 |
-
|
80 |
-
function load_image_source() {
|
81 |
-
var selected_source = get_image_source_setting();
|
82 |
-
$('.dev7_type').hide();
|
83 |
-
if( selected_source != dev7plugin.labels.manual_name){
|
84 |
-
$( '#dev7_type_' + selected_source ).show();
|
85 |
-
$('.manual.description').hide();
|
86 |
-
$('.dev7_non_manual').show();
|
87 |
-
$('#manual_images_upload').hide();
|
88 |
-
} else {
|
89 |
-
$('.manual.description').show();
|
90 |
-
$('.dev7_non_manual').hide();
|
91 |
-
$('#manual_images_upload').show();
|
92 |
-
}
|
93 |
-
|
94 |
-
if( selected_source == 'category' || selected_source == 'sticky' || selected_source == 'custom'){
|
95 |
-
$('tr.dev7_captions').show();
|
96 |
-
} else {
|
97 |
-
$('tr.dev7_captions').hide();
|
98 |
-
}
|
99 |
-
|
100 |
-
if( selected_source == 'category' ||
|
101 |
-
selected_source == 'gallery' ||
|
102 |
-
selected_source == 'sticky' ||
|
103 |
-
selected_source == 'custom' ||
|
104 |
-
selected_source == dev7plugin.labels.manual_name
|
105 |
-
){
|
106 |
-
$('tr.wp-image-size').show();
|
107 |
-
} else {
|
108 |
-
$('tr.wp-image-size').hide();
|
109 |
-
}
|
110 |
-
|
111 |
-
load_images();
|
112 |
-
}
|
113 |
-
|
114 |
-
// Dependant Select visibilty
|
115 |
-
$( '#' + dev7plugin.labels.post_type + '-settings select' ).each( function( index, element ){
|
116 |
-
dependant_visible( this );
|
117 |
-
});
|
118 |
-
|
119 |
-
$('#' + dev7plugin.labels.post_type + '-settings').on('change', 'select', function(){
|
120 |
-
dependant_visible( this );
|
121 |
-
});
|
122 |
-
|
123 |
-
$( '#' + dev7plugin.labels.post_type + '-settings input:checkbox' ).each( function( index, element ){
|
124 |
-
dependant_visible( this );
|
125 |
-
});
|
126 |
-
|
127 |
-
$('#' + dev7plugin.labels.post_type + '-settings').on('change', 'input:checkbox', function(){
|
128 |
-
dependant_visible( this );
|
129 |
-
});
|
130 |
-
|
131 |
-
function dependant_visible( element ) {
|
132 |
-
var id = $(element).attr( 'id' );
|
133 |
-
if ($('tr.parent-' + id).length > 0) {
|
134 |
-
|
135 |
-
if ( $(element).is(':checkbox') ) {
|
136 |
-
var value = ( $(element).is(':checked') ) ? 'on' : 'off';
|
137 |
-
} else if ( $(element).is('select') ) {
|
138 |
-
var value = $('option:selected', element).val();
|
139 |
-
}
|
140 |
-
$('tr.parent-' + id).hide();
|
141 |
-
$('tr.parent-' + id + '.' + value).show();
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
// Reload images
|
146 |
-
$('#' + dev7plugin.labels.post_type + '-settings').on('change', 'input.reload', function(){
|
147 |
-
load_images();
|
148 |
-
});
|
149 |
-
|
150 |
-
$('#' + dev7plugin.labels.post_type + '-settings').on('change', 'select.reload', function(){
|
151 |
-
load_images();
|
152 |
-
});
|
153 |
-
|
154 |
-
|
155 |
-
/**
|
156 |
-
* MMP integration
|
157 |
-
*
|
158 |
-
*/
|
159 |
-
|
160 |
-
function display_params() {
|
161 |
-
var source = $('select[name="' + dev7plugin.labels.post_meta_key + '[' + dev7plugin.labels.source_name + ']"] option:selected').val();
|
162 |
-
var method = $('select[name="' + dev7plugin.labels.post_meta_key + '[' + source + '_type]"] option:selected').val();
|
163 |
-
$('.image_source_param').hide();
|
164 |
-
if(typeof method != 'undefined') {
|
165 |
-
$('#' + source + '_param_' + method).show();
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
display_params();
|
170 |
-
|
171 |
-
$('#' + dev7plugin.labels.post_type + '-settings').on('change', 'select.image_source_type', function(){
|
172 |
-
display_params();
|
173 |
-
load_images();
|
174 |
-
});
|
175 |
-
|
176 |
-
$('#' + dev7plugin.labels.post_type + '-settings').on('change', '.image_source_param', function(){
|
177 |
-
load_images();
|
178 |
-
});
|
179 |
-
|
180 |
-
$('.image_source_param').keydown(function(e){
|
181 |
-
if (e.which == 13) {
|
182 |
-
e.preventDefault();
|
183 |
-
load_images();
|
184 |
-
}
|
185 |
-
});
|
186 |
-
|
187 |
-
$('input.reload').keydown(function(e){
|
188 |
-
if (e.which == 13) {
|
189 |
-
e.preventDefault();
|
190 |
-
load_images();
|
191 |
-
}
|
192 |
-
});
|
193 |
-
|
194 |
-
$('.reattach-images').on('click', function(e){
|
195 |
-
e.preventDefault();
|
196 |
-
var post_id = $(this).attr('data-post');
|
197 |
-
$spinner = $(this).next('.spinner');
|
198 |
-
if (post_id != '') {
|
199 |
-
$spinner.show();
|
200 |
-
$(this).hide();
|
201 |
-
$.ajax({
|
202 |
-
url: ajaxurl,
|
203 |
-
type: 'POST',
|
204 |
-
dataType: 'json',
|
205 |
-
data: { action: dev7plugin.labels.post_type + '_reattach_images',
|
206 |
-
nonce: dev7plugin.nonce,
|
207 |
-
post_id: post_id
|
208 |
-
},
|
209 |
-
success: function(response){
|
210 |
-
if(response.error){
|
211 |
-
alert(response.message);
|
212 |
-
$spinner.hide();
|
213 |
-
} else {
|
214 |
-
// images attached
|
215 |
-
window.location = response.redirect;
|
216 |
-
}
|
217 |
-
},
|
218 |
-
error: function(response, status, error){
|
219 |
-
alert('Error: ' + error.replace(/(<([^>]+)>)/ig,""));
|
220 |
-
$spinner.hide();
|
221 |
-
}
|
222 |
-
});
|
223 |
-
}
|
224 |
-
});
|
225 |
-
|
226 |
-
|
227 |
-
/**
|
228 |
-
* License Calls
|
229 |
-
*
|
230 |
-
*
|
231 |
-
**/
|
232 |
-
|
233 |
-
var license_input = dev7plugin.labels.options_key + '[license_key]';
|
234 |
-
var license_status = dev7plugin.labels.options_key + '[license_status]';
|
235 |
-
$('#activate-license').on('click', function(){
|
236 |
-
var license_key = $('input[name="' + license_input + '"]').val();
|
237 |
-
if (license_key != '') {
|
238 |
-
$('#dev7license .spinner').show();
|
239 |
-
document.getElementById("activate-license").disabled = true;
|
240 |
-
$.ajax({
|
241 |
-
url: ajaxurl,
|
242 |
-
type: 'POST',
|
243 |
-
dataType: 'json',
|
244 |
-
data: { action: dev7plugin.labels.post_type + '_activate_license',
|
245 |
-
nonce: dev7plugin.nonce,
|
246 |
-
license_key: license_key
|
247 |
-
},
|
248 |
-
success: function(response){
|
249 |
-
if(response.error){
|
250 |
-
alert(response.message);
|
251 |
-
$('#dev7license .spinner').hide();
|
252 |
-
document.getElementById("activate-license").disabled = false;
|
253 |
-
} else {
|
254 |
-
$('input[name="' + license_status + '"]').val(response.license_status);
|
255 |
-
if (response.license_status == 'valid') window.location = response.redirect;
|
256 |
-
else {
|
257 |
-
alert('License ' + response.license_status);
|
258 |
-
$('#dev7license .spinner').hide();
|
259 |
-
document.getElementById("activate-license").disabled = false;
|
260 |
-
}
|
261 |
-
}
|
262 |
-
},
|
263 |
-
error: function(response, status, error){
|
264 |
-
alert('Error: ' + error.replace(/(<([^>]+)>)/ig,""));
|
265 |
-
$('#dev7license .spinner').hide();
|
266 |
-
document.getElementById("activate-license").disabled = false;
|
267 |
-
}
|
268 |
-
});
|
269 |
-
}
|
270 |
-
});
|
271 |
-
|
272 |
-
$('#deactivate-license').on('click', function(){
|
273 |
-
$('#dev7license .spinner').show();
|
274 |
-
document.getElementById("deactivate-license").disabled = true;
|
275 |
-
$.ajax({
|
276 |
-
url: ajaxurl,
|
277 |
-
type: 'POST',
|
278 |
-
dataType: 'json',
|
279 |
-
data: { action: dev7plugin.labels.post_type + '_deactivate_license',
|
280 |
-
nonce: dev7plugin.nonce
|
281 |
-
},
|
282 |
-
success: function(response){
|
283 |
-
if(response.error){
|
284 |
-
alert(response.message);
|
285 |
-
$('#dev7license .spinner').hide();
|
286 |
-
document.getElementById("deactivate-license").disabled = false;
|
287 |
-
} else {
|
288 |
-
if (response.license_status == 'deactivated') {
|
289 |
-
$('input[name="' + license_status + '"]').val('');
|
290 |
-
}
|
291 |
-
window.location = response.redirect;
|
292 |
-
}
|
293 |
-
},
|
294 |
-
error: function(response, status, error){
|
295 |
-
alert('Error: ' + error.replace(/(<([^>]+)>)/ig,""));
|
296 |
-
$('#dev7license .spinner').hide();
|
297 |
-
document.getElementById("deactivate-license").disabled = false;
|
298 |
-
}
|
299 |
-
});
|
300 |
-
|
301 |
-
});
|
302 |
-
|
303 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/assets/js/image-admin.js
DELETED
@@ -1,359 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($){
|
2 |
-
|
3 |
-
|
4 |
-
if(typeof wp === 'undefined') return;
|
5 |
-
|
6 |
-
if(typeof wp.media === 'undefined') return;
|
7 |
-
|
8 |
-
var frame,
|
9 |
-
images = wp.media.view.l10n[dev7plugin.labels.post_type + 'Images'],
|
10 |
-
selection = getImages(images);
|
11 |
-
|
12 |
-
if(typeof wp.media.view.Toolbar.UberMedia !== 'undefined') {
|
13 |
-
|
14 |
-
var UberImage = Backbone.Model.extend({
|
15 |
-
});
|
16 |
-
|
17 |
-
var UberImages = Backbone.Collection.extend({
|
18 |
-
model: UberImage
|
19 |
-
});
|
20 |
-
|
21 |
-
var SelectedImages = Backbone.Collection.extend({
|
22 |
-
model: UberImage
|
23 |
-
});
|
24 |
-
|
25 |
-
wp.media.view.Toolbar.UberMedia = wp.media.view.Toolbar.UberMedia.extend({
|
26 |
-
className: 'media-toolbar mmp-toolbar',
|
27 |
-
initialize: function() {
|
28 |
-
_.defaults( this.options, {
|
29 |
-
event: 'mmp_event_insert',
|
30 |
-
close: false,
|
31 |
-
items: {
|
32 |
-
mmp_event_insert: {
|
33 |
-
text: wp.media.view.l10n.ubermediaButton,
|
34 |
-
style: 'primary',
|
35 |
-
id: 'uber-button',
|
36 |
-
priority: 80,
|
37 |
-
requires: false,
|
38 |
-
click: this.insertAction
|
39 |
-
}
|
40 |
-
}
|
41 |
-
});
|
42 |
-
|
43 |
-
wp.media.view.Toolbar.prototype.initialize.apply( this, arguments );
|
44 |
-
},
|
45 |
-
|
46 |
-
|
47 |
-
insertAction: function(){
|
48 |
-
if($('#uber-button').is('[disabled=disabled]')) return;
|
49 |
-
|
50 |
-
$('div.ubermedia').addClass('uber-media-overlay');
|
51 |
-
$('#method').attr("disabled", 'disabled');
|
52 |
-
$('#param').attr("disabled", 'disabled');
|
53 |
-
$('#pagination').attr("disabled", 'disabled');
|
54 |
-
|
55 |
-
$('#uber-button').attr("disabled", 'disabled');
|
56 |
-
$("#uber-button").text('Adding...');
|
57 |
-
|
58 |
-
var selectedimages = this.controller.state().props.get('custom_data');
|
59 |
-
var selection = new SelectedImages(selectedimages.models);
|
60 |
-
|
61 |
-
var that = this,
|
62 |
-
count = 0,
|
63 |
-
jqHXRs = [],
|
64 |
-
new_ids = '';
|
65 |
-
|
66 |
-
selection.each(function(model){
|
67 |
-
count++;
|
68 |
-
|
69 |
-
var modelAttr = model.attributes;
|
70 |
-
var fields = $.param(modelAttr);
|
71 |
-
data = 'action=uber_pre_insert&nonce=' + uber_media.nonce + '&imgsrc=' + encodeURI(model.get('data-full')) + '&postid=' + $('#post_ID').val() + '&dev7plugin=' + dev7plugin.labels.post_type +'&' + fields;
|
72 |
-
|
73 |
-
var full = model.get('data-full');
|
74 |
-
var imgstr;
|
75 |
-
|
76 |
-
jqHXRs.push(
|
77 |
-
$.post(ajaxurl, data,
|
78 |
-
function(data){
|
79 |
-
if(data.message == 'success')
|
80 |
-
new_ids += data.attachment_id + ',';
|
81 |
-
}
|
82 |
-
, 'json')
|
83 |
-
);
|
84 |
-
});
|
85 |
-
|
86 |
-
$.when.apply(this, jqHXRs).done(function(){
|
87 |
-
|
88 |
-
that.controller.state().props.set( 'custom_data', '');
|
89 |
-
that.controller.state().props.set( 'selected_id', '' );
|
90 |
-
that.controller.state().props.set( 'selected_image', '' );
|
91 |
-
|
92 |
-
new_ids = new_ids.substring(0, new_ids.length - 1);
|
93 |
-
var new_selection = getImages(new_ids);
|
94 |
-
|
95 |
-
var checkExist = setInterval(function() {
|
96 |
-
if (new_selection.length) {
|
97 |
-
var controller = that.controller,
|
98 |
-
state = controller.state(),
|
99 |
-
edit = controller.state('gallery-edit');
|
100 |
-
edit.get('library').add( new_selection.models );
|
101 |
-
state.trigger('reset');
|
102 |
-
controller.setState('gallery-edit');
|
103 |
-
clearInterval(checkExist);
|
104 |
-
}
|
105 |
-
}, 100);
|
106 |
-
|
107 |
-
});
|
108 |
-
}
|
109 |
-
|
110 |
-
});
|
111 |
-
}
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
$('#manual_images_upload').on('click', function(e) {
|
116 |
-
e.preventDefault();
|
117 |
-
|
118 |
-
var media = wp.media;
|
119 |
-
selection = getImages($('#_manual_image_ids').val());
|
120 |
-
// Set options for 1st frame render
|
121 |
-
var options = {
|
122 |
-
state: 'gallery-edit',
|
123 |
-
frame: 'post',
|
124 |
-
selection: selection
|
125 |
-
};
|
126 |
-
|
127 |
-
// Set Links for image meta
|
128 |
-
$.ajax({
|
129 |
-
url: ajaxurl,
|
130 |
-
type: 'POST',
|
131 |
-
dataType: 'json',
|
132 |
-
data: { action: dev7plugin.labels.post_type + '_get_meta_link', ids: images,
|
133 |
-
nonce: dev7plugin.nonce },
|
134 |
-
success: function(response){
|
135 |
-
$.each(response.metalink, function(index, value) {
|
136 |
-
selection.get(index).set('metalink', value);
|
137 |
-
});
|
138 |
-
},
|
139 |
-
error: function(response, status, error){
|
140 |
-
alert('Error: ' + error.replace(/(<([^>]+)>)/ig,""));
|
141 |
-
}
|
142 |
-
});
|
143 |
-
|
144 |
-
overrideAttachmentDetails();
|
145 |
-
|
146 |
-
frame = wp.media(options).open();
|
147 |
-
|
148 |
-
// Tweak views
|
149 |
-
frame.menu.get('view').unset('cancel');
|
150 |
-
frame.menu.get('view').unset('separateCancel');
|
151 |
-
|
152 |
-
frame.content.get('view').sidebar.unset('gallery'); // Hide Gallery Settings in sidebar
|
153 |
-
|
154 |
-
// When we are editing a gallery
|
155 |
-
overrideGalleryInsert();
|
156 |
-
frame.on( 'toolbar:render:gallery-edit', function() {
|
157 |
-
overrideGalleryInsert();
|
158 |
-
});
|
159 |
-
|
160 |
-
frame.on( 'content:render:browse', function( browser ) {
|
161 |
-
if ( !browser ) return;
|
162 |
-
// Hide Gallery Settings in sidebar
|
163 |
-
browser.sidebar.on('ready', function(){
|
164 |
-
browser.sidebar.unset('gallery');
|
165 |
-
});
|
166 |
-
// Hide filter/search as they don't work
|
167 |
-
browser.toolbar.on('ready', function(){
|
168 |
-
if(browser.toolbar.controller._state == 'gallery-library'){
|
169 |
-
browser.toolbar.$el.hide();
|
170 |
-
}
|
171 |
-
});
|
172 |
-
});
|
173 |
-
|
174 |
-
|
175 |
-
// Override Attachment Details
|
176 |
-
function overrideAttachmentDetails() {
|
177 |
-
|
178 |
-
media.view.Attachment.Details = media.view.Attachment.Details.extend({
|
179 |
-
tagName: 'div',
|
180 |
-
className: 'attachment-details',
|
181 |
-
template: media.template('attachment-details'),
|
182 |
-
|
183 |
-
events: {
|
184 |
-
'change [data-setting]': 'updateSetting',
|
185 |
-
'change [data-setting] input': 'updateSetting',
|
186 |
-
'change [data-setting] select': 'updateSetting',
|
187 |
-
'change [data-setting] textarea': 'updateSetting',
|
188 |
-
'change [data-customsetting] input': 'updateCustomSetting',
|
189 |
-
'click .delete-attachment': 'deleteAttachment',
|
190 |
-
'click .edit-attachment': 'editAttachment',
|
191 |
-
'click .refresh-attachment': 'refreshAttachment'
|
192 |
-
},
|
193 |
-
|
194 |
-
initialize: function() {
|
195 |
-
this.focusManager = new media.view.FocusManager({
|
196 |
-
el: this.el
|
197 |
-
});
|
198 |
-
|
199 |
-
media.view.Attachment.prototype.initialize.apply( this, arguments );
|
200 |
-
},
|
201 |
-
|
202 |
-
render: function() {
|
203 |
-
media.view.Attachment.prototype.render.apply( this, arguments );
|
204 |
-
this.focusManager.focus();
|
205 |
-
return this;
|
206 |
-
},
|
207 |
-
|
208 |
-
deleteAttachment: function( event ) {
|
209 |
-
event.preventDefault();
|
210 |
-
|
211 |
-
if ( confirm( l10n.warnDelete ) )
|
212 |
-
this.model.destroy();
|
213 |
-
},
|
214 |
-
|
215 |
-
editAttachment: function( event ) {
|
216 |
-
this.$el.addClass('needs-refresh');
|
217 |
-
},
|
218 |
-
|
219 |
-
refreshAttachment: function( event ) {
|
220 |
-
this.$el.removeClass('needs-refresh');
|
221 |
-
event.preventDefault();
|
222 |
-
this.model.fetch();
|
223 |
-
},
|
224 |
-
|
225 |
-
updateCustomSetting: function( event ) {
|
226 |
-
|
227 |
-
var $setting = $( event.target ).closest('[data-customsetting]'),
|
228 |
-
setting, value;
|
229 |
-
|
230 |
-
if ( ! $setting.length )
|
231 |
-
return;
|
232 |
-
|
233 |
-
setting = $setting.data('customsetting');
|
234 |
-
value = event.target.value;
|
235 |
-
|
236 |
-
if ( this.model.get( setting ) !== value ) {
|
237 |
-
this.model.set( setting, value );
|
238 |
-
$.ajax({
|
239 |
-
url: ajaxurl,
|
240 |
-
type: 'POST',
|
241 |
-
dataType: 'json',
|
242 |
-
data: { action: dev7plugin.labels.post_type + '_set_meta_link',
|
243 |
-
id:this.model.id,
|
244 |
-
metalink: value,
|
245 |
-
nonce: dev7plugin.nonce },
|
246 |
-
success: function(response){
|
247 |
-
},
|
248 |
-
error: function(response, status, error){
|
249 |
-
alert('Error: ' + error.replace(/(<([^>]+)>)/ig,""));
|
250 |
-
}
|
251 |
-
});
|
252 |
-
|
253 |
-
}
|
254 |
-
|
255 |
-
}
|
256 |
-
|
257 |
-
});
|
258 |
-
|
259 |
-
}
|
260 |
-
|
261 |
-
// Override insert button
|
262 |
-
function overrideGalleryInsert() {
|
263 |
-
var editing = frame.state().get('editing');
|
264 |
-
|
265 |
-
frame.toolbar.get('view').set({
|
266 |
-
insert: {
|
267 |
-
style: 'primary',
|
268 |
-
text: editing ? wp.media.view.l10n.updateGallery : wp.media.view.l10n.insertGallery,
|
269 |
-
|
270 |
-
click: function() {
|
271 |
-
var models = frame.state().get('library'),
|
272 |
-
ids = '';
|
273 |
-
|
274 |
-
models.each( function( attachment ) {
|
275 |
-
ids += attachment.id + ','
|
276 |
-
});
|
277 |
-
ids = ids.substring(0, ids.length - 1);
|
278 |
-
|
279 |
-
this.el.innerHTML = 'Saving'; //'<?php _e("Saving...", "zilla"); ?>';
|
280 |
-
|
281 |
-
$('#_manual_image_ids').val( ids );
|
282 |
-
frame.close();
|
283 |
-
|
284 |
-
$('#' + dev7plugin.labels.post_type +'-images').html('<li class="loading"><div class="spinner"></div></li>');
|
285 |
-
|
286 |
-
$.ajax({
|
287 |
-
url: ajaxurl,
|
288 |
-
type: 'POST',
|
289 |
-
dataType: 'json',
|
290 |
-
data: { action: dev7plugin.labels.post_type + '_load_images',
|
291 |
-
id:dev7plugin.post_id,
|
292 |
-
source: dev7plugin.labels.manual_name,
|
293 |
-
image_ids: ids,
|
294 |
-
nonce: dev7plugin.nonce },
|
295 |
-
success: function(response){
|
296 |
-
if(response.error){
|
297 |
-
alert(response.message);
|
298 |
-
} else {
|
299 |
-
if (response.images) {
|
300 |
-
$('#' + dev7plugin.labels.post_type + '-images').html('');
|
301 |
-
for(var i in response.images){
|
302 |
-
var image = response.images[i];
|
303 |
-
var output = '<li id="attachment-' + image.id + '">' +
|
304 |
-
'<img src="' + image.image_src + '" alt="' + image.post_title + '" title="' + image.post_title + '" class="attachment-thumbnail" />';
|
305 |
-
|
306 |
-
$('#' + dev7plugin.labels.post_type + '-images').append(output);
|
307 |
-
}
|
308 |
-
}
|
309 |
-
}
|
310 |
-
},
|
311 |
-
error: function(response, status, error){
|
312 |
-
alert('Error: ' + error.replace(/(<([^>]+)>)/ig,""));
|
313 |
-
}
|
314 |
-
});
|
315 |
-
|
316 |
-
}
|
317 |
-
}
|
318 |
-
});
|
319 |
-
}
|
320 |
-
|
321 |
-
});
|
322 |
-
|
323 |
-
// Load images
|
324 |
-
function getImages(images) {
|
325 |
-
if (!images) images = $('#_manual_image_ids').val();
|
326 |
-
|
327 |
-
if( images ){
|
328 |
-
var shortcode = new wp.shortcode({
|
329 |
-
tag: 'gallery',
|
330 |
-
attrs: { ids: images },
|
331 |
-
type: 'single'
|
332 |
-
});
|
333 |
-
|
334 |
-
var attachments = wp.media.gallery.attachments( shortcode );
|
335 |
-
|
336 |
-
|
337 |
-
var selection = new wp.media.model.Selection( attachments.models, {
|
338 |
-
props: attachments.props.toJSON(),
|
339 |
-
multiple: true
|
340 |
-
});
|
341 |
-
|
342 |
-
selection.gallery = attachments.gallery;
|
343 |
-
|
344 |
-
// Fetch the query's attachments, and then break ties from the
|
345 |
-
// query to allow for sorting.
|
346 |
-
selection.more().done( function() {
|
347 |
-
// Break ties with the query.
|
348 |
-
selection.props.set({ query: false });
|
349 |
-
selection.unmirror();
|
350 |
-
selection.props.unset('orderby');
|
351 |
-
});
|
352 |
-
|
353 |
-
return selection;
|
354 |
-
}
|
355 |
-
|
356 |
-
return false;
|
357 |
-
}
|
358 |
-
|
359 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/includes/admin-ajax.php
DELETED
@@ -1,291 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin AJAX Class
|
4 |
-
*
|
5 |
-
* @package Plugin Core
|
6 |
-
* @subpackage Admin/AJAX
|
7 |
-
* @copyright Copyright (c) 2014, Dev7studios
|
8 |
-
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License
|
9 |
-
* @since 2.2
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Admin AJAX Core Class
|
19 |
-
*
|
20 |
-
* @since 2.2
|
21 |
-
*/
|
22 |
-
class Dev7_Core_Admin_AJAX extends Dev7_Core {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Instance of Dev7 Images Core Class
|
26 |
-
*
|
27 |
-
* @var object
|
28 |
-
* @access private
|
29 |
-
* @since 2.2
|
30 |
-
*/
|
31 |
-
private $core_images;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Plugin options
|
35 |
-
*
|
36 |
-
* @var array
|
37 |
-
* @access private
|
38 |
-
* @since 2.2
|
39 |
-
*/
|
40 |
-
private $options;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* "construct" setting up ajax action hooks
|
44 |
-
*/
|
45 |
-
protected function core_init() {
|
46 |
-
$this->options = get_option( $this->labels->options_key );
|
47 |
-
$this->core_images = new Dev7_Core_Images( $this->labels, $this->is_lite );
|
48 |
-
|
49 |
-
add_action( 'wp_ajax_' . $this->labels->post_type . '_set_meta_link', array( $this, 'set_meta_link' ) );
|
50 |
-
add_action( 'wp_ajax_' . $this->labels->post_type . '_get_meta_link', array( $this, 'get_meta_link' ) );
|
51 |
-
add_action( 'wp_ajax_' . $this->labels->post_type . '_activate_license', array( $this, 'activate_license' ) );
|
52 |
-
add_action( 'wp_ajax_' . $this->labels->post_type . '_deactivate_license', array( $this, 'deactivate_license' ) );
|
53 |
-
add_action( 'wp_ajax_' . $this->labels->post_type . '_load_images', array( $this, 'load_images' ) );
|
54 |
-
add_action( 'wp_ajax_' . $this->labels->post_type . '_reattach_images', array( $this, 'reattach_images' ) );
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Sends to the media modal the link for an image
|
59 |
-
*
|
60 |
-
* @since 2.2
|
61 |
-
* @access public
|
62 |
-
* @return string
|
63 |
-
*/
|
64 |
-
public function get_meta_link() {
|
65 |
-
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], plugin_basename( $this->labels->post_type ) ) ) {
|
66 |
-
return 0;
|
67 |
-
}
|
68 |
-
|
69 |
-
if ( ! isset( $_POST['ids'] ) ) {
|
70 |
-
return 0;
|
71 |
-
}
|
72 |
-
|
73 |
-
$attachments = explode( ',', $_POST['ids'] );
|
74 |
-
|
75 |
-
$links = array();
|
76 |
-
if ( $attachments ) {
|
77 |
-
foreach ( $attachments as $attachment ) {
|
78 |
-
$link = get_post_meta( $attachment, '_wp_attachment_image_link', true );
|
79 |
-
if ( $link != '' ) {
|
80 |
-
$links[$attachment] = $link;
|
81 |
-
}
|
82 |
-
}
|
83 |
-
}
|
84 |
-
$response = array( 'metalink' => $links );
|
85 |
-
echo json_encode( $response );
|
86 |
-
die;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Saves the link for an image when entered in the media modal
|
91 |
-
*
|
92 |
-
* @since 2.2
|
93 |
-
* @access public
|
94 |
-
* @return string
|
95 |
-
*/
|
96 |
-
public function set_meta_link() {
|
97 |
-
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], plugin_basename( $this->labels->post_type ) ) ) {
|
98 |
-
return 0;
|
99 |
-
}
|
100 |
-
|
101 |
-
if ( ! isset( $_POST['id'] ) || ! isset( $_POST['metalink'] ) ) {
|
102 |
-
return 0;
|
103 |
-
}
|
104 |
-
|
105 |
-
$link = get_post_meta( $_POST['id'], '_wp_attachment_image_link', true );
|
106 |
-
$new_link = stripslashes( $_POST['metalink'] );
|
107 |
-
if ( $link != $new_link ) {
|
108 |
-
$new_link = wp_strip_all_tags( $new_link, true );
|
109 |
-
$result = update_post_meta( $_POST['id'], '_wp_attachment_image_link', addslashes( $new_link ) );
|
110 |
-
}
|
111 |
-
$response = array();
|
112 |
-
echo json_encode( $response );
|
113 |
-
die;
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Activates the plugin license with the Dev7studios EDD store
|
118 |
-
*
|
119 |
-
* @since 2.2
|
120 |
-
* @access public
|
121 |
-
* @return string
|
122 |
-
*/
|
123 |
-
public function activate_license() {
|
124 |
-
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], plugin_basename( $this->labels->post_type ) ) ) {
|
125 |
-
return 0;
|
126 |
-
}
|
127 |
-
|
128 |
-
if ( ! isset( $_POST['license_key'] ) ) {
|
129 |
-
return 0;
|
130 |
-
}
|
131 |
-
|
132 |
-
$ajax_response['error'] = false;
|
133 |
-
$ajax_response['message'] = '';
|
134 |
-
|
135 |
-
$options = $this->options;
|
136 |
-
$license = ( dev7_license_constant( $this->labels->post_type ) ) ? dev7_get_license_key( $this->labels->post_type, $options ) : trim( $_POST['license_key'] );
|
137 |
-
$options['license_key'] = $license;
|
138 |
-
|
139 |
-
$api_params = array(
|
140 |
-
'edd_action' => 'activate_license',
|
141 |
-
'license' => $license,
|
142 |
-
'item_name' => urlencode( $this->labels->dev7_item_name )
|
143 |
-
);
|
144 |
-
$response = wp_remote_get(
|
145 |
-
esc_url_raw( add_query_arg( $api_params, DEV7_STORE_URL ) ), array(
|
146 |
-
'timeout' => 15,
|
147 |
-
'sslverify' => false
|
148 |
-
)
|
149 |
-
);
|
150 |
-
if ( is_wp_error( $response ) ) {
|
151 |
-
$ajax_response['error'] = true;
|
152 |
-
$ajax_response['message'] = $response->get_error_message();
|
153 |
-
} else {
|
154 |
-
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
155 |
-
if ( isset( $license_data->license ) ) {
|
156 |
-
$options['license_status'] = $license_data->license;
|
157 |
-
$ajax_response['license_status'] = $license_data->license;
|
158 |
-
$ajax_response['redirect'] = admin_url( 'edit.php?post_type=' . $this->labels->post_type . '&page=' . $this->labels->post_type . '-settings' );
|
159 |
-
}
|
160 |
-
}
|
161 |
-
update_option( $this->labels->options_key, $options );
|
162 |
-
echo json_encode( $ajax_response );
|
163 |
-
die;
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Deactivates the plugin license with the Dev7studios EDD store
|
168 |
-
*
|
169 |
-
* @since 2.2
|
170 |
-
* @access public
|
171 |
-
* @return string
|
172 |
-
*/
|
173 |
-
public function deactivate_license() {
|
174 |
-
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], plugin_basename( $this->labels->post_type ) ) ) {
|
175 |
-
return 0;
|
176 |
-
}
|
177 |
-
|
178 |
-
$ajax_response['error'] = false;
|
179 |
-
$ajax_response['message'] = '';
|
180 |
-
|
181 |
-
$options = $this->options;
|
182 |
-
$license = trim( dev7_default_val( $options, 'license_key', '' ) );
|
183 |
-
|
184 |
-
$api_params = array(
|
185 |
-
'edd_action' => 'deactivate_license',
|
186 |
-
'license' => $license,
|
187 |
-
'item_name' => urlencode( $this->labels->dev7_item_name )
|
188 |
-
);
|
189 |
-
$response = wp_remote_get(
|
190 |
-
esc_url_raw( add_query_arg( $api_params, DEV7_STORE_URL ) ), array(
|
191 |
-
'timeout' => 15,
|
192 |
-
'sslverify' => false
|
193 |
-
)
|
194 |
-
);
|
195 |
-
if ( is_wp_error( $response ) ) {
|
196 |
-
$ajax_response['error'] = true;
|
197 |
-
$ajax_response['message'] = $response->get_error_message();
|
198 |
-
} else {
|
199 |
-
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
200 |
-
if ( isset( $license_data->license ) ) {
|
201 |
-
unset( $options['license_key'] );
|
202 |
-
unset( $options['license_status'] );
|
203 |
-
update_option( $this->labels->options_key, $options );
|
204 |
-
$ajax_response['license_status'] = 'deactivated';
|
205 |
-
$ajax_response['redirect'] = admin_url( 'edit.php?post_type=' . $this->labels->post_type . '&page=' . $this->labels->post_type . '-settings' );
|
206 |
-
}
|
207 |
-
}
|
208 |
-
echo json_encode( $ajax_response );
|
209 |
-
die;
|
210 |
-
}
|
211 |
-
|
212 |
-
/**
|
213 |
-
* Retrieves images associated with the [gallery]
|
214 |
-
*
|
215 |
-
* @since 2.2
|
216 |
-
* @access public
|
217 |
-
* @return string
|
218 |
-
*/
|
219 |
-
function load_images() {
|
220 |
-
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], $this->labels->post_type ) || ! isset( $_POST['source'] ) ) {
|
221 |
-
return 0;
|
222 |
-
}
|
223 |
-
|
224 |
-
$response['error'] = false;
|
225 |
-
$response['message'] = '';
|
226 |
-
$response['images'] = array();
|
227 |
-
|
228 |
-
$number_images = ( isset( $_POST['number_images'] ) && $_POST['number_images'] != '' ) ? $_POST['number_images'] : - 1;
|
229 |
-
|
230 |
-
$method = ( ( isset( $_POST['method'] ) && $_POST['method'] != '' ) ) ? $_POST['method'] : null;
|
231 |
-
$param = ( ( isset( $_POST['param'] ) && $_POST['param'] != '' ) ) ? $_POST['param'] : null;
|
232 |
-
$gallery = ( ( isset( $_POST['gallery'] ) && $_POST['gallery'] != '' ) ) ? $_POST['gallery'] : null;
|
233 |
-
$category = ( ( isset( $_POST['category'] ) && $_POST['category'] != '' ) ) ? $_POST['category'] : null;
|
234 |
-
$custom = ( ( isset( $_POST['custom'] ) && $_POST['custom'] != '' ) ) ? $_POST['custom'] : null;
|
235 |
-
$image_ids = ( ( isset( $_POST['image_ids'] ) && $_POST['image_ids'] != '' ) ) ? $_POST['image_ids'] : null;
|
236 |
-
|
237 |
-
$response['images'] = $this->core_images->get_images(
|
238 |
-
$_POST['id'],
|
239 |
-
'thumbnail',
|
240 |
-
$number_images,
|
241 |
-
$_POST['source'],
|
242 |
-
$method,
|
243 |
-
$param,
|
244 |
-
$gallery,
|
245 |
-
$category,
|
246 |
-
$custom,
|
247 |
-
$image_ids
|
248 |
-
);
|
249 |
-
|
250 |
-
echo json_encode( $response );
|
251 |
-
die;
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Reattaches images to a manual gallery when the manual image ids are not set
|
256 |
-
*
|
257 |
-
* @since 2.2
|
258 |
-
* @access public
|
259 |
-
* @return string
|
260 |
-
*/
|
261 |
-
public function reattach_images() {
|
262 |
-
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], plugin_basename( $this->labels->post_type ) ) ) {
|
263 |
-
return 0;
|
264 |
-
}
|
265 |
-
|
266 |
-
if ( ! isset( $_POST['post_id'] ) ) {
|
267 |
-
return 0;
|
268 |
-
}
|
269 |
-
|
270 |
-
$ajax_response['error'] = false;
|
271 |
-
$ajax_response['message'] = '';
|
272 |
-
|
273 |
-
$options = get_post_meta( $_POST['post_id'], $this->labels->post_meta_key, true );;
|
274 |
-
|
275 |
-
$images = dev7_get_attached_images( $_POST['post_id'], -1 );
|
276 |
-
|
277 |
-
if ( ! $images || count( $images ) == 0 ) {
|
278 |
-
$ajax_response['error'] = true;
|
279 |
-
$ajax_response['message'] = 'No images to attach';
|
280 |
-
} else {
|
281 |
-
$ids = wp_list_pluck( $images, 'ID' );
|
282 |
-
$manual_image_ids = implode( ',', $ids );
|
283 |
-
$options['manual_image_ids'] = $manual_image_ids;
|
284 |
-
$ajax_response['redirect'] = admin_url( 'edit.php?post_type=' . $this->labels->post_type );
|
285 |
-
update_post_meta( $_POST['post_id'], $this->labels->post_meta_key, $options );
|
286 |
-
}
|
287 |
-
|
288 |
-
echo json_encode( $ajax_response );
|
289 |
-
die;
|
290 |
-
}
|
291 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/includes/admin-edit.php
DELETED
@@ -1,513 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin Edit Class
|
4 |
-
*
|
5 |
-
* @package Plugin Core
|
6 |
-
* @subpackage Admin/Edit
|
7 |
-
* @copyright Copyright (c) 2014, Dev7studios
|
8 |
-
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License
|
9 |
-
* @since 2.2
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Admin Edit Core Class
|
19 |
-
*
|
20 |
-
* @since 2.2
|
21 |
-
*/
|
22 |
-
class Dev7_Core_Admin_Edit extends Dev7_Core {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Instance of Dev7 Images Core Class
|
26 |
-
*
|
27 |
-
* @var object
|
28 |
-
* @access private
|
29 |
-
* @since 2.2
|
30 |
-
*/
|
31 |
-
private $core_images;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* "construct" setting up the [gallery] edit screen
|
35 |
-
*/
|
36 |
-
protected function core_init() {
|
37 |
-
$this->core_images = new Dev7_Core_Images( $this->labels, $this->is_lite );
|
38 |
-
|
39 |
-
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
40 |
-
add_action( 'save_post', array( $this, 'save_post' ) );
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Adds meta boxes to the edit screen
|
45 |
-
*
|
46 |
-
* @since 2.2
|
47 |
-
* @access public
|
48 |
-
*/
|
49 |
-
public function admin_init() {
|
50 |
-
add_meta_box(
|
51 |
-
$this->labels->post_type . '_upload_box', sprintf( __( '%1$s Images', 'dev7core' ), $this->labels->singular ), array(
|
52 |
-
$this,
|
53 |
-
'meta_box_upload'
|
54 |
-
), $this->labels->post_type, 'normal'
|
55 |
-
);
|
56 |
-
add_meta_box(
|
57 |
-
$this->labels->post_type . '_settings_box', __( 'Settings', 'dev7core' ), array(
|
58 |
-
$this,
|
59 |
-
'meta_box_settings'
|
60 |
-
), $this->labels->post_type, 'normal'
|
61 |
-
);
|
62 |
-
add_meta_box(
|
63 |
-
$this->labels->post_type . '_shortcode_box', sprintf( __( 'Using this %1$s', 'dev7core' ), $this->labels->singular ), array(
|
64 |
-
$this,
|
65 |
-
'meta_box_shortcode'
|
66 |
-
), $this->labels->post_type, 'side'
|
67 |
-
);
|
68 |
-
add_meta_box(
|
69 |
-
$this->labels->post_type . '_usefullinks_box', __( 'Useful Links', 'dev7core' ), array(
|
70 |
-
$this,
|
71 |
-
'meta_box_usefullinks'
|
72 |
-
), $this->labels->post_type, 'side'
|
73 |
-
);
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Adds the Shortcode meta box to the edit screen
|
78 |
-
*
|
79 |
-
* @since 2.2
|
80 |
-
* @access public
|
81 |
-
*/
|
82 |
-
public function meta_box_shortcode() {
|
83 |
-
global $post;
|
84 |
-
echo '<p>' . sprintf( __( 'To use this %1$s in your posts or pages use the following shortcode:', 'dev7core' ), strtolower( $this->labels->singular ) ) . '</p>
|
85 |
-
<p><code>[' . $this->labels->shortcode . ' id="' . $post->ID . '"]</code>';
|
86 |
-
if ( $post->post_name != '' && $post->post_name <> $post->ID ) {
|
87 |
-
echo 'or</p><p><code>[' . $this->labels->shortcode . ' slug="' . $post->post_name . '"]</code>';
|
88 |
-
}
|
89 |
-
echo '</p>';
|
90 |
-
echo '<p>' . sprintf( __( 'To use this %1$s in a theme template file use the following code:', 'dev7core' ), strtolower( $this->labels->singular ) ) . '</p>
|
91 |
-
<p><code><?php ' . $this->labels->function . '( ' . $post->ID . ' ); ?></code>';
|
92 |
-
if ( $post->post_name != '' && $post->post_name <> $post->ID ) {
|
93 |
-
echo ' or</p><p><code><?php ' . $this->labels->function . '( "' . $post->post_name . '" ); ?></code>';
|
94 |
-
}
|
95 |
-
echo '</p>';
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Adds the Useful Links meta box to the edit screen
|
100 |
-
*
|
101 |
-
* @since 2.2
|
102 |
-
* @access public
|
103 |
-
*/
|
104 |
-
public function meta_box_usefullinks() {
|
105 |
-
echo '<div class="useful-links">';
|
106 |
-
echo '<p>' . __( 'Website:', 'dev7core' ) . ' <a href="' . DEV7_SITE_URL . '/products/' . $this->labels->slug . '/" target="_blank">' . $this->labels->plugin_name . '</a></p>';
|
107 |
-
echo '<p>' . __( 'Created by:', 'dev7core' ) . ' <a href="' . DEV7_SITE_URL . '" target="_blank">Dev7studios</a></p>';
|
108 |
-
if ( ! $this->is_lite ) {
|
109 |
-
echo '<p>' . __( 'Support:', 'dev7core' ) . ' <a href="' . DEV7_SITE_URL . '/support" target="_blank">Support</a></p>';
|
110 |
-
}
|
111 |
-
echo '<p>' . __( 'Documentation:', 'dev7core' ) . ' <a href="' . $this->get_documentation_link() . '" target="_blank">Documentation</a></p>';
|
112 |
-
echo '<p>' . __( 'Changelog:', 'dev7core' ) . ' <a href="' . $this->labels->plugin_url . 'changelog.txt" target="_blank">Changelog</a></p>';
|
113 |
-
echo '</div>';
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Get the documentation link
|
118 |
-
*
|
119 |
-
* @return string
|
120 |
-
*/
|
121 |
-
private function get_documentation_link() {
|
122 |
-
if ( isset( $this->labels->documentation ) && $this->labels->documentation ) {
|
123 |
-
return $this->labels->documentation;
|
124 |
-
}
|
125 |
-
|
126 |
-
return 'http://docs.themeisle.com';
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Adds the Image Upload meta box to the edit screen to configure the [gallery]
|
131 |
-
*
|
132 |
-
* @since 2.2
|
133 |
-
* @access public
|
134 |
-
*/
|
135 |
-
public function meta_box_upload() {
|
136 |
-
global $post;
|
137 |
-
$options = get_post_meta( $post->ID, $this->labels->post_meta_key, true );
|
138 |
-
?>
|
139 |
-
<a id="manual_images_upload" href="#" class="button">Configure</a>
|
140 |
-
<input type="hidden" id="_manual_image_ids" name="<?php echo $this->labels->post_meta_key; ?>[manual_image_ids]" value="<?php echo dev7_default_val( $options, 'manual_image_ids', '' ); ?>">
|
141 |
-
<ul id="<?php echo $this->labels->post_type; ?>-images" class="dev7plugin-images"></ul>
|
142 |
-
<?php
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Adds the [gallery] Settings meta box to the edit screen
|
147 |
-
*
|
148 |
-
* @since 2.2
|
149 |
-
* @access public
|
150 |
-
*/
|
151 |
-
public function meta_box_settings() {
|
152 |
-
global $post;
|
153 |
-
$options = get_post_meta( $post->ID, $this->labels->post_meta_key, true );
|
154 |
-
wp_nonce_field( plugin_basename( __FILE__ ), $this->labels->post_type . '_noncename' );
|
155 |
-
?>
|
156 |
-
<table id="<?php echo $this->labels->post_type; ?>-settings" class="form-table">
|
157 |
-
<tr valign="top">
|
158 |
-
<th scope="row"><?php echo sprintf( __( '%1$s Type', 'dev7-core' ), $this->labels->singular ) ?></th>
|
159 |
-
<td>
|
160 |
-
<select name="<?php echo $this->labels->post_meta_key; ?>[<?php echo $this->labels->source_name; ?>]">
|
161 |
-
<?php
|
162 |
-
$selected_source = dev7_default_val( $options, $this->labels->source_name, $this->core_images->image_source_default() );
|
163 |
-
$images_sources = $this->core_images->get_image_sources();
|
164 |
-
if ( $images_sources ) {
|
165 |
-
foreach ( $images_sources as $source => $value ) {
|
166 |
-
echo '<option value="' . $source . '"';
|
167 |
-
if ( $selected_source == $source ) {
|
168 |
-
echo ' selected="selected"';
|
169 |
-
}
|
170 |
-
echo '>' . __( $value, 'dev7core' ) . '</option>';
|
171 |
-
}
|
172 |
-
} else {
|
173 |
-
echo '<option value="none">' . __( 'No Sources', 'dev7core' ) . '</option>';
|
174 |
-
} ?>
|
175 |
-
</select>
|
176 |
-
<br>
|
177 |
-
<span class="manual description">
|
178 |
-
<?php _e( 'Choose to manually upload images or use images from the media library.', 'dev7core' ); ?>
|
179 |
-
<br>
|
180 |
-
<?php
|
181 |
-
if ( ! dev7_mmp_active() ) {
|
182 |
-
printf( __( 'You can add images from external sources and use them as feeds with our free plugin %1$s Media Manager Plus %2$s', 'dev7core' ), '<a href="' . admin_url( 'edit.php?post_type=' . $this->labels->post_type . '&page=' . $this->labels->post_type . '-install-plugins' ) . '">', '</a>' );
|
183 |
-
} else {
|
184 |
-
printf( __( 'Connect more sources using %1$s Media Manager Plus %2$s', 'dev7core' ), '<a href="' . admin_url( 'upload.php?page=uber-media' ) . '">', '</a>' );
|
185 |
-
}
|
186 |
-
?>
|
187 |
-
<br>
|
188 |
-
<?php do_action( $this->labels->post_type . '_manual_type_description' ); ?>
|
189 |
-
</span></td>
|
190 |
-
</tr>
|
191 |
-
<tr valign="top" id="dev7_type_gallery" class="dev7_type">
|
192 |
-
<th scope="row">- <?php _e( 'Gallery Location', 'dev7core' ); ?></th>
|
193 |
-
<td>
|
194 |
-
<select name="<?php echo $this->labels->post_meta_key; ?>[<?php echo $this->labels->type_name; ?>_gallery]">
|
195 |
-
<?php
|
196 |
-
$args = array(
|
197 |
-
'public' => true,
|
198 |
-
);
|
199 |
-
$post_types = get_post_types( $args, 'objects' );
|
200 |
-
foreach ( $post_types as $post_key => $post_type ) {
|
201 |
-
if ( $post_key == 'attachment' ) {
|
202 |
-
continue;
|
203 |
-
}
|
204 |
-
echo '<optgroup label="' . $post_type->labels->name . '">';
|
205 |
-
|
206 |
-
$posts = get_posts( array( 'numberposts' => - 1, 'post_type' => $post_key ) );
|
207 |
-
foreach ( $posts as $post_item ) {
|
208 |
-
echo '<option value="' . $post_item->ID . '"';
|
209 |
-
if ( dev7_default_val( $options, $this->labels->type_name . '_gallery' ) == $post_item->ID ) {
|
210 |
-
echo ' selected="selected"';
|
211 |
-
}
|
212 |
-
echo '>' . $post_item->post_title . '</option>';
|
213 |
-
}
|
214 |
-
echo ' </optgroup>';
|
215 |
-
}
|
216 |
-
?>
|
217 |
-
</select><br />
|
218 |
-
<span class="description"><?php _e( 'Select the post gallery you want to use', 'dev7core' ); ?></span>
|
219 |
-
</td>
|
220 |
-
</tr>
|
221 |
-
<tr valign="top" id="dev7_type_category" class="dev7_type">
|
222 |
-
<th scope="row">- <?php _e( 'Category', 'dev7core' ); ?></th>
|
223 |
-
<td>
|
224 |
-
<select name="<?php echo $this->labels->post_meta_key; ?>[<?php echo $this->labels->type_name; ?>_category]">
|
225 |
-
<?php
|
226 |
-
$categories = get_categories();
|
227 |
-
foreach ( $categories as $category ) {
|
228 |
-
echo '<option value="' . $category->cat_ID . '"';
|
229 |
-
if ( dev7_default_val( $options, $this->labels->type_name . '_category' ) == $category->cat_ID ) {
|
230 |
-
echo ' selected="selected"';
|
231 |
-
}
|
232 |
-
echo '>' . $category->name . '</option>';
|
233 |
-
}
|
234 |
-
?>
|
235 |
-
</select><br />
|
236 |
-
<span class="description"><?php _e( 'Select the category you want to use for post thumbnails', 'dev7core' ); ?></span>
|
237 |
-
</td>
|
238 |
-
</tr>
|
239 |
-
<tr valign="top" id="dev7_type_custom" class="dev7_type">
|
240 |
-
<th scope="row">- <?php _e( 'Custom Post Type', 'dev7core' ); ?></th>
|
241 |
-
<td>
|
242 |
-
<select name="<?php echo $this->labels->post_meta_key; ?>[<?php echo $this->labels->type_name; ?>_custom]">
|
243 |
-
<?php
|
244 |
-
$post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' );
|
245 |
-
foreach ( $post_types as $post_type ) {
|
246 |
-
echo '<option value="' . $post_type->name . '"';
|
247 |
-
if ( dev7_default_val( $options, $this->labels->type_name . '_custom' ) == $post_type->name ) {
|
248 |
-
echo ' selected="selected"';
|
249 |
-
}
|
250 |
-
echo '>' . $post_type->labels->name . '</option>';
|
251 |
-
}
|
252 |
-
?>
|
253 |
-
</select><br />
|
254 |
-
<span class="description"><?php _e( 'Select the custom post type you want to use for post thumbnails', 'dev7core' ); ?></span>
|
255 |
-
</td>
|
256 |
-
</tr>
|
257 |
-
<?php
|
258 |
-
// MMP settings for sources
|
259 |
-
$images_sources = $this->core_images->get_image_sources();
|
260 |
-
if ( $images_sources ) {
|
261 |
-
foreach ( $images_sources as $source => $value ) {
|
262 |
-
echo $this->get_image_source_details( $source, $selected_source );
|
263 |
-
}
|
264 |
-
}
|
265 |
-
// Plugin settings
|
266 |
-
$settings = apply_filters( $this->labels->post_type . '_admin_edit_settings', array() );
|
267 |
-
foreach ( $settings as $setting ) {
|
268 |
-
$setting = (object) $setting;
|
269 |
-
$class = '';
|
270 |
-
$class .= ( isset( $setting->tr_class ) ) ? $setting->tr_class . ' ' : '';
|
271 |
-
if ( isset( $setting->parent ) ) {
|
272 |
-
if ( ! is_array( $setting->parent ) ) {
|
273 |
-
$parents = array( $setting->parent );
|
274 |
-
} else {
|
275 |
-
$parents = $setting->parent;
|
276 |
-
}
|
277 |
-
|
278 |
-
foreach( $parents as $parent ) {
|
279 |
-
$class .= 'parent-' . $parent . ' ';
|
280 |
-
}
|
281 |
-
|
282 |
-
$class .= ( isset( $setting->visible ) ) ? ' ' . $setting->visible . ' ' : '';
|
283 |
-
}
|
284 |
-
$id = ( isset( $setting->id ) ) ? $setting->id : '';
|
285 |
-
?>
|
286 |
-
<tr valign="top" id="<?php echo $id; ?>" class="<?php echo $class; ?>">
|
287 |
-
<th scope="row"><?php echo ( isset( $setting->sub ) && $setting->sub ) ? '- ' : ''; ?><?php echo $setting->title; ?></th>
|
288 |
-
<td>
|
289 |
-
<?php
|
290 |
-
|
291 |
-
if ( ! is_array( $setting->name ) ) {
|
292 |
-
$setting->name = array( $setting->name );
|
293 |
-
}
|
294 |
-
foreach ( $setting->name as $setting_key => $setting_name ) {
|
295 |
-
|
296 |
-
$setting->default = ( isset( $setting->default ) ) ? $setting->default : '';
|
297 |
-
if ( ! is_array( $setting->default ) ) {
|
298 |
-
$setting->default = array( $setting->default );
|
299 |
-
}
|
300 |
-
|
301 |
-
$element_id = $setting_name;
|
302 |
-
$element_name = $this->labels->post_meta_key . '[' . $setting_name . ']';
|
303 |
-
$element_default = ( isset( $setting->default[$setting_key] ) ) ? $setting->default[$setting_key] : $setting->default[0];
|
304 |
-
$element_value = dev7_default_val( $options, $setting_name, $element_default );
|
305 |
-
$element_class = '';
|
306 |
-
$element_class .= ( isset( $setting->reload ) ) ? 'reload' : '';
|
307 |
-
|
308 |
-
if ( isset( $setting->pre_element ) && $setting->pre_element != '' ) {
|
309 |
-
echo $setting->pre_element;
|
310 |
-
}
|
311 |
-
switch ( $setting->type ) {
|
312 |
-
|
313 |
-
case 'text':
|
314 |
-
?>
|
315 |
-
<input type="text" name="<?php echo $element_name; ?>" value="<?php echo $element_value; ?>" class="<?php echo $element_class; ?>" />
|
316 |
-
<?php
|
317 |
-
break;
|
318 |
-
|
319 |
-
case 'number':
|
320 |
-
?>
|
321 |
-
<input type="number" name="<?php echo $element_name; ?>" value="<?php echo $element_value; ?>" class="<?php echo $element_class; ?>" />
|
322 |
-
<?php
|
323 |
-
break;
|
324 |
-
|
325 |
-
case 'textarea':
|
326 |
-
$rows = ( isset( $setting->rows ) ) ? $setting->rows : 20;
|
327 |
-
$cols = ( isset( $setting->cols ) ) ? $setting->cols : 80;
|
328 |
-
|
329 |
-
?>
|
330 |
-
<textarea class="<?php echo $element_class; ?>" name="<?php echo $element_name; ?>" rows="<?php echo $rows; ?>" cols="<?php echo $cols; ?>"><?php echo $element_value; ?></textarea>
|
331 |
-
<?php
|
332 |
-
break;
|
333 |
-
|
334 |
-
case 'checkbox':
|
335 |
-
?>
|
336 |
-
<input type="hidden" name="<?php echo $element_name; ?>" value="off" />
|
337 |
-
<input id="<?php echo $element_id; ?>" type="checkbox" name="<?php echo $element_name; ?>" value="on"<?php if ( $element_value == 'on' ) {
|
338 |
-
echo ' checked="checked"';
|
339 |
-
} ?>/>
|
340 |
-
<?php
|
341 |
-
break;
|
342 |
-
|
343 |
-
case 'select':
|
344 |
-
?>
|
345 |
-
<select id="<?php echo $element_id; ?>" name="<?php echo $element_name; ?>" class="<?php echo $element_class; ?>">
|
346 |
-
<?php
|
347 |
-
foreach ( $setting->options as $value => $name ) {
|
348 |
-
?>
|
349 |
-
<option value="<?php echo $value; ?>"<?php if ( $value == $element_value ) {
|
350 |
-
echo ' selected="selected"';
|
351 |
-
} ?>><?php echo $name; ?></option>
|
352 |
-
<?php } ?>
|
353 |
-
</select>
|
354 |
-
<?php
|
355 |
-
break;
|
356 |
-
|
357 |
-
case 'custom':
|
358 |
-
echo isset($setting->custom) ? $setting->custom : '';
|
359 |
-
break;
|
360 |
-
|
361 |
-
}
|
362 |
-
|
363 |
-
if ( isset( $setting->connect ) && ( $setting_key + 1 ) < count( $setting->name ) ) {
|
364 |
-
echo $setting->connect;
|
365 |
-
}
|
366 |
-
|
367 |
-
if ( isset( $setting->post_element ) && $setting->post_element != '' ) {
|
368 |
-
echo $setting->post_element;
|
369 |
-
}
|
370 |
-
|
371 |
-
if ( ( $setting_key + 1 ) == count( $setting->name ) && $setting->type != 'checkbox' ) {
|
372 |
-
echo '<br>';
|
373 |
-
}
|
374 |
-
}
|
375 |
-
|
376 |
-
|
377 |
-
if ( isset( $setting->descp ) && $setting->descp != '' ) {
|
378 |
-
?>
|
379 |
-
<span class="description"><?php echo $setting->descp; ?></span>
|
380 |
-
<?php
|
381 |
-
}
|
382 |
-
|
383 |
-
if ( isset( $setting->post_descp ) && $setting->post_descp != '' ) {
|
384 |
-
echo $setting->post_descp;
|
385 |
-
}
|
386 |
-
?>
|
387 |
-
</td>
|
388 |
-
</tr>
|
389 |
-
<?php
|
390 |
-
}
|
391 |
-
?>
|
392 |
-
</table>
|
393 |
-
<?php
|
394 |
-
}
|
395 |
-
|
396 |
-
/**
|
397 |
-
* Amend the settings of the [gallery] post before saving
|
398 |
-
*
|
399 |
-
* @since 2.2
|
400 |
-
*
|
401 |
-
* @param int $post_id Post ID
|
402 |
-
*
|
403 |
-
* @access public
|
404 |
-
*/
|
405 |
-
public function save_post( $post_id ) {
|
406 |
-
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
407 |
-
return;
|
408 |
-
}
|
409 |
-
|
410 |
-
if ( ! isset( $_POST[$this->labels->post_type . '_noncename'] ) || ! wp_verify_nonce( $_POST[$this->labels->post_type . '_noncename'], plugin_basename( __FILE__ ) ) ) {
|
411 |
-
return;
|
412 |
-
}
|
413 |
-
|
414 |
-
// Check permissions
|
415 |
-
if ( 'page' == $_POST['post_type'] ) {
|
416 |
-
if ( ! current_user_can( 'edit_page', $post_id ) ) {
|
417 |
-
return;
|
418 |
-
}
|
419 |
-
} else {
|
420 |
-
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
421 |
-
return;
|
422 |
-
}
|
423 |
-
}
|
424 |
-
|
425 |
-
// Good to go
|
426 |
-
$settings = $_POST[$this->labels->post_meta_key];
|
427 |
-
$settings = apply_filters( $this->labels->post_type . '_post_meta_save', $settings );
|
428 |
-
|
429 |
-
update_post_meta( $post_id, $this->labels->post_meta_key, $settings );
|
430 |
-
}
|
431 |
-
|
432 |
-
/**
|
433 |
-
* Amend the settings of the [gallery] post before saving
|
434 |
-
*
|
435 |
-
* @since 2.2
|
436 |
-
*
|
437 |
-
* @param string $image_source Source of the [gallery] images
|
438 |
-
* @param string $selected_source Selected source of the [gallery] images
|
439 |
-
*
|
440 |
-
* @access public
|
441 |
-
* @return string $html HTML output
|
442 |
-
*/
|
443 |
-
public function get_image_source_details( $image_source, $selected_source ) {
|
444 |
-
if ( ! dev7_mmp_active() ) {
|
445 |
-
return;
|
446 |
-
}
|
447 |
-
|
448 |
-
$defaults = $this->core_images->image_sources_defaults();
|
449 |
-
if ( ! array_key_exists( $image_source, $defaults ) ) {
|
450 |
-
|
451 |
-
$var = 'media_manager_plus_source_' . $image_source;
|
452 |
-
$obj = new $var();
|
453 |
-
$settings = $obj->show_details();
|
454 |
-
|
455 |
-
global $post;
|
456 |
-
$options = get_post_meta( $post->ID, $this->labels->post_meta_key, true );
|
457 |
-
|
458 |
-
$display = ( $image_source != $selected_source ) ? 'style="display: none;"' : '';
|
459 |
-
$header = '<tr valign="top" id="dev7_type_' . $image_source . '" class="dev7_type image_source" ' . $display . '>';
|
460 |
-
$header .= '<th scope="row"> ' . ucfirst( $image_source ) . ' settings</th>';
|
461 |
-
$header .= '<td>';
|
462 |
-
$body = '<label>';
|
463 |
-
$body .= ' <select name="' . $this->labels->post_meta_key . '[' . $image_source . '_type]" class="image_source_type" >';
|
464 |
-
foreach ( $settings as $method => $value ) {
|
465 |
-
$selected = ( dev7_default_val( $options, $image_source . '_type', '' ) ) == $method ? 'selected="selected"' : '';
|
466 |
-
$body .= '<option ' . $selected . ' value="' . $method . '">' . $value['name'] . '</option>';
|
467 |
-
}
|
468 |
-
$body .= ' </select><br>';
|
469 |
-
$body .= ' <span class="description">Choose the type of images from ' . ucfirst( $image_source ) . ' </span>';
|
470 |
-
$body .= '</label>';
|
471 |
-
|
472 |
-
foreach ( $settings as $method => $value ) {
|
473 |
-
if ( isset( $value['param_type'] ) ) {
|
474 |
-
$body .= '<div id="' . $image_source . '_param_' . $method . '" class="image_source_param">';
|
475 |
-
if ( $value['param_type'] == 'text' ) {
|
476 |
-
$body .= '<br><input id="' . $image_source . '_' . $method . '" type="text" value="' . dev7_default_val( $options, $image_source . '_' . $method, '' ) . '" name="' . $this->labels->post_meta_key . '[' . $image_source . '_' . $method . ']">';
|
477 |
-
}
|
478 |
-
|
479 |
-
if ( $value['param_type'] == 'select' ) {
|
480 |
-
|
481 |
-
if ( $value['param_dynamic'] ) {
|
482 |
-
$mmp_options = get_option( 'ubermediasettings_settings', array() );
|
483 |
-
$mmp_sources = dev7_default_val( $mmp_options, 'ubermediasettings_sources_available', array() );
|
484 |
-
|
485 |
-
$source_settings = $mmp_sources[$image_source . '-settings'];
|
486 |
-
$access_token = $source_settings['access-token'];
|
487 |
-
|
488 |
-
$param_obj = new $var( $access_token['oauth_token'], $access_token['oauth_token_secret'] );
|
489 |
-
$param_choices = $param_obj->get_param_choices( $method );
|
490 |
-
|
491 |
-
} else {
|
492 |
-
$param_choices = $value['param_choices'];
|
493 |
-
}
|
494 |
-
|
495 |
-
$body .= ' <select id="' . $image_source . '_' . $method . '" name="' . $this->labels->post_meta_key . '[' . $image_source . '_' . $method . ']">';
|
496 |
-
foreach ( $param_choices as $choice_key => $choice_value ) {
|
497 |
-
$selected = ( dev7_default_val( $options, $image_source . '_' . $method, '' ) ) == $choice_key ? 'selected="selected"' : '';
|
498 |
-
$body .= '<option ' . $selected . ' value="' . $choice_key . '">' . $choice_value . '</option>';
|
499 |
-
}
|
500 |
-
$body .= ' </select>';
|
501 |
-
}
|
502 |
-
|
503 |
-
$body .= ( isset( $value['param_desc'] ) ) ? ' <span class="description">' . $value['param_desc'] . '</span>' : '';
|
504 |
-
$body .= '</div>';
|
505 |
-
}
|
506 |
-
}
|
507 |
-
$footer = '</td></tr>';
|
508 |
-
$html = $header . $body . $footer;
|
509 |
-
|
510 |
-
return $html;
|
511 |
-
}
|
512 |
-
}
|
513 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/includes/admin-settings.php
DELETED
@@ -1,382 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin Settings Class
|
4 |
-
*
|
5 |
-
* @package Plugin Core
|
6 |
-
* @subpackage Admin/Settings
|
7 |
-
* @copyright Copyright (c) 2014, Dev7studios
|
8 |
-
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License
|
9 |
-
* @since 2.2
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Admin Settings Core Class
|
19 |
-
*
|
20 |
-
* @since 2.2
|
21 |
-
*/
|
22 |
-
class Dev7_Core_Admin_Settings extends Dev7_Core {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Plugin options
|
26 |
-
*
|
27 |
-
* @var array
|
28 |
-
* @access private
|
29 |
-
* @since 2.2
|
30 |
-
*/
|
31 |
-
private $options;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* "construct" for the [gallery] settings page
|
35 |
-
*/
|
36 |
-
protected function core_init() {
|
37 |
-
$this->options = get_option( $this->labels->options_key );
|
38 |
-
|
39 |
-
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
40 |
-
add_action( 'admin_menu', array( $this, 'remove_admin_menu' ) );
|
41 |
-
add_action( 'admin_init', array( $this, 'register_settings' ) );
|
42 |
-
add_action( 'after_plugin_row_' . $this->labels->plugin_basename, array( $this, 'plugin_row' ), 11 );
|
43 |
-
add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Adds a new menu item under the plugin post type
|
48 |
-
*
|
49 |
-
* @since 2.2
|
50 |
-
* @access public
|
51 |
-
*/
|
52 |
-
public function admin_menu() {
|
53 |
-
add_submenu_page(
|
54 |
-
'edit.php?post_type=' . $this->labels->post_type, 'Settings', 'Settings', 'manage_options', $this->labels->post_type . '-settings', array(
|
55 |
-
$this,
|
56 |
-
'settings_page'
|
57 |
-
)
|
58 |
-
);
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Controls the visibility of the plugin menu. Can be filtered.
|
63 |
-
*
|
64 |
-
* @since 2.2
|
65 |
-
* @access public
|
66 |
-
*/
|
67 |
-
public function remove_admin_menu() {
|
68 |
-
$options = $this->options;
|
69 |
-
if ( isset( $options['custom-roles'] ) ) {
|
70 |
-
$custom_roles = $options['custom-roles'];
|
71 |
-
if ( $custom_roles ) {
|
72 |
-
$allowed_roles = apply_filters( $this->labels->post_type . '_allowed_roles', $custom_roles );
|
73 |
-
global $current_user;
|
74 |
-
$user_roles = $current_user->roles;
|
75 |
-
$show = false;
|
76 |
-
foreach ( $allowed_roles as $role ) {
|
77 |
-
if ( in_array( $role, $user_roles ) ) {
|
78 |
-
$show = true;
|
79 |
-
}
|
80 |
-
}
|
81 |
-
if ( ! $show ) {
|
82 |
-
remove_menu_page( 'edit.php?post_type=' . $this->labels->post_type );
|
83 |
-
}
|
84 |
-
}
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Renders the settings page for the plugin
|
90 |
-
*
|
91 |
-
* @since 2.2
|
92 |
-
* @access public
|
93 |
-
*/
|
94 |
-
public function settings_page() {
|
95 |
-
?>
|
96 |
-
<div id="<?php echo $this->labels->post_type; ?>-wrap" class="wrap">
|
97 |
-
<div id="icon-options-general" class="icon32"></div>
|
98 |
-
<h2><?php echo apply_filters( $this->labels->post_type . '_settings_page_header', 'Settings' ); ?></h2>
|
99 |
-
|
100 |
-
<form action="options.php" method="post">
|
101 |
-
<?php settings_fields( $this->labels->post_type . '-settings' ); ?>
|
102 |
-
<?php do_settings_sections( $this->labels->post_type . '-settings' ); ?>
|
103 |
-
<p class="submit">
|
104 |
-
<input type="submit" name="submit" id="submit" class="button-primary" value="<?php _e( 'Save Changes', 'dev7-core' ); ?>">
|
105 |
-
</p>
|
106 |
-
</form>
|
107 |
-
</div>
|
108 |
-
<?php
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Registers the settings and sections
|
113 |
-
*
|
114 |
-
* @since 2.2
|
115 |
-
* @access public
|
116 |
-
*/
|
117 |
-
public function register_settings() {
|
118 |
-
register_setting(
|
119 |
-
$this->labels->post_type . '-settings', $this->labels->options_key, array(
|
120 |
-
$this,
|
121 |
-
'settings_validate'
|
122 |
-
)
|
123 |
-
);
|
124 |
-
add_settings_section(
|
125 |
-
$this->labels->post_type . '-settings', '', array(
|
126 |
-
$this,
|
127 |
-
'display_settings_intro'
|
128 |
-
), $this->labels->post_type . '-settings'
|
129 |
-
);
|
130 |
-
|
131 |
-
$settings[] = array( 'slug' => 'license-settings', 'title' => __( 'License', 'dev7-core' ) );
|
132 |
-
$settings[] = array( 'slug' => 'custom-roles', 'title' => __( 'Management Roles', 'dev7-core' ) );
|
133 |
-
|
134 |
-
$settings = apply_filters( $this->labels->post_type . '_register_settings', $settings );
|
135 |
-
|
136 |
-
foreach ( $settings as $setting ) {
|
137 |
-
$scope = ( isset( $setting['scope'] ) ) ? $setting['scope'] : $this;
|
138 |
-
$function = 'setting_' . str_replace( '-', '_', $setting['slug'] );
|
139 |
-
add_settings_field(
|
140 |
-
$setting['slug'], $setting['title'], array(
|
141 |
-
$scope,
|
142 |
-
$function
|
143 |
-
), $this->labels->post_type . '-settings', $this->labels->post_type . '-settings'
|
144 |
-
);
|
145 |
-
}
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Settings helper to render HTML settings
|
150 |
-
*
|
151 |
-
* @since 2.2
|
152 |
-
* @access public
|
153 |
-
*
|
154 |
-
* @param array $args settings array
|
155 |
-
*/
|
156 |
-
public function settings_helper( $args ) {
|
157 |
-
$element_name = $this->labels->options_key . '[' . $args['name'] . ']';
|
158 |
-
$element_default = ( isset( $args['default'] ) ) ? $args['default'] : '';
|
159 |
-
$element_value = dev7_default_val( $this->options, $args['name'], $element_default );
|
160 |
-
$element_class = ( isset( $args['class'] ) ) ? $args['class'] : '';
|
161 |
-
switch ( $args['type'] ) {
|
162 |
-
|
163 |
-
case 'text':
|
164 |
-
?>
|
165 |
-
<input type="text" name="<?php echo $element_name; ?>" value="<?php echo $element_value; ?>" class="<?php echo $element_class; ?> " />
|
166 |
-
<?php
|
167 |
-
break;
|
168 |
-
|
169 |
-
case 'textarea':
|
170 |
-
$rows = ( isset( $args['rows'] ) ) ? $args['rows'] : 5;
|
171 |
-
$cols = ( isset( $args['cols'] ) ) ? $args['cols'] : 80;
|
172 |
-
|
173 |
-
?>
|
174 |
-
<textarea class="<?php echo $element_class; ?>" name="<?php echo $element_name; ?>" rows="<?php echo $rows; ?>" cols="<?php echo $cols; ?>"><?php echo $element_value; ?></textarea>
|
175 |
-
<?php
|
176 |
-
break;
|
177 |
-
|
178 |
-
case 'number':
|
179 |
-
?>
|
180 |
-
<input type="number" name="<?php echo $element_name; ?>" value="<?php echo $element_value; ?>" class="<?php echo $element_class; ?> " />
|
181 |
-
<?php
|
182 |
-
break;
|
183 |
-
|
184 |
-
case 'checkbox':
|
185 |
-
?>
|
186 |
-
<input type="hidden" name="<?php echo $element_name; ?>" value="off" />
|
187 |
-
<input type="checkbox" name="<?php echo $element_name; ?>" value="on"<?php if ( $element_value == 'on' ) {
|
188 |
-
echo ' checked="checked"';
|
189 |
-
} ?> class="<?php echo $element_class; ?> " />
|
190 |
-
<?php
|
191 |
-
break;
|
192 |
-
|
193 |
-
case 'select':
|
194 |
-
?>
|
195 |
-
<select name="<?php echo $element_name; ?>" class="<?php echo $element_class; ?> ">
|
196 |
-
<?php
|
197 |
-
foreach ( $args['options'] as $value => $name ) {
|
198 |
-
?>
|
199 |
-
<option value="<?php echo $value; ?>"<?php if ( $value == $element_value ) {
|
200 |
-
echo ' selected="selected"';
|
201 |
-
} ?>><?php echo $name; ?></option>
|
202 |
-
<?php } ?>
|
203 |
-
</select>
|
204 |
-
<?php
|
205 |
-
break;
|
206 |
-
}
|
207 |
-
if ( isset( $args['descp'] ) && $args['descp'] != '' ) {
|
208 |
-
?>
|
209 |
-
<span class="description"><?php echo $args['descp']; ?></span>
|
210 |
-
<?php
|
211 |
-
}
|
212 |
-
}
|
213 |
-
|
214 |
-
/**
|
215 |
-
* Displays the introduction on the settings page
|
216 |
-
*
|
217 |
-
* @since 2.2
|
218 |
-
* @access public
|
219 |
-
*/
|
220 |
-
public function display_settings_intro() {
|
221 |
-
echo apply_filters( $this->labels->post_type . '_settings_intro', '' );
|
222 |
-
}
|
223 |
-
|
224 |
-
/**
|
225 |
-
* Validation of settings on save.
|
226 |
-
*
|
227 |
-
* @since 2.2
|
228 |
-
* @access public
|
229 |
-
*/
|
230 |
-
public function settings_validate( $input ) {
|
231 |
-
$options = $this->options;
|
232 |
-
if ( $options && is_array( $options ) ) {
|
233 |
-
foreach ( $options as $key => $option ) {
|
234 |
-
if ( ! array_key_exists( $key, $input ) && $key != 'license_status' && $key != 'license_key' ) {
|
235 |
-
$input[$key] = $option;
|
236 |
-
}
|
237 |
-
}
|
238 |
-
}
|
239 |
-
$input = $this->save_custom_roles( $input );
|
240 |
-
|
241 |
-
return apply_filters( $this->labels->post_type . '_settings_validate', $input );
|
242 |
-
}
|
243 |
-
|
244 |
-
/**
|
245 |
-
* Renders setting for custom roles
|
246 |
-
*
|
247 |
-
* @since 2.2
|
248 |
-
* @access public
|
249 |
-
*/
|
250 |
-
public function setting_custom_roles() {
|
251 |
-
$options = $this->options;
|
252 |
-
global $wp_roles;
|
253 |
-
$role_names = $wp_roles->get_names();
|
254 |
-
if ( ! isset( $options['custom-roles'] ) ) {
|
255 |
-
$defaults = array();
|
256 |
-
foreach ( $role_names as $key => $value ) {
|
257 |
-
if ( $key != 'administrator' ) {
|
258 |
-
$defaults[] = $key;
|
259 |
-
}
|
260 |
-
}
|
261 |
-
$options['custom-roles'] = $defaults;
|
262 |
-
}
|
263 |
-
$roles = array();
|
264 |
-
foreach ( $role_names as $key => $value ) {
|
265 |
-
if ( $key != 'administrator' ) {
|
266 |
-
$roles[$key] = get_role( $key );
|
267 |
-
$roles[$key]->display_name = $value;
|
268 |
-
if ( in_array( $roles[$key]->name, $options['custom-roles'] ) ) {
|
269 |
-
$roles[$key]->selected = true;
|
270 |
-
}
|
271 |
-
}
|
272 |
-
}
|
273 |
-
echo '<input type="hidden" name="' . $this->labels->options_key . '[roles]" value="roles">';
|
274 |
-
foreach ( $roles as $role ):
|
275 |
-
echo '<input type="checkbox" id="' . $role->name . '" name="' . $this->labels->options_key . '[' . $role->name . ']" ' . ( isset( $role->selected ) && ( $role->selected ) ? ' checked="checked"' : '' ) . '/> ';
|
276 |
-
echo $role->display_name . '<br/>';
|
277 |
-
endforeach;
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* Custom save method for saving custom roles
|
282 |
-
*
|
283 |
-
* @since 2.2
|
284 |
-
* @access private
|
285 |
-
*/
|
286 |
-
private function save_custom_roles( $input ) {
|
287 |
-
if ( $input && is_array( $input ) && isset( $input['roles'] ) ) {
|
288 |
-
$custom_roles = array();
|
289 |
-
global $wp_roles;
|
290 |
-
$role_names = $wp_roles->get_names();
|
291 |
-
$roles = array();
|
292 |
-
foreach ( $role_names as $key => $value ) {
|
293 |
-
if ( $key != 'administrator' ) {
|
294 |
-
$roles[$key] = get_role( $key );
|
295 |
-
$roles[$key]->display_name = $value;
|
296 |
-
}
|
297 |
-
}
|
298 |
-
foreach ( $input as $key => $value ) {
|
299 |
-
if ( array_key_exists( $key, $roles ) ) {
|
300 |
-
$custom_roles[] = $key;
|
301 |
-
unset( $input[$key] );
|
302 |
-
}
|
303 |
-
}
|
304 |
-
unset( $input['roles'] );
|
305 |
-
$custom_roles[] = 'administrator';
|
306 |
-
$input['custom-roles'] = $custom_roles;
|
307 |
-
}
|
308 |
-
|
309 |
-
return $input;
|
310 |
-
}
|
311 |
-
|
312 |
-
/**
|
313 |
-
* Renders setting for license
|
314 |
-
*
|
315 |
-
* @since 2.2
|
316 |
-
* @access public
|
317 |
-
*/
|
318 |
-
public function setting_license_settings() {
|
319 |
-
$license_key = dev7_get_license_key( $this->labels->post_type, $this->options );
|
320 |
-
$status = dev7_default_val( $this->options, 'license_status', false );
|
321 |
-
echo '<div id="dev7license">';
|
322 |
-
echo '<input type="hidden" name="' . $this->labels->options_key . '[license_status]" value="' . $status . '">';
|
323 |
-
if ( $status !== false && $status == 'valid' ) {
|
324 |
-
echo '<input type="hidden" name="' . $this->labels->options_key . '[license_key]" value="' . $license_key . '">';
|
325 |
-
echo '<span style="color:green;">' . __( 'Active: ', 'dev7-core' ) . '</span>';
|
326 |
-
echo '<span class="regular-text">' . $license_key . '</span><br> ';
|
327 |
-
echo '<input id="deactivate-license" type="button" class="button-secondary" value="' . __( 'Deactivate License', 'dev7-core' ) . '"/>';
|
328 |
-
} else {
|
329 |
-
if ( dev7_license_constant( $this->labels->post_type ) ) {
|
330 |
-
echo '<input type="hidden" name="' . $this->labels->options_key . '[license_key]" value="' . $license_key . '">';
|
331 |
-
echo '<span class="regular-text">' . $license_key . '</span><br> ';
|
332 |
-
echo '<label class="description">' . __( 'Activate this license key to enable automatic upgrades', 'dev7-core' ) . '</label><br>';
|
333 |
-
} else {
|
334 |
-
echo '<input type="text" name="' . $this->labels->options_key . '[license_key]" class="regular-text" value="' . $license_key . '"><br> ';
|
335 |
-
echo '<label class="description">' . __( 'Enter a valid license key to enable automatic upgrades', 'dev7-core' ) . '</label><br>';
|
336 |
-
}
|
337 |
-
echo '<input id="activate-license" type="button" class="button-primary" value="' . __( 'Activate License', 'dev7-core' ) . '"/>';
|
338 |
-
}
|
339 |
-
echo '<span class="spinner"></span></div>';
|
340 |
-
}
|
341 |
-
|
342 |
-
/**
|
343 |
-
* Displays a custom message about license activation in the plugin table list
|
344 |
-
*
|
345 |
-
* @since 2.2
|
346 |
-
* @access public
|
347 |
-
*/
|
348 |
-
public function plugin_row() {
|
349 |
-
$license_key = dev7_get_license_key( $this->labels->post_type, $this->options );
|
350 |
-
$status = dev7_default_val( $this->options, 'license_status', 'invalid' );
|
351 |
-
if ( ( empty( $license_key ) || $license_key == '' ) || $status == 'invalid' ) {
|
352 |
-
$settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=' . $this->labels->post_type . '&page=' . $this->labels->post_type . '-settings' ), __( 'Settings', 'dev7-core' ) );
|
353 |
-
$message = 'To finish activating ' . $this->labels->plugin_name . ', please go to ' . $settings_link . ' and enter your license key and activate it to enable automatic updates.';
|
354 |
-
} else {
|
355 |
-
return;
|
356 |
-
}
|
357 |
-
?>
|
358 |
-
<tr class="plugin-update-tr dev7-custom">
|
359 |
-
<td colspan="3" class="plugin-update">
|
360 |
-
<div class="update-message">
|
361 |
-
<?php echo $message; ?>
|
362 |
-
</div>
|
363 |
-
</td>
|
364 |
-
</tr>
|
365 |
-
<?php
|
366 |
-
}
|
367 |
-
|
368 |
-
/**
|
369 |
-
* Adds a new link to the plugin settings on the plugin table list
|
370 |
-
*
|
371 |
-
* @since 2.2
|
372 |
-
* @access public
|
373 |
-
*/
|
374 |
-
public function plugin_action_links( $links, $file ) {
|
375 |
-
if ( $file == $this->labels->plugin_basename ) {
|
376 |
-
$settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=' . $this->labels->post_type . '&page=' . $this->labels->post_type . '-settings' ), __( 'Settings', 'dev7-core' ) );
|
377 |
-
array_unshift( $links, $settings_link );
|
378 |
-
}
|
379 |
-
|
380 |
-
return $links;
|
381 |
-
}
|
382 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/includes/admin-view.php
DELETED
@@ -1,138 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin View Class
|
4 |
-
*
|
5 |
-
* @package Plugin Core
|
6 |
-
* @subpackage Admin/View
|
7 |
-
* @copyright Copyright (c) 2014, Dev7studios
|
8 |
-
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License
|
9 |
-
* @since 2.2
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Admin View Core Class
|
19 |
-
*
|
20 |
-
* @since 2.2
|
21 |
-
*/
|
22 |
-
class Dev7_Core_Admin_View extends Dev7_Core {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Instance of Dev7 Images Core Class
|
26 |
-
*
|
27 |
-
* @var object
|
28 |
-
* @access private
|
29 |
-
* @since 2.2
|
30 |
-
*/
|
31 |
-
private $core_images;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* "construct" for the [gallery] list page
|
35 |
-
*/
|
36 |
-
protected function core_init() {
|
37 |
-
$this->core_images = new Dev7_Core_Images( $this->labels, $this->is_lite );
|
38 |
-
|
39 |
-
add_action( 'manage_edit-' . $this->labels->post_type . '_columns', array( $this, 'edit_columns' ) );
|
40 |
-
add_action( 'manage_' . $this->labels->post_type . '_posts_custom_column', array( $this, 'custom_columns' ) );
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Adds the custom columns to the post type admin index screen
|
45 |
-
*
|
46 |
-
* @since 2.2
|
47 |
-
* @access public
|
48 |
-
*
|
49 |
-
* @param array $columns
|
50 |
-
*
|
51 |
-
* @return array $columns
|
52 |
-
*/
|
53 |
-
public function edit_columns( $columns ) {
|
54 |
-
$columns = array(
|
55 |
-
'cb' => '<input type="checkbox" />',
|
56 |
-
'title' => __( 'Title', 'dev7core' ),
|
57 |
-
'shortcode' => __( 'Shortcode', 'dev7core' ),
|
58 |
-
'type' => __( 'Type', 'dev7core' ),
|
59 |
-
'images' => __( 'Images', 'dev7core' ),
|
60 |
-
'author' => __( 'Author', 'dev7core' ),
|
61 |
-
'date' => __( 'Date', 'dev7core' )
|
62 |
-
);
|
63 |
-
|
64 |
-
return apply_filters( 'dev7_edit_columns', $columns );
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Populates the data in the custom columns
|
69 |
-
*
|
70 |
-
* @since 2.2
|
71 |
-
* @access public
|
72 |
-
*
|
73 |
-
* @param $column
|
74 |
-
*/
|
75 |
-
public function custom_columns( $column ) {
|
76 |
-
global $post;
|
77 |
-
|
78 |
-
if ( $post->post_type != $this->labels->post_type ) {
|
79 |
-
return;
|
80 |
-
}
|
81 |
-
$options = get_post_meta( $post->ID, $this->labels->post_meta_key, true );
|
82 |
-
|
83 |
-
do_action( $this->labels->post_type . '_custom_column_switch', $post, $column, $options );
|
84 |
-
|
85 |
-
$type = dev7_default_val( $options, $this->labels->source_name, $this->core_images->image_source_default() );
|
86 |
-
$types = $this->core_images->get_image_sources();
|
87 |
-
|
88 |
-
switch ( $column ) {
|
89 |
-
case 'images':
|
90 |
-
$limit = 5;
|
91 |
-
if ( isset( $_GET['mode'] ) && $_GET['mode'] == 'excerpt' ) {
|
92 |
-
$limit = 20;
|
93 |
-
}
|
94 |
-
$images = $this->core_images->get_images( $post->ID, 'thumbnail', $limit );
|
95 |
-
if ( $images ) {
|
96 |
-
echo '<ul class="dev7plugin-thumbs">';
|
97 |
-
foreach ( $images as $image ) {
|
98 |
-
echo '<li><img src="' . $image['image_src'] . '" alt="' . $image['alt_text'] . '" style="width:32px;height:32px;" /></li>';
|
99 |
-
}
|
100 |
-
echo '</ul>';
|
101 |
-
} else {
|
102 |
-
if ( ( ! isset( $types[$type] ) || $type == $this->labels->manual_name ) && ( ! isset( $options['manual_image_ids'] ) || $options['manual_image_ids'] == '' ) ) {
|
103 |
-
$images = dev7_get_attached_images( $post->ID, 1 );
|
104 |
-
if ( $images ) {
|
105 |
-
echo '<a class="reattach-images" data-post="'. $post->ID .'" href="#">Reattach Images</a><div class="reattach-spinner spinner"></div>';
|
106 |
-
} else {
|
107 |
-
echo 'No images attached';
|
108 |
-
}
|
109 |
-
}
|
110 |
-
}
|
111 |
-
break;
|
112 |
-
case 'shortcode':
|
113 |
-
echo '<code>[' . $this->labels->shortcode . ' id="' . $post->ID . '"]</code>';
|
114 |
-
if ( $post->post_name != '' ) {
|
115 |
-
echo '<br /><code>[' . $this->labels->shortcode . ' slug="' . $post->post_name . '"]</code>';
|
116 |
-
}
|
117 |
-
break;
|
118 |
-
case 'type':
|
119 |
-
|
120 |
-
echo isset( $types[$type] ) ? $types[$type] : 'Manual';
|
121 |
-
switch ( $type ) {
|
122 |
-
case 'gallery':
|
123 |
-
$gallery_post = get_the_title( dev7_default_val( $options, $this->labels->type_name . '_gallery' ) );
|
124 |
-
echo '<br><em>' . $gallery_post . '</em>';
|
125 |
-
break;
|
126 |
-
case 'category':
|
127 |
-
$category = get_category( dev7_default_val( $options, $this->labels->type_name . '_category' ) );
|
128 |
-
echo '<br><em>' . $category->name . '</em>';
|
129 |
-
break;
|
130 |
-
case 'custom':
|
131 |
-
$post_type = get_post_type_object( dev7_default_val( $options, $this->labels->type_name . '_custom' ) );
|
132 |
-
echo '<br><em>' . ( ( isset( $post_type->labels->name ) ) ? $post_type->labels->name : ucfirst( $post_type ) ) . '</em>';
|
133 |
-
break;
|
134 |
-
}
|
135 |
-
break;
|
136 |
-
}
|
137 |
-
}
|
138 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/includes/assets.php
DELETED
@@ -1,147 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Assets Class
|
4 |
-
*
|
5 |
-
* @package Plugin Core
|
6 |
-
* @subpackage Assets
|
7 |
-
* @copyright Copyright (c) 2014, Dev7studios
|
8 |
-
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License
|
9 |
-
* @since 2.2
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Assets Core Class
|
19 |
-
*
|
20 |
-
* @since 2.2
|
21 |
-
*/
|
22 |
-
class Dev7_Core_Assets extends Dev7_Core {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* "construct" for the Dev7 core Assets class
|
26 |
-
*/
|
27 |
-
protected function core_init() {
|
28 |
-
add_action( 'init', array( $this, 'init' ) );
|
29 |
-
add_action( 'admin_print_scripts', array( $this, 'admin_print_scripts' ) );
|
30 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ) );
|
31 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Registers the TinyMCE plugins
|
36 |
-
*
|
37 |
-
* @since 2.2
|
38 |
-
* @access public
|
39 |
-
*/
|
40 |
-
public function init() {
|
41 |
-
if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) && get_user_option( 'rich_editing' ) == 'true' ) {
|
42 |
-
add_filter( 'mce_external_plugins', array( $this, 'mce_add_plugin' ) );
|
43 |
-
add_filter( 'mce_buttons_2', array( $this, 'mce_register_button' ) );
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Registers the TinyMCE script
|
49 |
-
*
|
50 |
-
* @since 2.2
|
51 |
-
* @access public
|
52 |
-
*/
|
53 |
-
public function mce_add_plugin( $plugin_array ) {
|
54 |
-
$plugin_array[$this->labels->post_type] = plugins_url( 'assets/js/tinymce.js', $this->labels->plugin_file );
|
55 |
-
|
56 |
-
return $plugin_array;
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Registers the TinyMCE button
|
61 |
-
*
|
62 |
-
* @since 2.2
|
63 |
-
* @access public
|
64 |
-
*/
|
65 |
-
public function mce_register_button( $buttons ) {
|
66 |
-
array_push( $buttons, "|", $this->labels->post_type );
|
67 |
-
|
68 |
-
return $buttons;
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Prints the [galleries] as javascript to be used by the TinyMCE plugin
|
73 |
-
*
|
74 |
-
* @since 2.2
|
75 |
-
* @access public
|
76 |
-
*/
|
77 |
-
public function admin_print_scripts() {
|
78 |
-
// Galleries list for TinyMCE dropdown
|
79 |
-
$galleries = get_posts( array( 'post_type' => $this->labels->post_type, 'posts_per_page' => - 1 ) );
|
80 |
-
$list = array();
|
81 |
-
foreach ( $galleries as $gallery ) {
|
82 |
-
$list[] = array(
|
83 |
-
'id' => $gallery->ID,
|
84 |
-
'name' => $gallery->post_title
|
85 |
-
);
|
86 |
-
}
|
87 |
-
$settings = array(
|
88 |
-
'galleries' => json_encode( $list )
|
89 |
-
);
|
90 |
-
$html = "<script type='text/javascript'>\n";
|
91 |
-
$html .= 'var ' . $this->labels->post_type . ' = ' . json_encode( $settings ) . '';
|
92 |
-
$html .= "\n</script>";
|
93 |
-
echo $html;
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Registers and enqueues the styles for the plugin
|
98 |
-
*
|
99 |
-
* @since 2.2
|
100 |
-
* @access public
|
101 |
-
*/
|
102 |
-
public function admin_styles() {
|
103 |
-
global $post;
|
104 |
-
if ( ( isset( $post->post_type ) && $post->post_type == $this->labels->post_type )
|
105 |
-
|| ( isset( $_GET['page'] ) && $_GET['page'] == $this->labels->post_type . '-settings' )
|
106 |
-
) {
|
107 |
-
|
108 |
-
wp_register_style( $this->labels->post_type . '-admin', plugins_url( 'includes/core/assets/css/admin.css', $this->labels->plugin_file ), array(), $this->labels->plugin_version );
|
109 |
-
wp_enqueue_style( $this->labels->post_type . '-admin' );
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Registers and enqueues the scripts for the plugin
|
115 |
-
*
|
116 |
-
* @since 2.2
|
117 |
-
* @access public
|
118 |
-
*/
|
119 |
-
public function admin_scripts() {
|
120 |
-
global $post;
|
121 |
-
if ( ( isset( $post->post_type ) && $post->post_type == $this->labels->post_type )
|
122 |
-
|| ( isset( $_GET['page'] ) && $_GET['page'] == $this->labels->post_type . '-settings' )
|
123 |
-
) {
|
124 |
-
|
125 |
-
wp_register_script( $this->labels->post_type . '-core-admin', plugins_url( 'includes/core/assets/js/admin.js', $this->labels->plugin_file ), array( 'jquery' ), $this->labels->plugin_version );
|
126 |
-
wp_enqueue_script( $this->labels->post_type . '-core-admin' );
|
127 |
-
|
128 |
-
wp_register_script(
|
129 |
-
$this->labels->post_type . '-image-admin', plugins_url( 'includes/core/assets/js/image-admin.js', $this->labels->plugin_file ), array(
|
130 |
-
'jquery',
|
131 |
-
$this->labels->post_type . '-core-admin'
|
132 |
-
), $this->labels->plugin_version
|
133 |
-
);
|
134 |
-
wp_enqueue_script( $this->labels->post_type . '-image-admin' );
|
135 |
-
|
136 |
-
$settings = array(
|
137 |
-
'post_id' => ( isset( $post->ID ) ) ? $post->ID : '',
|
138 |
-
'labels' => $this->labels,
|
139 |
-
'nonce' => wp_create_nonce( $this->labels->post_type ),
|
140 |
-
);
|
141 |
-
$settings = apply_filters( $this->labels->post_type . '_script_settings', $settings );
|
142 |
-
wp_localize_script( $this->labels->post_type . '-core-admin', 'dev7plugin', $settings );
|
143 |
-
|
144 |
-
do_action( $this->labels->post_type . '_admin_scripts' );
|
145 |
-
}
|
146 |
-
}
|
147 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/includes/core.php
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Dev7studios Core
|
4 |
-
*
|
5 |
-
* @package Plugin Core
|
6 |
-
* @subpackage Core
|
7 |
-
* @copyright Copyright (c) 2014, Dev7studios
|
8 |
-
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License
|
9 |
-
* @since 2.2
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Main Core Class
|
19 |
-
*
|
20 |
-
* @since 2.4.9
|
21 |
-
*/
|
22 |
-
abstract class Dev7_Core {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* All of the specific plugin data
|
26 |
-
*
|
27 |
-
* @var object
|
28 |
-
* @access protected
|
29 |
-
* @since 2.2
|
30 |
-
*/
|
31 |
-
protected $labels;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Is this plugin a "lite" plugin
|
35 |
-
*
|
36 |
-
* @var bool
|
37 |
-
* @access protected
|
38 |
-
* @since 2.4.8
|
39 |
-
*/
|
40 |
-
protected $is_lite;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Main construct
|
44 |
-
*
|
45 |
-
* @since 2.2
|
46 |
-
*
|
47 |
-
* @param array $labels Specific plugin label data
|
48 |
-
* @param bool $is_lite Is this a "lite" plugin
|
49 |
-
*/
|
50 |
-
public function __construct( $labels, $is_lite = false ) {
|
51 |
-
$this->labels = (object) $labels;
|
52 |
-
$this->is_lite = $is_lite;
|
53 |
-
|
54 |
-
$this->core_init();
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Use this instead of overriding __construct
|
59 |
-
*/
|
60 |
-
protected function core_init()
|
61 |
-
{
|
62 |
-
//
|
63 |
-
}
|
64 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/includes/edd_sl_plugin_updater.php
DELETED
@@ -1,339 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// uncomment this line for testing
|
4 |
-
//set_site_transient( 'update_plugins', null );
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Allows plugins to use their own update API.
|
8 |
-
*
|
9 |
-
* @author Pippin Williamson
|
10 |
-
* @version 1.6
|
11 |
-
*/
|
12 |
-
if ( ! class_exists( 'Dev7_EDD_SL_Plugin_Updater_16' ) ) {
|
13 |
-
class Dev7_EDD_SL_Plugin_Updater_16 {
|
14 |
-
private $api_url = '';
|
15 |
-
private $api_data = array();
|
16 |
-
private $name = '';
|
17 |
-
private $slug = '';
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Class constructor.
|
21 |
-
*
|
22 |
-
* @uses plugin_basename()
|
23 |
-
* @uses hook()
|
24 |
-
*
|
25 |
-
* @param string $_api_url The URL pointing to the custom API endpoint.
|
26 |
-
* @param string $_plugin_file Path to the plugin file.
|
27 |
-
* @param array $_api_data Optional data to send with API calls.
|
28 |
-
* @return void
|
29 |
-
*/
|
30 |
-
function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
|
31 |
-
$this->api_url = trailingslashit( $_api_url );
|
32 |
-
$this->api_data = $_api_data;
|
33 |
-
$this->name = plugin_basename( $_plugin_file );
|
34 |
-
$this->slug = basename( $_plugin_file, '.php' );
|
35 |
-
$this->version = $_api_data['version'];
|
36 |
-
$this->plugin = plugin_basename( $_plugin_file );
|
37 |
-
|
38 |
-
// Set up hooks.
|
39 |
-
$this->init();
|
40 |
-
add_action( 'admin_init', array( $this, 'show_changelog' ) );
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Set up WordPress filters to hook into WP's update process.
|
45 |
-
*
|
46 |
-
* @uses add_filter()
|
47 |
-
*
|
48 |
-
* @return void
|
49 |
-
*/
|
50 |
-
public function init() {
|
51 |
-
|
52 |
-
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
53 |
-
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
54 |
-
|
55 |
-
add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Check for Updates at the defined API endpoint and modify the update array.
|
60 |
-
*
|
61 |
-
* This function dives into the update API just when WordPress creates its update array,
|
62 |
-
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
63 |
-
* It is reassembled from parts of the native WordPress plugin update code.
|
64 |
-
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
65 |
-
*
|
66 |
-
* @uses api_request()
|
67 |
-
*
|
68 |
-
* @param array $_transient_data Update array build by WordPress.
|
69 |
-
* @return array Modified update array with custom plugin data.
|
70 |
-
*/
|
71 |
-
function check_update( $_transient_data ) {
|
72 |
-
|
73 |
-
global $pagenow;
|
74 |
-
|
75 |
-
if( ! is_object( $_transient_data ) ) {
|
76 |
-
$_transient_data = new stdClass;
|
77 |
-
}
|
78 |
-
|
79 |
-
if( 'plugins.php' == $pagenow && is_multisite() ) {
|
80 |
-
return $_transient_data;
|
81 |
-
}
|
82 |
-
|
83 |
-
if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
|
84 |
-
|
85 |
-
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
86 |
-
|
87 |
-
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
88 |
-
$version_info->plugin = $this->plugin;
|
89 |
-
|
90 |
-
$this->did_check = true;
|
91 |
-
|
92 |
-
if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
93 |
-
|
94 |
-
$_transient_data->response[ $this->name ] = $version_info;
|
95 |
-
|
96 |
-
}
|
97 |
-
|
98 |
-
$_transient_data->last_checked = time();
|
99 |
-
$_transient_data->checked[ $this->name ] = $this->version;
|
100 |
-
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
return $_transient_data;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
|
109 |
-
*
|
110 |
-
* @param string $file
|
111 |
-
* @param array $plugin
|
112 |
-
*/
|
113 |
-
public function show_update_notification( $file, $plugin ) {
|
114 |
-
|
115 |
-
if ( ! current_user_can( 'update_plugins' ) ) {
|
116 |
-
return;
|
117 |
-
}
|
118 |
-
|
119 |
-
if ( ! is_multisite() ) {
|
120 |
-
return;
|
121 |
-
}
|
122 |
-
|
123 |
-
if ( $this->name != $file ) {
|
124 |
-
return;
|
125 |
-
}
|
126 |
-
|
127 |
-
// Remove our filter on the site transient
|
128 |
-
remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
|
129 |
-
|
130 |
-
$update_cache = get_site_transient( 'update_plugins' );
|
131 |
-
|
132 |
-
if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
133 |
-
|
134 |
-
$cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
|
135 |
-
$version_info = get_transient( $cache_key );
|
136 |
-
|
137 |
-
if( false === $version_info ) {
|
138 |
-
|
139 |
-
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
140 |
-
|
141 |
-
set_transient( $cache_key, $version_info, 3600 );
|
142 |
-
}
|
143 |
-
|
144 |
-
|
145 |
-
if ( ! is_object( $version_info ) ) {
|
146 |
-
return;
|
147 |
-
}
|
148 |
-
|
149 |
-
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
150 |
-
|
151 |
-
$update_cache->response[ $this->name ] = $version_info;
|
152 |
-
|
153 |
-
}
|
154 |
-
|
155 |
-
$update_cache->last_checked = time();
|
156 |
-
$update_cache->checked[ $this->name ] = $this->version;
|
157 |
-
|
158 |
-
set_site_transient( 'update_plugins', $update_cache );
|
159 |
-
|
160 |
-
} else {
|
161 |
-
|
162 |
-
$version_info = $update_cache->response[ $this->name ];
|
163 |
-
|
164 |
-
}
|
165 |
-
|
166 |
-
// Restore our filter
|
167 |
-
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
168 |
-
|
169 |
-
if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
170 |
-
|
171 |
-
// build a plugin list row, with update notification
|
172 |
-
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
|
173 |
-
echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
|
174 |
-
|
175 |
-
$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
|
176 |
-
|
177 |
-
if ( empty( $version_info->download_link ) ) {
|
178 |
-
printf(
|
179 |
-
__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
|
180 |
-
esc_html( $version_info->name ),
|
181 |
-
esc_url( $changelog_link ),
|
182 |
-
esc_html( $version_info->new_version )
|
183 |
-
);
|
184 |
-
} else {
|
185 |
-
printf(
|
186 |
-
__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
|
187 |
-
esc_html( $version_info->name ),
|
188 |
-
esc_url( $changelog_link ),
|
189 |
-
esc_html( $version_info->new_version ),
|
190 |
-
esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
|
191 |
-
);
|
192 |
-
}
|
193 |
-
|
194 |
-
echo '</div></td></tr>';
|
195 |
-
}
|
196 |
-
}
|
197 |
-
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Updates information on the "View version x.x details" page with custom data.
|
201 |
-
*
|
202 |
-
* @uses api_request()
|
203 |
-
*
|
204 |
-
* @param mixed $_data
|
205 |
-
* @param string $_action
|
206 |
-
* @param object $_args
|
207 |
-
* @return object $_data
|
208 |
-
*/
|
209 |
-
function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
210 |
-
|
211 |
-
if ( $_action != 'plugin_information' ) {
|
212 |
-
|
213 |
-
return $_data;
|
214 |
-
|
215 |
-
}
|
216 |
-
|
217 |
-
if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
|
218 |
-
|
219 |
-
return $_data;
|
220 |
-
|
221 |
-
}
|
222 |
-
|
223 |
-
$to_send = array(
|
224 |
-
'slug' => $this->slug,
|
225 |
-
'is_ssl' => is_ssl(),
|
226 |
-
'fields' => array(
|
227 |
-
'banners' => false, // These will be supported soon hopefully
|
228 |
-
'reviews' => false,
|
229 |
-
)
|
230 |
-
);
|
231 |
-
|
232 |
-
$api_response = $this->api_request( 'plugin_information', $to_send );
|
233 |
-
|
234 |
-
if ( false !== $api_response ) {
|
235 |
-
$_data = $api_response;
|
236 |
-
}
|
237 |
-
|
238 |
-
return $_data;
|
239 |
-
}
|
240 |
-
|
241 |
-
|
242 |
-
/**
|
243 |
-
* Disable SSL verification in order to prevent download update failures
|
244 |
-
*
|
245 |
-
* @param array $args
|
246 |
-
* @param string $url
|
247 |
-
* @return object $array
|
248 |
-
*/
|
249 |
-
function http_request_args( $args, $url ) {
|
250 |
-
// If it is an https request and we are performing a package download, disable ssl verification
|
251 |
-
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
252 |
-
$args['sslverify'] = false;
|
253 |
-
}
|
254 |
-
return $args;
|
255 |
-
}
|
256 |
-
|
257 |
-
/**
|
258 |
-
* Calls the API and, if successfull, returns the object delivered by the API.
|
259 |
-
*
|
260 |
-
* @uses get_bloginfo()
|
261 |
-
* @uses wp_remote_post()
|
262 |
-
* @uses is_wp_error()
|
263 |
-
*
|
264 |
-
* @param string $_action The requested action.
|
265 |
-
* @param array $_data Parameters for the API action.
|
266 |
-
* @return false||object
|
267 |
-
*/
|
268 |
-
private function api_request( $_action, $_data ) {
|
269 |
-
|
270 |
-
global $wp_version;
|
271 |
-
|
272 |
-
$data = array_merge( $this->api_data, $_data );
|
273 |
-
|
274 |
-
if ( $data['slug'] != $this->slug ) {
|
275 |
-
return;
|
276 |
-
}
|
277 |
-
|
278 |
-
if ( empty( $data['license'] ) ) {
|
279 |
-
return;
|
280 |
-
}
|
281 |
-
|
282 |
-
if( $this->api_url == home_url() ) {
|
283 |
-
return false; // Don't allow a plugin to ping itself
|
284 |
-
}
|
285 |
-
|
286 |
-
$api_params = array(
|
287 |
-
'edd_action' => 'get_version',
|
288 |
-
'license' => $data['license'],
|
289 |
-
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
290 |
-
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
291 |
-
'slug' => $data['slug'],
|
292 |
-
'author' => $data['author'],
|
293 |
-
'url' => home_url()
|
294 |
-
);
|
295 |
-
|
296 |
-
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
|
297 |
-
|
298 |
-
if ( ! is_wp_error( $request ) ) {
|
299 |
-
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
300 |
-
}
|
301 |
-
|
302 |
-
if ( $request && isset( $request->sections ) ) {
|
303 |
-
$request->sections = maybe_unserialize( $request->sections );
|
304 |
-
} else {
|
305 |
-
$request = false;
|
306 |
-
}
|
307 |
-
|
308 |
-
return $request;
|
309 |
-
}
|
310 |
-
|
311 |
-
public function show_changelog() {
|
312 |
-
|
313 |
-
if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
|
314 |
-
return;
|
315 |
-
}
|
316 |
-
|
317 |
-
if ( empty( $_REQUEST['plugin'] ) ) {
|
318 |
-
return;
|
319 |
-
}
|
320 |
-
|
321 |
-
if ( empty( $_REQUEST['slug'] ) ) {
|
322 |
-
return;
|
323 |
-
}
|
324 |
-
|
325 |
-
if ( ! current_user_can( 'update_plugins' ) ) {
|
326 |
-
wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
|
327 |
-
}
|
328 |
-
|
329 |
-
$response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
|
330 |
-
|
331 |
-
if ( $response && isset( $response->sections['changelog'] ) ) {
|
332 |
-
echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
|
333 |
-
}
|
334 |
-
|
335 |
-
exit;
|
336 |
-
}
|
337 |
-
|
338 |
-
}
|
339 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/includes/functions.php
DELETED
@@ -1,201 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Functions
|
4 |
-
*
|
5 |
-
* @package Plugin Core
|
6 |
-
* @subpackage Core
|
7 |
-
* @copyright Copyright (c) 2014, Dev7studios
|
8 |
-
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License
|
9 |
-
* @since 2.2
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Default value helper function
|
19 |
-
*
|
20 |
-
* @since 2.2
|
21 |
-
*
|
22 |
-
* @param $options
|
23 |
-
* @param $value
|
24 |
-
* @param string $default
|
25 |
-
*
|
26 |
-
* @return string
|
27 |
-
*/
|
28 |
-
if ( ! function_exists( 'dev7_default_val' ) ) {
|
29 |
-
function dev7_default_val( $options, $value, $default = '' ) {
|
30 |
-
if ( ! isset( $options[$value] ) ) {
|
31 |
-
return $default;
|
32 |
-
} else {
|
33 |
-
return $options[$value];
|
34 |
-
}
|
35 |
-
}
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Checks if a plugin is installed and active
|
40 |
-
*
|
41 |
-
* @since 2.2
|
42 |
-
*
|
43 |
-
* @param $plugin
|
44 |
-
*
|
45 |
-
* @return bool
|
46 |
-
*/
|
47 |
-
if ( ! function_exists( 'dev7_plugin_is_active' ) ) {
|
48 |
-
function dev7_plugin_is_active( $plugin ) {
|
49 |
-
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) );
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Checks if Media Manager Plus is installed and active
|
55 |
-
*
|
56 |
-
* @since 2.2
|
57 |
-
* @return bool
|
58 |
-
*/
|
59 |
-
if ( ! function_exists( 'dev7_mmp_active' ) ) {
|
60 |
-
function dev7_mmp_active() {
|
61 |
-
$mmp_path = 'uber-media/uber-media.php';
|
62 |
-
|
63 |
-
return dev7_plugin_is_active( $mmp_path );
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Checks if a license for the plugin has been set as a constant
|
69 |
-
*
|
70 |
-
* @since 2.2
|
71 |
-
* @return bool
|
72 |
-
*/
|
73 |
-
if ( ! function_exists( 'dev7_license_constant' ) ) {
|
74 |
-
function dev7_license_constant( $post_type ) {
|
75 |
-
return apply_filters( $post_type . '_check_license_constant', false );
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Returns the license key for the plugin
|
81 |
-
*
|
82 |
-
* @since 2.2
|
83 |
-
*
|
84 |
-
* @param string $post_type
|
85 |
-
* @param array $options
|
86 |
-
*
|
87 |
-
* @return string $license
|
88 |
-
*/
|
89 |
-
if ( ! function_exists( 'dev7_get_license_key' ) ) {
|
90 |
-
function dev7_get_license_key( $post_type, $options ) {
|
91 |
-
if ( dev7_license_constant( $post_type ) ) {
|
92 |
-
$license = apply_filters( $post_type . '_get_license_constant', '' );
|
93 |
-
} else {
|
94 |
-
$license = dev7_default_val( $options, 'license_key', '' );
|
95 |
-
}
|
96 |
-
|
97 |
-
return trim( $license );
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Checks to see if content has the plugin shortcode
|
103 |
-
*
|
104 |
-
* @since 2.2
|
105 |
-
*
|
106 |
-
* @param string $content
|
107 |
-
* @param array $shortcode
|
108 |
-
*
|
109 |
-
* @return bool $found
|
110 |
-
*/
|
111 |
-
if ( ! function_exists( 'dev7_has_shortcode_wrap' ) ) {
|
112 |
-
function dev7_has_shortcode_wrap( $content, $shortcode = '' ) {
|
113 |
-
|
114 |
-
if ( function_exists( 'has_shortcode' ) ) {
|
115 |
-
return has_shortcode( $content, $shortcode );
|
116 |
-
}
|
117 |
-
|
118 |
-
$found = false;
|
119 |
-
|
120 |
-
if ( ! $shortcode ) {
|
121 |
-
return $found;
|
122 |
-
}
|
123 |
-
if ( stripos( $content, '[' . $shortcode ) !== false ) {
|
124 |
-
$found = true;
|
125 |
-
}
|
126 |
-
|
127 |
-
return $found;
|
128 |
-
}
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Returns the images attached to a [gallery] post
|
133 |
-
*
|
134 |
-
* @since 2.2
|
135 |
-
*
|
136 |
-
* @param string $post_id
|
137 |
-
* @param array $limit
|
138 |
-
*
|
139 |
-
* @return array
|
140 |
-
*/
|
141 |
-
if ( ! function_exists( 'dev7_get_attached_images' ) ) {
|
142 |
-
function dev7_get_attached_images( $post_id, $limit ) {
|
143 |
-
$args = array(
|
144 |
-
'orderby' => 'menu_order ID',
|
145 |
-
'order' => 'ASC',
|
146 |
-
'post_type' => 'attachment',
|
147 |
-
'post_parent' => $post_id,
|
148 |
-
'post_mime_type' => 'image',
|
149 |
-
'post_status' => null,
|
150 |
-
'numberposts' => $limit
|
151 |
-
);
|
152 |
-
|
153 |
-
return get_posts( $args );
|
154 |
-
}
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Gets the [gallery] images attached as a gallery or just attached the to the post
|
159 |
-
*
|
160 |
-
* @since 2.2
|
161 |
-
*
|
162 |
-
* @param string $post
|
163 |
-
* @param array $limit
|
164 |
-
*
|
165 |
-
* @return array
|
166 |
-
*/
|
167 |
-
if ( ! function_exists( 'dev7_grab_attachment_ids_from_gallery' ) ) {
|
168 |
-
function dev7_grab_attachment_ids_from_gallery( $post, $limit ) {
|
169 |
-
if ( ! $post = get_post( $post ) ) {
|
170 |
-
return array();
|
171 |
-
}
|
172 |
-
|
173 |
-
if ( ! dev7_has_shortcode_wrap( $post->post_content, 'gallery' ) ) {
|
174 |
-
return dev7_get_attached_images( $post->ID, $limit );
|
175 |
-
}
|
176 |
-
|
177 |
-
$count = 0;
|
178 |
-
$attachments = array();
|
179 |
-
if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER ) ) {
|
180 |
-
foreach ( $matches as $shortcode ) {
|
181 |
-
if ( 'gallery' === $shortcode[2] ) {
|
182 |
-
$atts = shortcode_parse_atts( $shortcode[3] );
|
183 |
-
if ( isset( $atts['ids'] ) ) {
|
184 |
-
$attachment_ids = explode( ',', $atts['ids'] );
|
185 |
-
}
|
186 |
-
foreach ( $attachment_ids as $att_id ) {
|
187 |
-
$count ++;
|
188 |
-
if ( $limit != - 1 && $count > $limit ) {
|
189 |
-
break;
|
190 |
-
}
|
191 |
-
$attachment = new stdClass();
|
192 |
-
$attachment->ID = $att_id;
|
193 |
-
$attachments[] = $attachment;
|
194 |
-
}
|
195 |
-
}
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
return $attachments;
|
200 |
-
}
|
201 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/includes/post-type.php
DELETED
@@ -1,169 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Post Type Class
|
4 |
-
*
|
5 |
-
* @package Plugin Core
|
6 |
-
* @subpackage Post Type
|
7 |
-
* @copyright Copyright (c) 2014, Dev7studios
|
8 |
-
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License
|
9 |
-
* @since 2.2
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Post Type Core Class
|
20 |
-
*
|
21 |
-
* @since 1.0
|
22 |
-
*/
|
23 |
-
class Dev7_Core_Post_Type extends Dev7_Core {
|
24 |
-
|
25 |
-
/**
|
26 |
-
* "construct" for the Dev7 core Post Type class
|
27 |
-
*/
|
28 |
-
protected function core_init() {
|
29 |
-
add_action( 'init', array( $this, 'register_post_type' ) );
|
30 |
-
add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Registers the post type for the plugin
|
35 |
-
*
|
36 |
-
* @since 2.2
|
37 |
-
* @access public
|
38 |
-
*/
|
39 |
-
function register_post_type() {
|
40 |
-
$labels = array(
|
41 |
-
'name' => '%2$s',
|
42 |
-
'singular_name' => '%1$s',
|
43 |
-
'add_new' => __( 'Add New', 'dev7-core' ),
|
44 |
-
'add_new_item' => __( 'Add New %1$s', 'dev7-core' ),
|
45 |
-
'edit_item' => __( 'Edit %1$s', 'dev7-core' ),
|
46 |
-
'new_item' => __( 'New %1$s', 'dev7-core' ),
|
47 |
-
'all_items' => __( 'All %2$s', 'dev7-core' ),
|
48 |
-
'view_item' => __( 'View %1$s', 'dev7-core' ),
|
49 |
-
'search_items' => __( 'Search %2$s', 'dev7-core' ),
|
50 |
-
'not_found' => __( 'No %2$s found', 'dev7-core' ),
|
51 |
-
'not_found_in_trash' => __( 'No %2$s found in Trash', 'dev7-core' ),
|
52 |
-
'parent_item_colon' => '',
|
53 |
-
'menu_name' => __( '%2$s', 'dev7-core' )
|
54 |
-
);
|
55 |
-
|
56 |
-
foreach ( $labels as $key => $value ) {
|
57 |
-
$labels[$key] = sprintf( $value, $this->get_label_singular(), $this->get_label_plural() );
|
58 |
-
}
|
59 |
-
|
60 |
-
$labels = apply_filters( $this->labels->post_type . '_post_type_labels', $labels );
|
61 |
-
|
62 |
-
$supports = array( 'title', 'thumbnail' );
|
63 |
-
$supports = array_merge( $supports, apply_filters( 'dev7_post_type_supports', array() ) );
|
64 |
-
|
65 |
-
$post_type_args = array(
|
66 |
-
'labels' => $labels,
|
67 |
-
'public' => false,
|
68 |
-
'show_ui' => true,
|
69 |
-
'menu_position' => apply_filters( $this->labels->post_type . '_post_type_menu_position', 100 ),
|
70 |
-
'supports' => $supports,
|
71 |
-
'menu_icon' => apply_filters( $this->labels->post_type . '_post_type_menu_icon', '' )
|
72 |
-
);
|
73 |
-
register_post_type( $this->labels->post_type, apply_filters( $this->labels->post_type . '_post_type_args', $post_type_args ) );
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Sets the messages for the post type
|
78 |
-
*
|
79 |
-
* @since 2.2
|
80 |
-
* @access public
|
81 |
-
*
|
82 |
-
* @param array $messages
|
83 |
-
*
|
84 |
-
* @return array $messages
|
85 |
-
*/
|
86 |
-
public function post_updated_messages( $messages ) {
|
87 |
-
global $post, $post_ID;
|
88 |
-
|
89 |
-
$message_data = array(
|
90 |
-
0 => '',
|
91 |
-
1 => __( '%1$s updated.', 'dev7-core' ),
|
92 |
-
2 => __( 'Custom field updated.', 'dev7-core' ),
|
93 |
-
3 => __( 'Custom field deleted.', 'dev7-core' ),
|
94 |
-
4 => __( '%1$s updated.', 'dev7-core' ),
|
95 |
-
5 => '',
|
96 |
-
6 => __( '%1$s published.', 'dev7-core' ),
|
97 |
-
7 => __( '%1$s saved.', 'dev7-core' ),
|
98 |
-
8 => __( '%1$s submitted.', 'dev7-core' ),
|
99 |
-
9 => __( '%1$s scheduled for: <strong>%2$s</strong>. <a target="_blank" href="%2$s">Preview %1$s</a>', 'dev7-core' ),
|
100 |
-
10 => __( '%1$s draft updated.', 'dev7-core' )
|
101 |
-
);
|
102 |
-
|
103 |
-
foreach ( $message_data as $key => $value ) {
|
104 |
-
if ( $key == 9 ) {
|
105 |
-
$value = sprintf( $value, $this->get_label_singular(), date_i18n( __( 'M j, Y @ G:i', 'dev7-core' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ) );
|
106 |
-
} else {
|
107 |
-
if ( $key == 5 ) {
|
108 |
-
if ( isset( $_GET['revision'] ) ) {
|
109 |
-
$value = sprintf( __( '%1$s restored to revision from %2$s', 'dev7-core' ), $this->get_label_singular(), wp_post_revision_title( (int) $_GET['revision'], false ) );
|
110 |
-
}
|
111 |
-
} else {
|
112 |
-
$value = sprintf( $value, $this->get_label_singular() );
|
113 |
-
}
|
114 |
-
}
|
115 |
-
$message_data[$key] = $value;
|
116 |
-
}
|
117 |
-
$messages[$this->labels->post_type] = apply_filters( $this->labels->post_type . '_post_type_messages', $message_data );
|
118 |
-
|
119 |
-
return $messages;
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Gets the default labels for plugin post type
|
124 |
-
*
|
125 |
-
* @since 2.2
|
126 |
-
* @access private
|
127 |
-
* @return array
|
128 |
-
*/
|
129 |
-
private function get_default_labels() {
|
130 |
-
$defaults = array(
|
131 |
-
'singular' => __( 'Gallery', 'edd' ),
|
132 |
-
'plural' => __( 'Galleries', 'edd' )
|
133 |
-
);
|
134 |
-
|
135 |
-
return ( $this->labels ) ? (array) $this->labels : $defaults;
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Get Singular Label
|
140 |
-
*
|
141 |
-
* @since 2.2
|
142 |
-
* @access private
|
143 |
-
*
|
144 |
-
* @param bool $lowercase
|
145 |
-
*
|
146 |
-
* @return string $defaults['singular'] Singular label
|
147 |
-
*/
|
148 |
-
private function get_label_singular( $lowercase = false ) {
|
149 |
-
$defaults = $this->get_default_labels();
|
150 |
-
|
151 |
-
return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Get Plural Label
|
156 |
-
*
|
157 |
-
* @since 2.2
|
158 |
-
* @access private
|
159 |
-
*
|
160 |
-
* @param bool $lowercase
|
161 |
-
*
|
162 |
-
* @return string $defaults['plural'] Plural label
|
163 |
-
*/
|
164 |
-
private function get_label_plural( $lowercase = false ) {
|
165 |
-
$defaults = $this->get_default_labels();
|
166 |
-
|
167 |
-
return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
|
168 |
-
}
|
169 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/includes/shortcode.php
DELETED
@@ -1,302 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Shortcode Class
|
4 |
-
*
|
5 |
-
* @package Plugin Core
|
6 |
-
* @subpackage Shortcode
|
7 |
-
* @copyright Copyright (c) 2014, Dev7studios
|
8 |
-
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License
|
9 |
-
* @since 2.2
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Shortcode Core Class
|
19 |
-
*
|
20 |
-
* @since 1.0
|
21 |
-
*/
|
22 |
-
class Dev7_Core_Shortcode extends Dev7_Core {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Shortcode core scripts
|
26 |
-
*
|
27 |
-
* @var array
|
28 |
-
* @access private
|
29 |
-
* @since 2.2
|
30 |
-
*/
|
31 |
-
private $core_scripts;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Shortcode scripts
|
35 |
-
*
|
36 |
-
* @var array
|
37 |
-
* @access private
|
38 |
-
* @since 2.2
|
39 |
-
*/
|
40 |
-
private $scripts;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Shortcode core styles
|
44 |
-
*
|
45 |
-
* @var array
|
46 |
-
* @access private
|
47 |
-
* @since 2.2
|
48 |
-
*/
|
49 |
-
private $core_styles;
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Shortcode styles
|
53 |
-
*
|
54 |
-
* @var array
|
55 |
-
* @access private
|
56 |
-
* @since 2.2
|
57 |
-
*/
|
58 |
-
private $styles;
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Instance of Dev7 Images Core Class
|
62 |
-
*
|
63 |
-
* @var object
|
64 |
-
* @access private
|
65 |
-
* @since 2.2
|
66 |
-
*/
|
67 |
-
private $core_images;
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Whether or not core styles and scripts have been enqueued
|
71 |
-
*
|
72 |
-
* @var boolean
|
73 |
-
* @access private
|
74 |
-
* @since 2.4.3
|
75 |
-
*/
|
76 |
-
private $core_enqueued = false;
|
77 |
-
|
78 |
-
/**
|
79 |
-
* "construct" for the Dev7 core Images class
|
80 |
-
*/
|
81 |
-
protected function core_init() {
|
82 |
-
$this->core_images = new Dev7_Core_Images( $this->labels, $this->is_lite );
|
83 |
-
|
84 |
-
$this->core_scripts = apply_filters( $this->labels->post_type . '_shortcode_core_scripts', array() );
|
85 |
-
$this->core_styles = apply_filters( $this->labels->post_type . '_shortcode_core_styles', array() );
|
86 |
-
|
87 |
-
$this->scripts = apply_filters( $this->labels->post_type . '_shortcode_scripts', array() );
|
88 |
-
$this->styles = apply_filters( $this->labels->post_type . '_shortcode_styles', array() );
|
89 |
-
|
90 |
-
add_shortcode( $this->labels->shortcode, array( $this, 'shortcode' ) );
|
91 |
-
|
92 |
-
// Enqueues core styles and scripts only when a shortcode is present.
|
93 |
-
add_filter( 'the_posts', array( $this, 'shortcode_enqueue_core' ) );
|
94 |
-
|
95 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
|
96 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'register_styles' ) );
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Shortcode output for the plugin
|
101 |
-
*
|
102 |
-
* @since 2.2
|
103 |
-
*
|
104 |
-
* @param array $atts
|
105 |
-
*
|
106 |
-
* @access public
|
107 |
-
* @return string $output
|
108 |
-
*/
|
109 |
-
public function shortcode( $atts ) {
|
110 |
-
extract(
|
111 |
-
shortcode_atts(
|
112 |
-
array(
|
113 |
-
'id' => 0,
|
114 |
-
|
115 |
-
// Here for backwards compatibility, has the same function as force below.
|
116 |
-
'template' => false,
|
117 |
-
|
118 |
-
// To force the enqueue of core scripts, pass [... force="true"].
|
119 |
-
'force' => false,
|
120 |
-
'slug' => ''
|
121 |
-
), $atts
|
122 |
-
)
|
123 |
-
);
|
124 |
-
|
125 |
-
if ( ! $id && ! $slug ) {
|
126 |
-
return sprintf( __( 'Invalid %1$s', 'dev7core' ), $this->labels->singular );
|
127 |
-
}
|
128 |
-
|
129 |
-
if ( ! $id ) {
|
130 |
-
$object = get_page_by_path( $slug, OBJECT, $this->labels->post_type );
|
131 |
-
if ( $object ) {
|
132 |
-
$id = $object->ID;
|
133 |
-
} else {
|
134 |
-
return sprintf( __( 'Invalid %1$s Slug', 'dev7core' ), $this->labels->singular );
|
135 |
-
}
|
136 |
-
}
|
137 |
-
|
138 |
-
$output = '';
|
139 |
-
$options = get_post_meta( $id, $this->labels->post_meta_key, true );
|
140 |
-
$type = $options[$this->labels->source_name];
|
141 |
-
|
142 |
-
$defaults = $this->core_images->image_sources_defaults();
|
143 |
-
$slider_type = ( ! array_key_exists( $type, $defaults ) ) ? 'external' : '';
|
144 |
-
|
145 |
-
$images = $this->core_images->get_images( $id );
|
146 |
-
|
147 |
-
// Force enqueue of core scripts (good for do_shortcode() in templates).
|
148 |
-
if ( $template || $force ) {
|
149 |
-
$this->enqueue_core_scripts( true );
|
150 |
-
$this->enqueue_core_styles( true );
|
151 |
-
}
|
152 |
-
|
153 |
-
$this->enqueue_scripts( $options );
|
154 |
-
$this->enqueue_styles( $options );
|
155 |
-
|
156 |
-
// generate unique prefix for $id to avoid clashes with multiple same shortcode use
|
157 |
-
$prefix = wp_generate_password( 5, false );
|
158 |
-
$id = $prefix . '-' . $id;
|
159 |
-
|
160 |
-
if ( $images ) {
|
161 |
-
$output = apply_filters( $this->labels->post_type . '_shortcode_output', $id, $output, $options, $images, $slider_type );
|
162 |
-
}
|
163 |
-
|
164 |
-
return $output;
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Tests each post for a specific shortcode and enqueues core styles and scripts.
|
169 |
-
*
|
170 |
-
* Because we can't always trust `global $post` on `is_home()` or `is_archive()`
|
171 |
-
* we use this method with the `the_posts` filter to test each post being shown
|
172 |
-
* for the shortcode and enqueue the core styles. This saves us from having
|
173 |
-
* to enqueue the core scripts when they are un-necessary.
|
174 |
-
*
|
175 |
-
* Any list of posts that does not use the shortcode will result in the core
|
176 |
-
* styles not being enqueued.
|
177 |
-
*
|
178 |
-
* @since 2.4.3
|
179 |
-
*
|
180 |
-
* @param array $posts Posts sent from `the_posts` filter.
|
181 |
-
*
|
182 |
-
* @access public
|
183 |
-
* @return object $posts Does not modify Posts.
|
184 |
-
*/
|
185 |
-
public function shortcode_enqueue_core( $posts ) {
|
186 |
-
foreach ( $posts as $post ) {
|
187 |
-
if ( ! $this->core_enqueued && dev7_has_shortcode_wrap( $post->post_content, $this->labels->shortcode ) ) {
|
188 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_core_scripts' ) );
|
189 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_core_styles' ) );
|
190 |
-
|
191 |
-
// Tell this instance that it's been enqueued so we don't do this for every post.
|
192 |
-
$this->core_enqueued = true;
|
193 |
-
}
|
194 |
-
}
|
195 |
-
return $posts;
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Enqueues core shortcode scripts in <head>
|
200 |
-
*
|
201 |
-
* @param bool $force
|
202 |
-
*
|
203 |
-
* @since 2.2
|
204 |
-
* @access public
|
205 |
-
*/
|
206 |
-
public function enqueue_core_scripts( $force = false ) {
|
207 |
-
if ( $this->core_scripts && count( $this->core_scripts ) > 0 ) {
|
208 |
-
$required = array( 'jquery' );
|
209 |
-
|
210 |
-
// Enqueue our required scripts.
|
211 |
-
wp_enqueue_script( $required );
|
212 |
-
|
213 |
-
// Enqueue all the scripts.
|
214 |
-
foreach ( $this->core_scripts as $name => $url ) {
|
215 |
-
wp_enqueue_script( $name, $url, $required, $this->labels->plugin_version );
|
216 |
-
$required[] = $name;
|
217 |
-
}
|
218 |
-
}
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* Enqueues core shortcode styles in <head>
|
223 |
-
*
|
224 |
-
* @param bool $force
|
225 |
-
*
|
226 |
-
* @since 2.2
|
227 |
-
* @access public
|
228 |
-
*/
|
229 |
-
public function enqueue_core_styles( $force = false ) {
|
230 |
-
if ( $this->core_styles && count( $this->core_styles ) > 0 ) {
|
231 |
-
foreach ( $this->core_styles as $name => $url ) {
|
232 |
-
wp_enqueue_style( $name, $url, array(), $this->labels->plugin_version );
|
233 |
-
}
|
234 |
-
}
|
235 |
-
}
|
236 |
-
|
237 |
-
/**
|
238 |
-
* Enqueue shortcode scripts that are dependant on plugin options in <footer>
|
239 |
-
*
|
240 |
-
* @since 2.2
|
241 |
-
*
|
242 |
-
* @param array $options
|
243 |
-
*
|
244 |
-
* @access private
|
245 |
-
*/
|
246 |
-
private function enqueue_scripts( $options ) {
|
247 |
-
$scripts = apply_filters( $this->labels->post_type . '_shortcode_scripts_enqueue', $this->scripts, $options );
|
248 |
-
if ( $scripts && count( $scripts ) > 0 ) {
|
249 |
-
foreach ( $scripts as $name => $url ) {
|
250 |
-
wp_enqueue_script( $name );
|
251 |
-
}
|
252 |
-
}
|
253 |
-
}
|
254 |
-
|
255 |
-
/**
|
256 |
-
* Enqueue shortcode styles
|
257 |
-
*
|
258 |
-
* @since 2.2
|
259 |
-
*
|
260 |
-
* @param array $options
|
261 |
-
*
|
262 |
-
* @access private
|
263 |
-
*/
|
264 |
-
private function enqueue_styles( $options ) {
|
265 |
-
$styles = apply_filters( $this->labels->post_type . '_shortcode_styles_enqueue', $this->styles, $options );
|
266 |
-
if ( $styles && count( $styles ) > 0 ) {
|
267 |
-
foreach ( $styles as $name => $url ) {
|
268 |
-
wp_enqueue_style( $name );
|
269 |
-
}
|
270 |
-
}
|
271 |
-
}
|
272 |
-
|
273 |
-
/**
|
274 |
-
* Register shortcode scripts
|
275 |
-
*
|
276 |
-
* @since 2.2
|
277 |
-
* @access public
|
278 |
-
*/
|
279 |
-
public function register_scripts() {
|
280 |
-
if ( $this->scripts && count( $this->scripts ) > 0 ) {
|
281 |
-
$required = array( 'jquery' );
|
282 |
-
foreach ( $this->scripts as $name => $url ) {
|
283 |
-
wp_register_script( $name, $url, $required, $this->labels->plugin_version );
|
284 |
-
$required[] = $name;
|
285 |
-
}
|
286 |
-
}
|
287 |
-
}
|
288 |
-
|
289 |
-
/**
|
290 |
-
* Register shortcode styles
|
291 |
-
*
|
292 |
-
* @since 2.2
|
293 |
-
* @access public
|
294 |
-
*/
|
295 |
-
public function register_styles() {
|
296 |
-
if ( $this->styles && count( $this->styles ) > 0 ) {
|
297 |
-
foreach ( $this->styles as $name => $url ) {
|
298 |
-
wp_register_style( $name, $url, array(), $this->labels->plugin_version );
|
299 |
-
}
|
300 |
-
}
|
301 |
-
}
|
302 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/core/plugin.php
DELETED
@@ -1,174 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Dev7studios Plugin Core
|
4 |
-
*
|
5 |
-
* @package Plugin Core
|
6 |
-
* @subpackage Core
|
7 |
-
* @copyright Copyright (c) 2014, Dev7studios
|
8 |
-
* @license http://opensource.org/licenses/GPL-3.0 GNU Public License
|
9 |
-
* @since 2.2
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Main Plugin Core Class
|
19 |
-
*
|
20 |
-
* @since 2.2
|
21 |
-
*/
|
22 |
-
abstract class Dev7_Core_Plugin {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* All of the specific plugin data
|
26 |
-
*
|
27 |
-
* @var object
|
28 |
-
* @access private
|
29 |
-
* @since 2.2
|
30 |
-
*/
|
31 |
-
private $labels;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Is this plugin a "lite" plugin
|
35 |
-
*
|
36 |
-
* @var bool
|
37 |
-
* @access private
|
38 |
-
* @since 2.4.8
|
39 |
-
*/
|
40 |
-
private $is_lite;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Plugin options
|
44 |
-
*
|
45 |
-
* @var array
|
46 |
-
* @access private
|
47 |
-
* @since 2.2
|
48 |
-
*/
|
49 |
-
private $options;
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Instance of Dev7 Admin Settings Core Class
|
53 |
-
*
|
54 |
-
* @var object
|
55 |
-
* @access private
|
56 |
-
* @since 2.2
|
57 |
-
*/
|
58 |
-
private $settings_class;
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Main construct
|
62 |
-
*
|
63 |
-
* @since 2.2
|
64 |
-
*
|
65 |
-
* @param array $labels Specific plugin label data
|
66 |
-
*/
|
67 |
-
public function __construct( $labels, $is_lite = false ) {
|
68 |
-
$this->labels = (object) $labels;
|
69 |
-
$this->is_lite = $is_lite;
|
70 |
-
$this->options = get_option( $this->labels->options_key );
|
71 |
-
$this->setup_constants();
|
72 |
-
$this->includes();
|
73 |
-
$this->updater();
|
74 |
-
$this->loader();
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Setup core constants
|
79 |
-
*
|
80 |
-
* @access private
|
81 |
-
* @since 2.2
|
82 |
-
*/
|
83 |
-
private function setup_constants() {
|
84 |
-
if ( ! defined( 'DEV7_SITE_URL' ) ) {
|
85 |
-
define( 'DEV7_SITE_URL', 'https://themeisle.com' );
|
86 |
-
}
|
87 |
-
if ( ! defined( 'DEV7_STORE_URL' ) ) {
|
88 |
-
define( 'DEV7_STORE_URL', 'http://themeisle.com' );
|
89 |
-
}
|
90 |
-
// Core Folder Path
|
91 |
-
if ( ! defined( 'DEV7_CORE_DIR' ) ) {
|
92 |
-
define( 'DEV7_CORE_DIR', dirname( __FILE__ ) );
|
93 |
-
}
|
94 |
-
// Core Folder URL
|
95 |
-
if ( ! defined( 'DEV7_CORE_DIR' ) ) {
|
96 |
-
define( 'DEV7_CORE_DIR', dirname( __FILE__ ) );
|
97 |
-
}
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Include required core files
|
102 |
-
*
|
103 |
-
* @access private
|
104 |
-
* @since 2.2
|
105 |
-
*/
|
106 |
-
private function includes() {
|
107 |
-
if ( ! $this->is_lite ) {
|
108 |
-
require_once DEV7_CORE_DIR . '/includes/edd_sl_plugin_updater.php';
|
109 |
-
}
|
110 |
-
require_once DEV7_CORE_DIR . '/includes/core.php';
|
111 |
-
require_once DEV7_CORE_DIR . '/includes/functions.php';
|
112 |
-
require_once DEV7_CORE_DIR . '/includes/assets.php';
|
113 |
-
require_once DEV7_CORE_DIR . '/includes/post-type.php';
|
114 |
-
require_once DEV7_CORE_DIR . '/includes/admin-settings.php';
|
115 |
-
require_once DEV7_CORE_DIR . '/includes/admin-view.php';
|
116 |
-
require_once DEV7_CORE_DIR . '/includes/admin-edit.php';
|
117 |
-
require_once DEV7_CORE_DIR . '/includes/admin-ajax.php';
|
118 |
-
require_once DEV7_CORE_DIR . '/includes/admin-images.php';
|
119 |
-
require_once DEV7_CORE_DIR . '/includes/shortcode.php';
|
120 |
-
require_once DEV7_CORE_DIR . '/includes/images.php';
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Instantiate the EDD Plugin Updater
|
125 |
-
*
|
126 |
-
* @access private
|
127 |
-
* @uses EDD_SL_Plugin_Updater()
|
128 |
-
* @since 2.2
|
129 |
-
*/
|
130 |
-
private function updater() {
|
131 |
-
if ( ! $this->is_lite ) {
|
132 |
-
$license_key = dev7_get_license_key( $this->labels->post_type, $this->options );
|
133 |
-
new Dev7_EDD_SL_Plugin_Updater_16( DEV7_STORE_URL, $this->labels->plugin_file, array(
|
134 |
-
'version' => $this->labels->plugin_version,
|
135 |
-
'license' => $license_key,
|
136 |
-
'item_name' => $this->labels->dev7_item_name,
|
137 |
-
'author' => 'Dev7studios',
|
138 |
-
) );
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Loads all the Dev7 Core classes
|
144 |
-
*
|
145 |
-
* @access private
|
146 |
-
* @since 2.2
|
147 |
-
*/
|
148 |
-
private function loader() {
|
149 |
-
new Dev7_Core_Assets( $this->labels, $this->is_lite );
|
150 |
-
new Dev7_Core_Post_Type( $this->labels, $this->is_lite );
|
151 |
-
$this->settings_class = new Dev7_Core_Admin_Settings( $this->labels, $this->is_lite );
|
152 |
-
new Dev7_Core_Admin_View( $this->labels, $this->is_lite );
|
153 |
-
new Dev7_Core_Admin_Edit( $this->labels, $this->is_lite );
|
154 |
-
new Dev7_Core_Admin_AJAX( $this->labels, $this->is_lite );
|
155 |
-
new Dev7_Core_Admin_Images( $this->labels, $this->is_lite );
|
156 |
-
new Dev7_Core_Shortcode( $this->labels, $this->is_lite );
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Makes public the settings helper from the Dev7 Settings class
|
161 |
-
*
|
162 |
-
* @access public
|
163 |
-
* @uses Dev7_Core_Admin_Settings::settings_helper()
|
164 |
-
*
|
165 |
-
* @param array $args Settings arguments to be rendered as HTML
|
166 |
-
*
|
167 |
-
* @since 2.2
|
168 |
-
*/
|
169 |
-
public function settings_helper( $args ) {
|
170 |
-
$this->settings_class->settings_helper( $args );
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/interface/class-nivo-library-interface.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The library interface.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/interface
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The library interface.
|
14 |
+
*
|
15 |
+
* Defines the interface required for all the library classes.
|
16 |
+
*
|
17 |
+
* @package nivo-slider
|
18 |
+
* @subpackage nivo-slider/includes/interface
|
19 |
+
* @author ThemeIsle <friends@themeisle.com>
|
20 |
+
*/
|
21 |
+
interface Nivo_Library_Interface {
|
22 |
+
/**
|
23 |
+
* Use this instead of overriding __construct
|
24 |
+
*
|
25 |
+
* @since 3.0.0
|
26 |
+
*/
|
27 |
+
function after_core_construct();
|
28 |
+
}
|
includes/interface/class-nivo-settings-interface.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The settings interface.
|
4 |
+
*
|
5 |
+
* @link http://themeisle.com/plugins/nivo-slider/
|
6 |
+
* @since 3.0.0
|
7 |
+
*
|
8 |
+
* @package nivo-slider
|
9 |
+
* @subpackage nivo-slider/includes/interface
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The settings interface.
|
14 |
+
*
|
15 |
+
* Defines the interface required for settings class.
|
16 |
+
*
|
17 |
+
* @package nivo-slider
|
18 |
+
* @subpackage nivo-slider/includes/interface
|
19 |
+
* @author ThemeIsle <friends@themeisle.com>
|
20 |
+
*/
|
21 |
+
interface Nivo_Settings_Interface {
|
22 |
+
function set_labels( $labels );
|
23 |
+
function get_labels();
|
24 |
+
function get_label( $name );
|
25 |
+
function set_lite( $is_lite );
|
26 |
+
function get_lite();
|
27 |
+
}
|
includes/plugin.php
DELETED
@@ -1,830 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Exit if accessed directly
|
4 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
-
exit;
|
6 |
-
}
|
7 |
-
|
8 |
-
if ( ! class_exists( 'Dev7_Core_Plugin' ) ) {
|
9 |
-
require_once NIVO_SLIDER_LITE_PLUGIN_DIR . 'includes/core/plugin.php';
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Main Plugin Class
|
14 |
-
*/
|
15 |
-
class Dev7_Nivo_Slider_Lite extends Dev7_Core_Plugin {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Plugin Version
|
19 |
-
*
|
20 |
-
* @var string
|
21 |
-
* @access private
|
22 |
-
* @since 2.2
|
23 |
-
*/
|
24 |
-
private $version;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Post Type
|
28 |
-
*
|
29 |
-
* @var string
|
30 |
-
* @access private
|
31 |
-
* @since 2.2
|
32 |
-
*/
|
33 |
-
private $post_type;
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Plugin labels
|
37 |
-
*
|
38 |
-
* @var object
|
39 |
-
* @access private
|
40 |
-
* @since 2.2
|
41 |
-
*/
|
42 |
-
private $labels;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Main construct
|
46 |
-
*
|
47 |
-
* @since 2.2
|
48 |
-
*
|
49 |
-
* @param string $version
|
50 |
-
*/
|
51 |
-
public function __construct( $version ) {
|
52 |
-
$this->version = $version;
|
53 |
-
$this->labels = array(
|
54 |
-
'dev7_item_name' => 'Nivo Slider Lite WordPress Plugin',
|
55 |
-
'plugin_name' => 'Nivo Slider Lite',
|
56 |
-
'plugin_version' => $version,
|
57 |
-
'plugin_file' => NIVO_SLIDER_LITE_PLUGIN_FILE,
|
58 |
-
'plugin_basename' => NIVO_SLIDER_LITE_PLUGIN_BASENAME,
|
59 |
-
'plugin_url' => NIVO_SLIDER_LITE_PLUGIN_URL,
|
60 |
-
'post_type' => 'nivoslider',
|
61 |
-
'shortcode' => 'nivoslider',
|
62 |
-
'function' => 'nivo_slider',
|
63 |
-
'slug' => 'nivo-slider',
|
64 |
-
'post_meta_key' => 'nivo_settings',
|
65 |
-
'options_key' => 'nivoslider_settings',
|
66 |
-
'source_name' => 'type',
|
67 |
-
'manual_name' => 'manual',
|
68 |
-
'type_name' => 'type',
|
69 |
-
'singular' => __( 'Slider', 'nivo-slider' ),
|
70 |
-
'plural' => __( 'Sliders', 'nivo-slider' ),
|
71 |
-
'documentation' => 'http://docs.themeisle.com/'
|
72 |
-
);
|
73 |
-
$this->post_type = $this->labels['post_type'];
|
74 |
-
|
75 |
-
$this->add_filters();
|
76 |
-
$this->add_actions();
|
77 |
-
|
78 |
-
parent::__construct( $this->labels, true );
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Adds custom filters for the plugin
|
83 |
-
*
|
84 |
-
* @since 2.2
|
85 |
-
* @access private
|
86 |
-
*/
|
87 |
-
private function add_filters() {
|
88 |
-
add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 11, 2 );
|
89 |
-
add_filter( $this->post_type . '_post_type_labels', array( $this, 'post_type_labels' ) );
|
90 |
-
add_filter( $this->post_type . '_post_type_menu_icon', array( $this, 'post_type_menu_icon' ) );
|
91 |
-
add_filter( $this->post_type . '_settings_page_header', array( $this, 'settings_page_header' ) );
|
92 |
-
add_filter( $this->post_type . '_settings_intro', array( $this, 'settings_intro' ) );
|
93 |
-
add_filter( $this->post_type . '_admin_edit_settings', array( $this, 'admin_edit_settings' ) );
|
94 |
-
add_filter( $this->post_type . '_post_meta_save', array( $this, 'post_meta_save' ) );
|
95 |
-
add_filter( $this->post_type . '_script_settings', array( $this, 'script_settings' ) );
|
96 |
-
add_filter( $this->post_type . '_shortcode_core_styles', array( $this, 'shortcode_core_styles' ) );
|
97 |
-
add_filter( $this->post_type . '_shortcode_scripts', array( $this, 'shortcode_scripts' ) );
|
98 |
-
add_filter( $this->post_type . '_shortcode_styles', array( $this, 'shortcode_styles' ) );
|
99 |
-
add_filter( $this->post_type . '_shortcode_styles_enqueue', array( $this, 'shortcode_styles_enqueue' ), 10, 2 );
|
100 |
-
add_filter( $this->post_type . '_shortcode_output', array( $this, 'shortcode_output' ), 10, 5 );
|
101 |
-
add_filter( $this->post_type . '_get_image_sources', array( $this, 'get_image_sources' ) );
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Adds custom actions for the plugin
|
106 |
-
*
|
107 |
-
* @since 2.2
|
108 |
-
* @access private
|
109 |
-
*/
|
110 |
-
private function add_actions() {
|
111 |
-
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
112 |
-
add_action( 'admin_menu', array( $this, 'remove_settings_menu' ), 11 );
|
113 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ) );
|
114 |
-
add_action( $this->post_type . '_admin_scripts', array( $this, 'admin_scripts' ) );
|
115 |
-
add_action( $this->post_type . '_manual_type_description', array( $this, 'manual_type_description' ) );
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Add Upgrade metabox to the edit screen
|
120 |
-
*/
|
121 |
-
public function admin_init() {
|
122 |
-
add_meta_box( $this->post_type . '_upgrade_box', __( 'Upgrade to Pro', 'nivo-slider' ), array(
|
123 |
-
$this,
|
124 |
-
'meta_box_upgrade',
|
125 |
-
), $this->post_type, 'side' );
|
126 |
-
}
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Remove the settings page for the Lite plugin
|
130 |
-
*/
|
131 |
-
public function remove_settings_menu() {
|
132 |
-
remove_submenu_page( 'edit.php?post_type=' . $this->post_type, 'nivoslider-settings' );
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Registers and enqueues custom admin scripts
|
137 |
-
*
|
138 |
-
* @since 2.2
|
139 |
-
* @access public
|
140 |
-
*/
|
141 |
-
public function admin_scripts() {
|
142 |
-
wp_register_script( $this->post_type . '-lite-admin', plugins_url( 'assets/js/admin.js', dirname( __FILE__ ) ), array(
|
143 |
-
'jquery',
|
144 |
-
$this->post_type . '-core-admin',
|
145 |
-
), $this->version );
|
146 |
-
wp_enqueue_script( $this->post_type . '-lite-admin' );
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Registers and enqueues custom admin styles
|
151 |
-
*/
|
152 |
-
public function admin_styles() {
|
153 |
-
wp_register_style( $this->post_type . '-lite-admin', plugins_url( 'assets/css/admin.css', dirname( __FILE__ ) ), array(), $this->version );
|
154 |
-
wp_enqueue_style( $this->post_type . '-lite-admin' );
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Adds custom scripts to Shortcode script array for conditional loading
|
159 |
-
*
|
160 |
-
* @since 2.2
|
161 |
-
* @access public
|
162 |
-
*
|
163 |
-
* @param array $scripts
|
164 |
-
*
|
165 |
-
* @return array $scripts
|
166 |
-
*/
|
167 |
-
public function shortcode_scripts( $scripts ) {
|
168 |
-
$scripts = array( 'dev7-ns-nivoslider' => plugins_url( 'assets/js/jquery.nivo.slider.pack.js', dirname( __FILE__ ) ) );
|
169 |
-
|
170 |
-
return $scripts;
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Adds custom styles to Shortcode style array for loading to <head>
|
175 |
-
*
|
176 |
-
* @since 2.2
|
177 |
-
* @access public
|
178 |
-
*
|
179 |
-
* @param array $styles
|
180 |
-
*
|
181 |
-
* @return array $styles
|
182 |
-
*/
|
183 |
-
public function shortcode_core_styles( $styles ) {
|
184 |
-
return array( 'dev7-ns-nivoslider' => plugins_url( 'assets/css/nivo-slider.css', dirname( __FILE__ ) ) );
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Adds custom styles to Shortcode style array for conditional loading
|
189 |
-
*
|
190 |
-
* @since 2.2
|
191 |
-
* @access public
|
192 |
-
*
|
193 |
-
* @param array $styles
|
194 |
-
*
|
195 |
-
* @return array $styles
|
196 |
-
*/
|
197 |
-
public function shortcode_styles( $styles ) {
|
198 |
-
$styles = array();
|
199 |
-
$themes = $this->get_themes();
|
200 |
-
foreach ( $themes as $theme ) {
|
201 |
-
$styles[ 'nivoslider-theme-' . $theme['theme_name'] ] = $theme['theme_url'];
|
202 |
-
}
|
203 |
-
|
204 |
-
return $styles;
|
205 |
-
}
|
206 |
-
|
207 |
-
/**
|
208 |
-
* Custom shortcode enqueuing of scripts for selected Nivo theme
|
209 |
-
*
|
210 |
-
* @since 2.2
|
211 |
-
* @access public
|
212 |
-
*
|
213 |
-
* @param array $styles
|
214 |
-
* @param array $options
|
215 |
-
*
|
216 |
-
* @return array $styles
|
217 |
-
*/
|
218 |
-
public function shortcode_styles_enqueue( $styles, $options ) {
|
219 |
-
$slider_theme = 'nivoslider-theme-' . dev7_default_val( $options, 'theme' );
|
220 |
-
if ( $styles ) {
|
221 |
-
foreach ( $styles as $name => $url ) {
|
222 |
-
if ( substr( $name, 0, 17 ) == 'nivoslider-theme-' ) {
|
223 |
-
if ( $name != $slider_theme ) {
|
224 |
-
unset( $styles[ $name ] );
|
225 |
-
}
|
226 |
-
}
|
227 |
-
}
|
228 |
-
}
|
229 |
-
|
230 |
-
return $styles;
|
231 |
-
}
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Custom post type labels
|
235 |
-
*
|
236 |
-
* @since 2.2
|
237 |
-
* @access public
|
238 |
-
*
|
239 |
-
* @param array $labels
|
240 |
-
*
|
241 |
-
* @return array $labels
|
242 |
-
*/
|
243 |
-
public function post_type_labels( $labels ) {
|
244 |
-
$name = __( 'Nivo Slider', 'nivo-slider' );
|
245 |
-
$labels['name'] = $labels['singular_name'] = $labels['menu_name'] = $name;
|
246 |
-
|
247 |
-
return $labels;
|
248 |
-
}
|
249 |
-
|
250 |
-
/**
|
251 |
-
* Custom post type menu icon url
|
252 |
-
*
|
253 |
-
* @since 2.2
|
254 |
-
* @access public
|
255 |
-
*
|
256 |
-
* @param string $icon_url
|
257 |
-
*
|
258 |
-
* @return string $icon_url
|
259 |
-
*/
|
260 |
-
public function post_type_menu_icon( $icon_url ) {
|
261 |
-
return NIVO_SLIDER_LITE_PLUGIN_URL . 'assets/images/favicon.png';
|
262 |
-
}
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Custom settings page header
|
266 |
-
*
|
267 |
-
* @since 2.2
|
268 |
-
* @access public
|
269 |
-
* @return string
|
270 |
-
*/
|
271 |
-
public function settings_page_header() {
|
272 |
-
return 'Nivo Slider Lite Settings';
|
273 |
-
}
|
274 |
-
|
275 |
-
/**
|
276 |
-
* Custom settings page intro
|
277 |
-
*
|
278 |
-
* @since 2.2
|
279 |
-
* @access public
|
280 |
-
* @return string
|
281 |
-
*/
|
282 |
-
public function settings_intro() {
|
283 |
-
return '';
|
284 |
-
}
|
285 |
-
|
286 |
-
/**
|
287 |
-
* Adds custom settings to the plugin's printed javascript object
|
288 |
-
*
|
289 |
-
* @since 2.2
|
290 |
-
* @access public
|
291 |
-
*
|
292 |
-
* @param array $settings
|
293 |
-
*
|
294 |
-
* @return array $settings
|
295 |
-
*/
|
296 |
-
public function script_settings( $settings ) {
|
297 |
-
$themes = $this->get_themes();
|
298 |
-
$settings['themes'] = $themes;
|
299 |
-
|
300 |
-
return $settings;
|
301 |
-
}
|
302 |
-
|
303 |
-
/**
|
304 |
-
* Custom post meta settings saving logic
|
305 |
-
*
|
306 |
-
* @since 2.2
|
307 |
-
* @access public
|
308 |
-
*
|
309 |
-
* @param array $settings
|
310 |
-
*
|
311 |
-
* @return array $settings
|
312 |
-
*/
|
313 |
-
public function post_meta_save( $settings ) {
|
314 |
-
if ( ! is_numeric( $settings['dim_x'] ) || $settings['dim_x'] <= 0 ) {
|
315 |
-
$settings['dim_x'] = 400;
|
316 |
-
}
|
317 |
-
if ( ! is_numeric( $settings['dim_y'] ) || $settings['dim_y'] <= 0 ) {
|
318 |
-
$settings['dim_y'] = 150;
|
319 |
-
}
|
320 |
-
if ( ! is_numeric( $settings['slices'] ) || $settings['slices'] <= 0 ) {
|
321 |
-
$settings['slices'] = 15;
|
322 |
-
}
|
323 |
-
if ( ! is_numeric( $settings['boxCols'] ) || $settings['boxCols'] <= 0 ) {
|
324 |
-
$settings['boxCols'] = 8;
|
325 |
-
}
|
326 |
-
if ( ! is_numeric( $settings['boxRows'] ) || $settings['boxRows'] <= 0 ) {
|
327 |
-
$settings['boxRows'] = 4;
|
328 |
-
}
|
329 |
-
if ( ! is_numeric( $settings['animSpeed'] ) || $settings['animSpeed'] <= 0 ) {
|
330 |
-
$settings['animSpeed'] = 500;
|
331 |
-
}
|
332 |
-
if ( ! is_numeric( $settings['pauseTime'] ) || $settings['pauseTime'] <= 0 ) {
|
333 |
-
$settings['pauseTime'] = 3000;
|
334 |
-
}
|
335 |
-
if ( ! is_numeric( $settings['startSlide'] ) || $settings['startSlide'] < 0 ) {
|
336 |
-
$settings['startSlide'] = 0;
|
337 |
-
}
|
338 |
-
if ( ! isset( $settings['thumbSizeWidth'] ) || ! is_numeric( $settings['thumbSizeWidth'] ) || $settings['thumbSizeWidth'] <= 0 ) {
|
339 |
-
$settings['thumbSizeWidth'] = 70;
|
340 |
-
}
|
341 |
-
if ( ! isset( $settings['thumbSizeHeight'] ) || ! is_numeric( $settings['thumbSizeHeight'] ) || $settings['thumbSizeHeight'] <= 0 ) {
|
342 |
-
$settings['thumbSizeHeight'] = 50;
|
343 |
-
}
|
344 |
-
|
345 |
-
return $settings;
|
346 |
-
}
|
347 |
-
|
348 |
-
/**
|
349 |
-
* Post edit screen settings
|
350 |
-
*
|
351 |
-
* @since 2.2
|
352 |
-
* @access public
|
353 |
-
*
|
354 |
-
* @param array $settings
|
355 |
-
*
|
356 |
-
* @return array $settings
|
357 |
-
*/
|
358 |
-
public function admin_edit_settings( $settings ) {
|
359 |
-
$settings = array();
|
360 |
-
$settings[] = array(
|
361 |
-
'name' => 'enable_captions',
|
362 |
-
'default' => 'on',
|
363 |
-
'type' => 'checkbox',
|
364 |
-
'title' => __( 'Enable Captions', 'nivo-slider' ),
|
365 |
-
'descp' => __( 'Enable automatic captions from post titles', 'nivo-slider' ),
|
366 |
-
'sub' => true,
|
367 |
-
'tr_class' => 'dev7_captions',
|
368 |
-
);
|
369 |
-
$settings[] = array(
|
370 |
-
'name' => 'number_images',
|
371 |
-
'default' => '',
|
372 |
-
'type' => 'text',
|
373 |
-
'title' => __( 'Number of Images', 'nivo-slider' ),
|
374 |
-
'descp' => __( 'The number of images to use in the slider. Leave blank for all images. External sources default to 20', 'nivo-slider' ),
|
375 |
-
'sub' => true,
|
376 |
-
'tr_class' => 'dev7_non_manual',
|
377 |
-
'reload' => true,
|
378 |
-
);
|
379 |
-
$settings[] = array(
|
380 |
-
'name' => 'sizing',
|
381 |
-
'default' => 'fixed',
|
382 |
-
'type' => 'select',
|
383 |
-
'title' => __( 'Slider Sizing', 'nivo-slider' ),
|
384 |
-
'descp' => '<span class="dev7-pro-feature">' . sprintf( '<strong>%s</strong> %s <a href="%s" target="_blank">%s</a>', __( 'Pro Feature:', 'nivo-slider' ), __( 'Create fully <strong>responsive</strong> sliders.', 'nivo-slider' ), 'https://themeisle.com/plugins/nivo-slider/?utm_source=wp_plugin&utm_medium=upgrade_link&utm_content=size_setting&utm_campaign=' . $this->post_type . '_lite_plugin', __( 'Upgrade to Pro', 'nivo-slider' ) ) . '</span>',
|
385 |
-
'options' => array(
|
386 |
-
'fixed' => __( 'Fixed Size', 'nivo-slider' ),
|
387 |
-
),
|
388 |
-
);
|
389 |
-
$settings[] = array(
|
390 |
-
'name' => 'wp_image_size',
|
391 |
-
'default' => 'full',
|
392 |
-
'type' => 'select',
|
393 |
-
'title' => __( 'Image Size', 'nivo-slider' ),
|
394 |
-
'descp' => __( 'Select the size of image from the WordPress media library', 'nivo-slider' ),
|
395 |
-
'options' => Dev7_Core_Images::get_image_sizes(),
|
396 |
-
'tr_class' => 'wp-image-size',
|
397 |
-
);
|
398 |
-
$settings[] = array(
|
399 |
-
'name' => array( 'dim_x', 'dim_y' ),
|
400 |
-
'default' => array( 400, 150 ),
|
401 |
-
'type' => 'number',
|
402 |
-
'title' => __( 'Slider Size', 'nivo-slider' ),
|
403 |
-
'descp' => __( '(Size in px) Images will be cropped to these dimensions (eg 400 x 150)', 'nivo-slider' ),
|
404 |
-
'connect' => ' x ',
|
405 |
-
'parent' => 'sizing',
|
406 |
-
'visible' => 'fixed',
|
407 |
-
);
|
408 |
-
$settings[] = array(
|
409 |
-
'name' => 'theme',
|
410 |
-
'default' => 'default',
|
411 |
-
'type' => 'select',
|
412 |
-
'title' => __( 'Slider Theme', 'nivo-slider' ),
|
413 |
-
'descp' => '<span class="dev7-pro-feature">' . sprintf( '<strong>%s</strong> %s <a href="%s" target="_blank">%s</a>', __( 'Pro Feature:', 'nivo-slider' ), __( 'Select from our selection of beautiful <strong>pre-built themes</strong> or provide your own.', 'nivo-slider' ), 'https://themeisle.com/plugins/nivo-slider/?utm_source=wp_plugin&utm_medium=upgrade_link&utm_content=themes_setting&utm_campaign=' . $this->post_type . '_lite_plugin', __( 'Upgrade to Pro', 'nivo-slider' ) ) . '</span>',
|
414 |
-
'options' => array(
|
415 |
-
'' => __( 'None', 'nivo-slider' ),
|
416 |
-
'default' => __( 'Nivo Slider Default Theme', 'nivo-slider' ),
|
417 |
-
),
|
418 |
-
);
|
419 |
-
$effects = array(
|
420 |
-
'fade' => __( 'Fade', 'nivo-slider' ),
|
421 |
-
'fold' => __( 'Fold', 'nivo-slider' ),
|
422 |
-
'sliceDown' => __( 'Slice Down', 'nivo-slider' ),
|
423 |
-
'sliceUp' => __( 'Slice Up', 'nivo-slider' ),
|
424 |
-
'sliceUpDown' => __( 'Slice Up/Down', 'nivo-slider' ),
|
425 |
-
);
|
426 |
-
$settings[] = array(
|
427 |
-
'name' => 'effect',
|
428 |
-
'default' => 'fade',
|
429 |
-
'type' => 'select',
|
430 |
-
'title' => __( 'Transition Effect', 'nivo-slider' ),
|
431 |
-
'descp' => '<span class="dev7-pro-feature">' . sprintf( '<strong>%s</strong> %s <a href="%s" target="_blank">%s</a>', __( 'Pro Feature:', 'nivo-slider' ), __( 'Enable all <strong>16 stunning transition effects</strong>.', 'nivo-slider' ), 'https://themeisle.com/plugins/nivo-slider/?utm_source=wp_plugin&utm_medium=upgrade_link&utm_content=transition_setting&utm_campaign=' . $this->post_type . '_lite_plugin', __( 'Upgrade to Pro', 'nivo-slider' ) ) . '</span>',
|
432 |
-
'options' => $effects,
|
433 |
-
);
|
434 |
-
$settings[] = array(
|
435 |
-
'name' => 'slices',
|
436 |
-
'default' => '15',
|
437 |
-
'type' => 'number',
|
438 |
-
'title' => __( 'Slices', 'nivo-slider' ),
|
439 |
-
'descp' => __( 'The number of slices to use in the "Slice" transitions (eg 15)', 'nivo-slider' ),
|
440 |
-
);
|
441 |
-
$settings[] = array(
|
442 |
-
'name' => array( 'boxCols', 'boxRows' ),
|
443 |
-
'default' => array( 8, 4 ),
|
444 |
-
'type' => 'number',
|
445 |
-
'title' => __( 'Box (Cols x Rows)', 'nivo-slider' ),
|
446 |
-
'descp' => __( 'The number of columns and rows to use in the "Box" transitions (eg 8 x 4)', 'nivo-slider' ),
|
447 |
-
'connect' => ' x ',
|
448 |
-
);
|
449 |
-
$settings[] = array(
|
450 |
-
'name' => 'animSpeed',
|
451 |
-
'default' => '500',
|
452 |
-
'type' => 'number',
|
453 |
-
'title' => __( 'Animation Speed', 'nivo-slider' ),
|
454 |
-
'descp' => __( 'The speed of the transition animation in milliseconds (eg 500)', 'nivo-slider' ),
|
455 |
-
);
|
456 |
-
$settings[] = array(
|
457 |
-
'name' => 'controlNavThumbs',
|
458 |
-
'default' => 'off',
|
459 |
-
'type' => 'custom',
|
460 |
-
'title' => __( 'Enable Thumbnail Navigation', 'nivo-slider' ),
|
461 |
-
'descp' => '<span class="dev7-pro-feature">' . sprintf( '<strong>%s</strong> %s <a href="%s" target="_blank">%s</a>', __( 'Pro Feature:', 'nivo-slider' ), __( 'Enable <strong>thumbnail navigation</strong> and control thumb sizes.', 'nivo-slider' ), 'https://themeisle.com/plugins/nivo-slider/?utm_source=wp_plugin&utm_medium=upgrade_link&utm_content=thumbnail_setting&utm_campaign=' . $this->post_type . '_lite_plugin', __( 'Upgrade to Pro', 'nivo-slider' ) ) . '</span>',
|
462 |
-
);
|
463 |
-
$settings[] = array(
|
464 |
-
'name' => 'pauseTime',
|
465 |
-
'default' => '3000',
|
466 |
-
'type' => 'number',
|
467 |
-
'title' => __( 'Pause Time', 'nivo-slider' ),
|
468 |
-
'descp' => __( 'The amount of time to show each slide in milliseconds (eg 3000)', 'nivo-slider' ),
|
469 |
-
);
|
470 |
-
$settings[] = array(
|
471 |
-
'name' => 'startSlide',
|
472 |
-
'default' => '0',
|
473 |
-
'type' => 'number',
|
474 |
-
'title' => __( 'Start Slide', 'nivo-slider' ),
|
475 |
-
'descp' => __( 'Set which slide the slider starts from (zero based index: usually 0)', 'nivo-slider' ),
|
476 |
-
);
|
477 |
-
$settings[] = array(
|
478 |
-
'name' => 'directionNav',
|
479 |
-
'default' => 'on',
|
480 |
-
'type' => 'checkbox',
|
481 |
-
'title' => __( 'Enable Direction Navigation', 'nivo-slider' ),
|
482 |
-
'descp' => __( 'Prev & Next arrows', 'nivo-slider' ),
|
483 |
-
);
|
484 |
-
$settings[] = array(
|
485 |
-
'name' => 'controlNav',
|
486 |
-
'default' => 'on',
|
487 |
-
'type' => 'checkbox',
|
488 |
-
'title' => __( 'Enable Control Navigation', 'nivo-slider' ),
|
489 |
-
'descp' => __( 'eg 1,2,3...', 'nivo-slider' ),
|
490 |
-
);
|
491 |
-
$settings[] = array(
|
492 |
-
'name' => 'imageLink',
|
493 |
-
'default' => 'on',
|
494 |
-
'type' => 'checkbox',
|
495 |
-
'title' => __( 'Enable Images Links', 'nivo-slider' ),
|
496 |
-
'descp' => __( 'If a link has been added to an image when configuring, the image links to the url.', 'nivo-slider' ),
|
497 |
-
);
|
498 |
-
$settings[] = array(
|
499 |
-
'name' => 'targetBlank',
|
500 |
-
'default' => 'on',
|
501 |
-
'type' => 'checkbox',
|
502 |
-
'title' => __( 'Open Links in New Window', 'nivo-slider' ),
|
503 |
-
'descp' => __( 'Open the links in a new window.', 'nivo-slider' ),
|
504 |
-
'parent' => 'imageLink',
|
505 |
-
'visible' => 'on',
|
506 |
-
);
|
507 |
-
$settings[] = array(
|
508 |
-
'name' => 'pauseOnHover',
|
509 |
-
'default' => 'on',
|
510 |
-
'type' => 'checkbox',
|
511 |
-
'title' => __( 'Pause the Slider on Hover', 'nivo-slider' ),
|
512 |
-
);
|
513 |
-
$settings[] = array(
|
514 |
-
'name' => 'manualAdvance',
|
515 |
-
'default' => 'off',
|
516 |
-
'type' => 'checkbox',
|
517 |
-
'title' => __( 'Manual Transitions', 'nivo-slider' ),
|
518 |
-
'descp' => __( 'Slider is always paused', 'nivo-slider' ),
|
519 |
-
);
|
520 |
-
$settings[] = array(
|
521 |
-
'name' => 'randomStart',
|
522 |
-
'default' => 'off',
|
523 |
-
'type' => 'custom',
|
524 |
-
'title' => __( 'Random Start Slide', 'nivo-slider' ),
|
525 |
-
'descp' => '<span class="dev7-pro-feature">' . sprintf( '<strong>%s</strong> %s <a href="%s" target="_blank">%s</a>', __( 'Pro Feature:', 'nivo-slider' ), __( 'Enable <strong>random start slide</strong>.', 'nivo-slider' ), 'https://themeisle.com/plugins/nivo-slider/?utm_source=wp_plugin&utm_medium=upgrade_link&utm_content=random_setting&utm_campaign=' . $this->post_type . '_lite_plugin', __( 'Upgrade to Pro', 'nivo-slider' ) ) . '</span>',
|
526 |
-
);
|
527 |
-
|
528 |
-
return $settings;
|
529 |
-
}
|
530 |
-
|
531 |
-
/**
|
532 |
-
* Get Nivo themes and any custom themes from uploads/nivo-themes/
|
533 |
-
*
|
534 |
-
* @since 2.2
|
535 |
-
* @access private
|
536 |
-
*
|
537 |
-
* @param bool $select
|
538 |
-
*
|
539 |
-
* @return array $themes
|
540 |
-
*/
|
541 |
-
private function get_themes( $select = false ) {
|
542 |
-
$nivo_theme_specs = array(
|
543 |
-
'SkinName' => 'Skin Name',
|
544 |
-
'SkinURI' => 'Skin URI',
|
545 |
-
'Description' => 'Description',
|
546 |
-
'Version' => 'Version',
|
547 |
-
'Author' => 'Author',
|
548 |
-
'AuthorURI' => 'Author URI',
|
549 |
-
'SupportsThumbs' => 'Supports Thumbs',
|
550 |
-
);
|
551 |
-
|
552 |
-
$plugin_themes = glob( NIVO_SLIDER_LITE_PLUGIN_DIR . '/assets/themes/*', GLOB_ONLYDIR );
|
553 |
-
|
554 |
-
$upload_dir = wp_upload_dir();
|
555 |
-
$upload_path = $upload_dir['basedir'];
|
556 |
-
$upload_url = $upload_dir['baseurl'];
|
557 |
-
|
558 |
-
if ( strpos( $upload_path, 'uploads/sites/' ) !== false && is_multisite() ) {
|
559 |
-
$upload_path = substr( $upload_path, 0, strpos( $upload_path, '/sites/' ) );
|
560 |
-
$upload_url = substr( $upload_url, 0, strpos( $upload_url, '/sites/' ) );
|
561 |
-
}
|
562 |
-
$custom_themes = glob( $upload_path . '/nivo-themes/*', GLOB_ONLYDIR );
|
563 |
-
|
564 |
-
if ( ! is_array( $plugin_themes ) ) {
|
565 |
-
$plugin_themes = array();
|
566 |
-
}
|
567 |
-
if ( ! is_array( $custom_themes ) ) {
|
568 |
-
$custom_themes = array();
|
569 |
-
}
|
570 |
-
$nivo_themes = array_merge( $plugin_themes, $custom_themes );
|
571 |
-
|
572 |
-
$themes = array();
|
573 |
-
if ( $nivo_themes ) {
|
574 |
-
foreach ( $nivo_themes as $theme_dir ) {
|
575 |
-
$theme_name = basename( $theme_dir );
|
576 |
-
$theme_path = $theme_dir . '/' . $theme_name . '.css';
|
577 |
-
if ( file_exists( $theme_path ) ) {
|
578 |
-
if ( strpos( $theme_dir, 'uploads/nivo-themes' ) !== false ) {
|
579 |
-
$theme_url = $upload_url . '/nivo-themes/' . $theme_name . '/' . $theme_name . '.css';
|
580 |
-
} else {
|
581 |
-
$theme_url = plugins_url( 'assets/themes/' . $theme_name . '/' . $theme_name . '.css', NIVO_SLIDER_LITE_PLUGIN_FILE );
|
582 |
-
}
|
583 |
-
$themes[ $theme_name ] = array(
|
584 |
-
'theme_name' => $theme_name,
|
585 |
-
'theme_path' => $theme_path,
|
586 |
-
'theme_url' => $theme_url,
|
587 |
-
'theme_details' => get_file_data( $theme_path, $nivo_theme_specs ),
|
588 |
-
);
|
589 |
-
}
|
590 |
-
}
|
591 |
-
}
|
592 |
-
|
593 |
-
if ( $select ) {
|
594 |
-
$options = array();
|
595 |
-
foreach ( $themes as $theme ) {
|
596 |
-
$options[ $theme['theme_name'] ] = $theme['theme_details']['SkinName'];
|
597 |
-
}
|
598 |
-
|
599 |
-
return $options;
|
600 |
-
}
|
601 |
-
|
602 |
-
return $themes;
|
603 |
-
}
|
604 |
-
|
605 |
-
/**
|
606 |
-
* Remove link to the plugin settings on the plugin table list
|
607 |
-
*
|
608 |
-
* @since 2.2
|
609 |
-
* @access public
|
610 |
-
*/
|
611 |
-
public function plugin_action_links( $links, $file ) {
|
612 |
-
if ( basename( $file, '.php' ) == 'nivo-slider-lite' ) {
|
613 |
-
if ( isset( $links[0] ) ) {
|
614 |
-
unset( $links[0] );
|
615 |
-
}
|
616 |
-
}
|
617 |
-
|
618 |
-
return $links;
|
619 |
-
}
|
620 |
-
|
621 |
-
/**
|
622 |
-
* Override the type manual description
|
623 |
-
*/
|
624 |
-
public function manual_type_description() {
|
625 |
-
echo '<span class="dev7-pro-feature">' . sprintf( '<strong>%s</strong> %s <a href="%s" target="_blank">%s</a>', __( 'Pro Feature:', 'nivo-slider' ), __( 'Automatically populate sliders from <strong>posts galleries</strong>, <strong>posts in categories</strong> and <strong>sticky posts</strong>.', 'nivo-slider' ), 'https://themeisle.com/plugins/nivo-slider/?utm_source=wp_plugin&utm_medium=upgrade_link&utm_content=type_setting&utm_campaign=' . $this->post_type . '_lite_plugin', __( 'Upgrade to Pro', 'nivo-slider' ) ) . '</span>';
|
626 |
-
}
|
627 |
-
|
628 |
-
/**
|
629 |
-
* Restrict image sources
|
630 |
-
*
|
631 |
-
* @param $sources
|
632 |
-
*
|
633 |
-
* @return array
|
634 |
-
*/
|
635 |
-
public function get_image_sources( $sources ) {
|
636 |
-
$new_sources = array();
|
637 |
-
$new_sources['manual'] = $sources['manual'];
|
638 |
-
|
639 |
-
return $new_sources;
|
640 |
-
}
|
641 |
-
|
642 |
-
/**
|
643 |
-
* Adds the Upgrade meta box to the edit screen
|
644 |
-
*/
|
645 |
-
public function meta_box_upgrade() {
|
646 |
-
echo '<p>' . __( 'Get more awesome features by upgrading to the full plugin:', 'nivo-slider' ) . '</p>';
|
647 |
-
echo '<ul>';
|
648 |
-
echo '<li>' . __( 'Create sliders from Galleries, Categories and Sticky Posts', 'nivo-slider' ) . '</li>';
|
649 |
-
echo '<li>' . __( 'Responsive sliders', 'nivo-slider' ) . '</li>';
|
650 |
-
echo '<li>' . __( 'Pre-built and custom themes', 'nivo-slider' ) . '</li>';
|
651 |
-
echo '<li>' . __( 'All 16 transition effects', 'nivo-slider' ) . '</li>';
|
652 |
-
echo '<li>' . __( 'Thumbnail navigation', 'nivo-slider' ) . '</li>';
|
653 |
-
echo '<li>' . __( 'Random start slide', 'nivo-slider' ) . '</li>';
|
654 |
-
echo '<li>' . __( 'Nivo Slider Widget', 'nivo-slider' ) . '</li>';
|
655 |
-
echo '<li>' . __( 'Media Manager Plus integration', 'nivo-slider' ) . '</li>';
|
656 |
-
echo '<li>' . __( 'Access to our support Help Desk', 'nivo-slider' ) . '</li>';
|
657 |
-
echo '</ul>';
|
658 |
-
echo '<a href="https://themeisle.com/plugins/nivo-slider/?utm_source=wp_plugin&utm_medium=upgrade_link&utm_content=upgrade_metabox&utm_campaign=' . $this->post_type . '_lite_plugin" target="_blank" class="button-primary">' . __( 'Upgrade Now', 'nivo-slider' ) . '</a>';
|
659 |
-
}
|
660 |
-
|
661 |
-
/**
|
662 |
-
* Custom shortcode plugin output
|
663 |
-
*
|
664 |
-
* @since 2.2
|
665 |
-
* @access public
|
666 |
-
*
|
667 |
-
* @param int $id
|
668 |
-
* @param string $output
|
669 |
-
* @param array $options
|
670 |
-
* @param array $images
|
671 |
-
* @param string $slider_type
|
672 |
-
*
|
673 |
-
* @return string $output
|
674 |
-
*/
|
675 |
-
public function shortcode_output( $id, $output, $options, $images, $slider_type ) {
|
676 |
-
$captions = array();
|
677 |
-
$output .= '<div class="slider-wrapper';
|
678 |
-
if ( isset( $options['theme'] ) && $options['theme'] != '' ) {
|
679 |
-
$output .= ' theme-' . $options['theme'];
|
680 |
-
}
|
681 |
-
if ( isset( $options['controlNavThumbs'] ) && $options['controlNavThumbs'] == 'on' ) {
|
682 |
-
$output .= ' controlnav-thumbs';
|
683 |
-
}
|
684 |
-
$output .= '"><div class="ribbon"></div>';
|
685 |
-
$output .= '<div id="nivoslider-' . $id . '" class="nivoSlider"';
|
686 |
-
if ( $options['sizing'] == 'fixed' ) {
|
687 |
-
$output .= ' style="width:' . $options['dim_x'] . 'px;height:' . $options['dim_y'] . 'px;"';
|
688 |
-
}
|
689 |
-
$output .= '>';
|
690 |
-
$i = 0;
|
691 |
-
foreach ( $images as $image ) {
|
692 |
-
|
693 |
-
$image_link = dev7_default_val( $options, 'imageLink', 'on' );
|
694 |
-
$target_blank = dev7_default_val( $options, 'targetBlank', 'on' );
|
695 |
-
if ( ( isset( $image['post_permalink'] ) && $image['post_permalink'] != '' ) && $image_link == 'on' ) {
|
696 |
-
$target = ( $target_blank == 'on' ) ? ' target="_blank"' : '';
|
697 |
-
$output .= '<a ' . $target . ' href="' . $image['post_permalink'] . '">';
|
698 |
-
}
|
699 |
-
|
700 |
-
if ( $options['sizing'] == 'fixed' && isset( $image['attachment_id'] ) ) {
|
701 |
-
$resized_image = Dev7_Core_Images::resize_image( $image['attachment_id'], '', $options['dim_x'], $options['dim_y'], true );
|
702 |
-
if ( is_wp_error( $resized_image ) ) {
|
703 |
-
echo '<p>Error: ' . $resized_image->get_error_message() . '</p>';
|
704 |
-
$output .= '<img src="" ';
|
705 |
-
} else {
|
706 |
-
$output .= '<img src="' . $resized_image['url'] . '" ';
|
707 |
-
}
|
708 |
-
} else {
|
709 |
-
$output .= '<img src="' . $image['image_src'] . '" ';
|
710 |
-
}
|
711 |
-
|
712 |
-
if ( ( $options['type'] == 'manual' || $options['type'] == 'gallery' ) && isset( $image['post_title'] ) && $image['post_title'] != '' ) {
|
713 |
-
$captions[] = $image['post_title'];
|
714 |
-
$output .= 'title="#nivoslider-' . $id . '-caption-' . $i . '" ';
|
715 |
-
$i++;
|
716 |
-
}
|
717 |
-
if ( ( $options['type'] == 'category' || $options['type'] == 'sticky' || $options['type'] == 'custom' ) && $options['enable_captions'] == 'on' && isset( $image['post_title'] ) && $image['post_title'] != '' ) {
|
718 |
-
$captions[] = $image['post_title'];
|
719 |
-
$output .= 'title="#nivoslider-' . $id . '-caption-' . $i . '" ';
|
720 |
-
$i++;
|
721 |
-
}
|
722 |
-
|
723 |
-
if ( isset( $options['controlNavThumbs'] ) && $options['controlNavThumbs'] == 'on' ) {
|
724 |
-
if ( isset( $image['thumbnail'] ) ) {
|
725 |
-
$output .= 'data-thumb="' . $image['thumbnail'] . '" ';
|
726 |
-
} else {
|
727 |
-
$resized_image = Dev7_Core_Images::resize_image( $image['attachment_id'], '', $options['thumbSizeWidth'], $options['thumbSizeHeight'], true );
|
728 |
-
if ( is_wp_error( $resized_image ) ) {
|
729 |
-
echo '<p>Error: ' . $resized_image->get_error_message() . '</p>';
|
730 |
-
$output .= 'data-thumb="" ';
|
731 |
-
} else {
|
732 |
-
$output .= 'data-thumb="' . $resized_image['url'] . '" ';
|
733 |
-
}
|
734 |
-
}
|
735 |
-
}
|
736 |
-
|
737 |
-
$output .= 'alt="' . __( $image['alt_text'] ) . '" />';
|
738 |
-
if ( isset( $image['post_permalink'] ) && $image['post_permalink'] != '' ) {
|
739 |
-
$output .= '</a>';
|
740 |
-
}
|
741 |
-
}
|
742 |
-
$output .= '</div></div>';
|
743 |
-
|
744 |
-
if ( isset( $options['controlNavThumbs'] ) && 'on' == $options['controlNavThumbs'] ) {
|
745 |
-
|
746 |
-
// Get the height and width.
|
747 |
-
$thumbnail_height = $options['thumbSizeHeight'];
|
748 |
-
$thumbnail_width = $options['thumbSizeWidth'];
|
749 |
-
|
750 |
-
// Force the height/width of thumbnails set in slider settings.
|
751 |
-
$output .= "<style type='text/css' media='screen'> \n";
|
752 |
-
$output .= ".theme-default .nivo-controlNav.nivo-thumbs-enabled img, \n";
|
753 |
-
$output .= ".nivo-thumbs-enabled img { \n";
|
754 |
-
$output .= " width: {$thumbnail_width}px !important; \n";
|
755 |
-
$output .= " height: {$thumbnail_height}px !important; \n";
|
756 |
-
$output .= "} \n";
|
757 |
-
$output .= "</style> \n";
|
758 |
-
}
|
759 |
-
|
760 |
-
$i = 0;
|
761 |
-
foreach ( $captions as $caption ) {
|
762 |
-
$output .= '<div id="nivoslider-' . $id . '-caption-' . $i . '" class="nivo-html-caption">';
|
763 |
-
$output .= __( $caption );
|
764 |
-
$output .= '</div>';
|
765 |
-
$i++;
|
766 |
-
}
|
767 |
-
|
768 |
-
if ( count( $images ) > 1 ) {
|
769 |
-
$output .= '<script type="text/javascript">' . "\n";
|
770 |
-
$output .= 'jQuery(window).load(function(){' . "\n";
|
771 |
-
$output .= ' jQuery("#nivoslider-' . $id . '").nivoSlider({' . "\n";
|
772 |
-
$output .= ' effect:"' . $options['effect'] . '",' . "\n";
|
773 |
-
$output .= ' slices:' . $options['slices'] . ',' . "\n";
|
774 |
-
$output .= ' boxCols:' . $options['boxCols'] . ',' . "\n";
|
775 |
-
$output .= ' boxRows:' . $options['boxRows'] . ',' . "\n";
|
776 |
-
$output .= ' animSpeed:' . $options['animSpeed'] . ',' . "\n";
|
777 |
-
$output .= ' pauseTime:' . $options['pauseTime'] . ',' . "\n";
|
778 |
-
if ( isset( $options['randomStart'] ) && $options['randomStart'] == 'on' ) {
|
779 |
-
$output .= ' startSlide:' . floor( rand( 0, count( $images ) ) ) . ',' . "\n";
|
780 |
-
} else {
|
781 |
-
$output .= ' startSlide:' . $options['startSlide'] . ',' . "\n";
|
782 |
-
}
|
783 |
-
$output .= ' directionNav:' . ( ( $options['directionNav'] == 'on' ) ? 'true' : 'false' ) . ',' . "\n";
|
784 |
-
$output .= ' controlNav:' . ( ( $options['controlNav'] == 'on' ) ? 'true' : 'false' ) . ',' . "\n";
|
785 |
-
$output .= ' controlNavThumbs:' . ( ( isset( $options['controlNavThumbs'] ) && $options['controlNavThumbs'] == 'on' ) ? 'true' : 'false' ) . ',' . "\n";
|
786 |
-
$output .= ' pauseOnHover:' . ( ( $options['pauseOnHover'] == 'on' ) ? 'true' : 'false' ) . ',' . "\n";
|
787 |
-
$output .= ' manualAdvance:' . ( ( $options['manualAdvance'] == 'on' ) ? 'true' : 'false' ) . "\n";
|
788 |
-
$output .= ' });' . "\n";
|
789 |
-
$output .= '});' . "\n";
|
790 |
-
$output .= '</script>' . "\n";
|
791 |
-
} else {
|
792 |
-
$output .= '<script type="text/javascript">' . "\n";
|
793 |
-
$output .= 'jQuery(window).load(function(){' . "\n";
|
794 |
-
$output .= ' jQuery("#nivoslider-' . $id . ' img").css("position","relative").show();' . "\n";
|
795 |
-
$output .= '});' . "\n";
|
796 |
-
$output .= '</script>' . "\n";
|
797 |
-
}
|
798 |
-
|
799 |
-
return $output;
|
800 |
-
}
|
801 |
-
|
802 |
-
}
|
803 |
-
|
804 |
-
/**
|
805 |
-
* Template function to wrap the plugin shortcode
|
806 |
-
*
|
807 |
-
* @since 2.2
|
808 |
-
*
|
809 |
-
* @param mixed $slider
|
810 |
-
* @param bool $return
|
811 |
-
*/
|
812 |
-
if ( ! function_exists( 'nivo_slider' ) ) {
|
813 |
-
function nivo_slider( $slider, $return = false ) {
|
814 |
-
|
815 |
-
$slug = '';
|
816 |
-
$id = 0;
|
817 |
-
|
818 |
-
if ( is_numeric( $slider ) ) {
|
819 |
-
$id = $slider;
|
820 |
-
} else {
|
821 |
-
$slug = $slider;
|
822 |
-
}
|
823 |
-
|
824 |
-
if ( $return ) {
|
825 |
-
return do_shortcode( '[nivoslider slug="' . $slug . '" id="' . $id . '" template="1"]' );
|
826 |
-
} else {
|
827 |
-
echo do_shortcode( '[nivoslider slug="' . $slug . '" id="' . $id . '" template="1"]' );
|
828 |
-
}
|
829 |
-
}
|
830 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
install.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Simple Install
|
2 |
+
1. Login to WordPress and go to Plugins > Add New > Upload
|
3 |
+
2. Upload nivo-slider.zip and activate
|
4 |
+
3. Start adding your sliders in the "Nivo Slider" menu that appears.
|
5 |
+
|
6 |
+
Manual Install
|
7 |
+
1. Upload the nivo-slider folder to your /wp-content/plugins/ directory.
|
8 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
9 |
+
3. Start adding your sliders in the "Nivo Slider" menu that appears.
|
languages/nivo-slider.pot
ADDED
@@ -0,0 +1,607 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2017 ThemeIsle
|
2 |
+
# This file is distributed under the no.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: Slider by Nivo - Responsive Image Slider 1.0.6\n"
|
6 |
+
"Report-Msgid-Bugs-To: https://github.com/Codeinwp/nivo-slider-lite/issues\n"
|
7 |
+
"POT-Creation-Date: 2017-04-26 16:20:10+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: Themeisle Translate Team <friends@themeisle.com>\n"
|
13 |
+
"Language-Team: Themeisle Translate <friends@themeisle.com>\n"
|
14 |
+
"X-Generator: grunt-wp-i18n 0.5.4\n"
|
15 |
+
"X-Poedit-KeywordsList: "
|
16 |
+
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
17 |
+
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
18 |
+
"Language: en\n"
|
19 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
20 |
+
"X-Poedit-Country: United States\n"
|
21 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
22 |
+
"X-Poedit-Basepath: ../\n"
|
23 |
+
"X-Poedit-SearchPath-0: .\n"
|
24 |
+
"X-Poedit-Bookmarks: \n"
|
25 |
+
"X-Textdomain-Support: yes\n"
|
26 |
+
|
27 |
+
#: includes/abstract/class-nivo-model-abstract.php:56
|
28 |
+
msgid "Add New"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: includes/abstract/class-nivo-model-abstract.php:57
|
32 |
+
msgid "Add New %1$s"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: includes/abstract/class-nivo-model-abstract.php:58
|
36 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:59
|
37 |
+
msgid "Edit %1$s"
|
38 |
+
msgstr ""
|
39 |
+
|
40 |
+
#: includes/abstract/class-nivo-model-abstract.php:59
|
41 |
+
msgid "New %1$s"
|
42 |
+
msgstr ""
|
43 |
+
|
44 |
+
#: includes/abstract/class-nivo-model-abstract.php:60
|
45 |
+
msgid "All %2$s"
|
46 |
+
msgstr ""
|
47 |
+
|
48 |
+
#: includes/abstract/class-nivo-model-abstract.php:61
|
49 |
+
msgid "View %1$s"
|
50 |
+
msgstr ""
|
51 |
+
|
52 |
+
#: includes/abstract/class-nivo-model-abstract.php:62
|
53 |
+
msgid "Search %2$s"
|
54 |
+
msgstr ""
|
55 |
+
|
56 |
+
#: includes/abstract/class-nivo-model-abstract.php:63
|
57 |
+
msgid "No %2$s found"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: includes/abstract/class-nivo-model-abstract.php:64
|
61 |
+
msgid "No %2$s found in Trash"
|
62 |
+
msgstr ""
|
63 |
+
|
64 |
+
#: includes/admin/class-nivo-slider-admin.php:91
|
65 |
+
#: includes/admin/class-nivo-slider-admin.php:196
|
66 |
+
#: includes/admin/libs/class-nivo-slider-widget.php:31
|
67 |
+
msgid "Nivo Slider"
|
68 |
+
msgstr ""
|
69 |
+
|
70 |
+
#: includes/admin/class-nivo-slider-admin.php:92
|
71 |
+
msgid "Nivo Sliders"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#: includes/admin/class-nivo-slider-admin.php:261
|
75 |
+
msgid "Save Changes"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: includes/admin/class-nivo-slider-admin.php:290
|
79 |
+
msgid "Management Roles"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: includes/admin/class-nivo-slider-admin.php:491
|
83 |
+
msgid "Active: "
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#: includes/admin/class-nivo-slider-admin.php:493
|
87 |
+
msgid "Deactivate License"
|
88 |
+
msgstr ""
|
89 |
+
|
90 |
+
#: includes/admin/class-nivo-slider-admin.php:498
|
91 |
+
msgid "Activate this license key to enable automatic upgrades"
|
92 |
+
msgstr ""
|
93 |
+
|
94 |
+
#: includes/admin/class-nivo-slider-admin.php:501
|
95 |
+
msgid "Enter a valid license key to enable automatic upgrades"
|
96 |
+
msgstr ""
|
97 |
+
|
98 |
+
#: includes/admin/class-nivo-slider-admin.php:503
|
99 |
+
msgid "Activate License"
|
100 |
+
msgstr ""
|
101 |
+
|
102 |
+
#: includes/admin/class-nivo-slider-admin.php:519
|
103 |
+
#: includes/admin/class-nivo-slider-admin.php:543
|
104 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:279
|
105 |
+
msgid "Settings"
|
106 |
+
msgstr ""
|
107 |
+
|
108 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:66
|
109 |
+
msgid "Enable Captions"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:67
|
113 |
+
msgid "Enable automatic captions from post titles"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:75
|
117 |
+
msgid "Number of Images"
|
118 |
+
msgstr ""
|
119 |
+
|
120 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:76
|
121 |
+
msgid ""
|
122 |
+
"The number of images to use in the slider. Leave blank for all images. "
|
123 |
+
"External sources default to 20"
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:85
|
127 |
+
msgid "Slider Sizing"
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:86
|
131 |
+
msgid "Responsive sliders will fill the width of the container"
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:88
|
135 |
+
msgid "Responsive"
|
136 |
+
msgstr ""
|
137 |
+
|
138 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:89
|
139 |
+
msgid "Fixed Size"
|
140 |
+
msgstr ""
|
141 |
+
|
142 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:96
|
143 |
+
msgid "Image Size"
|
144 |
+
msgstr ""
|
145 |
+
|
146 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:97
|
147 |
+
msgid "Select the size of image from the WordPress media library"
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:105
|
151 |
+
msgid "Slider Size"
|
152 |
+
msgstr ""
|
153 |
+
|
154 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:106
|
155 |
+
msgid "(Size in px) Images will be cropped to these dimensions (eg 400 x 150)"
|
156 |
+
msgstr ""
|
157 |
+
|
158 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:119
|
159 |
+
msgid "Slider Theme"
|
160 |
+
msgstr ""
|
161 |
+
|
162 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:120
|
163 |
+
msgid "Use a pre-built theme or provide your own styles."
|
164 |
+
msgstr ""
|
165 |
+
|
166 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:124
|
167 |
+
msgid "Random"
|
168 |
+
msgstr ""
|
169 |
+
|
170 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:125
|
171 |
+
msgid "Fade"
|
172 |
+
msgstr ""
|
173 |
+
|
174 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:126
|
175 |
+
msgid "Fold"
|
176 |
+
msgstr ""
|
177 |
+
|
178 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:127
|
179 |
+
msgid "Slice Down"
|
180 |
+
msgstr ""
|
181 |
+
|
182 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:128
|
183 |
+
msgid "Slice Down (Left)"
|
184 |
+
msgstr ""
|
185 |
+
|
186 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:129
|
187 |
+
msgid "Slice Up"
|
188 |
+
msgstr ""
|
189 |
+
|
190 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:130
|
191 |
+
msgid "Slice Up (Left)"
|
192 |
+
msgstr ""
|
193 |
+
|
194 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:131
|
195 |
+
msgid "Slice Up/Down"
|
196 |
+
msgstr ""
|
197 |
+
|
198 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:132
|
199 |
+
msgid "Slice Up/Down (Left)"
|
200 |
+
msgstr ""
|
201 |
+
|
202 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:133
|
203 |
+
msgid "Slide In (Right)"
|
204 |
+
msgstr ""
|
205 |
+
|
206 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:134
|
207 |
+
msgid "Slide In (Left)"
|
208 |
+
msgstr ""
|
209 |
+
|
210 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:135
|
211 |
+
msgid "Box Random"
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:136
|
215 |
+
msgid "Box Rain"
|
216 |
+
msgstr ""
|
217 |
+
|
218 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:137
|
219 |
+
msgid "Box Rain (Reverse)"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:138
|
223 |
+
msgid "Box Rain Grow"
|
224 |
+
msgstr ""
|
225 |
+
|
226 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:139
|
227 |
+
msgid "Box Rain Grow (Reverse)"
|
228 |
+
msgstr ""
|
229 |
+
|
230 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:145
|
231 |
+
msgid "Transition Effect"
|
232 |
+
msgstr ""
|
233 |
+
|
234 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:152
|
235 |
+
msgid "Slices"
|
236 |
+
msgstr ""
|
237 |
+
|
238 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:153
|
239 |
+
msgid "The number of slices to use in the \"Slice\" transitions (eg 15)"
|
240 |
+
msgstr ""
|
241 |
+
|
242 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:159
|
243 |
+
msgid "Box (Cols x Rows)"
|
244 |
+
msgstr ""
|
245 |
+
|
246 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:160
|
247 |
+
msgid "The number of columns and rows to use in the \"Box\" transitions (eg 8 x 4)"
|
248 |
+
msgstr ""
|
249 |
+
|
250 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:167
|
251 |
+
msgid "Animation Speed"
|
252 |
+
msgstr ""
|
253 |
+
|
254 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:168
|
255 |
+
msgid "The speed of the transition animation in milliseconds (eg 500)"
|
256 |
+
msgstr ""
|
257 |
+
|
258 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:174
|
259 |
+
msgid "Enable Thumbnail Navigation"
|
260 |
+
msgstr ""
|
261 |
+
|
262 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:181
|
263 |
+
msgid "Thumbnail Size"
|
264 |
+
msgstr ""
|
265 |
+
|
266 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:182
|
267 |
+
msgid "The width and height of the thumbnails"
|
268 |
+
msgstr ""
|
269 |
+
|
270 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:190
|
271 |
+
msgid "Pause Time"
|
272 |
+
msgstr ""
|
273 |
+
|
274 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:191
|
275 |
+
msgid "The amount of time to show each slide in milliseconds (eg 3000)"
|
276 |
+
msgstr ""
|
277 |
+
|
278 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:197
|
279 |
+
msgid "Start Slide"
|
280 |
+
msgstr ""
|
281 |
+
|
282 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:198
|
283 |
+
msgid "Set which slide the slider starts from (zero based index: usually 0)"
|
284 |
+
msgstr ""
|
285 |
+
|
286 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:204
|
287 |
+
msgid "Enable Direction Navigation"
|
288 |
+
msgstr ""
|
289 |
+
|
290 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:205
|
291 |
+
msgid "Prev & Next arrows"
|
292 |
+
msgstr ""
|
293 |
+
|
294 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:211
|
295 |
+
msgid "Enable Control Navigation"
|
296 |
+
msgstr ""
|
297 |
+
|
298 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:212
|
299 |
+
msgid "eg 1,2,3..."
|
300 |
+
msgstr ""
|
301 |
+
|
302 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:218
|
303 |
+
msgid "Enable Images Links"
|
304 |
+
msgstr ""
|
305 |
+
|
306 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:219
|
307 |
+
msgid ""
|
308 |
+
"If a link has been added to an image when configuring, the image links to "
|
309 |
+
"the url."
|
310 |
+
msgstr ""
|
311 |
+
|
312 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:225
|
313 |
+
msgid "Open Links in New Window"
|
314 |
+
msgstr ""
|
315 |
+
|
316 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:226
|
317 |
+
msgid "Open the links in a new window."
|
318 |
+
msgstr ""
|
319 |
+
|
320 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:234
|
321 |
+
msgid "Pause the Slider on Hover"
|
322 |
+
msgstr ""
|
323 |
+
|
324 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:240
|
325 |
+
msgid "Manual Transitions"
|
326 |
+
msgstr ""
|
327 |
+
|
328 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:241
|
329 |
+
msgid "Slider is always paused"
|
330 |
+
msgstr ""
|
331 |
+
|
332 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:247
|
333 |
+
msgid "Random Start Slide"
|
334 |
+
msgstr ""
|
335 |
+
|
336 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:248
|
337 |
+
msgid "Overrides Start Slide value"
|
338 |
+
msgstr ""
|
339 |
+
|
340 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:273
|
341 |
+
msgid "%1$s Images"
|
342 |
+
msgstr ""
|
343 |
+
|
344 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:286
|
345 |
+
msgid "Using this %1$s"
|
346 |
+
msgstr ""
|
347 |
+
|
348 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:292
|
349 |
+
msgid "Useful Links"
|
350 |
+
msgstr ""
|
351 |
+
|
352 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:307
|
353 |
+
msgid "To use this %1$s in your posts or pages use the following shortcode:"
|
354 |
+
msgstr ""
|
355 |
+
|
356 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:313
|
357 |
+
msgid "To use this %1$s in a theme template file use the following code:"
|
358 |
+
msgstr ""
|
359 |
+
|
360 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:329
|
361 |
+
msgid "Website:"
|
362 |
+
msgstr ""
|
363 |
+
|
364 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:330
|
365 |
+
msgid "Created by:"
|
366 |
+
msgstr ""
|
367 |
+
|
368 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:332
|
369 |
+
msgid "Support:"
|
370 |
+
msgstr ""
|
371 |
+
|
372 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:334
|
373 |
+
msgid "Documentation:"
|
374 |
+
msgstr ""
|
375 |
+
|
376 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:335
|
377 |
+
msgid "Changelog:"
|
378 |
+
msgstr ""
|
379 |
+
|
380 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:369
|
381 |
+
msgid "%1$s Type"
|
382 |
+
msgstr ""
|
383 |
+
|
384 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:385
|
385 |
+
msgid "No Sources"
|
386 |
+
msgstr ""
|
387 |
+
|
388 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:390
|
389 |
+
msgid "Choose to manually upload images or use images from the media library."
|
390 |
+
msgstr ""
|
391 |
+
|
392 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:394
|
393 |
+
msgid ""
|
394 |
+
"You can add images from external sources and use them as feeds with our "
|
395 |
+
"free plugin %1$s Media Manager Plus %2$s"
|
396 |
+
msgstr ""
|
397 |
+
|
398 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:396
|
399 |
+
msgid "Connect more sources using %1$s Media Manager Plus %2$s"
|
400 |
+
msgstr ""
|
401 |
+
|
402 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:404
|
403 |
+
msgid "Gallery Location"
|
404 |
+
msgstr ""
|
405 |
+
|
406 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:434
|
407 |
+
msgid "Select the post gallery you want to use"
|
408 |
+
msgstr ""
|
409 |
+
|
410 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:438
|
411 |
+
#: includes/admin/libs/class-nivo-core-images.php:74
|
412 |
+
msgid "Category"
|
413 |
+
msgstr ""
|
414 |
+
|
415 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:454
|
416 |
+
msgid "Select the category you want to use for post thumbnails"
|
417 |
+
msgstr ""
|
418 |
+
|
419 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:458
|
420 |
+
#: includes/admin/libs/class-nivo-core-images.php:85
|
421 |
+
msgid "Custom Post Type"
|
422 |
+
msgstr ""
|
423 |
+
|
424 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:477
|
425 |
+
msgid "Select the custom post type you want to use for post thumbnails"
|
426 |
+
msgstr ""
|
427 |
+
|
428 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:702
|
429 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:142
|
430 |
+
msgid "Title"
|
431 |
+
msgstr ""
|
432 |
+
|
433 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:703
|
434 |
+
msgid "Shortcode"
|
435 |
+
msgstr ""
|
436 |
+
|
437 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:704
|
438 |
+
msgid "Source"
|
439 |
+
msgstr ""
|
440 |
+
|
441 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:705
|
442 |
+
msgid "Type"
|
443 |
+
msgstr ""
|
444 |
+
|
445 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:706
|
446 |
+
msgid "Images"
|
447 |
+
msgstr ""
|
448 |
+
|
449 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:707
|
450 |
+
msgid "Author"
|
451 |
+
msgstr ""
|
452 |
+
|
453 |
+
#: includes/admin/libs/class-nivo-core-admin-edit.php:708
|
454 |
+
msgid "Date"
|
455 |
+
msgstr ""
|
456 |
+
|
457 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:55
|
458 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:56
|
459 |
+
msgid "Create %1$s"
|
460 |
+
msgstr ""
|
461 |
+
|
462 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:57
|
463 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:58
|
464 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:64
|
465 |
+
msgid "Add to %1$s"
|
466 |
+
msgstr ""
|
467 |
+
|
468 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:60
|
469 |
+
msgid "Save %1$s"
|
470 |
+
msgstr ""
|
471 |
+
|
472 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:61
|
473 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:67
|
474 |
+
msgid "Update %1$s"
|
475 |
+
msgstr ""
|
476 |
+
|
477 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:62
|
478 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:90
|
479 |
+
msgid "Slide Details"
|
480 |
+
msgstr ""
|
481 |
+
|
482 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:66
|
483 |
+
msgid "Add from "
|
484 |
+
msgstr ""
|
485 |
+
|
486 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:93
|
487 |
+
msgid "Saved."
|
488 |
+
msgstr ""
|
489 |
+
|
490 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:111
|
491 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:137
|
492 |
+
msgid "Caption"
|
493 |
+
msgstr ""
|
494 |
+
|
495 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:116
|
496 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:147
|
497 |
+
msgid "Alt Text"
|
498 |
+
msgstr ""
|
499 |
+
|
500 |
+
#: includes/admin/libs/class-nivo-core-admin-images.php:121
|
501 |
+
msgid "Link"
|
502 |
+
msgstr ""
|
503 |
+
|
504 |
+
#: includes/admin/libs/class-nivo-core-images.php:72
|
505 |
+
msgid "Manual"
|
506 |
+
msgstr ""
|
507 |
+
|
508 |
+
#: includes/admin/libs/class-nivo-core-images.php:73
|
509 |
+
msgid "Gallery"
|
510 |
+
msgstr ""
|
511 |
+
|
512 |
+
#: includes/admin/libs/class-nivo-core-images.php:75
|
513 |
+
msgid "Sticky Posts"
|
514 |
+
msgstr ""
|
515 |
+
|
516 |
+
#: includes/admin/libs/class-nivo-core-images.php:406
|
517 |
+
msgid "File doesn't exist"
|
518 |
+
msgstr ""
|
519 |
+
|
520 |
+
#: includes/admin/libs/class-nivo-core-model.php:46
|
521 |
+
#: includes/admin/libs/class-nivo-core-model.php:49
|
522 |
+
msgid "%1$s updated."
|
523 |
+
msgstr ""
|
524 |
+
|
525 |
+
#: includes/admin/libs/class-nivo-core-model.php:47
|
526 |
+
msgid "Custom field updated."
|
527 |
+
msgstr ""
|
528 |
+
|
529 |
+
#: includes/admin/libs/class-nivo-core-model.php:48
|
530 |
+
msgid "Custom field deleted."
|
531 |
+
msgstr ""
|
532 |
+
|
533 |
+
#: includes/admin/libs/class-nivo-core-model.php:51
|
534 |
+
msgid "%1$s published."
|
535 |
+
msgstr ""
|
536 |
+
|
537 |
+
#: includes/admin/libs/class-nivo-core-model.php:52
|
538 |
+
msgid "%1$s saved."
|
539 |
+
msgstr ""
|
540 |
+
|
541 |
+
#: includes/admin/libs/class-nivo-core-model.php:53
|
542 |
+
msgid "%1$s submitted."
|
543 |
+
msgstr ""
|
544 |
+
|
545 |
+
#: includes/admin/libs/class-nivo-core-model.php:54
|
546 |
+
msgid ""
|
547 |
+
"%1$s scheduled for: <strong>%2$s</strong>. <a target=\"_blank\" "
|
548 |
+
"href=\"%2$s\">Preview %1$s</a>"
|
549 |
+
msgstr ""
|
550 |
+
|
551 |
+
#: includes/admin/libs/class-nivo-core-model.php:55
|
552 |
+
msgid "%1$s draft updated."
|
553 |
+
msgstr ""
|
554 |
+
|
555 |
+
#: includes/admin/libs/class-nivo-core-model.php:60
|
556 |
+
msgid "M j, Y @ G:i"
|
557 |
+
msgstr ""
|
558 |
+
|
559 |
+
#: includes/admin/libs/class-nivo-core-model.php:64
|
560 |
+
msgid "%1$s restored to revision from %2$s"
|
561 |
+
msgstr ""
|
562 |
+
|
563 |
+
#: includes/admin/libs/class-nivo-core-shortcode.php:114
|
564 |
+
msgid "Invalid %1$s"
|
565 |
+
msgstr ""
|
566 |
+
|
567 |
+
#: includes/admin/libs/class-nivo-core-shortcode.php:122
|
568 |
+
msgid "Invalid %1$s Slug"
|
569 |
+
msgstr ""
|
570 |
+
|
571 |
+
#: includes/admin/libs/class-nivo-slider-widget.php:33
|
572 |
+
msgid "Display a Nivo Slider"
|
573 |
+
msgstr ""
|
574 |
+
|
575 |
+
#: includes/admin/libs/class-nivo-slider-widget.php:104
|
576 |
+
msgid "Title:"
|
577 |
+
msgstr ""
|
578 |
+
|
579 |
+
#: includes/admin/libs/class-nivo-slider-widget.php:119
|
580 |
+
msgid "Select Slider"
|
581 |
+
msgstr ""
|
582 |
+
|
583 |
+
#: vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php:453
|
584 |
+
msgid ""
|
585 |
+
"Updating this theme will lose any customizations you have made. Cancel to "
|
586 |
+
"stop, OK to update."
|
587 |
+
msgstr ""
|
588 |
+
|
589 |
+
#. Plugin Name of the plugin/theme
|
590 |
+
msgid "Slider by Nivo - Responsive Image Slider"
|
591 |
+
msgstr ""
|
592 |
+
|
593 |
+
#. Plugin URI of the plugin/theme
|
594 |
+
msgid "https://themeisle.com/plugins/nivo-slider-lite"
|
595 |
+
msgstr ""
|
596 |
+
|
597 |
+
#. Description of the plugin/theme
|
598 |
+
msgid "Nivo Slider is The Most Popular And Easiest to Use WordPress Slider Plugin."
|
599 |
+
msgstr ""
|
600 |
+
|
601 |
+
#. Author of the plugin/theme
|
602 |
+
msgid "ThemeIsle"
|
603 |
+
msgstr ""
|
604 |
+
|
605 |
+
#. Author URI of the plugin/theme
|
606 |
+
msgid "https://themeisle.com/"
|
607 |
+
msgstr ""
|
nivo-slider-lite.php
CHANGED
@@ -3,81 +3,137 @@
|
|
3 |
* Plugin Name: Slider by Nivo - Responsive Image Slider
|
4 |
* Plugin URI: https://themeisle.com/plugins/nivo-slider-lite
|
5 |
* Description: Nivo Slider is The Most Popular And Easiest to Use WordPress Slider Plugin.
|
6 |
-
* Version:
|
7 |
* Author: ThemeIsle
|
8 |
* Author URI: https://themeisle.com/
|
9 |
* Text Domain: nivo-slider
|
10 |
* Domain Path: languages
|
|
|
|
|
11 |
**/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
16 |
}
|
17 |
|
|
|
|
|
18 |
/**
|
19 |
-
*
|
|
|
|
|
|
|
20 |
*/
|
21 |
-
class
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
*/
|
29 |
-
private $version = '1.0.5';
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
34 |
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
if ( class_exists( 'WordPress_Nivo_Slider' ) ) {
|
40 |
-
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
41 |
-
if ( is_plugin_active( 'nivo-slider/nivo-slider.php' ) ) {
|
42 |
-
return;
|
43 |
}
|
44 |
-
|
|
|
|
|
45 |
|
46 |
-
|
|
|
|
|
47 |
}
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
*/
|
52 |
-
private function setup_constants() {
|
53 |
-
// Plugin Folder Path
|
54 |
-
if ( ! defined( 'NIVO_SLIDER_LITE_PLUGIN_DIR' ) ) {
|
55 |
-
define( 'NIVO_SLIDER_LITE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
56 |
-
}
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
-
|
64 |
-
if ( ! defined( 'NIVO_SLIDER_LITE_PLUGIN_FILE' ) ) {
|
65 |
-
define( 'NIVO_SLIDER_LITE_PLUGIN_FILE', __FILE__ );
|
66 |
-
}
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Load core plugin files
|
76 |
-
*/
|
77 |
-
private function loader() {
|
78 |
-
require_once NIVO_SLIDER_LITE_PLUGIN_DIR . 'includes/plugin.php';
|
79 |
}
|
80 |
}
|
81 |
-
|
82 |
-
// Let's go!
|
83 |
-
$WordPress_Nivo_Slider_Lite = new WordPress_Nivo_Slider_Lite();
|
3 |
* Plugin Name: Slider by Nivo - Responsive Image Slider
|
4 |
* Plugin URI: https://themeisle.com/plugins/nivo-slider-lite
|
5 |
* Description: Nivo Slider is The Most Popular And Easiest to Use WordPress Slider Plugin.
|
6 |
+
* Version: 2.0.0
|
7 |
* Author: ThemeIsle
|
8 |
* Author URI: https://themeisle.com/
|
9 |
* Text Domain: nivo-slider
|
10 |
* Domain Path: languages
|
11 |
+
* WordPress Available: yes
|
12 |
+
* Requires License: no
|
13 |
**/
|
14 |
+
// If this file is called directly, abort.
|
15 |
+
if ( ! defined( 'WPINC' ) ) {
|
16 |
+
die;
|
17 |
+
}
|
18 |
+
/**
|
19 |
+
* The code that runs during plugin activation.
|
20 |
+
* This action is documented in includes/class-nivo-slider-activator.php
|
21 |
+
*/
|
22 |
+
function activate_nivo_slider() {
|
23 |
+
Nivo_Slider_Activator::activate();
|
24 |
+
}
|
25 |
|
26 |
+
/**
|
27 |
+
* The code that runs during plugin deactivation.
|
28 |
+
* This action is documented in includes/class-nivo-slider-deactivator.php
|
29 |
+
*/
|
30 |
+
function deactivate_nivo_slider() {
|
31 |
+
Nivo_Slider_Deactivator::deactivate();
|
32 |
}
|
33 |
|
34 |
+
register_activation_hook( __FILE__, 'activate_nivo_slider' );
|
35 |
+
register_deactivation_hook( __FILE__, 'deactivate_nivo_slider' );
|
36 |
/**
|
37 |
+
* The core plugin class that is used to define internationalization,
|
38 |
+
* admin-specific hooks, and public-facing site hooks.
|
39 |
+
*
|
40 |
+
* @since 3.0.0
|
41 |
*/
|
42 |
+
function nivo_slider_autoload( $class ) {
|
43 |
+
$namespaces = array( 'Nivo_Slider', 'Nivo_Core', 'Nivo' );
|
44 |
+
foreach ( $namespaces as $namespace ) {
|
45 |
+
if ( substr( $class, 0, strlen( $namespace ) ) == $namespace ) {
|
46 |
+
$filename = plugin_dir_path( __FILE__ ) . 'includes/class-' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
|
47 |
+
if ( is_readable( $filename ) ) {
|
48 |
+
require_once $filename;
|
49 |
|
50 |
+
return true;
|
51 |
+
}
|
52 |
+
$filename = plugin_dir_path( __FILE__ ) . 'includes/abstract/class-' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
|
53 |
+
if ( is_readable( $filename ) ) {
|
54 |
+
require_once $filename;
|
|
|
|
|
55 |
|
56 |
+
return true;
|
57 |
+
}
|
58 |
+
$filename = plugin_dir_path( __FILE__ ) . 'includes/interface/class-' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
|
59 |
+
if ( is_readable( $filename ) ) {
|
60 |
+
require_once $filename;
|
61 |
|
62 |
+
return true;
|
63 |
+
}
|
64 |
+
$filename = plugin_dir_path( __FILE__ ) . 'includes/admin/class-' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
|
65 |
+
if ( is_readable( $filename ) ) {
|
66 |
+
require_once $filename;
|
67 |
|
68 |
+
return true;
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
+
$filename = plugin_dir_path( __FILE__ ) . 'includes/admin/libs/class-' . str_replace( '_', '-', strtolower( $class ) ) . '.php';
|
71 |
+
if ( is_readable( $filename ) ) {
|
72 |
+
require_once $filename;
|
73 |
|
74 |
+
return true;
|
75 |
+
}
|
76 |
+
}
|
77 |
}
|
78 |
|
79 |
+
return false;
|
80 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
+
/**
|
83 |
+
* Begins execution of the plugin.
|
84 |
+
*
|
85 |
+
* Since everything within the plugin is registered via hooks,
|
86 |
+
* then kicking off the plugin from this point in the file does
|
87 |
+
* not affect the page life cycle.
|
88 |
+
*
|
89 |
+
* @since 3.0.0
|
90 |
+
*/
|
91 |
+
function run_nivo_slider() {
|
92 |
+
// Plugin Folder Path
|
93 |
+
if ( ! defined( 'NIVO_SLIDER_PLUGIN_DIR' ) ) {
|
94 |
+
define( 'NIVO_SLIDER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
95 |
+
}
|
96 |
+
// Plugin Folder URL
|
97 |
+
if ( ! defined( 'NIVO_SLIDER_PLUGIN_URL' ) ) {
|
98 |
+
define( 'NIVO_SLIDER_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
99 |
+
}
|
100 |
+
// Plugin Root File
|
101 |
+
if ( ! defined( 'NIVO_SLIDER_PLUGIN_FILE' ) ) {
|
102 |
+
define( 'NIVO_SLIDER_PLUGIN_FILE', __FILE__ );
|
103 |
+
}
|
104 |
+
// Plugin Basename
|
105 |
+
if ( ! defined( 'NIVO_SLIDER_PLUGIN_BASENAME' ) ) {
|
106 |
+
define( 'NIVO_SLIDER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
107 |
+
}
|
108 |
+
if ( ! defined( 'NIVO_PRO_UPSELL' ) ) {
|
109 |
+
define( 'NIVO_PRO_UPSELL', 'https://themeisle.com/plugins/nivo-slider' );
|
110 |
+
}
|
111 |
+
// Developer URL
|
112 |
+
$plugin = new Nivo_Slider();
|
113 |
+
$plugin->run();
|
114 |
+
$vendor_file = NIVO_SLIDER_PLUGIN_DIR . '/vendor/autoload_52.php';
|
115 |
+
if ( is_readable( $vendor_file ) ) {
|
116 |
+
require_once $vendor_file;
|
117 |
+
ThemeIsle_SDK_Loader::init_product( NIVO_SLIDER_PLUGIN_FILE );
|
118 |
+
}
|
119 |
|
120 |
+
}
|
|
|
|
|
|
|
121 |
|
122 |
+
spl_autoload_register( 'nivo_slider_autoload' );
|
123 |
+
run_nivo_slider();
|
124 |
+
if ( ! function_exists( 'nivo_slider' ) ) {
|
125 |
+
function nivo_slider( $slider, $return = false ) {
|
126 |
+
$slug = '';
|
127 |
+
$id = 0;
|
128 |
+
if ( is_numeric( $slider ) ) {
|
129 |
+
$id = $slider;
|
130 |
+
} else {
|
131 |
+
$slug = $slider;
|
132 |
+
}
|
133 |
+
if ( $return ) {
|
134 |
+
return do_shortcode( '[nivoslider slug="' . $slug . '" id="' . $id . '" template="1"]' );
|
135 |
+
} else {
|
136 |
+
echo do_shortcode( '[nivoslider slug="' . $slug . '" id="' . $id . '" template="1"]' );
|
137 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
}
|
|
|
|
|
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: themeisle, codeinwp, nivoslider
|
3 |
Tags: image, slider, nivo,slider plugin, slideshow, slideshow plugin, template tag, wordpress gallery, wordpress image slider, wordpress photo gallery, wordpress picture gallery, wordpress picture slider, wordpress responsive slider, wordpress slider, wordpress slider plugin, wordpress slideshow, wp slider
|
4 |
Requires at least: 3.0
|
5 |
-
Tested up to: 4.7.
|
6 |
Stable tag: trunk
|
7 |
License: GPLv3
|
8 |
|
@@ -22,15 +22,23 @@ Nivo Slider is the best choice for a WordPress slider plugin because it is fast,
|
|
22 |
**Get more awesome features by upgrading to the full plugin:**
|
23 |
|
24 |
* Create sliders from **Galleries, Categories and Sticky Posts**
|
25 |
-
* **
|
26 |
-
*
|
27 |
-
*
|
28 |
-
*
|
29 |
-
*
|
30 |
-
* Nivo Slider **Widget**
|
31 |
|
32 |
**[Click here to purchase the full plugin](https://themeisle.com/plugins/nivo-slider?utm_source=wordpress.org&utm_medium=web&utm_content=purchase_link&utm_campaign=nivoslider_lite_plugin)**
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
== Installation ==
|
35 |
|
36 |
1. Use WordPress' built-in installer
|
@@ -38,6 +46,13 @@ Nivo Slider is the best choice for a WordPress slider plugin because it is fast,
|
|
38 |
|
39 |
== Frequently Asked Questions ==
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
= I'd like access to more features and support. How can I get them? =
|
42 |
|
43 |
You can get access to more features and support by visiting the Themeisle website and
|
@@ -53,6 +68,12 @@ Purchasing a license gets you access to the full version of the Nivo Slider Word
|
|
53 |
|
54 |
== Changelog ==
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
= 1.0.3 =
|
57 |
* Added themeisle as author
|
58 |
|
2 |
Contributors: themeisle, codeinwp, nivoslider
|
3 |
Tags: image, slider, nivo,slider plugin, slideshow, slideshow plugin, template tag, wordpress gallery, wordpress image slider, wordpress photo gallery, wordpress picture gallery, wordpress picture slider, wordpress responsive slider, wordpress slider, wordpress slider plugin, wordpress slideshow, wp slider
|
4 |
Requires at least: 3.0
|
5 |
+
Tested up to: 4.7.4
|
6 |
Stable tag: trunk
|
7 |
License: GPLv3
|
8 |
|
22 |
**Get more awesome features by upgrading to the full plugin:**
|
23 |
|
24 |
* Create sliders from **Galleries, Categories and Sticky Posts**
|
25 |
+
* More custom **themes**
|
26 |
+
* Upcoming carousels builders support.
|
27 |
+
* Upcoming lightboxes support.
|
28 |
+
* Automatic updates.
|
29 |
+
* Priority support.
|
|
|
30 |
|
31 |
**[Click here to purchase the full plugin](https://themeisle.com/plugins/nivo-slider?utm_source=wordpress.org&utm_medium=web&utm_content=purchase_link&utm_campaign=nivoslider_lite_plugin)**
|
32 |
|
33 |
+
= See how Nivo can integrate with your website =
|
34 |
+
|
35 |
+
* [ Slider with bar using fading transition ](https://demo.themeisle.com/nivo-slider/slider-bar-fade)
|
36 |
+
* [ Dark slider with slice transition ](https://demo.themeisle.com/nivo-slider/slider-dark-slice/)
|
37 |
+
* [ Light slider with box transition ](https://demo.themeisle.com/nivo-slider/slider-light-box/)
|
38 |
+
* [ Slider with thumbnail navigation ](https://demo.themeisle.com/nivo-slider/slider-thumbnail/)
|
39 |
+
* [ Slider from category ](https://demo.themeisle.com/nivo-slider/slider-category/)
|
40 |
+
* [ Slider from gallery posts ](https://demo.themeisle.com/nivo-slider/slider-gallery/)
|
41 |
+
|
42 |
== Installation ==
|
43 |
|
44 |
1. Use WordPress' built-in installer
|
46 |
|
47 |
== Frequently Asked Questions ==
|
48 |
|
49 |
+
= How to use Custom Themes with the Nivo Slider =
|
50 |
+
http://docs.themeisle.com/article/510-using-custom-themes-with-the-nivo-slider
|
51 |
+
|
52 |
+
= How to use Nivo Slider template tag =
|
53 |
+
http://docs.themeisle.com/article/509-using-the-nivo-slider-template-tag
|
54 |
+
|
55 |
+
|
56 |
= I'd like access to more features and support. How can I get them? =
|
57 |
|
58 |
You can get access to more features and support by visiting the Themeisle website and
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
= 2.0.0 =
|
72 |
+
* Added more slider themes.
|
73 |
+
* Added responsive option.
|
74 |
+
* Added more transition effects.
|
75 |
+
* Major code refactor.
|
76 |
+
|
77 |
= 1.0.3 =
|
78 |
* Added themeisle as author
|
79 |
|
vendor/autoload.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInit7c7a15af9bab5b69940c5ab4b91d2536::getLoader();
|
vendor/autoload_52.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_52.php generated by xrstf/composer-php52
|
4 |
+
|
5 |
+
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInit36ec794f10e28898f33db6b7d2252402::getLoader();
|
vendor/codeinwp/themeisle-sdk/LICENSE
ADDED
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
{one line to give the program's name and a brief idea of what it does.}
|
635 |
+
Copyright (C) {year} {name of author}
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
{project} Copyright (C) {year} {fullname}
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<http://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
vendor/codeinwp/themeisle-sdk/README.md
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
# themeisle-sdk
|
2 |
+
ThemeIsle SDK library
|
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php
ADDED
@@ -0,0 +1,660 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The main loader class for license handling.
|
4 |
+
*
|
5 |
+
* @package ThemeIsleSDK
|
6 |
+
* @subpackage Licenser
|
7 |
+
* @copyright Copyright (c) 2017, Marius Cristea
|
8 |
+
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
9 |
+
* @since 1.0.0
|
10 |
+
*/
|
11 |
+
if ( ! class_exists( 'ThemeIsle_SDK_Licenser' ) ) :
|
12 |
+
/**
|
13 |
+
* Class ThemeIsle_SDK_Licenser
|
14 |
+
*
|
15 |
+
* Used to update the themeisle products
|
16 |
+
*/
|
17 |
+
class ThemeIsle_SDK_Licenser {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var string $license_key The license key string
|
21 |
+
*/
|
22 |
+
public $license_key;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var bool $do_check This ensures that the custom API request only runs on the second time that WP fires the update check
|
26 |
+
*/
|
27 |
+
private $do_check = false;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var bool $failed_checks Number of failed checks to the api endpoint
|
31 |
+
*/
|
32 |
+
private $failed_checks = 0;
|
33 |
+
/**
|
34 |
+
* @var ThemeIsle_SDK_Product $product The ThemeIsle Product.
|
35 |
+
*/
|
36 |
+
private $product;
|
37 |
+
/**
|
38 |
+
* @var string $product_key The product update response key.
|
39 |
+
*/
|
40 |
+
private $product_key;
|
41 |
+
/**
|
42 |
+
* @var int $max_failed Maximum failed checks allowed before show the notice
|
43 |
+
*/
|
44 |
+
private static $max_failed = 5;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* ThemeIsle_SDK_Licenser constructor.
|
48 |
+
*
|
49 |
+
* @param ThemeIsle_SDK_Product $product The product object.
|
50 |
+
*/
|
51 |
+
public function __construct( $product ) {
|
52 |
+
$this->product = $product;
|
53 |
+
$this->product_key = $this->product->get_key() . '-update-response';
|
54 |
+
if ( ! $this->product->requires_license() ) {
|
55 |
+
$this->license_key = 'free';
|
56 |
+
} else {
|
57 |
+
$license_data = get_option( $this->product->get_key() . '_license_data', '' );
|
58 |
+
$this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
|
59 |
+
if ( $license_data !== '' ) {
|
60 |
+
$this->license_key = isset( $license_data->key ) ? $license_data->key : get_option( $this->product->get_key() . '_license', '' );
|
61 |
+
} else {
|
62 |
+
$this->license_key = get_option( $this->product->get_key() . '_license', '' );
|
63 |
+
}
|
64 |
+
$this->register_license_hooks();
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Register license hooks for the themeisle products
|
70 |
+
*/
|
71 |
+
public function register_license_hooks() {
|
72 |
+
add_action( 'admin_init', array( $this, 'register_settings' ) );
|
73 |
+
add_action( 'admin_init', array( $this, 'activate_license' ) );
|
74 |
+
add_action( 'admin_init', array( $this, 'product_valid' ), 99999999 );
|
75 |
+
add_action( 'admin_notices', array( $this, 'show_notice' ) );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Register the setting for the license of the product
|
80 |
+
*
|
81 |
+
* @return bool
|
82 |
+
*/
|
83 |
+
public function register_settings() {
|
84 |
+
if ( ! is_admin() ) {
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
add_settings_field(
|
88 |
+
$this->product->get_key() . '_license',
|
89 |
+
$this->product->get_name() . ' license',
|
90 |
+
array( $this, 'license_view' ),
|
91 |
+
'general'
|
92 |
+
);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* The license view field
|
97 |
+
*/
|
98 |
+
public function license_view() {
|
99 |
+
$status = $this->get_license_status();
|
100 |
+
$value = $this->license_key;
|
101 |
+
|
102 |
+
$activate_string = apply_filters( $this->product->get_key() . '_lc_activate_string', 'Activate' );
|
103 |
+
$deactivate_string = apply_filters( $this->product->get_key() . '_lc_deactivate_string', 'Deactivate' );
|
104 |
+
$valid_string = apply_filters( $this->product->get_key() . '_lc_valid_string', 'Valid' );
|
105 |
+
$invalid_string = apply_filters( $this->product->get_key() . '_lc_invalid_string', 'Invalid' );
|
106 |
+
$license_message = apply_filters( $this->product->get_key() . '_lc_license_message', 'Enter your license from %s purchase history in order to get %s updates' );
|
107 |
+
|
108 |
+
echo '<p ><input ' . ( ( $status === 'valid' ) ? ( 'style="border:1px solid #7ad03a; "' ) : '' ) . ' type="text" id="' . $this->product->get_key() . '_license" name="' . $this->product->get_key() . '_license" value="' . $value . '" /><a ' . ( ( $status === 'valid' ) ? ( 'style="color:#fff;background: #7ad03a; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">' . $valid_string ) : ( 'style="color:#fff;background: #dd3d36; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">' . $invalid_string ) ) . ' </a> <button name="' . $this->product->get_key() . '_btn_trigger" ' . ( ( $status === 'valid' ) ? ( ' class="button button-primary">' . $deactivate_string ) : ( ' class="button button-primary" value="yes" type="submit" >' . $activate_string ) ) . ' </button></p><p class="description">' . sprintf( $license_message, '<a href="' . $this->product->get_store_url() . '">' . $this->product->get_store_url() . '</a> ', $this->product->get_type() ) . '</p>';
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Return the license status.
|
114 |
+
*
|
115 |
+
* @return string The License status.
|
116 |
+
*/
|
117 |
+
public function get_license_status() {
|
118 |
+
$license_data = get_option( $this->product->get_key() . '_license_data', '' );
|
119 |
+
if ( $license_data !== '' ) {
|
120 |
+
return isset( $license_data->license ) ? $license_data->license : get_option( $this->product->get_key() . '_license_status', 'not_active' );
|
121 |
+
} else {
|
122 |
+
return get_option( $this->product->get_key() . '_license_status', 'not_active' );
|
123 |
+
}
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Check if the license is active or not
|
129 |
+
*
|
130 |
+
* @return bool
|
131 |
+
*/
|
132 |
+
public function check_activation() {
|
133 |
+
$license_data = get_option( $this->product->get_key() . '_license_data', '' );
|
134 |
+
if ( $license_data !== '' ) {
|
135 |
+
return isset( $license_data->error ) ? ( $license_data->error == 'no_activations_left' ) : false;
|
136 |
+
}
|
137 |
+
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Check if the license is about to expire in the next month
|
143 |
+
*
|
144 |
+
* @return bool
|
145 |
+
*/
|
146 |
+
function check_expiration() {
|
147 |
+
$license_data = get_option( $this->product->get_key() . '_license_data', '' );
|
148 |
+
if ( $license_data !== '' ) {
|
149 |
+
if ( isset( $license_data->expires ) ) {
|
150 |
+
if ( strtotime( $license_data->expires ) - time() < 30 * 24 * 3600 ) {
|
151 |
+
return true;
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Return the renew url from the store used
|
161 |
+
*
|
162 |
+
* @return string The renew url.
|
163 |
+
*/
|
164 |
+
function renew_url() {
|
165 |
+
$license_data = get_option( $this->product->get_key() . '_license_data', '' );
|
166 |
+
if ( $license_data !== '' ) {
|
167 |
+
if ( isset( $license_data->download_id ) && isset( $license_data->key ) ) {
|
168 |
+
return $this->product->get_store_url() . '/checkout/?edd_license_key=' . $license_data->key . '&download_id=' . $license_data->download_id;
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
return $this->product->get_store_url();
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Check if we hide the notificatin nag or not
|
177 |
+
*
|
178 |
+
* @param string $hide The notification to hide.
|
179 |
+
*
|
180 |
+
* @return bool Either hide them or not.
|
181 |
+
*/
|
182 |
+
function check_hide( $hide ) {
|
183 |
+
if ( isset( $_GET[ $this->product->get_key() . '_hide_' . $hide ] ) ) {
|
184 |
+
if ( $_GET[ $this->product->get_key() . '_hide_' . $hide ] === 'yes' ) {
|
185 |
+
update_option( $this->product->get_key() . '_hide_' . $hide, 'yes' );
|
186 |
+
|
187 |
+
return false;
|
188 |
+
}
|
189 |
+
} else {
|
190 |
+
$license = get_option( $this->product->get_key() . '_hide_' . $hide, '' );
|
191 |
+
if ( $license === 'yes' ) {
|
192 |
+
return false;
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
return true;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Show the admin notice regarding the license status
|
201 |
+
*
|
202 |
+
* @return bool
|
203 |
+
*/
|
204 |
+
function show_notice() {
|
205 |
+
if ( ! is_admin() ) {
|
206 |
+
return false;
|
207 |
+
}
|
208 |
+
$status = $this->get_license_status();
|
209 |
+
$no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No activations left for %s !!!. You need to
|
210 |
+
upgrade your plan in order to use %s on more
|
211 |
+
websites. Please ask the %s
|
212 |
+
Staff for more details.' );
|
213 |
+
$no_valid_string = apply_filters( $this->product->get_key() . '_lc_no_valid_string', 'In order to benefit from updates and support for %s , please add
|
214 |
+
your license code from your <a href="%s" target="_blank">purchase history</a> and validate it <a
|
215 |
+
href="%s">here</a> ' );
|
216 |
+
$expiration_string = apply_filters( $this->product->get_key() . '_lc_expiration_string', 'Your license is about to expire
|
217 |
+
for %s. You can go to %s and renew it ' );
|
218 |
+
$hide_notice_string = apply_filters( $this->product->get_key() . '_lc_hide_notice_string', 'Hide Notice' );
|
219 |
+
if ( $status != 'valid' ) {
|
220 |
+
if ( $this->check_activation() ) {
|
221 |
+
if ( $this->check_hide( 'activation' ) ) {
|
222 |
+
?>
|
223 |
+
<div class="error">
|
224 |
+
<p><strong><?php
|
225 |
+
echo sprintf( $no_activations_string, $this->product->get_name(), $this->product->get_name(), '<a href="' . $this->product->get_store_url() . '"
|
226 |
+
target="_blank">' . $this->product->get_store_name() . '</a>' );
|
227 |
+
?></strong> | <a
|
228 |
+
href="<?php echo add_query_arg( $this->product->get_key() . '_activation', 'yes' ); ?> "><?php echo $hide_notice_string; ?></a>
|
229 |
+
</p>
|
230 |
+
</div>
|
231 |
+
<?php
|
232 |
+
return false;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
?>
|
236 |
+
<?php if ( $this->check_hide( 'valid' ) ) : ?>
|
237 |
+
<div class="error">
|
238 |
+
<p>
|
239 |
+
<strong><?php echo sprintf( $no_valid_string, $this->product->get_name() . ' ' . $this->product->get_type(), $this->product->get_type(), admin_url( 'options-general.php' ) . '#' . $this->product->get_key() ); ?> </strong>|
|
240 |
+
<a
|
241 |
+
href="<?php echo add_query_arg( $this->product->get_key() . '_hide_valid', 'yes' ); ?> "><?php echo $hide_notice_string; ?></a>
|
242 |
+
</p>
|
243 |
+
</div>
|
244 |
+
<?php endif; ?>
|
245 |
+
<?php
|
246 |
+
} else {
|
247 |
+
if ( $this->check_expiration() ) {
|
248 |
+
if ( $this->check_hide( 'expiration' ) ) {
|
249 |
+
?>
|
250 |
+
<div class="update-nag">
|
251 |
+
<p>
|
252 |
+
<strong><?php echo sprintf( $expiration_string, $this->product->get_name() . ' ' . $this->product->get_type(), '<a
|
253 |
+
href="' . $this->renew_url() . '"
|
254 |
+
target="_blank">' . $this->product->get_store_name() . '</a>' ); ?> </strong> |
|
255 |
+
<a
|
256 |
+
href="<?php echo add_query_arg( $this->product->get_key() . '_hide_expiration', 'yes' ); ?> "><?php echo $hide_notice_string; ?></a>
|
257 |
+
</p>
|
258 |
+
</div>
|
259 |
+
<?php
|
260 |
+
}
|
261 |
+
}
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Run the license check call
|
267 |
+
*/
|
268 |
+
public function product_valid() {
|
269 |
+
if ( false === ( $license = get_transient( $this->product->get_key() . '_license_data' ) ) ) {
|
270 |
+
$license = $this->check_license();
|
271 |
+
set_transient( $this->product->get_key() . '_license_data', $license, 12 * HOUR_IN_SECONDS );
|
272 |
+
update_option( $this->product->get_key() . '_license_data', $license );
|
273 |
+
}
|
274 |
+
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Increment the failed checks
|
279 |
+
*/
|
280 |
+
private function increment_failed_checks() {
|
281 |
+
$this->failed_checks ++;
|
282 |
+
update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks );
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Reset the failed checks
|
287 |
+
*/
|
288 |
+
private function reset_failed_checks() {
|
289 |
+
$this->failed_checks = 1;
|
290 |
+
update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks );
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Check the license status
|
295 |
+
*
|
296 |
+
* @return object The license data.
|
297 |
+
*/
|
298 |
+
public function check_license() {
|
299 |
+
$status = $this->get_license_status();
|
300 |
+
if ( $status == 'not_active' ) {
|
301 |
+
$license_data = new stdClass();
|
302 |
+
$license_data->license = 'not_active';
|
303 |
+
|
304 |
+
return $license_data;
|
305 |
+
}
|
306 |
+
$license = trim( $this->license_key );
|
307 |
+
$api_params = array(
|
308 |
+
'edd_action' => 'check_license',
|
309 |
+
'license' => $license,
|
310 |
+
'item_name' => urlencode( $this->product->get_name() ),
|
311 |
+
'url' => urlencode( home_url() ),
|
312 |
+
);
|
313 |
+
// Call the custom API.
|
314 |
+
$response = wp_remote_get( add_query_arg( $api_params, $this->product->get_store_url() ), array(
|
315 |
+
'timeout' => 15,
|
316 |
+
'sslverify' => false,
|
317 |
+
) );
|
318 |
+
if ( is_wp_error( $response ) ) {
|
319 |
+
$license_data = new stdClass();
|
320 |
+
$license_data->license = 'valid';
|
321 |
+
|
322 |
+
} else {
|
323 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
324 |
+
if ( ! is_object( $license_data ) ) {
|
325 |
+
$license_data = new stdClass();
|
326 |
+
$license_data->license = 'valid';
|
327 |
+
}
|
328 |
+
}
|
329 |
+
$license_old = get_option( $this->product->get_key() . '_license_data', '' );
|
330 |
+
if ( $license_old->license == 'valid' && ( $license_data->license != $license_old->license ) ) {
|
331 |
+
$this->increment_failed_checks();
|
332 |
+
} else {
|
333 |
+
$this->reset_failed_checks();
|
334 |
+
}
|
335 |
+
|
336 |
+
if ( $this->failed_checks <= self::$max_failed ) {
|
337 |
+
return $license_old;
|
338 |
+
}
|
339 |
+
|
340 |
+
if ( isset( $license_old->hide_valid ) ) {
|
341 |
+
$license_data->hide_valid = true;
|
342 |
+
}
|
343 |
+
|
344 |
+
if ( ! isset( $license_data->key ) ) {
|
345 |
+
$license_data->key = isset( $license_old->key ) ? $license_old->key : '';
|
346 |
+
}
|
347 |
+
|
348 |
+
if ( isset( $license_old->hide_expiration ) ) {
|
349 |
+
$license_data->hide_expiration = true;
|
350 |
+
}
|
351 |
+
|
352 |
+
if ( isset( $license_old->hide_activation ) ) {
|
353 |
+
$license_data->hide_activation = true;
|
354 |
+
}
|
355 |
+
|
356 |
+
return $license_data;
|
357 |
+
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Activate the license remotely
|
362 |
+
*/
|
363 |
+
function activate_license() {
|
364 |
+
// listen for our activate button to be clicked
|
365 |
+
if ( isset( $_POST[ $this->product->get_key() . '_btn_trigger' ] ) ) {
|
366 |
+
$status = $this->get_license_status();
|
367 |
+
// retrieve the license from the database
|
368 |
+
$license = $_POST[ $this->product->get_key() . '_license' ];
|
369 |
+
$api_params = array(
|
370 |
+
'license' => $license,
|
371 |
+
'item_name' => urlencode( $this->product->get_name() ),
|
372 |
+
'url' => urlencode( home_url() ),
|
373 |
+
);
|
374 |
+
if ( $status != 'valid' ) {
|
375 |
+
// data to send in our API request
|
376 |
+
$api_params['edd_action'] = 'activate_license';
|
377 |
+
} else {
|
378 |
+
$api_params['edd_action'] = 'deactivate_license';
|
379 |
+
}
|
380 |
+
// Call the custom API.
|
381 |
+
$response = wp_remote_get( add_query_arg( $api_params, $this->product->get_store_url() ) );
|
382 |
+
// make sure the response came back okay
|
383 |
+
if ( is_wp_error( $response ) ) {
|
384 |
+
$license_data = new stdClass();
|
385 |
+
$license_data->license = ( $status != 'valid' ) ? 'valid' : 'invalid';
|
386 |
+
|
387 |
+
} else {
|
388 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
389 |
+
if ( ! is_object( $license_data ) ) {
|
390 |
+
$license_data = new stdClass();
|
391 |
+
$license_data->license = ( $status != 'valid' ) ? 'valid' : 'invalid';
|
392 |
+
}
|
393 |
+
}
|
394 |
+
if ( ! isset( $license_data->key ) ) {
|
395 |
+
$license_data->key = $license;
|
396 |
+
}
|
397 |
+
if ( $license_data->license == 'valid' ) {
|
398 |
+
$this->reset_failed_checks();
|
399 |
+
}
|
400 |
+
|
401 |
+
if ( isset( $license_data->plan ) ) {
|
402 |
+
update_option( $this->product->get_key() . '_license_plan', $license_data->plan );
|
403 |
+
}
|
404 |
+
|
405 |
+
update_option( $this->product->get_key() . '_license_data', $license_data );
|
406 |
+
delete_transient( $this->product->get_key() . '_license_data' );
|
407 |
+
set_transient( $this->product->get_key() . '_license_data', $license_data, 12 * HOUR_IN_SECONDS );
|
408 |
+
|
409 |
+
}
|
410 |
+
}
|
411 |
+
|
412 |
+
/**
|
413 |
+
* Enable the license system
|
414 |
+
*/
|
415 |
+
public function enable() {
|
416 |
+
if ( $this->product->get_type() == 'plugin' ) {
|
417 |
+
add_filter( 'pre_set_site_transient_update_plugins', array(
|
418 |
+
$this,
|
419 |
+
'pre_set_site_transient_update_plugins_filter',
|
420 |
+
) );
|
421 |
+
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
422 |
+
add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
|
423 |
+
}
|
424 |
+
if ( $this->product->get_type() == 'theme' ) {
|
425 |
+
add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
|
426 |
+
add_filter( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
|
427 |
+
add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
|
428 |
+
add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
|
429 |
+
add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
|
430 |
+
|
431 |
+
}
|
432 |
+
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Load the Themes screen
|
437 |
+
*/
|
438 |
+
function load_themes_screen() {
|
439 |
+
add_thickbox();
|
440 |
+
add_action( 'admin_notices', array( &$this, 'update_nag' ) );
|
441 |
+
}
|
442 |
+
|
443 |
+
/**
|
444 |
+
* Alter the nag for themes update
|
445 |
+
*/
|
446 |
+
function update_nag() {
|
447 |
+
$theme = wp_get_theme( $this->product->get_slug() );
|
448 |
+
$api_response = get_transient( $this->product_key );
|
449 |
+
if ( false === $api_response ) {
|
450 |
+
return;
|
451 |
+
}
|
452 |
+
$update_url = wp_nonce_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $this->product->get_slug() ), 'upgrade-theme_' . $this->product->get_slug() );
|
453 |
+
$update_onclick = ' onclick="if ( confirm(\'' . esc_js( __( 'Updating this theme will lose any customizations you have made. Cancel to stop, OK to update.' ) ) . '\') ) {return true;}return false;"';
|
454 |
+
if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
|
455 |
+
echo '<div id="update-nag">';
|
456 |
+
printf( '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.',
|
457 |
+
$theme->get( 'Name' ),
|
458 |
+
$api_response->new_version,
|
459 |
+
'#TB_inline?width=640&inlineId=' . $this->product->get_version() . '_changelog',
|
460 |
+
$theme->get( 'Name' ),
|
461 |
+
$update_url,
|
462 |
+
$update_onclick
|
463 |
+
);
|
464 |
+
echo '</div>';
|
465 |
+
echo '<div id="' . $this->product->get_slug() . '_' . 'changelog" style="display:none;">';
|
466 |
+
echo wpautop( $api_response->sections['changelog'] );
|
467 |
+
echo '</div>';
|
468 |
+
}
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* @param mixed $value The transient data.
|
473 |
+
*
|
474 |
+
* @return mixed
|
475 |
+
*/
|
476 |
+
function theme_update_transient( $value ) {
|
477 |
+
$update_data = $this->check_for_update();
|
478 |
+
if ( $update_data ) {
|
479 |
+
$value->response[ $this->product->get_slug() ] = $update_data;
|
480 |
+
}
|
481 |
+
|
482 |
+
return $value;
|
483 |
+
}
|
484 |
+
|
485 |
+
/**
|
486 |
+
* Delete the update transient
|
487 |
+
*/
|
488 |
+
function delete_theme_update_transient() {
|
489 |
+
delete_transient( $this->product_key );
|
490 |
+
}
|
491 |
+
|
492 |
+
/**
|
493 |
+
* Check for updates
|
494 |
+
*
|
495 |
+
* @return array|bool Either the update data or false in case of failure
|
496 |
+
*/
|
497 |
+
function check_for_update() {
|
498 |
+
$theme = wp_get_theme( $this->product->get_slug() );
|
499 |
+
$update_data = get_transient( $this->product_key );
|
500 |
+
if ( false === $update_data ) {
|
501 |
+
$failed = false;
|
502 |
+
if ( empty( $this->license_key ) ) {
|
503 |
+
return false;
|
504 |
+
}
|
505 |
+
$api_params = array(
|
506 |
+
'edd_action' => 'get_version',
|
507 |
+
'version' => $this->product->get_version(),
|
508 |
+
'license' => $this->license_key,
|
509 |
+
'name' => $this->product->get_name(),
|
510 |
+
'slug' => $this->product->get_slug(),
|
511 |
+
'author' => $this->product->get_store_name(),
|
512 |
+
'url' => urlencode( home_url() ),
|
513 |
+
);
|
514 |
+
$response = wp_remote_post( $this->product->get_store_url(), array(
|
515 |
+
'timeout' => 15,
|
516 |
+
'sslverify' => false,
|
517 |
+
'body' => $api_params,
|
518 |
+
) );
|
519 |
+
// make sure the response was successful
|
520 |
+
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
|
521 |
+
$failed = true;
|
522 |
+
}
|
523 |
+
$update_data = json_decode( wp_remote_retrieve_body( $response ) );
|
524 |
+
if ( ! is_object( $update_data ) ) {
|
525 |
+
$failed = true;
|
526 |
+
}
|
527 |
+
// if the response failed, try again in 30 minutes
|
528 |
+
if ( $failed ) {
|
529 |
+
$data = new stdClass;
|
530 |
+
$data->new_version = $this->product->get_version();
|
531 |
+
set_transient( $this->product_key, $data, strtotime( '+30 minutes' ) );
|
532 |
+
|
533 |
+
return false;
|
534 |
+
}
|
535 |
+
// if the status is 'ok', return the update arguments
|
536 |
+
if ( ! $failed ) {
|
537 |
+
$update_data->sections = maybe_unserialize( $update_data->sections );
|
538 |
+
set_transient( $this->product_key, $update_data, strtotime( '+12 hours' ) );
|
539 |
+
}
|
540 |
+
}
|
541 |
+
if ( version_compare( $this->product->get_version(), $update_data->new_version, '>=' ) ) {
|
542 |
+
return false;
|
543 |
+
}
|
544 |
+
|
545 |
+
return (array) $update_data;
|
546 |
+
}
|
547 |
+
|
548 |
+
/**
|
549 |
+
* Check for Updates at the defined API endpoint and modify the update array.
|
550 |
+
*
|
551 |
+
* This function dives into the update API just when WordPress creates its update array,
|
552 |
+
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
553 |
+
* It is reassembled from parts of the native WordPress plugin update code.
|
554 |
+
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
555 |
+
*
|
556 |
+
* @uses api_request()
|
557 |
+
*
|
558 |
+
* @param array $_transient_data Update array build by WordPress.
|
559 |
+
*
|
560 |
+
* @return array Modified update array with custom plugin data.
|
561 |
+
*/
|
562 |
+
public function pre_set_site_transient_update_plugins_filter( $_transient_data ) {
|
563 |
+
if ( empty( $_transient_data ) || ! $this->do_check ) {
|
564 |
+
$this->do_check = true;
|
565 |
+
|
566 |
+
return $_transient_data;
|
567 |
+
}
|
568 |
+
$api_response = $this->api_request();
|
569 |
+
if ( false !== $api_response && is_object( $api_response ) && isset( $api_response->new_version ) ) {
|
570 |
+
if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
|
571 |
+
$_transient_data->response[ $this->product->get_slug() . '/' . $this->product->get_file() ] = $api_response;
|
572 |
+
}
|
573 |
+
}
|
574 |
+
|
575 |
+
return $_transient_data;
|
576 |
+
}
|
577 |
+
|
578 |
+
/**
|
579 |
+
* Calls the API and, if successfull, returns the object delivered by the API.
|
580 |
+
*
|
581 |
+
* @uses get_bloginfo()
|
582 |
+
* @uses wp_remote_post()
|
583 |
+
* @uses is_wp_error()
|
584 |
+
*
|
585 |
+
* @param string $_action The requested action.
|
586 |
+
* @param array $_data Parameters for the API action.
|
587 |
+
*
|
588 |
+
* @return false||object
|
589 |
+
*/
|
590 |
+
private function api_request( $_action = '', $_data = '' ) {
|
591 |
+
if ( empty( $this->license_key ) ) {
|
592 |
+
return;
|
593 |
+
}
|
594 |
+
$api_params = array(
|
595 |
+
'edd_action' => 'get_version',
|
596 |
+
'license' => $this->license_key,
|
597 |
+
'name' => urlencode( $this->product->get_name() ),
|
598 |
+
'slug' => urlencode( $this->product->get_slug() ),
|
599 |
+
'author' => $this->product->get_store_name(),
|
600 |
+
'url' => urlencode( home_url() ),
|
601 |
+
);
|
602 |
+
$request = wp_remote_post( $this->product->get_store_url(), array(
|
603 |
+
'timeout' => 15,
|
604 |
+
'sslverify' => false,
|
605 |
+
'body' => $api_params,
|
606 |
+
) );
|
607 |
+
if ( ! is_wp_error( $request ) ) :
|
608 |
+
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
609 |
+
if ( $request && isset( $request->sections ) ) {
|
610 |
+
$request->sections = maybe_unserialize( $request->sections );
|
611 |
+
}
|
612 |
+
|
613 |
+
return $request;
|
614 |
+
else :
|
615 |
+
return false;
|
616 |
+
endif;
|
617 |
+
}
|
618 |
+
|
619 |
+
/**
|
620 |
+
* Updates information on the "View version x.x details" page with custom data.
|
621 |
+
*
|
622 |
+
* @uses api_request()
|
623 |
+
*
|
624 |
+
* @param mixed $_data Plugin data.
|
625 |
+
* @param string $_action Action to send.
|
626 |
+
* @param object $_args Arguments to use.
|
627 |
+
*
|
628 |
+
* @return object $_data
|
629 |
+
*/
|
630 |
+
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
631 |
+
if ( ( $_action != 'plugin_information' ) || ! isset( $_args->slug ) || ( $_args->slug != $this->product->get_slug() ) ) {
|
632 |
+
return $_data;
|
633 |
+
}
|
634 |
+
$api_response = $this->api_request();
|
635 |
+
if ( false !== $api_response ) {
|
636 |
+
$_data = $api_response;
|
637 |
+
}
|
638 |
+
|
639 |
+
return $_data;
|
640 |
+
}
|
641 |
+
|
642 |
+
/**
|
643 |
+
* Disable SSL verification in order to prevent download update failures
|
644 |
+
*
|
645 |
+
* @param array $args Http args.
|
646 |
+
* @param string $url Url to check.
|
647 |
+
*
|
648 |
+
* @return object $array
|
649 |
+
*/
|
650 |
+
function http_request_args( $args, $url ) {
|
651 |
+
// If it is an https request and we are performing a package download, disable ssl verification
|
652 |
+
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
653 |
+
$args['sslverify'] = false;
|
654 |
+
}
|
655 |
+
|
656 |
+
return $args;
|
657 |
+
}
|
658 |
+
|
659 |
+
}
|
660 |
+
endif;
|
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The main loader class for ThemeIsle SDK
|
4 |
+
*
|
5 |
+
* @package ThemeIsleSDK
|
6 |
+
* @subpackage Loader
|
7 |
+
* @copyright Copyright (c) 2017, Marius Cristea
|
8 |
+
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
9 |
+
* @since 1.0.0
|
10 |
+
*/
|
11 |
+
// Exit if accessed directly.
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
+
exit;
|
14 |
+
}
|
15 |
+
if ( ! class_exists( 'ThemeIsle_SDK_Loader' ) ) :
|
16 |
+
/**
|
17 |
+
* Singleton loader for ThemeIsle SDK.
|
18 |
+
*/
|
19 |
+
final class ThemeIsle_SDK_Loader {
|
20 |
+
/**
|
21 |
+
* @var ThemeIsle_SDK_Loader instance The singleton instance
|
22 |
+
*/
|
23 |
+
private static $instance;
|
24 |
+
/**
|
25 |
+
* @var string $version The class version.
|
26 |
+
*/
|
27 |
+
private static $version = '1.0.0';
|
28 |
+
/**
|
29 |
+
* @var array The products which use the SDK.
|
30 |
+
*/
|
31 |
+
private static $products;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Register product into SDK.
|
35 |
+
*
|
36 |
+
* @param string $basefile The product basefile.
|
37 |
+
*
|
38 |
+
* @return ThemeIsle_SDK_Loader The singleton object.
|
39 |
+
*/
|
40 |
+
public static function init_product( $basefile ) {
|
41 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof ThemeIsle_SDK_Loader ) ) {
|
42 |
+
self::$instance = new ThemeIsle_SDK_Loader;
|
43 |
+
self::$instance->setup_hooks();
|
44 |
+
}
|
45 |
+
$product_object = new ThemeIsle_SDK_Product( $basefile );
|
46 |
+
self::$products[ $product_object->get_slug() ] = $product_object;
|
47 |
+
// Based on the Wordpress Available file header we enable the logger or not.
|
48 |
+
if ( ! $product_object->is_wordpress_available() ) {
|
49 |
+
$licenser = new ThemeIsle_SDK_Licenser( $product_object );
|
50 |
+
$licenser->enable();
|
51 |
+
}
|
52 |
+
// We enable the logger feature.
|
53 |
+
if ( $product_object->is_logger_active() ) {
|
54 |
+
$logger = new ThemeIsle_SDK_Logger( $product_object );
|
55 |
+
$logger->enable();
|
56 |
+
}
|
57 |
+
|
58 |
+
return self::$instance;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Setup loader hookds.
|
63 |
+
*/
|
64 |
+
public function setup_hooks() {
|
65 |
+
add_filter( 'extra_plugin_headers', array( $this, 'add_extra_headers' ) );
|
66 |
+
add_filter( 'extra_theme_headers', array( $this, 'add_extra_headers' ) );
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @param array $headers The extra headers.
|
71 |
+
*
|
72 |
+
* @return array The new headers.
|
73 |
+
*/
|
74 |
+
function add_extra_headers( $headers ) {
|
75 |
+
if ( ! in_array( 'Requires License', $headers ) ) {
|
76 |
+
$headers[] = 'Requires License';
|
77 |
+
}
|
78 |
+
if ( ! in_array( 'WordPress Available', $headers ) ) {
|
79 |
+
$headers[] = 'WordPress Available';
|
80 |
+
}
|
81 |
+
|
82 |
+
return $headers;
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
86 |
+
endif;
|
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The main loader class for ThemeIsle SDK
|
4 |
+
*
|
5 |
+
* @package ThemeIsleSDK
|
6 |
+
* @subpackage Logger
|
7 |
+
* @copyright Copyright (c) 2017, Marius Cristea
|
8 |
+
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
9 |
+
* @since 1.0.0
|
10 |
+
*/
|
11 |
+
if ( ! class_exists( 'ThemeIsle_SDK_Logger' ) ) :
|
12 |
+
/**
|
13 |
+
* Class ThemeIsle_SDK_Logger
|
14 |
+
*
|
15 |
+
* Send the statistics to the Themeisle Endpoint
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* Class ThemeIsle_SDK_Logger
|
19 |
+
*/
|
20 |
+
class ThemeIsle_SDK_Logger {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var string $logging_url Url where to send the logs
|
24 |
+
*/
|
25 |
+
private $logging_url = 'http://mirror.themeisle.com';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var ThemeIsle_SDK_Product $product Themeisle Product.
|
29 |
+
*/
|
30 |
+
private $product;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var string $product_cron Cron name handler
|
34 |
+
*/
|
35 |
+
private $product_cron;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* ThemeIsle_SDK_Logger constructor.
|
39 |
+
*
|
40 |
+
* @param ThemeIsle_SDK_Product $product_object Product Object.
|
41 |
+
*/
|
42 |
+
public function __construct( $product_object ) {
|
43 |
+
if ( $product_object instanceof ThemeIsle_SDK_Product ) {
|
44 |
+
$this->product = $product_object;
|
45 |
+
$this->product_cron = $product_object->get_key() . '_log_activity';
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Start the cron to send the log. It will randomize the interval in order to not send all the logs at the same time.
|
52 |
+
*/
|
53 |
+
public function enable() {
|
54 |
+
if ( ! wp_next_scheduled( $this->product_cron ) ) {
|
55 |
+
wp_schedule_single_event( time() + ( rand( 15, 24 ) * 3600 ), $this->product_cron );
|
56 |
+
}
|
57 |
+
add_action( $this->product_cron, array( $this, 'send_log' ) );
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Send the statistics to the api endpoint
|
62 |
+
*/
|
63 |
+
public function send_log() {
|
64 |
+
wp_remote_post( $this->logging_url, array(
|
65 |
+
'method' => 'POST',
|
66 |
+
'timeout' => 3,
|
67 |
+
'redirection' => 5,
|
68 |
+
'headers' => array(
|
69 |
+
'X-ThemeIsle-Event' => 'log_site',
|
70 |
+
),
|
71 |
+
'body' => array(
|
72 |
+
'site' => get_site_url(),
|
73 |
+
'product' => $this->product->get_slug(),
|
74 |
+
'version' => $this->product->get_version(),
|
75 |
+
),
|
76 |
+
) );
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
80 |
+
endif;
|
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php
ADDED
@@ -0,0 +1,265 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The product model class for ThemeIsle SDK
|
4 |
+
*
|
5 |
+
* @package ThemeIsleSDK
|
6 |
+
* @subpackage Product
|
7 |
+
* @copyright Copyright (c) 2017, Marius Cristea
|
8 |
+
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
9 |
+
* @since 1.0.0
|
10 |
+
*/
|
11 |
+
// Exit if accessed directly.
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
+
exit;
|
14 |
+
}
|
15 |
+
if ( ! class_exists( 'ThemeIsle_SDK_Product' ) ) :
|
16 |
+
/**
|
17 |
+
* Product model for ThemeIsle SDK.
|
18 |
+
*/
|
19 |
+
class ThemeIsle_SDK_Product {
|
20 |
+
/**
|
21 |
+
* @var string $slug THe product slug.
|
22 |
+
*/
|
23 |
+
private $slug;
|
24 |
+
/**
|
25 |
+
* @var string $basefile The file with headers.
|
26 |
+
*/
|
27 |
+
private $basefile;
|
28 |
+
/**
|
29 |
+
* @var string $type The product type ( plugin | theme ).
|
30 |
+
*/
|
31 |
+
private $type;
|
32 |
+
/**
|
33 |
+
* @var string $file The file name.
|
34 |
+
*/
|
35 |
+
private $file;
|
36 |
+
/**
|
37 |
+
* @var string $name The product name.
|
38 |
+
*/
|
39 |
+
private $name;
|
40 |
+
/**
|
41 |
+
* @var string $key The product ready key.
|
42 |
+
*/
|
43 |
+
private $key;
|
44 |
+
/**
|
45 |
+
* @var string $store_url The store url.
|
46 |
+
*/
|
47 |
+
private $store_url;
|
48 |
+
/**
|
49 |
+
* @var string $store_name The store name.
|
50 |
+
*/
|
51 |
+
private $store_name;
|
52 |
+
/**
|
53 |
+
* @var bool $requires_license Either user needs to activate it with license.
|
54 |
+
*/
|
55 |
+
private $requires_license;
|
56 |
+
/**
|
57 |
+
* @var bool $wordpress_available Either is available on wordpress or not.
|
58 |
+
*/
|
59 |
+
private $wordpress_available;
|
60 |
+
/**
|
61 |
+
* @var string $version The product version.
|
62 |
+
*/
|
63 |
+
private $version;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* ThemeIsle_SDK_Product constructor.
|
67 |
+
*
|
68 |
+
* @param string $basefile Product basefile.
|
69 |
+
*/
|
70 |
+
public function __construct( $basefile ) {
|
71 |
+
if ( ! empty( $basefile ) ) {
|
72 |
+
if ( is_readable( $basefile ) ) {
|
73 |
+
$this->basefile = $basefile;
|
74 |
+
$this->setup_from_path();
|
75 |
+
$this->setup_from_fileheaders();
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Setup props from fileheaders.
|
82 |
+
*/
|
83 |
+
public function setup_from_fileheaders() {
|
84 |
+
$file_headers = array();
|
85 |
+
if ( $this->type == 'plugin' ) {
|
86 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
87 |
+
$file_headers = get_plugin_data( $this->basefile );
|
88 |
+
}
|
89 |
+
if ( $this->type == 'theme' ) {
|
90 |
+
$file_headers = wp_get_theme( $this->basefile );
|
91 |
+
}
|
92 |
+
$this->name = $file_headers['Name'];
|
93 |
+
$this->store_name = $file_headers['AuthorName'];
|
94 |
+
$this->store_url = $file_headers['AuthorURI'];
|
95 |
+
$this->requires_license = ( $file_headers['Requires License'] == 'yes' ) ? true : false;
|
96 |
+
$this->wordpress_available = ( $file_headers['WordPress Available'] == 'yes' ) ? true : false;
|
97 |
+
$this->version = $file_headers['Version'];
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* The magic var_dump info method.
|
103 |
+
*
|
104 |
+
* @return array Debug info.
|
105 |
+
*/
|
106 |
+
public function __debugInfo() {
|
107 |
+
return array(
|
108 |
+
'name' => $this->name,
|
109 |
+
'slug' => $this->slug,
|
110 |
+
'version' => $this->version,
|
111 |
+
'basefile' => $this->basefile,
|
112 |
+
'key' => $this->key,
|
113 |
+
'type' => $this->type,
|
114 |
+
'store_name' => $this->store_name,
|
115 |
+
'store_url' => $this->store_url,
|
116 |
+
'wordpress_available' => $this->wordpress_available,
|
117 |
+
'requires_license' => $this->requires_license,
|
118 |
+
);
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Setup props from path.
|
124 |
+
*/
|
125 |
+
public function setup_from_path() {
|
126 |
+
$this->file = basename( $this->basefile );
|
127 |
+
$dir = dirname( $this->basefile );
|
128 |
+
$this->slug = basename( $dir );
|
129 |
+
$exts = explode( '.', $this->basefile );
|
130 |
+
$ext = $exts[ count( $exts ) - 1 ];
|
131 |
+
if ( $ext == 'css' ) {
|
132 |
+
$this->type = 'theme';
|
133 |
+
}
|
134 |
+
if ( $ext == 'php' ) {
|
135 |
+
$this->type = 'plugin';
|
136 |
+
}
|
137 |
+
$this->key = self::key_ready_name( $this->slug );
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* @param string $string the String to be normalized for cron handler.
|
142 |
+
*
|
143 |
+
* @return string $name The normalized string.
|
144 |
+
*/
|
145 |
+
static function key_ready_name( $string ) {
|
146 |
+
return str_replace( '-', '_', strtolower( trim( $string ) ) );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Getter for product name.
|
151 |
+
*
|
152 |
+
* @return string The product name.
|
153 |
+
*/
|
154 |
+
public function get_name() {
|
155 |
+
return $this->name;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Getter for product version.
|
160 |
+
*
|
161 |
+
* @return string The product version.
|
162 |
+
*/
|
163 |
+
public function get_version() {
|
164 |
+
return $this->version;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* If product is available on wordpress.org or not.
|
169 |
+
*
|
170 |
+
* @return bool Either is wp available or not.
|
171 |
+
*/
|
172 |
+
public function is_wordpress_available() {
|
173 |
+
return $this->wordpress_available;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Return the product key.
|
178 |
+
*
|
179 |
+
* @return string The product key.
|
180 |
+
*/
|
181 |
+
public function get_key() {
|
182 |
+
return $this->key;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Either the product requires license or not.
|
187 |
+
*
|
188 |
+
* @return bool Either requires license or not.
|
189 |
+
*/
|
190 |
+
public function requires_license() {
|
191 |
+
return $this->requires_license;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Check if the product is either theme or plugin.
|
196 |
+
*
|
197 |
+
* @return string Product type.
|
198 |
+
*/
|
199 |
+
public function get_type() {
|
200 |
+
return $this->type;
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Returns the Store name.
|
205 |
+
*
|
206 |
+
* @return string Store name.
|
207 |
+
*/
|
208 |
+
public function get_store_name() {
|
209 |
+
return $this->store_name;
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Returns the store url.
|
214 |
+
*
|
215 |
+
* @return string The store url.
|
216 |
+
*/
|
217 |
+
public function get_store_url() {
|
218 |
+
return $this->store_url;
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Returns the product slug.
|
223 |
+
*
|
224 |
+
* @return string The product slug.
|
225 |
+
*/
|
226 |
+
public function get_slug() {
|
227 |
+
return $this->slug;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Returns product basefile, which holds the metaheaders.
|
232 |
+
*
|
233 |
+
* @return string The product basefile.
|
234 |
+
*/
|
235 |
+
public function get_basefile() {
|
236 |
+
return $this->basefile;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Returns product filename.
|
241 |
+
*
|
242 |
+
* @return string The product filename.
|
243 |
+
*/
|
244 |
+
public function get_file() {
|
245 |
+
return $this->file;
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* We log the user website and product version.
|
250 |
+
*
|
251 |
+
* @return bool Either we log the data or not.
|
252 |
+
*/
|
253 |
+
public function is_logger_active() {
|
254 |
+
// If is not available on wordpress log this automatically.
|
255 |
+
if ( ! $this->is_wordpress_available() ) {
|
256 |
+
return true;
|
257 |
+
} else {
|
258 |
+
// If we have the product on wprog, by default this will be false
|
259 |
+
// and we can change it in each product.
|
260 |
+
return apply_filters( $this->get_key() . '_logger_flag', false );
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
}
|
265 |
+
endif;
|
vendor/codeinwp/themeisle-sdk/composer.json
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "codeinwp/themeisle-sdk",
|
3 |
+
"description": "ThemeIsle SDK ",
|
4 |
+
"keywords": [
|
5 |
+
"wordpress"
|
6 |
+
],
|
7 |
+
"homepage": "https://github.com/Codeinwp/themeisle-sdk",
|
8 |
+
"license": "GPL-2.0+",
|
9 |
+
"authors": [
|
10 |
+
{
|
11 |
+
"name": "ThemeIsle team",
|
12 |
+
"email": "friends@themeisle.com",
|
13 |
+
"homepage": "https://themeisle.com"
|
14 |
+
}
|
15 |
+
],
|
16 |
+
"autoload": {
|
17 |
+
"classmap": [
|
18 |
+
"class-themeisle-sdk-loader.php",
|
19 |
+
"class-themeisle-sdk-product.php",
|
20 |
+
"class-themeisle-sdk-logger.php",
|
21 |
+
"class-themeisle-sdk-licenser.php"
|
22 |
+
]
|
23 |
+
},
|
24 |
+
"support": {
|
25 |
+
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues"
|
26 |
+
}
|
27 |
+
}
|
vendor/codeinwp/themeisle-sdk/index.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package ThemeIsleSDK
|
4 |
+
* Ignore this.
|
5 |
+
*/
|
vendor/codeinwp/themeisle-sdk/phpcs.xml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<ruleset name="Themeisle">
|
3 |
+
<description>Themeisle rules for PHP_CodeSnifferr</description>
|
4 |
+
|
5 |
+
<file>.</file>
|
6 |
+
|
7 |
+
<exclude-pattern>node_modules/*</exclude-pattern>
|
8 |
+
<exclude-pattern>vendor/*</exclude-pattern>
|
9 |
+
<exclude-pattern>lib/*</exclude-pattern>
|
10 |
+
<exclude-pattern>old/*</exclude-pattern>
|
11 |
+
<exclude-pattern>*.min.js</exclude-pattern>
|
12 |
+
<exclude-pattern>*.min.css</exclude-pattern>
|
13 |
+
<rule ref="WordPress-Core">
|
14 |
+
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment"/>
|
15 |
+
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
|
16 |
+
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
|
17 |
+
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
|
18 |
+
<exclude name="Squiz.Commenting.InlineComment.NotCapital"/>
|
19 |
+
<exclude name="Squiz.Commenting.LongConditionClosingComment.Missing"/>
|
20 |
+
<exclude name="Squiz.Commenting.LongConditionClosingComment.Invalid"/>
|
21 |
+
<exclude name="WordPress.NamingConvention.ValidVariableName.StringNotSnakeCase"/>
|
22 |
+
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCase"/>
|
23 |
+
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>
|
24 |
+
<exclude name="Squiz.PHP.DisallowMultipleAssignments" />
|
25 |
+
</rule>
|
26 |
+
<rule ref="WordPress-Docs">
|
27 |
+
|
28 |
+
</rule>
|
29 |
+
|
30 |
+
<rule ref="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing">
|
31 |
+
<severity>0</severity>
|
32 |
+
</rule>
|
33 |
+
|
34 |
+
</ruleset>
|
vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
|
57 |
+
private $classMapAuthoritative = false;
|
58 |
+
|
59 |
+
public function getPrefixes()
|
60 |
+
{
|
61 |
+
if (!empty($this->prefixesPsr0)) {
|
62 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
63 |
+
}
|
64 |
+
|
65 |
+
return array();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getPrefixesPsr4()
|
69 |
+
{
|
70 |
+
return $this->prefixDirsPsr4;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getFallbackDirs()
|
74 |
+
{
|
75 |
+
return $this->fallbackDirsPsr0;
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getFallbackDirsPsr4()
|
79 |
+
{
|
80 |
+
return $this->fallbackDirsPsr4;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getClassMap()
|
84 |
+
{
|
85 |
+
return $this->classMap;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param array $classMap Class to filename map
|
90 |
+
*/
|
91 |
+
public function addClassMap(array $classMap)
|
92 |
+
{
|
93 |
+
if ($this->classMap) {
|
94 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
95 |
+
} else {
|
96 |
+
$this->classMap = $classMap;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
102 |
+
* appending or prepending to the ones previously set for this prefix.
|
103 |
+
*
|
104 |
+
* @param string $prefix The prefix
|
105 |
+
* @param array|string $paths The PSR-0 root directories
|
106 |
+
* @param bool $prepend Whether to prepend the directories
|
107 |
+
*/
|
108 |
+
public function add($prefix, $paths, $prepend = false)
|
109 |
+
{
|
110 |
+
if (!$prefix) {
|
111 |
+
if ($prepend) {
|
112 |
+
$this->fallbackDirsPsr0 = array_merge(
|
113 |
+
(array) $paths,
|
114 |
+
$this->fallbackDirsPsr0
|
115 |
+
);
|
116 |
+
} else {
|
117 |
+
$this->fallbackDirsPsr0 = array_merge(
|
118 |
+
$this->fallbackDirsPsr0,
|
119 |
+
(array) $paths
|
120 |
+
);
|
121 |
+
}
|
122 |
+
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
$first = $prefix[0];
|
127 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
128 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
129 |
+
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
if ($prepend) {
|
133 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
134 |
+
(array) $paths,
|
135 |
+
$this->prefixesPsr0[$first][$prefix]
|
136 |
+
);
|
137 |
+
} else {
|
138 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
139 |
+
$this->prefixesPsr0[$first][$prefix],
|
140 |
+
(array) $paths
|
141 |
+
);
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
147 |
+
* appending or prepending to the ones previously set for this namespace.
|
148 |
+
*
|
149 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
150 |
+
* @param array|string $paths The PSR-4 base directories
|
151 |
+
* @param bool $prepend Whether to prepend the directories
|
152 |
+
*
|
153 |
+
* @throws \InvalidArgumentException
|
154 |
+
*/
|
155 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
156 |
+
{
|
157 |
+
if (!$prefix) {
|
158 |
+
// Register directories for the root namespace.
|
159 |
+
if ($prepend) {
|
160 |
+
$this->fallbackDirsPsr4 = array_merge(
|
161 |
+
(array) $paths,
|
162 |
+
$this->fallbackDirsPsr4
|
163 |
+
);
|
164 |
+
} else {
|
165 |
+
$this->fallbackDirsPsr4 = array_merge(
|
166 |
+
$this->fallbackDirsPsr4,
|
167 |
+
(array) $paths
|
168 |
+
);
|
169 |
+
}
|
170 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
171 |
+
// Register directories for a new namespace.
|
172 |
+
$length = strlen($prefix);
|
173 |
+
if ('\\' !== $prefix[$length - 1]) {
|
174 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
175 |
+
}
|
176 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
177 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
178 |
+
} elseif ($prepend) {
|
179 |
+
// Prepend directories for an already registered namespace.
|
180 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
181 |
+
(array) $paths,
|
182 |
+
$this->prefixDirsPsr4[$prefix]
|
183 |
+
);
|
184 |
+
} else {
|
185 |
+
// Append directories for an already registered namespace.
|
186 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
187 |
+
$this->prefixDirsPsr4[$prefix],
|
188 |
+
(array) $paths
|
189 |
+
);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
195 |
+
* replacing any others previously set for this prefix.
|
196 |
+
*
|
197 |
+
* @param string $prefix The prefix
|
198 |
+
* @param array|string $paths The PSR-0 base directories
|
199 |
+
*/
|
200 |
+
public function set($prefix, $paths)
|
201 |
+
{
|
202 |
+
if (!$prefix) {
|
203 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
204 |
+
} else {
|
205 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
211 |
+
* replacing any others previously set for this namespace.
|
212 |
+
*
|
213 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
214 |
+
* @param array|string $paths The PSR-4 base directories
|
215 |
+
*
|
216 |
+
* @throws \InvalidArgumentException
|
217 |
+
*/
|
218 |
+
public function setPsr4($prefix, $paths)
|
219 |
+
{
|
220 |
+
if (!$prefix) {
|
221 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
222 |
+
} else {
|
223 |
+
$length = strlen($prefix);
|
224 |
+
if ('\\' !== $prefix[$length - 1]) {
|
225 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
226 |
+
}
|
227 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
228 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Turns on searching the include path for class files.
|
234 |
+
*
|
235 |
+
* @param bool $useIncludePath
|
236 |
+
*/
|
237 |
+
public function setUseIncludePath($useIncludePath)
|
238 |
+
{
|
239 |
+
$this->useIncludePath = $useIncludePath;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Can be used to check if the autoloader uses the include path to check
|
244 |
+
* for classes.
|
245 |
+
*
|
246 |
+
* @return bool
|
247 |
+
*/
|
248 |
+
public function getUseIncludePath()
|
249 |
+
{
|
250 |
+
return $this->useIncludePath;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Turns off searching the prefix and fallback directories for classes
|
255 |
+
* that have not been registered with the class map.
|
256 |
+
*
|
257 |
+
* @param bool $classMapAuthoritative
|
258 |
+
*/
|
259 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
260 |
+
{
|
261 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Should class lookup fail if not found in the current class map?
|
266 |
+
*
|
267 |
+
* @return bool
|
268 |
+
*/
|
269 |
+
public function isClassMapAuthoritative()
|
270 |
+
{
|
271 |
+
return $this->classMapAuthoritative;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Registers this instance as an autoloader.
|
276 |
+
*
|
277 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
278 |
+
*/
|
279 |
+
public function register($prepend = false)
|
280 |
+
{
|
281 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Unregisters this instance as an autoloader.
|
286 |
+
*/
|
287 |
+
public function unregister()
|
288 |
+
{
|
289 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Loads the given class or interface.
|
294 |
+
*
|
295 |
+
* @param string $class The name of the class
|
296 |
+
* @return bool|null True if loaded, null otherwise
|
297 |
+
*/
|
298 |
+
public function loadClass($class)
|
299 |
+
{
|
300 |
+
if ($file = $this->findFile($class)) {
|
301 |
+
includeFile($file);
|
302 |
+
|
303 |
+
return true;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Finds the path to the file where the class is defined.
|
309 |
+
*
|
310 |
+
* @param string $class The name of the class
|
311 |
+
*
|
312 |
+
* @return string|false The path if found, false otherwise
|
313 |
+
*/
|
314 |
+
public function findFile($class)
|
315 |
+
{
|
316 |
+
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
|
317 |
+
if ('\\' == $class[0]) {
|
318 |
+
$class = substr($class, 1);
|
319 |
+
}
|
320 |
+
|
321 |
+
// class map lookup
|
322 |
+
if (isset($this->classMap[$class])) {
|
323 |
+
return $this->classMap[$class];
|
324 |
+
}
|
325 |
+
if ($this->classMapAuthoritative) {
|
326 |
+
return false;
|
327 |
+
}
|
328 |
+
|
329 |
+
$file = $this->findFileWithExtension($class, '.php');
|
330 |
+
|
331 |
+
// Search for Hack files if we are running on HHVM
|
332 |
+
if ($file === null && defined('HHVM_VERSION')) {
|
333 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
334 |
+
}
|
335 |
+
|
336 |
+
if ($file === null) {
|
337 |
+
// Remember that this class does not exist.
|
338 |
+
return $this->classMap[$class] = false;
|
339 |
+
}
|
340 |
+
|
341 |
+
return $file;
|
342 |
+
}
|
343 |
+
|
344 |
+
private function findFileWithExtension($class, $ext)
|
345 |
+
{
|
346 |
+
// PSR-4 lookup
|
347 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
348 |
+
|
349 |
+
$first = $class[0];
|
350 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
351 |
+
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
352 |
+
if (0 === strpos($class, $prefix)) {
|
353 |
+
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
354 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
355 |
+
return $file;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
// PSR-4 fallback dirs
|
363 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
364 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
365 |
+
return $file;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
// PSR-0 lookup
|
370 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
371 |
+
// namespaced class name
|
372 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
373 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
374 |
+
} else {
|
375 |
+
// PEAR-like class name
|
376 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
377 |
+
}
|
378 |
+
|
379 |
+
if (isset($this->prefixesPsr0[$first])) {
|
380 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
381 |
+
if (0 === strpos($class, $prefix)) {
|
382 |
+
foreach ($dirs as $dir) {
|
383 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
384 |
+
return $file;
|
385 |
+
}
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
// PSR-0 fallback dirs
|
392 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
393 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
394 |
+
return $file;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
// PSR-0 include paths.
|
399 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
400 |
+
return $file;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Scope isolated include.
|
407 |
+
*
|
408 |
+
* Prevents access to $this/self from included files.
|
409 |
+
*/
|
410 |
+
function includeFile($file)
|
411 |
+
{
|
412 |
+
include $file;
|
413 |
+
}
|
vendor/composer/ClassLoader52.php
ADDED
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
|
4 |
+
*
|
5 |
+
* This file is released under the terms of the MIT license. You can find the
|
6 |
+
* complete text in the attached LICENSE file or online at:
|
7 |
+
*
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
*
|
10 |
+
* --------------------------------------------------------------------------
|
11 |
+
*
|
12 |
+
* 99% of this is copied as-is from the original Composer source code and is
|
13 |
+
* released under MIT license as well. Copyright goes to:
|
14 |
+
*
|
15 |
+
* - Fabien Potencier <fabien@symfony.com>
|
16 |
+
* - Jordi Boggiano <j.boggiano@seld.be>
|
17 |
+
*/
|
18 |
+
|
19 |
+
class xrstf_Composer52_ClassLoader {
|
20 |
+
private $prefixes = array();
|
21 |
+
private $fallbackDirs = array();
|
22 |
+
private $useIncludePath = false;
|
23 |
+
private $classMap = array();
|
24 |
+
private $classMapAuthoratative = false;
|
25 |
+
private $allowUnderscore = false;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param boolean $flag true to allow class names with a leading underscore, false to disable
|
29 |
+
*/
|
30 |
+
public function setAllowUnderscore($flag) {
|
31 |
+
$this->allowUnderscore = (boolean) $flag;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
public function getPrefixes() {
|
38 |
+
return $this->prefixes;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Turns off searching the prefix and fallback directories for classes
|
43 |
+
* that have not been registered with the class map.
|
44 |
+
*
|
45 |
+
* @param bool $classMapAuthoratative
|
46 |
+
*/
|
47 |
+
public function setClassMapAuthoritative($classMapAuthoratative) {
|
48 |
+
$this->classMapAuthoratative = $classMapAuthoratative;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Should class lookup fail if not found in the current class map?
|
53 |
+
*
|
54 |
+
* @return bool
|
55 |
+
*/
|
56 |
+
public function getClassMapAuthoratative() {
|
57 |
+
return $this->classMapAuthoratative;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @return array
|
62 |
+
*/
|
63 |
+
public function getFallbackDirs() {
|
64 |
+
return $this->fallbackDirs;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @return array
|
69 |
+
*/
|
70 |
+
public function getClassMap() {
|
71 |
+
return $this->classMap;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @param array $classMap class to filename map
|
76 |
+
*/
|
77 |
+
public function addClassMap(array $classMap) {
|
78 |
+
if ($this->classMap) {
|
79 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
80 |
+
}
|
81 |
+
else {
|
82 |
+
$this->classMap = $classMap;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Registers a set of classes, merging with any others previously set.
|
88 |
+
*
|
89 |
+
* @param string $prefix the classes prefix
|
90 |
+
* @param array|string $paths the location(s) of the classes
|
91 |
+
* @param bool $prepend prepend the location(s)
|
92 |
+
*/
|
93 |
+
public function add($prefix, $paths, $prepend = false) {
|
94 |
+
if (!$prefix) {
|
95 |
+
if ($prepend) {
|
96 |
+
$this->fallbackDirs = array_merge(
|
97 |
+
(array) $paths,
|
98 |
+
$this->fallbackDirs
|
99 |
+
);
|
100 |
+
}
|
101 |
+
else {
|
102 |
+
$this->fallbackDirs = array_merge(
|
103 |
+
$this->fallbackDirs,
|
104 |
+
(array) $paths
|
105 |
+
);
|
106 |
+
}
|
107 |
+
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
if (!isset($this->prefixes[$prefix])) {
|
112 |
+
$this->prefixes[$prefix] = (array) $paths;
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
if ($prepend) {
|
117 |
+
$this->prefixes[$prefix] = array_merge(
|
118 |
+
(array) $paths,
|
119 |
+
$this->prefixes[$prefix]
|
120 |
+
);
|
121 |
+
}
|
122 |
+
else {
|
123 |
+
$this->prefixes[$prefix] = array_merge(
|
124 |
+
$this->prefixes[$prefix],
|
125 |
+
(array) $paths
|
126 |
+
);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Registers a set of classes, replacing any others previously set.
|
132 |
+
*
|
133 |
+
* @param string $prefix the classes prefix
|
134 |
+
* @param array|string $paths the location(s) of the classes
|
135 |
+
*/
|
136 |
+
public function set($prefix, $paths) {
|
137 |
+
if (!$prefix) {
|
138 |
+
$this->fallbackDirs = (array) $paths;
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
$this->prefixes[$prefix] = (array) $paths;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Turns on searching the include path for class files.
|
147 |
+
*
|
148 |
+
* @param bool $useIncludePath
|
149 |
+
*/
|
150 |
+
public function setUseIncludePath($useIncludePath) {
|
151 |
+
$this->useIncludePath = $useIncludePath;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Can be used to check if the autoloader uses the include path to check
|
156 |
+
* for classes.
|
157 |
+
*
|
158 |
+
* @return bool
|
159 |
+
*/
|
160 |
+
public function getUseIncludePath() {
|
161 |
+
return $this->useIncludePath;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Registers this instance as an autoloader.
|
166 |
+
*/
|
167 |
+
public function register() {
|
168 |
+
spl_autoload_register(array($this, 'loadClass'), true);
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Unregisters this instance as an autoloader.
|
173 |
+
*/
|
174 |
+
public function unregister() {
|
175 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Loads the given class or interface.
|
180 |
+
*
|
181 |
+
* @param string $class the name of the class
|
182 |
+
* @return bool|null true, if loaded
|
183 |
+
*/
|
184 |
+
public function loadClass($class) {
|
185 |
+
if ($file = $this->findFile($class)) {
|
186 |
+
include $file;
|
187 |
+
return true;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Finds the path to the file where the class is defined.
|
193 |
+
*
|
194 |
+
* @param string $class the name of the class
|
195 |
+
* @return string|null the path, if found
|
196 |
+
*/
|
197 |
+
public function findFile($class) {
|
198 |
+
if ('\\' === $class[0]) {
|
199 |
+
$class = substr($class, 1);
|
200 |
+
}
|
201 |
+
|
202 |
+
if (isset($this->classMap[$class])) {
|
203 |
+
return $this->classMap[$class];
|
204 |
+
}
|
205 |
+
elseif ($this->classMapAuthoratative) {
|
206 |
+
return false;
|
207 |
+
}
|
208 |
+
|
209 |
+
$classPath = $this->getClassPath($class);
|
210 |
+
|
211 |
+
foreach ($this->prefixes as $prefix => $dirs) {
|
212 |
+
if (0 === strpos($class, $prefix)) {
|
213 |
+
foreach ($dirs as $dir) {
|
214 |
+
if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
|
215 |
+
return $dir.DIRECTORY_SEPARATOR.$classPath;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
foreach ($this->fallbackDirs as $dir) {
|
222 |
+
if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
|
223 |
+
return $dir.DIRECTORY_SEPARATOR.$classPath;
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
if ($this->useIncludePath && $file = self::resolveIncludePath($classPath)) {
|
228 |
+
return $file;
|
229 |
+
}
|
230 |
+
|
231 |
+
return $this->classMap[$class] = false;
|
232 |
+
}
|
233 |
+
|
234 |
+
private function getClassPath($class) {
|
235 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
236 |
+
// namespaced class name
|
237 |
+
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)).DIRECTORY_SEPARATOR;
|
238 |
+
$className = substr($class, $pos + 1);
|
239 |
+
}
|
240 |
+
else {
|
241 |
+
// PEAR-like class name
|
242 |
+
$classPath = null;
|
243 |
+
$className = $class;
|
244 |
+
}
|
245 |
+
|
246 |
+
$className = str_replace('_', DIRECTORY_SEPARATOR, $className);
|
247 |
+
|
248 |
+
// restore the prefix
|
249 |
+
if ($this->allowUnderscore && DIRECTORY_SEPARATOR === $className[0]) {
|
250 |
+
$className[0] = '_';
|
251 |
+
}
|
252 |
+
|
253 |
+
$classPath .= $className.'.php';
|
254 |
+
|
255 |
+
return $classPath;
|
256 |
+
}
|
257 |
+
|
258 |
+
public static function resolveIncludePath($classPath) {
|
259 |
+
$paths = explode(PATH_SEPARATOR, get_include_path());
|
260 |
+
|
261 |
+
foreach ($paths as $path) {
|
262 |
+
$path = rtrim($path, '/\\');
|
263 |
+
|
264 |
+
if ($file = file_exists($path.DIRECTORY_SEPARATOR.$file)) {
|
265 |
+
return $file;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
return false;
|
270 |
+
}
|
271 |
+
}
|
vendor/composer/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Copyright (c) 2016 Nils Adermann, Jordi Boggiano
|
3 |
+
|
4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
+
of this software and associated documentation files (the "Software"), to deal
|
6 |
+
in the Software without restriction, including without limitation the rights
|
7 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
+
to do so, subject to the following conditions:
|
10 |
+
|
11 |
+
The above copyright notice and this permission notice shall be included in all
|
12 |
+
copies or substantial portions of the Software.
|
13 |
+
|
14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
+
THE SOFTWARE.
|
21 |
+
|
vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'ThemeIsle_SDK_Licenser' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php',
|
10 |
+
'ThemeIsle_SDK_Loader' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php',
|
11 |
+
'ThemeIsle_SDK_Logger' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php',
|
12 |
+
'ThemeIsle_SDK_Product' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php',
|
13 |
+
);
|
vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'xrstf\\Composer52' => array($vendorDir . '/xrstf/composer-php52/lib'),
|
10 |
+
);
|
vendor/composer/autoload_psr4.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInit7c7a15af9bab5b69940c5ab4b91d2536
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
public static function getLoader()
|
17 |
+
{
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit7c7a15af9bab5b69940c5ab4b91d2536', 'loadClassLoader'), true, true);
|
23 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit7c7a15af9bab5b69940c5ab4b91d2536', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
+
foreach ($map as $namespace => $path) {
|
28 |
+
$loader->set($namespace, $path);
|
29 |
+
}
|
30 |
+
|
31 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
32 |
+
foreach ($map as $namespace => $path) {
|
33 |
+
$loader->setPsr4($namespace, $path);
|
34 |
+
}
|
35 |
+
|
36 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
37 |
+
if ($classMap) {
|
38 |
+
$loader->addClassMap($classMap);
|
39 |
+
}
|
40 |
+
|
41 |
+
$loader->register(true);
|
42 |
+
|
43 |
+
return $loader;
|
44 |
+
}
|
45 |
+
}
|
vendor/composer/autoload_real_52.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
+
|
5 |
+
class ComposerAutoloaderInit36ec794f10e28898f33db6b7d2252402 {
|
6 |
+
private static $loader;
|
7 |
+
|
8 |
+
public static function loadClassLoader($class) {
|
9 |
+
if ('xrstf_Composer52_ClassLoader' === $class) {
|
10 |
+
require dirname(__FILE__).'/ClassLoader52.php';
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return xrstf_Composer52_ClassLoader
|
16 |
+
*/
|
17 |
+
public static function getLoader() {
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit36ec794f10e28898f33db6b7d2252402', 'loadClassLoader'), true /*, true */);
|
23 |
+
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit36ec794f10e28898f33db6b7d2252402', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$vendorDir = dirname(dirname(__FILE__));
|
27 |
+
$baseDir = dirname($vendorDir);
|
28 |
+
$dir = dirname(__FILE__);
|
29 |
+
|
30 |
+
$map = require $dir.'/autoload_namespaces.php';
|
31 |
+
foreach ($map as $namespace => $path) {
|
32 |
+
$loader->add($namespace, $path);
|
33 |
+
}
|
34 |
+
|
35 |
+
$classMap = require $dir.'/autoload_classmap.php';
|
36 |
+
if ($classMap) {
|
37 |
+
$loader->addClassMap($classMap);
|
38 |
+
}
|
39 |
+
|
40 |
+
$loader->register(true);
|
41 |
+
|
42 |
+
return $loader;
|
43 |
+
}
|
44 |
+
}
|
vendor/composer/installed.json
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "xrstf/composer-php52",
|
4 |
+
"version": "v1.0.20",
|
5 |
+
"version_normalized": "1.0.20.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/composer-php52/composer-php52.git",
|
9 |
+
"reference": "bd41459d5e27df8d33057842b32377c39e97a5a8"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/composer-php52/composer-php52/zipball/bd41459d5e27df8d33057842b32377c39e97a5a8",
|
14 |
+
"reference": "bd41459d5e27df8d33057842b32377c39e97a5a8",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"time": "2016-04-16 21:52:24",
|
18 |
+
"type": "library",
|
19 |
+
"extra": {
|
20 |
+
"branch-alias": {
|
21 |
+
"dev-default": "1.x-dev"
|
22 |
+
}
|
23 |
+
},
|
24 |
+
"installation-source": "dist",
|
25 |
+
"autoload": {
|
26 |
+
"psr-0": {
|
27 |
+
"xrstf\\Composer52": "lib/"
|
28 |
+
}
|
29 |
+
},
|
30 |
+
"notification-url": "https://packagist.org/downloads/",
|
31 |
+
"license": [
|
32 |
+
"MIT"
|
33 |
+
]
|
34 |
+
},
|
35 |
+
{
|
36 |
+
"name": "codeinwp/themeisle-sdk",
|
37 |
+
"version": "dev-master",
|
38 |
+
"version_normalized": "9999999-dev",
|
39 |
+
"source": {
|
40 |
+
"type": "git",
|
41 |
+
"url": "https://github.com/Codeinwp/themeisle-sdk.git",
|
42 |
+
"reference": "beb20b65c6916d14e2222d40252a48faa440e72e"
|
43 |
+
},
|
44 |
+
"dist": {
|
45 |
+
"type": "zip",
|
46 |
+
"url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/beb20b65c6916d14e2222d40252a48faa440e72e",
|
47 |
+
"reference": "beb20b65c6916d14e2222d40252a48faa440e72e",
|
48 |
+
"shasum": ""
|
49 |
+
},
|
50 |
+
"time": "2017-03-30 15:34:04",
|
51 |
+
"type": "library",
|
52 |
+
"installation-source": "source",
|
53 |
+
"autoload": {
|
54 |
+
"classmap": [
|
55 |
+
"class-themeisle-sdk-loader.php",
|
56 |
+
"class-themeisle-sdk-product.php",
|
57 |
+
"class-themeisle-sdk-logger.php",
|
58 |
+
"class-themeisle-sdk-licenser.php"
|
59 |
+
]
|
60 |
+
},
|
61 |
+
"license": [
|
62 |
+
"GPL-2.0+"
|
63 |
+
],
|
64 |
+
"authors": [
|
65 |
+
{
|
66 |
+
"name": "ThemeIsle team",
|
67 |
+
"email": "friends@themeisle.com",
|
68 |
+
"homepage": "https://themeisle.com"
|
69 |
+
}
|
70 |
+
],
|
71 |
+
"description": "ThemeIsle SDK ",
|
72 |
+
"homepage": "https://github.com/Codeinwp/themeisle-sdk",
|
73 |
+
"keywords": [
|
74 |
+
"wordpress"
|
75 |
+
],
|
76 |
+
"support": {
|
77 |
+
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
|
78 |
+
"source": "https://github.com/Codeinwp/themeisle-sdk/tree/master"
|
79 |
+
}
|
80 |
+
}
|
81 |
+
]
|
vendor/xrstf/composer-php52/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2013 Christoph Mewes
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
of this software and associated documentation files (the "Software"), to deal
|
5 |
+
in the Software without restriction, including without limitation the rights
|
6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
8 |
+
to do so, subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in all
|
11 |
+
copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
THE SOFTWARE.
|
vendor/xrstf/composer-php52/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
PHP 5.2 Autoloading for Composer
|
2 |
+
================================
|
3 |
+
|
4 |
+
This package provides an easy way to get a PHP 5.2 compatible autoloader out of Composer. The generated autoloader is fully compatible to the original and is written into separate files, each ending with `_52.php`.
|
5 |
+
|
6 |
+
Legacy
|
7 |
+
------
|
8 |
+
|
9 |
+
Please do not use this, if you can avoid it. It's a horrible hack, often breaks and is extremely tied to Composer's interna. This package was originally developed in 2012, when PHP 5.2 was much more common on cheap webhosts.
|
10 |
+
|
11 |
+
In 2016, this package has been moved from Bitbucket to a Github organization, because the original developer could no longer reliably maintain it. This is the reason for this legacy package name ``xrstf/...``.
|
12 |
+
|
13 |
+
Usage
|
14 |
+
-----
|
15 |
+
|
16 |
+
In your project's `composer.json`, add the following lines:
|
17 |
+
|
18 |
+
```json
|
19 |
+
{
|
20 |
+
"require": {
|
21 |
+
"xrstf/composer-php52": "1.*"
|
22 |
+
},
|
23 |
+
"scripts": {
|
24 |
+
"post-install-cmd": [
|
25 |
+
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
26 |
+
],
|
27 |
+
"post-update-cmd": [
|
28 |
+
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
29 |
+
],
|
30 |
+
"post-autoload-dump": [
|
31 |
+
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
32 |
+
]
|
33 |
+
}
|
34 |
+
}
|
35 |
+
```
|
36 |
+
|
37 |
+
After the next update/install, you will have a `vendor/autoload_52.php` file, that you can simply include and use in PHP 5.2 projects.
|
vendor/xrstf/composer-php52/composer.json
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "xrstf/composer-php52",
|
3 |
+
"license": "MIT",
|
4 |
+
"support": {
|
5 |
+
"source": "https://github.com/composer-php52/composer-php52",
|
6 |
+
"issues": "https://github.com/composer-php52/composer-php52/issues"
|
7 |
+
},
|
8 |
+
"autoload": {
|
9 |
+
"psr-0": {
|
10 |
+
"xrstf\\Composer52": "lib/"
|
11 |
+
}
|
12 |
+
},
|
13 |
+
"scripts": {
|
14 |
+
"post-install-cmd": [
|
15 |
+
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
16 |
+
],
|
17 |
+
"post-update-cmd": [
|
18 |
+
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
19 |
+
]
|
20 |
+
},
|
21 |
+
"extra": {
|
22 |
+
"branch-alias": {
|
23 |
+
"dev-default": "1.x-dev"
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
vendor/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php
ADDED
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
|
4 |
+
*
|
5 |
+
* This file is released under the terms of the MIT license. You can find the
|
6 |
+
* complete text in the attached LICENSE file or online at:
|
7 |
+
*
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
*
|
10 |
+
* --------------------------------------------------------------------------
|
11 |
+
*
|
12 |
+
* 99% of this is copied as-is from the original Composer source code and is
|
13 |
+
* released under MIT license as well. Copyright goes to:
|
14 |
+
*
|
15 |
+
* - Igor Wiedler <igor@wiedler.ch>
|
16 |
+
* - Jordi Boggiano <j.boggiano@seld.be>
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace xrstf\Composer52;
|
20 |
+
|
21 |
+
use Composer\Autoload\AutoloadGenerator as BaseGenerator;
|
22 |
+
use Composer\Autoload\ClassMapGenerator;
|
23 |
+
use Composer\Config;
|
24 |
+
use Composer\Installer\InstallationManager;
|
25 |
+
use Composer\Package\AliasPackage;
|
26 |
+
use Composer\Package\PackageInterface;
|
27 |
+
use Composer\Repository\InstalledRepositoryInterface;
|
28 |
+
use Composer\Util\Filesystem;
|
29 |
+
|
30 |
+
class AutoloadGenerator extends BaseGenerator {
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var bool
|
34 |
+
*/
|
35 |
+
private $classMapAuthoritative = false;
|
36 |
+
|
37 |
+
public function __construct() {
|
38 |
+
// do nothing (but keep this constructor so we can build an instance without the need for an event dispatcher)
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Whether or not generated autoloader considers the class map
|
43 |
+
* authoritative.
|
44 |
+
*
|
45 |
+
* @param bool $classMapAuthoritative
|
46 |
+
*/
|
47 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
48 |
+
{
|
49 |
+
$this->classMapAuthoritative = (boolean) $classMapAuthoritative;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '') {
|
53 |
+
if ($this->classMapAuthoritative) {
|
54 |
+
// Force scanPsr0Packages when classmap is authoritative
|
55 |
+
$scanPsr0Packages = true;
|
56 |
+
}
|
57 |
+
|
58 |
+
$filesystem = new Filesystem();
|
59 |
+
$filesystem->ensureDirectoryExists($config->get('vendor-dir'));
|
60 |
+
|
61 |
+
$cwd = getcwd();
|
62 |
+
$basePath = $filesystem->normalizePath($cwd);
|
63 |
+
$vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir')));
|
64 |
+
$targetDir = $vendorPath.'/'.$targetDir;
|
65 |
+
$filesystem->ensureDirectoryExists($targetDir);
|
66 |
+
|
67 |
+
$useGlobalIncludePath = (bool) $config->get('use-include-path');
|
68 |
+
$prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
|
69 |
+
$classMapAuthoritative = $config->get('classmap-authoritative');
|
70 |
+
|
71 |
+
$vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
|
72 |
+
$vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
|
73 |
+
|
74 |
+
$appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
|
75 |
+
$appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
|
76 |
+
|
77 |
+
// add 5.2 compat
|
78 |
+
$vendorPathCode = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
|
79 |
+
$vendorPathToTargetDirCode = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathToTargetDirCode);
|
80 |
+
|
81 |
+
$packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
|
82 |
+
$autoloads = $this->parseAutoloads($packageMap, $mainPackage);
|
83 |
+
|
84 |
+
// add custom psr-0 autoloading if the root package has a target dir
|
85 |
+
$targetDirLoader = null;
|
86 |
+
$mainAutoload = $mainPackage->getAutoload();
|
87 |
+
if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
|
88 |
+
$levels = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
|
89 |
+
$prefixes = implode(', ', array_map(function ($prefix) {
|
90 |
+
return var_export($prefix, true);
|
91 |
+
}, array_keys($mainAutoload['psr-0'])));
|
92 |
+
|
93 |
+
$baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
|
94 |
+
|
95 |
+
$targetDirLoader = <<<EOF
|
96 |
+
|
97 |
+
public static function autoload(\$class) {
|
98 |
+
\$dir = $baseDirFromTargetDirCode.'/';
|
99 |
+
\$prefixes = array($prefixes);
|
100 |
+
|
101 |
+
foreach (\$prefixes as \$prefix) {
|
102 |
+
if (0 !== strpos(\$class, \$prefix)) {
|
103 |
+
continue;
|
104 |
+
}
|
105 |
+
|
106 |
+
\$path = explode(DIRECTORY_SEPARATOR, self::getClassPath(\$class));
|
107 |
+
\$path = \$dir.implode('/', array_slice(\$path, $levels));
|
108 |
+
|
109 |
+
if (!\$path = self::resolveIncludePath(\$path)) {
|
110 |
+
return false;
|
111 |
+
}
|
112 |
+
|
113 |
+
require \$path;
|
114 |
+
return true;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
EOF;
|
119 |
+
}
|
120 |
+
|
121 |
+
$filesCode = "";
|
122 |
+
$autoloads['files'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['files']));
|
123 |
+
foreach ($autoloads['files'] as $functionFile) {
|
124 |
+
// don't include file if it is using PHP 5.3+ syntax
|
125 |
+
// https://bitbucket.org/xrstf/composer-php52/issue/4
|
126 |
+
if ($this->isPHP53($functionFile)) {
|
127 |
+
$filesCode .= '// require '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile)."; // disabled because of PHP 5.3 syntax\n";
|
128 |
+
}
|
129 |
+
else {
|
130 |
+
$filesCode .= ' require '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile).";\n";
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
if (!$suffix) {
|
135 |
+
$suffix = md5(uniqid('', true));
|
136 |
+
}
|
137 |
+
|
138 |
+
$includePathFile = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode);
|
139 |
+
|
140 |
+
file_put_contents($vendorPath.'/autoload_52.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
|
141 |
+
file_put_contents($targetDir.'/autoload_real_52.php', $this->getAutoloadRealFile(true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader));
|
142 |
+
|
143 |
+
// use stream_copy_to_stream instead of copy
|
144 |
+
// to work around https://bugs.php.net/bug.php?id=64634
|
145 |
+
$sourceLoader = fopen(__DIR__.'/ClassLoader.php', 'r');
|
146 |
+
$targetLoader = fopen($targetDir.'/ClassLoader52.php', 'w+');
|
147 |
+
stream_copy_to_stream($sourceLoader, $targetLoader);
|
148 |
+
fclose($sourceLoader);
|
149 |
+
fclose($targetLoader);
|
150 |
+
unset($sourceLoader, $targetLoader);
|
151 |
+
}
|
152 |
+
|
153 |
+
protected function isPHP53($file) {
|
154 |
+
$tokens = token_get_all(file_get_contents($file));
|
155 |
+
$php53 = array(T_DIR, T_GOTO, T_NAMESPACE, T_NS_C, T_NS_SEPARATOR, T_USE);
|
156 |
+
|
157 |
+
// PHP 5.4+
|
158 |
+
if (defined('T_TRAIT')) {
|
159 |
+
$php53[] = T_TRAIT;
|
160 |
+
$php53[] = T_TRAIT_C;
|
161 |
+
$php53[] = T_TRAIT_C;
|
162 |
+
}
|
163 |
+
|
164 |
+
// PHP 5.5+
|
165 |
+
if (defined('T_FINALLY')) {
|
166 |
+
$php53[] = T_FINALLY;
|
167 |
+
$php53[] = T_YIELD;
|
168 |
+
}
|
169 |
+
|
170 |
+
foreach ($tokens as $token) {
|
171 |
+
if (is_array($token) && in_array($token[0], $php53)) {
|
172 |
+
return true;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
return false;
|
177 |
+
}
|
178 |
+
|
179 |
+
protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode) {
|
180 |
+
$includePaths = array();
|
181 |
+
|
182 |
+
foreach ($packageMap as $item) {
|
183 |
+
list($package, $installPath) = $item;
|
184 |
+
|
185 |
+
if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
|
186 |
+
$installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
|
187 |
+
}
|
188 |
+
|
189 |
+
foreach ($package->getIncludePaths() as $includePath) {
|
190 |
+
$includePath = trim($includePath, '/');
|
191 |
+
$includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
if (!$includePaths) {
|
196 |
+
return;
|
197 |
+
}
|
198 |
+
|
199 |
+
$includePathsFile = <<<EOF
|
200 |
+
<?php
|
201 |
+
|
202 |
+
// include_paths_52.php generated by xrstf/composer-php52
|
203 |
+
|
204 |
+
\$vendorDir = $vendorPathCode;
|
205 |
+
\$baseDir = $appBaseDirCode;
|
206 |
+
|
207 |
+
return array(
|
208 |
+
|
209 |
+
EOF;
|
210 |
+
|
211 |
+
foreach ($includePaths as $path) {
|
212 |
+
$includePathsFile .= "\t" . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
|
213 |
+
}
|
214 |
+
|
215 |
+
return $includePathsFile . ");\n";
|
216 |
+
}
|
217 |
+
|
218 |
+
protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix) {
|
219 |
+
return <<<AUTOLOAD
|
220 |
+
<?php
|
221 |
+
|
222 |
+
// autoload_52.php generated by xrstf/composer-php52
|
223 |
+
|
224 |
+
require_once $vendorPathToTargetDirCode.'/autoload_real_52.php';
|
225 |
+
|
226 |
+
return ComposerAutoloaderInit$suffix::getLoader();
|
227 |
+
|
228 |
+
AUTOLOAD;
|
229 |
+
}
|
230 |
+
|
231 |
+
protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000) {
|
232 |
+
// TODO the class ComposerAutoloaderInit should be revert to a closure
|
233 |
+
// when APC has been fixed:
|
234 |
+
// - https://github.com/composer/composer/issues/959
|
235 |
+
// - https://bugs.php.net/bug.php?id=52144
|
236 |
+
// - https://bugs.php.net/bug.php?id=61576
|
237 |
+
// - https://bugs.php.net/bug.php?id=59298
|
238 |
+
|
239 |
+
if ($filesCode) {
|
240 |
+
$filesCode = "\n\n".rtrim($filesCode);
|
241 |
+
}
|
242 |
+
|
243 |
+
$file = <<<HEADER
|
244 |
+
<?php
|
245 |
+
|
246 |
+
// autoload_real_52.php generated by xrstf/composer-php52
|
247 |
+
|
248 |
+
class ComposerAutoloaderInit$suffix {
|
249 |
+
private static \$loader;
|
250 |
+
|
251 |
+
public static function loadClassLoader(\$class) {
|
252 |
+
if ('xrstf_Composer52_ClassLoader' === \$class) {
|
253 |
+
require dirname(__FILE__).'/ClassLoader52.php';
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* @return xrstf_Composer52_ClassLoader
|
259 |
+
*/
|
260 |
+
public static function getLoader() {
|
261 |
+
if (null !== self::\$loader) {
|
262 |
+
return self::\$loader;
|
263 |
+
}
|
264 |
+
|
265 |
+
spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true /*, true */);
|
266 |
+
self::\$loader = \$loader = new xrstf_Composer52_ClassLoader();
|
267 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
|
268 |
+
|
269 |
+
\$vendorDir = $vendorPathCode;
|
270 |
+
\$baseDir = $appBaseDirCode;
|
271 |
+
\$dir = dirname(__FILE__);
|
272 |
+
|
273 |
+
|
274 |
+
HEADER;
|
275 |
+
|
276 |
+
if ($useIncludePath) {
|
277 |
+
$file .= <<<'INCLUDE_PATH'
|
278 |
+
$includePaths = require $dir.'/include_paths.php';
|
279 |
+
array_push($includePaths, get_include_path());
|
280 |
+
set_include_path(implode(PATH_SEPARATOR, $includePaths));
|
281 |
+
|
282 |
+
|
283 |
+
INCLUDE_PATH;
|
284 |
+
}
|
285 |
+
|
286 |
+
$file .= <<<'PSR0'
|
287 |
+
$map = require $dir.'/autoload_namespaces.php';
|
288 |
+
foreach ($map as $namespace => $path) {
|
289 |
+
$loader->add($namespace, $path);
|
290 |
+
}
|
291 |
+
|
292 |
+
|
293 |
+
PSR0;
|
294 |
+
|
295 |
+
if ($useClassMap) {
|
296 |
+
$file .= <<<'CLASSMAP'
|
297 |
+
$classMap = require $dir.'/autoload_classmap.php';
|
298 |
+
if ($classMap) {
|
299 |
+
$loader->addClassMap($classMap);
|
300 |
+
}
|
301 |
+
|
302 |
+
|
303 |
+
CLASSMAP;
|
304 |
+
}
|
305 |
+
|
306 |
+
if ($this->classMapAuthoritative) {
|
307 |
+
$file .= <<<'CLASSMAPAUTHORITATIVE'
|
308 |
+
$loader->setClassMapAuthoritative(true);
|
309 |
+
|
310 |
+
CLASSMAPAUTHORITATIVE;
|
311 |
+
}
|
312 |
+
|
313 |
+
if ($useGlobalIncludePath) {
|
314 |
+
$file .= <<<'INCLUDEPATH'
|
315 |
+
$loader->setUseIncludePath(true);
|
316 |
+
|
317 |
+
|
318 |
+
INCLUDEPATH;
|
319 |
+
}
|
320 |
+
|
321 |
+
if ($targetDirLoader) {
|
322 |
+
$file .= <<<REGISTER_AUTOLOAD
|
323 |
+
spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true);
|
324 |
+
|
325 |
+
|
326 |
+
REGISTER_AUTOLOAD;
|
327 |
+
|
328 |
+
}
|
329 |
+
|
330 |
+
$file .= <<<METHOD_FOOTER
|
331 |
+
\$loader->register($prependAutoloader);{$filesCode}
|
332 |
+
|
333 |
+
return \$loader;
|
334 |
+
}
|
335 |
+
|
336 |
+
METHOD_FOOTER;
|
337 |
+
|
338 |
+
$file .= $targetDirLoader;
|
339 |
+
|
340 |
+
return $file . <<<FOOTER
|
341 |
+
}
|
342 |
+
|
343 |
+
FOOTER;
|
344 |
+
|
345 |
+
}
|
346 |
+
}
|
vendor/xrstf/composer-php52/lib/xrstf/Composer52/ClassLoader.php
ADDED
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
|
4 |
+
*
|
5 |
+
* This file is released under the terms of the MIT license. You can find the
|
6 |
+
* complete text in the attached LICENSE file or online at:
|
7 |
+
*
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
*
|
10 |
+
* --------------------------------------------------------------------------
|
11 |
+
*
|
12 |
+
* 99% of this is copied as-is from the original Composer source code and is
|
13 |
+
* released under MIT license as well. Copyright goes to:
|
14 |
+
*
|
15 |
+
* - Fabien Potencier <fabien@symfony.com>
|
16 |
+
* - Jordi Boggiano <j.boggiano@seld.be>
|
17 |
+
*/
|
18 |
+
|
19 |
+
class xrstf_Composer52_ClassLoader {
|
20 |
+
private $prefixes = array();
|
21 |
+
private $fallbackDirs = array();
|
22 |
+
private $useIncludePath = false;
|
23 |
+
private $classMap = array();
|
24 |
+
private $classMapAuthoratative = false;
|
25 |
+
private $allowUnderscore = false;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param boolean $flag true to allow class names with a leading underscore, false to disable
|
29 |
+
*/
|
30 |
+
public function setAllowUnderscore($flag) {
|
31 |
+
$this->allowUnderscore = (boolean) $flag;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
public function getPrefixes() {
|
38 |
+
return $this->prefixes;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Turns off searching the prefix and fallback directories for classes
|
43 |
+
* that have not been registered with the class map.
|
44 |
+
*
|
45 |
+
* @param bool $classMapAuthoratative
|
46 |
+
*/
|
47 |
+
public function setClassMapAuthoritative($classMapAuthoratative) {
|
48 |
+
$this->classMapAuthoratative = $classMapAuthoratative;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Should class lookup fail if not found in the current class map?
|
53 |
+
*
|
54 |
+
* @return bool
|
55 |
+
*/
|
56 |
+
public function getClassMapAuthoratative() {
|
57 |
+
return $this->classMapAuthoratative;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @return array
|
62 |
+
*/
|
63 |
+
public function getFallbackDirs() {
|
64 |
+
return $this->fallbackDirs;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @return array
|
69 |
+
*/
|
70 |
+
public function getClassMap() {
|
71 |
+
return $this->classMap;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @param array $classMap class to filename map
|
76 |
+
*/
|
77 |
+
public function addClassMap(array $classMap) {
|
78 |
+
if ($this->classMap) {
|
79 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
80 |
+
}
|
81 |
+
else {
|
82 |
+
$this->classMap = $classMap;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Registers a set of classes, merging with any others previously set.
|
88 |
+
*
|
89 |
+
* @param string $prefix the classes prefix
|
90 |
+
* @param array|string $paths the location(s) of the classes
|
91 |
+
* @param bool $prepend prepend the location(s)
|
92 |
+
*/
|
93 |
+
public function add($prefix, $paths, $prepend = false) {
|
94 |
+
if (!$prefix) {
|
95 |
+
if ($prepend) {
|
96 |
+
$this->fallbackDirs = array_merge(
|
97 |
+
(array) $paths,
|
98 |
+
$this->fallbackDirs
|
99 |
+
);
|
100 |
+
}
|
101 |
+
else {
|
102 |
+
$this->fallbackDirs = array_merge(
|
103 |
+
$this->fallbackDirs,
|
104 |
+
(array) $paths
|
105 |
+
);
|
106 |
+
}
|
107 |
+
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
if (!isset($this->prefixes[$prefix])) {
|
112 |
+
$this->prefixes[$prefix] = (array) $paths;
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
if ($prepend) {
|
117 |
+
$this->prefixes[$prefix] = array_merge(
|
118 |
+
(array) $paths,
|
119 |
+
$this->prefixes[$prefix]
|
120 |
+
);
|
121 |
+
}
|
122 |
+
else {
|
123 |
+
$this->prefixes[$prefix] = array_merge(
|
124 |
+
$this->prefixes[$prefix],
|
125 |
+
(array) $paths
|
126 |
+
);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Registers a set of classes, replacing any others previously set.
|
132 |
+
*
|
133 |
+
* @param string $prefix the classes prefix
|
134 |
+
* @param array|string $paths the location(s) of the classes
|
135 |
+
*/
|
136 |
+
public function set($prefix, $paths) {
|
137 |
+
if (!$prefix) {
|
138 |
+
$this->fallbackDirs = (array) $paths;
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
$this->prefixes[$prefix] = (array) $paths;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Turns on searching the include path for class files.
|
147 |
+
*
|
148 |
+
* @param bool $useIncludePath
|
149 |
+
*/
|
150 |
+
public function setUseIncludePath($useIncludePath) {
|
151 |
+
$this->useIncludePath = $useIncludePath;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Can be used to check if the autoloader uses the include path to check
|
156 |
+
* for classes.
|
157 |
+
*
|
158 |
+
* @return bool
|
159 |
+
*/
|
160 |
+
public function getUseIncludePath() {
|
161 |
+
return $this->useIncludePath;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Registers this instance as an autoloader.
|
166 |
+
*/
|
167 |
+
public function register() {
|
168 |
+
spl_autoload_register(array($this, 'loadClass'), true);
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Unregisters this instance as an autoloader.
|
173 |
+
*/
|
174 |
+
public function unregister() {
|
175 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Loads the given class or interface.
|
180 |
+
*
|
181 |
+
* @param string $class the name of the class
|
182 |
+
* @return bool|null true, if loaded
|
183 |
+
*/
|
184 |
+
public function loadClass($class) {
|
185 |
+
if ($file = $this->findFile($class)) {
|
186 |
+
include $file;
|
187 |
+
return true;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Finds the path to the file where the class is defined.
|
193 |
+
*
|
194 |
+
* @param string $class the name of the class
|
195 |
+
* @return string|null the path, if found
|
196 |
+
*/
|
197 |
+
public function findFile($class) {
|
198 |
+
if ('\\' === $class[0]) {
|
199 |
+
$class = substr($class, 1);
|
200 |
+
}
|
201 |
+
|
202 |
+
if (isset($this->classMap[$class])) {
|
203 |
+
return $this->classMap[$class];
|
204 |
+
}
|
205 |
+
elseif ($this->classMapAuthoratative) {
|
206 |
+
return false;
|
207 |
+
}
|
208 |
+
|
209 |
+
$classPath = $this->getClassPath($class);
|
210 |
+
|
211 |
+
foreach ($this->prefixes as $prefix => $dirs) {
|
212 |
+
if (0 === strpos($class, $prefix)) {
|
213 |
+
foreach ($dirs as $dir) {
|
214 |
+
if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
|
215 |
+
return $dir.DIRECTORY_SEPARATOR.$classPath;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
foreach ($this->fallbackDirs as $dir) {
|
222 |
+
if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
|
223 |
+
return $dir.DIRECTORY_SEPARATOR.$classPath;
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
if ($this->useIncludePath && $file = self::resolveIncludePath($classPath)) {
|
228 |
+
return $file;
|
229 |
+
}
|
230 |
+
|
231 |
+
return $this->classMap[$class] = false;
|
232 |
+
}
|
233 |
+
|
234 |
+
private function getClassPath($class) {
|
235 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
236 |
+
// namespaced class name
|
237 |
+
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)).DIRECTORY_SEPARATOR;
|
238 |
+
$className = substr($class, $pos + 1);
|
239 |
+
}
|
240 |
+
else {
|
241 |
+
// PEAR-like class name
|
242 |
+
$classPath = null;
|
243 |
+
$className = $class;
|
244 |
+
}
|
245 |
+
|
246 |
+
$className = str_replace('_', DIRECTORY_SEPARATOR, $className);
|
247 |
+
|
248 |
+
// restore the prefix
|
249 |
+
if ($this->allowUnderscore && DIRECTORY_SEPARATOR === $className[0]) {
|
250 |
+
$className[0] = '_';
|
251 |
+
}
|
252 |
+
|
253 |
+
$classPath .= $className.'.php';
|
254 |
+
|
255 |
+
return $classPath;
|
256 |
+
}
|
257 |
+
|
258 |
+
public static function resolveIncludePath($classPath) {
|
259 |
+
$paths = explode(PATH_SEPARATOR, get_include_path());
|
260 |
+
|
261 |
+
foreach ($paths as $path) {
|
262 |
+
$path = rtrim($path, '/\\');
|
263 |
+
|
264 |
+
if ($file = file_exists($path.DIRECTORY_SEPARATOR.$file)) {
|
265 |
+
return $file;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
return false;
|
270 |
+
}
|
271 |
+
}
|
vendor/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
|
4 |
+
*
|
5 |
+
* This file is released under the terms of the MIT license. You can find the
|
6 |
+
* complete text in the attached LICENSE file or online at:
|
7 |
+
*
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace xrstf\Composer52;
|
12 |
+
|
13 |
+
use Composer\Repository\CompositeRepository;
|
14 |
+
use Composer\Script\Event;
|
15 |
+
|
16 |
+
class Generator {
|
17 |
+
public static function onPostInstallCmd(Event $event) {
|
18 |
+
$composer = $event->getComposer();
|
19 |
+
$installationManager = $composer->getInstallationManager();
|
20 |
+
$repoManager = $composer->getRepositoryManager();
|
21 |
+
$localRepo = $repoManager->getLocalRepository();
|
22 |
+
$package = $composer->getPackage();
|
23 |
+
$config = $composer->getConfig();
|
24 |
+
|
25 |
+
// We can't gain access to the Command's input object, so we have to look
|
26 |
+
// for -o / --optimize-autoloader ourselves. Sadly, neither getopt() works
|
27 |
+
// (always returns an empty array), nor does Symfony's Console Input, as
|
28 |
+
// it expects a full definition of the current command line and we can't
|
29 |
+
// provide that.
|
30 |
+
|
31 |
+
$args = $_SERVER['argv'];
|
32 |
+
$optimize = in_array('-o', $args) || in_array('--optimize-autoloader', $args) || in_array('--optimize', $args);
|
33 |
+
|
34 |
+
$suffix = $config->get('autoloader-suffix');
|
35 |
+
|
36 |
+
$generator = new AutoloadGenerator();
|
37 |
+
$generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize, $suffix);
|
38 |
+
}
|
39 |
+
}
|