Logo Slider - Version 1.4.5

Version Description

  • Off Buttons issue - Fixed.
  • Function renamed for admin styles.
  • Function for loading plugin text domain fixed.
  • Some code indentation.
Download this release

Release Info

Developer EnigmaWeb
Plugin Icon 128x128 Logo Slider
Version 1.4.5
Comparing to
See all releases

Code changes from version 1.4.4 to 1.4.5

Files changed (2) hide show
  1. logo-slider.php +774 -704
  2. readme.txt +13 -1
logo-slider.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Logo Slider
4
  Plugin URI: http://www.wordpress.org/extend/plugins/logo-slider
5
  Description: Add a logo slideshow carousel to your site quicky and easily.
6
- Version: 1.4.4
7
  Author: Enigma Plugins
8
  Author URI: http://www.enigmaplugins.com
9
  */
@@ -20,27 +20,29 @@ will be used throughout the plugin
20
  error_reporting(0);
21
 
22
  // Localization / Internationalization
23
- load_plugin_textdomain( 'lgs', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
 
 
 
 
24
 
25
- // define our defaults (filterable)
26
  $wp_logo_defaults = apply_filters('wp_logo_defaults', array(
27
-
28
- 'custom_css' => 'You can write your custom CSS here.',
29
- 'arrow' => 1,
30
- 'bgcolour' => '#FFFFFF',
31
- 'slider_width' => 450,
32
- 'slider_height' => 198,
33
- 'num_img' => 2,
34
- 'auto_slide' => 1,
35
- 'auto_slide_time' => '',
36
-
37
  ));
38
 
39
- // pull the settings from the db
40
  $wp_logo_slider_settings = get_option('wp_logo_slider_settings');
41
  $wp_logo_slider_images = get_option('wp_logo_slider_images');
42
 
43
- // fallback
44
  $wp_logo_slider_settings = wp_parse_args($wp_logo_slider_settings, $wp_logo_defaults);
45
 
46
 
@@ -51,33 +53,30 @@ to the proper actions in WordPress
51
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
52
  */
53
 
54
- // this function registers our settings in the db
55
  add_action('admin_init', 'wp_logo_register_settings');
56
  function wp_logo_register_settings() {
57
- register_setting('wp_logo_slider_images', 'wp_logo_slider_images', 'wp_logo_images_validate');
58
- register_setting('wp_logo_slider_settings', 'wp_logo_slider_settings', 'wp_logo_settings_validate');
59
  }
60
- // this function adds the settings page to the Appearance tab
61
  add_action('admin_menu', 'wp_logo_slider_menu');
62
  function wp_logo_slider_menu() {
63
-
64
-
65
- $page_title = 'Logo Slider';
66
- $menu_title = 'Logo Slider';
67
- $capability = 'manage_options';
68
- $menu_slug = 'wp_logo_slider';
69
- $function = 'wp_logo_slider';
70
- $icon = plugin_dir_url( __FILE__ ).'icon.png';
71
- add_menu_page($page_title,$menu_title,$capability,$menu_slug,$function,$icon);
72
-
73
  }
74
 
75
- // add "Settings" link to plugin page
76
  add_filter('plugin_action_links_' . plugin_basename(__FILE__) , 'wp_logo_plugin_action_links');
77
  function wp_logo_plugin_action_links($links) {
78
- $wp_logo_settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'upload.php?page=wp_logo_slider' ), __('Settings') );
79
- array_unshift($links, $wp_logo_settings_link);
80
- return $links;
81
  }
82
 
83
 
@@ -90,545 +89,613 @@ changes, as well as producing the visible page output.
90
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
91
  */
92
  function wp_logo_slider() {
93
- echo '<div class="wrap">';
94
-
95
- // handle image upload, if necessary
96
- if($_REQUEST['action'] == 'wp_handle_upload')
97
- wp_logo_handle_upload();
98
-
99
- // delete an image, if necessary
100
- if(isset($_REQUEST['delete']))
101
- wp_logo_delete_upload($_REQUEST['delete']);
102
-
103
- // the image management form
104
- wp_logo_images_admin();
105
-
106
- // the settings management form
107
- wp_logo_settings_admin();
108
 
109
- echo '</div>';
110
- }
 
111
 
 
 
 
 
 
 
 
112
 
113
  /*
114
  ///////////////////////////////////////////////
115
- this section handles uploading images, adding
116
- the image data to the database, deleting images,
117
- and deleting image data from the database.
118
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
119
  */
120
  // this function handles the file upload,
121
  // resize/crop, and adds the image data to the db
122
  function wp_logo_handle_upload() {
123
- global $wp_logo_slider_settings, $wp_logo_slider_images;
124
-
125
- // upload the image
126
- $upload = wp_handle_upload($_FILES['logo_images'], 0);
127
-
128
- // extract the $upload array
129
- extract($upload);
130
-
131
- // the URL of the directory the file was loaded in
132
- $upload_dir_url = str_replace(basename($file), '', $url);
133
-
134
- // get the image dimensions
135
- list($width, $height) = getimagesize($file);
136
-
137
- // if the uploaded file is NOT an image
138
- if(strpos($type, 'image') === FALSE) {
139
- unlink($file); // delete the file
140
- echo '<div class="error" id="message"><p>'.__('Sorry, but the file you uploaded does not seem to be a valid image. Please try again.','lgs').'</p></div>';
141
- return;
142
- }
143
-
144
- // if the image is larger than the width/height requirements, then scale it down.
145
- if($width > $wp_logo_slider_settings['slider_width'] || $height > $wp_logo_slider_settings['slider_height']) {
146
- // resize the image
147
-
148
- $width = $wp_logo_slider_settings['slider_width'];
149
- $height = $wp_logo_slider_settings['slider_height'];
150
- $image = wp_get_image_editor($file);
151
- if(is_wp_error($image)){
152
- return $image;
153
- }
154
- $resized = $image->resize($width, $height, TRUE);
155
- $destFile = $image->generate_filename(NULL, NULL);
156
- $saved = $image->save($destFile);
157
-
158
- if(is_wp_error($saved)){
159
- return $saved;
160
- }
161
- $newImgPath = $destFile;
162
- }
163
-
164
- // make the thumbnail
165
- $thumb_height = round((100 * $wp_logo_slider_settings['slider_height']) / $wp_logo_slider_settings['slider_width']);
166
- if(isset($upload['file'])) {
167
- $thumbnail = image_resize($file, 100, $thumb_height, true, 'thumb');
168
- $thumbnail_url = $upload_dir_url . basename($thumbnail);
169
- }
170
-
171
- $row = 1;
172
- foreach((array)$wp_logo_slider_images as $image => $data) :
173
- $row++;
174
- endforeach;
175
- // use the timestamp as the array key and id
176
- $time = date('YmdHis');
177
-
178
- // add the image data to the array
179
- $wp_logo_slider_images[$time] = array(
180
- 'id' => $time,
181
- 'file' => $file,
182
- 'file_url' => $url,
183
- 'thumbnail' => $thumbnail,
184
- 'thumbnail_url' => $thumbnail_url,
185
- 'slide_title' => '',
186
- 'slide_desc' => '',
187
- 'image_links_to' => ''
188
- );
189
-
190
- // add the image information to the database
191
- $wp_logo_slider_images['update'] = 'Added';
192
- update_option('wp_logo_slider_images', $wp_logo_slider_images);
193
  }
194
 
195
- // this function deletes the image,
196
- // and removes the image data from the db
197
  function wp_logo_delete_upload($id) {
198
- global $wp_logo_slider_images;
199
-
200
- // if the ID passed to this function is invalid,
201
- // halt the process, and don't try to delete.
202
- if(!isset($wp_logo_slider_images[$id])) return;
203
-
204
- // delete the image and thumbnail
205
- unlink($wp_logo_slider_images[$id]['file']);
206
- unlink($wp_logo_slider_images[$id]['thumbnail']);
207
-
208
- // indicate that the image was deleted
209
- $wp_logo_slider_images['update'] = 'Deleted';
210
-
211
- // remove the image data from the db
212
- unset($wp_logo_slider_images[$id]);
213
- update_option('wp_logo_slider_images', $wp_logo_slider_images);
214
- }
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
 
217
  /*
218
  ///////////////////////////////////////////////
219
- these two functions check to see if an update
220
- to the data just occurred. if it did, then they
221
- will display a notice, and reset the update option.
222
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
223
  */
224
- // this function checks to see if we just updated the settings
225
- // if so, it displays the "updated" message.
226
  function wp_logo_slider_settings_update_check() {
227
- global $wp_logo_slider_settings;
228
- if(isset($wp_logo_slider_settings['update'])) {
229
- echo '<div class="updated fade" id="message"><p>'.__('Wordpress Logo Slider Settings <strong>'.$wp_logo_slider_settings['update'],'lgs').'</strong></p></div>';
230
- unset($wp_logo_slider_settings['update']);
231
- update_option('wp_logo_slider_settings', $wp_logo_slider_settings);
232
- }
 
 
 
 
233
  }
234
- // this function checks to see if we just added a new image
235
- // if so, it displays the "updated" message.
 
236
  function wp_logo_slider_images_update_check() {
237
- global $wp_logo_slider_images;
238
- if($wp_logo_slider_images['update'] == 'Added' || $wp_logo_slider_images['update'] == 'Deleted' || $wp_logo_slider_images['update'] == 'Updated') {
239
- echo '<div class="updated fade" id="message"><p>'.__('Image(s) '.$wp_logo_slider_images['update'].' Successfully','lgs').'</p></div>';
240
- unset($wp_logo_slider_images['update']);
241
- update_option('wp_logo_slider_images', $wp_logo_slider_images);
242
- }
243
  }
