<?php
/** 欧皇源码网 www.ohltk.com
* lessphp v0.4.0
* http://leafo.net/lessphp
*
* LESS css compiler, adapted from http://lesscss.org
*
* Copyright 2012, Leaf Corcoran <leafot@gmail.com>
* Licensed under MIT or GPLv3, see LICENSE
*/
/** 欧皇源码网 www.ohltk.com
* The less compiler and parser.
*
* Converting LESS to CSS is a three stage process. The incoming file is parsed
* by `lessc_parser` into a syntax tree, then it is compiled into another tree
* representing the CSS structure by `lessc`. The CSS tree is fed into a
* formatter, like `lessc_formatter` which then outputs CSS as a string.
*
* During the first compile, all values are *reduced*, which means that their
* types are brought to the lowest form before being dump as strings. This
* handles math equations, variable dereferences, and the like.
*
* The `parse` function of `lessc` is the entry point.
*
* In summary:
*
* The `lessc` class creates an intstance of the parser, feeds it LESS code,
* then transforms the resulting tree to a CSS tree. This class also holds the
* evaluation context, such as all available mixins and variables at any given
* time.
*
* The `lessc_parser` class is only concerned with parsing its input.
*
* The `lessc_formatter` takes a CSS tree, and dumps it to a formatted string,
* handling things like indentation.
*/
class lessc {
static public $VERSION = "v0.4.0";
static protected $TRUE = array("keyword", "true");
static protected $FALSE = array("keyword", "false");
protected $libFunctions = array();
protected $registeredVars = array();
protected $preserveComments = false;
public $vPrefix = '@'; // prefix of abstract properties
public $mPrefix = '$'; // prefix of abstract blocks
public $parentSelector = '&';
public $importDisabled = false;
public $importDir = '';
protected $numberPrecision = null;
protected $allParsedFiles = array();
// set to the parser that generated the current line when compiling
// so we know how to create error messages
protected $sourceParser = null;
protected $sourceLoc = null;
static public $defaultValue = array("keyword", "");
static protected $nextImportId = 0; // uniquely identify imports
// attempts to find the path of an import url, returns null for css files
protected function findImport($url) {
foreach ((array)$this->importDir as $dir) {
$full = $dir.(substr($dir, -1) != '/' ? '/' : '').$url;
if ($this->fileExists($file = $full.'.less') || $this->fileExists($file = $full)) {
return $file;
}
}
return null;
}
protected function fileExists($name) {
return is_file($name);
}
static public function compressList($items, $delim) {
if (!isset($items[1]) && isset($items[0])) return $items[0];
else return array('list', $delim, $items);
}
static public function preg_quote($what) {
return preg_quote($what, '/');
}
protected function tryImport($importPath, $parentBlock, $out) {
if ($importPath[0] == "function" && $importPath[1] == "url") {
$importPath = $this->flattenList($importPath[2]);
}
$str = $this->coerceString($importPath);
if ($str === null) return false;
$url = $this->compileValue($this->lib_e($str));
// don't import if it ends in css
if (substr_compare($url, '.css', -4, 4) === 0) return false;
$realPath = $this->findImport($url);
if ($realPath === null) return false;
if ($this->importDisabled) {
return array(false, "/* import disabled */");
}
if (isset($this->allParsedFiles[realpath($realPath)])) {
return array(false, null);
}
$this->addParsedFile($realPath);
$parser = $this->makeParser($realPath);
$root = $parser->parse(file_get_contents($realPath));
// set the parents of all the block props
foreach ($root->props as $prop) {
if ($prop[0] == "block") {
$prop[1]->parent = $parentBlock;
}
}
// copy mixins into scope, set their parents
// bring blocks from import into current block
// TODO: need to mark the source parser these came from this file
foreach ($root->children as $childName => $child) {
if (isset($parentBlock->children[$childName])) {
$parentBlock->children[$childName] = array_merge(
$parentBlock->children[$childName],
$child);
} else {
$parentBlock->children[$childName] = $child;
}
}
$pi = pathinfo($realPath);
$dir = $pi["dirname"];
list($top, $bottom) = $this->sortProps($root->props, true);
$this->compileImportedProps($top, $parentBlock, $out, $parser, $dir);
return array(true, $bottom, $parser, $dir);
}
protected function compileImportedProps($props, $block, $out, $sourceParser, $importDir) {
$oldSourceParser = $this->sourceParser;
$oldImport = $this->importDir;
// TODO: this is because the importDir api is stupid
$this->importDir = (array)$this->importDir;
array_unshift($this->importDir, $importDir);
foreach ($props as $prop) {
$this->compileProp($prop, $block, $out);
}
$this->importDir = $oldImport;
$this->sourceParser = $oldSourceParser;
}
/** 欧皇源码网 www.ohltk.com
* Recursively compiles a block.
*
* A block is analogous to a CSS block in most cases. A single LESS document
* is encapsulated in a block when parsed, but it does not have parent tags
* so all of it's children appear on the root level when compiled.
*
* Blocks are made up of props and children.
*
* Props are property instructions, array tuples which describe an action
* to be taken, eg. write a property, set a variable, mixin a block.
*
* The children of a block are just all the blocks that are defined within.
* This is used to look up mixins when performing a mixin.
*
* Compiling the block involves pushing a fresh environment on the stack,
* and iterating through the props, compiling each one.
*
* See lessc::compileProp()
*
*/
protected function compileBlock($block) {
switch ($block->type) {
case "root":
$this->compileRoot($block);
break;
case null:
$this->compileCSSBlock($block);
break;
case "media":
$this->compileMedia($block);
break;
case "directive":
$name = "@" . $block->name;
if (!empty($block->value)) {
$name .= " " . $this->compileValue($this->reduce($block->value));
}
$this->compileNestedBlock($block, array($name));
break;
default:
$this->throwError("unknown block type: $block->type\n");
}
}
protected function compileCSSBlock($block) {
$env = $this->pushEnv();
$selectors = $this->compileSelectors($block->tags);
$env->selectors = $this->multiplySelectors($selectors);
$out = $this->makeOutputBlock(null, $env->selectors);
$this->scope->children[] = $out;
$this->compileProps($block, $out);
$block->scope = $env; // mixins carry scope with them!
$this->popEnv();
}
protected function compileMedia($media) {
$env = $this->pushEnv($media);
$parentScope = $this->mediaParent($this->scope);
$query = $this->compileMediaQuery($this->multiplyMedia($env));
$this->scope = $this->makeOutputBlock($media->type, array($query));
$parentScope->children[] = $this->scope;
$this->compileProps($media, $this->scope);
if (count($this->scope->lines) > 0) {
$orphanSelelectors = $this->findClosestSelectors();
if (!is_null($orphanSelelectors)) {
$orphan = $this->makeOutputBlock(null, $orphanSelelectors);
$orphan->lines = $this->scope->lines;
array_unshift($this->scope->children, $orphan);
$this->scope->lines = array();
}
}
$this->scope = $this->scope->parent;
$this->popEnv();
}
protected function mediaParent($scope) {
while (!empty($scope->parent)) {
if (!empty($scope->type) && $scope->type != "media") {
break;
}
$scope = $scope->parent;
}
return $scope;
}
protected function compileNestedBlock($block, $selectors) {
$this->pushEnv($block);
$this->scope = $this->makeOutputBlock($block->type, $selectors);
$this->scope->parent->children[] = $this->scope;
$this->compileProps($block, $this->scope);
$this->scope = $this->sco
没有合适的资源?快使用搜索试试~ 我知道了~
emlog后台管理面板lscale主题
共131个文件
php:59个
less:27个
js:14个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 36 浏览量
2022-07-12
13:00:33
上传
评论
收藏 916KB ZIP 举报
温馨提示
lscale主题是一套emlog后台界面主题,基于目前非常流行的响应式框架bootstrap开发 使用专为bootstrap设计创造的Font Awesome字体图标,响应式设计主流的左右两栏布局 完美支持电脑、平板、手机等主流终端设备,与emlog简陋的默认后台主题相比,整体非常高大上。 模板使用说明: 1、备份程序admin目录所有文件(因为模板修改了很多的admin下的核心内容) 2、解压下载的压缩包,把lscale文件夹里的所有文件上传到程序的admin目录并覆盖; 3、把tpl_option整个文件夹上传到程序的content/plugins/目录(如果安装过模板设置插件,请备份) 4、刷新后台即可
资源推荐
资源详情
资源评论
收起资源包目录
emlog后台管理面板lscale主题 (131个子文件)
bootstrap.css 118KB
app.css 56KB
font-awesome.min.css 23KB
animate.css 16KB
icon.css 12KB
style.css 11KB
main.css 4KB
css-uploadify.css 2KB
login.css 1KB
css-att.css 887B
font.css 607B
icon.eot 69KB
fontawesome-webfont.eot 59KB
add_bg.gif 2KB
tar.gif 2KB
fnone.gif 1KB
avatar.jpg 3KB
preview.jpg 2KB
jquery.min.js 91KB
jquery-ui-1.10.3.custom.min.js 71KB
bootstrap.js 54KB
jquery-ui.min.js 37KB
excanvas.js 19KB
app.js 17KB
common.js 10KB
main.js 7KB
app.plugin.js 5KB
jquery.slimscroll.min.js 5KB
respond.min.js 4KB
html5shiv.js 2KB
jquery.ui.touch-punch.min.js 1KB
emo.js 729B
icons.less 36KB
variables.less 16KB
app.mixins.less 13KB
app.reset.less 11KB
app.utilities.less 10KB
app.nav.less 7KB
app.layout.less 4KB
app.variables.less 3KB
app.widgets.less 3KB
app.plugin.less 2KB
app.colors.less 2KB
app.buttons.less 2KB
app.arrow.less 2KB
app.icons.less 1KB
mixins.less 983B
path.less 770B
animated.less 713B
app.switch.less 699B
rotated-flipped.less 622B
core.less 509B
stacked.less 476B
font-awesome.less 465B
app.less 402B
list.less 377B
larger.less 370B
bordered-pulled.less 330B
fixed-width.less 119B
FontAwesome.otf 92KB
lessc.inc.php 90KB
tpl_options.php 30KB
widgets.php 25KB
configure.php 16KB
plugin_header.php 13KB
admin_log.php 13KB
navbar.php 13KB
header.php 13KB
index.php 13KB
twitter.php 10KB
sort.php 9KB
data.php 8KB
template.php 8KB
edit_log.php 7KB
comment.php 7KB
user.php 7KB
add_log.php 6KB
seo.php 6KB
admin_log.php 5KB
links.php 5KB
comment.php 5KB
blogger.php 5KB
plugin.php 5KB
sortedit.php 5KB
user.php 5KB
blogger.php 5KB
template.php 4KB
page.php 4KB
admin_page.php 4KB
useredit.php 4KB
edit_page.php 4KB
add_page.php 4KB
attlib.php 3KB
naviedit.php 3KB
upload_multi.php 3KB
login.php 3KB
index.php 3KB
upload.php 2KB
template_crop.php 2KB
globals.php 2KB
共 131 条
- 1
- 2
资源评论
办公模板库素材蛙
- 粉丝: 1560
- 资源: 2289
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功