]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
htmloutputter->script() special cases src's that begin with plugin/ or local/ so...
authorCraig Andrews <candrews@integralblue.com>
Wed, 17 Feb 2010 17:03:14 +0000 (12:03 -0500)
committerCraig Andrews <candrews@integralblue.com>
Wed, 17 Feb 2010 17:03:14 +0000 (12:03 -0500)
Adjust plugins to not call common_path() when it's not necessary
Fix minify plugin

lib/htmloutputter.php
plugins/Autocomplete/AutocompletePlugin.php
plugins/Comet/CometPlugin.php
plugins/Facebook/FacebookPlugin.php
plugins/Facebook/facebookaction.php
plugins/InfiniteScroll/InfiniteScrollPlugin.php
plugins/Minify/MinifyPlugin.php
plugins/OStatus/OStatusPlugin.php
plugins/Orbited/OrbitedPlugin.php
plugins/Realtime/RealtimePlugin.php

index 7315fe2ad44d34c43c107af91da9bbaa6e6c595e..7786b5941e25ba770d3f11c029f360af5b322f50 100644 (file)
@@ -356,40 +356,47 @@ class HTMLOutputter extends XMLOutputter
 
             if( empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment']))
             {
-                $path = common_config('javascript', 'path');
+                if (strpos($src, 'plugins/') === 0 || strpos($src, 'local/') === 0) {
 
-                if (empty($path)) {
-                    $path = common_config('site', 'path') . '/js/';
-                }
+                    $src = common_path($src) . '?version=' . STATUSNET_VERSION;
 
-                if ($path[strlen($path)-1] != '/') {
-                    $path .= '/';
-                }
+                }else{
 
-                if ($path[0] != '/') {
-                    $path = '/'.$path;
-                }
+                    $path = common_config('javascript', 'path');
 
-                $server = common_config('javascript', 'server');
+                    if (empty($path)) {
+                        $path = common_config('site', 'path') . '/js/';
+                    }
 
-                if (empty($server)) {
-                    $server = common_config('site', 'server');
-                }
+                    if ($path[strlen($path)-1] != '/') {
+                        $path .= '/';
+                    }
 
-                $ssl = common_config('javascript', 'ssl');
+                    if ($path[0] != '/') {
+                        $path = '/'.$path;
+                    }
+
+                    $server = common_config('javascript', 'server');
 
-                if (is_null($ssl)) { // null -> guess
-                    if (common_config('site', 'ssl') == 'always' &&
-                        !common_config('javascript', 'server')) {
-                        $ssl = true;
-                    } else {
-                        $ssl = false;
+                    if (empty($server)) {
+                        $server = common_config('site', 'server');
                     }
-                }
 
-                $protocol = ($ssl) ? 'https' : 'http';
+                    $ssl = common_config('javascript', 'ssl');
 
-                $src = $protocol.'://'.$server.$path.$src . '?version=' . STATUSNET_VERSION;
+                    if (is_null($ssl)) { // null -> guess
+                        if (common_config('site', 'ssl') == 'always' &&
+                            !common_config('javascript', 'server')) {
+                            $ssl = true;
+                        } else {
+                            $ssl = false;
+                        }
+                    }
+
+                    $protocol = ($ssl) ? 'https' : 'http';
+
+                    $src = $protocol.'://'.$server.$path.$src . '?version=' . STATUSNET_VERSION;
+                }
             }
 
             $this->element('script', array('type' => $type,
index a28c65a2947841545193931fcd822d3f91179466..d586631a4a09dd4542784c1c7c0c2b239c9b137c 100644 (file)
@@ -42,8 +42,8 @@ class AutocompletePlugin extends Plugin
 
     function onEndShowScripts($action){
         if (common_logged_in()) {
-            $action->script(common_path('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js'));
-            $action->script(common_path('plugins/Autocomplete/Autocomplete.js'));
+            $action->script('plugins/Autocomplete/jquery-autocomplete/jquery.autocomplete.pack.js');
+            $action->script('plugins/Autocomplete/Autocomplete.js');
         }
     }
 
index 300d1e9a2488e7430becd87e7c5f0a95cafae092..29cb3004bf95df1ecb8543002b273aaca258e4b7 100644 (file)
@@ -68,7 +68,7 @@ class CometPlugin extends RealtimePlugin
         $ours = array('jquery.comet.js', 'cometupdate.js');
 
         foreach ($ours as $script) {
-            $scripts[] = common_path('plugins/Comet/'.$script);
+            $scripts[] = 'plugins/Comet/'.$script;
         }
 
         return $scripts;
index 4266b886d9cae1c9e9162e692de4fe5b9004ba13..78c9054e14818c1444e4d39e0173b2424b03a5e3 100644 (file)
@@ -181,7 +181,7 @@ class FacebookPlugin extends Plugin
         if ($this->reqFbScripts($action)) {
 
             $apikey      = common_config('facebook', 'apikey');
-            $plugin_path = common_path('plugins/Facebook');
+            $plugin_path = 'plugins/Facebook';
 
             $login_url  = common_local_url('FBConnectAuth');
             $logout_url = common_local_url('logout');
index 8437a705a7b7858ce5f4ecc416843ddd15182da2..f65b97c865587d10b675be04b558344b8fa3a936 100644 (file)
@@ -89,7 +89,7 @@ class FacebookAction extends Action
 
     function showScripts()
     {
-        $this->script(common_path('plugins/Facebook/facebookapp.js'));
+        $this->script('plugins/Facebook/facebookapp.js');
     }
 
     /**
index 77ad83a51bb8ecfcf1dd1ca512d787eb73cd2f37..a4d1a5d05ce11f05b43d77119a61ac91a4d3ca79 100644 (file)
@@ -40,8 +40,8 @@ class InfiniteScrollPlugin extends Plugin
 
     function onEndShowScripts($action)
     {
-        $action->script(common_path('plugins/InfiniteScroll/jquery.infinitescroll.js'));
-        $action->script(common_path('plugins/InfiniteScroll/infinitescroll.js'));
+        $action->script('plugins/InfiniteScroll/jquery.infinitescroll.js');
+        $action->script('plugins/InfiniteScroll/infinitescroll.js');
     }
 
     function onPluginVersion(&$versions)
index fe1883ded484082b4133de9e10b97da64b5ca92c..69def60641d778decdf5e3ba8bf7e3cbed2633f9 100644 (file)
@@ -86,7 +86,11 @@ class MinifyPlugin extends Plugin
         $url = parse_url($src);
         if( empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment']))
         {
-            $src = $this->minifyUrl($src);
+            if (strpos($src, 'plugins/') === 0 || strpos($src, 'local/') === 0) {
+                $src = $this->minifyUrl($src);
+            } else {
+                $src = $this->minifyUrl('js/'.$src);
+            }
         }
     }
 
index 3b1329d6c5d1ad2f926a7582c1f42041c6bc105c..a30f68cb363c2a808d489ea79b62d9afe4c1312e 100644 (file)
@@ -281,12 +281,12 @@ class OStatusPlugin extends Plugin
     }
 
     function onEndShowStatusNetStyles($action) {
-        $action->cssLink(common_path('plugins/OStatus/theme/base/css/ostatus.css'));
+        $action->cssLink('plugins/OStatus/theme/base/css/ostatus.css');
         return true;
     }
 
     function onEndShowStatusNetScripts($action) {
-        $action->script(common_path('plugins/OStatus/js/ostatus.js'));
+        $action->script('plugins/OStatus/js/ostatus.js');
         return true;
     }
 }
index ba87b266a03b2588cb62988531838dce483693c0..8af71af747246419595971f272d756128673d795 100644 (file)
@@ -77,9 +77,9 @@ class OrbitedPlugin extends RealtimePlugin
         $root = 'http://'.$server.(($port == 80) ? '':':'.$port);
 
         $scripts[] = $root.'/static/Orbited.js';
-        $scripts[] = common_path('plugins/Orbited/orbitedextra.js');
+        $scripts[] = 'plugins/Orbited/orbitedextra.js';
         $scripts[] = $root.'/static/protocols/stomp/stomp.js';
-        $scripts[] = common_path('plugins/Orbited/orbitedupdater.js');
+        $scripts[] = 'plugins/Orbited/orbitedupdater.js';
 
         return $scripts;
     }
index 6c212453e4455d12499690e2d83b7b984d70c724..e8c44a743ad2ac119bec1d8d9376367c338bc13d 100644 (file)
@@ -117,7 +117,7 @@ class RealtimePlugin extends Plugin
 
     function onEndShowStatusNetStyles($action)
     {
-        $action->cssLink(common_path('plugins/Realtime/realtimeupdate.css'),
+        $action->cssLink('plugins/Realtime/realtimeupdate.css',
                          null, 'screen, projection, tv');
         return true;
     }
@@ -307,7 +307,7 @@ class RealtimePlugin extends Plugin
 
     function _getScripts()
     {
-        return array(common_path('plugins/Realtime/realtimeupdate.js'));
+        return array('plugins/Realtime/realtimeupdate.js');
     }
 
     function _updateInitialize($timeline, $user_id)