Easy Social Icons - Version 1.2.4

Version Description

  • Bug fix, Security updates
Download this release

Release Info

Developer cybernetikz
Plugin Icon 128x128 Easy Social Icons
Version 1.2.4
Comparing to
See all releases

Code changes from version 1.2.3.1 to 1.2.4

css/admin-style.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .content_wrapper{ display:table; width:100%;}
2
+ .content_wrapper .left{ display:table-cell; float:none; vertical-align:top; }
3
+ .content_wrapper .right{ display:table-cell; float:none; vertical-align:top; width:261px; padding:0 0 0 20px; }
easy-social-icons.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Easy Social Icons
4
  Plugin URI: http://www.cybernetikz.com
5
  Description: You can upload your own social icon, set your social URL, choose weather you want to display vertical or horizontal. You can use the shortcode <strong>[cn-social-icon]</strong> in page/post, template tag for php file <strong>&lt;?php if ( function_exists('cn_social_icon') ) echo cn_social_icon(); ?&gt;</strong> also you can use the widget <strong>"Easy Social Icons"</strong> for sidebar.
6
- Version: 1.2.3.1
7
  Author: cybernetikz
8
  Author URI: http://www.cybernetikz.com
9
  License: GPL2
@@ -11,11 +11,43 @@ License: GPL2
11
 
12
  if( !defined('ABSPATH') ) die('-1');
13
  $upload_dir = wp_upload_dir();
14
- //print_r($upload_dir);
15
  $baseDir = $upload_dir['basedir'].'/';
16
  $baseURL = $upload_dir['baseurl'].'';
17
  $pluginsURI = plugins_url('/easy-social-icons/');
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  function generateRandomCode($length)
20
  {
21
  $chars = "234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -28,6 +60,13 @@ function generateRandomCode($length)
28
  return $url;
29
  }
