PluginProbe
MaxButtons – Create buttons / 6.5
MaxButtons – Create buttons v6.5
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
maxbuttons / includes / maxbuttons-collection-edit.php

maxbuttons-collection-edit.php in MaxButtons – Create buttons 6.5, at includes/maxbuttons-collection-edit.php

94 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 global $page_title;
3
4 $collections = MB()->getClass("collections");
5
6 $collection_type = (isset($_REQUEST["collection"])) ? sanitize_text_field($_REQUEST["collection"]) : 'basic';
7 $collection = $collections::getCollection($collection_type);
8
9
10 // handle submits
11 if ($_POST) {
12
13 $collection_id = intval($_POST["collection_id"]);
14 $collection->set($collection_id);
15
16 // this can be a new id (!)
17 $collection_id = $collection->save($_POST);
18 }
19 else
20 {
21 $collection_id = isset($_REQUEST["collection_id"]) ? intval($_REQUEST["collection_id"]) : 0;
22 }
23
24 $nonce = wp_create_nonce('collection-edit-' . $collection_id);
25 $block_nonce = wp_create_nonce('mbpro_collection_block-' . $collection_id);
26
27
28 $collection->set($collection_id);
29 $basic = $collection->getBlock("basic")->get();
30 $collection_name = $basic["name"];
31
32 $tab = isset($_REQUEST["tab"]) ? sanitize_text_field($_REQUEST["tab"]) : '';
33
34 $page_title = __("Edit Social Share", "maxbuttons");
35 $admin = MB()->getClass("admin");
36
37 $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>";
38
39 $admin->get_header(array("tabs_active" => true, "title" => $page_title, "title_action" => $action));
40
41
42 $button = MB()->getClass("button");
43
44 ?>
45 <?php if ($collection_id > 0): ?>
46 <div class="mb-message shortcode">
47 <?php $button_name = $button->getName(); ?>
48 <?php _e('To use this collection, place the following shortcode anywhere in your site content:', 'maxbuttons') ?>
49 <strong>[maxcollection id="<?php echo $collection_id ?>"]</strong> <i><?php _e("or","maxbuttons"); ?></i> <strong>[maxcollection name="<?php echo $collection_name ?>"]</strong>
50
51
52 </div>
53 <?php endif; ?>
54
55 <?php
56 /* Display admin notices [deprecated]
57 @ignore
58 */
59 do_action("mb_display_notices");
60
61 /* Display admin notices
62
63 Hook to display admin notices on error and other occurences in the editor. Follows WP guidelines on format. Use @see add_notice to add
64 notices.
65
66 @since 4.20
67 */
68 do_action('mb/collection/display_notices');
69 ?>
70
71
72 <form method="post" id='collection_edit' class="mb_ajax_save">
73
74
75 <?php $collection->showBlocks(); ?>
76
77
78 <?php $collection->display_field_map(); ?>
79 <input type="hidden" name="action" value="collection-edit">
80 <input type="hidden" name="collection_id" value="<?php echo $collection_id ?>">
81 <input type="hidden" name="nonce" value="<?php echo $nonce ?>">
82 <input type="hidden" name="block_nonce" value="<?php echo $block_nonce ?>">
83 <input type="hidden" name="tab" value="<?php echo $tab ?>" />
84 <input type="hidden" name="collection_type" value="<?php echo $collection_type ?>" >
85 </form>
86
87 <div class="form-actions">
88 <input type="submit" data-form='collection_edit' name="submit" value="<?php _e('Save All', 'maxbuttons') ?>" class="button-primary ">
89 </div>
90 <?php
91
92 $admin->get_footer();
93 ?>
94