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/blocks/display_block.php +51 -30 1.111.19 View file →
@@ -11,15 +11,15 @@
11 11 class displayBlock extends block
12 12 {
13 13 protected $blockname = "display";
14 14 protected $fields = array(
15 - 'display_page' => array('default' => 'hidden'),
15 + 'display_page' => array('default' => 'after'),
16 16 'display_page_options' => array('default' => array()),
17 - 'display_post' => array('default' => 'hidden'),
17 + 'display_post' => array('default' => 'after'),
18 18 'display_post_options' => array('default' => array()),
19 19 'display_homepage' => array('default' => 'hidden'),
20 20 'display_homepage_options' => array('default' => array()),
21 - 'display_archive' => array('default' => 'hidden'),
21 + 'display_archive' => array('default' => 'after'),
22 22 'display_archive_options' => array('default' => array()),
23 23 'show_desktop' => array('default' => 1),
24 24 'show_mobile' => array('default' => 1),
25 25 );
@@ -46,14 +46,16 @@
46 46 $save_global = array('display_page', 'display_post', 'display_homepage', 'display_archive');
47 47 $save_options = array('display_page_options', 'display_post_options', 'display_homepage_options', 'display_archive_options');
48 48
49 49 // check google block realsave as well. Implement this on the main form? Should be there.
50 - if (! isset($post['show_desktop']) && isset($post['form_post']))
51 - $blockdata['show_desktop'] = 0;
50 + if ( Install::isPRO() ) {
52 51
53 - if (! isset($post['show_mobile']) && isset($post['form_post']))
54 - $blockdata['show_mobile'] = 0;
52 + if (! isset($post['show_desktop']) && isset($post['form_post']))
53 + $blockdata['show_desktop'] = 0;
55 54
55 + if (! isset($post['show_mobile']) && isset($post['form_post']))
56 + $blockdata['show_mobile'] = 0;
57 + }
56 58
57 59 foreach($post_types as $post_type)
58 60 {
59 61 if (isset($post['display_' . $post_type]))
@@ -133,16 +135,22 @@
133 135 $orientation = $this->collection->orientation;
134 136 $is_static = $this->collection->is_static;
135 137 $is_post = $this->collection->is_post;
136 138
137 - $css["mb-item"]["normal"]["float"] = 'left';
139 + /// $css["mb-item"]["normal"]["float"] = 'left';
140 +
138 141 // Decide which auto values go with the default settings of the other dimensions.
139 142
140 - if ($position)
143 + if ($position && $is_static)
141 144 {
142 145 list($position_y, $position_x) = explode("_", $position);
143 146
144 147 }
148 + elseif($position && $is_post)
149 + {
150 + $position_x = $position;
151 + $position_y = false;
152 + }
145 153 else {
146 154 if ($is_static)
147 155 {
148 156 $position_x = 'left';
@@ -163,8 +171,9 @@
163 171 break;
164 172
165 173 case "vertical";
166 174 $css["mb-item"]["normal"]["clear"] = "both";
175 + $css['maxsocial']['normal']['width'] = 'auto';
167 176 break;
168 177
169 178 }
170 179
@@ -216,9 +225,13 @@
216 225 }
217 226
218 227
219 228 } // is_static
229 + /* elseif ($is_post)
230 + {
220 231
232 + } */
233 +
221 234 return $css;
222 235 }
223 236
224 237 protected function expert_admin()
@@ -751,8 +764,10 @@
751 764
752 765 // 'bottom' => __('Bottom', 'mbsocial'),
753 766 );
754 767
768 + $postpos_options = $static_options;
769 +
755 770 $staticpos_options = array(
756 771 // 'auto' => __('Auto', 'mbsocial'),
757 772 'top' => __('Top', 'mbsocial'),
758 773 'center' => __('Center', 'mbsocial'),
@@ -809,8 +824,9 @@
809 824
810 825 <div class='post_options'>
811 826
812 827 <?php
828 + /* 07/01/2021 - Seems unused
813 829 $staticIcons = array(
814 830 'auto' => 'icon_auto.png',
815 831 'left' => 'icon_posleft.png',
816 832 'right' => 'icon_posright.png',
@@ -819,8 +835,9 @@
819 835 'bottom' => 'icon_posbottom.png',
820 836 'horizontal' => 'icon_horizontal.png',
821 837 'vertical' => 'icon_vertical.png',
822 838 );
839 + */
823 840 $icon_url = MBSocial()->get_plugin_url() . 'images/icons/';
824 841
825 842 $orsp = new maxField('spacer');
826 843 $orsp->name = 'or_spacer';
@@ -850,46 +867,50 @@
850 867 $or->value = 'vertical';
851 868 // $or->image = $icon_url . $staticIcons['vertical'];
852 869 $or->custom_icon = 'display_icon vertical';
853 870
854 -
855 871 $admin->addField($orv, '', 'end');
856 872
857 873 $admin->display_fields();
858 874
875 +
876 +
859 877 ?>
860 878 </div>
861 879 <div class='content_options'>
862 880 <?php
863 881
882 +/* See : https://bitbucket.org/MF_Team/maxbuttons-social-share/issues/38/inline-share-buttons-cant-be-aligned
864 883 $spacer = new maxField('spacer');
865 - $spacer->name = 'spacer';
866 - //$spacer->main_class = 'pos_options';
884 + $spacer->name = 'pos_spacer';
867 885 $spacer->label = __('Alignment', 'mbsocial');
868 - //$admin->addField($spacer, 'start','');
886 + // $spacer->main_class = 'pos_options';
887 + $admin->addField($spacer, 'start','');
869 888
870 889 $i = 0;
871 - foreach($static_options as $option => $label)
890 +
891 + foreach($postpos_options as $option => $label)
872 892 {
873 - $posopt = new maxField('radio');
874 - $posopt->id = 'position_x_' . $option;
875 - $posopt->name = 'position_x';
876 - $posopt->title = $label;
877 - $posopt->value = $option;
878 - //$posopt->image = $icon_url . $staticIcons[$option];
879 - //$postopt->custom_icon = 'display_icon ' . $option;
880 893
881 - //default
882 - $posopt->checked = checked ( $option, 'auto', false);
883 - $posopt->inputclass = 'check_button icon';
884 - $end = ($i == count($static_options)-1) ? 'end' : '';
894 + $posopt = new maxField('radio');
895 + $posopt->id = 'position_' . $option;
896 + $posopt->name = 'position';
897 + $posopt->title = $label;
898 + $posopt->value = $option;
899 + //$posopt->image = $icon_url . 'icon_' . $y_option . $x_option . '.png';
900 + $posopt->custom_icon = 'display_icon center' . $option; // center comes from lookup on icon image
885 901
886 - //$admin->addField($posopt, '',$end);
887 - $i++;
902 + $posopt->checked = checked ( $option, 'auto', false);
903 + $posopt->inputclass = 'check_button icon';
904 +
905 + //$start = ($i == 0) ? 'start' : '';
906 + $end = ($i == 2) ? 'end' : '';
907 + $admin->addField($posopt, '', $end);
908 + $i++;
888 909 }
889 -/* This is note possible due to margins being in use . */
890 - //$admin->display_fields();
891 910
911 + $admin->display_fields();
912 +*/
892 913 ?>
893 914
894 915 </div>
895 916
@@ -940,9 +961,9 @@
940 961 $posopt->value = $y_option . '_' . $x_option;
941 962 //$posopt->image = $icon_url . 'icon_' . $y_option . $x_option . '.png';
942 963 $posopt->custom_icon = 'display_icon ' . $y_option . $x_option;
943 964
944 - $posopt->checked = checked ( $option, 'auto', false);
965 + $posopt->checked = checked ( $x_option, 'auto', false);
945 966 $posopt->inputclass = 'check_button icon';
946 967
947 968 $start = ( $end == 'end') ? 'start' : ''; // from prev run
948 969 $end = ($i % 3 === 0 && $i > 0) ? 'end' : '';