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


PHP Files::allow_creation方法代码示例

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


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

示例1: urlencode

        $url = 'articles/edit.php?anchor=' . urlencode('section:' . $item['id']) . '&variant=poll';
        $context['page_tools'][] = Skin::build_link($url, ARTICLES_POLL_IMG . i18n::s('Add a poll'), 'basic', i18n::s('Add new content to this section'));
    }
}
// add a section
if (Sections::allow_creation($item, $anchor)) {
    Skin::define_img('SECTIONS_ADD_IMG', 'sections/add.gif');
    $context['page_tools'][] = Skin::build_link('sections/edit.php?anchor=' . urlencode('section:' . $item['id']), SECTIONS_ADD_IMG . i18n::s('Add a section'), 'basic', i18n::s('Add a section'));
}
// comment this page if anchor does not prevent it
if (Comments::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('COMMENTS_ADD_IMG', 'comments/add.gif');
    $context['page_tools'][] = Skin::build_link(Comments::get_url('section:' . $item['id'], 'comment'), COMMENTS_ADD_IMG . i18n::s('Post a comment'), 'basic', i18n::s('Express yourself, and say what you think.'));
}
// add a file, if upload is allowed
if (Files::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
    $context['page_tools'][] = Skin::build_link('files/edit.php?anchor=' . urlencode('section:' . $item['id']), FILES_UPLOAD_IMG . i18n::s('Add a file'), 'basic', i18n::s('Attach related files.'));
}
// add a link
if (Links::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
    $context['page_tools'][] = Skin::build_link('links/edit.php?anchor=' . urlencode('section:' . $item['id']), LINKS_ADD_IMG . i18n::s('Add a link'), 'basic', i18n::s('Contribute to the web and link to relevant pages.'));
}
// post an image, if upload is allowed
if (Images::allow_creation($item, $anchor, 'section')) {
    Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
    $context['page_tools'][] = Skin::build_link('images/edit.php?anchor=' . urlencode('section:' . $item['id']), IMAGES_ADD_IMG . i18n::s('Add an image'), 'basic', i18n::s('You can upload a camera shot, a drawing, or another image file.'));
}
// ensure that the surfer can change content
if (Sections::allow_modification($item, $anchor)) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view_as_tabs.php

示例2:

    // insert anchor suffix
    if (is_object($anchor)) {
        $context['text'] .= $anchor->get_suffix();
    }
    // page menu
    //
    // get parent of the anchor too
    $parent = NULL;
    if (is_object($anchor) && ($parent = $anchor->get_parent())) {
        $parent =& Anchors::get($parent);
    }
    // the command to post a new file, if this is allowed
    if (is_object($anchor) && Files::allow_creation($anchor->get_values(), $parent, $anchor->get_type())) {
        Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
        $context['page_menu'][] = Skin::build_link(Files::get_url($anchor->get_reference(), 'file'), FILES_UPLOAD_IMG . i18n::s('Add a file'));
    }
    // command to go back
    if (is_object($anchor) && $anchor->is_viewable()) {
        $context['page_menu'][] = Skin::build_link($anchor->get_url(), i18n::s('Back to main page'), 'basic');
    }
    // side tools
    //
    // the command to post a new file, if this is allowed
    if (is_object($anchor) && Files::allow_creation($anchor->get_values(), $parent, $anchor->get_type())) {
        $context['page_tools'][] = Skin::build_link(Files::get_url($anchor->get_reference(), 'file'), i18n::s('Add a file'));
    }
    // back to main page
    $context['page_tools'][] = Skin::build_link($anchor->get_url(), i18n::s('Back to main page'));
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:list.php

