Permalink
Browse files

MaxSite CMS 0.818

  • Loading branch information...
1 parent 818180b commit a216870b35110a0d63d43a63e277880d9c5142b8 @maxsite committed Mar 9, 2013
@@ -7,7 +7,7 @@
class Maxsite_lib
{
- public $version = '0.817';
+ public $version = '0.818';
public $config = array();
public $data = array();
public $hooks = array();
@@ -1,7 +1,7 @@
<?php
/**
- * lessphp v0.3.8
+ * lessphp v0.3.9
* http://leafo.net/lessphp
*
* LESS css compiler, adapted from http://lesscss.org
@@ -38,7 +38,7 @@
* handling things like indentation.
*/
class lessc {
- static public $VERSION = "v0.3.8";
+ static public $VERSION = "v0.3.9";
static protected $TRUE = array("keyword", "true");
static protected $FALSE = array("keyword", "false");
@@ -327,6 +327,9 @@ protected function compileMediaQuery($queries) {
$parts[] = "($q[1])";
}
break;
+ case "variable":
+ $parts[] = $this->compileValue($this->reduce($q));
+ break;
}
}
@@ -434,7 +437,7 @@ protected function compileSelectors($selectors) {
foreach ($selectors as $s) {
if (is_array($s)) {
list(, $value) = $s;
- $out[] = $this->compileValue($this->reduce($value));
+ $out[] = trim($this->compileValue($this->reduce($value)));
} else {
$out[] = $s;
}
@@ -814,6 +817,10 @@ protected function lib_isem($value) {
return $this->toBool($value[0] == "number" && $value[2] == "em");
}
+ protected function lib_isrem($value) {
+ return $this->toBool($value[0] == "number" && $value[2] == "rem");
+ }
+
protected function lib_rgbahex($color) {
$color = $this->coerceColor($color);
if (is_null($color))
@@ -890,6 +897,16 @@ protected function lib_round($arg) {
return array("number", round($value), $arg[2]);
}
+ protected function lib_unit($arg) {
+ if ($arg[0] == "list") {
+ list($number, $newUnit) = $arg[2];
+ return array("number", $this->assertNumber($number),
+ $this->compileValue($this->lib_e($newUnit)));
+ } else {
+ return array("number", $this->assertNumber($arg), "");
+ }
+ }
+
/**
* Helper function to get arguments for color manipulation functions.
* takes a list that contains a color like thing and a percentage
@@ -1029,6 +1046,25 @@ protected function lib_mix($args) {
return $this->fixColor($new);
}
+ protected function lib_contrast($args) {
+ if ($args[0] != 'list' || count($args[2]) < 3) {
+ return array(array('color', 0, 0, 0), 0);
+ }
+
+ list($inputColor, $darkColor, $lightColor) = $args[2];
+
+ $inputColor = $this->assertColor($inputColor);
+ $darkColor = $this->assertColor($darkColor);
+ $lightColor = $this->assertColor($lightColor);
+ $hsl = $this->toHSL($inputColor);
+
+ if ($hsl[3] > 50) {
+ return $darkColor;
+ }
+
+ return $lightColor;
+ }
+
protected function assertColor($value, $error = "expected color value") {
$color = $this->coerceColor($value);
if (is_null($color)) $this->throwError($error);
@@ -1091,7 +1127,7 @@ protected function toRGB_helper($comp, $temp1, $temp2) {
* Expects H to be in range of 0 to 360, S and L in 0 to 100
*/
protected function toRGB($color) {
- if ($color == 'color') return $color;
+ if ($color[0] == 'color') return $color;
$H = $color[1] / 360;
$S = $color[2] / 100;
@@ -1179,6 +1215,14 @@ protected function funcToColor($func) {
protected function reduce($value, $forExpression = false) {
switch ($value[0]) {
+ case "interpolate":
+ $reduced = $this->reduce($value[1]);
+ $var = $this->compileValue($reduced);
+ $res = $this->reduce(array("variable", $this->vPrefix . $var));
+
+ if (empty($value[2])) $res = $this->lib_e($res);
+
+ return $res;
case "variable":
$key = $value[1];
if (is_array($key)) {
@@ -1299,8 +1343,12 @@ protected function coerceColor($value) {
case 'keyword':
$name = $value[1];
if (isset(self::$cssColors[$name])) {
- list($r, $g, $b) = explode(',', self::$cssColors[$name]);
- return array('color', $r, $g, $b);
+ $rgba = explode(',', self::$cssColors[$name]);
+
+ if(isset($rgba[3]))
+ return array('color', $rgba[0], $rgba[1], $rgba[2], $rgba[3]);
+
+ return array('color', $rgba[0], $rgba[1], $rgba[2]);
}
return null;
}
@@ -1445,6 +1493,34 @@ protected function op_color_color($op, $left, $right) {
return $this->fixColor($out);
}
+ function lib_red($color){
+ $color = $this->coerceColor($color);
+ if (is_null($color)) {
+ $this->throwError('color expected for red()');
+ }
+
+ return $color[1];
+ }
+
+ function lib_green($color){
+ $color = $this->coerceColor($color);
+ if (is_null($color)) {
+ $this->throwError('color expected for green()');
+ }
+
+ return $color[2];
+ }
+
+ function lib_blue($color){
+ $color = $this->coerceColor($color);
+ if (is_null($color)) {
+ $this->throwError('color expected for blue()');
+ }
+
+ return $color[3];
+ }
+
+
// operator on two numbers
protected function op_number_number($op, $left, $right) {
$unit = empty($left[2]) ? $right[2] : $left[2];
@@ -1945,6 +2021,7 @@ public static function cexecute($in, $force = false, $less = null) {
'teal' => '0,128,128',
'thistle' => '216,191,216',
'tomato' => '255,99,71',
+ 'transparent' => '0,0,0,0',
'turquoise' => '64,224,208',
'violet' => '238,130,238',
'wheat' => '245,222,179',
@@ -2519,6 +2596,9 @@ protected function mediaExpression(&$out) {
$out = array("mediaExp", $feature);
if ($value) $out[] = $value;
return true;
+ } elseif ($this->variable($variable)) {
+ $out = array('variable', $variable);
+ return true;
}
$this->seek($s);
@@ -2572,12 +2652,11 @@ protected function openString($end, &$out, $nestingOpen=null, $rejectStrs = null
continue;
}
- if (in_array($tok, $rejectStrs)) {
- $count = null;
+ if (!empty($rejectStrs) && in_array($tok, $rejectStrs)) {
+ $ount = null;
break;
}
-
$content[] = $tok;
$this->count+= strlen($tok);
}
@@ -2652,10 +2731,10 @@ protected function interpolation(&$out) {
$s = $this->seek();
if ($this->literal("@{") &&
- $this->keyword($var) &&
+ $this->openString("}", $interp, null, array("'", '"', ";")) &&
$this->literal("}", false))
{
- $out = array("variable", $this->lessc->vPrefix . $var);
+ $out = array("interpolate", $interp);
$this->eatWhiteDefault = $oldWhite;
if ($this->eatWhiteDefault) $this->whitespace();
return true;
@@ -2829,38 +2908,73 @@ protected function tagExpression(&$value) {
return false;
}
- // a single tag
+ // a space separated list of selectors
protected function tag(&$tag, $simple = false) {
if ($simple)
- $chars = '^,:;{}\][>\(\) "\'';
+ $chars = '^@,:;{}\][>\(\) "\'';
else
- $chars = '^,;{}["\'';
+ $chars = '^@,;{}["\'';
+
+ $s = $this->seek();
if (!$simple && $this->tagExpression($tag)) {
return true;
}
- $tag = '';
- while ($this->tagBracket($first)) $tag .= $first;
+ $hasExpression = false;
+ $parts = array();
+ while ($this->tagBracket($first)) $parts[] = $first;
+
+ $oldWhite = $this->eatWhiteDefault;
+ $this->eatWhiteDefault = false;
while (true) {
if ($this->match('(['.$chars.'0-9]['.$chars.']*)', $m)) {
- $tag .= $m[1];
+ $parts[] = $m[1];
if ($simple) break;
- while ($this->tagBracket($brack)) $tag .= $brack;
+ while ($this->tagBracket($brack)) {
+ $parts[] = $brack;
+ }
continue;
- } elseif ($this->unit($unit)) { // for keyframes
- $tag .= $unit[1] . $unit[2];
+ }
+
+ if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "@") {
+ if ($this->interpolation($interp)) {
+ $hasExpression = true;
+ $interp[2] = true; // don't unescape
+ $parts[] = $interp;
+ continue;
+ }
+
+ if ($this->literal("@")) {
+ $parts[] = "@";
+ continue;
+ }
+ }
+
+ if ($this->unit($unit)) { // for keyframes
+ $parts[] = $unit[1];
+ $parts[] = $unit[2];
continue;
}
+
break;
}
+ $this->eatWhiteDefault = $oldWhite;
+ if (!$parts) {
+ $this->seek($s);
+ return false;
+ }
- $tag = trim($tag);
- if ($tag == '') return false;
+ if ($hasExpression) {
+ $tag = array("exp", array("string", "", $parts));
+ } else {
+ $tag = trim(implode($parts));
+ }
+ $this->whitespace();
return true;
}
@@ -49,6 +49,9 @@ function dignity_rss_widget($num = 1)
if (isset($options['rss_to_email']) ) $options['rss_to_email'] = $options['rss_to_email'];
else $options['rss_to_email'] = t('RSS-лента на E-Mail', __FILE__);
+
+ if (isset($options['rss_to_email_login']) ) $options['rss_to_email_login'] = $options['rss_to_email_login'];
+ else $options['rss_to_email_login'] = '';
if (isset($options['textposle']) ) $options['textposle'] = '<p>' . $options['textposle'] . '</p>';
else $options['textposle'] = '';
@@ -74,6 +77,7 @@ function dignity_rss_widget_form($num = 1)
if ( !isset($options['yandex_text']) ) $options['yandex_text'] = t('Читать блог через Яндекс', __FILE__);
if ( !isset($options['rss_text']) ) $options['rss_text'] = t('RSS лента', __FILE__);
if ( !isset($options['rss_to_email']) ) $options['rss_to_email'] = t('Получать RSS-ленту на почту', __FILE__);
+ if ( !isset($options['rss_to_email_login']) ) $options['rss_to_email_login'] = '';
if ( !isset($options['textposle']) ) $options['textposle'] = '';
// вывод самой формы
@@ -83,8 +87,6 @@ function dignity_rss_widget_form($num = 1)
$form = mso_widget_create_form(t('Заголовок', __FILE__), form_input( array( 'name'=>$widget . 'header', 'value'=>$options['header'] ) ), '');
- $form .= mso_widget_create_form(t('Текст вначале', __FILE__), form_textarea( array( 'name'=>$widget . 'textdo', 'value'=>$options['textdo'] ) ), '');
-
$form .= mso_widget_create_form(t('Адрес RSS-Feed', __FILE__), form_input( array( 'name'=>$widget . 'feed_url', 'value'=>$options['feed_url'] ) ), '');
$form .= mso_widget_create_form(t('Текст для Google', __FILE__), form_input( array( 'name'=>$widget . 'google_text', 'value'=>$options['google_text'] )) , '');
@@ -95,6 +97,10 @@ function dignity_rss_widget_form($num = 1)
$form .= mso_widget_create_form(t('Текст RSS-лента на почту', __FILE__), form_input( array( 'name'=>$widget . 'rss_to_email', 'value'=>$options['rss_to_email'] ) ), '');
+ $form .= mso_widget_create_form(t('Ваш логин в <a href="http://feedburner.google.com/" target="_blank">feedburner</a>', __FILE__), form_input( array( 'name'=>$widget . 'rss_to_email_login', 'value'=>$options['rss_to_email_login'] ) ), t('Используется для оформления подписки на email. Активируйте в своем аккаунте feedburner разрешение для подписки на email.', __FILE__));
+
+ $form .= mso_widget_create_form(t('Текст вначале', __FILE__), form_textarea( array( 'name'=>$widget . 'textdo', 'value'=>$options['textdo'] ) ), '');
+
$form .= mso_widget_create_form(t('Текст в конце', __FILE__), form_textarea( array( 'name'=>$widget . 'textposle', 'value'=>$options['textposle'] ) ), '');
return $form;
@@ -119,6 +125,7 @@ function dignity_rss_widget_update($num = 1)
$newoptions['yandex_text'] = mso_widget_get_post($widget . 'yandex_text');
$newoptions['rss_text'] = mso_widget_get_post($widget . 'rss_text');
$newoptions['rss_to_email'] = mso_widget_get_post($widget . 'rss_to_email');
+ $newoptions['rss_to_email_login'] = mso_widget_get_post($widget . 'rss_to_email_login');
$newoptions['textposle'] = mso_widget_get_post($widget . 'textposle');
if ( $options != $newoptions )
@@ -137,12 +144,33 @@ function dignity_rss_widget_custom($options = array(), $num = 1)
$yandex_text = $options['yandex_text'];
$rss_text = $options['rss_text'];
$rss_to_email = $options['rss_to_email'];
+ $rss_to_email_login = $options['rss_to_email_login'];
+
$path = getinfo('plugins_url') . 'dignity_rss/img/'; # путь к картинкам
+
$rss_google = 'http://fusion.google.com/add?feedurl=' . $feed_url;
+
$rss_yandex = 'http://lenta.yandex.ru/settings.xml?name=feed&amp;url=' . $feed_url;
+
$rss_google_read = '<p><a href="' .$rss_google . '" rel="nofollow"><img src="' . $path . 'google.png" alt=""></a> <a href="' . $rss_google . '" rel="nofollow">' . $google_text . '</a></p>';
+
$rss_yandex_read = '<p><a href="' .$rss_yandex . '" rel="nofollow"><img src="' . $path . 'yandex.png" alt=""></a> <a href="' . $rss_yandex . '" rel="nofollow">' . $yandex_text . '</a></p>';
- $rss_mail = '<p><a href="http://www.rss2email.ru?rss=' . $feed_url . '" title="' . $rss_to_email . '" rel="nofollow"><img src="' . $path . 'email.png" alt=""></a> <a href="http://www.rss2email.ru?rss=' . $feed_url . '" title="' . $rss_to_email . '" rel="nofollow">' . $rss_to_email . '</a></p>';
+
+ // $rss_mail = '<p><a href="http://www.rss2email.ru?rss=' . $feed_url . '" title="' . $rss_to_email . '" rel="nofollow"><img src="' . $path . 'email.png" alt=""></a> <a href="http://www.rss2email.ru?rss=' . $feed_url . '" title="' . $rss_to_email . '" rel="nofollow">' . $rss_to_email . '</a></p>';
+
+ // http://feedburner.google.com/fb/a/mailverify?uri=maxsiteorg
+ if ($rss_to_email_login)
+ {
+ $url = 'http://feedburner.google.com/fb/a/mailverify?uri=' . $rss_to_email_login;
+
+ $rss_mail = '<p><a href="' . $url . '" title="' . $rss_to_email . '" rel="nofollow"><img src="' . $path . 'email.png" alt=""></a> <a href="' . $url . '" title="' . $rss_to_email . '" rel="nofollow">' . $rss_to_email . '</a></p>';
+
+ }
+ else
+ {
+ $rss_mail = '';
+ }
+
$rss_f = '<p><a href="' . $feed_url . '"><img src="' . $path . 'rss.png" alt=""></a>' . ' <a href="' . $feed_url . '">' . $rss_text . '</a></p>';
return $header . $textdo . $rss_f . $rss_google_read . $rss_yandex_read . $rss_mail . $textposle;
@@ -3,7 +3,7 @@
$info = array(
'name' => t('RSS-подписка', __FILE__),
'description' => t('Виджет для вывода RSS подписки', __FILE__),
- 'version' => '1.7',
+ 'version' => '1.8',
'author' => t('Александр Шиллинг', __FILE__),
'plugin_url' => 'http://alexanderschilling.net/',
'author_url' => 'http://alexanderschilling.net/',
Oops, something went wrong.

0 comments on commit a216870

Please sign in to comment.