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


PHP Articles::clear方法代码示例

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


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

示例1: Connector

require_once "config.php";
require_once "database.php";
$db = new Connector();
$db->connect($config);
if (isset($_GET) && isset($_GET["reinit"]) && $_GET["reinit"] == "true") {
    // Reset database
    require_once "models/journal_definitions.php";
    require_once "models/journals.php";
    require_once "models/articles.php";
    $definitions_model = new Journal_definitions();
    $journal_model = new Journals();
    $article_model = new Articles();
    // Clear tables
    $definitions_model->clear($db);
    $journal_model->clear($db);
    $article_model->clear($db);
}
// Parsing the journal list csv file
if ($config["journal_list_run"] === true) {
    require_once "parsers/parse_journal_list.php";
    new Journal_list($config, $db);
}
// Parsing pubmed central XML
if ($config["pubmed_central_run"] === true) {
    require_once "parsers/pubmed_central_xml.php";
    new Pubmed_central_parser($config, $db);
}
// Parsing Ovid XML
if ($config["ovid_run"] === true) {
    require_once "parsers/ovid_xml.php";
    new Ovid_parser($config, $db);
开发者ID:AMCeScience,项目名称:article-miner,代码行数:31,代码来源:init.php

示例2: elseif

    // not found
} elseif (!isset($item['id'])) {
    include '../error.php';
    // publication is restricted
} elseif (!$permitted) {
    // anonymous users are invited to log in
    if (!Surfer::is_logged()) {
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Articles::get_url($item['id'], 'unpublish')));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // update the database
} elseif ($error = Articles::unpublish($item['id'])) {
    $context['text'] .= $error;
} else {
    // clear the cache
    Articles::clear($item);
    // display the updated page
    Safe::redirect(Articles::get_permalink($item));
}
// clear the tab we are in, if any
if (is_object($anchor)) {
    $context['current_focus'] = $anchor->get_focus();
}
// path to this page
$context['path_bar'] = Surfer::get_path_bar($anchor);
// page title
$context['page_title'] = i18n::s('Draft');
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:unpublish.php

示例3: put_attributes


//.........这里部分代码省略.........
     if (isset($fields['extra'])) {
         $query[] = "extra='" . SQL::escape($fields['extra']) . "'";
     }
     if (isset($fields['description'])) {
         $query[] = "description='" . SQL::escape($fields['description']) . "'";
     }
     if (isset($fields['file_overlay'])) {
         $query[] = "file_overlay='" . SQL::escape($fields['file_overlay']) . "'";
     }
     if (isset($fields['handle']) && $fields['handle']) {
         $query[] = "handle='" . SQL::escape($fields['handle']) . "'";
     }
     if (isset($fields['icon_url'])) {
         $query[] = "icon_url='" . SQL::escape(preg_replace('/[^\\w\\/\\.,:%&\\?=-]+/', '_', $fields['icon_url'])) . "'";
     }
     if (isset($fields['introduction'])) {
         $query[] = "introduction='" . SQL::escape($fields['introduction']) . "'";
     }
     if (isset($fields['language'])) {
         $query[] = "language='" . SQL::escape($fields['language']) . "'";
     }
     if (isset($fields['locked'])) {
         $query[] = "locked='" . SQL::escape($fields['locked']) . "'";
     }
     if (isset($fields['meta'])) {
         $query[] = "meta='" . SQL::escape($fields['meta']) . "'";
     }
     if (isset($fields['nick_name'])) {
         $query[] = "nick_name='" . SQL::escape($fields['nick_name']) . "'";
     }
     if (isset($fields['options'])) {
         $query[] = "options='" . SQL::escape($fields['options']) . "'";
     }
     if (isset($fields['overlay'])) {
         $query[] = "overlay='" . SQL::escape($fields['overlay']) . "'";
     }
     if (isset($fields['overlay_id'])) {
         $query[] = "overlay_id='" . SQL::escape($fields['overlay_id']) . "'";
     }
     if (isset($fields['owner_id'])) {
         $query[] = "owner_id=" . SQL::escape($fields['owner_id']);
     }
     if (isset($fields['publish_date'])) {
         $query[] = "publish_name='" . SQL::escape(isset($fields['publish_name']) ? $fields['publish_name'] : $fields['edit_name']) . "'";
         $query[] = "publish_id=" . SQL::escape(isset($fields['publish_id']) ? $fields['publish_id'] : $fields['edit_id']);
         $query[] = "publish_address='" . SQL::escape(isset($fields['publish_address']) ? $fields['publish_address'] : $fields['edit_address']) . "'";
         $query[] = "publish_date='" . SQL::escape($fields['publish_date']) . "'";
     }
     if (isset($fields['prefix'])) {
         $query[] = "prefix='" . SQL::escape($fields['prefix']) . "'";
     }
     if (isset($fields['rank'])) {
         $query[] = "rank='" . SQL::escape($fields['rank']) . "'";
     }
     if (isset($fields['source'])) {
         $query[] = "source='" . SQL::escape($fields['source']) . "'";
     }
     if (isset($fields['suffix'])) {
         $query[] = "suffix='" . SQL::escape($fields['suffix']) . "'";
     }
     if (isset($fields['thumbnail_url'])) {
         $query[] = "thumbnail_url='" . SQL::escape(preg_replace('/[^\\w\\/\\.,:%&\\?=-]+/', '_', $fields['thumbnail_url'])) . "'";
     }
     if (isset($fields['tags'])) {
         $query[] = "tags='" . SQL::escape($fields['tags']) . "'";
     }
     if (isset($fields['title'])) {
         $fields['title'] = strip_tags($fields['title'], '<br>');
         $query[] = "title='" . SQL::escape($fields['title']) . "'";
     }
     if (isset($fields['trailer'])) {
         $query[] = "trailer='" . SQL::escape($fields['trailer']) . "'";
     }
     if (isset($fields['rating_sum'])) {
         $query[] = "rating_sum='" . SQL::escape($fields['rating_sum']) . "'";
     }
     // nothing to update
     if (!count($query)) {
         return TRUE;
     }
     // maybe a silent update
     if (!isset($fields['silent']) || $fields['silent'] != 'Y') {
         $query[] = "edit_name='" . SQL::escape($fields['edit_name']) . "'";
         $query[] = "edit_id=" . SQL::escape($fields['edit_id']);
         $query[] = "edit_address='" . SQL::escape($fields['edit_address']) . "'";
         $query[] = "edit_action='article:update'";
         $query[] = "edit_date='" . SQL::escape($fields['edit_date']) . "'";
     }
     // actual update query
     $query = "UPDATE " . SQL::table_name('articles') . " SET " . implode(', ', $query) . " WHERE id = " . SQL::escape($fields['id']);
     if (!SQL::query($query)) {
         return FALSE;
     }
     // list the article in categories
     Categories::remember('article:' . $fields['id'], isset($fields['publish_date']) ? $fields['publish_date'] : NULL_DATE, isset($fields['tags']) ? $fields['tags'] : '');
     // clear the cache
     Articles::clear($fields);
     // end of job
     return TRUE;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:articles.php