244
 
245
-
246
  /*
247
  ///////////////////////////////////////////////
248
  these two functions display the front-end code
249
  on the admin page. it's mostly form markup.
250
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
251
  */
252
- // display the images administration code
253
  function wp_logo_images_admin() { ?>
254
- <?php global $wp_logo_slider_images; ?>
255
- <?php wp_logo_slider_images_update_check(); ?>
256
- <h2><?php _e('Wordpress LogoSlider Images','lgs'); ?></h2>
257
-
258
- <table class="form-table">
259
- <tr valign="top"><th scope="row"><?php _e('Upload New Image','lgs') ?></th>
260
- <td>
261
- <form enctype="multipart/form-data" method="post" action="?page=wp_logo_slider">
262
- <input type="hidden" name="post_id" id="post_id" value="0" />
263
- <input type="hidden" name="action" id="action" value="wp_handle_upload" />
264
-
265
- <label for="logo_images"><?php _e('Select a File: ','lgs') ?></label>
266
- <input type="file" name="logo_images" id="logo_images" />
267
- <input type="submit" class="button-primary" name="html-upload" value="Upload" />
268
- </form>
269
- </td>
270
- </tr>
271
- </table><br />
272
-
273
- <p style="border:2px solid #999; border-radius: 10px; font-size: 12px; padding: 6px 10px; width: 24%;">
274
- <strong>Note: </strong>Drag &amp; Drop is auto save.
275
- </p>
 
276
 
277
- <?php if(!empty($wp_logo_slider_images)) : ?>
278
- <table class="widefat fixed" cellspacing="0" id="image_sort" style="width:100%; table-layout:inherit;">
279
- <thead>
280
- <tr>
281
- <th scope="col" class="column-slug"><?php _e('Image','lgs') ?></th>
282
- <th scope="col"><?php _e('Image Links To','lgs') ?></th>
283
- <th scope="col" class="column-slug"><?php _e('Actions','lgs') ?></th>
284
- </tr>
285
- </thead>
286
-
287
- <tfoot>
288
- <tr>
289
- <th scope="col" class="column-slug"><?php _e('Image','lgs') ?></th>
290
- <th scope="col"><?php _e('Image Links To','lgs') ?></th>
291
- <th scope="col" class="column-slug"><?php _e('Actions','lgs') ?></th>
292
- </tr>
293
- </tfoot>
294
-
295
- <tbody>
296
-
297
  <form method="post" action="options.php">
298
- <?php settings_fields('wp_logo_slider_images'); ?>
299
- <?php foreach((array)$wp_logo_slider_images as $image => $data) : ?>
300
- <tr id="list_item_<?php echo $image ?>" class="list_item">
301
- <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][id]" value="<?php echo $data['id']; ?>" />
302
- <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][file]" value="<?php echo $data['file']; ?>" />
303
- <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][file_url]" value="<?php echo $data['file_url']; ?>" />
304
- <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][thumbnail]" value="<?php //echo $data['thumbnail']; ?>" />
305
- <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][thumbnail_url]" value="<?php echo $data['thumbnail_url']; ?>" />
306
- <th scope="row" class="column-slug"><img src="<?php echo $data['thumbnail_url']; ?>" /></th>
307
- <td><?php //echo $image; ?><input type="text" name="wp_logo_slider_images[<?php echo $image; ?>][image_links_to]" value="<?php echo $data['image_links_to']; ?>" size="30" /></td>
308
- <td class="column-slug"><input type="submit" class="button-primary" value="Update" /> <a href="?page=wp_logo_slider&amp;delete=<?php echo $image; ?>" class="button">Delete</a></td>
309
- </tr>
310
- <?php endforeach; ?>
311
- <input type="hidden" name="wp_logo_slider_images[update]" value="Updated" />
 
 
 
 
 
 
312
  </form>
313
 
314
- </tbody>
315
  </table>
316
- <?php endif; ?>
317
-
318
  <?php
 
319
  }
320
 
321
-
322
  /*
323
  ///////////////////////////////////////////////
324
- SORTABLE FUNCTION.
325
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
326
  */
327
 
328
  function image_sort(){
329
- wp_enqueue_script('jquery');
 
330
  ?>
331
- <!--<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>-->
332
- <?php
333
- wp_enqueue_script('jquery-ui-sortable');
334
- ?>
335
- <script type="text/javascript">
336
-
337
- jQuery(document).ready( function(e) {
338
- jQuery('#image_sort').sortable({
339
- items: '.list_item',
340
- opacity: 0.5,
341
- cursor: 'pointer',
342
- axis: 'y',
343
- update: function() {
344
- var ordr = jQuery(this).sortable('serialize') + '&action=list_update_order';
345
- jQuery.post(ajaxurl, ordr, function(response){
346
- //alert(response);
347
  });
348
- }
349
- });
350
- });
351
-
352
- </script>
353
  <?php
354
- }
355
- add_action('admin_head','image_sort');
356
 
357
- function order_list(){
358
- global $wp_logo_slider_images;
359
-
360
- $list = $wp_logo_slider_images;
361
- $new_order = $_POST['list_item'];
362
- $new_list = array();
363
-
364
- foreach($new_order as $v){
365
- if(isset($list[$v])){
366
- $new_list[$v] = $list[$v];
367
- }
368
- }
369
- update_option('wp_logo_slider_images',$new_list);
370
- }
371
- add_action('wp_ajax_list_update_order','order_list');
372
 
373
- /*============================================================================================*/
 
 
374
 
 
 
 
 
 
 
 
 
375
 
376
- // display the settings administration code
377
- function wp_logo_settings_admin() { ?>
378
 
379
- <?php wp_logo_slider_settings_update_check(); ?>
380
- <h2><?php _e('Wordpress Logo Slider Settings','lgs'); ?></h2>
381
- <form method="post" action="options.php">
382
- <?php settings_fields('wp_logo_slider_settings'); ?>
383
- <?php global $wp_logo_slider_settings; $options = $wp_logo_slider_settings; ?>
 
 
 
 
 
384
  <table class="form-table">
385
- <tr><th scope="row"><?php _e('Size','lgs') ?></th>
386
- <td><?php _e('Width: ','lgs') ?><input type="text" name="wp_logo_slider_settings[slider_width]" value="<?php echo $options['slider_width'] ?>" size="4" /> <?php _e('Height: ','lgs') ?><input type="text" name="wp_logo_slider_settings[slider_height]" value="<?php echo $options['slider_height'] ?>" size="4" /></td></tr>
387
-
388
- <tr><th scope="row"><?php _e('Images Per Slide','lgs') ?></th>
389
  <td>
390
- <select name="wp_logo_slider_settings[num_img]">
391
- <option value="1" <?php echo ($options['num_img'] == '1' ? 'selected="selected"' : '') ?>><?php _e('1','lgs') ?></option>
392
- <option value="2" <?php echo ($options['num_img'] == '2' ? 'selected="selected"' : '') ?>><?php _e('2','lgs') ?></option>
393
- <option value="3" <?php echo ($options['num_img'] == '3' ? 'selected="selected"' : '') ?>><?php _e('3','lgs') ?></option>
394
- <option value="4" <?php echo ($options['num_img'] == '4' ? 'selected="selected"' : '') ?>><?php _e('4','lgs') ?></option>
395
- <option value="5" <?php echo ($options['num_img'] == '5' ? 'selected="selected"' : '') ?>><?php _e('5','lgs') ?></option>
396
- <option value="6" <?php echo ($options['num_img'] == '6' ? 'selected="selected"' : '') ?>><?php _e('6','lgs') ?></option>
397
- <option value="7" <?php echo ($options['num_img'] == '7' ? 'selected="selected"' : '') ?>><?php _e('7','lgs') ?></option>
398
- <option value="8" <?php echo ($options['num_img'] == '8' ? 'selected="selected"' : '') ?>><?php _e('8','lgs') ?></option>
399
- </select> <small><?php _e('Number of logos per slide','lgs') ?></small> </td>
400
- </tr>
401
-
402
- <tr><th scope="row"><?php _e('Background Colour','lgs') ?></th>
403
- <td><input type="text" name="wp_logo_slider_settings[bgcolour]" value="<?php echo $options['bgcolour'] ?>" /> <small><?php _e('Format: ','lgs') ?>#FFFFFF</small></td>
404
- </tr>
405
-
406
- <tr><th scope="row"><?php _e('Open logo links in New Window','lgs') ?></th>
407
- <td><input type="checkbox" name="wp_logo_slider_settings[new_window]" <?php echo ($options['new_window'] == 'on' ? 'checked="checked"' : '' ) ?> /></td>
408
- </tr>
409
-
410
- <tr><th scope="row"><?php _e('Select Slider','lgs') ?></th>
411
  <td>
412
- <select name="wp_logo_slider_settings[select_slider]">
413
- <option value="slide" <?php echo ($options['select_slider'] == 'slide' ? 'selected="selected"' : '' ) ?>><?php _e('Slide','lgs') ?></option>
414
- <option value="fade" <?php echo ($options['select_slider'] == 'fade' ? 'selected="selected"' : '' ) ?>><?php _e('Fade','lgs') ?></option>
415
- </select>
416
- </td>
417
- </tr>
418
-
419
- <tr><th scope="row"><?php _e('Auto Slide','lgs') ?></th>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  <td id="arrow-style">
421
-
422
- <?php _e('ON','lgs') ?> <input type="radio" name="wp_logo_slider_settings[auto_slide]" value="1" <?php if($options['auto_slide']==1){echo 'checked="checked"';}?> />&nbsp; &nbsp;
423
- <?php _e('OFF','lgs') ?> <input type="radio" name="wp_logo_slider_settings[auto_slide]" value="2" <?php if($options['auto_slide']==2){echo 'checked="checked"';}?>/>
 
 
 
 
 
 
 
 
424
  </td>
425
- </tr>
426
- <tr><th scope="row"><?php _e('Auto Slide Time','lgs') ?></th>
427
- <td><input type="text" name="wp_logo_slider_settings[auto_slide_time]" value="<?php echo $options['auto_slide_time'] ?>" size="4" /> <small><?php _e('Set auto slide duration in seconds','lgs') ?></small></td>
428
- </tr>
429
-
430
- <tr><th scope="row"><?php _e('Arrow Style','lgs') ?></th>
431
  <td id="arrow-style">
432
-
433
- <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/off.png" width="28" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="0" <?php if($options['arrow']==0){echo 'checked="checked"';}?> /></p>
434
- <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow1.png" width="28" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="1" <?php if($options['arrow']==1){echo 'checked="checked"';}?> /></p>
435
- <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow2.png" width="31" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="2" <?php if($options['arrow']==2){echo 'checked="checked"';}?>/></p>
436
- <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow3.png" width="34" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="3" <?php if($options['arrow']==3){echo 'checked="checked"';}?>/></p>
437
- <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow4.png" width="34" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="4" <?php if($options['arrow']==4){echo 'checked="checked"';}?>/></p>
438
- <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow5.png" width="24" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="5" <?php if($options['arrow']==5){echo 'checked="checked"';}?>/></p>
439
- <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow6.png" width="36" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="6" <?php if($options['arrow']==6){echo 'checked="checked"';}?>/></p>
440
- <p><img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow7.png" width="38" height="40" alt="" /><br /><input type="radio" name="wp_logo_slider_settings[arrow]" value="7" <?php if($options['arrow']==7){echo 'checked="checked"';}?>/></p>
441
-
442
- </td>
443
- </tr>
444
- <tr valign="top"><th scope="row"><?php _e('Custom CSS','lgs') ?></th>
445
- <td><textarea name="wp_logo_slider_settings[custom_css]" rows="6" cols="70"><?php echo $options['custom_css']; ?></textarea></td>
446
- </tr>
447
- <input type="hidden" name="wp_logo_slider_settings[update]" value="UPDATED" />
448
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  </table>
450
- <p class="submit">
451
- <input type="submit" class="button-primary" value="<?php _e('Save Settings','lgs') ?>" />
452
- </form>
453
-
454
- <!-- The Reset Option -->
455
- <form method="post" action="options.php">
456
- <?php settings_fields('wp_logo_slider_settings'); ?>
457
- <?php global $wp_logo_defaults; // use the defaults ?>
458
- <?php foreach((array)$wp_logo_defaults as $key => $value) : ?>
459
- <input type="hidden" name="wp_logo_slider_settings[<?php echo $key; ?>]" value="<?php echo $value; ?>" />
460
- <?php endforeach; ?>
461
- <input type="hidden" name="wp_logo_slider_settings[update]" value="RESET" />
462
- <input type="submit" class="button" value="<?php _e('Reset Settings','lgs') ?>" />
463
- </form>
464
- <!-- End Reset Option -->
465
- </p>
 
 
 
 
 
466
 
467
  <?php
468
  }
469
 
470
-
471
  /*
472
  ///////////////////////////////////////////////
473
- these two functions sanitize the data before it
474
- gets stored in the database via options.php
475
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
476
  */
477
- // this function sanitizes our settings data for storage
478
  function wp_logo_settings_validate($input) {
479
- $input['slider_width'] = intval($input['slider_width']);
480
- $input['slider_height'] = intval($input['slider_height']);
481
- $input['num_img'] = intval($input['num_img']);
482
- $input['arrow'] = intval($input['arrow']);
483
- $input['custom_css'] = wp_filter_nohtml_kses($input['custom_css']);
484
- $input['bgcolour'] = wp_filter_nohtml_kses($input['bgcolour']);
485
- $input['auto_slide'] = intval($input['auto_slide']);
486
- $input['auto_slide_time'] = intval($input['auto_slide_time']);
487
-
488
- return $input;
489
  }
490
- // this function sanitizes our image data for storage
 
491
  function wp_logo_images_validate($input) {
492
- foreach((array)$input as $key => $value) {
493
- if($key != 'update') {
494
- $input[$key]['file_url'] = clean_url($value['file_url']);
495
- $input[$key]['thumbnail_url'] = clean_url($value['thumbnail_url']);
496
-
497
- if($value['image_links_to'])
498
- $input[$key]['image_links_to'] = clean_url($value['image_links_to']);
499
-
500
- }
501
- }
502
- return $input;
503
  }
504
 
505
  /*
506
  ///////////////////////////////////////////////
507
- this final section generates all the code that
508
- is displayed on the front-end of the WP Theme
509
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
510
  */
511
  function logo_slider($args = array(), $content = null) {
512
- global $wp_logo_slider_settings, $wp_logo_slider_images;
513
- // possible future use
514
- $args = wp_parse_args($args, $wp_logo_slider_settings);
515
- $newline = "\n"; // line break
516
- echo '<div id="logo-slider-wraper">';
517
-
518
- $check = $wp_logo_slider_settings['new_window'];
519
-
520
- $new_window = '';
521
-
522
- if(isset($check))
523
- {
524
- $new_window = 'target="_blank"';
525
- }
526
- else
527
- {
528
- $new_window = 'target="_parent"';
529
- }
530
-
531
- $img_num1 = 1;
532
- $img_num2 = 2;
533
- $img_num3 = 3;
534
- $img_num4 = 4;
535
-
536
- $num_img = $wp_logo_slider_settings['num_img'];
537
-
538
- // Get web and other device engins for Responsive
539
- $iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
540
- $iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
541
- $iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
542
- $Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");
543
- $webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
544
- $mobile = stripos($_SERVER['HTTP_USER_AGENT'],"mobile");
545
- $BlackBerry = stripos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
546
- $RimTablet= stripos($_SERVER['HTTP_USER_AGENT'],"RIM Tablet");
547
-
548
- $msie = strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE');
549
- $firefox = strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox');
550
- $safari = strpos($_SERVER["HTTP_USER_AGENT"], 'Safari');
551
- $chrome = strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome');
552
- $Opera = strpos($_SERVER["HTTP_USER_AGENT"], 'OPR');
553
- $IE11 = strpos($_SERVER["HTTP_USER_AGENT"], 'rv:11.0');
554
-
555
- if( $iPod || $iPhone ){
556
- $data_chunks = array_chunk($wp_logo_slider_images, $img_num1);
557
- }else if($iPad){
558
- $data_chunks = array_chunk($wp_logo_slider_images, $img_num4);
559
- }else if($Android){
560
- $data_chunks = array_chunk($wp_logo_slider_images, $img_num1);
561
- }else if($webOS){
562
- $data_chunks = array_chunk($wp_logo_slider_images, $img_num1);
563
- }else if($mobile){
564
- $data_chunks = array_chunk($wp_logo_slider_images, $img_num1);
565
- }else if($BlackBerry){
566
- $data_chunks = array_chunk($wp_logo_slider_images, $img_num1);
567
- }else if($RimTablet){
568
- $data_chunks = array_chunk($wp_logo_slider_images, $img_num4);
569
- }else if(($msie) || ($firefox) || ($safari) || ($chrome) || ($IE11)){
570
- $data_chunks = array_chunk($wp_logo_slider_images, $num_img);
571
- }
572
-
573
- $slid = $wp_logo_slider_settings['select_slider'];
574
- $lgs_slide_effect = '';
575
-
576
- if($slid == 'slide'){
577
- $lgs_slide_effect = 'scrollHorz';
578
- }
579
- elseif($slid == 'fade'){
580
- $lgs_slide_effect = 'fade';
581
- }
582
- else{
583
- $lgs_slide_effect = 'scrollHorz';
584
- }
585
-
586
- $lgs_auto_slide = $wp_logo_slider_settings['auto_slide'];
587
- $lgs_slide_time = $wp_logo_slider_settings['auto_slide_time'];
588
-
589
- // Logo Image Slider
590
- ?>
591
- <ul id="logo-slider" class="cycle-slideshow"
592
- data-cycle-fx="<?php echo $lgs_slide_effect ?>"
593
- data-cycle-timeout="<?php echo (($lgs_auto_slide == 1 ) ? $lgs_slide_time * 1000 : 0) ?>"
594
- data-cycle-next="#prev"
595
- data-cycle-prev="#next"
596
- data-cycle-speed="600"
597
- data-cycle-slides="> li"
598
- >
599
- <?php
600
- foreach ($data_chunks as $data_chunk) {
601
- echo '<li class="slide">';
602
-
603
- foreach($data_chunk as $data) {
604
- if($data['image_links_to'])
605
- echo '<a href="'.$data['image_links_to'].'" '.$new_window.'>';
606
- echo '<img src="'.$data['file_url'].'" class="logo-img" alt="" />';
607
- if($data['image_links_to'])
608
- echo '</a>';
609
- }
610
-
611
- echo '</li>';
612
- }
613
- ?>
614
- </ul>
615
  <?php
616
- echo '<div class="slider-controls"><a href="#" id="prev">&lt;</a> <a href="#" id="next">&gt;</a></div>';
617
-
618
- echo '</div>';
 
 
619
  }
620
 
621
- // create the shortcode [wp_LogoSlider]
622
  add_shortcode('logo-slider', 'wp_slider_shortcode');
