当前位置: 首页>>代码示例>>PHP>>正文


PHP _tag_row函数代码示例

本文整理汇总了PHP中_tag_row函数的典型用法代码示例。如果您正苦于以下问题:PHP _tag_row函数的具体用法?PHP _tag_row怎么用?PHP _tag_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_tag_row函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: link_cat_row

                 echo link_cat_row($updated['term_id']);
             } else {
                 die(__('Category not updated.'));
             }
             break;
         case 'tag':
             $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
             $tag = get_term($id, $taxonomy);
             $_POST['description'] = $tag->description;
             $updated = wp_update_term($id, $taxonomy, $_POST);
             if ($updated && !is_wp_error($updated)) {
                 $tag = get_term($updated['term_id'], $taxonomy);
                 if (!$tag || is_wp_error($tag)) {
                     die(__('Tag not updated.'));
                 }
                 echo _tag_row($tag, '', $taxonomy);
             } else {
                 die(__('Tag not updated.'));
             }
             break;
     }
     exit;
     break;
 case 'find_posts':
     check_ajax_referer('find-posts');
     if (empty($_POST['ps'])) {
         exit;
     }
     $what = isset($_POST['pages']) ? 'page' : 'post';
     $s = stripslashes($_POST['ps']);
     preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:31,代码来源:admin-ajax.php

示例2: tag_rows

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 * @param unknown_type $pagesize
 * @param unknown_type $searchterms
 * @return unknown
 */
function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {

	// Get a page worth of tags
	$start = ($page - 1) * $pagesize;

	$args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);

	if ( !empty( $searchterms ) ) {
		$args['search'] = $searchterms;
	}

	$tags = get_terms( 'post_tag', $args );

	// convert it to table rows
	$out = '';
	$count = 0;
	foreach( $tags as $tag )
		$out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' );

	// filter and send to screen
	echo $out;
	return $count;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:33,代码来源:template.php

示例3: wp_update_term

         case 'link-cat':
             $updated = wp_update_term($id, 'link_category', $_POST);
             if ($updated && !is_wp_error($updated)) {
                 echo link_cat_row($updated['term_id']);
             } else {
                 die(__('Category not updated.'));
             }
             break;
         case 'tag':
             $updated = wp_update_term($id, 'post_tag', $_POST);
             if ($updated && !is_wp_error($updated)) {
                 $tag = get_term($updated['term_id'], 'post_tag');
                 if (!$tag || is_wp_error($tag)) {
                     die(__('Tag not updated.'));
                 }
                 echo _tag_row($tag);
             } else {
                 die(__('Tag not updated.'));
             }
             break;
     }
     exit;
     break;
 case 'meta-box-order':
     check_ajax_referer('meta-box-order');
     update_user_option($GLOBALS['current_user']->ID, "meta-box-order_{$_POST['page']}", $_POST['order']);
     die('1');
     break;
 case 'find_posts':
     check_ajax_referer('find-posts');
     if (empty($_POST['ps'])) {
开发者ID:SymbiSoft,项目名称:litprojects,代码行数:31,代码来源:admin-ajax.php

示例4: get_term

			$tag = get_term( $id, $taxonomy );
			$_POST['description'] = $tag->description;

			$updated = wp_update_term($id, $taxonomy, $_POST);
			if ( $updated && !is_wp_error($updated) ) {
				$tag = get_term( $updated['term_id'], $taxonomy );
				if ( !$tag || is_wp_error( $tag ) ) {
					if ( is_wp_error($tag) && $tag->get_error_message() )
						die( $tag->get_error_message() );
					die( __('Item not updated.') );
				}

				set_current_screen( 'edit-' . $taxonomy );

				echo _tag_row($tag, 0, $taxonomy);
			} else {
				if ( is_wp_error($updated) && $updated->get_error_message() )
					die( $updated->get_error_message() );
				die( __('Item not updated.') );
			}

			break;
	}

	exit;
	break;
case 'find_posts':
	check_ajax_referer( 'find-posts' );

	if ( empty($_POST['ps']) )
开发者ID:realfluid,项目名称:umbaugh,代码行数:30,代码来源:admin-ajax.php