30
 
 
 
 
 
 
 
 
31
  function cnss_my_script() {
32
  global $pluginsURI;
33
  wp_enqueue_script( 'jquery' );
@@ -40,7 +79,6 @@ function cnss_my_script() {
40
  }
41
 
42
  function cnss_admin_enqueue() {
43
- //if ($hook!='easy-social-icon_page_cnss_social_icon_add') return; //$hook
44
  global $pluginsURI;
45
  wp_enqueue_media();
46
  wp_register_script('cnss_admin_js', $pluginsURI . 'js/cnss_admin.js', array(), '1.0' );
@@ -104,27 +142,24 @@ function cnss_social_icon_option_fn() {
104
 
105
  ?>
106
  <div class="wrap">
107
- <h2>Social Icon Options</h2>
108
- <form method="post" action="options.php">
 
 
109
  <?php settings_fields( 'cnss-settings-group' ); ?>
110
  <table class="form-table">
111
  <tr valign="top">
112
  <th scope="row">Icon Width</th>
113
- <td><input type="text" name="cnss-width" id="cnss-width" class="small-text" value="<?php echo $cnss_width?>" />px</td>
114
  </tr>
115
  <tr valign="top">
116
  <th scope="row">Icon Height</th>
117
- <td><input type="text" name="cnss-height" id="cnss-height" class="small-text" value="<?php echo $cnss_height?>" />px</td>
118
  </tr>
119
  <tr valign="top">
120
  <th scope="row">Icon Margin <em><small>(Gap between each icon)</small></em></th>
121
- <td><input type="text" name="cnss-margin" id="cnss-margin" class="small-text" value="<?php echo $cnss_margin?>" />px</td>
122
  </tr>
123
-
124
- <?php /*?><tr valign="top">
125
- <th scope="row">Number of Rows</th>
126
- <td><input type="text" name="cnss-row-count" id="cnss-row-count" class="small-text" value="<?php echo $cnss_rows?>" /></td>
127
- </tr><?php */?>
128
 
129
  <tr valign="top">
130
  <th scope="row">Display Icon</th>
@@ -141,94 +176,61 @@ function cnss_social_icon_option_fn() {
141
  <input <?php echo $right ?> type="radio" name="cnss-text-align" id="right" value="right" />&nbsp;<label for="right">Right</label></td>
142
  </tr>
143
  </table>
144
-
145
  <p class="submit">
146
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
147
  </p>
148
  </form>
 
 
 
 
 
149
  </div>
150
  <?php
151
  }
152
 
153
  function cnss_db_install () {
154
- global $wpdb;
155
- global $cnss_db_version;
156
-
157
- $upload_dir = wp_upload_dir();
158
-
159
- /*$srcdir = ABSPATH.'wp-content/plugins/easy-social-icons/images/icon/';
160
- $targetdir = $upload_dir['basedir'].'/';
161
-
162
- $files = scandir($srcdir);
163
- foreach($files as $fname)
164
- {
165
- if($fname=='.')continue;
166
- if($fname=='..')continue;
167
- copy($srcdir.$fname, $targetdir.$fname);
168
- }*/
169
-
170
- $table_name = $wpdb->prefix . "cn_social_icon";
171
- if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
172
-
173
- $sql2 = "CREATE TABLE `$table_name` (
174
- `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
175
- `title` VARCHAR(255) NULL,
176
- `url` VARCHAR(255) NOT NULL,
177
- `image_url` VARCHAR(255) NOT NULL,
178
- `sortorder` INT NOT NULL DEFAULT '0',
179
- `date_upload` VARCHAR(100) NULL,
180
- `target` tinyint(1) NOT NULL DEFAULT '1',
181
- PRIMARY KEY (`id`)) ENGINE = InnoDB;";
182
-
183
- /*
184
- INSERT INTO `$table_name` (`title`, `url`, `image_url`, `sortorder`, `date_upload`, `target`) VALUES
185
- ('facebook', 'http://facebook.com/your-fan-page', '1368459524_facebook.png', 1, '1368459524', 1),
186
- ('twitter', 'http://twitter/username', '1368459556_twitter.png', 2, '1368459556', 1),
187
- ('flickr', 'http://flickr.com/?username', '1368459641_flicker.png', 3, '1368459641', 1),
188
- ('linkedin', 'http://linkedin.com', '1368459699_in.png', 4, '1368459699', 1),
189
- ('youtube', 'http://youtube.com/user', '1368459724_youtube.png', 5, '1368459724', 1);
190
- */
191
 
192
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
193
- dbDelta($sql2);
194
 
195
- add_option( 'cnss-width', '32');
196
- add_option( 'cnss-height', '32');
197
- add_option( 'cnss-margin', '4');
198
- add_option( 'cnss-row-count', '1');
199
- add_option( 'cnss-vertical-horizontal', 'horizontal');
200
- add_option( 'cnss-text-align', 'center');
201
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
203
-
204
  register_activation_hook(__FILE__,'cnss_db_install');
205
 
206
  if (isset($_GET['delete'])) {
207
-
208
  if ($_GET['id'] != '')
209
  {
210
-
211
  $table_name = $wpdb->prefix . "cn_social_icon";
212
- $image_file_path = $baseDir; //"../wp-content/uploads/";
213
- /*$sql = "SELECT * FROM ".$table_name." WHERE id =".$_GET['id'];
214
- $video_info = $wpdb->get_results($sql);
215
-
216
- if (!empty($video_info))
217
- {
218
- @unlink($image_file_path.$video_info[0]->image_url);
219
- }*/
220
- //$delete = "DELETE FROM ".$table_name." WHERE id = ".$_GET['id']." LIMIT 1";
221
- //$results = $wpdb->query( $delete );
222
-
223
  $wpdb->delete( $table_name, array( 'id' => $_GET['id'] ), array( '%d' ) );
224
-
225
  $msg = "Delete Successfully!!!"."<br />";
226
  }
227
-
228
  }
229
 
230
  add_action('init', 'cn_process_post');
231
-
232
  function cn_process_post(){
233
  global $wpdb,$err,$msg,$baseDir;
234
  if ( isset($_POST['submit_button']) && check_admin_referer('cn_insert_icon') ) {
@@ -239,68 +241,11 @@ function cn_process_post(){
239
  $err = "";
240
  $msg = "";
241
 
242
- //$image_file_path = "../wp-content/uploads/";
243
  $image_file_path = $baseDir;
244
 
245
- /*if ($_FILES["image_file"]["name"] != "" ){
246
-
247
- $extArr = array('jpg','png','gif','jpeg');
248
- $target_file = $image_file_path . basename($_FILES["image_file"]["name"]);
249
- $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
250
- $check = getimagesize($_FILES["image_file"]["tmp_name"]);
251
- if($check === false || !in_array($imageFileType,$extArr)) {
252
- $err .= "Invalid file type<br />";
253
- }
254
- else
255
- {
256
- if( $err=='' and $_FILES["image_file"]["size"] < 1024*1024*1 ) {
257
-
258
- if ($_FILES["image_file"]["error"] > 0)
259
- {
260
- $err .= "Return Code: " . $_FILES["image_file"]["error"] . "<br />";
261
- }
262
- else
263
- {
264
- if (file_exists($image_file_path . $_FILES["image_file"]["name"]))
265
- {
266
- $err .= $_FILES["image_file"]["name"] . " already exists. ";
267
- }
268
- else
269
- {
270
- $image_file_name = time().generateRandomCode(16).'.'.$imageFileType;
271
- $fstatus = move_uploaded_file($_FILES["image_file"]["tmp_name"], $image_file_path . $image_file_name);
272
- if ($fstatus == true){
273
- $msg = "Icon upload successful !"."<br />";
274
- }
275
- }
276
- }
277
- }
278
- else
279
- {
280
- $err .= "Max file size exceded" . "<br />";
281
- }
282
- }
283
- }
284
- else
285
- {
286
- $err .= "Please input image file". "<br />";
287
- }// end if image file*/
288
-
289
  if ($err == '')
290
  {
291
  $table_name = $wpdb->prefix . "cn_social_icon";
292
-
293
- /*$insert = "INSERT INTO " . $table_name .
294
- " (title, url, image_url, sortorder, date_upload, target) " .
295
- "VALUES ('" .
296
- sanitize_text_field( $_POST['title']) . "','" .
297
- sanitize_text_field( $_POST['url']) . "','" .
298
- $_POST['image_file'] . "'," .
299
- $_POST['sortorder'] . ",'" .
300
- time() . "'," .
301
- $_POST['target'] . "" .
302
- ")";*/
303
- //$results = $wpdb->query( $insert );
304
 
305
  $results = $wpdb->insert(
306
  $table_name,
@@ -337,79 +282,14 @@ function cn_process_post(){
337
 
338
  $url = $_POST['url'];
339
  $target = $_POST['target'];
340
-
341
- //$image_file_path = "../wp-content/uploads/";
342
  $image_file_path = $baseDir;
343
 
344
- $table_name = $wpdb->prefix . "cn_social_icon";
345
- $sql = "SELECT * FROM ".$table_name." WHERE id =".$_POST['id'];
346
- $video_info = $wpdb->get_results($sql);
347
- $image_file_name = $video_info[0]->image_url;
348
  $update = "";
349
-
350
- $type= 1;
351
- /*if ($_FILES["image_file"]["name"] != ""){
352
-
353
- $extArr = array('jpg','png','gif','jpeg');
354
- $target_file = $image_file_path . basename($_FILES["image_file"]["name"]);
355
- $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
356
- $check = getimagesize($_FILES["image_file"]["tmp_name"]);
357
- if($check === false || !in_array($imageFileType,$extArr)) {
358
- $err .= "Invalid file type<br />";
359
- }
360
- else
361
- {
362
-
363
- if( $err=='' && $_FILES["image_file"]["size"] <= 1024*1024*1 )
364
- {
365
- if ($_FILES["image_file"]["error"] > 0)
366
- {
367
- $err .= "Return Code: " . $_FILES["image_file"]["error"] . "<br />";
368
- }
369
- else
370
- {
371
- if (file_exists($image_file_path . $_FILES["image_file"]["name"]))
372
- {
373
- $err .= $_FILES["image_file"]["name"] . " already exists. ";
374
- }
375
- else
376
- {
377
- $image_file_name = time().generateRandomCode(16).'.'.$imageFileType;
378
- $fstatus = move_uploaded_file($_FILES["image_file"]["tmp_name"], $image_file_path . $image_file_name);
379
-
380
- if ($fstatus == true){
381
- $msg = "File Uploaded Successfully!!!".'<br />';
382
- @unlink($image_file_path.$video_info[0]->image_url);
383
- $update = "UPDATE " . $table_name . " SET " .
384
- "image_url='" .$image_file_name . "'" .
385
- " WHERE id=" . $_POST['id'];
386
- $results1 = $wpdb->query( $update );
387
- }
388
- }
389
- }
390
- }
391
- else
392
- {
393
- $err .= "Invalid file type or max file size exceded";
394
- }
395
- }
396
- }*/
397
-
398
- /*$update = "UPDATE " . $table_name . " SET " .
399
- "title='" .sanitize_text_field( $_POST['title']) . "'," .
400
- "url='" . $url . "'," .
401
- "image_url='" . $_POST['image_file'] . "'," .
402
- "sortorder=" .$_POST['sortorder'] . "," .
403
- "date_upload='" .time(). "'," .
404
- "target=$target " .
405
- " WHERE id=" . $_POST['id'];*/
406
-
407
 
408
  if ($err == '')
409
  {
410
  $table_name = $wpdb->prefix . "cn_social_icon";
411
- //$results3 = $wpdb->query( $update );
412
-
413
  $result3 = $wpdb->update(
414
  $table_name,
415
  array(
@@ -442,7 +322,6 @@ function cn_process_post(){
442
  }
443
 
444
  } // end edit
445
-
446
  }
447
  }//cn_process_post end
448
 
@@ -452,7 +331,7 @@ function cnss_social_icon_sort_fn() {
452
  $cnss_width = get_option('cnss-width');
453
  $cnss_height = get_option('cnss-height');
454
 
455
- $image_file_path = $baseURL; //"../wp-content/uploads/";
456
  $table_name = $wpdb->prefix . "cn_social_icon";
457
  $sql = "SELECT * FROM ".$table_name." WHERE 1 ORDER BY sortorder";
458
  $video_info = $wpdb->get_results($sql);
@@ -507,11 +386,9 @@ function cnss_social_icon_sort_fn() {
507
  });
508
  jQuery("#sortable").disableSelection();
509
  jQuery("#save-order").bind( "click", function() {
510
- //alert(jQuery("#sortable").sortable("serialize"));
511
  jQuery.post( ajaxurl, { action:'update-social-icon-order', order:jQuery("#sortable").sortable("serialize") }, function(response) {
512
- //alert(response);
513
  jQuery("#ajax-response").html('<div class="message updated fade"><p>Items Order Updated</p></div>');
514
- jQuery("#ajax-response div").delay(3000).hide("slow");
515
  });
516
  });
517
  });
@@ -529,19 +406,16 @@ function cnss_save_ajax_order()
529
  if (is_array($data))
530
  foreach($data as $key => $values )
531
  {
532
-
533
  if ( $key == 'item' )
534
  {
535
  foreach( $values as $position => $id )
536
- {
537
- $wpdb->update( $table_name, array('sortorder' => $position), array('id' => $id) );
538
- }
539
  }
540
-
541
  }
542
  }
543
 
544
-
545
  function cnss_social_icon_add_fn() {
546
 
547
  global $err,$msg,$baseURL;
@@ -551,15 +425,18 @@ function cnss_social_icon_add_fn() {
551
  //$cnss_margin = get_option('cnss-margin');
552
 
553
  if (isset($_GET['mode'])) {
554
- if ( $_GET['mode'] != '' and $_GET['mode'] == 'edit' and $_GET['id'] != '' )
555
- {
 
 
 
556
  $page_title = 'Edit Icon';
557
  $uptxt = 'Icon';
558
 
559
  global $wpdb;
560
  $table_name = $wpdb->prefix . "cn_social_icon";
561
- $image_file_path = $baseURL; //"../wp-content/uploads/";
562
- $sql = "SELECT * FROM ".$table_name." WHERE id =".$_GET['id'];
563
  $video_info = $wpdb->get_results($sql);
564
 
565
  if (!empty($video_info))
@@ -575,7 +452,6 @@ function cnss_social_icon_add_fn() {
575
  $image_url = $image_file_path.'/'.$image_url;
576
  else
577
  $image_url = $image_url;
578
-
579
  }
580
  }
581
  }
@@ -597,8 +473,7 @@ if($msg!='') echo '<div id="message" class="updated fade">'.$msg.'</div>';
597
  if($err!='') echo '<div id="message" class="error fade">'.$err.'</div>';
598
  ?>
599
  <h2><?php echo $page_title;?></h2>
600
-
601
- <form method="post" enctype="multipart/form-data" action="<?php //echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
602
  <?php wp_nonce_field('cn_insert_icon'); ?>
603
  <table class="form-table">
604
  <tr valign="top">
@@ -611,11 +486,9 @@ if($err!='') echo '<div id="message" class="error fade">'.$err.'</div>';
611
  <tr valign="top">
612
  <th scope="row"><?php echo $uptxt;?></th>
613
  <td>
614
- <?php //if (isset($_GET['mode'])) { } ?>
615
- <!--<input type="file" name="image_file" id="image_file" value="" />-->
616
  <input style="vertical-align:top" type="text" name="image_file" id="image_file" class="regular-text" value="<?php echo $image_url ?>" />
617
  <input style="vertical-align:top" id="logo_image_button" class="button" type="button" value="Choose Icon" />
618
- <img style="vertical-align:top" id="logoimg" src="<?php echo $image_url==''?$blank_img:$image_url; ?>" border="0" width="<?php echo $cnss_width ?>" height="<?php echo $cnss_height ?>" alt="<?php echo $title?>" /><br />
619
  </td>
620
  </tr>
621
 
@@ -627,7 +500,7 @@ if($err!='') echo '<div id="message" class="error fade">'.$err.'</div>';
627
  <tr valign="top">
628
  <th scope="row">Sort Order</th>
629
  <td>
630
- <input type="text" name="sortorder" id="sortorder" class="small-text" value="<?php echo $sortorder?>" />
631
  </td>
632
  </tr>
633
 
@@ -638,26 +511,19 @@ if($err!='') echo '<div id="message" class="error fade">'.$err.'</div>';
638
  <input type="radio" name="target" id="same" value="0" />&nbsp;<label for="same">Open same window</label>&nbsp;
639
  </td>
640
  </tr>
641
-
642
-
643
  </table>
644
 
645
-
646
  <?php if (isset($_GET['mode']) ) { ?>
647
  <input type="hidden" name="action" value="edit" />
648
  <input type="hidden" name="id" id="id" value="<?php echo $id;?>" />
649
  <?php } else {?>
650
  <input type="hidden" name="action" value="update" />
651
  <?php } ?>
652
-
653
 
654
  <p class="submit">
655
  <input type="submit" id="submit_button" name="submit_button" class="button-primary" value="<?php _e('Save Changes') ?>" />
656
  </p>
657
-
658
  </form>
659
-
660
-
661
  </div>
662
  <?php
663
  }
@@ -669,7 +535,7 @@ function cnss_social_icon_page_fn() {
669
  $cnss_width = get_option('cnss-width');
670
  $cnss_height = get_option('cnss-height');
671
 
672
- $image_file_path = $baseURL; //"../wp-content/uploads/";
673
  $table_name = $wpdb->prefix . "cn_social_icon";
674
  $sql = "SELECT * FROM ".$table_name." WHERE 1 ORDER BY sortorder";
675
  $video_info = $wpdb->get_results($sql);
@@ -686,15 +552,12 @@ function cnss_social_icon_page_fn() {
686
  {
687
  rpath1 = '<?php echo $_SERVER['PHP_SELF'].'?page=cnss_social_icon_page'; ?>';
688
  rpath2 = '&delete=y&id='+id;
689
- //alert(rpath1+rpath2);
690
  window.location = rpath1+rpath2;
691
  }
692
  }
693
  </script>
694
 
695
-
696
  <table class="widefat page fixed" cellspacing="0">
697
-
698
  <thead>
699
  <tr valign="top">
700
  <th class="manage-column column-title" scope="col">Title</th>
@@ -739,7 +602,6 @@ function cnss_social_icon_page_fn() {
739
  <td>
740
  <a onclick="show_confirm('<?php echo addslashes($vdoinfo->title)?>','<?php echo $vdoinfo->id;?>');" href="#delete"><strong>Delete</strong></a>
741
  </td>
742
-
743
  </tr>
744
  <?php }?>
745
  </tbody>
@@ -767,10 +629,9 @@ function cn_social_icon_table() {
767
  $cnss_rows = get_option('cnss-row-count');
768
  $vorh = get_option('cnss-vertical-horizontal');
769
 
770
- //$upload_dir = wp_upload_dir();
771
  global $wpdb,$baseURL;
772
  $table_name = $wpdb->prefix . "cn_social_icon";
773
- $image_file_path = $baseURL; //$upload_dir['baseurl'];
774
  $sql = "SELECT * FROM ".$table_name." WHERE image_url<>'' AND url<>'' ORDER BY sortorder";
775
  $video_info = $wpdb->get_results($sql);
776
  $icon_count = count($video_info);
@@ -783,13 +644,11 @@ function cn_social_icon_table() {
783
  $table_width = $cnss_width;
784
  else
785
  $table_width = $_columnCount*($cnss_width+$cnss_margin);
786
- //$table_width = $icon_count*($cnss_width+$cnss_margin);
787
 
788
  $td_width = $cnss_width+$cnss_margin;
789
 
790
  ob_start();
791
  echo '<table class="cnss-social-icon" style="width:'.$table_width.'px" border="0" cellspacing="0" cellpadding="0">';
792
- //echo $vorh=='horizontal'?'<tr>':'';
793
  $i=0;
794
  foreach($video_info as $icon)
795
  {
@@ -804,9 +663,7 @@ function cn_social_icon_table() {
804
  ?><td style="width:<?php echo $td_width ?>px"><a <?php echo ($icon->target==1)?'target="_blank"':'' ?> title="<?php echo $icon->title ?>" href="<?php echo $icon->url ?>"><img src="<?php echo $image_url?>" border="0" width="<?php echo $cnss_width ?>" height="<?php echo $cnss_height ?>" alt="<?php echo $icon->title ?>" /></a></td><?php
805
  if ( ($i%$_columnCount==0 || $i==$_collectionSize) && $vorh!='vertical' )echo '</tr>';
806
  echo $vorh=='vertical'?'</tr>':'';
807
- //$i++;
808
  }
809
- //echo $vorh=='horizontal'?'</tr>':'';
810
  echo '</table>';
811
  $out = ob_get_contents();
812
  ob_end_clean();
@@ -903,5 +760,4 @@ class Cnss_Widget extends WP_Widget {
903
 
904
  } // class Cnss_Widget
905
  add_action( 'widgets_init', create_function( '', 'register_widget( "Cnss_Widget" );' ) );
906
-
907
  add_shortcode('cn-social-icon', 'cn_social_icon');
3
  Plugin Name: Easy Social Icons
4
  Plugin URI: http://www.cybernetikz.com
5
  Description: You can upload your own social icon, set your social URL, choose weather you want to display vertical or horizontal. You can use the shortcode <strong>[cn-social-icon]</strong> in page/post, template tag for php file <strong>&lt;?php if ( function_exists('cn_social_icon') ) echo cn_social_icon(); ?&gt;</strong> also you can use the widget <strong>"Easy Social Icons"</strong> for sidebar.
6
+ Version: 1.2.4
7
  Author: cybernetikz
8
  Author URI: http://www.cybernetikz.com
9
  License: GPL2
11
 
12
  if( !defined('ABSPATH') ) die('-1');
13
  $upload_dir = wp_upload_dir();
 
14
  $baseDir = $upload_dir['basedir'].'/';
15
  $baseURL = $upload_dir['baseurl'].'';
16
  $pluginsURI = plugins_url('/easy-social-icons/');
17
 
18
+ function cnss_admin_sidebar() {
19
+
20
+ $banners = array(
21
+ array(
22
+ 'url' => 'http://www.cybernetikz.com/wordpress-magento-plugins/wordpress-plugins/?utm_source=easy-social-icons&utm_medium=banner&utm_campaign=wordpress-plugins',
23
+ 'img' => 'banner-1.jpg',
24
+ 'alt' => 'Banner 1',
25
+ ),
26
+ array(
27
+ 'url' => 'http://www.cybernetikz.com/portfolio/web-development/wordpress-website/?utm_source=easy-social-icons&utm_medium=banner&utm_campaign=wordpress-plugins',
28
+ 'img' => 'banner-2.jpg',
29
+ 'alt' => 'Banner 2',
30
+ ),
31
+ array(
32
+ 'url' => 'http://www.cybernetikz.com/seo-consultancy/?utm_source=easy-social-icons&utm_medium=banner&utm_campaign=wordpress-plugins',
33
+ 'img' => 'banner-3.jpg',
34
+ 'alt' => 'Banner 3',
35
+ ),
36
+ );
37
+ shuffle( $banners );
38
+ ?>
39
+ <div class="cn_admin_banner">
40
+ <?php
41
+ $i = 0;
42
+ foreach ( $banners as $banner ) {
43
+ echo '<a target="_blank" href="' . esc_url( $banner['url'] ) . '"><img width="261" height="190" src="' . plugins_url( 'images/' . $banner['img'], __FILE__ ) . '" alt="' . esc_attr( $banner['alt'] ) . '"/></a><br/><br/>';
44
+ $i ++;
45
+ }
46
+ ?>
47
+ </div>
48
+ <?php
49
+ }
50
+
51
  function generateRandomCode($length)
52
  {
53
  $chars = "234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
60
  return $url;
61
  }
62
 
63
+ function cnss_admin_style() {
64
+ global $pluginsURI;
65
+ wp_register_style( 'cnss_admin_css', $pluginsURI . 'css/admin-style.css', false, '1.0' );
66
+ wp_enqueue_style( 'cnss_admin_css' );
67
+ }
68
+ add_action( 'admin_enqueue_scripts', 'cnss_admin_style' );
69
+
70
  function cnss_my_script() {
71
  global $pluginsURI;
72
  wp_enqueue_script( 'jquery' );
79
  }
80
 
81
  function cnss_admin_enqueue() {
 
82
  global $pluginsURI;
83
  wp_enqueue_media();
84
  wp_register_script('cnss_admin_js', $pluginsURI . 'js/cnss_admin.js', array(), '1.0' );
142
 
143
  ?>
144
  <div class="wrap">
145
+ <h2>Social Icon Options</h2>
146
+ <div class="content_wrapper">
147
+ <div class="left">
148
+ <form method="post" action="options.php" enctype="multipart/form-data">
149
  <?php settings_fields( 'cnss-settings-group' ); ?>
150
  <table class="form-table">
151
  <tr valign="top">
152
  <th scope="row">Icon Width</th>
153
+ <td><input type="number" name="cnss-width" id="cnss-width" class="small-text" value="<?php echo $cnss_width?>" />px</td>
154
  </tr>
155
  <tr valign="top">
156
  <th scope="row">Icon Height</th>
157
+ <td><input type="number" name="cnss-height" id="cnss-height" class="small-text" value="<?php echo $cnss_height?>" />px</td>
158
  </tr>
159
  <tr valign="top">
160
  <th scope="row">Icon Margin <em><small>(Gap between each icon)</small></em></th>
161
+ <td><input type="number" name="cnss-margin" id="cnss-margin" class="small-text" value="<?php echo $cnss_margin?>" />px</td>
162
  </tr>
 
 
 
 
 
163
 
164
  <tr valign="top">
165
  <th scope="row">Display Icon</th>
176
  <input <?php echo $right ?> type="radio" name="cnss-text-align" id="right" value="right" />&nbsp;<label for="right">Right</label></td>
177
  </tr>
178
  </table>
 
179
  <p class="submit">
180
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
181
  </p>
182
  </form>
183
+ </div>
184
+ <div class="right">
185
+ <?php cnss_admin_sidebar(); ?>
186
+ </div>
187
+ </div>
188
  </div>
189
  <?php
190
  }
191
 
192
  function cnss_db_install () {
193
+ global $wpdb;
194
+ global $cnss_db_version;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
+ $upload_dir = wp_upload_dir();
 
197
 
198
+ $table_name = $wpdb->prefix . "cn_social_icon";
199
+ if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
200
+ $sql2 = "CREATE TABLE `$table_name` (
201
+ `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
202
+ `title` VARCHAR(255) NULL,
203
+ `url` VARCHAR(255) NOT NULL,
204
+ `image_url` VARCHAR(255) NOT NULL,
205
+ `sortorder` INT NOT NULL DEFAULT '0',
206
+ `date_upload` VARCHAR(100) NULL,
207
+ `target` tinyint(1) NOT NULL DEFAULT '1',
208
+ PRIMARY KEY (`id`)) ENGINE = InnoDB;";
209
+
210
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
211
+ dbDelta($sql2);
212
+
213
+ add_option( 'cnss-width', '32');
214
+ add_option( 'cnss-height', '32');
215
+ add_option( 'cnss-margin', '4');
216
+ add_option( 'cnss-row-count', '1');
217
+ add_option( 'cnss-vertical-horizontal', 'horizontal');
218
+ add_option( 'cnss-text-align', 'center');
219
+ }
220
  }
 
221
  register_activation_hook(__FILE__,'cnss_db_install');
222
 
223
  if (isset($_GET['delete'])) {
 
224
  if ($_GET['id'] != '')
225
  {
 
226
  $table_name = $wpdb->prefix . "cn_social_icon";
227
+ $image_file_path = $baseDir;
 
 
 
 
 
 
 
 
 
 
228
  $wpdb->delete( $table_name, array( 'id' => $_GET['id'] ), array( '%d' ) );
 
229
  $msg = "Delete Successfully!!!"."<br />";
230
  }
 
231
  }
232
 
233
  add_action('init', 'cn_process_post');
 
234
  function cn_process_post(){
235
  global $wpdb,$err,$msg,$baseDir;
236
  if ( isset($_POST['submit_button']) && check_admin_referer('cn_insert_icon') ) {
241
  $err = "";
242
  $msg = "";
243
 
 
244
  $image_file_path = $baseDir;
245
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  if ($err == '')
247
  {
248
  $table_name = $wpdb->prefix . "cn_social_icon";
 
 
 
 
 
 
 
 
 
 
 
 
249
 
250
  $results = $wpdb->insert(
251
  $table_name,
282
 
283
  $url = $_POST['url'];
284
  $target = $_POST['target'];
 
 
285
  $image_file_path = $baseDir;
286
 
 
 
 
 
287
  $update = "";
288
+ $type = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
 
290
  if ($err == '')
291
  {
292
  $table_name = $wpdb->prefix . "cn_social_icon";
 
 
293
  $result3 = $wpdb->update(
294
  $table_name,
295
  array(
322
  }
323
 
324
  } // end edit
 
325
  }
326
  }//cn_process_post end
327
 
331
  $cnss_width = get_option('cnss-width');
332
  $cnss_height = get_option('cnss-height');
333
 
334
+ $image_file_path = $baseURL;
335
  $table_name = $wpdb->prefix . "cn_social_icon";
336
  $sql = "SELECT * FROM ".$table_name." WHERE 1 ORDER BY sortorder";
337
  $video_info = $wpdb->get_results($sql);
386
  });
387
  jQuery("#sortable").disableSelection();
388
  jQuery("#save-order").bind( "click", function() {
 
389
  jQuery.post( ajaxurl, { action:'update-social-icon-order', order:jQuery("#sortable").sortable("serialize") }, function(response) {
 
390
  jQuery("#ajax-response").html('<div class="message updated fade"><p>Items Order Updated</p></div>');
391
+ jQuery("#ajax-response div").delay(1000).hide("slow");
392
  });
393
  });
394
  });
