addons.php 7.48 KB
Newer Older
imac's avatar
imac committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
<?php 

/*
*  acf_addons
*
*  @description: controller for add-ons sub menu page
*  @since: 3.6
*  @created: 25/01/13
*/

class acf_addons
{
	
	var $action;
	
	
	/*
	*  __construct
	*
	*  @description: 
	*  @since 3.1.8
	*  @created: 23/06/12
	*/
	
	function __construct()
	{
		// actions
		add_action('admin_menu', array($this,'admin_menu'), 11, 0);
	}
	
	
	/*
	*  admin_menu
	*
	*  @description: 
	*  @created: 2/08/12
	*/
	
	function admin_menu()
	{
		// add page
		$page = add_submenu_page('edit.php?post_type=acf', __('Add-ons','acf'), __('Add-ons','acf'), 'manage_options', 'acf-addons', array($this,'html'));
		
		
		// actions
		add_action('load-' . $page, array($this,'load'));
		add_action('admin_print_scripts-' . $page, array($this, 'admin_print_scripts'));
		add_action('admin_print_styles-' . $page, array($this, 'admin_print_styles'));
		add_action('admin_head-' . $page, array($this,'admin_head'));
	}
	
	
	/*
	*  load
	*
	*  @description: 
	*  @since 3.5.2
	*  @created: 16/11/12
	*  @thanks: Kevin Biloski and Charlie Eriksen via Secunia SVCRP
	*/
	
	function load()
	{
		
	}
	
	
	/*
	*  admin_print_scripts
	*
	*  @description: 
	*  @since 3.1.8
	*  @created: 23/06/12
	*/
	
	function admin_print_scripts()
	{
		
	}
	
	
	/*
	*  admin_print_styles
	*
	*  @description: 
	*  @since 3.1.8
	*  @created: 23/06/12
	*/
	
	function admin_print_styles()
	{
		wp_enqueue_style(array(
			'wp-pointer',
			'acf-global',
			'acf',
		));
	}
	
	
	/*
	*  admin_head
	*
	*  @description: 
	*  @since 3.1.8
	*  @created: 23/06/12
	*/
	
	function admin_head()
	{
				
	}
	
	
	/*
	*  html
	*
	*  @description: 
	*  @since 3.1.8
	*  @created: 23/06/12
	*/
	