623
  function wp_slider_shortcode($atts) {
624
-
625
- // Temp solution, output buffer the echo function.
626
- ob_start();
627
- logo_slider();
628
- $output = ob_get_clean();
629
-
630
- return $output;
631
-
632
  }
633
 
634
  add_action('wp_print_scripts', 'wp_LogoSlider_scripts');
@@ -643,240 +710,243 @@ function wp_LogoSlider_scripts() {
643
 
644
  add_action( 'wp_head', 'wp_logo_slider_style' );
645
  function wp_logo_slider_style() {
646
- global $wp_logo_slider_settings;
647
- global $options;
648
  ?>
649
-
650
- <style type="text/css" media="screen">
651
- <?php
652
- echo $wp_logo_slider_settings['custom_css'];
653
- ?>
654
- #logo-slider-wraper{
655
- position:relative;
656
-
657
  }
658
- .slider-controls{
659
- position:absolute;
660
- width:<?php echo $wp_logo_slider_settings['slider_width']; ?>px;
661
- top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px !important;
662
  }
663
  #logo-slider {
664
- position: relative;
665
- width: <?php echo $wp_logo_slider_settings['slider_width']; ?>px;
666
- height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
667
- margin: 0; padding: 0;
668
- overflow: hidden;
669
- list-style:none;
670
- background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
671
- text-align:center;
672
  }
673
- .slide{
674
- list-style:none;
675
- margin:0 !important;
676
- width:<?php echo $wp_logo_slider_settings['slider_width']; ?>px !important;
677
  }
678
- .slider-controls a{
679
- height:40px;
680
- width:40px;
681
- display:inline-block;
682
- text-indent:-9000px;
683
  }
684
  #prev{
685
- background:url(<?php echo WP_CONTENT_URL.'/plugins/logo-slider/arrows/arrow'. $wp_logo_slider_settings['arrow'].'.png'; ?>) no-repeat center;
686
- float:right;
687
- margin-right:-50px;
688
  }
689
  #next{
690
- background:url(<?php echo WP_CONTENT_URL.'/plugins/logo-slider/arrows/arrow'. $wp_logo_slider_settings['arrow'].'-prev.png'; ?>) no-repeat center;
691
- float:left;
692
- margin-left:-50px
693
- }
694
-
695
- /*
696
- ===============================================================
697
- --------------------_ Responsive _--------------------
698
- ===============================================================
699
- */
700
-
701
- @media screen and (max-width:320px){
702
- #logo-slider-wraper{
703
- position:relative !important;
704
- width:52% !important;
705
- left:42px;
706
- }
707
- .slider-controls {
708
- position: absolute;
709
- top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
710
- left:30px;
711
- width: 100% !important;
712
- }
713
- #logo-slider {
714
- background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
715
- height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
716
- list-style: none outside none;
717
- margin: 0;
718
- overflow: hidden;
719
- padding: 0;
720
- position: relative;
721
- width: 110% !important;
722
- }
723
- .slide {
724
- list-style: none outside none;
725
- margin: 0 !important;
726
- width: 100% !important;
727
- }
728
- #next{
729
- background:url(<?php echo WP_CONTENT_URL.'/plugins/logo-slider/arrows/arrow'. $wp_logo_slider_settings['arrow'].'-prev.png'; ?>) no-repeat center;
730
- float:left;
731
- margin-left:-66px !important;
732
- }
733
- .logo-img {
734
- margin-left:32px;
735
- }
736
  }
737
  @media screen and (min-width:321px) and (max-width:480px){
738
- #logo-slider-wraper{
739
- position:relative;
740
- width:35% !important;
741
- left:55px !important;
742
- }
743
- .slider-controls {
744
- position: absolute;
745
- top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
746
- width: 100% !important;
747
- }
748
- #logo-slider {
749
- background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
750
- height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
751
- list-style: none outside none;
752
- margin: 0;
753
- overflow: hidden;
754
- padding: 0;
755
- position: relative;
756
- width: 102% !important;
757
- }
758
- .slide {
759
- list-style: none outside none;
760
- margin: 0 !important;
761
- width: 100% !important;
762
- }
763
  }
764
  @media screen and (min-width:321px) and (max-width:360px){
765
- #logo-slider-wraper{
766
- position:relative;
767
- width:50% !important;
768
- }
769
- .slider-controls {
770
- position: absolute;
771
- top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
772
- width: 100% !important;
773
- }
774
- #logo-slider {
775
- background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
776
- height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
777
- list-style: none outside none;
778
- margin: 0;
779
- overflow: hidden;
780
- padding: 0;
781
- position: relative;
782
- width: 100% !important;
783
- }
784
- .slide {
785
- list-style: none outside none;
786
- margin: 0 !important;
787
- width: 100% !important;
788
- }
789
  }
790
  @media screen and (min-width:481px) and (max-width:640px){
791
- #logo-slider-wraper{
792
- position:relative;
793
- width:28% !important;
794
- left:34px !important
795
- }
796
- .slider-controls {
797
- position: absolute;
798
- top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
799
- width: 100% !important;
800
- }
801
- #logo-slider {
802
- background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
803
- height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
804
- list-style: none outside none;
805
- margin: 0;
806
- overflow: hidden;
807
- padding: 0;
808
- position: relative;
809
- width: 100% !important;
810
- }
811
- .slide {
812
- list-style: none outside none;
813
- margin: 0 !important;
814
- width: 100% !important;
815
- }
816
  }
817
  @media only screen and (min-width:641px) and (max-width:768px){
818
- #logo-slider-wraper{
819
- position:relative;
820
- width:78% !important;
821
- left:34px !important
822
- }
823
- .slider-controls {
824
- position: absolute;
825
- top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
826
- width: 100% !important;
827
- }
828
- #logo-slider {
829
- background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
830
- height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
831
- list-style: none outside none;
832
- margin: 0;
833
- overflow: hidden;
834
- padding: 0;
835
- position: relative;
836
- width: 100% !important;
837
- left:-12px;
838
- }
839
- .slide {
840
- list-style: none outside none;
841
- margin: 0 !important;
842
- width: 100% !important;
843
- }
844
  }
845
  @media only screen and (min-width:770px){
846
- #logo-slider-wraper{
847
- position:relative;
848
- width:<?php echo $wp_logo_slider_settings['slider_width']; ?>px !important;
849
- left:34px !important
850
- }
851
- .slider-controls {
852
- position: absolute;
853
- top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
854
- width: 100% !important;
855
- }
856
- #logo-slider {
857
- background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
858
- height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
859
- list-style: none outside none;
860
- margin: 0;
861
- overflow: hidden;
862
- padding: 0;
863
- position: relative;
864
- width: 100% !important;
865
- }
866
- .slide {
867
- list-style: none outside none;
868
- margin: 0 !important;
869
- width: <?php echo $wp_logo_slider_settings['slider_width']; ?>px !important;
870
- }
871
  }
 
 
 
872
 
873
- </style>
874
-
875
- <?php }
876
- add_action( 'admin_enqueue_scripts', 'admin_styles' );
877
- function admin_styles(){ ?>
878
- <style type="text/css" media="screen">
879
- #arrow-style p{ float:left; height:60px; width:40px; text-align:center; margin-right:16px;}
880
- </style>
881
- <?php }
882
-
 
 
 
 
3
  Plugin Name: Logo Slider
4
  Plugin URI: http://www.wordpress.org/extend/plugins/logo-slider
5
  Description: Add a logo slideshow carousel to your site quicky and easily.
6
+ Version: 1.4.5
7
  Author: Enigma Plugins
8
  Author URI: http://www.enigmaplugins.com
9
  */
20
  error_reporting(0);
21
 
22
  // Localization / Internationalization
23
+ add_action( 'plugins_loaded', 'lgs_plugin_load_textdomain' );
24
+ function lgs_plugin_load_textdomain() {
25
+ load_plugin_textdomain( 'lgs', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
26
+ }
27
+
28
 
29
+ // define our defaults (filterable)
30
  $wp_logo_defaults = apply_filters('wp_logo_defaults', array(
31
+ 'custom_css' => 'You can write your custom CSS here.',
32
+ 'arrow' => 1,
33
+ 'bgcolour' => '#FFFFFF',
34
+ 'slider_width' => 450,
35
+ 'slider_height' => 198,
36
+ 'num_img' => 2,
37
+ 'auto_slide' => 1,
38
+ 'auto_slide_time' => '',
 
 
39
  ));
40
 
41
+ // pull the settings from the db
42
  $wp_logo_slider_settings = get_option('wp_logo_slider_settings');
43
  $wp_logo_slider_images = get_option('wp_logo_slider_images');
44
 
45
+ // fallback
46
  $wp_logo_slider_settings = wp_parse_args($wp_logo_slider_settings, $wp_logo_defaults);
47
 
48
 
53
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
54
  */
55
 
56
+ // this function registers our settings in the db
57
  add_action('admin_init', 'wp_logo_register_settings');
58
  function wp_logo_register_settings() {
59
+ register_setting('wp_logo_slider_images', 'wp_logo_slider_images', 'wp_logo_images_validate');
60
+ register_setting('wp_logo_slider_settings', 'wp_logo_slider_settings', 'wp_logo_settings_validate');
61
  }
62
+ // this function adds the settings page to the Appearance tab
63
  add_action('admin_menu', 'wp_logo_slider_menu');
64
  function wp_logo_slider_menu() {
65
+ $page_title = 'Logo Slider';
66
+ $menu_title = 'Logo Slider';
67
+ $capability = 'manage_options';
68
+ $menu_slug = 'wp_logo_slider';
69
+ $function = 'wp_logo_slider';
70
+ $icon = plugin_dir_url( __FILE__ ).'icon.png';
71
+ add_menu_page($page_title,$menu_title,$capability,$menu_slug,$function,$icon);
 
 
 
72
  }
73
 
74
+ // add "Settings" link to plugin page
75
  add_filter('plugin_action_links_' . plugin_basename(__FILE__) , 'wp_logo_plugin_action_links');
76
  function wp_logo_plugin_action_links($links) {
77
+ $wp_logo_settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'upload.php?page=wp_logo_slider' ), __('Settings') );
78
+ array_unshift($links, $wp_logo_settings_link);
79
+ return $links;
80
  }