406
  if (is_array($data))
407
  foreach($data as $key => $values )
408
  {
 
409
  if ( $key == 'item' )
410
  {
411
  foreach( $values as $position => $id )
412
+ {
413
+ $wpdb->update( $table_name, array('sortorder' => $position), array('id' => $id) );
414
+ }
415
  }
 
416
  }
417
  }
418
 
 
419
  function cnss_social_icon_add_fn() {
420
 
421
  global $err,$msg,$baseURL;
425
  //$cnss_margin = get_option('cnss-margin');
426
 
427
  if (isset($_GET['mode'])) {
428
+ if ( $_GET['mode'] == 'edit' and $_GET['id'] != '' ) {
429
+
430
+ if( ! is_numeric($_GET['id']) )
431
+ wp_die('Sequrity Issue.');
432
+
433
  $page_title = 'Edit Icon';
434
  $uptxt = 'Icon';
435
 
436
  global $wpdb;
437
  $table_name = $wpdb->prefix . "cn_social_icon";
438
+ $image_file_path = $baseURL;
439
+ $sql = sprintf("SELECT * FROM %s WHERE id=%d", $table_name, $_GET['id']);
440
  $video_info = $wpdb->get_results($sql);
441
 
442
  if (!empty($video_info))
452
  $image_url = $image_file_path.'/'.$image_url;
453
  else
454
  $image_url = $image_url;
 
455
  }
456
  }
457
  }
