mirror of
https://github.com/friendica/friendica
synced 2025-04-26 03:50:12 +00:00
first files - move to Version 0.1
This commit is contained in:
parent
69865ea843
commit
65d37a8c20
257 changed files with 40746 additions and 1 deletions
292
php/Colors.php
Normal file
292
php/Colors.php
Normal file
|
@ -0,0 +1,292 @@
|
|||
<?php
|
||||
|
||||
class colors {
|
||||
|
||||
/* Convert hexdec color string to rgb(a) string */
|
||||
|
||||
function hex2rgba($color, $opacity = false) {
|
||||
|
||||
$default = 'rgb(0,0,0)';
|
||||
|
||||
//Return default if no color provided
|
||||
if(empty($color))
|
||||
return $default;
|
||||
|
||||
//Sanitize $color if "#" is provided
|
||||
if ($color[0] == '#' ) {
|
||||
$color = substr( $color, 1 );
|
||||
}
|
||||
|
||||
//Check if color has 6 or 3 characters and get values
|
||||
if (strlen($color) == 6) {
|
||||
$hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
|
||||
} elseif ( strlen( $color ) == 3 ) {
|
||||
$hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
|
||||
} else {
|
||||
return $default;
|
||||
}
|
||||
|
||||
//Convert hexadec to rgb
|
||||
$rgb = array_map('hexdec', $hex);
|
||||
|
||||
//Check if opacity is set(rgba or rgb)
|
||||
if($opacity){
|
||||
if(abs($opacity) > 1)
|
||||
$opacity = 1.0;
|
||||
$output = 'rgba('.implode(",",$rgb).','.$opacity.')';
|
||||
} else {
|
||||
$output = 'rgb('.implode(",",$rgb).')';
|
||||
}
|
||||
|
||||
//Return rgb(a) color string
|
||||
return $output;
|
||||
}
|
||||
|
||||
function hex2rgb( $colour ) {
|
||||
if ( $colour[0] == '#' ) {
|
||||
$colour = substr( $colour, 1 );
|
||||
}
|
||||
if ( strlen( $colour ) == 6 ) {
|
||||
list( $r, $g, $b ) = array( $colour[0] . $colour[1], $colour[2] . $colour[3], $colour[4] . $colour[5] );
|
||||
} elseif ( strlen( $colour ) == 3 ) {
|
||||
list( $r, $g, $b ) = array( $colour[0] . $colour[0], $colour[1] . $colour[1], $colour[2] . $colour[2] );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$r = hexdec( $r );
|
||||
$g = hexdec( $g );
|
||||
$b = hexdec( $b );
|
||||
return array( 'red' => $r, 'green' => $g, 'blue' => $b );
|
||||
}
|
||||
|
||||
|
||||
function rgbToHsl( $r, $g, $b ) {
|
||||
$oldR = $r;
|
||||
$oldG = $g;
|
||||
$oldB = $b;
|
||||
$r /= 255;
|
||||
$g /= 255;
|
||||
$b /= 255;
|
||||
$max = max( $r, $g, $b );
|
||||
$min = min( $r, $g, $b );
|
||||
$h;
|
||||
$s;
|
||||
$l = ( $max + $min ) / 2;
|
||||
$d = $max - $min;
|
||||
|
||||
if( $d == 0 ){
|
||||
$h = $s = 0; // achromatic
|
||||
} else {
|
||||
$s = $d / ( 1 - abs( 2 * $l - 1 ) );
|
||||
switch( $max ){
|
||||
case $r:
|
||||
$h = 60 * fmod( ( ( $g - $b ) / $d ), 6 );
|
||||
if ($b > $g) {
|
||||
$h += 360;
|
||||
}
|
||||
break;
|
||||
case $g:
|
||||
$h = 60 * ( ( $b - $r ) / $d + 2 );
|
||||
break;
|
||||
case $b:
|
||||
$h = 60 * ( ( $r - $g ) / $d + 4 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return array( round( $h, 2 ), round( $s, 2 ), round( $l, 2 ) );
|
||||
}
|
||||
function hslToRgb( $h, $s, $l ){
|
||||
$r = "";
|
||||
$g = "";
|
||||
$b = "";
|
||||
|
||||
$c = ( 1 - abs( 2 * $l - 1 ) ) * $s;
|
||||
$x = $c * ( 1 - abs( fmod( ( $h / 60 ), 2 ) - 1 ) );
|
||||
$m = $l - ( $c / 2 );
|
||||
if ( $h < 60 ) {
|
||||
$r = $c;
|
||||
$g = $x;
|
||||
$b = 0;
|
||||
} else if ( $h < 120 ) {
|
||||
$r = $x;
|
||||
$g = $c;
|
||||
$b = 0;
|
||||
} else if ( $h < 180 ) {
|
||||
$r = 0;
|
||||
$g = $c;
|
||||
$b = $x;
|
||||
} else if ( $h < 240 ) {
|
||||
$r = 0;
|
||||
$g = $x;
|
||||
$b = $c;
|
||||
} else if ( $h < 300 ) {
|
||||
$r = $x;
|
||||
$g = 0;
|
||||
$b = $c;
|
||||
} else {
|
||||
$r = $c;
|
||||
$g = 0;
|
||||
$b = $x;
|
||||
}
|
||||
|
||||
$r = ( $r + $m ) * 255;
|
||||
$g = ( $g + $m ) * 255;
|
||||
$b = ( $b + $m ) * 255;
|
||||
|
||||
return array( floor( $r ), floor( $g ), floor( $b ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* Som more example code - this needs to be deletet if we don't need it in
|
||||
* the future
|
||||
*/
|
||||
|
||||
function HTMLToRGB($htmlCode)
|
||||
{
|
||||
if($htmlCode[0] == '#')
|
||||
$htmlCode = substr($htmlCode, 1);
|
||||
|
||||
if (strlen($htmlCode) == 3)
|
||||
{
|
||||
$htmlCode = $htmlCode[0] . $htmlCode[0] . $htmlCode[1] . $htmlCode[1] . $htmlCode[2] . $htmlCode[2];
|
||||
}
|
||||
|
||||
$r = hexdec($htmlCode[0] . $htmlCode[1]);
|
||||
$g = hexdec($htmlCode[2] . $htmlCode[3]);
|
||||
$b = hexdec($htmlCode[4] . $htmlCode[5]);
|
||||
|
||||
return $b + ($g << 0x8) + ($r << 0x10);
|
||||
}
|
||||
|
||||
function RGBToHTML($RGB)
|
||||
{
|
||||
$r = 0xFF & ($RGB >> 0x10);
|
||||
$g = 0xFF & ($RGB >> 0x8);
|
||||
$b = 0xFF & $RGB;
|
||||
|
||||
$r = dechex($r);
|
||||
$g = dechex($g);
|
||||
$b = dechex($b);
|
||||
|
||||
return "#" . str_pad($r, 2, "0", STR_PAD_LEFT) . str_pad($g, 2, "0", STR_PAD_LEFT) . str_pad($b, 2, "0", STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
function ChangeLuminosity($RGB, $LuminosityPercent)
|
||||
{
|
||||
$HSL = RGBToHSL($RGB);
|
||||
$NewHSL = (int)(((float)$LuminosityPercent / 100) * 255) + (0xFFFF00 & $HSL);
|
||||
return HSLToRGB($NewHSL);
|
||||
}
|
||||
|
||||
function RGBToHSL($RGB)
|
||||
{
|
||||
$r = 0xFF & ($RGB >> 0x10);
|
||||
$g = 0xFF & ($RGB >> 0x8);
|
||||
$b = 0xFF & $RGB;
|
||||
|
||||
$r = ((float)$r) / 255.0;
|
||||
$g = ((float)$g) / 255.0;
|
||||
$b = ((float)$b) / 255.0;
|
||||
|
||||
$maxC = max($r, $g, $b);
|
||||
$minC = min($r, $g, $b);
|
||||
|
||||
$l = ($maxC + $minC) / 2.0;
|
||||
|
||||
if($maxC == $minC)
|
||||
{
|
||||
$s = 0;
|
||||
$h = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($l < .5)
|
||||
{
|
||||
$s = ($maxC - $minC) / ($maxC + $minC);
|
||||
}
|
||||
else
|
||||
{
|
||||
$s = ($maxC - $minC) / (2.0 - $maxC - $minC);
|
||||
}
|
||||
if($r == $maxC)
|
||||
$h = ($g - $b) / ($maxC - $minC);
|
||||
if($g == $maxC)
|
||||
$h = 2.0 + ($b - $r) / ($maxC - $minC);
|
||||
if($b == $maxC)
|
||||
$h = 4.0 + ($r - $g) / ($maxC - $minC);
|
||||
|
||||
$h = $h / 6.0;
|
||||
}
|
||||
|
||||
$h = (int)round(255.0 * $h);
|
||||
$s = (int)round(255.0 * $s);
|
||||
$l = (int)round(255.0 * $l);
|
||||
|
||||
$HSL = $l + ($s << 0x8) + ($h << 0x10);
|
||||
return $HSL;
|
||||
}
|
||||
|
||||
function HSLToRGB($HSL)
|
||||
{
|
||||
$h = 0xFF & ($HSL >> 0x10);
|
||||
$s = 0xFF & ($HSL >> 0x8);
|
||||
$l = 0xFF & $HSL;
|
||||
|
||||
$h = ((float)$h) / 255.0;
|
||||
$s = ((float)$s) / 255.0;
|
||||
$l = ((float)$l) / 255.0;
|
||||
|
||||
if($s == 0)
|
||||
{
|
||||
$r = $l;
|
||||
$g = $l;
|
||||
$b = $l;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($l < .5)
|
||||
{
|
||||
$t2 = $l * (1.0 + $s);
|
||||
}
|
||||
else
|
||||
{
|
||||
$t2 = ($l + $s) - ($l * $s);
|
||||
}
|
||||
$t1 = 2.0 * $l - $t2;
|
||||
|
||||
$rt3 = $h + 1.0/3.0;
|
||||
$gt3 = $h;
|
||||
$bt3 = $h - 1.0/3.0;
|
||||
|
||||
if($rt3 < 0) $rt3 += 1.0;
|
||||
if($rt3 > 1) $rt3 -= 1.0;
|
||||
if($gt3 < 0) $gt3 += 1.0;
|
||||
if($gt3 > 1) $gt3 -= 1.0;
|
||||
if($bt3 < 0) $bt3 += 1.0;
|
||||
if($bt3 > 1) $bt3 -= 1.0;
|
||||
|
||||
if(6.0 * $rt3 < 1) $r = $t1 + ($t2 - $t1) * 6.0 * $rt3;
|
||||
elseif(2.0 * $rt3 < 1) $r = $t2;
|
||||
elseif(3.0 * $rt3 < 2) $r = $t1 + ($t2 - $t1) * ((2.0/3.0) - $rt3) * 6.0;
|
||||
else $r = $t1;
|
||||
|
||||
if(6.0 * $gt3 < 1) $g = $t1 + ($t2 - $t1) * 6.0 * $gt3;
|
||||
elseif(2.0 * $gt3 < 1) $g = $t2;
|
||||
elseif(3.0 * $gt3 < 2) $g = $t1 + ($t2 - $t1) * ((2.0/3.0) - $gt3) * 6.0;
|
||||
else $g = $t1;
|
||||
|
||||
if(6.0 * $bt3 < 1) $b = $t1 + ($t2 - $t1) * 6.0 * $bt3;
|
||||
elseif(2.0 * $bt3 < 1) $b = $t2;
|
||||
elseif(3.0 * $bt3 < 2) $b = $t1 + ($t2 - $t1) * ((2.0/3.0) - $bt3) * 6.0;
|
||||
else $b = $t1;
|
||||
}
|
||||
|
||||
$r = (int)round(255.0 * $r);
|
||||
$g = (int)round(255.0 * $g);
|
||||
$b = (int)round(255.0 * $b);
|
||||
|
||||
$RGB = $b + ($g << 0x8) + ($r << 0x10);
|
||||
return $RGB;
|
||||
}
|
||||
}
|
34
php/Image.php
Normal file
34
php/Image.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file view/theme/frio/php/Image.php
|
||||
* @brief contain methods to deal with images
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This class contains methods to deal with images
|
||||
*/
|
||||
class Image {
|
||||
|
||||
/**
|
||||
* @brief Give all available options for the background image
|
||||
*
|
||||
* @param array $arr Array with the present user settings
|
||||
*
|
||||
* @return array Array with the immage options
|
||||
*/
|
||||
public static function get_options($arr) {
|
||||
$bg_image_options = array(
|
||||
'repeat' => array(
|
||||
'frio_bg_image_option', t("Repeat the image"), "repeat", t("Will repeat your image to fill the background."), ($arr["bg_image_option"] == "repeat")),
|
||||
'stretch' => array(
|
||||
'frio_bg_image_option', t("Stretch"), "stretch", t("Will stretch to width/height of the image."), ($arr["bg_image_option"] == "stretch")),
|
||||
'cover' => array(
|
||||
'frio_bg_image_option', t("Resize fill and-clip"), "cover", t("Resize to fill and retain aspect ratio."), ($arr["bg_image_option"] == "cover")),
|
||||
'contain' => array(
|
||||
'frio_bg_image_option', t("Resize best fit"), "contain", t("Resize to best fit and retain aspect ratio."), ($arr["bg_image_option"] == "contain")),
|
||||
);
|
||||
|
||||
return $bg_image_options;
|
||||
}
|
||||
}
|
493
php/PHPColors/Color.php
Normal file
493
php/PHPColors/Color.php
Normal file
|
@ -0,0 +1,493 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Author: Arlo Carreon <http://arlocarreon.com>
|
||||
* Info: http://mexitek.github.io/phpColors/
|
||||
* License: http://arlo.mit-license.org/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* A color utility that helps manipulate HEX colors
|
||||
*/
|
||||
class Color {
|
||||
|
||||
private $_hex;
|
||||
private $_hsl;
|
||||
private $_rgb;
|
||||
|
||||
/**
|
||||
* Auto darkens/lightens by 10% for sexily-subtle gradients.
|
||||
* Set this to FALSE to adjust automatic shade to be between given color
|
||||
* and black (for darken) or white (for lighten)
|
||||
*/
|
||||
const DEFAULT_ADJUST = 10;
|
||||
|
||||
/**
|
||||
* Instantiates the class with a HEX value
|
||||
* @param string $hex
|
||||
* @throws Exception "Bad color format"
|
||||
*/
|
||||
function __construct( $hex ) {
|
||||
// Strip # sign is present
|
||||
$color = str_replace("#", "", $hex);
|
||||
|
||||
// Make sure it's 6 digits
|
||||
if( strlen($color) === 3 ) {
|
||||
$color = $color[0].$color[0].$color[1].$color[1].$color[2].$color[2];
|
||||
} else if( strlen($color) != 6 ) {
|
||||
throw new Exception("HEX color needs to be 6 or 3 digits long");
|
||||
}
|
||||
|
||||
$this->_hsl = self::hexToHsl( $color );
|
||||
$this->_hex = $color;
|
||||
$this->_rgb = self::hexToRgb( $color );
|
||||
}
|
||||
|
||||
// ====================
|
||||
// = Public Interface =
|
||||
// ====================
|
||||
|
||||
/**
|
||||
* Given a HEX string returns a HSL array equivalent.
|
||||
* @param string $color
|
||||
* @return array HSL associative array
|
||||
*/
|
||||
public static function hexToHsl( $color ){
|
||||
|
||||
// Sanity check
|
||||
$color = self::_checkHex($color);
|
||||
|
||||
// Convert HEX to DEC
|
||||
$R = hexdec($color[0].$color[1]);
|
||||
$G = hexdec($color[2].$color[3]);
|
||||
$B = hexdec($color[4].$color[5]);
|
||||
|
||||
$HSL = array();
|
||||
|
||||
$var_R = ($R / 255);
|
||||
$var_G = ($G / 255);
|
||||
$var_B = ($B / 255);
|
||||
|
||||
$var_Min = min($var_R, $var_G, $var_B);
|
||||
$var_Max = max($var_R, $var_G, $var_B);
|
||||
$del_Max = $var_Max - $var_Min;
|
||||
|
||||
$L = ($var_Max + $var_Min)/2;
|
||||
|
||||
if ($del_Max == 0)
|
||||
{
|
||||
$H = 0;
|
||||
$S = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $L < 0.5 ) $S = $del_Max / ( $var_Max + $var_Min );
|
||||
else $S = $del_Max / ( 2 - $var_Max - $var_Min );
|
||||
|
||||
$del_R = ( ( ( $var_Max - $var_R ) / 6 ) + ( $del_Max / 2 ) ) / $del_Max;
|
||||
$del_G = ( ( ( $var_Max - $var_G ) / 6 ) + ( $del_Max / 2 ) ) / $del_Max;
|
||||
$del_B = ( ( ( $var_Max - $var_B ) / 6 ) + ( $del_Max / 2 ) ) / $del_Max;
|
||||
|
||||
if ($var_R == $var_Max) $H = $del_B - $del_G;
|
||||
else if ($var_G == $var_Max) $H = ( 1 / 3 ) + $del_R - $del_B;
|
||||
else if ($var_B == $var_Max) $H = ( 2 / 3 ) + $del_G - $del_R;
|
||||
|
||||
if ($H<0) $H++;
|
||||
if ($H>1) $H--;
|
||||
}
|
||||
|
||||
$HSL['H'] = ($H*360);
|
||||
$HSL['S'] = $S;
|
||||
$HSL['L'] = $L;
|
||||
|
||||
return $HSL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a HSL associative array returns the equivalent HEX string
|
||||
* @param array $hsl
|
||||
* @return string HEX string
|
||||
* @throws Exception "Bad HSL Array"
|
||||
*/
|
||||
public static function hslToHex( $hsl = array() ){
|
||||
// Make sure it's HSL
|
||||
if(empty($hsl) || !isset($hsl["H"]) || !isset($hsl["S"]) || !isset($hsl["L"]) ) {
|
||||
throw new Exception("Param was not an HSL array");
|
||||
}
|
||||
|
||||
list($H,$S,$L) = array( $hsl['H']/360,$hsl['S'],$hsl['L'] );
|
||||
|
||||
if( $S == 0 ) {
|
||||
$r = $L * 255;
|
||||
$g = $L * 255;
|
||||
$b = $L * 255;
|
||||
} else {
|
||||
|
||||
if($L<0.5) {
|
||||
$var_2 = $L*(1+$S);
|
||||
} else {
|
||||
$var_2 = ($L+$S) - ($S*$L);
|
||||
}
|
||||
|
||||
$var_1 = 2 * $L - $var_2;
|
||||
|
||||
$r = round(255 * self::_huetorgb( $var_1, $var_2, $H + (1/3) ));
|
||||
$g = round(255 * self::_huetorgb( $var_1, $var_2, $H ));
|
||||
$b = round(255 * self::_huetorgb( $var_1, $var_2, $H - (1/3) ));
|
||||
|
||||
}
|
||||
|
||||
// Convert to hex
|
||||
$r = dechex($r);
|
||||
$g = dechex($g);
|
||||
$b = dechex($b);
|
||||
|
||||
// Make sure we get 2 digits for decimals
|
||||
$r = (strlen("".$r)===1) ? "0".$r:$r;
|
||||
$g = (strlen("".$g)===1) ? "0".$g:$g;
|
||||
$b = (strlen("".$b)===1) ? "0".$b:$b;
|
||||
|
||||
return $r.$g.$b;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given a HEX string returns a RGB array equivalent.
|
||||
* @param string $color
|
||||
* @return array RGB associative array
|
||||
*/
|
||||
public static function hexToRgb( $color ){
|
||||
|
||||
// Sanity check
|
||||
$color = self::_checkHex($color);
|
||||
|
||||
// Convert HEX to DEC
|
||||
$R = hexdec($color[0].$color[1]);
|
||||
$G = hexdec($color[2].$color[3]);
|
||||
$B = hexdec($color[4].$color[5]);
|
||||
|
||||
$RGB['R'] = $R;
|
||||
$RGB['G'] = $G;
|
||||
$RGB['B'] = $B;
|
||||
|
||||
return $RGB;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given an RGB associative array returns the equivalent HEX string
|
||||
* @param array $rgb
|
||||
* @return string RGB string
|
||||
* @throws Exception "Bad RGB Array"
|
||||
*/
|
||||
public static function rgbToHex( $rgb = array() ){
|
||||
// Make sure it's RGB
|
||||
if(empty($rgb) || !isset($rgb["R"]) || !isset($rgb["G"]) || !isset($rgb["B"]) ) {
|
||||
throw new Exception("Param was not an RGB array");
|
||||
}
|
||||
|
||||
// https://github.com/mexitek/phpColors/issues/25#issuecomment-88354815
|
||||
// Convert RGB to HEX
|
||||
$hex[0] = str_pad(dechex($rgb['R']), 2, '0', STR_PAD_LEFT);
|
||||
$hex[1] = str_pad(dechex($rgb['G']), 2, '0', STR_PAD_LEFT);
|
||||
$hex[2] = str_pad(dechex($rgb['B']), 2, '0', STR_PAD_LEFT);
|
||||
|
||||
return implode( '', $hex );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given a HEX value, returns a darker color. If no desired amount provided, then the color halfway between
|
||||
* given HEX and black will be returned.
|
||||
* @param int $amount
|
||||
* @return string Darker HEX value
|
||||
*/
|
||||
public function darken( $amount = self::DEFAULT_ADJUST ){
|
||||
// Darken
|
||||
$darkerHSL = $this->_darken($this->_hsl, $amount);
|
||||
// Return as HEX
|
||||
return self::hslToHex($darkerHSL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a HEX value, returns a lighter color. If no desired amount provided, then the color halfway between
|
||||
* given HEX and white will be returned.
|
||||
* @param int $amount
|
||||
* @return string Lighter HEX value
|
||||
*/
|
||||
public function lighten( $amount = self::DEFAULT_ADJUST ){
|
||||
// Lighten
|
||||
$lighterHSL = $this->_lighten($this->_hsl, $amount);
|
||||
// Return as HEX
|
||||
return self::hslToHex($lighterHSL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a HEX value, returns a mixed color. If no desired amount provided, then the color mixed by this ratio
|
||||
* @param string $hex2 Secondary HEX value to mix with
|
||||
* @param int $amount = -100..0..+100
|
||||
* @return string mixed HEX value
|
||||
*/
|
||||
public function mix($hex2, $amount = 0){
|
||||
$rgb2 = self::hexToRgb($hex2);
|
||||
$mixed = $this->_mix($this->_rgb, $rgb2, $amount);
|
||||
// Return as HEX
|
||||
return self::rgbToHex($mixed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array with two shades that can be used to make a gradient
|
||||
* @param int $amount Optional percentage amount you want your contrast color
|
||||
* @return array An array with a 'light' and 'dark' index
|
||||
*/
|
||||
public function makeGradient( $amount = self::DEFAULT_ADJUST ) {
|
||||
// Decide which color needs to be made
|
||||
if( $this->isLight() ) {
|
||||
$lightColor = $this->_hex;
|
||||
$darkColor = $this->darken($amount);
|
||||
} else {
|
||||
$lightColor = $this->lighten($amount);
|
||||
$darkColor = $this->_hex;
|
||||
}
|
||||
|
||||
// Return our gradient array
|
||||
return array( "light" => $lightColor, "dark" => $darkColor );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether or not given color is considered "light"
|
||||
* @param string|Boolean $color
|
||||
* @param int $lighterThan
|
||||
* @return boolean
|
||||
*/
|
||||
public function isLight( $color = FALSE, $lighterThan = 130 ){
|
||||
// Get our color
|
||||
$color = ($color) ? $color : $this->_hex;
|
||||
|
||||
// Calculate straight from rbg
|
||||
$r = hexdec($color[0].$color[1]);
|
||||
$g = hexdec($color[2].$color[3]);
|
||||
$b = hexdec($color[4].$color[5]);
|
||||
|
||||
return (( $r*299 + $g*587 + $b*114 )/1000 > $lighterThan);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not a given color is considered "dark"
|
||||
* @param string|Boolean $color
|
||||
* @param int $darkerThan
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDark( $color = FALSE, $darkerThan = 130 ){
|
||||
// Get our color
|
||||
$color = ($color) ? $color:$this->_hex;
|
||||
|
||||
// Calculate straight from rbg
|
||||
$r = hexdec($color[0].$color[1]);
|
||||
$g = hexdec($color[2].$color[3]);
|
||||
$b = hexdec($color[4].$color[5]);
|
||||
|
||||
return (( $r*299 + $g*587 + $b*114 )/1000 <= $darkerThan);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the complimentary color
|
||||
* @return string Complementary hex color
|
||||
*
|
||||
*/
|
||||
public function complementary() {
|
||||
// Get our HSL
|
||||
$hsl = $this->_hsl;
|
||||
|
||||
// Adjust Hue 180 degrees
|
||||
$hsl['H'] += ($hsl['H']>180) ? -180:180;
|
||||
|
||||
// Return the new value in HEX
|
||||
return self::hslToHex($hsl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns your color's HSL array
|
||||
*/
|
||||
public function getHsl() {
|
||||
return $this->_hsl;
|
||||
}
|
||||
/**
|
||||
* Returns your original color
|
||||
*/
|
||||
public function getHex() {
|
||||
return $this->_hex;
|
||||
}
|
||||
/**
|
||||
* Returns your color's RGB array
|
||||
*/
|
||||
public function getRgb() {
|
||||
return $this->_rgb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the cross browser CSS3 gradient
|
||||
* @param int $amount Optional: percentage amount to light/darken the gradient
|
||||
* @param boolean $vintageBrowsers Optional: include vendor prefixes for browsers that almost died out already
|
||||
* @param string $prefix Optional: prefix for every lines
|
||||
* @param string $suffix Optional: suffix for every lines
|
||||
* @link http://caniuse.com/css-gradients Resource for the browser support
|
||||
* @return string CSS3 gradient for chrome, safari, firefox, opera and IE10
|
||||
*/
|
||||
public function getCssGradient( $amount = self::DEFAULT_ADJUST, $vintageBrowsers = FALSE, $suffix = "" , $prefix = "" ) {
|
||||
|
||||
// Get the recommended gradient
|
||||
$g = $this->makeGradient($amount);
|
||||
|
||||
$css = "";
|
||||
/* fallback/image non-cover color */
|
||||
$css .= "{$prefix}background-color: #".$this->_hex.";{$suffix}";
|
||||
|
||||
/* IE Browsers */
|
||||
$css .= "{$prefix}filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#".$g['light']."', endColorstr='#".$g['dark']."');{$suffix}";
|
||||
|
||||
/* Safari 4+, Chrome 1-9 */
|
||||
if ( $vintageBrowsers ) {
|
||||
$css .= "{$prefix}background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#".$g['light']."), to(#".$g['dark']."));{$suffix}";
|
||||
}
|
||||
|
||||
/* Safari 5.1+, Mobile Safari, Chrome 10+ */
|
||||
$css .= "{$prefix}background-image: -webkit-linear-gradient(top, #".$g['light'].", #".$g['dark'].");{$suffix}";
|
||||
|
||||
/* Firefox 3.6+ */
|
||||
if ( $vintageBrowsers ) {
|
||||
$css .= "{$prefix}background-image: -moz-linear-gradient(top, #".$g['light'].", #".$g['dark'].");{$suffix}";
|
||||
}
|
||||
|
||||
/* Opera 11.10+ */
|
||||
if ( $vintageBrowsers ) {
|
||||
$css .= "{$prefix}background-image: -o-linear-gradient(top, #".$g['light'].", #".$g['dark'].");{$suffix}";
|
||||
}
|
||||
|
||||
/* Unprefixed version (standards): FF 16+, IE10+, Chrome 26+, Safari 7+, Opera 12.1+ */
|
||||
$css .= "{$prefix}background-image: linear-gradient(to bottom, #".$g['light'].", #".$g['dark'].");{$suffix}";
|
||||
|
||||
// Return our CSS
|
||||
return $css;
|
||||
}
|
||||
|
||||
// ===========================
|
||||
// = Private Functions Below =
|
||||
// ===========================
|
||||
|
||||
|
||||
/**
|
||||
* Darkens a given HSL array
|
||||
* @param array $hsl
|
||||
* @param int $amount
|
||||
* @return array $hsl
|
||||
*/
|
||||
private function _darken( $hsl, $amount = self::DEFAULT_ADJUST){
|
||||
// Check if we were provided a number
|
||||
if( $amount ) {
|
||||
$hsl['L'] = ($hsl['L'] * 100) - $amount;
|
||||
$hsl['L'] = ($hsl['L'] < 0) ? 0:$hsl['L']/100;
|
||||
} else {
|
||||
// We need to find out how much to darken
|
||||
$hsl['L'] = $hsl['L']/2 ;
|
||||
}
|
||||
|
||||
return $hsl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lightens a given HSL array
|
||||
* @param array $hsl
|
||||
* @param int $amount
|
||||
* @return array $hsl
|
||||
*/
|
||||
private function _lighten( $hsl, $amount = self::DEFAULT_ADJUST){
|
||||
// Check if we were provided a number
|
||||
if( $amount ) {
|
||||
$hsl['L'] = ($hsl['L'] * 100) + $amount;
|
||||
$hsl['L'] = ($hsl['L'] > 100) ? 1:$hsl['L']/100;
|
||||
} else {
|
||||
// We need to find out how much to lighten
|
||||
$hsl['L'] += (1-$hsl['L'])/2;
|
||||
}
|
||||
|
||||
return $hsl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mix 2 rgb colors and return an rgb color
|
||||
* @param array $rgb1
|
||||
* @param array $rgb2
|
||||
* @param int $amount ranged -100..0..+100
|
||||
* @return array $rgb
|
||||
*
|
||||
* ported from http://phpxref.pagelines.com/nav.html?includes/class.colors.php.source.html
|
||||
*/
|
||||
private function _mix($rgb1, $rgb2, $amount = 0) {
|
||||
|
||||
$r1 = ($amount + 100) / 100;
|
||||
$r2 = 2 - $r1;
|
||||
|
||||
$rmix = (($rgb1['R'] * $r1) + ($rgb2['R'] * $r2)) / 2;
|
||||
$gmix = (($rgb1['G'] * $r1) + ($rgb2['G'] * $r2)) / 2;
|
||||
$bmix = (($rgb1['B'] * $r1) + ($rgb2['B'] * $r2)) / 2;
|
||||
|
||||
return array('R' => $rmix, 'G' => $gmix, 'B' => $bmix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a Hue, returns corresponding RGB value
|
||||
* @param int $v1
|
||||
* @param int $v2
|
||||
* @param int $vH
|
||||
* @return int
|
||||
*/
|
||||
private static function _huetorgb( $v1,$v2,$vH ) {
|
||||
if( $vH < 0 ) {
|
||||
$vH += 1;
|
||||
}
|
||||
|
||||
if( $vH > 1 ) {
|
||||
$vH -= 1;
|
||||
}
|
||||
|
||||
if( (6*$vH) < 1 ) {
|
||||
return ($v1 + ($v2 - $v1) * 6 * $vH);
|
||||
}
|
||||
|
||||
if( (2*$vH) < 1 ) {
|
||||
return $v2;
|
||||
}
|
||||
|
||||
if( (3*$vH) < 2 ) {
|
||||
return ($v1 + ($v2-$v1) * ( (2/3)-$vH ) * 6);
|
||||
}
|
||||
|
||||
return $v1;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* You need to check if you were given a good hex string
|
||||
* @param string $hex
|
||||
* @return string Color
|
||||
* @throws Exception "Bad color format"
|
||||
*/
|
||||
private static function _checkHex( $hex ) {
|
||||
// Strip # sign is present
|
||||
$color = str_replace("#", "", $hex);
|
||||
|
||||
// Make sure it's 6 digits
|
||||
if( strlen($color) == 3 ) {
|
||||
$color = $color[0].$color[0].$color[1].$color[1].$color[2].$color[2];
|
||||
} else if( strlen($color) != 6 ) {
|
||||
throw new Exception("HEX color needs to be 6 or 3 digits long");
|
||||
}
|
||||
|
||||
return $color;
|
||||
}
|
||||
|
||||
}
|
162
php/PHPColors/README.md
Normal file
162
php/PHPColors/README.md
Normal file
|
@ -0,0 +1,162 @@
|
|||
### Last Build: [](http://travis-ci.org/mexitek/phpColors)
|
||||
|
||||
## Installation
|
||||
|
||||
### Composer
|
||||
|
||||
Simply add `mexitek/phpcolors` to `composer.json` using `dev-master`.
|
||||
|
||||
`composer require mexitek/phpcolors dev-master`
|
||||
|
||||
## How it works
|
||||
Instantiate an object of the color class with a hex color string `$foo = new Color("336699")`. That's it! Now, call the methods you need for different color variants.
|
||||
|
||||
## Available Methods
|
||||
- <strong>darken( [$amount] )</strong> : Allows you to obtain a darker shade of your color. Optionally you can decide to darken using a desired percentage.
|
||||
- <strong>lighten( [$amount] )</strong> : Allows you to obtain a lighter shade of your color. Optionally you can decide to lighten using a desired percentage.
|
||||
- <strong>mix($hex, [$amount] )</strong> : Allows you to mix another color to your color. Optionally you can decide to set the percent of second color or original color amount is ranged -100..0.100.
|
||||
- <strong>isLight( [$hex] )</strong> : Determins whether your color (or the provide param) is considered a "light" color. Returns `TRUE` if color is light.
|
||||
- <strong>isDark( [$hex] )</strong> : Determins whether your color (or the provide param) is considered a "dark" color. Returns `TRUE` if color is dark.
|
||||
- <strong>makeGradient( [$amount] )</strong> : Returns an array with 2 indices `light` and `dark`, the initial color will either be selected for `light` or `dark` depending on its brightness, then the other color will be generated. The optional param allows for a static lighten or darkened amount.
|
||||
- <strong>complementary()</strong> : Returns the color "opposite" or complementary to your color.
|
||||
- <strong>getHex()</strong> : Returns the original hex color.
|
||||
- <strong>getHsl()</strong> : Returns HSL array for your color.
|
||||
- <strong>getRgb()</strong> : Returns RGB array for your color.
|
||||
|
||||
> Auto lightens/darkens by 10% for sexily-subtle gradients
|
||||
|
||||
```php
|
||||
/**
|
||||
* Using The Class
|
||||
*/
|
||||
|
||||
use Mexitek\PHPColors\Color;
|
||||
|
||||
// Initialize my color
|
||||
$myBlue = new Color("#336699");
|
||||
|
||||
echo $myBlue->darken();
|
||||
// 1a334d
|
||||
|
||||
echo $myBlue->lighten();
|
||||
// 8cb3d9
|
||||
|
||||
echo $myBlue->isLight();
|
||||
// false
|
||||
|
||||
echo $myBlue->isDark();
|
||||
// true
|
||||
|
||||
echo $myBlue->complementary();
|
||||
// 996633
|
||||
|
||||
echo $myBlue->getHex();
|
||||
// 336699
|
||||
|
||||
print_r( $myBlue->getHsl() );
|
||||
// array( "H"=> 210, "S"=> 0.5, "L"=>0.4 );
|
||||
|
||||
print_r( $myBlue->getRgb() );
|
||||
// array( "R"=> 51, "G"=> 102, "B"=>153 );
|
||||
|
||||
print_r($myBlue->makeGradient());
|
||||
// array( "light"=>"8cb3d9" ,"dark"=>"336699" )
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Static Methods
|
||||
- <strong>hslToHex( $hsl )</strong> : Convert a HSL array to a HEX string.
|
||||
- <strong>hexToHsl( $hex )</strong> : Convert a HEX string into an HSL array.
|
||||
- <strong>hexToRgb( $hex )</strong> : Convert a HEX string into an RGB array.
|
||||
- <strong>rgbToHex( $rgb )</strong> : Convert an RGB array into a HEX string.
|
||||
|
||||
```php
|
||||
/**
|
||||
* On The Fly Custom Calculations
|
||||
*/
|
||||
|
||||
use Mexitek\PHPColors\Color;
|
||||
|
||||
// Convert my HEX
|
||||
$myBlue = Color::hexToHsl("#336699");
|
||||
|
||||
// Get crazy with the HUE
|
||||
$myBlue["H"] = 295;
|
||||
|
||||
// Gimme my new color!!
|
||||
echo Color::hslToHex($myBlue);
|
||||
// 913399
|
||||
|
||||
```
|
||||
|
||||
## CSS Helpers
|
||||
- <strong>getCssGradient( [$amount] [, $vintageBrowsers] )</strong> : Generates the CSS3 gradients for safari, chrome, opera, firefox and IE10. Optional percentage amount for lighter/darker shade. Optional boolean for older gradient CSS support.
|
||||
|
||||
> Would like to add support to custom gradient stops
|
||||
|
||||
```php
|
||||
|
||||
use Mexitek\PHPColors\Color;
|
||||
|
||||
// Initialize my color
|
||||
$myBlue = new Color("#336699");
|
||||
|
||||
// Get CSS
|
||||
echo $myBlue->getCssGradient();
|
||||
/* - Actual output doesn't have comments and is single line
|
||||
|
||||
// fallback background
|
||||
background: #336699;
|
||||
|
||||
// IE Browsers
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8cb3d9', endColorstr='#336699');
|
||||
|
||||
// Safari 5.1+, Mobile Safari, Chrome 10+
|
||||
background-image: -webkit-linear-gradient(top, #8cb3d9, #336699);
|
||||
|
||||
// Standards
|
||||
background-image: linear-gradient(to bottom, #8cb3d9, #336699);
|
||||
|
||||
*/
|
||||
|
||||
```
|
||||
|
||||
However, if you want to support the ancient browsers (which has negligible market share and almost died out), you can set the second parameter to `TRUE`. This will output:
|
||||
|
||||
```php
|
||||
|
||||
use Mexitek\PHPColors\Color;
|
||||
$myBlue = new Color("#336699");
|
||||
|
||||
// Get CSS
|
||||
echo $myBlue->getCssGradient(10, TRUE);
|
||||
/* - Actual output doesn't have comments and is single line
|
||||
|
||||
background: #336699; // fallback background
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8cb3d9', endColorstr='#336699'); // IE Browsers
|
||||
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#8cb3d9), to(#336699)); // Safari 4+, Chrome 1-9
|
||||
background-image: -webkit-linear-gradient(top, #8cb3d9, #336699); // Safari 5.1+, Mobile Safari, Chrome 10+
|
||||
background-image: -moz-linear-gradient(top, #8cb3d9, #336699); // Firefox 3.6+
|
||||
background-image: -o-linear-gradient(top, #8cb3d9, #336699); // Opera 11.10+
|
||||
background-image: linear-gradient(to bottom, #8cb3d9, #336699); // Standards
|
||||
|
||||
*/
|
||||
|
||||
```
|
||||
|
||||
## Github Contributors
|
||||
- mexitek
|
||||
- danielpataki
|
||||
- alexmglover
|
||||
- intuxicated
|
||||
- pborreli
|
||||
- curtisgibby
|
||||
- matthewpatterson
|
||||
- there4
|
||||
- alex-humphreys
|
||||
- zaher
|
||||
- primozcigler
|
||||
- thedavidmeister
|
||||
|
||||
# License: [arlo.mit-license.org](http://arlo.mit-license.org)
|
131
php/frio_boot.php
Normal file
131
php/frio_boot.php
Normal file
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file view/theme/frio/php/frio_boot.php
|
||||
*
|
||||
* @brief This file contains functions for page contstruction
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Load page template in dependence of the template mode
|
||||
*
|
||||
* @todo Check if this is really needed.
|
||||
*/
|
||||
function load_page(&$a) {
|
||||
if(isset($_GET["mode"]) AND ($_GET["mode"] == "minimal")) {
|
||||
require "view/theme/frio/minimal.php";
|
||||
} elseif((isset($_GET["mode"]) AND ($_GET["mode"] == "modal"))) {
|
||||
require "view/theme/frio/modal.php";
|
||||
} else {
|
||||
$template = 'view/theme/' . current_theme() . '/'
|
||||
. ((x($a->page,'template')) ? $a->page['template'] : 'default' ) . '.php';
|
||||
if(file_exists($template))
|
||||
require_once($template);
|
||||
else
|
||||
require_once(str_replace('theme/' . current_theme() . '/', '', $template));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check if page is a modal page
|
||||
*
|
||||
* This function checks if $_REQUEST['pagename'] is
|
||||
* a defined in a $modalpages
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_modal() {
|
||||
$is_modal = false;
|
||||
$modalpages = get_modalpage_list();
|
||||
|
||||
foreach ($modalpages as $r => $value) {
|
||||
if(strpos($_REQUEST['pagename'],$value) !== false) {
|
||||
$is_modal = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $is_modal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Array with modalpages
|
||||
*
|
||||
* The array contains the page names of the pages
|
||||
* which should displayed as modals
|
||||
*
|
||||
* @return array Pagenames as path
|
||||
*/
|
||||
function get_modalpage_list() {
|
||||
//Arry of pages wich getting bootstrap modal dialogs
|
||||
$modalpages = array('poke/',
|
||||
'message/new',
|
||||
'settings/oauth/add',
|
||||
'events/new',
|
||||
// 'fbrowser/image/'
|
||||
);
|
||||
|
||||
return $modalpages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Array with standard pages
|
||||
*
|
||||
* The array contains the page names of the pages
|
||||
* which should displayed as standard-page
|
||||
*
|
||||
* @return array Pagenames as path
|
||||
*/
|
||||
function get_standard_page_list() {
|
||||
//Arry of pages wich getting the standard page template
|
||||
$standardpages = array(//'profile',
|
||||
// 'fbrowser/image/'
|
||||
);
|
||||
|
||||
return $standardpages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if page is standard page
|
||||
*
|
||||
* This function checks if $_REQUEST['pagename'] is
|
||||
* a defined $standardpages
|
||||
*
|
||||
* @param string $pagetitle Title of the actual page
|
||||
* @return bool
|
||||
*/
|
||||
function is_standard_page($pagetitle) {
|
||||
$is_standard_page = false;
|
||||
$standardpages = get_standard_page_list();
|
||||
|
||||
foreach ($standardpages as $r => $value) {
|
||||
if(strpos($pagetitle,$value) !== false) {
|
||||
$is_standard_page = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $is_standard_page;
|
||||
}
|
||||
/**
|
||||
* @brief Get the typ of the page
|
||||
*
|
||||
* @param type $pagetitle
|
||||
* @return string
|
||||
*/
|
||||
function get_page_type($pagetitle) {
|
||||
$page_type = "";
|
||||
|
||||
if(is_modal())
|
||||
$page_type = "modal";
|
||||
|
||||
if(is_standard_page($pagetitle))
|
||||
$page_type = "standard_page";
|
||||
|
||||
if($page_type)
|
||||
return $page_type;
|
||||
|
||||
}
|
186
php/modes/default.php
Normal file
186
php/modes/default.php
Normal file
|
@ -0,0 +1,186 @@
|
|||
<?php
|
||||
/**
|
||||
* @file view/theme/frio/php/modes/default.php
|
||||
* @brief The default site template
|
||||
*/
|
||||
?>
|
||||
|
||||
<!DOCTYPE html >
|
||||
|
||||
<?php
|
||||
require_once('view/theme/frio/php/frio_boot.php');
|
||||
|
||||
$minimal = is_modal();
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title><?php if(x($page,'title')) echo $page['title'] ?></title>
|
||||
<meta name="viewport" content="initial-scale=1.0">
|
||||
<meta request="<?php echo $_REQUEST['pagename'] ?> ">
|
||||
<script>var baseurl="<?php echo $a->get_baseurl() ?>";</script>
|
||||
<script>var frio="<?php echo "view/theme/frio"; ?>";</script>
|
||||
<?php $baseurl = $a->get_baseurl(); ?>
|
||||
<?php $frio = "view/theme/frio"; ?>
|
||||
<?php
|
||||
// Because we use minimal for modals the header and the included js stuff should be only loaded
|
||||
// if the page is an standard page (so we don't have it twice for modals)
|
||||
//
|
||||
/// @todo Think about to move js stuff in the footer
|
||||
if(!$minimal) {
|
||||
if(x($page,'htmlhead')) echo $page['htmlhead'];
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</head>
|
||||
<?php
|
||||
if(($_SERVER['REQUEST_URI'] != "/register") && ($_SERVER['REQUEST_URI'] != "/lostpass") && ($_SERVER['REQUEST_URI'] != "/login"))
|
||||
{
|
||||
echo"<body id=\"top\">";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo"<body id=\"top\">";
|
||||
}
|
||||
?>
|
||||
<?php if($_SERVER['REQUEST_URI'] == "/"){header('Location: /login');} ?>
|
||||
<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
|
||||
<?php
|
||||
if(x($page,'nav') && (!$minimal)){
|
||||
echo str_replace("~config.sitename~",get_config('config','sitename'),
|
||||
str_replace("~system.banner~",get_config('system','banner'),
|
||||
$page['nav']
|
||||
));};
|
||||
|
||||
// special minimal style for modal dialogs
|
||||
if($minimal) {
|
||||
?>
|
||||
<section class="minimal" style="margin:0px!important; padding:0px!important; float:none!important;display:block!important;"><?php if(x($page,'content')) echo $page['content']; ?>
|
||||
<div id="page-footer"></div>
|
||||
</section>
|
||||
<?php }
|
||||
// the style for all other pages
|
||||
else {
|
||||
?> <main>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php
|
||||
if(($_REQUEST['pagename'] != "register") && ($_REQUEST['pagename'] != "lostpass") && ($_REQUEST['pagename'] != "login") && ($_SERVER['REQUEST_URI'] != "/"))
|
||||
{
|
||||
echo"
|
||||
<aside class=\"col-lg-3 col-md-3 offcanvas-sm offcanvas-xs\">
|
||||
"; if(x($page,'aside')) echo $page['aside']; echo"
|
||||
"; if(x($page,'right_aside')) echo $page['right_aside']; echo"
|
||||
</aside>
|
||||
|
||||
<!-- The following paragraph can maybe deleted because we don't need it anymore -->
|
||||
<div id=\"NavAside\" class=\"navmenu navmenu-default navmenu-fixed-left offcanvas hidden-lg hidden-md\">
|
||||
<div class=\"nav-container\">
|
||||
<div class=\"list-group\">
|
||||
"; if(x($page,'aside')) echo $page['aside']; echo"
|
||||
"; if(x($page,'right_aside')) echo $page['right_aside']; echo"
|
||||
</div>
|
||||
</div>
|
||||
</div><!--/.sidebar-offcanvas-->
|
||||
|
||||
<div class=\"col-lg-8 col-md-8 col-sm-12 col-xs-12\" id=\"content\">
|
||||
<section class=\"sectiontop "; echo $a->argv[0]; echo "-content-wrapper\">";
|
||||
if(x($page,'content')) echo $page['content']; echo"
|
||||
<div id=\"pause\"></div> <!-- The pause/resume Ajax indicator -->
|
||||
</section>
|
||||
</div>
|
||||
";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo"
|
||||
<div class=\"col-lg-12 col-md-12 col-sm-12 col-xs-12\" id=\"content\" style=\"margin-top:50px;\" >
|
||||
"; if(x($page,'content')) echo $page['content']; echo"
|
||||
</div>
|
||||
";
|
||||
}
|
||||
?>
|
||||
|
||||
</div><!--row-->
|
||||
</div><!-- container -->
|
||||
|
||||
<div id="back-to-top" title="back to top">⇧</div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<span id="notifsound"></span>
|
||||
<script>
|
||||
$("#menu-toggle").click(function(e) {
|
||||
e.preventDefault();
|
||||
$("#wrapper").toggleClass("toggled");
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$.fn.enterKey = function (fnc, mod) {
|
||||
return this.each(function () {
|
||||
$(this).keypress(function (ev) {
|
||||
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
|
||||
if ((keycode == '13' || keycode == '10') && (!mod || ev[mod + 'Key'])) {
|
||||
fnc.call(this, ev);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
$('textarea').enterKey(function() {$(this).closest('form').submit(); }, 'ctrl')
|
||||
$('input').enterKey(function() {$(this).closest('form').submit(); }, 'ctrl')
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var pagetitle = null;
|
||||
$("nav").bind('nav-update', function(e,data)
|
||||
{
|
||||
if (pagetitle==null) pagetitle = document.title;
|
||||
var count = $(data).find('notif').attr('count');
|
||||
if (count>0)
|
||||
{
|
||||
document.title = "("+count+") "+pagetitle;
|
||||
/* document.getElementById('notifsound').innerHTML='<object type="audio/mpeg" width="0" height="0" data="<?=$frio?>/audios/901.mp3"><param name="notif" value="<?=$frio?>/audios/901.mp3" /><param name="autostart" value="true" /><param name="loop" value="false" /></object>'; */
|
||||
}
|
||||
else
|
||||
{
|
||||
document.title = pagetitle;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="<?=$frio?>/frameworks/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/jasny/js/jasny-bootstrap.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/bootstrap-select/js/bootstrap-select.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/ekko-lightbox/ekko-lightbox.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/justifiedGallery/jquery.justifiedGallery.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
|
||||
<script src="<?=$frio?>/js/theme.js"></script>
|
||||
<script src="<?=$frio?>/js/acl.js"></script>
|
||||
|
||||
|
||||
<!-- Modal -->
|
||||
<div id="modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="plan-info" aria-hidden="true">
|
||||
<div class="modal-dialog modal-full-screen">
|
||||
<div class="modal-content">
|
||||
<div id="modal-header" class="modal-header">
|
||||
<button id="modal-cloase" type="button" class="close" data-dismiss="modal" aria-hidden="true">
|
||||
×
|
||||
</button>
|
||||
<h4 id="modal-title" class="modal-title"></h4>
|
||||
</div>
|
||||
<div id="modal-body" class="modal-body">
|
||||
<!-- /# content goes here -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Dummy div to append other div's when needed (e.g. used for js function editpost() -->
|
||||
<div id="cache-container"></div>
|
||||
|
||||
</footer>
|
||||
<?php } ?> <!-- End of condition if $minal else the rest -->
|
||||
</body>
|
11
php/modes/modal.php
Normal file
11
php/modes/modal.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
* @file view/theme/frio/php/modes/modal.php
|
||||
* @brief The site template for Modals
|
||||
*
|
||||
* This themplate is used for bs modals. So outputs
|
||||
* only the pure content
|
||||
*/
|
||||
|
||||
if(x($page,'content')) echo $page['content'];
|
||||
|
142
php/modes/standard.php
Normal file
142
php/modes/standard.php
Normal file
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
/**
|
||||
* @file view/theme/frio/php/modes/default.php
|
||||
* @brief The default site template
|
||||
*/
|
||||
?>
|
||||
|
||||
<!DOCTYPE html >
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title><?php if(x($page,'title')) echo $page['title'] ?></title>
|
||||
<meta name="viewport" content="initial-scale=1.0">
|
||||
<meta request="<?php echo $_REQUEST['pagename'] ?> ">
|
||||
<script>var baseurl="<?php echo $a->get_baseurl() ?>";</script>
|
||||
<script>var frio="<?php echo "view/theme/frio"; ?>";</script>
|
||||
<?php $baseurl = $a->get_baseurl(); ?>
|
||||
<?php $frio = "view/theme/frio"; ?>
|
||||
<?php if(x($page,'htmlhead')) echo $page['htmlhead']; ?>
|
||||
|
||||
|
||||
</head>
|
||||
<body id=\"top\">";
|
||||
<?php if($_SERVER['REQUEST_URI'] == "/"){header('Location: /login');} ?>
|
||||
<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
|
||||
<?php
|
||||
if(x($page,'nav')) {
|
||||
echo str_replace("~config.sitename~",get_config('config','sitename'),
|
||||
str_replace("~system.banner~",get_config('system','banner'),
|
||||
$page['nav']
|
||||
));};
|
||||
?>
|
||||
<main>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php
|
||||
echo"
|
||||
<aside class=\"col-lg-3 col-md-3 hidden-sm hidden-xs\">
|
||||
"; if(x($page,'aside')) echo $page['aside']; echo"
|
||||
"; if(x($page,'right_aside')) echo $page['right_aside']; echo"
|
||||
"; include('includes/photo_side.php'); echo"
|
||||
</aside>
|
||||
|
||||
<div id=\"NavAside\" class=\"navmenu navmenu-default navmenu-fixed-left offcanvas hidden-lg hidden-md\">
|
||||
<div class=\"nav-container\">
|
||||
<div class=\"list-group\">
|
||||
"; if(x($page,'aside')) echo $page['aside']; echo"
|
||||
"; if(x($page,'right_aside')) echo $page['right_aside']; echo"
|
||||
"; include('includes/photo_side.php'); echo"
|
||||
</div>
|
||||
</div>
|
||||
</div><!--/.sidebar-offcanvas-->
|
||||
|
||||
<div class=\"col-lg-8 col-md-8 col-sm-12 col-xs-12\" id=\"content\">
|
||||
<section class=\"sectiontop\">
|
||||
<div class=\"panel "; echo $a->argv[0]; echo "-content-wrapper\">
|
||||
<div class=\"panel-body\">";
|
||||
if(x($page,'content')) echo $page['content']; echo"
|
||||
<div id=\"pause\"></div> <!-- The pause/resume Ajax indicator -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
";
|
||||
?>
|
||||
|
||||
</div><!--row-->
|
||||
</div><!-- container -->
|
||||
|
||||
<div id="back-to-top" title="back to top">⇧</div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<span id="notifsound"></span>
|
||||
<script>
|
||||
$("#menu-toggle").click(function(e) {
|
||||
e.preventDefault();
|
||||
$("#wrapper").toggleClass("toggled");
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$.fn.enterKey = function (fnc, mod) {
|
||||
return this.each(function () {
|
||||
$(this).keypress(function (ev) {
|
||||
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
|
||||
if ((keycode == '13' || keycode == '10') && (!mod || ev[mod + 'Key'])) {
|
||||
fnc.call(this, ev);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
$('textarea').enterKey(function() {$(this).closest('form').submit(); }, 'ctrl')
|
||||
$('input').enterKey(function() {$(this).closest('form').submit(); }, 'ctrl')
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var pagetitle = null;
|
||||
$("nav").bind('nav-update', function(e,data)
|
||||
{
|
||||
if (pagetitle==null) pagetitle = document.title;
|
||||
var count = $(data).find('notif').attr('count');
|
||||
if (count>0)
|
||||
{
|
||||
document.title = "("+count+") "+pagetitle;
|
||||
/* document.getElementById('notifsound').innerHTML='<object type="audio/mpeg" width="0" height="0" data="<?=$frio?>/audios/901.mp3"><param name="notif" value="<?=$frio?>/audios/901.mp3" /><param name="autostart" value="true" /><param name="loop" value="false" /></object>'; */
|
||||
}
|
||||
else
|
||||
{
|
||||
document.title = pagetitle;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script src="<?=$frio?>/js/theme.js"></script>
|
||||
<script src="<?=$frio?>/js/acl.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/jasny/js/jasny-bootstrap.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/bootstrap-select/js/bootstrap-select.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/ekko-lightbox/ekko-lightbox.min.js"></script>
|
||||
<script src="<?=$frio?>/frameworks/justifiedGallery/jquery.justifiedGallery.min.js"></script>
|
||||
|
||||
<!-- Modal -->
|
||||
<div id="modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="plan-info" aria-hidden="true">
|
||||
<div class="modal-dialog modal-full-screen">
|
||||
<div class="modal-content">
|
||||
<div id="modal-header" class="modal-header">
|
||||
<button id="modal-cloase" type="button" class="close" data-dismiss="modal" aria-hidden="true">
|
||||
×
|
||||
</button>
|
||||
<h4 id="modal-title" class="modal-title"></h4>
|
||||
</div>
|
||||
<div id="modal-body" class="modal-body">
|
||||
<!-- /# content goes here -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</footer>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue