/*
Plugin Name: Ultimate tag cloud widget
Plugin URI: http://bennison.se/?page_id=173
Description: This plugin aims to be the most configurable tag cloud widget out there, able to suit all your wierd tag cloud needs.
Version: 1.1
Author: Rickard Andersson
Author URI: http://bennison.se
*/
/**
* Ultimate tag cloud widget class
* @package UTCW
*/
class UTCW extends WP_Widget {
// Default values if the widget isn't configured properly
private $default_title = "Tag Cloud";
private $default_order = "alphabetically";
private $default_size_from = 10;
private $default_size_to = 30;
private $default_max = 45;
private $default_taxonomy = "post_tag";
private $default_reverse = false;
private $default_color = "none";
private $default_letter_spacing = "normal";
private $default_word_spacing = "normal";
private $default_case = "off";
// Allowed values for miscellanious options in the widget
private $allowed_orders = array('random', 'alphabetically', 'count');
private $allowed_taxonomys = array('post_tag', 'category');
private $allowed_colors = array('none', 'random', 'set', 'span');
private $allowed_cases = array('lowercase', 'uppercase', 'capitalize', 'off');
/**
* Constructor
* @return void
*/
function UTCW() {
$options = array('description' => __("Highly configurable tag cloud"));
parent::WP_Widget(false, __('Ultimate Tag Cloud'), $options);
}
/**
* Action handler for the form in the admin panel
* @param array $new_instance
* @param array $old_instance
* @retrn array
*/
function update($new_instance, $old_instance) {
extract($new_instance);
// Check all input values and set the default value if any value is invalid or empty
$instance = $old_instance;
$instance['title'] = strlen($title) > 0 ? apply_filters('widget_title', $title) : apply_filters('widget_title', $this->default_title);
$instance['size_from'] = is_numeric($size_from) ? $size_from : $this->default_size_from;
$instance['size_to'] = is_numeric($size_to) ? $size_to : $this->default_size_to;
$instance['max'] = is_numeric($max) ? $max : $this->default_max;
$instance['letter_spacing'] = is_numeric($letter_spacing) ? $letter_spacing : $this->default_letter_spacing;
$instance['word_spacing'] = is_numeric($word_spacing) ? $word_spacing : $this->default_word_spacing;
$instance['reverse'] = $reverse == "on" ? true : false;
$instance['exclude'] = strlen($exclude) > 0 ? @explode(",", $exclude) : array();
$instance['color_set'] = strlen($color_set) > 0 ? @explode(",", $color_set) : array();
$instance['authors'] = array();
$instance['color_span_from'] = preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $color_span_from) > 0 ? $color_span_from : "";
$instance['color_span_to'] = preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $color_span_to) > 0 ? $color_span_to : "";
$instance['taxonomy'] = in_array($taxonomy, $this->allowed_taxonomys) ? $taxonomy : $this->default_taxonomy;
$instance['order'] = in_array($order, $this->allowed_orders) ? $order : $this->default_order;
$instance['color'] = in_array($color, $this->allowed_colors) ? $color : $this->default_color;
$instance['case'] = in_array($case, $this->allowed_cases) ? $case : $this->default_case;
// Only accept numeric authors (user ID)
if (is_array($authors)) {
foreach ($authors as $author) {
if (is_numeric($author)) {
$instance['authors'][] = $author;
}
}
}
// Remove spaces in the comma separated list
foreach ($instance['exclude'] as $key => $value) {
$instance['exclude'][$key] = trim($value);
}
// Only allow hexadecimal color values in the format #ffffff and #fff
foreach ($instance['color_set'] as $key => $color) {
if (preg_match('/#([a-f0-9]{6}|[a-f0-9]{3})/i', $color) == 0) {
unset($instance['color_set'][$key]);
}
}
return $instance;
}
/**
* Function for displaying the widget on the page
* @param array $args
* @param array $instance
* @return void
*/
function widget($args, $instance) {
global $wpdb;
extract($args);
extract($instance);
// Parse settings from $instance and set default values where empty or invalid
$title = strlen($title) > 0 ? $title : $this->default_title;
$size_from = is_numeric($size_from) ? $size_from : $this->default_size_from;
$size_to = is_numeric($size_to) ? $size_to : $this->default_size_to;
$max = is_numeric($max) ? $max : $this->default_max;
$reverse = is_bool($reverse) ? $reverse : $this->default_reverse;
$authors = is_array($authors) ? $authors : array();
$exclude = is_array($exclude) ? $exclude : array();
$color_set = is_array($color_set) ? $color_set : array();
$letter_spacing = is_numeric($letter_spacing) ? $letter_spacing . "px" : $this->default_letter_spacing;
$word_spacing = is_numeric($word_spacing) ? $word_spacing . "px" : $this->default_word_spacing;
$color_span_from = is_string($color_span_from) ? $color_span_from : "";
$color_span_to = is_string($color_span_to) ? $color_span_to : "";
$order = in_array($order, $this->allowed_orders) ? $order : $this->default_order;
$taxonomy = in_array($taxonomy, $this->allowed_taxonomys) ? $taxonomy : $this->default_taxonomy;
$color = in_array($color, $this->allowed_colors) ? $color : $this->default_color;
$case = in_array($case, $this->allowed_cases) ? $case : $this->default_case;
// Fallback values
$counts = array();
$tag_array = array();
// Build SQL query
$q = "SELECT t.term_id, t.name, t.slug, COUNT(tr.term_taxonomy_id) AS `count` ";
$q .= "FROM `$wpdb->posts` AS p ";
$q .= "LEFT JOIN `$wpdb->term_relationships` AS tr ON tr.object_id = p.ID ";
$q .= "LEFT JOIN `$wpdb->terms` AS t ON t.term_id = tr.term_taxonomy_id ";
$q .= "LEFT JOIN `$wpdb->term_taxonomy` AS tt ON tt.term_id = t.term_id ";
$q .= "WHERE tt.taxonomy = '$taxonomy' ";
if (count($authors) > 0) {
$q .= "AND post_author IN (" . implode(",", $authors) . ") ";
}
if (count($exclude) > 0) {
$q .= "AND t.name NOT IN ('" . implode("', '", $exclude) . "') ";
}
$q .= "GROUP BY t.term_id ";
$q .= "ORDER BY COUNT(tr.term_taxonomy_id) DESC ";
$q .= "LIMIT $max;";
$tag_data = $wpdb->get_results($q);
if (count($tag_data) > 0) {
// Extract counts and create an array to work with
foreach ($tag_data as $tag) {
$counts[] = $tag->count;
$tag_array[] = array(
'term_id' => $tag->term_id,
'count' => $tag->count,
'slug' => $tag->slug,
'name' => $tag->name,
'link' => get_term_link(intval($tag->term_id), $taxonomy),
'color' => ""
);
}
// Highest and lowest values
$min_count = min($counts);
$max_count = max($counts);
// Get the step size
$font_step = $this->calc_step($min_count, $max_count, $size_from, $size_to);
// Calculate sizes for all tags
foreach ($tag_array as $key => $tag) {
$tag_array[$key]['size'] = $size_from + ( ( $tag['count'] - $min_count ) * $font_step );
}
// Check the coloring preference, default is none
switch ($color) {
// Just get an randomized value, who would ever use this?!
case "random":
foreach ($tag_array as $key => $tag) {
$tag_array[$key]['color'] = sprintf("#%s%s%s", dechex(rand() % 255), dechex(rand() % 255), dechex(rand() % 255));
}
break;
// Select a random value from the preset colors
case "set":
if (is_array($color_set) && count($color_set) > 0) {
foreach ($tag_array as $key => $tag) {
$tag_array[$key]['color'] = $color_set[ array_rand($color_set) ];
}
}
break;
// Calculate colors in a span between two values
case "span":
// Check the color format, #fff or #fffff
if (strlen($color_span_from) == 4) {
$red_from = hexdec(sprintf("%s%s", $color_span_from[1], $color_span_from[1]));
$green_from = hexdec(sprintf("%s%s", $color_span_from[2], $color_span_from[2]));
$blue_from = hexdec(sprintf("%s%s", $color_span_from[3], $color_span_from[3]));
} else {
$red_from = hexdec(substr($color_span_from, 1, 2));
$green_from = hexdec(substr($color_span_from, 3, 2));
$blue_from = hexdec(substr($color_span_from, 5, 2));
}
if (strlen($color_span_to) == 4) {
$red_to = hexdec(sprintf("%s%s", $color_span_to[1], $color_span_to[1]));
$green_to = hexdec(sprintf("%s%s", $color_span_to[2], $color_span_to[2]));
$blue_to = hexdec(sprintf("%s%s", $color_span_to[3], $color_span_to[3]));
} else {
$red_to = hexdec(substr($color_span_to, 1, 2));
$green_to = hexdec(substr($color_span_to, 3, 2));
$blue_to = hexdec(substr($color_span_to, 5, 2));
}
// Calculate steps for all the colors.
$red_step = $this->calc_step($min_count, $max_count, $red_from, $red_to);
$green_step = $this->calc_step($min_count, $max_count, $green_from, $green_to);
$blue_step = $this->calc_step($min_count, $max_count, $blue_from, $blue_to);
// Iterate all tags and calculate their color
foreach ($tag_array as $key => $tag) {
$red = round($red_from + ( ( $tag['count'] - $min_count ) * $red_step ));
$green = round($green_from + ( ( $tag['count'] - $min_count ) * $green_step ));
$blue = round($blue_from + ( ( $tag['count'] - $min_count ) * $blue_step ));
$tag_array[$key]['color'] = sprintf("rgb(%s,%s,%s)", $red, $green, $blue);
}
break;
}
// Check the ordering preference, default is alphabetically
switch ($order) {
case "random":
shuffle($tag_array);
break;
case "count":
usort($tag_array, 'utcw_cmp_count');
break;
default:
usort($tag_array, 'utcw_cmp_name');
break;
}
// Reverse the list if the user prefers it that way. Reversing an random sorted result seems correct.
if ($reverse === true) {
$tag_array = array_reverse($tag_array);
}
}
switch ($case) {
case 'uppercase':
$text_transform = 'text-transform: uppercase;';
break;
case 'lowercase':
$text_transform = 'text-transform: lowercase;';
break;
case 'capitalize':
$text_transform = 'text-transform: capitalize;';
break;
}
// Print the tag cloud content
echo $before_widget;
echo $before_title . $title . $after_title;
printf('
";
echo $after_widget;
}
/**
* Function for handling the widget control in admin panel
* @param array $instance
* @return void
*/
function form($instance) {
// Get stored preferences
$title = esc_attr($instance['title']);
$order = esc_attr($instance['order']);
$size_from = esc_attr($instance['size_from']);
$size_to = esc_attr($instance['size_to']);
$max = esc_attr($instance['max']);
$taxonomy = esc_attr($instance['taxonomy']);
$color = esc_attr($instance['color']);
$color_span_from = esc_attr($instance['color_span_from']);
$color_span_to = esc_attr($instance['color_span_to']);
$letter_spacing = esc_attr($instance['letter_spacing']);
$word_spacing = esc_attr($instance['word_spacing']);
$case = esc_attr($instance['case']);
$exclude = $instance['exclude'];
$reverse = $instance['reverse'];
$authors = $instance['authors'];
$color_set = $instance['color_set'];
// Fallbacks
if (!is_array($authors)) {
$authors = array();
}
if (!is_array($exclude)) {
$exclude = array();
}
if (!is_array($color_set)) {
$color_set = array();
}
// Content of the widget settings form
?>
_e("Authors:"); ?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
ID, $authors, true) ? 'checked="checked"' : "" ?> />
=$user->user_login?>
_e("Order:"); ?>
/>
/>
/>
/>
>
>
" />
_e("Title:") ?>
onclick="javascript:utcw_change()" />
onclick="javascript:utcw_change()" />
onclick="javascript:utcw_change()" />
>
" />
onclick="javascript:utcw_change()" />
>
/>
/>
/>
/>
}
/**
* Used to calculate how step size in spanning values
* @param integer $min
* @param integer $max
* @param integer $from
* @param integer $to
* @return integer
*/
private function calc_step($min, $max, $from, $to) {
// Thank you wordpress for this
$spread = $max - $min;
if ( $spread <= 0 )
$spread = 1;
$font_spread = $to - $from;
if ( $font_spread < 0 && $negative === false)
$font_spread = 1;
$step = $font_spread / $spread;
return $step;
}
}
// Register widget with wordpress
add_action('widgets_init', create_function('', 'return register_widget("UTCW");'));
//Register scripts and css with wordpress
wp_register_script('utcw-js', '/wp-content/plugins/ultimate-tag-cloud-widget/utcw.js', array('jquery'), rand(), false);
wp_register_style('utcw-css', '/wp-content/plugins/ultimate-tag-cloud-widget/utcw.css', array(), rand(), 'all');
/**
* Action handler for wordpress init used to attach scripts and styles
* @return void
*/
function utcw_init() {
wp_enqueue_script('utcw-js');
wp_enqueue_style('utcw-css');
}
add_action('init', 'utcw_init');
/**
* Compare function for sorting by count
* @param array $a
* @param array $b
* @return integer
*/
function utcw_cmp_count($a, $b) {
if ($a['count'] == $b['count']) {
return 0;
} else{
return ($a['count'] < $b['count']) ? -1 : 1;
}
}
/**
* Compare function for sorting by name
* @param array $a
* @param array $b
* @return integer
*/
function utcw_cmp_name($a, $b) {
return strcasecmp($a['name'], $b['name']);
}
Causas y síntomas de colesterol y de Consejos y Técnicas para la Reducción de colesterol Publicado por: Dr. Carlos Buchar | Perlas De Salud
Lea más sobre los remedios caseros para el colesterol y reducir el colesterol elevado y también visitar el Suplemento a base de plantas para reducir el nivel de colesterol
Signos y síntomas
Los niveles elevados de colesterol en el cuerpo como tal no producen síntomas o signos principales, sino que conduce al desarrollo de trastornos graves como enfermedad cardíaca aterosclerótica, la hipertensión, enfermedad vascular periférica, los cálculos biliares, etc bloqueo de las arterias coronarias en el corazón por la deposición de colesterol conduce a la insuficiencia coronaria, isquemia (disminución del suministro de oxígeno a los músculos del corazón) y esto se traduce finalmente en el infarto de miocardio (ataque al corazón). El colesterol constituye una gran parte del tipo más frecuente de los cálculos biliares. Los niveles muy altos de plomo de colesterol a los cambios de la piel como xanthelesma cerca de los ojos. La ausencia de síntomas hasta que las complicaciones ocurren precisan un control periódico de los perfiles de lípidos en todos los individuos.
Los alimentos que reducen el colesterol
Entonces, ¿qué son los alimentos que deben comer y cuáles debe evitar, para mantener a raya el colesterol alto? Éstos son algunos consejos:
1. Una dieta rica en fibra por lo general ayuda a mantener el colesterol normal, aparte de sus otros beneficios a los intestinos. Hacer pan de trigo integral, harina de avena, granos enteros, en bruto (bien lavadas) frutas y verduras y ensaladas una parte importante de su dieta . Por ejemplo, la avena es rica en fibra. Estos se unen a los ácidos biliares que contienen colesterol antes de que llegue la sangre, por lo que este lavado de colesterol del cuerpo, sin dejar que entrar en el torrente sanguíneo.
2. la inclusión diaria de legumbres y lentejas en la dieta es algo que los indios están familiarizados. Estos también proporcionan fibra. Trate de consumir lentejas y coles de todos los días. Haga clic aquí para ver algunas recetas fáciles de lentejas
3. Evite los alimentos chatarra y los alimentos procesados, ya que estos son ricos en trans y aumentar el colesterol malo. Por la misma razón, evitar comiendo patatas fritas y otros alimentos fritos para frenar el hambre. En su lugar, se trata de una idea mejor para comer – con moderación – en frutos secos como almendras y nueces. Estos proporcionan ácidos grasos esenciales, que han demostrado ser beneficiosos.
4. Pescados como el salmón o la caballa contienen Omega 3 ácidos grasos. Estos también son buenos para el corazón. Haz que una parte de su dieta (sin freír) si usted es un no-vegetariano.
5. Si usted es un no-vegetariano, trate de evitar las carnes rojas como el cordero, carne de res, cerdo, etc carne magra y pollo son mejores opciones. Elija siempre la carne a la parrilla sobre la carne fritos para evitar que la ingesta de grasa extra.
6. Los huevos se consumen con moderación en la dieta no parece causar un aumento de colesterol en la sangre como se creía antes. Un huevo al día es aceptable en la dieta, siempre y cuando se tenga cuidado que el resto de la dieta es baja en grasas saturadas.
7. Hierbas y especias como el ajo, clavo de olor, jengibre, cúrcuma, romero y no sólo ayudan a dar sabor a los alimentos, pero muchos de ellos también ofrecen beneficios para reducir el colesterol.
Postes relacionados:
Loading
Deja un comentario
Tienes que iniciar sesión para escribir un comentario.