| @@ -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,23 @@ | ||
| 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 | + | |
| 300 | 315 | // new method of getting data around |
| 301 | 316 | $w->tell('display/env/hook', $hook); |
| 302 | 317 | $w->tell('display/env/post_id', $this->post_id); |
| 303 | 318 | $w->tell('display/env/is_static', $this->is_static ); |
| @@ -609,14 +624,14 @@ | ||
| 609 | 624 | { |
| 610 | 625 | if (! $this->is_showable) |
| 611 | 626 | return; |
| 612 | 627 | |
| 613 | - | |
| 628 | + /* 1.8 Deprecated. Not included in MB() anymore, using svg method. | |
| 614 | 629 | if (method_exists(MB(), 'load_library')) |
| 615 | 630 | { |
| 616 | 631 | MB()->load_library('fontawesome'); // always load lib since change is about 100% this includes FA. |
| 617 | 632 | } |
| 618 | - | |
| 633 | + */ | |
| 619 | 634 | maxUtils::startTime('collection-display-' . self::$count); |
| 620 | 635 | |
| 621 | 636 | $w = MBSocial()->whistle(); |
| 622 | 637 | |
| @@ -676,8 +691,23 @@ | ||
| 676 | 691 | } |
| 677 | 692 | |
| 678 | 693 | } |
| 679 | 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 | + | |
| 680 | 710 | public function displayCSS($css, $args = array() ) // $echo = true, $style_tag = true) |
| 681 | 711 | { |
| 682 | 712 | |
| 683 | 713 | $default = array( |
| @@ -689,13 +719,14 @@ | ||
| 689 | 719 | if ($args['load_type'] == 'inline') |
| 690 | 720 | $args['style_tag'] =true; |
| 691 | 721 | |
| 692 | 722 | $output = ''; |
| 723 | + $css = apply_filters('mbsocial/displaycss/', $css); | |
| 693 | 724 | |
| 694 | 725 | if ($args["style_tag"]) |
| 695 | 726 | $output .= "<style type='text/css'>"; |
| 696 | 727 | |
| 697 | - $output .= apply_filters('mbsocial/displaycss/', $css); | |
| 728 | + $output .= $css; | |
| 698 | 729 | |
| 699 | 730 | if ($args["style_tag"]) |
| 700 | 731 | $output .= "</style>"; |
| 701 | 732 | |
| @@ -703,13 +734,22 @@ | ||
| 703 | 734 | if ($args["load_type"] == 'footer') |
| 704 | 735 | { |
| 705 | 736 | $load_id = 'collection-' . $this->collection_id; // must be unique for unique items, otherwise css won't be output |
| 706 | 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 | + | |
| 707 | 746 | if (self::$count > 1) |
| 708 | 747 | { |
| 709 | 748 | $load_id .= "-" . self::$count; |
| 710 | 749 | } |
| 711 | 750 | |
| 751 | + | |
| 712 | 752 | do_action('mb-footer',$load_id, $output); |
| 713 | 753 | } |
| 714 | 754 | elseif ($args["load_type"] == 'inline') |
| 715 | 755 | { |
| @@ -944,8 +984,9 @@ | ||
| 944 | 984 | $css = $this->styleObj->preParse($css); |
| 945 | 985 | $css = apply_filters('mbsocial/parsecss/', $css); // anybody else |
| 946 | 986 | |
| 947 | 987 | $css = $this->getCSSParser()->parse($css); |
| 988 | + | |
| 948 | 989 | maxUtils::endTime('collection-parseCSS-'. self::$count); |
| 949 | 990 | return $css; |
| 950 | 991 | } |
| 951 | 992 | |