예제 #1
0
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $text = $instance['text'];
        $category_id = !empty($instance['category_id']) ? $instance['category_id'] : '';
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        $args = array('category' => $category_id);
        $bookmarks = get_bookmarks($args);
        echo '<div class="widget-content-link">';
        echo '<select onchange="openUrl(this.value)" style="height:35px;">';
        echo '<option value=""> Chọn liên kết </option>';
        foreach ($bookmarks as $bookmark) {
            echo '<option value="', $bookmark->link_url, '">', $bookmark->link_name, '</a><br />';
        }
        echo '</select>';
        echo '</div>';
        echo $after_widget;
        add_action('wp_footer', 'addJs_LinkCombobox_Widget');
        function addJs_LinkCombobox_Widget()
        {
            echo '<script language="javascript">';
            echo 'function openUrl(url){
					if(url.length) window.open(url);
				}
			</script>';
        }
    }
/**
 * Sponsor Functions
 */
function mf_sponsor_carousel($category_name)
{
    // Get all of the sponsor from the links
    $sponsors = get_bookmarks(array('orderby' => 'rating', 'category_name' => $category_name));
    // Split them into chucks of two
    $sponsors = array_chunk($sponsors, 2, true);
    // Get the output started.
    $output = '<div id="myCarousel" class="carousel slide">';
    $output .= '<div class="carousel-inner">';
    // Loop through each block of sponsors
    foreach ($sponsors as $idx => $sponsor) {
        if ($idx == 0) {
            $output .= '<div class="item active">';
        } else {
            $output .= '<div class="item">';
        }
        $output .= '<div class="row-fluid">';
        // Loop through the individual sponsors
        foreach ($sponsor as $spon) {
            $output .= '<div class="span6"><div class="thumb"><a href="' . esc_url($spon->link_url) . '"><img src="' . wpcom_vip_get_resized_remote_image_url($spon->link_image, 125, 105) . '" alt="' . esc_attr($spon->link_name) . '"></a></div></div>';
        }
        $output .= '</div></div>';
    }
    $output .= '</div></div>';
    return $output;
}
 function updates_requested()
 {
     if (isset($_POST['update']) or isset($_POST['action']) or isset($_POST['update_uri'])) {
         // Only do things with side-effects for HTTP POST or command line
         $fwp_update_invoke = 'post';
     } else {
         $fwp_update_invoke = 'get';
     }
     $update_set = array();
     if ($fwp_update_invoke != 'get') {
         if (isset($_POST['link_ids']) and is_array($_POST['link_ids']) and $_POST['action'] == FWP_UPDATE_CHECKED) {
             $targets = get_bookmarks(array('include' => implode(",", $_POST['link_ids'])));
             if (is_array($targets)) {
                 foreach ($targets as $target) {
                     $update_set[] = $target->link_rss;
                 }
             } else {
                 // This should never happen
                 FeedWordPress::critical_bug('fwp_syndication_manage_page::targets', $targets, __LINE__);
             }
         } elseif (isset($_POST['update_uri'])) {
             $targets = $_POST['update_uri'];
             if (!is_array($targets)) {
                 $targets = array($targets);
             }
             $update_set = $targets;
         }
     }
     return $update_set;
 }