81
 
82
 
89
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
90
  */
91
  function wp_logo_slider() {
92
+ echo '<div class="wrap">';
93
+ // handle image upload, if necessary
94
+ if($_REQUEST['action'] == 'wp_handle_upload')
95
+ wp_logo_handle_upload();
 
 
 
 
 
 
 
 
 
 
 
96
 
97
+ // delete an image, if necessary
98
+ if(isset($_REQUEST['delete']))
99
+ wp_logo_delete_upload($_REQUEST['delete']);
100
 
101
+ // the image management form
102
+ wp_logo_images_admin();
103
+
104
+ // the settings management form
105
+ wp_logo_settings_admin();
106
+ echo '</div>';
107
+ }
108
 
109
  /*
110
  ///////////////////////////////////////////////
111
+ this section handles uploading images, adding
112
+ the image data to the database, deleting images,
113
+ and deleting image data from the database.
114
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
115
  */
116
  // this function handles the file upload,
117
  // resize/crop, and adds the image data to the db
118
  function wp_logo_handle_upload() {
119
+ global $wp_logo_slider_settings, $wp_logo_slider_images;
120
+
121
+ // upload the image
122
+ $upload = wp_handle_upload($_FILES['logo_images'], 0);
123
+
124
+ // extract the $upload array
125
+ extract($upload);
126
+
127
+ // the URL of the directory the file was loaded in
128
+ $upload_dir_url = str_replace(basename($file), '', $url);
129
+
130
+ // get the image dimensions
131
+ list($width, $height) = getimagesize($file);
132
+
133
+ // if the uploaded file is NOT an image
134
+ if(strpos($type, 'image') === FALSE) {
135
+ unlink($file); // delete the file
136
+ echo '<div class="error" id="message"><p>'.__('Sorry, but the file you uploaded does not seem to be a valid image. Please try again.','lgs').'</p></div>';
137
+ return;
138
+ }
139
+
140
+ // if the image is larger than the width/height requirements, then scale it down.
141
+ if($width > $wp_logo_slider_settings['slider_width'] || $height > $wp_logo_slider_settings['slider_height']) {
142
+ // resize the image
143
+ $width = $wp_logo_slider_settings['slider_width'];
144
+ $height = $wp_logo_slider_settings['slider_height'];
145
+ $image = wp_get_image_editor($file);
146
+ if(is_wp_error($image)){
147
+ return $image;
148
+ }
149
+ $resized = $image->resize($width, $height, TRUE);
150
+ $destFile = $image->generate_filename(NULL, NULL);
151
+ $saved = $image->save($destFile);
152
+
153
+ if(is_wp_error($saved)){
154
+ return $saved;
155
+ }
156
+ $newImgPath = $destFile;
157
+ }
158
+
159
+ // make the thumbnail
160
+ $thumb_height = round((100 * $wp_logo_slider_settings['slider_height']) / $wp_logo_slider_settings['slider_width']);
161
+ if(isset($upload['file'])) {
162
+ $thumbnail = image_resize($file, 100, $thumb_height, true, 'thumb');
163
+ $thumbnail_url = $upload_dir_url . basename($thumbnail);
164
+ }
165
+
166
+ $row = 1;
167
+ foreach((array)$wp_logo_slider_images as $image => $data) :
168
+ $row++;
169
+ endforeach;
170
+
171
+ // use the timestamp as the array key and id
172
+ $time = date('YmdHis');
173
+
174
+ // add the image data to the array
175
+ $wp_logo_slider_images[$time] = array(
176
+ 'id' => $time,
177
+ 'file' => $file,
178
+ 'file_url' => $url,
179
+ 'thumbnail' => $thumbnail,
180
+ 'thumbnail_url' => $thumbnail_url,
181
+ 'slide_title' => '',
182
+ 'slide_desc' => '',
183
+ 'image_links_to' => ''
184
+ );
185
+
186
+ // add the image information to the database
187
+ $wp_logo_slider_images['update'] = 'Added';
188
+ update_option('wp_logo_slider_images', $wp_logo_slider_images);
189
  }
190
 
191
+ // this function deletes the image,
192
+ // and removes the image data from the db
193
  function wp_logo_delete_upload($id) {
194
+ global $wp_logo_slider_images;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
+ // if the ID passed to this function is invalid,
197
+ // halt the process, and don't try to delete.
198
+ if(!isset($wp_logo_slider_images[$id])) return;
199
+
200
+ // delete the image and thumbnail
201
+ unlink($wp_logo_slider_images[$id]['file']);
202
+ unlink($wp_logo_slider_images[$id]['thumbnail']);
203
+
204
+ // indicate that the image was deleted
205
+ $wp_logo_slider_images['update'] = 'Deleted';
206
+
207
+ // remove the image data from the db
208
+ unset($wp_logo_slider_images[$id]);
209
+ update_option('wp_logo_slider_images', $wp_logo_slider_images);
210
+ }
211
 
212
  /*
213
  ///////////////////////////////////////////////
214
+ these two functions check to see if an update
215
+ to the data just occurred. if it did, then they
216
+ will display a notice, and reset the update option.
217
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
218
  */
219
+ // this function checks to see if we just updated the settings
220
+ // if so, it displays the "updated" message.
221
  function wp_logo_slider_settings_update_check() {
222
+ global $wp_logo_slider_settings;
223
+ if(isset($wp_logo_slider_settings['update'])) {
224
+ echo '<div class="updated fade" id="message">
225
+ <p>'.__('Wordpress Logo Slider Settings <strong>'.$wp_logo_slider_settings['update'],'lgs').'</strong>
226
+ </p>
227
+ </div>';
228
+
229
+ unset($wp_logo_slider_settings['update']);
230
+ update_option('wp_logo_slider_settings', $wp_logo_slider_settings);
231
+ }
232
  }
233
+
234
+ // this function checks to see if we just added a new image
235
+ // if so, it displays the "updated" message.
236
  function wp_logo_slider_images_update_check() {
237
+ global $wp_logo_slider_images;
238
+ if($wp_logo_slider_images['update'] == 'Added' || $wp_logo_slider_images['update'] == 'Deleted' || $wp_logo_slider_images['update'] == 'Updated') {
239
+ echo '<div class="updated fade" id="message"><p>'.__('Image(s) '.$wp_logo_slider_images['update'].' Successfully','lgs').'</p></div>';
240
+ unset($wp_logo_slider_images['update']);
241
+ update_option('wp_logo_slider_images', $wp_logo_slider_images);
242
+ }
243
  }
244
 
 
245
  /*
246
  ///////////////////////////////////////////////
247
  these two functions display the front-end code
248
  on the admin page. it's mostly form markup.
249
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
250
  */
251
+ // display the images administration code
252
  function wp_logo_images_admin() { ?>
253
+ <?php global $wp_logo_slider_images; ?>
254
+ <?php wp_logo_slider_images_update_check(); ?>
255
+ <h2><?php _e('Wordpress LogoSlider Images','lgs'); ?></h2>
256
+
257
+ <table class="form-table">
258
+ <tr valign="top"><th scope="row"><?php _e('Upload New Image','lgs') ?></th>
259
+ <td>
260
+ <form enctype="multipart/form-data" method="post" action="?page=wp_logo_slider">
261
+ <input type="hidden" name="post_id" id="post_id" value="0" />
262
+ <input type="hidden" name="action" id="action" value="wp_handle_upload" />
263
+
264
+ <label for="logo_images"><?php _e('Select a File: ','lgs') ?></label>
265
+ <input type="file" name="logo_images" id="logo_images" />
266
+ <input type="submit" class="button-primary" name="html-upload" value="Upload" />
267
+ </form>
268
+ </td>
269
+ </tr>
270
+ </table>
271
+ <br />
272
+
273
+ <p style="border:2px solid #999; border-radius: 10px; font-size: 12px; padding: 6px 10px; width: 24%;">
274
+ <strong>Note: </strong>Drag &amp; Drop is auto save.
275
+ </p>
276
 
277
+ <?php
278
+ if(!empty($wp_logo_slider_images)) :
279
+ ?>
280
+ <table class="widefat fixed" cellspacing="0" id="image_sort" style="width:100%; table-layout:inherit;">
281
+ <thead>
282
+ <tr>
283
+ <th scope="col" class="column-slug"><?php _e('Image','lgs') ?></th>
284
+ <th scope="col"><?php _e('Image Links To','lgs') ?></th>
285
+ <th scope="col" class="column-slug"><?php _e('Actions','lgs') ?></th>
286
+ </tr>
287
+ </thead>
288
+ <tfoot>
289
+ <tr>
290
+ <th scope="col" class="column-slug"><?php _e('Image','lgs') ?></th>
291
+ <th scope="col"><?php _e('Image Links To','lgs') ?></th>
292
+ <th scope="col" class="column-slug"><?php _e('Actions','lgs') ?></th>
293
+ </tr>
294
+ </tfoot>
295
+ <tbody>
 
296
  <form method="post" action="options.php">
297
+ <?php settings_fields('wp_logo_slider_images'); ?>
298
+ <?php foreach((array)$wp_logo_slider_images as $image => $data) : ?>
299
+ <tr id="list_item_<?php echo $image ?>" class="list_item">
300
+ <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][id]" value="<?php echo $data['id']; ?>" />
301
+ <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][file]" value="<?php echo $data['file']; ?>" />
302
+ <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][file_url]" value="<?php echo $data['file_url']; ?>" />
303
+ <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][thumbnail]" value="<?php //echo $data['thumbnail']; ?>" />
304
+ <input type="hidden" name="wp_logo_slider_images[<?php echo $image; ?>][thumbnail_url]" value="<?php echo $data['thumbnail_url']; ?>" />
305
+ <th scope="row" class="column-slug"><img src="<?php echo $data['thumbnail_url']; ?>" /></th>
306
+ <td>
307
+ <?php //echo $image; ?>
308
+ <input type="text" name="wp_logo_slider_images[<?php echo $image; ?>][image_links_to]" value="<?php echo $data['image_links_to']; ?>" size="30" />
309
+ </td>
310
+ <td class="column-slug">
311
+ <input type="submit" class="button-primary" value="Update" />
312
+ <a href="?page=wp_logo_slider&amp;delete=<?php echo $image; ?>" class="button">Delete</a>
313
+ </td>
314
+ </tr>
315
+ <?php endforeach; ?>
316
+ <input type="hidden" name="wp_logo_slider_images[update]" value="Updated" />
317
  </form>
