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


PHP Versions::get_url方法代码示例

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


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

示例1: layout

 /**
  * list versions
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return an array of ($url => $attributes)
     $items = array();
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // initialize variables
         $prefix = $suffix = $icon = '';
         // the url to view this item
         $url = '_' . $item['id'];
         // Versions::get_url($item['id']);
         // version description
         $label = sprintf(i18n::s('edited by %s %s'), ucfirst($item['edit_name']), Skin::build_date($item['edit_date']));
         // command to view this version
         $suffix .= ' ' . Skin::build_link(Versions::get_url($item['id'], 'view'), i18n::s('compare to current version'), 'button');
         // list all components for this item
         $items[$url] = array($prefix, $label, $suffix, 'version', $icon);
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:36,代码来源:layout_versions.php

示例2:

}
// ensure that the surfer can change content
if (Sections::allow_modification($item, $anchor)) {
    // modify this page
    Skin::define_img('SECTIONS_EDIT_IMG', 'sections/edit.gif');
    if (!is_object($overlay) || !($label = $overlay->get_label('edit_command', 'sections'))) {
        $label = i18n::s('Edit this section');
    }
    $context['page_tools'][] = Skin::build_link(Sections::get_url($item['id'], 'edit'), SECTIONS_EDIT_IMG . $label, 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
}
// commands for section owners
if (Sections::is_owned($item, $anchor) || Surfer::is_associate()) {
    // access previous versions, if any
    if ($has_versions) {
        Skin::define_img('SECTIONS_VERSIONS_IMG', 'sections/versions.gif');
        $context['page_tools'][] = Skin::build_link(Versions::get_url('section:' . $item['id'], 'list'), SECTIONS_VERSIONS_IMG . i18n::s('Versions'), 'basic', i18n::s('Restore a previous version if necessary'));
    }
    // lock the page
    if (!isset($item['locked']) || $item['locked'] == 'N') {
        Skin::define_img('SECTIONS_LOCK_IMG', 'sections/lock.gif');
        $context['page_tools'][] = Skin::build_link(Sections::get_url($item['id'], 'lock'), SECTIONS_LOCK_IMG . i18n::s('Lock'), 'basic');
    } else {
        Skin::define_img('SECTIONS_UNLOCK_IMG', 'sections/unlock.gif');
        $context['page_tools'][] = Skin::build_link(Sections::get_url($item['id'], 'lock'), SECTIONS_UNLOCK_IMG . i18n::s('Unlock'), 'basic');
    }
    // delete the page
    Skin::define_img('SECTIONS_DELETE_IMG', 'sections/delete.gif');
    $context['page_tools'][] = Skin::build_link(Sections::get_url($item['id'], 'delete'), SECTIONS_DELETE_IMG . i18n::s('Delete this section'), 'basic');
    // manage content
    if ($has_content) {
        Skin::define_img('SECTIONS_MANAGE_IMG', 'sections/manage.gif');
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view_as_tabs.php

示例3: sprintf

    }
    $context['text'] .= Skin::finalize_list($links, 'assistant_bar');
    // page help
    $help = '';
    // information to members
    if (Surfer::is_member()) {
        $help .= '<p>' . sprintf(i18n::s('This has been posted by %s %s.'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date'])) . "</p>\n";
    }
    $help .= '<p><ins>' . i18n::s('Text inserted since that version.') . '</ins></p>' . '<p><del>' . i18n::s('Text suppressed from this version.') . '</del></p>' . '<p>' . i18n::s('Caution: restoration can not be reversed!') . '</p>';
    $context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
    //
    // the navigation sidebar
    //
    $text = '';
    // buttons to display previous and next pages, if any
    if (is_object($anchor)) {
        $neighbours = $anchor->get_neighbours('version', $item);
        $text .= Skin::neighbours($neighbours, 'sidebar');
    }
    // build a nice sidebar box
    if ($text) {
        $text =& Skin::build_box(i18n::s('Navigation'), $text, 'neighbours', 'neighbours');
    }
    $context['components']['neighbours'] = $text;
    //
    // referrals, if any, in a sidebar
    //
    $context['components']['referrals'] =& Skin::build_referrals(Versions::get_url($item['id']));
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例4: elseif

// stop crawlers
if (Surfer::is_crawler()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // not found
} elseif (!isset($item['id'])) {
    include '../error.php';
    // an anchor is mandatory
} elseif (!is_object($anchor)) {
    Safe::header('Status: 404 Not Found', TRUE, 404);
    Logger::error(i18n::s('No anchor has been found.'));
    // permission denied
} elseif (!$permitted) {
    // surfer has to be authenticated
    if (!Surfer::is_logged()) {
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Versions::get_url($item['id'], 'restore')));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // restoration
} else {
    // update the database
    if (Versions::restore($item['id'])) {
        // provide some feed-back
        $context['text'] .= '<p>' . i18n::s('The page has been successfully restored.') . '</p>';
        // follow-up commands
        $context['text'] .= Skin::build_link($anchor->get_url(), i18n::s('Done'), 'button');
        // clear the cache; the article may be listed at many places
        Cache::clear();
    }
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:restore.php

示例5: urlencode

 //
 // update tools
 if (Files::allow_modification($item, $anchor)) {
     // modify this page
     Skin::define_img('FILES_EDIT_IMG', 'files/edit.gif');
     $context['page_tools'][] = Skin::build_link(Files::get_url($item['id'], 'edit'), FILES_EDIT_IMG . i18n::s('Update this file'), 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
     // post an image, if upload is allowed
     if (Images::allow_creation($item, $anchor, 'file')) {
         Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
         $context['page_tools'][] = Skin::build_link('images/edit.php?anchor=' . urlencode('file:' . $item['id']), IMAGES_ADD_IMG . i18n::s('Add an image'), 'basic');
     }
 }
 // restore a previous version, if any
 if (is_object($anchor) && $anchor->is_owned() && Versions::count_for_anchor('file:' . $item['id'])) {
     Skin::define_img('FILES_VERSIONS_IMG', 'files/versions.gif');
     $context['page_tools'][] = Skin::build_link(Versions::get_url('file:' . $item['id'], 'list'), FILES_VERSIONS_IMG . i18n::s('Versions'));
 }
 // delete command provided to associates and owners
 if (is_object($anchor) && $anchor->is_owned() || Surfer::is_associate()) {
     Skin::define_img('FILES_DELETE_IMG', 'files/delete.gif');
     $context['page_tools'][] = Skin::build_link(Files::get_url($item['id'], 'delete'), FILES_DELETE_IMG . i18n::s('Delete this file'));
 }
 // the navigation sidebar
 $text = '';
 if (is_object($anchor)) {
     $neighbours = $anchor->get_neighbours('file', $item);
     $text .= Skin::neighbours($neighbours, 'sidebar');
 }
 // build a nice sidebar box
 if ($text) {
     $text =& Skin::build_box(i18n::s('Navigation'), $text, 'neighbours', 'neighbours');
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例6: sprintf

//	$context['path_bar'] = array( 'versions/' => i18n::s('Versions') );
// the title of the page
if (is_object($anchor) && $anchor->is_viewable()) {
    $context['page_title'] = sprintf(i18n::s('Versions: %s'), $anchor->get_title());
} else {
    $context['page_title'] = i18n::s('List versions');
}
// an anchor is mandatory
if (!is_object($anchor)) {
    Safe::header('Status: 404 Not Found', TRUE, 404);
    Logger::error(i18n::s('No anchor has been found.'));
    // permission denied
} elseif (!$permitted) {
    // anonymous users are invited to log in or to register
    if (!Surfer::is_logged()) {
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Versions::get_url($anchor->get_reference(), 'list')));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // stop hackers
} elseif ($page > 10) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // display the index
} else {
    // insert anchor prefix
    if (is_object($anchor)) {
        $context['text'] .= $anchor->get_prefix();
    }
    // cache the section
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:list.php


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