Example #1
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();
}
Example #2
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 
}
Example #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();
    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 
}
Example #4
0
function themerex_options_page()
{
    global $themerex_options_data;
    themerex_options_page_start();
    foreach ($themerex_options_data as $field) {
        themerex_options_show_field($field);
    }
    themerex_options_page_stop();
}
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 
}