コード例 #1
0
ファイル: skin.php プロジェクト: ZerGabriel/Doragon-Skin
 /**
  * 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);
 }
コード例 #2
0
ファイル: skin.php プロジェクト: AlexandrST/esoTalk
 /**
  * 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>");
     }
 }
コード例 #3
0
ファイル: colors.php プロジェクト: XelaRellum/tt-rss
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 '';
}
コード例 #4
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]);
}
コード例 #5
0
ファイル: colorconvert.php プロジェクト: aguynamedirvin/F-C
function hsl2hex($hsl)
{
    $rgb = hsl2rgb($hsl);
    return rgb2hex($rgb);
}
コード例 #6
0
function getRgb($sColor, $fSaturation, $fLightness, $hColorData)
{
    $h = $hColorData['hsl'][$sColor]['h'];
    $s = $hColorData['hsl'][$sColor]['s'] > 0.01 ? $fSaturation : 0;
    $l = $hColorData['colors']['darkmode'] ? 100 - $fLightness : $fLightness;
    return hsl2rgb($h, $s, $l);
}
コード例 #7
0
				<td><input type="submit" name="color" class="submit" value="Convert" /></td>
			</tr>
		</table>
			
<?php 
if ($_GET['mode'] == 'hex' || $_GET['mode'] == 'rgb' || $_GET['mode'] == 'hsl' || $_GET['color'] == 'Convert') {
    ?>
		<h3>Hue of new color (0-359)&deg; [same saturation and lightness]</h3>
		<div class="color-hue">
			<div class="label-radio">
<?php 
    for ($i = 0; $i < 360; $i++) {
        if (fmod($i, 5) and abs($i - $h2) > 2) {
            continue;
        }
        $rgb = hsl2rgb($i, $s, $l);
        $del = $i - $h;
        if ($del > 0) {
            $del = '+' . $del;
        }
        echo '	<label style="background:' . rgb2hex($rgb[0], $rgb[1], $rgb[2]) . ';" title="' . $i . ' (' . $del . ')">';
        echo '<input name="h2" type="radio" value="' . $i . '" title="' . $i . ' (' . $del . ')"';
        if ($i == $h2) {
            echo ' checked="checked"';
        }
        echo ' />';
        echo '</label>' . chr(10);
    }
    ?>
			</div>
		</div>
コード例 #8
0
$FULL = 1.0;
// constant lightness level
$LIGHT = 0.6;
// semi-white
// assign each topic a random hue
for ($i = 0; $i < $numTopics; $i++) {
    $hue = mt_rand(0, 360) / 360;
    $rainbow[] = $hue;
    $rgb = hsl2rgb($hue, $FADE, $LIGHT);
    echo '#topic_' . $i . '{';
    echo 'background-color:rgb(' . $rgb[0] . ',' . $rgb[1] . ',' . $rgb[2] . ');';
    echo '}';
    echo '.topic_' . $i . '{';
    echo 'background-color:rgb(' . $rgb[0] . ',' . $rgb[1] . ',' . $rgb[2] . ');';
    echo '}';
    $rgb = hsl2rgb($hue, $FULL, $LIGHT);
    echo '#topic_' . $i . ':hover{';
    echo 'background-color:rgb(' . $rgb[0] . ',' . $rgb[1] . ',' . $rgb[2] . ');';
    echo '}';
    echo '.topic_' . $i . ':hover{';
    echo 'background-color:rgb(' . $rgb[0] . ',' . $rgb[1] . ',' . $rgb[2] . ');';
    echo '}';
}
?>
</style>
<script type="text/javascript">

/**
 * Remember which headers the user collapsed/expanded by storing in cookie
 * so that on browser return the user can continue where he left off
 */
コード例 #9
0
				<td><input type="submit" name="color" class="submit" value="Convert" /></td>
			</tr>
		</table>
			
