PluginProbe
Social Share Buttons / 1.19
Social Share Buttons v1.19
trunk 0.9 1.0 1.1 1.1.1 1.1.2 1.10 1.11 1.12 1.15 1.16 1.17 1.18 1.19 1.2 1.20 1.3 1.30 1.4 1.5 1.6 1.7 1.8 1.9
← All changes | classes/class-collection.php +32 -5 1.91.19 View file →
@@ -1,11 +1,11 @@
1 1 <?php
2 2 namespace MBSocial;
3 3 defined('ABSPATH') or die('No direct access permitted');
4 4
5 -use \maxbuttons\maxUtils as maxUtils;
6 -use \maxbuttons\maxCSSParser as maxCSSParser;
7 -use \simple_html_dom as simple_html_dom;
5 +use \MaxButtons\maxUtils as maxUtils;
6 +use \MaxButtons\maxCSSParser as maxCSSParser;
7 +use \MaxButtons\simple_html_dom as simple_html_dom;
8 8
9 9
10 10 class collection
11 11 {
@@ -296,8 +296,9 @@
296 296 elseif (isset($meta['general']['active']) && $is_old_active === 0) // backward for 0.9.5 . Can go at some point
297 297 $this->is_showable = false;
298 298 }
299 299
300 +
300 301 if ( Install::isPRO() ) {
301 302 $show_mobile = (isset($data['display']['show_mobile']) && $data['display']['show_mobile'] == 0) ? false: true;
302 303 $show_desktop = (isset($data['display']['show_desktop']) && $data['display']['show_desktop'] == 0) ? false: true;
303 304
@@ -309,8 +310,9 @@
309 310 {
310 311 $this->is_showable = false;
311 312 }
312 313 }
314 +
313 315 // new method of getting data around
314 316 $w->tell('display/env/hook', $hook);
315 317 $w->tell('display/env/post_id', $this->post_id);
316 318 $w->tell('display/env/is_static', $this->is_static );
@@ -622,9 +624,8 @@
622 624 {
623 625 if (! $this->is_showable)
624 626 return;
625 627
626 -
627 628 /* 1.8 Deprecated. Not included in MB() anymore, using svg method.
628 629 if (method_exists(MB(), 'load_library'))
629 630 {
630 631 MB()->load_library('fontawesome'); // always load lib since change is about 100% this includes FA.
@@ -690,8 +691,23 @@
690 691 }
691 692
692 693 }
693 694
695 + public function getDisplayCSS($doc_id = false) // For file output
696 + {
697 + $key = '_parsed_css';
698 +
699 + if ($doc_id)
700 + $key .= '_' . $doc_id;
701 +
702 + $meta = $this->get_meta($key);
703 + if (is_array($meta))
704 + return array_shift($meta);
705 + else
706 + return false;
707 +
708 + }
709 +
694 710 public function displayCSS($css, $args = array() ) // $echo = true, $style_tag = true)
695 711 {
696 712
697 713 $default = array(
@@ -703,13 +719,14 @@
703 719 if ($args['load_type'] == 'inline')
704 720 $args['style_tag'] =true;
705 721
706 722 $output = '';
723 + $css = apply_filters('mbsocial/displaycss/', $css);
707 724
708 725 if ($args["style_tag"])
709 726 $output .= "<style type='text/css'>";
710 727
711 - $output .= apply_filters('mbsocial/displaycss/', $css);
728 + $output .= $css;
712 729
713 730 if ($args["style_tag"])
714 731 $output .= "</style>";
715 732
@@ -717,13 +734,22 @@
717 734 if ($args["load_type"] == 'footer')
718 735 {
719 736 $load_id = 'collection-' . $this->collection_id; // must be unique for unique items, otherwise css won't be output
720 737
738 + $use_file = get_option('maxbuttons_usecssfile', false);
739 + if ($use_file)
740 + {
741 +
742 + wp_enqueue_style('maxbuttons-social-front-' . self::$count, admin_url('admin-ajax.php').'?action=maxbuttons_social_css&id=' . $this->collection_id . '&doc=' . self::$count) ;
743 + $this->update_meta($this->collection_id, '_parsed_css_' . self::$count, $css);
744 + }
745 +
721 746 if (self::$count > 1)
722 747 {
723 748 $load_id .= "-" . self::$count;
724 749 }
725 750
751 +
726 752 do_action('mb-footer',$load_id, $output);
727 753 }
728 754 elseif ($args["load_type"] == 'inline')
729 755 {
@@ -958,8 +984,9 @@
958 984 $css = $this->styleObj->preParse($css);
959 985 $css = apply_filters('mbsocial/parsecss/', $css); // anybody else
960 986
961 987 $css = $this->getCSSParser()->parse($css);
988 +
962 989 maxUtils::endTime('collection-parseCSS-'. self::$count);
963 990 return $css;
964 991 }
965 992