<?php

add_action('dslc_hook_register_modules',
     create_function('', 'return dslc_register_module( "Ainex_Pricing_Table_Block" );')
);

class Ainex_Pricing_Table_Block extends DSLC_Module {

 	// Module Attributes
    var $module_id = 'Ainex_Pricing_Table_Block';
    var $module_title = 'Pricing Table Block';
    var $module_icon = 'dollar';
    var $module_category = 'Ainex - Pricing Table';

 	// Module Options
    function options() {

    	// The options array
    	$dslc_options = array(

			array(
				'label' => 'Pricing Table Block - Title',
				'id' => 'title',
				'std' => 'Economy',
				'type' => 'textarea',
				'section' => 'styling',
			),
			array(
				'label' => 'Content',
				'id' => 'content',
				'std' => '500 GB Disk Space
					100 Databases List
					Free Domain Registration
					1 Hosting Space
					FREE Ad Coupons
					Account Control Panel
					FREE 24/7 Support',
				'type' => 'textarea',
				'section' => 'styling',
			),
			array(
				'label' => 'Currency',
				'id' => 'currency',
				'std' => '$',
				'type' => 'textarea',
				'section' => 'styling',
			),
			array(
				'label' => 'Price',
				'id' => 'price',
				'std' => '3.99',
				'type' => 'textarea',
				'section' => 'styling',
			),
			array(
				'label' => 'Price per month/year',
				'id' => 'price_per',
				'std' => 'per month',
				'type' => 'text',
				'section' => 'styling',
			),
			array(
				'label' => 'Button Text',
				'id' => 'buttontext',
				'std' => 'sign up now!',
				'type' => 'textarea',
				'section' => 'styling',
			),
			array(
				'label' => 'Button Link URL',
				'id' => 'button_link',
				'std' => '#',
				'type' => 'textarea',
				'section' => 'styling',
			),
			array(
				'label' => 'Highlights',
				'id' => 'highlights',
				'std' => '0',
				'type' => 'select',
				'section' => 'styling',
				'choices' => array(
					array(
						'label' => 'No',
						'value' => '0'
					),
					array(
						'label' => 'Yes',
						'value' => '1'
					),
				)
			),
		);

		$dslc_options = array_merge( $dslc_options, $this->shared_options('animation_options') );

    	// Return the array
    	return apply_filters( 'dslc_module_options', $dslc_options, $this->module_id );

    }

 	// Module Output
    function output( $options ) {

    	global $dslc_active;

		if ( $dslc_active && is_user_logged_in() && current_user_can( DS_LIVE_COMPOSER_CAPABILITY ) )
			$dslc_is_admin = true;
		else
			$dslc_is_admin = false;

		//REQUIRED
		$this->module_start( $options );

	?>
	<div class="hosting_plans">
				<div class="one_full">
		        	<div class="plan<?php if($options['highlights']==1){ echo ' active'; } ?>">
		            	<div class="title">
		                	<h4><?php echo $options['title']; ?></h4>
		                    <strong><?php echo $options['currency'].$options['price']; ?> <em>/ <?php echo $options['price_per']; ?></em></strong>
		                </div>
		                <ul>
		                    <?php
								$content = stripcslashes( $options['content'] );
								$items = preg_split( '/\r\n|\r|\n/', $content );

								$output = '';
								$dem    = 1;
								foreach($items as $item){
									$output .= '<li class="fa fa-check">' . htmlspecialchars_decode( $item ) . '</li>';
								}
								echo $output;
							?>
						</ul>
		                <a href="<?php echo $options['button_link']; ?>" class="but_signup"><?php echo $options['buttontext']; ?></a>
		            </div>
		        </div><!-- end plan -->

	</div>
	<div class="clearfix"></div>
	<?php
    	// REQUIRED
    	$this->module_end( $options );

    }

}