PluginProbe
Social Share Buttons / 1.2
Social Share Buttons v1.2
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 +9 -56 1.161.2 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()
@@ -244,9 +242,8 @@
244 242 // check if on some mobile
245 243 $mobileDetect = new Mobile_Detect;
246 244 $this->is_mobile = $mobileDetect->isMobile();
247 245 $this->is_tablet = $mobileDetect->isTablet();
248 - $this->is_desktop = ($this->is_mobile) ? false : true;
249 246
250 247 $options = isset($data['display'][$hook . '_options']) ? $data['display'][$hook . '_options'] : array();
251 248
252 249 $orientation = isset($options['orientation']) ? $options['orientation'] : 'auto';
@@ -296,21 +293,8 @@
296 293 elseif (isset($meta['general']['active']) && $is_old_active === 0) // backward for 0.9.5 . Can go at some point
297 294 $this->is_showable = false;
298 295 }
299 296
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 297 // new method of getting data around
314 298 $w->tell('display/env/hook', $hook);
315 299 $w->tell('display/env/post_id', $this->post_id);
316 300 $w->tell('display/env/is_static', $this->is_static );
@@ -622,14 +606,14 @@
622 606 {
623 607 if (! $this->is_showable)
624 608 return;
625 609
626 - /* 1.8 Deprecated. Not included in MB() anymore, using svg method.
627 - if (method_exists(MB(), 'load_library'))
610 +
611 + /*if (method_exists(MB(), 'load_library'))
628 612 {
629 613 MB()->load_library('fontawesome'); // always load lib since change is about 100% this includes FA.
630 - }
631 - */
614 + } */
615 +
632 616 maxUtils::startTime('collection-display-' . self::$count);
633 617
634 618 $w = MBSocial()->whistle();
635 619
@@ -689,23 +673,8 @@
689 673 }
690 674
691 675 }
692 676
693 - public function getDisplayCSS($doc_id = false) // For file output
694 - {
695 - $key = '_parsed_css';
696 -
697 - if ($doc_id)
698 - $key .= '_' . $doc_id;
699 -
700 - $meta = $this->get_meta($key);
701 - if (is_array($meta))
702 - return array_shift($meta);
703 - else
704 - return false;
705 -
706 - }
707 -
708 677 public function displayCSS($css, $args = array() ) // $echo = true, $style_tag = true)
709 678 {
710 679
711 680 $default = array(
@@ -717,9 +686,8 @@
717 686 if ($args['load_type'] == 'inline')
718 687 $args['style_tag'] =true;
719 688
720 689 $output = '';
721 - $css = apply_filters('mbsocial/displaycss/', $css);
722 690
723 691 if ($args["style_tag"])
724 692 $output .= "<style type='text/css'>";
725 693
@@ -732,22 +700,13 @@
732 700 if ($args["load_type"] == 'footer')
733 701 {
734 702 $load_id = 'collection-' . $this->collection_id; // must be unique for unique items, otherwise css won't be output
735 703
736 - $use_file = get_option('maxbuttons_usecssfile', false);
737 - if ($use_file)
738 - {
739 -
740 - wp_enqueue_style('maxbuttons-social-front-' . self::$count, admin_url('admin-ajax.php').'?action=maxbuttons_social_css&id=' . $this->collection_id . '&doc=' . self::$count) ;
741 - $this->update_meta($this->collection_id, '_parsed_css_' . self::$count, $css);
742 - }
743 -
744 704 if (self::$count > 1)
745 705 {
746 706 $load_id .= "-" . self::$count;
747 707 }
748 708
749 -
750 709 do_action('mb-footer',$load_id, $output);
751 710 }
752 711 elseif ($args["load_type"] == 'inline')
753 712 {
@@ -780,9 +739,12 @@
780 739
781 740 if ($args["js_tag"])
782 741 {
783 742 $output .= "<script type='text/javascript'> ";
743 +// $output .= " if (typeof MBcollection" . $this->collection_id . " == 'undefined') { ";
744 +// $output .= " function MBcollection" . $this->collection_id . "() { ";
784 745
746 +
785 747 }
786 748
787 749 foreach($js as $index => $code)
788 750 {
@@ -842,9 +804,8 @@
842 804
843 805 $collectionObj->load($node);
844 806
845 807 $active = ( isset($this->data['network']['network_active']) && is_array($this->data['network']['network_active']) ) ? $this->data['network']['network_active'] : array();
846 -
847 808 if (count($active) == 0 && $args['preview'] == true)
848 809 {
849 810 $networks = $admin->get_default_networks();
850 811 $use_networks = $networks['unselected'];
@@ -865,15 +826,8 @@
865 826 if (! is_object($network))
866 827 {
867 828 continue;
868 829 }
869 - if (! $is_preview)
870 - {
871 - if ( ($this->is_mobile && ! $network->forMobile() ) || $this->is_desktop && ! $network->forDesktop() )
872 - {
873 - continue;
874 - }
875 - }
876 830 $w->tell('display/parse/network', $network);
877 831
878 832 $button_args = array('link' => $network->get_url(),
879 833 'preview' => $is_preview,
@@ -982,9 +936,8 @@
982 936 $css = $this->styleObj->preParse($css);
983 937 $css = apply_filters('mbsocial/parsecss/', $css); // anybody else
984 938
985 939 $css = $this->getCSSParser()->parse($css);
986 -
987 940 maxUtils::endTime('collection-parseCSS-'. self::$count);
988 941 return $css;
989 942 }
990 943