Esempio n. 1
0
function _cat_row($category, $level, $name_override = false)
{
    global $class;
    $pad = str_repeat('— ', $level);
    if (current_user_can('manage_categories')) {
        $edit = "<a href='categories.php?action=edit&amp;cat_ID={$category->term_id}' class='edit'>" . __('Edit') . "</a></td>";
        $default_cat_id = (int) get_option('default_category');
        if ($category->term_id != $default_cat_id) {
            $edit .= "<td><a href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID={$category->term_id}", 'delete-category_' . $category->term_id) . "' onclick=\"return deleteSomething( 'cat', {$category->term_id}, '" . js_escape(sprintf(__("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop."), $category->name, get_catname($default_cat_id), get_catname($default_link_cat_id))) . "' );\" class='delete'>" . __('Delete') . "</a>";
        } else {
            $edit .= "<td style='text-align:center'>" . __("Default");
        }
    } else {
        $edit = '';
    }
    $class = defined('DOING_AJAX') && DOING_AJAX || " class='alternate'" == $class ? '' : " class='alternate'";
    $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}>\n\t\t<th scope='row' style='text-align: center'>{$category->term_id}</th>\n\t\t<td>" . ($name_override ? $name_override : $pad . ' ' . $category->name) . "</td>\n\t\t<td>{$category->description}</td>\n\t\t<td align='center'>{$posts_count}</td>\n\t\t<td>{$edit}</td>\n\t</tr>\n";
    return apply_filters('cat_row', $output);
}
Esempio n. 2
0
function display_entry($post)
{
    $category = get_catname($post->category);
    ?>
	<h3><?php 
    echo $post->title;
    ?>
</h3>
	<a href="<?php 
    echo 'http://127.0.0.1/blog/show_cat.php?id=' . $post->category;
    ?>
"><p><?php 
    echo $category;
    ?>
</p></a>
	<p><?php 
    echo $post->body;
    ?>
</p>
<?php 
    echo "<hr>";
}
Esempio n. 3
0
 function getAllCats($force = false)
 {
     /*
      * gets all published site categories (same format as getAllTags)
      */
     if (is_null($this->_allcats) || $force) {
         global $wpdb;
         $q = "SELECT p2c.category_id AS cat_id, COUNT(p2c.rel_id) AS numposts,\r\n                    UNIX_TIMESTAMP(max(p.post_date_gmt)) + '" . get_option('gmt_offset') . "' AS last_post_date,\r\n                    UNIX_TIMESTAMP(max(p.post_date_gmt)) AS last_post_date_gmt\r\n                FROM {$wpdb->post2cat} p2c\r\n                INNER JOIN {$wpdb->posts} p ON p2c.post_id=p.id\r\n                WHERE (p.post_status='publish' OR p.post_status='static')\r\n                  AND p.post_date_gmt<='" . gmdate("Y-m-d H:i:s", time()) . "'\r\n                GROUP BY p2c.category_id\r\n                ORDER BY numposts DESC ";
         $results = $wpdb->get_results($q);
         $allcats = array();
         if (!is_null($results) && is_array($results)) {
             foreach ($results as $cat) {
                 $catname = get_catname($cat->cat_id);
                 $allcats[$catname] = array('name' => get_catname($cat->cat_id), 'count' => $cat->numposts, 'link' => get_category_link((int) $cat->cat_id));
             }
         }
         $this->_allcats =& $allcats;
     }
     return $this->_allcats;
 }
case 'delete-page' :
	$id = (int) $_POST['id'];
	if ( !current_user_can('edit_post', $id) )	{
		die('-1');
	}

	if ( wp_delete_post($id) ) {
		die('1');
	} else	die('0');
	break;
case 'delete-cat' :
	if ( !current_user_can('manage_categories') )
		die ('-1');

	$id = (int) $_POST['id'];
	$cat_name = get_catname($cat_ID);

	if ( wp_delete_category($id) )
		die('1');
	else	die('0');
	break;
