addons.php
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * acf_addons |
| 5 | * |
| 6 | * @description: controller for add-ons sub menu page |
| 7 | * @since: 3.6 |
| 8 | * @created: 25/01/13 |
| 9 | */ |
| 10 | |
| 11 | class acf_addons |
| 12 | { |
| 13 | |
| 14 | var $action; |
| 15 | |
| 16 | |
| 17 | /* |
| 18 | * __construct |
| 19 | * |
| 20 | * @description: |
| 21 | * @since 3.1.8 |
| 22 | * @created: 23/06/12 |
| 23 | */ |
| 24 | |
| 25 | function __construct() |
| 26 | { |
| 27 | // actions |
| 28 | add_action('admin_menu', array($this,'admin_menu'), 11, 0); |
| 29 | } |
| 30 | |
| 31 | |
| 32 | /* |
| 33 | * admin_menu |
| 34 | * |
| 35 | * @description: |
| 36 | * @created: 2/08/12 |
| 37 | */ |
| 38 | |
| 39 | function admin_menu() |
| 40 | { |
| 41 | // add page |
| 42 | $page = add_submenu_page('edit.php?post_type=acf', __('Add-ons','acf'), __('Add-ons','acf'), 'manage_options', 'acf-addons', array($this,'html')); |
| 43 | |
| 44 | |
| 45 | // actions |
| 46 | add_action('load-' . $page, array($this,'load')); |
| 47 | add_action('admin_print_scripts-' . $page, array($this, 'admin_print_scripts')); |
| 48 | add_action('admin_print_styles-' . $page, array($this, 'admin_print_styles')); |
| 49 | add_action('admin_head-' . $page, array($this,'admin_head')); |
| 50 | } |
| 51 | |
| 52 | |
| 53 | /* |
| 54 | * load |
| 55 | * |
| 56 | * @description: |
| 57 | * @since 3.5.2 |
| 58 | * @created: 16/11/12 |
| 59 | * @thanks: Kevin Biloski and Charlie Eriksen via Secunia SVCRP |
| 60 | */ |
| 61 | |
| 62 | function load() |
| 63 | { |
| 64 | |
| 65 | } |
| 66 | |
| 67 | |
| 68 | /* |
| 69 | * admin_print_scripts |
| 70 | * |
| 71 | * @description: |
| 72 | * @since 3.1.8 |
| 73 | * @created: 23/06/12 |
| 74 | */ |
| 75 | |
| 76 | function admin_print_scripts() |
| 77 | { |
| 78 | |
| 79 | } |
| 80 | |
| 81 | |
| 82 | /* |
| 83 | * admin_print_styles |
| 84 | * |
| 85 | * @description: |
| 86 | * @since 3.1.8 |
| 87 | * @created: 23/06/12 |
| 88 | */ |
| 89 | |
| 90 | function admin_print_styles() |
| 91 | { |
| 92 | wp_enqueue_style(array( |
| 93 | 'wp-pointer', |
| 94 | 'acf-global', |
| 95 | 'acf', |
| 96 | )); |
| 97 | } |
| 98 | |
| 99 | |
| 100 | /* |
| 101 | * admin_head |
| 102 | * |
| 103 | * @description: |
| 104 | * @since 3.1.8 |
| 105 | * @created: 23/06/12 |
| 106 | */ |
| 107 | |
| 108 | function admin_head() |
| 109 | { |
| 110 | |
| 111 | } |
| 112 | |
| 113 | |
| 114 | /* |
| 115 | * html |
| 116 | * |
| 117 | * @description: |
| 118 | * @since 3.1.8 |
| 119 | * @created: 23/06/12 |
| 120 | */ |
| 121 | |
| 122 | function html() |
| 123 | { |
| 124 | // vars |
| 125 | $dir = apply_filters('acf/get_info', 'dir'); |
| 126 | |
| 127 | |
| 128 | $premium = array(); |
| 129 | $premium[] = array( |
| 130 | 'title' => __("Repeater Field",'acf'), |
| 131 | 'description' => __("Create infinite rows of repeatable data with this versatile interface!",'acf'), |
| 132 | 'thumbnail' => $dir . 'images/add-ons/repeater-field-thumb.jpg', |
| 133 | 'active' => class_exists('acf_field_repeater'), |
| 134 | 'url' => 'http://www.advancedcustomfields.com/add-ons/repeater-field/' |
| 135 | ); |
| 136 | $premium[] = array( |
| 137 | 'title' => __("Gallery Field",'acf'), |
| 138 | 'description' => __("Create image galleries in a simple and intuitive interface!",'acf'), |
| 139 | 'thumbnail' => $dir . 'images/add-ons/gallery-field-thumb.jpg', |
| 140 | 'active' => class_exists('acf_field_gallery'), |
| 141 | 'url' => 'http://www.advancedcustomfields.com/add-ons/gallery-field/' |
| 142 | ); |
| 143 | $premium[] = array( |
| 144 | 'title' => __("Options Page",'acf'), |
| 145 | 'description' => __("Create global data to use throughout your website!",'acf'), |
| 146 | 'thumbnail' => $dir . 'images/add-ons/options-page-thumb.jpg', |
| 147 | 'active' => class_exists('acf_options_page_plugin'), |
| 148 | 'url' => 'http://www.advancedcustomfields.com/add-ons/options-page/' |
| 149 | ); |
| 150 | $premium[] = array( |
| 151 | 'title' => __("Flexible Content Field",'acf'), |
| 152 | 'description' => __("Create unique designs with a flexible content layout manager!",'acf'), |
| 153 | 'thumbnail' => $dir . 'images/add-ons/flexible-content-field-thumb.jpg', |
| 154 | 'active' => class_exists('acf_field_flexible_content'), |
| 155 | 'url' => 'http://www.advancedcustomfields.com/add-ons/flexible-content-field/' |
| 156 | ); |
| 157 | |
| 158 | |
| 159 | $free = array(); |
| 160 | $free[] = array( |
| 161 | 'title' => __("Gravity Forms Field",'acf'), |
| 162 | 'description' => __("Creates a select field populated with Gravity Forms!",'acf'), |
| 163 | 'thumbnail' => $dir . 'images/add-ons/gravity-forms-field-thumb.jpg', |
| 164 | 'active' => class_exists('gravity_forms_field'), |
| 165 | 'url' => 'https://github.com/stormuk/Gravity-Forms-ACF-Field/' |
| 166 | ); |
| 167 | $free[] = array( |
| 168 | 'title' => __("Date & Time Picker",'acf'), |
| 169 | 'description' => __("jQuery date & time picker",'acf'), |
| 170 | 'thumbnail' => $dir . 'images/add-ons/date-time-field-thumb.jpg', |
| 171 | 'active' => class_exists('acf_field_date_time_picker'), |
| 172 | 'url' => 'http://wordpress.org/extend/plugins/acf-field-date-time-picker/' |
| 173 | ); |
| 174 | $free[] = array( |
| 175 | 'title' => __("Location Field",'acf'), |
| 176 | 'description' => __("Find addresses and coordinates of a desired location",'acf'), |
| 177 | 'thumbnail' => $dir . 'images/add-ons/google-maps-field-thumb.jpg', |
| 178 | 'active' => class_exists('acf_field_location'), |
| 179 | 'url' => 'https://github.com/elliotcondon/acf-location-field/' |
| 180 | ); |
| 181 | $free[] = array( |
| 182 | 'title' => __("Contact Form 7 Field",'acf'), |
| 183 | 'description' => __("Assign one or more contact form 7 forms to a post",'acf'), |
| 184 | 'thumbnail' => $dir . 'images/add-ons/cf7-field-thumb.jpg', |
| 185 | 'active' => class_exists('acf_field_cf7'), |
| 186 | 'url' => 'https://github.com/taylormsj/acf-cf7-field/' |
| 187 | ); |
| 188 | |
| 189 | ?> |
| 190 | <div class="wrap" style="max-width:970px;"> |
| 191 | |
| 192 | <div class="icon32" id="icon-acf"><br></div> |
| 193 | <h2 style="margin: 4px 0 15px;"><?php _e("Advanced Custom Fields Add-Ons",'acf'); ?></h2> |
| 194 | |
| 195 | <div class="acf-alert"> |
| 196 | <p style=""><?php _e("The following Add-ons are available to increase the functionality of the Advanced Custom Fields plugin.",'acf'); ?><br /> |
| 197 | <?php _e("Each Add-on can be installed as a separate plugin (receives updates) or included in your theme (does not receive updates).",'acf'); ?></p> |
| 198 | </div> |
| 199 | <?php /* |
| 200 | <div class="acf-alert"> |
| 201 | <p><strong><?php _e("Just updated to version 4?",'acf'); ?></strong> <?php _e("Activation codes have changed to plugins! Download your purchased add-ons",'acf'); ?> <a href="http://www.advancedcustomfields.com/add-ons-download/" target="_blank"><?php _e("here",'acf'); ?></a></p> |
| 202 | </div> |
| 203 | */ ?> |
| 204 | |
| 205 | <div id="add-ons" class="clearfix"> |
| 206 | |
| 207 | <?php foreach( $premium as $addon ): ?> |
| 208 | <div class="add-on wp-box <?php if( $addon['active'] ): ?>add-on-active<?php endif; ?>"> |
| 209 | <a target="_blank" href="<?php echo $addon['url']; ?>"> |
| 210 | <img src="<?php echo $addon['thumbnail']; ?>" /> |
| 211 | </a> |
| 212 | <div class="inner"> |
| 213 | <h3><a target="_blank" href="<?php echo $addon['url']; ?>"><?php echo $addon['title']; ?></a></h3> |
| 214 | <p><?php echo $addon['description']; ?></p> |
| 215 | </div> |
| 216 | <div class="footer"> |
| 217 | <?php if( $addon['active'] ): ?> |
| 218 | <a class="button button-disabled"><span class="tick"></span><?php _e("Installed",'acf'); ?></a> |
| 219 | <?php else: ?> |
| 220 | <a target="_blank" href="<?php echo $addon['url']; ?>" class="button"><?php _e("Purchase & Install",'acf'); ?></a> |
| 221 | <?php endif; ?> |
| 222 | </div> |
| 223 | </div> |
| 224 | <?php endforeach; ?> |
| 225 | |
| 226 | <div class="add-on-title"></div> |
| 227 | |
| 228 | <?php foreach( $free as $addon ): ?> |
| 229 | <div class="add-on wp-box <?php if( $addon['active'] ): ?>add-on-active<?php endif; ?>"> |
| 230 | <a target="_blank" href="<?php echo $addon['url']; ?>"> |
| 231 | <img src="<?php echo $addon['thumbnail']; ?>" /> |
| 232 | </a> |
| 233 | <div class="inner"> |
| 234 | <h3><a target="_blank" href="<?php echo $addon['url']; ?>"><?php echo $addon['title']; ?></a></h3> |
| 235 | <p><?php echo $addon['description']; ?></p> |
| 236 | </div> |
| 237 | <div class="footer"> |
| 238 | <?php if( $addon['active'] ): ?> |
| 239 | <a class="button button-disabled"><span class="tick"></span><?php _e("Installed",'acf'); ?></a> |
| 240 | <?php else: ?> |
| 241 | <a target="_blank" href="<?php echo $addon['url']; ?>" class="button"><?php _e("Download",'acf'); ?></a> |
| 242 | <?php endif; ?> |
| 243 | </div> |
| 244 | </div> |
| 245 | <?php endforeach; ?> |
| 246 | |
| 247 | |
| 248 | </div> |
| 249 | |
| 250 | </div> |
| 251 | <?php |
| 252 | |
| 253 | return; |
| 254 | |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | new acf_addons(); |
| 259 | |
| 260 | ?> |