本文整理汇总了PHP中get_bookmarks函数的典型用法代码示例。如果您正苦于以下问题:PHP get_bookmarks函数的具体用法?PHP get_bookmarks怎么用?PHP get_bookmarks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_bookmarks函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: widget
/**
* 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>';
}
}
开发者ID:anhtuan64,项目名称:sage,代码行数:39,代码来源:rt_link-combobox-widget.php
示例2: mf_sponsor_carousel
/**
* 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;
}
开发者ID:alessioCattaneo,项目名称:Mini-Maker-Faire-WordPress-Theme,代码行数:29,代码来源:sponsor.php
示例3: updates_requested
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;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:30,代码来源:syndication.php
示例4: mf_sponsor_list
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;
}
开发者ID:hansstam,项目名称:makerfaire,代码行数:35,代码来源:sponsor.php
示例5: displayLinks
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;
}
开发者ID:rogopag,项目名称:area,代码行数:26,代码来源:functions.php
示例6: widget
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);
}
开发者ID:noelboss,项目名称:terrific-icf-roma,代码行数:8,代码来源:Links.php
示例7: widget
/** @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
}
开发者ID:Djailla,项目名称:wordpress_blog_template,代码行数:57,代码来源:runnosphere_BLOGROLL.php
示例8: acegiak_atlink_content
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);
}
开发者ID:acegiak,项目名称:atlink,代码行数:11,代码来源:atlink.php
示例9: test_orderby_rand_should_not_be_cached
/**
* @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);
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:14,代码来源:getBookmarks.php
示例10: link_delete
/**
* 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);
}
}
}
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:16,代码来源:Generic_AdminLinks.php
示例11: ubik_links
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);
}
开发者ID:synapticism,项目名称:ubik-links,代码行数:53,代码来源:ubik-links-core.php
示例12: xv_bookmarks
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>';
}
}
开发者ID:xavivars,项目名称:xv-bookmarks,代码行数:12,代码来源:xv-bookmarks.php
示例13: link_exists
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;
}
开发者ID:nerd-nite,项目名称:nerd-nite-plugin,代码行数:12,代码来源:autolink.php
示例14: get_footer_link_options
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();
}
}
开发者ID:blocher,项目名称:oneholyname,代码行数:13,代码来源:footerlink.php
示例15: show_nav
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";
}
开发者ID:hewu,项目名称:blogwp,代码行数:51,代码来源:ezy-nav-menu.php
示例16: wiziapp_getAllLinks
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));
}
开发者ID:sajidsan,项目名称:sajidsan.github.io,代码行数:14,代码来源:lists.php
示例17: faf_filters_overview
/**
* 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>";
}
开发者ID:berniecultess,项目名称:infirev,代码行数:52,代码来源:advanced_filters_overview.php
示例18: prepare_items
/**
*
* @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 );
}
开发者ID:ShankarVellal,项目名称:WordPress,代码行数:25,代码来源:class-wp-links-list-table.php
示例19: blogroll_links_html
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;
}
开发者ID:rajivpant,项目名称:blogroll-links,代码行数:18,代码来源:blogroll-links.php
示例20: prepare_items
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 );
}
开发者ID:realfluid,项目名称:umbaugh,代码行数:18,代码来源:class-wp-links-list-table.php
注:本文中的get_bookmarks函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论