Пример #1
0
 public static function shortcodes_helper($atts, $enc_content = null)
 {
     extract(shortcode_atts(array('text' => '', 'url' => false, 'twitter_handles' => false, 'hidden_hashtags' => false, 'hidden_urls' => false, 'display_mode' => false, 'remove_twitter_handles' => false, 'remove_url' => false, 'remove_hidden_hashtags' => false, 'remove_hidden_urls' => false), $atts));
     //	Is this an enclosing or self-closing shortcode?
     //	http://codex.wordpress.org/Shortcode_API#Enclosing_vs_self-closing_shortcodes
     if (!is_null($enc_content) && $enc_content != '') {
         //	Enclosing shortcode. We want to use the text inside
         //	the shortcode instead of in the text attribute.
         $text = $enc_content;
     }
     $Share = new TT_Share_Handler($text, $url, $twitter_handles, $hidden_hashtags, $hidden_urls, $remove_twitter_handles, $remove_url, $remove_hidden_hashtags, $remove_hidden_urls);
     $options = get_option('tt_plugin_options');
     //	What display mode are we using?
     if ($display_mode === false) {
         //	None provided in shortcode
         if (!$options || !array_key_exists('display_mode', $options)) {
             $display_mode = 'box';
         } else {
             $display_mode = $options['display_mode'];
         }
     }
     switch ($display_mode) {
         case 'button_link':
             //	Do we include the icon?
             if (!array_key_exists('simple_link_include_icon', $options) || $options['simple_link_include_icon']) {
                 return $Share->display_link();
             } else {
                 return $Share->display_link(false);
             }
         default:
             return $Share->display_box();
     }
 }