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


PHP Images::get_icon_href方法代码示例

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


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

示例1: 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

示例2: touch


//.........这里部分代码省略.........
         // append a reference to a new image to the description
     } elseif ($action == 'image:create' && $origin) {
         if (!Codes::check_embedded($this->item['description'], 'image', $origin)) {
             // the overlay may prevent embedding
             if (is_object($this->overlay) && !$this->overlay->should_embed_files()) {
             } else {
                 // list has already started
                 if (preg_match('/\\[image=[^\\]]+?\\]\\s*$/', $this->item['description'])) {
                     $this->item['description'] .= ' [image=' . $origin . ']';
                 } else {
                     $this->item['description'] .= "\n\n" . '[image=' . $origin . ']';
                 }
                 $query[] = "description = '" . SQL::escape($this->item['description']) . "'";
             }
         }
         // also use it as thumnail if none has been defined yet
         if (!isset($this->item['thumbnail_url']) || !trim($this->item['thumbnail_url'])) {
             include_once $context['path_to_root'] . 'images/images.php';
             if (($image = Images::get($origin)) && ($url = Images::get_thumbnail_href($image))) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         }
         // refresh stamp only if image update occurs within 6 hours after last edition
         if (SQL::strtotime($this->item['edit_date']) + 6 * 60 * 60 < time()) {
             $silently = TRUE;
         }
         // suppress a reference to an image that has been deleted
     } elseif ($action == 'image:delete' && $origin) {
         // suppress reference in main description field
         $query[] = "description = '" . SQL::escape(Codes::delete_embedded($this->item['description'], 'image', $origin)) . "'";
         // suppress references as icon and thumbnail as well
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 if ($this->item['icon_url'] == $url) {
                     $query[] = "icon_url = ''";
                 }
                 if ($this->item['thumbnail_url'] == $url) {
                     $query[] = "thumbnail_url = ''";
                 }
             }
             if ($url = Images::get_thumbnail_href($image)) {
                 if ($this->item['icon_url'] == $url) {
                     $query[] = "icon_url = ''";
                 }
                 if ($this->item['thumbnail_url'] == $url) {
                     $query[] = "thumbnail_url = ''";
                 }
             }
         }
         // set an existing image as the article icon
     } elseif ($action == 'image:set_as_icon' && $origin) {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 $query[] = "icon_url = '" . SQL::escape($url) . "'";
             }
             // also use it as thumnail if none has been defined yet
             if (!(isset($this->item['thumbnail_url']) && trim($this->item['thumbnail_url'])) && ($url = Images::get_thumbnail_href($image))) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         }
         // set an existing image as the article thumbnail
     } elseif ($action == 'image:set_as_thumbnail' && $origin) {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
开发者ID:rair,项目名称:yacs,代码行数:67,代码来源:article.php

示例3: touch

 /**
  * remember the last action for this category
  *
  * @param string the description of the last action
  * @param string the id of the item related to this update
  * @param boolean TRUE to not change the edit date of this anchor, default is FALSE
  *
  * @see shared/anchor.php
  */
 function touch($action, $origin = NULL, $silently = FALSE)
 {
     global $context;
     // don't go further on import
     if (preg_match('/import$/i', $action)) {
         return;
     }
     // no category bound
     if (!isset($this->item['id'])) {
         return;
     }
     // sanity check
     if (!$origin) {
         logger::remember('categories/category.php: unexpected NULL origin at touch()');
         return;
     }
     // components of the query
     $query = array();
     // append a reference to a new image to the description
     if ($action == 'image:create') {
         if (!Codes::check_embedded($this->item['description'], 'image', $origin)) {
             // the overlay may prevent embedding
             if (is_object($this->overlay) && !$this->overlay->should_embed_files()) {
             } else {
                 // list has already started
                 if (preg_match('/\\[image=[^\\]]+?\\]\\s*$/', $this->item['description'])) {
                     $query[] = "description = '" . SQL::escape($this->item['description'] . ' [image=' . $origin . ']') . "'";
                 } else {
                     $query[] = "description = '" . SQL::escape($this->item['description'] . "\n\n" . '[image=' . $origin . ']') . "'";
                 }
             }
         }
         // also use it as thumnail if none has been defined yet
         if (!isset($this->item['thumbnail_url']) || !trim($this->item['thumbnail_url'])) {
             include_once $context['path_to_root'] . 'images/images.php';
             if (($image = Images::get($origin)) && ($url = Images::get_thumbnail_href($image))) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         }
         // refresh stamp only if image update occurs within 6 hours after last edition
         if (SQL::strtotime($this->item['edit_date']) + 6 * 60 * 60 < time()) {
             $silently = TRUE;
         }
         // suppress a reference to an image that has been deleted
     } elseif ($action == 'image:delete') {
         // suppress reference in main description field
         $query[] = "description = '" . SQL::escape(Codes::delete_embedded($this->item['description'], 'image', $origin)) . "'";
         // suppress references as icon and thumbnail as well
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 if ($this->item['icon_url'] == $url) {
                     $query[] = "icon_url = ''";
                 }
                 if ($this->item['thumbnail_url'] == $url) {
                     $query[] = "thumbnail_url = ''";
                 }
             }
             if ($url = Images::get_thumbnail_href($image)) {
                 if ($this->item['icon_url'] == $url) {
                     $query[] = "icon_url = ''";
                 }
                 if ($this->item['thumbnail_url'] == $url) {
                     $query[] = "thumbnail_url = ''";
                 }
             }
         }
         // set an existing image as the category icon
     } elseif ($action == 'image:set_as_icon') {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 $query[] = "icon_url = '" . SQL::escape($url) . "'";
             }
             // also use it as thumnail if none has been defined yet
             if (!(isset($this->item['thumbnail_url']) && trim($this->item['thumbnail_url'])) && ($url = Images::get_thumbnail_href($image))) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         }
         $silently = TRUE;
         // set an existing image as the category thumbnail
     } elseif ($action == 'image:set_as_thumbnail') {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_thumbnail_href($image)) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         }
         $silently = TRUE;
         // append a new image, and set it as the article thumbnail
     } elseif ($action == 'image:set_as_both') {
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:category.php

示例4: touch


//.........这里部分代码省略.........
         $query[] = "description = '" . SQL::escape($text) . "'";
         // append a reference to a new image to the description
     } elseif ($action == 'image:create') {
         if (!Codes::check_embedded($this->item['description'], 'image', $origin)) {
             // the overlay may prevent embedding
             if (is_object($this->overlay) && !$this->overlay->should_embed_files()) {
             } else {
                 // list has already started
                 if (preg_match('/\\[image=[^\\]]+?\\]\\s*$/', $this->item['description'])) {
                     $query[] = "description = '" . SQL::escape($this->item['description'] . ' [image=' . $origin . ']') . "'";
                 } else {
                     $query[] = "description = '" . SQL::escape($this->item['description'] . "\n\n" . '[image=' . $origin . ']') . "'";
                 }
             }
         }
         // also use it as thumnail if none has been defined yet
         if (!isset($this->item['thumbnail_url']) || !trim($this->item['thumbnail_url'])) {
             include_once $context['path_to_root'] . 'images/images.php';
             if (($image = Images::get($origin)) && ($url = Images::get_thumbnail_href($image))) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         }
         // refresh stamp only if image update occurs within 6 hours after last edition
         if (SQL::strtotime($this->item['edit_date']) + 6 * 60 * 60 < time()) {
             $silently = TRUE;
         }
         // suppress a reference to an image that has been deleted
     } elseif ($action == 'image:delete') {
         // suppress reference in main description field
         $query[] = "description = '" . SQL::escape(Codes::delete_embedded($this->item['description'], 'image', $origin)) . "'";
         // suppress references as icon and thumbnail as well
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 if ($this->item['icon_url'] == $url) {
                     $query[] = "icon_url = ''";
                 }
                 if ($this->item['thumbnail_url'] == $url) {
                     $query[] = "thumbnail_url = ''";
                 }
             }
             if ($url = Images::get_thumbnail_href($image)) {
                 if ($this->item['icon_url'] == $url) {
                     $query[] = "icon_url = ''";
                 }
                 if ($this->item['thumbnail_url'] == $url) {
                     $query[] = "thumbnail_url = ''";
                 }
             }
         }
         // set an existing image as the section icon
     } elseif ($action == 'image:set_as_icon') {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 $query[] = "icon_url = '" . SQL::escape($url) . "'";
             }
             // also use it as thumnail if none has been defined yet
             if (!(isset($this->item['thumbnail_url']) && trim($this->item['thumbnail_url'])) && ($url = Images::get_thumbnail_href($image))) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         } elseif ($origin) {
             $query[] = "icon_url = '" . SQL::escape($origin) . "'";
         }
         $silently = TRUE;
         // set an existing image as the section thumbnail
