Your IP : 216.73.216.171


Current Path : /home/ereika83/www/wp-content/plugins/genesis-club-pro/classes/
Upload File :
Current File : /home/ereika83/www/wp-content/plugins/genesis-club-pro/classes/class-footer-widgets.php

<?php
if (!class_exists('Genesis_Club_Copyright_Widget')) {
 class Genesis_Club_Copyright_Widget extends Genesis_Club_Widget {
    private $footer;
    private	$defaults = array( 
    	'nav_menu' => 0, 'center' => true, 'two_lines' => true,  
		'show_copyright' => true, 'show_address' => true, 'show_telephone' => true, 'show_email' => false,
		'show_return' => true, 'return_class' => '', 'footer_class' => '', 'visibility' => '');

	private $tips = array(
		'nav_menu' => array('heading' => 'Footer Menu', 'tip' => 'Choose the menu to display in the footer'),
		'center' => array('heading' => 'Center Menu', 'tip' => 'Center the footer horizontally'),
		'layout' => array('heading' => 'Layout', 'tip' => 'Choose order and layout in which menu, copyright and contact are placed, + means same line, | means new line'),
		'show_copyright' => array('heading' => 'Show Copyright', 'tip' => 'Show copyright holder an year range'),
		'show_address' => array('heading' => 'Show Address', 'tip' => 'Show contact address'),
		'show_telephone' => array('heading' => 'Show Telephone', 'tip' => 'Show telephone number(s)'),
		'show_email' => array('heading' => 'Show Email', 'tip' => 'Show email'),
		'use_microdata' => array('heading' => 'Use HTML5 Microdata', 'tip' => 'Express organization, contact and any geo-coordinates using HTML5 microdata'),
		'show_return' => array('heading' => 'Show Return To Top', 'tip' => 'Show link to return to the top of the page'),
		'return_class' => array('heading' => 'Return To Top', 'tip' => 'Add custom classes to apply to the return to top links. For more than one custom class, just put a space between each class. For example: "light small"'),
		'footer_class' => array('heading' => 'Footer Credits', 'tip' => 'Add custom classes to apply to the text in the footer menu, copyright and contact information.  For more than one custom class, just put a space between each class. For example: "light small"'),
		'visibility' => array('heading' => 'Widget Visibility', 'tip' => 'Determine on which pages the footer widget is displayed'),
	);

	function __construct() {
		$widget_ops = array( 'description' => __( "A widget displaying menu links, copyright and company details" ) );
		$control_ops = array('width' => 360, 'height' => 480);		
		parent::__construct('footer_copyright', __('Genesis Club Copyright'), $widget_ops, $control_ops);
        $this->footer = $this->plugin->get_module('footer');
		$this->set_defaults( $this->defaults) ;
	}
	
	function widget( $args, $instance ) {
        $args = $this->override_args($args, $instance) ;
        extract($args);
		if ($this->hide_widget($instance['visibility'])) return; //check visibility requirements

		if ($footer = $this->footer->footer($instance)) 
			printf ('%1$s%2$s%3$s', $before_widget, $footer, $after_widget);
	}

    

	function update( $new_instance, $old_instance ) {
		$instance = $this->update_instance( $new_instance, $old_instance );
		$instance['nav_menu'] = !empty($new_instance['nav_menu']) ? $new_instance['nav_menu'] : 0;
		$instance['show_copyright'] = !empty($new_instance['show_copyright']) ? 1 : 0;
		$instance['show_telephone'] = !empty($new_instance['show_telephone']) ? 1 : 0;	
		$instance['show_email'] = !empty($new_instance['show_email']) ? 1 : 0;	
		$instance['show_address'] = !empty($new_instance['show_address']) ? 1 : 0;	
		$instance['use_microdata'] = !empty($new_instance['use_microdata']);
		$instance['center'] = !empty($new_instance['center']) ? 1 : 0;
		$instance['show_return'] = !empty($new_instance['show_return']) ? 1 : 0;
		$instance['return_class'] = $this->utils->clean_css_classes($new_instance['return_class']);
		$instance['footer_class'] = $this->utils->clean_css_classes($new_instance['footer_class']);
		$instance['layout'] = trim($new_instance['layout']);
		$instance['visibility'] = trim($new_instance['visibility']);
		return $instance;
	}

	function form( $instance ) {
		$this->form_init ($instance, $this->tips);
		$menus = array();
		$menus[0] = 'No menu';
		$menu_terms = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
		if ( $menu_terms ) 
         foreach ( $menu_terms as $term ) $menus[ $term->term_id ] = $term->name;
		$this->print_form_field('nav_menu',  'select', $menus);
		$this->print_form_field('center',  'checkbox');
		$this->print_form_field('show_copyright', 'checkbox');
		$this->print_form_field('show_address', 'checkbox');
		$this->print_form_field('show_telephone', 'checkbox');
		$this->print_form_field('show_email', 'checkbox');
		$this->print_form_field('show_return', 'checkbox');
		if ($this->utils->is_html5()) $this->print_form_field('use_microdata', 'checkbox');
		$this->print_form_field('layout', 'select', $this->footer->get_layouts());

		print <<< CUSTOM_CLASSES
<h4>Custom Classes (Optional)</h4>
<p>We have defined three color classes <i>dark</i>, <i>light</i> and <i>white</i>, and two size classes, <i>small</i> and <i>tiny</i>. Feel free to use these alongside your own custom CSS classes to change the footer font size and color.</p>
CUSTOM_CLASSES;

		$this->print_form_field('return_class', 'text', array(), array('size' => 10));
		$this->print_form_field('footer_class', 'text', array(), array('size' => 10));
		$this->print_form_field('visibility',  'radio', $this->get_visibility_options(), array('separator' => '<br />'));
	}

 }
}

