Easy Social Icons - Version 1.2.3

Version Description

  • Rsponsive feature added
  • Sequrity updates
Download this release

Release Info

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

Code changes from version 1.2.2 to 1.2.3

Files changed (4) hide show
  1. css/cnss.css +8 -30
  2. easy-social-icons.php +279 -165
  3. js/cnss.js +11 -0
  4. readme.txt +8 -3
css/cnss.css CHANGED
@@ -1,35 +1,13 @@
1
- table.cnss-social-icon tr td, table.cnss-social-icon, table.cnss-social-icon tr {
2
- padding:0 !important;
3
- margin:0 !important;
4
- border:none !important;
5
- vertical-align:middle !important;
6
- background:none !important;
7
- }
8
- table.cnss-social-icon tr td img{
9
- max-width:100% !important;
10
- /* background: transparent;
11
- -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)";
12
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
13
- zoom: 1;*/
14
- }
15
- /*table.cnss-social-icon tr td img:hover{
16
- opacity:0.5;
17
- filter:alpha(opacity=50);
18
- margin-top:-15px;
19
- }*/
20
- table.cnss-social-icon tr td a img, table.cnss-social-icon tr td a:hover img, table.cnss-social-icon tr td a img:hover{
21
- border:none !important;
22
- }
23
- table.cnss-social-icon tr td a img:hover, table.cnss-social-icon tr td a:hover img{
24
- max-width:100% !important;
25
- }
26
- /*table.cnss-social-icon tr td img{
27
- margin-right:4px;
28
- }*/
29
-
30
  #sortable { list-style-type: none; margin: 10px 0 0; padding: 0; width: 100%; }
31
  #sortable ul { margin-left:20px; list-style: none; }
32
  #sortable li { padding: 2px 0px; margin: 4px 0px; border: 1px solid #DDDDDD; cursor: move; -moz-border-radius:6px;}
33
  #sortable li span { display: block; background: #f7f7f7; padding: 5px 10px; color:#808080; font-size:13px; font-weight:bold;}
34
  #sortable li.placeholder{border: dashed 2px #ccc;background-color:#FFF;height:20px;}
35
- .clear {clear: both}
 
 
 
