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


PHP get_post_statuses函数代码示例

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


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

示例1: getTranslationStatus

 public static function getTranslationStatus($status)
 {
     static $cache = null;
     if ($cache === null) {
         $cache = \get_post_statuses();
     }
     return isset($cache[$status]) ? $cache[$status] : $status;
 }
开发者ID:kmvan,项目名称:poiauthor,代码行数:8,代码来源:Api.php

示例2: get_translated_status

 /**
  * Returns the according translation of the given post status, if available.
  *
  * @param string $status Post status.
  *
  * @return string The according translation of the given post status.
  */
 private function get_translated_status($status)
 {
     static $cache;
     if (!$cache) {
         $cache = get_post_statuses();
     }
     return isset($cache[$status]) ? $cache[$status] : esc_html($status);
 }
开发者ID:inpsyde,项目名称:multilingual-press,代码行数:15,代码来源:StatusAwareSearchResultsView.php

示例3: get_translated_status

 /**
  * Get the translated post status if possible.
  *
  * @param  string $status
  * @return string
  */
 private function get_translated_status($status)
 {
     static $statuses = FALSE;
     !$statuses and $statuses = get_post_statuses();
     if (isset($statuses[$status])) {
         return $statuses[$status];
     }
     return esc_html(ucfirst($status));
 }
开发者ID:ycms,项目名称:multilingual-press,代码行数:15,代码来源:Mlp_Relationship_Control_Ajax_Search.php

示例4: handle_ajax_search

 public static function handle_ajax_search()
 {
     check_ajax_referer('psu_search');
     $args = array('post_type' => array());
     if (!empty($_GET['post_type'])) {
         $unsanitized_post_types = array_map('sanitize_key', explode(',', $_GET['post_type']));
         foreach ($unsanitized_post_types as $post_type) {
             if (($post_type_obj = get_post_type_object($post_type)) && current_user_can($post_type_obj->cap->read)) {
                 $args['post_type'][] = $post_type;
             }
         }
     }
     if (count($args['post_type']) < 1) {
         die('-1');
     }
     if (!empty($_GET['paged'])) {
         $args['paged'] = absint($_GET['paged']);
     }
     if (!empty($_GET['s'])) {
         $args['s'] = sanitize_text_field($_GET['s']);
     }
     if (!empty($_GET['order']) && in_array(strtolower($_GET['order']), array('asc', 'desc'))) {
         $args['order'] = $_GET['order'];
     }
     if (!empty($_GET['orderby'])) {
         $args['orderby'] = sanitize_text_field($_GET['orderby']);
     }
     if (!empty($_GET['post_status'])) {
         $post_statuses = explode(',', $_GET['post_status']);
         $defined_statuses = array_keys(get_post_statuses());
         $allowed_statuses = array_merge($defined_statuses, array('inherit', 'any'));
         $filtered_statuses = array_intersect($post_statuses, $allowed_statuses);
         if (!empty($filtered_statuses)) {
             $args['post_status'] = $filtered_statuses;
         }
     }
     if (!empty($_GET['include'])) {
         $args['post__in'] = array_filter(array_map('intval', explode(',', $_GET['include'])));
     }
     if (!empty($_GET['exclude'])) {
         $selected = array_map('intval', explode(',', $_GET['exclude']));
     } else {
         $selected = array();
     }
     $name = 'foobar';
     if (!empty($_GET['name'])) {
         $_name = sanitize_text_field($_GET['name']);
         if ($_name) {
             $name = $_name;
         }
     }
     $psu_box = new Post_Selection_Box($name, array('post_type' => $args['post_type'], 'selected' => $selected));
     $response = new stdClass();
     $response->rows = $psu_box->render_results($args);
     die(wp_send_json($response));
 }
开发者ID:postmatic,项目名称:post-selection-ui,代码行数:56,代码来源:Post_Selection_UI.php