if (!class_exists('Genesis_Club_Footer_Trademark_Widget')) {
 class Genesis_Club_Trademark_Widget extends Genesis_Club_Widget {

	private $tips = array(
			'category' => array('heading' => 'Category', 'tip' => 'Select Link Category for Your Trademarks'),
			'limit' => array('heading' => 'Number of links', 'tip' => 'Number of trademarks to show'),
			'orderby' => array('heading' => 'Order By', 'tip' => 'Sort by name, rating, ID or random'),
			'nofollow' => array('heading' => 'Nofollow Links', 'tip' => 'Mark the links with rel=nofollow'),
			'visibility' => array('heading' => 'Widget Visibility', 'tip' => 'Determine on which pages the footer widget is displayed'),
			);

    private	$defaults = array( 'title' => '',
    	'category' => false, 'limit' => '', 'orderby' => 'name', 'nofollow' => false, 'visibility' => '');
		
	function __construct() {
		add_filter('pre_option_link_manager_enabled', '__return_true' );
		$widget_ops = array('description' => __( 'Trademarks, Service Marks and Kitemarks') );
		parent::__construct('footer_trademarks', __('Genesis Club Trademarks'), $widget_ops, array(), $this->defaults );
	}

    function nofollow_links( $content) {
	    return preg_replace_callback( '/<a([^>]*)>(.*?)<\/a[^>]*>/is', array( &$this, 'nofollow_link' ), $content ) ;
    }

    function nofollow_link($matches) { //make link nofollow
		$attrs = shortcode_parse_atts( stripslashes ($matches[ 1 ]) );
		$atts='';
        $rel = ' rel="nofollow"';
		foreach ( $attrs AS $key => $value ) {
			$key = strtolower($key);
            $nofollow = '';
			if ('rel' == $key) {
              $rel = '';
              if (strpos($value, 'follow') === FALSE) $nofollow = ' nofollow';
            }
            $atts .= sprintf(' %1$s="%2$s%3$s"', $key, $value, $nofollow);
		}
		return sprintf('<a%1$s%2$s>%3$s</a>', $rel, $atts, $matches[ 2 ]);
	}

	function widget( $args, $instance ) {
        $args = $this->override_args($args, $instance) ;
        extract($args);
		if ($this->hide_widget($instance['visibility'])) return; //check visibility requirements

		$category = isset($instance['category']) ? $instance['category'] : false;
		$orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
		$order = $orderby == 'rating' ? 'DESC' : 'ASC';
		$limit = (isset( $instance['limit'] ) && $instance['limit']) ? $instance['limit'] : -1;
		$nofollow = isset( $instance['nofollow'] ) && $instance['nofollow'];

		$links = wp_list_bookmarks(apply_filters('widget_links_args', array(
			'echo' => 0,
			'title_before' => '', 'title_after' => '',
			'title_li' => '', 'categorize' => false,
			'before' => '', 'after' => '',
			'category_before' => '', 'category_after' => '',
			'show_images' => true, 'show_description' => false,
			'show_name' => false, 'show_rating' => false,
			'category' => $category, 'class' => 'trademark widget',
			'orderby' => $orderby, 'order' => $order,
			'limit' => $limit,
		)));
		
		echo $before_widget;
        echo ($nofollow ? $this->nofollow_links($links) : $links);
		echo $after_widget;
	}

	function update( $new_instance, $old_instance ) {
		$instance = $this->update_instance( $new_instance, $old_instance );
		$instance['orderby'] = 'name';
		if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
			$instance['orderby'] = $new_instance['orderby'];
		$instance['category'] = intval( $new_instance['category'] );
		$instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : '';
		$instance['nofollow'] = !empty($new_instance['nofollow']);
		$instance['visibility'] = trim($new_instance['visibility']);
		return $instance;
	}

	function form( $instance ) {
		$this->form_init ($instance, $this->tips);
		$links = array();
		$link_cats = get_terms( 'link_category' );
		foreach ( $link_cats as $link_cat ) {
			$id = intval($link_cat->term_id);
			$links[$id] = $link_cat->name;
		}
		$this->print_form_field('category', 'select', $links);
		$this->print_form_field('orderby', 'select', array(
			'name' => __( 'Link title'),
			'rating' => __( 'Link rating'),
			'id' => __( 'Link ID'),
			'rand' => __( 'Random')
		));
		$this->print_form_field('limit',  'text', array(),  array('size' => 3 ,'maxlength' => 3));
		$this->print_form_field('nofollow',  'checkbox');
        $this->print_form_field('visibility', 'radio',
			$this->get_visibility_options(), array('separator' => '<br />'));
	}
 }
}