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


PHP NextendFilesystem::absoluteURLToPath方法代码示例

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


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

示例1: NextendSliderCache

 function NextendSliderCache($slider)
 {
     nextendimportsmartslider2('nextend.smartslider.check');
     nextendimport('nextend.css.css');
     nextendimport('nextend.javascript.javascript');
     nextendimport('nextend.fonts.google');
     $this->slider = $slider;
     $sliderid = $slider->_sliderid;
     $recache = false;
     $cached = json_decode(NextendSmartSliderStorage::get('slidercache' . $sliderid), true);
     if (nextendIsWordpress()) {
         $time = current_time('timestamp');
     } else {
         $time = time();
     }
     nextendimportsmartslider2('nextend.smartslider.admin.models.slides');
     $slidesModel = new NextendSmartsliderAdminModelSlides(null);
     $slides = $slidesModel->getSlides($sliderid, '');
     $slideexpire = null;
     foreach ($slides as $s) {
         $publish_up = strtotime($s['publish_up']);
         if ($publish_up && $publish_up > $time && ($slideexpire == null || $publish_up < $slideexpire)) {
             $slideexpire = $publish_up;
         }
         $publish_down = strtotime($s['publish_down']);
         if ($publish_down && $publish_down > $time && ($slideexpire == null || $publish_down < $slideexpire)) {
             $slideexpire = $publish_down;
         }
     }
     if (is_array($cached)) {
         if (NextendSmartSliderStorage::get('sliderchanged' . $sliderid) == 1) {
             $recache = true;
         } else {
             if (isset($cached['time']) && isset($cached['expire']) && $cached['time'] < time() - $cached['expire'] * 60 * 60) {
                 $recache = true;
             } else {
                 if (isset($cached['slideexpire']) && $cached['slideexpire'] < $time) {
                     $recache = true;
                 }
             }
         }
     } else {
         $recache = true;
     }
     if (!$recache) {
         $data = $cached['data'];
         if (isset($data['css'])) {
             if (!NextendFilesystem::fileexists(NextendFilesystem::absoluteURLToPath($data['css']))) {
                 $recache = true;
             }
         } else {
             $recache = true;
         }
         if (!isset($data['libraries']) || !isset($data['libraries']['jquery']) || !isset($data['libraries']['jquery']['jsfiles']) || count($data['libraries']['jquery']['jsfiles']) == 0) {
             $recache = true;
         }
     }
     //$recache = true;
     if ($recache) {
         $data = $this->render();
         $cached = array('time' => time(), 'data' => $data);
         if ($this->slider->_generatorParams->get('enabled', 0)) {
             $generatorcached = json_decode(NextendSmartSliderStorage::get('generator' . $sliderid), true);
             if (is_array($generatorcached)) {
                 $cached['time'] = $generatorcached['time'];
                 $cached['expire'] = $this->slider->_generatorParams->get('cachetime', '24');
             }
         }
         if ($slideexpire) {
             $cached['slideexpire'] = $slideexpire;
         }
         NextendSmartSliderStorage::set('slidercache' . $sliderid, json_encode($cached));
         NextendSmartSliderStorage::set('sliderchanged' . $sliderid, '0');
     }
     $this->cssurl = $data['css'];
     if (nextendIsWordPress()) {
         add_action('nextend_css', array($this, 'addCSS'));
     } elseif (nextendIsMagento()) {
         Nextend_SmartSlider2_Model_Observer::$sliders[] = array($this, 'addCSS');
     } else {
         $this->addCSS();
     }
     $js = NextendJavascript::getInstance();
     foreach ($data['js']['core'] as $j) {
         $js->addJsFile($j);
     }
     if (isset($data['libraries']) && count($data['libraries'])) {
         foreach ($data['libraries'] as $library => $jss) {
             $js->loadLibrary($library);
             if (!empty($jss['js'])) {
                 $js->addLibraryJs($library, $jss['js']);
             }
             if (count($jss['jsfiles'])) {
                 foreach ($jss['jsfiles'] as $j) {
                     $js->addLibraryJsFile($library, $j);
                 }
             }
         }
     }
     if (isset($data['fonts']) && count($data['fonts'])) {
//.........这里部分代码省略.........
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:101,代码来源:slidercache.php

示例2: resizeImage

 function resizeImage($imageurl, $width, $height, $mode = 'cover', $resizeremote = false)
 {
     $originalimageurl = $imageurl;
     if ($width > 0 && $height > 0 && function_exists('exif_imagetype') && function_exists('imagecreatefrompng')) {
         $extra = array();
         if (substr($imageurl, 0, 2) == '//') {
             $imageurl = parse_url(NextendUri::getBaseuri(), PHP_URL_SCHEME) . ':' . $imageurl;
         }
         $imageurl = NextendUri::relativetoabsolute($imageurl);
         $imagepath = NextendFilesystem::absoluteURLToPath($imageurl);
         if ($imagepath == $imageurl) {
             if (!$resizeremote) {
                 return $originalimageurl;
             }
             $imagepath = parse_url($imageurl, PHP_URL_PATH);
         } else {
             $extra[] = @filemtime($imagepath);
             $imageurl = $imagepath;
         }
         $extension = strtolower(pathinfo($imagepath, PATHINFO_EXTENSION));
         $filetype = '';
         if ($extension == 'png') {
             $filetype = 'png';
         } else {
             if ($extension == 'jpg' || $extension == 'jpeg') {
                 $filetype = 'jpg';
             }
         }
         if ($filetype != '') {
             $hash = $this->createHashFromArray(array_merge(func_get_args(), $this->backgrouncolor, $extra));
             $cachefile = $this->_folder . $hash . '.' . $filetype;
             if (!NextendFilesystem::existsFile($cachefile)) {
                 $imagetype = @exif_imagetype($imageurl);
                 if ($imagetype) {
                     if ($imagetype == IMAGETYPE_PNG) {
                         $filetype = 'png';
                     } else {
                         if ($imagetype == IMAGETYPE_JPEG) {
                             $filetype = 'jpg';
                         } else {
                             $filetype = '';
                         }
                     }
                     if ($filetype) {
                         $img = null;
                         $rotated = null;
                         if ($filetype == 'png') {
                             $img = @imagecreatefrompng($imageurl);
                         } else {
                             if ($filetype == 'jpg') {
                                 $img = @imagecreatefromjpeg($imageurl);
                                 if (function_exists("exif_read_data")) {
                                     $exif = exif_read_data($imageurl);
                                     if ($exif && !empty($exif['Orientation'])) {
                                         switch ($exif['Orientation']) {
                                             case 3:
                                                 $rotated = imagerotate($img, 180, 0);
                                                 break;
                                             case 6:
                                                 $rotated = imagerotate($img, -90, 0);
                                                 break;
                                             case 8:
                                                 $rotated = imagerotate($img, 90, 0);
                                                 break;
                                         }
                                     }
                                     if ($rotated) {
                                         imagedestroy($img);
                                         $img = $rotated;
                                     }
                                 }
                             }
                         }
                         if ($img) {
                             $owidth = imagesx($img);
                             $oheight = imagesy($img);
                             if ($rotated || $owidth != $width || $oheight != $height) {
                                 $image = imagecreatetruecolor($width, $height);
                                 if ($filetype == 'png') {
                                     imagesavealpha($image, true);
                                     imagealphablending($image, false);
                                     $white = imagecolorallocatealpha($image, 255, 255, 255, 127);
                                     imagefilledrectangle($image, 0, 0, $width, $height, $white);
                                 } else {
                                     if ($filetype == 'jpg') {
                                         $bg = imagecolorallocate($image, $this->backgrouncolor[0], $this->backgrouncolor[1], $this->backgrouncolor[2]);
                                         imagefilledrectangle($image, 0, 0, $width, $height, $bg);
                                     }
                                 }
                                 $dst_x = 0;
                                 $dst_y = 0;
                                 $src_x = 0;
                                 $src_y = 0;
                                 $dst_w = $width;
                                 $dst_h = $height;
                                 $src_w = $owidth;
                                 $src_h = $oheight;
                                 $horizontalRatio = $width / $owidth;
                                 $verticalRatio = $height / $oheight;
                                 if ($mode == 'cover') {
//.........这里部分代码省略.........
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:image.php

示例3: generateAjaxCSS

 function generateAjaxCSS($loadedCSS)
 {
     $css = '';
     if (count($this->_cssFiles)) {
         $lesscache = $this->_lesscache;
         foreach ($this->_cssFiles as $k => $file) {
             if (!in_array($k, $loadedCSS)) {
                 if (is_array($file)) {
                     $lesscache->addContext($file[1], $file[2]);
                 } else {
                     $css .= preg_replace('#url\\([\'"]([^"\'\\)]+)[\'"]\\)#', 'url(' . NextendFilesystem::pathToAbsoluteURL(dirname($k)) . '/$1)', NextendFilesystem::readFile($k));
                 }
             }
         }
         if ($lesscache) {
             $filename = $lesscache->getCache();
             if ($filename) {
                 $lessfile = NextendFilesystem::absoluteURLToPath($lesscache->getCache());
                 $css .= preg_replace('#url\\([\'"]([^"\'\\)]+)[\'"]\\)#', 'url(' . NextendFilesystem::pathToAbsoluteURL(dirname($lessfile)) . '/$1)', NextendFilesystem::readFile($lessfile));
             }
         }
     }
     $css .= $this->_css;
     return $css;
 }
开发者ID:sangikumar,项目名称:IP,代码行数:25,代码来源:css.php

示例4: ss2_css_image_replace

 function ss2_css_image_replace($ms)
 {
     global $zip;
     if (substr($ms[1], 0, 2) == '//') {
         $ms[1] = 'http:' . $ms[1];
     }
     $path = NextendFilesystem::absoluteURLToPath($ms[1]);
     if (NextendFilesystem::fileexists($path)) {
         if (nextendIsJoomla()) {
             $rel = str_replace('plugins/', 'images/', NextendFilesystem::pathToRelativePath($path));
         } else {
             if (nextendIsWordpress()) {
                 $rel = str_replace(NEXTEND_SMART_SLIDER2 . 'plugins/', 'images/', $path);
             }
         }
         $zip->addFile(NextendFilesystem::readFile($path), $rel);
         return 'url(' . $rel . ')';
     }
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:19,代码来源:sliders.php

示例5: generateCSS

 function generateCSS()
 {
     if (class_exists('NextendFontsGoogle')) {
         $fonts = NextendFontsGoogle::getInstance();
         $fonts->generateFonts();
     }
     if (count($this->_cssFiles)) {
         foreach ($this->_cssFiles as $file) {
             if (is_array($file)) {
                 // LESS
                 $this->_lesscache->addContext($file[1], $file[2]);
             } else {
                 if (substr($file, 0, 4) == 'http') {
                     $this->serveCSSFile($file);
                 } else {
                     if ($this->_cacheenabled) {
                         $this->_cache->addFile($file);
                     } else {
                         $url = NextendFilesystem::pathToAbsoluteURL($file);
                         $this->serveCSSFile($url);
                     }
                 }
             }
         }
     }
     if ($this->_cacheenabled) {
         if ($this->_lesscache) {
             $this->_cache->addFile(NextendFilesystem::absoluteURLToPath($this->_lesscache->getCache()));
         }
         $this->serveCSSFile($this->_cache->getCache());
     } else {
         if ($this->_lesscache) {
             $this->serveCSSFile($this->_lesscache->getCache());
         }
     }
     $this->serveCSS();
 }
开发者ID:01J,项目名称:bealtine,代码行数:37,代码来源:css.php


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