Exemple #1
0
function show_custom_field($field, $value)
{
    $output = '';
    switch ($field['type']) {
        case 'reviews':
            $output .= '<div class="reviewBlock">' . getReviewsMarkup($field, $value, true) . '</div>';
            break;
        case 'mediamanager':
            wp_enqueue_media();
            $output .= '<a id="' . $field['id'] . '" class="button mediamanager"
				data-choose="' . (isset($field['multiple']) && $field['multiple'] ? __('Choose Images', 'themerex') : __('Choose Image', 'themerex')) . '"
				data-update="' . (isset($field['multiple']) && $field['multiple'] ? __('Add to Gallery', 'themerex') : __('Choose Image', 'themerex')) . '"
				data-multiple="' . (isset($field['multiple']) && $field['multiple'] ? 'true' : 'false') . '"
				data-linked-field="' . $field['media_field_id'] . '"
				onclick="showMediaManager(this); return false;"
				>' . (isset($field['multiple']) && $field['multiple'] ? __('Choose Images', 'themerex') : __('Choose Image', 'themerex')) . '</a>';
            break;
    }
    return $output;
}
Exemple #2
0
        }
        if ($reviews_first_author || !$reviews_second_hide) {
            $output .= '<div id="reviews_author" class="reviews_tab reviews_author">';
            $field["id"] = "reviews_marks_author";
            $field["descr"] = $post_descr;
            $marks = marksToDisplay(get_custom_option('reviews_marks'));
            $output .= getReviewsMarkup($field, $marks, false, $reviews_first_author);
            $output .= '</div>';
        }
        if (!$reviews_first_author || !$reviews_second_hide) {
            $output .= '<div id="reviews_users" class="reviews_tab reviews_users"' . (!$output ? ' style="display: block;"' : '') . '>';
            $marks = marksToDisplay(get_post_meta($post_id, 'reviews_marks2', true));
            $users = get_post_meta($post_id, 'reviews_users', true);
            $field["id"] = "reviews_marks_users";
            $field["descr"] = '<div class="criteria_summary_descr">' . sprintf(__("Summary rating from %s user's marks.", 'themerex'), '<span class="theme_strong">' . $users . '</span>') . ' ' . (!isset($_COOKIE['reviews_vote']) || themerex_strpos($_COOKIE['reviews_vote'], ',' . $post_id . ',') === false ? __('You can set own marks for this article - just click on stars above and press "Accept".', 'themerex') : __('Thanks for your vote!', 'themerex')) . '</div>' . '<a href="#" class="theme_button reviews_users_accept">' . __('Accept', 'themerex') . '</a>';
            $output .= getReviewsMarkup($field, $marks, false, !$reviews_first_author);
            $output .= '</div>';
        }
        echo $output;
        ?>
							</div>
							<script type="text/javascript">
								var reviews_max_level = <?php 
        echo $maxLevel;
        ?>
;
								var reviews_levels = "<?php 
        echo get_theme_option('reviews_criterias_levels');
        ?>
";
								var reviews_vote = "<?php 
    $output .= '<div class="sc_tabs_array">';
    if ($reviews_first_author || !$reviews_second_hide) {
        $field["id"] = "reviews_marks_author";
        $field["descr"] = strip_tags($post_data['post_excerpt']);
        $field["accept"] = false;
        $marks = marksToDisplay(marksPrepare(get_custom_option('reviews_marks'), count($field['options'])));
        $output .= '<div class="reviewTab" id="author-tabs">' . getReviewsMarkup($field, $marks, false, false, $reviews_first_author) . '</div>';
    }
    // Users marks
    if (!$reviews_first_author || !$reviews_second_hide) {
        $marks = marksToDisplay(marksPrepare(get_post_meta($post_data['post_id'], 'reviews_marks2', true), count($field['options'])));
        $users = max(0, get_post_meta($post_data['post_id'], 'reviews_users', true));
        $field["id"] = "reviews_marks_users";
        $field["descr"] = sprintf(__("Summary rating from <b>%s</b> user's marks.", 'themerex'), $users) . ' ' . (!isset($_COOKIE['reviews_vote']) || themerex_strpos($_COOKIE['reviews_vote'], ',' . $post_data['post_id'] . ',') === false ? __('You can set own marks for this article - just click on stars above and press "Accept".', 'themerex') : __('Thanks for your vote!', 'themerex'));
        $field["accept"] = $allowUserReviews;
        $output .= '<div class="reviewTab" id="users-tabs"' . (!$output ? ' style="display: block;"' : '') . '>' . getReviewsMarkup($field, $marks, $allowUserReviews, false, !$reviews_first_author) . '</div>';
    }
    $output .= '</div>';
    $THEMEREX_REVIEWS_RATING .= $output . '</div>';
    if ($allowUserReviews) {
        $THEMEREX_REVIEWS_RATING .= '
			<script type="text/javascript">
				var reviews_max_level = ' . $maxLevel . ';
				var reviews_levels = "' . get_theme_option('reviews_criterias_levels') . '";
				var reviews_vote = "' . (isset($_COOKIE['reviews_vote']) ? $_COOKIE['reviews_vote'] : '') . '";
				var marks = "' . $marks . '".split(",");
				var users = ' . max(0, $users) . ';
				var post_id = ' . $post_data['post_id'] . ';
				allowUserReviews = ' . ($allowUserReviews ? 'true' : 'false') . ';
			</script>
		';