1
+ table.cnss-social-icon tr td, table.cnss-social-icon, table.cnss-social-icon tr {padding:0 !important;margin:0 !important;border:none !important;vertical-align:middle !important;background:none !important;}
2
+ table.cnss-social-icon tr td img{max-width:100% !important;}
3
+ table.cnss-social-icon tr td a img, table.cnss-social-icon tr td a:hover img, table.cnss-social-icon tr td a img:hover{border:none !important;}
4
+ table.cnss-social-icon tr td a img:hover, table.cnss-social-icon tr td a:hover img{max-width:100% !important;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  #sortable { list-style-type: none; margin: 10px 0 0; padding: 0; width: 100%; }
6
  #sortable ul { margin-left:20px; list-style: none; }
7
  #sortable li { padding: 2px 0px; margin: 4px 0px; border: 1px solid #DDDDDD; cursor: move; -moz-border-radius:6px;}
8
  #sortable li span { display: block; background: #f7f7f7; padding: 5px 10px; color:#808080; font-size:13px; font-weight:bold;}
9
  #sortable li.placeholder{border: dashed 2px #ccc;background-color:#FFF;height:20px;}
10
+ .clear {clear: both}
11
+ ul.cnss-social-icon{margin:0; padding:0;list-style-type:none}
12
+ ul.cnss-social-icon li a img{display:inherit!important;}
13
+ ul.cnss-social-icon li a{border:none!important;text-decoration:none!important;}
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.2
7
  Author: cybernetikz
8
  Author URI: http://www.cybernetikz.com
9
  License: GPL2
@@ -78,6 +78,7 @@ function register_cnss_settings() {
78
  register_setting( 'cnss-settings-group', 'cnss-margin' );
79
  register_setting( 'cnss-settings-group', 'cnss-row-count' );
80
  register_setting( 'cnss-settings-group', 'cnss-vertical-horizontal' );
 
81
  }
82
 
83
  function cnss_social_icon_option_fn() {
@@ -87,10 +88,20 @@ function cnss_social_icon_option_fn() {
87
  $cnss_margin = get_option('cnss-margin');
88
  $cnss_rows = get_option('cnss-row-count');
89
  $vorh = get_option('cnss-vertical-horizontal');
 
 
90
  $vertical ='';
91
  $horizontal ='';
92
  if($vorh=='vertical') $vertical = 'checked="checked"';
93
  if($vorh=='horizontal') $horizontal = 'checked="checked"';
 
 
 
 
 
 
 
 
94
  ?>
95
  <div class="wrap">
96
  <h2>Social Icon Options</h2>
@@ -110,10 +121,10 @@ function cnss_social_icon_option_fn() {
110
  <td><input type="text" name="cnss-margin" id="cnss-margin" class="small-text" value="<?php echo $cnss_margin?>" />px</td>
111
  </tr>
112
 
113
- <tr valign="top">
114
  <th scope="row">Number of Rows</th>
115
  <td><input type="text" name="cnss-row-count" id="cnss-row-count" class="small-text" value="<?php echo $cnss_rows?>" /></td>
116
- </tr>
117
 
118
  <tr valign="top">
119
  <th scope="row">Display Icon</th>
@@ -121,6 +132,14 @@ function cnss_social_icon_option_fn() {
121
  <input <?php echo $horizontal ?> type="radio" name="cnss-vertical-horizontal" id="horizontal" value="horizontal" />&nbsp;<label for="horizontal">Horizontally</label><br />
122
  <input <?php echo $vertical ?> type="radio" name="cnss-vertical-horizontal" id="vertical" value="vertical" />&nbsp;<label for="vertical">Vertically</label></td>
123
  </tr>
 
 
 
 
 
 
 
 
124
  </table>
125
 
126
  <p class="submit">
@@ -178,7 +197,7 @@ function cnss_db_install () {
178
  add_option( 'cnss-margin', '4');
179
  add_option( 'cnss-row-count', '1');
180
  add_option( 'cnss-vertical-horizontal', 'horizontal');
181
-
182
  }
183
  }
184
 
@@ -198,183 +217,234 @@ if (isset($_GET['delete'])) {
198
  {
199
  @unlink($image_file_path.$video_info[0]->image_url);
200
  }*/
201
- $delete = "DELETE FROM ".$table_name." WHERE id = ".$_GET['id']." LIMIT 1";
202
- $results = $wpdb->query( $delete );
 
 
 
203
  $msg = "Delete Successfully!!!"."<br />";
204
  }
205
 
206
  }
207
 
208
- if (isset($_POST['submit_button'])) {
209
 
210
- if ($_POST['action'] == 'update')
211
- {
 
212
 
213
- $err = "";
214
- $msg = "";
215
-
216
- //$image_file_path = "../wp-content/uploads/";
217
- $image_file_path = $baseDir;
218
-
219
- /*if ($_FILES["image_file"]["name"] != "" ){
220
 
221
- $extArr = array('jpg','png','gif','jpeg');
222
- $target_file = $image_file_path . basename($_FILES["image_file"]["name"]);
223
- $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
224
- $check = getimagesize($_FILES["image_file"]["tmp_name"]);
225
- if($check === false || !in_array($imageFileType,$extArr)) {
226
- $err .= "Invalid file type<br />";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  }
228
  else
229
  {
230
- if( $err=='' and $_FILES["image_file"]["size"] < 1024*1024*1 ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
 
232
- if ($_FILES["image_file"]["error"] > 0)
233
- {
234
- $err .= "Return Code: " . $_FILES["image_file"]["error"] . "<br />";
235
- }
236
- else
237
- {
238
- if (file_exists($image_file_path . $_FILES["image_file"]["name"]))
239
- {
240
- $err .= $_FILES["image_file"]["name"] . " already exists. ";
241
- }
242
- else
243
- {
244
- $image_file_name = time().generateRandomCode(16).'.'.$imageFileType;
245
- $fstatus = move_uploaded_file($_FILES["image_file"]["tmp_name"], $image_file_path . $image_file_name);
246
- if ($fstatus == true){
247
- $msg = "Icon upload successful !"."<br />";
248
- }
249
- }
250
- }
251
- }
 
 
252
  else
253
- {
254
- $err .= "Max file size exceded" . "<br />";
255
- }
256
  }
257
- }
258
- else
259
- {
260
- $err .= "Please input image file". "<br />";
261
- }// end if image file*/
262
 
263
- if ($err == '')
264
  {
265
- $table_name = $wpdb->prefix . "cn_social_icon";
 
266
 
267
- $insert = "INSERT INTO " . $table_name .
268
- " (title, url, image_url, sortorder, date_upload, target) " .
269
- "VALUES ('" .
270
- mysql_real_escape_string( $_POST['title']) . "','" .
271
- mysql_real_escape_string( $_POST['url']) . "','" .
272
- $_POST['image_file'] . "'," .
273
- $_POST['sortorder'] . ",'" .
274
- time() . "'," .
275
- $_POST['target'] . "" .
276
- ")";
277
- $results = $wpdb->query( $insert );
278
 
279
- if (!$results)
280
- $err .= "Fail to update database" . "<br />";
281
- else
282
- $msg .= "Update successful !" . "<br />";
283
-
284
- }
285
- }// end if update
286
-
287
- if ( $_POST['action'] == 'edit' and $_POST['id'] != '' )
288
- {
289
- $err = "";
290
- $msg = "";
291
-
292
- $url = $_POST['url'];
293
- $target = $_POST['target'];
294
-
295
- //$image_file_path = "../wp-content/uploads/";
296
- $image_file_path = $baseDir;
297
-
298
- $table_name = $wpdb->prefix . "cn_social_icon";
299
- $sql = "SELECT * FROM ".$table_name." WHERE id =".$_POST['id'];
300
- $video_info = $wpdb->get_results($sql);
301
- $image_file_name = $video_info[0]->image_url;
302
- $update = "";
303
-
304
- $type= 1;
305
- /*if ($_FILES["image_file"]["name"] != ""){
306
-
307
- $extArr = array('jpg','png','gif','jpeg');
308
- $target_file = $image_file_path . basename($_FILES["image_file"]["name"]);
309
- $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
310
- $check = getimagesize($_FILES["image_file"]["tmp_name"]);
311
- if($check === false || !in_array($imageFileType,$extArr)) {
312
- $err .= "Invalid file type<br />";
313
- }
314
- else
315
- {
316
-
317
- if( $err=='' && $_FILES["image_file"]["size"] <= 1024*1024*1 )
318
- {
319
- if ($_FILES["image_file"]["error"] > 0)
320
- {
321
- $err .= "Return Code: " . $_FILES["image_file"]["error"] . "<br />";
322
- }
323
- else
324
- {
325
- if (file_exists($image_file_path . $_FILES["image_file"]["name"]))
326
- {
327
- $err .= $_FILES["image_file"]["name"] . " already exists. ";
328
- }
329
- else
330
  {
331
- $image_file_name = time().generateRandomCode(16).'.'.$imageFileType;
332
- $fstatus = move_uploaded_file($_FILES["image_file"]["tmp_name"], $image_file_path . $image_file_name);
333
-
334
- if ($fstatus == true){
335
- $msg = "File Uploaded Successfully!!!".'<br />';
336
- @unlink($image_file_path.$video_info[0]->image_url);
337
- $update = "UPDATE " . $table_name . " SET " .
338
- "image_url='" .$image_file_name . "'" .
339
- " WHERE id=" . $_POST['id'];
340
- $results1 = $wpdb->query( $update );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  }
342
  }
 
 
 
343
  }
344
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  else
346
  {
347
- $err .= "Invalid file type or max file size exceded";
348
  }
349
  }
350
- }*/
351
-
352
- $update = "UPDATE " . $table_name . " SET " .
353
- "title='" .mysql_real_escape_string( $_POST['title']) . "'," .
354
- "url='" . $url . "'," .
355
- "image_url='" . $_POST['image_file'] . "'," .
356
- "sortorder=" .$_POST['sortorder'] . "," .
357
- "date_upload='" .time(). "'," .
358
- "target=$target " .
359
- " WHERE id=" . $_POST['id'];
360
- if ($err == '')
361
- {
362
- $table_name = $wpdb->prefix . "cn_social_icon";
363
- $results3 = $wpdb->query( $update );
364
 
365
- if (!$results3){
366
- $err .= "Update fails !". "<br />";
367
- }
368
- else
369
- {
370
- $msg = "Update successful !". "<br />";
371
- }
372
- }
373
 
374
- } // end edit
375
-
376
- }
377
-
378
 
379
  function cnss_social_icon_sort_fn() {
380
  global $wpdb,$baseURL;
@@ -475,15 +545,14 @@ function cnss_save_ajax_order()
475
  function cnss_social_icon_add_fn() {
476
 
477
  global $err,$msg,$baseURL;
 
 
 
 
478
 
479
  if (isset($_GET['mode'])) {
480
  if ( $_GET['mode'] != '' and $_GET['mode'] == 'edit' and $_GET['id'] != '' )
481
  {
482
-
483
- $cnss_width = get_option('cnss-width');
484
- $cnss_height = get_option('cnss-height');
485
- //$cnss_margin = get_option('cnss-margin');
486
-
487
  $page_title = 'Edit Icon';
488
  $uptxt = 'Icon';
489
 
@@ -512,15 +581,14 @@ function cnss_social_icon_add_fn() {
512
  }
513
  else
514
  {
515
-
516
  $page_title = 'Add New Icon';
517
  $title = "";
518
  $url = "";
519
  $image_url = "";
 
520
  $sortorder = "0";
521
  $target = "";
522
  $uptxt = 'Icon';
523
-
524
  }
525
  ?>
526
  <div class="wrap">
@@ -530,8 +598,8 @@ if($err!='') echo '<div id="message" class="error fade">'.$err.'</div>';
530
  ?>
531
  <h2><?php echo $page_title;?></h2>
532
 
533
- <form method="post" enctype="multipart/form-data" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
534
-
535
  <table class="form-table">
536
  <tr valign="top">
537
  <th scope="row">Title</th>
@@ -547,7 +615,7 @@ if($err!='') echo '<div id="message" class="error fade">'.$err.'</div>';
547
  <!--<input type="file" name="image_file" id="image_file" value="" />-->
548
  <input style="vertical-align:top" type="text" name="image_file" id="image_file" class="regular-text" value="<?php echo $image_url ?>" />
549
  <input style="vertical-align:top" id="logo_image_button" class="button" type="button" value="Choose Icon" />
550
- <img style="vertical-align:top" id="logoimg" src="<?php echo $image_url ?>" border="0" width="<?php echo $cnss_width ?>" height="<?php echo $cnss_height ?>" alt="<?php echo $title?>" /><br />
551
  </td>
552
  </tr>
553
 
@@ -669,7 +737,7 @@ function cnss_social_icon_page_fn() {
669
  <a href="?page=cnss_social_icon_add&mode=edit&id=<?php echo $vdoinfo->id;?>"><strong>Edit</strong></a>
670
  </td>
671
  <td>
672
- <a onclick="show_confirm('<?php echo $vdoinfo->title?>','<?php echo $vdoinfo->id;?>');" href="#delete"><strong>Delete</strong></a>
673
  </td>
674
 
675
  </tr>
@@ -691,7 +759,7 @@ function cnss_social_icon_page_fn() {
691
  <?php
692
  }
693
 
694
- function cn_social_icon() {
695
 
696
  $cnss_width = get_option('cnss-width');
697
  $cnss_height = get_option('cnss-height');
@@ -745,6 +813,52 @@ function cn_social_icon() {
745
  return $out;
746
  }
747
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
748
  class Cnss_Widget extends WP_Widget {
749
 
750
  public function __construct() {
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
7
  Author: cybernetikz
8
  Author URI: http://www.cybernetikz.com
9
  License: GPL2
78
  register_setting( 'cnss-settings-group', 'cnss-margin' );
79
  register_setting( 'cnss-settings-group', 'cnss-row-count' );
80
  register_setting( 'cnss-settings-group', 'cnss-vertical-horizontal' );
81
+ register_setting( 'cnss-settings-group', 'cnss-text-align' );
82
  }
83
 
84
  function cnss_social_icon_option_fn() {
88
  $cnss_margin = get_option('cnss-margin');
89
  $cnss_rows = get_option('cnss-row-count');
90
  $vorh = get_option('cnss-vertical-horizontal');
91
+ $text_align = get_option('cnss-text-align');
92
+
93
  $vertical ='';
94
  $horizontal ='';
95
  if($vorh=='vertical') $vertical = 'checked="checked"';
96
  if($vorh=='horizontal') $horizontal = 'checked="checked"';
97
+
98
+ $center ='';
99
+ $left ='';
100
+ $right ='';
101
+ if($text_align=='center') $center = 'checked="checked"';
102
+ if($text_align=='left') $left = 'checked="checked"';
103
+ if($text_align=='right') $right = 'checked="checked"';
104
+
105
  ?>
106
  <div class="wrap">
107
  <h2>Social Icon Options</h2>
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>
132
  <input <?php echo $horizontal ?> type="radio" name="cnss-vertical-horizontal" id="horizontal" value="horizontal" />&nbsp;<label for="horizontal">Horizontally</label><br />
133
  <input <?php echo $vertical ?> type="radio" name="cnss-vertical-horizontal" id="vertical" value="vertical" />&nbsp;<label for="vertical">Vertically</label></td>
134
  </tr>
135
+
136
+ <tr valign="top">
137
+ <th scope="row">Icon Alignment</th>
138
+ <td>
139
+ <input <?php echo $center ?> type="radio" name="cnss-text-align" id="center" value="center" />&nbsp;<label for="center">Center</label><br />
140
+ <input <?php echo $left ?> type="radio" name="cnss-text-align" id="left" value="left" />&nbsp;<label for="left">Left</label><br />
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">
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
 
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') ) {
235
 
236
+ if ($_POST['action'] == 'update')
237
+ {
 
 
 
 
 
238
 
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,
307
+ array(
308
+ 'title' => sanitize_text_field($_POST['title']),
309
+ 'url' => sanitize_text_field($_POST['url']),
310
+ 'image_url' => sanitize_text_field($_POST['image_file']),
311
+ 'sortorder' => sanitize_text_field($_POST['sortorder']),
312
+ 'date_upload' => time(),
313
+ 'target' => sanitize_text_field($_POST['target']),
314
+ ),
315
+ array(
316
+ '%s',
317
+ '%s',
318
+ '%s',
319
+ '%d',
320
+ '%s',
321
+ '%d',
322
+ )
323
+ );
324
+
325
+ if (!$results)
326
+ $err .= "Fail to update database" . "<br />";
327
  else
328
+ $msg .= "Update successful !" . "<br />";
329
+
 
330
  }
331
+ }// end if update
 
 
 
 
332
 
333
+ if ( $_POST['action'] == 'edit' and $_POST['id'] != '' )
334
  {
335
+ $err = "";
336
+ $msg = "";
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(
416
+ 'title' => sanitize_text_field($_POST['title']),
417
+ 'url' => sanitize_text_field($_POST['url']),
418
+ 'image_url' => sanitize_text_field($_POST['image_file']),
419
+ 'sortorder' => sanitize_text_field($_POST['sortorder']),
420
+ 'date_upload' => time(),
421
+ 'target' => sanitize_text_field($_POST['target']),
422
+ ),
423
+ array( 'id' => sanitize_text_field($_POST['id']) ),
424
+ array(
425
+ '%s',
426
+ '%s',
427
+ '%s',
428
+ '%d',
429
+ '%s',
430
+ '%d',
431
+ ),
432
+ array( '%d' )
433
+ );
434
+
435
+ if (false === $result3){
436
+ $err .= "Update fails !". "<br />";
437
+ }
438
  else
439
  {
440
+ $msg = "Update successful !". "<br />";
441
  }
442
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
 
444
+ } // end edit
 
 
 
 
 
 
 
445
 
446
+ }
447
+ }//cn_process_post end
 
 
448
 
449
  function cnss_social_icon_sort_fn() {
450
  global $wpdb,$baseURL;
545
  function cnss_social_icon_add_fn() {
546
 
547
  global $err,$msg,$baseURL;
548
+
549
+ $cnss_width = get_option('cnss-width');
550
+ $cnss_height = get_option('cnss-height');
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
 
581
  }
582
  else
583
  {
 
584
  $page_title = 'Add New Icon';
585
  $title = "";
586
  $url = "";
587
  $image_url = "";
588
+ $blank_img = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
589
  $sortorder = "0";
590
  $target = "";
591
  $uptxt = 'Icon';
 
592
  }
593
  ?>
594
  <div class="wrap">
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">
605
  <th scope="row">Title</th>
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
 
737
  <a href="?page=cnss_social_icon_add&mode=edit&id=<?php echo $vdoinfo->id;?>"><strong>Edit</strong></a>
738
  </td>
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>
759
  <?php
760
  }
761
 
762
+ function cn_social_icon_table() {
763
 
764
  $cnss_width = get_option('cnss-width');
765
  $cnss_height = get_option('cnss-height');
813
  return $out;
814
  }
815
 
816
+ function format_title($str) {
817
+ $pattern = '/[^a-zA-Z0-9]/';
818
+ return preg_replace($pattern,'-',$str);
819
+ }
820
+
821
+ function cn_social_icon() {
822
+
823
+ $cnss_width = get_option('cnss-width');
824
+ $cnss_height = get_option('cnss-height');
825
+ $cnss_margin = get_option('cnss-margin');
826
+ $cnss_rows = get_option('cnss-row-count');
827
+ $vorh = get_option('cnss-vertical-horizontal');
828
+ $text_align = get_option('cnss-text-align');
829
+
830
+ global $wpdb,$baseURL;
831
+ $table_name = $wpdb->prefix . "cn_social_icon";
832
+ $image_file_path = $baseURL;
833
+ $sql = "SELECT * FROM ".$table_name." WHERE image_url<>'' AND url<>'' ORDER BY sortorder";
834
+ $video_info = $wpdb->get_results($sql);
835
+ $icon_count = count($video_info);
836
+
837
+ $_collectionSize = count($video_info);
838
+ $_rowCount = $cnss_rows ? $cnss_rows : 1;
839
+ $_columnCount = ceil($_collectionSize/$_rowCount);
840
+ $li_margin = round($cnss_margin/2);
841
+
842
+ ob_start();
843
+ echo '<ul class="cnss-social-icon" style="text-align:'.$text_align.';">';
844
+ $i=0;
845
+ foreach($video_info as $icon)
846
+ {
847
+
848
+ if(strpos($icon->image_url,'/')===false)
849
+ $image_url = $image_file_path.'/'.$icon->image_url;
850
+ else
851
+ $image_url = $icon->image_url;
852
+
853
+ ?><li class="<?php echo format_title($icon->title); ?>" style=" <?php echo $vorh=='horizontal'?'display:inline;':''; ?>"><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 ?>" style=" <?php echo 'margin:'.$li_margin.'px;'; ?>" /></a></li><?php
854
+ $i++;
855
+ }
856
+ echo '</ul>';
857
+ $out = ob_get_contents();
858
+ ob_end_clean();
859
+ return $out;
860
+ }
861
+
862
  class Cnss_Widget extends WP_Widget {
863
 
864
  public function __construct() {
js/cnss.js CHANGED
@@ -11,4 +11,15 @@ jQuery(document).ready(function($) {
11
  //marginTop:'0px'
12
  }, 200 );
13
  });
 
 
 
 
 
 
 
 
 
 
 
14
  });
11
  //marginTop:'0px'
12
  }, 200 );
13
  });
