• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_category_to_edit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: check_admin_referer

        check_admin_referer();
        if (!current_user_can('manage_categories')) {
            die(__('Cheatin’ uh?'));
        }
        $cat_ID = (int) $_GET['cat_ID'];
        $cat_name = get_catname($cat_ID);
        if (1 == $cat_ID) {
            die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
        }
        wp_delete_category($cat_ID);
        header('Location: categories.php?message=2');
        break;
    case 'edit':
        require_once 'admin-header.php';
        $cat_ID = (int) $_GET['cat_ID'];
        $category = get_category_to_edit($cat_ID);
        ?>

<div class="wrap">
 <h2><?php 
        _e('Edit Category');
        ?>
</h2>
 <form name="editcat" action="categories.php" method="post">
	  <table class="editform" width="100%" cellspacing="2" cellpadding="5">
		<tr>
		  <th width="33%" scope="row"><?php 
        _e('Category name:');
        ?>
</th>
		  <td width="67%"><input name="cat_name" type="text" value="<?php 
开发者ID:robertlange81,项目名称:Website,代码行数:31,代码来源:categories.php


示例2: _cat_row

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $category
 * @param unknown_type $level
 * @param unknown_type $name_override
 * @return unknown
 */
function _cat_row( $category, $level, $name_override = false ) {
	static $row_class = '';

	$category = get_category( $category, OBJECT, 'display' );

	$default_cat_id = (int) get_option( 'default_category' );
	$pad = str_repeat( '&#8212; ', $level );
	$name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
	$edit_link = "categories.php?action=edit&amp;cat_ID=$category->term_id";
	if ( current_user_can( 'manage_categories' ) ) {
		$edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />';
		$actions = array();
		$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
		$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
		if ( $default_cat_id != $category->term_id )
			$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
		$action_count = count($actions);
		$i = 0;
		$edit .= '<div class="row-actions">';
		foreach ( $actions as $action => $link ) {
			++$i;
			( $i == $action_count ) ? $sep = '' : $sep = ' | ';
			$edit .= "<span class='$action'>$link$sep</span>";
		}
		$edit .= '</div>';
	} else {
		$edit = $name;
	}

	$row_class = 'alternate' == $row_class ? '' : 'alternate';
	$qe_data = get_category_to_edit($category->term_id);

	$category->count = number_format_i18n( $category->count );
	$posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
	$output = "<tr id='cat-$category->term_id' class='iedit $row_class'>";

	$columns = get_column_headers('categories');
	$hidden = get_hidden_columns('categories');
	foreach ( $columns as $column_name => $column_display_name ) {
		$class = "class=\"$column_name column-$column_name\"";

		$style = '';
		if ( in_array($column_name, $hidden) )
			$style = ' style="display:none;"';

		$attributes = "$class$style";

		switch ($column_name) {
			case 'cb':
				$output .= "<th scope='row' class='check-column'>";
				if ( $default_cat_id != $category->term_id ) {
					$output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
				} else {
					$output .= "&nbsp;";
				}
				$output .= '</th>';
				break;
			case 'name':
				$output .= "<td $attributes>$edit";
				$output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
				$output .= '<div class="name">' . $qe_data->name . '</div>';
				$output .= '<div class="slug">' . $qe_data->slug . '</div>';
				$output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
				break;
			case 'description':
				$output .= "<td $attributes>$category->description</td>";
				break;
			case 'slug':
				$output .= "<td $attributes>$category->slug</td>";
				break;
			case 'posts':
				$attributes = 'class="posts column-posts num"' . $style;
				$output .= "<td $attributes>$posts_count</td>\n";
		}
	}
	$output .= '</tr>';

	return $output;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:89,代码来源:template.php


示例3: powerpressadmin_edit_itunes_feed


//.........这里部分代码省略.........
			 </p>
			 <p>
			 <?php 
        echo __('Learn more:', 'powerpress');
        ?>
 <a href="http://create.blubrry.com/manual/syndicating-your-podcast-rss-feeds/changing-your-podcast-rss-feed-address-url/" target="_blank"><?php 
        echo __('Changing Your Podcast RSS Feed Address (URL)', 'powerpress');
        ?>
</a>
			</p>
		</div>
		<div id="new_feed_url_step_2" style="display: <?php 
        echo !empty($FeedSettings['itunes_new_feed_url']) || !empty($FeedSettings['itunes_new_feed_url_podcast']) ? 'block' : 'none';
        ?>
;">
			<p style="margin-top: 5px;"><strong><?php 
        echo __('WARNING: Changes made here are permanent. If the New Feed URL entered is incorrect, you will lose subscribers and will no longer be able to update your listing in the iTunes Store.', 'powerpress');
        ?>
</strong></p>
			<p><strong><?php 
        echo __('DO NOT MODIFY THIS SETTING UNLESS YOU ABSOLUTELY KNOW WHAT YOU ARE DOING.', 'powerpress');
        ?>
</strong></p>
			<p>
				<?php 
        echo htmlspecialchars(sprintf(__('Apple recommends you maintain the %s tag in your feed for at least two weeks to ensure that most subscribers will receive the new New Feed URL.', 'powerpress'), '<itunes:new-feed-url>'));
        ?>
			</p>
			<p>
			<?php 
        $FeedName = __('Main RSS2 feed', 'powerpress');
        $FeedURL = get_feed_link('rss2');
        if ($cat_ID) {
            $category = get_category_to_edit($cat_ID);
            $FeedName = sprintf(__('%s category feed', 'powerpress'), htmlspecialchars($category->name));
            $FeedURL = get_category_feed_link($cat_ID);
        } else {
            if ($feed_slug) {
                if (!empty($General['custom_feeds'][$feed_slug])) {
                    $FeedName = $General['custom_feeds'][$feed_slug];
                } else {
                    $FeedName = __('Podcast', 'powerpress');
                }
                $FeedName = trim($FeedName) . ' ' . __('feed', 'powerpress');
                $FeedURL = get_feed_link($feed_slug);
            } else {
                if ($FeedAttribs['type'] == 'ttid') {
                    $term_object = get_term_to_edit($FeedAttribs['term_id'], $FeedAttribs['taxonomy_type']);
                    $FeedName = sprintf(__('%s taxonomy term feed', 'powerpress'), htmlspecialchars($term_object->name));
                    $FeedURL = get_term_feed_link($FeedAttribs['term_id'], $FeedAttribs['taxonomy_type'], 'rss2');
                }
            }
        }
        echo sprintf(__('The New Feed URL value below will be applied to the %s (%s).', 'powerpress'), $FeedName, $FeedURL);
        ?>
			</p>
			<p style="margin-bottom: 0;">
				<label style="width: 25%; float:left; display:block; font-weight: bold;"><?php 
        echo __('New Feed URL', 'powerpress');
        ?>
</label>
				<input type="text" name="Feed[itunes_new_feed_url]" style="width: 55%;"  value="<?php 
        echo esc_attr($FeedSettings['itunes_new_feed_url']);
        ?>
" maxlength="250" />
			</p>
开发者ID:ajay786singh,项目名称:emc,代码行数:67,代码来源:powerpressadmin-editfeed.php


示例4: powerpress_admin_categoryfeeds

function powerpress_admin_categoryfeeds()
{
    $General = powerpress_get_settings('powerpress_general');
    ?>
<h2><?php 
    echo __('Category Podcasting', 'powerpress');
    ?>
</h2>
<p>
	<?php 
    echo __('Category Podcasting adds custom podcast settings to specific blog category feeds, allowing you to organize episodes by topic.', 'powerpress');
    ?>
</p>
<p>
	<?php 
    echo sprintf(__('If you are looking to organize episodes by file or format, please use %s.', 'powerpress'), '<a href="' . admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php') . '" title="' . __('Custom Podcast Channels') . '">' . __('Custom Podcast Channels') . '</a>');
    ?>
</p><style type="text/css">
.column-url {
	width: 40%;
}
.column-name {
	width: 30%;
}
.column-feed-slug {
	width: 15%;
}
.column-episode-count {
	width: 15%;
}
.category-list {
	width: 100%;
}
</style>
<div id="col-container">

<div id="col-right">
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php 
    print_column_headers('powerpressadmin_categoryfeeds');
    ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php 
    print_column_headers('powerpressadmin_categoryfeeds', false);
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    $Feeds = array();
    if (isset($General['custom_cat_feeds'])) {
        $Feeds = $General['custom_cat_feeds'];
    }
    $count = 0;
    while (list($null, $cat_ID) = each($Feeds)) {
        if (empty($cat_ID)) {
            continue;
        }
        $category = get_category_to_edit($cat_ID);
        if (is_wp_error($category)) {
            // $cat_ID does not existing
            continue;
        }
        //var_dump($category);
        $columns = powerpress_admin_customfeeds_columns();
        $hidden = array();
        if ($count % 2 == 0) {
            echo '<tr valign="middle" class="alternate">';
        } else {
            echo '<tr valign="middle">';
        }
        $edit_link = admin_url('admin.php?page=powerpress/powerpressadmin_categoryfeeds.php&amp;action=powerpress-editcategoryfeed&amp;cat=') . $cat_ID;
        $feed_title = $category->name;
        $url = get_category_feed_link($cat_ID);
        $short_url = str_replace('http://', '', $url);
        $short_url = str_replace('www.', '', $short_url);
        if (strlen($short_url) > 35) {
            $short_url = substr($short_url, 0, 32) . '...';
        }
        foreach ($columns as $column_name => $column_display_name) {
            $class = "class=\"column-{$column_name}\"";
            //$short_url = '';
            switch ($column_name) {
                case 'feed-slug':
                    echo "<td {$class}>{$category->slug}";
                    echo "</td>";
                    break;
                case 'name':
                    echo '<td ' . $class . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit "%s"', 'powerpress'), $feed_title)) . '">' . esc_html($feed_title) . '</a></strong><br />';
                    $actions = array();
                    $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit', 'powerpress') . '</a>';
                    $actions['remove'] = "<a class='submitdelete' href='" . admin_url() . wp_nonce_url("admin.php?page=powerpress/powerpressadmin_categoryfeeds.php&amp;action=powerpress-delete-category-feed&amp;cat={$cat_ID}", 'powerpress-delete-category-feed-' . $cat_ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to remove podcast settings for category feed '%s'\n  'Cancel' to stop, 'OK' to delete.", 'powerpress'), esc_html($feed_title))) . "') ) { return true;}return false;\">" . __('Remove', 'powerpress') . "</a>";
                    $action_count = count($actions);
                    $i = 0;
//.........这里部分代码省略.........
开发者ID:mattsims,项目名称:powerpress,代码行数:101,代码来源:powerpressadmin-categoryfeeds.php


示例5: _cat_row

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $category
 * @param unknown_type $level
 * @param unknown_type $name_override
 * @return unknown
 */
function _cat_row($category, $level, $name_override = false)
{
    static $row_class = '';
    $category = get_category($category, OBJECT, 'display');
    $default_cat_id = (int) get_option('default_category');
    $pad = str_repeat('&#8212; ', max(0, $level));
    $name = $name_override ? $name_override : $pad . ' ' . $category->name;
    $edit_link = "categories.php?action=edit&amp;cat_ID={$category->term_id}";
    if (current_user_can('manage_categories')) {
        $edit = "<a class='row-title' href='{$edit_link}' title='" . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $category->name)) . "'>" . esc_attr($name) . '</a><br />';
        $actions = array();
        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
        if ($default_cat_id != $category->term_id) {
            $actions['delete'] = "<a class='delete:the-list:cat-{$category->term_id} submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID={$category->term_id}", 'delete-category_' . $category->term_id) . "'>" . __('Delete') . "</a>";
        }
        $actions = apply_filters('cat_row_actions', $actions, $category);
        $action_count = count($actions);
        $i = 0;
        $edit .= '<div class="row-actions">';
        foreach ($actions as $action => $link) {
            ++$i;
            $i == $action_count ? $sep = '' : ($sep = ' | ');
            $edit .= "<span class='{$action}'>{$link}{$sep}</span>";
        }
        $edit .= '</div>';
    } else {
        $edit = $name;
    }
    $row_class = 'alternate' == $row_class ? '' : 'alternate';
    $qe_data = get_category_to_edit($category->term_id);
    $category->count = number_format_i18n($category->count);
    $posts_count = $category->count > 0 ? "<a href='edit.php?cat={$category->term_id}'>{$category->count}</a>" : $category->count;
    $output = "<tr id='cat-{$category->term_id}' class='iedit {$row_class}'>";
    $columns = get_column_headers('categories');
    $hidden = get_hidden_columns('categories');
    foreach ($columns as $column_name => $column_display_name) {
        $class = "class=\"{$column_name} column-{$column_name}\"";
        $style = '';
        if (in_array($column_name, $hidden)) {
            $style = ' style="display:none;"';
        }
        $attributes = "{$class}{$style}";
        switch ($column_name) {
            case 'cb':
                $output .= "<th scope='row' class='check-column'>";
                if ($default_cat_id != $category->term_id) {
                    $output .= "<input type='checkbox' name='delete[]' value='{$category->term_id}' />";
                } else {
                    $output .= "&nbsp;";
                }
                $output .= '</th>';
                break;
            case 'name':
                $output .= "<td {$attributes}>{$edit}";
                $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
                $output .= '<div class="name">' . $qe_data->name . '</div>';
                $output .= '<div class="slug">' . $qe_data->slug . '</div>';
                $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
                break;
            case 'description':
                $output .= "<td {$attributes}>{$category->description}</td>";
                break;
            case 'slug':
                $output .= "<td {$attributes}>{$category->slug}</td>";
                break;
            case 'posts':
                $attributes = 'class="posts column-posts num"' . $style;
                $output .= "<td {$attributes}>{$posts_count}</td>\n";
                break;
            default:
                $output .= "<td {$attributes}>";
                $output .= apply_filters('manage_categories_custom_column', '', $column_name, $category->term_id);
                $output .= "</td>";
        }
    }
    $output .= '</tr>';
    return $output;
}
开发者ID:bluedanbob,项目名称:wordpress,代码行数:89,代码来源:template.php


示例6: bm_caticons_adminicons

/**
 * Display the icons panel in Icons tab
 * @author Brahim MACHKOURI
 */
function bm_caticons_adminicons()
{
    // I took some of the code from categories.php of WordPress 2.5 and modified it a little
    global $wpdb;
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
    if (isset($_GET['deleteit']) && isset($_GET['delete'])) {
        $action = 'bulk-delete';
    }
    switch ($action) {
        case 'update-category-icon':
            $cat_ID = (int) $_GET['cat_ID'];
            $priority = $_REQUEST['ig_priority'];
            $icon = $_REQUEST['ig_icon'];
            $small_icon = $_REQUEST['ig_small_icon'];
            if ($wpdb->get_var($wpdb->prepare("SELECT cat_id FROM {$wpdb->ig_caticons} WHERE cat_id='{$cat_ID}'"))) {
                $wpdb->query($wpdb->prepare("UPDATE {$wpdb->ig_caticons} SET priority='{$priority}', icon='{$icon}', small_icon='{$small_icon}' WHERE cat_id='{$cat_ID}'"));
            } else {
                $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->ig_caticons} (cat_id, priority, icon, small_icon) VALUES ('{$cat_ID}', '{$priority}', '{$icon}', '{$small_icon}')"));
            }
            break;
        case 'delete':
            $cat_ID = (int) $_GET['cat_ID'];
            if (!is_admin() || !current_user_can('manage_categories')) {
                wp_die(__('Are you trying to cheat ?', 'category_icons'));
            }
            $cat_name = get_catname($cat_ID);
            $request = "DELETE FROM {$wpdb->ig_caticons} WHERE cat_id='{$cat_ID}'";
            if (false === $wpdb->query($wpdb->prepare($request))) {
                wp_die(__('Error in Category Icons', 'category_icons') . ' : ' . $request);
            }
            break;
        case 'bulk-delete':
            if (!is_admin() || !current_user_can('manage_categories')) {
                wp_die(__('You are not allowed to delete category icons.', 'category_icons'));
            }
            foreach ((array) $_GET['delete'] as $cat_ID) {
                $cat_name = get_catname($cat_ID);
                $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->ig_caticons} WHERE cat_id='{$cat_ID}'"));
            }
            break;
    }
    switch ($action) {
        case 'edit':
            $cat_ID = (int) $_GET['cat_ID'];
            $category = get_category_to_edit($cat_ID);
            list($priority, $icon, $small_icon) = bm_caticons_get_icons($cat_ID);
            ?>
		<div class="wrap">
		<h2><?php 
            _e('Select Category Icons', 'category_icons');
            ?>
</h2>
		<form method="post" name="caticons-form1" action="">
		  <?php 
            wp_nonce_field('caticons-nonce');
            ?>
			<input type="hidden" name="ig_module" value="caticons" />
			<input type="hidden" name="ig_tab" value="icons" />
			<input type="hidden" name="action" value="update-category-icon" />
            <table  border="0" class="form-table">
                <tr>
                    <th scope="row" style="vertical-align:text-top;"><?php 
            _e('Category ID', 'category_icons');
            ?>
</th>
                    <td colspan="2" ><?php 
            echo $cat_ID;
            ?>
</td>
                </tr>
                <tr>
                    <th scope="row" style="vertical-align:text-top;"><?php 
            _e('Name', 'category_icons');
            ?>
</th>
                    <td colspan="2"><?php 
            echo $category->name;
            ?>
</td>
                </tr>
                <tr>
                    <th scope="row" class="num" style="vertical-align:text-top;"><?php 
            _e('Priority', 'category_icons');
            ?>
</th>
                    <td colspan="2">
                        <input type="text" name="ig_priority" size="5" value="<?php 
            echo $priority;
            ?>
" />
                    </td>
                </tr>
                <tr>
                    <th scope="row" style="vertical-align:text-top;"><?php 
            _e('Icon', 'category_icons');
            ?>
//.........这里部分代码省略.........
开发者ID:SayenkoDesign,项目名称:gogo-racing.com,代码行数:101,代码来源:category_icons.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_catname函数代码示例发布时间:2022-05-15
下一篇:
PHP get_category_template函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap