Пример #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;
 }
Пример #2
0
 /**
  * Updates product
  *
  * @access public
  * @param int $ID
  * @param array $data
  * @return void
  */
 public static function updateProduct($ID, $data)
 {
     global $wpdb;
     $redirect = false;
     if (empty($ID)) {
         $ID = self::addProduct();
         $redirect = true;
     }
     $args = array('ID' => $ID);
     //title
     $args['post_title'] = themex_value('title', $data);
     if (empty($args['post_title'])) {
         ThemexInterface::$messages[] = __('Product name field is required', 'makery');
     }
     //category
     if (themex_taxonomy('product_cat')) {
         $category = intval(themex_value('category', $data));
         if (empty($category)) {
             ThemexInterface::$messages[] = __('Item category field is required', 'makery');
         } else {
             $term = get_term($category, 'product_cat');
             if (empty($term)) {
                 ThemexInterface::$messages[] = __('This item category does not exist', 'makery');
             } else {
                 wp_set_object_terms($ID, $term->name, 'product_cat');
             }
         }
     }
     //tags
     if (!ThemexCore::checkOption('product_tags')) {
         $tags = sanitize_text_field(themex_value('tags', $data));
         $tags = array_map('trim', explode(',', $tags));
         if (!empty($tags)) {
             $tag = reset($tags);
             if (empty($tag)) {
                 wp_set_object_terms($ID, null, 'product_tag');
             } else {
                 wp_set_object_terms($ID, $tags, 'product_tag');
             }
         }
     }
     //type
     $virtual = 'no';
     $ending = 'yes';
     if (themex_value('type', $data) == 'virtual' || ThemexCore::getOption('product_type', 'all') == 'virtual') {
         $virtual = 'yes';
         $ending = 'no';
     }
     update_post_meta($ID, '_virtual', $virtual);
     update_post_meta($ID, '_downloadable', $virtual);
     update_post_meta($ID, '_manage_stock', $ending);
     update_post_meta($ID, '_stock_status', 'instock');
     update_post_meta($ID, '_visibility', 'visible');
     //price
     if (!ThemexCore::checkOption('product_price')) {
         if (isset($data['regular_price'])) {
             $regular_price = self::formatPrice(themex_value('regular_price', $data), false);
             update_post_meta($ID, '_price', $regular_price);
             update_post_meta($ID, '_regular_price', $regular_price);
         }
         if (isset($data['sale_price'])) {
             $sale_price = self::formatPrice(themex_value('sale_price', $data), false);
             if (empty($sale_price)) {
                 $sale_price = '';
             }
             update_post_meta($ID, '_sale_price', $sale_price);
             if (!empty($sale_price)) {
                 update_post_meta($ID, '_price', $sale_price);
             }
         }
     }
     //stock
     if ($virtual == 'no' && isset($data['stock'])) {
         $stock = intval(themex_value('stock', $data));
         update_post_meta($ID, '_stock', $stock);
     }
     //shipping
     if (themex_taxonomy('product_shipping_class')) {
         $class = intval(themex_value('shipping_class', $data));
         $term = get_term($class, 'product_shipping_class');
         if (empty($class)) {
             wp_set_object_terms($ID, '', 'product_shipping_class');
         } else {
             if (!is_wp_error($term)) {
                 wp_set_object_terms($ID, $term->name, 'product_shipping_class');
             }
         }
     }
     //file
     if ($virtual == 'yes' && isset($_FILES['file'])) {
         $files = get_post_meta($ID, '_downloadable_files', true);
         if (empty($files) || !is_array($files)) {
             $files = array();
         }
         $extensions = array_map('trim', explode(',', ThemexCore::getOption('product_extensions', 'zip')));
         $attachment = ThemexCore::addFile($_FILES['file'], $extensions, $ID);
         if (isset($attachment['ID']) && $attachment['ID'] != 0) {
             $file = array_shift($files);
             if (is_array($file) && isset($file['file'])) {
                 $current = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid='%s'", $file['file']));
                 if (!empty($current)) {
                     wp_delete_attachment($current, true);
                 }
             }
             $files = array_merge(array(md5($attachment['guid']) => array('name' => themex_filename($attachment['guid']), 'file' => $attachment['guid'])), $files);
             update_post_meta($ID, '_downloadable_files', $files);
         }
     }
     //attributes
     if (!ThemexCore::checkOption('product_attributes')) {
         $attributes = self::getAttributes();
         $options = get_post_meta($ID, '_product_attributes', true);
         if (empty($options) || !is_array($options)) {
             $options = array();
         }
         foreach ($attributes as $attribute) {
             if (isset($data[$attribute['name']]) && taxonomy_exists($attribute['name'])) {
                 $name = stripslashes(strip_tags($data[$attribute['name']]));
                 $value = sanitize_title($data[$attribute['name']]);
                 if ($attribute['type'] == 'select') {
                     $term = get_term_by('id', $value, $attribute['name']);
                     $value = '';
                     if ($term !== false) {
                         $value = $term->slug;
                     }
                 }
                 if ($attribute['type'] != 'select' || (isset($attribute['options'][$value]) || $value == '')) {
                     if ($attribute['type'] == 'select') {
                         wp_set_object_terms($ID, $value, $attribute['name']);
                     } else {
                         wp_set_object_terms($ID, $name, $attribute['name']);
                     }
                     if ($value != '') {
                         $options[$attribute['name']] = array('name' => $attribute['name'], 'value' => $value, 'position' => '0', 'is_visible' => 1, 'is_variation' => 0, 'is_taxonomy' => 1);
                     } else {
                         unset($options[$attribute['name']]);
                     }
                 }
             }
         }
         update_post_meta($ID, '_product_attributes', $options);
     }
     //options
     $option_names = themex_array('option_names', $data);
     $option_values = themex_array('option_values', $data);
     if (is_array($option_names) && is_array($option_values)) {
         $slugs = array();
         $options = get_post_meta($ID, '_product_attributes', true);
         if (empty($options) || !is_array($options)) {
             $options = array();
         }
         foreach ($option_names as $index => $name) {
             if (isset($option_values[$index])) {
                 $name = sanitize_text_field($name);
                 $slug = sanitize_title($name);
                 $value = implode('|', array_map('trim', explode(',', sanitize_text_field($option_values[$index]))));
                 if (!empty($slug) && !empty($name) && !empty($value)) {
                     $slugs[] = $slug;
                     $options[$slug] = array('name' => $name, 'value' => $value, 'position' => '0', 'is_visible' => 0, 'is_variation' => 1, 'is_taxonomy' => 0);
                 }
             }
         }
         foreach ($options as $slug => $option) {
             if (isset($option['is_taxonomy']) && empty($option['is_taxonomy']) && !in_array($slug, $slugs)) {
                 unset($options[$slug]);
             }
         }
         update_post_meta($ID, '_product_attributes', $options);
     }
     //variations
     $variation_ids = themex_array('variation_ids', $data);
     $variation_stocks = themex_array('variation_stocks', $data);
     $variation_regular_prices = themex_array('variation_regular_prices', $data);
     $variation_sale_prices = themex_array('variation_sale_prices', $data);
     if (is_array($variation_ids) && is_array($variation_stocks) && is_array($variation_regular_prices) && is_array($variation_sale_prices)) {
         $variations = self::getVariations($ID, array('fields' => 'ids'));
         $new_variations = array();
         foreach ($variation_ids as $index => $variation_id) {
             if (isset($variation_stocks[$index]) && isset($variation_regular_prices[$index]) && isset($variation_sale_prices[$index])) {
                 $variation_id = intval($variation_id);
                 $stock = intval($variation_stocks[$index]);
                 $regular_price = self::formatPrice($variation_regular_prices[$index], false);
                 $sale_price = $variation_sale_prices[$index];
                 if (!empty($stock) && (empty($variation_id) || !in_array($variation_id, $variations))) {
                     $variation_id = wp_insert_post(array('post_type' => 'product_variation', 'post_parent' => $ID, 'post_status' => 'publish', 'post_author' => 1, 'post_title' => sprintf(__('Variation #%s', 'makery'), count($variations) + 1)));
                 }
                 if (!empty($variation_id)) {
                     $new_variations[] = $variation_id;
                     if (($variation_index = array_search($variation_id, $variations)) !== false) {
                         unset($variations[$variation_index]);
                     }
                     update_post_meta($variation_id, '_manage_stock', 'yes');
                     update_post_meta($variation_id, '_stock_status', 'instock');
                     update_post_meta($variation_id, '_stock', $stock);
                     update_post_meta($variation_id, '_regular_price', $regular_price);
                     update_post_meta($variation_id, '_price', $regular_price);
                     if ($sale_price != '') {
                         $sale_price = self::formatPrice($sale_price, false);
                         update_post_meta($variation_id, '_sale_price', $sale_price);
                         update_post_meta($variation_id, '_price', $sale_price);
                     } else {
                         update_post_meta($variation_id, '_sale_price', '');
                     }
                     $options = self::getOptions($ID);
                     foreach ($options as $name => $option) {
                         $values = themex_array('variation_' . $name . 's', $data);
                         $items = array_map('trim', explode(',', $option['value']));
                         if (is_array($values) && isset($values[$index]) && (in_array($values[$index], $items) || $values[$index] == '')) {
                             update_post_meta($variation_id, 'attribute_' . $name, $values[$index]);
                         }
                     }
                 }
             }
         }
         foreach ($variations as $variation) {
             wp_delete_post($variation, true);
         }
         if (empty($new_variations)) {
             wp_set_object_terms($ID, 'simple', 'product_type');
         } else {
             set_transient('wc_product_children_ids_' . $ID . WC_Cache_Helper::get_transient_version('product'), $new_variations, 84600 * 365);
             WC_Product_Variable::sync($ID);
             wp_set_object_terms($ID, 'variable', 'product_type');
         }
     }
     //content
     $args['post_content'] = trim(themex_value('content', $data));
     $args['post_content'] = wp_kses($args['post_content'], array('strong' => array(), 'em' => array(), 'a' => array('href' => array(), 'title' => array(), 'target' => array()), 'p' => array(), 'br' => array()));
     $success = false;
     if (empty(ThemexInterface::$messages)) {
         $status = get_post_status($ID);
         if ($status == 'draft') {
             $args['post_status'] = 'pending';
             if (ThemexCore::checkOption('product_approve')) {
                 $args['post_status'] = 'publish';
             }
             $redirect = true;
         }
         ThemexInterface::$messages[] = __('Product has been successfully saved', 'makery');
         $_POST['success'] = true;
         $success = true;
     }
     //update post
     wp_update_post($args);
     if ($redirect) {
         ThemexInterface::setMessages($success);
         wp_redirect(ThemexCore::getURL('shop-product', $ID));
         exit;
     }
 }
			<?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']);