318
 
319
+ </tbody>
320
  </table>
 
 
321
  <?php
322
+ endif;
323
  }
324
 
 
325
  /*
326
  ///////////////////////////////////////////////
327
+ SORTABLE FUNCTION.
328
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
329
  */
330
 
331
  function image_sort(){
332
+ wp_enqueue_script('jquery');
333
+ wp_enqueue_script('jquery-ui-sortable');
334
  ?>
335
+ <script type="text/javascript">
336
+ jQuery(document).ready( function(e) {
337
+ jQuery('#image_sort').sortable({
338
+ items: '.list_item',
339
+ opacity: 0.5,
340
+ cursor: 'pointer',
341
+ axis: 'y',
342
+ update: function() {
343
+ var ordr = jQuery(this).sortable('serialize') + '&action=list_update_order';
344
+ jQuery.post(ajaxurl, ordr, function(response){
345
+ //alert(response);
346
+ });
347
+ }
 
 
 
348
  });
349
+ });
350
+ </script>
 
 
 
351
  <?php
352
+ }
353
+ add_action('admin_head','image_sort');
354
 
355
+ function order_list(){
356
+ global $wp_logo_slider_images;
 
 
 
 
 
 
 
 
 
 
 
 
 
357
 
358
+ $list = $wp_logo_slider_images;
359
+ $new_order = $_POST['list_item'];
360
+ $new_list = array();
361
 
362
+ foreach($new_order as $v){
363
+ if(isset($list[$v])){
364
+ $new_list[$v] = $list[$v];
365
+ }
366
+ }
367
+ update_option('wp_logo_slider_images',$new_list);
368
+ }
369
+ add_action('wp_ajax_list_update_order','order_list');
370
 
371
+ /*============================================================================================*/
 
372
 
373
+ // display the settings administration code
374
+ function wp_logo_settings_admin() {
375
+ wp_logo_slider_settings_update_check();
376
+ ?>
377
+ <h2><?php _e('Wordpress Logo Slider Settings','lgs'); ?></h2>
378
+ <form method="post" action="options.php">
379
+ <?php
380
+ settings_fields('wp_logo_slider_settings');
381
+ global $wp_logo_slider_settings; $options = $wp_logo_slider_settings;
382
+ ?>
383
  <table class="form-table">
384
+ <tr>
385
+ <th scope="row"><?php _e('Size','lgs') ?></th>
 
 
386
  <td>
387
+ <?php _e('Width: ','lgs') ?>
388
+ <input type="text" name="wp_logo_slider_settings[slider_width]" value="<?php echo $options['slider_width'] ?>" size="4" />
389
+ <?php _e('Height: ','lgs') ?>
390
+ <input type="text" name="wp_logo_slider_settings[slider_height]" value="<?php echo $options['slider_height'] ?>" size="4" />
391
+ </td>
392
+ </tr>
393
+ <tr>
394
+ <th scope="row"><?php _e('Images Per Slide','lgs') ?></th>
 
 
 
 
 
 
 
 
 
 
 
 
 
395
  <td>
396
+ <select name="wp_logo_slider_settings[num_img]">
397
+ <option value="1" <?php echo ($options['num_img'] == '1' ? 'selected="selected"' : '') ?>>
398
+ <?php _e('1','lgs') ?>
399
+ </option>
400
+ <option value="2" <?php echo ($options['num_img'] == '2' ? 'selected="selected"' : '') ?>>
401
+ <?php _e('2','lgs') ?>
402
+ </option>
403
+ <option value="3" <?php echo ($options['num_img'] == '3' ? 'selected="selected"' : '') ?>>
404
+ <?php _e('3','lgs') ?>
405
+ </option>
406
+ <option value="4" <?php echo ($options['num_img'] == '4' ? 'selected="selected"' : '') ?>>
407
+ <?php _e('4','lgs') ?>
408
+ </option>
409
+ <option value="5" <?php echo ($options['num_img'] == '5' ? 'selected="selected"' : '') ?>>
410
+ <?php _e('5','lgs') ?>
411
+ </option>
412
+ <option value="6" <?php echo ($options['num_img'] == '6' ? 'selected="selected"' : '') ?>>
413
+ <?php _e('6','lgs') ?>
414
+ </option>
415
+ <option value="7" <?php echo ($options['num_img'] == '7' ? 'selected="selected"' : '') ?>>
416
+ <?php _e('7','lgs') ?>
417
+ </option>
418
+ <option value="8" <?php echo ($options['num_img'] == '8' ? 'selected="selected"' : '') ?>>
419
+ <?php _e('8','lgs') ?>
420
+ </option>
421
+ </select>
422
+ <small><?php _e('Number of logos per slide','lgs') ?></small>
423
+ </td>
424
+ </tr>
425
+ <tr>
426
+ <th scope="row"><?php _e('Background Colour','lgs') ?></th>
427
+ <td>
428
+ <input type="text" name="wp_logo_slider_settings[bgcolour]" value="<?php echo $options['bgcolour'] ?>" />
429
+ <small><?php _e('Format: ','lgs') ?>#FFFFFF</small>
430
+ </td>
431
+ </tr>
432
+ <tr>
433
+ <th scope="row"><?php _e('Open logo links in New Window','lgs') ?></th>
434
+ <td>
435
+ <input type="checkbox" name="wp_logo_slider_settings[new_window]" <?php echo ($options['new_window'] == 'on' ? 'checked="checked"' : '' ) ?> />
436
+ </td>
437
+ </tr>
438
+ <tr>
439
+ <th scope="row"><?php _e('Select Slider','lgs') ?></th>
440
+ <td>
441
+ <select name="wp_logo_slider_settings[select_slider]">
442
+ <option value="slide" <?php echo ($options['select_slider'] == 'slide' ? 'selected="selected"' : '' ) ?>>
443
+ <?php _e('Slide','lgs') ?>
444
+ </option>
445
+ <option value="fade" <?php echo ($options['select_slider'] == 'fade' ? 'selected="selected"' : '' ) ?>>
446
+ <?php _e('Fade','lgs') ?>
447
+ </option>
448
+ </select>
449
+ </td>
450
+ </tr>
451
+ <tr>
452
+ <th scope="row"><?php _e('Auto Slide','lgs') ?></th>
453
  <td id="arrow-style">
454
+ <?php _e('ON','lgs') ?>
455
+ <input type="radio" name="wp_logo_slider_settings[auto_slide]" value="1" <?php if($options['auto_slide']==1){echo 'checked="checked"';}?> />&nbsp; &nbsp;
456
+ <?php _e('OFF','lgs') ?>
457
+ <input type="radio" name="wp_logo_slider_settings[auto_slide]" value="2" <?php if($options['auto_slide']==2){echo 'checked="checked"';}?>/>
458
+ </td>
459
+ </tr>
460
+ <tr>
461
+ <th scope="row"><?php _e('Auto Slide Time','lgs') ?></th>
462
+ <td>
463
+ <input type="text" name="wp_logo_slider_settings[auto_slide_time]" value="<?php echo $options['auto_slide_time'] ?>" size="4" />
464
+ <small><?php _e('Set auto slide duration in seconds','lgs') ?></small>
465
  </td>
466
+ </tr>
467
+ <tr>
468
+ <th scope="row"><?php _e('Arrow Style','lgs') ?></th>
 
 
 
469
  <td id="arrow-style">
470
+ <p>
471
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/off.png" width="28" height="40" alt="" />
472
+ <br />
473
+ <input type="radio" name="wp_logo_slider_settings[arrow]" value="0" <?php if($options['arrow']==0){echo 'checked="checked"';}?> />
474
+ </p>
475
+ <p>
476
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow1.png" width="28" height="40" alt="" />
477
+ <br />
478
+ <input type="radio" name="wp_logo_slider_settings[arrow]" value="1" <?php if($options['arrow']==1){echo 'checked="checked"';}?> />
479
+ </p>
480
+ <p>
481
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow2.png" width="31" height="40" alt="" />
482
+ <br />
483
+ <input type="radio" name="wp_logo_slider_settings[arrow]" value="2" <?php if($options['arrow']==2){echo 'checked="checked"';}?>/>
484
+ </p>
485
+ <p>
486
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow3.png" width="34" height="40" alt="" />
487
+ <br />
488
+ <input type="radio" name="wp_logo_slider_settings[arrow]" value="3" <?php if($options['arrow']==3){echo 'checked="checked"';}?>/>
489
+ </p>
490
+ <p>
491
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow4.png" width="34" height="40" alt="" />
492
+ <br />
493
+ <input type="radio" name="wp_logo_slider_settings[arrow]" value="4" <?php if($options['arrow']==4){echo 'checked="checked"';}?>/>
494
+ </p>
495
+ <p>
496
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow5.png" width="24" height="40" alt="" />
497
+ <br />
498
+ <input type="radio" name="wp_logo_slider_settings[arrow]" value="5" <?php if($options['arrow']==5){echo 'checked="checked"';}?>/>
499
+ </p>
500
+ <p>
501
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow6.png" width="36" height="40" alt="" />
502
+ <br />
503
+ <input type="radio" name="wp_logo_slider_settings[arrow]" value="6" <?php if($options['arrow']==6){echo 'checked="checked"';}?>/>
504
+ </p>
505
+ <p>
506
+ <img src="<?php echo plugin_dir_url(__FILE__); ?>/arrows/arrow7.png" width="38" height="40" alt="" />
507
+ <br />
508
+ <input type="radio" name="wp_logo_slider_settings[arrow]" value="7" <?php if($options['arrow']==7){echo 'checked="checked"';}?>/>
509
+ </p>
510
+ </td>
511
+ </tr>
512
+ <tr valign="top">
513
+ <th scope="row"><?php _e('Custom CSS','lgs') ?></th>
514
+ <td>
515
+ <textarea name="wp_logo_slider_settings[custom_css]" rows="6" cols="70"><?php echo $options['custom_css']; ?></textarea>
516
+ </td>
517
+ </tr>
518
+ <input type="hidden" name="wp_logo_slider_settings[update]" value="UPDATED" />
519
  </table>
520
+
521
+ <p class="submit">
522
+ <input type="submit" class="button-primary" value="<?php _e('Save Settings','lgs') ?>" />
523
+ </p>
524
+ </form>
525
+
526
+ <!-- The Reset Option -->
527
+ <form method="post" action="options.php">
528
+ <?php
529
+ settings_fields('wp_logo_slider_settings');
530
+ global $wp_logo_defaults; // use the defaults
531
+
532
+ foreach((array)$wp_logo_defaults as $key => $value) : ?>
533
+ <input type="hidden" name="wp_logo_slider_settings[<?php echo $key; ?>]" value="<?php echo $value; ?>" />
534
+ <?php
535
+ endforeach;
536
+ ?>
537
+ <input type="hidden" name="wp_logo_slider_settings[update]" value="RESET" />
538
+ <input type="submit" class="button" value="<?php _e('Reset Settings','lgs') ?>" />
539
+ </form>
540
+ <!-- End Reset Option -->
541
 
542
  <?php
543
  }
544
 
 
545
  /*
546
  ///////////////////////////////////////////////
547
+ these two functions sanitize the data before it
548
+ gets stored in the database via options.php
549
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
550
  */
551
+ // this function sanitizes our settings data for storage
552
  function wp_logo_settings_validate($input) {
553
+ $input['slider_width'] = intval($input['slider_width']);
554
+ $input['slider_height'] = intval($input['slider_height']);
555
+ $input['num_img'] = intval($input['num_img']);
556
+ $input['arrow'] = intval($input['arrow']);
557
+ $input['custom_css'] = wp_filter_nohtml_kses($input['custom_css']);
558
+ $input['bgcolour'] = wp_filter_nohtml_kses($input['bgcolour']);
559
+ $input['auto_slide'] = intval($input['auto_slide']);
560
+ $input['auto_slide_time'] = intval($input['auto_slide_time']);
561
+
562
+ return $input;
563
  }
564
+
565
+ // this function sanitizes our image data for storage
566
  function wp_logo_images_validate($input) {
567
+ foreach((array)$input as $key => $value) {
568
+ if($key != 'update') {
569
+ $input[$key]['file_url'] = clean_url($value['file_url']);
570
+ $input[$key]['thumbnail_url'] = clean_url($value['thumbnail_url']);
571
+
572
+ if($value['image_links_to'])
573
+ $input[$key]['image_links_to'] = clean_url($value['image_links_to']);
574
+ }
575
+ }
576
+ return $input;
 
577
  }
578
 
579
  /*
580
  ///////////////////////////////////////////////
581
+ this final section generates all the code that
582
+ is displayed on the front-end of the WP Theme
583
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
584
  */
585
  function logo_slider($args = array(), $content = null) {
586
+ global $wp_logo_slider_settings, $wp_logo_slider_images;
587
+
588
+ // possible future use
589
+ $args = wp_parse_args($args, $wp_logo_slider_settings);
590
+ $newline = "\n"; // line break
591
+
592
+ echo '<div id="logo-slider-wraper">';
593
+ $check = $wp_logo_slider_settings['new_window'];
594
+ $new_window = '';
595
+
596
+ if(isset($check)) {
597
+ $new_window = 'target="_blank"';
598
+ } else {
599
+ $new_window = 'target="_parent"';
600
+ }
601
+
602
+ $img_num1 = 1;
603
+ $img_num2 = 2;
604
+ $img_num3 = 3;
605
+ $img_num4 = 4;
606
+
607
+ $num_img = $wp_logo_slider_settings['num_img'];
608
+
609
+ // Get web and other device engins for Responsive
610
+ $iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
611
+ $iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
612
+ $iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
613
+ $Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");
614
+ $webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
615
+ $mobile = stripos($_SERVER['HTTP_USER_AGENT'],"mobile");
616
+ $BlackBerry = stripos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
617
+ $RimTablet= stripos($_SERVER['HTTP_USER_AGENT'],"RIM Tablet");
618
+
619
+ $msie = strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE');
620
+ $firefox = strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox');
621
+ $safari = strpos($_SERVER["HTTP_USER_AGENT"], 'Safari');
622
+ $chrome = strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome');
623
+ $Opera = strpos($_SERVER["HTTP_USER_AGENT"], 'OPR');
624
+ $IE11 = strpos($_SERVER["HTTP_USER_AGENT"], 'rv:11.0');
625
+
626
+ if( $iPod || $iPhone ){
627
+ $data_chunks = array_chunk($wp_logo_slider_images, $img_num1);
628
+ }else if($iPad){
629
+ $data_chunks = array_chunk($wp_logo_slider_images, $img_num4);
630
+ }else if($Android){
631
+ $data_chunks = array_chunk($wp_logo_slider_images, $img_num1);
632
+ }else if($webOS){
633
+ $data_chunks = array_chunk($wp_logo_slider_images, $img_num1);
634
+ }else if($mobile){
635
+ $data_chunks = array_chunk($wp_logo_slider_images, $img_num1);
636
+ }else if($BlackBerry){
637
+ $data_chunks = array_chunk($wp_logo_slider_images, $img_num1);
638
+ }else if($RimTablet){
639
+ $data_chunks = array_chunk($wp_logo_slider_images, $img_num4);
640
+ }else if(($msie) || ($firefox) || ($safari) || ($chrome) || ($IE11)){
641
+ $data_chunks = array_chunk($wp_logo_slider_images, $num_img);
642
+ }
643
+
644
+ $slid = $wp_logo_slider_settings['select_slider'];
645
+ $lgs_slide_effect = '';
646
+
647
+ if($slid == 'slide') {
648
+ $lgs_slide_effect = 'scrollHorz';
649
+ } elseif($slid == 'fade') {
650
+ $lgs_slide_effect = 'fade';
651
+ } else {
652
+ $lgs_slide_effect = 'scrollHorz';
653
+ }
654
+
655
+ $lgs_auto_slide = $wp_logo_slider_settings['auto_slide'];
656
+ $lgs_slide_time = $wp_logo_slider_settings['auto_slide_time'];
657
+
658
+ // Logo Image Slider
659
+ ?>
660
+ <ul id="logo-slider" class="cycle-slideshow"
661
+ data-cycle-fx="<?php echo $lgs_slide_effect ?>"
662
+ data-cycle-timeout="<?php echo (($lgs_auto_slide == 1 ) ? $lgs_slide_time * 1000 : 0) ?>"
663
+ data-cycle-next="#prev"
664
+ data-cycle-prev="#next"
665
+ data-cycle-speed="600"
666
+ data-cycle-slides="> li"
667
+ >
668
+ <?php
669
+ foreach ($data_chunks as $data_chunk) {
670
+ echo '<li class="slide">';
671
+ foreach($data_chunk as $data) {
672
+ if($data['image_links_to'])
673
+ echo '<a href="'.$data['image_links_to'].'" '.$new_window.'>';
674
+ echo '<img src="'.$data['file_url'].'" class="logo-img" alt="" />';
675
+ if($data['image_links_to'])
676
+ echo '</a>';
677
+ }
678
+ echo '</li>';
679
+ }
680
+ ?>
681
+ </ul>
 
 
 
 
 
 
 
682
  <?php
683
+ if($wp_logo_slider_settings['arrow'] != 0) {
684
+ echo '<div class="slider-controls"><a href="#" id="prev">&lt;</a> <a href="#" id="next">&gt;</a></div>';
685
+ }
686
+
687
+ echo '</div>';
688
  }
689
 
690
+ // create the shortcode [wp_LogoSlider]
691
  add_shortcode('logo-slider', 'wp_slider_shortcode');
692
  function wp_slider_shortcode($atts) {
693
+ // Temp solution, output buffer the echo function.
694
+ ob_start();
695
+ logo_slider();
696
+ $output = ob_get_clean();
697
+
698
+ return $output;
 
 
699
  }
