|
4 | 4 | Plugin Name: ACF Input Counter
|
5 | 5 | Plugin URI: https://github.com/Hube2/acf-input-counter/
|
6 | 6 | Description: Show character count for limited text and textarea fields
|
7 |
| - Version: 0.1.0 |
| 7 | + Version: 1.1.0 |
8 | 8 | Author: John A. Huebner II
|
9 | 9 | Author URI: https://github.com/Hube2/
|
10 | 10 | GitHub Plugin URI: https://github.com/Hube2/acf-input-counter/
|
|
18 | 18 |
|
19 | 19 | class acf_input_counter {
|
20 | 20 |
|
21 |
| - private $version = '0.1.0'; |
| 21 | + private $version = '1.1.0'; |
22 | 22 |
|
23 | 23 | public function __construct() {
|
24 | 24 | add_action('acf/render_field/type=text', array($this, 'render_field'), 20, 1);
|
25 | 25 | add_action('acf/render_field/type=textarea', array($this, 'render_field'), 20, 1);
|
26 | 26 | add_action('acf/input/admin_enqueue_scripts', array($this, 'scripts'));
|
| 27 | + add_filter('jh_plugins_list', array($this, 'meta_box_data')); |
27 | 28 | } // end public function __construct
|
| 29 | + |
| 30 | + function meta_box_data($plugins=array()) { |
| 31 | + |
| 32 | + $plugins[] = array( |
| 33 | + 'title' => 'ACF Input Counter', |
| 34 | + 'screens' => array('acf-field-group', 'edit-acf-field-group'), |
| 35 | + 'doc' => 'https://github.com/Hube2/acf-input-counter' |
| 36 | + ); |
| 37 | + return $plugins; |
| 38 | + |
| 39 | + } // end function meta_box |
28 | 40 |
|
29 | 41 | private function run() {
|
30 | 42 | // cannot run on field group editor or it will
|
@@ -107,5 +119,48 @@ private function check($allow, $exist) {
|
107 | 119 | } // end private function check
|
108 | 120 |
|
109 | 121 | } // end class acf_input_counter
|
| 122 | + |
| 123 | + if (!function_exists('jh_plugins_list_meta_box')) { |
| 124 | + function jh_plugins_list_meta_box() { |
| 125 | + $plugins = apply_filters('jh_plugins_list', array()); |
| 126 | + |
| 127 | + $id = 'plugins-by-john-huebner'; |
| 128 | + $title = '<a style="text-decoration: none; font-size: 1em;" href="https://github.com/Hube2" target="_blank">Plugins by John Huebner</a>'; |
| 129 | + $callback = 'show_blunt_plugins_list_meta_box'; |
| 130 | + $screens = array(); |
| 131 | + foreach ($plugins as $plugin) { |
| 132 | + $screens = array_merge($screens, $plugin['screens']); |
| 133 | + } |
| 134 | + $context = 'side'; |
| 135 | + $priority = 'low'; |
| 136 | + add_meta_box($id, $title, $callback, $screens, $context, $priority); |
| 137 | + |
| 138 | + |
| 139 | + } // end function jh_plugins_list_meta_box |
| 140 | + add_action('add_meta_boxes', 'jh_plugins_list_meta_box'); |
| 141 | + |
| 142 | + function show_blunt_plugins_list_meta_box() { |
| 143 | + $plugins = apply_filters('jh_plugins_list', array()); |
| 144 | + ?> |
| 145 | + <p style="margin-bottom: 0;">Thank you for using my plugins</p> |
| 146 | + <ul style="margin-top: 0; margin-left: 1em;"> |
| 147 | + <?php |
| 148 | + foreach ($plugins as $plugin) { |
| 149 | + ?> |
| 150 | + <li style="list-style-type: disc; list-style-position:"> |
| 151 | + <?php |
| 152 | + echo $plugin['title']; |
| 153 | + if ($plugin['doc']) { |
| 154 | + ?> <a href="<?php echo $plugin['doc']; ?>" target="_blank">Documentation</a><?php |
| 155 | + } |
| 156 | + ?> |
| 157 | + </li> |
| 158 | + <?php |
| 159 | + } |
| 160 | + ?> |
| 161 | + </ul> |
| 162 | + <p><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hube02%40earthlink%2enet&lc=US&item_name=Donation%20for%20WP%20Plugins%20I%20Use&no_note=0&cn=Add%20special%20instructions%20to%20the%20seller%3a&no_shipping=1¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted" target="_blank">Please consider making a small donation.</a></p><?php |
| 163 | + } |
| 164 | + } // end if !function_exists |
110 | 165 |
|
111 | 166 | ?>
|
0 commit comments