示例5: WP_Ajax_Response

     }
     if ('' === trim($_POST['name'])) {
         $x = new WP_Ajax_Response(array('what' => 'tag', 'id' => new WP_Error('name', __('You did not enter a tag name.'))));
         $x->send();
     }
     $tag = wp_insert_term($_POST['name'], 'post_tag', $_POST);
     if (is_wp_error($tag)) {
         $x = new WP_Ajax_Response(array('what' => 'tag', 'id' => $tag));
         $x->send();
     }
     if (!$tag || !($tag = get_term($tag['term_id'], 'post_tag'))) {
         die('0');
     }
     $tag_full_name = $tag->name;
     $tag_full_name = attribute_escape($tag_full_name);
     $x = new WP_Ajax_Response(array('what' => 'tag', 'id' => $tag->term_id, 'data' => _tag_row($tag), 'supplemental' => array('name' => $tag_full_name, 'show-link' => sprintf(__('Tag <a href="#%s">%s</a> added'), "tag-{$tag->term_id}", $tag_full_name))));
     $x->send();
     break;
 case 'add-comment':
     check_ajax_referer($action);
     if (!current_user_can('edit_post', $id)) {
         die('-1');
     }
     $search = isset($_POST['s']) ? $_POST['s'] : false;
     $start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1 : 24;
     $status = isset($_POST['comment_status']) ? $_POST['comment_status'] : false;
     $mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail';
     list($comments, $total) = _wp_get_comment_list($status, $search, $start, 1);
     if (!$comments) {
         die('1');
     }
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:admin-ajax.php

示例6: attribute_escape

			'what' => 'tag',
			'id' => $tag
		) );
		$x->send();
	}

	if ( !$tag || (!$tag = get_term( $tag['term_id'], 'post_tag' )) )
		die('0');

	$tag_full_name = $tag->name;
	$tag_full_name = attribute_escape($tag_full_name);

	$x = new WP_Ajax_Response( array(
		'what' => 'tag',
		'id' => $tag->term_id,
		'data' => _tag_row( $tag ),
		'supplemental' => array('name' => $tag_full_name, 'show-link' => sprintf(__( 'Tag <a href="#%s">%s</a> added' ), "tag-$tag->term_id", $tag_full_name))
	) );
	$x->send();
	break;
case 'add-comment' :
	check_ajax_referer( $action );
	if ( !current_user_can( 'edit_post', $id ) )
		die('-1');
	$search = isset($_POST['s']) ? $_POST['s'] : false;
	$start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1: 24;
	$status = isset($_POST['comment_status']) ? $_POST['comment_status'] : false;
	$mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail';

	list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1 );
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:30,代码来源:admin-ajax.php

示例7: _term_rows

function _term_rows($taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0)
{
    $start = ($page - 1) * $per_page;
    $end = $start + $per_page;
    $output = '';
    foreach ($terms as $key => $term) {
        if ($count >= $end) {
            break;
        }
        if ($term->parent != $parent && empty($_GET['s'])) {
            continue;
        }
        // If the page starts in a subtree, print the parents.
        if ($count == $start && $term->parent > 0 && empty($_GET['s'])) {
            $my_parents = $parent_ids = array();
            $p = $term->parent;
            while ($p) {
                $my_parent = get_term($p, $taxonomy);
                $my_parents[] = $my_parent;
                $p = $my_parent->parent;
                if (in_array($p, $parent_ids)) {
                    // Prevent parent loops.
                    break;
                }
                $parent_ids[] = $p;
            }
            unset($parent_ids);
            $num_parents = count($my_parents);
            while ($my_parent = array_pop($my_parents)) {
                $output .= "\t" . _tag_row($my_parent, $level - $num_parents, $taxonomy);
                $num_parents--;
            }
        }
        if ($count >= $start) {
            $output .= "\t" . _tag_row($term, $level, $taxonomy);
        }
        ++$count;
        unset($terms[$key]);
        if (isset($children[$term->term_id]) && empty($_GET['s'])) {
            $output .= _term_rows($taxonomy, $terms, $children, $page, $per_page, $count, $term->term_id, $level + 1);
        }
    }
    return $output;
}
开发者ID:hacklabr,项目名称:toquenobrasil,代码行数:44,代码来源:template.php


注:本文中的_tag_row函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。