PluginProbe
Social Share Buttons / 1.5
Social Share Buttons v1.5
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 -69 trunk1.5 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 \MaxButtons\simple_html_dom as simple_html_dom;
5 +use \maxbuttons\maxUtils as maxUtils;
6 +use \maxbuttons\maxCSSParser as maxCSSParser;
7 +use \simple_html_dom as simple_html_dom;
8 8
9 9
10 10 class collection
11 11 {
@@ -59,9 +59,9 @@
59 59 $block = collections::getBlock($block_name);
60 60 if ($block)
61 61 {
62 62 $block->setCollection($this);
63 - $default_data = $block->save_fields($default_data, array() ); // force the fields to set a default pos.
63 + $default_data = $block->save_fields($default_data, null ); // force the fields to set a default pos.
64 64
65 65 $this->blocks[$block_name] = $block;
66 66
67 67 }
@@ -296,23 +296,8 @@
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 -
301 - if ( Install::isPRO() ) {
302 - $show_mobile = (isset($data['display']['show_mobile']) && $data['display']['show_mobile'] == 0) ? false: true;
303 - $show_desktop = (isset($data['display']['show_desktop']) && $data['display']['show_desktop'] == 0) ? false: true;
304 -
305 - if ($this->is_mobile && ! $show_mobile)
306 - {
307 - $this->is_showable = false;
308 - }
309 - if ($this->is_desktop && ! $show_desktop)
310 - {
311 - $this->is_showable = false;
312 - }
313 - }
314 -
315 300 // new method of getting data around
316 301 $w->tell('display/env/hook', $hook);
317 302 $w->tell('display/env/post_id', $this->post_id);
318 303 $w->tell('display/env/is_static', $this->is_static );
@@ -351,24 +336,8 @@
351 336 $result["title"] = __("Error : Block was not there","maxbuttons");
352 337 return $result;
353 338 }
354 339
355 - public function endAjaxRequest($args = array())
356 - {
357 - $defaults = array(
358 - "error" => true, // can have errors and still result true on success
359 - "result" => true,
360 - "body" => "",
361 - "title" => "",
362 - "data" => array(),
363 - );
364 -
365 - $args = wp_parse_args($args, $defaults);
366 -
367 - echo json_encode($args);
368 - die();
369 - }
370 -
371 340 /** Save the collection post data to the database. This will invoke the save functions of the blocks itself to gather, verify and manipulate data */
372 341 public function save($post)
373 342 {
374 343 $data = array();
@@ -640,14 +609,14 @@
640 609 {
641 610 if (! $this->is_showable)
642 611 return;
643 612
644 - /* 1.8 Deprecated. Not included in MB() anymore, using svg method.
613 +
645 614 if (method_exists(MB(), 'load_library'))
646 615 {
647 616 MB()->load_library('fontawesome'); // always load lib since change is about 100% this includes FA.
648 617 }
649 - */
618 +
650 619 maxUtils::startTime('collection-display-' . self::$count);
651 620
652 621 $w = MBSocial()->whistle();
653 622
@@ -707,23 +676,8 @@
707 676 }
708 677
709 678 }
710 679
711 - public function getDisplayCSS($doc_id = false) // For file output
712 - {
713 - $key = '_parsed_css';
714 -
715 - if ($doc_id)
716 - $key .= '_' . $doc_id;
717 -
718 - $meta = $this->get_meta($key);
719 - if (is_array($meta))
720 - return array_shift($meta);
721 - else
722 - return false;
723 -
724 - }
725 -
726 680 public function displayCSS($css, $args = array() ) // $echo = true, $style_tag = true)
727 681 {
728 682
729 683 $default = array(
@@ -735,14 +689,13 @@
735 689 if ($args['load_type'] == 'inline')
736 690 $args['style_tag'] =true;
737 691
738 692 $output = '';
739 - $css = apply_filters('mbsocial/displaycss/', $css);
740 693
741 694 if ($args["style_tag"])
742 695 $output .= "<style type='text/css'>";
743 696
744 - $output .= $css;
697 + $output .= apply_filters('mbsocial/displaycss/', $css);
745 698
746 699 if ($args["style_tag"])
747 700 $output .= "</style>";
748 701
@@ -750,22 +703,13 @@
750 703 if ($args["load_type"] == 'footer')
751 704 {
752 705 $load_id = 'collection-' . $this->collection_id; // must be unique for unique items, otherwise css won't be output
753 706
754 - $use_file = get_option('maxbuttons_usecssfile', false);
755 - if ($use_file)
756 - {
757 -
758 - wp_enqueue_style('maxbuttons-social-front-' . self::$count, admin_url('admin-ajax.php').'?action=maxbuttons_social_css&id=' . $this->collection_id . '&doc=' . self::$count) ;
759 - $this->update_meta($this->collection_id, '_parsed_css_' . self::$count, $css);
760 - }
761 -
762 707 if (self::$count > 1)
763 708 {
764 709 $load_id .= "-" . self::$count;
765 710 }
766 711
767 -
768 712 do_action('mb-footer',$load_id, $output);
769 713 }
770 714 elseif ($args["load_type"] == 'inline')
771 715 {
@@ -775,9 +719,9 @@
775 719 }
776 720
777 721 }
778 722
779 - public function displayJS($js, $args = array() )
723 + public function displayJS($js, $args = array() ) // $echo = true, $style_tag = true)
780 724 {
781 725 $default = array(
782 726 "echo" => true,
783 727 "js_tag" => true,
@@ -808,9 +752,11 @@
808 752 }
809 753
810 754 if ($args["js_tag"])
811 755 {
812 - $output .= "
756 + $output .= " // }
757 + // }
758 + // window.onload = MBcollection" . $this->collection_id . "();
813 759 </script> ";
814 760 }
815 761
816 762
@@ -843,9 +789,9 @@
843 789 $collectionObj = new simple_html_dom();
844 790 $collection_id = $this->collection_id;
845 791
846 792 $styleObj = $this->styleObj;
847 - $style_class = '';
793 + $style_class = ''; //$styleObj->class;
848 794 $style_class = $this->orientation;
849 795
850 796 // create container
851 797 if (self::$count > 1)
@@ -851,9 +797,9 @@
851 797 if (self::$count > 1)
852 798 {
853 799 $style_class .= ' doc-' . self::$count;
854 800 }
855 - $node = "<div class='maxsocial maxsocial-" . esc_attr($collection_id) . " $style_class ' data-collection='" . $collection_id . "' data-nonce='" . wp_create_nonce('maxsocial_ajax_action-' . $collection_id) . "''>
801 + $node = "<div class='maxsocial maxsocial-" . $collection_id . " $style_class ' data-collection='" . $collection_id . "'>
856 802 </div>";
857 803 $node = apply_filters("maxbuttons/social/basic-container",$node);
858 804
859 805 $collectionObj->load($node);
@@ -891,9 +837,9 @@
891 837 }
892 838 $w->tell('display/parse/network', $network);
893 839
894 840 $button_args = array('link' => $network->get_url(),
895 - 'preview' => $is_preview,
841 + 'preview' => $is_preview,
896 842 'index' => $index,
897 843 'name' => $network->get('network'),
898 844 'data' => $this->data,
899 845 'collection_count' => self::$count,
@@ -998,9 +944,8 @@
998 944 $css = $this->styleObj->preParse($css);
999 945 $css = apply_filters('mbsocial/parsecss/', $css); // anybody else
1000 946
1001 947 $css = $this->getCSSParser()->parse($css);
1002 -
1003 948 maxUtils::endTime('collection-parseCSS-'. self::$count);
1004 949 return $css;
1005 950 }
1006 951