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


PHP Shopp::clearpng方法代码示例

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


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

示例1: menus

 /**
  * Generates the Shopp admin menus
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function menus()
 {
     global $menu, $plugin_page;
     $access = 'shopp_menu';
     if (Shopp::maintenance()) {
         $access = 'manage_options';
     }
     // Add main menus
     $position = shopp_admin_add_menu(Shopp::__('Shopp'), 'orders', 40, false, 'shopp_orders', Shopp::clearpng());
     shopp_admin_add_menu(Shopp::__('Catalog'), 'products', $position, false, 'shopp_products', Shopp::clearpng());
     // Add after the Shopp menus to avoid being purged by the duplicate separator check
     $menu[$position - 1] = array('', 'read', 'separator-shopp', '', 'wp-menu-separator');
     // Add menus to WordPress admin
     foreach ($this->pages as $page) {
         $this->submenus($page);
     }
     $parent = get_admin_page_parent();
     if (isset($this->menus[$parent]) && false === strpos($this->menus[$parent], 'toplevel')) {
         $current_page = $plugin_page;
         $plugin_page = $parent;
         add_action('adminmenu', create_function('', 'global $plugin_page; $plugin_page = "' . $current_page . '";'));
     }
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:31,代码来源:AdminPages.php

示例2: gallery


//.........这里部分代码省略.........
     $width = $p_width > 0 ? $p_width : $_width;
     $height = $p_height > 0 ? $p_height : $_height;
     $preview_width = $width;
     // Find the max dimensions to use for the preview spacing image
     $maxwidth = $maxheight = 0;
     foreach ($O->images as $img) {
         $scale = $p_fit ? array_search($p_fit, ImageAsset::$defaults['scaling']) : false;
         $scaled = $img->scaled($width, $height, $scale);
         $maxwidth = max($maxwidth, $scaled['width']);
         $maxheight = max($maxheight, $scaled['height']);
     }
     if (0 == $maxwidth) {
         $maxwidth = $width;
     }
     if (0 == $maxheight) {
         $maxheight = $height;
     }
     $p_link = Shopp::str_true($p_link);
     $product_class = 'product_' . (int) $O->id;
     // Setup preview images
     $previews = '';
     if ('transparent' == strtolower($p_bg)) {
         $fill = -1;
     } else {
         $fill = $p_bg ? hexdec(ltrim($p_bg, '#')) : false;
     }
     $lowest_quality = min(ImageSetting::$qualities);
     $scale = $p_fit ? array_search($p_fit, ImageAsset::$defaults['scaling']) : false;
     $sharpen = $p_sharpen ? max($p_sharpen, ImageAsset::$defaults['sharpen']) : false;
     $quality = $p_quality ? max($p_quality, $lowest_quality) : false;
     foreach ($O->images as $Image) {
         $firstPreview = false;
         if (empty($previews)) {
             // Adds "filler" image to reserve the dimensions in the DOM
             $firstPreview = $previews .= '<li class="fill">' . '<img src="' . Shopp::clearpng() . '" alt="" style="width: ' . (int) $maxwidth . 'px; height: ' . (int) $maxheight . 'px;" />' . '</li>';
         }
         $scaled = $Image->scaled($width, $height, $scale);
         $titleattr = !empty($Image->title) ? ' title="' . esc_attr($Image->title) . '"' : '';
         $alt = esc_attr(!empty($Image->alt) ? $Image->alt : $Image->filename);
         $src = $Image->url($width, $height, $scale, $sharpen, $quality, $fill);
         $img = '<img src="' . $src . '"' . $titleattr . ' alt="' . $alt . '" width="' . (int) $scaled['width'] . '" height="' . (int) $scaled['height'] . '" />';
         if ($p_link) {
             $hrefattr = $Image->url();
             $relattr = empty($rel) ? '' : ' rel="' . esc_attr($rel) . '"';
             $linkclasses = array('gallery', $product_class, $zoomfx);
             $img = '<a href="' . $hrefattr . '" class="' . join(' ', $linkclasses) . '"' . $relattr . $titleattr . '>' . $img . '</a>';
         }
         $previews .= '<li id="preview-' . $Image->id . '"' . (empty($firstPreview) ? '' : '  class="active"') . '>' . $img . '</li>';
     }
     $previews = '<ul class="previews">' . $previews . '</ul>';
     $thumbs = '';
     $twidth = $preview_width + $margins;
     // Add thumbnails (if needed)
     if (count($O->images) > 1) {
         $default_size = 64;
         $_thumbwidth = shopp_setting('gallery_thumbnail_width');
         $_thumbheight = shopp_setting('gallery_thumbnail_height');
         if (!$_thumbwidth) {
             $_thumbwidth = $default_size;
         }
         if (!$_thumbheight) {
             $_thumbheight = $default_size;
         }
         if ($thumbsize > 0) {
             $thumbwidth = $thumbheight = $thumbsize;
         }
         $width = $thumbwidth > 0 ? $thumbwidth : $_thumbwidth;
         $height = $thumbheight > 0 ? $thumbheight : $_thumbheight;
         $thumbs = '';
         foreach ($O->images as $Image) {
             $scale = $thumbfit ? array_search($thumbfit, ImageAsset::$defaults['scaling']) : false;
             $sharpen = $thumbsharpen ? min($thumbsharpen, ImageAsset::$defaults['sharpen']) : false;
             $quality = $thumbquality ? min($thumbquality, ImageAsset::$defaults['quality']) : false;
             if ('transparent' == strtolower($thumbbg)) {
                 $fill = -1;
             } else {
                 $fill = $thumbbg ? hexdec(ltrim($thumbbg, '#')) : false;
             }
             $scaled = $Image->scaled($width, $height, $scale);
             $titleattr = empty($Image->title) ? '' : ' title="' . esc_attr($Image->title) . '"';
             $alt = esc_attr(empty($Image->alt) ? $Image->name : $Image->alt);
             $src = $Image->url($width, $height, $scale, $sharpen, $quality, $fill);
             $thumbclasses = array('preview-' . $Image->id);
             if (empty($thumbs)) {
                 $thumbclasses[] = 'first';
             }
             $thumbclasses = esc_attr(join(' ', $thumbclasses));
             $thumbs .= '<li id="thumbnail-' . $Image->id . '" class="' . $thumbclasses . '">' . '<img src="' . $src . '"' . $titleattr . ' alt="' . $alt . '" width="' . (int) $scaled['width'] . '" height="' . (int) $scaled['height'] . '" />' . '</li> ';
         }
         $thumbs = '<ul class="thumbnails">' . $thumbs . '</ul>';
     }
     // end count($O->images)
     if ($rowthumbs > 0) {
         $twidth = ($width + $margins + 2) * (int) $rowthumbs;
     }
     $result = '<div id="gallery-' . $O->id . '" class="gallery">' . $previews . $thumbs . '</div>';
     $script = "\t" . 'ShoppGallery("#gallery-' . $O->id . '","' . $preview . '"' . ($twidth ? ",{$twidth}" : "") . ');';
     add_storefrontjs($script);
     return $result;
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:101,代码来源:product.php


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