function wpestate_pin_images()
 {
     $pins = array();
     $taxonomy = 'property_action_category';
     $tax_terms = get_terms($taxonomy);
     $taxonomy_cat = 'property_category';
     $categories = get_terms($taxonomy_cat);
     foreach ($tax_terms as $tax_term) {
         $name = sanitize_key(wpestate_limit64('wp_estate_' . $tax_term->slug));
         $limit54 = sanitize_key(wpestate_limit54($tax_term->slug));
         $pins[$limit54] = esc_html(get_option($name));
     }
     foreach ($categories as $categ) {
         $name = sanitize_key(wpestate_limit64('wp_estate_' . $categ->slug));
         $limit54 = sanitize_key(wpestate_limit54($categ->slug));
         $pins[$limit54] = esc_html(get_option($name));
     }
     foreach ($tax_terms as $tax_term) {
         foreach ($categories as $categ) {
             $limit54 = sanitize_key(wpestate_limit27($categ->slug)) . sanitize_key(wpestate_limit27($tax_term->slug));
             $name = 'wp_estate_' . $limit54;
             $pins[$limit54] = esc_html(get_option($name));
         }
     }
     $name = 'wp_estate_idxpin';
     $pins['idxpin'] = esc_html(get_option($name));
     $name = 'wp_estate_userpin';
     $pins['userpin'] = esc_html(get_option($name));
     return json_encode($pins);
 }
