示例#1
0
文件: init.php 项目: DanTour/design
/**
 * J!Blank Template for Joomla by JBlank.pro (JBZoo.com)
 *
 * @package    JBlank
 * @author     SmetDenis <*****@*****.**>
 * @copyright  Copyright (c) JBlank.pro
 * @license    http://www.gnu.org/licenses/gpl.html GNU/GPL
 * @link       http://jblank.pro/ JBlank project page
 */
defined('_JEXEC') or die;
// load libs
!version_compare(PHP_VERSION, '5.3.10', '=>') or die('Your host needs to use PHP 5.3.10 or higher to run JBlank Template');
require_once dirname(__FILE__) . '/libs/template.php';
/************************* runtime configurations *********************************************************************/
$tpl = JBlankTemplate::getInstance();
$tpl->css(array('//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', 'bootstrap-submenu.min.css', 'carousel.css', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-lightness/jquery-ui.css', 'slimbox-jquery/slimbox2-rtl.css', 'template.less'))->js(array('//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js', 'template.js', 'bootstrap.min.js', 'bootstrap-submenu.min.js', '//code.jquery.com/ui/1.11.3/jquery-ui.min.js', '//ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js', 'slimbox2.js', 'custom.js'))->excludeCSS(array())->excludeJS(array('mootools', 'media\\/jui\\/js'))->generator('J!Blank.pro Joomla Template')->html5(true)->meta(array('<meta http-equiv="X-UA-Compatible" content="IE=edge">', '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">', '<link rel="apple-touch-icon-precomposed" href="' . $tpl->img . '/icons/apple-touch-iphone.png">', '<link rel="apple-touch-icon-precomposed" sizes="72x72" href="' . $tpl->img . '/icons/apple-touch-ipad.png">', '<link rel="apple-touch-icon-precomposed" sizes="114x114" href="' . $tpl->img . '/icons/apple-touch-iphone4.png">', '<link rel="apple-touch-icon-precomposed" sizes="144x144" href="' . $tpl->img . '/icons/apple-touch-ipad-retina.png">', '<meta name="google-site-verification" content="... google verification hash ..." />', '<meta name="yandex-verification" content="... yandex verification hash ..." />'));
/************************* your php code below this line **************************************************************/
// mobile detect using (just for example!)
if ($tpl->isMobile()) {
    $tpl->css('media-mobile.less');
    // css only for mobiles
} elseif ($tpl->isTablet()) {
    $tpl->css('media-tablet.less');
    // css only for tablets
}
// USE IT ON YOUR OWN --> RISK <-- THIS IS EXPERIMENTAL FEATURES!
// After that all assets files will be included
/*
$tpl
    // merge css with compress (second arg)
示例#2
0
 /**
  * Convert image file to base64 string for CSS files
  * @param $args
  * @return string
  * @throws Exception
  */
 public static function lib_dataUri($args)
 {
     if (!isset($args[2])) {
         return '';
     }
     $tpl = JBlankTemplate::getInstance();
     $image = $args[2][0];
     if (!empty($image)) {
         $filePath = $tpl->imgFull . '/' . $image;
     } else {
         throw new Exception('data-uri: undefined argument ' . print_r($args, true));
     }
     $filePath = JPath::clean($filePath);
     if (!JFile::exists($filePath)) {
         throw new Exception('data-uri: file "' . $filePath . '" is not exists');
     }
     if ($tpl->isDebug()) {
         $result = 'url(\'' . $tpl->img . '/' . ltrim($image, '/') . '\')';
     } else {
         $imgData = getimagesize($filePath);
         $imgBin = fread(fopen($filePath, 'r'), filesize($filePath));
         $imgStr = base64_encode($imgBin);
         $result = 'url(\'data:' . $imgData['mime'] . ';base64,' . $imgStr . '\')';
     }
     return $result;
 }
示例#3
0
文件: minify.php 项目: Cheren/JBlank
 /**
  * @return bool
  */
 protected function _isDebug()
 {
     return $this->_tpl->isDebug();
 }
示例#4
0
 /**
  * Convert image file to base64 string for CSS files
  * @param $args
  * @return string
  * @throws Exception
  */
 public static function lib_dataUri($args)
 {
     if (!isset($args[2])) {
         return '';
     }
     $tpl = JBlankTemplate::getInstance();
     $image = $args[2][0];
     if (!empty($image)) {
         $filePath = $tpl->lessFull . '/' . $image;
     } else {
         throw new Exception('data-uri: undefined argument ' . print_r($args, true));
     }
     $filePath = realpath(JPath::clean($filePath));
     if (empty($filePath) || !JFile::exists($filePath)) {
         throw new Exception('data-uri: file "' . $filePath . '" is not exists');
     }
     $kbSize = filesize($filePath) / 1024;
     if ($tpl->isDebug() || $kbSize > 32) {
         $relPath = str_replace(array(JPATH_ROOT, $tpl->imgFull), '', $filePath);
         $relPath = str_replace("\\", '/', $relPath);
         $result = 'url("' . $tpl->img . '/' . ltrim($relPath, '/') . '")';
     } else {
         $imgData = getimagesize($filePath);
         $imgBin = fread(fopen($filePath, 'r'), filesize($filePath));
         $imgStr = base64_encode($imgBin);
         $result = 'url("data:' . $imgData['mime'] . ';base64,' . $imgStr . '"\'")';
     }
     return $result;
 }