473
  if($err!='') echo '<div id="message" class="error fade">'.$err.'</div>';
474
  ?>
475
  <h2><?php echo $page_title;?></h2>
476
+ <form method="post" enctype="multipart/form-data" action="">
 
477
  <?php wp_nonce_field('cn_insert_icon'); ?>
478
  <table class="form-table">
479
  <tr valign="top">
486
  <tr valign="top">
487
  <th scope="row"><?php echo $uptxt;?></th>
488
  <td>
 
 
489
  <input style="vertical-align:top" type="text" name="image_file" id="image_file" class="regular-text" value="<?php echo $image_url ?>" />
490
  <input style="vertical-align:top" id="logo_image_button" class="button" type="button" value="Choose Icon" />
491
+ <img style="vertical-align:top" id="logoimg" src="<?php echo $image_url==''?$blank_img:$image_url; ?>" border="0" width="<?php echo $cnss_width; ?>" height="<?php echo $cnss_height; ?>" alt="<?php echo $title; ?>" /><br />
492
  </td>
493
  </tr>
494
 
500
  <tr valign="top">
501
  <th scope="row">Sort Order</th>
502
  <td>
503
+ <input type="number" name="sortorder" id="sortorder" class="small-text" value="<?php echo $sortorder?>" />
504
  </td>
