Ejemplo n.º 1
0
function socialize_shortcode($atts)
{
    extract(shortcode_atts(array('service' => 'something'), $atts));
    switch ($service) {
        case 'twitter':
            return SocializeServices::createSocializeTwitter();
            break;
        case 'facebook':
            return SocializeServices::createSocializeFacebook();
            break;
        case 'digg':
            return '';
            /* Leaving for backward compat */
            break;
        case 'sphinn':
            return SocializeServices::createSocializeSphinn();
            break;
        case 'reddit':
            return SocializeServices::createSocializeReddit();
            break;
        case 'dzone':
            return SocializeServices::createSocializeDzone();
            break;
        case 'stumbleupon':
            return SocializeServices::createSocializeStumble();
            break;
        case 'delicious':
            return SocializeServices::createSocializeDelicous();
            break;
        case 'buffer':
            return SocializeServices::createSocializeBuffer();
            break;
        case 'linkedin':
            return SocializeServices::createSocializeLinkedIn();
            break;
        case 'googleplus':
            return SocializeServices::createSocializePlusOne();
            break;
        case 'pinterest':
            return SocializeServices::createSocializePinterest();
            break;
        case 'pocket':
            return SocializeServices::createSocializePocket();
            break;
    }
}
 function action_wrapper($socialize_settings = null)
 {
     global $post;
     $buttonDisplay = "";
     $socialize_text = "";
     $before_button = '<div class="socialize-button">';
     $after_button = '</div>';
     $alert_display = '';
     if (!isset($socialize_settings)) {
         $socialize_settings = socializeWP::get_options();
     }
     if (is_single() && isset($socialize_settings['socialize_alert_box']) && $socialize_settings['socialize_alert_box'] == 'on' || is_page() && isset($socialize_settings['socialize_alert_box_pages']) && $socialize_settings['socialize_alert_box_pages'] == 'on') {
         if (get_post_custom_keys($post->ID) && in_array('socialize_text', get_post_custom_keys($post->ID)) && get_post_meta($post->ID, 'socialize_text', true) != "") {
             $socialize_text = get_post_meta($post->ID, 'socialize_text', true);
         } else {
             $socialize_text = $socialize_settings['socialize_text'];
         }
         if (get_post_custom_keys($post->ID) && in_array('socialize', get_post_custom_keys($post->ID))) {
             $socializemeta = explode(',', get_post_meta($post->ID, 'socialize', true));
         } else {
             $socializemeta = explode(',', $socialize_settings['sharemeta']);
         }
         if (!in_array(21, $socializemeta)) {
             $alert_buttons_array = SocializeServices::get_button_array('action');
             $r_socializemeta = array_reverse($socializemeta);
             foreach ($r_socializemeta as $socialize_button) {
                 if (in_array($socialize_button, $alert_buttons_array)) {
                     array_splice($alert_buttons_array, array_search($socialize_button, $alert_buttons_array), 1);
                     array_unshift($alert_buttons_array, $socialize_button);
                 }
             }
             foreach ($alert_buttons_array as $serviceID) {
                 $buttonDisplay .= self::display_button($serviceID, $before_button, $after_button, $socialize_settings, $socializemeta);
             }
             $alert_display = $socialize_settings['socialize_action_template'];
             preg_match_all('%\\%\\%([a-zA-Z0-9_ ]+)\\%\\%%', $alert_display, $m);
             foreach ($m[1] as $i) {
                 $strReplace = "";
                 switch (strtolower(trim($i))) {
                     case "buttons":
                         $strReplace = $buttonDisplay;
                         break;
                     case "content":
                         $strReplace = $socialize_text;
                         break;
                     case "facebook_like_standard":
                         $strReplace = SocializeServices::createSocializeFacebook('official-like', array('fb_layout' => 'standard', 'fb_showfaces' => 'true', 'fb_width' => '450', 'fb_verb' => 'like', 'fb_font' => 'arial', 'fb_color' => 'light'));
                         break;
                     case "facebook_compact":
                         $strReplace = SocializeServices::createSocializeFacebook('official-like', array('fb_layout' => 'button_count', 'fb_showfaces' => 'false', 'fb_width' => '90', 'fb_verb' => 'like', 'fb_font' => 'arial', 'fb_color' => 'light'));
                         break;
                     case "tweetmeme_compact":
                         $strReplace = SocializeServices::createSocializeTwitter('tweetmeme', array('socialize_tweetmeme_style' => 'compact'));
                         break;
                     case "twitter_compact":
                         $strReplace = SocializeServices::createSocializeTwitter('official', array('socialize_twitter_count' => 'horizontal'));
                         break;
                 }
                 $alert_display = str_replace("%%" . $i . "%%", trim($strReplace), $alert_display);
             }
             $alert_display = '<div class="socialize-containter" style="background-color:' . $socialize_settings['socialize_alert_bg'] . '; border: ' . $socialize_settings['socialize_alert_border_size'] . ' ' . $socialize_settings['socialize_alert_border_style'] . ' ' . $socialize_settings['socialize_alert_border_color'] . ';">' . $alert_display . '</div>';
         }
     }
     return $alert_display;
 }
 function sort_buttons_array($socializemeta)
 {
     $inline_buttons_array = SocializeServices::get_button_array('inline');
     $alert_buttons_array = SocializeServices::get_button_array('action');
     $r_socializemeta = array_reverse($socializemeta);
     $socialize_buttons = array();
     $socialize_buttons[0] = $inline_buttons_array;
     $socialize_buttons[1] = $alert_buttons_array;
     $service_names_array = array();
     foreach (socializeWP::$socialize_services as $service_name => $service_data) {
         if (isset($service_data['inline'])) {
             $service_names_array[$service_data['inline']] = $service_name;
         }
         if (isset($service_data['action'])) {
             $service_names_array[$service_data['action']] = $service_name;
         }
     }
     $service_names_array = apply_filters('socialize-sort_buttons_array', $service_names_array);
     $socialize_buttons[2] = $service_names_array;
     foreach ($r_socializemeta as $socialize_button) {
         if (in_array($socialize_button, $inline_buttons_array)) {
             array_splice($inline_buttons_array, array_search($socialize_button, $inline_buttons_array), 1);
             array_unshift($inline_buttons_array, $socialize_button);
             $socialize_buttons[0] = $inline_buttons_array;
         } else {
             if (in_array($socialize_button, $alert_buttons_array)) {
                 array_splice($alert_buttons_array, array_search($socialize_button, $alert_buttons_array), 1);
                 array_unshift($alert_buttons_array, $socialize_button);
                 $socialize_buttons[1] = $alert_buttons_array;
             }
         }
     }
     return $socialize_buttons;
 }