Example #1
0
 /**
  * Renders module settings
  *
  * @access public
  * @return string
  */
 public static function renderSettings()
 {
     $out = '<input type="hidden" name="' . __CLASS__ . '[]" value="" />';
     $out .= ThemexInterface::renderOption(array('name' => __('Show Country', 'academy'), 'id' => __CLASS__ . '[billing_country]', 'type' => 'checkbox', 'default' => themex_value(self::$data, 'billing_country')));
     $out .= ThemexInterface::renderOption(array('name' => __('Show City', 'academy'), 'id' => __CLASS__ . '[billing_city]', 'type' => 'checkbox', 'default' => themex_value(self::$data, 'billing_city')));
     $out .= ThemexInterface::renderOption(array('name' => __('Show State', 'academy'), 'id' => __CLASS__ . '[billing_state]', 'type' => 'checkbox', 'default' => themex_value(self::$data, 'billing_state')));
     $out .= ThemexInterface::renderOption(array('name' => __('Show Address', 'academy'), 'id' => __CLASS__ . '[billing_address]', 'type' => 'checkbox', 'default' => themex_value(self::$data, 'billing_address')));
     $out .= ThemexInterface::renderOption(array('name' => __('Show Postcode', 'academy'), 'id' => __CLASS__ . '[billing_postcode]', 'type' => 'checkbox', 'default' => themex_value(self::$data, 'billing_postcode')));
     $out .= ThemexInterface::renderOption(array('name' => __('Show Company', 'academy'), 'id' => __CLASS__ . '[billing_company]', 'type' => 'checkbox', 'default' => themex_value(self::$data, 'billing_company')));
     $out .= ThemexInterface::renderOption(array('name' => __('Show Phone', 'academy'), 'id' => __CLASS__ . '[billing_phone]', 'type' => 'checkbox', 'default' => themex_value(self::$data, 'billing_phone')));
     return $out;
 }
			<?php 
ThemexInterface::renderMessages(themex_value('success', $_POST, false));
?>
		</div>
		<table class="profile-fields">
			<tbody>
				<tr>
					<th><?php 
_e('Notifications', 'makery');
?>
</th>
					<td>
						<div class="element-select">
							<span></span>
							<?php 
echo ThemexInterface::renderOption(array('id' => 'notices', 'type' => 'select', 'value' => esc_attr(ThemexUser::$data['current']['settings']['notices']), 'options' => array('1' => __('Enabled', 'makery'), '0' => __('Disabled', 'makery')), 'wrap' => false));
?>
						</div>
					</td>
				</tr>
				<tr>
					<th><?php 
_e('Email Address', 'makery');
?>
</th>
					<td>
						<div class="field-wrap">
							<input type="text" name="email" value="<?php 
echo esc_attr(ThemexUser::$data['current']['email']);
?>
" />
 /**
  * Renders sidebar option
  *
  * @access public
  * @param array $sidebar
  * @return string
  */
 public static function renderSidebar($sidebar)
 {
     $out = '<div class="themex-sidebar-item themex-option" id="' . $sidebar['id'] . '">';
     $out .= '<h3 class="themex-sidebar-title">' . $sidebar['name'] . '</h3>';
     $out .= '<a href="#" class="themex-button themex-remove-button themex-trigger" title="' . __('Remove', 'academy') . '" data-action="themex_sidebar_remove" data-element="' . $sidebar['id'] . '"></a>';
     //sidebar name
     $out .= themexInterface::renderOption(array('type' => 'hidden', 'id' => __CLASS__ . '[' . $sidebar['id'] . '][name]', 'value' => $sidebar['name']));
     //pages list
     $pages = get_pages();
     foreach ($pages as $page) {
         $items[$page->ID] = $page->post_title;
     }
     $out .= ThemexInterface::renderOption(array('name' => __('Pages', 'academy'), 'id' => __CLASS__ . '[' . $sidebar['id'] . '][pages][]', 'type' => 'select', 'options' => $items, 'attributes' => array('multiple' => 'multiple'), 'value' => isset(self::$data[$sidebar['id']]['pages']) ? self::$data[$sidebar['id']]['pages'] : ''));
     //categories list
     $items = array();
     $categories = get_categories();
     foreach ($categories as $category) {
         $items[$category->term_id] = $category->name;
     }
     $out .= ThemexInterface::renderOption(array('name' => __('Categories', 'academy'), 'id' => __CLASS__ . '[' . $sidebar['id'] . '][categories][]', 'type' => 'select', 'options' => $items, 'attributes' => array('multiple' => 'multiple'), 'value' => isset(self::$data[$sidebar['id']]['categories']) ? self::$data[$sidebar['id']]['categories'] : ''));
     $out .= '</div>';
     return $out;
 }
 /**
  * Renders module settings
  *
  * @access public
  * @return string
  */
 public static function renderSettings()
 {
     $out = '<table><tbody>';
     //render options
     if (isset(self::$data['options'])) {
         $option['value'] = '';
         if (isset($option['default'])) {
             $option['value'] = $option['default'];
         }
         foreach (self::$data['options'] as $option) {
             $out .= '<tr>';
             $out .= '<th><h4 class="themex-shortcode-title">' . $option['name'] . '</h4></th>';
             $out .= '<td>' . ThemexInterface::renderOption($option) . '</td>';
             $out .= '</tr>';
         }
     }
     //render clone
     if (isset(self::$data['clone'])) {
         $ID = 'a' . uniqid();
         $out .= '<tr><td colspan="2"><div class="themex-shortcode-pane"><div class="themex-shortcode-clone" id="' . $ID . '">';
         $out .= '<div class="themex-shortcode-pattern hidden">' . self::$data['clone']['shortcode'] . '</div>';
         $out .= '<div class="themex-shortcode-value hidden"></div>';
         $out .= '<a href="#" class="themex-button themex-remove-button themex-trigger" data-element="' . $ID . '" title="' . __('Remove', 'academy') . '"></a>';
         $out .= '<a href="#" class="themex-button themex-clone-button themex-trigger" data-element="' . $ID . '" data-value="' . $ID . '" title="' . __('Add', 'academy') . '"></a>';
         foreach (self::$data['clone']['options'] as $option) {
             $out .= ThemexInterface::renderOption($option);
         }
         $out .= '</div></div></td></tr>';
     }
     $out .= '<tr><th></th><td><div class="themex-option themex-submit"><input type="submit" class="themex-button" value="' . __('Insert Shortcode', 'academy') . '" /></div></td></tr>';
     $out .= '</tbody></table>';
     $out .= '<div class="themex-shortcode-pattern hidden">' . self::$data['shortcode'] . '</div>';
     $out .= '<div class="themex-shortcode-value hidden"></div>';
     return $out;
 }
 /**
  * Renders option
  *
  * @access public
  * @param array $option
  * @return string
  */
 public static function renderOption($option)
 {
     global $post, $wp_registered_sidebars, $wp_locale;
     $out = '';
     //option wrapper
     if (!isset($option['wrap']) || $option['wrap']) {
         $parent = '';
         if (isset($option['parent'])) {
             $parent = 'data-parent="' . THEMEX_PREFIX . $option['parent']['id'] . '" ';
             $parent .= 'data-value="' . $option['parent']['value'] . '"';
         }
         $out .= '<div class="themex-option themex-' . str_replace('_', '-', $option['type']) . '" ' . $parent . '>';
         if (isset($option['name']) && $option['type'] != 'checkbox') {
             $out .= '<h3 class="themex-option-title">' . $option['name'] . '</h3>';
         }
     }
     //option before
     if (isset($option['before'])) {
         $out .= $option['before'];
     }
     //option description
     if (isset($option['description'])) {
         $out .= '<div class="themex-tooltip"><div class="themex-tooltip-icon"></div><div class="themex-tooltip-text">' . $option['description'] . '</div></div>';
     }
     //option attributes
     $attributes = '';
     if (isset($option['attributes'])) {
         foreach ($option['attributes'] as $name => $value) {
             $attributes .= $name . '="' . $value . '" ';
         }
     }
     //option value
     if (!isset($option['value'])) {
         $option['value'] = '';
         if (isset($option['id'])) {
             $option['value'] = themex_stripslashes(get_option($option['id']));
             if (($option['value'] === false || $option['value'] == '') && isset($option['default'])) {
                 $option['value'] = themex_stripslashes($option['default']);
             }
         } else {
             if (isset($option['default'])) {
                 $option['value'] = themex_stripslashes($option['default']);
             }
         }
     }
     switch ($option['type']) {
         //text field
         case 'text':
             $out .= '<input type="text" id="' . $option['id'] . '" name="' . $option['id'] . '" value="' . $option['value'] . '" ' . $attributes . ' />';
             break;
             //number field
         //number field
         case 'number':
             $out .= '<input type="number" id="' . $option['id'] . '" name="' . $option['id'] . '" value="' . abs(intval($option['value'])) . '" ' . $attributes . ' />';
             break;
             //date field
         //date field
         case 'date':
             $out .= '<input type="text" id="' . $option['id'] . '" name="' . $option['id'] . '" value="' . $option['value'] . '" class="date-field" ' . $attributes . ' />';
             break;
             //hidden field
         //hidden field
         case 'hidden':
             $out .= '<input type="hidden" id="' . $option['id'] . '" name="' . $option['id'] . '" value="' . $option['value'] . '" ' . $attributes . ' />';
             break;
             //message field
         //message field
         case 'textarea':
             $out .= '<textarea id="' . $option['id'] . '" name="' . $option['id'] . '" ' . $attributes . '>' . $option['value'] . '</textarea>';
             break;
             //checkbox
         //checkbox
         case 'checkbox':
             $checked = '';
             if ($option['value'] == 'true') {
                 $checked = 'checked="checked"';
             }
             $out .= '<input type="checkbox" id="' . $option['id'] . '" name="' . $option['id'] . '" value="true" ' . $checked . ' ' . $attributes . ' />';
             if (isset($option['name'])) {
                 $out .= '<label for="' . $option['id'] . '">' . $option['name'] . '</label>';
             }
             break;
             //colorpicker
         //colorpicker
         case 'color':
             $out .= '<input name="' . $option['id'] . '" id="' . $option['id'] . '" type="text" value="' . $option['value'] . '" class="themex-colorpicker" />';
             break;
             //uploader
         //uploader
         case 'uploader':
             $out .= '<input name="' . $option['id'] . '" id="' . $option['id'] . '" type="text" value="' . $option['value'] . '" ' . $attributes . ' />';
             $out .= '<a class="button themex-upload-button">' . __('Browse', 'academy') . '</a>';
             break;
             //multiple uploader
         //multiple uploader
         case 'attachments':
             if (empty($option['value']) || !is_array($option['value'])) {
                 $option['value'] = array('a' . uniqid() => array('title' => '', 'url' => '', 'type' => ''));
             }
             $out .= '<div class="themex-clone-pane"><input type="hidden" id="' . $option['id'] . '" name="' . $option['id'] . '" value="" />';
             foreach ($option['value'] as $key => $field) {
                 $out .= '<div class="themex-clone-item" id="' . $option['id'] . '_' . $key . '">';
                 $out .= '<a href="#" class="themex-button themex-remove-button themex-trigger" data-element="' . $option['id'] . '_' . $key . '" title="' . __('Remove', 'academy') . '"></a>';
                 $out .= '<a href="#" class="themex-button themex-clone-button themex-trigger" data-element="' . $option['id'] . '_' . $key . '" data-value="' . $key . '" title="' . __('Add', 'academy') . '"></a>';
                 $out .= ThemexInterface::renderOption(array('id' => $option['id'] . '[' . $key . '][title]', 'type' => 'text', 'value' => themex_value($field, 'title'), 'wrap' => false, 'attributes' => array('placeholder' => __('Title', 'academy'))));
                 $out .= ThemexInterface::renderOption(array('id' => $option['id'] . '[' . $key . '][type]', 'type' => 'select', 'value' => themex_value($field, 'type'), 'wrap' => false, 'options' => array('document' => __('Document', 'academy'), 'audio' => __('Audio', 'academy'), 'video' => __('Video', 'academy'))));
                 $out .= ThemexInterface::renderOption(array('id' => $option['id'] . '[' . $key . '][status]', 'type' => 'select', 'value' => themex_value($field, 'status'), 'wrap' => false, 'options' => array('file' => __('File', 'academy'), 'link' => __('Link', 'academy'))));
                 $out .= ThemexInterface::renderOption(array('id' => $option['id'] . '[' . $key . '][url]', 'type' => 'uploader', 'value' => themex_value($field, 'url'), 'attributes' => array('placeholder' => 'URL')));
                 $out .= '</div>';
             }
             $out .= '</div>';
             break;
             //images selector
         //images selector
         case 'select_image':
             foreach ($option['options'] as $name => $src) {
                 $out .= '<image src="' . $src . '" ';
                 if ($name == $option['value']) {
                     $out .= 'class="current"';
                 }
                 $out .= ' data-value="' . $name . '" />';
             }
             $out .= '<input type="hidden" name="' . $option['id'] . '" id="' . $option['id'] . '" value="' . $option['value'] . '" ' . $attributes . ' />';
             break;
             //custom dropdown
         //custom dropdown
         case 'select':
             $out .= '<select id="' . $option['id'] . '" name="' . $option['id'] . '" ' . $attributes . '>';
             if (isset($option['options'])) {
                 foreach ($option['options'] as $name => $title) {
                     $selected = '';
                     if ($option['value'] != '' && ($name == $option['value'] || is_array($option['value']) && in_array($name, $option['value']))) {
                         $selected = 'selected="selected"';
                     }
                     $out .= '<option value="' . $name . '" ' . $selected . '>' . $title . '</option>';
                 }
             }
             $out .= '</select>';
             break;
             //fonts dropdown
         //fonts dropdown
         case 'select_font':
             $options = ThemexCore::$components['fonts'];
             asort($options);
             $out .= self::renderOption(array('id' => $option['id'], 'type' => 'select', 'wrap' => false, 'default' => $option['value'], 'options' => $options));
             break;
             //pages dropdown
         //pages dropdown
         case 'select_page':
             $args = array('selected' => $option['value'], 'echo' => 0, 'name' => $option['id'], 'id' => $option['id']);
             $out .= wp_dropdown_pages($args);
             break;
             //posts dropdown
         //posts dropdown
         case 'select_post':
             $atts = array('numberposts' => -1, 'post_type' => $option['post_type'], 'post_status' => array('publish', 'future', 'pending', 'draft'), 'orderby' => 'title', 'order' => 'ASC');
             if (isset($post) && isset($post->ID)) {
                 $atts['exclude'] = array($post->ID);
                 if ($option['post_type'] == 'lesson' && $post->post_type == 'lesson') {
                     $course = ThemexCore::getPostRelations($post->ID, 0, 'lesson_course', true);
                     $atts['include'] = array_diff(ThemexCore::getPostRelations(0, $course, 'lesson_course'), array($post->ID));
                 }
             }
             if ($option['post_type'] != 'product' && !current_user_can('manage_options')) {
                 $atts['author'] = get_current_user_id();
             }
             $items = get_posts($atts);
             $out .= '<select id="' . $option['id'] . '" name="' . $option['id'] . '" ' . $attributes . '>';
             $out .= '<option value="0">' . __('None', 'academy') . '</option>';
             foreach ($items as $item) {
                 $selected = '';
                 if ($item->ID == $option['value']) {
                     $selected = 'selected="selected"';
                 }
                 $out .= '<option value="' . $item->ID . '" ' . $selected . '>' . $item->post_title . '</option>';
             }
             $out .= '</select>';
             break;
             //sidebars dropdown
         //sidebars dropdown
         case 'select_sidebar':
             $sidebars = array();
             foreach ($wp_registered_sidebars as $sidebar) {
                 $sidebars[$sidebar['name']] = $sidebar['name'];
             }
             $out .= self::renderOption(array('id' => $option['id'], 'type' => 'select', 'wrap' => false, 'options' => $sidebars));
             break;
             //categories dropdown
         //categories dropdown
         case 'select_category':
             $args = array('hide_empty' => 0, 'echo' => 0, 'selected' => $option['value'], 'show_option_all' => __('None', 'academy'), 'hierarchical' => 0, 'name' => $option['id'], 'id' => $option['id'], 'depth' => 0, 'tab_index' => 0, 'taxonomy' => $option['taxonomy'], 'hide_if_empty' => false);
             if (isset($option['attributes'])) {
                 $args['class'] = $option['attributes']['class'];
             }
             $out .= wp_dropdown_categories($args);
             break;
             //range slider
         //range slider
         case 'slider':
             $out .= '<div class="themex-slider-controls"></div><div class="themex-slider-value"></div>';
             $out .= '<input type="hidden" class="slider-max" value="' . $option['max_value'] . '" />';
             $out .= '<input type="hidden" class="slider-min" value="' . $option['min_value'] . '" />';
             $out .= '<input type="hidden" class="slider-unit" value="' . $option['unit'] . '" />';
             $out .= '<input type="hidden" class="slider-value" name="' . $option['id'] . '" id="' . $option['id'] . '"  value="' . $option['value'] . '" />';
             break;
             //quiz questions
         //quiz questions
         case 'questions':
             if (empty($option['value']) || !is_array($option['value'])) {
                 $option['value'] = array('q' . uniqid() => array('title' => '', 'type' => ''));
             }
             $out .= '<div class="themex-clone-pane"><input type="hidden" id="' . $option['id'] . '" name="' . $option['id'] . '" value="" />';
             foreach ($option['value'] as $key => $field) {
                 $out .= '<div class="themex-clone-item" id="' . $option['id'] . '_' . $key . '">';
                 $out .= '<a href="#" class="themex-button themex-remove-button themex-trigger" data-element="' . $option['id'] . '_' . $key . '" title="' . __('Remove', 'academy') . '"></a>';
                 $out .= '<a href="#" class="themex-button themex-clone-button themex-trigger" data-value="' . $key . '" title="' . __('Add', 'academy') . '"></a>';
                 $out .= ThemexInterface::renderOption(array('id' => $option['id'] . '[' . $key . '][title]', 'type' => 'text', 'value' => htmlspecialchars(themex_value($field, 'title')), 'wrap' => false, 'attributes' => array('placeholder' => __('Question', 'academy'))));
                 $out .= ThemexInterface::renderOption(array('id' => $option['id'] . '[' . $key . '][type]', 'type' => 'select', 'value' => themex_value($field, 'type'), 'wrap' => false, 'options' => array('single' => __('Single Choice', 'academy'), 'multiple' => __('Multiple Choice', 'academy'), 'string' => __('Short Answer', 'academy'))));
                 if (!isset($field['answers']) || empty($field['answers'])) {
                     $field['answers'] = array('a' . uniqid() => array('title' => ''));
                 }
                 foreach ($field['answers'] as $index => $answer) {
                     $out .= '<div class="themex-clone-item clearfix" id="' . $option['id'] . '_' . $key . '_' . $index . '">';
                     $out .= '<a href="#" class="themex-button themex-remove-button themex-trigger" data-element="' . $option['id'] . '_' . $key . '_' . $index . '" title="' . __('Remove', 'academy') . '"></a>';
                     $out .= '<a href="#" class="themex-button themex-clone-button themex-trigger" data-element="' . $option['id'] . '_' . $key . '_' . $index . '" data-value="' . $index . '" title="' . __('Add', 'academy') . '"></a>';
                     $out .= ThemexInterface::renderOption(array('id' => $option['id'] . '[' . $key . '][answers][' . $index . '][title]', 'type' => 'text', 'value' => htmlspecialchars(themex_value($answer, 'title')), 'wrap' => false, 'attributes' => array('placeholder' => __('Answer', 'academy'))));
                     $out .= ThemexInterface::renderOption(array('id' => $option['id'] . '[' . $key . '][answers][' . $index . '][result]', 'type' => 'checkbox', 'value' => themex_value($answer, 'result'), 'wrap' => false));
                     $out .= '</div>';
                 }
                 $out .= '</div>';
             }
             $out .= '</div>';
             break;
             //users manager
         //users manager
         case 'users':
             $users = ThemexCore::getUserRelations(0, $post->ID, $post->post_type);
             $out .= '<div class="themex-row clearfix">';
             $out .= wp_dropdown_users(array('echo' => false, 'exclude' => $users, 'name' => 'add_user_id', 'id' => 'add_user_id'));
             $out .= '<input type="submit" name="add_user" class="button" value="' . __('Add', 'academy') . '" /></div>';
             if (!empty($users)) {
                 $out .= '<div class="themex-row clearfix">';
                 $out .= wp_dropdown_users(array('echo' => false, 'include' => $users, 'name' => 'remove_user_id', 'id' => 'remove_user_id'));
                 $out .= '<input type="submit" name="remove_user" class="button" value="' . __('Remove', 'academy') . '" /></div>';
             }
             break;
             //module settings
         //module settings
         case 'module':
             $out .= '<div class="' . substr(strtolower(implode('-', preg_split('/(?=[A-Z])/', str_replace(THEMEX_PREFIX, '', $option['id'])))), 1) . '">';
             if (isset($option['slug'])) {
                 $out .= call_user_func(array(str_replace(THEMEX_PREFIX, '', $option['id']), 'renderSettings'), $option['slug']);
             } else {
                 $out .= call_user_func(array(str_replace(THEMEX_PREFIX, '', $option['id']), 'renderSettings'));
             }
             $out .= '</div>';
             break;
     }
     //option after
     if (isset($option['after'])) {
         $out .= $option['after'];
     }
     //wrap option
     if (!isset($option['wrap']) || $option['wrap']) {
         $out .= '</div>';
     }
     return $out;
 }
    function form($instance)
    {
        $instance = wp_parse_args((array) $instance, array('number' => '6', 'order' => 'registered', 'title' => ''));
        ?>
		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'academy');
        ?>
