PluginProbe
MaxButtons – Create buttons / 6.28
MaxButtons – Create buttons v6.28
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
← All changes | classes/admin-class.php +57 -2 6.246.28 View file →
@@ -7,8 +7,12 @@
7 7
8 8 protected $wpdb;
9 9 protected static $instance = null;
10 10
11 + protected $fields = array();
12 + protected $defined_fields = array();
13 + protected $defined_updatable = array();
14 +
11 15 function __construct()
12 16 {
13 17 global $wpdb;
14 18 $this->wpdb = $wpdb;
@@ -25,9 +29,9 @@
25 29
26 30 public function loadFonts()
27 31 {
28 32 $fonts = array(
29 - '' => '',
33 + '' => __('[Site Default]','maxbuttons'),
30 34 'Arial' => 'Arial',
31 35 'Courier New' => 'Courier New',
32 36 'Georgia' => 'Georgia',
33 37 'Tahoma' => 'Tahoma',
@@ -37,8 +41,59 @@
37 41 );
38 42 return $fonts;
39 43 }
40 44
45 +
46 + // add a maxfield to be displayed on the admin.
47 + public function addfield( $field, $start = '', $end = '')
48 + {
49 + $field_id = isset($field->id) ? $field->id : $field->template . \rand(0,1000);
50 +
51 + $field->publish = false; // Output fields via class - never output.
52 +
53 + $this->fields[$field_id] = array('field' => $field,
54 + 'start' => $start,
55 + 'end' => $end);
56 + $this->fields = apply_filters('mb/editor/addfield', $this->fields, $field);
57 +
58 + $this->defined_fields[] = $field_id;
59 + do_action('mb/editor/afterfield/'. $field_id);
60 + }
61 +
62 + public function display_fields($clean = true, $return = false)
63 + {
64 + $fields = apply_filters('mb/display_fields', $this->fields);
65 + $output = '';
66 +
67 +
68 + foreach($fields as $id => $item)
69 + {
70 + $field = $item['field'];
71 + $output .= $field->output($item['start'], $item['end']);
72 + }
73 +
74 + // auto-update system
75 + $updatable = $this->defined_updatable;
76 + foreach($updatable as $index => $field)
77 + {
78 + $updatable[$index] = '#' . $field;
79 + }
80 +
81 + $output .= ' <span class="updatables hidden">' . implode(',', $updatable) . '</span>';
82 +
83 + if ($clean)
84 + {
85 + $this->fields = array();
86 + $this->defined_updatable = array();
87 + }
88 +
89 + if (! $return)
90 + echo $output;
91 + else
92 + return $output;
93 +
94 +}
95 +
41 96 /* Get multiple buttons
42 97
43 98 Used for overview pages, retrieve buttons on basis of passed arguments.
44 99
@@ -303,9 +358,9 @@
303 358
304 359 if (! is_dir($dir))
305 360 return false;
306 361
307 - $file = fopen( trailingslashit($dir) . "/maxbuttons.log", "a+");
362 + $file = fopen( trailingslashit($dir) . "/maxbuttons.log", "a+");
308 363 $now = new DateTime() ;
309 364 $now_format = $now->format("d/M/Y H:i:s");
310 365
311 366 $write_string = "[" . $now_format . "] $action - $message ( $caller )";