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


PHP post::save方法代码示例

本文整理汇总了PHP中post::save方法的典型用法代码示例。如果您正苦于以下问题:PHP post::save方法的具体用法?PHP post::save怎么用?PHP post::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在post的用法示例。


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

示例1: edit

 public function edit($id = NULL)
 {
     $id = (int) $id;
     if (!$id) {
         $this->redirect('admin');
     }
     $statuses = array("publish", "draft");
     if ($this->data) {
         if (isset($this->data['cancelar'])) {
             $this->redirect("admin/");
         } else {
             $P = new post();
             $P->find($id);
             if (!preg_match("/\\S+/", $this->data['title']) or $this->data['title'] == "") {
                 $this->data['title'] = "Untitled";
             }
             if (!preg_match("/\\S+/", $this->data['urlfriendly']) or $this->data['urlfriendly'] == "") {
                 $this->data['urlfriendly'] = $this->data['title'];
             }
             $this->data['urlfriendly'] = $P->buildUrl($this->data['urlfriendly'], $id);
             $P->updateTags($id, $this->data['tags']);
             unset($this->data['tags']);
             $P->prepareFromArray($this->data);
             $P->save();
             $this->session->flash('Información guardada correctamente.');
             $this->redirect("admin/edit/{$id}");
         }
     }
     $P = new post();
     $post = $P->find($id);
     $post['title'] = utils::convert2HTML($P['title']);
     $post['content'] = utils::convert2HTML($P['content']);
     $post['tags'] = $P->getTags($id, 'string');
     $this->title_for_layout($this->l10n->__("Editar post - Codice CMS"));
     $this->view->id = $id;
     $this->view->post = $post;
     $this->view->statuses = $statuses;
     $this->view->setLayout("admin");
     $this->render();
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:40,代码来源:admin_controller.php

示例2: intval

<?php

require "../../includes/conf.inc.php";
require "../../includes/functions.inc.php";
if (isset($_POST['id'])) {
    $id = intval($_POST['id']);
    $postTitle = $_POST['postTitle'];
    $textArea = $_POST['postText'];
    $imp = $_POST['imp'];
    $postTitle = ucfirst(sanitize_text($postTitle));
    $textArea = trim(mysql_real_escape_string(stripslashes($textArea)));
    if ($postTitle == '' || $textArea == '') {
        $response = array('success' => 0, 'error' => 1, 'errorMsg' => 'Either Post Title Or Post Body is empty!');
    } else {
        $newPost = array('postTitle' => $postTitle, 'postText' => $textArea, 'imp' => $imp);
        if (!post::save($newPost, $id)) {
            $response = array('success' => 0, 'error' => 2, 'errorMsg' => 'Opps! Something Went Wrong!');
        } else {
            $response = array('success' => 1, 'error' => 0);
        }
    }
    echo json_encode($response);
}
开发者ID:amriterry,项目名称:ptn,代码行数:23,代码来源:update.php

示例3: array

<?php

require "../../includes/conf.inc.php";
require "../../includes/functions.inc.php";
if (isset($_POST['postId'])) {
    $postId = $_POST['postId'];
    if (!post::save(array('statusId' => 1), $postId)) {
        $response = array('success' => 0, 'error' => 1, 'errorMsg' => 'Opps! Something Went Wrong! Please Try Again Later', 'debugMsg' => mysql_error());
    } else {
        $post = post::view($postId, 1);
        $postTitle = $post['postTitle'];
        $previewLink = '<a href="' . generate_link($postTitle, $postId) . '" target="_blank" class="ico_preview"></a>';
        $response = array('success' => 1, 'preview' => $previewLink, 'error' => 0);
    }
    echo json_encode($response);
}
开发者ID:amriterry,项目名称:ptn,代码行数:16,代码来源:publish.php

示例4: testPost

 public static function testPost($request, $context)
 {
     $data = array("texte" => $request["texte"], "date" => $request["date"], "image" => $request["image"]);
     $post = new post($data);
     $post->id = $post->save();
     if (is_null($post->id)) {
         return NULL;
     } else {
         return $post;
     }
 }
开发者ID:uy-rrodriguez,项目名称:twitty,代码行数:11,代码来源:mainController.php

示例5: tweetme

 public static function tweetme($request, $context)
 {
     //print_r($request);
     if (!empty($request['tweetform'])) {
         $image = empty($request['image']) ? "null" : $request['image'];
         $postInfo['texte'] = $request['text'];
         $postInfo['image'] = $image;
         $postInfo['date'] = date("Y-m-d H:i:s");
         $post = new post($postInfo);
         $idPost = $post->save();
         //print_r($idPost);
         $tweetInfo['emetteur'] = $context->getSessionAttribute('id');
         $tweetInfo['parent'] = $context->getSessionAttribute('id');
         $tweetInfo['post'] = $idpost;
         $tweet = new tweet($tweetInfo);
         $idTweet = $tweet->save();
         //print_r($idTweet);
         return context::SUCCESS;
     }
     return context::ERROR;
 }
开发者ID:nikyasu,项目名称:TweetLkProject,代码行数:21,代码来源:mainController.php

示例6: save_edit_post

 private function save_edit_post($data)
 {
     if (isset($data['cat']) && isset($data['thread']) && isset($data['post']) && isset($data['content']) && !$this->banned()) {
         // Set variables
         $category_id = $data['cat'];
         $thread_id = $data['thread'];
         $post_id = $data['post'];
         //Fetch post to edit
         $post = post::get($data['post']);
         $editTime = Time();
         $content = $data['content'];
         //Fetch forum data
         // $category = category::get($category);
         // $thread = thread::get($thread);
         thread::update_post_count($thread_id);
         if ($this->user['Username'] == $post['author'] || $this->user['SiteRank'] >= 4) {
             $result = post::save($category_id, $thread_id, $post_id, $content, $editTime, $this->user);
         } else {
             self::errorJSON('You do not have permission to edit this post!');
         }
     } else {
         self::errorJSON('Something went wrong!');
     }
 }
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:24,代码来源:forum.worker.php


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