505
  </tr>
506
 
511
  <input type="radio" name="target" id="same" value="0" />&nbsp;<label for="same">Open same window</label>&nbsp;
512
  </td>
513
  </tr>
 
 
514
  </table>
515
 
 
516
  <?php if (isset($_GET['mode']) ) { ?>
517
  <input type="hidden" name="action" value="edit" />
518
  <input type="hidden" name="id" id="id" value="<?php echo $id;?>" />
519
  <?php } else {?>
520
  <input type="hidden" name="action" value="update" />
521
  <?php } ?>
 
522
 
523
  <p class="submit">
524
  <input type="submit" id="submit_button" name="submit_button" class="button-primary" value="<?php _e('Save Changes') ?>" />
525
  </p>
 
526
  </form>
 
 
527
  </div>
528
  <?php
529
  }
535
  $cnss_width = get_option('cnss-width');
536
  $cnss_height = get_option('cnss-height');
537
 
538
+ $image_file_path = $baseURL;
539
  $table_name = $wpdb->prefix . "cn_social_icon";
540
  $sql = "SELECT * FROM ".$table_name." WHERE 1 ORDER BY sortorder";
541
  $video_info = $wpdb->get_results($sql);
552
  {
553
  rpath1 = '<?php echo $_SERVER['PHP_SELF'].'?page=cnss_social_icon_page'; ?>';
554
  rpath2 = '&delete=y&id='+id;
 
555
  window.location = rpath1+rpath2;
556
  }
