本文整理汇总了PHP中NextendFilesystem::pathToAbsoluteURL方法的典型用法代码示例。如果您正苦于以下问题:PHP NextendFilesystem::pathToAbsoluteURL方法的具体用法?PHP NextendFilesystem::pathToAbsoluteURL怎么用?PHP NextendFilesystem::pathToAbsoluteURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NextendFilesystem
的用法示例。
在下文中一共展示了NextendFilesystem::pathToAbsoluteURL方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: makeUrl
function makeUrl($matches)
{
if (substr($matches[1], 0, 5) == 'data:') {
return $matches[0];
}
if (substr($matches[1], 0, 4) == 'http') {
return $matches[0];
}
if (substr($matches[1], 0, 2) == '//') {
return $matches[0];
}
return 'url(' . str_replace(array('http://', 'https://'), '//', NextendFilesystem::pathToAbsoluteURL(dirname($this->path))) . '/' . $matches[1] . ')';
}
示例3: getData
function getData($number)
{
nextendimport('nextend.database.database');
$db = NextendDatabase::getInstance();
$data = array();
require_once JPATH_ROOT . '/components/com_mijoshop/mijoshop/mijoshop.php';
$config = MijoShop::get('opencart')->get('config');
$currency = MijoShop::get('opencart')->get('currency');
if (MijoShop::get('base')->isAdmin('joomla')) {
global $vqmod;
if (empty($vqmod)) {
require_once JPATH_MIJOSHOP_OC . '/vqmod/vqmod.php';
$vqmod = new VQMod();
}
require_once $vqmod->modCheck(DIR_SYSTEM . 'library/tax.php');
MijoShopOpencart::$tax = new Tax(MijoShopOpencart::$registry);
MijoShopOpencart::$registry->set('tax', MijoShopOpencart::$tax);
}
$tax = MijoShop::get('opencart')->get('tax');
$router = MijoShop::get('router');
$language_id = intval($this->_data->get('mijoshopproductssourcelanguage'));
if (!$language_id) {
$language_id = intval($config->get('config_language_id'));
}
$tmpLng = $config->get('config_language_id');
$config->set('config_language_id', $language_id);
MijoShopOpencart::$loader->model('catalog/product');
$p = new ModelCatalogProduct(MijoShopOpencart::$registry);
$query = 'SELECT ';
$query .= 'p.product_id ';
$query .= 'FROM #__mijoshop_product AS p ';
$query .= 'LEFT JOIN #__mijoshop_product_description AS pc USING(product_id) ';
$query .= 'LEFT JOIN #__mijoshop_product_to_category AS ptc USING(product_id) ';
$query .= 'LEFT JOIN #__mijoshop_product_special AS ps USING(product_id) ';
$where = array();
$category = array_map('intval', explode('||', $this->_data->get('mijoshopproductssourcecategory', '')));
if (!in_array(0, $category) && count($category) > 0) {
$where[] = 'ptc.category_id IN (' . implode(',', $category) . ') ';
}
if ($this->_data->get('mijoshopproductssourcepublished', 1)) {
$where[] = ' p.status = 1 ';
}
if ($this->_data->get('mijoshopproductssourcespecial', 0)) {
$where[] = ' ps.price IS NOT NULL';
$jnow = JFactory::getDate();
$now = version_compare(JVERSION, '1.6.0', '<') ? $jnow->toMySQL() : $jnow->toSql();
$where[] = ' (ps.date_start = "0000-00-00" OR ps.date_start < \'' . $now . '\')';
$where[] = ' (ps.date_end = "0000-00-00" OR ps.date_end > \'' . $now . '\')';
}
if ($this->_data->get('mijoshopproductssourceinstock', 0)) {
$where[] = ' p.quantity > 0 ';
}
$where[] = ' pc.language_id = ' . $language_id;
if (count($where) > 0) {
$query .= 'WHERE ' . implode(' AND ', $where) . ' ';
}
$query .= 'GROUP BY p.product_id ';
$order = NextendParse::parse($this->_data->get('mijoshopproductsorder1', 'pc.name|*|asc'));
if ($order[0]) {
$query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
$order = NextendParse::parse($this->_data->get('mijoshopproductsorder2', '|*|asc'));
if ($order[0]) {
$query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
}
}
$query .= 'LIMIT 0, ' . $number;
$db->setQuery($query);
$result = $db->loadAssocList();
for ($i = 0; $i < count($result); $i++) {
$pi = $p->getProduct($result[$i]['product_id']);
$data[$i] = array();
$data[$i]['title'] = $data[$i]['name'] = $pi['name'];
$data[$i]['short_description'] = $pi['description'];
$data[$i]['model'] = $pi['model'];
$data[$i]['sku'] = $pi['sku'];
$data[$i]['quantity'] = $pi['quantity'];
$data[$i]['manufacturer'] = $pi['manufacturer'];
$data[$i]['rating'] = $pi['rating'];
$data[$i]['price'] = $currency->format($tax->calculate($pi['price'], $pi['tax_class_id'], $config->get('config_tax')));
if ((double) $product_info['special']) {
$data[$i]['special_price'] = $currency->format($tax->calculate($pi['special'], $pi['tax_class_id'], $config->get('config_tax')));
} else {
$data[$i]['special_price'] = '';
}
if ($config->get('config_tax')) {
$data[$i]['price_ex_tax'] = $currency->format((double) $pi['special'] ? $pi['special'] : $pi['price']);
}
$data[$i]['thumbnail'] = $data[$i]['image'] = NextendFilesystem::pathToAbsoluteURL(DIR_IMAGE) . $pi['image'];
$data[$i]['addtocart'] = $data[$i]['url'] = $router->route('index.php?option=com_mijoshop&route=product/product&product_id=' . $pi['product_id']);
$data[$i]['addtocart_label'] = 'View product';
$data[$i]['category_name'] = 'Not available';
$data[$i]['category_url'] = '#';
}
$config->set('config_language_id', $tmpLng);
return $data;
}
示例4: resizeImage
//.........这里部分代码省略.........
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') {
if ($horizontalRatio > $verticalRatio) {
$new_h = $horizontalRatio * $oheight;
$dst_y = ($height - $new_h) / 2;
$dst_h = $new_h;
} else {
$new_w = $verticalRatio * $owidth;
$dst_x = ($width - $new_w) / 2;
$dst_w = $new_w;
}
} else {
if ($mode == 'contain') {
if ($horizontalRatio < $verticalRatio) {
$new_h = $horizontalRatio * $oheight;
$dst_y = ($height - $new_h) / 2;
$dst_h = $new_h;
} else {
$new_w = $verticalRatio * $owidth;
$dst_x = ($width - $new_w) / 2;
$dst_w = $new_w;
}
}
}
imagecopyresampled($image, $img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
imagedestroy($img);
if ($filetype == 'png') {
imagepng($image, $cachefile);
} else {
if ($filetype == 'jpg') {
imagejpeg($image, $cachefile, 100);
}
}
imagedestroy($image);
return NextendFilesystem::pathToAbsoluteURL($cachefile);
} else {
imagedestroy($img);
}
}
}
}
} else {
return NextendFilesystem::pathToAbsoluteURL($cachefile);
}
}
}
return $originalimageurl;
}
示例5: 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);
}
示例6: parseFile
function parseFile($content, $path, $i)
{
return preg_replace('#url\\([\'"]([^"\'\\)]+)[\'"]\\)#', 'url(' . NextendFilesystem::pathToAbsoluteURL(dirname($path)) . '/$1)', $content);
}
示例7: 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;
}
示例8: 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();
}
示例9: lessColorizeimage
function lessColorizeimage(&$arg)
{
if (isset($arg[2])) {
$arg =& $arg[2];
if (isset($arg[0])) {
$colorize = $this->getFromEscapedArgs($arg[0]);
}
if (isset($arg[1])) {
$image = $this->getFromEscapedArgs($arg[1]);
if ($image == '-1') {
return 'none';
}
}
if (isset($arg[2])) {
$color = $this->getFromEscapedArgs($arg[2]);
}
$url = '';
if ($colorize == 0) {
$url = NextendFilesystem::pathToAbsoluteURL(NextendFilesystem::getBasePath() . $image);
} else {
if (realpath($image) !== false) {
$image = realpath($image);
} else {
$image = NextendFilesystem::getBasePath() . $image;
}
$url = $this->colorizeImage($image, $color, '548722');
}
return $this->url($url);
}
}