예제 #4
0
function mf_sponsor_list($category_name, $slug = '')
{
    //get the list of links based on faire name
    $sponsors = get_bookmarks(array('orderby' => 'name', 'category_name' => $category_name, 'limit' => 40));
    $slugData = get_term_by('slug', $slug, 'link_category', OBJECT);
    if (is_object($slugData)) {
        $slugCat = get_objects_in_term($slugData->term_id, 'link_category');
    } else {
        $slugCat = array();
    }
    //get the list of links based on sponsor category name
    $slugData = get_term_by('slug', $category_name, 'link_category', OBJECT);
    $sponsorName = get_objects_in_term($slugData->term_id, 'link_category');
    //find the links that are in both the sponsor category and specified faire
    if (!empty($slugCat)) {
        $category = array_intersect($slugCat, $sponsorName);
    } else {
        $category = $sponsorName;
    }
    $include = implode(',', $category);
    $sponsors = array();
    if (!empty($include)) {
        $sponsors = get_bookmarks(array('orderby' => 'name', 'limit' => 40, 'include' => $include));
    }
    // Get the output started.
    $output = '<ul>';
    // Loop through each block of sponsors
    foreach ($sponsors as $idx => $spon) {
        //foreach ($sponsor as $spon) {
        $output .= '<li><a href="' . esc_url($spon->link_url) . '"><img src="' . legacy_get_resized_remote_image_url($spon->link_image, 125, 105) . '" alt=""></a></li>';
        //}
    }
    $output .= '</ul>';
    return $output;
}
예제 #5
0
파일: functions.php 프로젝트: rogopag/area
 function displayLinks($cat, $class = 'boxesBox', $close = '', $limit = 10)
 {
     //get the links and store it in an array
     $b = get_bookmarks('category=' . $cat . '&orderby=id&order=DESC&limit=' . $limit);
     $html .= '<div class="' . $class . '"><h2 class="blue">Link</h2>';
     $html .= '<div class="boxes BoxesSecond BoxesSecondBrowserFix boxFullWidth">';
     // column left
     $html .= '<ul class="ulLinkLeft">';
     for ($i = 0; $i < 5; $i++) {
         $html .= '<li>';
         $html .= '<a href="' . $b[$i]->link_url . '" title="' . $b[$i]->link_name . '" target="_blank">' . $b[$i]->link_name . '</a>';
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '<ul>';
     //column right
     for ($i = 5; $i < 10; $i++) {
         $html .= '<li>';
         $html .= '<a href="' . $b[$i]->link_url . '" title="' . $b[$i]->link_name . '" target="_blank">' . $b[$i]->link_name . '</a>';
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '<p class="segnala2"><a href="http://dito.areato.org/home/?page_id=124" class="segnala">Tutti i link</a></p>';
     $html .= '</div></div>' . $close;
     echo $html;
 }
예제 #6
0
 function widget($args, $instance)
 {
     $data['title'] = apply_filters('widget_title', empty($instance['title']) ? __('Links') : $instance['title'], $instance, $this->id_base);
     $category = isset($instance['category']) ? $instance['category'] : false;
     // load bookmarks
     $data['links'] = get_bookmarks(array('orderby' => 'name', 'order' => 'ASC', 'category_name' => $category));
     $this->display($instance, $data);
 }
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $link = apply_filters('widget_link', $instance['link']);
        //Operation with TITLE and LINK
        if ('' . $link == '') {
            $link = "#";
            $target = "_self";
        } else {
            $target = "_blank";
        }
        if ('' . $title == '') {
            $html_title = "";
        } else {
            $first = substr($title, 0, 1);
            $other = substr($title, 1);
            $html_title = '<div class="widget_title">';
            $html_title .= '<a href="' . $link . '" target="' . $target . '">';
            $html_title .= $before_title;
            $html_title .= '<span class="widget_title_first">' . $first . '</span>';
            $html_title .= $other;
            $html_title .= $after_title;
            $html_title .= "</a>";
            $html_title .= "</div>";
            $html_title .= '<div class="widget_sep"></div>';
        }
        $args = array('category_name' => "blogroll", 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1, 'categorize' => 0, 'category_orderby' => 'name', 'category_order' => 'ASC', 'class' => '');
        ?>

			<?php 
        echo $before_widget;
        ?>

            <div class="widget">

                <?php 
        echo $html_title;
        ?>

                <div class="widget_content blogroll_list">
                	<?php 
        $global = get_bookmarks($args);
        foreach ($global as $bm) {
            $html = "<div class='blogroll_el'> - <a href='" . $bm->link_url . "' target='" . $bm->link_target . "'>" . $bm->link_name . "</a></div>";
            print $html;
        }
        ?>
                </div>
            </div>

			<?php 
        echo $after_widget;
        ?>
		<?php 
    }
예제 #8
0
파일: atlink.php 프로젝트: acegiak/atlink
function acegiak_atlink_content($content)
{
    return preg_replace_callback('`(^|\\W)@(\\w+)`i', function ($matches) {
        foreach (get_bookmarks() as $bookmark) {
            if (preg_match("`" . $matches[2] . "`i", preg_replace("`\\W`", "", $bookmark->link_name))) {
                return $matches[1] . '<a class="h-card u-category" href="' . $bookmark->link_url . '" alt="' . $bookmark->link_name . '">' . $bookmark->link_name . '</a>';
            }
        }
        return $matches[1] . '<a class="h-card u-category" href="https://twitter.com/' . $matches[2] . '" alt="@' . $matches[2] . '">@' . $matches[2] . '</a>';
    }, $content);
}
 /**
  * @ticket 18356
  */
 public function test_orderby_rand_should_not_be_cached()
 {
     global $wpdb;
     $bookmarks = self::factory()->bookmark->create_many(2);
     $found1 = get_bookmarks(array('orderby' => 'rand'));
     $num_queries = $wpdb->num_queries;
     $found2 = get_bookmarks(array('orderby' => 'rand'));
     // equal sets != same order
     $this->assertEqualSets($found1, $found2);
     $this->assertTrue($num_queries < $wpdb->num_queries);
 }
예제 #10
0
 /**
  * Deletes plugin link from Blogroll
  *
  * @return void
  */
 public static function link_delete()
 {
     require_once ABSPATH . 'wp-admin/includes/bookmark.php';
     $bookmarks = get_bookmarks();
     $link_id = 0;
     foreach ($bookmarks as $bookmark) {
         if ($bookmark->link_url == W3TC_LINK_URL) {
             wp_delete_link($bookmark->link_id);
         }
     }
 }
예제 #11
0
function ubik_links()
{
    // Initialize
    $links = $category = $search = '';
    $links_array = array();
    // Private links can only be seen by users with the manage_links capability
    $hide_invisible = current_user_can('manage_links') ? 0 : 1;
    // Get the link category from the query string
    if (get_query_var('link_category')) {
        $category = get_query_var('link_category');
    }
    // Link search; also works with categories
    if (get_query_var('link_search')) {
        $search = get_query_var('link_search');
    }
    // Fetch the bookmarks
    $links = get_bookmarks(array('orderby' => apply_filters('ubik_links_orderby', 'link_id'), 'order' => apply_filters('ubik_links_order', 'DESC'), 'category_name' => $category, 'hide_invisible' => $hide_invisible, 'search' => esc_sql($search), 'limit' => -1));
    // Check for results then run through the loop
    if (!empty($links)) {
        foreach ($links as $link) {
            // Initialize all variables
            $title = $desc = $url = $rel = $target = $updated = $cats = $cats_formatted = '';
            // Conditionally set relevant variables
            if (!empty($link->link_id)) {
                $id = $link->link_id;
            }
            if (!empty($link->link_name)) {
                $title = $link->link_name;
            }
            if (!empty($link->link_description)) {
                $desc = $link->link_description;
            }
            if (!empty($link->link_url)) {
                $url = $link->link_url;
                $domain = parse_url($url);
                $domain = $domain['host'];
            }
            if (!empty($link->link_rel)) {
                $rel = ' rel="' . $link->link_rel . '"';
            }
            if (!empty($link->link_target)) {
                $target = ' target="' . $link->link_target . '"';
            }
            // Link categories
            if (!empty($id)) {
                $cats = ubik_links_categories($id);
            }
            // Assemble the links array; this returns the raw data as well as processed strings
            $links_array[] = array('id' => $id, 'title' => $title, 'description' => $desc, 'url' => $url, 'domain' => $domain, 'rel' => $rel, 'target' => $target, 'cats' => $cats, 'cats_html' => implode(', ', $cats), 'cats_list' => ubik_links_categories_list($cats), 'link' => '<a href="' . $url . '"' . $rel . $target . '>' . $title . '</a>');
        }
    }
    return apply_filters('ubik_links', $links_array);
}
예제 #12
0
 function xv_bookmarks()
 {
     $bookmarks = get_bookmarks('orderby=name&show_description=1');
     foreach ($bookmarks as $bookmark) {
         echo '<li><a href="' . $bookmark->link_url . '">';
         if (substr($bookmark->link_image, 0, 4) == 'http') {
             echo '<span class="imgfavicon"><img src="' . $bookmark->link_image . '" alt="' . $bookmark->link_name . '" /></span>';
         }
         echo $bookmark->link_name . '</a><div class="antifloat"></div>';
         echo '</li>';
     }
 }
예제 #13
0
function link_exists($link_url)
{
    $bookmarks = get_bookmarks();
    $matching_id = 0;
    foreach ($bookmarks as $bookmark) {
        if ($bookmark->link_url == $link_url) {
            $matching_id = $bookmark->link_id;
            break;
        }
    }
    return $matching_id;
}
예제 #14
0
function get_footer_link_options()
{
    $links = get_bookmarks(array('category_name' => 'Dynamic'));
    if (!empty($links)) {
        $options = array();
        foreach ($links as $link) {
            $options[$link->link_id] = $link->link_name;
        }
        return $options;
    } else {
        return array();
    }
}
예제 #15
0
function show_nav($nav_id = 'nav', $css_class = 'nav', $before_html = '', $after_html = '', $seperator = '', $display_as_list = false)
{
    if ($display_as_list) {
        $containertag = "ul";
        $openlist = "<li>";
        $closelist = "</li>";
    } else {
        $containertag = "div";
        $openlist = "";
        $closelist = "";
    }
    $useseperator = $seperator;
    echo '<' . $containertag . ' id="' . $nav_id . '" class="' . $css_class . '">';
    $navlinks = get_bookmarks('orderby=rating&category_name=' . $nav_id);
    $numOfItems = count($navlinks);
    $counter = 0;
    foreach ((array) $navlinks as $navlink) {
        $counter += 1;
        if ($counter == $numOfItems) {
            $useseperator = "";
        }
        if (!empty($navlink->link_url)) {
            $link_url = $navlink->link_url;
        } else {
            $link_url = "";
        }
        if (!empty($navlink->link_name)) {
            $link_name = $navlink->link_name;
        } else {
            $link_name = "";
        }
        if (!empty($navlink->link_description)) {
            $link_description = ' title="' . $navlink->link_description . '"';
        } else {
            $link_description = "";
        }
        if (!empty($navlink->link_target)) {
            $link_target = ' target="' . $navlink->link_target . '"';
        } else {
            $link_target = "";
        }
        $markCurrent = '';
        $rootpath_ar = explode("/", $_SERVER['REQUEST_URI']);
        $rootpath = "/" . $rootpath_ar[1] . "/";
        if ($link_url == $_SERVER['REQUEST_URI'] || $link_url . "/" == $_SERVER['REQUEST_URI'] || $link_url == $_SERVER['REQUEST_URI'] . "/" || $link_url == $rootpath) {
            $markCurrent = ' class="current"';
        }
        echo $openlist . '<a href="' . $link_url . '"' . $link_description . $link_target . $markCurrent . '>' . $before_html . $link_name . $after_html . "</a>" . $closelist . $useseperator . "\n";
    }
    echo "</{$containertag}>\n";
}
예제 #16
0
function wiziapp_getAllLinks()
{
    $header = array('action' => 'wiziapp_getAllLinks', 'status' => TRUE, 'code' => 200, 'message' => '');
    $linksLimit = WiziappConfig::getInstance()->links_list_limit;
    $pageNumber = isset($_GET['wizipage']) ? $_GET['wizipage'] : 0;
    $links = get_bookmarks(array('limit' => $linksLimit, 'offset' => $pageNumber * $linksLimit));
    $linksSummary = array();
    foreach ($links as $link) {
        $linksSummary[$link->link_url] = $link->link_name;
    }
    // Get the total number of pages
    $total = $GLOBALS['WiziappDB']->get_links_count();
    echo json_encode(array('header' => $header, 'links' => $linksSummary, 'total' => $total));
}
 /** 
 * Outputs an overview of all filters. 
 *
 * @since 0.4
 */
 public function faf_filters_overview()
 {
     echo "<h2>" . __("Feedwordpress Advanced Filters Overview", "faf") . "</h2>";
     _e("This page will display the filters from all feeds in the order they will be executed on the posts", "faf");
     $faf = new FeedwordpressAdvancedFilters();
     $cat_id = FeedWordpress::link_category_id();
     $links = get_bookmarks(array("category" => $cat_id));
     foreach ($links as $l => $link) {
         $Slink = new SyndicatedLink($link);
         $filter_array = $faf->get_filter_tree($Slink);
         echo "<a name='#" . $link->link_name . "' ></a>";
         echo "<hr /><h3>" . $link->link_name . "</h3>";
         foreach ($filter_array as $context => $filters) {
             if (count($filters) > 0) {
                 foreach ($filters as $filter) {
                     $name = $filter["filter_name"];
                     $args = $filter["filter_args"];
                     // echo "<div class='faf_filterSetting'><ul>";
                     $av_filters = $faf->get_available_filters();
                     $filter_function = $av_filters[$context][$name]["filter_function"];
                     if (version_compare(PHP_VERSION, "5.3.0", "<")) {
                         $desc = call_user_func($filter_function . '::get_description');
                     } else {
                         $desc = $filter_function::get_description();
                     }
                     echo "<div class='faf_filterBox'><h4>{$desc}</h4>";
                     //$filterObj = new $filter_function(array(),$args);
                     //$filterObj->display();
                     //   $filter_function::getDisplay($args);
                     if (version_compare(PHP_VERSION, "5.3.0", "<")) {
                         call_user_func_array($filter_function . '::getDisplay', array($args, $filter_function));
                     } else {
                         $filter_function::getDisplay($args);
                     }
                     /* foreach($args as $arg_name => $arg_value)
                       	{
                       		if ($arg_value == 1) $arg_value = "yes"; 
                       		echo "<li>$arg_name :: $arg_value</li>"; 
                        	} */
                     // echo "</ul></div></p>";
                     echo "</div>";
                 }
             }
         }
     }
     echo "<div class='faf_small'><a href=\"http://www.weblogmechanic.com/plugins/feedwordpress-advanced-filters/\" target=\"_blank\">Feedwordpress Advanced Filters</a> \t\tversion " . FAF_VERSION . " by Bas Schuiling</div>";
 }
	/**
	 *
	 * @global int    $cat_id
	 * @global string $s
	 * @global string $orderby
	 * @global string $order
	 */
	public function prepare_items() {
		global $cat_id, $s, $orderby, $order;

		wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', 's' ) );

		$args = array( 'hide_invisible' => 0, 'hide_empty' => 0 );

		if ( 'all' != $cat_id )
			$args['category'] = $cat_id;
		if ( !empty( $s ) )
			$args['search'] = $s;
		if ( !empty( $orderby ) )
			$args['orderby'] = $orderby;
		if ( !empty( $order ) )
			$args['order'] = $order;

		$this->items = get_bookmarks( $args );
	}
예제 #19
0
function blogroll_links_html($category_id, $sort_by, $sort_order)
{
    $bm = get_bookmarks(array('orderby' => $sort_by, 'order' => $sort_order, 'limit' => -1, 'category' => "{$category_id}", 'category_name' => null, 'hide_invisible' => 1, 'show_updated' => 0, 'include' => null, 'exclude' => null, 'search' => '.'));
    $links .= '<ul>';
    foreach ($bm as $bookmark) {
        $rel_string = $bookmark->link_rel;
        $rel_tag_part = strlen($rel_string) > 0 ? ' rel="' . $rel_string . '"' : '';
        $target_string = $bookmark->link_target;
        $target_tag_part = strlen($target_string) > 0 ? ' target="' . $target_string . '"' : '';
        $description_string = $bookmark->link_description;
        $description_tag = strlen($description_string) > 0 ? ' - ' . $description_string : '';
        $image_string = $bookmark->link_image;
        $image_tag = strlen($image_string) > 0 ? '<br />' . '<img src="' . $bookmark->link_image . '" border="0"/>' : '';
        $links .= sprintf('<li><a href="%s"%s%s>%s</a>%s%s</li>', $bookmark->link_url, $rel_tag_part, $target_tag_part, $bookmark->link_name, $description_tag, $image_tag);
    }
    $links .= '</ul>';
    return $links;
}
	function prepare_items() {
		global $cat_id, $s, $orderby, $order;

		wp_reset_vars( array( 'action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'orderby', 'order', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]', 's' ) );

		$args = array( 'hide_invisible' => 0, 'hide_empty' => 0 );

		if ( 'all' != $cat_id )
			$args['category'] = $cat_id;
		if ( !empty( $s ) )
			$args['search'] = $s;
		if ( !empty( $orderby ) )
			$args['orderby'] = $orderby;
		if ( !empty( $order ) )
			$args['order'] = $order;

		$this->items = get_bookmarks( $args );
	}
 public function widget($args, $instance)
 {
     $this->instance = $instance;
     $category = $this->get_category_from_instance($instance);
     $categories = array();
     foreach ($category as $pvalue) {
         $value = hocwp_get_value_by_key($pvalue, 'value');
         if (hocwp_id_number_valid($value)) {
             $categories[] = $value;
         }
     }
     $bm_args = array('category' => implode(',', $categories));
     $bookmarks = get_bookmarks($bm_args);
     hocwp_widget_before($args, $instance);
     $bookmarks = hocwp_sanitize_bookmark_link_image($bookmarks);
     $bm_args = array('before' => '', 'after' => '');
     echo _walk_bookmarks($bookmarks, $bm_args);
     hocwp_widget_after($args, $instance);
 }
예제 #22
0
 /**
  * Imports the WordPress links into this custom post type
  *
  * @since 8/19/12
  * @uses  called using ajax
  *
  * @return array( %old_link_id%, %new_post_id% ) - for testability only
  */
 function import_links()
 {
     check_ajax_referer('simple_links_import_links');
     //Add the categories from the links
     $old_link_cats = get_terms('link_category', array());
     if (is_array($old_link_cats)) {
         foreach ($old_link_cats as $cat) {
             if (!term_exists($cat->name, Simple_Links_Categories::TAXONOMY)) {
                 $args['description'] = $cat->description;
                 $args['slug'] = $cat->slug;
                 wp_insert_term($cat->name, Simple_Links_Categories::TAXONOMY, $args);
             }
         }
     }
     //for testability
     $matches = array();
     //Import Each link
     foreach (get_bookmarks() as $link) {
         $post = array('post_name' => $link->link_name, 'post_status' => 'publish', 'post_title' => $link->link_name, 'post_type' => 'simple_link');
         //Create the new post
         $id = wp_insert_post($post);
         $matches[$link->link_id] = $id;
         //Update Existing post data
         update_post_meta($id, 'description', $link->link_description);
         update_post_meta($id, 'target', $link->link_target);
         update_post_meta($id, 'web_address', $link->link_url);
         //Put the post in the old categories
         $terms = wp_get_object_terms($link->link_id, 'link_category');
         if (is_array($terms)) {
             foreach ($terms as $term) {
                 if ($term_id = term_exists($term->name, Simple_Links_Categories::TAXONOMY)) {
                     wp_set_object_terms($id, (int) $term_id['term_id'], Simple_Links_Categories::TAXONOMY, true);
                 }
             }
         }
     }
     return $matches;
 }
예제 #23
0
function get_the_link_items_with_posts($id = null)
{
    $bookmarks = get_bookmarks('orderby=date&category=' . $id);
    $output = '';
    if (!empty($bookmarks)) {
        $output .= '<div class="friend-posts--wrap fontSmooth">';
        foreach ($bookmarks as $bookmark) {
            $output .= '<div class="friend-posts"><h4 class="friend-posts-title"><a style="display:block" href="' . $bookmark->link_url . '" title="' . $bookmark->link_description . '" target="_blank" >' . get_avatar($bookmark->link_notes, 24) . $bookmark->link_name . '</a></h4>';
            $url = $bookmark->link_rss ? $bookmark->link_rss : rtrim($bookmark->link_url, '/') . '/feed/';
            $rss_items = get_feed_posts($url);
            if (!empty($rss_items)) {
                $output .= '<ul class="friend-posts-items">';
                foreach ($rss_items as $rss_item) {
                    $output .= '<li><a target="_blank" rel="external nofollow" href="' . $rss_item['url'] . '">' . $rss_item['title'] . '</a></li>';
                }
                $output .= '</ul>';
            }
            $output .= '</div>';
        }
        $output .= '</div>';
    }
    return $output;
}
예제 #24
0
/**
 * This gets buckets of content and has some defaults which allow for the
 * most generic buckets to be laid out for display. Carousels are also
 * buckets.
 */
function get_buckets($bucket_type = 'Bucket', $exclude_category = 'Case Studies, CC Store', $orderby = 'rating', $debug = false)
{
    $buckets = array();
    $bookmarks = get_bookmarks(array('orderby' => $orderby, 'category_name' => $bucket_type));
    $excluded_categories = explode(', ', $exclude_category);
    if (empty($excluded_categories)) {
        $excluded_categories[] = $exclude_category;
    }
    foreach ($bookmarks as $b) {
        $do_not_save = false;
        $book = get_bookmark($b->link_id);
        foreach ($book->link_category as $term_id) {
            $link_terms = get_term_by('id', $term_id, 'link_category');
            if (in_array($link_terms->name, $excluded_categories)) {
                $do_not_save = true;
            }
            $book->link_terms[] = $link_terms;
        }
        if (!$do_not_save) {
            $buckets[] = $book;
        }
    }
    return $buckets;
}
예제 #25
0
파일: links.php 프로젝트: JustinHop/mlb
			<div class="fixed"></div>
		</div>
		<div class="content">

			<?php 
    if ($linkcats) {
        foreach ($linkcats as $linkcat) {
            ?>
				<div class="boxcaption"><h3><?php 
            echo $linkcat->name;
            ?>
</h3></div>
				<div class="box linkcat">
					<ul>
						<?php 
            $bookmarks = get_bookmarks('orderby=rand&category_name=' . $linkcat->name);
            if (!empty($bookmarks)) {
                foreach ($bookmarks as $bookmark) {
                    echo '<li><a href="' . $bookmark->link_url . '" title="' . $bookmark->link_description . '">' . $bookmark->link_name . '</a></li>';
                }
            }
            ?>
					</ul>
					<div class="fixed"></div>
				</div>
			<?php 
        }
    }
    the_content();
    ?>
			<div class="fixed"></div>
예제 #26
0
/**
 * Gets the links associated with category by id.
 *
 * @since 0.71
 * @deprecated 2.1
 * @deprecated Use get_bookmarks()
 * @see get_bookmarks()
 *
 * @param int $category The category to use. If no category supplied uses all
 * @param string $before the html to output before the link
 * @param string $after the html to output after the link
 * @param string $between the html to output between the link/image and its description.
 *		Not used if no image or show_images == true
 * @param bool $show_images whether to show images (if defined).
 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
 *		'description', or 'rating'. Or maybe owner. If you start the name with an
 *		underscore the order will be reversed. You can also specify 'rand' as the order
 *		which will return links in a random order.
 * @param bool $show_description whether to show the description if show_images=false/not defined.
 * @param bool $show_rating show rating stars/chars
 * @param int $limit Limit to X entries. If not specified, all entries are shown.
 * @param int $show_updated whether to show last updated timestamp
 * @param bool $echo whether to echo the results, or return them instead
 * @return null|string
 */
function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true)
{
    _deprecated_function(__FUNCTION__, '2.1', 'get_bookmarks()');
    $order = 'ASC';
    if (substr($orderby, 0, 1) == '_') {
        $order = 'DESC';
        $orderby = substr($orderby, 1);
    }
    if ($category == -1) {
        //get_bookmarks uses '' to signify all categories
        $category = '';
    }
    $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
    if (!$results) {
        return;
    }
    $output = '';
    foreach ((array) $results as $row) {
        if (!isset($row->recently_updated)) {
            $row->recently_updated = false;
        }
        $output .= $before;
        if ($show_updated && $row->recently_updated) {
            $output .= get_option('links_recently_updated_prepend');
        }
        $the_link = '#';
        if (!empty($row->link_url)) {
            $the_link = esc_url($row->link_url);
        }
        $rel = $row->link_rel;
        if ('' != $rel) {
            $rel = ' rel="' . $rel . '"';
        }
        $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
        $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
        $title = $desc;
        if ($show_updated) {
            if (substr($row->link_updated_f, 0, 2) != '00') {
                $title .= ' (' . __('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + get_option('gmt_offset') * HOUR_IN_SECONDS) . ')';
            }
        }
        if ('' != $title) {
            $title = ' title="' . $title . '"';
        }
        $alt = ' alt="' . $name . '"';
        $target = $row->link_target;
        if ('' != $target) {
            $target = ' target="' . $target . '"';
        }
        $output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>';
        if ($row->link_image != null && $show_images) {
            if (strpos($row->link_image, 'http') !== false) {
                $output .= "<img src=\"{$row->link_image}\" {$alt} {$title} />";
            } else {
                // If it's a relative path
                $output .= "<img src=\"" . get_option('siteurl') . "{$row->link_image}\" {$alt} {$title} />";
            }
        } else {
            $output .= $name;
        }
        $output .= '</a>';
        if ($show_updated && $row->recently_updated) {
            $output .= get_option('links_recently_updated_append');
        }
        if ($show_description && '' != $desc) {
            $output .= $between . $desc;
        }
        if ($show_rating) {
            $output .= $between . get_linkrating($row);
        }
        $output .= "{$after}\n";
    }
    // end while
    if (!$echo) {
        return $output;
    }
    echo $output;
}
예제 #27
0
</div>