557
  }
558
  </script>
559
 
 
560
  <table class="widefat page fixed" cellspacing="0">
 
561
  <thead>
562
  <tr valign="top">
563
  <th class="manage-column column-title" scope="col">Title</th>
602
  <td>
603
  <a onclick="show_confirm('<?php echo addslashes($vdoinfo->title)?>','<?php echo $vdoinfo->id;?>');" href="#delete"><strong>Delete</strong></a>
604
  </td>
 
605
  </tr>
606
  <?php }?>
607
  </tbody>
629
  $cnss_rows = get_option('cnss-row-count');
630
  $vorh = get_option('cnss-vertical-horizontal');
631
 
 
632
  global $wpdb,$baseURL;
633
  $table_name = $wpdb->prefix . "cn_social_icon";
634
+ $image_file_path = $baseURL;
635
  $sql = "SELECT * FROM ".$table_name." WHERE image_url<>'' AND url<>'' ORDER BY sortorder";
636
  $video_info = $wpdb->get_results($sql);
637
  $icon_count = count($video_info);
644
  $table_width = $cnss_width;
645
  else
646
  $table_width = $_columnCount*($cnss_width+$cnss_margin);
 
647
 
648
  $td_width = $cnss_width+$cnss_margin;
649
 
650
  ob_start();
