| @@ -2,9 +2,8 @@ | ||
| 2 | 2 | namespace MBSocial; |
| 3 | 3 | defined('ABSPATH') or die('No direct access permitted'); |
| 4 | 4 | |
| 5 | 5 | use MaxButtons\maxButton as maxButton; |
| 6 | -use MaxButtons\maxBlocks as maxBlocks; | |
| 7 | 6 | |
| 8 | 7 | $button = new maxButton(); // this loads the maxblocks template files |
| 9 | 8 | |
| 10 | 9 | |
| @@ -18,109 +17,40 @@ | ||
| 18 | 17 | $admin->header($header); |
| 19 | 18 | |
| 20 | 19 | |
| 21 | 20 | $collection_ids = collections::getCollections(); |
| 22 | -$number_of_collections = count($collection_ids); | |
| 23 | 21 | |
| 24 | -$the_collection_id = isset($_GET['social_id']) ? intval($_GET['social_id']) : false; | |
| 25 | 22 | |
| 26 | -if ($the_collection_id === false && $number_of_collections > 0 ) | |
| 27 | -{ | |
| 28 | - $the_collection_id = $collection_ids[0]; // load the first one | |
| 29 | -} | |
| 30 | -else { | |
| 31 | - $collection_id = 0; | |
| 32 | -} | |
| 33 | -?> | |
| 23 | +if (count($collection_ids) == 0) | |
| 24 | + $collection_ids = array(0); | |
| 34 | 25 | |
| 35 | -<form class='mb-ajax-form' data-action='save-share'> | |
| 36 | 26 | |
| 27 | +?> | |
| 37 | 28 | |
| 38 | -<?php if($number_of_collections > 0) : ?> | |
| 39 | -<div class='help-side collection_switcher'> | |
| 40 | - <h3>Your Social Groups</h3> | |
| 41 | - <?php // | |
| 42 | - //if (Install::isPro()): | |
| 29 | +<?php foreach ($collection_ids as $collection_id): ?> | |
| 43 | 30 | |
| 44 | - foreach($collection_ids as $id) { | |
| 45 | - $collection = new collection($id); | |
| 46 | - $genBlock = $collection->getBlock('generalBlock'); | |
| 47 | - $name = $genBlock->getValue('name'); | |
| 48 | - $nwBlock = $collection->getBlock('networkBlock'); | |
| 49 | - | |
| 50 | - $networks_number = count($nwBlock->getValue('network_active')); // ) | |
| 51 | - | |
| 52 | - $name = ( strlen($name) > 0) ? $name : '#' . $id; | |
| 53 | - $active = ($id == $the_collection_id) ? 'active' : ''; | |
| 54 | - | |
| 55 | - if ( Install::isPRO() ) | |
| 56 | - $link = '<span><a href="' . add_query_arg('social_id', $id) . '">' . $name . '</a></span>'; | |
| 57 | - else { | |
| 58 | - $link = '<span>' . $name . '</span>'; | |
| 59 | - } | |
| 60 | - echo '<div class="item ' . $active . '">'; | |
| 61 | - echo $link; | |
| 62 | - echo '<span> [' . $networks_number . ' buttons] </span>'; | |
| 63 | - echo '<span> [maxsocial id="' . $id . '"] </span>'; | |
| 64 | - echo '</div>'; | |
| 65 | - | |
| 66 | - } | |
| 67 | - | |
| 68 | - if ( Install::isPRO() ) | |
| 69 | - { | |
| 70 | - $link = '<a href="' . add_query_arg('social_id', 0) . '" title="' . __('Add', 'mbsocial') . '"> <span class="plus">+</span> ' . __('Add', 'mbsocial') . '</a>'; | |
| 71 | - } | |
| 72 | - else { | |
| 73 | - $link = '<a><span class="plus">+</span> ' . __('Add', 'mbsocial') . '</a>'; | |
| 74 | - } | |
| 75 | - | |
| 76 | - echo '<span class="item new">' . $link . '</span>'; | |
| 77 | - | |
| 78 | - | |
| 79 | - if (! Install::isPro() ) | |
| 80 | - { ?> | |
| 81 | - <div class='forpro overlay'><div><?php echo $admin->getProMessage(); ?></div></div> | |
| 82 | - <?php } ?> | |
| 31 | +<?php if ($collection_id > 0): ?> | |
| 32 | +<div class='mb-message shortcode'> | |
| 33 | + <?php printf(__('Shortcode for manual use: [maxsocial id="%s"]','mbsocial'), $collection_id); ?> | |
| 83 | 34 | </div> |
| 84 | 35 | <?php endif; ?> |
| 85 | 36 | |
| 86 | - <?php if ($the_collection_id > 0): | |
| 87 | - $collection_id = $the_collection_id; | |
| 88 | - ?> | |
| 37 | +<form class='mb-ajax-form' data-action='save-share'> | |
| 38 | + <input type='hidden' name="collection_id" value="<?php echo $collection_id ?>" /> | |
| 89 | 39 | |
| 90 | - <div class='mb-message shortcode'> | |
| 91 | - <?php printf(__('Shortcode for manual use: [maxsocial id="%s"]','mbsocial'), $collection_id); ?> | |
| 92 | - </div> | |
| 93 | - <?php endif; ?> | |
| 94 | 40 | |
| 95 | - <input type='hidden' name="collection_id" value="<?php echo $collection_id ?>" /> | |
| 96 | - <input type='hidden' name="form_post" value="true" /> | |
| 97 | - | |
| 98 | 41 | <div class="form-actions "> |
| 99 | - <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'mbsocial') ?></button> | |
| 100 | - <?php if ($collection_id > 0 && Install::isPro()): ?> | |
| 101 | - <button type='button' class='button remove maxmodal' data-modal='modal_remove'><?php _e('Delete', 'mbsocial'); ?></button> | |
| 102 | - <?php endif; ?> | |
| 42 | + <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'maxbuttons') ?></button> | |
| 103 | 43 | </div> |
| 104 | 44 | |
| 45 | + <?php include('share_editor.php'); ?> | |
| 105 | 46 | |
| 106 | - <?php include('share_editor.php'); ?> | |
| 47 | + <?php //$admin->output_defined_fields(); ?> | |
| 107 | 48 | |
| 108 | 49 | |
| 50 | + | |
| 109 | 51 | <div class="form-actions"> |
| 110 | - <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'mbsocial') ?></button> | |
| 52 | + <button type="button" class="button-primary button-save mb-ajax-submit" data-action='save_collection'><?php _e('Save', 'maxbuttons') ?></button> | |
| 111 | 53 | </div> |
| 112 | - | |
| 113 | - <div id='modal_remove' class='maxmodal-data'> | |
| 114 | - <div class='title'><?php _e('Delete Social Group', 'mbsocial'); ?></div> | |
| 115 | - <span class="content"><p><?php _e("You are about to permanently remove this Social Group. Are you sure?", "mbsocial"); ?></p></span> | |
| 116 | - <div class='controls'> | |
| 117 | - <button type="button" class='button-primary mb-ajax-action' data-action='remove-collection' data-param='<?php echo $collection_id ?>'> | |
| 118 | - <?php _e('Yes','mbsocial'); ?></button> | |
| 119 | - | |
| 120 | - <a class="modal_close button-primary"><?php _e("No", "mbsocial"); ?></a> | |
| 121 | - | |
| 122 | - </div> | |
| 123 | - | |
| 124 | - </div> <!-- modal --> | |
| 125 | 54 | <?php $admin->footer(); ?> |
| 126 | 55 | </form> |
| 56 | +<?php endforeach; ?> | |