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/profile_block.php +73 -5 1.61.19 View file →
@@ -30,13 +30,18 @@
30 30 if ($network->is_social_share())
31 31 {
32 32 $this->fields['useprofile_' . $name] = array('default' => 0);
33 33 }
34 + if ($network->has_alternate())
35 + {
36 + $this->fields['use_alternate_' . $name] = array('default' => 0);
37 + }
34 38 }
35 39 }
36 40
37 41 MBSocial()->whistle()->listen('display/vars/profile', array($this, 'get_profile'), 'ask'); // somebody asks for profile name
38 42 MBSocial()->whistle()->listen('editor/profile/use', array($this, 'get_profile_use'), 'ask'); // somebody asks for useprofile settings
43 + MBSocial()->whistle()->listen('editor/profile/alternate', array($this, 'get_alternate_use'), 'ask'); // somebody
39 44 }
40 45
41 46 public function get_profile()
42 47 {
@@ -75,8 +80,40 @@
75 80 }
76 81 }
77 82 }
78 83
84 + public function get_alternate_use()
85 + {
86 + $network = MBSocial()->whistle()->ask('display/parse/network');
87 + $name = $network->get('network');
88 + $blockdata = $this->data[$this->blockname];
89 +
90 + if (is_object($network))
91 + {
92 + if ($network->has_alternate())
93 + {
94 + if (isset($blockdata['use_alternate_'. $name]))
95 + {
96 + return $blockdata['use_alternate_' . $name];
97 + }
98 + }
99 + return false;
100 + }
101 + }
102 +
103 + public function save_fields($data, $post)
104 + {
105 + $data = parent::save_fields($data, $post);
106 +
107 + // Filter URL
108 + if (isset($data[$this->blockname]['profile_rss']) && strlen($data[$this->blockname]['profile_rss'] > 0))
109 + {
110 + $data[$this->blockname]['profile_rss'] = esc_url_raw($data[$this->blockname]['profile_rss']);
111 + }
112 +
113 + return $data;
114 + }
115 +
79 116 public function admin()
80 117 {
81 118 $admin = mbSocial()->admin();
82 119 $active_networks = isset($this->data['network']['active']) ? $this->data['network']['active'] : array();
@@ -81,8 +118,10 @@
81 118 $admin = mbSocial()->admin();
82 119 $active_networks = isset($this->data['network']['active']) ? $this->data['network']['active'] : array();
83 120 $networks = mbSocial()->networks()->get(); // all networks!
84 121
122 +
123 +
85 124 foreach($networks as $network)
86 125 {
87 126 if ($network->is_share_icon() )
88 127 {
@@ -118,20 +157,49 @@
118 157 {
119 158 $sw = new maxField('switch');
120 159 $sw->id = 'useprofile_' . $name;
121 160 $sw->name = $sw->id;
122 - $sw->label = '';
123 - $sw->label = __('Use Profile', 'mbsocial');
161 + $sw->label = __('Share Profile', 'mbsocial');
124 162 $sw->value = 1;
125 163 $sw->inputclass = 'check_button icon';
126 164 $sw->checked = checked(1, $this->getValue($sw->name), false);
127 165
128 - $admin->addField($sw, '','end', false);
166 + // $sw->mainclass = 'switch';
167 +
168 + // dunno about that.
169 + //$admin->addField($sw, 'group_start',array('group_end', 'end'), false);
170 + // $end = $network->has_alternate() ? '' : 'end';
171 + $admin->addField($sw, '', 'end', false);
129 172 }
130 173
174 + if ($network->has_alternate())
175 + {
176 + $spacer = new maxField('spacer');
177 + $spacer->id = 'spacer-alternate';
178 + $spacer->name = $spacer->id;
179 + $spacer->label = ' ';
180 + $spacer->main_class = 'option alternate_profile';
181 + $spacer->start_conditional = htmlentities(json_encode(array("target" => 'useprofile_'. $name, 'values' => 'checked')));
182 +
183 + $spacer2 = clone $spacer;
184 + $spacer2->id = 'spacer-alt-2';
185 + $spacer2->name = $spacer2->id;
186 +
187 + $admin->addField($spacer, 'start', '', false);
188 + $admin->addField($spacer2, '', '', false);
189 +
190 + $alt = new MaxField('switch');
191 + $alt->id = 'use_alternate_' . $name;
192 + $alt->name = $alt->id;
193 + $alt->label = $network->get('alternate_label');
194 + $alt->value = 1;
195 + $alt->inputclass = 'check_button icon';
196 + $alt->checked = checked($alt->value, $this->getValue($alt->name), false);
197 +
198 + $admin->addField($alt, '','end', false);
199 + }
131 200 }
132 201
133 -
134 202 }
135 203
136 204 if (count($networks) > 0)
137 205 {
@@ -140,9 +208,9 @@
140 208 <h3><?php _e('Profile Options', 'mbsocial'); ?></h3>
141 209
142 210 <p>Fill out the link to your profile on the network. </p>
143 211
144 - <p><strong>Use Profile :</strong> Check this to share your profile instead of the current page. This option is available for networks supporting both options</p>
212 + <p><strong>Share Profile :</strong> Check this to share your profile instead of the current page. This option is available for networks supporting both options</p>
145 213 </div>
146 214
147 215 <div class='options option-container layout' id='profileBlock' data-refresh='previewBlock' >
148 216 <div class='title'><?php _e('Profiles', 'mbsocial' ); ?></div>