Ejemplo n.º 1
0
function axiom_show_custom_field($id, $field, $value)
{
    $output = '';
    switch ($field['type']) {
        case 'reviews':
            $output .= '<div class="reviews_block">' . trim(axiom_reviews_get_markup($field, $value, true)) . '</div>';
            break;
        case 'mediamanager':
            wp_enqueue_media();
            $output .= '<a id="' . esc_attr($id) . '" class="button mediamanager"
				data-choose="' . esc_attr(isset($field['multiple']) && $field['multiple'] ? __('Choose Images', 'axiom') : __('Choose Image', 'axiom')) . '"
				data-update="' . esc_attr(isset($field['multiple']) && $field['multiple'] ? __('Add to Gallery', 'axiom') : __('Choose Image', 'axiom')) . '"
				data-multiple="' . esc_attr(isset($field['multiple']) && $field['multiple'] ? 'true' : 'false') . '"
				data-linked-field="' . esc_attr($field['media_field_id']) . '"
				onclick="axiom_show_media_manager(this); return false;"
				>' . (isset($field['multiple']) && $field['multiple'] ? __('Choose Images', 'axiom') : __('Choose Image', 'axiom')) . '</a>';
            break;
    }
    return apply_filters('axiom_filter_show_custom_field', $output, $id, $field, $value);
}
Ejemplo n.º 2
0
    // Author marks
    if ($reviews_first_author || !$reviews_second_hide) {
        $field["id"] = "reviews_marks_author";
        $field["descr"] = strip_tags($post_data['post_excerpt']);
        $field["accept"] = false;
        $marks = axiom_reviews_marks_to_display(axiom_reviews_marks_prepare(axiom_get_custom_option('reviews_marks'), count($field['options'])));
        $output .= '<div id="author_marks" class="sc_tabs_content">' . trim(axiom_reviews_get_markup($field, $marks, false, false, $reviews_first_author)) . '</div>';
    }
    // Users marks
    if (!$reviews_first_author || !$reviews_second_hide) {
        $marks = axiom_reviews_marks_to_display(axiom_reviews_marks_prepare(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.", 'axiom'), $users) . ' ' . (!isset($_COOKIE['axiom_votes']) || axiom_strpos($_COOKIE['axiom_votes'], ',' . $post_data['post_id'] . ',') === false ? __('You can set own marks for this article - just click on stars above and press "Accept".', 'axiom') : __('Thanks for your vote!', 'axiom'));
        $field["accept"] = $allow_user_marks;
        $output .= '<div id="users_marks" class="sc_tabs_content"' . (!$output ? ' style="display: block;"' : '') . '>' . trim(axiom_reviews_get_markup($field, $marks, $allow_user_marks, false, !$reviews_first_author)) . '</div>';
    }
    $reviews_markup .= $output . '</div>';
    if ($allow_user_marks) {
        axiom_enqueue_script('jquery-ui-draggable', false, array('jquery', 'jquery-ui-core'), null, true);
        $reviews_markup .= '
			<script type="text/javascript">
				jQuery(document).ready(function() {
					AXIOM_GLOBALS["reviews_allow_user_marks"] = ' . ($allow_user_marks ? 'true' : 'false') . ';
					AXIOM_GLOBALS["reviews_max_level"] = ' . $max_level . ';
					AXIOM_GLOBALS["reviews_levels"] = "' . trim(axiom_get_theme_option('reviews_criterias_levels')) . '";
					AXIOM_GLOBALS["reviews_vote"] = "' . (isset($_COOKIE['axiom_votes']) ? $_COOKIE['axiom_votes'] : '') . '";
					AXIOM_GLOBALS["reviews_marks"] = "' . $marks . '".split(",");
					AXIOM_GLOBALS["reviews_users"] = ' . max(0, $users) . ';
					AXIOM_GLOBALS["post_id"] = ' . $post_data['post_id'] . ';
				});