?>
" />
Пример #4
0
 /**
  * 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;
 }
Пример #5
0
    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 
    }
Пример #6
0
			<h1 class="themex-page-title"><?php 
_e('Theme Options', 'academy');
?>
</h1>
			<input type="submit" name="<?php 
echo THEMEX_PREFIX;
?>
save_options" value="<?php 
_e('Save Changes', 'academy');
?>
" class="themex-button disabled themex-save-button" />
		</div>
		<div class="themex-content">
			<div class="themex-menu">
				<?php 
ThemexInterface::renderMenu();
?>
			</div>
			<div class="themex-sections">
				
				<?php 
self::renderSections();
?>
				
			</div>
		</div>	
		<div class="themex-footer">
			<input type="submit" name="<?php 
echo THEMEX_PREFIX;
?>
reset_options" value="<?php 
Пример #7
0
 /**
  * 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;
 }
Пример #8
0
								<input type="hidden" name="variation_ids[]" value="<?php 
                        echo $variation->ID;
                        ?>
" />
							</div>
						</td>
					</tr>
					<?php 
                    }
                }
                ?>
			</tbody>
		</table>
		<div class="profile-description">
			<?php 
                ThemexInterface::renderEditor('content', ThemexWoo::$data['product']['content']);
                ?>
		</div>
		<?php 
                if (ThemexWoo::$data['product']['status'] == 'draft') {
                    ?>
			<?php 
                    if (ThemexCore::checkOption('shop_approve')) {
                        ?>
			<a href="#" class="element-button element-submit primary"><?php 
                        _e('Save Changes', 'makery');
                        ?>
</a>
			<?php 
                    } else {
                        ?>
Пример #9
0
 /**
  * Submits shop report
  *
  * @access public
  * @param array $data
  * @return void
  */
 public static function submitReport($data)
 {
     $shop = intval(themex_value('shop_id', $data));
     if (!empty($shop)) {
         $reason = sanitize_text_field(themex_value('reason', $data));
         if (empty($reason)) {
             ThemexInterface::$messages[] = '"' . __('Reason', 'makery') . '" ' . __('field is required', 'makery');
         }
         if (empty(ThemexInterface::$messages)) {
             $subject = __('Shop Report', 'makery');
             $content = ThemexCore::getOption('email_shop_report', 'Sender: %user%<br />Shop: %shop%<br />Reason: %reason%');
             $user = get_userdata(get_current_user_id());
             $keywords = array('user' => '<a href="' . get_author_posts_url($user->ID) . '">' . $user->user_login . '</a>', 'shop' => '<a href="' . get_permalink($shop) . '">' . get_the_title($shop) . '</a>', 'reason' => wpautop($reason));
             $content = themex_keywords($content, $keywords);
             themex_mail(get_option('admin_email'), $subject, $content, $user->user_email);
             ThemexInterface::$messages[] = __('Report has been successfully sent', 'makery');
             ThemexInterface::renderMessages(true);
         } else {
             ThemexInterface::renderMessages();
         }
     }
     die;
 }