case 'delete-comment' :
	$id = (int) $_POST['id'];

	if ( !$comment = get_comment($id) )
		die('0');
	if ( !current_user_can('edit_post', $comment->comment_post_ID) )	
		die('-1');

	if ( wp_delete_comment($comment->comment_ID) ) {
		die('1');
function cfgp_clone_post_on_publish($post_id, $post)
{
    global $wpdb;
    /* Allow for draft, pending, trash as well as publish - a published post can transition into these */
    if (!in_array($post->post_status, array('publish', 'draft', 'pending', 'trash'))) {
        return;
    }
    /* Get the Shadow Blog's ID */
    $cfgp_blog_id = cfgp_get_shadow_blog_id();
    /* Get the current blog's id */
    $current_blog_id = $wpdb->blogid;
    /* Check to see if we're inserting the post, or updating an existing */
    $clone_post_id = cfgp_are_we_inserting($post->ID);
    /* Get all the post_meta for current post */
    $all_post_meta = get_post_custom($post->ID);
    /* Grab the Permalink of the post, so the shadow blog knows how to get back to the post */
    $permalink = get_permalink($post->ID);
    switch_to_blog($cfgp_blog_id);
    /************
     * POST WORK *
     ************/
    $old_post_id = $post->ID;
    $clone_id = cfgp_do_the_post($post, $clone_post_id);
    $post->ID = $old_post_id;
    /****************
     * CATEGORY WORK *
     ****************/
    /* Grab category names that the current post belongs to. */
    if (isset($_POST['post_category']) && is_array($_POST['post_category']) && count($_POST['post_category']) > 0) {
        /* Post has categories */
        $cur_cats = $_POST['post_category'];
    } else {
        /* Post doesn't have any categories, assign to 'Uncategorized' */
        $cur_cats = array(get_cat_ID('Uncategorized'));
    }
    /* We have id's, now get the names */
    foreach ($cur_cats as $cat) {
        $cur_cats_names[] = get_catname($cat);
    }
    /* Add categories to clone post */
    $cat_results = cfgp_do_categories($clone_id, $cur_cats_names);
    /***********
     * TAG WORK *
     ***********/
    /* tags changed in 2.8, so we need to see if we're >= 2.8 */
    global $wp_version;
    if (version_compare($wp_version, '2.8', '>=')) {
        $tags = $_POST['tax_input']['post_tag'];
    } else {
        $tags = $_POST['tags_input'];
    }
    /* Add tags to clone post */
    $tag_results = cfgp_do_tags($clone_id, $tags);
    /******************
     * MORE TAXONOMIES *
     ******************/
    do_action('cfgp_clone_post_taxonomies', compact('clone_id', 'post'));
    /*****************
     * POST META WORK *
     *****************/
    /* Add original post's postmeta to clone post */
    $post_meta_results = apply_filters('cfgp_do_post_meta', array(), $clone_id, $current_blog_id, $all_post_meta, $permalink, $old_post_id);
    restore_current_blog();
    /* Add post_meta to the original
     * 	post of the clone's post id */
    update_post_meta($post->ID, '_cfgp_clone_id', $clone_id);
    /* This is a handy array of results, for troubleshooting
     * 	they're not returned on post publish, but can be put
     * 	out to the error log */
    $single_post_results[] = array('original_post' => $post->ID, 'clone_id' => $clone_id, 'cat_results' => $cat_results, 'tag_results' => $tag_results, 'post_meta_results' => $post_meta_results);
}
function archive_header($before = '', $after = '')
{
    global $post, $orderby, $month, $previous, $siteurl, $blogfilename, $archiveheadstart, $archiveheadend, $category_name;
    $orderby = explode(' ', $orderby);
    $orderby = $orderby[0];
    if ('date' == $orderby || empty($orderby)) {
        $thismonth = mysql2date('m', $post->post_date);
        $thisyear = mysql2date('Y', $post->post_date);
        $thisdate = $thisyear . $thismonth;
        if ($thisdate != $previous) {
            $thismonth = mysql2date('m', $post->post_date);
            $output .= '<strong><br/><a href="' . get_month_link($thisyear, $thismonth) . '">' . $thisyear . '年' . $month[$thismonth] . '</a></strong>';
        }
        $previous = $thisdate;
    } elseif ('title' == $orderby) {
        $thisletter = ucfirst(mb_substr($post->yomi, 0, 1, $GLOBALS['blog_charset']));
        if ($thisletter > "ん") {
            $thisletter = "漢字";
        }
        if ($thisletter != $previous) {
            $output .= "<br/>" . $thisletter;
        }
        $previous = $thisletter;
    } elseif ('category' == $orderby) {
        $thiscategory = $category_name;
        if ($thiscategory != $previous) {
            $output .= '<br/><strong><a href="' . get_category_link(false, $thiscategory) . '">' . get_catname($thiscategory) . '</a></strong>';
        }
        $previous = $thiscategory;
    }
    if (!empty($output)) {
        $output = $before . $output . $after . NL;
        echo $output;
    }
}
}
$cats = get_all_category_ids();
if (!$cats) {
    echo "<p align='center'><strong>No Categories Found</strong></p>";
    return;
}
?>
<fieldset class='move_options'>
  <table width="100%" cellpadding="3" cellspacing="3" style="text-align: left; vertical-align: top;">
  <form method='POST'>
  <tr class="alternate"><th width="75%">Category</th><th width="25%">Destination</th></tr>
<input type='hidden' name='wpadp_move_options' value='update'>
  <?php 
