當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Images::allow_modification方法代碼示例

本文整理匯總了PHP中Images::allow_modification方法的典型用法代碼示例。如果您正苦於以下問題:PHP Images::allow_modification方法的具體用法?PHP Images::allow_modification怎麽用?PHP Images::allow_modification使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Images的用法示例。


在下文中一共展示了Images::allow_modification方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: strip_tags

$id = strip_tags($id);
// get the item from the database
$item = Images::get($id);
// get the related anchor, if any
$anchor = NULL;
if (isset($item['anchor'])) {
    $anchor = Anchors::get($item['anchor']);
} elseif (isset($_REQUEST['anchor'])) {
    $anchor = Anchors::get($_REQUEST['anchor']);
} elseif (isset($context['arguments'][1])) {
    $anchor = Anchors::get($context['arguments'][0] . ':' . $context['arguments'][1]);
}
// we are allowed to add a new file
if (!isset($item['id']) && Images::allow_creation($anchor)) {
    $permitted = TRUE;
} elseif (isset($item['id']) && Images::allow_modification($anchor, $item)) {
    $permitted = TRUE;
} else {
    $permitted = FALSE;
}
// do not always show the edition form
$with_form = FALSE;
// load the skin, maybe with a variant
load_skin('images', $anchor);
// clear the tab we are in, if any
if (is_object($anchor)) {
    $context['current_focus'] = $anchor->get_focus();
}
// the path to this page
if (is_object($anchor) && $anchor->is_viewable()) {
    $context['path_bar'] = $anchor->get_path_bar();
開發者ID:rair,項目名稱:yacs,代碼行數:31,代碼來源:edit.php

示例2: layout

 /**
  * list images
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return html text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     $variant = 'thumbnail';
     // process all items in the list
     while ($image = SQL::fetch($result)) {
         // a title for the image --do not force a title
         if (isset($image['title'])) {
             $title = $image['title'];
         } else {
             $title = '';
         }
         // provide thumbnail if not defined, or forced, or for large images
         if (!$image['use_thumbnail'] || $image['use_thumbnail'] == 'A' || $image['use_thumbnail'] == 'Y' && $image['image_size'] > $context['thumbnail_threshold']) {
             // where to fetch the image file
             $href = Images::get_thumbnail_href($image);
             // to drive to plain image
             $link = Images::get_icon_href($image);
             // add an url, if any
         } elseif ($image['link_url']) {
             // flag large images
             if ($image['image_size'] > $context['thumbnail_threshold']) {
                 $variant = rtrim('large ' . $variant);
             }
             // where to fetch the image file
             $href = Images::get_icon_href($image);
             // transform local references, if any
             include_once $context['path_to_root'] . '/links/links.php';
             $attributes = Links::transform_reference($image['link_url']);
             if ($attributes[0]) {
                 $link = $context['url_to_root'] . $attributes[0];
             } else {
                 $link = $image['link_url'];
             }
             // get the <img ... /> element
         } else {
             // do not append poor titles to inline images
             if ($variant == 'thumbnail') {
                 $title = '';
             }
             // flag large images
             if ($image['image_size'] > $context['thumbnail_threshold']) {
                 $variant = rtrim('large ' . $variant);
             }
             // where to fetch the image file
             $href = Images::get_icon_href($image);
             // no link
             $link = '';
         }
         // use the skin
         if (Images::allow_modification($image['anchor'], $image['id'])) {
             // build editable image
             $text .= Skin::build_image($variant, $href, $title, $link, $image['id']);
         } else {
             $text .= Skin::build_image($variant, $href, $title, $link);
         }
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
開發者ID:rair,項目名稱:yacs,代碼行數:75,代碼來源:layout_images_as_thumb.php

示例3: render_object


//.........這裏部分代碼省略.........
                 $link = Images::get_icon_href($image);
                 // add an url, if any
             } elseif ($image['link_url']) {
                 // flag large images
                 if ($image['image_size'] > $context['thumbnail_threshold']) {
                     $variant = rtrim('large ' . $variant);
                 }
                 // where to fetch the image file
                 $href = Images::get_icon_href($image);
                 // transform local references, if any
                 include_once $context['path_to_root'] . '/links/links.php';
                 $attributes = Links::transform_reference($image['link_url']);
                 if ($attributes[0]) {
                     $link = $context['url_to_root'] . $attributes[0];
                 } else {
                     $link = $image['link_url'];
                 }
                 // get the <img ... /> element
             } else {
                 // do not append poor titles to inline images
                 if ($variant == 'inline') {
                     $title = '';
                 }
                 // flag large images
                 if ($image['image_size'] > $context['thumbnail_threshold']) {
                     $variant = rtrim('large ' . $variant);
                 }
                 // where to fetch the image file
                 $href = Images::get_icon_href($image);
                 // no link
                 $link = '';
             }
             // use the skin
             if (Images::allow_modification($image['anchor'], $id)) {
                 // build editable image
                 $output =& Skin::build_image($variant, $href, $title, $link, $id);
             } else {
                 $output =& Skin::build_image($variant, $href, $title, $link);
             }
             return $output;
             // embed a stack of images
         // embed a stack of images
         case 'images':
             include_once $context['path_to_root'] . 'images/images.php';
             // get the list of ids
             $ids = preg_split("/\\s*,\\s*/", $id);
             if (!count($ids)) {
                 $output = '[images=id1, id2, ...]';
                 return $output;
             }
             // build the list of images
             $items = array();
             foreach ($ids as $id) {
                 // get the image record
                 if ($image = Images::get($id)) {
                     // a title for the image --do not force a title
                     if (isset($image['title'])) {
                         $title = $image['title'];
                     } else {
                         $title = '';
                     }
                     // provide thumbnail if not defined, or forced, or for large images
                     $variant = 'inline';
                     if (!$image['use_thumbnail'] || $image['use_thumbnail'] == 'A' || $image['use_thumbnail'] == 'Y' && $image['image_size'] > $context['thumbnail_threshold']) {
                         // not inline anymore, but thumbnail
                         $variant = 'thumbnail';
開發者ID:rair,項目名稱:yacs,代碼行數:67,代碼來源:codes.php


注:本文中的Images::allow_modification方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。