function favrskovtheme_form_system_theme_settings_alter(&$form, &$form_state) { $form['favrskovtheme_settings'] = array('#type' => 'vertical_tabs', '#weight' => -10); /** * Header settings. */ $form['favrskovtheme_settings']['favrskovtheme_header_footer'] = array('#type' => 'fieldset', '#title' => t('Header and Footer Settings')); // RGB to hex $default_color = theme_get_setting('favrskovtheme_header_background') ? _color_pack(theme_get_setting('favrskovtheme_header_background')) : '586464'; $default_color = trim($default_color, '#'); $form['favrskovtheme_settings']['favrskovtheme_header_footer']['favrskovtheme_header_background'] = array('#type' => 'jquery_colorpicker', '#title' => t('Header Background color'), '#description' => t('Adjust header background color'), '#default_value' => $default_color); // Decimal to % $default_opacity = theme_get_setting('favrskovtheme_header_opacity') ? (double) theme_get_setting('favrskovtheme_header_opacity') : 1; $default_opacity *= 100; $form['favrskovtheme_settings']['favrskovtheme_header_footer']['favrskovtheme_header_opacity'] = array('#type' => 'jslider', '#title' => t('Header Opacity'), '#description' => t('Adjust header opacity, %'), '#min' => 0, '#max' => 100, '#default_value' => $default_opacity, '#display_inputs' => FALSE, '#display_values' => TRUE, '#slider_length' => '500px'); $form['favrskovtheme_settings']['favrskovtheme_header_footer']['favrskovtheme_header_links'] = array('#type' => 'select', '#title' => t('Header color scheme'), '#description' => t('Adjust header links color'), '#options' => array('' => t('None'), 'header-red-scheme' => t('Red'), 'header-dark-blue-scheme' => t('Dark blue'), 'header-dark-scheme' => t('Dark grey'), 'header-grey-scheme' => t('Grey'), 'header-white-scheme' => t('White'), 'header-yellow-scheme' => t('Yellow'), 'header-violet-scheme' => t('Violet'), 'header-pink-scheme' => t('Pink'), 'header-fern-green-scheme' => t('Fern Green'), 'header-salat-green-scheme' => t('Salat green'), 'header-orange-scheme' => t('Orange')), '#default_value' => theme_get_setting('favrskovtheme_header_links')); $form['favrskovtheme_settings']['favrskovtheme_header_footer']['favrskovtheme_footer_background'] = array('#type' => 'jquery_colorpicker', '#title' => t('Foter Background color'), '#description' => t('Adjust header background color'), '#default_value' => theme_get_setting('favrskovtheme_footer_background') ? theme_get_setting('favrskovtheme_footer_background') : '586464'); /** * Multisite settings. */ $form['favrskovtheme_settings']['favrskovtheme_multisite'] = array('#type' => 'fieldset', '#title' => t('Multisite Settings')); $form['favrskovtheme_settings']['favrskovtheme_multisite']['favrskovtheme_multisite_links'] = array('#type' => 'select', '#title' => t('Links color'), '#description' => t('Adjust links color'), '#options' => array('' => t('Default'), 'violet' => t('Violet'), 'dark-grey' => t('Dark grey'), 'grey' => t('Grey'), 'yellow' => t('Yellow'), 'blue' => t('Blue'), 'pink' => t('Pink'), 'salat-green' => t('Salat green')), '#default_value' => theme_get_setting('favrskovtheme_multisite_links')); if (!empty($form['#submit'])) { array_unshift($form['#submit'], 'favrskovtheme_form_system_theme_settings_submit'); } else { $form['#submit'][] = 'favrskovtheme_form_system_theme_settings_submit'; } }
/** * Shift a given color, using a reference pair and a target blend color. * * Note: this function is significantly different from the JS version, as it * is written to match the blended images perfectly. * * Constraint: if (ref2 == target + (ref1 - target) * delta) for some fraction delta * then (return == target + (given - target) * delta) * * Loose constraint: Preserve relative positions in saturation and luminance * space. */ function _color_shift($given, $ref1, $ref2, $target) { // We assume that ref2 is a blend of ref1 and target and find // delta based on the length of the difference vectors: // delta = 1 - |ref2 - ref1| / |white - ref1| $target = _color_unpack($target, true); $ref1 = _color_unpack($ref1, true); $ref2 = _color_unpack($ref2, true); for ($i = 0; $i < 3; ++$i) { $numerator += ($ref2[$i] - $ref1[$i]) * ($ref2[$i] - $ref1[$i]); $denominator += ($target[$i] - $ref1[$i]) * ($target[$i] - $ref1[$i]); } $delta = $denominator > 0 ? 1 - sqrt($numerator / $denominator) : 0; // Calculate the color that ref2 would be if the assumption was true. for ($i = 0; $i < 3; ++$i) { $ref3[$i] = $target[$i] + ($ref1[$i] - $target[$i]) * $delta; } // If the assumption is not true, there is a difference between ref2 and ref3. // We measure this in HSL space. Notation: x' = hsl(x). $ref2 = _color_rgb2hsl($ref2); $ref3 = _color_rgb2hsl($ref3); for ($i = 0; $i < 3; ++$i) { $shift[$i] = $ref2[$i] - $ref3[$i]; } // Take the given color, and blend it towards the target. $given = _color_unpack($given, true); for ($i = 0; $i < 3; ++$i) { $result[$i] = $target[$i] + ($given[$i] - $target[$i]) * $delta; } // Finally, we apply the extra shift in HSL space. // Note: if ref2 is a pure blend of ref1 and target, then |shift| = 0. $result = _color_rgb2hsl($result); for ($i = 0; $i < 3; ++$i) { $result[$i] = min(1, max(0, $result[$i] + $shift[$i])); } $result = _color_hsl2rgb($result); // Return hex color. return _color_pack($result, true); }
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 ''; }
/** * Preprocessor for theme_spaces_design(). */ function ginkgo_preprocess_spaces_design(&$vars) { if (module_exists('color') && !empty($vars['color'])) { if ($rgb = _color_unpack($vars['color'], TRUE)) { $classes = context_get('theme', 'body_classes'); $classes .= ' color'; context_set('theme', 'body_classes', $classes); $hsl = _color_rgb2hsl($rgb); if ($hsl[2] > 0.8) { $hsl[2] = 0.7; $rgb = _color_hsl2rgb($hsl); } // This code generates color values that are blended against // Black/White -- IT DOES NOT PRESERVE SATURATION. $modifiers = array('upshift' => $hsl[2] < 0.25 ? array('+', 0.1) : array('+', 0.25), 'downshift' => array('-', 0.38)); foreach ($modifiers as $id => $modifier) { $color = $rgb; foreach ($rgb as $k => $v) { switch ($modifier[0]) { case '-': $color[$k] = $color[$k] * (1 - $modifier[1]); break; default: $color[$k] = $color[$k] + (1 - $color[$k]) * $modifier[1]; break; } } $vars[$id] = _color_pack($color, TRUE); } $vars['color'] = _color_pack($rgb, TRUE); } } }
/** * Autohift colors in HSL color space * @param color * CSS hex color to be shifted (e.g. #000000 ) * @param $X_min * Hue/Saturation/Lightness minimum value, normalized to a fraction of 1 * @param $X_max * Hue/Saturation/Lightness maximum value, normalized to a fraction of 1 * @return a string containing a CSS hexcolor (e.g. #000000 ) */ function color_autoshift($color, $min_h, $max_h, $min_s, $max_s, $min_l, $max_l) { $newcolor = _color_unpack($color, TRUE); // hex to RGB $newcolor = _color_rgb2hsl($newcolor); // RGB to HSL if ($min_h) { if ($newcolor[0] < $min_h) { $newcolor[0] = $min_h; } } if ($max_h) { if ($newcolor[0] > $max_h) { $newcolor[0] = $max_h; } } if ($min_s) { if ($newcolor[1] < $min_s) { $newcolor[1] = $min_s; } } if ($max_s) { if ($newcolor[1] > $max_s) { $newcolor[1] = $max_s; } } if ($min_l) { if ($newcolor[2] < $min_l) { $newcolor[2] = $min_l; } } if ($max_l) { if ($newcolor[2] > $max_l) { $newcolor[2] = $max_l; } } $newcolor = _color_hsl2rgb($newcolor); // Back to RGB $newcolor = _color_pack($newcolor, TRUE); // RGB back to hex return $newcolor; }
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'] .= " "; $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'] .= " "; $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'] .= " ({$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); }