Esempio n. 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;
 }
		<a href="#view" title="<?php 
    _e('Grid View', 'makery');
    ?>
" class="element-submit <?php 
    if (themex_value('view', $_GET) == 'grid') {
        ?>
active<?php 
    }
    ?>
" data-value="grid"><span class="fa fa-th-large"></span></a>
		<?php 
}
?>
		
		<input type="hidden" name="view" id="view" value="<?php 
echo themex_value('view', $_GET, $view);
?>
" />
		<?php 
foreach ($_GET as $key => $value) {
    if (!in_array($key, array('submit', 'view'))) {
        if (is_array($value)) {
            foreach ($value as $item) {
                echo '<input type="hidden" name="' . esc_attr($key) . '[]" value="' . esc_attr($item) . '" />';
            }
        } else {
            echo '<input type="hidden" name="' . esc_attr($key) . '" value="' . esc_attr($value) . '" />';
        }
    }
}
?>
Esempio n. 3
0
<?php

get_header();
?>
<div class="woocommerce">
	<?php 
$woocommerce_loop['single'] = true;
$woocommerce_loop['columns'] = 4;
$products = array_merge(ThemexShop::$data['products'], array(0));
$limit = intval(themex_value('limit', $_GET, ThemexCore::getOption('products_per_page', 9)));
$order = ThemexWoo::getSorting();
query_posts(array('post_type' => 'product', 'post_status' => 'publish', 'paged' => themex_paged(), 'posts_per_page' => $limit, 'post__in' => $products, 'orderby' => $order['orderby'], 'order' => $order['order'], 'meta_key' => $order['meta_key']));
$layout = 'full';
$shop = $post->ID;
ThemexWoo::getTemplate('archive-product.php');
?>
</div>
<?php 
get_footer();
                    ?>
								<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 
                }
                ?>
							</td>
						</tr>
						<?php 
            }
            ?>
				
					<?php 
        }
    }
Esempio n. 5
0
                    ?>
">
								<span class="fa fa-upload"></span>
							</label>
							<input type="file" id="product_file" name="file" class="element-file shifted" />
						</div>
					</td>
				</tr>
				<?php 
                }
                ?>
				<?php 
                if (!ThemexCore::checkOption('product_attributes')) {
                    $attributes = ThemexWoo::getAttributes();
                    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>
								<select name="<?php 
                            echo esc_attr($attribute['name']);
                            ?>
Esempio n. 6
0
 /**
  * Gets answer statistics
  *
  * @access public
  * @param int $ID
  * @param int $user
  * @return array
  */
 public static function getAnswerStatistics($ID, $user)
 {
     $answers = array();
     $quiz = ThemexCore::getPostRelations(0, $ID, 'quiz_lesson', true);
     if (!empty($quiz)) {
         $relations = explode(' ; ', ThemexCore::getUserRelations($user, $quiz, 'answers', true) . ' ');
         foreach ($relations as $relation) {
             $answer = array();
             $relation = explode(' , ', $relation);
             if (count($relation) == 3) {
                 $answer['question'] = themex_value($relation, 0);
                 $answer['answer'] = themex_value($relation, 1);
                 $answer['result'] = themex_value($relation, 2);
                 $answers[] = $answer;
             }
         }
     }
     return $answers;
 }
</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>
					</td>
				</tr>
			</tbody>
		</table>
		<?php 
        }
        ?>
		<a href="#" class="element-button element-submit primary"><?php 
        _e('Save Changes', 'makery');
        ?>
</a>
		<input type="hidden" name="shop_id" value="<?php 
<?php

/*
@version 3.0.0
*/
if (!defined('ABSPATH')) {
    exit;
}
global $woocommerce_loop, $layout;
$view = ThemexCore::getOption('products_view', 'grid');
if (!isset($layout)) {
    $layout = ThemexCore::getOption('products_layout', 'right');
}
$woocommerce_loop['view'] = themex_value('view', $_GET, $view);
$woocommerce_loop['columns'] = 4;
if ($layout != 'full') {
    $woocommerce_loop['columns'] = 3;
}
get_header('shop');
if ($layout == 'left') {
    ?>
<aside class="column fourcol">
	<?php 
    ThemexSidebar::renderSidebar('products', true);
    ?>
</aside>
<div class="column eightcol last">
<?php 
} else {
    if ($layout == 'right') {
        ?>
Esempio n. 9
0
 /**
  * Updates user settings
  *
  * @access public
  * @param int $ID
  * @param array $data
  * @return void
  */
 public static function updateSettings($ID, $data)
 {
     $current = get_user_by('id', $ID);
     $required = false;
     $user = array('ID' => $ID);
     //password
     $new_password = trim(themex_value($data, 'new_password'));
     if (!empty($new_password)) {
         $confirm_password = trim(themex_value($data, 'confirm_password'));
         $user['user_pass'] = $new_password;
         $required = true;
         if (strlen($new_password) < 4) {
             ThemexInterface::$messages[] = __('Password must be at least 4 characters long', 'academy');
         } else {
             if (strlen($new_password) > 16) {
                 ThemexInterface::$messages[] = __('Password must be not more than 16 characters long', 'academy');
             } else {
                 if (preg_match("/^([a-zA-Z0-9@#-_\$%^&+=!?]{1,20})\$/", $new_password) == 0) {
                     ThemexInterface::$messages[] = __('Password contains invalid characters', 'academy');
                 } else {
                     if ($new_password != $confirm_password) {
                         ThemexInterface::$messages[] = __('Passwords do not match', 'academy');
                     }
                 }
             }
         }
     }
     //email
     $email = trim(themex_value($data, 'email'));
     if ($email != $current->user_email) {
         $user['user_email'] = $email;
         $required = true;
         if (!is_email($email)) {
             ThemexInterface::$messages[] = __('Email address is invalid', 'academy');
         }
     }
     $current_password = trim(themex_value($data, 'current_password'));
     if ($required && !wp_check_password($current_password, $current->user_pass, $current->ID)) {
         ThemexInterface::$messages[] = __('Current password is incorrect', 'academy');
     }
     if (empty(ThemexInterface::$messages)) {
         wp_update_user($user);
         ThemexInterface::$messages[] = __('Settings have been successfully saved', 'academy');
         $_POST['success'] = true;
     }
 }
Esempio n. 10
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;
 }
Esempio n. 11
0
						<input type="hidden" name="product_id" value="<?php 
            echo ThemexWoo::$data['product']['ID'];
            ?>
" />
						<input type="hidden" name="woo_action" value="update_image" />
					</form>
				</div>
				<?php 
        }
    } else {
        if (ThemexUser::isShop()) {
            ThemexShop::refresh(ThemexUser::$data['current']['shop'], true);
            ?>
			<div class="image-wrap">
				<?php 
            echo ThemexCore::getImage(themex_value('ID', ThemexShop::$data), 200, THEME_URI . 'images/shop.png');
            ?>
			</div>
			<div class="profile-upload">
				<form action="" enctype="multipart/form-data" method="POST">
					<label for="shop_thumb" class="element-button square" title="<?php 
            _e('Upload Image', 'makery');
            ?>
">
						<span class="fa fa-upload"></span>
					</label>
					<input type="file" id="shop_thumb" name="shop_image" class="element-upload shifted" />
					<input type="hidden" name="shop_id" value="<?php 
            echo ThemexShop::$data['ID'];
            ?>
" />
Esempio n. 12
0
 /**
  * Updates products limit
  *
  * @access public
  * @return int
  */
 public static function updateProductsLimit()
 {
     $limit = intval(themex_value('limit', $_GET, ThemexCore::getOption('products_per_page', 9)));
     return $limit;
 }
Esempio n. 13
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;
 }
Esempio n. 14
0
 /**
  * Renders module data
  *
  * @access public
  * @param string $slug
  * @param array $optionst
  * @param array $values
  * @return void
  */
 public static function renderData($slug, $options = array(), $values = array())
 {
     $options = wp_parse_args($options, array('edit' => true, 'placeholder' => true, 'before_title' => '', 'after_title' => '', 'before_content' => '', 'after_content' => ''));
     $out = '';
     $counter = 0;
     if (self::isActive($slug)) {
         foreach (self::$data[$slug]['fields'] as $field) {
             if (!empty($field['name'])) {
                 $ID = themex_sanitize_key($field['name']);
                 $field['name'] = themex_get_string($ID, 'name', $field['name']);
                 $counter++;
                 if ($options['edit']) {
                     if (!empty($options['before_title']) || !empty($options['after_title'])) {
                         $out .= $options['before_title'] . $field['name'] . $options['after_title'];
                     }
                     if (!empty($options['before_content'])) {
                         $out .= $options['before_content'];
                     }
                     $args = array('id' => $ID, 'type' => $field['type'], 'value' => themex_value($values, $ID), 'wrap' => false);
                     if ($field['type'] == 'textarea') {
                         $out .= '<div class="clear"></div>';
                     } else {
                         $out .= '<div class="sixcol column ';
                         if ($counter % 2 == 0) {
                             $out .= 'last">';
                         } else {
                             $out .= '">';
                         }
                     }
                     if ($field['type'] == 'select') {
                         $field['options'] = themex_get_string($ID, 'options', $field['options']);
                         $args['options'] = array_merge(array('0' => $field['name']), explode(',', $field['options']));
                         $out .= '<div class="select-field">';
                     } else {
                         if ($options['placeholder']) {
                             $args['attributes'] = array('placeholder' => $field['name']);
                         }
                         $out .= '<div class="field-wrapper">';
                     }
                     if (in_array($field['type'], array('number', 'email'))) {
                         $args['type'] = 'text';
                     }
                     $out .= ThemexInterface::renderOption($args);
                     $out .= '</div>';
                     if ($field['type'] != 'textarea') {
                         $out .= '</div>';
                         if ($counter % 2 == 0) {
                             $out .= '<div class="clear"></div>';
                         }
                     }
                     if (!empty($options['after_content'])) {
                         $out .= $options['after_content'];
                     }
                 } else {
                     if (isset($values[$ID])) {
                         $out .= $options['before_title'] . $field['name'] . $options['after_title'] . $options['before_content'];
                         if ($field['type'] == 'select') {
                             $field['options'] = themex_get_string($ID, 'options', $field['options']);
                             $items = array_merge(array('0' => '&ndash;'), explode(',', $field['options']));
                             if (isset($items[$values[$ID]])) {
                                 $values[$ID] = $items[$values[$ID]];
                             }
                         }
                         if (empty($values[$ID])) {
                             $values[$ID] = '&ndash;';
                         }
                         $out .= $values[$ID];
                         $out .= $options['after_content'];
                     }
                 }
             }
         }
         if ($options['edit'] && isset(self::$data[$slug]['captcha'])) {
             $out .= '<div class="clear"></div>';
             $out .= '<div class="form-captcha clearfix">';
             $out .= '<img src="' . THEMEX_URI . 'assets/images/captcha/captcha.php" alt="" />';
             $out .= '<input type="text" name="captcha" id="captcha" size="6" value="" placeholder="' . __('Code', 'academy') . '" /></div>';
         }
     }
     echo $out;
 }
Esempio n. 15
0
		<a href="<?php 
    echo ThemexFacebook::getURL();
    ?>
" title="<?php 
    _e('Sign in with Facebook', 'academy');
    ?>
" class="element-button facebook-button left">
			<span class="button-icon facebook"></span>
		</a>
		<?php 
}
?>
		<div class="form-loader"></div>
		<input type="hidden" name="user_action" value="login_user" />
		<input type="hidden" name="user_redirect" value="<?php 
