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


PHP Content::add方法代码示例

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


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

示例1: add

 /**
  * 发表文章
  */
 public function add()
 {
     if (IS_POST) {
         $mid = $this->_category[$this->_cid]['mid'];
         $ContentModel = new Content($mid);
         if ($ContentModel->add($_POST)) {
             $this->success('发表成功!');
         } else {
             $this->error($ContentModel->error);
         }
     } else {
         if (!$this->_cid) {
             $this->error('栏目不能为空');
         }
         $category = $this->_category[$this->_cid];
         $_REQUEST['mid'] = $mid = $category['mid'];
         if ($category['cattype'] != 1) {
             $this->error('本栏目不能发表文章');
         }
         //获取分配字段
         $form = K('ContentForm');
         $this->form = $form->get();
         //分配验证规则
         $this->formValidate = $form->formValidate;
         $this->display();
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:30,代码来源:ContentControl.class.php

示例2: add

 public function add()
 {
     if (!$this->ContentAccess->isAdd($this->_cid)) {
         $this->error('没有操作权限<script>setTimeout(function(){window.close();},1000)</script>');
     }
     if (IS_POST) {
         $mid = $this->_category[$this->_cid]['mid'];
         $ContentModel = new Content($mid);
         if ($aid = $ContentModel->add($_POST)) {
             $this->success('发表成功!');
         } else {
             $this->error($ContentModel->error);
         }
     } else {
         if (!$this->_cid) {
             $this->error('栏目不能为空');
         }
         $category = $this->_category[$this->_cid];
         $_REQUEST['mid'] = $mid = $category['mid'];
         if ($category['cattype'] != 1) {
             $this->error('本栏目不能发表文章');
         }
         //获取分配字段
         $form = K('ContentForm');
         $this->form = $form->get();
         //分配验证规则
         $this->formValidate = $form->formValidate;
         $this->display();
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:30,代码来源:ContentControl.class.php

示例3: addContent

 /**
  * Adds an item to the page content (content).
  * @param mixed $content
  * @param boolean $returnAdded
  * @return self|mixed
  */
 public function addContent($content, $returnAdded = false)
 {
     $this->_content->add($content);
     if ($returnAdded === true) {
         return $content;
     }
     return $this;
 }
开发者ID:TechnoSoluciones,项目名称:B2C,代码行数:14,代码来源:Page.php

示例4: add

 public function add()
 {
     if (IS_POST) {
         $ContentModel = new Content();
         if ($ContentModel->add($_POST)) {
             $this->success('发表成功!', U('content', array('mid' => $this->mid)));
         } else {
             $this->error($ContentModel->error);
         }
     } else {
         //获取分配字段
         $model = K('ContentForm');
         $this->assign('form', $model->get());
         //分配验证规则
         $this->assign('formValidate', $model->formValidate);
         $this->display();
     }
 }
开发者ID:lililishuang,项目名称:hdcms,代码行数:18,代码来源:ContentController.class.php

示例5: addAction

 /** Add contents
  */
 public function addAction()
 {
     $form = new ContentForm();
     $form->submit->setLabel('Add new content to system');
     $form->author->setValue($this->getIdentityForForms());
     $this->view->form = $form;
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) {
         if ($form->isValid($form->getValues())) {
             $insertData = $form->getValues();
             $content = new Content();
             $insert = $content->add($insertData);
             $this->_helper->solrUpdater->update('beocontent', $insert);
             $this->_flashMessenger->addMessage('Static content added');
             $this->_redirect('/admin/content');
         } else {
             $form->populate($form->getValues());
         }
     }
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:21,代码来源:ContentController.php

示例6: add

 /**
  * 添加信息 
  */
 public function add()
 {
     if (IS_POST) {
         //栏目ID
         $catid = $_POST['info']['catid'] = intval($_POST['info']['catid']);
         if (empty($catid)) {
             $this->error("请指定栏目ID!");
         }
         if (trim($_POST['info']['title']) == '') {
             $this->error("标题不能为空!");
         }
         //获取当前栏目配置
         $category = $this->categorys[$catid];
         //栏目类型为0
         if ($category['type'] == 0) {
             //模型ID
             $this->modelid = $modelid = $this->categorys[$catid]['modelid'];
             //检查模型是否被禁用
             if ($this->Model[$modelid]['disabled'] == 1) {
                 $this->error("模型被禁用!");
             }
             //setting 配置
             $setting = unserialize($category['setting']);
             import('Content');
             $Content = new Content();
             $status = $Content->add($_POST['info']);
             if ($status) {
                 $this->success("添加成功!");
             } else {
                 $this->error("添加失败!");
             }
         } else {
             $this->error("该栏目类型无法发布!");
         }
     } else {
         $catid = $this->_get("catid");
         //取得对应模型
         $category = $this->categorys[$catid];
         if (empty($category)) {
             $this->error("参数错误!");
         }
         //判断是否终极栏目
         if ($category['child']) {
             $this->error("只有终极栏目可以发布文章!");
         }
         //模型ID
         $modelid = $category['modelid'];
         //检查模型是否被禁用
         if ($this->Model[$modelid]['disabled'] == 1) {
             $this->error("模型被禁用!");
         }
         //取模型ID,依模型ID来生成对应的表单
         require_cache(RUNTIME_PATH . 'content_form.class.php');
         //实例化表单类 传入 模型ID 栏目ID 栏目数组
         $content_form = new content_form($modelid, $catid, $this->categorys);
         //生成对应字段的输入表单
         $forminfos = $content_form->get();
         //生成对应的JS验证规则
         $formValidateRules = $content_form->formValidateRules;
         //js验证不通过提示语
         $formValidateMessages = $content_form->formValidateMessages;
         //js
         $formJavascript = $content_form->formJavascript;
         //取得当前栏目setting配置信息
         $setting = unserialize($category['setting']);
         $workflowid = $setting['workflowid'];
         //当前登陆用户名
         $admin_username = AppframeAction::$Cache["username"];
         //var_dump($category);exit;
         $this->assign("catid", $catid);
         $this->assign("uploadurl", CONFIG_SITEFILEURL);
         $this->assign("content_form", $content_form);
         $this->assign("forminfos", $forminfos);
         $this->assign("formValidateRules", $formValidateRules);
         $this->assign("formValidateMessages", $formValidateMessages);
         $this->assign("formJavascript", $formJavascript);
         $this->assign("setting", $setting);
         $this->assign("admin_username", $admin_username);
         $this->assign("category", $category);
         $this->assign("workflowid", $workflowid);
         $this->display();
     }
 }
开发者ID:BGCX262,项目名称:ztoa-svn-to-git,代码行数:86,代码来源:ContentAction.class.php

示例7: add

 public function add()
 {
     if (IS_POST) {
         $ContentModel = new Content($this->_mid);
         if ($ContentModel->add($_POST)) {
             $this->success('发表成功!');
         } else {
             $this->error($ContentModel->error);
         }
     } else {
         //获取分配字段
         $form = K('ContentForm');
         $this->form = $form->get();
         //分配验证规则
         $this->formValidate = $form->formValidate;
         $this->display('add.php');
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:18,代码来源:ContentControl.class.php

示例8: call

 public static function call()
 {
     $task = $_POST['task'];
     if ($task == 'getContent' && isset($_POST['title'])) {
         include_once 'Content.php';
         Content::getFromTitle();
     } else {
         if ($task == 'getContent') {
             include_once 'Content.php';
             Content::get();
         } else {
             if ($task == 'addContent') {
                 include_once 'Content.php';
                 Content::add();
             } else {
                 if ($task == 'editContent') {
                     include_once 'Content.php';
                     Content::edit();
                 } else {
                     if ($task == 'deleteContent') {
                         include_once 'Content.php';
                         Content::remove();
                     } else {
                         if ($task == 'getType') {
                             include_once 'Type.php';
                             Type::get();
                         } else {
                             if ($task == 'addType') {
                                 include_once 'Type.php';
                                 Type::add();
                             } else {
                                 if ($task == 'editType') {
                                     include_once 'Type.php';
                                     Type::edit();
                                 } else {
                                     if ($task == 'deleteType') {
                                         include_once 'Type.php';
                                         Type::remove();
                                     } else {
                                         if ($task == 'getContentOnUser') {
                                             include_once 'ContentOnUser.php';
                                             ContentOnUser::get();
                                         } else {
                                             if ($task == 'addContentToUser') {
                                                 include_once 'ContentOnUser.php';
                                                 ContentOnUser::add();
                                             } else {
                                                 if ($task == 'editContentOnUser') {
                                                     include_once 'ContentOnUser.php';
                                                     ContentOnUser::edit();
                                                 } else {
                                                     if ($task == 'removeContentFromUser') {
                                                         include_once 'ContentOnUser.php';
                                                         ContentOnUser::remove();
                                                     } else {
                                                         if ($task == 'useContentOnUser') {
                                                             include_once 'ContentOnUser.php';
                                                             ContentOnUser::useContentOnUser();
                                                         } else {
                                                             if ($task == 'getUser') {
                                                                 include_once 'User.php';
                                                                 User::get();
                                                             } else {
                                                                 echo "Task not recognized.<br>";
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:therubberduck,项目名称:norn,代码行数:80,代码来源:Webservice.php

示例9: array

<?php

Config::$page_includes = array();
include PATH_CLASS . 'bspapi.class.php';
$settings = array('account_id' => 34169, 'secret_key' => '7ad8eec0a901b74ff8846cdfd923510991f86225', 'mode' => 'test');
$bsp = new BspApi($settings);
$response = $bsp->image($_GET['id']);
$response = json_decode($response);
if ($response->response_code != 200) {
    exit('ERROR: ' . $response->response_code . ' ' . $response->data->error->message);
}
$image = $response->data->image;
$content = new Content();
Content::$page->add('title', 'BiggerStock Images - ' . $image->title);
$content->add('image', $image);
// Add route content to page
$content->loadTemplate($_ROUTES_[Core::$current_route]['template']);
$content->addToPage();
unset($content);
开发者ID:shutterstock,项目名称:basecoat,代码行数:19,代码来源:image.php

示例10: Content

require_once "../bd.php";
//Include connect to BD
require_once '../classes/base.php';
// Include main classes
//Add entries
if (isset($_POST['submit'])) {
    //echo $_POST['title'] . '|' . $_POST['tags'] . '|' . iconv('UTF-8', 'windows-1251', $_POST['content']);
    $addObject = new Content();
    $title = iconv('UTF-8', 'windows-1251', $_POST['title']);
    $tags = iconv('UTF-8', 'windows-1251', $_POST['tags']);
    $content = iconv('UTF-8', 'windows-1251', $_POST['content']);
    if ($title == '' || $tags == '' || $content == '') {
        echo 'False';
    } else {
        if ($addObject->add($title, $tags, $content, 'On')) {
            echo 'True';
        } else {
            echo 'False';
        }
    }
}
//Update entries
if (isset($_POST['submit_edit'])) {
    $addObject = new Content();
    $title = iconv('UTF-8', 'windows-1251', $_POST['title']);
    $tags = iconv('UTF-8', 'windows-1251', $_POST['tags']);
    $content = iconv('UTF-8', 'windows-1251', $_POST['content']);
    $status = iconv('UTF-8', 'windows-1251', $_POST['status']);
    $id = $_POST['editId'];
    if ($title == '' || $tags == '' || $content == '') {
开发者ID:ViktorLomakin,项目名称:work,代码行数:30,代码来源:ajax.php

示例11: add

 public function add()
 {
     if (!$this->ContentAccess->isAdd($this->_cid)) {
         $this->error('没有操作权限<script>setTimeout(function(){window.close();},1000)</script>');
     }
     if (IS_POST) {
         $ContentModel = new Content($this->_mid);
         if ($ContentModel->add($_POST)) {
             $this->success('发表成功!');
         } else {
             $this->error($ContentModel->error);
         }
     } else {
         //获取分配字段
         $form = K('ContentForm');
         $this->form = $form->get();
         //分配验证规则
         $this->formValidate = $form->formValidate;
         $this->display('add.php');
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:21,代码来源:ContentControl.class.php

示例12: Content

<?php

require_once "ClassLoader.php";
echo "<h1>Testing Content.php and Element.php</h1>";
echo "Adding content to sections...<br/><br/>";
// No pre-defined sections
$content = new Content();
$content->add("<h1>Hello World</h1>");
$content->addText("How are you?", 0);
$content->addFile("include-me.inc", "main");
// add index based section
$content->addHtml("<div class='aside'>#1 in the tri-county</div>", "alt");
$content->addHtml("<div class='aside'>Father's Day Sale this weekend</div>", 1);
echo "<h2>Debug String</h2>";
echo "<pre>";
echo $content->debugStr();
echo "</pre>";
echo "<br/><br/>";
// retrieve all
echo "All content...<br/>";
$elements = $content->elements();
foreach ($elements as $e) {
    echo "[" . $e->contentType() . "]" . $e->data() . "<br/>";
}
// retrieve first section
echo "<br/><hr/><br/>First section content...<br/>";
$elements = $content->elements(0);
foreach ($elements as $e) {
    echo "[" . $e->contentType() . "]" . $e->data() . "<br/>";
}
// retrieve second section
开发者ID:benjaminhough,项目名称:blueprints-web-kit,代码行数:31,代码来源:content.php

示例13: catch

<?php

try {
    $response = $bsp->search(array('q' => $_GET['words']));
} catch (BspApiException $e) {
    echo $e->getMessage();
    exit;
}
$response = json_decode($response);
if ($response->response_code != 200) {
    exit('ERROR: ' . $response->response_code . ' ' . $response->message);
}
$paging = $response->data->paging;
$images = $response->data->images;
$content = new Content();
Content::$page->add('title', 'BiggerStock Images - ');
$content->add('total_images', number_format($paging->total_items));
$content->add('page_no', number_format($paging->page));
$content->add('page_count', number_format($paging->total_pages));
$content->add('images', $images);
// Add route content to page
$content->loadTemplate($_ROUTES_[Core::$current_route]['template']);
$content->addToPage();
unset($content);
开发者ID:shutterstock,项目名称:basecoat,代码行数:24,代码来源:search.php

示例14: add

 /**
  * 在线投稿 
  */
 public function add()
 {
     $CategoryPriv = M("CategoryPriv");
     if (IS_POST) {
         //栏目ID
         $catid = $_POST['info']['catid'] = intval($_POST['info']['catid']);
         if (empty($catid)) {
             $this->error("请指定栏目ID!");
         }
         $Prv = $CategoryPriv->where(array("catid" => $catid, "roleid" => AppframeAction::$Cache['User']['groupid'], "is_admin" => 0, "action" => "add"))->find();
         if (!$Prv) {
             $this->error("您没有该栏目投稿权限!");
         }
         if (trim($_POST['info']['title']) == '') {
             $this->error("标题不能为空!");
         }
         //获取当前栏目配置
         $category = $this->categorys[$catid];
         //栏目类型为0
         if ($category['type'] == 0) {
             //模型ID
             $this->modelid = $modelid = $this->categorys[$catid]['modelid'];
             //检查模型是否被禁用
             if ($this->Model[$modelid]['disabled'] == 1) {
                 $this->error("模型被禁用!");
             }
             //setting 配置
             $setting = unserialize($category['setting']);
             import('Content');
             define("GROUP_MODULE", "Contents");
             $Content = new Content();
             $id = $Content->add($_POST['info']);
             if ($id) {
                 //前台投稿,根据栏目配置和用户配置
                 $Member_group = F("Member_group");
                 $groupid = AppframeAction::$Cache['User']['groupid'];
                 //如果会员组设置中设置,投稿不需要审核,直接无视栏目设置
                 if ($Member_group[$groupid]['allowpostverify'] || (int) $setting['member_check'] == 0) {
                     if (service("Passport")->user_integral(AppframeAction::$Cache['uid'], $setting['member_addpoint'])) {
                         $integral = 1;
                     } else {
                         $integral = 0;
                     }
                 } else {
                     $integral = 0;
                 }
                 //添加投稿记录
                 M("MemberContent")->add(array("catid" => $catid, "content_id" => $id, "userid" => AppframeAction::$Cache['uid'], 'integral' => $integral, "time" => time()));
                 $this->success("投稿成功!", U("Content/mybutors"));
             } else {
                 $this->error("投稿失败!");
             }
         } else {
             $this->error("该栏目类型无法发布!");
         }
     } else {
         import("Tree");
         $tree = new Tree();
         $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ', '&nbsp;&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;&nbsp;└─ ');
         $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
         $str = "<option value='\$catid' \$selected \$disabled>\$spacer \$catname</option>";
         //栏目列表 可以用缓存的方式
         $array = $this->categorys;
         //栏目ID
         $catid = $this->_get("catid");
         //查询出全部权限
         $Prv = $CategoryPriv->where(array("is_admin" => 0, "action" => "add"))->select();
         foreach ($array as $k => $v) {
             if ($v['catid'] == $catid) {
                 $array[$k]['selected'] = "selected";
             }
             if (in_array(array("catid" => $v['catid'], "roleid" => AppframeAction::$Cache['User']['groupid'], "is_admin" => 0, "action" => "add"), $Prv)) {
                 //只有终极栏目可以发表
                 if ($v['child'] == 1) {
                     $array[$k]['disabled'] = "disabled";
                 } else {
                     $array[$k]['disabled'] = "";
                 }
             } else {
                 $array[$k]['disabled'] = "disabled";
             }
         }
         $tree->init($array);
         $categorydata = $tree->get_tree(0, $str, $parentid);
         $this->assign("catid", false);
         $this->assign("Category", $categorydata);
         //如果取不到栏目ID,显示栏目列表
         if (!$catid) {
             $this->display();
             exit;
         }
         $catid = $this->_get("catid");
         //取得对应模型
         $category = $this->categorys[$catid];
         if (empty($category)) {
             $this->error("参数错误!");
         }
//.........这里部分代码省略.........
开发者ID:BGCX262,项目名称:ztoa-svn-to-git,代码行数:101,代码来源:ContentAction.class.php


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