Revert "Coding convention applied - part 1"
This commit is contained in:
parent
9c2c483996
commit
7b352f3f74
181 changed files with 3507 additions and 4338 deletions
0
view/smarty3/.gitignore
vendored
Normal file → Executable file
0
view/smarty3/.gitignore
vendored
Normal file → Executable file
|
@ -4,30 +4,23 @@ function duepuntozero_init(App $a) {
|
|||
|
||||
set_template_engine($a, 'smarty3');
|
||||
|
||||
$colorset = get_pconfig( local_user(), 'duepuntozero','colorset');
|
||||
if (!$colorset) {
|
||||
$colorset = get_config('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
||||
}
|
||||
if ($colorset) {
|
||||
if ($colorset == 'greenzero') {
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
|
||||
}
|
||||
if ($colorset == 'purplezero') {
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/purplezero.css" type="text/css" media="screen" />'."\n";
|
||||
}
|
||||
if ($colorset == 'easterbunny') {
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />'."\n";
|
||||
}
|
||||
if ($colorset == 'darkzero') {
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/darkzero.css" type="text/css" media="screen" />'."\n";
|
||||
}
|
||||
if ($colorset == 'comix') {
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />'."\n";
|
||||
}
|
||||
if ($colorset == 'slackr') {
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />'."\n";
|
||||
}
|
||||
}
|
||||
$colorset = get_pconfig( local_user(), 'duepuntozero','colorset');
|
||||
if (!$colorset)
|
||||
$colorset = get_config('duepuntozero', 'colorset'); // user setting have priority, then node settings
|
||||
if ($colorset) {
|
||||
if ($colorset == 'greenzero')
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
|
||||
if ($colorset == 'purplezero')
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/purplezero.css" type="text/css" media="screen" />'."\n";
|
||||
if ($colorset == 'easterbunny')
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />'."\n";
|
||||
if ($colorset == 'darkzero')
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/darkzero.css" type="text/css" media="screen" />'."\n";
|
||||
if ($colorset == 'comix')
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />'."\n";
|
||||
if ($colorset == 'slackr')
|
||||
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />'."\n";
|
||||
}
|
||||
$a->page['htmlhead'] .= <<< EOT
|
||||
<script>
|
||||
function insertFormatting(BBcode, id) {
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
/**
|
||||
* A color utility that helps manipulate HEX colors
|
||||
* @todo convert space -> tab
|
||||
*/
|
||||
class Color {
|
||||
|
||||
|
@ -34,9 +33,9 @@ class Color {
|
|||
$color = str_replace("#", "", $hex);
|
||||
|
||||
// Make sure it's 6 digits
|
||||
if ( strlen($color) === 3 ) {
|
||||
if( strlen($color) === 3 ) {
|
||||
$color = $color[0].$color[0].$color[1].$color[1].$color[2].$color[2];
|
||||
} elseif ( strlen($color) != 6 ) {
|
||||
} else if( strlen($color) != 6 ) {
|
||||
throw new Exception("HEX color needs to be 6 or 3 digits long");
|
||||
}
|
||||
|
||||
|
@ -113,19 +112,19 @@ class Color {
|
|||
*/
|
||||
public static function hslToHex( $hsl = array() ){
|
||||
// Make sure it's HSL
|
||||
if (empty($hsl) || !isset($hsl["H"]) || !isset($hsl["S"]) || !isset($hsl["L"]) ) {
|
||||
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 ) {
|
||||
if( $S == 0 ) {
|
||||
$r = $L * 255;
|
||||
$g = $L * 255;
|
||||
$b = $L * 255;
|
||||
} else {
|
||||
|
||||
if ($L<0.5) {
|
||||
if($L<0.5) {
|
||||
$var_2 = $L*(1+$S);
|
||||
} else {
|
||||
$var_2 = ($L+$S) - ($S*$L);
|
||||
|
@ -184,7 +183,7 @@ class Color {
|
|||
*/
|
||||
public static function rgbToHex( $rgb = array() ){
|
||||
// Make sure it's RGB
|
||||
if (empty($rgb) || !isset($rgb["R"]) || !isset($rgb["G"]) || !isset($rgb["B"]) ) {
|
||||
if(empty($rgb) || !isset($rgb["R"]) || !isset($rgb["G"]) || !isset($rgb["B"]) ) {
|
||||
throw new Exception("Param was not an RGB array");
|
||||
}
|
||||
|
||||
|
@ -245,7 +244,7 @@ class Color {
|
|||
*/
|
||||
public function makeGradient( $amount = self::DEFAULT_ADJUST ) {
|
||||
// Decide which color needs to be made
|
||||
if ( $this->isLight() ) {
|
||||
if( $this->isLight() ) {
|
||||
$lightColor = $this->_hex;
|
||||
$darkColor = $this->darken($amount);
|
||||
} else {
|
||||
|
@ -388,7 +387,7 @@ class Color {
|
|||
*/
|
||||
private function _darken( $hsl, $amount = self::DEFAULT_ADJUST){
|
||||
// Check if we were provided a number
|
||||
if ( $amount ) {
|
||||
if( $amount ) {
|
||||
$hsl['L'] = ($hsl['L'] * 100) - $amount;
|
||||
$hsl['L'] = ($hsl['L'] < 0) ? 0:$hsl['L']/100;
|
||||
} else {
|
||||
|
@ -407,7 +406,7 @@ class Color {
|
|||
*/
|
||||
private function _lighten( $hsl, $amount = self::DEFAULT_ADJUST){
|
||||
// Check if we were provided a number
|
||||
if ( $amount ) {
|
||||
if( $amount ) {
|
||||
$hsl['L'] = ($hsl['L'] * 100) + $amount;
|
||||
$hsl['L'] = ($hsl['L'] > 100) ? 1:$hsl['L']/100;
|
||||
} else {
|
||||
|
@ -447,23 +446,23 @@ class Color {
|
|||
* @return int
|
||||
*/
|
||||
private static function _huetorgb( $v1,$v2,$vH ) {
|
||||
if ( $vH < 0 ) {
|
||||
if( $vH < 0 ) {
|
||||
$vH += 1;
|
||||
}
|
||||
|
||||
if ( $vH > 1 ) {
|
||||
if( $vH > 1 ) {
|
||||
$vH -= 1;
|
||||
}
|
||||
|
||||
if ( (6*$vH) < 1 ) {
|
||||
if( (6*$vH) < 1 ) {
|
||||
return ($v1 + ($v2 - $v1) * 6 * $vH);
|
||||
}
|
||||
|
||||
if ( (2*$vH) < 1 ) {
|
||||
if( (2*$vH) < 1 ) {
|
||||
return $v2;
|
||||
}
|
||||
|
||||
if ( (3*$vH) < 2 ) {
|
||||
if( (3*$vH) < 2 ) {
|
||||
return ($v1 + ($v2-$v1) * ( (2/3)-$vH ) * 6);
|
||||
}
|
||||
|
||||
|
@ -482,9 +481,9 @@ class Color {
|
|||
$color = str_replace("#", "", $hex);
|
||||
|
||||
// Make sure it's 6 digits
|
||||
if ( strlen($color) == 3 ) {
|
||||
if( strlen($color) == 3 ) {
|
||||
$color = $color[0].$color[0].$color[1].$color[1].$color[2].$color[2];
|
||||
} elseif ( strlen($color) != 6 ) {
|
||||
} else if( strlen($color) != 6 ) {
|
||||
throw new Exception("HEX color needs to be 6 or 3 digits long");
|
||||
}
|
||||
|
||||
|
|
|
@ -78,12 +78,12 @@ function frio_item_photo_links(App $a, &$body_info) {
|
|||
$occurence = 1;
|
||||
$p = bb_find_open_close($body_info['html'], "<a", ">");
|
||||
|
||||
while ($p !== false && ($occurence++ < 500)) {
|
||||
while($p !== false && ($occurence++ < 500)) {
|
||||
$link = substr($body_info['html'], $p['start'], $p['end'] - $p['start']);
|
||||
$matches = array();
|
||||
|
||||
preg_match("/\/photos\/[\w]+\/image\/([\w]+)/", $link, $matches);
|
||||
if ($matches) {
|
||||
if($matches) {
|
||||
// Replace the link for the photo's page with a direct link to the photo itself
|
||||
$newlink = str_replace($matches[0], "/photo/{$matches[1]}", $link);
|
||||
|
||||
|
|
|
@ -49,12 +49,12 @@ function frost_item_photo_links(App $a, &$body_info) {
|
|||
|
||||
$occurence = 1;
|
||||
$p = bb_find_open_close($body_info['html'], "<a", ">");
|
||||
while ($p !== false && ($occurence++ < 500)) {
|
||||
while($p !== false && ($occurence++ < 500)) {
|
||||
$link = substr($body_info['html'], $p['start'], $p['end'] - $p['start']);
|
||||
|
||||
$matches = array();
|
||||
preg_match("/\/photos\/[\w]+\/image\/([\w]+)/", $link, $matches);
|
||||
if ($matches) {
|
||||
if($matches) {
|
||||
|
||||
// Replace the link for the photo's page with a direct link to the photo itself
|
||||
$newlink = str_replace($matches[0], "/photo/{$matches[1]}", $link);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue