if ($respect_expiration) { $args['meta_query'] = $this->ExpirationDate->get_meta_query(); } $banners_query = new WP_Query( $args ); $banner = !empty($banners_query->posts) ? $banners_query->posts[0] : false; return $banner; } function get_banners_by_atts($atts) { $args = array( 'posts_per_page' => $atts['count'], 'orderby' => 'rand', 'post_type'=> 'banner', 'banner_groups' => $atts['group'], 'nopaging' => ($atts['count'] == '-1'), // turn paging off posts_per_page is unlimited 'meta_query' => $this->ExpirationDate->get_meta_query() ); $banners_query = new WP_Query( $args ); $banners = !empty($banners_query->posts) ? $banners_query->posts : array(); return $banners; } function buildBannerHTML($banner, $banner_id, $atts) { if($banner_id == ''){ $banner_id = $banner->ID; } $post_thumbnail_id = get_post_thumbnail_id( $banner_id ); $cta = $this->get_option_value($banner_id, 'cta_text', ''); $target_url = $this->get_option_value($banner_id, 'target_url', '#'); $css_class = $this->get_option_value($banner_id, 'css_class', ''); $use_big_link = isset($atts['link_entire_banner']) ? $atts['link_entire_banner'] : get_option('custom_banners_use_big_link'); $open_in_window = isset($atts['open_link_in_new_window']) ? $atts['open_link_in_new_window'] : get_option('custom_banners_open_link_in_new_window'); $show_captions = isset($atts['show_caption']) ? $atts['show_caption'] : !get_option('custom_banners_never_show_captions', 0); $show_cta_buttons = isset($atts['show_cta_button']) ? ($atts['show_cta_button'] == 1) : !get_option('custom_banners_never_show_cta_buttons', 0); $width = isset($atts['width']) ? $atts['width'] : 'auto'; $height = isset($atts['height']) ? $atts['height'] : 'auto'; $banner_width = isset($atts['banner_width']) ? $atts['banner_width'] : 'auto'; $banner_width_px = !empty($atts['banner_width_px']) && intval($atts['banner_width_px']) > 0 ? intval($atts['banner_width_px']) : ''; $banner_height = isset($atts['banner_height']) ? $atts['banner_height'] : 'auto'; $banner_height_px = !empty($atts['banner_height_px']) && intval($atts['banner_height_px']) > 0 ? intval($atts['banner_height_px']) : ''; $theme = isset($atts['theme']) ? $atts['theme'] : get_option('custom_banners_theme'); $legacy_cta_position = ($theme == 'default_style') ? true : false;//if using the original ("default") theme, order the HTML according to the old style. Otherwise, new style. $slideshow = isset($atts['slideshow']) ? $atts['slideshow'] : false; // filters $target_url = apply_filters('custom_banners_target_url', $target_url, $banner_id); $css_class = apply_filters('custom_banners_banner_class', $css_class, $banner_id); // TODO: add filters for the other attributes // if no CTA is present but a target URL is, then link the entire banner if ( empty($cta) && !empty($target_url) ) { $use_big_link = true; } // placeholder variables $html = ''; $img_html = ''; $banner_style = ''; // add any extra CSS classes to the banner $extra_classes = array($css_class, 'banner-' . $banner_id); if (strlen($cta) > 0) { $extra_classes[] = 'has_cta'; if($legacy_cta_position){ $extra_classes[] = 'legacy_cta_position'; } } if ($atts['caption_position'] == 'left') { $extra_classes[] = 'left'; $extra_classes[] = 'horiz'; } else if ($atts['caption_position'] == 'right') { $extra_classes[] = 'right'; $extra_classes[] = 'horiz'; } else if ($atts['caption_position'] == 'top') { $extra_classes[] = 'top'; $extra_classes[] = 'vert'; } else if ($atts['caption_position'] == 'bottom') { $extra_classes[] = 'bottom'; $extra_classes[] = 'vert'; } //get theme name and theme basename //add both via extra classes $spot = strpos($theme, '-'); if ($spot !== FALSE) { $theme_basename = substr($theme, 0, $spot); $extra_classes[] = sprintf('custom-banners-theme-%s', $theme_basename); } $extra_classes[] = sprintf('custom-banners-theme-%s', $theme); $extra_classes_str = implode(' ', $extra_classes); // we can use either a background image on the banner div, or an tag inside the banner div instead $option_use_image_tag = isset($atts['use_image_tag']) ? $atts['use_image_tag'] : false; // we must force image tags on slideshows, however, or cycle2 wont work in our current configuration if ( !empty($atts['slideshow']) ) { $option_use_image_tag = true; } // load the featured image, of one was specified if ($post_thumbnail_id !== '' && $post_thumbnail_id > 0) { if (!$option_use_image_tag) { $img_src = wp_get_attachment_image_src($post_thumbnail_id, 'full'); $banner_style = "background-image: url('" . $img_src[0] . "');"; $img_html = ''; } else { $img_style = ''; $frame_style = ''; $img_meta = wp_get_attachment_metadata($post_thumbnail_id, 'full'); if ($banner_width == 'specify') { $img_style .= sprintf('width: %spx;', $banner_width_px); } else if ( is_numeric($width) ) { $img_style .= sprintf( 'width: %spx;', $width ); $frame_style .= sprintf( 'width: %spx;', $width ); } else if ( $width == '100_percent' ) { $img_style .= 'width: 100%;'; $frame_style .= 'width: 100%;'; } if ($banner_height == 'specify') { $img_style .= sprintf('height: %spx;', $banner_height_px); } else if ( is_numeric($height) ) { $frame_style .= sprintf( 'height: %spx;', $height ); $img_style .= sprintf( 'height: %spx;', $height ); } if (strlen($img_style) > 0) { $img_atts = array('style' => $img_style); } else { $img_atts = array(); } if ($banner_width == 'specify' && $banner_height == 'specify') { $size = array($banner_width_px, $banner_height_px); } else { $size = 'fullsize'; } // add frame if slideshow $img_html = ''; if ($slideshow && $atts['auto_height']) { $img_html .= sprintf(''; } } } if($atts['hide']){ $banner_display = 'style="display:none; %s"'; } else { $banner_display = 'style="%s"'; } $banner_wrapper_style = sprintf($banner_display, $this->build_banner_wrapper_css($atts)); if($open_in_window){ $link_target = ' target="_blank" '; } else { $link_target = ''; } $banner_style .= $this->build_banner_css($atts); // generate the html now $html .= ''; // // apply a filter to the completed banner HTML $banner_html = apply_filters('custom_banners_banner_html', $html, $banner_id, $atts); // allow the user to inject before and after HTML via filters $before_banner = apply_filters('custom_banners_before_banner', '', $banner_id, $atts); $after_banner = apply_filters('custom_banners_after_banner', '', $banner_id, $atts); // add it all together and return return $before_banner . $banner_html . $after_banner; } function get_banner_caption_html($banner_id, $target_url, $link_target, $cta) { $style_str = apply_filters('custom_banners_cta_button_style', '', $banner_id); return sprintf( '', $target_url, $link_target, $style_str, htmlspecialchars($cta) ); } function add_stylesheets_and_scripts() { $cssUrl = plugins_url( 'assets/css/wp-banners.css' , __FILE__ ); $this->add_stylesheet('wp-banners-css', $cssUrl); //theme stylesheets to admin for theme preview section $this->add_admin_stylesheet('wp-banners-css', $cssUrl); //need to include cycle2 this way, for compatibility with our other plugins $jsUrl = plugins_url( 'assets/js/jquery.cycle2.min.js' , __FILE__ ); $this->add_script('gp_cycle2', $jsUrl, array( 'jquery' ), false, true); //enqueue it again, on the admin side, for use in the theme preview tool $this->add_admin_script('gp_cycle2', $jsUrl, array( 'jquery' ), false, true); $cb_js_url = plugins_url( 'assets/js/custom-banners.js' , __FILE__ ); $this->add_script('custom-banners-js', $cb_js_url, array( 'jquery' ), false, true); } //this is the heading of the new column we're adding to the banner posts list function custom_banners_column_head($defaults) { $defaults = array_slice($defaults, 0, 1, true) + array("cbp_banner_preview" => "Thumbnail") + array_slice($defaults, 1, 1, true) + array("single_shortcode" => "Shortcode") + array_slice($defaults, 2, count($defaults)-2, true); return apply_filters('custom_banners_admin_columns_head', $defaults); } //this content is displayed in the banner post list function custom_banners_columns_content($column_name, $post_ID) { if ($column_name == 'cbp_banner_preview') { $thumb_html = get_the_post_thumbnail( $post_ID, 'post-thumbnail', array('style' => 'max-width: 100px; height: auto') ); printf( '%s', get_edit_post_link($post_ID), $thumb_html ); } else if ($column_name == 'single_shortcode') { $banner_shortcode = get_option("custom_banners_banner_shortcode", 'banner'); $my_shortcode = sprintf('[%s id="%d"]', $banner_shortcode, $post_ID); printf('', $my_shortcode); } do_action('custom_banners_admin_columns_content', $column_name, $post_ID); } //this is the heading of the new column we're adding to the banner category list function custom_banners_cat_column_head($defaults) { $defaults = array_slice($defaults, 0, 2, true) + array("single_shortcode" => "Shortcode") + array_slice($defaults, 2, count($defaults)-2, true); return $defaults; } //this content is displayed in the banner category list function custom_banners_cat_columns_content($value, $column_name, $tax_id) { $category = get_term_by('id', $tax_id, 'banner_groups'); return "[banner group='{$category->slug}']"; } //register any widgets here function custom_banners_register_widgets() { include('lib/widgets/single_banner_widget.php'); include('lib/widgets/rotating_banner_widget.php'); include('lib/widgets/banner_list_widget.php'); register_widget( 'singleBannerWidget' ); register_widget( 'rotatingBannerWidget' ); register_widget( 'bannerListWidget' ); } //add an inline link to the settings page, before the "deactivate" link function add_settings_link_to_plugin_action_links($links) { $settings_link = 'Settings'; array_unshift($links, $settings_link); return $links; } // add inline links to our plugin's description area on the Plugins page function add_custom_links_to_plugin_description($links, $file) { /** Get the plugin file name for reference */ $plugin_file = plugin_basename( __FILE__ ); /** Check if $plugin_file matches the passed $file name */ if ( $file == $plugin_file ) { $new_links['settings_link'] = 'Settings'; $new_links['support_link'] = 'Get Support'; if(!$this->is_pro){ $new_links['upgrade_to_pro'] = 'Upgrade to Pro'; } $links = array_merge( $links, $new_links); } return $links; } /* Displays a meta box with the shortcodes to display the current banner */ function display_shortcodes_meta_box() { global $post; echo "Copy & Paste this shortcode into any post or page to display this banner:
"; $banner_shortcode = get_option("custom_banners_banner_shortcode", 'banner'); $my_shortcode = sprintf('[%s id="%d"]', $banner_shortcode, $post->ID); printf('', $my_shortcode); } function add_meta_boxes(){ add_meta_box( 'banner_shortcodes', 'Shortcodes', array($this, 'display_shortcodes_meta_box'), 'banner', 'side', 'default' ); } /* * Builds a CSS string for the banner wrapper. Primarily controls height and width * * @param $atts Attributes from the shortcode * * @returns string The completed CSS string, with the values inlined */ function build_banner_css($atts) { $option_use_image_tag = isset($atts['use_image_tag']) ? $atts['use_image_tag'] : false; $defaults = array( 'width' => get_option('custom_banners_default_width', ''), 'height' => get_option('custom_banners_default_height', ''), 'banner_width' => 'auto', 'banner_width_px' => '', 'banner_height' => 'auto', 'banner_height_px' => '', ); $atts = array_merge($defaults, $atts); $banner_width = isset($atts['banner_width']) ? $atts['banner_width'] : 'auto'; $banner_width_px = !empty($atts['banner_width_px']) && intval($atts['banner_width_px']) > 0 ? intval($atts['banner_width_px']) : ''; $banner_height = isset($atts['banner_height']) ? $atts['banner_height'] : 'auto'; $banner_height_px = !empty($atts['banner_height_px']) && intval($atts['banner_height_px']) > 0 ? intval($atts['banner_height_px']) : ''; $slideshow = isset($atts['slideshow']) ? $atts['slideshow'] : false; if ( $slideshow ) { $banner_width = 'auto'; $banner_width_px = ''; $banner_height = 'auto'; $banner_height_px = ''; $atts['width'] = ''; $atts['height'] = ''; } if ($banner_width == 'specify') { $atts['width'] = $banner_width_px; } if ($banner_height == 'specify') { $atts['height'] = $banner_height_px; } $css_rule_template = ' %s: %s;'; $output = ''; /* * Width */ $option_val = $atts['width']; if (!empty($option_val) || $banner_width == '100_percent' || $banner_width == 'auto') { if ($banner_width == 'auto' && $option_use_image_tag) { $option_val = 'auto'; $output .= sprintf($css_rule_template, 'width', $option_val); } else if ($banner_width == '100_percent') { $option_val = '100%'; $output .= sprintf($css_rule_template, 'width', $option_val); } else if ( is_numeric($option_val) ) { $option_val .= 'px'; $output .= sprintf($css_rule_template, 'width', $option_val); } } /* * Height */ $option_val = $atts['height']; if (!empty($option_val) || $banner_height == 'auto') { if ($banner_height == 'auto' && $option_use_image_tag) { $option_val = 'auto'; $output .= sprintf($css_rule_template, 'height', $option_val); } else if ( is_numeric($option_val)&& !$option_use_image_tag ) { $option_val .= 'px'; $output .= sprintf($css_rule_template, 'height', $option_val); } } // return the completed CSS string return trim($output); } /* * Builds a CSS string for the slideshow wrapper. Primarily controls height and width * * @param $atts Attributes from the shortcode * * @returns string The completed CSS string, with the values inlined */ function build_slideshow_wrapper_css($atts) { $option_use_image_tag = isset($atts['use_image_tag']) ? $atts['use_image_tag'] : false; $defaults = array( 'width' => get_option('custom_banners_default_width', ''), 'height' => get_option('custom_banners_default_height', ''), 'banner_width' => 'auto', 'banner_width_px' => '', 'banner_height' => 'auto', 'banner_height_px' => '', ); $atts = array_merge($defaults, $atts); $width = isset($atts['width']) ? $atts['width'] : 'auto'; $height = isset($atts['height']) ? $atts['height'] : 'auto'; $banner_width = isset($atts['banner_width']) ? $atts['banner_width'] : 'auto'; $banner_width_px = !empty($atts['banner_width_px']) && intval($atts['banner_width_px']) > 0 ? intval($atts['banner_width_px']) : ''; $banner_height = isset($atts['banner_height']) ? $atts['banner_height'] : 'auto'; $banner_height_px = !empty($atts['banner_height_px']) && intval($atts['banner_height_px']) > 0 ? intval($atts['banner_height_px']) : ''; $slideshow = true; if ($banner_width == 'specify') { $atts['width'] = $banner_width_px; } else if ( is_numeric($width) ) { $atts['width'] = $width; } else if ( $width == '100_percent' ) { $atts['width'] = '100%'; } if ($banner_height == 'specify') { $atts['height'] = $banner_height_px; } else if ( is_numeric($height) ) { $atts['height'] = $height; } $css_rule_template = ' %s: %s;'; $output = ''; /* * Width */ $option_val = $atts['width']; if (!empty($option_val) || $banner_width == '100_percent' || $banner_width == 'auto') { if ($banner_width == 'auto' && $option_use_image_tag) { $option_val = 'auto'; $output .= sprintf($css_rule_template, 'width', $option_val); } else if ($banner_width == '100_percent') { $option_val = '100%'; $output .= sprintf($css_rule_template, 'width', $option_val); } else if ( is_numeric($option_val) ) { $option_val .= 'px'; $output .= sprintf($css_rule_template, 'width', $option_val); } } /* * Height */ $option_val = $atts['height']; if (!empty($option_val) || $banner_height == 'auto') { if ($banner_height == 'auto' && $option_use_image_tag) { $option_val = 'auto'; $output .= sprintf($css_rule_template, 'height', $option_val); } else if ( is_numeric($option_val) ) { $option_val .= 'px'; $output .= sprintf($css_rule_template, 'height', $option_val); } } // return the completed CSS string return trim($output); } /* * Builds a CSS string for the banner itself. Primarily controls height and width * * @param $atts Attributes from the shortcode * * @returns string The completed CSS string, with the values inlined */ function build_banner_wrapper_css($atts) { $defaults = array( 'width' => get_option('custom_banners_default_width', ''), 'height' => get_option('custom_banners_default_height', ''), 'banner_width' => '', 'banner_width_px' => '', 'banner_height' => '', 'banner_height_px' => '', ); $atts = shortcode_atts($defaults, $atts); $banner_width = isset($atts['banner_width']) ? $atts['banner_width'] : ''; $banner_width_px = !empty($atts['banner_width_px']) && intval($atts['banner_width_px']) > 0 ? intval($atts['banner_width_px']) : ''; $banner_height = isset($atts['banner_height']) ? $atts['banner_height'] : ''; $banner_height_px = !empty($atts['banner_height_px']) && intval($atts['banner_height_px']) > 0 ? intval($atts['banner_height_px']) : ''; if ($banner_width == 'specify') { $atts['width'] = $banner_width_px; } if ($banner_height == 'specify') { $atts['height'] = $banner_height_px; } $css_rule_template = ' %s: %s;'; $output = ''; /* * Width */ if ($banner_width != 'auto') { $option_val = $atts['width']; if (!empty($option_val) || $banner_width == '100_percent') { if ($banner_width == '100_percent') { $option_val = '100%'; $output .= sprintf($css_rule_template, 'width', $option_val); } else if ( is_numeric($option_val) ) { $option_val .= 'px'; $output .= sprintf($css_rule_template, 'width', $option_val); } } } /* * Height */ if ($banner_height != 'auto') // TODO: maybe disable this altogether { $option_val = $atts['height']; if (!empty($option_val)) { if ( is_numeric($option_val) ) { $option_val .= 'px'; $output .= sprintf($css_rule_template, 'height', $option_val); } } } // return the completed CSS string return trim($output); } /* * Builds a CSS string for the banner's caption * * @param $atts Attributes from the shortcode * * @returns string The completed CSS string, with the values inlined */ function build_caption_css($atts = array()) { $css_rule_template = ' %s: %s;'; $output = ''; /* * Background Color + Opacity */ $color_val = get_option('custom_banners_caption_background_color', ''); $opacity_val = get_option('custom_banners_caption_background_opacity', ''); if (!empty($color_val)) { // convert the hex string into an "rgba()" string $opacity = !empty($opacity_val) ? ($opacity_val / 100) : 1; $rgba = $this->hex2rgba($color_val, $opacity); $output .= sprintf($css_rule_template, 'background-color', $rgba); } /* * Background Opacity */ if (!empty($option_val)) { $output .= sprintf($css_rule_template, 'opacity', $option_val); } /* * Remove Background image if Background Color / Opacity was specified */ if (!empty($output)) { $output .= sprintf($css_rule_template, 'background-image', 'none'); } // return the completed CSS string return trim($output); } function hex2rgba($color, $opacity = false) { $default = 'rgb(0,0,0)'; //Return default if no color provided if(empty($color)) { return $default; } //Sanitize $color if "#" is provided if ($color[0] == '#' ) { $color = substr( $color, 1 ); } //Check if color has 6 or 3 characters and get values if (strlen($color) == 6) { $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); } elseif ( strlen( $color ) == 3 ) { $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); } else { return $default; } //Convert hexadec to rgb $rgb = array_map('hexdec', $hex); //Check if opacity is set(rgba or rgb) if($opacity){ if(abs($opacity) > 1) $opacity = 1.0; $output = 'rgba('.implode(",",$rgb).','.$opacity.')'; } else { $output = 'rgb('.implode(",",$rgb).')'; } //Return rgb(a) color string return $output; } function add_settings_link() { do_action('custom_banners_before_add_settings_link'); $hook_suffix = add_submenu_page( 'edit.php?post_type=banner', 'Settings', 'Settings', 'administrator', 'custom-banners-settings-redirect', array($this, 'settings_link_redirect') ); add_action("load-$hook_suffix", array($this, 'settings_link_redirect')); do_action('custom_banners_after_add_settings_link'); } function settings_link_redirect() { $settings_page_url = admin_url('admin.php?page=custom-banners-settings'); wp_redirect($settings_page_url); exit(); } function add_extra_classes_to_admin_menu() { global $menu; if ( !empty($menu) ) { foreach( $menu as $key => $value ) { if( 'Custom Banners Settings' == $value[0] ) { $extra_classes = 'custom_banners_admin_menu'; $extra_classes .= $this->is_pro ? ' custom_banners_pro_admin_menu' : ' custom_banners_free_admin_menu'; $menu[$key][4] .= ' ' . $extra_classes; } } } } } $ebp = new CustomBannersPlugin(); // Initialize any addons now do_action('custom_banners_bootstrap'); Šalavijų saldainiai kosuliui ar skaudančiai gerklei - Asėja

Šalavijų saldainiai kosuliui ar skaudančiai gerklei

Šalavijas yra tikras stebuklas ir natūralus vaistas daugeliui kasdienių negalavimų. Jo eteriniai aliejai turi dezinfekcinių, antioksidacinių ir priešuždegiminių savybių. Net jei neturite daržo, galite šį prieskonį auginti ištisus metus. Viduržemio jūros regiono augalas lengvai auga ant saulėtos palangės, o atšilus orams, puikiai jaučiasi balkone. Auginti šalaviją verta ne tik todėl, kad tai skanus ir kvapnus prieskonis. Jį galite naudoti gamindami daugelį kosmetikos gaminių (dantų pastos milteliams, dezodorantams ar vabzdžių įgėlimo skausmui malšinti).

Šalavijai žinomi ir kaip puikūs vaistai kosuliui ar draskančiam gerklės skausmui malšinti. Vienas iš būdų, kuris beje labai patinka vaikams, – tai šių žolelių saldainiai. Jie sumažina ligos simptomus ir padeda greičiau pasveikti. Tokių saldainių galite įsigyti vaistinėse, bet galite pasigaminti ir namuose. Daug laiko tikrai nesugaišite.

Reikalingi tokie ingredientai:

*sauja šviežių šalavijų lapų arba 2 šaukštai džiovintų,

*100 g cukranendrių cukraus (apie 0,5 puodelio)

*2 šaukštai vandens

*1 šaukštas medaus

*1 šaukštas šviežiai spaustų citrinų sulčių

Saldainių gaminimas: kuo smulkiau supjaustykite šalavijų lapus. Į puodą ar keptuvę įpilkite cukrų ir vandenį, kaitinkite ant nedidelės kaitros kol užvirs. Jokiu būdu nemaišykite, šiek tiek pasukinėkite puodą, taip cukrus greičiau ištirps. Kai vanduo išgaruos, o skystas cukrus pradės po truputį ruduoti, nedelsdami nei akimirkos nuimkite puodą nuo viryklės. Šiame etape labai svarbu prižiūrėti, kad cukrus nesudegtų! Į kiek pravėsusį sirupą įmaišykite susmulkintus šalavijų lapus, medų ir citrinos sultis. Dabar reikės suktis greitai: ant kepimo popieriaus nedideliais kiekiais išpilstykite gautą mišinį (galite pasinaudoti silikonine saldainių forma) ir leiskite atvėsti. Nuimkite sustingusius saldainius nuo kepimo popieriaus ar iš formelių ir laikykite sandariai uždarytame stikliniame inde. Lengvą šalavijų lapų kartumą panaikinsite, jei gydomuosius saldainius apibersite nedideliu cukraus pudros kiekiu.

Smagios gamybos ir geros visiems sveikatos!

 

Ugnė D.

Atgal