/** * Localize all javascript message strings. * * @since 1.0.0 * @package GeoDirectory_Review_Rating_Manager */ function geodir_reviewrating_localize_all_js_msg() { global $path_location_url; $arr_alert_msg = array('geodir_reviewrating_admin_url' => admin_url('admin.php'), 'geodir_reviewrating_admin_ajax_url' => geodir_reviewrating_ajax_url(), 'geodir_reviewrating_select_overall_rating_off_img' => __('Please select overall rating Off image.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_select_overall_rating_on_img' => __('Please select overall rating on image.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_select_overall_rating_half_img' => __('Please select Overall rating half image.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_please_enter' => __('Please enter', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_score_text' => __('Score text', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_star_text' => __('Star Text', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_enter_title' => __('Please enter Title.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_rating_delete_confirmation' => __('Do you want to delete this rating?', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_please_select' => __('Please select', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_categories_text' => __('Categories.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_select_post_type' => __('Please select Post Type.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_enter_rating_title' => __('Please enter rating title.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_select_multirating_style' => __('Please Select multirating style.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_select_review_like_img' => __('Please select review like image.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_select_review_unlike_img' => __('Please select review unlike image.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_hide_images' => __('Hide Images', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_show_images' => __('Show Images', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_hide_ratings' => __('Hide Multi Ratings', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_show_ratings' => __('Show Multi Ratings', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_delete_image_confirmation' => __('Are you sure want to delete this image?', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_please_enter_below' => __('Please enter below', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_please_enter_above' => __('Please enter above', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_numeric_validation' => __('Please enter only numeric value', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_maximum_star_rating_validation' => __('You are create maximum seven star rating', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_star_and_input_box_validation' => __('Your input box number and number of star is not same', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_star_and_score_text_validation' => __('Your input box number and number of Score text is not same', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_select_rating_off_img' => __('Please select rating off image.', GEODIRREVIEWRATING_TEXTDOMAIN), 'geodir_reviewrating_rating_img_featured' => get_option('geodir_reviewrating_overall_off_img_featured'), 'geodir_reviewrating_rating_color_featured' => get_option('geodir_reviewrating_overall_color_featured'), 'geodir_reviewrating_rating_width_featured' => get_option('geodir_reviewrating_overall_off_img_width_featured'), 'geodir_reviewrating_rating_height_featured' => get_option('geodir_reviewrating_overall_off_img_height_featured'), 'geodir_reviewrating_optional_multirating' => (bool) get_option('geodir_reviewrating_optional_multirating')); foreach ($arr_alert_msg as $key => $value) { if (!is_scalar($value)) { continue; } $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); } $script = "var geodir_reviewrating_all_js_msg = " . json_encode($arr_alert_msg) . ';'; echo '<script>'; echo $script; echo '</script>'; }
/** * Adds rating manager 'create ratings' tab settings - form fields. * * @since 1.0.0 * @package GeoDirectory_Review_Rating_Manager * * @global object $wpdb WordPress Database object. */ function geodir_reviewrating_create_rating_form() { global $cat_display, $post_cat, $table_prefix, $wpdb; $ajax_url = geodir_reviewrating_ajax_url(); if (isset($_REQUEST['rating_cat_id']) && $_REQUEST['rating_cat_id'] != '') { $sqlquery = $wpdb->prepare("select * from " . GEODIR_REVIEWRATING_CATEGORY_TABLE . " where id = %d", array($_REQUEST['rating_cat_id'])); $qry_result = $wpdb->get_row($sqlquery); } $nonce = wp_create_nonce('geodir_create_rating_nonce'); ?> <div class="gd-content-heading active"> <h3><?php _e('Create Ratings', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </h3> <div id="form_div"> <?php if (isset($_REQUEST['rating_cat_id']) && $_REQUEST['rating_cat_id'] != '') { ?> <input type="hidden" value="<?php echo $_REQUEST['rating_cat_id']; ?> " name="rating_cat_id" /> <?php } ?> <input type="hidden" name="geodir_create_rating_nonce_field" value="<?php echo $nonce; ?> " /> <table class="form-table" id='tblSample'> <tr> <th scope="row"><?php _e('Select multirating style', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </th> <td><?php $qry_result_category_id = isset($qry_result->category_id) ? $qry_result->category_id : ''; echo geodir_reviewrating_style_dl($qry_result_category_id); ?> </td> </tr> <tr> <th scope="row"><?php _e('Rating title', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </th> <td><input class="regular-text" type="text" name="rating_title" id="rating_title" value="<?php if (isset($qry_result->title)) { echo $qry_result->title; } ?> " /></td> </tr> <tr> <th scope="row"><?php _e('Showing method', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </th> <td> <?php $checked = ''; $checked_false = ''; if (isset($qry_result) && $qry_result->check_text_rating_cond == '0') { $checked_false = "checked"; } else { $checked = "checked"; } ?> <input type="radio" name="show_star" id="select_star" value="1" <?php echo $checked; ?> /> <?php _e('Show star', GEODIRREVIEWRATING_TEXTDOMAIN); ?> <input type="radio" name="show_star" id="select_text" value="0" <?php echo $checked_false; ?> /> <?php _e('Show dropdown', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </td> </tr> <tr> <th scope="row"><?php _e('Select post type', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </th> <td> <?php $post_arr = array(); if (isset($qry_result->post_type) && $qry_result->post_type != '') { $post_arr = explode(',', $qry_result->post_type); } $geodir_post_types = get_option('geodir_post_types'); $geodir_posttypes = geodir_get_posttypes(); $i = 1; foreach ($geodir_posttypes as $p_type) { $geodir_posttype_info = $geodir_post_types[$p_type]; $listing_slug = $geodir_posttype_info['labels']['singular_name']; ?> <div style="float:left; border:1px solid #CCCCCC; margin:0 5px;" > <input type="checkbox" name="post_type<?php echo $i; ?> " id="_<?php echo $i; ?> " value="<?php echo $p_type; ?> " class="rating_checkboxs" <?php if (count($post_arr) > 0) { if (in_array($p_type, $post_arr)) { echo 'checked="checked"'; } } ?> /><b> <?php echo ucwords($listing_slug); ?> </b> <?php $cat_display = 'select'; $post_cat = isset($qry_result->category) ? $qry_result->category : ''; ?> <br/> <select id="categories_type_<?php echo $i; ?> " name="categories_type_<?php echo $i; ?> []" multiple="multiple" style="display:<?php if (!in_array($p_type, $post_arr)) { echo 'none'; } ?> ;"> <?php echo geodir_custom_taxonomy_walker($p_type . 'category'); ?> </select> </div> <?php $i++; } ?> <input type="hidden" value="<?php echo $i -= 1; ?> " name="number_of_post" /> </td> </tr> </table> <p class="submit"><input type="button" id="create_rating_submit" class="button-primary" value="<?php _e('Save Changes', GEODIRREVIEWRATING_TEXTDOMAIN); ?> " /></p> </div> <table class="widefat" style="width:100%;"> <thead> <tr> <th width="50"><strong><?php _e('S No.', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </strong></th> <th width="100"><strong><?php _e('Rating Style', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </strong></th> <th width="100"><strong><?php _e('Rating Title', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </strong></th> <th width="100"><strong><?php _e('Rating Image', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </strong></th> <th width="125"><strong><?php _e('Post Types', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </strong></th> <th width="125"><strong><?php _e('Categories', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </strong></th> <th width="50"><strong><?php _e('Action', GEODIRREVIEWRATING_TEXTDOMAIN); ?> </strong></th> </tr> </thead> <tbody> <?php $geodir_reviews = geodir_reviewrating_rating_categories(); $check_multi_category_name = ''; if (!empty($geodir_reviews)) { $counter = 1; foreach ($geodir_reviews as $wnw_review) { $nonce = wp_create_nonce('geodir_delete_rating_' . $wnw_review->id); if ($counter % 2 == 0) { $bgcolor = '#FFF'; } else { $bgcolor = '#FCFCFC'; } $rating_style = geodir_reviewrating_get_style_by_id($wnw_review->category_id); echo '<tr style="background-color:' . $bgcolor . ';height:40px;">'; echo '<td>' . $counter . '</td>'; echo '<td>' . __($rating_style->name, GEODIRECTORY_TEXTDOMAIN) . '</td>'; echo '<td>' . __($wnw_review->title, GEODIRECTORY_TEXTDOMAIN) . '</td>'; echo '<td><img style="width:16px;" src="' . $rating_style->s_img_off . '" alt="' . esc_attr(__('rating icon', GEODIRREVIEWRATING_TEXTDOMAIN)) . '" />'; /*<img style="width:16px;" src="'.$rating_style->s_img_on.'"/> <img style="width:16px;" src="'.$rating_style->s_img_half.'"/>*/ echo '</td>'; echo '<td>'; if ($wnw_review->post_type != '') { $post_types = explode(',', $wnw_review->post_type); if (!empty($post_types)) { $j = 0; $comma = ''; $get_post_types = ''; foreach ($post_types as $ptype) { $post_typeinfo = get_post_type_object($ptype); if ($j != 0) { $comma = ', '; } $get_post_types .= $comma . ucwords($post_typeinfo->labels->singular_name); $j++; } } echo $get_post_types; } echo '</td>'; echo '<td>'; if (isset($wnw_review->multi_category_name)) { $check_multi_category_name .= ',' . $wnw_review->multi_category_name . ','; } $category = trim($wnw_review->category, ","); $terms = explode(",", $category); $rating_term = ''; foreach ($terms as $termid) { $rating_term .= $wpdb->get_var($wpdb->prepare("select name from " . $table_prefix . "terms where term_id = %d", array($termid))) . ','; } echo trim($rating_term, ','); echo '</td>'; $url = admin_url('admin.php'); $edit_action = add_query_arg(array('page' => 'geodirectory&tab=multirating_fields&subtab=geodir_create_rating', 'rating_cat_id' => $wnw_review->id), esc_url($url)); $delete_action = add_query_arg(array('ajax_action' => 'delete_rating_category', 'rating_cat_id' => $wnw_review->id, '_wpnonce' => $nonce), esc_url($ajax_url)); echo '<td><a href="' . $edit_action . '"> <img src="' . GEODIR_REVIEWRATING_PLUGINDIR_URL . '/images/edit.png" alt="' . __('Edit Rating', GEODIRREVIEWRATING_TEXTDOMAIN) . '" title="' . __('Edit Rating', GEODIRREVIEWRATING_TEXTDOMAIN) . '"/></a> <a href="' . $delete_action . '" onclick="return delete_rating();"> <img src="' . GEODIR_REVIEWRATING_PLUGINDIR_URL . '/images/delete.png" alt="' . __('Delete Rating', GEODIRREVIEWRATING_TEXTDOMAIN) . '" title="' . __('Delete Rating', GEODIRREVIEWRATING_TEXTDOMAIN) . '"/></a></td>'; echo '</tr>'; $counter++; } } else { echo '<tr><td colspan="7" align="center">' . __('No Record Found.', GEODIRREVIEWRATING_TEXTDOMAIN) . '</td></tr>'; } ?> </tbody> </table> </div><?php }