function themerex_options_load_scripts() { // WP Color Picker themerex_enqueue_style('wp-color-picker', false, array(), null); // ThemeREX options styles themerex_enqueue_style('themerex-options-style', themerex_get_file_url('/admin/css/theme-options.css'), array(), null); themerex_enqueue_style('themerex-options-style-datepicker', themerex_get_file_url('/admin/css/theme-options-datepicker.css'), array(), null); // ThemeREX messages script themerex_enqueue_style('themerex-messages-style', themerex_get_file_url('/js/messages/_messages.css'), array(), null); // WP core scripts wp_enqueue_media(); themerex_enqueue_script('wp-color-picker', false, array('jquery'), null, true); // jQuery scripts themerex_enqueue_script('jquery-ui-core', false, array('jquery'), null, true); themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-ui-accordion', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-ui-sortable', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-ui-draggable', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-ui-datepicker', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-input-mask', themerex_get_file_url('/admin/js/jquery.maskedinput.1.3.1.js'), array('jquery'), null, true); // ThemeREX options scripts themerex_enqueue_script('themerex-options-script', themerex_get_file_url('/admin/js/theme-options.js'), array('jquery'), null, true); // ThemeREX messages script themerex_enqueue_script('themerex-messages', themerex_get_file_url('/js/messages/_messages.js'), array('jquery'), null, true); }
function load_scripts() { if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'trx_emailer') { themerex_enqueue_script('jquery-ui-core', false, array('jquery'), null, true); themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('trx-emailer-script', get_template_directory_uri() . '/admin/tools/emailer/emailer.js', array('jquery'), null, true); } }
function load_scripts() { if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'trx_emailer') { themerex_enqueue_style('trx-emailer-style', themerex_get_file_url('/admin/tools/emailer/emailer.css'), array(), null); } if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'trx_emailer') { themerex_enqueue_script('jquery-ui-core', false, array('jquery'), null, true); themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('trx-emailer-script', themerex_get_file_url('/admin/tools/emailer/emailer.js'), array('jquery'), null, true); } }
function load_scripts() { if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'po_composer') { themerex_enqueue_style('po-composer-style', get_template_directory_uri() . '/admin/tools/po_composer/po_composer.css', array(), null); } if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'po_composer') { themerex_enqueue_script('jquery-ui-core', false, array('jquery'), null, true); themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('po-composer-script', get_template_directory_uri() . '/admin/tools/po_composer/po_composer.js', array('jquery'), null, true); } }
function show_meta_box_page() { global $THEMEREX_meta_box_page, $post, $THEMEREX_options; // Use nonce for verification echo '<input type="hidden" name="meta_box_page_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />'; $custom_options = get_post_meta($post->ID, 'post_custom_options', true); $page_options = array_merge($THEMEREX_options, $THEMEREX_meta_box_page['fields']); themerex_options_load_scripts(); themerex_options_prepare_js(); themerex_enqueue_script('_admin', get_template_directory_uri() . '/js/_admin.js', array('jquery'), null, true); themerex_options_page_start(array('data' => $page_options, 'add_inherit' => true, 'show_page_layout' => false, 'override' => 'page')); foreach ($page_options as $option) { if (!isset($option['override']) || !in_array('page', explode(',', $option['override']))) { continue; } $id = isset($option['id']) ? $option['id'] : ''; $meta = isset($custom_options[$id]) ? $custom_options[$id] : ''; themerex_options_show_field($option, $meta); } themerex_options_page_stop(); }
function sc_graph($atts, $content = null) { if (in_shortcode_blogger()) { return ''; } extract(shortcode_atts(array("id" => "", "labels" => "Label1, Label2, Label3", "type" => "Curve", "style" => "", "top" => "", "bottom" => "", "left" => "", "right" => "", "width" => ""), $atts)); themerex_enqueue_script('diagram-chart', get_template_directory_uri() . '/js/diagram/chart.min.js', array(), null, true); themerex_enqueue_script('diagram-raphael', get_template_directory_uri() . '/js/diagram/diagram.raphael.js', array(), null, true); themerex_enqueue_script('graph', get_template_directory_uri() . '/js/diagram/Graph.js', array('jquery'), null, true); $ed_l = $left !== 'auto' ? themerex_substr($left, -1) == '%' ? '%' : 'px' : ''; $ed_r = $right !== 'auto' ? themerex_substr($right, -1) == '%' ? '%' : 'px' : ''; $s = ($top !== '' ? 'margin-top:' . $top . 'px;' : '') . ($bottom !== '' ? 'margin-bottom:' . $bottom . 'px;' : '') . ($left !== '' ? 'margin-left:' . $left . $ed_l . ';' : '') . ($right !== '' ? 'margin-right:' . $right . $ed_r . ';' : '') . ($width !== '' ? 'width:' . $width . 'px;' : ''); $content = do_shortcode($content); if ($type == 'line') { $type = 'Line'; } return '<div class="tw-chart-graph tw-animate tw-redraw with-list-desc" data-zero="false" data-labels="' . $labels . '"' . 'data-type="' . $type . '" data-item-height="" data-animation-delay="0" data-animation-offset="90%" style="' . $s . '">' . '<ul class="data" style="display: none;">' . $content . '</ul>' . '<canvas></canvas>' . '</div>'; }
function themerex_shortcodes_load_scripts() { themerex_enqueue_script('themerex-shortcodes-script', themerex_get_file_url('/shortcodes/shortcodes_admin.js'), array('jquery'), null, true); themerex_enqueue_script('themerex-selection-script', themerex_get_file_url('/js/jquery.selection.js'), array('jquery'), null, true); }
<?php if (!is_user_logged_in() && get_theme_option('show_login') == 'yes') { // todo: Login form themerex_enqueue_script('form-login', themerex_get_file_url('/js/_form_login.js'), array(), null, true); ?> <div id="user-popUp" class="user-popUp mfp-with-anim mfp-hide"> <div class="sc_tabs"> <ul class="loginHeadTab"> <li><a href="#loginForm" class="loginFormTab icon"><?php _e('Log In', 'themerex'); ?> </a></li> <li><a href="#registerForm" class="registerFormTab icon"><?php _e('Create an Account', 'themerex'); ?> </a></li> </ul> <div id="loginForm" class="formItems loginFormBody"> <div class="itemformLeft"> <form action="<?php echo esc_url(wp_login_url()); ?> " method="post" name="login_form" class="formValid"> <input type="hidden" name="redirect_to" value="<?php echo esc_url(home_url()); ?> " /> <ul class="formList"> <li class="icon formLogin"><input type="text" id="login" name="log" value="" placeholder="<?php
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); global $wp_query, $post; global $THEMEREX_CURRENT_SIDEBAR; /* Our variables from the widget settings. */ $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : ''); $title_tabs = array(isset($instance['title_popular']) ? $instance['title_popular'] : '', isset($instance['title_commented']) ? $instance['title_commented'] : '', isset($instance['title_liked']) ? $instance['title_liked'] : ''); $number = isset($instance['number']) ? (int) $instance['number'] : ''; $show_date = isset($instance['show_date']) ? (int) $instance['show_date'] : 0; $show_image = isset($instance['show_image']) ? (int) $instance['show_image'] : 0; $show_author = isset($instance['show_author']) ? (int) $instance['show_author'] : 0; $show_counters = isset($instance['show_counters']) ? (int) $instance['show_counters'] : 0; $category = isset($instance['category']) ? (int) $instance['category'] : 0; $output = $tabs = ''; if ($THEMEREX_CURRENT_SIDEBAR == 'top') { $output .= '<div class="columnsWrap">'; } $rnd = str_replace('.', '', mt_rand()); for ($i = 0; $i < 3; $i++) { $args = array('post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'post_password' => '', 'posts_per_page' => $number, 'ignore_sticky_posts' => 1, 'order' => 'DESC'); if ($i == 0) { // Most popular $args['meta_key'] = 'post_views_count'; $args['orderby'] = 'meta_value_num'; $show_counters = $show_counters ? 'views' : ''; } else { if ($i == 2) { // Most liked $args['meta_key'] = 'post_likes_count'; $args['orderby'] = 'meta_value_num'; $show_counters = $show_counters ? 'likes' : ''; } else { // Most commented $args['orderby'] = 'comment_count'; $show_counters = $show_counters ? 'comments' : ''; } } if ($category > 0) { $args['cat'] = $category; } $ex = get_theme_option('exclude_cats'); if (!empty($ex)) { $args['category__not_in'] = explode(',', $ex); } query_posts($args); /* Loop posts */ if (have_posts()) { if ($THEMEREX_CURRENT_SIDEBAR == 'top') { $output .= ' <div class="tab_content columns1_3" id="widget_popular_' . $i . '"> <h2 class="widgetSubtitle">' . $title_tabs[$i] . '</h2> '; } else { $tabs .= '<li ><a href="#widget_popular_' . $rnd . '_' . $i . '">' . $title_tabs[$i] . '</a></li>'; $output .= ' <div class="tab_content" id="widget_popular_' . $rnd . '_' . $i . '"' . ($i == 1 && !$output ? ' style="display: block;"' : '') . '> '; } $post_number = 0; while (have_posts()) { the_post(); $post_number++; require themerex_get_file_dir('/templates/page-part-widgets-posts.php'); if ($post_number >= $number) { break; } } $output .= ' </div> '; } } if ($THEMEREX_CURRENT_SIDEBAR == 'top') { $output .= '</div>'; } /* Restore main wp_query and current post data in the global var $post */ wp_reset_query(); wp_reset_postdata(); if (!empty($output)) { themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); /* Before widget (defined by themes). */ echo balanceTags($before_widget); /* Display the widget title if one was input (before and after defined by themes). */ if ($title) { echo balanceTags($before_title) . esc_html($title) . balanceTags($after_title); } echo ' <div class="popular_and_commented_tabs' . ($THEMEREX_CURRENT_SIDEBAR == 'top' ? '' : ' tabs_area') . '"> ' . ($THEMEREX_CURRENT_SIDEBAR == 'top' ? '' : ' <ul class="tabs"> ' . $tabs . ' </ul> ') . $output . ' </div> '; /* After widget (defined by themes). */ echo balanceTags($after_widget); } }
function themerex_shortcodes_load_scripts() { global $THEMEREX_shortcodes; ?> <script type="text/javascript"> var THEMEREX_shortcodes = JSON.parse('<?php echo str_replace("'", "\\'", json_encode($THEMEREX_shortcodes)); ?> '); </script> <?php themerex_enqueue_script('themerex-shortcodes-script', get_template_directory_uri() . '/includes/shortcodes/shortcodes_admin.js', array('jquery'), null, true); themerex_enqueue_script('themerex-selection-script', get_template_directory_uri() . '/js/jquery.selection.js', array('jquery'), null, true); }
<?php if (get_theme_option('show_theme_customizer') == 'yes') { $basic_color = get_custom_option('theme_color'); $accent_color = get_custom_option('theme_accent_color'); $background_color = get_custom_option('bg_color'); $color_cheme = get_custom_option('color_scheme_theme'); $reviews_max_level = max(5, (int) get_custom_option('reviews_max_level')); $body_style = get_custom_option('body_style'); $bg_pattern = get_custom_option('bg_pattern'); $bg_image = get_custom_option('bg_image'); $logo_position = get_custom_option('logo_position'); $menu_style = get_custom_option('menu_style'); $custom_style = $color_cheme == 'themeDark' ? 'co_dark' : 'co_light'; /*scripts & styles*/ themerex_enqueue_style('swiperslider-style', get_template_directory_uri() . '/js/swiper/idangerous.swiper.css', array(), null); themerex_enqueue_script('swiperslider', get_template_directory_uri() . '/js/swiper/idangerous.swiper-2.1.js', array('jquery'), null, true); themerex_enqueue_style('swiperslider-scrollbar-style', get_template_directory_uri() . '/js/swiper/idangerous.swiper.scrollbar.css', array(), null); themerex_enqueue_script('swiperslider-scrollbar', get_template_directory_uri() . '/js/swiper/idangerous.swiper.scrollbar-2.1.js', array('jquery'), null, true); }
<?php } // todo: magnific & pretty // magnific & pretty themerex_enqueue_style('magnific-style', themerex_get_file_url('/js/magnific-popup/magnific-popup.css'), array(), null); themerex_enqueue_script('magnific', themerex_get_file_url('/js/magnific-popup/jquery.magnific-popup.min.js'), array('jquery'), null, true); // Load PrettyPhoto if it selected in Theme Options if (get_theme_option('popup_engine') == 'pretty') { themerex_enqueue_style('prettyphoto-style', themerex_get_file_url('/js/prettyphoto/css/prettyPhoto.css'), array(), null); themerex_enqueue_script('prettyphoto', themerex_get_file_url('/js/prettyphoto/jquery.prettyPhoto.min.js'), array('jquery'), 'no-compose', true); } // todo: Media elements library if (get_theme_option('use_mediaelement') == 'yes') { if (floatval(get_bloginfo('version')) < "3.6") { themerex_enqueue_style('mediaplayer-style', themerex_get_file_url('/js/mediaplayer/mediaplayer.css'), array(), null); themerex_enqueue_script('mediaplayer', themerex_get_file_url('/js/mediaplayer/mediaelement.min.js'), array(), null, true); } else { wp_enqueue_style('mediaelement'); wp_enqueue_style('wp-mediaelement'); wp_enqueue_script('mediaelement'); wp_enqueue_script('wp-mediaelement'); } } else { global $wp_scripts, $wp_styles; $wp_scripts->done[] = 'mediaelement'; $wp_scripts->done[] = 'wp-mediaelement'; $wp_styles->done[] = 'mediaelement'; $wp_styles->done[] = 'wp-mediaelement'; } if ($post_number > 0) { // Pagination
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); global $wp_query, $post; /* Our variables from the widget settings. */ $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : ''); $title_tabs = array(apply_filters('widget_title', isset($instance['title_author']) ? $instance['title_author'] : ''), apply_filters('widget_title', isset($instance['title_users']) ? $instance['title_users'] : '')); $number = isset($instance['number']) ? (int) $instance['number'] : ''; $show_date = isset($instance['show_date']) ? (int) $instance['show_date'] : 0; $show_image = isset($instance['show_image']) ? (int) $instance['show_image'] : 0; $show_author = isset($instance['show_author']) ? (int) $instance['show_author'] : 0; $show_counters = isset($instance['show_counters']) ? (int) $instance['show_counters'] : 0; $category = isset($instance['category']) ? (int) $instance['category'] : 0; $counters = 'stars'; $output = ''; $tabs = array(); $reviews_first_author = get_theme_option('reviews_first') == 'author'; $reviews_second_hide = get_theme_option('reviews_second') == 'hide'; for ($i = 0; $i < 2; $i++) { if ($i == 0 && !$reviews_first_author && $reviews_second_hide) { continue; } if ($i == 1 && $reviews_first_author && $reviews_second_hide) { continue; } $args = array('post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'post_password' => '', 'posts_per_page' => $number, 'ignore_sticky_posts' => 1, 'order' => 'DESC', 'orderby' => 'meta_value_num', 'meta_key' => 'reviews_avg' . ($i == 0 ? '' : '2')); if ($category > 0) { $args['cat'] = $category; } $ex = get_theme_option('exclude_cats'); if (!empty($ex)) { $args['category__not_in'] = explode(',', $ex); } query_posts($args); /* Loop posts */ if (have_posts()) { $tabs[$i] = '<li><a href="#widget_top10_' . $i . '" class="theme_button"><span>' . $title_tabs[$i] . '</span></a></li>'; $output .= ' <div class="tab_content" id="widget_top10_' . $i . '"' . ($i == 1 && !$output ? ' style="display: block;"' : '') . '> '; $post_number = 0; while (have_posts()) { the_post(); $post_number++; $post_id = get_the_ID(); $post_date = getDateOrDifference(get_the_date('Y-m-d H:i:s')); $post_title = $post->post_title; $post_link = get_permalink(); $output .= ' <div class="post_item' . ($post_number == 1 ? ' first' : '') . '"> '; if ($show_image) { $post_thumb = getResizedImageTag($post_id, 60, 60); if ($post_thumb) { $output .= ' <div class="post_thumb image_wrapper">' . $post_thumb . '</div> '; } } $output .= ' <div class="post_wrapper"> <h5 class="post_title theme_title' . ($show_counters == 2 ? '' : ' title_padding') . '"><a href="' . $post_link . '">' . $post_title . '</a></h5> '; if ($show_counters) { $post_counters = marksToDisplay(get_post_meta($post_id, 'reviews_avg' . ($i == 0 ? '' : '2'), true)); if ($post_counters > 0) { if (themerex_strlen($post_counters) == 1) { $post_counters .= '.0'; } if ($show_counters == 2 && get_custom_option('show_reviews') == 'yes') { $output .= ' <div class="reviews_summary blog_reviews"> <div class="criteria_summary criteria_row"> ' . getReviewsSummaryStars($post_counters) . ' </div> </div> '; } } } if ($show_date || $show_counters || $show_author) { $output .= ' <div class="post_info theme_info"> '; if ($show_date) { $output .= ' <span class="post_date theme_text">' . $post_date . '</span> '; } if ($show_author) { $post_author_id = $post->post_author; $post_author_name = get_the_author_meta('display_name', $post_author_id); $post_author_url = get_author_posts_url($post_author_id, ''); $output .= ' <span class="post_author">' . __('by', 'themerex') . ' <a href="' . $post_author_url . '">' . $post_author_name . '</a></span> '; } if ($show_counters == 1 && $post_counters) { $output .= ' <span class="post_comments"><a href="' . $post_link . '"> <span class="comments_icon icon-star"></span><span class="post_comments_number">' . $post_counters . '</span> </a></span>'; } $output .= ' </div> '; } $output .= ' </div> </div> '; if ($post_number >= $number) { break; } } $output .= ' </div> '; } } /* Restore main wp_query and current post data in the global var $post */ wp_reset_query(); wp_reset_postdata(); if (!empty($output)) { if (!$reviews_second_hide) { themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); } /* Before widget (defined by themes). */ echo balanceTags($before_widget); /* Display the widget title if one was input (before and after defined by themes). */ if ($title) { echo balanceTags($before_title . $title . $after_title); } echo balanceTags(' <div class="top10_tabs' . ($show_image ? '' : ' ordered_list') . ($show_image || $show_date || $show_author ? '' : ' flat_list') . '">' . (!$reviews_second_hide ? '<ul class="tabs">' . ($reviews_first_author ? $tabs[0] . $tabs[1] : $tabs[1] . $tabs[0]) . '</ul>' : '') . $output . (!$reviews_second_hide ? ' <script type="text/javascript"> jQuery(document).ready(function() { jQuery(\'.top10_tabs\').tabs(); }); </script>' : '') . ' </div> '); /* After widget (defined by themes). */ echo balanceTags($after_widget); } }
//sidebar ?> </div><!-- /.wrapContent > /.wrapWide --> </div><!-- /.wrapContent --> <?php // ----------------- Google map ----------------------- if (get_custom_option('googlemap_show') == 'yes') { $map_address = get_custom_option('googlemap_address'); $map_latlng = get_custom_option('googlemap_latlng'); $map_zoom = get_custom_option('googlemap_zoom'); $map_scroll = get_custom_option('googlemap_scroll'); $map_style = get_custom_option('googlemap_style'); if (!empty($map_address) || !empty($map_latlng)) { themerex_enqueue_script('googlemap', 'http://maps.google.com/maps/api/js?sensor=false', array(), null, true); themerex_enqueue_script('googlemap_init', get_template_directory_uri() . '/js/_googlemap_init.js', array(), null, true); echo do_shortcode('[trx_googlemap id="footer" latlng="' . $map_latlng . '" address="' . $map_address . '" zoom="' . $map_zoom . '" scroll="' . $map_scroll . '" style="' . $map_style . '" width="100%" height="350"]'); } } // -------------- footer -------------- $footer_widget = get_custom_option('show_sidebar_footer') == 'yes' && is_active_sidebar(get_custom_option('sidebar_footer')); if ($footer_widget) { ?> <footer <?php echo $footer_widget ? 'class="footerWidget"' : ''; ?> > <div class="main"> <?php // ---------------- Footer sidebar ----------------------
function theme_skin_add_scripts_classter() { if (file_exists(themerex_get_file_dir('/skins/general/general.js'))) { themerex_enqueue_script('theme-skin-script', themerex_get_file_url('/skins/general/general.js'), array('main-style'), null); } }
<?php if (!is_user_logged_in() && get_theme_option('show_login') == 'yes') { /*scripts & styles*/ themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-effects-slide', false, array('jquery', 'jquery-effects-core'), null, true); ?> <div id="user-popUp" class="user-popUp mfp-with-anim mfp-hide"> <div class="sc_tabs sc_tabs sc_tabs_style_1 sc_tabs_effects "> <ul class="sc_tabs_titles"> <li><a href="#registerForm" class="registerFormTab"><?php _e('Join', 'themerex'); ?> </a></li> <li><a href="#loginForm" class="loginFormTab">Sign in</a></li> </ul> <div class="sc_tabs_array"> <div id="loginForm" class="formItems loginFormBody sc_columns_2"> <form action="<?php echo wp_login_url(); ?> " method="post" name="login_form" class="formValid"> <div class="sc_columns_item"> <input type="hidden" name="redirect_to" value="<?php echo home_url(); ?> " /> <ul class="formList"> <li class="formLogin"><input type="text" id="login" name="log" value="" placeholder="<?php _e('Email', 'themerex');
<?php //====================================== Editor area ======================================== if ($post_data['post_edit_enable']) { require_once themerex_get_file_dir('/admin/theme-options.php'); wp_register_script('wp-color-picker', get_site_url() . '/wp-admin/js/color-picker.min.js', array('jquery'), '1.0', true); themerex_enqueue_style('fontello-admin', themerex_get_file_url('/admin/css/fontello/css/fontello-admin.css'), array(), null); themerex_enqueue_style('frontend-editor-style', themerex_get_file_url('/js/editor/_editor.css'), array('main-style'), null); themerex_enqueue_script('frontend-editor', themerex_get_file_url('/js/editor/_editor.js'), array(), null, true); themerex_options_load_scripts(); themerex_options_prepare_js($post_data['post_type'] == 'page' ? 'page' : 'post'); themerex_shortcodes_load_scripts(); themerex_shortcodes_prepare_js(); ?> <div id="frontend_editor"> <div id="frontend_editor_inner"> <form method="post"> <label id="frontend_editor_post_title_label" for="frontend_editor_post_title"><?php _e('Title', 'themerex'); ?> </label> <input type="text" name="frontend_editor_post_title" id="frontend_editor_post_title" value="<?php echo esc_attr($post_data['post_title']); ?> " /> <?php $ajax_nonce = wp_create_nonce('themerex_editor_nonce'); $ajax_url = admin_url('admin-ajax.php'); wp_editor($post_data['post_content_original'], 'frontend_editor_post_content', array('wpautop' => true, 'textarea_rows' => 16)); ?> <label id="frontend_editor_post_excerpt_label" for="frontend_editor_post_excerpt"><?php
function themerex_admin_setup() { themerex_enqueue_script('jquery', false, array(), null, true); themerex_enqueue_script('jquery-ui-core', false, array('jquery'), null, true); themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-cookie', get_template_directory_uri() . '/js/jquery.cookie.js', array('jquery'), null, true); themerex_enqueue_style('wp-color-picker', array(), null); themerex_enqueue_script('wp-color-picker', false, array(), null, true); themerex_enqueue_style('theme-admin-style', get_template_directory_uri() . '/admin/css/admin-style.css', array(), null); themerex_enqueue_style('fontello-admin', get_template_directory_uri() . '/admin/css/fontello/css/fontello-admin.css', array(), null); themerex_enqueue_style('fontello', get_template_directory_uri() . '/includes/fontello/css/fontello.css', array(), null); themerex_enqueue_script('_utils', get_template_directory_uri() . '/js/_utils.js', array(), null, true); }
// Uncomment this section if you want filter related posts on post formats if ($post_data['post_format'] != '' && $post_data['post_format'] != 'standard') { $args['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-' . $post_data['post_format'])); } $args = addSortOrderInQuery($args, get_custom_option('post_related_sort'), get_custom_option('post_related_order')); $recent_posts = wp_get_recent_posts($args, OBJECT); if (is_array($recent_posts) && count($recent_posts) > 0) { if (get_custom_option("post_related_style") == 'yes') { // todo: magnific & pretty // magnific & pretty themerex_enqueue_style('magnific-style', themerex_get_file_url('/js/magnific-popup/magnific-popup.css'), array(), null); themerex_enqueue_script('magnific', themerex_get_file_url('/js/magnific-popup/jquery.magnific-popup.min.js'), array('jquery'), null, true); // Load PrettyPhoto if it selected in Theme Options if (get_theme_option('popup_engine') == 'pretty') { themerex_enqueue_style('prettyphoto-style', themerex_get_file_url('/js/prettyphoto/css/prettyPhoto.css'), array(), null); themerex_enqueue_script('prettyphoto', themerex_get_file_url('/js/prettyphoto/jquery.prettyPhoto.min.js'), array('jquery'), 'no-compose', true); } } ?> <section class="relatedWrap<?php echo get_custom_option("show_post_comments") == 'yes' ? ' hrShadow' : ''; ?> "> <h3><?php _e('Recomended Posts', 'themerex'); ?> </h3> <div class="relatedPostWrap"> <div class="columnsWrap <?php echo get_custom_option("post_related_style") == 'no' ? ' no_indent_style columnsFloat' : ' indent_style'; ?>
function themerex_reviews_scripts() { themerex_enqueue_script('_reviews', get_template_directory_uri() . '/js/_reviews.js', array('jquery'), null, true); }
function themerex_init_template() { // AJAX Queries settings global $THEMEREX_ajax_nonce, $THEMEREX_ajax_url; $THEMEREX_ajax_nonce = wp_create_nonce('ajax_nonce'); $THEMEREX_ajax_url = admin_url('admin-ajax.php'); // Set theme params from GET if (isset($_GET['set']) && $_GET['set'] == 1) { foreach ($_GET as $k => $v) { if (get_theme_option($k, null) !== null) { setcookie($k, $v, 0, '/'); $_COOKIE[$k] = $v; } } } // Get custom options from current category / page / post / shop load_custom_options(); // Reject old browsers support global $THEMEREX_jreject; $THEMEREX_jreject = false; if (!isset($_COOKIE['jreject'])) { themerex_enqueue_style('jquery_reject-style', themerex_get_file_url('/js/jreject/css/jquery.reject.css'), array(), null); themerex_enqueue_script('jquery_reject', themerex_get_file_url('/js/jreject/jquery.reject.js'), array('jquery'), null, true); setcookie('jreject', 1, 0, '/'); $THEMEREX_jreject = true; } // Main menu global $THEMEREX_mainmenu; if (get_custom_option('show_top_panel') != 'hide') { $menu_slug = get_custom_option('menu_main'); $args = array('menu' => empty($menu_slug) || $menu_slug == 'default' || is_inherit_option($menu_slug) ? '' : $menu_slug, 'container' => '', 'container_class' => '', 'container_id' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'menu_class' => '', 'menu_id' => 'mainmenu', 'echo' => false, 'fallback_cb' => '', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'depth' => 11, 'theme_location' => 'mainmenu'); if (get_theme_option('custom_menu') == 'yes' && class_exists('themerex_walker')) { $args['walker'] = new themerex_walker(); } $THEMEREX_mainmenu = wp_nav_menu($args); } else { $THEMEREX_mainmenu = ''; } // User menu global $THEMEREX_usermenu; if (get_custom_option('show_top_panel') != 'hide' && get_custom_option('show_user_menu') == 'yes') { $menu_slug = get_custom_option('menu_user'); $THEMEREX_usermenu = wp_nav_menu(array('menu' => empty($menu_slug) || $menu_slug == 'default' || is_inherit_option($menu_slug) ? '' : $menu_slug, 'container' => '', 'container_class' => '', 'container_id' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'menu_class' => '', 'menu_id' => 'usermenu', 'echo' => false, 'fallback_cb' => '', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'depth' => 11, 'theme_location' => 'usermenu')); } else { $THEMEREX_usermenu = ''; } // Side menu global $THEMEREX_sidemenu; if (get_custom_option('show_left_panel') == 'yes') { $menu_slug = get_custom_option('menu_side'); $THEMEREX_sidemenu = wp_nav_menu(array('menu' => empty($menu_slug) || $menu_slug == 'default' || is_inherit_option($menu_slug) ? '' : $menu_slug, 'container' => '', 'container_class' => '', 'container_id' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'menu_class' => '', 'menu_id' => 'sidemenu', 'echo' => false, 'fallback_cb' => '', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'depth' => 11, 'theme_location' => 'sidemenu')); } else { $THEMEREX_sidemenu = ''; } // Panel menu global $THEMEREX_panelmenu; if (get_custom_option('show_right_panel') == 'yes') { $menu_slug = get_custom_option('menu_right'); $THEMEREX_panelmenu = wp_nav_menu(array('menu' => empty($menu_slug) || $menu_slug == 'default' || is_inherit_option($menu_slug) ? '' : $menu_slug, 'container' => '', 'container_class' => '', 'container_id' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'menu_class' => '', 'menu_id' => 'panelmenu', 'echo' => false, 'fallback_cb' => '', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'depth' => 11, 'theme_location' => 'panelmenu')); } else { $THEMEREX_panelmenu = ''; } // Include current skin $skin = themerex_escape_shell_cmd(get_custom_option('theme_skin')); if (file_exists(themerex_get_file_dir('/skins/' . $skin . '/' . $skin . '.php'))) { require_once themerex_get_file_dir('/skins/' . $skin . '/' . $skin . '.php'); } // Logo image and icon from skin global $logo_text, $logo_slogan, $logo_icon, $logo_image, $logo_side, $logo_fixed, $logo_footer; $logo_text = get_custom_option('logo_text'); $logo_slogan = get_custom_option('logo_slogan'); $menu_align = get_custom_option('menu_align'); if ($logo_slogan == '') { $logo_slogan = get_bloginfo('description'); } $logo_icon = $logo_image = $logo_side = $logo_fixed = $logo_footer = ''; if (($logo_icon = get_custom_option('logo_icon')) == '' && file_exists(themerex_get_file_dir('/skins/' . $skin . '/images/logo-icon.png'))) { $logo_icon = themerex_get_file_url('/skins/' . $skin . '/images/logo-icon.png'); } if ($menu_align == 'left' || $menu_align == 'center') { if (($logo_image = get_custom_option('logo_top')) == '' && file_exists(themerex_get_file_dir('/skins/' . $skin . '/images/logo-top.png'))) { $logo_image = themerex_get_file_url('/skins/' . $skin . '/images/logo-top.png'); } } if ($logo_image == '' && ($logo_image = get_custom_option('logo_image')) == '' && file_exists(themerex_get_file_dir('/skins/' . $skin . '/images/logo.png'))) { $logo_image = themerex_get_file_url('/skins/' . $skin . '/images/logo.png'); } if (($logo_side = get_custom_option('logo_side')) == '' && file_exists(themerex_get_file_dir('/skins/' . $skin . '/images/logo-side.png'))) { $logo_side = themerex_get_file_url('/skins/' . $skin . '/images/logo-side.png'); } if ($logo_side == '') { $logo_side = $logo_image; } if (($logo_fixed = get_custom_option('logo_fixed')) == '' && file_exists(themerex_get_file_dir('/skins/' . $skin . '/images/logo-fixed.png'))) { $logo_fixed = themerex_get_file_url('/skins/' . $skin . '/images/logo-fixed.png'); } if ($logo_fixed == '') { $logo_fixed = $logo_image; } if (($logo_footer = get_custom_option('logo_image_footer')) == '' && file_exists(themerex_get_file_dir('/skins/' . $skin . '/images/logo-footer.png'))) { $logo_footer = themerex_get_file_url('/skins/' . $skin . '/images/logo-footer.png'); } if ($logo_footer == '') { $logo_footer = $logo_image; } global $THEMEREX_shop_mode; $THEMEREX_shop_mode = getValueGPC('themerex_shop_mode'); if (empty($THEMEREX_shop_mode)) { $THEMEREX_shop_mode = get_custom_option('shop_mode', ''); } if (empty($THEMEREX_shop_mode) || !is_archive()) { $THEMEREX_shop_mode = 'thumbs'; } }
<a href="#" class="swpRightPosButton"><span class="icon-cog animate-spin"></span></a> <?php // raggable themerex_enqueue_script('jquery-ui-draggable', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-ui-sortable', false, array('jquery', 'jquery-ui-core'), null, true); // customizer if (get_custom_option('show_theme_customizer') == 'yes') { themerex_enqueue_script('_customizer', themerex_get_file_url('/js/_customizer.js'), array(), null, true); } // scrollbar themerex_enqueue_style('swiperslider-style', themerex_get_file_url('/js/swiper/idangerous.swiper.css'), array(), null); themerex_enqueue_style('swiperslider-scrollbar-style', themerex_get_file_url('/js/swiper/idangerous.swiper.scrollbar.css'), array(), null); themerex_enqueue_script('swiperslider', themerex_get_file_url('/js/swiper/idangerous.swiper-2.7.js'), array('jquery'), null, true); themerex_enqueue_script('swiperslider-scrollbar', themerex_get_file_url('/js/swiper/idangerous.swiper.scrollbar-2.4.js'), array('jquery'), null, true); global $THEMEREX_panelmenu; $tab = (int) get_custom_option('right_panel_tab'); $shift = 0; if (get_theme_option('show_theme_customizer') != 'yes' && $tab > 0) { $shift++; } if (!$THEMEREX_panelmenu && $tab > 2) { $shift++; } $tab = max(0, $tab - $shift); ?> <div class="sc_tabs" data-active="<?php echo esc_attr($tab); ?> ">
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); global $wp_query, $post; /* Our variables from the widget settings. */ $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : ''); $title_tabs = array(apply_filters('widget_title', isset($instance['title_popular']) ? $instance['title_popular'] ? $instance['title_popular'] : __('Popular', 'themerex') : ''), apply_filters('widget_title', isset($instance['title_commented']) ? $instance['title_commented'] ? $instance['title_commented'] : __('Commented', 'themerex') : '')); $number = isset($instance['number']) ? (int) $instance['number'] : ''; $show_date = isset($instance['show_date']) ? (int) $instance['show_date'] : 0; $show_image = isset($instance['show_image']) ? (int) $instance['show_image'] : 0; $show_author = isset($instance['show_author']) ? (int) $instance['show_author'] : 0; $show_counters = isset($instance['show_counters']) ? (int) $instance['show_counters'] : 0; $category = isset($instance['category']) ? (int) $instance['category'] : 0; $output = $tabs = ''; for ($i = 0; $i < 2; $i++) { $args = array('post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'post_password' => '', 'posts_per_page' => $number, 'ignore_sticky_posts' => 1, 'order' => 'DESC'); if ($i == 0) { // Most popular $args['meta_key'] = 'post_views_count'; $args['orderby'] = 'meta_value_num'; } else { // Most commented $args['orderby'] = 'comment_count'; } if ($category > 0) { $args['cat'] = $category; } $ex = get_theme_option('exclude_cats'); if (!empty($ex)) { $args['category__not_in'] = explode(',', $ex); } query_posts($args); /* Loop posts */ if (have_posts()) { $tabs .= '<li><a href="#widget_popular_' . $i . '" class="theme_button"><span>' . $title_tabs[$i] . '</span></a></li>'; $output .= ' <div class="tab_content" id="widget_popular_' . $i . '"> '; $post_number = 0; while (have_posts()) { the_post(); $post_number++; $post_id = get_the_ID(); $post_date = getDateOrDifference(get_the_date('Y-m-d H:i:s')); $post_title = $post->post_title; $post_link = get_permalink(); $output .= ' <div class="post_item' . ($post_number == 1 ? ' first' : '') . '"> '; if ($show_image) { $post_thumb = getResizedImageTag($post_id, 60, 60); if ($post_thumb) { $output .= ' <div class="post_thumb image_wrapper">' . $post_thumb . '</div> '; } } $output .= ' <div class="post_wrapper"> <h5 class="post_title theme_title' . ($show_counters == 2 ? '' : ' title_padding') . '"><a href="' . $post_link . '">' . $post_title . '</a></h5> '; if ($show_date || $show_counters || $show_author) { $output .= ' <div class="post_info theme_info"> '; if ($show_date) { $output .= ' <span class="post_date theme_text">' . $post_date . '</span> '; } if ($show_author) { $post_author_id = $post->post_author; $post_author_name = get_the_author_meta('display_name', $post_author_id); $post_author_url = get_author_posts_url($post_author_id, ''); $output .= ' <span class="post_author">' . __(' by', 'themerex') . ' <a href="' . $post_author_url . '">' . $post_author_name . '</a></span> '; } if ($show_counters) { if ($i == 0) { $post_counters = getPostViews($post_id); $post_comments_link = $post_link; } else { $post_counters = get_comments_number(); $post_comments_link = get_comments_link($post_id); } if ($show_counters == 2 && ($show_date || $show_author)) { $output .= '<br />'; } $output .= ' <span class="post_comments' . ($show_counters == 2 ? '_text' : '') . '"><a href="' . $post_comments_link . '">' . ($show_counters == 2 ? '' : '<span class="comments_icon icon-' . ($i == 0 ? 'eye' : 'chat-1') . '"></span>') . '<span class="post_comments_number">' . $post_counters . '</span>' . ($show_counters == 2 ? ' ' . ($i == 0 ? __('views', 'themerex') : __('comments', 'themerex')) : '') . '</a></span> '; } $output .= ' </div> '; } $output .= ' </div> </div> '; if ($post_number >= $number) { break; } } $output .= ' </div> '; } } /* Restore main wp_query and current post data in the global var $post */ wp_reset_query(); wp_reset_postdata(); if (!empty($output)) { themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-effects-slide', false, array('jquery', 'jquery-effects-core'), null, true); /* Before widget (defined by themes). */ echo balanceTags($before_widget); /* Display the widget title if one was input (before and after defined by themes). */ if ($title) { echo balanceTags($before_title . $title . $after_title); } echo balanceTags(' <div class="sc_tabs sc_tabs_effects' . ($show_image ? '' : ' ordered_list') . ($show_image || $show_date || $show_counters > 1 || $show_author ? '' : ' flat_list') . '"> <ul class="tabs">' . $tabs . '</ul>' . $output . '</div> '); /* After widget (defined by themes). */ echo balanceTags($after_widget); } }
<?php //===================================== Comments ===================================== if (get_custom_option("show_post_comments") == 'yes') { if (is_singular() && comments_open() && get_option('thread_comments')) { themerex_enqueue_script('comment-reply', false, array(), null, true); themerex_enqueue_script('form-comments', get_template_directory_uri() . '/js/_form_comments.js', array(), null, true); } if (comments_open() || get_comments_number() != 0) { comments_template(); } }
function show_meta_box_post() { global $THEMEREX_meta_box_post, $post, $THEMEREX_options; // Use nonce for verification echo '<input type="hidden" name="meta_box_post_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />'; // Nonce for ajax queries $THEMEREX_ajax_nonce = wp_create_nonce('ajax_nonce'); $THEMEREX_ajax_url = admin_url('admin-ajax.php'); $maxLevel = max(5, (int) get_theme_option('reviews_max_level')); $custom_options = get_post_meta($post->ID, 'post_custom_options', true); if (isset($custom_options['reviews_marks'])) { $custom_options['reviews_marks'] = marksToDisplay($custom_options['reviews_marks']); } $post_options = array_merge($THEMEREX_options, $THEMEREX_meta_box_post['fields']); themerex_options_load_scripts(); themerex_options_prepare_js(); themerex_enqueue_script('_admin', get_template_directory_uri() . '/js/_admin.js', array('jquery'), null, true); ?> <script type="text/javascript"> // AJAX fields var THEMEREX_ajax_url = "<?php echo $THEMEREX_ajax_url; ?> "; var THEMEREX_ajax_nonce = "<?php echo $THEMEREX_ajax_nonce; ?> "; var reviews_criterias = "<?php $rc = get_theme_option('reviews_criterias'); echo is_array($rc) ? implode(',', $rc) : ''; ?> "; var reviews_levels = "<?php echo get_theme_option('reviews_criterias_levels'); ?> "; var reviews_max_level = <?php echo $maxLevel; ?> ; var allowUserReviews = true; jQuery(document).ready(function() { // Init post specific meta fields //initPostReviews(); }); </script> <div class="reviews_<?php echo esc_attr($maxLevel); ?> "> <?php themerex_options_page_start(array('data' => $post_options, 'add_inherit' => true, 'show_page_layout' => false, 'override' => 'post')); foreach ($post_options as $option) { if (!isset($option['override']) || !in_array('post', explode(',', $option['override']))) { continue; } $id = isset($option['id']) ? $option['id'] : ''; $meta = isset($custom_options[$id]) ? $custom_options[$id] : ''; themerex_options_show_field($option, $meta); } themerex_options_page_stop(); ?> </div> <?php }
<?php $show_all = !isset($postinfo_buttons) || !is_array($postinfo_buttons); // Social share buttons if (is_singular() && get_theme_option('show_share') == 'yes') { themerex_enqueue_script('social-share', themerex_get_file_url('/js/social/social-share.js'), array(), null, true); } ?> <ul> <?php if ($show_all || in_array('more', $postinfo_buttons)) { ?> <li class="squareButton light ico"><a class="icon-link" title="<?php _e('More', 'themerex'); ?> " href="<?php echo esc_url($post_data['post_link']); ?> "><?php _e('More', 'themerex'); ?> </a></li> <?php } if ($show_all || in_array('likes', $postinfo_buttons)) { ?> <?php $likes = isset($_COOKIE['themerex_likes']) ? $_COOKIE['themerex_likes'] : ''; $allow = themerex_strpos($likes, ',' . $post_data['post_id'] . ',') === false; ?> <li class="likeButton like<?php
function frontend_scripts() { themerex_enqueue_style('custom-menu-style', themerex_get_file_url('/admin/tools/custom_menu/custom_menu.css'), array(), null); themerex_enqueue_script('custom-menu-script', themerex_get_file_url('/admin/tools/custom_menu/custom_menu.js'), array('jquery'), null, true); }
function sc_zoom($atts, $content = null) { if (in_shortcode_blogger()) { return ''; } extract(shortcode_atts(array("id" => "", "class" => "", "src" => "", "url" => "", "over" => "", "border" => "none", "align" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts)); $s = getStyleString('!' . $top, '!' . $right, '!' . $bottom, '!' . $left, $width, $height); $width = getStyleValue($width); $height = getStyleValue($height); if (empty($id)) { $id = 'sc_zoom_' . str_replace('.', '', mt_rand()); } themerex_enqueue_script('elevate-zoom', themerex_get_file_url('/js/jquery.elevateZoom-3.0.4.min.js'), array(), null, true); $src = $src != '' ? $src : $url; if ($src > 0) { $attach = wp_get_attachment_image_src($src, 'full'); if (isset($attach[0]) && $attach[0] != '') { $src = $attach[0]; } } if ($over > 0) { $attach = wp_get_attachment_image_src($over, 'full'); if (isset($attach[0]) && $attach[0] != '') { $over = $attach[0]; } } return empty($src) ? '' : (!sc_param_is_off($border) ? '<div class="sc_border sc_border_' . $border . '">' : '') . '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_zoom' . (!empty($class) ? ' ' . $class : '') . '"' . ($s != '' ? ' style="' . $s . '"' : '') . '>' . '<img src="' . $src . '"' . ($height != '' ? ' style="height:' . $height . ';"' : '') . ' data-zoom-image="' . $over . '" alt="" />' . '</div>' . (!sc_param_is_off($border) ? '</div>' : ''); }
function shortcodes_vc_scripts() { // Include CSS themerex_enqueue_style('shortcodes_vc-style', themerex_get_file_url('/shortcodes/shortcodes_vc.css'), array(), null); // Include JS themerex_enqueue_script('shortcodes_vc', themerex_get_file_url('/shortcodes/shortcodes_vc.js'), array(), null, true); }
/** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating your form elements. This handles the confusing stuff. */ function form($instance) { /* Widget admin side css */ themerex_enqueue_style('widget-qrcode-style', get_template_directory_uri() . '/widgets/qrcode/widget-qrcode-admin.css', array(), null); themerex_enqueue_script('qrcode', get_template_directory_uri() . '/widgets/qrcode/jquery.qrcode-0.6.0.min.js', array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'), null, false); /* Set up some default widget settings. */ $address = explode(',', get_theme_option('user_address')); $defaults = array('title' => '', 'description' => __('QR Code Generator (for your vcard)', 'themerex'), 'ulname' => '', 'ufname' => '', 'ucompany' => '', 'uaddr' => '', 'ucity' => '', 'upostcode' => '', 'ucountry' => '', 'uemail' => '', 'usite' => '', 'uphone' => '', 'uid' => md5(microtime()), 'urev' => date('Y-m-d'), 'image' => '', 'show_personal' => 0, 'show_what' => 1, 'auto_draw' => 0, 'width' => 160, 'text' => '', 'color' => '#000000', 'bg' => ''); $instance = wp_parse_args((array) $instance, $defaults); ?> <div class="widget_qrcode"> <div class="qrcode_tabs"> <ul class="tabs"> <li class="first"><a href="#tab_settings"><?php _e('Settings', 'themerex'); ?> </a></li> <li><a href="#tab_fields" onmousedown="initQRCode()"><?php _e('Personal Data', 'themerex'); ?> </a></li> <li><a href="#tab_text" onmousedown="initQRCode()"><?php _e('Any Text', 'themerex'); ?> </a></li> </ul> <div id="tab_settings" class="tab_content tab_settings"> <p> <label for="<?php echo esc_attr($this->get_field_id('title')); ?> "><?php _e('Title:', 'themerex'); ?> </label> <input class="fld_title" onfocus="initQRCode()" id="<?php echo esc_attr($this->get_field_id('title')); ?> " name="<?php echo esc_attr($this->get_field_name('title')); ?> " value="<?php echo esc_attr($instance['title']); ?> " style="width:100%;" /> </p> <p> <label><?php _e('Show as QR Code:', 'themerex'); ?> </label><br /> <input class="fld_show_what" onfocus="initQRCode()" id="<?php echo esc_attr($this->get_field_id('show_what')); ?> _1" name="<?php echo esc_attr($this->get_field_name('show_what')); ?> " value="1" type="radio" <?php echo esc_attr($instance['show_what'] == 1 ? 'checked="checked"' : ''); ?> /> <label for="<?php echo esc_attr($this->get_field_id('show_what')); ?> _1"> <?php _e('Personal VCard', 'themerex'); ?> </label> <input class="fld_show_what" onfocus="initQRCode()" id="<?php echo esc_attr($this->get_field_id('show_what')); ?> _0" name="<?php echo esc_attr($this->get_field_name('show_what')); ?> " value="0" type="radio" <?php echo esc_attr($instance['show_what'] == 0 ? 'checked="checked"' : ''); ?> /> <label for="<?php echo esc_attr($this->get_field_id('show_what')); ?> _0"> <?php _e('Any text', 'themerex'); ?> </label> </p> <p> <input class="fld_show_personal" onfocus="initQRCode()" id="<?php echo esc_attr($this->get_field_id('show_personal')); ?> " name="<?php echo esc_attr($this->get_field_name('show_personal')); ?> " value="1" type="checkbox" <?php echo esc_attr($instance['show_personal'] == 1 ? 'checked="checked"' : ''); ?> /> <label for="<?php echo esc_attr($this->get_field_id('show_personal')); ?> "><?php _e('Show data under QR Code:', 'themerex'); ?> </label> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('width')); ?> "><?php _e('Width:', 'themerex'); ?> </label> <input onmousedown="initQRCode()" onfocus="initQRCode()" id="<?php echo esc_attr($this->get_field_id('width')); ?> " name="<?php echo esc_attr($this->get_field_name('width')); ?> " value="<?php echo esc_attr($instance['width']); ?> " style="width:100%;" class="fld_width" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('color')); ?> "><?php _e('Color:', 'themerex'); ?> </label> <input onmousedown="initQRCode()" onfocus="initQRCode()" id="<?php echo esc_attr($this->get_field_id('color')); ?> " name="<?php echo esc_attr($this->get_field_name('color')); ?> " value="<?php echo esc_attr($instance['color']); ?> " style="width:100%; background-color:<?php echo esc_attr($instance['color']); ?> " class="iColorPicker fld_color" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('bg')); ?> "><?php _e('Bg color:', 'themerex'); ?> </label> <input onmousedown="initQRCode()" onfocus="initQRCode()" id="<?php echo esc_attr($this->get_field_id('bg')); ?> " name="<?php echo esc_attr($this->get_field_name('bg')); ?> " value="<?php echo esc_attr($instance['bg']); ?> " style="width:100%; background-color:<?php echo esc_attr($instance['bg']); ?> " class="iColorPicker fld_bg" /> </p> </div> <div id="tab_fields" class="tab_content tab_personal"> <p> <label for="<?php echo esc_attr($this->get_field_id('ulname')); ?> "><?php _e('Last name:', 'themerex'); ?> </label> <input class="fld_ulname" id="<?php echo esc_attr($this->get_field_id('ulname')); ?> " name="<?php echo esc_attr($this->get_field_name('ulname')); ?> " value="<?php echo esc_attr($instance['ulname']); ?> " style="width:100%;" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('ufname')); ?> "><?php _e('First name:', 'themerex'); ?> </label> <input class="fld_ufname" id="<?php echo esc_attr($this->get_field_id('ufname')); ?> " name="<?php echo esc_attr($this->get_field_name('ufname')); ?> " value="<?php echo esc_attr($instance['ufname']); ?> " style="width:100%;" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('ucompany')); ?> "><?php _e('Company:', 'themerex'); ?> </label> <input class="fld_ucompany" id="<?php echo esc_attr($this->get_field_id('ucompany')); ?> " name="<?php echo esc_attr($this->get_field_name('ucompany')); ?> " value="<?php echo esc_attr($instance['ucompany']); ?> " style="width:100%;" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('uphone')); ?> "><?php _e('Phone:', 'themerex'); ?> </label> <input class="fld_uphone" id="<?php echo esc_attr($this->get_field_id('uphone')); ?> " name="<?php echo esc_attr($this->get_field_name('uphone')); ?> " value="<?php echo esc_attr($instance['uphone']); ?> " style="width:100%;" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('uaddr')); ?> "><?php _e('Address:', 'themerex'); ?> </label> <input class="fld_uaddr" id="<?php echo esc_attr($this->get_field_id('uaddr')); ?> " name="<?php echo esc_attr($this->get_field_name('uaddr')); ?> " value="<?php echo esc_attr($instance['uaddr']); ?> " style="width:100%;" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('ucity')); ?> "><?php _e('City:', 'themerex'); ?> </label> <input class="fld_ucity" id="<?php echo esc_attr($this->get_field_id('ucity')); ?> " name="<?php echo esc_attr($this->get_field_name('ucity')); ?> " value="<?php echo esc_attr($instance['ucity']); ?> " style="width:100%;" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('upostcode')); ?> "><?php _e('Post code:', 'themerex'); ?> </label> <input class="fld_upostcode" id="<?php echo esc_attr($this->get_field_id('upostcode')); ?> " name="<?php echo esc_attr($this->get_field_name('upostcode')); ?> " value="<?php echo esc_attr($instance['upostcode']); ?> " style="width:100%;" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('ucountry')); ?> "><?php _e('Country:', 'themerex'); ?> </label> <input class="fld_ucountry" id="<?php echo esc_attr($this->get_field_id('ucountry')); ?> " name="<?php echo esc_attr($this->get_field_name('ucountry')); ?> " value="<?php echo esc_attr($instance['ucountry']); ?> " style="width:100%;" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('uemail')); ?> "><?php _e('E-mail:', 'themerex'); ?> </label> <input class="fld_uemail" id="<?php echo esc_attr($this->get_field_id('uemail')); ?> " name="<?php echo esc_attr($this->get_field_name('uemail')); ?> " value="<?php echo esc_attr($instance['uemail']); ?> " style="width:100%;" /> </p> <p> <label for="<?php echo esc_attr($this->get_field_id('usite')); ?> "><?php _e('Web Site URL:', 'themerex'); ?> </label> <input class="fld_usite" id="<?php echo esc_attr($this->get_field_id('usite')); ?> " name="<?php echo esc_attr($this->get_field_name('usite')); ?> " value="<?php echo esc_attr($instance['usite']); ?> " style="width:100%;" /> </p> </div> <div id="tab_text" class="tab_content tab_text"> <p> <label for="<?php echo esc_attr($this->get_field_id('fld_text')); ?> "><?php _e('Text to show as QR Code:', 'themerex'); ?> </label> <textarea class="fld_text" id="<?php echo esc_attr($this->get_field_id('text')); ?> " name="<?php echo esc_attr($this->get_field_name('text')); ?> " style="width:100%;"><?php echo esc_attr($instance['text']); ?> </textarea> </p> </div> </div> <input class="fld_uid" id="<?php echo esc_attr($this->get_field_id('uid')); ?> " name="<?php echo esc_attr($this->get_field_name('uid')); ?> " value="<?php echo esc_attr($instance['uid']); ?> " type="hidden" /> <input class="fld_urev" id="<?php echo esc_attr($this->get_field_id('urev')); ?> " name="<?php echo esc_attr($this->get_field_name('urev')); ?> " value="<?php echo esc_attr($instance['urev']); ?> " type="hidden" /> <p> <input class="fld_button_draw" id="<?php echo esc_attr($this->get_field_id('button_draw')); ?> " name="<?php echo esc_attr($this->get_field_name('button_draw')); ?> " value="<?php _e('Update', 'themerex'); ?> " type="button" /> <input class="fld_auto_draw" id="<?php echo esc_attr($this->get_field_id('auto_draw')); ?> " name="<?php echo esc_attr($this->get_field_name('auto_draw')); ?> " value="1" type="checkbox" <?php echo esc_attr($instance['auto_draw'] == 1 ? 'checked="checked"' : ''); ?> /> <label for="<?php echo esc_attr($this->get_field_id('auto_draw')); ?> "> <?php _e('Auto', 'themerex'); ?> </label> </p> <input class="fld_image" id="<?php echo esc_attr($this->get_field_id('image')); ?> " name="<?php echo esc_attr($this->get_field_name('image')); ?> " value="" type="hidden" /> <div id="<?php echo esc_attr($this->get_field_id('qrcode_image')); ?> " class="qrcode_image"><img src="<?php echo esc_attr($instance['image']); ?> " alt="" /></div> <div id="<?php echo esc_attr($this->get_field_id('qrcode_data')); ?> " class="qrcode_data"> <?php if ($instance['show_personal'] == 1) { ?> <ul> <?php if ($instance['show_what'] == 1) { ?> <li class="user_name odd first"><?php echo __('Name:', 'themerex') . ' ' . $instance['ufname'] . ' ' . $instance['ulname']; ?> </li> <?php echo ($instance['ucompany'] ? '<li class="user_company even">' . __('Company:', 'themerex') . ' ' . $instance['ucompany'] . '</li>' : '') . ($instance['uphone'] ? '<li class="user_phone odd">' . __('Phone:', 'themerex') . ' ' . $instance['uphone'] . '</li>' : '') . ($instance['uemail'] ? '<li class="user_email even">' . __('E-mail:', 'themerex') . ' ' . '<a href="mailto:' . $instance['uemail'] . '">' . $instance['uemail'] . '</a></li>' : '') . ($instance['usite'] ? '<li class="user_site odd">' . __('Site:', 'themerex') . ' ' . '<a href="' . $instance['usite'] . '" target="_blank">' . $instance['usite'] . '</a></li>' : ''); ?> <?php } else { ?> <li class="text odd first"><?php echo balanceTags($instance['text']); ?> </li> <?php } ?> </ul> <?php } ?> </div> </div> <script type="text/javascript"> jQuery(document).ready(function(){ initQRCode(); iColorPicker(); }); function initQRCode() { var widget = null; jQuery('#widgets-right .widget_qrcode input.iColorPicker').each(function() { var obj = jQuery(this); if (!obj.hasClass('colored') && obj.attr('id').indexOf('__i__') < 0) { widget = obj.parents('.widget_qrcode'); obj.addClass('colored'); setColorPicker(jQuery(this).attr('id')); widget.find('div.qrcode_tabs').tabs(); widget.find('.fld_button_draw').click(function() { updateQRCode(widget); }); widget.parents('form').find('.widget-control-save').click(function() { updateQRCode(widget); }); widget.find('.tab_personal input,.tab_text textarea,.fld_auto_draw,.iColorPicker').change(function () { if (widget.find('.fld_auto_draw').attr('checked')=='checked') { widget.find('.fld_button_draw').hide(); updateQRCode(widget); } else widget.find('.fld_button_draw').show(); }); } }); if (widget && widget.find('.fld_auto_draw').attr('checked')=='checked') widget.find('.fld_button_draw').hide(); } function updateQRCode(widget) { showQRCode(widget, { ufname: widget.find('.fld_ufname').val(), ulname: widget.find('.fld_ulname').val(), ucompany: widget.find('.fld_ucompany').val(), usite: widget.find('.fld_usite').val(), uemail: widget.find('.fld_uemail').val(), uphone: widget.find('.fld_uphone').val(), //ufax: widget.find('.fld_ufax').val(), uaddr: widget.find('.fld_uaddr').val(), ucity: widget.find('.fld_ucity').val(), upostcode: widget.find('.fld_upostcode').val(), ucountry: widget.find('.fld_ucountry').val(), //unote: widget.find('.fld_unote').val(), //ucats: widget.find('.fld_ucats').val(), uid: widget.find('.fld_uid').val(), urev: widget.find('.fld_urev').val(), text: widget.find('.fld_text').val() }, { qrcode: widget.find('.qrcode_image').eq(0), personal: widget.find('.qrcode_data'), show_personal: widget.find('.fld_show_personal').attr('checked')=='checked', show_what: widget.find('.fld_show_what').attr('checked')=='checked' ? 1 : 0, width: widget.find('.fld_width').val(), color: widget.find('.fld_color').val(), bg: widget.find('.fld_bg').val() } ); widget.find('.fld_image').val(widget.find('.qrcode_image canvas').get(0).toDataURL('image/png')); } function showQRCode(widget, vc, opt) { if (opt.show_what==1) { var text = 'BEGIN:VCARD\n' + 'VERSION:3.0\n' + 'FN:' + vc.ufname + ' ' + vc.ulname + '\n' + 'N:' + vc.ulname + ';' + vc.ufname + '\n' + (vc.ucompany ? 'ORG:' + vc.ucompany + '\n' : '') + (vc.uphone ? 'TEL;TYPE=cell, pref:' + vc.uphone + '\n' : '') + (vc.ufax ? 'TEL;TYPE=fax, pref:' + vc.ufax + '\n' : '') + (vc.uaddr || vc.ucity || vc.ucountry ? 'ADR;TYPE=dom, home, postal, parcel:;;' + vc.uaddr + ';' + vc.ucity + ';;' + vc.upostcode + ';' + vc.ucountry + '\n' : '') + (vc.usite ? 'URL:' + vc.usite + '\n' : '') + (vc.uemail ? 'EMAIL;TYPE=INTERNET:' + vc.uemail + '\n' : '') + (vc.ucats ? 'CATEGORIES:' + vc.ucats + '\n' : '') + (vc.unote ? 'NOTE:' + vc.unote + '\n' : '') + (vc.urev ? 'NOTE:' + vc.urev + '\n' : '') + (vc.uid ? 'UID:' + vc.uid + '\n' : '') + 'END:VCARD'; } else { var text = vc.text; } opt.qrcode .empty() .qrcode({ 'text': text, 'color': opt.color, 'bgColor': opt.bg!='' ? opt.bg : null, 'width': opt.width, 'height': opt.width, 'size': opt.width }); if (opt.show_personal == 0) opt.personal.empty().hide(); else opt.personal.html( '<ul>' + (opt.show_what==1 ? '<li class="user_name odd first">' + vc.ufname + ' ' + vc.ulname + '</li>' + (vc.ucompany ? '<li class="user_company even">' + vc.ucompany + '</li>' : '') + (vc.uphone ? '<li class="user_phone odd">' + vc.uphone + '</li>' : '') + (vc.uemail ? '<li class="user_email even"><a href="mailto:' + vc.uemail + '">' + vc.uemail + '</a></li>' : '') + (vc.usite ? '<li class="user_site odd"><a href="' + vc.usite + '" target="_blank">' + vc.usite + '</a></li>' : '') : '<li class="text odd first">' + vc.text + '</li>') + '</ul>' ).show(); } if (!window.setColorPicker) { function setColorPicker(id_picker) { jQuery('#'+id_picker).click(function (e) { "use strict"; iColorShow(null, jQuery(this), function(fld, clr) { "use strict"; fld.css('backgroundColor', clr).val(clr); }); }); /* jQuery('#'+id_picker).ColorPicker({ color: jQuery('#'+id_picker).val(), onShow: function (colpkr) { jQuery(colpkr).fadeIn(500); return false; }, onHide: function (colpkr) { jQuery(colpkr).fadeOut(500); return false; }, onChange: function (hsb, hex, rgb) { jQuery('#'+id_picker).css('backgroundColor', '#' + hex).val('#' + hex); } }); */ } } </script> <?php }