Easy Social Icons - Version 1.1

Version Description

  • icon upload folder fix
Download this release

Release Info

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

Code changes from version 1.0 to 1.1

Files changed (2) hide show
  1. easy-social-icons.php +27 -23
  2. readme.txt +5 -2
easy-social-icons.php CHANGED
@@ -3,13 +3,18 @@
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.0
7
  Author: cybernetikz
8
  Author URI: http://www.cybernetikz.com
9
  License: GPL2
10
  */
11
 
 
 
 
 
12
  $pluginsURI = plugins_url('/easy-social-icons/');
 
13
  function cnss_my_script() {
14
  global $pluginsURI;
15
  wp_enqueue_script( 'jquery' );
@@ -98,7 +103,6 @@ function cnss_social_icon_option_fn() {
98
  <?php
99
  }
100
 
101
-
102
  function cnss_db_install () {
103
  global $wpdb;
104
  global $cnss_db_version;
@@ -154,7 +158,7 @@ if (isset($_GET['delete'])) {
154
  {
155
 
156
  $table_name = $wpdb->prefix . "cn_social_icon";
157
- $image_file_path = "../wp-content/uploads/";
158
  $sql = "SELECT * FROM ".$table_name." WHERE id =".$_REQUEST['id'];
159
  $video_info = $wpdb->get_results($sql);
160
 
@@ -169,7 +173,6 @@ if (isset($_GET['delete'])) {
169
 
170
  }
171
 
172
-
173
  if (isset($_POST['submit_button'])) {
174
 
175
  if ($_POST['action'] == 'update')
@@ -178,7 +181,8 @@ if (isset($_POST['submit_button'])) {
178
  $err = "";
179
  $msg = "";
180
 
181
- $image_file_path = "../wp-content/uploads/";
 
182
 
183
  if ($_FILES["image_file"]["name"] != "" ){
184
 
@@ -204,7 +208,7 @@ if (isset($_POST['submit_button'])) {
204
  $image_file_name = time().'_'.$_FILES["image_file"]["name"];
205
  $fstatus = move_uploaded_file($_FILES["image_file"]["tmp_name"], $image_file_path . $image_file_name);
206
  if ($fstatus == true){
207
- $msg = "File Uploaded Successfully!!!"."<br />";
208
  }
209
  }
210
  }
@@ -238,7 +242,7 @@ if (isset($_POST['submit_button'])) {
238
  if (!$results)
239
  $err .= "Fail to update database" . "<br />";
240
  else
241
- $msg .= "Update Successfull!!!" . "<br />";
242
 
243
  }
244
  }// end if update
@@ -251,7 +255,9 @@ if (isset($_POST['submit_button'])) {
251
  $url = $_REQUEST['url'];
252
  $target = $_REQUEST['target'];
253
 
254
- $image_file_path = "../wp-content/uploads/";
 
 
255
  $table_name = $wpdb->prefix . "cn_social_icon";
256
  $sql = "SELECT * FROM ".$table_name." WHERE id =".$_REQUEST['id'];
257
  $video_info = $wpdb->get_results($sql);
@@ -308,11 +314,11 @@ if (isset($_POST['submit_button'])) {
308
  $results3 = $wpdb->query( $update );
309
 
310
  if (!$results3){
311
- $err .= "Update Fail!!!". "<br />";
312
  }
313
  else
314
  {
315
- $msg = "Update Successfull!!!". "<br />";
316
  }
317
  }
318
 
@@ -322,12 +328,12 @@ if (isset($_POST['submit_button'])) {
322
 
323
 
324
  function cnss_social_icon_sort_fn() {
325
- global $wpdb;
326
 
327
  $cnss_width = get_option('cnss-width');
328
  $cnss_height = get_option('cnss-height');
329
 
330
- $image_file_path = "../wp-content/uploads/";
331
  $table_name = $wpdb->prefix . "cn_social_icon";
332
  $sql = "SELECT * FROM ".$table_name." WHERE 1 ORDER BY sortorder";
333
  $video_info = $wpdb->get_results($sql);
@@ -412,7 +418,7 @@ function cnss_save_ajax_order()
412
 
413
  function cnss_social_icon_add_fn() {
414
 
415
- global $err,$msg;
416
 
417
  if (isset($_GET['mode'])) {
418
  if ( $_REQUEST['mode'] != '' and $_REQUEST['mode'] == 'edit' and $_REQUEST['id'] != '' )
@@ -422,13 +428,12 @@ function cnss_social_icon_add_fn() {
422
  $cnss_height = get_option('cnss-height');
423
  //$cnss_margin = get_option('cnss-margin');
424
 
425
-
426
  $page_title = 'Edit Icon';
427
  $uptxt = 'Upload Icon';
428
 
429
  global $wpdb;
430
  $table_name = $wpdb->prefix . "cn_social_icon";
431
- $image_file_path = "../wp-content/uploads/";
432
  $sql = "SELECT * FROM ".$table_name." WHERE id =".$_REQUEST['id'];
433
  $video_info = $wpdb->get_results($sql);
434
 
@@ -458,10 +463,9 @@ function cnss_social_icon_add_fn() {
458
  ?>
459
  <div class="wrap">
460
  <?php
461
- if($msg!='' or $err!='')
462
- echo '<div id="message" class="updated fade">'. $msg.$err.'</div>';
463
  ?>
464
-
465
  <h2><?php echo $page_title;?></h2>
466
 
467
  <form method="post" enctype="multipart/form-data" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
@@ -529,12 +533,12 @@ if($msg!='' or $err!='')
529
 
530
  function cnss_social_icon_page_fn() {
531
 
532
- global $wpdb;
533
 
534
  $cnss_width = get_option('cnss-width');
535
  $cnss_height = get_option('cnss-height');
536
 
537
- $image_file_path = "../wp-content/uploads/";
538
  $table_name = $wpdb->prefix . "cn_social_icon";
539
  $sql = "SELECT * FROM ".$table_name." WHERE 1 ORDER BY sortorder";
540
  $video_info = $wpdb->get_results($sql);
@@ -625,10 +629,10 @@ function cn_social_icon() {
625
  $cnss_rows = get_option('cnss-row-count');
626
  $vorh = get_option('cnss-vertical-horizontal');
627
 
628
- $upload_dir = wp_upload_dir();
629
- global $wpdb;
630
  $table_name = $wpdb->prefix . "cn_social_icon";
631
- $image_file_path = $upload_dir['baseurl'];
632
  $sql = "SELECT * FROM ".$table_name." WHERE image_url<>'' AND url<>'' ORDER BY sortorder";
633
  $video_info = $wpdb->get_results($sql);
634
  $icon_count = count($video_info);
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.1
7
  Author: cybernetikz
8
  Author URI: http://www.cybernetikz.com
9
  License: GPL2
10
  */
11
 
12
+ $upload_dir = wp_upload_dir();
13
+ //print_r($upload_dir);
14
+ $baseDir = $upload_dir['basedir'].'/';
15
+ $baseURL = $upload_dir['baseurl'].'/';
16
  $pluginsURI = plugins_url('/easy-social-icons/');
17
+
18
  function cnss_my_script() {
19
  global $pluginsURI;
20
  wp_enqueue_script( 'jquery' );
103
  <?php
104
  }
105
 
 
106
  function cnss_db_install () {
107
  global $wpdb;
108
  global $cnss_db_version;
158
  {
159
 
160
  $table_name = $wpdb->prefix . "cn_social_icon";
161
+ $image_file_path = $baseDir; //"../wp-content/uploads/";
162
  $sql = "SELECT * FROM ".$table_name." WHERE id =".$_REQUEST['id'];
163
  $video_info = $wpdb->get_results($sql);
164
 
173
 
174
  }
175
 
 
176
  if (isset($_POST['submit_button'])) {
177
 
178
  if ($_POST['action'] == 'update')
181
  $err = "";
182
  $msg = "";
183
 
184
+ //$image_file_path = "../wp-content/uploads/";
185
+ $image_file_path = $baseDir;
186
 
187
  if ($_FILES["image_file"]["name"] != "" ){
188
 
208
  $image_file_name = time().'_'.$_FILES["image_file"]["name"];
209
  $fstatus = move_uploaded_file($_FILES["image_file"]["tmp_name"], $image_file_path . $image_file_name);
210
  if ($fstatus == true){
211
+ $msg = "Icon upload successfully !"."<br />";
212
  }
213
  }
214
  }
242
  if (!$results)
243
  $err .= "Fail to update database" . "<br />";
244
  else
245
+ $msg .= "Update successful !" . "<br />";
246
 
247
  }
248
  }// end if update
255
  $url = $_REQUEST['url'];
256
  $target = $_REQUEST['target'];
257
 
258
+ //$image_file_path = "../wp-content/uploads/";
259
+ $image_file_path = $baseDir;
260
+
261
  $table_name = $wpdb->prefix . "cn_social_icon";
262
  $sql = "SELECT * FROM ".$table_name." WHERE id =".$_REQUEST['id'];
263
  $video_info = $wpdb->get_results($sql);
314
  $results3 = $wpdb->query( $update );
315
 
316
  if (!$results3){
317
+ $err .= "Update fails !". "<br />";
318
  }
319
  else
320
  {
321
+ $msg = "Update successful !". "<br />";
322
  }
323
  }
324
 
328
 
329
 
330
  function cnss_social_icon_sort_fn() {
331
+ global $wpdb,$baseURL;
332
 
333
  $cnss_width = get_option('cnss-width');
334
  $cnss_height = get_option('cnss-height');
335
 
336
+ $image_file_path = $baseURL; //"../wp-content/uploads/";
337
  $table_name = $wpdb->prefix . "cn_social_icon";
338
  $sql = "SELECT * FROM ".$table_name." WHERE 1 ORDER BY sortorder";
339
  $video_info = $wpdb->get_results($sql);
418
 
419
  function cnss_social_icon_add_fn() {
420
 
421
+ global $err,$msg,$baseURL;
422
 
423
  if (isset($_GET['mode'])) {
424
  if ( $_REQUEST['mode'] != '' and $_REQUEST['mode'] == 'edit' and $_REQUEST['id'] != '' )
428
  $cnss_height = get_option('cnss-height');
429
  //$cnss_margin = get_option('cnss-margin');
430
 
 
431
  $page_title = 'Edit Icon';
432
  $uptxt = 'Upload Icon';
433
 
434
  global $wpdb;
435
  $table_name = $wpdb->prefix . "cn_social_icon";
436
+ $image_file_path = $baseURL; //"../wp-content/uploads/";
437
  $sql = "SELECT * FROM ".$table_name." WHERE id =".$_REQUEST['id'];
438
  $video_info = $wpdb->get_results($sql);
439
 
463
  ?>
464
  <div class="wrap">
465
  <?php
466
+ if($msg!='') echo '<div id="message" class="updated fade">'.$msg.'</div>';
467
+ if($err!='') echo '<div id="message" class="error fade">'.$err.'</div>';
468
  ?>
 
469
  <h2><?php echo $page_title;?></h2>
470
 
471
  <form method="post" enctype="multipart/form-data" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
533
 
534
  function cnss_social_icon_page_fn() {
535
 
536
+ global $wpdb,$baseURL;
537
 
538
  $cnss_width = get_option('cnss-width');
539
  $cnss_height = get_option('cnss-height');
540
 
541
+ $image_file_path = $baseURL; //"../wp-content/uploads/";
542
  $table_name = $wpdb->prefix . "cn_social_icon";
543
  $sql = "SELECT * FROM ".$table_name." WHERE 1 ORDER BY sortorder";
544
  $video_info = $wpdb->get_results($sql);
629
  $cnss_rows = get_option('cnss-row-count');
630
  $vorh = get_option('cnss-vertical-horizontal');
631
 
632
+ //$upload_dir = wp_upload_dir();
633
+ global $wpdb,$baseURL;
634
  $table_name = $wpdb->prefix . "cn_social_icon";
635
+ $image_file_path = $baseURL; //$upload_dir['baseurl'];
636
  $sql = "SELECT * FROM ".$table_name." WHERE image_url<>'' AND url<>'' ORDER BY sortorder";
637
  $video_info = $wpdb->get_results($sql);
638
  $icon_count = count($video_info);
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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: 2.8.6
6
- Tested up to: 3.9.1
7
- Stable tag: 1.0
8
 
9
  You can upload your own social icon, set your social URL, choose weather you want to display vertical or horizontal.
10
 
@@ -71,6 +71,9 @@ Also you can use the widget for the sidebar.
71
 
72
  == Changelog ==
73
 
 
 
 
74
  = 1.0 =
75
  * Add sorting icon using drag drop
76
  * Built in 5 social icons preloaded as sample icon, to save your time (facebook, twitter, linkedin, flickr, youtube).
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: 2.8.6
6
+ Tested up to: 4.0
7
+ Stable tag: 1.1
8
 
9
  You can upload your own social icon, set your social URL, choose weather you want to display vertical or horizontal.
10
 
71
 
72
  == Changelog ==
73
 
74
+ = 1.1 =
75
+ * icon upload folder fix
76
+
77
  = 1.0 =
78
  * Add sorting icon using drag drop
79
  * Built in 5 social icons preloaded as sample icon, to save your time (facebook, twitter, linkedin, flickr, youtube).