:</label>
			<input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo $instance['title'];
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('number');
        ?>
"><?php 
        _e('Number', 'academy');
        ?>
:</label>
			<input class="widefat" type="number" id="<?php 
        echo $this->get_field_id('number');
        ?>
" name="<?php 
        echo $this->get_field_name('number');
        ?>
" value="<?php 
        echo $instance['number'];
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('order');
        ?>
"><?php 
        _e('Order', 'academy');
        ?>
:</label>
			<?php 
        echo ThemexInterface::renderOption(array('id' => $this->get_field_name('order'), 'type' => 'select', 'value' => $instance['order'], 'wrap' => false, 'options' => array('registered' => __('Date', 'academy'), 'display_name' => __('Name', 'academy'), 'post_count' => __('Activity', 'academy')), 'attributes' => array('class' => 'widefat')));
        ?>
		</p>
	<?php 
    }
 /**
  * Renders field option
  *
  * @access public
  * @param array $field
  * @return string
  */
 public static function renderField($field)
 {
     $out = '<div class="themex-form-item themex-option" id="' . $field['form'] . '_' . $field['id'] . '">';
     $out .= '<a href="#" class="themex-button themex-remove-button themex-trigger" title="' . __('Remove', 'makery') . '" data-action="themex_form_remove" data-element="' . $field['form'] . '_' . $field['id'] . '"></a>';
     $out .= ThemexInterface::renderOption(array('id' => $field['form'] . '_' . $field['id'] . '_value', 'type' => 'hidden', 'value' => $field['form'], 'wrap' => false, 'after' => '<a href="#" class="themex-button themex-add-button themex-trigger" title="' . __('Add', 'makery') . '" data-action="themex_form_add" data-element="' . $field['form'] . '_' . $field['id'] . '" data-value="' . $field['form'] . '_' . $field['id'] . '_value"></a>'));
     $out .= ThemexInterface::renderOption(array('id' => __CLASS__ . '[' . $field['form'] . '][fields][' . $field['id'] . '][name]', 'type' => 'text', 'attributes' => array('placeholder' => __('Name', 'makery')), 'value' => isset(self::$data[$field['form']]['fields'][$field['id']]['name']) ? themex_stripslashes(self::$data[$field['form']]['fields'][$field['id']]['name']) : '', 'wrap' => false));
     $out .= ThemexInterface::renderOption(array('id' => __CLASS__ . '[' . $field['form'] . '][fields][' . $field['id'] . '][type]', 'type' => 'select', 'options' => array('text' => __('String', 'makery'), 'select' => __('Select', 'makery')), 'value' => isset(self::$data[$field['form']]['fields'][$field['id']]['type']) ? self::$data[$field['form']]['fields'][$field['id']]['type'] : '', 'wrap' => false));
     $out .= ThemexInterface::renderOption(array('id' => __CLASS__ . '[' . $field['form'] . '][fields][' . $field['id'] . '][options]', 'type' => 'text', 'attributes' => array('placeholder' => __('Options', 'makery')), 'value' => isset(self::$data[$field['form']]['fields'][$field['id']]['options']) ? self::$data[$field['form']]['fields'][$field['id']]['options'] : '', 'wrap' => false));
     $out .= '</div>';
     return $out;
 }
                }
            } else {
                ?>
						<tr>
							<th><?php 
                echo $field['label'];
                ?>
</th>
							<td>
								<?php 
                if (in_array($field['type'], array('select', 'select_country'))) {
                    ?>
								<div class="element-select">
									<span></span>
									<?php 
                    echo ThemexInterface::renderOption(array('id' => $field['name'], 'type' => $field['type'], 'options' => array_intersect_key(themex_array('options', $field), $methods), 'value' => themex_value($field['name'], $_POST), 'wrap' => false, 'attributes' => array('class' => 'element-trigger')));
                    ?>
								</div>
								<?php 
                } else {
                    ?>
								<div class="field-wrap">
									<input type="text" name="<?php 
                    echo esc_attr($field['name']);
                    ?>
" value="<?php 
                    echo esc_attr(themex_value($field['name'], $_POST));
                    ?>
" />
								</div>
								<?php 
				<?php 
                if (in_array(ThemexCore::getOption('product_type', 'all'), array('all', 'physical'))) {
                    ?>
				<?php 
                    if (themex_taxonomy('product_shipping_class') && ThemexWoo::isShipping()) {
                        ?>
				<tr class="trigger-type-physical">
					<th><?php 
                        _e('Shipping Class', 'makery');
                        ?>
</th>
					<td>
						<div class="element-select">
							<span></span>
							<?php 
                        echo ThemexInterface::renderOption(array('id' => 'shipping_class', 'type' => 'select_category', 'taxonomy' => 'product_shipping_class', 'value' => ThemexWoo::$data['product']['shipping_class'], 'wrap' => false));
                        ?>
						</div>
					</td>
				</tr>
				<?php 
                    }
                    ?>
				<?php 
                    if (ThemexWoo::$data['product']['form'] != 'variable') {
                        ?>
				<tr class="trigger-type-physical">
					<th><?php 
                        _e('Stock', 'makery');
                        ?>
</th>
Example #10
0
 /**
  * Renders admin profile
  *
  * @access public
  * @param mixed $user
  * @return void
  */
 public static function renderAdminProfile($user)
 {
     $profile = self::getProfile($user->ID, true);
     $out = '<table class="form-table themex-profile"><tbody>';
     if (current_user_can('edit_users')) {
         $out .= '<tr><th><label for="avatar">' . __('Profile Photo', 'academy') . '</label></th>';
         $out .= '<td><div class="themex-image-uploader">';
         $out .= get_avatar($user->ID);
         $out .= ThemexInterface::renderOption(array('id' => 'avatar', 'type' => 'uploader', 'value' => '', 'wrap' => false));
         $out .= '</div></td></tr>';
     }
     if (!ThemexCore::checkOption('profile_signature')) {
         $out .= '<tr><th><label>' . __('Signature', 'academy') . '</label></th><td>';
         $out .= '<input type="text" name="signature" value="' . $profile['signature'] . '" />';
         $out .= '</td></tr>';
     }
     ob_start();
     ThemexForm::renderData('profile', array('edit' => true, 'before_title' => '<tr><th><label>', 'after_title' => '</label></th>', 'before_content' => '<td>', 'after_content' => '</td></tr>'), $profile);
     $out .= ob_get_contents();
     ob_end_clean();
     $out .= '<tr><th><label>' . __('Profile Text', 'academy') . '</label></th><td>';
     ob_start();
     ThemexInterface::renderEditor('description', wpautop(get_user_meta($user->ID, 'description', true)));
     $out .= ob_get_contents();
     ob_end_clean();
     $out .= '</td></tr>';
     if (!ThemexCore::checkOption('profile_links')) {
         $out .= '<tr><th><label>' . __('Facebook', 'academy') . '</label></th><td>';
         $out .= '<input type="text" name="facebook" value="' . $profile['facebook'] . '" />';
         $out .= '</td></tr>';
         $out .= '<tr><th><label>' . __('Twitter', 'academy') . '</label></th><td>';
         $out .= '<input type="text" name="twitter" value="' . $profile['twitter'] . '" />';
         $out .= '</td></tr>';
         $out .= '<tr><th><label>' . __('Google', 'academy') . '</label></th><td>';
         $out .= '<input type="text" name="google" value="' . $profile['google'] . '" />';
         $out .= '</td></tr>';
         $out .= '<tr><th><label>' . __('Tumblr', 'academy') . '</label></th><td>';
         $out .= '<input type="text" name="tumblr" value="' . $profile['tumblr'] . '" />';
         $out .= '</td></tr>';
         $out .= '<tr><th><label>' . __('LinkedIn', 'academy') . '</label></th><td>';
         $out .= '<input type="text" name="linkedin" value="' . $profile['linkedin'] . '" />';
         $out .= '</td></tr>';
         $out .= '<tr><th><label>' . __('Flickr', 'academy') . '</label></th><td>';
         $out .= '<input type="text" name="flickr" value="' . $profile['flickr'] . '" />';
         $out .= '</td></tr>';
         $out .= '<tr><th><label>' . __('YouTube', 'academy') . '</label></th><td>';
         $out .= '<input type="text" name="youtube" value="' . $profile['youtube'] . '" />';
         $out .= '</td></tr>';
         $out .= '<tr><th><label>' . __('Vimeo', 'academy') . '</label></th><td>';
         $out .= '<input type="text" name="vimeo" value="' . $profile['vimeo'] . '" />';
         $out .= '</td></tr>';
     }
     $out .= '</tbody></table>';
     echo $out;
 }
							<?php 
    echo ThemexInterface::renderOption(array('id' => 'country', 'type' => 'select_country', 'attributes' => array('class' => 'countries-list'), 'value' => esc_attr(themex_array('country', $_GET)), 'wrap' => false));
    ?>
						</div>
					</td>
				</tr>
				<tr>
					<th><?php 
    _e('City', 'makery');
    ?>
</th>
					<td>
						<div class="element-select">
							<span></span>
							<?php 
    echo ThemexInterface::renderOption(array('id' => 'city', 'type' => 'select_city', 'attributes' => array('class' => 'element-filter', 'data-filter' => 'countries-list'), 'value' => esc_attr(themex_array('city', $_GET)), 'wrap' => false));
    ?>
						</div>
					</td>
				</tr>
				<?php 
}
?>
			</tbody>
		</table>
		<a href="#" class="element-button element-submit primary"><?php 
_e('Search', 'makery');
?>
</a>
		<input type="hidden" name="post_type" value="shop" />
	</form>
 /**
  * Renders admin profile
  *
  * @access public
  * @param mixed $user
  * @return void
  */
 public static function renderAdminProfile($user)
 {
     $profile = self::getProfile($user->ID);
     $out = '<table class="form-table themex-profile"><tbody>';
     if (current_user_can('edit_users')) {
         $out .= '<tr><th><label for="avatar">' . __('Profile Photo', 'academy') . '</label></th>';
         $out .= '<td><div class="themex-image-uploader">';
         $out .= get_avatar($user->ID);
         $out .= ThemexInterface::renderOption(array('id' => 'avatar', 'type' => 'uploader', 'value' => '', 'wrap' => false));
         $out .= '</div></td></tr>';
     }
     ob_start();
     ThemexForm::renderData('profile', array('edit' => true, 'placeholder' => false, 'before_title' => '<tr><th><label>', 'after_title' => '</label></th>', 'before_content' => '<td>', 'after_content' => '</td></tr>'), $profile);
     $out .= ob_get_contents();
     ob_end_clean();
     $out .= '<tr><th><label>' . __('Profile Text', 'academy') . '</label></th><td>';
     ob_start();
     ThemexInterface::renderEditor('description', themex_array('description', $profile));
     $out .= ob_get_contents();
     ob_end_clean();
     $out .= '</td></tr>';
     $out .= '</tbody></table>';
     echo $out;
 }
        continue;
    }
    ?>
				<tr>
					<th><?php 
    echo $field['label'];
    ?>
</th>
					<td>
						<?php 
    if (in_array($field['type'], array('select', 'select_country'))) {
        ?>
						<div class="element-select">
							<span></span>
							<?php 
        echo ThemexInterface::renderOption(array('id' => $field['name'], 'type' => $field['type'], 'options' => themex_array('options', $field), 'value' => esc_attr(ThemexUser::$data['current']['profile']['billing_country']), 'wrap' => false));
        ?>
						</div>
						<?php 
    } else {
        ?>
						<div class="field-wrap">
							<input type="text" name="<?php 
        echo esc_attr($field['name']);
        ?>
" value="<?php 
        echo esc_attr(ThemexUser::$data['current']['profile'][$field['name']]);
        ?>
" />
						</div>
						<?php 
						<div class="element-select">
							<span></span>
							<?php 
            echo ThemexInterface::renderOption(array('id' => 'local_delivery_availability', 'type' => 'select', 'options' => array('all' => __('All Countries', 'makery'), 'specific' => __('Specific Countries', 'makery')), 'attributes' => array('class' => 'element-trigger'), 'value' => themex_value('availability', $shipping['local_delivery'], 'all'), 'wrap' => false));
            ?>
						</div>
					</td>
				</tr>
				<tr class="trigger-local-delivery-availability-specific">
					<th><?php 
            _e('Countries', 'makery');
            ?>
</th>
					<td>
						<?php 
            echo ThemexInterface::renderOption(array('id' => 'local_delivery_countries[]', 'type' => 'select', 'options' => ThemexWoo::getShippingCountries(), 'value' => themex_array('countries', $shipping['local_delivery']), 'wrap' => false, 'attributes' => array('class' => 'element-chosen', 'multiple' => 'multiple', 'data-placeholder' => __('Select Options', 'makery'))));
            ?>
					</td>
				</tr>
				<tr>
					<th><?php 
            _e('Cost', 'makery');
            ?>
</th>
					<td>
						<div class="field-wrap">
							<input type="text" name="local_delivery_cost" value="<?php 
            echo ThemexWoo::formatPrice(themex_value('cost', $shipping['local_delivery'], '0'));
            ?>
" />
						</div>
						</div>
					</td>
				</tr>
				<?php 
        if (themex_taxonomy('shop_category')) {
            ?>
				<tr>
					<th><?php 
            _e('Category', 'makery');
            ?>
</th>
					<td>
						<div class="element-select">
							<span></span>
							<?php 
            echo ThemexInterface::renderOption(array('id' => 'category', 'type' => 'select_category', 'taxonomy' => 'shop_category', 'value' => ThemexShop::$data['profile']['category'], 'wrap' => false));
            ?>
						</div>
					</td>
				</tr>
				<?php 
        }
        ?>
			</tbody>
		</table>
		<div class="profile-editor">
			<h5><?php 
        _e('Description', 'makery');
        ?>
</h5>
			<?php 
                    foreach ($attributes as $attribute) {
                        $value = themex_value($attribute['name'], ThemexWoo::$data['product']['attributes']);
                        ?>
					<tr>
						<th><?php 
                        echo $attribute['label'];
                        ?>
</th>
						<td>
							<?php 
                        if ($attribute['type'] == 'select') {
                            ?>
							<div class="element-select">
								<span></span>
								<?php 
                            echo ThemexInterface::renderOption(array('id' => $attribute['name'], 'type' => 'select_category', 'taxonomy' => $attribute['name'], 'value' => $value, 'wrap' => false));
                            ?>
							</div>
							<?php 
                        } else {
                            ?>
							<div class="field-wrap">
								<input type="text" name="<?php 
                            echo esc_attr($attribute['name']);
                            ?>
" value="<?php 
                            echo esc_attr($value);
                            ?>
" />
							</div>
							<?php