| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | $collectionBlock["network"] = array('order' => 10, |
| 6 | 6 | 'class' => "networkBlock"); |
| 7 | 7 | |
| 8 | -use \simple_html_dom as simple_html_dom; | |
| 8 | +use \MaxButtons\simple_html_dom as simple_html_dom; | |
| 9 | 9 | use \MaxButtons\maxField as maxField; |
| 10 | 10 | use \MaxButtons\maxBlocks as maxBlocks; |
| 11 | 11 | use \MaxButtons\maxInstall as maxInstall; |
| 12 | 12 | |
| @@ -297,8 +297,14 @@ | ||
| 297 | 297 | |
| 298 | 298 | $button = MB()->getClass("button"); |
| 299 | 299 | $network_active = isset($post['network_item_active']) ? $post['network_item_active'] : array(); |
| 300 | 300 | |
| 301 | + // Dummy is to ensure conditionals work on network_active. | |
| 302 | + $index = array_search('dummy', $network_active); | |
| 303 | + if ($index !== false) | |
| 304 | + unset($network_active[$index]); | |
| 305 | + | |
| 306 | + | |
| 301 | 307 | //mbcustom |
| 302 | 308 | $mbcustom = isset($post['mbcustom_id']) ? $post['mbcustom_id'] : array(); |
| 303 | 309 | $data[$this->blockname]['mbcustom'] = array(); |
| 304 | 310 | |
| @@ -329,11 +335,15 @@ | ||
| 329 | 335 | } |
| 330 | 336 | |
| 331 | 337 | // new user, give default networks |
| 332 | 338 | $collection_id = $this->collection->getID(); |
| 339 | + | |
| 340 | + | |
| 333 | 341 | if (count($network_active) == 0 && $collection_id == 0) |
| 334 | 342 | $network_active = array('facebook', 'twitter'); // default options |
| 335 | 343 | |
| 344 | + | |
| 345 | + | |
| 336 | 346 | $data[$this->blockname]["network_active"] = $network_active; |
| 337 | 347 | return $data; |
| 338 | 348 | } |
| 339 | 349 | |
| @@ -376,13 +386,32 @@ | ||
| 376 | 386 | $active_networks = isset($blockdata['network_active']) ? $blockdata['network_active'] : array(); |
| 377 | 387 | $networks = $admin->get_networks($active_networks); |
| 378 | 388 | $styleObj = $this->collection->getStyle(); |
| 379 | 389 | |
| 390 | +/* | |
| 391 | + No clue what this is doing here. | |
| 392 | +foreach ($networks as $type => $data) | |
| 393 | + { | |
| 394 | + echo $type; var_dump($data); | |
| 395 | + foreach ($data as $network_id => $network) | |
| 396 | + { | |
| 397 | + $label = $network->get_nice_name(); | |
| 398 | + $icon = $network->get('icon'); | |
| 399 | + $icon_type = $network->get('icon_type'); | |
| 400 | + $color = $network->get('color'); | |
| 401 | + | |
| 402 | + $field = new maxField('switch'); | |
| 403 | + $field->id = $network->get('name'); | |
| 404 | + $field->label = $label; | |
| 405 | + | |
| 406 | + $admin->addField($field, 'start', 'end'); | |
| 407 | + } | |
| 408 | + } */ | |
| 380 | 409 | ?> |
| 381 | 410 | <div class='help-side'> |
| 382 | 411 | <h3><?php _e('Social Networks','mbsocial'); ?></h3> |
| 383 | - <p>Drag and drop the networks you want to use into the 'active' box. You can find additional networks under the 'more networks' tab.</p> | |
| 384 | - <p>Hold the mouse pointer over the network icon to see the network's name</p> | |
| 412 | + <p><?php printf(__('%s Drag and drop %s the networks you want to use into the \'active\' box. You can find additional networks under the \'more networks\' tab.', 'mbsocial'), '<strong>', '</strong>'); ?></p> | |
| 413 | + <p><?php __('Hold the mouse pointer over the network icon to see the network\'s name', 'mbsocial'); ?></p> | |
| 385 | 414 | <p>The <strong>Share Page</strong> networks will share your website's URL to other networks. </p> |
| 386 | 415 | <p>The <strong>Share Profile</strong> networks will link from the website to your social accounts</p> |
| 387 | 416 | </div> |
| 388 | 417 | <div class='options networks option-container' id='networkBlock' data-refresh='previewBlock'> |
| @@ -396,8 +425,9 @@ | ||
| 396 | 425 | $admin->addField($field_obj); |
| 397 | 426 | $admin->addUpdate($field_obj); |
| 398 | 427 | $admin->display_fields(); |
| 399 | 428 | |
| 429 | + | |
| 400 | 430 | ?> |
| 401 | 431 | <div class='title'><?php _e('Social Networks','mbsocial') ?> </div> |
| 402 | 432 | <div class='inside'> |
| 403 | 433 | <div class='option active_network'> |
| @@ -404,8 +434,10 @@ | ||
| 404 | 434 | <label><?php _e('Active','mbsocial'); ?></label> |
| 405 | 435 | <div class='drag-area input' data-area='active'> |
| 406 | 436 | <span class="updatables hidden">input[name="network_active"], input[name="network_item_active"]</span> |
| 407 | 437 | |
| 438 | + <input type="hidden" name="network_item_active[]" value="dummy"> | |
| 439 | + | |
| 408 | 440 | <?php if (isset($networks['selected'])): foreach($networks['selected'] as $index => $network): ?> |
| 409 | 441 | |
| 410 | 442 | <?php |
| 411 | 443 | $args = array(); |
| @@ -414,9 +446,12 @@ | ||
| 414 | 446 | |
| 415 | 447 | $this->printNetwork($index, $network, $args ); |
| 416 | 448 | |
| 417 | 449 | ?> |
| 418 | - <?php endforeach; endif; ?> | |
| 450 | + <?php endforeach; | |
| 451 | + else: ?> | |
| 452 | + <?php | |
| 453 | + endif; ?> | |
| 419 | 454 | </div> |
| 420 | 455 | </div> |
| 421 | 456 | |
| 422 | 457 | |
| @@ -500,9 +535,9 @@ | ||
| 500 | 535 | </p> |
| 501 | 536 | |
| 502 | 537 | |
| 503 | 538 | <?php if (Install::isPro()): ?> |
| 504 | - <p><?php _e('The MaxButtons option lets you a MaxButton and configure it.','mbsocial') ?></p> | |
| 539 | + <p><?php _e('The MaxButtons option lets you add a MaxButton and configure it.','mbsocial') ?></p> | |
| 505 | 540 | <?php endif; ?> |
| 506 | 541 | </div> |
| 507 | 542 | |
| 508 | 543 | <div class='hidden mbcustom-helper'> |
| @@ -697,6 +732,4 @@ | ||
| 697 | 732 | <?php |
| 698 | 733 | } |
| 699 | 734 | |
| 700 | 735 | } |
| 701 | - | |
| 702 | -?> | |