示例5: init

 public static function init()
 {
     foreach (get_class_methods(__CLASS__) as $method) {
         if (!in_array($method, array('init', 'channels'))) {
             call_user_func(array(__CLASS__, $method));
         }
     }
     # Trivial ones
     # User roles
     global $wp_roles;
     if (is_object($wp_roles)) {
         self::$roles = $wp_roles->role_names;
     }
     # ALL post statuses
     $post_statuses = array_merge(get_post_statuses(), array('auto-draft' => __('Auto Draft'), 'inherit' => __('Inherit', 'kc-settings'), 'trash' => __('Trash'), 'future' => __('Scheduled')));
     asort($post_statuses);
     self::$post_statuses = $post_statuses;
     # Yes/No
     self::$yesno = array('0' => __('No', 'kc-settings'), '1' => __('Yes', 'kc-settings'));
 }
开发者ID:Omuze,项目名称:barakat,代码行数:20,代码来源:options.php

示例6: sre2t_the_post_dates

function sre2t_the_post_dates()
{
    global $wpdb, $wp_locale;
    $dateoptions = '';
    $types = "'" . implode("', '", get_post_types(array('public' => true, 'can_export' => true), 'names')) . "'";
    if (function_exists(get_post_stati)) {
        $stati = "'" . implode("', '", get_post_stati(array('internal' => false), 'names')) . "'";
    } else {
        $stati = "'" . implode("', '", get_post_statuses(array('internal' => false), 'names')) . "'";
    }
    if ($monthyears = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, YEAR(DATE_ADD(post_date, INTERVAL 1 MONTH)) AS `eyear`, MONTH(DATE_ADD(post_date, INTERVAL 1 MONTH)) AS `emonth` FROM {$wpdb->posts} WHERE post_type IN ({$types}) AND post_status IN ({$stati}) ORDER BY post_date ASC ")) {
        foreach ($monthyears as $k => $monthyear) {
            $monthyears[$k]->lmonth = $wp_locale->get_month($monthyear->month, 2);
        }
        for ($s = 0, $e = count($monthyears) - 1; $e >= 0; $s++, $e--) {
            //$dateoptions .= "\t<option value=\"" . $monthyears[$s]->year . '-' . zeroise( $monthyears[$s]->month, 2 ) . '">' . $monthyears[$s]->lmonth . ' ' . $monthyears[$s]->year . "</option>\n";
            $dateoptions .= "\t<option value=\"" . $monthyears[$e]->eyear . '-' . zeroise($monthyears[$e]->emonth, 2) . '">' . $monthyears[$e]->lmonth . ' ' . $monthyears[$e]->year . "</option>\n";
        }
    }
    return $dateoptions;
}
开发者ID:venamax,项目名称:trixandtrax-cl,代码行数:21,代码来源:export-to-text_helpers.php

