# HG changeset patch # User Alessio Caiazza # Date 1245255733 0 # Node ID 7bbb9825c40743e86a1123335e93543f86802363 # Parent 280089e56e5898e403c5b077f8ed6c22e42e16f6 aboutme.php re-indented. :( diff -r 280089e56e5898e403c5b077f8ed6c22e42e16f6 -r 7bbb9825c40743e86a1123335e93543f86802363 aboutme.php --- a/aboutme.php Wed Jun 17 15:37:42 2009 +0000 +++ b/aboutme.php Wed Jun 17 16:22:13 2009 +0000 @@ -9,22 +9,22 @@ /* Social Links Copyright 2008 Kareem Sultan (email : kareemsultan@gmail.com) */ /* - (c) 2009 Alessio Caiazza -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + (c) 2009 Alessio Caiazza + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -http://www.gnu.org/licenses/gpl.txt + http://www.gnu.org/licenses/gpl.txt */ @@ -40,46 +40,46 @@ define('KEY_URL_TEMPLATE',2); define('KEY_INSTRUCTION',3); define('KEY_DISPLAY_NAME',4); - + //$sl_db_version = "1.0"; $plugindir = get_settings('home').'/wp-content/plugins/'.dirname(plugin_basename(__FILE__)); $pluginrelativedir = '/wp-content/plugins/'.dirname(plugin_basename(__FILE__)); $definitions = array( - array(0,'facebook.png','%userid%','Enter your complete Facebook profile URL','Facebook'), - array(1,'myspace.png','%userid%','Enter your complete MySpace URL.','MySpace'), - array(2,'linkedin.png','%userid%','Enter your complete LinkedIn URL.','LinkedIn'), - array(3,'picasa.png','http://picasaweb.google.com/%userid%','Enter your Picasa(Google) username.','Picasa Web Album'), - array(4,'flickr.png','http://flickr.com/photos/%userid%','Enter your flickr username','Flickr'), - array(5,'youtube.png','http://www.youtube.com/%userid%','Enter your YouTube username','YouTube'), - array(6,'twitter.png','http://twitter.com/%userid%','Enter your Twitter username','Twitter'), - array(7,'pownce.png','http://pownce.com/%userid%','Enter your Pownce username','Pownce'), - array(8,'plurk.png','http://www.plurk.com/user/%userid%','Enter your Plurk username','Plurk'), - array(9,'digg.png','http://www.digg.com/users/%userid%','Enter your Digg username.','Digg'), - array(10,'delicious.png','http://delicious.com/%userid%','Enter your Delicious username','Delicious'), - array(11,'blogmarks.png','http://blogmarks.net/user/%userid%','Enter your BlogMarks username.','BlogMarks'), - array(12,'stumbleupon.png','http://%userid%.stumbleupon.com','Enter your Stumble Upon username','Stumble Upon'), - array(13,'lastfm.png','http://www.last.fm/user/%userid%','Enter your Last.fm username','Last.fm'), - array(14,'amazon.png','%userid%','Enter your complete Amazon Wishlist URL','Amazon Wishlist'), - array(15,'blog.png','%userid%','Enter the complete blog URL.','Blog'), - array(16,'jeqq.png','http://www.jeqq.com/user/view/profile/%userid%','Enter your Jeqq username','Jeqq'), - array(17,'dapx.png','%userid%','Enter your complete Dapx URL.','Dapx'), - array(18,'xing.jpg','%userid%','Enter your complete Xing URL.','Xing'), - array(19,'sixent.png','http://%userid%.sixent.com/','Enter your Sixent username','Sixent'), - array(20,'technorati.jpg','http://technorati.com/people/technorati/%userid%/','Enter your Technorati username.','Technorati'), - array(21,'friendfeed.png','http://friendfeed.com/%userid%','Enter your FriendFeed username.','FriendFeed'), - array(22,'identica.png','http://identi.ca/%userid%','Enter your Identi.ca username.','Identi.ca'), - array(23,'bitbucket.png','http://bitbucket.org/%userid%','Enter your Bitbucket username.','Bitbucket'), - array(24,'github.png','http://github.com/%userid%','Enter your Github username.','Github'), - array(25,'hellotxt.gif','http://hellotxt.com/user/%userid%','Enter your Hellotxt username.','Hellotxt'), - array(26,'hyves.png','http://%userid%.hyves.nl','Enter your Hyves.nl username.','Hyves.nl'), - array(27,'disqus.png','http://disqus.com/people/%userid%','Enter your Disqus username.','Disqus'), - array(28,'redgage.png','http://www.redgage.com/%userid%','Enter your RedGage username.','RedGage') +array(0,'facebook.png','%userid%','Enter your complete Facebook profile URL','Facebook'), +array(1,'myspace.png','%userid%','Enter your complete MySpace URL.','MySpace'), +array(2,'linkedin.png','%userid%','Enter your complete LinkedIn URL.','LinkedIn'), +array(3,'picasa.png','http://picasaweb.google.com/%userid%','Enter your Picasa(Google) username.','Picasa Web Album'), +array(4,'flickr.png','http://flickr.com/photos/%userid%','Enter your flickr username','Flickr'), +array(5,'youtube.png','http://www.youtube.com/%userid%','Enter your YouTube username','YouTube'), +array(6,'twitter.png','http://twitter.com/%userid%','Enter your Twitter username','Twitter'), +array(7,'pownce.png','http://pownce.com/%userid%','Enter your Pownce username','Pownce'), +array(8,'plurk.png','http://www.plurk.com/user/%userid%','Enter your Plurk username','Plurk'), +array(9,'digg.png','http://www.digg.com/users/%userid%','Enter your Digg username.','Digg'), +array(10,'delicious.png','http://delicious.com/%userid%','Enter your Delicious username','Delicious'), +array(11,'blogmarks.png','http://blogmarks.net/user/%userid%','Enter your BlogMarks username.','BlogMarks'), +array(12,'stumbleupon.png','http://%userid%.stumbleupon.com','Enter your Stumble Upon username','Stumble Upon'), +array(13,'lastfm.png','http://www.last.fm/user/%userid%','Enter your Last.fm username','Last.fm'), +array(14,'amazon.png','%userid%','Enter your complete Amazon Wishlist URL','Amazon Wishlist'), +array(15,'blog.png','%userid%','Enter the complete blog URL.','Blog'), +array(16,'jeqq.png','http://www.jeqq.com/user/view/profile/%userid%','Enter your Jeqq username','Jeqq'), +array(17,'dapx.png','%userid%','Enter your complete Dapx URL.','Dapx'), +array(18,'xing.jpg','%userid%','Enter your complete Xing URL.','Xing'), +array(19,'sixent.png','http://%userid%.sixent.com/','Enter your Sixent username','Sixent'), +array(20,'technorati.jpg','http://technorati.com/people/technorati/%userid%/','Enter your Technorati username.','Technorati'), +array(21,'friendfeed.png','http://friendfeed.com/%userid%','Enter your FriendFeed username.','FriendFeed'), +array(22,'identica.png','http://identi.ca/%userid%','Enter your Identi.ca username.','Identi.ca'), +array(23,'bitbucket.png','http://bitbucket.org/%userid%','Enter your Bitbucket username.','Bitbucket'), +array(24,'github.png','http://github.com/%userid%','Enter your Github username.','Github'), +array(25,'hellotxt.gif','http://hellotxt.com/user/%userid%','Enter your Hellotxt username.','Hellotxt'), +array(26,'hyves.png','http://%userid%.hyves.nl','Enter your Hyves.nl username.','Hyves.nl'), +array(27,'disqus.png','http://disqus.com/people/%userid%','Enter your Disqus username.','Disqus'), +array(28,'redgage.png','http://www.redgage.com/%userid%','Enter your RedGage username.','RedGage') ); //comparison based on socialnetwok name function compare_social($s1, $s2) { - return strcmp($s1[KEY_DISPLAY_NAME], $s2[KEY_DISPLAY_NAME]); + return strcmp($s1[KEY_DISPLAY_NAME], $s2[KEY_DISPLAY_NAME]); } //Sorts socialnetworks in alphabetical order @@ -88,308 +88,306 @@ function social_links_wrapper(){ -// This only works if the widget api is installed -if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') ) - return; // ...and if not, exit gracefully from the script. + // This only works if the widget api is installed + if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') ) + return; // ...and if not, exit gracefully from the script. -//WPD_print('Filename: '.__FILE__); -//WPD_print('DB version: '.get_option( "SOCIAL_LINKS_DB_VERSION" )); - // Displays the icons in the sidebar - function widget_social_links($args) { - global $definitions; - extract($args); - - $options = get_option('widget_social_links'); - $title = empty($options['title']) ? 'About Me' : $options['title']; - $width = empty($options['width']) ? 20 : $options['width']; - - echo $before_widget; - echo $before_title . $title . $after_title ; - - echo ''; - echo "'; - echo $after_widget; - - } - - //Config Panel - function widget_social_links_control() { - global $definitions; - $options = get_option('widget_social_links'); - - if ( $_POST['social-links-submit'] ) { - // Clean up control form submission options - $newoptions['title'] = strip_tags(stripslashes($_POST['social-links-title'])); - $newoptions['width'] = strip_tags(stripslashes($_POST['social-links-width'])); - - - if ( $options != $newoptions ) { - $options = $newoptions; - update_option('widget_social_links', $options); - } - } - - $title = empty($options['title']) ? 'About Me' : $options['title']; - $width = empty($options['width']) ? 100 : $options['width']; - - ?> - - - - -
- -
- -
- - - prefix . "social_links"; - $sql = 'delete from ' . $table_name . ' where id='.$linkId; - $result = $wpdb->query($wpdb->prepare($sql)); - - if($result == 1) - $result = 'Removed link.'; - else - $result = 'There was a problem deleting the link. Refresh the page and try again.'.$sql; - //WPD_print($result); - die(' - $("message").innerHTML = "'.$result.'"; - $("message").className="updated fade"; - $("message").style.visibility = "visible"; - '); - } - - - - - - function insertNetwork($id,$value){ - - - //WPD_print('Inserting new network'); - global $wpdb; - - //WPD_print('networkID='.$id.' data='.$value); - $table_name = $wpdb->prefix . "social_links"; - $sql = 'Insert into ' . $table_name . ' (network_id,user_info,sort_order) VALUES ("'.$id.'","'.$value.'",1000)'; - $result = $wpdb->query($wpdb->prepare($sql)); - //WPD_print($sql); - return $result; - } - - function getSocialLinks(){ - global $wpdb; - $table_name = $wpdb->prefix . "social_links"; - $sql = 'Select * from ' . $table_name . ' order by sort_order'; - $results = $wpdb->get_results($sql,ARRAY_N); - ////WPD_print("Select networks results: ".$results); - return $results; - - } - - function generateSocialLinksInnerHTML(){ - global $definitions; - global $plugindir; + //WPD_print('Filename: '.__FILE__); + //WPD_print('DB version: '.get_option( "SOCIAL_LINKS_DB_VERSION" )); + // Displays the icons in the sidebar + function widget_social_links($args) { + global $definitions; + extract($args); - $rows = getSocialLinks(); - if(count($rows)==0) - return; - ////WPD_print("Found".count($rows)." networks."); + $options = get_option('widget_social_links'); + $title = empty($options['title']) ? 'About Me' : $options['title']; + $width = empty($options['width']) ? 20 : $options['width']; - foreach ($rows as $row) { - //WPD_print("SiteID: " . $row[1]); - $linkInfoArray = $definitions[$row[1]]; - //WPD_print('network info '. $linkInfoArray); - $url = str_replace("%userid%",$row[2],$linkInfoArray[KEY_URL_TEMPLATE]); - $innerHTML = $innerHTML . "".$linkInfoArray[KEY_DISPLAY_NAME].""; - if($row != $rows[count($rows)-1]){ - $innerHTML = $innerHTML."\n"; - } - } + echo $before_widget; + echo $before_title . $title . $after_title ; - return $innerHTML; - } - - function generateSocialLinksPreviewInnerHTML($delimiter){ - global $definitions; - global $plugindir; + echo ''; + echo "'; + echo $after_widget; - $rows = getSocialLinks(); - if(count($rows)==0) - return; - //WPD_print("Found ".count($rows)." networks."); + } - foreach ($rows as $row) { - //WPD_print("SiteID: " . $row[2]); - //var_dump($row); - $linkInfoArray = $definitions[$row[1]]; - //var_dump($linkInfoArray); - //WPD_print('network info '. $linkInfoArray); - $url = str_replace("%userid%",$row[2],$linkInfoArray[KEY_URL_TEMPLATE]); - $innerHTML = $innerHTML . "".$linkInfoArray[KEY_DISPLAY_NAME].""; - if($row != $rows[count($rows)-1]){ - $innerHTML = $innerHTML.$delimiter; - } - } + //Config Panel + function widget_social_links_control() { + global $definitions; + $options = get_option('widget_social_links'); - return $innerHTML; - } - - /* - function generateSocialLinksData(){ - global $definitions; - - $rows = getSocialLinks(); - if(count($rows)==0) - return; - ////WPD_print("Found".count($rows)." networks."); - $data = ''; - foreach ($rows as $row) { - $linkInfoArray = $definitions[$row[2]]; - $data += "link_$row[0],$linkInfoArray[0],$linkInfoArray[1],$linkInfoArray[4]\n"; - } - return $data; - - } - */ - - function social_links_admin_menu(){ - global $pluginrelativedir; - //add_options_page('Social Links Settings', 'Social Links', 8,$pluginrelativedir.'/edit-sociallinks.php'); - add_management_page('Social Links Settings - About Me', 'About Me', 8,__FILE__,'widget_social_links_settings'); + if ( $_POST['social-links-submit'] ) { + // Clean up control form submission options + $newoptions['title'] = strip_tags(stripslashes($_POST['social-links-title'])); + $newoptions['width'] = strip_tags(stripslashes($_POST['social-links-width'])); - global $plugindir; - wp_enqueue_script('about-me', $plugindir . '/javascript.js',array('sack')); - wp_enqueue_script('scriptaculous'); - } - - function addHeaderCode(){ - //WPD_print("header code"); - global $plugindir; - echo '' . "\n"; - - } - - - - ////WPD_print("Registering plugin"); - - add_action('wp_head','addHeaderCode'); - - - - //Add action to load sub menu - add_action('admin_menu', 'social_links_admin_menu'); - - - - - //Add ajax callback action called from client side javascript - add_action('wp_ajax_social_links_add_network', 'wp_ajax_social_links_add_network' ); - add_action('wp_ajax_social_links_delete_network', 'wp_ajax_social_links_delete_network' ); - - register_sidebar_widget('About Me - Social Links', 'widget_social_links'); - register_widget_control('About Me - Social Links', 'widget_social_links_control'); - - }//End of SocialLinks class + + if ( $options != $newoptions ) { + $options = $newoptions; + update_option('widget_social_links', $options); + } + } + + $title = empty($options['title']) ? 'About Me' : $options['title']; + $width = empty($options['width']) ? 100 : $options['width']; + + ?> + + + + +
+ +
+ +
+ + + prefix . "social_links"; + $sql = 'delete from ' . $table_name . ' where id='.$linkId; + $result = $wpdb->query($wpdb->prepare($sql)); + + if($result == 1) + $result = 'Removed link.'; + else + $result = 'There was a problem deleting the link. Refresh the page and try again.'.$sql; + //WPD_print($result); + die(' + $("message").innerHTML = "'.$result.'"; + $("message").className="updated fade"; + $("message").style.visibility = "visible"; + '); + } + + + + + + function insertNetwork($id,$value){ + + + //WPD_print('Inserting new network'); + global $wpdb; + + //WPD_print('networkID='.$id.' data='.$value); + $table_name = $wpdb->prefix . "social_links"; + $sql = 'Insert into ' . $table_name . ' (network_id,user_info,sort_order) VALUES ("'.$id.'","'.$value.'",1000)'; + $result = $wpdb->query($wpdb->prepare($sql)); + //WPD_print($sql); + return $result; + } + + function getSocialLinks(){ + global $wpdb; + $table_name = $wpdb->prefix . "social_links"; + $sql = 'Select * from ' . $table_name . ' order by sort_order'; + $results = $wpdb->get_results($sql,ARRAY_N); + ////WPD_print("Select networks results: ".$results); + return $results; + + } + + function generateSocialLinksInnerHTML(){ + global $definitions; + global $plugindir; + + $rows = getSocialLinks(); + if(count($rows)==0) + return; + ////WPD_print("Found".count($rows)." networks."); + + foreach ($rows as $row) { + //WPD_print("SiteID: " . $row[1]); + $linkInfoArray = $definitions[$row[1]]; + //WPD_print('network info '. $linkInfoArray); + $url = str_replace("%userid%",$row[2],$linkInfoArray[KEY_URL_TEMPLATE]); + $innerHTML = $innerHTML . "".$linkInfoArray[KEY_DISPLAY_NAME].""; + if($row != $rows[count($rows)-1]){ + $innerHTML = $innerHTML."\n"; + } + } + + return $innerHTML; + } + + function generateSocialLinksPreviewInnerHTML($delimiter){ + global $definitions; + global $plugindir; + + $rows = getSocialLinks(); + if(count($rows)==0) + return; + //WPD_print("Found ".count($rows)." networks."); + + foreach ($rows as $row) { + //WPD_print("SiteID: " . $row[2]); + //var_dump($row); + $linkInfoArray = $definitions[$row[1]]; + //var_dump($linkInfoArray); + //WPD_print('network info '. $linkInfoArray); + $url = str_replace("%userid%",$row[2],$linkInfoArray[KEY_URL_TEMPLATE]); + $innerHTML = $innerHTML . "".$linkInfoArray[KEY_DISPLAY_NAME].""; + if($row != $rows[count($rows)-1]){ + $innerHTML = $innerHTML.$delimiter; + } + } + + return $innerHTML; + } + +/* +function generateSocialLinksData(){ + global $definitions; + + $rows = getSocialLinks(); + if(count($rows)==0) + return; + ////WPD_print("Found".count($rows)." networks."); + $data = ''; + foreach ($rows as $row) { + $linkInfoArray = $definitions[$row[2]]; + $data += "link_$row[0],$linkInfoArray[0],$linkInfoArray[1],$linkInfoArray[4]\n"; + } + return $data; + +} +*/ + + function social_links_admin_menu(){ + global $pluginrelativedir; + //add_options_page('Social Links Settings', 'Social Links', 8,$pluginrelativedir.'/edit-sociallinks.php'); + add_management_page('Social Links Settings - About Me', 'About Me', 8,__FILE__,'widget_social_links_settings'); + + global $plugindir; + wp_enqueue_script('about-me', $plugindir . '/javascript.js',array('sack')); + wp_enqueue_script('scriptaculous'); + } + + function addHeaderCode(){ + //WPD_print("header code"); + global $plugindir; + echo '' . "\n"; + + } + + + +////WPD_print("Registering plugin"); + + add_action('wp_head','addHeaderCode'); + + + + //Add action to load sub menu + add_action('admin_menu', 'social_links_admin_menu'); + + + + + //Add ajax callback action called from client side javascript + add_action('wp_ajax_social_links_add_network', 'wp_ajax_social_links_add_network' ); + add_action('wp_ajax_social_links_delete_network', 'wp_ajax_social_links_delete_network' ); + + register_sidebar_widget('About Me - Social Links', 'widget_social_links'); + register_widget_control('About Me - Social Links', 'widget_social_links_control'); + +}//End of SocialLinks class add_action('plugins_loaded','social_links_wrapper'); //todo handle auto db table update function social_links_install(){ - //require_once('datastore.php'); - //sl_install(); - - global $wpdb; - - //WPD_print("Installing Social Links Plugin"); - //echo '
Activation social links
'; - - $table_name = $wpdb->prefix . "social_links"; - - // $installed_ver = get_option( "SOCIAL_LINKS_DB_VERSION" ); + //require_once('datastore.php'); + //sl_install(); - if($wpdb->get_var("show tables like '$table_name'") != $table_name ) { - - $sql = "CREATE TABLE " . $table_name . " ( - id mediumint(9) NOT NULL AUTO_INCREMENT, - network_id int not null, - user_info VARCHAR(55) NOT NULL, - sort_order int not null DEFAULT 0, - UNIQUE KEY id (id) - );"; - - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); - dbDelta($sql); - - - add_option("SOCIAL_LINKS_DB_VERSION", SOCIAL_LINKS_DB_VERSION); - } - } + global $wpdb; + + //WPD_print("Installing Social Links Plugin"); + //echo '
Activation social links
'; + + $table_name = $wpdb->prefix . "social_links"; + + // $installed_ver = get_option( "SOCIAL_LINKS_DB_VERSION" ); + + if($wpdb->get_var("show tables like '$table_name'") != $table_name ) { + + $sql = "CREATE TABLE " . $table_name . " ( + id mediumint(9) NOT NULL AUTO_INCREMENT, + network_id int not null, + user_info VARCHAR(55) NOT NULL, + sort_order int not null DEFAULT 0, + UNIQUE KEY id (id) + );"; + + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + dbDelta($sql); + + + add_option("SOCIAL_LINKS_DB_VERSION", SOCIAL_LINKS_DB_VERSION); + } +} //Administration page @@ -397,113 +395,113 @@ $messageClass; function widget_social_links_settings(){ - if (isset($_POST['saveorder'])) - { - saveSortOrder(); - } - + if (isset($_POST['saveorder'])) + { + saveSortOrder(); + } - global $definitions; - global $message; - global $messageClass; - global $plugindir; - - $visibility = 'hidden'; - if(!empty($messageClass)) - $visibility = 'visible'; - - ?> + global $definitions; + global $message; + global $messageClass; + global $plugindir; -
-

About Me

- - -
-
-

Add New Social Link

- - - -
- - -
-
- -
- -
-

Preview

-
- -
- - - - -
-
- -
-
-
-
-

- To add a new link select the network from the drop down, fill in the appropriate information and press enter.
- To change the order they appear, rearrange the icons in the preview and click 'Save Order'.
- To delete a link, simply drag it to the trash can. -

+ $visibility = 'hidden'; + if(!empty($messageClass)) + $visibility = 'visible'; + + ?> + + +
+

About Me

+ + +
+
+

Add New Social Link

+ + + +
+ + +
+
+ +
+ +
+

Preview

+
+ +
+ + + +
-
- - + +
+ +
+
+

+ To add a new link select the network from the drop down, fill in the appropriate information and press enter.
+ To change the order they appear, rearrange the icons in the preview and click 'Save Order'.
+ To delete a link, simply drag it to the trash can. +

+
+
+ +prefix . "social_links"; - foreach($newSortorderArray["displayDiv"] as $order => $id){ - //WPD_print('Order: '.$order.' Value: '.$id); - - $sql = 'Update ' . $table_name . ' Set sort_order='.$order.' where id='.$id; - $result = $wpdb->query($wpdb->prepare($sql)); - //WPD_print('Result for '.$sql.' is '.$result); - - } - $message = 'Saved links\' order.'; - } - else{ - $message = 'No items to save.'; - } - $messageClass = 'updated fade'; - } + global $wpdb; + global $message; + global $messageClass; + //WPD_print("Action: " . $action); + //WPD_print("Sort Data: " . $sortDataOrder); + $sortDataOrder = !empty($_POST['sortOrderData']) ? $_POST['sortOrderData'] : ''; + if(!empty($sortDataOrder)) + { + //WPD_print("Saving order"); + parse_str($sortDataOrder,$newSortorderArray); + if(count($newSortorderArray) != 0){ + //WPD_print("List size: " . count($newSortorderArray)); + $table_name = $wpdb->prefix . "social_links"; + foreach($newSortorderArray["displayDiv"] as $order => $id){ + //WPD_print('Order: '.$order.' Value: '.$id); + + $sql = 'Update ' . $table_name . ' Set sort_order='.$order.' where id='.$id; + $result = $wpdb->query($wpdb->prepare($sql)); + //WPD_print('Result for '.$sql.' is '.$result); + + } + $message = 'Saved links\' order.'; + } + else{ + $message = 'No items to save.'; + } + $messageClass = 'updated fade'; + } } - + ?>