| 1 |
<?php |
| 2 |
namespace MaxButtons; |
| 3 |
defined('ABSPATH') or die('No direct access permitted'); |
| 4 |
|
| 5 |
global $page_title; |
| 6 |
$page_title = __("Social Share", "maxbuttons"); |
| 7 |
$admin = MB()->getClass("admin"); |
| 8 |
|
| 9 |
$action = "<a class='page-title-action add-new-h2' href='" . admin_url() . "admin.php?page=maxbuttons-collections&action=edit&collection=social'>" . __('Add New', 'maxbuttons') . "</a>"; |
| 10 |
|
| 11 |
$admin->get_header(array("tabs_active" => true, "title" => $page_title, "title_action" => $action)); |
| 12 |
|
| 13 |
$collections = maxCollections::getCollections(); |
| 14 |
$maxCol = new maxCollection(); |
| 15 |
?> |
| 16 |
|
| 17 |
<a class="page-title-action collection-addnew" href="<?php echo admin_url() ?>admin.php?page=maxbuttons-collections&action=edit&collection=social"> |
| 18 |
<?php _e("Add New","maxbuttons"); ?></a> |
| 19 |
|
| 20 |
<?php |
| 21 |
|
| 22 |
/* Display admin notices |
| 23 |
|
| 24 |
Hook to display admin notices on error and other occurences in the editor. Follows WP guidelines on format. |
| 25 |
@since 4.20 |
| 26 |
*/ |
| 27 |
do_action('mb/collection/display_notices'); |
| 28 |
?> |
| 29 |
</span> |
| 30 |
|
| 31 |
|
| 32 |
<span class="remove_action_title" style="display:none"><?php _e("Removing this collection","maxbuttons"); ?></span> |
| 33 |
<span class="remove_action_text" style="display:none"><?php _e("Are you sure you want to permanently delete this collection?", "maxbuttons"); ?></span> |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
<div class='collection_list'> |
| 38 |
<?php |
| 39 |
|
| 40 |
|
| 41 |
foreach ($collections as $index => $data) |
| 42 |
{ |
| 43 |
$id = $data["collection_id"]; |
| 44 |
$name = $maxCol->get_meta($id, "collection_name"); |
| 45 |
$name = isset($name['collection_name']) ? $name["collection_name"] : ''; |
| 46 |
|
| 47 |
|
| 48 |
$collection = maxCollections::getCollectionById($id); |
| 49 |
if (! $collection) |
| 50 |
continue; |
| 51 |
|
| 52 |
$collection_type = $collection->getType(); |
| 53 |
$block_nonce = wp_create_nonce('mbpro_collection_block-' . $id); |
| 54 |
|
| 55 |
$button_count = 0; |
| 56 |
$picker = $collection->getBlock("picker"); |
| 57 |
if ($picker) |
| 58 |
{ |
| 59 |
$picker_data = $picker->get(); |
| 60 |
$button_count = count($picker_data["selection"]); |
| 61 |
} |
| 62 |
|
| 63 |
?> |
| 64 |
|
| 65 |
<div class='collection collection-<?php echo $id ?>' data-id="<?php echo $id ?>" data-blocknonce="<?php echo $block_nonce ?>" data-type="<?php echo $collection_type ?>"> |
| 66 |
<div class="collection_remove dashicons dashicons-no"></div> |
| 67 |
|
| 68 |
<h3 class='title'><a href="?page=maxbuttons-collections&action=edit&collection=social&collection_id=<?php echo $id ?>"><?php echo $name; ?></a> |
| 69 |
|
| 70 |
<?php if ($button_count > 0): ?> |
| 71 |
<span class="button-count">(<?php echo $button_count ?> <?php _e("Buttons","maxbuttons"); ?>)</span> |
| 72 |
<?php endif; ?> |
| 73 |
</h3> |
| 74 |
|
| 75 |
<div class="collection-container"> |
| 76 |
<?php |
| 77 |
|
| 78 |
$args = array("preview" => true, |
| 79 |
|
| 80 |
); |
| 81 |
|
| 82 |
$collection->display($args); |
| 83 |
|
| 84 |
?> |
| 85 |
</div> |
| 86 |
<p>[maxcollection id="<?php echo $id ?>"]</p> |
| 87 |
<p><a href="?page=maxbuttons-collections&action=edit&collection=social&collection_id=<?php echo $id ?>"><?php _e("Edit","maxbuttons"); ?></a></p> |
| 88 |
<!-- <p>[ Edit - Delete ] </p> --> |
| 89 |
|
| 90 |
</div> |
| 91 |
<?php |
| 92 |
} |
| 93 |
|
| 94 |
if (count($collections) == 0) |
| 95 |
{ |
| 96 |
do_action("mb-display-collection-welcome"); |
| 97 |
} |
| 98 |
?> |
| 99 |
|
| 100 |
</div> <!-- // collection-list --> |
| 101 |
</div> <!-- // main --> |
| 102 |
<div class="ad-wrap"> |
| 103 |
<?php do_action("mb-display-ads"); ?> |
| 104 |
</div> |
| 105 |
|
| 106 |
<?php |
| 107 |
$admin->get_footer(); |
| 108 |
|