function axiom_reviews_check_criterias() { global $_REQUEST; if (!wp_verify_nonce($_REQUEST['nonce'], 'ajax_nonce')) { die; } $response = array('error' => '', 'criterias' => ''); $ids = explode(',', $_REQUEST['ids']); if (count($ids) > 0) { foreach ($ids as $id) { $id = (int) $id; $prop = axiom_taxonomy_get_inherited_property('category', $id, 'reviews_criterias'); if (!empty($prop) && !axiom_is_inherit_option($prop)) { $response['criterias'] = implode(',', $prop); break; } } } echo json_encode($response); die; }
function axiom_add_mainmenu_classes($items, $args) { if (is_admin()) { return $items; } if ($args->menu_id == 'mainmenu' && axiom_get_theme_option('menu_colored') == 'yes') { foreach ($items as $k => $item) { if ($item->menu_item_parent == 0) { if ($item->type == 'taxonomy' && $item->object == 'category') { $cur_tint = axiom_taxonomy_get_inherited_property('category', $item->object_id, 'bg_tint'); if (!empty($cur_tint) && !axiom_is_inherit_option($cur_tint)) { $items[$k]->classes[] = 'bg_tint_' . esc_attr($cur_tint); } } } } } return $items; }
function axiom_post_show_custom_field_option($option, $id, $post_type, $post_id) { if ($id == 'reviews_marks') { $cat_list = axiom_get_categories_by_post_id($post_id); if (!empty($cat_list['category']->terms)) { foreach ($cat_list['category']->terms as $cat) { $term_id = (int) $cat->term_id; $prop = axiom_taxonomy_get_inherited_property('category', $term_id, 'reviews_criterias'); if (!empty($prop) && !axiom_is_inherit_option($prop)) { $option['options'] = $prop; break; } } } } return $option; }
function axiom_get_custom_option($name, $defa = null, $post_id = 0, $post_type = 'post', $tax_id = 0, $tax_type = 'category') { if (isset($_GET[$name])) { $rez = $_GET[$name]; } else { global $AXIOM_GLOBALS; $hash_name = $name . '_' . $tax_id . '_' . $post_id; if (!empty($AXIOM_GLOBALS['theme_options_loaded']) && isset($AXIOM_GLOBALS['custom_options'][$hash_name])) { $rez = $AXIOM_GLOBALS['custom_options'][$hash_name]; } else { if ($tax_id > 0) { $rez = axiom_taxonomy_get_inherited_property($tax_type, $tax_id, $name); if ($rez == '') { $rez = axiom_get_theme_option($name, $defa); } } else { if ($post_id > 0) { $rez = axiom_get_theme_option($name, $defa); $custom_options = get_post_meta($post_id, 'post_custom_options', true); if (isset($custom_options[$name]) && !axiom_is_inherit_option($custom_options[$name])) { $rez = $custom_options[$name]; } else { $terms = array(); $tax = axiom_get_taxonomy_categories_by_post_type($post_type); $tax_obj = get_taxonomy($tax); $tax_query = !empty($tax_obj->query_var) ? $tax_obj->query_var : $tax; if ($tax == 'category' && is_category() || $tax == 'post_tag' && is_tag() || is_tax($tax)) { // Current page is taxonomy's archive (Categories and Tags need specific check) $terms = array(get_queried_object()); } else { $taxes = axiom_get_terms_by_post_id(array('post_id' => $post_id, 'taxonomy' => $tax)); if (!empty($taxes[$tax]->terms)) { $terms = $taxes[$tax]->terms; } } $tmp = ''; if (!empty($terms)) { for ($cc = 0; $cc < count($terms) && (empty($tmp) || axiom_is_inherit_option($tmp)); $cc++) { $tmp = axiom_taxonomy_get_inherited_property($terms[$cc]->taxonomy, $terms[$cc]->term_id, $name); } } if ($tmp != '') { $rez = $tmp; } } } else { $rez = axiom_get_theme_option($name, $defa); if (axiom_get_theme_option('show_theme_customizer') == 'yes' && axiom_get_theme_option('remember_visitors_settings') == 'yes' && function_exists('axiom_get_value_gpc')) { $tmp = axiom_get_value_gpc($name, $rez); if (!axiom_is_inherit_option($tmp)) { $rez = $tmp; } } if (isset($AXIOM_GLOBALS['template_options'][$name]) && !axiom_is_inherit_option($AXIOM_GLOBALS['template_options'][$name])) { $rez = is_array($AXIOM_GLOBALS['template_options'][$name]) ? $AXIOM_GLOBALS['template_options'][$name][0] : $AXIOM_GLOBALS['template_options'][$name]; } if (isset($AXIOM_GLOBALS['taxonomy_options'][$name]) && !axiom_is_inherit_option($AXIOM_GLOBALS['taxonomy_options'][$name])) { $rez = $AXIOM_GLOBALS['taxonomy_options'][$name]; } if (isset($AXIOM_GLOBALS['post_options'][$name]) && !axiom_is_inherit_option($AXIOM_GLOBALS['post_options'][$name])) { $rez = is_array($AXIOM_GLOBALS['post_options'][$name]) ? $AXIOM_GLOBALS['post_options'][$name][0] : $AXIOM_GLOBALS['post_options'][$name]; } } } $rez = apply_filters('axiom_filter_get_custom_option', $rez, $name); if (!empty($AXIOM_GLOBALS['theme_options_loaded'])) { $AXIOM_GLOBALS['custom_options'][$hash_name] = $rez; } } } return $rez; }
} $max_level = max(5, (int) axiom_get_custom_option('reviews_max_level')); $allow_user_marks = (!$reviews_first_author || !$reviews_second_hide) && (!isset($_COOKIE['axiom_votes']) || axiom_strpos($_COOKIE['axiom_votes'], ',' . $post_data['post_id'] . ',') === false) && (axiom_get_theme_option('reviews_can_vote') == 'all' || is_user_logged_in()); $reviews_markup = '<div class="reviews_block' . ($use_tabs ? ' sc_tabs sc_tabs_style_2' : '') . '">'; $output = $marks = $users = ''; if ($use_tabs) { $author_tab = '<li class="sc_tabs_title"><a href="#author_marks" class="theme_button">' . __('Author', 'axiom') . '</a></li>'; $users_tab = '<li class="sc_tabs_title"><a href="#users_marks" class="theme_button">' . __('Users', 'axiom') . '</a></li>'; $output .= '<ul class="sc_tabs_titles">' . ($reviews_first_author ? $author_tab . $users_tab : $users_tab . $author_tab) . '</ul>'; } // Criterias list $field = array("options" => axiom_get_theme_option('reviews_criterias')); if (!empty($post_data['post_terms'][$post_data['post_taxonomy']]->terms)) { foreach ($post_data['post_terms'][$post_data['post_taxonomy']]->terms as $cat) { $id = (int) $cat->term_id; $prop = axiom_taxonomy_get_inherited_property($post_data['post_taxonomy'], $id, 'reviews_criterias'); if (!empty($prop) && !axiom_is_inherit_option($prop)) { $field['options'] = $prop; break; } } } // 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