PluginProbe
Social Share Buttons / 1.0
Social Share Buttons v1.0
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 +14 -44 1.91.0 View file →
@@ -31,10 +31,8 @@
31 31 public $is_static = false;
32 32 public $is_post = false; // embedded in a post situation
33 33 public $is_mobile = false;
34 34 public $is_tablet = false;
35 - public $is_desktop = false;
36 -
37 35 public $orientation = 'horizontal';
38 36 public $display_mode = 'hidden';
39 37 public $post_id;
40 38
@@ -59,9 +57,9 @@
59 57 $block = collections::getBlock($block_name);
60 58 if ($block)
61 59 {
62 60 $block->setCollection($this);
63 - $default_data = $block->save_fields($default_data, array() ); // force the fields to set a default pos.
61 + $default_data = $block->save_fields($default_data, null ); // force the fields to set a default pos.
64 62
65 63 $this->blocks[$block_name] = $block;
66 64
67 65 }
@@ -80,9 +78,9 @@
80 78 }
81 79
82 80 if ($collection_id > 0)
83 81 {
84 - $this->set($collection_id); // set function loads the block values
82 + $this->set($collection_id);
85 83 }
86 84 }
87 85 /* Get all buttons that are currently loaded */
88 86 /*public function getLoadedButtons()
@@ -223,10 +221,9 @@
223 221 $display = 'shortcode'; // exception
224 222
225 223 $this->display_mode = $display;
226 224
227 -
228 - if (! is_admin() && is_singular() )
225 + if (! is_admin() )
229 226 {
230 227 global $post;
231 228 $this->post_id = $post->ID;
232 229 }
@@ -244,9 +241,8 @@
244 241 // check if on some mobile
245 242 $mobileDetect = new Mobile_Detect;
246 243 $this->is_mobile = $mobileDetect->isMobile();
247 244 $this->is_tablet = $mobileDetect->isTablet();
248 - $this->is_desktop = ($this->is_mobile) ? false : true;
249 245
250 246 $options = isset($data['display'][$hook . '_options']) ? $data['display'][$hook . '_options'] : array();
251 247
252 248 $orientation = isset($options['orientation']) ? $options['orientation'] : 'auto';
@@ -296,21 +292,8 @@
296 292 elseif (isset($meta['general']['active']) && $is_old_active === 0) // backward for 0.9.5 . Can go at some point
297 293 $this->is_showable = false;
298 294 }
299 295
300 - if ( Install::isPRO() ) {
301 - $show_mobile = (isset($data['display']['show_mobile']) && $data['display']['show_mobile'] == 0) ? false: true;
302 - $show_desktop = (isset($data['display']['show_desktop']) && $data['display']['show_desktop'] == 0) ? false: true;
303 -
304 - if ($this->is_mobile && ! $show_mobile)
305 - {
306 - $this->is_showable = false;
307 - }
308 - if ($this->is_desktop && ! $show_desktop)
309 - {
310 - $this->is_showable = false;
311 - }
312 - }
313 296 // new method of getting data around
314 297 $w->tell('display/env/hook', $hook);
315 298 $w->tell('display/env/post_id', $this->post_id);
316 299 $w->tell('display/env/is_static', $this->is_static );
@@ -622,15 +605,8 @@
622 605 {
623 606 if (! $this->is_showable)
624 607 return;
625 608
626 -
627 - /* 1.8 Deprecated. Not included in MB() anymore, using svg method.
628 - if (method_exists(MB(), 'load_library'))
629 - {
630 - MB()->load_library('fontawesome'); // always load lib since change is about 100% this includes FA.
631 - }
632 - */
633 609 maxUtils::startTime('collection-display-' . self::$count);
634 610
635 611 $w = MBSocial()->whistle();
636 612
@@ -656,9 +632,9 @@
656 632 $cache = false;
657 633
658 634 if (! $cache)
659 635 {
660 - //$cssParser = $this->getCSSParser();
636 + $cssParser = $this->getCSSParser();
661 637 $domObj = $this->parse($args);
662 638
663 639 //$css = $this->parseCSS($args);
664 640
@@ -707,9 +683,9 @@
707 683
708 684 if ($args["style_tag"])
709 685 $output .= "<style type='text/css'>";
710 686
711 - $output .= apply_filters('mbsocial/displaycss/', $css);
687 + $output .= $css;
712 688
713 689 if ($args["style_tag"])
714 690 $output .= "</style>";
715 691
@@ -756,9 +732,12 @@
756 732
757 733 if ($args["js_tag"])
758 734 {
759 735 $output .= "<script type='text/javascript'> ";
736 +// $output .= " if (typeof MBcollection" . $this->collection_id . " == 'undefined') { ";
737 +// $output .= " function MBcollection" . $this->collection_id . "() { ";
760 738
739 +
761 740 }
762 741
763 742 foreach($js as $index => $code)
764 743 {
@@ -834,23 +813,17 @@
834 813 }
835 814
836 815 $index = 0; // used as unique button_id
837 816
817 +
838 818 maxUtils::startTime('collection-parse-network-' . self::$count);
839 819 foreach($use_networks as $network)
840 820 {
821 + $w->tell('display/parse/network', $network);
841 822 if (! is_object($network))
842 823 {
843 824 continue;
844 825 }
845 - if (! $is_preview)
846 - {
847 - if ( ($this->is_mobile && ! $network->forMobile() ) || $this->is_desktop && ! $network->forDesktop() )
848 - {
849 - continue;
850 - }
851 - }
852 - $w->tell('display/parse/network', $network);
853 826
854 827 $button_args = array('link' => $network->get_url(),
855 828 'preview' => $is_preview,
856 829 'index' => $index,
@@ -878,17 +851,12 @@
878 851 {
879 852
880 853 // save DOM structure to parser
881 854 $cssParser->loadDom($button);
882 - $css = '';
883 -
884 - $css = $this->parseCSS( array('preview' => $is_preview) );
885 -
886 855 $this->buttons[] = array('item_class' => $button_args['name'],
887 856 'obj' => $button,
888 - 'css' => $css,
857 + 'css' => $this->parseCSS( array('preview' => $is_preview) ),
889 858 );
890 -
891 859 }
892 860
893 861 $index++;
894 862
@@ -895,8 +863,10 @@
895 863 } // network loop.
896 864 maxUtils::endTime('collection-parse-network-' . self::$count);
897 865
898 866 // general parsing
867 +
868 +
899 869 $button_output = '';
900 870 $css = '';
901 871
902 872 foreach($this->buttons as $button_item)
@@ -955,11 +925,11 @@
955 925 }
956 926
957 927 // before the parse let have style have one more go
958 928 $css = $this->styleObj->preParse($css);
959 - $css = apply_filters('mbsocial/parsecss/', $css); // anybody else
960 929
961 930 $css = $this->getCSSParser()->parse($css);
931 +
962 932 maxUtils::endTime('collection-parseCSS-'. self::$count);
963 933 return $css;
964 934 }
965 935