Ejemplo n.º 1
0
 function style()
 {
     $socialize_settings = socializeWP::get_options();
     echo '<style type="text/css" media="screen">';
     echo '.socialize-floating { margin-left: ' . $socialize_settings['socialize_out_margin'] . 'px; }';
     echo '</style>';
 }
Ejemplo n.º 2
0
 function get_properties()
 {
     global $post;
     $socialize_settings = socializeWP::get_options();
     $og_properties = array();
     if (is_singular()) {
         $image = '';
         if (current_theme_supports('post-thumbnails') && has_post_thumbnail($post->ID)) {
             $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'post-thumbnail');
             if ($thumbnail) {
                 $image = $thumbnail[0];
             }
         }
         $og_properties = array('og:title' => strip_tags($post->post_title), 'og:type' => 'article', 'og:url' => get_permalink(), 'og:image' => $image, 'og:site_name' => get_bloginfo('name'), 'fb:app_id' => $socialize_settings['socialize_fb_appid'], 'fb:admins' => $socialize_settings['socialize_fb_adminid'], 'fb:page_id' => $socialize_settings['socialize_fb_pageid']);
     }
     return $og_properties;
 }
 function insert_socialize($content)
 {
     if (in_the_loop()) {
         $socialize_settings = socializeWP::get_options();
         if ((is_front_page() || is_home()) && isset($socialize_settings['socialize_display_front']) && $socialize_settings['socialize_display_front']) {
             // Display on front page
             $content = self::inline_wrapper($socialize_settings) . $content . self::action_wrapper($socialize_settings);
         } else {
             if (is_archive() && isset($socialize_settings['socialize_display_archives']) && $socialize_settings['socialize_display_archives'] == 'on') {
                 // Display in archives
                 $content = self::inline_wrapper($socialize_settings) . $content;
             } else {
                 if (is_search() && isset($socialize_settings['socialize_display_search']) && $socialize_settings['socialize_display_search'] == 'on') {
                     // Display in search
                     $content = self::inline_wrapper($socialize_settings) . $content;
                 } else {
                     if (is_singular('page') && isset($socialize_settings['socialize_display_pages']) && $socialize_settings['socialize_display_pages'] == 'on') {
                         // Display on pages
                         $content = self::inline_wrapper($socialize_settings) . $content . self::action_wrapper($socialize_settings);
                     } else {
                         if (is_singular('post') && isset($socialize_settings['socialize_display_posts']) && $socialize_settings['socialize_display_posts'] == 'on') {
                             // Display on single pages
                             $content = self::inline_wrapper($socialize_settings) . $content . self::action_wrapper($socialize_settings);
                         } else {
                             if (!empty($socialize_settings['socialize_display_custom']) && is_singular($socialize_settings['socialize_display_custom'])) {
                                 // Display on single pages
                                 $content = self::inline_wrapper($socialize_settings) . $content . self::action_wrapper($socialize_settings);
                             } else {
                                 if (is_feed() && isset($socialize_settings['socialize_display_feed']) && $socialize_settings['socialize_display_feed'] == 'on') {
                                     // Display in feeds
                                     $content = self::inline_wrapper($socialize_settings) . $content;
                                 } else {
                                     // default display (add inline buttons without action box
                                     //$content = self::inline_wrapper() . $content;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $content;
 }
 function process_socialize_settings_admin()
 {
     if (!empty($_POST['socialize_default_reset'])) {
         if (strstr($_GET['page'], "socialize") && check_admin_referer('socialize-update-settings_options')) {
             $socialize_settings = socializeWP::get_options();
             // If Buttons or Both
             if ($_POST['socialize_default_type'] == 'buttons/cta' || $_POST['socialize_default_type'] == 'buttons') {
                 $socializemetaarray = array();
                 if (isset($_POST['socialize_buttons'])) {
                     foreach ($_POST['socialize_buttons'] as $button) {
                         if ($button > 0) {
                             array_push($socializemetaarray, $button);
                         }
                     }
                 }
                 $socializemeta = implode(',', $socializemetaarray);
                 $socialize_settings['sharemeta'] = $socializemeta;
             }
             // If CTA or Both
             if ($_POST['socialize_default_type'] == 'buttons/cta' || $_POST['socialize_default_type'] == 'cta') {
                 $socialize_text = $_POST['socialize_text'];
                 $socialize_settings['socialize_text'] = stripslashes($_POST['socialize_text']);
             }
             // Loop through all posts with socialize custom meta and update with new settings
             $mod_posts = new WP_Query(array('meta_key' => 'socialize', 'post_status' => array('publish', 'pending', 'draft', 'future', 'private'), 'post_type' => 'any', 'posts_per_page' => -1));
             while ($mod_posts->have_posts()) {
                 $mod_posts->the_post();
                 if ($_POST['socialize_default_type'] == 'buttons/cta' || $_POST['socialize_default_type'] == 'buttons') {
                     update_post_meta(get_the_ID(), 'socialize', $socializemeta);
                 }
                 if ($_POST['socialize_default_type'] == 'buttons/cta' || $_POST['socialize_default_type'] == 'cta') {
                     update_post_meta(get_the_ID(), 'socialize_text', $socialize_text);
                 }
             }
             wp_reset_postdata();
             // Update settings
             socializeWP::update_options($socialize_settings);
             // Update user
             echo "<div id=\"updatemessage\" class=\"updated fade\"><p>Default Socialize settings updated.</p></div>\n";
             echo "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>";
         }
     }
     if (!empty($_POST['socialize_option_submitted'])) {
         if (strstr($_GET['page'], "socialize") && check_admin_referer('socialize-update-settings_options')) {
             $socialize_settings = socializeWP::get_options();
             $socializemetaarray = array();
             if (isset($_POST['socialize_buttons'])) {
                 foreach ($_POST['socialize_buttons'] as $button) {
                     if ($button > 0) {
                         array_push($socializemetaarray, $button);
                     }
                 }
             }
             $socializemeta = implode(',', $socializemetaarray);
             $socialize_settings['sharemeta'] = $socializemeta;
             $socialize_text = $_POST['socialize_text'];
             $socialize_settings['socialize_text'] = stripslashes($_POST['socialize_text']);
             if (isset($_POST['socialize_bitly_name'])) {
                 $socialize_settings['socialize_bitly_name'] = $_POST['socialize_bitly_name'];
             }
             if (isset($_POST['socialize_bitly_key'])) {
                 $socialize_settings['socialize_bitly_key'] = $_POST['socialize_bitly_key'];
             }
             if (isset($_POST['socialize_fb_appid'])) {
                 $socialize_settings['socialize_fb_appid'] = $_POST['socialize_fb_appid'];
             }
             if (isset($_POST['socialize_fb_adminid'])) {
                 $socialize_settings['socialize_fb_adminid'] = $_POST['socialize_fb_adminid'];
             }
             if (isset($_POST['socialize_og'])) {
                 $socialize_settings['socialize_og'] = $_POST['socialize_og'];
             } else {
                 $socialize_settings['socialize_og'] = '';
             }
             if (isset($_POST['socialize_fb_pageid'])) {
                 $socialize_settings['socialize_fb_pageid'] = $_POST['socialize_fb_pageid'];
             } else {
                 $socialize_settings['socialize_fb_pageid'] = '';
             }
             echo "<div id=\"updatemessage\" class=\"updated fade\"><p>Socialize settings updated.</p></div>\n";
             echo "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>";
             socializeWP::update_options($socialize_settings);
         }
     }
     //updated
     $socialize_settings = socializeWP::get_options();
     return $socialize_settings;
 }
Ejemplo n.º 5
0
 function get_short_url($url, $socialize_settings = null)
 {
     if (!isset($socialize_settings)) {
         $socialize_settings = socializeWP::get_options();
     }
     if ($socialize_settings['socialize_bitly_name'] != "" && $socialize_settings['socialize_bitly_key'] != "") {
         return esc_url(self::get_bitly_short_url(apply_filters('socialize-short_url', $url), $socialize_settings['socialize_bitly_name'], $socialize_settings['socialize_bitly_key']));
     } else {
         return apply_filters('socialize-short_url', get_permalink());
     }
 }