本文整理汇总了PHP中wp_table函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_table函数的具体用法?PHP wp_table怎么用?PHP wp_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_table函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_wp_tables
function upgrade_wp_tables()
{
global $xoopsDB;
require_once dirname(dirname(__FILE__)) . '/wp-config.php';
if ($xoopsDB->query("SHOW COLUMNS FROM " . wp_table('postmeta')) == false) {
$sql1 = "CREATE TABLE " . wp_table('postmeta') . " (\n\t\t\t\t\t\tmeta_id int(11) NOT NULL auto_increment,\n\t\t\t\t\t\tpost_id int(11) NOT NULL default '0',\n\t\t\t\t\t\tmeta_key varchar(255) default NULL,\n\t\t\t\t\t\tmeta_value text,\n\t\t\t\t\t\tPRIMARY KEY\t (meta_id),\n\t\t\t\t\t\tKEY post_id (post_id),\n\t\t\t\t\t\tKEY meta_key (meta_key)\n\t\t\t\t\t)";
$xoopsDB->query($sql1);
$GLOBALS['msgs'][] = "TABLE " . wp_table('postmeta') . " is added.";
}
if (!$xoopsDB->getRowsNum($xoopsDB->query("SHOW COLUMNS FROM " . wp_table('comments') . " LIKE 'comment_type'"))) {
$sql1 = "ALTER TABLE " . wp_table('comments') . " ADD (\n\t\t\t\t\t\tcomment_agent varchar(255) NOT NULL default '',\n\t\t\t\t\t\tcomment_type varchar(20) NOT NULL default '',\n\t\t\t\t\t\tcomment_parent int(11) NOT NULL default '0',\n\t\t\t\t\t\tuser_id int(11) NOT NULL default '0'\n\t\t\t\t\t)";
$xoopsDB->query($sql1);
$GLOBALS['msgs'][] = "TABLE " . wp_table('comments') . " is modified.";
}
$sql1 = "ALTER TABLE " . wp_table('options') . " CHANGE \n\t\t\t\t\toption_value option_value longtext NOT NULL default ''\n\t\t\t\t";
$xoopsDB->query($sql1);
$GLOBALS['msgs'][] = "TABLE " . wp_table('options') . " is modified.";
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id=1");
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id=2");
$xoopsDB->query("UPDATE " . wp_table('optiongroup_options') . " SET seq=1 WHERE group_id=6 AND option_id=3");
$xoopsDB->query("UPDATE " . wp_table('optiongroup_options') . " SET seq=2 WHERE group_id=6 AND option_id=4");
$xoopsDB->query("UPDATE " . wp_table('optiongroup_options') . " SET seq=3 WHERE group_id=6 AND option_id=54");
# --------------------------------------------------------
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =7 AND option_name ='new_users_can_blog'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =7");
}
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =8 AND option_name ='users_can_register'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =8");
}
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =91 AND option_name ='gzipcompression'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =91");
}
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =27 AND option_name ='use_blodotgsping'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=3 AND option_id =27");
}
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =28 AND option_name ='blodotgsping_url'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=3 AND option_id =28");
}
if (!get_settings('use_comment_preview')) {
add_option('use_comment_preview', '0', 2, "Display Preview Screen after comment posting.", 2, 8);
}
if (!get_settings('active_plugins')) {
add_option('active_plugins', "\n");
}
if (!get_settings('check_trackback_content')) {
add_option('check_trackback_content', '0', 3, '_LANG_INST_BASE_VALUE95', 2, 8);
}
if (!get_settings('trackback_filename')) {
add_option('trackback_filename', 'wp-trackback.php', 3, 'TrackBack File Name (default wp-trackback.php)', 3, 8);
}
if (!get_settings('xmlrpc_filename')) {
add_option('xmlrpc_filename', 'xmlrpc.php', 3, 'TrackBack File Name (default xmlrpc.php)', 3, 8);
}
if (!get_settings('xmlrpc_autodetect')) {
add_option('xmlrpc_autodetect', '0', 3, 'Enable XMLRPC File Auto detection', 2, 8);
}
$date_format = get_settings('date_format');
$date_format = str_replace('\\\\d', '\\d', $date_format);
update_option('date_format', $date_format);
}
示例2: upgrade_wp_tables
function upgrade_wp_tables()
{
global $xoopsDB;
require_once dirname(dirname(__FILE__)) . '/wp-config.php';
if ($xoopsDB->query("SHOW COLUMNS FROM " . wp_table('postmeta')) == false) {
$sql1 = "CREATE TABLE " . wp_table('postmeta') . " (\n\t\t\t\t\t\tmeta_id int(11) NOT NULL auto_increment,\n\t\t\t\t\t\tpost_id int(11) NOT NULL default '0',\n\t\t\t\t\t\tmeta_key varchar(255) default NULL,\n\t\t\t\t\t\tmeta_value text,\n\t\t\t\t\t\tPRIMARY KEY\t (meta_id),\n\t\t\t\t\t\tKEY post_id (post_id),\n\t\t\t\t\t\tKEY meta_key (meta_key)\n\t\t\t\t\t)";
$xoopsDB->query($sql1);
$GLOBALS['msgs'][] = "TABLE " . wp_table('postmeta') . " is added.";
}
if (!$xoopsDB->getRowsNum($xoopsDB->query("SHOW COLUMNS FROM " . wp_table('comments') . " LIKE 'comment_type'"))) {
$sql1 = "ALTER TABLE " . wp_table('comments') . " ADD (\n\t\t\t\t\t\tcomment_agent varchar(255) NOT NULL default '',\n\t\t\t\t\t\tcomment_type varchar(20) NOT NULL default '',\n\t\t\t\t\t\tcomment_parent int(11) NOT NULL default '0',\n\t\t\t\t\t\tuser_id int(11) NOT NULL default '0'\n\t\t\t\t\t)";
$xoopsDB->query($sql1);
$GLOBALS['msgs'][] = "TABLE " . wp_table('comments') . " is modified.";
}
# --------------------------------------------------------
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =7 AND option_name ='new_users_can_blog'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =7");
}
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =8 AND option_name ='users_can_register'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =8");
}
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =91 AND option_name ='gzipcompression'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =91");
}
if (!get_settings('use_comment_preview')) {
add_option('use_comment_preview', '0', 2, "Display Preview Screen after comment posting.", 2, 8);
}
if (!get_settings('active_plugins')) {
add_option('active_plugins', "\n");
}
}
示例3: update_links
/**
** update_links()
** Update in the db the links which have been updated ($all_links[url][1] != 0)
**/
function update_links()
{
global $all_links;
reset($all_links);
while (list($id, $val) = each($all_links)) {
if ($val[1]) {
$GLOBALS['wpdb']->query("UPDATE " . wp_table('links') . " SET link_updated = '{$val['1']}' WHERE link_id = {$val['0']}");
}
}
// end while
}
示例4: wpbl_notify
function wpbl_notify($comment_id, $reason, $harvest)
{
global $wbbl_comment;
$tableposts = wp_table('posts');
$sql = "SELECT * FROM {$tableposts} WHERE ID='{$wbbl_comment['comment_post_ID']}' LIMIT 1";
$post = $GLOBALS['wpdb']->get_row($sql);
if (!empty($wpbl_comment['comment_author_IP'])) {
$comment_author_domain = gethostbyaddr($wpbl_comment['comment_author_IP']);
} else {
$comment_author_domain = '';
}
// create the e-mail body
$notify_message = "A new ";
if ($wpbl_comment['comment_type'] == '') {
$notify_message .= "Comment";
} else {
if ($wpbl_comment['comment_type'] == 'trackback') {
$notify_message .= "TrackBack";
} else {
if ($wpbl_comment['comment_type'] == 'pingback') {
$notify_message .= "PingBack";
}
}
}
$notify_message .= " on post #{$wbbl_comment['comment_post_ID']} \"" . stripslashes($post->post_title) . "\" has been automatically deleted by the WPBlacklist plugin.\r\n\r\n";
$notify_message .= "Author : {$wpbl_comment['comment_author']} (IP: {$wpbl_comment['comment_author_IP']} , {$comment_author_domain})\r\n";
$notify_message .= "E-mail : {$wpbl_comment['comment_author_email']}\r\n";
$notify_message .= "URL : {$wpbl_comment['comment_author_url']}\r\n";
$notify_message .= "Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput={$wpbl_comment['comment_author_IP']}\r\n";
$notify_message .= "Comment:\r\n" . stripslashes($wpbl_comment['comment_content']) . "\r\n\r\n";
$notify_message .= "Triggered by : {$reason}\r\n\r\n";
// add harvested info - if there is any
if (!empty($harvest)) {
$notify_message .= "Harvested the following information:\r\n" . stripslashes($harvest);
}
// e-mail header
$subject = '[' . stripslashes(get_settings('blogname')) . '] Automatically deleted: "' . stripslashes($post->post_title) . '"';
$admin_email = get_settings("admin_email");
$from = "From: {$admin_email}";
if (strtolower(get_settings('blog_charset')) == "euc-jp") {
$mail_charset = "iso-2022-jp";
} else {
$mail_charset = get_settings('blog_charset');
}
$message_headers = "MIME-Version: 1.0\r\n" . "{$from}\r\n" . "Content-Type: text/plain; charset=\"" . $mail_charset . "\"\r\n";
// send e-mail
if (function_exists('mb_send_mail')) {
mb_send_mail($admin_email, $subject, $notify_message, $from);
} else {
@mail($admin_email, $subject, $notify_message, $from);
}
return true;
}
示例5: show_author_select
function show_author_select()
{
$users = $GLOBALS['wpdb']->get_results("SELECT * FROM " . wp_table('users') . " WHERE user_level > 0", ARRAY_A);
$output = '<option value="">' . _LANG_NKA_ALL_AUTHOR . '</option>' . NL;
foreach ($users as $user) {
$output .= '<option value="' . $user['ID'] . '"';
if ($user['ID'] == $GLOBALS['author']) {
$output .= 'selected="selected"';
}
$output .= '>' . $user['user_nickname'] . '</option>' . NL;
}
$output = '<select name="author">' . NL . $output . '</select>' . NL;
echo $output;
}
示例6: wp_xoops_search
function wp_xoops_search($queryarray, $andor, $limit, $offset, $userid, $wp_num = "")
{
$GLOBALS['use_cache'] = 1;
if ($wp_num == "") {
$GLOBALS['wp_id'] = $wp_num;
$GLOBALS['wp_inblock'] = 1;
require XOOPS_ROOT_PATH . "/modules/wordpress/wp-config.php";
$GLOBALS['wp_inblock'] = 0;
}
$now = date('Y-m-d H:i:s', time() + get_settings('time_difference') * 3600);
$where = "(post_status = 'publish') AND (post_date <= '" . $now . "')";
if (is_array($queryarray) && ($count = count($queryarray))) {
$where .= " AND ((post_title LIKE '%{$queryarray['0']}%' OR post_content LIKE '%{$queryarray['0']}%')";
for ($i = 1; $i < $count; $i++) {
$where .= " {$andor} ";
$where .= "(post_title LIKE '%{$queryarray[$i]}%' OR post_content LIKE '%{$queryarray[$i]}%')";
}
$where .= ") ";
}
if ($userid) {
$userid = intval($userid);
$where .= " AND (post_author=" . $userid . ")";
}
$request = "SELECT * FROM " . wp_table('posts') . " WHERE " . $where;
$request .= " ORDER BY post_date DESC";
$result = $GLOBALS['xoopsDB']->query($request, $limit, $offset);
$ret = array();
$i = 0;
while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) {
$ret[$i]['link'] = str_replace(wp_siteurl() . "/", "", get_permalink($myrow['ID']));
$ret[$i]['title'] = htmlspecialchars($myrow['post_title'], ENT_QUOTES);
$ret[$i]['image'] = "wp-images/search.png";
$date_str = $myrow['post_date'];
$yyyy = substr($date_str, 0, 4);
$mm = substr($date_str, 5, 2);
$dd = substr($date_str, 8, 2);
$hh = substr($date_str, 11, 2);
$nn = substr($date_str, 15, 2);
$ss = substr($date_str, 17, 2);
$ret[$i]['time'] = mktime($hh, $nn, $ss, $mm, $dd, $yyyy);
$ret[$i]['uid'] = $myrow['post_author'];
$ret[$i]['page'] = $myrow['post_title'];
if (!empty($myrow['post_content']) && function_exists('xoops_make_context')) {
$ret[$i]['context'] = xoops_make_context(strip_tags($myrow['post_content']), $queryarray);
}
$i++;
}
return $ret;
}
示例7: show_author_select
function show_author_select()
{
global $wpdb, $tableusers, $author;
$users = $wpdb->get_results("SELECT * FROM " . wp_table('users') . " WHERE user_level > 0", ARRAY_A);
$output .= '<option value="">全投稿者</option>' . NL;
foreach ($users as $user) {
$output .= '<option value="' . $user['ID'] . '"';
if ($user['ID'] == $author) {
$output .= 'selected="selected"';
}
$output .= '>' . $user['user_nickname'] . '</option>' . NL;
}
$output = '<select name="author">' . NL . $output . '</select>' . NL;
echo $output;
}
示例8: _wp_xoops_search
function _wp_xoops_search($queryarray, $andor, $limit, $offset, $userid)
{
$now = current_time('mysql');
$where = '(post_status = \'publish\') AND (post_date <= \'' . $now . '\')';
if (is_array($queryarray) && ($count = count($queryarray))) {
$where .= " AND ((post_title LIKE '%{$queryarray['0']}%' OR post_content LIKE '%{$queryarray['0']}%')";
for ($i = 1; $i < $count; $i++) {
$where .= " {$andor} ";
$where .= "(post_title LIKE '%{$queryarray[$i]}%' OR post_content LIKE '%{$queryarray[$i]}%')";
}
$where .= ') ';
}
if ($userid) {
$userid = intval($userid);
$where .= ' AND (post_author=' . $userid . ')';
}
$request = 'SELECT * FROM ' . wp_table('posts') . ' WHERE ' . $where;
$request .= ' ORDER BY post_date DESC';
$result = $GLOBALS['xoopsDB']->query($request, $limit, $offset);
$ret = array();
$i = 0;
while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) {
$ret[$i]['link'] = str_replace(wp_siteurl() . '/', '', get_permalink($myrow['ID']));
$ret[$i]['title'] = htmlspecialchars($myrow['post_title'], ENT_QUOTES);
$ret[$i]['image'] = 'wp-images/search.png';
$date_str = $myrow['post_date'];
$yyyy = substr($date_str, 0, 4);
$mm = substr($date_str, 5, 2);
$dd = substr($date_str, 8, 2);
$hh = substr($date_str, 11, 2);
$nn = substr($date_str, 15, 2);
$ss = substr($date_str, 17, 2);
$ret[$i]['time'] = mktime($hh, $nn, $ss, $mm, $dd, $yyyy);
$ret[$i]['uid'] = $myrow['post_author'];
$ret[$i]['page'] = $myrow['post_title'];
if (!empty($myrow['post_content']) && function_exists('xoops_make_context')) {
$ret[$i]['context'] = xoops_make_context(strip_tags($myrow['post_content']), $queryarray);
}
if (!empty($myrow['post_content']) && function_exists('search_make_context')) {
if (!empty($_GET['showcontext']) && $_GET['showcontext'] == 1) {
$ret[$i]['context'] = search_make_context(strip_tags($myrow['post_content']), $queryarray);
}
}
$i++;
}
return $ret;
}
示例9: validate_option
function validate_option($option, $name, $val)
{
global $wpdb;
$msg = '';
switch ($option->option_type) {
case 6:
// range
// get range
$range = $wpdb->get_row("SELECT optionvalue_max, optionvalue_min FROM " . wp_table('optionvalues') . " WHERE option_id = {$option->option_id}");
if ($range) {
if ($val < $range->optionvalue_min || $val > $range->optionvalue_max) {
$msg = "{$name} is outside the valid range ({$range->optionvalue_min} - {$range->optionvalue_max}). ";
}
}
}
// end switch
return $msg;
}
示例10: apply_filters
function apply_filters($tag, $string)
{
if (isset($GLOBALS['wp_filter'][wp_id()]['all'])) {
foreach ($GLOBALS['wp_filter'][wp_id()]['all'] as $priority => $functions) {
if (isset($GLOBALS['wp_filter'][wp_id()][$tag][$priority])) {
$GLOBALS['wp_filter'][wp_id()][$tag][$priority] = array_merge($GLOBALS['wp_filter'][wp_id()]['all'][$priority], $GLOBALS['wp_filter'][wp_id()][$tag][$priority]);
} else {
$GLOBALS['wp_filter'][wp_id()][$tag][$priority] = array_merge($GLOBALS['wp_filter'][wp_id()]['all'][$priority], array());
}
$GLOBALS['wp_filter'][wp_id()][$tag][$priority] = array_unique($GLOBALS['wp_filter'][wp_id()][$tag][$priority]);
}
}
if (isset($GLOBALS['wp_filter'][wp_id()][$tag])) {
ksort($GLOBALS['wp_filter'][wp_id()][$tag]);
/* Keep Plugin Comatibility */
$tables = array('posts', 'users', 'categories', 'post2cat', 'comments', 'links', 'linkcategories', 'options', 'optiontypes', 'optionvalues', 'optiongroups', 'optiongroup_options', 'postmeta', 'settings');
$oldtables = array();
foreach ($tables as $table) {
if (isset($GLOBALS['table' . $table])) {
$oldtables[$table] = $GLOBALS['table' . $table];
}
$GLOBALS['table' . $table] = wp_table($table);
}
foreach ($GLOBALS['wp_filter'][wp_id()][$tag] as $priority => $functions) {
foreach ($functions as $function) {
// echo "<br/>$tag - $function <br>";
$string = $function($string);
// echo $string;
}
}
foreach ($tables as $table) {
unset($GLOBALS['table' . $table]);
}
foreach ($oldtables as $table => $value) {
$GLOBALS['table' . $table] = $value;
}
}
return $string;
}
示例11: list_cats
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children = FALSE, $child_of = 0, $categoryObjects = null, $recurse = 0, $feed = '', $feed_image = '', $exclude = '', $hierarchical = FALSE, $echo = true)
{
$list_cats = '';
// Optiondates now works
if ('' == $file) {
$file = wp_siteurl() . '/index.php';
}
$excludeCriteria = null;
if (!empty($exclude)) {
$excats = preg_split('/[\\s,]+/', $exclude);
if (count($excats)) {
$excludeCriteria = new CriteriaCompo();
foreach ($excats as $excat) {
$exclusions .= ' AND cat_ID <> ' . intval($excat) . ' ';
$excludeCriteria->add(new Criteria('cat_ID', $excat, '!='));
$catc = trim(get_category_children($excat, '', ' '));
$catc_array = explode(' ', $catc);
for ($i = 0; $i < count($catc_array); $i++) {
$excludeCriteria->add(new Criteria('category_id', intval($catc_array[$i]), '!='));
}
}
}
}
$categoryHandler =& wp_handler('Category');
if (!$categoryObjects) {
$criteria =& new CriteriaCompo(new Criteria('cat_ID', 0, '>'));
if ($excludeCriteria) {
$criteria->add($excludeCriteria);
}
$criteria->setSort('cat_' . $sort_column);
$criteria->setOrder($sort_order);
$categoryObjects =& $categoryHandler->getObjects($criteria, false, 'cat_ID, cat_name, category_nicename, category_description cat_description, category_parent');
}
if (empty($GLOBALS['category_posts']) || !count($GLOBALS['category_posts'])) {
$criteria =& new CriteriaCompo('post_status', 'publish');
if ($excludeCriteria) {
$criteria->add($excludeCriteria);
}
$criteria->setGroupBy('category_id');
$joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'cat_ID', 'category_id', 'INNER');
$joinCriteria->cascade(new XoopsJoinCriteria(wp_table('posts'), 'post_id', 'ID', 'INNER'));
$categoryPostsObjects =& $categoryHandler->getObjects($criteria, false, 'cat_ID, COUNT(' . wp_table('post2cat') . '.post_id) AS cat_count', false, $joinCriteria);
if ($categoryPostsObjects) {
foreach ($categoryPostsObjects as $categoryObject) {
if (intval($hide_empty) != 1 || $categoryObject->getExtraVar('cat_count') > 0) {
$GLOBALS['category_posts'][$categoryObject->getVar('cat_ID')] = $categoryObject->getExtraVar('cat_count');
}
}
}
}
if (intval($optiondates) == 1) {
$criteria =& new CriteriaCompo('post_status', 'publish');
if ($excludeCriteria) {
$criteria->add($excludeCriteria);
}
$criteria->setGroupBy('category_id');
$joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'cat_ID', 'category_id', 'INNER');
$joinCriteria->cascade(new XoopsJoinCriteria(wp_table('posts'), 'post_id', 'ID', 'INNER'));
$categoryDateObjects =& $categoryHandler->getObjects($criteria, false, 'cat_ID, DAYOFMONTH(MAX(post_date)) AS lastday,
MONTH(MAX(post_date)) AS lastmonth', false, $joinCriteria);
foreach ($categoryDateObjects as $categoryObject) {
$category_lastday["" . $categoryObject->getVar('cat_ID')] = $categoryObject->getExtraVar('lastday');
$category_lastmonth["" . $categoryObject->getVar('cat_ID')] = $categoryObject->getExtraVar('lastmonth');
}
}
if (intval($optionall) == 1 && !$child_of && $categoryObjects) {
$all = apply_filters('list_cats', $all);
$link = "<a href=\"" . $file . '?cat=all">' . $all . "</a>";
if ($list) {
$list_cats .= "\n\t<li>{$link}</li>";
} else {
$list_cats .= "\t{$link}<br />\n";
}
}
$num_found = 0;
$thelist = "";
foreach ($categoryObjects as $categoryObject) {
$category = $categoryObject->exportWpObject();
$child_list = '';
if ((!$hierarchical || $category->category_parent == $child_of) && ($children || $category->category_parent == 0)) {
if ($hierarchical && $children) {
$child_list = list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $hierarchical, $category->cat_ID, $categoryObjects, 1, $feed, $feed_image, $exclude, $hierarchical);
}
if (intval($hide_empty) == 0 || isset($GLOBALS['category_posts']["{$category->cat_ID}"]) || $child_list) {
$num_found++;
$link = '<a href="' . get_category_link(0, $category->cat_ID, $category->category_nicename) . '" ';
if ($use_desc_for_title == 0 || empty($category->cat_description)) {
$link .= 'title="' . sprintf("View all posts filed under %s", htmlspecialchars($category->cat_name)) . '"';
} else {
$link .= 'title="' . htmlspecialchars(strip_tags($category->cat_description)) . '"';
}
$link .= '>';
$link .= apply_filters('list_cats', $category->cat_name) . '</a>';
if (!empty($feed_image) || !empty($feed)) {
$link .= ' ';
if (empty($feed_image)) {
$link .= '(';
}
$link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"';
if (!empty($feed)) {
//.........这里部分代码省略.........
示例12: draft_list
function draft_list($user_ID)
{
if ($GLOBALS['user_level'] == 10) {
$drafts = $GLOBALS['wpdb']->get_results("SELECT ID, post_title FROM " . wp_table('posts') . " WHERE post_status = 'draft'");
} else {
$drafts = $GLOBALS['wpdb']->get_results("SELECT ID, post_title FROM " . wp_table('posts') . " WHERE post_status = 'draft' AND post_author = {$user_ID}");
}
if ($drafts) {
?>
<div class="wrap">
<p><strong><?php
echo _LANG_P_YOUR_DRAFTS;
?>
</strong>
<?php
$i = 0;
foreach ($drafts as $draft) {
$delim = 0 != $i ? ', ' : '';
$draft->post_title = $draft->post_title;
if ($draft->post_title == '') {
$draft->post_title = 'Post #' . $draft->ID;
}
++$i;
?>
<?php
echo $delim;
?>
<a href='post.php?action=edit&post=<?php
echo $draft->ID;
?>
' title='Edit this draft'><?php
echo $draft->post_title;
?>
</a>
<?php
}
?>
.</p>
</div>
<?php
}
}
示例13: array
}
// This array constructs the admin menu bar.
//
// Menu item name
// The minimum level the user needs to access the item: between 0 and 10
// The URL of the item's file
$menu[5] = array(_LANG_ADMIN_MENU_WRITE, 1, 'post.php');
$menu[10] = array(_LANG_ADMIN_MENU_EDIT, 1, 'edit.php');
$menu[20] = array(_LANG_ADMIN_MENU_CATE, 3, 'categories.php');
$menu[25] = array(_LANG_ADMIN_MENU_LINK, 5, 'link-manager.php');
$menu[30] = array(_LANG_ADMIN_MENU_USER, 3, 'users.php');
$menu[35] = array(_LANG_ADMIN_MENU_OPTION, 6, 'options.php');
$menu[40] = array(_LANG_ADMIN_MENU_PLUG, 8, 'plugins.php');
$menu[45] = array(_LANG_ADMIN_MENU_PROFILE, 1, 'profile.php');
ksort($menu);
// So other files can plugin
$submenu['edit.php'][5] = array(_LANG_E_LATEST_POSTS, 1, 'edit.php');
$submenu['edit.php'][20] = array(_LANG_E_LATEST_COMMENTS, 1, 'edit-comments.php');
$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM " . wp_table('comments') . " WHERE comment_approved = '0'");
$submenu['edit.php'][25] = array(sprintf(_LANG_E_AWAIT_MODER . " (%s)", $awaiting_mod), 1, 'moderation.php');
$submenu['link-manager.php'][5] = array(_LANG_WLA_MANAGE_LINK, 5, 'link-manager.php');
$submenu['link-manager.php'][10] = array(_LANG_WLA_ADD_LINK, 5, 'link-add.php');
$submenu['link-manager.php'][15] = array(_LANG_WLA_LINK_CATE, 5, 'link-categories.php');
$submenu['link-manager.php'][20] = array(_LANG_WLA_IMPORT_BLOG, 5, 'link-import.php');
$option_groups = $wpdb->get_results("\n\t\t\t\t\t\t\tSELECT group_id, group_name, group_desc, group_longdesc \n\t\t\t\t\t\t\tFROM " . wp_table('optiongroups') . " ORDER BY group_id\n\t\t\t\t\t\t");
$submenu['options.php'] = array();
foreach ($option_groups as $option_group) {
$submenu['options.php'][] = array($option_group->group_name, 6, "options.php?option_group_id={$option_group->group_id}");
}
$submenu['options.php'][] = array(_LANG_WOP_PERM_LINKS, 9, 'options-permalink.php');
do_action('admin_menu', '');
示例14: harvest
function harvest($commentID)
{
global $wpdb;
$tableblacklist = $GLOBALS['xoopsDB']->prefix("wp_blacklist");
$info = '';
$details = $wpdb->get_row("SELECT * FROM " . wp_table('comments') . " WHERE comment_ID = {$commentID}");
if ($details) {
// Add author e-mail to blacklist - if it isn't blank
if (!empty($details->comment_author_email)) {
$buf = sanctify($details->comment_author_email);
$request = $wpdb->get_row("SELECT id FROM {$tableblacklist} WHERE regex='{$buf}'");
if (!$request) {
$wpdb->query("INSERT INTO {$tableblacklist} (regex, regex_type) VALUES ('{$buf}','url')");
$info .= "Author e-mail: {$details->comment_author_email}\r\n";
}
}
// Add author IP to blacklist
$buf = sanctify($details->comment_author_IP);
$request = $wpdb->get_row("SELECT id FROM {$tableblacklist} WHERE regex='{$buf}'");
if (!$request) {
$wpdb->query("INSERT INTO {$tableblacklist} (regex, regex_type) VALUES ('{$buf}','ip')");
$info .= "Author IP: {$details->comment_author_IP}\r\n";
}
// get the author's url without the prefix stuff - if it isn't blank
if (!empty($details->comment_author_url)) {
$regex = "/([a-z]*)(:\\/\\/)([a-z]*\\.)?(.*)/i";
preg_match($regex, $details->comment_author_url, $matches);
if (strcasecmp('www.', $matches[3]) == 0) {
$buf = $matches[4];
} else {
$buf = $matches[3] . $matches[4];
}
$buf = remove_trailer($buf);
$buf = sanctify($buf);
$request = $wpdb->get_row("SELECT id FROM {$tableblacklist} WHERE regex='{$buf}'");
if (!$request) {
$wpdb->query("INSERT INTO {$tableblacklist} (regex, regex_type) VALUES ('{$buf}','url')");
$info .= "Author URL: {$buf}\r\n";
}
}
// harvest links found in comment
$regex = "/([a-z]*)(:\\/\\/)([a-z]*\\.)?([^\"><\\s]*)/im";
preg_match_all($regex, $details->comment_content, $matches);
for ($i = 0; $i < count($matches[4]); $i++) {
if (strcasecmp('www.', $matches[3][$i]) == 0) {
$buf = $matches[4][$i];
} else {
$buf = $matches[3][$i] . $matches[4][$i];
}
$ps = strrpos($buf, '/');
if ($ps) {
$buf = substr($buf, 0, $ps);
}
$buf = remove_trailer($buf);
$buf = sanctify($buf);
$request = $wpdb->get_row("SELECT id FROM {$tableblacklist} WHERE regex='{$buf}'");
if (!$request) {
$wpdb->query("INSERT INTO {$tableblacklist} (regex, regex_type) VALUES ('{$buf}','url')");
$info .= "Comment URL: {$buf}\r\n";
}
}
// for
}
return $info;
}
示例15: tkzy_get_recent_comments
function tkzy_get_recent_comments($limit = 10, $cat_date = 1, $show_type = 1)
{
$comment_lenth = 30;
$request = "SELECT ID, post_title, post_date, \n\t\tcomment_ID, comment_author, comment_author_url, comment_author_email, comment_date, comment_content \n\t\tFROM " . wp_table('posts') . ", " . wp_table('comments') . " WHERE " . wp_table('posts') . ".ID=" . wp_table('comments') . ".comment_post_ID AND " . wp_table('comments') . ".comment_approved='1'";
if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 1) {
$request .= "AND (comment_content like '<trackback />%' OR comment_content like '<pingkback />%') ";
}
$request .= " ORDER BY " . wp_table('comments') . ".comment_date DESC LIMIT {$limit}";
$lcomments = $GLOBALS['wpdb']->get_results($request);
$output = '';
if ($lcomments) {
usort($lcomments, "sort_comment_by_date");
}
$new_post_ID = -1;
if ($lcomments) {
$output .= "<ul class='wpBlockList'>";
foreach ($lcomments as $lcomment) {
if ($lcomment->ID != $new_post_ID) {
// next post
if ($new_post_ID != -1) {
$output .= "\t</ul>\n</li>\n";
}
$post_title = stripslashes($lcomment->post_title);
if (trim($post_title) == "") {
$post_title = _WP_POST_NOTITLE;
}
$comment_content = strip_tags($lcomment->comment_content);
$comment_content = stripslashes($comment_content);
if (function_exists('mb_substr')) {
$comment_excerpt = mb_substr($comment_content, 0, $comment_lenth);
} else {
$comment_excerpt = substr($comment_content, 0, $comment_lenth);
}
$permalink = wp_siteurl() . "/index.php?p={$lcomment->ID}&c=1";
$output .= "<li>";
$output .= "<span class='comment-title'><a href=\"{$permalink}\">{$post_title}</a></span>\n";
$output .= "\t<ul class=\"children\" style=\"list-style-type: none;\">\n";
$new_post_ID = $lcomment->ID;
}
$output .= "\t\t<li>";
if ($cat_date) {
$comment_date = $lcomment->comment_date;
if (time() - mysql2date('U', $comment_date) < 60 * 60 * 24) {
# within 24 hours
$comment_date = mysql2date('H:i', $comment_date);
} else {
$comment_date = mysql2date('m/d', $comment_date);
}
$output .= "<span class=\"post-date\">{$comment_date}</span> : ";
}
$output .= "<span class=\"comment_author\">" . tkzy_get_comment_author_link($lcomment, 25) . "</span></li>\n";
if (preg_match('|<trackback />|', $lcomment->comment_content)) {
$type = '[TrackBack]';
} elseif (preg_match('|<pingback />|', $lcomment->comment_content)) {
$type = '[Ping]';
} else {
$type = '[Comment]';
}
if ($show_type) {
$output .= "<span style=\"font-size:90%\"> - {$type}</span>";
}
}
}
$output .= "\t</ul>\n</li>\n</ul>\n";
return $output;
}