700
 
701
  add_action('wp_print_scripts', 'wp_LogoSlider_scripts');
710
 
711
  add_action( 'wp_head', 'wp_logo_slider_style' );
712
  function wp_logo_slider_style() {
713
+ global $wp_logo_slider_settings;
714
+ global $options;
715
  ?>
716
+ <style type="text/css" media="screen">
717
+ <?php
718
+ echo $wp_logo_slider_settings['custom_css'];
719
+ ?>
720
+ #logo-slider-wraper {
721
+ position:relative;
 
 
722
  }
723
+ .slider-controls {
724
+ position:absolute;
725
+ width:<?php echo $wp_logo_slider_settings['slider_width']; ?>px;
726
+ top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px !important;
727
  }
728
  #logo-slider {
729
+ position: relative;
730
+ width: <?php echo $wp_logo_slider_settings['slider_width']; ?>px;
731
+ height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
732
+ margin: 0; padding: 0;
733
+ overflow: hidden;
734
+ list-style:none;
735
+ background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
736
+ text-align:center;
737
  }
738
+ .slide {
739
+ list-style:none;
740
+ margin:0 !important;
741
+ width:<?php echo $wp_logo_slider_settings['slider_width']; ?>px !important;
742
  }
743
+ .slider-controls a {
744
+ height:40px;
745
+ width:40px;
746
+ display:inline-block;
747
+ text-indent:-9000px;
748
  }
749
  #prev{
750
+ background:url(<?php echo WP_CONTENT_URL.'/plugins/logo-slider/arrows/arrow'. $wp_logo_slider_settings['arrow'].'.png'; ?>) no-repeat center;
751
+ float:right;
752
+ margin-right:-50px;
753
  }
754
  #next{
755
+ background:url(<?php echo WP_CONTENT_URL.'/plugins/logo-slider/arrows/arrow'. $wp_logo_slider_settings['arrow'].'-prev.png'; ?>) no-repeat center;
756
+ float:left;
757
+ margin-left:-50px
758
+ }
759
+ /*
760
+ ===============================================================
761
+ --------------------_ Responsive _--------------------
762
+ ===============================================================
763
+ */
764
+ @media screen and (max-width:320px) {
765
+ #logo-slider-wraper{
766
+ position:relative !important;
767
+ width:52% !important;
768
+ left:42px;
769
+ }
770
+ .slider-controls {
771
+ position: absolute;
772
+ top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
773
+ left:30px;
774
+ width: 100% !important;
775
+ }
776
+ #logo-slider {
777
+ background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
778
+ height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
779
+ list-style: none outside none;
780
+ margin: 0;
781
+ overflow: hidden;
782
+ padding: 0;
783
+ position: relative;
784
+ width: 110% !important;
785
+ }
786
+ .slide {
787
+ list-style: none outside none;
788
+ margin: 0 !important;
789
+ width: 100% !important;
790
+ }
791
+ #next{
792
+ background:url(<?php echo WP_CONTENT_URL.'/plugins/logo-slider/arrows/arrow'. $wp_logo_slider_settings['arrow'].'-prev.png'; ?>) no-repeat center;
793
+ float:left;
794
+ margin-left:-66px !important;
795
+ }
796
+ .logo-img {
797
+ margin-left:32px;
798
+ }
 
 
799
  }
800
  @media screen and (min-width:321px) and (max-width:480px){
801
+ #logo-slider-wraper{
802
+ position:relative;
803
+ width:35% !important;
804
+ left:55px !important;
805
+ }
806
+ .slider-controls {
807
+ position: absolute;
808
+ top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
809
+ width: 100% !important;
810
+ }
811
+ #logo-slider {
812
+ background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
813
+ height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
814
+ list-style: none outside none;
815
+ margin: 0;
816
+ overflow: hidden;
817
+ padding: 0;
818
+ position: relative;
819
+ width: 102% !important;
820
+ }
821
+ .slide {
822
+ list-style: none outside none;
823
+ margin: 0 !important;
824
+ width: 100% !important;
825
+ }
826
  }
827
  @media screen and (min-width:321px) and (max-width:360px){
828
+ #logo-slider-wraper{
829
+ position:relative;
830
+ width:50% !important;
831
+ }
832
+ .slider-controls {
833
+ position: absolute;
834
+ top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
835
+ width: 100% !important;
836
+ }
837
+ #logo-slider {
838
+ background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
839
+ height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
840
+ list-style: none outside none;
841
+ margin: 0;
842
+ overflow: hidden;
843
+ padding: 0;
844
+ position: relative;
845
+ width: 100% !important;
846
+ }
847
+ .slide {
848
+ list-style: none outside none;
849
+ margin: 0 !important;
850
+ width: 100% !important;
851
+ }
852
  }
853
  @media screen and (min-width:481px) and (max-width:640px){
854
+ #logo-slider-wraper{
855
+ position:relative;
856
+ width:28% !important;
857
+ left:34px !important;
858
+ }
859
+ .slider-controls {
860
+ position: absolute;
861
+ top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
862
+ width: 100% !important;
863
+ }
864
+ #logo-slider {
865
+ background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
866
+ height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
867
+ list-style: none outside none;
868
+ margin: 0;
869
+ overflow: hidden;
870
+ padding: 0;
871
+ position: relative;
872
+ width: 100% !important;
873
+ }
874
+ .slide {
875
+ list-style: none outside none;
876
+ margin: 0 !important;
877
+ width: 100% !important;
878
+ }
879
  }
880
  @media only screen and (min-width:641px) and (max-width:768px){
881
+ #logo-slider-wraper{
882
+ position:relative;
883
+ width:78% !important;
884
+ left:34px !important
885
+ }
886
+ .slider-controls {
887
+ position: absolute;
888
+ top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
889
+ width: 100% !important;
890
+ }
891
+ #logo-slider {
892
+ background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
893
+ height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
894
+ list-style: none outside none;
895
+ margin: 0;
896
+ overflow: hidden;
897
+ padding: 0;
898
+ position: relative;
899
+ width: 100% !important;
900
+ left:-12px;
901
+ }
902
+ .slide {
903
+ list-style: none outside none;
904
+ margin: 0 !important;
905
+ width: 100% !important;
906
+ }
907
  }
908
  @media only screen and (min-width:770px){
909
+ #logo-slider-wraper{
910
+ position:relative;
911
+ width:<?php echo $wp_logo_slider_settings['slider_width']; ?>px !important;
912
+ left:34px !important;
913
+ }
914
+ .slider-controls {
915
+ position: absolute;
916
+ top: <?php echo $wp_logo_slider_settings['slider_height'] / 2 - 19 ?>px;
917
+ width: 100% !important;
918
+ }
919
+ #logo-slider {
920
+ background:<?php echo $wp_logo_slider_settings['bgcolour']; ?>;
921
+ height: <?php echo $wp_logo_slider_settings['slider_height']?>px;
922
+ list-style: none outside none;
923
+ margin: 0;
924
+ overflow: hidden;
925
+ padding: 0;
926
+ position: relative;
927
+ width: 100% !important;
928
+ }
929
+ .slide {
930
+ list-style: none outside none;
931
+ margin: 0 !important;
932
+ width: <?php echo $wp_logo_slider_settings['slider_width']; ?>px !important;
933
+ }
934
  }
935
+ </style>
936
+ <?php
937
+ }
938
 
939
+ add_action( 'admin_enqueue_scripts', 'wp_logo_slider_admin_styles' );
940
+ function wp_logo_slider_admin_styles(){ ?>
941
+ <style type="text/css" media="screen">
942
+ #arrow-style p {
943
+ float:left;
944
+ height:60px;
945
+ width:40px;
946
+ text-align:center;
947
+ margin-right:16px;
948
+ }
949
+ </style>
950
+ <?php
951
+ }
952
+ ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: EnigmaWeb
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CEJ9HFWJ94BG4
4
  Tags: logo slide, logo slideshow, logo slide show, logo carousel, image carousel, logo slider, sponsors, logo showcase
5
  Requires at least: 3.1
6
- Tested up to: 4.1
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
 
@@ -78,6 +78,12 @@ If you've tried all the obvious stuff and it's still not working please request
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
 
81
  = 1.4.4 =
82
  * Number of logos to be displayed in iPad - Fixed
83
 
@@ -116,6 +122,12 @@ If you've tried all the obvious stuff and it's still not working please request
116
 
117
  == Upgrade Notice ==
118
 
 
 
 
 
 
 
119
  = 1.4.4 =
120
  * Number of logos to be displayed in iPad - Fixed
121
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CEJ9HFWJ94BG4
4
  Tags: logo slide, logo slideshow, logo slide show, logo carousel, image carousel, logo slider, sponsors, logo showcase
5
  Requires at least: 3.1
6
+ Tested up to: 4.2
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
 
78
 
79
  == Changelog ==
80
 
81
+ = 1.4.5 =
82
+ * Off Buttons issue - Fixed.
83
+ * Function renamed for admin styles.
84
+ * Function for loading plugin text domain fixed.
85
+ * Some code indentation.
86
+
87
  = 1.4.4 =
88
  * Number of logos to be displayed in iPad - Fixed
89
 
122
 
123
  == Upgrade Notice ==
124
 
125
+ = 1.4.5 =
126
+ * Off Buttons issue - Fixed.
127
+ * Function renamed for admin styles.
128
+ * Function for loading plugin text domain fixed.
129
+ * Some code indentation.
130
+
131
  = 1.4.4 =
132
  * Number of logos to be displayed in iPad - Fixed
133