Assembla home | Assembla project page
 

Changeset 79

Show
Ignore:
Timestamp:
02/26/08 22:15:40 (9 months ago)
Author:
Seldaek
Message:

* Base: fixes tinyUrl encoding of #anchors

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Phergie/Plugin/Abstract/Base.php

    r78 r79  
    4646 
    4747    /** 
    48     * Reference to the current instance of the plugin, used to make its  
     48    * Reference to the current instance of the plugin, used to make its 
    4949    * non-static methods accessible to other plugins 
    5050    * 
     
    189189    { 
    190190        if (strlen($url) > 30) { 
    191             $tiny = @file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode($url)); 
     191                $opts = array('http' => 
     192                    array( 
     193                        'timeout' => 4, 
     194                        'method' => 'POST', 
     195                        'header' => 'Content-type: application/x-www-form-urlencoded', 
     196                        'content' => http_build_query(array('url' => $url)) 
     197                    ) 
     198                ); 
     199                $context = stream_context_create($opts); 
     200                $tiny = @file_get_contents('http://tinyurl.com/api-create.php', false, $context); 
    192201            if (empty($tiny)) { 
    193202                $tiny = $url; 
     
    211220 
    212221    /** 
    213     * Returns whether or not the current environment meets the requirements  
    214     * of the plugin in order for it to be run, including the PHP version,  
    215     * loaded PHP extensions, and other plugins intended to be loaded.  
     222    * Returns whether or not the current environment meets the requirements 
     223    * of the plugin in order for it to be run, including the PHP version, 
     224    * loaded PHP extensions, and other plugins intended to be loaded. 
    216225    * Plugins with such requirements should override this method. 
    217226    * 
    218     * @param array $plugins List of short names for plugins that the  
     227    * @param array $plugins List of short names for plugins that the 
    219228    *                       bootstrap file intends to instantiate 
    220229    * @return bool TRUE if dependencies are met, FALSE otherwise