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


PHP NextendFilesystem::existsFile方法代码示例

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


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

示例1: getCache

 function getCache()
 {
     if (count($this->_files) == 0 && $this->_text == '') {
         return false;
     }
     if ($this->_cacheTime == 'static' || $this->_cacheTime == 0) {
         $folder = $this->_path . 'static' . DIRECTORY_SEPARATOR;
         $currentcachetime = 0;
     } else {
         $time = time();
         $currentcachetime = $time - $time % $this->_cacheTime;
         $folder = $this->_path . $this->_prename . $currentcachetime . DIRECTORY_SEPARATOR;
     }
     $this->createCacheSubFolder($folder, $currentcachetime);
     $hash = $this->createHash();
     $cachefile = $folder . $hash . '.' . $this->_filetype;
     $cachefilegzip = $folder . $hash . '.php';
     if (!NextendFilesystem::existsFile($cachefile)) {
         $cached = "/* " . date('l jS \\of F Y h:i:s A') . "*/\n\n";
         for ($i = 0; $i < count($this->_files); $i++) {
             $cached .= $this->parseFile(NextendFilesystem::readFile($this->_files[$i]), $this->_files[$i], $i);
         }
         $cached .= $this->_text;
         NextendFilesystem::createFile($cachefile, $this->parseCached($cached));
         if ($this->_gzip) {
             $php = '<?php ' . $this->getgzipHeader($currentcachetime) . 'if (extension_loaded("zlib") && (ini_get("output_handler") != "ob_gzhandler")) {' . 'ini_set("zlib.output_compression", 1);' . '}' . 'readfile("' . str_replace('\\', '/', $cachefile) . '");';
             NextendFilesystem::createFile($cachefilegzip, $php);
         }
     }
     if ($this->_gzip) {
         return NextendFilesystem::pathToAbsoluteURL($cachefilegzip);
     }
     return NextendFilesystem::pathToAbsoluteURL($cachefile);
 }
开发者ID:Nguyenkain,项目名称:Elearning,代码行数:34,代码来源:cache.php

示例2: render

 function render($tpl)
 {
     $tplpath = $this->_path . 'tpl/' . $tpl . '.php';
     if (NextendFilesystem::existsFile($tplpath)) {
         include $tplpath;
     }
 }
开发者ID:Nguyenkain,项目名称:Elearning,代码行数:7,代码来源:view.php

示例3: getFontUrl

 function getFontUrl()
 {
     $css = NextendCss::getInstance();
     $url = 'https://fonts.googleapis.com/css?family=';
     $subset = '';
     if (count($this->_fonts)) {
         foreach ($this->_fonts as $family => $font) {
             $style = explode(',', $font[0]);
             $style = array_filter(array_unique($style));
             foreach ($style as $k => $s) {
                 $file = NEXTENDLIBRARYASSETS . 'fonts/' . preg_replace("/[^a-z0-9]/", '', strtolower($family)) . '/' . $s . '/s.css';
                 if (NextendFilesystem::existsFile($file)) {
                     unset($style[$k]);
                     $css->addCssFile($file, null, true);
                 }
             }
             if (count($style)) {
                 $url .= urlencode($family) . ':' . implode(',', $style) . '|';
                 $subset .= $font[1] . ',';
             }
         }
     }
     if ($url == 'https://fonts.googleapis.com/css?family=') {
         return '';
     }
     $url = substr($url, 0, -1);
     $subset = explode(',', $subset);
     $subset = array_filter(array_unique($subset));
     $url .= '&subset=' . implode(',', $subset);
     return $url;
 }
开发者ID:sangikumar,项目名称:IP,代码行数:31,代码来源:google.php

