Exemplo n.º 1
0
function hex2hsl($hex)
{
    //Validate Hex Input
    $hex = validate_hex($hex);
    // Split input by color
    $hex = str_split($hex, 2);
    // Convert color values to value between 0 and 1
    $r = hexdec($hex[0]) / 255;
    $g = hexdec($hex[1]) / 255;
    $b = hexdec($hex[2]) / 255;
    return rgb2hsl(array($r, $g, $b));
}
Exemplo n.º 2
0
 /**
  * Write the skin's color configuration and CSS.
  * 
  * @param string $primary The primary color.
  * @return void
  */
 protected function writeColors($primary)
 {
     ET::writeConfig(array("skin.Doragon.primaryColor" => $primary));
     $rgb = colorUnpack($primary, true);
     $hsl = rgb2hsl($rgb);
     $primary = colorPack(hsl2rgb($hsl), true);
     $hsl[1] = max(0, $hsl[1] - 0.3);
     $secondary = colorPack(hsl2rgb(array(2 => 0.6) + $hsl), true);
     $tertiary = colorPack(hsl2rgb(array(2 => 0.92) + $hsl), true);
     $css = file_get_contents($this->resource("colors.css"));
     $css = str_replace(array("{primary}", "{secondary}", "{tertiary}"), array($primary, $secondary, $tertiary), $css);
     file_put_contents(PATH_CONFIG . "/colors.css", $css);
 }
Exemplo n.º 3
0
 /**
  * Initialize the skin.
  * 
  * @param ETController $sender The page controller.
  * @return void
  */
 public function handler_init($sender)
 {
     $sender->addCSSFile((C("esoTalk.https") ? "https" : "http") . "://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700");
     $sender->addCSSFile("core/skin/base.css", true);
     $sender->addCSSFile($this->getResource("styles.css"), true);
     // If we're viewing from a mobile browser, add the mobile CSS and change the master view.
     if ($isMobile = isMobileBrowser()) {
         $sender->addCSSFile($this->getResource("mobile.css"), true);
         $sender->masterView = "mobile.master";
         $sender->addToHead("<meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=1.0;'>");
     }
     // If custom colors have been set in this skin's settings, add some CSS to the page.
     $styles = array();
     // If a custom header color has been set...
     if ($c = C("skin.Default.headerColor")) {
         $styles[] = "#hdr {background-color:{$c}}";
         // If the header color is in the top half of the lightness spectrum, add the "lightHdr" class to the body.
         $rgb = colorUnpack($c, true);
         $hsl = rgb2hsl($rgb);
         if ($hsl[2] >= 0.5) {
             $sender->bodyClass .= " lightHdr";
         }
     }
     // If a custom body color has been set...
     if ($c = C("skin.Default.bodyColor")) {
         $styles[] = "body, .scrubberMore {background-color:{$c} !important}";
         // If the body color is in the bottom half of the lightness spectrum, add the "darkBody" class to the body.
         $rgb = colorUnpack($c, true);
         $hsl = rgb2hsl($rgb);
         if ($hsl[2] < 0.5) {
             $sender->bodyClass .= " darkBody";
         }
         // Slightly darken the body color and set it as the border color for the body content area.
         $hsl[2] = max(0, $hsl[2] - 0.1);
         $hsl[1] = min($hsl[1], 0.5);
         $b = colorPack(hsl2rgb($hsl), true);
         $styles[] = "#body-content {border-color:{$b}}";
     }
     // If a custom body background image has been set...
     if ($img = C("skin.Default.bodyImage") and !$isMobile) {
         $styles[] = "body {background-image:url(" . getWebPath($img) . "); background-position:top center; background-attachment:fixed}";
     }
     // Do we want this background image to not repeat?
     if ($img and C("skin.Default.noRepeat")) {
         $styles[] = "body {background-repeat:no-repeat}";
     }
     // If we have any custom styles at all, add them to the page head.
     if (count($styles)) {
         $sender->addToHead("<style type='text/css'>\n" . implode("\n", $styles) . "\n</style>");
     }
 }