示例3: elseif

} elseif (isset($_REQUEST['variant']) && $_REQUEST['variant']) {
    $overlay = Overlay::bind($_REQUEST['variant']);
} elseif (isset($_SESSION['pasted_variant']) && $_SESSION['pasted_variant']) {
    $overlay = Overlay::bind($_SESSION['pasted_variant']);
    unset($_SESSION['pasted_variant']);
    // set a new overlay instance, except if some template has been defined for this anchor
} elseif (!isset($item['id']) && is_object($anchor)) {
    $overlay = $anchor->get_overlay('file_overlay');
}
// get parent of the anchor too
$parent = NULL;
if (is_object($anchor) && ($parent = $anchor->get_parent())) {
    $parent = Anchors::get($parent);
}
// we are allowed to add a new file
if (!isset($item['id']) && is_object($anchor) && Files::allow_creation($anchor->get_values(), $parent, $anchor->get_type())) {
    $permitted = TRUE;
} elseif (isset($item['id']) && Files::allow_modification($item, $anchor)) {
    $permitted = TRUE;
} else {
    $permitted = FALSE;
}
// do not always show the edition form
$with_form = FALSE;
// load the skin, maybe with a variant
load_skin('files', $anchor);
// clear the tab we are in, if any
if (is_object($anchor)) {
    $context['current_focus'] = $anchor->get_focus();
}
// the path to this page
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:edit.php

示例4: layout_newest


//.........这里部分代码省略.........
         $text .= $overlay->get_text('view', $item);
     }
     // the beautified description, which is the actual page body
     if ($item['description']) {
         // use adequate label
         if (is_object($overlay) && ($label = $overlay->get_label('description'))) {
             $text .= Skin::build_block($label, 'title');
         }
         $text .= Skin::build_block($item['description'], 'description', '', $item['options']);
     }
     //
     // list related files
     //
     // if this surfer is an editor of this article, show hidden files as well
     if (Articles::is_assigned($item['id']) || is_object($anchor) && $anchor->is_assigned()) {
         Surfer::empower();
     }
     // build a complete box
     $box['bar'] = array();
     $box['text'] = '';
     // count the number of files in this article
     if ($count = Files::count_for_anchor('article:' . $item['id'])) {
         if ($count > 20) {
             $box['bar'] += array('_count' => sprintf(i18n::ns('%d file', '%d files', $count), $count));
         }
         // list files by date (default) or by title (option files_by_title)
         if (Articles::has_option('files_by', $anchor, $item) == 'title') {
             $items = Files::list_by_title_for_anchor('article:' . $item['id'], 0, FILES_PER_PAGE, 'article:' . $item['id']);
         } else {
             $items = Files::list_by_date_for_anchor('article:' . $item['id'], 0, FILES_PER_PAGE, 'article:' . $item['id']);
         }
         if (is_array($items)) {
             $box['text'] .= Skin::build_list($items, 'decorated');
         }
         // navigation commands for files
         $prefix = Articles::get_url($item['id'], 'navigate', 'files');
         $box['bar'] += Skin::navigate($url, $prefix, $count, FILES_PER_PAGE, 0);
         // the command to post a new file, if allowed
         if (Files::allow_creation($item, $anchor, 'article')) {
             $link = 'files/edit.php?anchor=' . urlencode('article:' . $item['id']);
             $box['bar'] += array($link => i18n::s('Add a file'));
         }
         if (is_array($box['bar'])) {
             $box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
         }
     }
     // actually render the html for this box
     if ($box['text']) {
         $text .= Skin::build_box(i18n::s('Files'), $box['text'], 'header1', 'files');
     }
     //
     // bottom page menu
     //
     // discuss this page, if the index page can be commented, and comments are accepted at the article level
     if (Comments::allow_creation($item, $anchor)) {
         $this->menu[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'comment'), i18n::s('Post a comment'), 'span');
     }
     // info on related comments
     if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
         $this->menu[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'list'), sprintf(i18n::ns('%d comment', '%d comments', $count), $count), 'span');
     }
     // new links are accepted at the index page and at the article level
     if (Links::allow_trackback()) {
         $this->menu[] = Skin::build_link('links/trackback.php?anchor=' . urlencode('article:' . $item['id']), i18n::s('Reference this page'), 'span');
     }
     // info on related links
     if ($count = Links::count_for_anchor('article:' . $item['id'])) {
         $this->menu[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d link', '%d links', $count), $count), 'span');
     }
     // new files are accepted at the index page and at the article level
     if (is_object($anchor) && $anchor->has_option('with_files') && !($anchor->has_option('no_files') || preg_match('/\\bno_files\\b/i', $item['options']))) {
         // add a file
         if (Files::allow_creation($item, $anchor, 'article')) {
             if ($context['with_friendly_urls'] == 'Y') {
                 $link = 'files/edit.php/article/' . $item['id'];
             } else {
                 $link = 'files/edit.php?anchor=' . urlencode('article:' . $item['id']);
             }
             $this->menu[] = Skin::build_link($link, i18n::s('Add a file'), 'span');
         }
     }
     // modify this page
     if (Surfer::is_empowered()) {
         $this->menu[] = Skin::build_link(Articles::get_url($item['id'], 'edit'), i18n::s('Edit'), 'span');
     }
     // view permalink
     if (Surfer::is_empowered()) {
         $this->menu[] = Skin::build_link($url, i18n::s('Permalink'), 'span');
     }
     // insert overlay data, if any
     if (is_object($overlay)) {
         $text .= $overlay->get_text('trailer', $item);
     }
     // add trailer information from this item, if any
     if (isset($item['trailer']) && trim($item['trailer'])) {
         $text .= Codes::beautify($item['trailer']);
     }
     // returned the formatted content
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_home_articles_as_alistapart.php

示例5: layout

 /**
  * list articles
  *
  * @param resource the SQL result
  * @return a string to be displayed
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // no hovering label
     $href_title = '';
     // we build an array for the skin::build_tabs() function
     $panels = array();
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'article:' . $item['id']);
         // panel content
         $text = '';
         // insert anchor prefix
         if (is_object($anchor)) {
             $text .= $anchor->get_prefix();
         }
         // the introduction text, if any
         if (is_object($overlay)) {
             $text .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
         } elseif (isset($item['introduction']) && trim($item['introduction'])) {
             $text .= Skin::build_block($item['introduction'], 'introduction');
         }
         // get text related to the overlay, if any
         if (is_object($overlay)) {
             $text .= $overlay->get_text('view', $item);
         }
         // filter description, if necessary
         if (is_object($overlay)) {
             $description = $overlay->get_text('description', $item);
         } else {
             $description = $item['description'];
         }
         // the beautified description, which is the actual page body
         if ($description) {
             // use adequate label
             if (is_object($overlay) && ($label = $overlay->get_label('description'))) {
                 $text .= Skin::build_block($label, 'title');
             }
             // beautify the target page
             $text .= Skin::build_block($description, 'description', '', $item['options']);
         }
         // list files only to people able to change the page
         if (Articles::allow_modification($item, $anchor)) {
             $embedded = NULL;
         } else {
             $embedded = Codes::list_embedded($item['description']);
         }
         // build a complete box
         $box = array('bar' => array(), 'text' => '');
         // count the number of files in this article
         if ($count = Files::count_for_anchor('article:' . $item['id'], FALSE, $embedded)) {
             if ($count > 20) {
                 $box['bar'] += array('_count' => sprintf(i18n::ns('%d file', '%d files', $count), $count));
             }
             // list files by date (default) or by title (option files_by_title)
             $offset = ($zoom_index - 1) * FILES_PER_PAGE;
             if (Articles::has_option('files_by', $anchor, $item) == 'title') {
                 $items = Files::list_by_title_for_anchor('article:' . $item['id'], 0, 300, 'article:' . $item['id'], $embedded);
             } else {
                 $items = Files::list_by_date_for_anchor('article:' . $item['id'], 0, 300, 'article:' . $item['id'], $embedded);
             }
             // actually render the html
             if (is_array($items)) {
                 $box['text'] .= Skin::build_list($items, 'decorated');
             } elseif (is_string($items)) {
                 $box['text'] .= $items;
             }
             // the command to post a new file
             if (Files::allow_creation($item, $anchor, 'article')) {
                 Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
                 $box['bar'] += array('files/edit.php?anchor=' . urlencode('article:' . $item['id']) => FILES_UPLOAD_IMG . i18n::s('Add a file'));
             }
         }
         // some files have been attached to this page
         if ($page == 1 && $count > 1) {
             // the command to download all files
             $link = 'files/fetch_all.php?anchor=' . urlencode('article:' . $item['id']);
             if ($count > 20) {
                 $label = i18n::s('Zip 20 first files');
             } else {
                 $label = i18n::s('Zip all files');
             }
             $box['bar'] += array($link => $label);
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_articles_as_tabs.php

示例6: array

 } else {
     // images
     $box = '';
     if (Images::allow_creation($item, $anchor, 'category')) {
         $menu = array('images/edit.php?anchor=' . urlencode('category:' . $item['id']) => i18n::s('Add an image'));
         $box .= Skin::build_list($menu, 'menu_bar');
     }
     if ($items = Images::list_by_date_for_anchor('category:' . $item['id'])) {
         $box .= Skin::build_list($items, 'decorated');
     }
     if ($box) {
         $text .= Skin::build_box(i18n::s('Images'), $box, 'folded');
     }
     // files
     $box = '';
     if (Files::allow_creation($item, $anchor, 'category')) {
         $menu = array('files/edit.php?anchor=' . urlencode('category:' . $item['id']) => i18n::s('Add a file'));
         $box .= Skin::build_list($menu, 'menu_bar');
     }
     if ($items = Files::list_embeddable_for_anchor('category:' . $item['id'], 0, 50)) {
         $box .= Skin::build_list($items, 'decorated');
     }
     if ($box) {
         $text .= Skin::build_box(i18n::s('Files'), $box, 'folded');
     }
 }
 // display in a separate panel
 if ($text) {
     $panels[] = array('resources', i18n::s('Resources'), 'resources_panel', $text);
 }
 //
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:edit.php

示例7: urlencode

//
// advertise this thread
$invite = '';
if (isset($context['with_email']) && $context['with_email'] == 'Y') {
    Skin::define_img('ARTICLES_INVITE_IMG', 'articles/invite.gif');
    $invite = Skin::build_link(Articles::get_url($item['id'], 'invite'), ARTICLES_INVITE_IMG . i18n::s('Invite participants'), 'basic', i18n::s('Spread the word'));
}
// thread participants
if (!isset($item['locked']) || $item['locked'] != 'Y') {
    $text .= Skin::build_box(i18n::s('Participants'), '<div id="thread_roster_panel"></div>' . $invite, 'boxes', 'roster');
}
// files
//
// the command to post a new file -- do that in this window, since the surfer will be driven back here
$invite = '';
if (Files::allow_creation($item, $anchor, 'article')) {
    Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
    $link = 'files/edit.php?anchor=' . urlencode('article:' . $item['id']);
    $invite = Skin::build_link($link, FILES_UPLOAD_IMG . i18n::s('Add a file'), 'basic') . BR;
}
// list files by date (default) or by title (option files_by_title)
if (Articles::has_option('files_by', $anchor, $item) == 'title') {
    $items = Files::list_by_title_for_anchor('article:' . $item['id'], 0, 20, 'compact');
} else {
    $items = Files::list_by_date_for_anchor('article:' . $item['id'], 0, 20, 'compact');
}
// actually render the html
if (is_array($items)) {
    // the command to list all files
    if (count($items)) {
        $items = array_merge($items, array(Files::get_url('article:' . $item['id'], 'list') => i18n::s('All files')));
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view_as_chat.php


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