PluginProbe
Social Share Buttons / 1.1.2
Social Share Buttons v1.1.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/blocks/layout-block.php +69 -102 trunk1.1.2 View file →
@@ -63,8 +63,11 @@
63 63 "font_icon_weight" => array("default" => "normal",
64 64 "css" => "font-weight",
65 65 "csspart" => 'mb-icon'),
66 66
67 +
68 + // 'width' => array(),
69 + // 'height' => array(),
67 70 'use_background' => array('default' => 1, ),
68 71 'background_color' => array('default' => '#000',
69 72 'css' => 'background-color',
70 73 'csspart' => 'mb-social',
@@ -87,32 +90,68 @@
87 90 ),
88 91 "ignore_container" => array("default" => 1),
89 92
90 93
94 + /* "static_position_ver" => array("default" => "Auto",
95 + ),
96 + "static_position_hor" => array("default" => "Auto",
97 + ),
98 + */
91 99 );
100 + /*public function map_fields($map)
101 + {
102 + $map = parent::map_fields($map);
103 + $map["orientation"]["func"] = "updatePlacement";
92 104
93 - public function __construct()
105 + return $map;
106 + } */
107 +
108 +/* function parseButtons($buttons)
94 109 {
95 - parent::__construct();
110 + // searches the cache for the container statement ending with -container or -center and tries to remove then
111 + // not very optimal code, but this is a way to maintain cache loading while altering css.
96 112
97 - if (Install::isPro())
98 - add_filter('mbsocial/displaycss/', array($this, 'addWebFont') );
113 + if ($this->data["ignore_container"] == 0)
114 + return $buttons; // ignore container off .
99 115
100 - }
116 + foreach($buttons as $button)
117 + {
118 + $cache = $button->getCache();
101 119
102 - public function addWebFont($css)
103 - {
104 - $fonts = '';
120 + // chops all css statements in a different line
121 + preg_match_all('/([^{]+)\s*\{\s*([^}]+)\s*}/i',$cache, $matches);
122 + foreach($matches[0] as $cssline)
123 + {
124 + // tries to find the last part of the statement from - to {
125 + preg_match_all('/.([^-])*{/i', $cssline, $item);
105 126
106 - if ( isset ($this->data[$this->blockname]['webfonts']))
127 + $item = trim(str_replace("{","",$item[0][0]));
128 + if ($item == '-center' || $item == '-container')
129 + {
130 + $cache = str_replace($cssline,'',$cache);
131 + }
132 +
133 +
134 + }
135 +
136 + //([^{]+)\s*\{\s*([^}]+)\s*} { split }
137 + // match last thing .([^-])*{
138 + $button->setCache($cache);
139 +
140 + $data = $button->get();
141 +
142 + $container = isset($data["container"]) ? $data["container"] : array();
143 + foreach($container as $key => $value)
107 144 {
145 + if ($key != 'container_enabled' && $key != 'container_center_div_wrap') // causes container to be removed otherwise
146 + $container[$key] = '';
147 + }
108 148
109 - $webfonts = $this->data[$this->blockname]['webfonts'];
110 - $fonts .= '@import url(' . $webfonts . ');';
149 + $button->setdata("container", $container);
150 + }
151 + return $buttons;
111 152
112 - }
113 - return $fonts . $css;
114 - }
153 + } */
115 154
116 155 function parseCSS($css, $args)
117 156 {
118 157 $css = parent::parseCSS($css, $args);
@@ -136,15 +175,16 @@
136 175 $css['mb-social']['normal']['background-color'] = $color;
137 176 $css['mb-social']['hover']['background-color'] = "darken($color, 10%)";
138 177 }
139 178
179 + /*$css['mb-icon.svg path']['normal']['color'] = '#fff';
180 + $css['mb-icon.svg path']['hover']['color'] = '#ff0000';
181 +*/
140 182 $css["mb-item"]["normal"]["float"] = "left";
141 183 $css["mb-item"]["normal"]["display"] = "inline-block";
142 184 $css["mb-item a"]["normal"]["cursor"] = "pointer"; // by default social share = call to action.
143 - $css['mb-item a']['normal']['text-decoration'] = 'none';
144 185
145 186
146 -
147 187 if (isset($blockdata['button_spacing']) && $blockdata['button_spacing'] > 0)
148 188 {
149 189 $orientation = $this->collection->orientation;
150 190 $is_static = $w->ask('display/env/is_static');
@@ -152,27 +192,16 @@
152 192 $button_spacing = $blockdata['button_spacing'];
153 193
154 194 if ($orientation == 'horizontal')
155 195 {
156 - $css['mb-item']['normal']['margin-right'] = $button_spacing . 'px';
196 + $css['mb-item']['normal']['margin'] = $button_spacing . 'px';
157 197 }
158 198 if ($orientation == 'vertical')
159 199 {
160 - $css['mb-item']['normal']['margin-bottom'] = $button_spacing . 'px';
200 + $css['mb-item']['normal']['margin'] = $button_spacing . 'px';
161 201 }
162 202 }
163 203
164 - // Check font again.
165 - if (Install::isPro())
166 - {
167 - //var_dump($css);
168 - $blockdata = $this->data[$this->blockname];
169 - $font = $blockdata['font'];
170 - $args = array('font' => $font);
171 - $webfont = patches::checkWebFonts($args);
172 - $this->data[$this->blockname]['webfonts'] = $webfont;
173 - }
174 -
175 204 return $css;
176 205
177 206 }
178 207
@@ -180,9 +209,17 @@
180 209 {
181 210 $blockdata = $this->data[$this->blockname];
182 211
183 212 $use_background = isset($blockdata['use_background']) ? $blockdata['use_background'] : false;
213 +// ??
214 + if ($use_background)
215 + {
216 + // $item = $itemObj->find('.mb-item',0);
217 + // $item->class .= ' social-colors';
218 + // $network = $this->network->get('network');
184 219
220 + }
221 +
185 222 return $itemObj;
186 223
187 224 }
188 225
@@ -192,75 +229,12 @@
192 229 if (! isset($post["ignore_container"]) && ! is_null($post))
193 230 $data[$this->blockname]["ignore_container"] = 0;
194 231 if (! isset($post['use_background']) && ! is_null($post))
195 232 $data[$this->blockname]['use_background'] = 0;
196 -
197 - if ( count ($post) == 0)
198 - return $data; // don't run on default situations
199 -
200 - // Do the font here
201 - $blockdata = $data[$this->blockname];
202 - $font = $blockdata['font'];
203 - //$label_weight = $blockdata['font_label_weight'];
204 - // $icon_weight = $blockdata['icon_label_weight'];
205 -
206 - $args = array('font' => $font);
207 -
208 - $webfont = patches::checkWebFonts($args);
209 - $data[$this->blockname]['webfonts'] = $webfont;
210 -
211 233 return $data;
212 234
213 235 }
214 236
215 - function fontModal()
216 - {
217 - ?>
218 - <div class='maxmodal-data' id='add-fonts' data-load='window.maxFoundry.maxfonts.load' data-height='90%'>
219 - <span class='title'><?php _e("Font Manager","maxbuttons-pro"); ?>
220 -
221 - </span>
222 -
223 - <span class='content'>
224 - <p><?php printf(__("Select from %s fonts you would like to use and they will show up in the dropdown list", 'maxbuttons-pro'), '<span class="fontcount"></span>'); ?></p>
225 - <div class="loading_overlay"></div>
226 - <div class='loading'>
227 - <img src="<?php echo MB()->get_plugin_url(false) ?>images/spinner.gif">
228 - <span><?php _e("Loading","maxbuttons-pro"); ?></span>
229 - </div>
230 - <div class="font_manager">
231 - <div class='font_search'> <span><?php _e("Search","maxbuttons-pro") ?></span>
232 - <input type='text' name='font_search' value='' />
233 - </div>
234 -
235 - <div class="font_wrap">
236 - <div class='font_left'>
237 - <ul class='items'>
238 -
239 - </ul>
240 - </div>
241 - <div class='font_right '>
242 - <ul class='items'>
243 -
244 - </ul>
245 - </div>
246 - </div>
247 - <div class='font_example'>
248 - <span class='placeholder'><?php _e("Click on a font to see an example","maxbuttons-pro"); ?></span>
249 - <span class='example_text'><?php _e("AaBbCcDdEeFfGgEeHh") ?></span>
250 - </div>
251 - </div>
252 - </span>
253 - <div class='controls'>
254 - <div class='controls_inline'>
255 - <button type='button' name='save_fonts' class='button-primary'><?php _e("Save changes", 'maxbuttons-pro'); ?></button> &nbsp;
256 - <button type='button' class='button-primary modal_close'><?php _e("Close","maxbuttons-pro"); ?></button>
257 - </div>
258 - </div>
259 - </div> <!-- maxmodal-data -->
260 - <?php
261 - }
262 -
263 237 function admin()
264 238 {
265 239 $admin = mbSocial()->admin();
266 240
@@ -316,15 +290,8 @@
316 290 $color_hover->name = $color_hover->id;
317 291 $admin->addField( $color_hover, '', 'end');
318 292
319 293 // FONTS
320 - /* $button = new maxField('generic');
321 - $button->label = '';
322 - $button->id = 'manage-fonts';
323 - $button->name = 'button_fonts';
324 - $button->content = '<div id="manage-fonts" class="button manage-fonts maxmodal" data-modal="add-fonts" title="' . __("Add additional fonts","maxbuttons-pro") . '" ><i class="dashicons dashicons-editor-spellcheck"></i>' . __('Font Manager', 'maxbuttons-pro') . '</div>';
325 - $admin->addField($button, 'start', 'end');
326 -*/
327 294 $fonts = MB()->getClass('admin')->loadFonts();
328 295
329 296 $field_font = new maxField('generic');
330 297 $field_font->label = __('Font Family','maxbuttons');
@@ -337,9 +304,9 @@
337 304
338 305 <?php
339 306 // FONT SIZE
340 307 //global $maxbuttons_font_sizes;
341 - //$sizes = apply_filters('mb/editor/fontsizes', maxUtils::generate_font_sizes(10,50) );
308 + $sizes = apply_filters('mb/editor/fontsizes', maxUtils::generate_font_sizes(10,50) );
342 309
343 310 // *** LABEL SIZE *** //
344 311 $field_size = new maxField('number');
345 312 $field_size->label = __('Label Size', 'mbsocial');
@@ -476,15 +443,15 @@
476 443 $admin->addUpdate($spacing);
477 444 $admin->addField($spacing, 'start', 'end');
478 445
479 446 $admin->display_fields();
447 +
480 448 ?>
481 449 </div> <!-- inside -->
482 450 </div> <!-- option container -->
483 451
484 452
485 - <?php $this->fontModal(); ?>
486 453
487 454 <?php
488 -} // admin
455 + }
489 456
490 457 }