示例4: onNextendSliderGeneratorList

 function onNextendSliderGeneratorList(&$group, &$list, $showall = false)
 {
     if ($showall || smartsliderIsFull()) {
         $installed = NextendFilesystem::existsFile(JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jshopping' . DIRECTORY_SEPARATOR . 'jshopping.php');
         if ($showall || $installed) {
             $group[$this->_group] = 'JoomShopping';
             if (!isset($list[$this->_group])) {
                 $list[$this->_group] = array();
             }
             $list[$this->_group][$this->_group . '_products'] = array(NextendText::_('Products'), $this->getPath() . 'products' . DIRECTORY_SEPARATOR, true, true, $installed ? true : 'http://extensions.joomla.org/extensions/e-commerce/shopping-cart/5378', 'product');
         }
     }
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:13,代码来源:joomshopping.php

示例5: colorizeImage

 function colorizeImage($img, $targetColor, $baseColor)
 {
     $cachefile = $this->_folder . 'colorize' . md5($img) . $targetColor . $baseColor . '.' . $this->_filetype;
     if (!NextendFilesystem::existsFile($cachefile)) {
         $targetHexArr = NextendColor::hex82hex($targetColor);
         $targetColor = $targetHexArr[0];
         $alpha = hexdec($targetHexArr[1]);
         $c1 = NextendColor::hex2hsl($baseColor);
         $c2 = NextendColor::hex2hsl($targetColor);
         $im = imagecreatefrompng($img);
         $width = imagesx($im);
         $height = imagesy($im);
         $this->createIm($width, $height);
         $rgb = NextendColor::rgb2array($targetColor);
         for ($x = 0; $x < $width; $x++) {
             for ($y = 0; $y < $height; $y++) {
                 $rgba = ImageColorAt($im, $x, $y);
                 $rgb = array($rgba >> 16 & 0xff, $rgba >> 8 & 0xff, $rgba & 0xff);
                 $hsl = NextendColor::rgb2hsl($rgb);
                 $a[0] = $hsl[0] + ($c2[0] - $c1[0]);
                 $a[1] = $hsl[1] * ($c2[1] / $c1[1]);
                 if ($a[1] > 1) {
                     $a[1] = 1;
                 }
                 $a[2] = exp(log($hsl[2]) * log($c2[2]) / log($c1[2]));
                 if ($a[2] > 1) {
                     $a[2] = 1;
                 }
                 $rgb = NextendColor::hsl2rgb($a);
                 $A = 0xff - ($rgba >> 24) * 2 & 0xff;
                 $A = (int) ($A * ($alpha / 0xff));
                 if ($A > 0xff) {
                     $A = 0xff;
                 }
                 $A = (int) ((0xff - $A) / 2);
                 imagesetpixel($this->_im, $x, $y, imagecolorallocatealpha($this->_im, $rgb[0], $rgb[1], $rgb[2], $A));
             }
         }
         $this->saveIm($cachefile);
         imagedestroy($im);
     }
     return NextendFilesystem::pathToAbsoluteURL($cachefile);
 }
开发者ID:01J,项目名称:bealtine,代码行数:43,代码来源:image.php

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

示例7: resizeImage

 function resizeImage($image, $w, $h)
 {
     $w = intval($w);
     $h = intval($h);
     $cachefile = $this->_folder . 'resize' . md5($image) . $w . '_' . $h . '.' . $this->_filetype;
     if (!NextendFilesystem::existsFile($cachefile)) {
         if ($image && $w >= 1 && $h >= 1) {
             if (strpos($image, 'http') === 0) {
                 //url
             } else {
                 if (!NextendFilesystem::existsFile($image)) {
                     $image = NextendFilesystem::getBasePath() . $image;
                 }
             }
             if (is_readable($image)) {
                 $orig = null;
                 switch (exif_imagetype($image)) {
                     case IMAGETYPE_JPEG:
                         $orig = imagecreatefromjpeg($image);
                         break;
                     case IMAGETYPE_PNG:
                         $orig = imagecreatefrompng($image);
                         break;
                 }
                 if ($orig) {
                     $this->createIm($w, $h);
                     $ow = imagesx($orig);
                     $oh = imagesy($orig);
                     $ratioX = $ow / $w;
                     $ratioY = $oh / $h;
                     if ($ratioX > $ratioY) {
                         $ow = $ratioY * $w;
                     } else {
                         $oh = $ratioX * $h;
                     }
                     imagecopyresampled($this->_im, $orig, 0, 0, 0, 0, $w, $h, $ow, $oh);
                     $this->saveIm($cachefile);
                     imagedestroy($orig);
                     return NextendFilesystem::pathToAbsoluteURL($cachefile);
                 }
             } else {
                 return $image;
             }
         } else {
             return $image;
         }
     }
     return NextendFilesystem::pathToAbsoluteURL($cachefile);
 }
开发者ID:Gordondalos,项目名称:smart-event,代码行数:49,代码来源:image.php


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