Пример #10
0
 /**
  * Submits form data
  *
  * @access public
  * @return void
  */
 public static function submitData()
 {
     self::refresh();
     parse_str($_POST['data'], $data);
     if (isset($data['slug']) && self::isActive($data['slug'])) {
         if (isset(self::$data[$data['slug']]['captcha'])) {
             session_start();
             $posted_code = md5($data['captcha']);
             $session_code = $_SESSION['captcha'];
             if ($session_code != $posted_code) {
                 ThemexInterface::$messages[] = __('The verification code is incorrect', 'academy');
             }
         }
         foreach (self::$data[$data['slug']]['fields'] as $field) {
             $ID = themex_sanitize_key($field['name']);
             $field['name'] = themex_get_string($ID, 'name', $field['name']);
             if ((!isset($data[$ID]) || trim($data[$ID]) == '') && !isset($field['optional']) && $field['type'] != 'checkbox') {
                 ThemexInterface::$messages[] = '"' . $field['name'] . '" ' . __('field is required', 'academy');
             } else {
                 if ($field['type'] == 'number' && !is_numeric($data[$ID])) {
                     ThemexInterface::$messages[] = '"' . $field['name'] . '" ' . __('field can only contain numbers', 'academy');
                 }
                 if ($field['type'] == 'email' && !is_email($data[$ID])) {
                     ThemexInterface::$messages[] = __('You have entered an invalid email address', 'academy');
                 }
             }
         }
         if (!empty(ThemexInterface::$messages)) {
             ThemexInterface::renderMessages();
         } else {
             $email = get_option('admin_email');
             $subject = __('Contact', 'academy');
             $message = '';
             foreach (self::$data[$data['slug']]['fields'] as $field) {
                 $ID = themex_sanitize_key($field['name']);
                 $field['name'] = themex_get_string($ID, 'name', $field['name']);
                 if ($field['type'] == 'select') {
                     $field['options'] = themex_get_string($ID, 'options', $field['options']);
                     $items = explode(',', $field['options']);
                     if (isset($items[$data[$ID] - 1])) {
                         $data[$ID] = $items[$data[$ID] - 1];
                     } else {
                         $data[$ID] = '&ndash;';
                     }
                 } else {
                     if ($field['type'] == 'textarea') {
                         $data[$ID] = nl2br($data[$ID]);
                     }
                 }
                 $message .= '<strong>' . $field['name'] . '</strong>: ' . $data[$ID] . '<br />';
             }
             if (themex_mail($email, $subject, $message) && isset(self::$data[$data['slug']]['message'])) {
                 $message = themex_get_string($data['slug'], 'message', self::$data[$data['slug']]['message']);
                 ThemexInterface::$messages[] = $message;
             }
             ThemexInterface::renderMessages(true);
         }
     }
     die;
 }