开发者ID:rair,项目名称:yacs,代码行数:67,代码来源:section.php

示例5: while

 if (!($result = SQL::query($query))) {
     $context['text'] .= Logger::error_pop() . BR . "\n";
     return;
     // parse the whole list
 } else {
     // fetch one anchor and the linked member
     $errors_count = 0;
     while ($row = SQL::fetch($result)) {
         // animate user screen and take care of time
         $count++;
         if (!($count % 100)) {
             $context['text'] .= sprintf(i18n::s('%d records have been processed'), $count) . BR . "\n";
             // ensure enough execution time
             Safe::set_time_limit(30);
         }
         if (!Images::get_icon_href($row)) {
             $errors_count++;
             $anchor = Anchors::get($row['anchor']);
             $context['text'] .= sprintf(i18n::s('Missing: %s'), 'image ' . Skin::build_link(Images::get_url($row['id']), $row['id'] . ' ' . $row['image_name'])) . ' ' . i18n::s('in') . ' ' . (is_object($anchor) ? Skin::build_link($anchor->get_url(), $row['anchor']) : '') . BR . "\n";
         }
     }
 }
 // ending message
 $context['text'] .= sprintf(i18n::s('%d records have been processed'), $count) . BR . "\n";
 $context['text'] .= sprintf(i18n::s('%d missing files'), $errors_count) . BR . "\n";
 // display the execution time
 $time = round(get_micro_time() - $context['start_time'], 2);
 $context['text'] .= '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
 // forward to the index page
 $menu = array('images/' => i18n::s('Images'));
 $context['text'] .= Skin::build_list($menu, 'menu_bar');
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:check.php

