public function show_settings_page() { $opts = ss_get_options(); $post_types = get_post_types(array('public' => true), 'objects'); include SS_PLUGIN_DIR . 'includes/settings-page.php'; }
public function social_sharing($atts = array()) { extract(shortcode_atts(array('social_options' => 'twitter, facebook, googleplus', 'twitter_username' => '', 'twitter_text' => __('Share on Twitter ', 'social-sharing'), 'facebook_text' => __('Share on Facebook', 'social-sharing'), 'googleplus_text' => __('Share on Google+', 'social-sharing'), 'linkedin_text' => __('Share on Linkedin', 'social-sharing'), 'pinterest_text' => __('Share on Pinterest', 'social-sharing'), 'icon_order' => 'f,t,g,l,p', 'social_image' => '', 'show_icons' => '0', 'before_button_text' => '', 'text_position' => 'left'), $atts)); if (!is_array($social_options)) { $social_options = array_filter(array_map('trim', explode(',', $social_options))); } remove_filter('the_title', 'wptexturize'); $title = urlencode(html_entity_decode(get_the_title())); add_filter('the_title', 'wptexturize'); $url = urlencode(get_permalink()); $loadjs = ''; $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'medium'); $thumb_url = $thumb['0']; if ($thumb_url == '') { if ($atts['pinterest_image'] == '') { $thumb_url = SS_PLUGIN_URL . 'static/blank.jpg'; } else { $thumb_url = $atts['pinterest_image']; } } if ($social_image == '') { $social_image = $thumb_url; } $social_image = urlencode($social_image); $opts = ss_get_options(); foreach ($opts['load_static'] as $static) { if ($static == 'load_js') { $loadjs = 'onclick="return ss_plugin_loadpopup_js(this);"'; } } $ssbutton_facebook = 'button-facebook'; $ssbutton_twitter = 'button-twitter'; $ssbutton_googleplus = 'button-googleplus'; $ssbutton_linkedin = 'button-linkedin'; $ssbutton_pinterest = 'button-pinterest'; $sssocial_sharing = ''; if ($show_icons) { $sssocial_sharing = 'ss-social-sharing'; $ssbutton_facebook = 'ss-button-facebook'; $ssbutton_twitter = 'ss-button-twitter'; $ssbutton_googleplus = 'ss-button-googleplus'; $ssbutton_linkedin = 'ss-button-linkedin'; $ssbutton_pinterest = 'ss-button-pinterest'; } $icon_order = explode(',', $icon_order); ob_start(); ?> <div class="social-sharing <?php echo $sssocial_sharing; ?> "> <?php if (!empty($before_button_text) && ($text_position == 'left' || $text_position == 'top')) { ?> <span class="<?php echo $text_position; ?> "><?php echo $before_button_text; ?> </span> <?php } ?> <?php foreach ($icon_order as $o) { switch ($o) { case 'f': if (in_array('facebook', $social_options)) { ?> <a <?php echo $loadjs; ?> rel="external nofollow" class="<?php echo $ssbutton_facebook; ?> " href="http://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?> " target="_blank" ><?php echo $facebook_text; ?> </a><?php } break; case 't': if (in_array('twitter', $social_options)) { ?> <a <?php echo $loadjs; ?> rel="external nofollow" class="<?php echo $ssbutton_twitter; ?> " href="http://twitter.com/intent/tweet/?text=<?php echo $title; ?> &url=<?php echo $url; if (!empty($twitter_username)) { echo '&via=' . $twitter_username; } ?> " target="_blank"><?php echo $twitter_text; ?> </a><?php } break; case 'g': if (in_array('googleplus', $social_options)) { ?> <a <?php echo $loadjs; ?> rel="external nofollow" class="<?php echo $ssbutton_googleplus; ?> " href="https://plus.google.com/share?url=<?php echo $url; ?> " target="_blank" ><?php echo $googleplus_text; ?> </a><?php } break; case 'l': if (in_array('linkedin', $social_options)) { ?> <a <?php echo $loadjs; ?> rel="external nofollow" class="<?php echo $ssbutton_linkedin; ?> " href="http://www.linkedin.com/shareArticle?mini=true&url=<?php echo substr($url, 0, 1024); ?> &title=<?php echo substr($title, 0, 200); ?> " target="_blank" ><?php echo $linkedin_text; ?> </a><?php } break; case 'p': if (in_array('pinterest', $social_options)) { ?> <a <?php echo $loadjs; ?> rel="external nofollow" class="<?php echo $ssbutton_pinterest; ?> " href="http://pinterest.com/pin/create/button/?url=<?php echo $url; ?> &media=<?php echo $social_image; ?> &description=<?php echo $title; ?> " target="_blank" ><?php echo $pinterest_text; ?> </a><?php } break; } } ?> <?php if (!empty($before_button_text) && ($text_position == 'bottom' || $text_position == 'right')) { ?> <span class="<?php echo $text_position; ?> "><?php echo $before_button_text; ?> </span> <?php } ?> </div> <?php $output = ob_get_contents(); ob_end_clean(); return $output; }