Version Description
- Integrate WordPress default media uploader
- Some security updates
- Remove preloaded sample icon as icon upload method change
Download this release
Release Info
Developer | cybernetikz |
Plugin | Easy Social Icons |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.2
- css/index.php +0 -0
- easy-social-icons.php +173 -89
- images/icon/index.php +0 -0
- images/index.php +0 -0
- index.php +0 -0
- js/cnss.js +1 -1
- js/cnss_admin.js +34 -0
- js/index.php +0 -0
- readme.txt +17 -3
css/index.php
ADDED
File without changes
|
easy-social-icons.php
CHANGED
@@ -3,21 +3,45 @@
|
|
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><?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.
|
6 |
-
Version: 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' );
|
21 |
wp_enqueue_script('jquery-ui-sortable');
|
22 |
wp_register_script('cnss_js', $pluginsURI . 'js/cnss.js', array(), '1.0' );
|
23 |
wp_enqueue_script( 'cnss_js' );
|
@@ -25,7 +49,20 @@ function cnss_my_script() {
|
|
25 |
wp_register_style('cnss_css', $pluginsURI . 'css/cnss.css', array(), '1.0' );
|
26 |
wp_enqueue_style( 'cnss_css' );
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
add_action('init', 'cnss_my_script');
|
|
|
29 |
add_action('wp_ajax_update-social-icon-order', 'cnss_save_ajax_order' );
|
30 |
add_action('admin_menu', 'cnss_add_menu_pages');
|
31 |
|
@@ -107,8 +144,9 @@ function cnss_db_install () {
|
|
107 |
global $wpdb;
|
108 |
global $cnss_db_version;
|
109 |
|
110 |
-
$srcdir = ABSPATH.'wp-content/plugins/easy-social-icons/images/icon/';
|
111 |
$upload_dir = wp_upload_dir();
|
|
|
|
|
112 |
$targetdir = $upload_dir['basedir'].'/';
|
113 |
|
114 |
$files = scandir($srcdir);
|
@@ -117,12 +155,12 @@ function cnss_db_install () {
|
|
117 |
if($fname=='.')continue;
|
118 |
if($fname=='..')continue;
|
119 |
copy($srcdir.$fname, $targetdir.$fname);
|
120 |
-
}
|
121 |
|
122 |
$table_name = $wpdb->prefix . "cn_social_icon";
|
123 |
if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
|
124 |
|
125 |
-
$sql2 = "CREATE TABLE
|
126 |
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
|
127 |
`title` VARCHAR(255) NULL,
|
128 |
`url` VARCHAR(255) NOT NULL,
|
@@ -130,14 +168,17 @@ function cnss_db_install () {
|
|
130 |
`sortorder` INT NOT NULL DEFAULT '0',
|
131 |
`date_upload` VARCHAR(100) NULL,
|
132 |
`target` tinyint(1) NOT NULL DEFAULT '1',
|
133 |
-
PRIMARY KEY (`id`)) ENGINE = InnoDB;
|
134 |
-
|
135 |
-
|
136 |
-
(
|
137 |
-
(
|
138 |
-
(
|
139 |
-
(
|
140 |
-
|
|
|
|
|
|
|
141 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
142 |
dbDelta($sql2);
|
143 |
|
@@ -154,19 +195,19 @@ register_activation_hook(__FILE__,'cnss_db_install');
|
|
154 |
|
155 |
if (isset($_GET['delete'])) {
|
156 |
|
157 |
-
if ($
|
158 |
{
|
159 |
|
160 |
$table_name = $wpdb->prefix . "cn_social_icon";
|
161 |
$image_file_path = $baseDir; //"../wp-content/uploads/";
|
162 |
-
|
163 |
$video_info = $wpdb->get_results($sql);
|
164 |
|
165 |
if (!empty($video_info))
|
166 |
{
|
167 |
@unlink($image_file_path.$video_info[0]->image_url);
|
168 |
-
}
|
169 |
-
$delete = "DELETE FROM ".$table_name." WHERE id = ".$
|
170 |
$results = $wpdb->query( $delete );
|
171 |
$msg = "Delete Successfully!!!"."<br />";
|
172 |
}
|
@@ -184,15 +225,19 @@ if (isset($_POST['submit_button'])) {
|
|
184 |
//$image_file_path = "../wp-content/uploads/";
|
185 |
$image_file_path = $baseDir;
|
186 |
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
|
|
|
|
|
|
|
|
196 |
if ($_FILES["image_file"]["error"] > 0)
|
197 |
{
|
198 |
$err .= "Return Code: " . $_FILES["image_file"]["error"] . "<br />";
|
@@ -205,23 +250,24 @@ if (isset($_POST['submit_button'])) {
|
|
205 |
}
|
206 |
else
|
207 |
{
|
208 |
-
$image_file_name = time().'
|
209 |
$fstatus = move_uploaded_file($_FILES["image_file"]["tmp_name"], $image_file_path . $image_file_name);
|
210 |
if ($fstatus == true){
|
211 |
-
$msg = "Icon upload
|
212 |
}
|
213 |
}
|
214 |
}
|
215 |
}
|
216 |
else
|
217 |
{
|
218 |
-
$err .= "
|
219 |
}
|
220 |
}
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
225 |
|
226 |
if ($err == '')
|
227 |
{
|
@@ -230,12 +276,12 @@ if (isset($_POST['submit_button'])) {
|
|
230 |
$insert = "INSERT INTO " . $table_name .
|
231 |
" (title, url, image_url, sortorder, date_upload, target) " .
|
232 |
"VALUES ('" .
|
233 |
-
$wpdb->escape( $
|
234 |
-
$wpdb->escape( $
|
235 |
-
$
|
236 |
-
$
|
237 |
time() . "'," .
|
238 |
-
$
|
239 |
")";
|
240 |
$results = $wpdb->query( $insert );
|
241 |
|
@@ -247,63 +293,75 @@ if (isset($_POST['submit_button'])) {
|
|
247 |
}
|
248 |
}// end if update
|
249 |
|
250 |
-
if ( $
|
251 |
{
|
252 |
$err = "";
|
253 |
$msg = "";
|
254 |
|
255 |
-
$url = $
|
256 |
-
$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 =".$
|
263 |
$video_info = $wpdb->get_results($sql);
|
264 |
$image_file_name = $video_info[0]->image_url;
|
265 |
$update = "";
|
266 |
|
267 |
-
$imgExtArray = array('image/gif','image/jpeg','image/pjpeg','image/png');
|
268 |
$type= 1;
|
269 |
-
if ($_FILES["image_file"]["name"] != ""){
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
else
|
283 |
{
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
295 |
}
|
|
|
|
|
|
|
296 |
}
|
297 |
-
}
|
298 |
-
else
|
299 |
-
{
|
300 |
-
$err .= "Invalid file type or max file size exceded";
|
301 |
}
|
302 |
-
}
|
303 |
|
304 |
$update = "UPDATE " . $table_name . " SET " .
|
305 |
"title='" .$wpdb->escape( $_POST['title']) . "'," .
|
306 |
"url='" . $url . "'," .
|
|
|
307 |
"sortorder=" .$_POST['sortorder'] . "," .
|
308 |
"date_upload='" .time(). "'," .
|
309 |
"target=$target " .
|
@@ -352,11 +410,18 @@ function cnss_social_icon_sort_fn() {
|
|
352 |
|
353 |
<div id="order-post-type">
|
354 |
<ul id="sortable">
|
355 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
<li id="item_<?php echo $vdoinfo->id ?>">
|
357 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
358 |
<tr style="background:#f7f7f7">
|
359 |
-
<td width="60"> <img src="<?php echo $
|
360 |
<td><span><?php echo $vdoinfo->title;?></span></td>
|
361 |
</tr>
|
362 |
</table>
|
@@ -421,7 +486,7 @@ function cnss_social_icon_add_fn() {
|
|
421 |
global $err,$msg,$baseURL;
|
422 |
|
423 |
if (isset($_GET['mode'])) {
|
424 |
-
if ( $
|
425 |
{
|
426 |
|
427 |
$cnss_width = get_option('cnss-width');
|
@@ -429,12 +494,12 @@ function cnss_social_icon_add_fn() {
|
|
429 |
//$cnss_margin = get_option('cnss-margin');
|
430 |
|
431 |
$page_title = 'Edit Icon';
|
432 |
-
$uptxt = '
|
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 =".$
|
438 |
$video_info = $wpdb->get_results($sql);
|
439 |
|
440 |
if (!empty($video_info))
|
@@ -442,9 +507,15 @@ function cnss_social_icon_add_fn() {
|
|
442 |
$id = $video_info[0]->id;
|
443 |
$title = $video_info[0]->title;
|
444 |
$url = $video_info[0]->url;
|
445 |
-
$image_url = $
|
446 |
$sortorder = $video_info[0]->sortorder;
|
447 |
$target = $video_info[0]->target;
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
}
|
449 |
}
|
450 |
}
|
@@ -457,7 +528,7 @@ function cnss_social_icon_add_fn() {
|
|
457 |
$image_url = "";
|
458 |
$sortorder = "0";
|
459 |
$target = "";
|
460 |
-
$uptxt = '
|
461 |
|
462 |
}
|
463 |
?>
|
@@ -472,7 +543,7 @@ if($err!='') echo '<div id="message" class="error fade">'.$err.'</div>';
|
|
472 |
|
473 |
<table class="form-table">
|
474 |
<tr valign="top">
|
475 |
-
<th scope="row">
|
476 |
<td>
|
477 |
<input type="text" name="title" id="title" class="regular-text" value="<?php echo $title?>" />
|
478 |
</td>
|
@@ -481,10 +552,11 @@ if($err!='') echo '<div id="message" class="error fade">'.$err.'</div>';
|
|
481 |
<tr valign="top">
|
482 |
<th scope="row"><?php echo $uptxt;?></th>
|
483 |
<td>
|
484 |
-
<?php if (isset($_GET['mode'])) { ?>
|
485 |
-
|
486 |
-
<?php
|
487 |
-
<input
|
|
|
488 |
</td>
|
489 |
</tr>
|
490 |
|
@@ -553,8 +625,9 @@ function cnss_social_icon_page_fn() {
|
|
553 |
var r=confirm('Are you confirm to delete "'+title+'"');
|
554 |
if (r==true)
|
555 |
{
|
556 |
-
rpath1 = '<?php echo $_SERVER['
|
557 |
rpath2 = '&delete=y&id='+id;
|
|
|
558 |
window.location = rpath1+rpath2;
|
559 |
}
|
560 |
}
|
@@ -576,7 +649,13 @@ function cnss_social_icon_page_fn() {
|
|
576 |
</thead>
|
577 |
|
578 |
<tbody>
|
579 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
<tr valign="top">
|
581 |
<td>
|
582 |
<?php echo $vdoinfo->title;?>
|
@@ -589,7 +668,7 @@ function cnss_social_icon_page_fn() {
|
|
589 |
</td>
|
590 |
|
591 |
<td>
|
592 |
-
<img src="<?php echo $
|
593 |
</td>
|
594 |
|
595 |
<td>
|
@@ -655,7 +734,12 @@ function cn_social_icon() {
|
|
655 |
$i=0;
|
656 |
foreach($video_info as $icon)
|
657 |
{
|
658 |
-
|
|
|
|
|
|
|
|
|
|
|
659 |
echo $vorh=='vertical'?'<tr>':'';
|
660 |
if($i++%$_columnCount==0 && $vorh!='vertical' )echo '<tr>';
|
661 |
?><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
|
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><?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.
|
6 |
+
Version: 1.2
|
7 |
Author: cybernetikz
|
8 |
Author URI: http://www.cybernetikz.com
|
9 |
License: GPL2
|
10 |
*/
|
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";
|
22 |
+
$i = 0;
|
23 |
+
$url = "";
|
24 |
+
while ($i <= $length) {
|
25 |
+
$url .= $chars{mt_rand(0,strlen($chars))};
|
26 |
+
$i++;
|
27 |
+
}
|
28 |
+
return $url;
|
29 |
+
}
|
30 |
+
|
31 |
+
/*function cnss_admin_enqueue($hook) {
|
32 |
+
global $pluginsURI;
|
33 |
+
echo $pluginsURI;
|
34 |
+
if( 'index.php' != $hook )
|
35 |
+
return;
|
36 |
+
wp_register_script( 'add_media_js', $pluginsURI.'js/add-media.js' );
|
37 |
+
wp_enqueue_script('add_media_js');
|
38 |
+
wp_enqueue_media();
|
39 |
+
}
|
40 |
+
add_action( 'admin_enqueue_scripts', 'cnss_admin_enqueue' );*/
|
41 |
+
|
42 |
function cnss_my_script() {
|
43 |
global $pluginsURI;
|
44 |
+
wp_enqueue_script( 'jquery' );
|
45 |
wp_enqueue_script('jquery-ui-sortable');
|
46 |
wp_register_script('cnss_js', $pluginsURI . 'js/cnss.js', array(), '1.0' );
|
47 |
wp_enqueue_script( 'cnss_js' );
|
49 |
wp_register_style('cnss_css', $pluginsURI . 'css/cnss.css', array(), '1.0' );
|
50 |
wp_enqueue_style( 'cnss_css' );
|
51 |
}
|
52 |
+
|
53 |
+
function cnss_admin_enqueue($hook) {
|
54 |
+
if ($hook!='easy-social-icon_page_cnss_social_icon_add')
|
55 |
+
{
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
global $pluginsURI;
|
59 |
+
wp_enqueue_media();
|
60 |
+
wp_register_script('cnss_admin_js', $pluginsURI . 'js/cnss_admin.js', array(), '1.0' );
|
61 |
+
wp_enqueue_script( 'cnss_admin_js' );
|
62 |
+
}
|
63 |
+
|
64 |
add_action('init', 'cnss_my_script');
|
65 |
+
add_action('admin_enqueue_scripts', 'cnss_admin_enqueue' );
|
66 |
add_action('wp_ajax_update-social-icon-order', 'cnss_save_ajax_order' );
|
67 |
add_action('admin_menu', 'cnss_add_menu_pages');
|
68 |
|
144 |
global $wpdb;
|
145 |
global $cnss_db_version;
|
146 |
|
|
|
147 |
$upload_dir = wp_upload_dir();
|
148 |
+
|
149 |
+
/*$srcdir = ABSPATH.'wp-content/plugins/easy-social-icons/images/icon/';
|
150 |
$targetdir = $upload_dir['basedir'].'/';
|
151 |
|
152 |
$files = scandir($srcdir);
|
155 |
if($fname=='.')continue;
|
156 |
if($fname=='..')continue;
|
157 |
copy($srcdir.$fname, $targetdir.$fname);
|
158 |
+
}*/
|
159 |
|
160 |
$table_name = $wpdb->prefix . "cn_social_icon";
|
161 |
if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
|
162 |
|
163 |
+
$sql2 = "CREATE TABLE `$table_name` (
|
164 |
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
|
165 |
`title` VARCHAR(255) NULL,
|
166 |
`url` VARCHAR(255) NOT NULL,
|
168 |
`sortorder` INT NOT NULL DEFAULT '0',
|
169 |
`date_upload` VARCHAR(100) NULL,
|
170 |
`target` tinyint(1) NOT NULL DEFAULT '1',
|
171 |
+
PRIMARY KEY (`id`)) ENGINE = InnoDB;";
|
172 |
+
|
173 |
+
/*
|
174 |
+
INSERT INTO `$table_name` (`title`, `url`, `image_url`, `sortorder`, `date_upload`, `target`) VALUES
|
175 |
+
('facebook', 'http://facebook.com/your-fan-page', '1368459524_facebook.png', 1, '1368459524', 1),
|
176 |
+
('twitter', 'http://twitter/username', '1368459556_twitter.png', 2, '1368459556', 1),
|
177 |
+
('flickr', 'http://flickr.com/?username', '1368459641_flicker.png', 3, '1368459641', 1),
|
178 |
+
('linkedin', 'http://linkedin.com', '1368459699_in.png', 4, '1368459699', 1),
|
179 |
+
('youtube', 'http://youtube.com/user', '1368459724_youtube.png', 5, '1368459724', 1);
|
180 |
+
*/
|
181 |
+
|
182 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
183 |
dbDelta($sql2);
|
184 |
|
195 |
|
196 |
if (isset($_GET['delete'])) {
|
197 |
|
198 |
+
if ($_GET['id'] != '')
|
199 |
{
|
200 |
|
201 |
$table_name = $wpdb->prefix . "cn_social_icon";
|
202 |
$image_file_path = $baseDir; //"../wp-content/uploads/";
|
203 |
+
/*$sql = "SELECT * FROM ".$table_name." WHERE id =".$_GET['id'];
|
204 |
$video_info = $wpdb->get_results($sql);
|
205 |
|
206 |
if (!empty($video_info))
|
207 |
{
|
208 |
@unlink($image_file_path.$video_info[0]->image_url);
|
209 |
+
}*/
|
210 |
+
$delete = "DELETE FROM ".$table_name." WHERE id = ".$_GET['id']." LIMIT 1";
|
211 |
$results = $wpdb->query( $delete );
|
212 |
$msg = "Delete Successfully!!!"."<br />";
|
213 |
}
|
225 |
//$image_file_path = "../wp-content/uploads/";
|
226 |
$image_file_path = $baseDir;
|
227 |
|
228 |
+
/*if ($_FILES["image_file"]["name"] != "" ){
|
229 |
+
|
230 |
+
$extArr = array('jpg','png','gif','jpeg');
|
231 |
+
$target_file = $image_file_path . basename($_FILES["image_file"]["name"]);
|
232 |
+
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
|
233 |
+
$check = getimagesize($_FILES["image_file"]["tmp_name"]);
|
234 |
+
if($check === false || !in_array($imageFileType,$extArr)) {
|
235 |
+
$err .= "Invalid file type<br />";
|
236 |
+
}
|
237 |
+
else
|
238 |
+
{
|
239 |
+
if( $err=='' and $_FILES["image_file"]["size"] < 1024*1024*1 ) {
|
240 |
+
|
241 |
if ($_FILES["image_file"]["error"] > 0)
|
242 |
{
|
243 |
$err .= "Return Code: " . $_FILES["image_file"]["error"] . "<br />";
|
250 |
}
|
251 |
else
|
252 |
{
|
253 |
+
$image_file_name = time().generateRandomCode(16).'.'.$imageFileType;
|
254 |
$fstatus = move_uploaded_file($_FILES["image_file"]["tmp_name"], $image_file_path . $image_file_name);
|
255 |
if ($fstatus == true){
|
256 |
+
$msg = "Icon upload successful !"."<br />";
|
257 |
}
|
258 |
}
|
259 |
}
|
260 |
}
|
261 |
else
|
262 |
{
|
263 |
+
$err .= "Max file size exceded" . "<br />";
|
264 |
}
|
265 |
}
|
266 |
+
}
|
267 |
+
else
|
268 |
+
{
|
269 |
+
$err .= "Please input image file". "<br />";
|
270 |
+
}// end if image file*/
|
271 |
|
272 |
if ($err == '')
|
273 |
{
|
276 |
$insert = "INSERT INTO " . $table_name .
|
277 |
" (title, url, image_url, sortorder, date_upload, target) " .
|
278 |
"VALUES ('" .
|
279 |
+
$wpdb->escape( $_POST['title']) . "','" .
|
280 |
+
$wpdb->escape( $_POST['url']) . "','" .
|
281 |
+
$_POST['image_file'] . "'," .
|
282 |
+
$_POST['sortorder'] . ",'" .
|
283 |
time() . "'," .
|
284 |
+
$_POST['target'] . "" .
|
285 |
")";
|
286 |
$results = $wpdb->query( $insert );
|
287 |
|
293 |
}
|
294 |
}// end if update
|
295 |
|
296 |
+
if ( $_POST['action'] == 'edit' and $_POST['id'] != '' )
|
297 |
{
|
298 |
$err = "";
|
299 |
$msg = "";
|
300 |
|
301 |
+
$url = $_POST['url'];
|
302 |
+
$target = $_POST['target'];
|
303 |
|
304 |
//$image_file_path = "../wp-content/uploads/";
|
305 |
$image_file_path = $baseDir;
|
306 |
|
307 |
$table_name = $wpdb->prefix . "cn_social_icon";
|
308 |
+
$sql = "SELECT * FROM ".$table_name." WHERE id =".$_POST['id'];
|
309 |
$video_info = $wpdb->get_results($sql);
|
310 |
$image_file_name = $video_info[0]->image_url;
|
311 |
$update = "";
|
312 |
|
|
|
313 |
$type= 1;
|
314 |
+
/*if ($_FILES["image_file"]["name"] != ""){
|
315 |
+
|
316 |
+
$extArr = array('jpg','png','gif','jpeg');
|
317 |
+
$target_file = $image_file_path . basename($_FILES["image_file"]["name"]);
|
318 |
+
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
|
319 |
+
$check = getimagesize($_FILES["image_file"]["tmp_name"]);
|
320 |
+
if($check === false || !in_array($imageFileType,$extArr)) {
|
321 |
+
$err .= "Invalid file type<br />";
|
322 |
+
}
|
323 |
+
else
|
324 |
+
{
|
325 |
+
|
326 |
+
if( $err=='' && $_FILES["image_file"]["size"] <= 1024*1024*1 )
|
|
|
327 |
{
|
328 |
+
if ($_FILES["image_file"]["error"] > 0)
|
329 |
+
{
|
330 |
+
$err .= "Return Code: " . $_FILES["image_file"]["error"] . "<br />";
|
331 |
+
}
|
332 |
+
else
|
333 |
+
{
|
334 |
+
if (file_exists($image_file_path . $_FILES["image_file"]["name"]))
|
335 |
+
{
|
336 |
+
$err .= $_FILES["image_file"]["name"] . " already exists. ";
|
337 |
+
}
|
338 |
+
else
|
339 |
+
{
|
340 |
+
$image_file_name = time().generateRandomCode(16).'.'.$imageFileType;
|
341 |
+
$fstatus = move_uploaded_file($_FILES["image_file"]["tmp_name"], $image_file_path . $image_file_name);
|
342 |
+
|
343 |
+
if ($fstatus == true){
|
344 |
+
$msg = "File Uploaded Successfully!!!".'<br />';
|
345 |
+
@unlink($image_file_path.$video_info[0]->image_url);
|
346 |
+
$update = "UPDATE " . $table_name . " SET " .
|
347 |
+
"image_url='" .$image_file_name . "'" .
|
348 |
+
" WHERE id=" . $_POST['id'];
|
349 |
+
$results1 = $wpdb->query( $update );
|
350 |
+
}
|
351 |
+
}
|
352 |
}
|
353 |
}
|
354 |
+
else
|
355 |
+
{
|
356 |
+
$err .= "Invalid file type or max file size exceded";
|
357 |
}
|
|
|
|
|
|
|
|
|
358 |
}
|
359 |
+
}*/
|
360 |
|
361 |
$update = "UPDATE " . $table_name . " SET " .
|
362 |
"title='" .$wpdb->escape( $_POST['title']) . "'," .
|
363 |
"url='" . $url . "'," .
|
364 |
+
"image_url='" . $_POST['image_file'] . "'," .
|
365 |
"sortorder=" .$_POST['sortorder'] . "," .
|
366 |
"date_upload='" .time(). "'," .
|
367 |
"target=$target " .
|
410 |
|
411 |
<div id="order-post-type">
|
412 |
<ul id="sortable">
|
413 |
+
<?php
|
414 |
+
foreach($video_info as $vdoinfo) {
|
415 |
+
if(strpos($vdoinfo->image_url,'/')===false)
|
416 |
+
$image_url = $image_file_path.'/'.$vdoinfo->image_url;
|
417 |
+
else
|
418 |
+
$image_url = $vdoinfo->image_url;
|
419 |
+
|
420 |
+
?>
|
421 |
<li id="item_<?php echo $vdoinfo->id ?>">
|
422 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
423 |
<tr style="background:#f7f7f7">
|
424 |
+
<td width="60"> <img src="<?php echo $image_url;?>" border="0" width="<?php echo $cnss_width ?>" height="<?php echo $cnss_height ?>" alt="<?php echo $vdoinfo->title;?>" /></td>
|
425 |
<td><span><?php echo $vdoinfo->title;?></span></td>
|
426 |
</tr>
|
427 |
</table>
|
486 |
global $err,$msg,$baseURL;
|
487 |
|
488 |
if (isset($_GET['mode'])) {
|
489 |
+
if ( $_GET['mode'] != '' and $_GET['mode'] == 'edit' and $_GET['id'] != '' )
|
490 |
{
|
491 |
|
492 |
$cnss_width = get_option('cnss-width');
|
494 |
//$cnss_margin = get_option('cnss-margin');
|
495 |
|
496 |
$page_title = 'Edit Icon';
|
497 |
+
$uptxt = 'Icon';
|
498 |
|
499 |
global $wpdb;
|
500 |
$table_name = $wpdb->prefix . "cn_social_icon";
|
501 |
$image_file_path = $baseURL; //"../wp-content/uploads/";
|
502 |
+
$sql = "SELECT * FROM ".$table_name." WHERE id =".$_GET['id'];
|
503 |
$video_info = $wpdb->get_results($sql);
|
504 |
|
505 |
if (!empty($video_info))
|
507 |
$id = $video_info[0]->id;
|
508 |
$title = $video_info[0]->title;
|
509 |
$url = $video_info[0]->url;
|
510 |
+
$image_url = $video_info[0]->image_url;
|
511 |
$sortorder = $video_info[0]->sortorder;
|
512 |
$target = $video_info[0]->target;
|
513 |
+
|
514 |
+
if(strpos($image_url,'/')===false)
|
515 |
+
$image_url = $image_file_path.'/'.$image_url;
|
516 |
+
else
|
517 |
+
$image_url = $image_url;
|
518 |
+
|
519 |
}
|
520 |
}
|
521 |
}
|
528 |
$image_url = "";
|
529 |
$sortorder = "0";
|
530 |
$target = "";
|
531 |
+
$uptxt = 'Icon';
|
532 |
|
533 |
}
|
534 |
?>
|
543 |
|
544 |
<table class="form-table">
|
545 |
<tr valign="top">
|
546 |
+
<th scope="row">Title</th>
|
547 |
<td>
|
548 |
<input type="text" name="title" id="title" class="regular-text" value="<?php echo $title?>" />
|
549 |
</td>
|
552 |
<tr valign="top">
|
553 |
<th scope="row"><?php echo $uptxt;?></th>
|
554 |
<td>
|
555 |
+
<?php //if (isset($_GET['mode'])) { } ?>
|
556 |
+
<!--<input type="file" name="image_file" id="image_file" value="" />-->
|
557 |
+
<input style="vertical-align:top" type="text" name="image_file" id="image_file" class="regular-text" value="<?php echo $image_url ?>" />
|
558 |
+
<input style="vertical-align:top" id="logo_image_button" class="button" type="button" value="Choose Icon" />
|
559 |
+
<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 />
|
560 |
</td>
|
561 |
</tr>
|
562 |
|
625 |
var r=confirm('Are you confirm to delete "'+title+'"');
|
626 |
if (r==true)
|
627 |
{
|
628 |
+
rpath1 = '<?php echo $_SERVER['PHP_SELF'].'?page=cnss_social_icon_page'; ?>';
|
629 |
rpath2 = '&delete=y&id='+id;
|
630 |
+
//alert(rpath1+rpath2);
|
631 |
window.location = rpath1+rpath2;
|
632 |
}
|
633 |
}
|
649 |
</thead>
|
650 |
|
651 |
<tbody>
|
652 |
+
<?php
|
653 |
+
foreach($video_info as $vdoinfo) {
|
654 |
+
if(strpos($vdoinfo->image_url,'/')===false)
|
655 |
+
$image_url = $image_file_path.'/'.$vdoinfo->image_url;
|
656 |
+
else
|
657 |
+
$image_url = $vdoinfo->image_url;
|
658 |
+
?>
|
659 |
<tr valign="top">
|
660 |
<td>
|
661 |
<?php echo $vdoinfo->title;?>
|
668 |
</td>
|
669 |
|
670 |
<td>
|
671 |
+
<img src="<?php echo $image_url;?>" border="0" width="<?php echo $cnss_width ?>" height="<?php echo $cnss_height ?>" alt="<?php echo $vdoinfo->title;?>" />
|
672 |
</td>
|
673 |
|
674 |
<td>
|
734 |
$i=0;
|
735 |
foreach($video_info as $icon)
|
736 |
{
|
737 |
+
|
738 |
+
if(strpos($icon->image_url,'/')===false)
|
739 |
+
$image_url = $image_file_path.'/'.$icon->image_url;
|
740 |
+
else
|
741 |
+
$image_url = $icon->image_url;
|
742 |
+
|
743 |
echo $vorh=='vertical'?'<tr>':'';
|
744 |
if($i++%$_columnCount==0 && $vorh!='vertical' )echo '<tr>';
|
745 |
?><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
|
images/icon/index.php
ADDED
File without changes
|
images/index.php
ADDED
File without changes
|
index.php
ADDED
File without changes
|
js/cnss.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
jQuery('table.cnss-social-icon tr td img').hover(function() {
|
3 |
jQuery(this).animate({
|
4 |
opacity: 0.5
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
jQuery('table.cnss-social-icon tr td img').hover(function() {
|
3 |
jQuery(this).animate({
|
4 |
opacity: 0.5
|
js/cnss_admin.js
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
|
3 |
+
var custom_logo_uploader;
|
4 |
+
|
5 |
+
$('#logo_image_button').click(function(e) {
|
6 |
+
e.preventDefault();
|
7 |
+
//If the uploader object has already been created, reopen the dialog
|
8 |
+
if (custom_logo_uploader) {
|
9 |
+
custom_logo_uploader.open();
|
10 |
+
return;
|
11 |
+
}
|
12 |
+
//Extend the wp.media object
|
13 |
+
custom_logo_uploader = wp.media.frames.file_frame = wp.media({
|
14 |
+
title: 'Choose icon',
|
15 |
+
button: {
|
16 |
+
text: 'Set icon image'
|
17 |
+
},
|
18 |
+
multiple: false
|
19 |
+
});
|
20 |
+
//When a file is selected, grab the URL and set it as the text field's value
|
21 |
+
custom_logo_uploader.on('select', function() {
|
22 |
+
attachment = custom_logo_uploader.state().get('selection').first().toJSON();
|
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 |
+
|
29 |
+
});
|
30 |
+
//Open the uploader dialog
|
31 |
+
custom_logo_uploader.open();
|
32 |
+
});
|
33 |
+
|
34 |
+
});
|
js/index.php
ADDED
File without changes
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
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:
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
You can upload your own social icon, set your social URL, choose weather you want to display vertical or horizontal.
|
10 |
|
@@ -12,6 +12,11 @@ You can upload your own social icon, set your social URL, choose weather you wan
|
|
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>PAID SUPPORT ($30/Hr, We ACCEPT PAYPAL )</strong>
|
16 |
>
|
17 |
> 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:
|
@@ -58,6 +63,10 @@ Use this shortcode for page/post <strong>[cn-social-icon]</strong> , for php cod
|
|
58 |
|
59 |
Also you can use the widget for the sidebar.
|
60 |
|
|
|
|
|
|
|
|
|
61 |
== Screenshots ==
|
62 |
|
63 |
1. add new icon page layout
|
@@ -71,6 +80,11 @@ Also you can use the widget for the sidebar.
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
74 |
= 1.1 =
|
75 |
* icon upload folder fix
|
76 |
|
2 |
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.1
|
7 |
+
Stable tag: 1.2
|
8 |
|
9 |
You can upload your own social icon, set your social URL, choose weather you want to display vertical or horizontal.
|
10 |
|
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 |
+
|
17 |
+
If you are using <strong>wordpress version lower than 3.5</strong> please use "Easy Social Icons" version
|
18 |
+
<a href="https://downloads.wordpress.org/plugin/easy-social-icons.1.0.zip">1.1</a>
|
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:
|
63 |
|
64 |
Also you can use the widget for the sidebar.
|
65 |
|
66 |
+
= Ques : What if my wordpress version is below 3.5? =
|
67 |
+
Ans :
|
68 |
+
If you are using wordpress version lower than 3.5 please use Easy social Icon version <a href="https://downloads.wordpress.org/plugin/easy-social-icons.1.0.zip">1.1</a>
|
69 |
+
|
70 |
== Screenshots ==
|
71 |
|
72 |
1. add new icon page layout
|
80 |
|
81 |
== Changelog ==
|
82 |
|
83 |
+
= 1.2 =
|
84 |
+
* Integrate WordPress default media uploader
|
85 |
+
* Some security updates
|
86 |
+
* Remove preloaded sample icon as icon upload method change
|
87 |
+
|
88 |
= 1.1 =
|
89 |
* icon upload folder fix
|
90 |
|