function weaveriip_widget_area_shortcode($args = '') { /* implement [weaver_widget_area id='name'] shortcode */ extract(shortcode_atts(array('id' => '#', 'class' => '', 'style' => '"margin-left:auto;margin-right:auto;"'), $args)); $area = 'per-page-' . $id; // retrieve meta value $bad = '<h3>[weaver_widget_area] - Area ' . $id . ' not defined.</h3>'; $id_tag = 'per-page-widget'; if ($class == 'primary') { $id_tag = $class; $class = ''; } $content = '<div id="' . $id_tag . '" class="widget-area sidebar_extra ' . $area . ' ' . $class . '" style=' . weaveriip_bracket($style, '"', '"') . '><ul class="xoxo">' . "\n"; if (strlen($id) > 0) { // want to display some areas if (!is_active_sidebar($area)) { return $bad; } ob_start(); /* let's use output buffering to allow use of Dynamic Widgets plugin and not have empty sidebar */ $success = dynamic_sidebar($area); $content .= ob_get_clean(); if ($success && $content) { $content .= "\n</ul></div>\n"; } else { $content = $bad; } } return $content; }
function weaveriip_feed_shortcode($args = '') { /* implement [weaver_feed feed='ur'] shortcode */ extract(shortcode_atts(array('feed' => '#', 'show_sitename' => true, 'show_content' => true, 'excerpt' => false, 'trusted' => false, 'title_style' => '', 'items' => 10), $args)); $err_msg = '[weaver_feed] invalid values provided.'; $show_sitename = weaveriip_tf($show_sitename); $show_content = weaveriip_tf($show_content); $excerpt = weaveriip_tf($excerpt); weaverii_sc_reset_opts(); weaverii_sc_setopt('more_msg', '<br />Click Article Title for full article at original site.'); if ($title_style != '') { $title_style = 'style=' . weaveriip_bracket($title_style, '"', '"'); } $ent_title = '<header class="entry-header"><div class="entry-hdr"><h2 class="entry-title" ' . $title_style . '>'; while (stristr($feed, 'http') != $feed) { // strip anything before http $feed = substr($feed, 1); } if (empty($feed)) { return $err_msg; } // self-url destruction sequence if ($feed == site_url() || $feed == home_url()) { return '[weaver_feed] - feed must not be own site.'; } $rss = fetch_feed($feed); $sitedesc = ''; $sitelink = ''; if (!is_wp_error($rss)) { $sitedesc = esc_attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset')))); $sitetitle = esc_html(strip_tags($rss->get_title())); $sitelink = esc_url(strip_tags($rss->get_permalink())); while (stristr($sitelink, 'http') != $sitelink) { $sitelink = substr($sitelink, 1); } } else { if (is_admin() || current_user_can('edit_theme_options')) { $err_msg = '<p>' . sprintf(__('<strong>RSS Error</strong>: %s', 'weaver-ii'), $rss->get_error_message()) . '</p>'; } return $err_msg; } if (empty($sitetitle)) { $sitetitle = empty($sitedesc) ? __('Unknown Feed', 'weaver-ii') : $sitedesc; } $feed = esc_url(strip_tags($feed)); if ($sitetitle) { $imgurl = apply_filters('weaverii-social-dir', weaverii_relative_url('includes/pro/social/1/')) . 'rss.png'; $sitetitle = '<h2 class="entry-title feed-title">' . '<a href="' . $feed . '" title="' . esc_attr(__('Syndicate this content', 'weaver-ii')) . '" target="_blank"><img src="' . $imgurl . '" height="16" width="16" alt="RSS" /></a> ' . "<a href='{$sitelink}' title='{$sitedesc}' target='_blank'>{$sitetitle}</a></h2>"; } $out = "<div class='weaver-feed'> <!-- *********************************************** -->\n"; if ($show_sitename) { $out .= $sitetitle . "\n"; // add a title for whole feed } $items = (int) $items; if ($items < 1 || 20 < $items) { $items = 10; } if (!$rss->get_item_quantity()) { $out .= '<p>' . __('An error has occurred; the feed is probably down. Try again later.', 'weaver-ii') . '</p></div>'; $rss->__destruct(); unset($rss); return $out; } $rss_items = $rss->get_items(0, $items); // +++++++++++ feed article loop ++++++++++++ foreach ($rss_items as $item) { $out .= '<article class="post type-post hentry category-uncategorized post-feed">' . "\n"; $link = $item->get_link(); while (stristr($link, 'http') != $link) { $link = substr($link, 1); } $link = esc_url(strip_tags($link)); $title = esc_attr(strip_tags($item->get_title())); if (empty($title)) { $title = __('Untitled', 'weaver-ii'); } $desc = @html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset')); if (!$trusted) { $desc = str_replace(array("\n", "\r"), ' ', esc_attr(strip_tags($desc))); } if ($excerpt) { $desc = wp_html_excerpt($desc, 300); // Append ellipsis. Change existing [...] to […]. if ('[...]' == substr($desc, -5)) { $desc = substr($desc, 0, -5) . '[…]'; } elseif ('[…]' != substr($desc, -10)) { $desc .= ' […]'; } } if (!$trusted) { $desc = esc_html($desc); } $date = ''; $date = $item->get_date('U'); if ($date) { $date = date_i18n(get_option('date_format'), $date); } $author = $item->get_author(); if (is_object($author)) { $author = $author->get_name(); $author = esc_html(strip_tags($author)); } else { $author = ''; } if ($link == '') { $link = '#'; } $out .= $ent_title . '<a href="' . $link . '" title="Permalink to ' . $title . '">' . $title . "</a></h2></div>\n"; // now match logic for posted_on $out .= weaveriip_posted_on_code($date, $author) . "</header> <!-- entry-header -->\n"; if ($show_content) { $out .= "<div class='entry-content'>\n" . $desc . "\n</div> <!-- entry-content -->\n"; } $out .= "</article> <!-- post-feed -->\n"; } $out .= "</div> <!-- weaver-feed -->\n"; $rss->__destruct(); unset($rss); weaverii_sc_reset_opts(); return $out; }
function weaveriip_save_totalcss() { global $weaveriip_totalcss_checkbox_opts, $weaveriip_totalcss_text_opts, $weaveriip_totalcss_bg_opts; /* Save options from plus header: wvrx_plus_save_posts */ if (!weaverii_pro_isset('wvp_css')) { weaveriip_totalcss_init(); } if (isset($_POST['css_edit_lines'])) { $value = weaverii_filter_code($_POST['css_edit_lines']); if (!empty($value) && (!is_numeric($value) || !is_int((int) $value))) { $value = 1; } if ($value < 1 || $value > 25) { $value = 1; } weaverii_pro_setopt('css_edit_lines', $value); } global $weaveriip_css; foreach ($weaveriip_css as $option => $val) { if (isset($_POST[$val['id']]) && $_POST[$val['id']] != '' && $_POST[$val['id']] != '{}') { $css = weaverii_filter_code($_POST[$val['id']]); $css = weaveriip_bracket($css, '{', '}'); weaverii_pro_setopt($val['id'], $css); } else { weaverii_pro_setopt($val['id'], false); } } weaverii_pro_update_options('save_totalcss'); /* and let the user know something happened */ echo '<div id="message" class="updated fade"><p><strong>Weaver II Pro More Options Saved</strong></p></div>'; }