Example #2
0
 function wpestate_new_general_set()
 {
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         // print_r($_POST);
         $allowed_html = array();
         if (isset($_POST['add_field_name'])) {
             $new_custom = array();
             foreach ($_POST['add_field_name'] as $key => $value) {
                 $temp_array = array();
                 $temp_array[0] = $value;
                 $temp_array[1] = wp_kses($_POST['add_field_label'][sanitize_key($key)], $allowed_html);
                 $temp_array[2] = wp_kses($_POST['add_field_type'][sanitize_key($key)], $allowed_html);
                 $temp_array[3] = wp_kses($_POST['add_field_order'][sanitize_key($key)], $allowed_html);
                 $new_custom[] = $temp_array;
             }
             usort($new_custom, "wpestate_sorting_function");
             update_option('wp_estate_custom_fields', $new_custom);
         }
         // multiple currencies
         if (isset($_POST['add_curr_name'])) {
             foreach ($_POST['add_curr_name'] as $key => $value) {
                 $temp_array = array();
                 $temp_array[0] = $value;
                 $temp_array[1] = wp_kses($_POST['add_curr_label'][sanitize_key($key)], $allowed_html);
                 $temp_array[2] = wp_kses($_POST['add_curr_value'][sanitize_key($key)], $allowed_html);
                 $temp_array[3] = wp_kses($_POST['add_curr_order'][sanitize_key($key)], $allowed_html);
                 $new_custom_cur[] = $temp_array;
             }
             update_option('wp_estate_multi_curr', $new_custom_cur);
         } else {
         }
         if (isset($_POST['theme_slider'])) {
             update_option('wp_estate_theme_slider', true);
         }
         foreach ($_POST as $variable => $value) {
             if ($variable != 'submit') {
                 if ($variable != 'add_field_name' && $variable != 'add_field_label' && $variable != 'add_field_type' && $variable != 'add_field_order' && $variable != 'adv_search_how' && $variable != 'adv_search_what' && $variable != 'adv_search_label') {
                     $variable = sanitize_key($variable);
                     if ($variable == 'co_address') {
                         $allowed_html_br = array('br' => array(), 'em' => array(), 'strong' => array());
                         $postmeta = wp_kses($value, $allowed_html_br);
                     } else {
                         $postmeta = wp_kses($value, $allowed_html);
                     }
                     update_option(wpestate_limit64('wp_estate_' . $variable), $postmeta);
                 } else {
                     update_option('wp_estate_' . $variable, $value);
                 }
             }
         }
         if (isset($_POST['is_custom']) && $_POST['is_custom'] == 1 && !isset($_POST['add_field_name'])) {
             update_option('wp_estate_custom_fields', '');
         }
         if (isset($_POST['is_custom_cur']) && $_POST['is_custom_cur'] == 1 && !isset($_POST['add_curr_name'])) {
             update_option('wp_estate_multi_curr', '');
         }
         if (isset($_POST['paid_submission']) && $_POST['paid_submission'] == 'membership') {
             wp_estate_schedule_user_check();
         } else {
             wp_clear_scheduled_hook('wpestate_check_for_users_event');
         }
     }
     $allowed_html = array();
     $active_tab = isset($_GET['tab']) ? wp_kses($_GET['tab'], $allowed_html) : 'general_settings';
     print ' <div class="wrap">
     <form method="post" action="">
     <div class="wpestate-tab-wrapper-container">
     <div class="wpestate-tab-wrapper">';
     print '<div class="ourlogo"><a href="http://wpestate.org/" target="_blank"><img src="' . get_template_directory_uri() . '/img/logoadmin.png" alt="logo"></a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'general_settings' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=general_settings">' . esc_html__('General Settings', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'social_contact' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=social_contact">' . esc_html__('Social & Contact', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'appearance' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=appearance">' . esc_html__('Appearance', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'price_set' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=price_set">' . esc_html__('Price & Currency', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'mapsettings' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=mapsettings">' . esc_html__('Google Maps Settings', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'membership' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=membership">' . esc_html__('Membership & Payment Settings ', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'design' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=design">' . esc_html__('Design', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'pin_management' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=pin_management">' . esc_html__('Pin Management', 'wpestate') . '</a></div>';
     //     print '<div class="wpestate-tab-item ';
     //     print $active_tab == 'icon_management' ? 'wpestate-tab-active' : '';
     //     print'"><a href="themes.php?page=libs/theme-admin.php&tab=icon_management">'.esc_html__( 'Icon Management','wpestate').'</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'custom_fields' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=custom_fields">' . esc_html__('Listings Custom Fields', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'adv_search' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=adv_search">' . esc_html__('Advanced Search', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'display_features' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=display_features">' . esc_html__('Listings Features & Amenities ', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'listings_labels' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=listings_labels">' . esc_html__('Listings Labels', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'theme-slider' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=theme-slider">' . esc_html__('Set Theme Slider', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'help_custom' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=help_custom">' . esc_html__('Help & Custom', 'wpestate') . '</a></div>';
     print '<div class="wpestate-tab-item ';
     print $active_tab == 'generate_pins' ? 'wpestate-tab-active' : '';
     print '"><a href="themes.php?page=libs/theme-admin.php&tab=generate_pins">' . esc_html__('Generate Pins', 'wpestate') . '</a></div>';
     print '</div>';
     switch ($active_tab) {
         case "general_settings":
             wpestate_theme_admin_general_settings();
             break;
         case "social_contact":
             wpestate_theme_admin_social();
             break;
         case "appearance":
             wpestate_theme_admin_apperance();
             break;
         case "design":
             wpestate_theme_admin_design();
             break;
         case "help_custom":
             wpestate_theme_admin_help();
             break;
         case "mapsettings":
             wpestate_theme_admin_mapsettings();
             break;
         case "membership":
             wpestate_theme_admin_membershipsettings();
             break;
         case "adv_search":
             wpestate_theme_admin_adv_search();
             break;
         case "pin_management":
             wpestate_show_pins();
             break;
         case "custom_fields":
             wpestate_custom_fields();
             break;
         case "display_features":
             wpestate_display_features();
             break;
         case "listings_labels":
             wpestate_display_labels();
             break;
         case "theme-slider":
             wpestate_theme_slider();
             break;
         case "price_set":
             wpestate_price_set();
             break;
         case "generate_pins":
             wpestate_generate_file_pins();
             break;
     }
     print '</div></form></div>';
 }
Example #3
0
    function wpestate_show_pins()
    {
        $pins = array();
        $taxonomy = 'property_action_category';
        $tax_terms = get_terms($taxonomy, 'hide_empty=0');
        $taxonomy_cat = 'property_category';
        $categories = get_terms($taxonomy_cat, 'hide_empty=0');
        // add only actions
        foreach ($tax_terms as $tax_term) {
            $name = sanitize_key(wpestate_limit64('wp_estate_' . $tax_term->slug));
            $limit54 = sanitize_key(wpestate_limit54($tax_term->slug));
            $pins[$limit54] = esc_html(get_option($name));
        }
        // add only categories
        foreach ($categories as $categ) {
            $name = sanitize_key(wpestate_limit64('wp_estate_' . $categ->slug));
            $limit54 = sanitize_key(wpestate_limit54($categ->slug));
            $pins[$limit54] = esc_html(get_option($name));
        }
        // add combinations
        foreach ($tax_terms as $tax_term) {
            foreach ($categories as $categ) {
                $limit54 = sanitize_key(wpestate_limit27($categ->slug) . wpestate_limit27($tax_term->slug));
                $name = 'wp_estate_' . $limit54;
                $pins[$limit54] = esc_html(get_option($name));
            }
        }
        $name = 'wp_estate_idxpin';
        $pins['idxpin'] = esc_html(get_option($name));
        $name = 'wp_estate_userpin';
        $pins['userpin'] = esc_html(get_option($name));
        print '<div class="wpestate-tab-container">';
        print '<h1 class="wpestate-tabh1">Pin Management</h1>';
        print '<form method="post" action="">';
        $taxonomy = 'property_action_category';
        $tax_terms = get_terms($taxonomy, 'hide_empty=0');
        $taxonomy_cat = 'property_category';
        $categories = get_terms($taxonomy_cat, 'hide_empty=0');
        print '<p class="admin-exp">' . esc_html__('Add new Google Maps pins for single actions / single categories.', 'wpestate') . '</p>
        <table class="form-table">';
        foreach ($tax_terms as $tax_term) {
            $limit54 = $post_name = sanitize_key(wpestate_limit54($tax_term->slug));
            print '    
            <tr valign="top">
                <th scope="row" width="500"><label for="' . $limit54 . '">' . esc_html__('For action ', 'wpestate') . '<strong>' . $tax_term->name . ' </strong> </label></th>
                <td>
                    <input type="text"    class="pin-upload-form" size="36" name="' . $post_name . '" value="' . $pins[$limit54] . '" />
                    <input type="button"  class="upload_button button pin-upload" value="' . esc_html__('Upload Pin', 'wpestate') . '" />
                </td>
            </tr>';
        }
        foreach ($categories as $categ) {
            $limit54 = $post_name = sanitize_key(wpestate_limit54($categ->slug));
            print '    
            <tr valign="top">
                <th scope="row" width="500"><label for="' . $limit54 . '">' . esc_html__('for category: ', 'wpestate') . '<strong>' . $categ->name . ' </strong>  </label></th>
                <td>
                    <input type="text"    class="pin-upload-form" size="36" name="' . $post_name . '" value="' . $pins[$limit54] . '" />
                    <input type="button"  class="upload_button button pin-upload" value="' . esc_html__('Upload Pin', 'wpestate') . '"  />
                </td>
            </tr>';
        }
        print '</table>';
        print '<p class="admin-exp">' . esc_html__('Add new Google Maps pins for actions & categories combined (example: \'apartments in sales\')', 'wpestate') . '</p>
        <table class="form-table">';
        foreach ($tax_terms as $tax_term) {
            foreach ($categories as $categ) {
                $limit54 = sanitize_key(wpestate_limit27($categ->slug)) . sanitize_key(wpestate_limit27($tax_term->slug));
                print '    
            <tr valign="top">
                <th scope="row" width="500"><label for="' . $limit54 . '">' . esc_html__('For action', 'wpestate') . ' <strong>' . $tax_term->name . '</strong>, ' . esc_html__('category', 'wpestate') . ': <strong>' . $categ->name . '</strong>  </label></th>
                <td>
                    <input id="' . $limit54 . '" type="text" size="36" name="' . $limit54 . '" value="' . $pins[$limit54] . '" />
                    <input type="button"  class="upload_button button pin-upload" value="' . esc_html__('Upload Pin', 'wpestate') . '" />
                </td>
            </tr> 
            ';
            }
        }
        print ' 
    <tr valign="top">
        <th scope="row" width="500"><label for="idxpin">' . esc_html__('For IDX (if plugin is enabled) ', 'wpestate') . '</label></th>
        <td>
            <input id="idxpin" type="text" size="36" name="idxpin" value="' . $pins['idxpin'] . '" />
            <input type="button"  class="upload_button button pin-upload" value="' . esc_html__('Upload Pin', 'wpestate') . '" />
        </td>
   </tr> 
 
   <tr valign="top">
        <th scope="row" width="500"><label for="userpinn">' . esc_html__('Userpin in geolocation', 'wpestate') . '</label></th>
        <td>
            <input id="userpin" type="text" size="36" name="userpin" value="' . $pins['userpin'] . '" />
            <input type="button"  class="upload_button button pin-upload" value="' . esc_html__('Upload Pin', 'wpestate') . '" />
        </td>
   </tr> 

    </table>
    <p class="submit">
        <input type="submit" name="submit" id="submit" class="button-primary"  value="' . esc_html__('Save Changes', 'wpestate') . '" />
    </p>
</form>
</div>

';
    }