XPressME Integration Kit

Trac

Changeset 447 for trunk


Ignore:
Timestamp:
Nov 20, 2009, 11:14:16 AM (15 years ago)
Author:
toemon
Message:

#234 の対策で不要になった関数dropdown_cats_options()を削除

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/blocks/block_common.php

    r436 r447  
    1515    return $form; 
    1616         
    17 } 
    18 endif; 
    19  
    20 if(!function_exists("dropdown_cats_options")): 
    21 function dropdown_cats_options($sort_column = 'ID', $sort_order = 'asc', $selected=array())  
    22 { 
    23     $mydirpath = dirname(dirname(__FILE__)); 
    24         $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; 
    25         if ($mydirname == 'wordpress'){ 
    26                 $wp_prefix = 'wp_'; 
    27         } else { 
    28                 $wp_prefix = $mydirname . '_'; 
    29         } 
    30         $xoopsDB =& Database::getInstance(); 
    31         $myts =& MyTextSanitizer::getInstance(); 
    32     $selected = is_array($selected)?$selected:array($selected); 
    33     $sort_column = 'cat_'.$sort_column; 
    34         include $mydirpath.'/wp-includes/version.php'; 
    35         if ($wp_db_version < 6124) { 
    36                 $db_xpress_categories = $xoopsDB->prefix($wp_prefix . 'categories'); 
    37                 $query = " 
    38                 SELECT cat_ID, cat_name, category_nicename,category_parent  
    39                 FROM $db_xpress_categories  
    40                 WHERE cat_ID > 0  
    41                 "; 
    42                 $query .= " ORDER BY $sort_column $sort_order"; 
    43  
    44     } else { 
    45         $db_xpress_terms = $xoopsDB->prefix($wp_prefix . 'terms'); 
    46         $db_xpress_term_taxonomy = $xoopsDB->prefix($wp_prefix . 'term_taxonomy'); 
    47         $query = " 
    48                         SELECT $db_xpress_terms.term_id as cat_ID , $db_xpress_terms.name as cat_name , $db_xpress_term_taxonomy.taxonomy  
    49                         FROM $db_xpress_terms LEFT JOIN $db_xpress_term_taxonomy ON $db_xpress_terms.term_id = $db_xpress_term_taxonomy.term_id  
    50                         WHERE $db_xpress_term_taxonomy.taxonomy = 'category'  
    51         "; 
    52                 $query .= " ORDER BY $sort_column $sort_order"; 
    53     } 
    54         $res =  $xoopsDB->query($query, 0, 0); 
    55     if ($res !== false){ 
    56                 while($row = $xoopsDB->fetchArray($res)){ 
    57             $cat_name = $row['cat_name']; 
    58             $cat_ID = $row['cat_ID']; 
    59             echo "\t<option value=\"".$cat_ID."\""; 
    60             if (in_array($cat_ID, $selected)) 
    61                 echo ' selected="selected"'; 
    62             echo '>'; 
    63             echo $myts->htmlspecialchars($cat_name); 
    64             echo "</option>\n"; 
    65         } 
    66     } 
    67     return; 
    6817} 
    6918endif; 
Note: See TracChangeset for help on using the changeset viewer.