651
  echo '<table class="cnss-social-icon" style="width:'.$table_width.'px" border="0" cellspacing="0" cellpadding="0">';
 
652
  $i=0;
653
  foreach($video_info as $icon)
654
  {
663
  ?><td style="width:<?php echo $td_width ?>px"><a <?php echo ($icon->target==1)?'target="_blank"':'' ?> title="<?php echo $icon->title ?>" href="<?php echo $icon->url ?>"><img src="<?php echo $image_url?>" border="0" width="<?php echo $cnss_width ?>" height="<?php echo $cnss_height ?>" alt="<?php echo $icon->title ?>" /></a></td><?php
664
  if ( ($i%$_columnCount==0 || $i==$_collectionSize) && $vorh!='vertical' )echo '</tr>';
665
  echo $vorh=='vertical'?'</tr>':'';
 
666
  }
 
667
  echo '</table>';
668
  $out = ob_get_contents();
669
  ob_end_clean();
760
 
761
  } // class Cnss_Widget
762
  add_action( 'widgets_init', create_function( '', 'register_widget( "Cnss_Widget" );' ) );
 
763
  add_shortcode('cn-social-icon', 'cn_social_icon');
images/banner-1.jpg ADDED
Binary file
images/banner-2.jpg ADDED
Binary file
images/banner-3.jpg ADDED
Binary file
js/cnss_admin.js CHANGED
@@ -23,6 +23,7 @@ jQuery(document).ready(function($) {
23
  //alert(attachment.id);
24
  $('#image_file').val(attachment.url);
25
  $('#logoimg').attr('width','32');
 
26
  $('#logoimg').attr('src',attachment.url);
27
  //$('#ftrimg').attr('src',attachment.sizes.thumbnail.url);
28
 
23
  //alert(attachment.id);
24
  $('#image_file').val(attachment.url);
25
  $('#logoimg').attr('width','32');
26
+ $('#logoimg').attr('height','32');
27
  $('#logoimg').attr('src',attachment.url);
28
  //$('#ftrimg').attr('src',attachment.sizes.thumbnail.url);
29
 
readme.txt CHANGED
@@ -3,14 +3,14 @@ Contributors: cybernetikz
3
  Donate link:
4
  Tags: easy social icon,easy social icons,social icon,social icons,social,social share,follow,followus,follow us,share,icon
5
  Requires at least: 3.5
6
- Tested up to: 4.2.2
7
- Stable tag: 1.2.3.1
8
 
9
  You can upload your own social icon, set your social URL, choose whether you want to display vertical or horizontal.
10
 
11
  == Description ==
12
 
13
- You can upload your own social icon, set your social URL, choose weather you want to display vertical or horizontal. You can use the shortcode <strong>[cn-social-icon]</strong> in page/post, template tag for php file <strong><?php if ( function_exists('cn_social_icon') ) echo cn_social_icon(); ?></strong> also you can use the widget <strong>"Easy Social Icons"</strong> for sidebar.
14
 
15
  <strong>There is no predefined/built-in social icon added in this plugins, you have to upload your own custom social icons first.</strong>
16
 
@@ -19,7 +19,7 @@ If you are using <strong>wordpress version lower than 3.5</strong> please use "E
19
 
20
  > <strong>PAID SUPPORT ($30/Hr, We ACCEPT PAYPAL )</strong>
21
  >
22
- > We assume most of the users would find it easy to install & use this plugin but those who needs support on any of the following:
23
  >
24
  > <strong>a. Get the plugin installed </strong>
25
  >
@@ -80,12 +80,15 @@ If you are using wordpress version lower than 3.5 please use Easy social Icon ve
80
 
81
  == Changelog ==
82
 
 
 
 
83
  = 1.2.3.1 =
84
  * CSS fix
85
 
86
  = 1.2.3 =
87
  * Rsponsive feature added
88
- * Sequrity updates
89
 
90
  = 1.2.2 =
91
  * PHP notice/warning fix
3
  Donate link:
4
  Tags: easy social icon,easy social icons,social icon,social icons,social,social share,follow,followus,follow us,share,icon
5
  Requires at least: 3.5
6
+ Tested up to: 4.2.4
7
+ Stable tag: 1.2.4
8
 
9
  You can upload your own social icon, set your social URL, choose whether you want to display vertical or horizontal.
10
 
11
  == Description ==
12
 
13
+ You can upload your own social icon, set your social URL, choose whether you want to display vertical or horizontal. You can use the shortcode <strong>[cn-social-icon]</strong> in page/post, template tag for php file <strong>&lt;?php if ( function_exists('cn_social_icon') ) echo cn_social_icon(); ?&gt;</strong> also you can use the widget <strong>"Easy Social Icons"</strong> for sidebar.
14
 
15
  <strong>There is no predefined/built-in social icon added in this plugins, you have to upload your own custom social icons first.</strong>
16
 
19
 
20
  > <strong>PAID SUPPORT ($30/Hr, We ACCEPT PAYPAL )</strong>
21
  >
22
+ > We assume most of the users would find it easy to install & use this plugin but those who needs <strong><em>PAID SUPPORT</em></strong> on any of the following:
23
  >
24
  > <strong>a. Get the plugin installed </strong>
25
  >
80
 
81
  == Changelog ==
82
 
83
+ = 1.2.4 =
84
+ * Bug fix, Security updates
85
+
86
  = 1.2.3.1 =
87
  * CSS fix
88
 
89
  = 1.2.3 =
90
  * Rsponsive feature added
91
+ * Security updates
92
 
93
  = 1.2.2 =
94
  * PHP notice/warning fix