function sc_selector_js()
{
    if (is_themerex_options_used()) {
        themerex_options_load_scripts();
        themerex_options_prepare_js();
        themerex_shortcodes_load_scripts();
    }
}
Beispiel #2
0
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('page');
    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();
}
Beispiel #3
0
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('post');
    ?>
    
    <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 = "";
		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 $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] : '';
        if ($id == 'reviews_marks') {
            $cat_list = getCategoriesByPostId($post->ID);
            if (count($cat_list) > 0) {
                foreach ($cat_list as $cat) {
                    $id = (int) $cat['term_id'];
                    $prop = get_category_inherited_property($id, 'reviews_criterias');
                    if (!empty($prop) && !is_inherit_option($prop)) {
                        $option['options'] = $prop;
                        break;
                    }
                }
            }
        }
        themerex_options_show_field($option, $meta);
    }
    themerex_options_page_stop();
    ?>
	</div>
	<?php 
}
function sc_selector_prepare_js()
{
    if (is_themerex_options_used()) {
        themerex_options_prepare_js('general');
        themerex_shortcodes_prepare_js();
    }
}
Beispiel #5
0
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

//====================================== 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 category_custom_fields_show($tax = null)
{
    global $THEMEREX_options;
    ?>
  
	<table border="0" cellpadding="0" cellspacing="0" class="form-table">
    <tr class="form-field" valign="top">  
	    <td span="2">
	<div class="section section-info ">
		<h3 class="heading"><?php 
    _e('Custom settings for this category (and nested):', 'themerex');
    ?>
</h3>
		<div class="option">
			<div class="controls">
				<div class="info">
					<?php 
    _e('Select parameters for showing posts from this category and all nested categories.', 'themerex');
    ?>
<br />
					<?php 
    _e('Attention: In each nested category you can override this settings.', 'themerex');
    ?>
				</div>
			</div>
		</div>
	</div>
<?php 
    // Use nonce for verification
    echo '<input type="hidden" name="meta_box_category_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
    $custom_options = category_custom_fields_get($tax);
    themerex_options_load_scripts();
    themerex_options_prepare_js();
    wp_enqueue_script('_admin', get_template_directory_uri() . '/js/_admin.js', array('jquery'), null, true);
    themerex_options_page_start(array('data' => $THEMEREX_options, 'add_inherit' => true, 'show_page_layout' => false, 'override' => 'category'));
    foreach ($THEMEREX_options as $option) {
        if (!isset($option['override']) || !in_array('category', 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();
    ?>
		</td>
	</tr>
	</table>
<?php 
}