示例7: column_title

 /**
  * Display the gig title column.
  *
  * Determines the gig title, accounting for an empty value and outputs
  * row actions based on capability.
  *
  * @since 1.0.0
  *
  * @param WP_Post $item Gig post object.
  * @return string Column value.
  */
 function column_title($item)
 {
     $statuses = get_post_statuses();
     $status = 'publish' !== $item->post_status && array_key_exists($item->post_status, $statuses) ? ' - <strong>' . esc_html($statuses[$item->post_status]) . '</strong>' : '';
     $date = empty($item->gig_datetime) ? __('(no date)', 'audiotheme') : mysql2date(get_option('date_format'), $item->gig_datetime);
     $out = sprintf('<strong><a href="%1$s" class="row-title">%2$s</a></strong> - %3$s%4$s<br>', esc_url(get_edit_post_link($item->ID)), esc_html($date), esc_html(empty($item->gig_time) ? 'TBD' : $item->gig_time), $status);
     $post_type_object = get_post_type_object($item->post_type);
     $can_edit_post = current_user_can($post_type_object->cap->edit_post, $item->ID);
     if ($can_edit_post && 'trash' !== $item->post_status) {
         $actions['edit'] = '<a href="' . get_edit_post_link($item->ID, true) . '" title="' . esc_attr(__('Edit this item', 'audiotheme')) . '">' . __('Edit', 'audiotheme') . '</a>';
         #$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
     }
     if (current_user_can($post_type_object->cap->delete_post, $item->ID)) {
         if ('trash' === $item->post_status) {
             $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash', 'audiotheme')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&amp;action=untrash', $item->ID)), 'untrash-post_' . $item->ID) . "'>" . __('Restore', 'audiotheme') . '</a>';
         } elseif (EMPTY_TRASH_DAYS) {
             $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash', 'audiotheme')) . "' href='" . get_delete_post_link($item->ID) . "'>" . __('Trash', 'audiotheme') . '</a>';
         }
         if ('trash' === $item->post_status || !EMPTY_TRASH_DAYS) {
             $onclick = " onclick=\"return confirm('" . esc_js(sprintf(__('Are you sure you want to delete this %s?', 'audiotheme'), strtolower($post_type_object->labels->singular_name))) . "');\"";
             $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently', 'audiotheme')) . "' href='" . get_delete_post_link($item->ID, '', true) . "'{$onclick}>" . __('Delete Permanently', 'audiotheme') . '</a>';
         }
     }
     if ($post_type_object->public) {
         if (in_array($item->post_status, array('pending', 'draft', 'future'))) {
             if ($can_edit_post) {
                 $actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($item->ID))) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;', 'audiotheme'), $item->post_title)) . '" rel="permalink">' . __('Preview', 'audiotheme') . '</a>';
             }
         } elseif ('trash' !== $item->post_status) {
             $actions['view'] = '<a href="' . esc_url(get_permalink($item->ID)) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;', 'audiotheme'), $item->post_title)) . '" rel="permalink">' . __('View', 'audiotheme') . '</a>';
         }
     }
     $out .= $this->row_actions($actions);
     return $out;
 }
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:46,代码来源:class-audiotheme-gigs-list-table.php

示例8: cms_tpv_print_childs

/**
 * Output JSON for the children of a node
 * $arrOpenChilds = array with id of pages to open children on
 */
