PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 3.1
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v3.1
4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / Themes / DragDrop / ThemesRepository.php
wp-user-avatar / src / Themes / DragDrop Last commit date
EditProfile 5 years ago Login 5 years ago MemberDirectory 5 years ago PasswordReset 5 years ago Registration 5 years ago UserProfile 5 years ago AbstractBuildScratch.php 5 years ago AbstractMemberDirectoryTheme.php 5 years ago AbstractTheme.php 5 years ago FieldListing.php 5 years ago MemberDirectoryListing.php 5 years ago ProfileFieldListing.php 5 years ago ThemeInterface.php 5 years ago ThemesRepository.php 5 years ago index.php 5 years ago
ThemesRepository.php
337 lines
1 <?php
2
3 namespace ProfilePress\Core\Themes\DragDrop;
4
5
6 use ProfilePress\Core\Classes\FormRepository;
7
8 class ThemesRepository
9 {
10 private static $themes;
11
12 public static function defaultThemes()
13 {
14 if (is_null(self::$themes)) {
15 self::$themes = apply_filters('ppress_registered_dragdrop_themes',
16 array_merge(self::freeThemes(), self::premiumThemes())
17 );
18 }
19 }
20
21 public static function freeThemes()
22 {
23 return [
24 [
25 'name' => 'Tulip',
26 'theme_class' => 'Tulip',
27 'theme_type' => FormRepository::REGISTRATION_TYPE,
28 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/tulip-registration.png'
29 ],
30 [
31 'name' => 'Perfecto Lite',
32 'theme_class' => 'PerfectoLite',
33 'theme_type' => FormRepository::REGISTRATION_TYPE,
34 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/perfectolite-registration.png'
35 ],
36
37 [
38 'name' => 'Tulip',
39 'theme_class' => 'Tulip',
40 'theme_type' => FormRepository::EDIT_PROFILE_TYPE,
41 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/tulip-edit-profile.png'
42 ],
43
44 [
45 'name' => 'Tulip',
46 'theme_class' => 'Tulip',
47 'theme_type' => FormRepository::LOGIN_TYPE,
48 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/tulip-login.png'
49 ],
50 [
51 'name' => 'Perfecto Lite',
52 'theme_class' => 'PerfectoLite',
53 'theme_type' => FormRepository::LOGIN_TYPE,
54 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/perfectolite-login.png'
55 ],
56
57
58 [
59 'name' => 'Tulip',
60 'theme_class' => 'Tulip',
61 'theme_type' => FormRepository::PASSWORD_RESET_TYPE,
62 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/tulip-password-reset.png'
63 ],
64
65 [
66 'name' => 'Default',
67 'theme_class' => 'DefaultTemplate',
68 'theme_type' => FormRepository::USER_PROFILE_TYPE,
69 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/default-user-profile.png'
70 ],
71 [
72 'name' => 'Dixon',
73 'theme_class' => 'Dixon',
74 'theme_type' => FormRepository::USER_PROFILE_TYPE,
75 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/dixon-profile.png'
76 ],
77
78 [
79 'name' => 'Default',
80 'theme_class' => 'DefaultTemplate',
81 'theme_type' => FormRepository::MEMBERS_DIRECTORY_TYPE,
82 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/default-member-directory.png'
83 ],
84 [
85 'name' => 'Gerbera',
86 'theme_class' => 'Gerbera',
87 'theme_type' => FormRepository::MEMBERS_DIRECTORY_TYPE,
88 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/gerbera-member-directory.png'
89 ],
90 ];
91 }
92
93 public static function premiumThemes()
94 {
95 return [
96 [
97 'name' => 'Daffodil',
98 'theme_class' => 'Daffodil',
99 'flag' => 'premium',
100 'theme_type' => FormRepository::REGISTRATION_TYPE,
101 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/daffodil-registration.png'
102 ],
103 [
104 'name' => 'Smiley',
105 'theme_class' => 'Smiley',
106 'flag' => 'premium',
107 'theme_type' => FormRepository::REGISTRATION_TYPE,
108 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/smiley-registration.png'
109 ],
110 [
111 'name' => 'Pinnacle',
112 'theme_class' => 'Pinnacle',
113 'flag' => 'premium',
114 'theme_type' => FormRepository::REGISTRATION_TYPE,
115 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/pinnacle-login-registration.png'
116 ],
117 [
118 'name' => 'Bash',
119 'theme_class' => 'Bash',
120 'flag' => 'premium',
121 'theme_type' => FormRepository::REGISTRATION_TYPE,
122 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/bash-registration.png'
123 ],
124 [
125 'name' => 'Perfecto Pro',
126 'theme_class' => 'PerfectoPro',
127 'flag' => 'premium',
128 'theme_type' => FormRepository::REGISTRATION_TYPE,
129 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/perfectopro-registration.png'
130 ],
131
132 [
133 'name' => 'Daffodil',
134 'theme_class' => 'Daffodil',
135 'flag' => 'premium',
136 'theme_type' => FormRepository::EDIT_PROFILE_TYPE,
137 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/daffodil-edit-profile.png'
138 ],
139 [
140 'name' => 'Smiley',
141 'theme_class' => 'Smiley',
142 'flag' => 'premium',
143 'theme_type' => FormRepository::EDIT_PROFILE_TYPE,
144 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/smiley-edit-profile.png'
145 ],
146 [
147 'name' => 'Perfecto',
148 'theme_class' => 'Perfecto',
149 'flag' => 'premium',
150 'theme_type' => FormRepository::EDIT_PROFILE_TYPE,
151 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/perfectolite-edit-profile.png'
152 ],
153 [
154 'name' => 'Pinnacle',
155 'theme_class' => 'Pinnacle',
156 'flag' => 'premium',
157 'theme_type' => FormRepository::EDIT_PROFILE_TYPE,
158 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/pinnacle-edit-profile.png'
159 ],
160
161 [
162 'name' => 'Daffodil',
163 'theme_class' => 'Daffodil',
164 'flag' => 'premium',
165 'theme_type' => FormRepository::LOGIN_TYPE,
166 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/daffodil-login.png'
167 ],
168 [
169 'name' => 'Bash',
170 'theme_class' => 'Bash',
171 'flag' => 'premium',
172 'theme_type' => FormRepository::LOGIN_TYPE,
173 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/bash-login.png'
174 ],
175 [
176 'name' => 'Perfecto Pro',
177 'theme_class' => 'PerfectoPro',
178 'flag' => 'premium',
179 'theme_type' => FormRepository::LOGIN_TYPE,
180 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/perfectopro-login.png'
181 ],
182 [
183 'name' => 'Smiley',
184 'theme_class' => 'Smiley',
185 'flag' => 'premium',
186 'theme_type' => FormRepository::LOGIN_TYPE,
187 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/smiley-login.png'
188 ],
189 [
190 'name' => 'Pinnacle',
191 'theme_class' => 'Pinnacle',
192 'flag' => 'premium',
193 'theme_type' => FormRepository::LOGIN_TYPE,
194 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/pinnacle-login-registration.png'
195 ],
196
197 [
198 'name' => 'Daffodil',
199 'theme_class' => 'Daffodil',
200 'flag' => 'premium',
201 'theme_type' => FormRepository::PASSWORD_RESET_TYPE,
202 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/daffodil-password-reset.png'
203 ],
204 [
205 'name' => 'Smiley',
206 'theme_class' => 'Smiley',
207 'flag' => 'premium',
208 'theme_type' => FormRepository::PASSWORD_RESET_TYPE,
209 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/smiley-password-reset.png'
210 ],
211 [
212 'name' => 'Bash',
213 'theme_class' => 'Bash',
214 'flag' => 'premium',
215 'theme_type' => FormRepository::PASSWORD_RESET_TYPE,
216 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/bash-password-reset.png'
217 ],
218 [
219 'name' => 'Perfecto',
220 'theme_class' => 'Perfecto',
221 'flag' => 'premium',
222 'theme_type' => FormRepository::PASSWORD_RESET_TYPE,
223 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/perfectolite-password-reset.png'
224 ],
225 [
226 'name' => 'Pinnacle',
227 'theme_class' => 'Pinnacle',
228 'flag' => 'premium',
229 'theme_type' => FormRepository::PASSWORD_RESET_TYPE,
230 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/pinnacle-password-reset.png'
231 ],
232
233 [
234 'name' => 'Smiley',
235 'theme_class' => 'Smiley',
236 'flag' => 'premium',
237 'theme_type' => FormRepository::USER_PROFILE_TYPE,
238 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/smiley-profile.png'
239 ],
240 [
241 'name' => 'Monochrome',
242 'theme_class' => 'Monochrome',
243 'flag' => 'premium',
244 'theme_type' => FormRepository::USER_PROFILE_TYPE,
245 'screenshot' => PPRESS_ASSETS_URL . '/images/themes/monochrome-profile.png'
246 ],
247 ];
248 }
249
250 /**
251 * All Optin themes available.
252 *
253 * @return mixed
254 */
255 public static function get_all()
256 {
257 self::defaultThemes();
258
259 return self::$themes;
260 }
261
262 /**
263 * Get form themes of a given type.
264 *
265 * @param string $form_type
266 *
267 * @return mixed
268 */
269 public static function get_by_type($form_type)
270 {
271 $all = self::get_all();
272
273 return array_reduce($all, function ($carry, $item) use ($form_type) {
274
275 // remove leading & trailing whitespace.
276 $form_type_array = array_map('trim', explode(',', $item['theme_type']));
277
278 if (in_array($form_type, $form_type_array)) {
279 $carry[] = $item;
280 }
281
282 return $carry;
283 }, []);
284 }
285
286 /**
287 * Get form theme by name.
288 *
289 * @param string $name
290 *
291 * @return mixed
292 */
293 public static function get_by_name($name)
294 {
295 $all = self::get_all();
296
297 return array_reduce($all, function ($carry, $item) use ($name) {
298
299 if ($item['name'] == $name) {
300 $carry = $item;
301 }
302
303 return $carry;
304 });
305 }
306
307 /**
308 * Add form theme to theme repository.
309 *
310 * @param mixed $data
311 *
312 * @return void
313 */
314 public static function add($data)
315 {
316 self::defaultThemes();
317 self::$themes[] = $data;
318 }
319
320 /**
321 * Delete form theme from stack.
322 *
323 * @param mixed $theme_name
324 *
325 * @return void
326 */
327 public static function delete_by_name($theme_name)
328 {
329 self::defaultThemes();
330
331 foreach (self::$themes as $index => $theme) {
332 if ($theme['name'] == $theme_name) {
333 unset(self::$themes[$index]);
334 }
335 }
336 }
337 }