PluginProbe
Social Share Buttons / 1.18
Social Share Buttons v1.18
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
share-button / classes / blocks / effect_block.php

effect_block.php in Social Share Buttons 1.18, at classes/blocks/effect_block.php

132 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace MBSocial;
3 defined('ABSPATH') or die('No direct access permitted');
4
5 use \MaxButtons\maxField as maxField;
6 use \MaxButtons\maxBlocks as maxBlocks;
7 use \MaxButtons\maxButton as maxButton;
8
9 $collectionBlock["effect"] = array('class' => "effectBlock",
10 'order' => 55);
11
12 class effectBlock extends block
13 {
14
15 protected $blockname = "effect";
16 protected $fields = array(
17 'effect_type' => array('default' => 'none'),
18 'scale' => array('default' => '120'),
19 );
20
21
22 public function parseCSS($css,$args)
23 {
24 $blockdata = $this->data[$this->blockname];
25 //$is_active = isset($blockdata['use_effect']) && $blockdata['use_effect'] == 1 ? true : false;
26
27 //if (! $is_active)
28 // return $css;
29
30 $effect = $this->getValue('effect_type');
31 $style = $this->collection->getStyle();
32
33 // maybe this should be moved to style object in time(?)
34 switch($effect)
35 {
36 case 'transform':
37 $scale = $this->getvalue('scale');
38 $scale = $scale / 10;
39 $css = $style->addEffect($css, $effect, array('scale' => $scale));
40
41 break;
42
43 case 'drop':
44 case 'shift':
45 case 'lift' :
46
47 $layoutBlock = $this->collection->getBlock('layoutBlock');
48 $labelsize = $layoutBlock->getValue('font_label_size');
49
50 $css = $style->addEffect($css, $effect, array('line_height' => $labelsize));
51 break;
52 default:
53 $css = $style->addEffect($css, $effect);
54 break;
55 }
56
57
58 $css['mb-social']['normal']['transition'] = 'all 0.4s linear';
59
60
61 return $css;
62 }
63
64
65 public function admin()
66 {
67 $admin = mbSocial()->admin();
68
69
70
71 $types = array('none' => __('None', 'mbsocial'),
72 'hover' => __('Hover', 'mbsocial'),
73 'transform' => __('Enlarge', 'mbsocial'),
74 'drop' => __('Drop', 'mbsocial'),
75 'lift' => __('Lift from down', 'mbsocial'),
76 'shift' => __('Shift from left', 'mbsocial'),
77 'flip' => __('Flip', 'mbsocial'),
78 'stretch' => __('Stretch', 'mbsocial'),
79 );
80
81 $shape_icons = array();
82
83 ?>
84 <div class='help-side'>
85 <h3><?php _e('Effect Options', 'mbsocial'); ?></h3>
86
87 <p><?php _e('These will modify the behavior when a user hovers the mouse cursor over the share buttons', 'mbsocial') ?></p>
88
89 </div>
90
91 <div class='options option-container style' id='effectBlock' data-refresh='previewBlock' >
92 <?php if (! Install::isPRO() ) : ?>
93 <div class='forpro overlay'><div><?php echo $admin->getProMessage(); ?></div></div>
94 <?php endif; ?>
95 <div class='title'><?php _e('Hover Effects', 'mbsocial'); ?></div>
96 <div class='inside'>
97 <?php
98
99 $etype = new maxField('option_select');
100 $etype->id = 'effect_type';
101 $etype->name = $etype->id;
102 $etype->label = __('Type', 'mbsocial');
103 $etype->options = $types;
104 $etype->selected = $this->getValue($etype->id);
105
106
107 $admin->addField($etype, 'start','end');
108
109 $scale = new maxField('number');
110 $scale->id = 'scale';
111 $scale->name = $scale->id;
112 $scale->label = __('Scale', 'mbsocial');
113 $scale->inputclass = 'tiny';
114 $scale->min = '100';
115 $scale->default = 'Enlarge in %. 100% is same size';
116 $scale->value = $this->getValue('scale');
117 $scale->start_conditional = htmlentities(json_encode(array('target' => $etype->id, 'values' => array('transform') )));
118
119 $admin->addField($scale, 'start','end');
120
121 $admin->display_fields();
122 ?>
123 </div>
124 </div>
125 <?php
126 } // admin
127
128
129
130
131 }
132