14
+
15
+ jQuery('ul.cnss-social-icon li img').hover(function() {
16
+ jQuery(this).animate({
17
+ opacity: 0.5
18
+ }, 200 );
19
+ },
20
+ function() {
21
+ jQuery(this).animate({
22
+ opacity: 1
23
+ }, 200 );
24
+ });
25
  });
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.1
7
- Stable tag: 1.2.2
8
 
9
  You can upload your own social icon, set your social URL, choose weather you want to display vertical or horizontal.
10
 
@@ -36,15 +36,16 @@ If you are using <strong>wordpress version lower than 3.5</strong> please use "E
36
  = Key Feature =
37
 
38
  * You can upload your own social icons, set URL for that icon with sort order, target window etc.
 
39
  * You will get the add/edit/delete option for icons
40
  * You can set the icon width and height to fit in your template/design perfectly
41
  * You can display your social share icon vertically or horizontally to match perfectly with your template/design.
42
  * You can put your social icon set in the sidebar using the widget
43
  * You can insert your social icon set in pages/posts using short code
44
  * Sort social media icons using drag drop
45
- * You can display the icons split by rows, input the number of rows in the plugins admin option page
46
  * Also if you are familiar with php code then you can use the template tag to place the social icon set anywhere in the php template file
47
- * Built in 5 social icons preloaded as sample icon, to save your time (facebook, twitter, linkedin, flickr, youtube).
 
