Ignore:
Timestamp:
03/07/2009 08:14:19 PM (3 years ago)
Author:
amir
Message:

Changed the activation code of the plugin to enable using symbolic links from the plugin's directory to our plugin directory.
Removed unused variables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/transposh.php

    r59 r60  
    278278function insert_javascript_includes() 
    279279{ 
    280     global $plugin_url, $is_edit_mode, $wp_query; 
     280    global $plugin_url, $wp_query; 
    281281 
    282282    if (!($wp_query->query_vars[EDIT_PARAM] == "1" || 
     
    752752} 
    753753 
     754/* 
     755 * Gets the plugin name to be used in activation/decativation hooks.  
     756 * Keep only the file name and its containing directory. Don't use the full 
     757 * path as it will break when using symbollic links.  
     758 */ 
     759function get_plugin_name() 
     760{ 
     761        $file = __FILE__;        
     762        $file = str_replace('\\','/',$file); // sanitize for Win32 installs 
     763        $file = preg_replace('|/+|','/', $file); // remove any duplicate slash 
     764         
     765        //keep only the file name and its parent directory 
     766        $file = preg_replace('/.*(\/[^\/]+\/[^\/]+)$/', '$1', $file); 
     767        logger("Plugin path $file", 3); 
     768        return $file; 
     769} 
     770 
    754771//Register callbacks 
    755772add_action('wp_head', 'add_custom_css'); 
     
    760777 
    761778add_action( 'plugins_loaded', 'plugin_loaded'); 
    762 add_action('activate_'.str_replace('\\','/',plugin_basename(__FILE__)),'plugin_activate'); 
    763 add_action('deactivate_'.str_replace('\\','/',plugin_basename(__FILE__)),'plugin_deactivate'); 
     779register_activation_hook(get_plugin_name(), 'plugin_activate'); 
     780register_deactivation_hook(get_plugin_name(),'plugin_deactivate'); 
    764781?> 
Note: See TracChangeset for help on using the changeset viewer.