<br class="clear" />
</div>

<div class="clear"></div>

<?php 
if ('all' == $cat_id) {
    $cat_id = '';
}
$args = array('category' => $cat_id, 'hide_invisible' => 0, 'orderby' => $sqlorderby, 'hide_empty' => 0);
if (!empty($_GET['s'])) {
    $args['search'] = $_GET['s'];
}
$links = get_bookmarks($args);
if ($links) {
    $link_columns = get_column_headers('link-manager');
    $hidden = get_hidden_columns('link-manager');
    ?>

<?php 
    wp_nonce_field('bulk-bookmarks');
    ?>
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php 
    print_column_headers('link-manager');
    ?>
	</tr>
예제 #28
0
        wp_reset_query();
        ?>
 
							</ul>
							
							<div style="clear:both;"></div>
							
							<div id="network-list">
							<h2>Our Broader Network</h2>
							<p>These superstars have been a part of our teaching teams, fellows, staff or founding team. They continue to do amazing work at Stanford and in the world.</p>
							<ul>
							<?php 
        //echo strip_tags(preg_replace('@\<li([^>]*)>\<a([^>]*)>(.*?)\<\/a>@i', '<li$1><a$2><span>$3</span></a>', wp_list_bookmarks('category=47&title_li=&categorize=0&echo=0&orderby=name&order=asc&show_images=0') ),'<li>'  );
        ?>
							<?php 
        $links = get_bookmarks(array('category' => 47));
        foreach ($links as $link) {
            echo '<li id="' . $link->link_image . '">' . $link->link_name . "</li>";
        }
        ?>
							</ul>
							</div>

						</div>
						
						<?php 
        echo apply_atomic_shortcode('entry_meta', '<div class="entry-meta">[entry-edit-link]</div>');
        ?>

						<?php 
        do_atomic('close_entry');
예제 #29
0
 /**
  * Instantiate multiple containers of the container type managed by this class.
  *
  * @param array $containers Array of assoc. arrays containing container data.
  * @param string $purpose An optional code indicating how the retrieved containers will be used.
  * @param bool $load_wrapped_objects Preload wrapped objects regardless of purpose. 
  * 
  * @return array of blcBookmark indexed by "container_type|container_id"
  */
 function get_containers($containers, $purpose = '', $load_wrapped_objects = false)
 {
     $containers = $this->make_containers($containers);
     //Preload bookmark data if it is likely to be useful later
     $preload = $load_wrapped_objects || in_array($purpose, array(BLC_FOR_DISPLAY, BLC_FOR_PARSING));
     if ($preload) {
         $bookmark_ids = array();
         foreach ($containers as $container) {
             $bookmark_ids[] = $container->container_id;
         }
         $args = array('include' => implode(',', $bookmark_ids));
         $bookmarks = get_bookmarks($args);
         foreach ($bookmarks as $bookmark) {
             $key = $this->container_type . '|' . $bookmark->link_id;
             if (isset($containers[$key])) {
                 $containers[$key]->wrapped_object = $bookmark;
             }
         }
     }
     return $containers;
 }
예제 #30
0
foreach ((array) $cats as $cat) {
    /**
     * Filters the OPML outline link category name.
     *
     * @since 2.2.0
     *
     * @param string $catname The OPML outline category name.
     */
    $catname = apply_filters('link_category', $cat->name);
    ?>
<outline type="category" title="<?php 
    echo esc_attr($catname);
    ?>
">
<?php 
    $bookmarks = get_bookmarks(array("category" => $cat->term_id));
    foreach ((array) $bookmarks as $bookmark) {
        /**
         * Filters the OPML outline link title text.
         *
         * @since 2.2.0
         *
         * @param string $title The OPML outline title text.
         */
        $title = apply_filters('link_title', $bookmark->link_name);
        ?>
	<outline text="<?php 
        echo esc_attr($title);
        ?>
" type="link" xmlUrl="<?php 
        echo esc_attr($bookmark->link_rss);