Beispiel #1
0
 /**
  * Get relevant main open graph, twitter and pinterest data and use it for later functions
  * 
  * @return void
  */
 public function get_og_data()
 {
     $this->og_title = $this->sanitize_data(get_post_meta($this->postID, 'mashsb_og_title', true));
     $this->og_description = $this->sanitize_data(get_post_meta($this->postID, 'mashsb_og_description', true));
     $this->og_image = $this->get_image_url();
     $this->twitter_title = $this->sanitize_data(get_post_meta($this->postID, 'mashsb_custom_tweet', true));
     $this->twitter_creator = $this->get_twitter_creator();
     $this->twitter_site = mashsb_get_twitter_username();
 }
Beispiel #2
0
function mashsb_twitter_desc()
{
    $str = "";
    if (mashsb_get_twitter_username()) {
        $str .= __('Based on your username @', 'mashsb') . mashsb_get_twitter_username() . __(' ,the shortened post url and the current content above', 'mashsb');
    } else {
        $str .= __('Based on the shortened post url and the current content above', 'mashsb');
    }
    $str .= __(' your tweet has a maximum of 140 characters. ', 'mashsb');
    if (!mashsb_yoast_active()) {
        $str .= __('If this is left blank the post title will be used. ', 'mashsb');
    } else {
        $str .= __('If this is left blank the Yoast Twitter Title or post title will be used. ', 'mashsb');
    }
    return $str;
}
function arrNetworks($name, $is_shortcode)
{
    global $mashsb_custom_url, $mashsb_custom_text, $mashsb_twitter_url;
    if ($is_shortcode) {
        $url = !empty($mashsb_custom_url) ? urlencode($mashsb_custom_url) : urlencode(mashsb_get_url());
        $title = !empty($mashsb_custom_text) ? $mashsb_custom_text : mashsb_get_title();
        $twitter_title = !empty($mashsb_custom_text) ? $mashsb_custom_text : mashsb_get_twitter_title();
    }
    if (!$is_shortcode) {
        $url = urlencode(mashsb_get_url());
        $title = mashsb_get_title();
        $twitter_title = mashsb_get_twitter_title();
    }
    $via = mashsb_get_twitter_username() ? '&via=' . mashsb_get_twitter_username() : '';
    $networks_arr = array('facebook' => 'http://www.facebook.com/sharer.php?u=' . $url, 'twitter' => 'https://twitter.com/intent/tweet?text=' . $twitter_title . '&url=' . $mashsb_twitter_url . $via, 'subscribe' => '#', 'url' => $url, 'title' => $title);
    // Delete custom text
    unset($mashsb_custom_text);
    // Delete custom url
    unset($mashsb_custom_url);
    $networks = apply_filters('mashsb_array_networks', $networks_arr);
    return isset($networks[$name]) ? $networks[$name] : '';
}