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/blocks/layout-block.php +88 -66 1.21.5 View file →
@@ -63,11 +63,8 @@
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(),
70 67 'use_background' => array('default' => 1, ),
71 68 'background_color' => array('default' => '#000',
72 69 'css' => 'background-color',
73 70 'csspart' => 'mb-social',
@@ -90,69 +87,33 @@
90 87 ),
91 88 "ignore_container" => array("default" => 1),
92 89
93 90
94 - /* "static_position_ver" => array("default" => "Auto",
95 - ),
96 - "static_position_hor" => array("default" => "Auto",
97 - ),
98 - */
99 91 );
100 - /*public function map_fields($map)
92 +
93 + public function __construct()
101 94 {
102 - $map = parent::map_fields($map);
103 - $map["orientation"]["func"] = "updatePlacement";
95 + parent::__construct();
104 96
105 - return $map;
106 - } */
97 + if (Install::isPro())
98 + add_filter('mbsocial/displaycss/', array($this, 'addWebFont') );
107 99
108 -/* function parseButtons($buttons)
100 + }
101 +
102 + public function addWebFont($css)
109 103 {
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.
104 + $fonts = '';
112 105
113 - if ($this->data["ignore_container"] == 0)
114 - return $buttons; // ignore container off .
115 -
116 - foreach($buttons as $button)
117 - {
118 - $cache = $button->getCache();
119 -
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)
106 + if ( isset ($this->data[$this->blockname]['webfonts']))
123 107 {
124 - // tries to find the last part of the statement from - to {
125 - preg_match_all('/.([^-])*{/i', $cssline, $item);
126 108
127 - $item = trim(str_replace("{","",$item[0][0]));
128 - if ($item == '-center' || $item == '-container')
129 - {
130 - $cache = str_replace($cssline,'',$cache);
131 - }
109 + $webfonts = $this->data[$this->blockname]['webfonts'];
110 + $fonts .= '@import url(' . $webfonts . ');';
132 111
133 -
134 112 }
113 + return $fonts . $css;
114 + }
135 115
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)
144 - {
145 - if ($key != 'container_enabled' && $key != 'container_center_div_wrap') // causes container to be removed otherwise
146 - $container[$key] = '';
147 - }
148 -
149 - $button->setdata("container", $container);
150 - }
151 - return $buttons;
152 -
153 - } */
154 -
155 116 function parseCSS($css, $args)
156 117 {
157 118 $css = parent::parseCSS($css, $args);
158 119 $w = MBSocial()->whistle();
@@ -175,14 +136,12 @@
175 136 $css['mb-social']['normal']['background-color'] = $color;
176 137 $css['mb-social']['hover']['background-color'] = "darken($color, 10%)";
177 138 }
178 139
179 - /*$css['mb-icon.svg path']['normal']['color'] = '#fff';
180 - $css['mb-icon.svg path']['hover']['color'] = '#ff0000';
181 -*/
182 140 $css["mb-item"]["normal"]["float"] = "left";
183 141 $css["mb-item"]["normal"]["display"] = "inline-block";
184 142 $css["mb-item a"]["normal"]["cursor"] = "pointer"; // by default social share = call to action.
143 + $css['mb-item a']['normal']['text-decoration'] = 'none';
185 144
186 145
187 146 if (isset($blockdata['button_spacing']) && $blockdata['button_spacing'] > 0)
188 147 {
@@ -209,17 +168,9 @@
209 168 {
210 169 $blockdata = $this->data[$this->blockname];
211 170
212 171 $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');
219 172
220 - }
221 -
222 173 return $itemObj;
223 174
224 175 }
225 176
@@ -229,12 +180,76 @@
229 180 if (! isset($post["ignore_container"]) && ! is_null($post))
230 181 $data[$this->blockname]["ignore_container"] = 0;
231 182 if (! isset($post['use_background']) && ! is_null($post))
232 183 $data[$this->blockname]['use_background'] = 0;
184 +
185 +
186 + if ( count ($post) == 0)
187 + return $data; // don't run on default situations
188 +
189 + // Do the font here
190 + $blockdata = $this->data[$this->blockname];
191 + $font = $blockdata['font'];
192 + //$label_weight = $blockdata['font_label_weight'];
193 + // $icon_weight = $blockdata['icon_label_weight'];
194 +
195 + $args = array('font' => $font);
196 + $webfont = patches::checkWebFonts($args);
197 + $data[$this->blockname]['webfonts'] = $webfont;
198 +
199 +
233 200 return $data;
234 201
235 202 }
236 203
204 + function fontModal()
205 + {
206 + ?>
207 + <div class='maxmodal-data' id='add-fonts' data-load='window.maxFoundry.maxfonts.load' data-height='90%'>
208 + <span class='title'><?php _e("Font Manager","maxbuttons-pro"); ?>
209 +
210 + </span>
211 +
212 + <span class='content'>
213 + <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>
214 + <div class="loading_overlay"></div>
215 + <div class='loading'>
216 + <img src="<?php echo MB()->get_plugin_url(true) ?>images/loading.gif">
217 + <span><?php _e("Loading","maxbuttons-pro"); ?></span>
218 + </div>
219 + <div class="font_manager">
220 + <div class='font_search'> <span><?php _e("Search","maxbuttons-pro") ?></span>
221 + <input type='text' name='font_search' value='' />
222 + </div>
223 +
224 + <div class="font_wrap">
225 + <div class='font_left'>
226 + <ul class='items'>
227 +
228 + </ul>
229 + </div>
230 + <div class='font_right '>
231 + <ul class='items'>
232 +
233 + </ul>
234 + </div>
235 + </div>
236 + <div class='font_example'>
237 + <span class='placeholder'><?php _e("Click on a font to see an example","maxbuttons-pro"); ?></span>
238 + <span class='example_text'><?php _e("AaBbCcDdEeFfGgEeHh") ?></span>
239 + </div>
240 + </div>
241 + </span>
242 + <div class='controls'>
243 + <div class='controls_inline'>
244 + <button type='button' name='save_fonts' class='button-primary'><?php _e("Save changes", 'maxbuttons-pro'); ?></button> &nbsp;
245 + <button type='button' class='button-primary modal_close'><?php _e("Close","maxbuttons-pro"); ?></button>
246 + </div>
247 + </div>
248 + </div> <!-- maxmodal-data -->
249 + <?php
250 + }
251 +
237 252 function admin()
238 253 {
239 254 $admin = mbSocial()->admin();
240 255
@@ -290,8 +305,15 @@
290 305 $color_hover->name = $color_hover->id;
291 306 $admin->addField( $color_hover, '', 'end');
292 307
293 308 // FONTS
309 + /* $button = new maxField('generic');
310 + $button->label = '';
311 + $button->id = 'manage-fonts';
312 + $button->name = 'button_fonts';
313 + $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>';
314 + $admin->addField($button, 'start', 'end');
315 +*/
294 316 $fonts = MB()->getClass('admin')->loadFonts();
295 317
296 318 $field_font = new maxField('generic');
297 319 $field_font->label = __('Font Family','maxbuttons');
@@ -443,15 +465,15 @@
443 465 $admin->addUpdate($spacing);
444 466 $admin->addField($spacing, 'start', 'end');
445 467
446 468 $admin->display_fields();
447 -
448 469 ?>
449 470 </div> <!-- inside -->
450 471 </div> <!-- option container -->
451 472
452 473
474 + <?php $this->fontModal(); ?>
453 475
454 476 <?php
455 - }
477 +} // admin
456 478
457 479 }