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


PHP Archive::saveEntry方法代码示例

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


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

示例1: setPlan

 /**
  * Saves $plan as this user's plan.
  * @param plan Text to save.
  * @param archive Archive settings for this plan.
  * @param timestamp Timestamp to save archive with.
  * @public
  */
 function setPlan($plan, $archive = 'N', $name = '', $timestamp = null)
 {
     if (!isset($timestamp)) {
         $timestamp = mktime();
     }
     /* save it in the archives */
     if ($archive == 'P' || $archive == 'Y') {
         $success = ARCHIVE_OK == Archive::saveEntry($this->userID, $timestamp, addslashes($plan), addslashes(htmlspecialchars($name)), $archive == 'Y' ? true : false);
     } else {
         $success = true;
     }
     $oldplan = $this->getPlan($this);
     $query = "DELETE FROM plans WHERE uid=" . $this->userID;
     $success = $success && !DB::isError($this->dbh->query($query));
     /* format the journalled plan */
     if ($this->getPreference('journal')) {
         if (!($divider = $this->getPreference('journal_divider'))) {
             $divider = PW_DIVIDER;
         }
         if ($this->getPreference('journal_order') == 'new') {
             $tmp = '';
             for ($i = 0; $i < $this->getPreference('journal_entries'); $i++) {
                 list($ts, $txt) = Archive::getEntryByIndex($this->userID, $i);
                 if ($ts == 0) {
                     break;
                 }
                 $tmp .= Planworld::getDisplayDivider($divider, $ts) . "\n";
                 $tmp .= $txt . "\n";
             }
             $plan = $tmp;
         } else {
             $tmp = '';
             for ($i = $this->getPreference('journal_entries') - 1; $i >= 0; $i--) {
                 list($ts, $txt) = Archive::getEntryByIndex($this->userID, $i);
                 if ($ts == 0) {
                     break;
                 }
                 $tmp .= Planworld::getDisplayDivider($divider, $ts) . "\n";
                 $tmp .= $txt . "\n";
             }
             $plan = $tmp;
         }
     }
     /* process snoop references */
     $success = $success && Snoop::process($this, $plan, $oldplan);
     $success = $success && $this->deleteDrafts();
     /* save the plan */
     $query = "INSERT INTO plans (uid, content) VALUES (" . $this->userID . ", '" . addslashes($plan) . "')";
     return $success && !DB::isError($this->dbh->query($query));
 }
开发者ID:jlodom,项目名称:planworld,代码行数:57,代码来源:User.php


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