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