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

PHP write_post函数代码示例

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

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



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

示例1: elseif

    } elseif (isset($_POST['publish'])) {
        $location = "page-new.php?posted={$page_ID}";
    } elseif ($action == 'editattachment') {
        $location = 'attachments.php';
    } else {
        $location = "page.php?action=edit&post={$page_ID}&message=4";
    }
    wp_redirect($location);
}
if (isset($_POST['deletepost'])) {
    $action = "delete";
}
switch ($action) {
    case 'post':
        check_admin_referer('add-page');
        $page_ID = write_post();
        redirect_page($page_ID);
        exit;
        break;
    case 'edit':
        $title = __('Edit');
        $editing = true;
        $page_ID = $post_ID = $p = (int) $_GET['post'];
        $post = get_post_to_edit($page_ID);
        if (empty($post->ID)) {
            wp_die(__("You attempted to edit a page that doesn't exist. Perhaps it was deleted?"));
        }
        if ('page' != $post->post_type) {
            wp_redirect(get_edit_post_link($post_ID, 'url'));
            exit;
        }
开发者ID:alx,项目名称:blogsfera,代码行数:31,代码来源:page.php


示例2: switch

if (isset($_POST['deletepost'])) {
$action = "delete";
}

// Fix submenu highlighting for pages.
if ( isset($_REQUEST['post']) && 'static' == get_post_status($_REQUEST['post']) )
	$submenu_file = 'page-new.php';

$editing = true;

switch($action) {
case 'post':
	check_admin_referer('add-post');
	
	$post_ID = write_post();

	// Redirect.
	if (!empty($_POST['mode'])) {
	switch($_POST['mode']) {
		case 'bookmarklet':
			$location = $_POST['referredby'];
			break;
		case 'sidebar':
			$location = 'sidebar.php?a=b';
			break;
		default:
			$location = 'post.php';
			break;
		}
	} else {
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:30,代码来源:post.php


示例3: wp_dashboard_quick_press

         exit;
     }
     if ($error_msg) {
         return wp_dashboard_quick_press($error_msg);
     }
     $post = get_post($_REQUEST['post_ID']);
     check_admin_referer('add-' . $post->post_type);
     $_POST['comment_status'] = get_default_comment_status($post->post_type);
     $_POST['ping_status'] = get_default_comment_status($post->post_type, 'pingback');
     edit_post();
     wp_dashboard_quick_press();
     exit;
 case 'postajaxpost':
 case 'post':
     check_admin_referer('add-' . $post_type);
     $post_id = 'postajaxpost' == $action ? edit_post() : write_post();
     redirect_post($post_id);
     exit;
 case 'edit':
     $editing = true;
     if (empty($post_id)) {
         wp_redirect(admin_url('post.php'));
         exit;
     }
     if (!$post) {
         wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?'));
     }
     if (!$post_type_object) {
         wp_die(__('Unknown post type.'));
     }
     if (!in_array($typenow, get_post_types(array('show_ui' => true)))) {
开发者ID:pbearne,项目名称:contrib2core,代码行数:31,代码来源:post.php


示例4: ajax_submit_custom_content

 /**
  * Handles the post back from the edit content form.  This isn't really a
  * ajax post back, but it was the easiest way to handle the request without
  * a bunch of url/include handling.
  *
  * @todo change this to work like the manage page works instead.
  *
  */
 public function ajax_submit_custom_content()
 {
     $action = $_POST['hiddenaction'];
     $post_type = $_POST['post_type'];
     do_action('submit_custom_content', $post_type, $action);
     if ($handler = $this->get_content_handler($post_type)) {
         switch ($action) {
             case 'post':
                 check_admin_referer('add-post');
                 $post_ID = write_post();
                 $handler->redirect_content($post_ID);
                 exit;
                 break;
             case 'editpost':
                 $post_ID = (int) $_POST['post_ID'];
                 check_admin_referer('update-post_' . $post_ID);
                 if (!current_user_can('edit_post', $post_ID)) {
                     wp_die(__('You are not allowed to edit this post.'));
                 }
                 $post_data =& $_POST;
                 $handler->update_content($post_ID, $post_data);
                 break;
         }
     }
     die(0);
 }
开发者ID:voceconnect,项目名称:cms-press,代码行数:34,代码来源:cp-custom-content-core.php


示例5: strpos

  strpos( $sendback, 'post-new.php' ) !== false ) {
  if ( 'attachment' == $post_type ) {
  $sendback = admin_url( 'upload.php' );
  } else {
  $sendback = admin_url( 'edit.php' );
  $sendback .= ( ! empty( $post_type ) ) ? '?post_type=' . $post_type : '';
  }
  } else {
  $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
  } */
switch ($action) {
    case 'post':
        check_admin_referer('add-' . $post_type);
        $_POST['publish'] = 'publish';
        // tell write_post() to publish
        $post_id = write_post();
        redirect_post($post_id, $_url);
        exit;
        break;
    case 'editpost':
        check_admin_referer('update-post_' . $post_id);
        $post_id = edit_post();
        redirect_post($post_id, $_url);
        // Send user on their way while we keep working
        exit;
        break;
    case 'edit':
    default:
        $editing = true;
        if (empty($post_id)) {
            wp_redirect(admin_url('admin.php') . '?page=CRED_Forms');
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:31,代码来源:edit-form.php


示例6: elseif

        $location = "post-new.php?posted={$post_ID}";
    } elseif ($action == 'editattachment') {
        $location = 'attachments.php';
    } else {
        $location = "post.php?action=edit&post={$post_ID}&message=4";
    }
    wp_redirect($location);
}
if (isset($_POST['deletepost'])) {
    $action = 'delete';
}
switch ($action) {
    case 'postajaxpost':
    case 'post':
        check_admin_referer('add-post');
        $post_ID = 'post' == $action ? write_post() : edit_post();
        redirect_post($post_ID);
        exit;
        break;
    case 'edit':
        $title = __('Edit');
        $editing = true;
        if (empty($_GET['post'])) {
            wp_redirect("post.php");
            exit;
        }
        $post_ID = $p = (int) $_GET['post'];
        $post = get_post($post_ID);
        if (empty($post->ID)) {
            wp_die(__("You attempted to edit a post that doesn't exist. Perhaps it was deleted?"));
        }
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:post.php


示例7: form_handler

 public function form_handler()
 {
     if (isset($_POST['post_ID'])) {
         require_once ABSPATH . '/wp-admin/includes/post.php';
         $action = isset($_POST['action']) ? $_POST['action'] : '';
         if (isset($_GET['post'])) {
             $post_id = $post_ID = (int) $_GET['post'];
         } elseif (isset($_POST['post_ID'])) {
             $post_id = $post_ID = (int) $_POST['post_ID'];
         } else {
             $post_id = $post_ID = 0;
         }
         $post = $post_type = $post_type_object = null;
         if ($post_id) {
             $post = get_post($post_id);
         }
         if ($post) {
             $post_type = $post->post_type;
             $post_type_object = get_post_type_object($post_type);
         }
         if (isset($_POST['deletepost'])) {
             $action = 'delete';
         } elseif (isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview']) {
             $action = 'preview';
         }
         $sendback = wp_get_referer();
         if (!$sendback || strpos($sendback, 'post.php') !== false || strpos($sendback, 'post-new.php') !== false) {
             if ('attachment' == $post_type) {
                 $sendback = admin_url('upload.php');
             } else {
                 $sendback = admin_url('edit.php');
                 $sendback .= !empty($post_type) ? '?post_type=' . $post_type : '';
             }
         } else {
             $sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'ids'), $sendback);
         }
         switch ($action) {
             case 'postajaxpost':
             case 'post':
                 check_admin_referer('add-' . $post_type);
                 $post_id = 'postajaxpost' == $action ? edit_post() : write_post();
                 $this->redirect_post($post_id);
                 exit;
                 break;
             case 'editpost':
                 wp_verify_nonce('update-post_' . $post_id);
                 $post_id = edit_post();
                 // Session cookie flag that the post was saved
                 if (isset($_COOKIE['wp-saving-post-' . $post_id])) {
                     setcookie('wp-saving-post-' . $post_id, 'saved');
                 }
                 $this->redirect_post($post_id);
                 // Send user on their way while we keep working
                 exit;
                 break;
             case 'trash':
                 check_admin_referer('trash-post_' . $post_id);
                 if (!$post) {
                     wp_die(__('The item you are trying to move to the Trash no longer exists.'));
                 }
                 if (!$post_type_object) {
                     wp_die(__('Unknown post type.'));
                 }
                 if (!current_user_can('delete_post', $post_id)) {
                     wp_die(__('You are not allowed to move this item to the Trash.'));
                 }
                 if ($user_id = wp_check_post_lock($post_id)) {
                     $user = get_userdata($user_id);
                     wp_die(sprintf(__('You cannot move this item to the Trash. %s is currently editing.'), $user->display_name));
                 }
                 if (!wp_trash_post($post_id)) {
                     wp_die(__('Error in moving to Trash.'));
                 }
                 wp_redirect(add_query_arg(array('trashed' => 1, 'ids' => $post_id), $sendback));
                 exit;
                 break;
             case 'preview':
                 check_admin_referer('update-post_' . $post_id);
                 $url = post_preview();
                 wp_redirect($url);
                 exit;
                 break;
         }
         // end switch
     }
 }
开发者ID:VadimSid,项目名称:thinkgreek,代码行数:86,代码来源:class-bon-front-end-editor.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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