Exemplo n.º 4
0
    if ($g2 < 0) {
        $g2 = 0;
    }
    if ($g2 > 255) {
        $g2 = 255;
    }
    if ($b2 < 0) {
        $b2 = 0;
    }
    if ($b2 > 255) {
        $b2 = 255;
    }
    $hex2 = rgb2hex($r2, $g2, $b2);
    $hex2 = substr($hex2, 1);
    // remove '#'
    $hsl2 = rgb2hsl($r2, $g2, $b2);
    $h2 = $hsl2[0];
    $s2 = $hsl2[1];
    $l2 = $hsl2[2];
    rgb_sample($r2, $g2, $b2, 'Second color');
} elseif (!isset($_GET['mode2']) && $_GET['h2'] && $_GET['s2'] && $_GET['l2'] || $_GET['mode2'] == 'hsl2' && is_numeric($_GET['h2']) && is_numeric($_GET['s2']) && is_numeric($_GET['l2'])) {
    $modehsl2 = ' checked="checked" ';
    $modergb2 = $modehex2 = '';
    $h2 = $_GET['h2'];
    $s2 = $_GET['s2'];
    $l2 = $_GET['l2'];
    if ($h2 < 0) {
        $h2 = 0;
    }
    if ($h2 > 359) {
        $h2 = 359;
Exemplo n.º 5
0
function rgb_luminance($rgb, $scale = 5)
{
    $luminance = array(0.44, 0.5, 0.5600000000000001, 0.62, 0.68, 0.74, 0.8, 0.86, 0.92, 0.98);
    if ($scale < 0) {
        $scale = 0;
    }
    if ($scale > 9) {
        $scale = 9;
    }
    $new = rgb2hsl($rgb);
    $new[2] = $luminance[round($scale)];
    $newColor = hsl2rgb($new);
    return $newColor;
}
Exemplo n.º 6
0
function calculate_avg_color($iconFile)
{
    $palette = colorPalette($iconFile, 4, 4);
    if (is_array($palette)) {
        foreach ($palette as $p) {
            $hsl = rgb2hsl(_color_unpack("#{$p}"));
            if ($hsl[1] > 0.25 && $hsl[2] > 0.25 && !($hsl[0] >= 0 && $hsl[0] < 0.01 && $hsl[1] < 0.01) && !($hsl[0] >= 0 && $hsl[0] < 0.01 && $hsl[2] > 0.99)) {
                return _color_pack(hsl2rgb($hsl));
            }
        }
    }
    return '';
}
Exemplo n.º 7
0
<?php

use_helper('Color');
$hls = rgb2hsl($sf_user->getAttribute("popup_color", "973765", "persistent"));
?>

<style type="text/css">
  input, textarea {
    border: 1px solid hsla(<?php 
echo $hls[0];
?>
,<?php 
echo $hls[1];
?>
%,50%,.7); /*whatever the skin color is*/
  }

  #content-outer {
    background-color: hsla(<?php 
echo $hls[0];
?>
,<?php 
echo $hls[1];
?>
%,50%,1); /*whatever the skin color is*/
  }

  #content-outer h1 {
    border-bottom: 1px dotted hsla(<?php 
echo $hls[0];
?>
Exemplo n.º 8
0
?>
			</div>
		</div>
			

		<div style="clear:both; float:none;">
			<input type="submit" class="submit" name="color" value="Click" />
		</div>
	</div><!-- .form-container -->

<!-- Complementary colors -->

	<h3>Results</h3>
<?php 
$hex = rgb2hex($r, $g, $b);
$hsl = rgb2hsl($r, $g, $b);
$h = $hsl[0];
$s = $hsl[1];
$l = $hsl[2];
$color = readable_color($r, $g, $b);
?>

	<div class="color-results" style="<?php 
echo 'background-color:' . $hex . '; color:' . $color . ';';
?>
">


<?php 
rgb_sample($r, $g, $b, 'Basic color');
?>
Exemplo n.º 9
0
function hue($R1, $G1, $B1, $R2, $G2, $B2, $mode = 0)
{
    //Takes either the hue ($mode=0) or hue and saturation ($mode=1) of the given color
    $HSL1 = rgb2hsl($R1, $G1, $B1);
    $HSL2 = rgb2hsl($R2, $G2, $B2);
    $H = $HSL2[0];
    $S = $mode == 1 ? $HSL2[1] : $HSL1[1];
    //picture seem to turn red when r=g=b  &mode=0&r=0&g=0&b=0
    $L = $HSL1[2];
    $RGB = hsl2rgb($H, $S, $L);
    return array($RGB[0], $RGB[1], $RGB[2]);
}
Exemplo n.º 10
0
        echo '</tr>' . chr(10);
    }
}
?>
</table>

		
			<h3>Table of "grey" web safe colors</h3>

<table border="0" cellpadding="0" cellspacing="0" width="100%" class="websafetable">
<?php 
echo '<tr>' . chr(10);
for ($i = 0; $i <= 255; $i += 51) {
    echo '	<td>';
    //rgb_sample($i,$i,$i,'');
    $hsl = rgb2hsl($i, $i, $i);
    $hex = rgb2hex($i, $i, $i);
    $color = readable_color($i, $i, $i);
    echo chr(10) . '<div class="rgb-sample" style="background:' . $hex . '; color:' . $color . ';">' . chr(10);
    echo '	' . $hex . '; rgb(' . $i . ',' . $i . ',' . $i . '); hsl(' . $hsl[0] . ',' . $hsl[1] . '%,' . $hsl[2] . '%); ' . chr(10);
    echo '	</td>' . chr(10);
}
echo '</tr>' . chr(10);
?>
</table>


<?php 
include '../inc/_wrap_after.php';
include '../inc/_sidebar.php';
include '../inc/_footer.php';
Exemplo n.º 11
0
/**
 * Überschreiben der Farben in den SVG-Dateien
 *
 * @param array $hColors        Farbwerte des Benutzers
 */
function updateSVGImages($hColors)
{
    // HSL-Daten der Hauptfarbe auslesen
    $hColorData = array('colors' => $hColors, 'base_hue' => 187, 'hsl' => array('main' => rgb2hsl($hColors['main']), 'accent' => rgb2hsl($hColors['accent'])));
    $bDarkmode = $hColors['darkmode'];
    $hColorData['hex'] = array('#000000' => $bDarkmode ? "#FEFEFE" : "#000000", '#003473' => getRgb('main', 100, 22.55, $hColorData), '#0084B6' => getRgb('main', 100, 35.69, $hColorData), '#0283B4' => $hColors['main'], '#030202' => getRgb('main', 20, 0.98, $hColorData), '#080000' => getRgb('main', 100, 1.57, $hColorData), '#333333' => getRgb('main', 0, 20, $hColorData), '#525252' => getRgb('main', 0, 32.16, $hColorData), '#57534C' => getRgb('accent', 6.75, 31.96, $hColorData), '#586C7A' => getRgb('main', 16.19, 41.18, $hColorData), '#5D798A' => getRgb('main', 16.19, 41.18, $hColorData), '#767677' => getRgb('main', 0.42, 46.47, $hColorData), '#99D4E7' => getRgb('main', 61.9, 75.29000000000001, $hColorData), '#9ACDEC' => getRgb('main', 62.9, 75.69, $hColorData), '#9ACEE8' => getRgb('main', 62.9, 75.69, $hColorData), '#9acee8' => getRgb('main', 62.9, 75.69, $hColorData), '#9BD4E3' => getRgb('main', 56.25, 74.90000000000001, $hColorData), '#9EB9C2' => getRgb('main', 22.29, 69.22, $hColorData), '#9FB9C2' => getRgb('main', 22.29, 69.22, $hColorData), '#A6A6A7' => getRgb('main', 0.57, 65.29000000000001, $hColorData), '#B8B7B7' => getRgb('main', 0.7, 71.95999999999999, $hColorData), '#CFCED2' => getRgb('main', 4.26, 81.56999999999999, $hColorData), '#D0D0D0' => getRgb('main', 0, 81.56999999999999, $hColorData), '#ED1C2E' => getRgb('main', 85.31, 51.96, $hColorData), '#EF8E0E' => $hColors['accent'], '#F08F0E' => $hColors['accent'], '#F18F09' => $hColors['accent'], '#f3f3f2' => getRgb('main', 4, 95.09999999999999, $hColorData), '#F4F4F3' => getRgb('main', 4, 95.09999999999999, $hColorData), '#FA8A3B' => $hColors['accent'], '#FCB131' => $hColors['accent'], '#FFA000' => $hColors['accent'], '#FFFFFF' => $bDarkmode ? "#010101" : "#FFFFFF", '#010101' => "#000000", '#FEFEFE' => "#FFFFFF", '#A1D7DE' => getRgb('main', 48, 75, $hColorData), '#AEDAE0' => getRgb('main', 44, 78, $hColorData), '#BAE3E8' => getRgb('main', 50, 82, $hColorData), '#BFE4E8' => getRgb('main', 48, 83, $hColorData), '#C6E7EB' => getRgb('main', 49, 85, $hColorData), '#C9E9ED' => getRgb('main', 50, 86, $hColorData), '#CAE4E8' => getRgb('main', 39, 85, $hColorData), '#D9EFF2' => getRgb('main', 50, 90, $hColorData), '#E6F7F9' => getRgb('main', 63, 94, $hColorData));
    $hColorData['replace'] = array('search' => array_keys($hColorData['hex']), 'replace' => array_values($hColorData['hex']));
    updateHexImage($hColorData, 'header/bg.svg');
    updateHexImage($hColorData, 'sprite-shop.svg');
    updateHexImage($hColorData, 'domains/illustration.svg');
    updateHexImage($hColorData, 'header/addons.svg');
    updateHexImage($hColorData, 'header/hero.svg');
    updateHexImage($hColorData, 'header/service.svg');
    updateHexImage($hColorData, 'header/tariff.svg');
    updateHexImage($hColorData, 'references/sprite.svg');
}
 private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, $next_unread_feed, $offset, $vgr_last_feed = false, $override_order = false, $include_children = false)
 {
     if (isset($_REQUEST["DevForceUpdate"])) {
         header("Content-Type: text/plain");
     }
     $disable_cache = false;
     $reply = array();
     $timing_info = microtime(true);
     $topmost_article_ids = array();
     if (!$offset) {
         $offset = 0;
     }
     if ($method == "undefined") {
         $method = "";
     }
     $method_split = explode(":", $method);
     if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
         // Update the feed if required with some basic flood control
         $result = db_query($this->link, "SELECT cache_images,cache_content," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\t\t\tFROM ttrss_feeds WHERE id = '{$feed}'");
         if (db_num_rows($result) != 0) {
             $last_updated = strtotime(db_fetch_result($result, 0, "last_updated"));
             $cache_images = sql_bool_to_bool(db_fetch_result($result, 0, "cache_images"));
             $cache_content = sql_bool_to_bool(db_fetch_result($result, 0, "cache_content"));
             if (!$cache_images && !$cache_content && time() - $last_updated > 120 || isset($_REQUEST['DevForceUpdate'])) {
                 include "rssfuncs.php";
                 update_rss_feed($this->link, $feed, true, true);
             } else {
                 db_query($this->link, "UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'\n\t\t\t\t\t\t\tWHERE id = '{$feed}'");
             }
         }
     }
     if ($method_split[0] == "MarkAllReadGR") {
         catchup_feed($this->link, $method_split[1], false);
     }
     // FIXME: might break tag display?
     if (is_numeric($feed) && $feed > 0 && !$cat_view) {
         $result = db_query($this->link, "SELECT id FROM ttrss_feeds WHERE id = '{$feed}' LIMIT 1");
         if (db_num_rows($result) == 0) {
             $reply['content'] = "<div align='center'>" . __('Feed not found.') . "</div>";
         }
     }
     @($search = db_escape_string($_REQUEST["query"]));
     if ($search) {
         $disable_cache = true;
     }
     @($search_mode = db_escape_string($_REQUEST["search_mode"]));
     $match_on = "both";
     // deprecated, TODO: remove
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("H0", $timing_info);
     }
     //		error_log("format_headlines_list: [" . $feed . "] method [" . $method . "]");
     if ($search_mode == '' && $method != '') {
         $search_mode = $method;
     }
     //		error_log("search_mode: " . $search_mode);
     $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $match_on, $override_order, $offset, 0, false, 0, $include_children);
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("H1", $timing_info);
     }
     $result = $qfh_ret[0];
     $feed_title = $qfh_ret[1];
     $feed_site_url = $qfh_ret[2];
     $last_error = $qfh_ret[3];
     $cache_content = true;
     $vgroup_last_feed = $vgr_last_feed;
     $reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url, $feed_title, $feed, $cat_view, $search, $match_on, $search_mode, $view_mode, $last_error);
     $headlines_count = db_num_rows($result);
     /* if (get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {
     			$button_plugins = array();
     			foreach (explode(",", ARTICLE_BUTTON_PLUGINS) as $p) {
     				$pclass = "button_" . trim($p);
     
     				if (class_exists($pclass)) {
     					$plugin = new $pclass($link);
     					array_push($button_plugins, $plugin);
     				}
     			}
     		} */
     global $pluginhost;
     if (db_num_rows($result) > 0) {
         $lnum = $offset;
         $num_unread = 0;
         $cur_feed_title = '';
         $fresh_intl = get_pref($this->link, "FRESH_ARTICLE_MAX_AGE") * 60 * 60;
         if ($_REQUEST["debug"]) {
             $timing_info = print_checkpoint("PS", $timing_info);
         }
         while ($line = db_fetch_assoc($result)) {
             $class = $lnum % 2 ? "even" : "odd";
             $id = $line["id"];
             $feed_id = $line["feed_id"];
             $label_cache = $line["label_cache"];
             $labels = false;
             $label_row_style = "";
             if ($label_cache) {
                 $label_cache = json_decode($label_cache, true);
                 if ($label_cache) {
                     if ($label_cache["no-labels"] == 1) {
                         $labels = array();
                     } else {
                         $labels = $label_cache;
                     }
                 }
             }
             if (!is_array($labels)) {
                 $labels = get_article_labels($this->link, $id);
             }
             if (count($labels) > 0) {
                 for ($i = 0; $i < min(4, count($labels)); $i++) {
                     $bg = rgb2hsl(_color_unpack($labels[$i][3]));
                     if ($bg && $bg[1] > 0) {
                         $bg[1] = 0.1;
                         $bg[2] = 1;
                         $bg = _color_pack(hsl2rgb($bg));
                         $label_row_style = $this->make_gradient($bg, $class);
                         break;
                     }
                 }
             }
             $labels_str = "<span id=\"HLLCTR-{$id}\">";
             $labels_str .= format_article_labels($labels, $id);
             $labels_str .= "</span>";
             if (count($topmost_article_ids) < 3) {
                 array_push($topmost_article_ids, $id);
             }
             if ($line["unread"] == "t" || $line["unread"] == "1") {
                 $class .= " Unread";
                 ++$num_unread;
                 $is_unread = true;
             } else {
                 $is_unread = false;
             }
             if ($line["marked"] == "t" || $line["marked"] == "1") {
                 $marked_pic = "<img id=\"FMPIC-{$id}\"\n\t\t\t\t\t\tsrc=\"" . theme_image($this->link, 'images/mark_set.svg') . "\"\n\t\t\t\t\t\tclass=\"markedPic\" alt=\"Unstar article\"\n\t\t\t\t\t\tonclick='javascript:toggleMark({$id})'>";
             } else {
                 $marked_pic = "<img id=\"FMPIC-{$id}\"\n\t\t\t\t\t\tsrc=\"" . theme_image($this->link, 'images/mark_unset.svg') . "\"\n\t\t\t\t\t\tclass=\"markedPic\" alt=\"Star article\"\n\t\t\t\t\t\tonclick='javascript:toggleMark({$id})'>";
             }
             if ($line["published"] == "t" || $line["published"] == "1") {
                 $published_pic = "<img id=\"FPPIC-{$id}\" src=\"" . theme_image($this->link, 'images/pub_set.svg') . "\"\n\t\t\t\t\t\tclass=\"markedPic\"\n\t\t\t\t\t\talt=\"Unpublish article\" onclick='javascript:togglePub({$id})'>";
             } else {
                 $published_pic = "<img id=\"FPPIC-{$id}\" src=\"" . theme_image($this->link, 'images/pub_unset.svg') . "\"\n\t\t\t\t\t\tclass=\"markedPic\"\n\t\t\t\t\t\talt=\"Publish article\" onclick='javascript:togglePub({$id})'>";
             }
             #				$content_link = "<a target=\"_blank\" href=\"".$line["link"]."\">" .
             #					$line["title"] . "</a>";
             #				$content_link = "<a
             #					href=\"" . htmlspecialchars($line["link"]) . "\"
             #					onclick=\"view($id,$feed_id);\">" .
             #					$line["title"] . "</a>";
             #				$content_link = "<a href=\"javascript:viewContentUrl('".$line["link"]."');\">" .
             #					$line["title"] . "</a>";
             $updated_fmt = make_local_datetime($this->link, $line["updated_noms"], false);
             if (get_pref($this->link, 'SHOW_CONTENT_PREVIEW')) {
                 $content_preview = truncate_string(strip_tags($line["content_preview"]), 100);
             }
             $score = $line["score"];
             $score_pic = theme_image($this->link, "images/" . get_score_pic($score));
             /*				$score_title = __("(Click to change)");
             				$score_pic = "<img class='hlScorePic' src=\"images/$score_pic\"
             					onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">"; */
             $score_pic = "<img class='hlScorePic' score='{$score}' onclick='changeScore({$id}, this)' src=\"{$score_pic}\"\n\t\t\t\t\ttitle=\"{$score}\">";
             if ($score > 500) {
                 $hlc_suffix = "H";
             } else {
                 if ($score < -100) {
                     $hlc_suffix = "L";
                 } else {
                     $hlc_suffix = "";
                 }
             }
             $entry_author = $line["author"];
             if ($entry_author) {
                 $entry_author = " - {$entry_author}";
             }
             $has_feed_icon = feed_has_icon($feed_id);
             if ($has_feed_icon) {
                 $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . "/{$feed_id}.ico\" alt=\"\">";
             } else {
                 $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/pub_set.svg\" alt=\"\">";
             }
             if (!get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {
                 if (get_pref($this->link, 'VFEED_GROUP_BY_FEED')) {
                     if ($feed_id != $vgroup_last_feed && $line["feed_title"]) {
                         $cur_feed_title = $line["feed_title"];
                         $vgroup_last_feed = $feed_id;
                         $cur_feed_title = htmlspecialchars($cur_feed_title);
                         $vf_catchup_link = "(<a onclick='catchupFeedInGroup({$feed_id});' href='#'>" . __('mark as read') . "</a>)";
                         $reply['content'] .= "<div class='cdmFeedTitle'>" . "<div style=\"float : right\">{$feed_icon_img}</div>" . "<a href=\"#\" onclick=\"viewfeed({$feed_id})\">" . $line["feed_title"] . "</a> {$vf_catchup_link}</div>";
                     }
                 }
                 $mouseover_attrs = "onmouseover='postMouseIn({$id})'\n\t\t\t\t\t\tonmouseout='postMouseOut({$id})'";
                 $reply['content'] .= "<div class='{$class}' id='RROW-{$id}' {$label_row_style} {$mouseover_attrs}>";
                 $reply['content'] .= "<div class='hlLeft'>";
                 $reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\t\t\ttype=\"checkbox\" onclick=\"toggleSelectRow2(this)\"\n\t\t\t\t\t\t\tid=\"RCHK-{$id}\">";
                 $reply['content'] .= "{$marked_pic}";
                 $reply['content'] .= "{$published_pic}";
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "<div onclick='return hlClicked(event, {$id})'\n\t\t\t\t\t\tclass=\"hlTitle\"><span class='hlContent{$hlc_suffix}'>";
                 $reply['content'] .= "<a id=\"RTITLE-{$id}\"\n\t\t\t\t\t\thref=\"" . htmlspecialchars($line["link"]) . "\"\n\t\t\t\t\t\tonclick=\"\">" . truncate_string($line["title"], 200);
                 if (get_pref($this->link, 'SHOW_CONTENT_PREVIEW')) {
                     if ($content_preview) {
                         $reply['content'] .= "<span class=\"contentPreview\"> - {$content_preview}</span>";
                     }
                 }
                 $reply['content'] .= "</a></span>";
                 $reply['content'] .= $labels_str;
                 if (!get_pref($this->link, 'VFEED_GROUP_BY_FEED') && defined('_SHOW_FEED_TITLE_IN_VFEEDS')) {
                     if (@$line["feed_title"]) {
                         $reply['content'] .= "<span class=\"hlFeed\">\n\t\t\t\t\t\t\t\t(<a href=\"#\" onclick=\"viewfeed({$feed_id})\">" . $line["feed_title"] . "</a>)\n\t\t\t\t\t\t\t</span>";
                     }
                 }
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "<span class=\"hlUpdated\">{$updated_fmt}</span>";
                 $reply['content'] .= "<div class=\"hlRight\">";
                 $reply['content'] .= $score_pic;
                 if ($line["feed_title"] && !get_pref($this->link, 'VFEED_GROUP_BY_FEED')) {
                     $reply['content'] .= "<span onclick=\"viewfeed({$feed_id})\"\n\t\t\t\t\t\t\tstyle=\"cursor : pointer\"\n\t\t\t\t\t\t\ttitle=\"" . htmlspecialchars($line['feed_title']) . "\">\n\t\t\t\t\t\t\t{$feed_icon_img}<span>";
                 }
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "</div>";
             } else {
                 $line["tags"] = get_article_tags($this->link, $id, $_SESSION["uid"], $line["tag_cache"]);
                 unset($line["tag_cache"]);
                 $line["content"] = sanitize($this->link, $line["content_preview"], false, false, $feed_site_url);
                 foreach ($pluginhost->get_hooks($pluginhost::HOOK_RENDER_ARTICLE_CDM) as $p) {
                     $line = $p->hook_render_article_cdm($line);
                 }
                 if (get_pref($this->link, 'VFEED_GROUP_BY_FEED') && $line["feed_title"]) {
                     if ($feed_id != $vgroup_last_feed) {
                         $cur_feed_title = $line["feed_title"];
                         $vgroup_last_feed = $feed_id;
                         $cur_feed_title = htmlspecialchars($cur_feed_title);
                         $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup({$feed_id});' href='#'>" . __('mark as read') . "</a>)";
                         $has_feed_icon = feed_has_icon($feed_id);
                         if ($has_feed_icon) {
                             $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . "/{$feed_id}.ico\" alt=\"\">";
                         } else {
                             //$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\" alt=\"\">";
                         }
                         $reply['content'] .= "<div class='cdmFeedTitle'>" . "<div style=\"float : right\">{$feed_icon_img}</div>" . "<a href=\"#\" onclick=\"viewfeed({$feed_id})\">" . $line["feed_title"] . "</a> {$vf_catchup_link}</div>";
                     }
                 }
                 $expand_cdm = get_pref($this->link, 'CDM_EXPANDED');
                 $mouseover_attrs = "onmouseover='postMouseIn({$id})'\n\t\t\t\t\t\tonmouseout='postMouseOut({$id})'";
                 $reply['content'] .= "<div class=\"{$class}\" {$label_row_style}\n\t\t\t\t\t\tid=\"RROW-{$id}\" {$mouseover_attrs}'>";
                 $reply['content'] .= "<div class=\"cdmHeader\">";
                 $reply['content'] .= "<div>";
                 $reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\t\t\ttype=\"checkbox\" onclick=\"toggleSelectRow2(this, false, true)\"\n\t\t\t\t\t\t\tid=\"RCHK-{$id}\">";
                 $reply['content'] .= "{$marked_pic}";
                 $reply['content'] .= "{$published_pic}";
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "<div id=\"PTITLE-FULL-{$id}\" style=\"display : none\">" . htmlspecialchars(strip_tags($line['title'])) . "</div>";
                 $reply['content'] .= "<span id=\"RTITLE-{$id}\"\n\t\t\t\t\t\tonclick=\"return cdmClicked(event, {$id});\"\n\t\t\t\t\t\tclass=\"titleWrap{$hlc_suffix}\">\n\t\t\t\t\t\t<a class=\"title\"\n\t\t\t\t\t\ttitle=\"" . htmlspecialchars($line['title']) . "\"\n\t\t\t\t\t\ttarget=\"_blank\" href=\"" . htmlspecialchars($line["link"]) . "\">" . $line["title"] . " {$entry_author}</a>";
                 $reply['content'] .= $labels_str;
                 if (!get_pref($this->link, 'VFEED_GROUP_BY_FEED')) {
                     if (@$line["feed_title"]) {
                         $reply['content'] .= "<span class=\"hlFeed\">\n\t\t\t\t\t\t\t\t<a href=\"#\" onclick=\"viewfeed({$feed_id})\">" . $line["feed_title"] . "</a>\n\t\t\t\t\t\t\t</span>";
                     }
                 }
                 if (!$expand_cdm) {
                     $content_hidden = "style=\"display : none\"";
                 } else {
                     $excerpt_hidden = "style=\"display : none\"";
                 }
                 $reply['content'] .= "<span {$excerpt_hidden}\n\t\t\t\t\t\tid=\"CEXC-{$id}\" class=\"cdmExcerpt\"> - {$content_preview}</span>";
                 $reply['content'] .= "</span>";
                 $reply['content'] .= "<div>";
                 $reply['content'] .= "<span class='updated'>{$updated_fmt}</span>";
                 $reply['content'] .= "{$score_pic}";
                 if (!get_pref($this->link, "VFEED_GROUP_BY_FEED") && $line["feed_title"]) {
                     $reply['content'] .= "<span style=\"cursor : pointer\"\n\t\t\t\t\t\t\ttitle=\"" . htmlspecialchars($line["feed_title"]) . "\"\n\t\t\t\t\t\t\tonclick=\"viewfeed({$feed_id})\">{$feed_icon_img}</span>";
                 }
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "<div class=\"cdmContent\" {$content_hidden}\n\t\t\t\t\t\tonclick=\"return cdmClicked(event, {$id});\"\n\t\t\t\t\t\tid=\"CICD-{$id}\">";
                 $reply['content'] .= "<div id=\"POSTNOTE-{$id}\">";
                 if ($line['note']) {
                     $reply['content'] .= format_article_note($id, $line['note']);
                 }
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "<div class=\"cdmContentInner\">";
                 if ($line["orig_feed_id"]) {
                     $tmp_result = db_query($this->link, "SELECT * FROM ttrss_archived_feeds\n\t\t\t\t\tWHERE id = " . $line["orig_feed_id"]);
                     if (db_num_rows($tmp_result) != 0) {
                         $reply['content'] .= "<div clear='both'>";
                         $reply['content'] .= __("Originally from:");
                         $reply['content'] .= "&nbsp;";
                         $tmp_line = db_fetch_assoc($tmp_result);
                         $reply['content'] .= "<a target='_blank'\n\t\t\t\t\t\t\t\thref=' " . htmlspecialchars($tmp_line['site_url']) . "'>" . $tmp_line['title'] . "</a>";
                         $reply['content'] .= "&nbsp;";
                         $reply['content'] .= "<a target='_blank' href='" . htmlspecialchars($tmp_line['feed_url']) . "'>";
                         $reply['content'] .= "<img title='" . __('Feed URL') . "'class='tinyFeedIcon' src='images/pub_unset.svg'></a>";
                         $reply['content'] .= "</div>";
                     }
                 }
                 $feed_site_url = $line["site_url"];
                 if ($cache_content && $line["cached_content"] != "") {
                     $line["content_preview"] =& $line["cached_content"];
                 }
                 $reply['content'] .= "<span id=\"CWRAP-{$id}\">";
                 $reply['content'] .= $line["content"];
                 $reply['content'] .= "</span>";
                 /*					$tmp_result = db_query($this->link, "SELECT always_display_enclosures FROM
                 						ttrss_feeds WHERE id = ".
                 						(($line['feed_id'] == null) ? $line['orig_feed_id'] :
                 							$line['feed_id'])." AND owner_uid = ".$_SESSION["uid"]);
                 
                 					$always_display_enclosures = sql_bool_to_bool(db_fetch_result($tmp_result,
                 						0, "always_display_enclosures")); */
                 $always_display_enclosures = sql_bool_to_bool($line["always_display_enclosures"]);
                 $reply['content'] .= format_article_enclosures($this->link, $id, $always_display_enclosures, $line["content"]);
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "<div class=\"cdmFooter\">";
                 $tags_str = format_tags_string($line["tags"], $id);
                 $reply['content'] .= "<img src='" . theme_image($this->link, 'images/tag.png') . "' alt='Tags' title='Tags'>\n\t\t\t\t\t\t<span id=\"ATSTR-{$id}\">{$tags_str}</span>\n\t\t\t\t\t\t<a title=\"" . __('Edit tags for this article') . "\"\n\t\t\t\t\t\thref=\"#\" onclick=\"editArticleTags({$id}, {$feed_id}, true)\">(+)</a>";
                 $num_comments = $line["num_comments"];
                 $entry_comments = "";
                 if ($num_comments > 0) {
                     if ($line["comments"]) {
                         $comments_url = htmlspecialchars($line["comments"]);
                     } else {
                         $comments_url = htmlspecialchars($line["link"]);
                     }
                     $entry_comments = "<a target='_blank' href=\"{$comments_url}\">{$num_comments} comments</a>";
                 } else {
                     if ($line["comments"] && $line["link"] != $line["comments"]) {
                         $entry_comments = "<a target='_blank' href=\"" . htmlspecialchars($line["comments"]) . "\">comments</a>";
                     }
                 }
                 if ($entry_comments) {
                     $reply['content'] .= "&nbsp;({$entry_comments})";
                 }
                 $reply['content'] .= "<div style=\"float : right\">";
                 foreach ($pluginhost->get_hooks($pluginhost::HOOK_ARTICLE_BUTTON) as $p) {
                     $reply['content'] .= $p->hook_article_button($line);
                 }
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "</div>";
                 $reply['content'] .= "</div>";
             }
             ++$lnum;
         }
         if ($_REQUEST["debug"]) {
             $timing_info = print_checkpoint("PE", $timing_info);
         }
     } else {
         $message = "";
         switch ($view_mode) {
             case "unread":
                 $message = __("No unread articles found to display.");
                 break;
             case "updated":
                 $message = __("No updated articles found to display.");
                 break;
             case "marked":
                 $message = __("No starred articles found to display.");
                 break;
             default:
                 if ($feed < -10) {
                     $message = __("No articles found to display. You can assign articles to labels manually (see the Actions menu above) or use a filter.");
                 } else {
                     $message = __("No articles found to display.");
                 }
         }
         if (!$offset && $message) {
             $reply['content'] .= "<div class='whiteBox'>{$message}";
             $reply['content'] .= "<p class=\"small\"><span class=\"insensitive\">";
             $result = db_query($this->link, "SELECT " . SUBSTRING_FOR_DATE . "(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds\n\t\t\t\t\tWHERE owner_uid = " . $_SESSION['uid']);
             $last_updated = db_fetch_result($result, 0, "last_updated");
             $last_updated = make_local_datetime($this->link, $last_updated, false);
             $reply['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated);
             $result = db_query($this->link, "SELECT COUNT(id) AS num_errors\n\t\t\t\t\tFROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION["uid"]);
             $num_errors = db_fetch_result($result, 0, "num_errors");
             if ($num_errors > 0) {
                 $reply['content'] .= "<br/>";
                 $reply['content'] .= "<a class=\"insensitive\" href=\"#\" onclick=\"showFeedsWithErrors()\">" . __('Some feeds have update errors (click for details)') . "</a>";
             }
             $reply['content'] .= "</span></p></div>";
         }
     }
     if ($_REQUEST["debug"]) {
         $timing_info = print_checkpoint("H2", $timing_info);
     }
     return array($topmost_article_ids, $headlines_count, $feed, $disable_cache, $vgroup_last_feed, $reply);
 }
Exemplo n.º 13
0
function rgb_sample($r = 0, $g = 0, $b = 0, $msg = '')
{
    // input: RGB color; output: color in HSL mode;
    if ($r > 255) {
        $r = 255;
    }
    if ($r < 0) {
        $r = 0;
    }
    if ($g > 255) {
        $g = 255;
    }
    if ($g < 0) {
        $g = 0;
    }
    if ($b > 255) {
        $b = 255;
    }
    if ($b < 0) {
        $b = 0;
    }
    $hsl = rgb2hsl($r, $g, $b);
    $hex = rgb2hex($r, $g, $b);
    $color = readable_color($r, $g, $b);
    echo chr(10) . '<div class="rgb-sample" style="background:' . $hex . '; color:' . $color . ';">' . chr(10);
    if (!(trim($msg) == '')) {
        echo '	<strong>' . $msg . '</strong>: ' . chr(10);
    }
    echo '	' . $hex . '; rgb(' . $r . ',' . $g . ',' . $b . '); hsl(' . $hsl[0] . ',' . $hsl[1] . '%,' . $hsl[2] . '%); ' . chr(10);
    echo '	<span style="background:#000; color:' . $hex . '">black</span> ' . chr(10);
    echo '	<span style="color:#000;">black</span> ' . chr(10);
    echo '	<span style="background:#fff; color:' . $hex . ';">white</span> ' . chr(10);
    echo '	<span style="color:#fff;">white</span> ' . chr(10);
    echo '</div>' . chr(10);
}