Plugin Directory

Changeset 963041


Ignore:
Timestamp:
08/09/2014 02:52:03 PM (12 years ago)
Author:
ryan_xantoo
Message:

3.0 Release including Image Uploading.

Location:
map-contact/trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • map-contact/trunk/admin/add_new_address.php

    r958909 r963041  
    66        global $wpdb;
    77
     8        wp_enqueue_script('jquery');
     9        wp_enqueue_script('media-upload');
     10        wp_enqueue_script('thickbox');
     11        wp_register_script('my-upload', plugin_dir_url(__FILE__).'media_uploader.js', array('jquery','media-upload','thickbox'));
     12        wp_enqueue_script('my-upload');
     13        wp_enqueue_style('thickbox');
     14
    815        if ($_POST["submit"])
    916        {
    10             $wpdb->query("INSERT INTO ".$wpdb->prefix."map_addresses VALUES('','".trim($_POST["name"])."','".trim($_POST["infowindow"])."','".trim($_POST["email"])."','".trim($_POST["address"])."')");
     17            $wpdb->query("INSERT INTO ".$wpdb->prefix."map_addresses VALUES('','".$_POST["image_location"]."','".trim($_POST["name"])."','".trim($_POST["infowindow"])."','".trim($_POST["email"])."','".trim($_POST["address"])."')");
    1118            echo "<div class='updated'> <p>New address has been added!</p> </div>";
    1219        }
     
    1522        <form action='".$URL."' method='POST'>
    1623        <table style='padding-top:10px;'>
     24        <tr><td style='width:200px;'>Image:</td><td style='width:300px;'><input type='text'  name='image_location' value='' style='width:63.01%;' /><input type='button' class='upload-button' value='Upload Image' /></td></tr>
    1725        <tr><td style='width:200px;'>Contact Name:</td><td style='width:300px;'><input style='width:100%;' type='text' name='name'></td></tr>
    1826        <tr><td style='width:200px;'>Address:</td><td style='width:300px;'><input style='width:100%;' type='text' name='address'></td></tr>
    19         <tr><td style='width:200px;'>Info Window HTML:</td><td style='max-width:300px; width:300px;'><textarea style='max-width: 100%; max-height: 106px; width:100%; height: 106px;' name='infowindow'></textarea></td></tr>
     27        <tr><td style='width:200px;'>Info Window HTML:</td><td style='max-width:300px; width:300px;'><textarea style='max-width: 100%; max-height: 106px; width:100%; height: 106px;' name='infowindow'><h2>Your Name Here!</h2><img src='[IMAGE_URL]'><div>Your Info Window description here!</div></textarea></td></tr>
    2028        <tr><td style='width:200px;'>Email:</td><td style='width:300px;'><input style='width:100%;' type='text' name='email'></td></tr>
    2129        </table>";
    2230        submit_button('Add Address', 'submit', 'submit');
    2331        echo "</form>";
     32
    2433        ?>
    2534    </div>
  • map-contact/trunk/admin/map_addresses.php

    r958909 r963041  
    77        $columns = array(
    88            'id' => 'ID',
     9            'image'    => 'Image',
    910            'name'    => 'Name',
    1011            'address'      => 'Address',
     
    5657                $row = $wpdb->get_var("SELECT $element FROM ".$wpdb->prefix."map_settings WHERE id='".$id."'");
    5758
    58                 if (@mysql_fetch_array($result) !== false && !empty($id) && !empty($element))
     59                if (@mysql_fetch_array($result) !== false && !empty($id) && !empty($element) && !empty($value))
    5960                {
    6061                    $wpdb->query("UPDATE ".$wpdb->prefix."map_addresses SET $element='".$value."' WHERE id='".$id."'");
     
    9091
    9192        $addressess = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."map_addresses");
     93        $imported = false;
    9294        foreach ($addressess as $address)
    9395        {
    9496            $address = get_object_vars($address);
    95             $listTable->data[] = array("id" => $address["id"],"name" => "<input name='".$address["id"]."_"."name"."' type='text' style='width:100%;' value='".$address["name"]."'>","infowindow" => "<textarea name='".$address["id"]."_"."infowindow"."' style='max-width: 100%; max-height: 106px;width:100%; height:106px;'>".$address["infoWindow"]."</textarea>","address" => "<input name='".$address["id"]."_"."address"."' type='text' style='width:100%;' value='".$address["address"]."'>","email" => "<input name='".$address["id"]."_"."email"."' type='text' style='width:100%;' value='".$address["email"]."'>", "delete" => "<div style='height:106px; line-height:106px; text-align:center;'><form id='delete' action='".$URL."' method='POST'><input type='submit' value='Delete' name='".$address['id']."_delete'></form></div>");
     97
     98            if (!empty($address["image"]) && $imported==false)
     99            {
     100                wp_enqueue_script('jquery');
     101                wp_enqueue_script('media-upload');
     102                wp_enqueue_script('thickbox');
     103                wp_register_script('my-upload', plugin_dir_url(__FILE__).'media_uploader.js', array('jquery','media-upload','thickbox'));
     104                wp_enqueue_script('my-upload');
     105                wp_enqueue_style('thickbox');
     106                $imported = true;
     107            }
     108
     109            $image = "<div style='width:100%; text-align:center;'><img src='".$address["image"]."' style='max-width:100%;' /></div>"."<div style='text-align:center;'><input type='hidden'  name='".$address["id"]."_image' value='' style='width:63.01%;' /><input type='button' class='upload-button' value='Change Image' /></div>";
     110
     111            $listTable->data[] = array("id" => $address["id"],"image" => $image,"name" => "<input name='".$address["id"]."_"."name"."' type='text' style='width:100%;' value='".$address["name"]."'>","infowindow" => "<textarea name='".$address["id"]."_"."infowindow"."' style='max-width: 100%; max-height: 106px;width:100%; height:106px;'>".$address["infoWindow"]."</textarea>","address" => "<input name='".$address["id"]."_"."address"."' type='text' style='width:100%;' value='".$address["address"]."'>","email" => "<input name='".$address["id"]."_"."email"."' type='text' style='width:100%;' value='".$address["email"]."'>", "delete" => "<div style='height:106px; line-height:106px; text-align:center;'><form id='delete' action='".$URL."' method='POST'><input type='submit' value='Delete' name='".$address['id']."_delete'></form></div>");
    96112        }
    97113
  • map-contact/trunk/includes/stylesheet.css

    r958909 r963041  
    1111{
    1212    background-color: #FFFFFF;
    13     border: 1px solid #DBDBDB !important;
    14     border-radius: 0px !important;
    15     -moz-border-radius: 0px !important;
    16     -webkit-border-radius: 0px !important;
     13    border: 1px solid #DBDBDB;
     14    border-radius: 0px;
     15    -moz-border-radius: 0px;
     16    -webkit-border-radius: 0px;
    1717    padding: 10px 10px 10px 10px;
    18     box-shadow: 5px 5px 2px 2px #DBDBDB !important;
    19     -moz-box-shadow: 5px 5px 2px 2px #DBDBDB !important;
    20     -webkit-box-shadow: 5px 5px 2px 2px #DBDBDB !important;
     18    box-shadow: 5px 5px 2px 2px #DBDBDB;
     19    -moz-box-shadow: 5px 5px 2px 2px #DBDBDB;
     20    -webkit-box-shadow: 5px 5px 2px 2px #DBDBDB;
    2121}
    2222.lightbox {
     
    2828    background:rgba(0, 0, 0, .8);
    2929}
     30.person_entry img
     31{
     32    width: 35%;
     33    float: left;
     34    text-align: center;
     35    margin-right:14px;
     36    background: #FFFFFF;
     37    border: 1px solid #DBDBDB;
     38    padding: 2px; border-radius: 200px;
     39    -moz-border-radius: 200px !important;
     40    -webkit-border-radius: 200px !important;
     41    box-sizing: border-box !important;
     42    -moz-box-sizing: border-box !important;
     43    -webkit-box-sizing: border-box !important;
     44}
  • map-contact/trunk/map-contact.php

    r960722 r963041  
    66    Plugin URI: http://wordpress.org/plugins/map-contact/
    77    Author URI: http://xantoo.com/
    8     Version: 2.0.4
     8    Version: 3.0
    99 */
    1010
     
    4848
    4949                $address["infoWindow"] = trim(preg_replace('/\s\s+/', ' ', $address["infoWindow"]));
    50                 $map->addLocationPin($loc["lat"],$loc["lng"],$address["name"],"<div style='max-width:250px; padding-bottom:10px;'>".preg_replace("/<img[^>]+\>/i", "", $address["infoWindow"])."</div>");
     50                $iw = preg_replace("/<img[^>]+\>/i", "", $address["infoWindow"]);
     51                $map->addLocationPin($loc["lat"],$loc["lng"],$address["name"],"<div style='max-width:250px; padding-bottom:10px;'>".$iw."</div>");
    5152            }
    5253        }
     
    6768        foreach ($addresses as $address) {
    6869            $address = get_object_vars($address);
     70            $contact = "";
     71            if (!empty($address["image"])) { $address["infoWindow"] = preg_replace("/".preg_quote("[IMAGE_URL]")."/i",$address["image"],$address["infoWindow"]); }
     72
    6973            if (!empty($address["email"])){
    7074                $contact = '<button type="button" onclick="document.getElementById(\''.$address["id"].'_lightbox\').style.display=\'inline\';" >Contact by email</button>';
     75
    7176                if (strpos($_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"],"http")!==true) { $URL = "http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } else { $URL = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; }
    7277
     
    187192        dbDelta( "CREATE TABLE ".$wpdb->prefix."map_addresses (
    188193        `id` int(11) NOT NULL AUTO_INCREMENT,
     194        `image` text NOT NULL,
    189195        `name` text NOT NULL,
    190196        `infoWindow` text NOT NULL,
     
    201207        else
    202208        {
    203             $wpdb->get_var("INSERT INTO ".$wpdb->prefix."map_addresses"." VALUES('','Ryan Smith','<h2>Ryan Smith</h2> <img src=\'http://www.w3.org/html/logo/downloads/HTML5_Logo_256.png\' style=\'width: 35% !important; float: left !important; text-align: center; margin-right:14px; background: #FFFFFF !important; border: 1px solid #DBDBDB !important; padding: 2px !important; border-radius: 200px !important; -moz-border-radius: 200px !important; -webkit-border-radius: 200px !important; box-sizing: border-box !important; -moz-box-sizing: border-box !important; -webkit-box-sizing: border-box !important;\'><div>Ryan, our lead developer on Map Contact is located in Greater London!</div>','ryan@xantoo.com','London')");
    204             $wpdb->get_var("INSERT INTO ".$wpdb->prefix."map_addresses"." VALUES('','James Smith','<h2>James Smith</h2><img src=\'http://a1.res.cloudinary.com/hvqqwrowv/image/asset/css3-65bdc13faee51df7f05b91f44414a80d.png\' style=\'width: 35% !important; float: left !important; text-align: center; margin-right:14px; background: #FFFFFF !important; border: 1px solid #DBDBDB !important; padding: 2px !important; border-radius: 200px !important; -moz-border-radius: 200px !important; -webkit-border-radius: 200px !important; box-sizing: border-box !important; -moz-box-sizing: border-box !important; -webkit-box-sizing: border-box !important;\'><div>James, our lead marketer on Map Contact is located in Greater London!</div>','james@xantoo.com','London')");
    205         }
    206     }
     209            $wpdb->get_var("INSERT INTO ".$wpdb->prefix."map_addresses"." VALUES('','http://www.w3.org/html/logo/downloads/HTML5_Logo_256.png','Ryan Smith',\"<h2>Ryan Smith</h2><img src='[IMAGE_URL]'><div>Ryan, our lead developer on Map Contact is located in Greater London!</div>\",'ryan@xantoo.com','London')");
     210            $wpdb->get_var("INSERT INTO ".$wpdb->prefix."map_addresses"." VALUES('','http://a1.res.cloudinary.com/hvqqwrowv/image/asset/css3-65bdc13faee51df7f05b91f44414a80d.png','James Smith',\"<h2>James Smith</h2><img src='[IMAGE_URL]'><div>James, our lead marketer on Map Contact is located in Greater London!</div>\",'james@xantoo.com','London')");
     211        }
     212    }
     213}
     214
     215function updatePlugin()
     216{
     217    //2.1 UPDATE
     218    global $wpdb;
     219
     220    $result = $wpdb->get_var("SHOW COLUMNS FROM `wp_map_addresses` LIKE 'image'");
     221
     222    if (!$result) { $wpdb->query("ALTER TABLE wp_map_addresses ADD COLUMN `image` text NOT NULL AFTER `ID`"); }
    207223}
    208224
     
    212228add_shortcode( 'map-contact', 'shortcodeManagment' );
    213229register_activation_hook( __FILE__, "pluginActivated");
     230add_action( 'admin_init', 'updatePlugin' );
    214231?>
  • map-contact/trunk/readme.txt

    r960722 r963041  
    2323* Fully cross browser compliant including IE7 to IE11.
    2424* Mobile device optimized, all tablets and phones.
    25 * Click on map markets to open the persons profile as well as displaying the persons profile under the map.
     25* Click on map markers to open the persons profile as well as displaying the persons profile under the map.
     26* Upload and change contact images in seconds.
    2627
    2728= To-Do =
    28 
    29 * Profile Pictures upload via admin, currently only available by uploading picture manually and pasting link
    30 into html code.
    31 
    3229
    3330* If you have any suggestions what so ever please dont hesitate to leave feedback.
     
    6158=
    6259
     60= 3.0 - 09/08/2014 =
     61*  Upload and change contact images, without having to put code!
     62
    6363= 2.0.4 - 05/08/2014 =
    6464*  Bug Fixes
Note: See TracChangeset for help on using the changeset viewer.