foreach ($cats as $i => $value) {
    echo "<tr>";
    $catname = get_catname($cats[$i]);
    if ($cats[$i] == $selCat) {
        $preMod = "<strong>";
        $postMod = "</strong>";
        $checked = "checked='checked'";
    } else {
        $preMod = "";
        $postMod = "";
        $checked = "";
    }
    echo "<td>{$preMod}{$catname}{$postMod}</td>";
    echo "<td><input type='radio' name='{$inputName}' value='{$cats[$i]}' {$checked}></td>";
    echo "</tr>";
}
?>
<tr><td align='right' colspan='2'><input type='submit' 	name='submit' value='Update Options'></td></tr>
function archive_header($before = '', $after = '')
{
    $GLOBALS['orderby'] = explode(' ', $GLOBALS['orderby']);
    $GLOBALS['orderby'] = $GLOBALS['orderby'][0];
    if ('date' == $GLOBALS['orderby'] || empty($GLOBALS['orderby'])) {
        $thismonth = mysql2date('m', $GLOBALS['post']->post_date);
        $thisyear = mysql2date('Y', $GLOBALS['post']->post_date);
        $thisdate = $thisyear . $thismonth;
        if ($thisdate != $GLOBALS['previous']) {
            $thismonth = mysql2date('m', $GLOBALS['post']->post_date);
            $monthstr = ereg_replace('%MONTH', $GLOBALS['month'][zeroise($thismonth, 2)], $GLOBALS['wp_month_format']);
            $monthstr = ereg_replace('%YEAR', sprintf("%d", $thisyear), $monthstr);
            $output = '<strong><br/><a href="' . get_month_link($thisyear, $thismonth) . '">' . $monthstr . '</a></strong>';
        }
        $GLOBALS['previous'] = $thisdate;
    } elseif ('title' == $GLOBALS['orderby']) {
        if (_LANGCODE == 'ja') {
            $thisletter = ucfirst(mb_substr($GLOBALS['post']->yomi, 0, 1, $GLOBALS['blog_charset']));
            if ($thisletter > "ん") {
                $thisletter = "漢字";
            }
        } else {
            $thisletter = ucfirst(substr($GLOBALS['post']->yomi, 0, 1));
        }
        if (empty($GLOBALS['previous']) || $thisletter != $GLOBALS['previous']) {
            $output = "<br/>" . $thisletter;
        }
        $GLOBALS['previous'] = $thisletter;
    } elseif ('category' == $GLOBALS['orderby']) {
        $thiscategory = $GLOBALS['category_name'];
        if ($thiscategory != $GLOBALS['previous']) {
            $output = '<br/><strong><a href="' . get_category_link(false, $thiscategory) . '">' . get_catname($thiscategory) . '</a></strong>';
        }
        $GLOBALS['previous'] = $thiscategory;
    }
    if (!empty($output)) {
        $output = $before . $output . $after . NL;
        echo $output;
    }
}
/**
 * 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');
            ?>
</th>
                    <td valign="top"><label><?php 
            _e('Select a file : ', 'category_icons');
            ?>
</label>
                        <select name="ig_icon" onchange="icon_preview.src=('<?php 
            echo ig_caticons_url();
            ?>
/'+this.options[this.selectedIndex].value);">
                            <option value="">--- <?php 
            _e('No Icon', 'category_icons');
            ?>
 ---</option>
                            <?php 
            bm_caticons_get_icons_paths($icon);
            ?>
                        </select><br/>
                        <label><?php 
            _e('Or enter an URL : ', 'category_icons');
            ?>
<input type="text" name="bm_icon_url"/></label>
                    </td>
                    <td valign="top"><img id="icon_preview" src="<?php 
            echo ig_caticons_url() . "/{$icon}";
            ?>
" alt="icon" /></td>
                </tr>
                <tr>
                    <th scope="row" style="vertical-align:text-top;"><?php 
            _e('Small Icon', 'category_icons');
            ?>
</th>
                    <td valign="top"><label><?php 
            _e('Select a file : ', 'category_icons');
            ?>
</label>
                        <select name="ig_small_icon" onchange="small_icon_preview.src=('<?php 
            echo ig_caticons_url();
            ?>
/'+this.options[this.selectedIndex].value);">
                            <option value="">--- <?php 
            _e('No Icon', 'category_icons');
            ?>
 ---</option>
                            <?php 
            bm_caticons_get_icons_paths($small_icon);
            ?>
                        </select><br/>
                        <label><?php 
            _e('Or enter an URL : ', 'category_icons');
            ?>
<input type="text" name="bm_smallicon_url"/></label>
                    </td>
                    <td valign="top"><img id="small_icon_preview" src="<?php 
            echo ig_caticons_url() . "/{$small_icon}";
            ?>
" alt="small icon" /></td>
                </tr>
            </table>
			<div class="submit"><input type="submit" name="info_update" value="<?php 
            _e('Select Icons', 'category_icons');
            ?>
 &raquo;" /></div>
        </form>
		</div>
		<?php 
            break;
        default:
            ?>
	<div class="wrap">
        <form id="posts-filter" action="" method="get" name="caticons-form2">
        <?php 
            wp_nonce_field('caticons-nonce');
            ?>
            <input type="hidden" name="ig_module" value="caticons" />
            <input type="hidden" name="page" value="category_icons.php" />
            <input type="hidden" name="action" value="delete" />
            <input type="hidden" name="ig_tab" value="icons" />
		
		<div class="tablenav">
			<div class="alignleft">
				<input type="submit" value="<?php 
            _e('Delete icons and priority', 'category_icons');
            ?>
" name="deleteit" class="button-secondary delete" />
			</div>
			<br class="clear" />
		</div>
		<br class="clear" />
		<table class="widefat" id="caticons_table">
			<thead>
			<tr>
   				<th scope="col" id="cb" class="check-column"><input type="checkbox" /></th>
				<th scope="col"><?php 
            _e('ID', 'category_icons');
            ?>
</th>
                <th scope="col" ><?php 
            _e('Name', 'category_icons');
            ?>
</th>
                <th scope="col" style="text-align:center"><?php 
            _e('Description', 'category_icons');
            ?>
</th>
                <th scope="col" class="num" style="text-align:center"><?php 
            _e('Posts', 'category_icons');
            ?>
</th>
                <th scope="col" style="text-align:center"><?php 
            _e('Priority', 'category_icons');
            ?>
</th>
				<th scope="col" style="text-align:center"><?php 
            _e('Icon', 'category_icons');
            ?>
</th>
				<th scope="col" style="text-align:center"><?php 
            _e('Small Icon', 'category_icons');
            ?>
</th>
			</tr>
			</thead>
			<tbody id="the-list" class="list:cat">
		<?php 
            bm_caticons_rows();
            ?>
			</tbody>
		</table>
		</form>
        <div class="tablenav">
        <br class="clear" />
        </div>
        <br class="clear" />
        </div>
	<?php 
    }
    // end switch
}
function archive_header(&$post, $before = '', $after = '')
{
    static $previous = '';
    if (test_param('orderby')) {
        $orderby = explode(' ', get_param('orderby'));
        $orderby = $orderby[0];
    } else {
        $orderby = '';
    }
    switch ($orderby) {
        case 'title':
            if (_LANGCODE == 'ja') {
                $thisletter = ucfirst(mb_substring($post->yomi, 0, 1, $GLOBALS['blog_charset']));
                if ($thisletter > "¤ó") {
                    $thisletter = "´Á»ú";
                }
            } else {
                $thisletter = ucfirst(substr($post->yomi, 0, 1));
            }
            if ($thisletter == "") {
                $thisletter = _WP_POST_NOTITLE;
            }
            if ($previous === '' || $thisletter !== $previous) {
                $output = "<br/>" . $thisletter;
            }
            $previous = $thisletter;
            break;
        case 'category':
            $thiscategory = $post->cat_ID;
            if ($thiscategory != $previous) {
                $output = '<br/><strong><a href="' . get_category_link(false, $thiscategory) . '">' . get_catname($thiscategory) . '</a></strong>';
            }
            $previous = $thiscategory;
            break;
        case 'author':
            $thisauthor = $post->post_author;
            if ($thisauthor != $previous) {
                $output = '<br/><strong><a href="' . get_author_link(false, $thisauthor) . '">' . the_author('', false) . '</a></strong>';
            }
            $previous = $thisauthor;
            break;
        case 'date':
        case '':
            $thismonth = mysql2date('m', $post->post_date);
            $thisyear = mysql2date('Y', $post->post_date);
            $thisdate = $thisyear . $thismonth;
            if ($thisdate != $previous) {
                $monthstr = format_month(sprintf("%d", $thisyear), $GLOBALS['month'][zeroise($thismonth, 2)]);
                $output = '<strong><br/><a href="' . get_month_link($thisyear, $thismonth) . '">' . $monthstr . '</a></strong>';
            }
            $previous = $thisdate;
            break;
    }
    if (!empty($output)) {
        $output = $before . $output . $after . "\n";
        echo $output;
    }
}
Esempio n. 11
0
                                    <dl>
                                        <dd><a target="_blank" href="<?php 
        echo $v['url'];
        ?>
">
                                            <img src="<?php 
        echo $v['thumb'];
        ?>
" alt="<?php 
        echo $v['title'];
        ?>
" style="opacity: 1;"><?php 
        echo $v['title'];
        ?>
</a><span><?php 
        echo get_catname($v[catid]);
        ?>
</span>
                                        </dd>
                                    </dl>
                                    <?php 
        $n++;
    }
}
unset($n);
?>
                                    <!------content------>

                                </div>
                            </div>
                        </div>
</th>
	</tr>
	</thead>
	<tbody id="the-list">
<?php 
        cat_rows();
        ?>
	</tbody>
</table>

</div>

<?php 
        if (current_user_can('manage_categories')) {
            ?>
<div class="wrap">
<p><?php 
            printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and links in that category.  Instead, posts in the deleted category are set to the category <strong>%s</strong> and links are set to <strong>%s</strong>.'), get_catname(get_option('default_category')), get_catname(get_option('default_link_category')));
            ?>
</p>
</div>

<?php 
            include 'edit-category-form.php';
        }
        ?>

<?php 
        break;
}
include 'admin-footer.php';
function pp_admin_projects()
{
    global $user_identity;
    $title = __('Edit Projects', 'prologue-projects');
    if (!($project_category_id = pp_get_category_id('projects'))) {
        ?>
<div class="wrap nosubsub">
<?php 
        screen_icon();
        ?>
	<h2>
<?php 
        echo wp_specialchars($title);
        ?>
	</h2>
	<div id="message" class="updated"><p><?php 
        _e('You must <a href="admin.php?page=prologue-projects-settings">assign an existing category</a> as the container for all projects.', 'prologue-projects');
        ?>
</p></div>
</div>
<?php 
        return;
    }
    global $action;
    wp_reset_vars(array('action'));
    if (isset($_GET['action']) && isset($_GET['delete']) && ('delete' == $_GET['action'] || 'delete' == $_GET['action2'])) {
        $action = 'bulk-delete';
    }
    switch ($action) {
        case 'addproject':
            check_admin_referer('add-project');
            if (!current_user_can('manage_categories')) {
                wp_die(__('Cheatin&#8217; uh?', 'prologue-projects'));
            }
            if (pp_insert_project($_POST)) {
                wp_redirect('admin.php?page=prologue-projects&message=1#addproject');
            } else {
                wp_redirect('admin.php?page=prologue-projects&message=4#addproject');
            }
            exit;
            break;
        case 'delete':
            $project_ID = (int) $_GET['project_ID'];
            check_admin_referer('delete-project_' . $project_ID);
            if (!current_user_can('manage_categories')) {
                wp_die(__('Cheatin&#8217; uh?', 'prologue-projects'));
            }
            $project_name = get_catname($project_ID);
            // Don't delete the default cats.
            if ($project_ID == get_option('default_category')) {
                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one", 'prologue-projects'), $cat_name));
            }
            pp_delete_project($project_ID);
            wp_redirect('admin.php?page=prologue-projects&message=2');
            exit;
            break;
        case 'bulk-delete':
            check_admin_referer('bulk-projects');
            echo 1;
            if (!current_user_can('manage_categories')) {
                wp_die(__('You are not allowed to delete projects.', 'prologue-projects'));
            }
            foreach ((array) $_GET['delete'] as $project_ID) {
                $project_name = get_catname($project_ID);
                // Don't delete the default cats.
                if ($project_ID == get_option('default_category')) {
                    wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one", 'prologue-projects'), $cat_name));
                }
                pp_delete_project($project_ID);
            }
            $sendback = wp_get_referer();
            wp_redirect($sendback);
            exit;
            break;
        case 'edit':
            if (!current_user_can('manage_categories')) {
                wp_die(__('You are not allowed to edit projects.', 'prologue-projects'));
            }
            $title = __('Edit Project', 'prologue-projects');
            require_once 'admin-header.php';
            $project_ID = (int) $_GET['project_ID'];
            $project = pp_get_project_data($project_ID, 'all', 'editing');
            ?>

<div class="wrap nosubsub">
<?php 
            screen_icon();
            ?>

	<h2><?php 
            echo wp_specialchars($title);
            ?>
</h2>

<?php 
            if (isset($_GET['message']) && ($msg = (int) $_GET['message'])) {
                ?>

	<div id="message" class="updated fade"><p><?php 
                echo $messages[$msg];
                ?>
</p></div>

<?php 
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            ?>

			<div class="wrap">
				<div id="ajax-response"></div>
				<form name="addproject" id="editproject" method="post" action="admin.php?page=prologue-projects" class="validate">
					<input type="hidden" name="action" value="editedproject" />
					<input type="hidden" name="project_ID" value="<?php 
            echo $project['id'];
            ?>
" />
					<?php 
            wp_original_referer_field(true, 'previous');
            ?>
					<?php 
            wp_nonce_field('update-project_' . $project['id']);
            ?>

					<table class="form-table">
						<tr class="form-field form-required">
							<th scope="row" valign="top"><label for="project_name"><?php 
            _e('Project Name', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_name" id="project_name" type="text" value="<?php 
            echo attribute_escape($project['name']);
            ?>
" size="40" aria-required="true" /><br />
							<span class="setting-description"><?php 
            _e('The name is used to identify the project almost everywhere, for example under the post or in the project widgets.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_nicename"><?php 
            _e('Project Slug', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_nicename" id="project_nicename" type="text" value="<?php 
            echo attribute_escape($project['slug']);
            ?>
" size="40" /><br />
							<span class="setting-description"><?php 
            _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_parent"><?php 
            _e('Project Parent', 'prologue-projects');
            ?>
</label></th>
							<td><?php 
            wp_dropdown_categories(array('child_of' => $project_category_id, 'hide_empty' => 0, 'name' => 'project_parent', 'orderby' => 'name', 'selected' => $project['parent_id'], 'hierarchical' => true, 'show_option_none' => __('None', 'prologue-projects')));
            ?>
<br />
							<span class="setting-description"><?php 
            _e('Projects, can have a hierarchy. You might have an event project, and under that have sub-projects for catering and merchandise. Totally optional.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_description"><?php 
            _e('Description', 'prologue-projects');
            ?>
</label></th>
							<td><textarea name="project_description" id="project_description" rows="5" cols="40"><?php 
            echo wp_specialchars($project['description']);
            ?>
</textarea><br />
							<span class="setting-description"><?php 
            _e('The description is displayed on each project page.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_logo"><?php 
            _e('Project Logo', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_logo" id="project_logo" type="text" value="<?php 
            echo attribute_escape($project['logo']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The project\'s logo. Must be a full URL of an image. Maximum size of 64px x 64px is recommended.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_website"><?php 
            _e('Project Website', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_website" id="project_website" type="text" value="<?php 
            echo attribute_escape($project['website']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The project\'s external website. Must be a full URL.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_blog"><?php 
            _e('Project Blog', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_blog" id="project_blog" type="text" value="<?php 
            echo attribute_escape($project['blog']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The project\'s external blog. Must be a full URL.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_svn"><?php 
            _e('Project Subversion Repository', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_svn" id="project_svn" type="text" value="<?php 
            echo attribute_escape($project['svn']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The location of the project\'s Subversion repository. This is only common in software projects.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_trac"><?php 
            _e('Project Trac Installation', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_trac" id="project_trac" type="text" value="<?php 
            echo attribute_escape($project['trac']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The location of the project\'s Trac ticketing website. This is only common in software projects.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_intertrac"><?php 
            _e('Project InterTrac Code', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_intertrac" id="project_intertrac" type="text" value="<?php 
            echo attribute_escape($project['intertrac']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('This code allows users to distinguish between different Trac installations in the same update. This is only common in software projects.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_activity"><?php 
            _e('Project Activity Feeds', 'prologue-projects');
            ?>
</label></th>
							<td><textarea name="project_activity" id="project_activity" rows="5" cols="40"><?php 
            echo wp_specialchars(join("\n", stripslashes_deep($project['activity'])));
            ?>
</textarea><br />
							<span class="setting-description"><?php 
            _e('Specify a list of feeds you wish to aggregate into the projects "activity" sidebar. One feed per line. Activity reported by Trac is automatically included here.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_overheard"><?php 
            _e('Project Overheard Feeds', 'prologue-projects');
            ?>
</label></th>
							<td><textarea name="project_overheard" id="project_overheard" rows="5" cols="40"><?php 
            echo wp_specialchars(join("\n", stripslashes_deep($project['overheard'])));
            ?>
</textarea><br />
							<span class="setting-description"><?php 
            _e('Specify a list of feeds you wish to aggregate into the projects "overheard" sidebar. One feed per line.', 'prologue-projects');
            ?>
</span></td>
						</tr>
					</table>

					<p class="submit"><input type="submit" class="button" name="submit" value="<?php 
            _e('Update Project', 'prologue-projects');
            ?>
" /></p>
				</form>
			</div><!-- /wrap -->



<?php 
            break;
        case 'editedproject':
            $project_ID = (int) $_POST['project_ID'];
            check_admin_referer('update-project_' . $project_ID);
            if (!current_user_can('manage_categories')) {
                wp_die(__('Cheatin&#8217; uh?', 'prologue-projects'));
            }
            $location = 'admin.php?page=prologue-projects';
            if ($referer = wp_get_original_referer()) {
                if (false !== strpos($referer, 'admin.php')) {
                    $location = $referer;
                }
            }
            if (pp_update_project($_POST)) {
                $location = add_query_arg('message', 3, $location);
            } else {
                $location = add_query_arg('message', 5, $location);
            }
            wp_redirect($location);
            exit;
            break;
        default:
            if (isset($_GET['_wp_http_referer']) && !empty($_GET['_wp_http_referer'])) {
                wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
                exit;
            }
            require_once 'admin-header.php';
            $messages[1] = __('Project added.', 'prologue-projects');
            $messages[2] = __('Project deleted.', 'prologue-projects');
            $messages[3] = __('Project updated.', 'prologue-projects');
            $messages[4] = __('Project not added.', 'prologue-projects');
            $messages[5] = __('Project not updated.', 'prologue-projects');
            ?>

<div class="wrap nosubsub">
<?php 
            screen_icon();
            ?>
	<h2>
<?php 
            echo wp_specialchars($title);
            if (isset($_GET['s']) && $_GET['s']) {
                printf('<span class="subtitle">' . __('Search results for &#8220;%s&#8221;', 'prologue-projects') . '</span>', wp_specialchars(stripslashes($_GET['s'])));
            }
            ?>
	</h2>

<?php 
            if (isset($_GET['message']) && ($msg = (int) $_GET['message'])) {
                ?>
	<div id="message" class="updated fade"><p><?php 
                echo $messages[$msg];
                ?>
</p></div>
<?php 
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            ?>

	<form class="search-form topmargin" action="" method="get">
		<p class="search-box">
			<label class="hidden" for="project-search-input"><?php 
            _e('Search Projects', 'prologue-projects');
            ?>
:</label>
			<input type="text" class="search-input" id="project-search-input" name="s" value="<?php 
            _admin_search_query();
            ?>
" />
			<input type="hidden" name="page" value="prologue-projects" />
			<input type="submit" value="<?php 
            _e('Search Projects', 'prologue-projects');
            ?>
" class="button" />
		</p>
	</form><br class="clear" />

	<div id="col-container">
		<div id="col-right">
			<div class="col-wrap">
				<form id="posts-filter" action="" method="get">
					<input type="hidden" name="page" value="prologue-projects" />
					<div class="tablenav">

<?php 
            $pagenum = isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 0;
            if (empty($pagenum)) {
                $pagenum = 1;
            }
            if (!isset($projectsperpage) || $projectsperpage < 0) {
                $projectsperpage = 20;
            }
            $projectstotal = count(pp_get_projects());
            $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'prev_text' => __('&laquo;', 'prologue-projects'), 'next_text' => __('&raquo;', 'prologue-projects'), 'total' => ceil($projectstotal / $projectsperpage), 'current' => $pagenum));
            if ($page_links) {
                ?>

						<div class="tablenav-pages"><?php 
                echo $page_links;
                ?>
</div>

<?php 
            }
            ?>

						<div class="alignleft actions">
							<select name="action">
								<option value="" selected="selected"><?php 
            _e('Bulk Actions', 'prologue-projects');
            ?>
</option>
								<option value="delete"><?php 
            _e('Delete', 'prologue-projects');
            ?>
</option>
							</select>
							<input type="submit" value="<?php 
            _e('Apply', 'prologue-projects');
            ?>
" name="doaction" id="doaction" class="button-secondary action" />
							<?php 
            wp_nonce_field('bulk-projects');
            ?>
						</div>

						<br class="clear" />
					</div>

					<div class="clear"></div>

					<table class="widefat fixed" cellspacing="0">
						<thead>
							<tr>

<?php 
            print_column_headers('projects');
            ?>

							</tr>
						</thead>

						<tfoot>
							<tr>

<?php 
            print_column_headers('projects', false);
            ?>

							</tr>
						</tfoot>

						<tbody id="the-list" class="list:projects">

<?php 
            pp_project_rows($project_category_id, 0, 0, $pagenum, $projectsperpage);
            ?>

						</tbody>
					</table>

					<div class="tablenav">

<?php 
            if ($page_links) {
                ?>

						<div class="tablenav-pages"><?php 
                echo $page_links;
                ?>
</div>

<?php 
            }
            ?>

						<div class="alignleft actions">
							<select name="action2">
								<option value="" selected="selected"><?php 
            _e('Bulk Actions', 'prologue-projects');
            ?>
</option>
								<option value="delete"><?php 
            _e('Delete', 'prologue-projects');
            ?>
</option>
							</select>
							<input type="submit" value="<?php 
            _e('Apply', 'prologue-projects');
            ?>
" name="doaction2" id="doaction2" class="button-secondary action" />
							<?php 
            wp_nonce_field('bulk-projects');
            ?>
						</div>

						<br class="clear" />
					</div>
				</form>

				<div class="form-wrap">
					<p><?php 
            _e('<strong>Note:</strong><br />Deleting a project does not delete the posts in that project.', 'prologue-projects');
            ?>
</p>
				</div>
			</div>
		</div><!-- /col-right -->

		<div id="col-left">
			<div class="col-wrap">

<?php 
            if (current_user_can('manage_categories')) {
                ?>

				<div class="form-wrap">
					<h3><?php 
                _e('Add Project', 'prologue-projects');
                ?>
</h3>
					<div id="ajax-response"></div>
					<form name="addproject" id="addproject" method="post" action="admin.php?page=prologue-projects" class="add:the-list: validate">
						<input type="hidden" name="action" value="addproject" />
						<?php 
                wp_original_referer_field(true, 'previous');
                ?>
						<?php 
                wp_nonce_field('add-project');
                ?>

						<div class="form-field form-required">
							<label for="project_name"><?php 
                _e('Project Name', 'prologue-projects');
                ?>
</label>
							<input name="project_name" id="project_name" type="text" value="" size="40" aria-required="true" />
							<p><?php 
                _e('The name is used to identify the project almost everywhere, for example under the post or in the project widgets.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_nicename"><?php 
                _e('Project Slug', 'prologue-projects');
                ?>
</label>
							<input name="project_nicename" id="project_nicename" type="text" value="" size="40" />
							<p><?php 
                _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_parent"><?php 
                _e('Project Parent', 'prologue-projects');
                ?>
</label>
							<?php 
                wp_dropdown_categories(array('child_of' => $project_category_id, 'hide_empty' => 0, 'name' => 'project_parent', 'orderby' => 'name', 'selected' => 0, 'hierarchical' => true, 'show_option_none' => __('None', 'prologue-projects')));
                ?>
							<p><?php 
                _e('Projects, can have a hierarchy. You might have an event project, and under that have sub-projects for catering and merchandise. Totally optional.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_description"><?php 
                _e('Description', 'prologue-projects');
                ?>
</label>
							<textarea name="project_description" id="project_description" rows="5" cols="40"></textarea>
							<p><?php 
                _e('The description is displayed on each project page.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_logo"><?php 
                _e('Project Logo', 'prologue-projects');
                ?>
</label>
							<input name="project_logo" id="project_logo" type="text" value="" size="255" />
							<p><?php 
                _e('The project\'s logo. Must be a full URL of an image. Maximum size of 64px x 64px is recommended.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_website"><?php 
                _e('Project Website', 'prologue-projects');
                ?>
</label>
							<input name="project_website" id="project_website" type="text" value="" size="255" />
							<p><?php 
                _e('The project\'s external website. Must be a full URL.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_blog"><?php 
                _e('Project Blog', 'prologue-projects');
                ?>
</label>
							<input name="project_blog" id="project_blog" type="text" value="" size="255" />
							<p><?php 
                _e('The project\'s external blog. Must be a full URL.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_svn"><?php 
                _e('Project Subversion Repository', 'prologue-projects');
                ?>
</label>
							<input name="project_svn" id="project_svn" type="text" value="" size="255" />
							<p><?php 
                _e('The location of the project\'s Subversion repository. This is only common in software projects.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_trac"><?php 
                _e('Project Trac Installation', 'prologue-projects');
                ?>
</label>
							<input name="project_trac" id="project_trac" type="text" value="" size="255" />
							<p><?php 
                _e('The location of the project\'s Trac ticketing website. This is only common in software projects.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_intertrac"><?php 
                _e('Project InterTrac Code', 'prologue-projects');
                ?>
</label>
							<input name="project_intertrac" id="project_intertrac" type="text" value="" size="255" />
							<p><?php 
                _e('This code allows users to distinguish between different Trac installations in the same update. This is only common in software projects.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_activity"><?php 
                _e('Project Activity Feeds', 'prologue-projects');
                ?>
</label>
							<textarea name="project_activity" id="project_activity" rows="5" cols="40"></textarea>
							<p><?php 
                _e('Specify a list of feeds you wish to aggregate into the projects "activity" sidebar. One feed per line. Activity reported by Trac is automatically included here.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_overheard"><?php 
                _e('Project Overheard Feeds', 'prologue-projects');
                ?>
</label>
							<textarea name="project_overheard" id="project_overheard" rows="5" cols="40"></textarea>
							<p><?php 
                _e('Specify a list of feeds you wish to aggregate into the projects "overheard" sidebar. One feed per line.', 'prologue-projects');
                ?>
</p>
						</div>

						<p class="submit"><input type="submit" class="button" name="submit" value="<?php 
                _e('Add Project', 'prologue-projects');
                ?>
" /></p>
					</form>
				</div>

<?php 
            }
            ?>

			</div>
		</div><!-- /col-left -->
	</div><!-- /col-container -->
</div><!-- /wrap -->

<script type="text/javascript">
/* <![CDATA[ */
(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = '<?php 
            echo js_escape(__("You are about to delete the selected projects.\n  'Cancel' to stop, 'OK' to delete.", 'prologue-projects'));
            ?>
';
				return showNotice.warn(m);
			}
		});
	});
})(jQuery);
/* ]]> */
</script>

<?php 
            break;
    }
}
Esempio n. 14
0
 function import_cat_select_before_each($cat_ID, $level)
 {
     // callback to display sublist element
     global $current_blog_ID, $blog, $cat, $postdata, $default_main_cat, $action, $tabindex;
     echo '<li>';
     if (get_allow_cross_posting() >= 1) {
         // We allow cross posting, display checkbox:
         echo '<input type="checkbox" name="post_extracats[]" class="checkbox" title="', T_('Select as an additionnal category'), '" value="', $cat_ID, '"';
         echo ' />';
     }
     // Radio for main cat:
     if ($current_blog_ID == $blog) {
         if ($default_main_cat == 0 && $action == 'post') {
             // Assign default cat for new post
             $default_main_cat = $cat_ID;
         }
         echo ' <input type="radio" name="post_category" class="checkbox" title="', T_('Select as MAIN category'), '" value="', $cat_ID, '"';
         if ($cat_ID == $postdata["Category"] || $cat_ID == $default_main_cat) {
             echo ' checked="checked"';
         }
         echo ' />';
     }
     echo ' ' . htmlspecialchars(get_catname($cat_ID));
 }
        <th scope="col"><?php _e('Description') ?></th>
        <th scope="col"><?php _e('# Posts') ?></th>
        <th colspan="2"><?php _e('Action') ?></th>
	</tr>
<?php
cat_rows();
?>
</table>

</div>

<?php if ( $user_level > 3 ) : ?>
<div class="wrap">
    <p><?php printf(__('<strong>Note:</strong><br />
Deleting a category does not delete posts from that category, it will just
set them back to the default category <strong>%s</strong>.'), get_catname(1)) ?>
  </p>
</div>

<div class="wrap">
    <h2><?php _e('Add New Category') ?></h2>
    <form name="addcat" id="addcat" action="categories.php" method="post">
        
        <p><?php _e('Name:') ?><br />
        <input type="text" name="cat_name" value="" /></p>
        <p><?php _e('Category parent:') ?><br />
        <select name='cat' class='postform'>
        <option value='0'><?php _e('None') ?></option>
        <?php wp_dropdown_cats(0); ?>
        </select></p>
        <p><?php _e('Description: (optional)') ?> <br />
Esempio n. 16
0
 /**
  * Filter the category items and/or shows padlock
  *
  * @uses $capa_protect_show_private_categories
  * @uses $capa_protect_show_padlock_on_private_categories
  * @uses $current_user
  * @uses $wpc_siteurl
  *
  * @uses trailingslashit()
  * @uses capa_protect::user_can_access()
  *
  * @param string $text
  *
  * @return string
  */
 function filter_category_list_item($text, $category = null)
 {
     global $capa_protect_show_private_categories, $capa_protect_show_padlock_on_private_categories;
     global $current_user, $wpc_siteurl, $wp_version;
     if ($current_user && isset($current_user->allcaps['manage_categories']) && !isset($current_user->caps['editor'])) {
         return $text;
     }
     $all_category_ids = capa_protect::_get_taxonomy_ids();
     $all_category_ids = $all_category_ids['category'];
     # Make the changes
     $site_root = parse_url($wpc_siteurl);
     $site_root = trailingslashit($site_root['path']);
     if ($capa_protect_show_private_categories) {
         if ($capa_protect_show_padlock_on_private_categories) {
             foreach ($all_category_ids as $taxo_id => $term_id) {
                 if (!capa_protect::user_can_access($term_id, $current_user, 'cat')) {
                     $tmp_catname = (int) $wp_version < 2.8 ? get_catname($term_id) : get_cat_name($term_id);
                     $search[$taxo_id] = "#>" . $tmp_catname . "<#";
                     $replace[$taxo_id] = '><img src="' . $site_root . 'wp-content/plugins/capa/img/padlock.gif" height="10" width="10" valign="center" border="0"/> ' . $tmp_catname . '<';
                 }
             }
             // In the case user see all categories but padlock is active
             // $search will be empty
             return count($search) > 0 ? preg_replace($search, $replace, $text) : $text;
         }
         return $text;
     }
     return $text;
 }
function _cat_row( $category, $level, $name_override = false ) {
	global $class;

	$pad = str_repeat( '&#8212; ', $level );
	if ( current_user_can( 'manage_categories' ) ) {
		$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__( 'Edit' )."</a></td>";
		$default_cat_id = (int) get_option( 'default_category' );
		$default_link_cat_id = (int) get_option( 'default_link_category' );

		if ( ($category->cat_ID != $default_cat_id ) && ($category->cat_ID != $default_link_cat_id ) )
			$edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->cat_name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
		else
			$edit .= "<td style='text-align:center'>".__( "Default" );
	} else
		$edit = '';

	$class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";

	$category->category_count = number_format( $category->category_count );
	$category->link_count = number_format( $category->link_count );
	$posts_count = ( $category->category_count > 0 ) ? "<a href='edit.php?cat=$category->cat_ID'>$category->category_count</a>" : $category->category_count;
	return "<tr id='cat-$category->cat_ID'$class>
		<th scope='row' style='text-align: center'>$category->cat_ID</th>
		<td>" . ( $name_override ? $name_override : $pad . ' ' . $category->cat_name ) . "</td>
		<td>$category->category_description</td>
		<td align='center'>$posts_count</td>
		<td align='center'>$category->link_count</td>
		<td>$edit</td>\n\t</tr>\n";
}
<br />
		<input type="text" name="cat_name" value="" /></p>
		<p><?php 
        echo _LANG_C_NAME_CATDESC;
        ?>
 (optional) <br />
		<textarea name="category_description" rows="5" cols="50" style="width: 97%;"></textarea></p>
		<p><input type="hidden" name="action" value="addcat" /><input type="submit" name="submit" value="<?php 
        echo _LANG_C_NAME_ADD;
        ?>
" /></p>
	</form>
</div>


<div class="wrap">
<h2>Note : </h2>
  <p><?php 
        echo _LANG_C_NOTE_CATEGORY;
        ?>
 &rsaquo;&rsaquo; <strong><?php 
        echo get_catname(1);
        ?>
</strong></p>
</div>

	<?php 
        break;
}
/* </Categories> */
include 'admin-footer.php';
        _e('Apply');
        ?>
" name="doaction2" id="doaction2" class="button-secondary action" />
<?php 
        wp_nonce_field('bulk-categories');
        ?>
</div>

<br class="clear" />
</div>

</form>

<div class="form-wrap">
<p><?php 
        printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category'))));
        ?>
</p>
<p><?php 
        printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag');
        ?>
</p>
</div>

</div>
</div><!-- /col-right -->

<div id="col-left">
<div class="col-wrap">

<?php 
Esempio n. 20
0
<?php

include 'functions.php';
session_start();
check_valid_user();
$catid = $_GET['id'];
$catname = get_catname($catid);
do_html_header($catname);
$post = get_cate_post($catid);
display_entries($post);
do_html_url('blog', 'Home');
do_html_footer();
Esempio n. 21
0
wp_dropdown_categories('exclude=' . $category->cat_ID . '&hide_empty=0&class=widefield&orderby=name&hierarchical=1&name=category_parent&orderby=name&hierarchical=1&selected=' . $category->category_parent . '&hierarchical=1&show_option_none=' . __('None'));
?>
		</div>
	</fieldset>
	<fieldset>
		<div class="labelrow">
			<label for="category_description"><?php 
_e('Description: (optional)');
?>
</label>
			<br class="accessible" />
		</div>
		<div class="inputrow">
			<textarea rows="10" cols="25" name="category_description" id="category_description"><?php 
echo wp_specialchars($category->category_description);
?>
</textarea>
		</div>
	</fieldset>
<?php 
$this->panel_button('submit', 'submit', $submit_text);
if ($this->context == 'edit') {
    $default_cat_id = (int) get_option('default_category');
    $default_link_cat_id = (int) get_option('default_link_category');
    $question = sprintf(__("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop."), $category->name, get_catname($default_cat_id), get_catname($default_link_cat_id));
    $url = wp_nonce_url("categories.php?action=delete&amp;cat_ID={$category->term_id}", 'delete-category_' . $category->term_id);
    $this->panel_delete_button(__('Delete'), $question, $url);
}
?>
</form>
        ?>
</th>
        <th colspan="2"><?php 
        echo _LANG_C_NAME_CATACTION;
        ?>
</th>
	</tr>
<?php 
        cat_rows();
        ?>
</table>
</div>

<div class="wrap">
    <p><?php 
        printf(_LANG_C_NOTE_CATEGORY, get_catname(1));
        ?>
</p>
</div>

<?php 
        $form_id = "addcat";
        $form_title = _LANG_C_ADD_NEWCAT;
        $cat_ID = 0;
        $cat_name = "";
        $category_parent = 0;
        $category_description = "";
        include 'include/categories-form.php';
        break;
}
include 'admin-footer.php';
Esempio n. 23
0
	</tr>
