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


PHP Wiki::update方法代码示例

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


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

示例1: Wiki

 function handler_ajax_update($page)
 {
     $json = json_decode(Env::v('json'));
     $wiki = new Wiki($json->wid);
     $page->jsonAssign('success', true);
     try {
         $wiki->select(Wiki::SELECT_VERSION);
         $content = trim($json->content);
         if ($content != $wiki->content()) {
             $wiki->update($content);
             $wiki->select(Wiki::SELECT_VERSION);
         }
         $page->jsonAssign('html', $wiki->html());
     } catch (Exception $e) {
         $page->jsonAssign('success', false);
     }
     return PL_JSON;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:18,代码来源:wiki.php

示例2: from

 public static function from($mixed, $insertIfNotExists = false)
 {
     try {
         $w = static::batchFrom(array($mixed))->first();
     } catch (ItemNotFoundException $e) {
         if ($insertIfNotExists) {
             $w = new Wiki(array('name' => $mixed));
             $w->insert();
             $w->update('');
         } else {
             throw $e;
         }
     }
     return $w;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:15,代码来源:wiki.php

示例3: execute

 /**
  * We already knew beforehand what handle was requested and the ID was looked up.
  * @param int $id
  * @return array(title,content)
  */
 function execute($id)
 {
     $w = new Wiki($this->db);
     $w->set($id);
     $this->dispatcher->controller->dispatcherObject = $w;
     $content = $w->revision->content;
     $handle = $w->handle;
     if (!$this->hasRights($_SESSION['access'], 'modify', $handle)) {
         return array($handle . ' - WikiCreate', 'No Permission');
     }
     $args = $this->defaultArgs;
     $args['content'] = $content;
     // Lets save it.
     if (isset($_POST['save']) && !empty($_POST['wikicontent'])) {
         // Did it actually change?
         if (htmlentities($_POST['wikicontent']) !== $content) {
             $w->update(htmlentities($_POST['wikicontent']));
             header('Location: ' . PATH_TO_DOCROOT . '/wiki/' . $handle);
             exit;
         }
     } elseif (isset($_POST['preview']) && !empty($_POST['wikicontent'])) {
         // But only if the content actually
         if (htmlentities($_POST['wikicontent']) !== $content) {
             $wv = new WikiView($this->dispatcher);
             list(, $args['preview_content']) = $wv->execute('', htmlentities($_POST['wikicontent']), false);
             $args['content'] = htmlentities($_POST['wikicontent']);
             $args['preview'] = $this->template->parse('preview', $args);
         }
     }
     $args['button_action'] = '/wiki/' . $handle;
     $args['button'] = 'Cancel';
     $args['class'] = 'buttonmargin';
     $buttons = $this->template->parse('button', $args);
     $args['handle'] = $handle;
     $args['formaction'] = '/wiki/' . $handle . '?action=edit';
     $args['actiontype'] = 'Submit changes';
     $args['buttons'] = $buttons;
     $this->siteArgs['edit']['active'] = 'active';
     $this->addSiteArgs();
     return array($handle . ' - WikiModify', $this->template->parse('create', $args));
 }
开发者ID:Barthak,项目名称:voodoo,代码行数:46,代码来源:WikiController.php


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