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


PHP Articles::stamp方法代码示例

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


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

示例1: elseif

    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // page has already been published
} elseif (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // publication is confirmed
} elseif (isset($_REQUEST['publish_date']) && $_REQUEST['publish_date'] > NULL_DATE) {
    // convert dates from surfer time zone to UTC time zone
    $_REQUEST['publish_date'] = Surfer::to_GMT($_REQUEST['publish_date']);
    if (isset($_REQUEST['expiry_date']) && $_REQUEST['expiry_date'] > NULL_DATE) {
        $_REQUEST['expiry_date'] = Surfer::to_GMT($_REQUEST['expiry_date']);
    }
    // update the database
    if ($error = Articles::stamp($item['id'], $_REQUEST['publish_date'], isset($_REQUEST['expiry_date']) ? $_REQUEST['expiry_date'] : NULL_DATE)) {
        Logger::error($error);
    } else {
        // reflect in memory what has been saved in database
        $item['publish_date'] = $_REQUEST['publish_date'];
        // send to watchers of this page, and to watchers upwards
        $watching_context = new Article();
        $watching_context->load_by_content($item, $anchor);
        // do whatever is necessary on page publication
        Articles::finalize_publication($watching_context, $item, $overlay, isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y', isset($_REQUEST['notify_followers']) && $_REQUEST['notify_followers'] == 'Y');
        // splash messages
        $context['text'] .= '<p>' . i18n::s('The page has been successfully published.') . "</p>\n";
        // list persons that have been notified
        $context['text'] .= Mailer::build_recipients('article:' . $item['id']);
        // clear the cache
        Articles::clear($item);
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:publish.php

示例2: elseif

        $menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), i18n::s('Manage it'), 'span');
        $follow_up .= Skin::finalize_list($menu, 'menu_bar');
        $context['text'] .= Skin::build_block($follow_up, 'bottom');
        // nothing to do
    } else {
        Logger::error(i18n::s('No page has been selected.'));
    }
    // publish pages
} elseif ($action == 'publish_articles') {
    // articles
    if (isset($_REQUEST['selected_articles'])) {
        $count = 0;
        foreach ($_REQUEST['selected_articles'] as $dummy => $id) {
            // the article to publish
            if (($article = Articles::get($id)) && $article['publish_date'] <= NULL_DATE) {
                if (!Articles::stamp($article['id'], gmstrftime('%Y-%m-%d %H:%M:%S'), '')) {
                    $count++;
                }
            }
        }
        // clear cache for containing section
        Sections::clear($item);
        // report on results
        $context['text'] .= '<p>' . sprintf(i18n::ns('%d page has been published.', '%d pages have been published.', $count), $count) . '</p>';
        // follow-up commands
        $follow_up = i18n::s('What do you want to do now?');
        $menu = array();
        $menu[] = Skin::build_link(Sections::get_permalink($item), i18n::s('View the section'), 'span');
        $menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), i18n::s('Manage it'), 'span');
        $follow_up .= Skin::finalize_list($menu, 'menu_bar');
        $context['text'] .= Skin::build_block($follow_up, 'bottom');
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:manage.php

示例3: array_merge

    $menu = array_merge($menu, array('articles/review.php#expired' => i18n::s('Review queue')));
    $follow_up .= Skin::build_list($menu, 'menu_bar');
    $context['text'] .= Skin::build_block($follow_up, 'bottom');
    // new publication date
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'publish') {
    // convert from surfer time zone to UTC time zone
    if (isset($_REQUEST['publish_date']) && $_REQUEST['publish_date'] > NULL_DATE) {
        $_REQUEST['publish_date'] = Surfer::to_GMT($_REQUEST['publish_date']);
    }
    // reset the publication date
    if (!isset($_REQUEST['publish_date']) || $_REQUEST['publish_date'] <= '0000-00-00') {
        $query = "UPDATE " . SQL::table_name('articles') . " SET publish_date='" . NULL_DATE . "' WHERE id = " . SQL::escape($item['id']);
        SQL::query($query);
        $context['text'] .= '<p>' . i18n::s('The publication date has been removed.') . "</p>\n";
        // update the database
    } elseif ($error = Articles::stamp($item['id'], $_REQUEST['publish_date'])) {
        Logger::error($error);
    } else {
        $context['text'] .= '<p>' . i18n::s('The publication date has been changed.') . "</p>\n";
    }
    // touch the related anchor
    if (is_object($anchor)) {
        $anchor->touch('article:update', $item['id'], isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y');
    }
    // clear the cache
    Articles::clear($item);
    // follow-up commands
    $follow_up = i18n::s('Where do you want to go now?');
    $menu = array();
    $menu = array_merge($menu, array(Articles::get_permalink($item) => i18n::s('Back to the page')));
    $menu = array_merge($menu, array('articles/review.php' => i18n::s('Review queue')));
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:stamp.php


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