示例6: upload_to

 /**
  * upload a file as a image attach to a given anchor
  * to be used in custom "edit_as" script
  * 
  * @global string $context
  * @param object $anchor
  * @param array $file (from $_FILES)
  * @param bool $set_as_thumb
  * @param bool $put
  */
 public static function upload_to($anchor, $file, $set_as_thumb = false, $put = false)
 {
     global $context;
     // attach some image
     $path = Files::get_path($anchor->get_reference(), 'images');
     // $_REQUEST['action'] = 'set_as_icon'; // instruction for image::upload
     if (isset($file) && ($uploaded = Files::upload($file, $path, array('Image', 'upload')))) {
         // prepare image informations
         $image = array();
         $image['image_name'] = $uploaded;
         $image['image_size'] = $file['size'];
         $image['thumbnail_name'] = 'thumbs/' . $uploaded;
         $image['anchor'] = $anchor->get_reference();
         //$combined = array_merge($image, $_FILES);
         // post the image which was uploaded
         if ($image['id'] = Images::post($image)) {
             // successfull post
             $context['text'] .= '<p>' . i18n::s('Following image has been added:') . '</p>' . Codes::render_object('image', $image['id']) . '<br style="clear:left;" />' . "\n";
             // set image as icon and thumbnail
             if ($set_as_thumb) {
                 // delete former icon if any
                 /*if(isset($anchor->item['icon_url'])
                                                         && $anchor->item['icon_url']
                                                         && $match = Images::get_by_anchor_and_name($anchor->get_reference(), pathinfo($anchor->item['icon_url'],PATHINFO_BASENAME))) {
                 
                 
                                                     if($match['id'] != $image['id'])
                                                         Images::delete($match['id']);
                                                 }*/
                 $fields = array('thumbnail_url' => Images::get_thumbnail_href($image), 'icon_url' => Images::get_icon_href($image));
                 if ($put) {
                     $fields['id'] = $_REQUEST['id'];
                     $class = $anchor->get_static_group_class();
                     $class::put_attributes($fields);
                 } else {
                     $_REQUEST = array_merge($_REQUEST, $fields);
                 }
             }
         }
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:51,代码来源:images.php

示例7: touch

 /**
  * remember the last action for this user
  *
  * @param string the description of the last action
  * @param string the id of the item related to this update
  * @param boolean TRUE to not change the edit date of this anchor, default is FALSE
  *
  * @see shared/anchor.php
  */
 function touch($action, $origin = NULL, $silently = FALSE)
 {
     global $context;
     // don't go further on import
     if (preg_match('/import$/i', $action)) {
         return;
     }
     // no item bound
     if (!isset($this->item['id'])) {
         return;
     }
     // sanity check
     if (!$origin) {
         logger::remember('users/user.php: unexpected NULL origin at touch()');
         return;
     }
     // components of the query
     $query = array();
     // append a reference to a new image to the description
     if ($action == 'image:create') {
         if (!Codes::check_embedded($this->item['description'], 'image', $origin)) {
             // the overlay may prevent embedding
             if (is_object($this->overlay) && !$this->overlay->should_embed_files()) {
             } else {
                 // list has already started
                 if (preg_match('/\\[image=[^\\]]+?\\]\\s*$/', $this->item['description'])) {
                     $query[] = "description = '" . SQL::escape($this->item['description'] . ' [image=' . $origin . ']') . "'";
                 } else {
                     $query[] = "description = '" . SQL::escape($this->item['description'] . "\n\n" . '[image=' . $origin . ']') . "'";
                 }
             }
         }
         // refresh stamp only if image update occurs within 6 hours after last edition
         if (SQL::strtotime($this->item['edit_date']) + 6 * 60 * 60 < time()) {
             $silently = TRUE;
         }
         // suppress a reference to an image that has been deleted
     } elseif ($action == 'image:delete') {
         // suppress reference in main description field
         $query[] = "description = '" . SQL::escape(Codes::delete_embedded($this->item['description'], 'image', $origin)) . "'";
         // suppress references as icon and thumbnail as well
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 if ($this->item['avatar_url'] == $url) {
                     $query[] = "avatar_url = ''";
                 }
             }
             if ($url = Images::get_thumbnail_href($image)) {
                 if ($this->item['avatar_url'] == $url) {
                     $query[] = "avatar_url = ''";
                 }
             }
         }
         // set an existing image as the user avatar
     } elseif ($action == 'image:set_as_avatar') {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 $query[] = "avatar_url = '" . SQL::escape($url) . "'";
             }
         }
         $silently = TRUE;
         // set an existing image as the user thumbnail
     } elseif ($action == 'image:set_as_thumbnail') {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_thumbnail_href($image)) {
                 $query[] = "avatar_url = '" . SQL::escape($url) . "'";
             }
         }
         $silently = TRUE;
         // append a new image
     } elseif ($action == 'image:set_as_both') {
         if (!Codes::check_embedded($this->item['description'], 'image', $origin)) {
             $query[] = "description = '" . SQL::escape($this->item['description'] . ' [image=' . $origin . ']') . "'";
         }
         // do not remember minor changes
         $silently = TRUE;
         // add a reference to a location in the article description
     } elseif ($action == 'location:create') {
         if (!Codes::check_embedded($this->item['description'], 'location', $origin)) {
             $query[] = "description = '" . SQL::escape($this->item['description'] . ' [location=' . $origin . ']') . "'";
         }
         // suppress a reference to a location that has been deleted
     } elseif ($action == 'location:delete') {
         $query[] = "description = '" . SQL::escape(Codes::delete_embedded($this->item['description'], 'location', $origin)) . "'";
         // add a reference to a new table in the user description
     } elseif ($action == 'table:create') {
         if (!Codes::check_embedded($this->item['description'], 'table', $origin)) {
             $query[] = "description = '" . SQL::escape($this->item['description'] . ' [table=' . $origin . ']') . "'";
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:user.php

示例8: render_object


//.........这里部分代码省略.........
             return $output;
             // embed an image
         // embed an image
         case 'image':
             include_once $context['path_to_root'] . 'images/images.php';
             // get the variant, if any
             $attributes = preg_split("/\\s*,\\s*/", $id, 2);
             $id = $attributes[0];
             if (isset($attributes[1])) {
                 $variant = $attributes[1];
             } else {
                 $variant = 'inline';
             }
             // get the image record
             if (!($image = Images::get($id))) {
                 $output = '[image=' . $id . ']';
                 return $output;
             }
             // 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']) {
                 // not inline anymore, but thumbnail --preserve other variants
                 if ($variant == 'inline') {
                     $variant = 'thumbnail';
                 }
                 // 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 == '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
开发者ID:rair,项目名称:yacs,代码行数:67,代码来源:codes.php


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