echo themex_value($_POST, 'user_redirect');
?>
" />
		<input type="hidden" name="nonce" class="nonce" value="<?php 
echo wp_create_nonce(THEMEX_PREFIX . 'nonce');
?>
" />
		<input type="hidden" name="action" class="action" value="<?php 
echo THEMEX_PREFIX;
?>
update_user" />
	</form>			
</div>
<div class="clear"></div>
<?php 
$query = new WP_Query(array('post_type' => 'page', 'meta_key' => '_wp_page_template', 'meta_value' => 'template-register.php'));
Esempio n. 16
0
    echo esc_attr($id);
    ?>
" <?php 
    selected($orderby, $id);
    ?>
><?php 
    echo esc_html($name);
    ?>
</option>
				<?php 
}
?>
			</select>
		</div>
		<input type="hidden" name="limit" id="limit" value="<?php 
echo themex_value('limit', $_GET, $limit);
?>
" />
		<?php 
foreach ($_GET as $key => $value) {
    if (!in_array($key, array('orderby', 'submit', 'limit'))) {
        if (is_array($value)) {
            foreach ($value as $item) {
                echo '<input type="hidden" name="' . esc_attr($key) . '[]" value="' . esc_attr($item) . '" />';
            }
        } else {
            echo '<input type="hidden" name="' . esc_attr($key) . '" value="' . esc_attr($value) . '" />';
        }
    }
}
?>
Esempio n. 17
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;
 }
		<a href="<?php 
    echo ThemexFacebook::getURL();
    ?>
" title="<?php 
    _e('Sign in with Facebook', 'academy');
    ?>
" class="element-button facebook-button left">
			<span class="button-icon facebook"></span>
		</a>
		<?php 
}
?>
		<div class="form-loader"></div>
		<input type="hidden" name="user_action" value="login_user" />
		<input type="hidden" name="user_redirect" value="<?php 
echo esc_url(themex_value($_POST, 'user_redirect'));
?>
" />
		<input type="hidden" name="nonce" class="nonce" value="<?php 
echo wp_create_nonce(THEMEX_PREFIX . 'nonce');
?>
" />
		<input type="hidden" name="action" class="action" value="<?php 
echo THEMEX_PREFIX;
?>
update_user" />
	</form>			
</div>
<div class="clear"></div>
<?php 
$query = new WP_Query(array('post_type' => 'page', 'meta_key' => '_wp_page_template', 'meta_value' => 'template-register.php'));
get_sidebar('profile-left');
?>
<div class="column fivecol">
	<div class="element-title indented">
		<h1><?php 
_e('My Settings', 'makery');
?>
</h1>
	</div>
	<?php 
ThemexInterface::renderTemplateContent('profile-settings');
?>
	<form action="" method="POST" class="site-form">
		<div class="message">
			<?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));
?>
Esempio n. 20
0
            $classes = ThemexWoo::getShippingClasses();
            $costs = themex_array('costs', $shipping['flat_rate']);
            foreach ($classes as $index => $class) {
                ?>
				<tr> 
					<td><?php 
                echo $class->name;
                ?>
</td>
					<td>
						<div class="field-wrap">
							<input type="text" name="flat_rate_cost[<?php 
                echo $index;
                ?>
]" value="<?php 
                echo themex_value($class->slug, $costs, '0');
                ?>
" />
							<input type="hidden" name="flat_rate_class[<?php 
                echo $index;
                ?>
]" value="<?php 
                echo $class->slug;
                ?>
" />
						</div>
					</td>
				</tr>
				<?php 
            }
            ?>