<?php 
if ($_GET['mode'] == 'hex' || $_GET['mode'] == 'rgb' || $_GET['mode'] == 'hsl' || $_GET['color'] == 'Convert') {
    ?>
		<h3>Saturation of new color (0-359)&deg; [same hue and lightness]</h3>
		<div class="color-saturation">
			<div class="label-radio">
<?php 
    for ($i = 0; $i <= 100; $i++) {
        if (fmod($i, 5) and abs($i - $s2) > 2) {
            continue;
        }
        $rgb = hsl2rgb($h, $i, $l);
        $del = $i - $s;
        if ($del > 0) {
            $del = '+' . $del;
        }
        echo '	<label style="background:' . rgb2hex($rgb[0], $rgb[1], $rgb[2]) . ';" title="' . $i . ' (' . $del . ')">';
        echo '<input name="s2" type="radio" value="' . $i . '" title="' . $i . ' (' . $del . ')"';
        if ($i == $s2) {
            echo ' checked="checked"';
        }
        echo ' />';
        echo '</label>' . chr(10);
    }
    ?>
			</div>
		</div>
コード例 #10
0
ファイル: lib_func.php プロジェクト: 1upon0/ui
function hsl2hex($h, $s, $l)
{
    return rgb2hex(hsl2rgb($h, $s, $l));
}
コード例 #11
0
<?php

include '../include.php';
include '../inc/_header.php';
include '../inc/_wrap_before.php';
?>

	
<?php 
// randomize
$rand_h = rand(0, 359);
$rand_s = rand(0, 40) + 50;
$rand_l = rand(0, 20) + 40;
$rand_rgb = hsl2rgb($rand_h, $rand_s, $rand_l);
$rand = rgb2hex($rand_rgb[0], $rand_rgb[1], $rand_rgb[2]);
$bgrand = readable_color($rand_rgb[0], $rand_rgb[1], $rand_rgb[2]);
?>

	<h2>Convert HSL to RGB</h2>
	<p>You can convert color from HSL to RGB and from HSL to Hex or just click <?php 
echo random_link_hsl();
?>
.</p>

<?php 
if (isset($_GET['h']) && isset($_GET['s']) && isset($_GET['l'])) {
    $h = $_GET['h'];
    $s = $_GET['s'];
    $l = $_GET['l'];
    hsl_sample($h, $s, $l, 'Basic color');
}
コード例 #12
0
    echo ' />';
    echo '</label>' . chr(10);
}
?>
			</div>
		</div>
			

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

<!-- Complementary colors -->
<?php 
$rgb = hsl2rgb($h, $s, $l);
$hex = rgb2hex($rgb[0], $rgb[1], $rgb[2]);
$color = readable_color($rgb[0], $rgb[1], $rgb[2]);
?>
	<h3>Results</h3>
	<div class="color-results" style="<?php 
echo 'background-color:' . $hex . '; color:' . $color . ';';
?>
">


<?php 
hsl_sample($h, $s, $l, 'Basic color');
?>
		<h3>Complementary colors:</h3>
					
コード例 #13
0
ファイル: Hsla.php プロジェクト: pyrsmk/imagix
 public function apply($resource)
 {
     // Extract arguments
     @(list(, $h, $s, $l, $a) = func_get_args());
     $h = (int) $h;
     $s = (int) $s;
     $l = (int) $l;
     $a = (int) $a;
     // Convert
     list($r, $g, $b) = hsl2rgb($h, $s, $l);
     // Normalize
     if ($a < 0) {
         $a = 0;
     } elseif ($a > 100) {
         $a = 100;
     }
     if ($l < 0) {
         $l = 0;
     } elseif ($l > 100) {
         $l = 100;
     }
     $a = (100 - $a) * 1.27;
     $l = ($l * 2 - 100) * 2.55;
     // Compute hue ratio
     $delta = $r + $g + $b;
     if ($delta != 0) {
         $ratio1 = $r / $delta;
         $ratio2 = $g / $delta;
         $ratio3 = $b / $delta;
     }
     // Get resolution
     $width = imagesx($resource);
     $height = imagesy($resource);
     if (!$width || !$height) {
         throw new Exception("An error was encountered while getting image resolution");
     }
     // Apply effect
     $x = 0;
     do {
         $y = 0;
         do {
             // Get current pixel color
             list($r, $g, $b) = $this->_getColorAt($resource, $x, $y);
             // Define new color
             $new_r = $r * $ratio1 + $g * $ratio2 + $b * $ratio3 + $l;
             $new_g = $r * $ratio3 + $g * $ratio1 + $b * $ratio2 + $l;
             $new_b = $r * $ratio2 + $g * $ratio3 + $b * $ratio1 + $l;
             // Format
             if ($new_r < 0) {
                 $new_r = 0;
             } elseif ($new_r > 255) {
                 $new_r = 255;
             }
             if ($new_g < 0) {
                 $new_g = 0;
             } elseif ($new_g > 255) {
                 $new_g = 255;
             }
             if ($new_b < 0) {
                 $new_b = 0;
             } elseif ($new_b > 255) {
                 $new_b = 255;
             }
             // Define pixel
             imagesetpixel($resource, $x, $y, imagecolorallocatealpha($resource, $new_r, $new_g, $new_b, $a));
         } while (++$y < $height);
     } while (++$x < $width);
     return $resource;
 }