function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $post_type)
{
    $arrPages = cms_tpv_get_pages("parent={$pageID}&view={$view}&post_type={$post_type}");
    if ($arrPages) {
        global $current_screen;
        $screen = convert_to_screen("edit");
        #return;
        // If this is set to null then quick/bul edit stops working on posts (not pages)
        // If did set it to null sometime. Can't remember why...
        // $screen->post_type = null;
        $post_type_object = get_post_type_object($post_type);
        ob_start();
        // some plugins, for example magic fields, return javascript and things here. we're not compatible with that, so just swallow any output
        $posts_columns = get_column_headers($screen);
        ob_get_clean();
        unset($posts_columns["cb"], $posts_columns["title"], $posts_columns["author"], $posts_columns["categories"], $posts_columns["tags"], $posts_columns["date"]);
        global $post;
        // Translated post statuses
        $post_statuses = get_post_statuses();
        ?>
[<?php 
        for ($i = 0, $pagesCount = sizeof($arrPages); $i < $pagesCount; $i++) {
            $onePage = $arrPages[$i];
            $tmpPost = $post;
            $post = $onePage;
            $page_id = $onePage->ID;
            $arrChildPages = NULL;
            $editLink = get_edit_post_link($onePage->ID, 'notDisplay');
            $content = esc_html($onePage->post_content);
            $content = str_replace(array("\n", "\r"), "", $content);
            $hasChildren = false;
            // if viewing trash, don't get children. we watch them "flat" instead
            if ($view == "trash") {
            } else {
                $arrChildPages = cms_tpv_get_pages("parent={$onePage->ID}&view={$view}&post_type={$post_type}");
            }
            if (!empty($arrChildPages)) {
                $hasChildren = true;
            }
            // if no children, output no state
            $strState = '"state": "closed",';
            if (!$hasChildren) {
                $strState = '';
            }
            // type of node
            $rel = $onePage->post_status;
            if ($onePage->post_password) {
                $rel = "password";
            }
            // modified time
            $post_modified_time = strtotime($onePage->post_modified);
            $post_modified_time = date_i18n(get_option('date_format'), $post_modified_time, false);
            // last edited by
            setup_postdata($post);
            $post_author = cms_tpv_get_the_modified_author();
            if (empty($post_author)) {
                $post_author = __("Unknown user", 'cms-tree-page-view');
            }
            $title = get_the_title($onePage->ID);
            // so hooks and stuff will do their work
            $title = apply_filters("cms_tree_page_view_post_title", $title, $onePage);
            if (empty($title)) {
                $title = __("<Untitled page>", 'cms-tree-page-view');
            }
            $arr_page_css_styles = array();
            $user_can_edit_page = apply_filters("cms_tree_page_view_post_can_edit", current_user_can($post_type_object->cap->edit_post, $page_id), $page_id);
            $user_can_add_inside = apply_filters("cms_tree_page_view_post_user_can_add_inside", current_user_can($post_type_object->cap->create_posts, $page_id), $page_id);
            $user_can_add_after = apply_filters("cms_tree_page_view_post_user_can_add_after", current_user_can($post_type_object->cap->create_posts, $page_id), $page_id);
            if ($user_can_edit_page) {
                $arr_page_css_styles[] = "cms_tpv_user_can_edit_page_yes";
            } else {
                $arr_page_css_styles[] = "cms_tpv_user_can_edit_page_no";
            }
            if ($user_can_add_inside) {
                $arr_page_css_styles[] = "cms_tpv_user_can_add_page_inside_yes";
            } else {
                $arr_page_css_styles[] = "cms_tpv_user_can_add_page_inside_no";
            }
            if ($user_can_add_after) {
                $arr_page_css_styles[] = "cms_tpv_user_can_add_page_after_yes";
            } else {
                $arr_page_css_styles[] = "cms_tpv_user_can_add_page_after_no";
            }
            $page_css = join(" ", $arr_page_css_styles);
            // fetch columns
            $str_columns = "";
            foreach ($posts_columns as $column_name => $column_display_name) {
                $col_name = $column_display_name;
                if ($column_name == "comments") {
                    $col_name = __("Comments");
                }
                $str_columns .= "<dt>{$col_name}</dt>";
                $str_columns .= "<dd>";
                if ($column_name == "comments") {
                    $str_columns .= '<div class="post-com-count-wrapper">';
                    $left = get_pending_comments_num($onePage->ID);
//.........这里部分代码省略.........
开发者ID:johnny-bit,项目名称:WordPress-CMS-Tree-Page-View,代码行数:101,代码来源:functions.php

示例9: wp_idea_stream_ideas_get_all_status

/**
 * Gets all WordPress built in post status (to be used in filters)
 *
 * @package WP Idea Stream
 * @subpackage ideas/functions
 *
 * @since 2.0.0
 *
 * @param  array  $status
 * @return array          the available post status
 */
function wp_idea_stream_ideas_get_all_status($status = array())
{
    return array_keys(get_post_statuses());
}
开发者ID:BoweFrankema,项目名称:wp-idea-stream,代码行数:15,代码来源:functions.php

示例10: render_site_options_pull

    public function render_site_options_pull($site_id)
    {
        //TODO: JS if is_meta show text box, if is_photo show photo select with numbers as values, else show select of post fields
        //TODO: JS Validation
        //TODO: deal with ability to select, i.e. media:group/media:thumbnail[@width="75"]/@url (can't be unserialized as is with quotes around 75)
        $feed_url = get_post_meta($site_id, 'syn_feed_url', true);
        $default_post_type = get_post_meta($site_id, 'syn_default_post_type', true);
        $default_post_status = get_post_meta($site_id, 'syn_default_post_status', true);
        $default_comment_status = get_post_meta($site_id, 'syn_default_comment_status', true);
        $default_ping_status = get_post_meta($site_id, 'syn_default_ping_status', true);
        $node_config = get_post_meta($site_id, 'syn_node_config', true);
        $id_field = get_post_meta($site_id, 'syn_id_field', true);
        $enc_field = get_post_meta($site_id, 'syn_enc_field', true);
        $enc_is_photo = get_post_meta($site_id, 'syn_enc_is_photo', true);
        if (isset($node_config['namespace'])) {
            $namespace = $node_config['namespace'];
        }
        //unset is outside of isset() test to remove the item from the array if the key is there with no value
        $namespace = isset($node_config['namespace']) ? $node_config['namespace'] : null;
        unset($node_config['namespace']);
        $post_root = isset($node_config['post_root']) ? $node_config['post_root'] : null;
        unset($node_config['post_root']);
        $enc_parent = isset($node_config['enc_parent']) ? $node_config['enc_parent'] : null;
        unset($node_config['enc_parent']);
        $categories = isset($node_config['categories']) && !empty($node_config['categories']) ? (array) $node_config['categories'] : null;
        unset($node_config['categories']);
        $custom_nodes = $node_config['nodes'];
        ?>
		<p>
			<label for="feed_url"><?php 
        esc_html_e('Enter feed URL', 'push-syndication');
        ?>
</label>
		</p>
		<p>
			<input type="text" name="feed_url" id="feed_url" size="100" value="<?php 
        esc_attr_e($feed_url);
        ?>
" />
		</p>
		<p>
			<label for="default_post_type"><?php 
        esc_html_e('Select post type', 'push-syndication');
        ?>
</label>
		</p>
		<p>
			<select name="default_post_type" id="default_post_type">
			<?php 
        $post_types = get_post_types();
        foreach ($post_types as $post_type) {
            ?>
				<option value="<?php 
            esc_attr_e($post_type);
            ?>
" <?php 
            selected($post_type, $default_post_type);
            ?>
><?php 
            esc_html_e($post_type);
            ?>
</option>
			<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="default_post_status"><?php 
        esc_html_e('Select post status', 'push-syndication');
        ?>
</label>
		</p>
		<p>
			<select name="default_post_status" id="default_post_status">
			<?php 
        $post_statuses = get_post_statuses();
        foreach ($post_statuses as $key => $value) {
            ?>
				<option value="<?php 
            esc_attr_e($key);
            ?>
" <?php 
            selected($key, $default_post_status);
            ?>
><?php 
            esc_html_e($key);
            ?>
</option>
			<?php 
        }
        ?>
			</select>
		</p>
		<p>
			<label for="default_comment_status"><?php 
        esc_html_e('Select comment status', 'push-syndication');
        ?>
</label>
		</p>
//.........这里部分代码省略.........
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:101,代码来源:class-client-options.php

示例11: frontier_post_add_link

			<th class="frontier-menu" ><a id="frontier-post-add-new-link" href='<?php 
    echo frontier_post_add_link($tmp_p_id);
    ?>
'><?php 
    echo $tmp_add_text;
    ?>
</a></th>
			<th class="frontier-menu" >&nbsp;</th>
		</tr>
	</table>

<?php 
}
// if can_add
if ($user_posts->found_posts > 0) {
    $tmp_status_list = get_post_statuses();
    // If post for all users is viewed, show author instead of category
    if ($frontier_list_all_posts == "true" || $frontier_list_pending_posts == "true") {
        $cat_author_heading = __("Author", "frontier-post");
    } else {
        $cat_author_heading = __("Category", "frontier-post");
    }
    ?>

<table class="frontier-list" id="user_post_list">
 	<div id="frontier-post-list-heading">
	<thead>
		<tr>
			<th class="frontier-list-posts" id="frontier-list-posts-date"><?php 
    _e("Date", "frontier-post");
    ?>
开发者ID:arildoosilva,项目名称:besm_restricted_area,代码行数:31,代码来源:frontier_post_form_list.php

示例12: wa_fronted_footer

    /**
     * Runs in wp_footer, adds spinner and settings modal
     */
    public function wa_fronted_footer()
    {
        if (is_array(WA_Fronted::$options) && !empty(WA_Fronted::$options) && WA_Fronted::$options !== false) {
            global $post;
            require_once ABSPATH . '/wp-admin/includes/post.php';
            require_once ABSPATH . '/wp-admin/includes/admin.php';
            $field_prefix = 'wa_fronted_';
            $default_fieldgroups = array('post_slug', 'post_status', 'post_date', 'post_parent', 'sticky', 'comment_status', 'taxonomies');
            $field_groups = apply_filters('wa_fronted_settings_fields', $default_fieldgroups);
            ?>
			<div id="wa-fronted-settings-modal">
				<div class="wa-fronted-modal-inner">
					<button class="close-wa-fronted-modal"><i class="fa fa-close"></i></button>

					<form id="wa-fronted-settings" method="POST">
						<?php 
            if (is_array($field_groups) && !empty($field_groups)) {
                foreach ($field_groups as $field_group) {
                    switch ($field_group) {
                        case 'post_slug':
                            ?>
											<div class="fieldgroup">
												<label for="<?php 
                            echo $field_prefix;
                            ?>
post_name"><?php 
                            _e('Post slug', 'wa-fronted');
                            ?>
</label>
												<input type="text" name="<?php 
                            echo $field_prefix;
                            ?>
post_name" id="<?php 
                            echo $field_prefix;
                            ?>
post_name" value="<?php 
                            echo $post->post_name;
                            ?>
">
											</div>
											<?php 
                            break;
                        case 'post_status':
                            $all_statuses = get_post_statuses();
                            $current_post_status = get_post_status($post->ID);
                            ?>
											<div class="fieldgroup">
												<label for="<?php 
                            echo $field_prefix;
                            ?>
post_status"><?php 
                            _e('Post status', 'wa-fronted');
                            ?>
</label>
												<select name="<?php 
                            echo $field_prefix;
                            ?>
post_status" id="<?php 
                            echo $field_prefix;
                            ?>
post_status">
													<?php 
                            foreach ($all_statuses as $status_key => $status_label) {
                                ?>
														<option value="<?php 
                                echo $status_key;
                                ?>
" <?php 
                                echo $current_post_status == $status_key ? 'selected' : '';
                                ?>
>
															<?php 
                                echo $status_label;
                                ?>
														</option>
													<?php 
                            }
                            ?>
												</select>
											</div>
											<?php 
                            break;
                        case 'post_date':
                            ?>
											<div class="fieldgroup">
												<label for="<?php 
                            echo $field_prefix;
                            ?>
post_date"><?php 
                            _e('Post date', 'wa-fronted');
                            ?>
</label>
												<input type="text" name="<?php 
                            echo $field_prefix;
                            ?>
post_date" id="<?php 
                            echo $field_prefix;
//.........这里部分代码省略.........
开发者ID:r-a-y,项目名称:wa-fronted,代码行数:101,代码来源:wa-fronted.php

示例13: wp_getPostStatusList

 /**
  * Retrieve post statuses.
  *
  * @since 2.5.0
  *
  * @param array $args Method parameters.
  * @return array
  */
 function wp_getPostStatusList($args)
 {
     $this->escape($args);
     $blog_id = (int) $args[0];
     $username = $args[1];
     $password = $args[2];
     if (!($user = $this->login($username, $password))) {
         return $this->error;
     }
     if (!current_user_can('edit_posts')) {
         return new IXR_Error(403, __('You are not allowed access to details about this site.'));
     }
     do_action('xmlrpc_call', 'wp.getPostStatusList');
     return get_post_statuses();
 }
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:23,代码来源:class-wp-xmlrpc-server.php

示例14: get_post_statuses

 function get_post_statuses()
 {
     return array_merge(get_post_statuses(), array('future' => __('Scheduled', WYSIJA)));
 }
开发者ID:sontv1003,项目名称:fashionbeans,代码行数:4,代码来源:wp_tools.php

示例15: frontier_post_admin_page_general

function frontier_post_admin_page_general()
{
    //must check that the user has the required capability
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    require FRONTIER_POST_DIR . "/include/frontier_post_defaults.php";
    //include("../include/frontier_post_defaults.php");
    echo '<strong>Frontier Post  - Version: ' . FRONTIER_POST_VERSION . '</strong>';
    // ****************************************************************************
    // Save settings
    //*******************************************************************************
    // See if the user has posted us some information
    // If they did, this hidden field will be set to 'Y'
    if (isset($_POST["frontier_isupdated_general_hidden"]) && $_POST["frontier_isupdated_general_hidden"] == 'Y') {
        $fps_save_general_options = frontier_post_get_settings();
        foreach ($fps_general_option_list as $tmp_option_name) {
            if (!key_exists($tmp_option_name, $fps_save_general_options)) {
                $fps_save_general_options[$tmp_option_name] = $fps_general_defaults[$tmp_option_name];
            }
            $fps_save_general_options[$tmp_option_name] = isset($_POST[$tmp_option_name]) ? $_POST[$tmp_option_name] : "";
            //echo "Saving. ".$tmp_option_name." - Value: ".$fps_save_general_options[$tmp_option_name]."<br>";
        }
        update_option(FRONTIER_POST_SETTINGS_OPTION_NAME, $fps_save_general_options);
        // Put an settings updated message on the screen
        echo '<div class="updated"><p><strong>' . __('Settings saved.', 'frontier-post') . '</strong></p></div>';
    }
    // end update options
    $fps_general_options = frontier_post_get_settings();
    $fps_post_status_list = get_post_statuses();
    echo '<div class="wrap">';
    echo '<div class="frontier-admin-menu">';
    echo '<h2>' . __("Frontier Post Settings", "frontier-post") . '</h2>';
    echo '<hr>' . __("Documentation", "frontier_post") . ': <a href="http://wpfrontier.com/frontier-post-settings/" target="_blank">General Settings</a>';
    echo ' - <a href="http://wpfrontier.com/frontier-post-shortcodes/" target="_blank">Shortcodes</a><hr>';
    echo '<form name="frontier_post_settings" method="post" action="">';
    echo '<input type="hidden" name="frontier_isupdated_general_hidden" value="Y">';
    echo '<table border="1" cellspacing="0" cellpadding="0">';
    echo "<tr>";
    echo "<td>" . __("Allow edit of posts with comments", "frontier-post") . "</td>";
    fps_html_field("fps_edit_w_comments", 'checkbox', $fps_general_options, true);
    echo "<td>" . __("Max age in days to allow edit of post", "frontier-post") . "</td>";
    fps_html_field("fps_edit_max_age", 'text', $fps_general_options, true);
    echo "</tr><tr>";
    echo "<td>" . __("Allow deletion of posts with comments", "frontier-post") . "</td>";
    fps_html_field("fps_del_w_comments", 'checkbox', $fps_general_options, true);
    echo "<td>" . __("Max age in days to allow delete of post", "frontier-post") . "</td>";
    fps_html_field("fps_delete_max_age", 'text', $fps_general_options, true);
    echo "</tr><tr>";
    echo "<td>" . __("Number of post per page", "frontier-post") . "</td>";
    fps_html_field("fps_ppp", 'text', $fps_general_options, true);
    echo "<td>" . __("Page containing [frontier-post] shortcode", "frontier-post") . "</td>";
    echo "<td>";
    wp_dropdown_pages(array('name' => 'fps_page_id', 'id' => 'fps_page_id', 'dept' => 1, 'hide_empty' => 0, 'selected' => $fps_general_options['fps_page_id'], 'hierarchical' => true, 'show_option_none' => __('None')));
    echo "</td>";
    echo "</tr><tr>";
    echo "<td>" . __("Default status for new posts", "frontier-post") . "</td>";
    fps_html_field("fps_default_status", 'select', $fps_general_options, true, 1, $fps_post_status_list);
    echo "<td>" . __("Page for pending posts ", "frontier-post") . "</td>";
    echo "<td>";
    wp_dropdown_pages(array('name' => 'fps_pending_page_id', 'id' => 'fps_pending_page_id', 'dept' => 1, 'hide_empty' => 0, 'selected' => $fps_general_options['fps_pending_page_id'], 'hierarchical' => true, 'show_option_none' => __('None')));
    echo "</td>";
    echo '</tr></table><hr>';
    //*****************************************************************************
    // Additional options
    //*****************************************************************************
    //echo '<hr>';
    //echo '<h2>'.__("Additional options", "frontier-post").'</h2>';
    echo '<table border="1" cellspacing="	"2" cellpadding="1">';
    echo "<tr>";
    echo '<th colspan="3"></center>' . __("Additional options", "frontier-post") . '</center></th>';
    echo "</tr><tr>";
    echo "<td>" . __("Allow users to change status from Published", "frontier-post") . "</td>";
    fps_html_field("fps_change_status", 'checkbox', $fps_general_options, true, 1);
    echo "<td>" . __("Once published users can change status back to draft/pending", "frontier-post") . "</td>";
    echo "</tr><tr>";
    echo "<td>" . __("Use featured image", "frontier-post") . "</td>";
    fps_html_field("fps_show_feat_img", 'checkbox', $fps_general_options, true, 1);
    echo "<td>" . __("Enables selection of featured image from frontend form ", "frontier-post") . "(does not work perfectly)</td>";
    echo "</tr><tr>";
    echo "<td>" . __("Show link to login page", "frontier-post") . "</td>";
    fps_html_field("fps_show_login", 'checkbox', $fps_general_options, true, 1);
    echo "<td>" . __("Shows link to wp-login.php after text: Please login", "frontier-post") . "</td>";
    echo "</tr><tr>";
    echo "<td>" . __("Show add/update/delete messages", "frontier-post") . "</td>";
    fps_html_field("fps_show_msg", 'checkbox', $fps_general_options, true, 1);
    echo "<td>" . __("Show message on the form confirming a post has been added/updated/deleted", "frontier-post") . "</td>";
    echo "</tr><tr>";
    echo "<td>" . __("Show edit/delete/view icons in list", "frontier-post") . "</td>";
    fps_html_field("fps_use_icons", 'checkbox', $fps_general_options, true, 1);
    $tmptext = "<td>" . __("Show icons instead of text for edit/delete/view in list", "frontier-post");
    $tmptext .= "&nbsp" . '<img height="12px" src="' . FRONTIER_POST_URL . '/images/edit.png' . '"></img>';
    $tmptext .= "&nbsp" . '<img height="12px" src="' . FRONTIER_POST_URL . '/images/delete.png' . '"></img>';
    $tmptext .= "&nbsp" . '<img height="12px" src="' . FRONTIER_POST_URL . '/images/view.png' . '"></img>';
    $tmptext .= "</td>";
    echo $tmptext;
    echo "</tr><tr>";
    echo "<td>" . __("Hide Add New Post link on list", "frontier-post") . "</td>";
    fps_html_field("fps_hide_add_on_list", 'checkbox', $fps_general_options, true, 1);
    echo "<td>" . __("Hide add new post on list form", "frontier-post") . "</td>";
//.........这里部分代码省略.........
开发者ID:joeynimu,项目名称:frontier-post,代码行数:101,代码来源:frontier-post-admin-general.php


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