|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Provide a admin area view for the plugin. |
|
5
|
|
|
* |
|
6
|
|
|
* This file is used to markup the admin-facing aspects of the plugin |
|
7
|
|
|
* |
|
8
|
|
|
* @link rahicodes.wordpress.com |
|
9
|
|
|
* @since 1.0.0 |
|
10
|
|
|
* |
|
11
|
|
|
* @package Myslideshow |
|
12
|
|
|
* @subpackage Myslideshow/admin/partials |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* This function renders the custom settings page for 'slideshow settings' |
|
17
|
|
|
* |
|
18
|
|
|
* @since 1.0.1 |
|
19
|
|
|
*/ |
|
20
|
|
|
function mss_render_settings_page() { |
|
21
|
|
|
|
|
22
|
|
|
global $slides_options; |
|
23
|
|
|
$number_of_images = $slides_options['images_number']; |
|
24
|
|
|
$urls = explode(";", $slides_options['image_urls']); |
|
25
|
|
|
|
|
26
|
|
|
if (function_exists('wp_enqueue_media')) { |
|
27
|
|
|
wp_enqueue_media(); |
|
28
|
|
|
} else { |
|
29
|
|
|
wp_enqueue_style('thickbox'); |
|
|
|
|
|
|
30
|
|
|
wp_enqueue_script('media-upload'); |
|
|
|
|
|
|
31
|
|
|
wp_enqueue_script('thickbox'); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
?> |
|
35
|
|
|
<form id="settings_form" method="post" action="options.php"> |
|
36
|
|
|
<?php |
|
37
|
|
|
settings_fields('mss-settings-group'); |
|
|
|
|
|
|
38
|
|
|
?> |
|
39
|
|
|
<div class="settings-wrapper"> |
|
40
|
|
|
|
|
41
|
|
|
<div class="header"> |
|
42
|
|
|
<h2>My Slide Show Control Panel</h2> |
|
43
|
|
|
<span>v1.0.3</span> |
|
44
|
|
|
</div> |
|
45
|
|
|
|
|
46
|
|
|
<span><i><?php esc_html_e('Recommended image dimensions', 'myslideshow'); ?>: 1000 X 560</i></span> |
|
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
<div id="images-container"> |
|
49
|
|
|
<div id="add-image" class="image disable-sort-item"> |
|
50
|
|
|
<span class="dashicons dashicons-plus"></span> |
|
51
|
|
|
</div> |
|
52
|
|
|
|
|
53
|
|
|
<?php |
|
54
|
|
|
// render images from the db |
|
55
|
|
|
for ($i = 0; $i < $number_of_images; $i++) { |
|
56
|
|
|
echo '<div class="image sortable" style="background-image: url(' . $urls[$i] . ');"> |
|
57
|
|
|
<div class="delete-image"> |
|
58
|
|
|
<span class="dashicons dashicons-trash"></span> |
|
59
|
|
|
</div> |
|
60
|
|
|
</div>'; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
?> |
|
64
|
|
|
</div> |
|
65
|
|
|
|
|
66
|
|
|
<div class="footer"> |
|
67
|
|
|
<span><i><b><?php esc_html_e('Tip', 'myslideshow'); ?>: </b> |
|
68
|
|
|
<?php esc_html_e('You can drag images to change their order in the slide show!', 'myslideshow'); ?></i></span> |
|
69
|
|
|
<button id="btn-save" class="button-primary"> <?php _e('Save Changes'); ?></button> |
|
|
|
|
|
|
70
|
|
|
</div> |
|
71
|
|
|
|
|
72
|
|
|
</div> |
|
73
|
|
|
</form> |
|
74
|
|
|
<?php |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Helper function for rendering image slides |
|
79
|
|
|
* |
|
80
|
|
|
* @since 1.0.2 |
|
81
|
|
|
*/ |
|
82
|
|
|
function render_mss_shortcode() { |
|
83
|
|
|
|
|
84
|
|
|
// get slide show options |
|
85
|
|
|
global $slides_options; |
|
86
|
|
|
$html = ''; |
|
87
|
|
|
|
|
88
|
|
|
$number_of_images = $slides_options['images_number']; |
|
89
|
|
|
|
|
90
|
|
|
// check if there are any images added in the slideshow or not |
|
91
|
|
|
if ($number_of_images == 0) { |
|
92
|
|
|
$html .= '<h5> No images found. You can add images in \'Slideshow Settings\' menu in the admin panel. </h5>'; |
|
93
|
|
|
return $html; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
$image_urls = explode(";", $slides_options['image_urls']); |
|
97
|
|
|
$html .= '<div class="mss-slides-container">'; |
|
98
|
|
|
$html .= '<img class="static-bg" src="' . plugins_url('assets/images/default-bg.png', dirname(__FILE__)) . '"/>'; |
|
|
|
|
|
|
99
|
|
|
|
|
100
|
|
|
for ($i = 0; $i < $number_of_images; $i++) { |
|
101
|
|
|
$html .= '<img class="slide" src="' . $image_urls[$i] . '"/>'; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
// arrows |
|
105
|
|
|
$html .= '<div class="arrow left"><img src="' . plugins_url('assets/images/arrow-left.png', dirname(__FILE__)) . '"/></div>'; |
|
106
|
|
|
$html .= '<div class="arrow right"><img src="' . plugins_url('assets/images/arrow-right.png', dirname(__FILE__)) . '"/></div>'; |
|
107
|
|
|
|
|
108
|
|
|
// indicators |
|
109
|
|
|
$html .= '<ul class="indicators">'; |
|
110
|
|
|
|
|
111
|
|
|
for ($i = 0; $i < $number_of_images; $i++) { |
|
112
|
|
|
$html .= '<li></li>'; |
|
113
|
|
|
} |
|
114
|
|
|
$html .= '</ul>'; |
|
115
|
|
|
|
|
116
|
|
|
$html .= '</div>'; |
|
117
|
|
|
|
|
118
|
|
|
return $html; |
|
119
|
|
|
} |
|
120
|
|
|
?> |
|
121
|
|
|
|