function my_colorful_tag_cloud($cat_id, $tc_tax, $tc_post_type) { $defaults = array('smallest' => 12, 'largest' => 24, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true); if (pods_url_variable(0) == 'tasks' || pods_url_variable(0) == 'how-do-i') { $defaults = array('smallest' => 12, 'largest' => 28, 'unit' => 'pt', 'number' => 90, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true); } $args = wp_parse_args($args, $defaults); global $wpdb; if ($cat_id != "") { $tquery = $wpdb->prepare("SELECT DISTINCT terms2.term_id as term_id, terms2.name as name, terms2.slug as link, t2.count as count, t2.term_taxonomy_id as term_taxonomy_id, 0 as term_group, 'post_tag' as taxonomy FROM {$wpdb->posts} as p1 LEFT JOIN {$wpdb->term_relationships} as r1 ON p1.ID = r1.object_ID LEFT JOIN {$wpdb->term_taxonomy} as t1 ON r1.term_taxonomy_id = t1.term_taxonomy_id LEFT JOIN {$wpdb->terms} as terms1 ON t1.term_id = terms1.term_id, {$wpdb->posts} as p2 LEFT JOIN {$wpdb->term_relationships} as r2 ON p2.ID = r2.object_ID LEFT JOIN {$wpdb->term_taxonomy} as t2 ON r2.term_taxonomy_id = t2.term_taxonomy_id LEFT JOIN {$wpdb->terms} as terms2 ON t2.term_id = terms2.term_id WHERE ( t1.taxonomy = '%s' AND p1.post_status = 'publish' AND p1.post_type = '%s' AND terms1.term_id = '%s' AND t2.taxonomy = 'post_tag' AND p2.post_status = 'publish' AND p1.ID = p2.ID ) ORDER BY t2.count desc limit 90", $tc_tax, $tc_post_type, $cat_id); } else { $tquery = $wpdb->prepare("SELECT DISTINCT terms2.term_id as term_id, terms2.name as name, terms2.slug as link, t2.count as count, t2.term_taxonomy_id as term_taxonomy_id, 0 as term_group, 'post_tag' as taxonomy FROM {$wpdb->posts} as p1 LEFT JOIN {$wpdb->term_relationships} as r1 ON p1.ID = r1.object_ID LEFT JOIN {$wpdb->term_taxonomy} as t1 ON r1.term_taxonomy_id = t1.term_taxonomy_id LEFT JOIN {$wpdb->terms} as terms1 ON t1.term_id = terms1.term_id, {$wpdb->posts} as p2 LEFT JOIN {$wpdb->term_relationships} as r2 ON p2.ID = r2.object_ID LEFT JOIN {$wpdb->term_taxonomy} as t2 ON r2.term_taxonomy_id = t2.term_taxonomy_id LEFT JOIN {$wpdb->terms} as terms2 ON t2.term_id = terms2.term_id WHERE ( t1.taxonomy = '%s' AND p1.post_status = 'publish' AND p1.post_type = '%s' AND t2.taxonomy = 'post_tag' AND p2.post_status = 'publish' AND p1.ID = p2.ID ) ORDER BY t2.count desc limit 90", $tc_tax, $tc_post_type); } if ($tc_post_type == 'projects') { $tquery = "\n\t\t\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t\t{$wpdb->terms}.term_id,\n\t\t\t\t\t\t{$wpdb->terms}.name,\n\t\t\t\t\t\t{$wpdb->terms}.slug,\n\t\t\t\t\t\t{$wpdb->term_taxonomy}.count,\n\t\t\t\t\t\t{$wpdb->term_taxonomy}.term_taxonomy_id,\n\t\t\t\t\t\t0 as term_group,\n\t\t\t\t\t\t'post_tag' as taxonomy\nFROM\t\t\t\t{$wpdb->posts}, {$wpdb->term_taxonomy}, {$wpdb->term_relationships}, {$wpdb->terms}\nWHERE\t\t\t\t{$wpdb->posts}.post_type = 'projects' AND\n\t\t\t\t\t{$wpdb->posts}.post_status = 'publish' AND\n\t\t\t\t\t{$wpdb->posts}.id = {$wpdb->term_relationships}.object_id AND\n\t\t\t\t\t{$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id AND\n\t\t\t\t\t{$wpdb->term_taxonomy}.taxonomy = 'post_tag' AND\n\t\t\t\t\t{$wpdb->terms}.term_id = {$wpdb->term_taxonomy}.term_id AND\n\t\t\t\t\t{$wpdb->term_taxonomy}.count > 0\n\t\t\t\t\tlimit 45\n\t\t\t\t\t\n\t\t\t\t\t\t"; } if ($tc_post_type == 'vacancies') { $tquery = "\n\t\t\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t\t{$wpdb->terms}.term_id,\n\t\t\t\t\t\t{$wpdb->terms}.name,\n\t\t\t\t\t\t{$wpdb->terms}.slug,\n\t\t\t\t\t\t{$wpdb->term_taxonomy}.count,\n\t\t\t\t\t\t{$wpdb->term_taxonomy}.term_taxonomy_id,\n\t\t\t\t\t\t0 as term_group,\n\t\t\t\t\t\t'post_tag' as taxonomy\nFROM\t\t\t\t{$wpdb->posts}, {$wpdb->term_taxonomy}, {$wpdb->term_relationships}, {$wpdb->terms}\nWHERE\t\t\t\t{$wpdb->posts}.post_type = 'vacancies' AND\n\t\t\t\t\t{$wpdb->posts}.post_status = 'publish' AND\n\t\t\t\t\t{$wpdb->posts}.id = {$wpdb->term_relationships}.object_id AND\n\t\t\t\t\t{$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id AND\n\t\t\t\t\t{$wpdb->term_taxonomy}.taxonomy = 'post_tag' AND\n\t\t\t\t\t{$wpdb->terms}.term_id = {$wpdb->term_taxonomy}.term_id AND\n\t\t\t\t\t{$wpdb->term_taxonomy}.count > 0\n\t\t\t\t\tlimit 45\n\t\t\t\t\t\n\t\t\t\t\t\t"; } if ($tc_post_type == 'event') { $tquery = "\n\t\t\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t\t{$wpdb->terms}.term_id,\n\t\t\t\t\t\t{$wpdb->terms}.name,\n\t\t\t\t\t\t{$wpdb->terms}.slug,\n\t\t\t\t\t\t{$wpdb->term_taxonomy}.count,\n\t\t\t\t\t\t{$wpdb->term_taxonomy}.term_taxonomy_id,\n\t\t\t\t\t\t0 as term_group,\n\t\t\t\t\t\t'post_tag' as taxonomy\nFROM\t\t\t\t{$wpdb->posts}, {$wpdb->term_taxonomy}, {$wpdb->term_relationships}, {$wpdb->terms}\nWHERE\t\t\t\t{$wpdb->posts}.post_type = 'event' AND\n\t\t\t\t\t{$wpdb->posts}.post_status = 'publish' AND\n\t\t\t\t\t{$wpdb->posts}.id = {$wpdb->term_relationships}.object_id AND\n\t\t\t\t\t{$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id AND\n\t\t\t\t\t{$wpdb->term_taxonomy}.taxonomy = 'post_tag' AND\n\t\t\t\t\t{$wpdb->terms}.term_id = {$wpdb->term_taxonomy}.term_id AND\n\t\t\t\t\t{$wpdb->term_taxonomy}.count > 0\n\t\t\t\t\tlimit 45\n\t\t\t\t\t\n\t\t\t\t\t\t"; } $tags = $wpdb->get_results($tquery); // $tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags //print_r($tags); if (empty($tags) || is_wp_error($tags)) { return; } foreach ($tags as $key => $tag) { $link = get_term_link(intval($tag->term_id), $tag->taxonomy); if (is_wp_error($link)) { return false; } $tags[$key]->link = $link; $tags[$key]->id = $tag->term_id; } $defaults = array('smallest' => 12, 'largest' => 24, 'unit' => 'pt', 'number' => 0, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'topic_count_text_callback' => 'default_topic_count_text', 'topic_count_scale_callback' => 'default_topic_count_scale', 'filter' => 1); if (!isset($args['topic_count_text_callback']) && isset($args['single_text']) && isset($args['multiple_text'])) { $body = 'return sprintf ( _n(' . var_export($args['single_text'], true) . ', ' . var_export($args['multiple_text'], true) . ', $count), number_format_i18n( $count ));'; $args['topic_count_text_callback'] = create_function('$count', $body); } $args = wp_parse_args($args, $defaults); extract($args); if (empty($tags)) { return; } $tags_sorted = apply_filters('tag_cloud_sort', $tags, $args); if ($tags_sorted != $tags) { // the tags have been sorted by a plugin $tags = $tags_sorted; unset($tags_sorted); } else { if ('RAND' == $order) { shuffle($tags); } else { // SQL cannot save you; this is a second (potentially different) sort on a subset of data. if ('name' == $orderby) { uasort($tags, '_wp_object_name_sort_cb'); } else { uasort($tags, '_wp_object_count_sort_cb'); } if ('DESC' == $order) { $tags = array_reverse($tags, true); } } } if ($number > 0) { $tags = array_slice($tags, 0, $number); } $counts = array(); $real_counts = array(); // For the alt tag foreach ((array) $tags as $key => $tag) { $real_counts[$key] = $tag->count; $counts[$key] = $topic_count_scale_callback($tag->count); } $min_count = min($counts); $spread = max($counts) - $min_count; if ($spread <= 0) { $spread = 1; } $font_spread = $largest - $smallest; if ($font_spread < 0) { $font_spread = 1; } $font_step = $font_spread / $spread; $a = array(); $colors = 6; foreach ($tags as $key => $tag) { $count = $counts[$key]; $real_count = $real_counts[$key]; $pstyp = ''; if (pods_url_variable(1) == 'projects') { $pstyp = '?posttype=projects'; } if (pods_url_variable(1) == 'vacancies') { $pstyp = '?posttype=vacancies'; } if (pods_url_variable(0) == 'task-by-category') { $pstyp = '?posttype=task'; } if (pods_url_variable(0) == 'news-by-category') { $pstyp = '?posttype=news'; } if (pods_url_variable(0) == 'tasks') { $pstyp = '?posttype=task'; } if (pods_url_variable(0) == 'how-do-i') { $pstyp = '?posttype=task'; } if (pods_url_variable(0) == 'newspage') { $pstyp = '?posttype=news'; } $tag_link = '#' != $tag->link ? esc_url($tag->link) . $pstyp : '#'; $tag_id = isset($tags[$key]->id) ? $tags[$key]->id : $key; $tag_name = $tags[$key]->name; $min_color = "#5679b9"; $max_color = "#af1410"; $color = round($smallest + ($count - $min_count) * $font_step - ($smallest - 1)); $basecol = HTMLToRGB('#3a6f9e'); $scolor = ChangeLuminosity($basecol, 60 - $color * 3.3); $scolor = RGBToHTML($scolor); $class = 'color-' . round($smallest + ($count - $min_count) * $font_step - ($smallest - 1)); $tag_link = explode("/", $tag_link); $tag_link = $tag_link[4]; $a[] = "<a href='" . site_url() . "/tagged/?tag=" . $tag_link . "' style='font-size: " . str_replace(',', '.', $smallest + ($count - $min_count) * $font_step) . "{$unit}; color: " . $scolor . ";'>{$tag_name}</a>"; } $return = join($separator, $a); return apply_filters('wp_generate_tag_cloud', $return, $tags, $args); }
function govintranet_custom_styles() { $custom_css = ""; // write custom css for background header colour $bg = get_theme_mod('link_color', '#428bca'); $custom_css .= "\n\t\ta, a .listglyph {\n\t\tcolor: " . $bg . ";\n\t\t}\n\t\t"; $bg = get_theme_mod('link_visited_color', '#7303aa'); $custom_css .= "\n\t\ta:visited, a:visited .listglyph {\n\t\tcolor: " . $bg . ";\n\t\t}\n\t\t"; $gisheight = get_option('options_widget_border_height'); if (!$gisheight) { $gisheight = 7; } $gis = "options_header_background"; $gishex = get_theme_mod('header_background', '#0b2d49'); if (substr($gishex, 0, 1) != "#") { $gishex = "#" . $gishex; } if ($gishex == "#") { $gishex = "#0b2d49"; } $custom_css .= "\n\t\t.custom-background {\n\t\tbackground-color: " . $gishex . ";\n\t\t}\n\t\t"; $headtext = get_theme_mod('header_textcolor', '#ffffff'); if (substr($headtext, 0, 1) != "#") { $headtext = "#" . $headtext; } if ($headtext == "#") { $headtext = "#ffffff"; } $headimage = get_theme_mod('header_image', ''); $basecol = HTMLToRGB(substr($gishex, 1, 6)); $topborder = ChangeLuminosity($basecol, 33); // set bar colour // if using automatic complementary colour then convert header color // otherwise use specified colour $giscc = get_option('options_enable_automatic_complementary_colour'); if ($giscc) { $giscc = RGBToHTML($topborder); } elseif (get_option('options_complementary_colour')) { $giscc = get_option('options_complementary_colour'); } else { $giscc = $gishex; } if ($headimage != 'remove-header') { $custom_css .= "\n\t\t\t#topstrip {\n\t\t\tbackground: " . $gishex . " url(" . get_header_image() . ");\n\t\t\tcolor: " . $headtext . ";\n\t\t\t}\n\t\t\t"; } else { $custom_css .= "\n\t\t\t#topstrip {\n\t\t\tbackground: " . $gishex . ";\n\t\t\tcolor: " . $headtext . ";\n\t\t\t}\n\t\t\t"; } $custom_css .= "\n\t\t@media only screen and (max-width: 767px) {\n\t\t\t#masthead {\n\t\t\tbackground: " . $gishex . " !important;\n\t\t\tcolor: " . $headtext . ";\n\t\t\tpadding: 0 1em;\n\t\t\t}\n\t\t\t#primarynav ul li a {\n\t\t\tbackground: " . $gishex . ";\n\t\t\tcolor: " . $headtext . ";\n\t\t\t}\t\n\t\t\t#primarynav ul li a:hover {\n\t\t\tcolor: " . $gishex . " !important;\n\t\t\tbackground: " . $headtext . ";\n\t\t\t}\t\n\t\t}\n\t\t"; $custom_css .= "\n\t\t.btn-primary, .btn-primary a {\n\t\tbackground: " . $giscc . ";\n\t\tborder: 1px solid " . $giscc . ";\n\t\tcolor: " . $headtext . ";\n\t\t}\n\t\t"; $custom_css .= "\n\t\t.btn-primary a:hover {\n\t\tbackground: " . $gishex . ";\n\t\t}\n\t\t"; $custom_css .= "\n\t\t#topstrip a {\n\t\tcolor: " . $headtext . ";\n\t\t}\n\t\t"; $custom_css .= "\n\t\t#utilitybar ul#menu-utilities li a, #menu-utilities {\n\t\tcolor: " . $headtext . ";\n\t\t}\n\t\t"; $custom_css .= "\n\t\t#footerwrapper {"; $custom_css .= "border-top: " . $gisheight . "px solid " . $giscc . ";"; $custom_css .= "}"; $custom_css .= "\n\t\t.page-template-page-about-php .category-block h2 {"; $custom_css .= "border-top: " . $gisheight . "px solid " . $giscc . ";"; $custom_css .= "padding: 0.6em 0;\n\t\t}\n\t\t"; $custom_css .= "\n\t\t.home.page .category-block h3 {\n\t\t\tborder-bottom: 3px solid " . $gishex . ";\n\t\t}\n\t\t.h3border {\n\t\tborder-bottom: 3px solid " . $gishex . ";\n\t\t}\n\t\t"; $custom_css .= "\n\t\t#content .widget-box {\n\t\tpadding: .1em 0 .7em 0;\n\t\tfont-size: .9em;\n\t\tbackground: #fff;"; $custom_css .= "border-top: " . $gisheight . "px solid " . $giscc . ";"; $custom_css .= "margin-top: .7em;\n\t\t}\n\t\t"; $custom_css .= "\n\t\t.home.page .category-block h3 {"; $custom_css .= "border-top: " . $gisheight . "px solid " . $giscc . ";"; $custom_css .= "border-bottom: none;\n\t\tpadding-top: 16px;\n\t\tmargin-top: 16px;\n\t\t}\n\t\t"; $directorystyle = get_option('options_staff_directory_style'); // 0 = squares, 1 = circles if ($directorystyle) { $custom_css .= "\n\t\t\t.bbp-user-page.single #bbp-user-avatar img.avatar {\n\t\t\t\tborder-radius: 50%;\n\t\t\t}\n\t\t\t"; } $custom_css .= "\n\t\t.bbp-user-page .panel-heading {"; $custom_css .= "border-top: " . $gisheight . "px solid " . $giscc . ";"; $custom_css .= "\n\t\t}\n\t\t"; $custom_css .= "\n\t\t.page-template-page-news-php h1 {\n\t\tborder-bottom: " . $gisheight . "px solid " . $giscc . ";\n\t\t} \n\t\t.tax-team h2 {\n\t\tborder-bottom: " . $gisheight . "px solid " . $giscc . ";\n\t\t} \n\t\t"; //write custom css for logo $gisid = get_option('options_header_logo'); $gislogow = wp_get_attachment_image_src($gisid); $gislogo = $gislogow[0]; $gisw = $gislogow[1] + 10; $custom_css .= "\n\t\t#crownlink {\n\t\tbackground: url('" . $gislogo . "') no-repeat;\t \n\t\tbackground-position:left 10px;\n\t\tpadding: 16px 0 0 " . $gisw . "px;\n\t\theight: auto;\n\t\tmin-height: 50px;\n\t\tmargin-bottom: 0.6em;\n\t\t}\n\t\t"; $custom_css .= "\n\t\t#primarynav ul li {\n\t\tborder-bottom: 1px solid " . $gishex . ";\n\t\tborder-top: 1px solid " . $gishex . ";\n\t\tborder-right: 1px solid " . $gishex . ";\n\t\t}\n\t\t#primarynav ul li:last-child, #primarynav ul li.last-link {\n\t\tborder-right: 1px solid " . $gishex . ";\n\t\t}\n\n\t\t#primarynav ul li:first-child, #primarynav ul li.first-link {\n\t\tborder-left: 1px solid " . $gishex . ";\n\t\t}\n\n\t\t#searchformdiv button:hover { background: " . $gishex . "; color: " . $headtext . "; }\n\t\t"; $custom_css .= "a.wptag {color: " . $headtext . "; background: " . $gishex . ";} \n"; $custom_css .= "a.:visited.wptag {color: " . $headtext . "; background: " . $gishex . ";} \n"; if ($headimage != 'remove-header' && $headimage) { $custom_css .= '#utilitybar ul#menu-utilities li a, #menu-utilities, #crownlink { text-shadow: 1px 1px #333; }'; } $terms = get_terms('category', array('hide_empty' => false)); if ($terms) { foreach ((array) $terms as $taxonomy) { $themeid = $taxonomy->term_id; $themeURL = $taxonomy->slug; $background = get_option('category_' . $themeid . '_cat_background_colour'); $foreground = get_option('category_' . $themeid . '_cat_foreground_colour'); $custom_css .= "button.btn.t" . $themeid . ", a.btn.t" . $themeid . " {color: " . $foreground . "; background: " . $background . "; border: 1px solid " . $background . ";} \n"; $custom_css .= ".cattagbutton a.btn.t" . $themeid . ", a.btn.t" . $themeid . " {color: " . $foreground . "; background: " . $background . "; border-bottom: 3px solid #000; border-radius: 3px; } \n"; $custom_css .= ".cattagbutton a:hover.btn.t" . $themeid . ", a.btn.t" . $themeid . " {color: " . $foreground . "; background: " . $background . "; border-bottom: 3px solid #000; border-radius: 3px; } \n"; $custom_css .= ".category-block .t" . $themeid . ", .category-block .t" . $themeid . " a {color: " . $foreground . "; background: " . $background . "; border: 1px solid " . $background . "; width: 100%; padding: 0.5em; } \n"; $custom_css .= "button:hover.btn.t" . $themeid . ", a:hover.btn.t" . $themeid . "{color: white; background: #333; border: 1px solid " . $background . ";} \n"; $custom_css .= "a.t" . $themeid . "{color: " . $foreground . "; background: " . $background . ";} \n"; $custom_css .= "a.t" . $themeid . " a {color: " . $foreground . " !important;} \n"; $custom_css .= ".brd" . $themeid . "{border-left: 1.2em solid " . $background . ";} \n"; $custom_css .= ".hr" . $themeid . "{border-bottom: 1px solid " . $background . ";} \n"; $custom_css .= ".h1_" . $themeid . "{border-bottom: " . $gisheight . "px solid " . $background . "; margin-bottom: 0.4em; padding-bottom: 0.3em;} \n"; $custom_css .= ".b" . $themeid . "{border-left: 20px solid " . $background . ";} \n"; $custom_css .= ".dashicons.dashicons-category.gb" . $themeid . "{color: " . $background . ";} \n"; $custom_css .= "a:visited.wptag.t" . $themeid . "{color: " . $foreground . ";} \n"; } } $giscss = get_option('options_custom_css_code'); $custom_css .= $giscss; $jumbo_searchbox = get_option("options_search_jumbo_searchbox", false); if ($jumbo_searchbox) { $custom_css .= "\t\t\n\t\t#headsearch { padding-right: 0; }\n\t\t#searchformdiv.altsearch { padding: 1.75em 6em 1.75em 6em; background: " . $giscc . "; }\n\t\t#searchformdiv.altsearch button.btn.btn-primary { background: " . $gishex . "; color: white; }\n\t\t#searchformdiv.altsearch button.btn.btn-primary:hover { background-color: #eee; color: black; }\n\t\t"; } if (get_option("options_staff_directory_style") && get_option("options_forum_support")) { $custom_css .= "#bbpress-forums img.avatar { border-radius: 50%; }"; } $styleurl = get_stylesheet_directory_uri() . '/css/custom.css'; wp_enqueue_style('govintranet_custom_styles', $styleurl); wp_add_inline_style('govintranet_custom_styles', $custom_css); }
/* Custom CSS rules below: */ <?php $gis = "general_intranet_custom_css_code"; $giscss = get_option($gis); echo $giscss; $gis = "general_intranet_enable_automatic_complementary_colour"; $giscc = get_option($gis); // write custom css for background header colour $gis = "general_intranet_widget_border_height"; $gisheight = get_option($gis); if (!$gisheight) { $gisheight = 7; } $gis = "general_intranet_header_background"; $gishex = get_option($gis); $basecol = HTMLToRGB($gishex); $topborder = ChangeLuminosity($basecol, 33); echo "\n\t\t#topstrip {\n\t\tbackground: " . $gishex . ";\n\t\t}\n\t\t"; echo "\n\t\t#footerwrapper {"; if ($giscc == 1) { echo "border-top: " . $gisheight . "px solid " . RGBToHTML($topborder) . ";"; } else { echo "border-top: " . $gisheight . "px solid " . $gishex . ";"; } echo "}"; echo "\n\t\t.page-template-page-about-php .category-block h2 {"; if ($giscc == 1) { echo "border-top: " . $gisheight . "px solid " . RGBToHTML($topborder) . ";"; } else { echo "border-top: " . $gisheight . "px solid " . $gishex . ";"; }
if ($rows_aff > 0) { $available[$c] = 0; $row = mysql_fetch_assoc($result2); $reason[$c] = $row['Reden']; } } $query3 = "SELECT KleurInBIS FROM roeigraden WHERE Roeigraad='{$grade}';"; $result3 = mysql_query($query3); if (!$result3) { die("Ophalen van kleuren mislukt." . mysql_error()); } else { $row3 = mysql_fetch_assoc($result3); $bgcolor = $row3['KleurInBIS']; // Check for dark colors $colour = $bgcolor; $rgb = HTMLToRGB($colour); $hsl = RGBToHSL($rgb); $toodark = ''; if ($hsl->lightness < 140) { $toodark = true; } } echo "<tr class='header-column-row'><th "; if ($available[$c] && InRange($date_to_show, 10)) { echo "onclick=\"showInschrijving(0, " . $boat_ids_array[$c] . ", '" . $date_to_show . "', '" . str_replace(' ', '%20', $cat_to_show) . "', '" . $grade_to_show . "', '" . $start_time_to_show . "');\" bgcolor=\"" . $bgcolor . "\" " . ($toodark == true ? 'class="too-dark"' : "") . ">"; } else { echo " bgcolor=\"" . $bgcolor . "\" " . ($toodark == true ? 'class="too-dark"' : "") . ">"; } echo "<div>{$boats_array[$c]}</div></th>"; echo "<td class='text-center " . ($toodark == true ? 'too-dark' : "") . "' bgcolor=\"" . $bgcolor . "\">{$weight} kg</td>"; echo "<td class='text-center " . ($toodark == true ? 'too-dark' : "") . "' bgcolor=\"" . $bgcolor . "\">{$type}</td>";
function isDarkColor($color) { global $conf; $lightness_swap = empty($conf->global->FULLCALENDAR_LIGTHNESS_SWAP) ? 150 : $conf->global->FULLCALENDAR_LIGTHNESS_SWAP; $rgb = HTMLToRGB($color); $hsl = RGBToHSL($rgb); return $hsl->lightness < $lightness_swap ? 1 : 0; }
$gishex = get_theme_mod('header_background', '#0b2d49'); if (substr($gishex, 0, 1) != "#") { $gishex = "#" . $gishex; } if ($gishex == "#") { $gishex = "#0b2d49"; } $headtext = get_theme_mod('header_textcolor', '#ffffff'); if (substr($headtext, 0, 1) != "#") { $headtext = "#" . $headtext; } if ($headtext == "#") { $headtext = "#ffffff"; } $headimage = get_theme_mod('header_image', ''); $basecol = HTMLToRGB(substr($gishex, 1, 6)); $topborder = ChangeLuminosity($basecol, 33); // set bar colour // if using automatic complementary colour then convert header color // otherwise use specified colour $giscc = get_option('options_enable_automatic_complementary_colour'); if ($giscc) { $giscc = RGBToHTML($topborder); } elseif (get_option('options_complementary_colour')) { $giscc = get_option('options_complementary_colour'); } else { $giscc = $gishex; } if ($headimage != 'remove-header') { echo "\n\t\t\t#topstrip {\n\t\t\tbackground: " . $gishex . " url(" . get_header_image() . ");\n\t\t\tcolor: " . $headtext . ";\n\t\t\t}\n\t\t\t"; } else {