PluginProbe
MaxButtons – Create buttons / 7.13.1
MaxButtons – Create buttons v7.13.1
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-button.php

maxbuttons-button.php in MaxButtons – Create buttons 7.13.1, at includes/maxbuttons-button.php

222 lines 9.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace MaxButtons;
3 defined('ABSPATH') or die('No direct access permitted');
4
5 $button_id = $this->view->button_id;
6 $button = $this->view->button;
7
8 $admin = MB()->getClass('admin');
9 $page_title = __("Button editor","maxbuttons");
10 $action = "<a class='page-title-action add-new-h2' href='" . $this->getButtonLink() . "'>" . __('Add New', 'maxbuttons') . "</a>";
11 $admin->get_header(array("title" => $page_title, "title_action" => $action) );
12 ?>
13 <form id="new-button-form" action="<?php echo $this->getButtonLink($button_id, array('noheader' => true)); // echo admin_url('admin.php?page=maxbuttons-controller&action=button&noheader=true'); ?>" method="post">
14 <input type="hidden" name="button_id" value="<?php echo $button_id ?>">
15 <?php wp_nonce_field("button-edit","maxbuttons_button") ?>
16 <?php wp_nonce_field("button-copy","copy_nonce"); ?>
17 <?php wp_nonce_field("button-delete","delete_nonce"); ?>
18 <?php wp_nonce_field('button-trash', 'trash_nonce'); ?>
19
20 <div class="form-actions">
21 <a class="button-primary button button-save" href='javascript:void(0);'><?php _e('Save', 'maxbuttons') ?></a>
22 <?php if ($button_id > 0): ?>
23 <a id="button-copy" class="maxmodal button" data-modal='copy-button' href="javascript:void(0)"><?php _e('Copy', 'maxbuttons') ?></a>
24 <a id="button-trash" class="maxmodal button" data-modal = 'trash-button' href="javascript:void(0);"><?php _e('Move to Trash', 'maxbuttons') ?></a>
25 <a class="button maxmodal" href="javascript:void(0);" data-modal='delete-button'><?php _e("Delete","maxbuttons"); ?> </a>
26 <?php endif; // button_id > 0 ?>
27
28 <?php do_action('mb/editor/form-actions', $button); ?>
29 </div>
30
31 <!-- delete modal -->
32 <div class="maxmodal-data" id="delete-button">
33 <span class='title'><?php _e("Removing button","maxbuttons"); ?></span>
34 <span class="content"><p><?php _e("You are about to permanently remove this button. Are you sure?", "maxbuttons"); ?></p></span>
35 <div class='controls'>
36 <button type="button" class='button-primary' data-buttonaction='delete' data-buttonid='<?php echo $button_id ?>'>
37 <?php _e('Yes','maxbuttons'); ?></button>
38
39 <a class="modal_close button-primary"><?php _e("No", "maxbuttons"); ?></a>
40
41 </div>
42 </div>
43
44 <!-- trash modal -->
45 <div class="maxmodal-data" id="trash-button">
46 <span class='title'><?php _e("Trash button","maxbuttons"); ?></span>
47 <span class="content"><p><?php _e("The button will be moved to trash. It can be recovered from the trash bin later. Continue?", "maxbuttons"); ?></p></span>
48 <div class='controls'>
49 <button type="button" class='button-primary' data-buttonaction='trash' data-buttonid='<?php echo $button_id ?>'>
50 <?php _e('Yes','maxbuttons'); ?></button>
51
52 <a class="modal_close button-primary"><?php _e("No", "maxbuttons"); ?></a>
53
54 </div>
55 </div>
56
57 <!-- copy modal -->
58 <div class='maxmodal-data' id='copy-button' data-load='window.maxFoundry.maxadmin.checkCopyModal'>
59 <span class='title'><?php _e("Copy this button","maxbuttons"); ?></span>
60 <span class="content">
61
62 <div class='copy-warning'>
63 <h3><?php _e('You probably don\'t want to copy your button!', 'maxbuttons'); ?></h3>
64 <p><?php _e( sprintf("Changing %sText%s and %sURL%s can be done with the same button. %s This will save you time in the near future", "<b>","</b>","<b>","</b>","<br>"),'maxbuttons'); ?> </p>
65
66 <p class="example">
67
68 <strong><?php _e("Add the same button with different link","maxbuttons"); ?></strong><br>
69 &nbsp; [maxbutton id="<?php echo $button_id ?>" url="http://yoururl"]
70 </p>
71
72 <p class="example"><strong><?php _e("Use the same button but change the text","maxbuttons"); ?> </strong><br />
73 &nbsp; [maxbutton id="<?php echo $button_id ?>" text="yourtext"]
74 </p>
75
76 <p class="example"><strong><?php _e("Both","maxbuttons"); ?> </strong><br />
77 &nbsp; [maxbutton id="<?php echo $button_id ?>" text="yourtext" url="http://yoururl"]
78 </p>
79
80 </div>
81
82
83 <div class='mb-message mb-notice copy-notice hidden'><p><?php _e('Your button has not been saved. Any changes will be lost!','maxbuttons'); ?></p>
84 </div>
85 <p><?php _e("Do you want to copy this button to a new button?","maxbuttons"); ?></p>
86 </span>
87 <span class="controls">
88 <button type="button" class='button-primary' data-buttonaction='copy' data-buttonid='<?php echo $button_id ?>'>
89 <?php _e('Copy','maxbuttons'); ?></button>
90
91 <a class='button modal_close'><?php _e("Cancel",'maxbuttons'); ?></a>
92 </span>
93 </div>
94
95 <?php
96 /** Display admin notices [deprecated]
97 * @ignore
98 */
99 /** Display admin notices
100 *
101 * Hook to display admin notices on error and other occurences in the editor. Follows WP guidelines on format.
102 * @since 4.20
103 */
104 do_action("mb/editor/display_notices");
105 ?>
106
107 <?php if ($button_id > 0): ?>
108 <div class="mb-message shortcode">
109 <?php $button_name = $button->getName();
110
111 ?>
112 <?php _e('To use this button, place the following shortcode anywhere you want it to appear in your site content:', 'maxbuttons') ?>
113 <strong>[maxbutton id="<?php echo $button_id ?>"]</strong>
114
115 <p><?php _e("Shortcode options can make using MaxButtons much easier! Check all possible options", 'maxbuttons'); ?> </p>
116
117 <span class='shortcode-expand closed'><h4><?php _e("How to make your life easier","maxbuttons"); ?>
118 <span class="dashicons-before dashicons-arrow-down"></span>
119 </h4>
120
121 </span>
122
123 <div class="expanded">
124 <p class="example">
125 <strong><?php _e("Add a button by using the button name","maxbuttons"); ?></strong>
126 &nbsp; [maxbutton name="<?php echo $button_name; ?>"]
127 </p>
128 <p class="example">
129 <strong><?php _e("Same button with different link","maxbuttons"); ?></strong>
130 &nbsp; [maxbutton id="<?php echo $button_id ?>" url="http://yoururl"]
131 </p>
132
133 <p class="example"><strong><?php _e("Same button with diffent text","maxbuttons"); ?> </strong>
134 &nbsp; [maxbutton id="<?php echo $button_id ?>" text="yourtext"]
135 </p>
136 <p class="example"><strong><?php _e("All possible shortcode options","maxbuttons"); ?></strong>
137 &nbsp; [maxbutton id="<?php echo $button_id ?>" text="yourtext" url="http://yoururl" linktitle="tooltip" window="new" nofollow="true"]
138 </p>
139
140 <h4><?php _e("More tips","maxbuttons"); ?></h4>
141 <p><?php _e("If you use this button on a static page, on multiple pages, or upload your theme to another WordPress installation choose an unique name and use ",
142 "maxbuttons"); ?> <strong>[maxbutton name='my-buy-button' url='http://yoururl']</strong>.
143 </p>
144
145 <p> <?php _e("By using this syntax when you edit and save your button it will be changed everywhere it is used on your site. If you delete the button and create a new one with the same name the new button will be used on your site. Easy!","maxbuttons"); ?>
146 </p>
147
148 </div>
149 </div>
150 <?php endif; ?>
151
152 <div class="output">
153 <div class="header"><?php _e('Preview', 'maxbuttons') ?>
154 <span class='preview-toggle dashicons dashicons-arrow-up'> </span>
155 </div>
156 <?php
157 // $border_box = get_option('maxbuttons_borderbox');
158 // $boxclass = '';
159 // if ($border_box == 1) // box-sizing option.
160 // $boxclass = 'preview-border-box';
161 ?>
162 <div class="inner">
163
164 <p><?php _e('The top is the normal button, the bottom one is the hover.', 'maxbuttons') ?></p>
165 <div class="result ">
166
167 <?php $button->display(array("mode" => 'editor', "load_css" => "element")); ?>
168
169 <p>&nbsp;</p>
170
171 <?php $button->display(array("mode" => 'editor', "preview_part" => ":hover", "load_css" => "element")); ?>
172
173 <?php $button->display_field_map(); ?>
174 </div>
175
176 <input type='hidden' id='colorpicker_current' value=''>
177
178 <div class="input mbcolor preview nodrag">
179 <input type="text" name="button_preview" id="button_preview" class="color-field" value="#ffffff">
180 </div>
181
182 <div class="note"><?php _e('Change this color to see your button on a different background.', 'maxbuttons') ?></div>
183 <input type="hidden" id="button_preview" value='' />
184 <input style="display: none;" type="text" id="button_output" name="button_output" value="" />
185
186 <div class="clear"></div>
187 </div> <!-- inner -->
188 </div> <!-- output -->
189
190 <div class='editor'>
191 <div id='normal_screen'>
192 <!-- <span class='dashicons dashicons-admin-home'>&nbsp;</span> -->
193
194 <?php #### STARTING FIELDS;
195 $button->admin_fields();
196 ?>
197 </div>
198 <!--
199 <div id='mobile_screen1'>
200 <span class='dashicons dashicons-admin-home'>&nbsp;</span>
201 - Screen 2 (wohoe)
202 </div>
203 -->
204
205 </div>
206 <div class="form-actions">
207 <a href="#" class="button-primary button-save"><?php _e('Save', 'maxbuttons') ?></a>
208 </div>
209
210 </form>
211
212 <?php // output the link dialog thing
213
214 if ( ! class_exists( '_WP_Editors', false ) )
215 require( ABSPATH . WPINC . '/class-wp-editor.php' );
216
217 //add the interface of the link picker.
218 \_WP_Editors::wp_link_dialog() ?>
219
220 </div>
221 <?php $admin->get_footer(); ?>
222