Пример #11
0
 /**
  * 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;
 }
/*
Template Name: Shop Membership
*/
get_header();
get_sidebar('profile-left');
?>
<div class="column fivecol">
	<div class="element-title indented">
		<h1><?php 
_e('Shop Membership', 'makery');
?>
</h1>
	</div>
	<?php 
ThemexInterface::renderTemplateContent('shop-membership');
?>
	<?php 
if (!ThemexWoo::isActive() || !ThemexCore::checkOption('membership_free')) {
    ?>
	<span class="secondary"><?php 
    _e('This shop does not exist.', 'makery');
    ?>
</span>
	<?php 
} else {
    $membership = ThemexUser::getMembership(ThemexUser::$data['current']['ID']);
    ?>
	<table class="profile-fields">
		<tbody>
			<tr>
						<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 class="profile-editor">
			<h5><?php 
        _e('About', 'makery');
        ?>
</h5>
			<?php 
        ThemexInterface::renderEditor('about', ThemexShop::$data['profile']['about']);
        ?>
		</div>
		<div class="profile-editor">
			<h5><?php 
        _e('Policies', 'makery');
        ?>
</h5>
			<?php 
        ThemexInterface::renderEditor('policy', ThemexShop::$data['profile']['policy']);
        ?>
		</div>
		<?php 
        if (ThemexShop::$data['status'] == 'draft') {
            ?>
			<?php 
            if (ThemexCore::checkOption('shop_approve')) {
                ?>
			<a href="#" class="element-button element-submit primary"><?php 
                _e('Save Changes', 'makery');
                ?>
</a>
			<?php 
            } else {
                ?>
Пример #15
0
_e('Sign In', 'makery');
?>
</a>
		<?php 
if (ThemexFacebook::isActive()) {
    ?>
		<a href="<?php 
    echo home_url('?facebook_login=1');
    ?>
" class="element-button element-facebook square facebook" title="<?php 
    _e('Sign in with Facebook', 'makery');
    ?>
"><span class="fa fa-facebook"></span></a>
		<?php 
}
?>
		<a href="#password_form" class="element-button element-colorbox square" title="<?php 
_e('Password Recovery', 'makery');
?>
"><span class="fa fa-life-ring"></span></a>
		<input type="hidden" name="user_action" value="login_user" />
		<input type="hidden" name="action" class="action" value="<?php 
echo THEMEX_PREFIX;
?>
update_user" />
	</form>
</div>
<div class="clear"></div>
<?php 
ThemexInterface::renderTemplateContent('register');
get_footer();
                }
            } 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 
Пример #17
0
/*
Template Name: Shop Products
*/
get_header();
get_sidebar('profile-left');
?>
<div class="column fivecol">
	<div class="element-title indented">
		<h1><?php 
_e('Shop Items', 'makery');
?>
</h1>
	</div>
	<?php 
ThemexInterface::renderTemplateContent('shop-products');
?>
	<?php 
if (ThemexCore::checkOption('shop_multiple')) {
    ?>
	<span class="secondary"><?php 
    _e('This shop does not exist.', 'makery');
    ?>
</span>
	<?php 
} else {
    if (ThemexShop::$data['status'] != 'publish') {
        ?>
	<span class="secondary"><?php 
        _e('This shop is currently being reviewed.', 'makery');
        ?>
Пример #18
0
						</div>
					</td>
				</tr>
				<?php 
}
?>
				<?php 
ThemexForm::renderData('profile', array('edit' => true, 'placeholder' => false, 'before_title' => '<tr><th>', 'after_title' => '</th>', 'before_content' => '<td>', 'after_content' => '</td></tr>'), ThemexUser::$data['user']['profile']);
?>
			</tbody>
		</table>
		<?php 
if (!ThemexCore::checkOption('profile_description')) {
    ?>
			<?php 
    ThemexInterface::renderEditor('description', ThemexUser::$data['user']['profile']['description']);
    ?>
		<?php 
}
?>
		<a href="#" class="element-button submit-button"><span class="button-icon save"></span><?php 
_e('Save Changes', 'academy');
?>
</a>
		<input type="hidden" name="user_action" value="update_profile" />
		<input type="hidden" name="nonce" value="<?php 
echo wp_create_nonce(THEMEX_PREFIX . 'nonce');
?>
" />
	</form>
</div>
Пример #19
0
/*
Template Name: Shop Orders
*/
get_header();
get_sidebar('profile-left');
?>
<div class="column fivecol">
	<div class="element-title indented">
		<h1><?php 
_e('Shop Orders', 'makery');
?>
</h1>
	</div>
	<?php 
ThemexInterface::renderTemplateContent('shop-orders');
?>
	<?php 
if (ThemexCore::checkOption('shop_multiple')) {
    ?>
	<span class="secondary"><?php 
    _e('This shop does not exist.', 'makery');
    ?>
</span>
	<?php 
} else {
    if (ThemexShop::$data['status'] != 'publish') {
        ?>
	<span class="secondary"><?php 
        _e('This shop is currently being reviewed.', 'makery');
        ?>
Пример #20
0
ThemexInterface::renderTemplateContent('profile-address');
?>
	<?php 
if (!ThemexWoo::isActive() || ThemexCore::checkOption('profile_address')) {
    ?>
	<span class="secondary"><?php 
    _e('There are no fields in this form.', 'makery');
    ?>
</span>
	<?php 
} else {
    ?>
	<form action="" method="POST" class="site-form">
		<div class="message">
			<?php 
    ThemexInterface::renderMessages(themex_value('success', $_POST, false));
    ?>
		</div>
		<table class="profile-fields">
			<tbody>
				<?php 
    foreach (ThemexCore::$components['forms']['address'] as $field) {
        ?>
				<tr>
					<th><?php 
        echo $field['label'];
        ?>
</th>
					<td>
						<div class="field-wrap">
							<input type="text" name="<?php 
Пример #21
0
 /**
  * Submits user message
  *
  * @access public
  * @param int $ID
  * @param array $data
  * @return void
  */
 public static function submitMessage($ID, $data)
 {
     $user = intval(themex_value('user_id', $data));
     if (!empty($user)) {
         $message = sanitize_text_field(themex_value('message', $data));
         if (empty($message)) {
             ThemexInterface::$messages[] = '"' . __('Message', 'makery') . '" ' . __('field is required', 'makery');
         }
         if (empty(ThemexInterface::$messages)) {
             $subject = __('New Message', 'makery');
             $content = ThemexCore::getOption('email_message', 'Sender: %user%<br />Message: %message%');
             $receiver = get_userdata($user);
             $sender = get_userdata($ID);
             $keywords = array('user' => '<a href="' . get_author_posts_url($sender->ID) . '">' . $sender->user_login . '</a>', 'message' => wpautop($message));
             $content = themex_keywords($content, $keywords);
             themex_mail($receiver->user_email, $subject, $content, $sender->user_email);
             ThemexInterface::$messages[] = __('Message has been successfully sent', 'makery');
             ThemexInterface::renderMessages(true);
         } else {
             ThemexInterface::renderMessages();
         }
     }
     die;
 }
Пример #22
0
?>
	<h1><?php 
the_title();
?>
</h1>
	<?php 
the_content();
?>
	<div class="quiz-listing">
		<form id="quiz_form" action="<?php 
the_permalink();
?>
" method="POST">
			<div class="message">
				<?php 
ThemexInterface::renderMessages(ThemexLesson::$data['progress']);
?>
			</div>
			<?php 
$counter = 0;
foreach (ThemexLesson::$data['quiz']['questions'] as $key => $question) {
    $counter++;
    ?>
			<div class="quiz-question <?php 
    echo $question['type'];
    ?>
">
				<div class="question-title">
					<div class="question-number"><?php 
    echo $counter;
    ?>
Пример #23
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;
 }
Пример #24
0
 /**
  * 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;
 }
Пример #25
0
			<?php 
} else {
    if (is_singular('shop')) {
        ?>
				<div class="featured-wrap">
					<section class="site-featured container clearfix">
						<?php 
        get_template_part('template', 'shop');
        ?>
					</section>
				</div>
				<!-- /featured -->
			<?php 
    } else {
        ?>
				<div class="site-title">
					<div class="container">
						<h1><?php 
        ThemexInterface::renderPageTitle();
        ?>
</h1>
					</div>
				</div>
				<!-- /title -->
			<?php 
    }
}
?>
		</div>
		<div class="content-wrap">
			<section class="site-content container">
Пример #26
0
 /**
  * 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;
 }
Пример #27
0
							<?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>
Пример #28
0
">
		<?php 
        get_template_part('content', 'course-grid');
        ?>
		</div>
		<?php 
        if ($counter == $columns) {
            $counter = 0;
            echo '<div class="clear"></div>';
        }
    }
    ?>
	</div>
	<?php 
}
?>
	<?php 
ThemexInterface::renderPagination();
?>
</div>
<?php 
if ($layout == 'right') {
    ?>
<aside class="sidebar fourcol column last">
	<?php 
    get_sidebar();
    ?>
</aside>
<?php 
}
get_footer();
/*
Template Name: Profile Referrals
*/
get_header();
get_sidebar('profile-left');
?>
<div class="column fivecol">
	<div class="element-title indented">
		<h1><?php 
_e('My Referrals', 'makery');
?>
</h1>
	</div>
	<?php 
ThemexInterface::renderTemplateContent('profile-referrals');
?>
	<?php 
if (ThemexCore::checkOption('shop_referrals') || !ThemexWoo::isActive()) {
    ?>
	<span class="secondary"><?php 
    _e('This page does not exist.', 'makery');
    ?>
</span>
	<?php 
} else {
    ?>
		<form action="" method="POST" class="site-form">
			<table class="profile-fields">
				<tbody>
					<tr>