コード例 #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);
     extract($instance);
     // Our variables from the widget settings
     $title = '';
     // Before widget (defined by theme functions file)
     echo $before_widget;
     // Display the widget title if one was input
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo '<div id="relme_widget" class="relmewidget">';
     /* get options */
     $options = get_option('syndication_content_options');
     $urls = explode("\n", $options['relme_links']);
     $urls = syn_meta::clean_urls($urls);
     // Allow URLs to be added by other plugins
     $urls = apply_filters('syn_head_links', $urls);
     echo '<ul class="social-icon">';
     if (!empty($urls)) {
         foreach ($urls as $url) {
             if (empty($url)) {
                 continue;
             }
             echo '<li><a';
             if (is_front_page() || is_home()) {
                 echo ' rel="me"';
             }
             echo ' href="' . $url . '" ></a></li>' . "\n";
         }
     }
     echo '</ul></div>';
     // After widget (defined by theme functions file)
     echo $after_widget;
 }
コード例 #2
0
function get_syndication_links()
{
    $options = get_option('syndication_content_options');
    $urls = explode("\n", get_post_meta(get_the_ID(), 'syndication_urls', true));
    // Mf2_syndication is used by the Micropub plugin
    $mf2 = explode("\n", get_post_meta(get_the_ID(), 'mf2_syndication', true));
    // Clean and dudupe
    $urls = syn_meta::clean_urls(array_merge($urls, $mf2));
    // Allow URLs to be added by other plugins
    $urls = apply_filters('syn_add_links', $urls);
    if (!empty($urls)) {
        $strings = get_syn_network_strings();
        $synlinks = '<span class="relsyn social-icon"><ul>' . $options['text_before'];
        foreach ($urls as $url) {
            if (empty($url)) {
                continue;
            }
            $domain = extract_domain_name($url);
            if (array_key_exists($domain, $strings)) {
                $name = $strings[$domain];
            } else {
                $name = $domain;
            }
            $synlinks .= '<li><a title="' . $name . '" class="u-syndication" href="' . esc_url($url) . '"';
            if (is_single()) {
                $synlinks .= ' rel="syndication">';
            } else {
                $synlinks .= '>';
            }
            if ($options['just_icons'] == "1") {
                $synlinks .= $name;
            }
            $synlinks .= '</a></li>';
        }
        $synlinks .= '</ul></span>';
    }
    return empty($synlinks) ? '' : $synlinks;
}
コード例 #3
0
 public static function head_relme_links()
 {
     global $post;
     if (!is_front_page() || !is_home()) {
         return;
     }
     /* get options */
     $options = get_option('syndication_content_options');
     $urls = explode("\n", $options['relme_links']);
     $urls = syn_meta::clean_urls($urls);
     // Allow URLs to be added by other plugins
     $urls = apply_filters('syn_head_links', $urls);
     if (!empty($urls)) {
         foreach ($urls as $url) {
             if (empty($url)) {
                 continue;
             }
             echo '<link rel="me" href="' . $url . '" />' . "\n";
         }
     }
 }