<?php 
        cat_rows();
        ?>
</table>

<div id="ajax-response"></div>

</div>

<?php 
        if (current_user_can('manage_categories')) {
            ?>
<div class="wrap">
<p><?php 
            printf(__('<strong>Note:</strong><br />Deleting a category does not delete posts from that category, it will just set them back to the default category <strong>%s</strong>.'), get_catname(get_option('default_category')));
            ?>
</p>
</div>

<div class="wrap">
    <h2><?php 
            _e('Add New Category');
            ?>
</h2>
    <form name="addcat" id="addcat" action="categories.php" method="post">
        
        <p><?php 
            _e('Name:');
            ?>
<br />
Esempio n. 24
0
         $edited_Item =& new Item();
         $edited_Item->set_creator_User($item_Author);
         $edited_Item->set('title', $post_title);
         $edited_Item->set('content', $post_content);
         $edited_Item->set('datestart', $post_date);
         $edited_Item->set('main_cat_ID', $post_category);
         $edited_Item->set('extra_cat_IDs', $post_catids);
         $edited_Item->set('status', $post_status);
         $edited_Item->set('locale', $post_locale);
         $edited_Item->set('notifications_status', 'finished');
         $edited_Item->set('comment_status', $comment_status);
         $edited_Item->set_renderers($post_renderers);
         $edited_Item->dbinsert();
         $post_ID = $edited_Item->ID;
     }
     $message .= '<li><span style="color:green">Imported successfully</span><ul><li>main category: <span style="color:#09c">' . get_catname($post_category) . '</span></li>';
     if (count($post_catids)) {
         $message .= '<li>extra categories: <span style="color:#09c">' . preg_replace('/(\\d+)/e', "get_catname('\\1')", implode(', ', $post_catids)) . '</span></li>';
     }
     $message .= '</ul></li>';
     $count_postscreated++;
 }
 echo $message . '</ul>';
 if (count($comments)) {
     // comments
     $message = '';
     $comments = explode("-----\nCOMMENT:", $comments[0]);
     foreach ($comments as $comment) {
         $comment = trim($comment);
         if (empty($comment)) {
             continue;