mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
Giant commit, sorry mailing list people. Move all table names to new $wpdb versions. Works but the whole app needs thorough testing now.
git-svn-id: https://develop.svn.wordpress.org/trunk@1355 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+21
-22
@@ -26,9 +26,9 @@ function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
|
||||
$between = " ", $show_images = true, $orderby = 'id',
|
||||
$show_description = true, $show_rating = false,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
global $tablelinkcategories, $wpdb;
|
||||
global $wpdb;
|
||||
$cat_id = -1;
|
||||
$results = $wpdb->get_results("SELECT cat_id FROM $tablelinkcategories WHERE cat_name='$cat_name'");
|
||||
$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$cat_id = $result->cat_id;
|
||||
@@ -49,11 +49,11 @@ function bool_from_yn($yn) {
|
||||
** category (no default) - The category to use.
|
||||
**/
|
||||
function wp_get_linksbyname($category) {
|
||||
global $wpdb, $tablelinkcategories;
|
||||
global $wpdb;
|
||||
|
||||
$cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
||||
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
||||
. " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_name='$category'");
|
||||
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_name='$category'");
|
||||
if ($cat) {
|
||||
if ($cat->sort_desc == 'Y') {
|
||||
$cat->sort_order = '_'.$cat->sort_order;
|
||||
@@ -71,11 +71,11 @@ function wp_get_linksbyname($category) {
|
||||
** category (no default) - The category to use.
|
||||
**/
|
||||
function wp_get_links($category) {
|
||||
global $wpdb, $tablelinkcategories;
|
||||
global $wpdb;
|
||||
|
||||
$cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
||||
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
||||
. " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_id=$category");
|
||||
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_id=$category");
|
||||
if ($cat) {
|
||||
if ($cat->sort_desc == 'Y') {
|
||||
$cat->sort_order = '_'.$cat->sort_order;
|
||||
@@ -114,7 +114,7 @@ function get_links($category = -1, $before = '', $after = '<br />',
|
||||
$show_description = true, $show_rating = false,
|
||||
$limit = -1, $show_updated = 1, $echo = true) {
|
||||
|
||||
global $tablelinks, $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
$direction = ' ASC';
|
||||
$category_query = "";
|
||||
@@ -155,7 +155,7 @@ function get_links($category = -1, $before = '', $after = '<br />',
|
||||
|
||||
$sql = "SELECT link_url, link_name, link_image, link_target,
|
||||
link_description, link_rating, link_rel $length $recently_updated_test $get_updated
|
||||
FROM $tablelinks
|
||||
FROM $wpdb->links
|
||||
WHERE link_visible = 'Y' " .
|
||||
$category_query;
|
||||
$sql .= ' ORDER BY ' . $orderby;
|
||||
@@ -277,9 +277,9 @@ function get_links($category = -1, $before = '', $after = '<br />',
|
||||
** }
|
||||
**/
|
||||
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
|
||||
global $tablelinkcategories, $wpdb;
|
||||
global $wpdb;
|
||||
$cat_id = -1;
|
||||
$results = $wpdb->get_results("SELECT cat_id FROM $tablelinkcategories WHERE cat_name='$cat_name'");
|
||||
$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$cat_id = $result->cat_id;
|
||||
@@ -324,9 +324,9 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
|
||||
** link_notes
|
||||
**/
|
||||
function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
|
||||
global $tablelinks, $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
$sql = "SELECT * FROM $tablelinks WHERE link_visible = 'Y'";
|
||||
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
|
||||
if ($category != -1) {
|
||||
$sql .= " AND link_category = $category ";
|
||||
}
|
||||
@@ -459,10 +459,10 @@ function get_links_withrating($category = -1, $before = '', $after = '<br />',
|
||||
** uses 0
|
||||
*/
|
||||
function get_linkcatname($id = 0) {
|
||||
global $tablelinkcategories, $wpdb;
|
||||
global $wpdb;
|
||||
$cat_name = '';
|
||||
if ('' != $id) {
|
||||
$cat_name = $wpdb->get_var("SELECT cat_name FROM $tablelinkcategories WHERE cat_id=$id");
|
||||
$cat_name = $wpdb->get_var("SELECT cat_name FROM $wpdb->linkcategories WHERE cat_id=$id");
|
||||
}
|
||||
return stripslashes($cat_name);
|
||||
}
|
||||
@@ -473,8 +473,8 @@ function get_linkcatname($id = 0) {
|
||||
** uses 0
|
||||
*/
|
||||
function get_autotoggle($id = 0) {
|
||||
global $tablelinkcategories, $wpdb;
|
||||
$auto_toggle = $wpdb->get_var("SELECT auto_toggle FROM $tablelinkcategories WHERE cat_id=$id");
|
||||
global $wpdb;
|
||||
$auto_toggle = $wpdb->get_var("SELECT auto_toggle FROM $wpdb->linkcategories WHERE cat_id=$id");
|
||||
if ('' == $auto_toggle)
|
||||
$auto_toggle = 'N';
|
||||
return $auto_toggle;
|
||||
@@ -492,9 +492,8 @@ function get_autotoggle($id = 0) {
|
||||
*/
|
||||
function links_popup_script($text = 'Links', $width=400, $height=400,
|
||||
$file='links.all.php', $count = true) {
|
||||
global $tablelinks;
|
||||
if ($count == true) {
|
||||
$counts = $wpdb->get_var("SELECT count(*) FROM $tablelinks");
|
||||
$counts = $wpdb->get_var("SELECT count(*) FROM $wpdb->links");
|
||||
}
|
||||
|
||||
$javascript = "<a href=\"#\" " .
|
||||
@@ -518,7 +517,7 @@ function links_popup_script($text = 'Links', $width=400, $height=400,
|
||||
* added by Dougal
|
||||
*
|
||||
* Output a list of all links, listed by category, using the
|
||||
* settings in $tablelinkcategories and output it as a nested
|
||||
* settings in $wpdb->linkcategories and output it as a nested
|
||||
* HTML unordered list.
|
||||
*
|
||||
* Parameters:
|
||||
@@ -526,7 +525,7 @@ function links_popup_script($text = 'Links', $width=400, $height=400,
|
||||
* hide_if_empty (default true) - Supress listing empty link categories
|
||||
*/
|
||||
function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
|
||||
global $tablelinkcategories, $tablelinks, $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
$order = strtolower($order);
|
||||
|
||||
@@ -545,8 +544,8 @@ function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
|
||||
SELECT DISTINCT link_category, cat_name, show_images,
|
||||
show_description, show_rating, show_updated, sort_order,
|
||||
sort_desc, list_limit
|
||||
FROM `$tablelinks`
|
||||
LEFT JOIN `$tablelinkcategories` ON (link_category = cat_id)
|
||||
FROM `$wpdb->links`
|
||||
LEFT JOIN `$wpdb->linkcategories` ON (link_category = cat_id)
|
||||
WHERE link_visible = 'Y'
|
||||
AND list_limit <> 0
|
||||
ORDER BY $cat_order $direction ", ARRAY_A);
|
||||
|
||||
Reference in New Issue
Block a user