48
 
49
  Please visit our site <a target="_blank" href="http://www.cybernetikz.com/blog/wordpress-plugins-easy-social-icons/">www.cybernetikz.com/</a>
50
 
@@ -80,6 +81,10 @@ If you are using wordpress version lower than 3.5 please use Easy social Icon ve
80
 
81
  == Changelog ==
82
 
 
 
 
 
83
  = 1.2.2 =
84
  * PHP notice/warning fix
85
 
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.1
7
+ Stable tag: 1.2.3
8
 
9
  You can upload your own social icon, set your social URL, choose weather you want to display vertical or horizontal.
10
 
36
  = Key Feature =
37
 
38
  * You can upload your own social icons, set URL for that icon with sort order, target window etc.
39
+ * Work with responsive website
40
  * You will get the add/edit/delete option for icons
41
  * You can set the icon width and height to fit in your template/design perfectly
42
  * You can display your social share icon vertically or horizontally to match perfectly with your template/design.
43
  * You can put your social icon set in the sidebar using the widget
44
  * You can insert your social icon set in pages/posts using short code
45
  * Sort social media icons using drag drop
 
46
  * Also if you are familiar with php code then you can use the template tag to place the social icon set anywhere in the php template file
47
+ * Responsive feature added, so <span style="text-decoration: line-through;">You can display the icons split by rows, input the number of rows in the plugins admin option page</span> removed
48
+ * <span style="text-decoration: line-through;">Built in 5 social icons preloaded as sample icon, to save your time (facebook, twitter, linkedin, flickr, youtube).</span>
49
 
50
  Please visit our site <a target="_blank" href="http://www.cybernetikz.com/blog/wordpress-plugins-easy-social-icons/">www.cybernetikz.com/</a>
51
 
81
 
82
  == Changelog ==
83
 
84
+ = 1.2.3 =
85
+ * Rsponsive feature added
86
+ * Sequrity updates
87
+
88
  = 1.2.2 =
89
  * PHP notice/warning fix
90