Plugin Directory

Changeset 358149


Ignore:
Timestamp:
03/10/2011 10:40:33 AM (15 years ago)
Author:
johannesfosseus
Message:

ver 1.2

Location:
drop-zone
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • drop-zone/trunk/drop-zone.class.php

    r354491 r358149  
    1515        $thumbnail_max_height = $instance['thumbnail_max_height'];
    1616
    17         $postID = get_option($args['widget_id']);
     17        $postID = get_option($args['id']);
    1818
    1919        // check if we have a thumb and the height/width is set
     
    2323
    2424        if($postID){
     25
    2526            $post = get_post($postID); // get the post, post_excerpt
    2627            $link = get_permalink($postID);
    2728            $drop_zone_excerpt = $this->trim_excerpt($post->post_content,20); // the drop-zone excerpt
     29            $the_widgets_pos_id = substr($args['widget_id'], strpos($args['widget_id'], "-") + 1); // we need the id
    2830
    29             echo "<div class=\"widget-container\" data-url=\"".$link."\" data-index=\"0\" data-removable=\"true\" data-droppable=\"true\" data-position=\"".$args['widget_id']."\">";
     31            echo "<div class=\"widget-container\" data-url=\"".$link."\" data-index=\"0\" data-removable=\"true\" data-droppable=\"true\" data-position=\"".$args['id'].":".$the_widgets_pos_id."\">";
    3032
    3133            if($post_thumbnail_id){
     
    3436            }
    3537
    36             echo "<h3 class=\"widget-title\"><a href=\"".$link."\">".$post->post_title."</a></h3>";
     38            echo $args['before_title']."<a href=\"".$link."\">".$post->post_title."</a>".$args['after_title'];
    3739
    3840            if($show_excerpt){
     
    4244            echo "</div>";
    4345        } else {
    44             echo "<div class=\"droppable widget-container\" data-url=\"".$post->guid."\" data-index=\"0\" data-removable=\"true\" data-droppable=\"true\" data-position=\"".$args['widget_id']."\">";
     46            echo "<div class=\"droppable widget-container\" data-url=\"".$post->guid."\" data-index=\"0\" data-droppable=\"true\" data-position=\"".$args['id'].":".$the_widgets_pos_id."\">";
    4547            echo "</div>";
    4648        }
  • drop-zone/trunk/drop-zone.php

    r357616 r358149  
    55Description: Drag drop frontend widget
    66Author: Johannes Fosseus
    7 Version: 1.1
     7Version: 1.2
    88*/
    99
     
    4141// ajax callback
    4242function drop_zone_drop() {
    43     global $wpdb,$DropZone;
     43    global $wpdb,$DropZone,$wp_registered_sidebars;
     44
    4445
    4546    // secutity
     
    4950
    5051    // find the "widgets id"
    51     $widget_id = substr($_GET['infoBlock']['position'], strpos($_GET['infoBlock']['position'], "-") + 1);
     52    $widget_id = substr($_GET['infoBlock']['position'], strpos($_GET['infoBlock']['position'], ":") + 1);
     53
     54    // Find the widgets "position"
     55    list ($position, $after) = explode(':', $_GET['infoBlock']['position']);
    5256
    5357    // use it to get the specific widget options
     
    5761    $thumbnail_max_width = $instance[$widget_id]['thumbnail_max_width'];
    5862    $thumbnail_max_height = $instance[$widget_id]['thumbnail_max_height'];
    59 
    6063    $postID = url_to_postid($_GET['infoBlock']['url']); // get the postID
    6164
     
    6972        $drop_zone_excerpt = $DropZone->trim_excerpt($post->post_content,20); // the drop-zone excerpt
    7073
    71         echo "<div class=\"widget-container\" data-edited=\"true\" data-url=\"".$_GET['infoBlock']['url']."\" data-index=\"0\" data-removable=\"true\" data-droppable=\"true\" data-position=\"".$_GET['infoBlock']['position']."\">";
     74        echo "<div class=\"widget-container\" data-url=\"".$_GET['infoBlock']['url']."\" data-index=\"0\" data-removable=\"true\" data-droppable=\"true\" data-position=\"".$_GET['infoBlock']['position']."\">";
    7275
    7376        if($post_thumbnail_id){
     
    7679        }
    7780
    78         echo "<h3 class=\"widget-title\"><a href=\"".$_GET['infoBlock']['url']."\">".$post->post_title."</a></h3>";
     81        echo $wp_registered_sidebars[$position]['before_title']."<a href=\"".$_GET['infoBlock']['url']."\">".$post->post_title."</a>".$wp_registered_sidebars[$position]['after_title'];
    7982
    8083        if($show_excerpt){
     
    8588
    8689        // and svave
    87         $DropZone->save_on_drop($_GET['infoBlock']['position'],$postID);
     90        $DropZone->save_on_drop($position,$postID);
     91    }
     92
     93    // clear the supercache, if supercache is installed
     94    if(function_exists('wp_cache_clear_cache')){
     95        wp_cache_clear_cache();
    8896    }
    8997
     
    97105        die();
    98106    }
     107    list ($position, $after) = explode(':', $_POST['position']);
    99108    $postID = url_to_postid($_POST['url']);
    100     $DropZone->remove($_POST['position'],$postID);
     109    $DropZone->remove($position,$postID);
    101110    die;
    102111}
  • drop-zone/trunk/readme.txt

    r357543 r358149  
    2222== Changelog ==
    2323
     24= 1.2 =
     25* Added support for wp super cache wp_cache_clear_cache() on drop/save
     26* Bugfixing in the after/before widget settings
     27
    2428= 1.1 =
    2529* Added before and after title to the widget
Note: See TracChangeset for help on using the changeset viewer.