コード例 #14
0
    echo '</label>' . chr(10);
}
?>
			</div>
		</div>
			
			
		<h3>Lightness (0-100)% [darker or lighter]</h3>
		<div class="color-lightness">
			<div class="label-radio">
<?php 
for ($i = 0; $i <= 100; $i++) {
    if (fmod($i, 5) and abs($i - $l) > 2) {
        continue;
    }
    $rgb = hsl2rgb($h, $s, $i);
    echo '	<label style="background:' . rgb2hex($rgb[0], $rgb[1], $rgb[2]) . ';" title="' . $i . '">';
    echo '<input name="l" type="radio" value="' . $i . '" title="' . $i . '"';
    if ($i == $l) {
        echo ' checked="checked"';
    }
    echo ' />';
    echo '</label>' . chr(10);
}
?>
			</div>
		</div>
			

		<div style="clear:both; float:none;">
			<input type="submit" class="submit" name="color" value="Submit" />
コード例 #15
0
ファイル: gradient.php プロジェクト: rhertzog/lcs
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;
}
コード例 #16
0
 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);
 }
コード例 #17
0
    if ($h2 > 359) {
        $h2 = 359;
    }
    if ($s2 < 0) {
        $s2 = 0;
    }
    if ($s2 > 100) {
        $s2 = 100;
    }
    if ($l2 < 0) {
        $l2 = 0;
    }
    if ($l2 > 100) {
        $l2 = 100;
    }
    $rgb2 = hsl2rgb($h2, $s2, $l2);
    $r2 = $rgb2[0];
    $g2 = $rgb2[1];
    $b2 = $rgb2[2];
    $hex2 = rgb2hex($r2, $g2, $b2);
    $hex2 = substr($hex2, 1);
    // remove '#'
    rgb_sample($r2, $g2, $b2, 'Second color');
}
?>

<script type="text/javascript">
jQuery(function($){
	$('.form-container').wrap('<fo'+'rm name="color" method="get" action="<?php 
echo basename(__FILE__);
?>
コード例 #18
0
ファイル: color.php プロジェクト: webvitalii/web-services
function random_link_hsl()
{
    $rand_h = rand(0, 359);
    $rand_s = rand(0, 100);
    $rand_l = rand(0, 100);
    $rand_rgb = hsl2rgb($rand_h, $rand_s, $rand_l);
    $rand = rgb2hex($rand_rgb[0], $rand_rgb[1], $rand_rgb[2]);
    $bgrand = readable_color($rand_rgb[0], $rand_rgb[1], $rand_rgb[2]);
    return '<!--googleoff: index--><a rel="nofollow" class="random" style="padding:0 2px; color:' . $rand . '; background:' . $bgrand . ';" href="' . basename($_SERVER['SCRIPT_FILENAME']) . '?mode=hsl&amp;h=' . $rand_h . '&amp;s=' . $rand_s . '&amp;l=' . $rand_l . '" rel="nofollow">random color</a><!--googleon: index-->';
}