示例4: transcode

 /**
  * transcode some references
  *
  * @see images/images.php
  *
  * @param array of pairs of strings to be used in preg_replace()
  */
 function transcode($transcoded)
 {
     global $context;
     // no item bound
     if (!isset($this->item['id'])) {
         return;
     }
     // prepare preg_replace()
     $from = array();
     $to = array();
     foreach ($transcoded as $pair) {
         $from[] = $pair[0];
         $to[] = $pair[1];
     }
     // transcode various fields
     $this->item['introduction'] = preg_replace($from, $to, $this->item['introduction']);
     $this->item['description'] = preg_replace($from, $to, $this->item['description']);
     // update the database
     $query = "UPDATE " . SQL::table_name('articles') . " SET " . " introduction = '" . SQL::escape($this->item['introduction']) . "'," . " description = '" . SQL::escape($this->item['description']) . "'" . " WHERE id = " . SQL::escape($this->item['id']);
     SQL::query($query);
     // always clear the cache
     Articles::clear($this->item);
 }
开发者ID:rair,项目名称:yacs,代码行数:30,代码来源:article.php

示例5: put_attributes

 /**
  * change only some (minor) attributes
  */
 public static function put_attributes(&$fields)
 {
     global $context;
     // id cannot be empty
     if (!isset($fields['id']) || !is_numeric($fields['id'])) {
         Logger::error(i18n::s('No item has the provided id.'));
         return FALSE;
     }
     // following fields are forbidden with this function
     if (isset($fields['password']) || isset($fields['nickname']) || isset($field['editor'])) {
         Logger::error(i18n::s('This action is forbidden with users::put_attributes function.'));
         return FALSE;
     }
     // remember who is changing this record
     Surfer::check_default_editor($fields);
     // query components
     $query = array();
     // clean provided tags
     if (isset($fields['tags'])) {
         $fields['tags'] = trim($fields['tags'], " \t.:,!?");
     }
     // protect from hackers
     if (isset($fields['avatar_url'])) {
         $fields['avatar_url'] = encode_link($fields['avatar_url']);
     }
     // build SET part of the query
     foreach ($fields as $key => $field) {
         if ($key == 'id') {
             continue;
         }
         $query[] = $key . "='" . SQL::escape($field) . "'";
     }
     // nothing to update
     if (!count($query)) {
         return TRUE;
     }
     // actual update query
     $query = "UPDATE " . SQL::table_name('users') . " SET " . implode(', ', $query) . " WHERE id = " . SQL::escape($fields['id']);
     if (!SQL::query($query)) {
         return FALSE;
     }
     // list the user in categories
     if (isset($fields['tags']) && $fields['tags']) {
         Categories::remember('user:' . $fields['id'], NULL_DATE, $fields['tags']);
     }
     // clear the cache
     Articles::clear($fields);
     // end of job
     return TRUE;
 }
开发者ID:rair,项目名称:yacs,代码行数:53,代码来源:users.php


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