summaryrefslogtreecommitdiff
blob: dc16af35b5c14547664f600c161f70427c6bfe09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
<script type="text/javascript">
    if (window.WMPJSInterface && window.WMPJSInterface != null){
        jQuery(document).ready(function(){

            WMPJSInterface.localpath = "<?php echo plugins_url()."/".WMP_DOMAIN."/"; ?>";
            WMPJSInterface.init();
        });
    }
</script>
<div id="wmpack-admin">
	<div class="spacer-60"></div>
    <!-- set title -->
    <h1><?php echo WMP_PLUGIN_NAME.' '.WMP_VERSION;?></h1>
	<div class="spacer-20"></div>
	<div class="look-and-feel">
        <div class="left-side">

            <!-- add nav menu -->
            <?php include_once(WMP_PLUGIN_PATH.'admin/sections/admin-menu.php'); ?>
            <div class="spacer-0"></div>

            <!-- add content form -->
            <div class="details">
                <div class="spacer-10"></div>
                <p><p>Customize your mobile web application by choosing from the below color schemes &amp; fonts, adding your logo and app icon. The default theme comes with 6 abstract covers that are randomly displayed on the loading screen to give your app a magazine flavor. You can further personalize your mobile web application by uploading your own cover.</p>
                <div class="spacer-20"></div>
            </div>
            <div class="spacer-10"></div>

			<?php
                $theme_settings = WMobilePack_Themes_Config::get_theme_config();

                if ($theme_settings !== false):
            ?>

				<div class="details">
					<h2 class="title">Customize Color Schemes and Fonts</h2>
					<div class="spacer-15"></div>
					<div class="grey-line"></div>
					<div class="spacer-30"></div>

					<?php if (version_compare(PHP_VERSION, '5.3') < 0) :?>
						<div class="message-container warning">
							<div class="wrapper">
								<span>Customizing the theme's colors and fonts requires PHP5.3 or greater. Your PHP version (<?php echo PHP_VERSION;?>) is not supported.</span>
							</div>
						</div>
						<div class="spacer-20"></div>
					<?php endif;?>

					<form name="wmp_edittheme_form" id="wmp_edittheme_form" action="<?php echo admin_url('admin-ajax.php'); ?>?action=wmp_theme_settings" method="post">

						<div class="color-schemes">
							<p class="section-header">Select Color Scheme</p>
							<div class="spacer-20"></div>

							<!-- add labels -->
							<div class="colors description">
								<?php foreach ($theme_settings['labels'] as $key => $description):?>
									<div class="color-" title="<?php echo $description;?>"><?php echo $key+1;?></div>
								<?php endforeach; ?>
							</div>
							<div class="spacer-15"></div>

							<!-- add presets radio buttons & colors -->
							<?php
								$selected_color_scheme = WMobilePack_Options::get_setting('color_scheme');
								if ($selected_color_scheme == '')
									$selected_color_scheme = 1;

								foreach ($theme_settings['presets'] as $color_scheme => $default_colors):
							?>
								<input type="radio" name="wmp_edittheme_colorscheme" id="wmp_edittheme_colorscheme" value="<?php echo $color_scheme;?>" <?php if ($color_scheme == $selected_color_scheme) echo 'checked="checked"';?> autocomplete="off" />
								<div class="colors">

									<?php foreach ($theme_settings['labels'] as $key => $description):?>
										<div class="color-<?php echo $color_scheme.'-'.$key;?>" title="<?php echo $description;?>" style="background: <?php echo $theme_settings['presets'][$color_scheme][$key];?>"></div>
									<?php endforeach;?>

								</div>
								<div class="spacer-20"></div>
							<?php endforeach;?>

							<!-- add custom scheme radio button -->
							<input type="radio" name="wmp_edittheme_colorscheme" id="wmp_edittheme_colorscheme" value="0" <?php echo $selected_color_scheme == 0 ? 'checked="checked"' : '';?> autocomplete="off" />
							<p>Edit custom colors</p>
						</div>

						<!-- start notice -->
						<div class="notice notice-left left" style="width: 50%;">
							<span>
								The color scheme will impact the following sections within the mobile web application:<br/><br/>
								<?php
									foreach ($theme_settings['labels'] as $key => $description)
										echo ($key+1).'.&nbsp;'.$description.'<br/>';
								?>
							</span>
						</div>

						<div class="spacer-20"></div>

						<!-- start color pickers -->
						<div class="color-schemes-custom" style="display: <?php echo $selected_color_scheme == 0 ? 'block' : 'none';?>;">

							<p class="section-header">Your Custom Scheme</p>
							<div class="spacer-20"></div>

							<div class="set">
								<?php
									// display color pickers and divide them into two columns
									$half = ceil( count($theme_settings['labels']) / 2);

									// read the custom colors options array
									$selected_custom_colors = WMobilePack_Options::get_setting('custom_colors');

									foreach ($theme_settings['labels'] as $key => $description):

										$color_value = '';
										if (!empty($selected_custom_colors) && array_key_exists($key, $selected_custom_colors))
											$color_value = $selected_custom_colors[$key];
								?>
									<label for="wmp_edittheme_customcolor<?php echo $key;?>"><?php echo ($key+1).'. '.$description;?></label>
									<input type="text" name="wmp_edittheme_customcolor<?php echo $key;?>" id="wmp_edittheme_customcolor<?php echo $key;?>" value="<?php echo $color_value;?>" autocomplete="off" />
									<div class="spacer-10"></div>

									<?php if ($key + 1 == $half):?>
										</div>
										<div class="set">
									<?php endif;?>

								<?php endforeach;?>
							</div>
						</div>
						<div class="spacer-20"></div>

						<!-- choose fonts -->
						<div class="font-chooser">
							<p class="section-header">Select Fonts</p>
							<div class="spacer-20"></div>

							<!-- add radio buttons -->
							<?php if (array_key_exists('headlines-font', $theme_settings['fonts'])): ?>
								<?php
									$font_headlines = WMobilePack_Options::get_setting('font_headlines');
									if ($font_headlines == '')
										$font_headlines = 1;
								?>

								<label for="wmp_edittheme_fontheadlines">Headlines</label>

								<select name="wmp_edittheme_fontheadlines" id="wmp_edittheme_fontheadlines">

									<?php foreach (WMobilePack_Themes_Config::$allowed_fonts as $key => $font_family): ?>
										<option value="<?php echo $key+1;?>" data-text='<span style="font-family:<?php echo str_replace(" ", "", $font_family);?>"><?php echo $font_family;?></span>' <?php if ($font_headlines == $key+1) echo "selected";?>></option>
									<?php endforeach; ?>
								</select>

								<div class="spacer-10"></div>
							<?php endif; ?>

							<?php if (array_key_exists('subtitles-font', $theme_settings['fonts'])): ?>
								<?php
									$font_subtitles = WMobilePack_Options::get_setting('font_subtitles');
									if ($font_subtitles == '')
										$font_subtitles = 1;
								?>

								<label for="wmp_edittheme_fontsubtitles">Subtitles</label>
								<select name="wmp_edittheme_fontsubtitles" id="wmp_edittheme_fontsubtitles">
									<?php foreach (WMobilePack_Themes_Config::$allowed_fonts as $key => $font_family): ?>
										<option value="<?php echo $key+1;?>" data-text='<span style="font-family:<?php echo str_replace(" ", "", $font_family);?>"><?php echo $font_family;?></span>' <?php if ($font_subtitles == $key+1) echo "selected";?>></option>
									<?php endforeach; ?>
								</select>
								<div class="spacer-10"></div>
							<?php endif; ?>

							<?php if(array_key_exists('paragraphs-font', $theme_settings['fonts'])): ?>
								<?php
									$font_paragraphs = WMobilePack_Options::get_setting('font_paragraphs');
									if ($font_paragraphs == '')
										$font_paragraphs = 1;
								?>

								<label for="wmp_edittheme_fontparagraphs">Paragraphs</label>
								<select name="wmp_edittheme_fontparagraphs" id="wmp_edittheme_fontparagraphs">
									<?php foreach (WMobilePack_Themes_Config::$allowed_fonts as $key => $font_family): ?>
										<option value="<?php echo $key+1;?>" data-text='<span style="font-family:<?php echo str_replace(" ", "", $font_family);?>"><?php echo $font_family;?></span>' <?php if ($font_paragraphs == $key+1) echo "selected";?>></option>
									<?php endforeach; ?>
								</select>
								<div class="spacer-20"></div>
							<?php endif;?>
						</div>

						<div class="spacer-20"></div>
						<a href="javascript:void(0);" id="wmp_edittheme_send_btn" class="btn green smaller" >Save</a>
					</form>
				</div>
				<div class="spacer-15"></div>
            <?php endif;?>

            <div class="details branding">

                <h2 class="title">Customize Your App's Logo and Icon</h2>
                <div class="spacer-15"></div>
                <div class="grey-line"></div>
                <div class="spacer-20"></div>
                <p>You can also personalize your app by adding <strong>your own logo and icon</strong>. The logo will be displayed on the home page of your mobile web app, while the icon will be used when readers add your app to their homescreen.</p>
                <div class="spacer-20"></div>

				<?php
					$warning_message = '';
					$icon_filename = WMobilePack_Options::get_setting('icon');

					if ($icon_filename == '') {
						$warning_message = 'Upload an App Icon to take advantage of the Add To Home Screen functionality!';

					} elseif ($icon_filename != '' && file_exists(WMP_FILES_UPLOADS_DIR . $icon_filename)) {
						foreach (WMobilePack_Uploads::$manifest_sizes as $manifest_size) {
							if (!file_exists(WMP_FILES_UPLOADS_DIR . $manifest_size . $icon_filename)) {
								$warning_message = 'WP Mobile Pack Version 3.1 comes with Add To Home Screen functionality which requires you to reupload your App Icon.';
								break;
							}
						}
					}
				?>

				<div id="wmp_editimages_warning" class="message-container warning" style="display:<?php echo ($warning_message != '') ? 'block':'none' ?>">
					<div class="wrapper">
						<div class="relative"><a class="close-x"></a></div>
						<span><?php echo $warning_message; ?></span>
					</div>
					<div class="spacer-10"></div>
				</div>
                <div class="left">
                    <form name="wmp_editimages_form" id="wmp_editimages_form" action="<?php echo admin_url('admin-ajax.php'); ?>?action=wmp_theme_editimages&type=upload" method="post" enctype="multipart/form-data">

                        <?php
                            $logo_path = WMobilePack_Options::get_setting('logo');

                            if ($logo_path != "") {

                                if (!file_exists(WMP_FILES_UPLOADS_DIR . $logo_path))
                                    $logo_path = '';
                                else
                                    $logo_path = WMP_FILES_UPLOADS_URL . $logo_path;
                            }

                        ?>

                        <!-- upload logo field -->
                        <div class="wmp_editimages_uploadlogo" style="display: <?php echo $logo_path == '' ? 'block' : 'none';?>;">

                            <label for="wmp_editimages_logo">Upload your app logo</label>

                            <div class="custom-upload">

                                <input type="file" id="wmp_editimages_logo" name="wmp_editimages_logo" />
                                <div class="fake-file">
                                    <input type="text" id="fakefilelogo" disabled="disabled" />
                                    <a href="#" class="btn grey smaller">Browse</a>
                                </div>


                                <a href="javascript:void(0)" id="wmp_editimages_logo_removenew" class="remove" style="display: none;"></a>
                            </div>

                            <!-- cancel upload logo button -->
                            <div class="wmp_editimages_changelogo_cancel cancel-link" style="display: none;">
                                <a href="javascript:void(0);" class="cancel">cancel</a>
                            </div>
                            <div class="field-message error" id="error_logo_container"></div>

                        </div>

                        <!-- logo image -->
                        <div class="wmp_editimages_logocontainer display-logo" style="display: <?php echo $logo_path != '' ? 'block' : 'none';?>;">

                            <label for="branding_logo">App logo</label>
                            <div class="img" id="wmp_editimages_currentlogo" style="background:url(<?php echo $logo_path;?>); background-size:contain; background-repeat: no-repeat; background-position: center"></div>

                            <!-- edit/delete logo links -->
                            <a href="javascript:void(0);" class="wmp_editimages_changelogo btn grey smaller edit">Change</a>
                            <a href="#" class="wmp_editimages_deletelogo smaller remove">remove</a>

                        </div>

                        <div class="spacer-20"></div>

                        <?php
                            $icon_path = WMobilePack_Options::get_setting('icon');

                            if ($icon_path != "") {

                                if (!file_exists(WMP_FILES_UPLOADS_DIR . $icon_path))
                                    $icon_path = '';
                                else
                                    $icon_path = WMP_FILES_UPLOADS_URL . $icon_path;
                            }
                        ?>

                        <!-- upload icon field -->
                        <div class="wmp_editimages_uploadicon" style="display: <?php echo $icon_path == '' ? 'block' : 'none';?>;">

                            <label for="wmp_editimages_icon">Upload your app icon</label>

                            <div class="custom-upload">

                                <input type="file" id="wmp_editimages_icon" name="wmp_editimages_icon" />
                                <div class="fake-file">
                                    <input type="text" id="fakefileicon" disabled="disabled" />
                                    <a href="#" class="btn grey smaller">Browse</a>
                                </div>

                                <a href="javascript:void(0)" id="wmp_editimages_icon_removenew" class="remove" style="display: none;"></a>
                            </div>
                            <!-- cancel upload icon button -->
                            <div class="wmp_editimages_changeicon_cancel cancel-link" style="display: none;">
                                <a href="javascript:void(0);" class="cancel">cancel</a>
                            </div>
                            <div class="field-message error" id="error_icon_container"></div>

                        </div>

                        <!-- icon image -->
                        <div class="wmp_editimages_iconcontainer display-icon" style="display: <?php echo $icon_path != '' ? 'block' : 'none';?>;;">

                            <label for="branding_icon">App icon</label>
                            <img src="<?php echo $icon_path;?>" id="wmp_editimages_currenticon" />

                            <!-- edit/delete icon links -->
                            <a href="javascript:void(0);" class="wmp_editimages_changeicon btn grey smaller edit">Change</a>
                            <a href="#" class="wmp_editimages_deleteicon smaller remove">remove</a>
						</div>

						<div class="spacer-20"></div>

						<a href="javascript:void(0);" id="wmp_editimages_send_btn" class="btn green smaller">Save</a>

                    </form>
                </div>

                <div class="notice notice-left right" style="width: 265px;">
                    <span>
                        Add your logo in a .png format with a transparent background. This will be displayed on the cover of your app.<br /><br />
                        Your icon should be square with a recommended size of 256 x 256 px. This will be displayed when the app will be added to the homescreen.<br /><br />
                        The file size for uploaded images should not exceed 1MB.
                    </span>
                </div>
                <div class="spacer-0"></div>
			</div>

			<div class="spacer-15"></div>
			<div class="details">
			<div class="display-mode">
				<h2 class="title">Add to Home Screen</h2>
				<div class="spacer-20"></div>
				<p>In order for your users to be prompted to add the app to their home screen you must add a service worker to the root of your domain.</p>
				<div class="spacer-10"></div>
				<p>Move the 'sw.js' file which is located in the 'wordpress-mobile-pack' plugin directory to the root of your domain '/' using FTP.</p>
				<div class="spacer-10"></div>
				<p>Once you have moved the file to your root, check the box bellow and click 'save'. For more details visit the <a href="https://docs.wpmobilepack.com/wp-mobile-pack-free/look-and-feel.html" target="_blank">support page.</a></p>
				<div class="spacer-30"></div>
				<form name="wmp_service_worker_form" id="wmp_service_worker_form" class="left" action="<?php echo admin_url('admin-ajax.php'); ?>?action=wmp_settings_save" method="post" style="min-width: 300px;">
					<?php $installed = WMobilePack_Options::get_setting('service_worker_installed'); ?>
					<input type="hidden" name="wmp_option_service_worker_installed" id="wmp_option_service_worker_installed" value="<?php echo $installed; ?>"/>
					<input type="checkbox" name="wmp_service_worker_installed_check" id="wmp_service_worker_installed_check" value="1" <?php if ($installed == 1) echo "checked" ;?> />
					<label for="wmp_service_worker_installed_check"> Service Worker Installed </label>
					<div class="spacer-40"></div>
					<a href="javascript:void(0);" id="wmp_service_worker_send_btn" class="btn green smaller">Save</a>
				</form>
			</div>
			<div class="spacer-0"></div>
			</div>


            <div class="spacer-15"></div>

                <div class="details branding">

				<h2 class="title">Customize Your App's Cover</h2>
				<div class="spacer-15"></div>
				<div class="grey-line"></div>
				<div class="spacer-20"></div>
				<p>Each theme comes with 6 abstract covers that are randomly displayed on the loading screen to give your app a magazine flavor. You can further personalize your mobile web application by uploading your own cover.</p>
				<div class="spacer-20"></div>

				<form name="wmp_editcover_form" id="wmp_editcover_form" action="<?php echo admin_url('admin-ajax.php'); ?>?action=wmp_theme_editimages&type=upload" method="post" enctype="multipart/form-data">
					<div class="left">
						<?php
							$cover_path = WMobilePack_Options::get_setting('cover');

							if ($cover_path != "") {

								if (!file_exists(WMP_FILES_UPLOADS_DIR . $cover_path))
									$cover_path = '';
								else
									$cover_path = WMP_FILES_UPLOADS_URL . $cover_path;
							}
						?>

						<!-- upload cover field -->
						<div class="wmp_editcover_uploadcover" style="display: <?php echo $cover_path == '' ? 'block' : 'none';?>;">

							<label for="wmp_editcover_cover">Upload your app cover:</label>

							<div class="custom-upload">

								<input type="file" id="wmp_editcover_cover" name="wmp_editcover_cover" />
								<div class="fake-file">
									<input type="text" id="fakefilecover" disabled="disabled" />
									<a href="#" class="btn grey smaller">Browse</a>
								</div>

								<a href="javascript:void(0)" id="wmp_editcover_cover_removenew" class="remove" style="display: none;"></a>
							</div>

							<!-- cancel upload cover button -->
							<div class="wmp_editcover_changecover_cancel cancel-link" style="display: none;">
								<a href="javascript:void(0);" class="cancel">cancel</a>
							</div>
							<div class="field-message error" id="error_cover_container"></div>

						</div>

						<!-- cover image -->
						<div class="wmp_editcover_covercontainer display-logo" style="display: <?php echo $cover_path != '' ? 'block' : 'none';?>;">

							<label for="branding_cover">App cover:</label>
							<div class="img" id="wmp_editcover_currentcover" style="background:url(<?php echo $cover_path;?>); background-size:contain; background-repeat: no-repeat; background-position: center"></div>

							<!-- edit/delete cover links -->
							<a href="javascript:void(0);" class="wmp_editcover_changecover btn grey smaller edit">Change</a>
							<a href="#" class="wmp_editcover_deletecover smaller remove">remove</a>

						</div>
					</div>

					<div class="notice notice-left right" style="width: 265px;">
						<span>
						   Your cover will be used in portrait and landscape modes, so choose something that will look good on different screen sizes. <br />
						   We recommend using a square image of minimum 500 x 500 px. The file size for uploaded images should not exceed 1MB.
						</span>
					</div>

					<div class="spacer-20"></div>
					<a href="javascript:void(0);" id="wmp_editcover_send_btn" class="btn green smaller">Save</a>

				</form>
				<div class="spacer-0"></div>
			</div>
        </div>

        <div class="right-side">
            <!-- waitlist form -->
            <?php include_once(WMP_PLUGIN_PATH.'admin/sections/waitlist.php'); ?>

            <!-- add feedback form -->
            <?php include_once(WMP_PLUGIN_PATH.'admin/sections/feedback.php'); ?>
        </div>
	</div>
</div>

<script type="text/javascript">
    if (window.WMPJSInterface && window.WMPJSInterface != null){
        jQuery(document).ready(function(){

            window.WMPJSInterface.add("UI_customizetheme","WMP_EDIT_THEME",{'DOMDoc':window.document}, window);
            window.WMPJSInterface.add("UI_editimages","WMP_EDIT_IMAGES",{'DOMDoc':window.document}, window);
			window.WMPJSInterface.add("UI_editcover","WMP_EDIT_COVER",{'DOMDoc':window.document}, window);
			window.WMPJSInterface.add("UI_service_worker","WMP_SERVICE_WORKER",{'DOMDoc':window.document}, window);

        });
    }
</script>