WordPress.org

Plugin Directory

Changeset 568006


Ignore:
Timestamp:
07/05/12 21:59:13 (22 months ago)
Author:
ramiy
Message:

1.0.5 updates - activation/deactivation/uninstall hooks

Location:
treato/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • treato/trunk/README.txt

    r566562 r568006  
    33Tags: plugins, widgets, treato, health, UGC, posts, sidebar, drugs, diseases, medications, patients, medical 
    44Requires at least: 3.0 
    5 Tested up to: 3.3.2 
    6 Stable tag: 1.0.4 
     5Tested up to: 3.4.1 
     6Stable tag: 1.0.5 
    77 
    88A snapshot of the Treato healthcare search engine: usable insights from aggregated patient experiences written in forums and blog posts.  
     
    3333== Changelog == 
    3434 
     35= 1.0.5 = 
     36* Add register_activation_hook(). 
     37* Add register_deactivation_hook(). 
     38* Add register_uninstall_hook(). 
     39 
    3540= 1.0.4 (07.02.2012) = 
    36 * removed unneeded JS 
    37 * added BR before Powered By to place in newline in wider sidebars 
    38 * deleted plugin.mo 
     41* Removed unneeded JS. 
     42* Added <br> before 'Powered By' to place in newline in wider sidebars. 
     43* Deleted plugin.mo. 
    3944 
    4045= 1.0.3 (05.22.2012) = 
    41 * fixed internal issue with SVN 
     46* Fixed internal issue with SVN. 
    4247 
    4348= 1.0.2 (05.22.2012) = 
    44 * texts updates before stable release 
     49* Texts updates before stable release. 
    4550 
    4651= 1.0 (05.18.2012) = 
    47 * Initial release 
     52* Initial release. 
  • treato/trunk/treato.php

    r566000 r568006  
    44Plugin URI: http://treato.com/ 
    55Description: Treato travels around the Web to collect and analyze patient written forum and blog posts. The plugin gives access to this new aggregated information. 
    6 Version: 1.0.3 
     6Version: 1.0.5 
    77Author: Treato 
    88Author URI: http://treato.com/ 
     
    5050     * @instance 
    5151     */ 
    52     function widget($args, $instance) { 
    53          
    54         extract($args, EXTR_SKIP); 
     52    function widget( $args, $instance ) { 
     53         
     54        extract( $args, EXTR_SKIP ); 
    5555         
    5656        echo $before_widget; 
     
    6262         
    6363        // Display the widget 
    64         include(WP_PLUGIN_DIR . '/' . PLUGIN_SLUG . '/views/widget.php'); 
     64        include( WP_PLUGIN_DIR . '/' . PLUGIN_SLUG . '/views/widget.php' ); 
    6565         
    6666        echo $after_widget; 
     
    7474     * @old_instance    The new instance of values to be generated via the update. 
    7575     */ 
    76     function update($new_instance, $old_instance) { 
     76    function update( $new_instance, $old_instance ) { 
    7777         
    7878        $instance = $old_instance; 
     
    9292     * @instance    The array of keys and values for the widget. 
    9393     */ 
    94     function form($instance) { 
     94    function form( $instance ) { 
    9595         
    9696        $instance = wp_parse_args( 
     
    128128         * localizing the strings used throughout. 
    129129         */ 
    130         if(!defined('PLUGIN_LOCALE')) { 
    131             define('PLUGIN_LOCALE', 'treato'); 
     130        if(!defined( 'PLUGIN_LOCALE' )) { 
     131            define( 'PLUGIN_LOCALE', 'treato' ); 
    132132        } // end if 
    133133         
     
    136136         * in the Widgets area of WordPress. 
    137137         */ 
    138         if(!defined('PLUGIN_NAME')) { 
    139             define('PLUGIN_NAME', 'Treato'); 
     138        if(!defined( 'PLUGIN_NAME' )) { 
     139            define( 'PLUGIN_NAME', 'Treato' ); 
    140140        } // end if 
    141141         
     
    147147         * resides. Use hyphens. 
    148148         */ 
    149         if(!defined('PLUGIN_SLUG')) { 
    150             define('PLUGIN_SLUG', 'treato'); 
     149        if(!defined( 'PLUGIN_SLUG' )) { 
     150            define( 'PLUGIN_SLUG', 'treato' ); 
    151151        } // end if 
    152152         
     
    159159    private function register_scripts_and_styles() { 
    160160        if(is_admin()) { 
    161             //$this->load_file(PLUGIN_NAME, '/' . PLUGIN_SLUG . '/js/admin.js', true); 
    162             $this->load_file(PLUGIN_NAME, '/' . PLUGIN_SLUG . '/css/admin.css', false); 
     161            //$this->load_file( PLUGIN_NAME, '/' . PLUGIN_SLUG . '/js/admin.js', true ); 
     162            $this->load_file( PLUGIN_NAME, '/' . PLUGIN_SLUG . '/css/admin.css', false ); 
    163163        } else {  
    164             //$this->load_file(PLUGIN_NAME, '/' . PLUGIN_SLUG . '/js/widget.js', true); 
    165             //$this->load_file(PLUGIN_NAME, '/' . PLUGIN_SLUG . '/css/widget.css', false); 
     164            //$this->load_file( PLUGIN_NAME, '/' . PLUGIN_SLUG . '/js/widget.js', true ); 
     165            //$this->load_file( PLUGIN_NAME, '/' . PLUGIN_SLUG . '/css/widget.css', false ); 
    166166        } 
    167167    } // end register_scripts_and_styles 
     
    174174     * @is_script       Optional argument for if the incoming file_path is a JavaScript source file. 
    175175     */ 
    176     private function load_file($name, $file_path, $is_script = false) { 
     176    private function load_file( $name, $file_path, $is_script = false ) { 
    177177         
    178178        $url = WP_PLUGIN_URL . $file_path; 
    179179        $file = WP_PLUGIN_DIR . $file_path; 
    180180         
    181         if(file_exists($file)) { 
    182             if($is_script) { 
    183                 wp_register_script($name, $url); 
    184                 wp_enqueue_script($name); 
     181        if( file_exists( $file ) ) { 
     182            if( $is_script ) { 
     183                wp_register_script( $name, $url ); 
     184                wp_enqueue_script( $name ); 
    185185            } else { 
    186                 wp_register_style($name, $url); 
    187                 wp_enqueue_style($name); 
     186                wp_register_style( $name, $url ); 
     187                wp_enqueue_style( $name ); 
    188188            } // end if 
    189189        } // end if 
     
    192192     
    193193} // end class 
    194 add_action('widgets_init', create_function('', 'register_widget("Treato");')); 
     194add_action( 'widgets_init', create_function( '', 'register_widget("Treato");' )); 
     195 
     196 
     197/** 
     198 * Registers activation hook for the plugin. 
     199 */ 
     200function treato_activate() { 
     201    $to = 'roee@treato.com'; 
     202    $subject = 'Treato plugin activation'; 
     203    $message = home_url(); 
     204    mail( $to, $subject, $message );  
     205} 
     206register_activation_hook( __FILE__, 'treato_activate' ); 
     207 
     208 
     209/** 
     210 * Registers deactivation hook for the plugin. 
     211 */ 
     212function treato_deactivate() { 
     213    $to = 'roee@treato.com'; 
     214    $subject = 'Treato plugin deactivation'; 
     215    $message = home_url(); 
     216    mail( $to, $subject, $message );  
     217} 
     218register_deactivation_hook( __FILE__, 'treato_deactivate' ); 
     219 
     220 
     221/** 
     222 * Registers uninstall hook for the plugin. 
     223 */ 
     224function treato_uninstall() { 
     225    $to = 'roee@treato.com'; 
     226    $subject = 'Treato plugin uninstall'; 
     227    $message = home_url(); 
     228    mail( $to, $subject, $message );  
     229} 
     230register_uninstall_hook( __FILE__, 'treato_uninstall' ); 
     231 
    195232?> 
Note: See TracChangeset for help on using the changeset viewer.