	function html()
	{
		// vars
		$dir = apply_filters('acf/get_info', 'dir');
		
		
		$premium = array();
		$premium[] = array(
			'title' => __("Repeater Field",'acf'),
			'description' => __("Create infinite rows of repeatable data with this versatile interface!",'acf'),
			'thumbnail' => $dir . 'images/add-ons/repeater-field-thumb.jpg',
			'active' => class_exists('acf_field_repeater'),
			'url' => 'http://www.advancedcustomfields.com/add-ons/repeater-field/'
		);
		$premium[] = array(
			'title' => __("Gallery Field",'acf'),
			'description' => __("Create image galleries in a simple and intuitive interface!",'acf'),
			'thumbnail' => $dir . 'images/add-ons/gallery-field-thumb.jpg',
			'active' => class_exists('acf_field_gallery'),
			'url' => 'http://www.advancedcustomfields.com/add-ons/gallery-field/'
		);
		$premium[] = array(
			'title' => __("Options Page",'acf'),
			'description' => __("Create global data to use throughout your website!",'acf'),
			'thumbnail' => $dir . 'images/add-ons/options-page-thumb.jpg',
			'active' => class_exists('acf_options_page_plugin'),
			'url' => 'http://www.advancedcustomfields.com/add-ons/options-page/'
		);
		$premium[] = array(
			'title' => __("Flexible Content Field",'acf'),
			'description' => __("Create unique designs with a flexible content layout manager!",'acf'),
			'thumbnail' => $dir . 'images/add-ons/flexible-content-field-thumb.jpg',
			'active' => class_exists('acf_field_flexible_content'),
			'url' => 'http://www.advancedcustomfields.com/add-ons/flexible-content-field/'
		);
		
		
		$free = array();
		$free[] = array(
			'title' => __("Gravity Forms Field",'acf'),
			'description' => __("Creates a select field populated with Gravity Forms!",'acf'),
			'thumbnail' => $dir . 'images/add-ons/gravity-forms-field-thumb.jpg',
			'active' => class_exists('gravity_forms_field'),
			'url' => 'https://github.com/stormuk/Gravity-Forms-ACF-Field/'
		);
		$free[] = array(
			'title' => __("Date & Time Picker",'acf'),
			'description' => __("jQuery date & time picker",'acf'),
			'thumbnail' => $dir . 'images/add-ons/date-time-field-thumb.jpg',
			'active' => class_exists('acf_field_date_time_picker'),
			'url' => 'http://wordpress.org/extend/plugins/acf-field-date-time-picker/'
		);
		$free[] = array(
			'title' => __("Google Map Extended",'acf'),
			'description' => __("Find addresses and coordinates of a desired location",'acf'),
			'thumbnail' => $dir . 'images/add-ons/google-maps-field-thumb.jpg',
			'active' => class_exists('acf_field_google_map_extended'),
			'url' => 'https://wordpress.org/plugins/advanced-custom-fields-google-map-extended/'
		);
		$free[] = array(
			'title' => __("Contact Form 7 Field",'acf'),
			'description' => __("Assign one or more contact form 7 forms to a post",'acf'),
			'thumbnail' => $dir . 'images/add-ons/cf7-field-thumb.jpg',
			'active' => class_exists('acf_field_cf7'),
			'url' => 'https://github.com/taylormsj/acf-cf7-field/'
		);
		
		?>
<div class="wrap" style="max-width:970px;">

	<div class="icon32" id="icon-acf"><br></div>
	<h2 style="margin: 4px 0 15px;"><?php _e("Advanced Custom Fields Add-Ons",'acf'); ?></h2>
	
	<div class="acf-alert">
	<p style=""><?php _e("The following Add-ons are available to increase the functionality of the Advanced Custom Fields plugin.",'acf'); ?><br />
	<?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>
	</div>
	<?php /*
	<div class="acf-alert">
		<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>
	</div>
	*/ ?>
	
	<div id="add-ons" class="clearfix">
		
		<div class="add-on-group clearfix">
		<?php foreach( $premium as $addon ): ?>
		<div class="add-on wp-box <?php if( $addon['active'] ): ?>add-on-active<?php endif; ?>">
			<a target="_blank" href="<?php echo $addon['url']; ?>">
				<img src="<?php echo $addon['thumbnail']; ?>" />
			</a>
			<div class="inner">
				<h3><a target="_blank" href="<?php echo $addon['url']; ?>"><?php echo $addon['title']; ?></a></h3>
				<p><?php echo $addon['description']; ?></p>
			</div>
			<div class="footer">
				<?php if( $addon['active'] ): ?>
					<a class="button button-disabled"><span class="acf-sprite-tick"></span><?php _e("Installed",'acf'); ?></a>
				<?php else: ?>
					<a target="_blank" href="<?php echo $addon['url']; ?>" class="button"><?php _e("Purchase & Install",'acf'); ?></a>
				<?php endif; ?>
			</div>
		</div>
		<?php endforeach; ?>
		</div>
		
		<div class="add-on-group clearfix">
		<?php foreach( $free as $addon ): ?>
		<div class="add-on wp-box <?php if( $addon['active'] ): ?>add-on-active<?php endif; ?>">
			<a target="_blank" href="<?php echo $addon['url']; ?>">
				<img src="<?php echo $addon['thumbnail']; ?>" />
			</a>
			<div class="inner">
				<h3><a target="_blank" href="<?php echo $addon['url']; ?>"><?php echo $addon['title']; ?></a></h3>
				<p><?php echo $addon['description']; ?></p>
			</div>
			<div class="footer">
				<?php if( $addon['active'] ): ?>
					<a class="button button-disabled"><span class="acf-sprite-tick"></span><?php _e("Installed",'acf'); ?></a>
				<?php else: ?>
					<a target="_blank" href="<?php echo $addon['url']; ?>" class="button"><?php _e("Download",'acf'); ?></a>
				<?php endif; ?>
			</div>
		</div>
		<?php endforeach; ?>	
		</div>
		
				
	</div>
	
</div>
<script type="text/javascript">
(function($) {
	
	$(window).on('load', function(){
		
		$('#add-ons .add-on-group').each(function(){
		
			var $el = $(this),
				h = 0;
			
			
			$el.find('.add-on').each(function(){
				
				h = Math.max( $(this).height(), h );
				
			});
			
			$el.find('.add-on').height( h );
			
		});
		
	});
	
})(jQuery);	
</script>
		<?php
		
		return;
		
	}		
}

new acf_addons();

?>