]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Use script() and cssLink() methods everywhere instead of manually writing out javascr...
authorCraig Andrews <candrews@integralblue.com>
Wed, 5 Aug 2009 23:45:12 +0000 (19:45 -0400)
committerCraig Andrews <candrews@integralblue.com>
Wed, 5 Aug 2009 23:45:12 +0000 (19:45 -0400)
actions/avatarsettings.php
actions/grouplogo.php
lib/action.php
lib/designsettings.php
lib/facebookaction.php

index c2bb35a39580153a4b696015d104b42b4fb6b104..38e3103f4a0cff33e7725348eaec578d467d964f 100644 (file)
@@ -382,13 +382,7 @@ class AvatarsettingsAction extends AccountSettingsAction
     function showStylesheets()
     {
         parent::showStylesheets();
-        $jcropStyle =
-          common_path('theme/base/css/jquery.Jcrop.css?version='.LACONICA_VERSION);
-
-        $this->element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => $jcropStyle,
-                                     'media' => 'screen, projection, tv'));
+        $this->cssLink('css/jquery.Jcrop.css','base','screen, projection, tv');
     }
 
     /**
@@ -402,13 +396,8 @@ class AvatarsettingsAction extends AccountSettingsAction
         parent::showScripts();
 
         if ($this->mode == 'crop') {
-            $jcropPack = common_path('js/jcrop/jquery.Jcrop.pack.js');
-            $jcropGo   = common_path('js/jcrop/jquery.Jcrop.go.js');
-
-            $this->element('script', array('type' => 'text/javascript',
-                                           'src' => $jcropPack));
-            $this->element('script', array('type' => 'text/javascript',
-                                           'src' => $jcropGo));
+            $this->script('js/jcrop/jquery.Jcrop.pack.js');
+            $this->script('js/jcrop/jquery.Jcrop.go.js');
         }
     }
 }
index 8f6158dacaafbbd9626b525284745d3451c3f548..5edb10cf8aba5f7c6b13beeb8a438563867753d9 100644 (file)
@@ -428,13 +428,7 @@ class GrouplogoAction extends GroupDesignAction
     function showStylesheets()
     {
         parent::showStylesheets();
-        $jcropStyle =
-          common_path('theme/base/css/jquery.Jcrop.css?version='.LACONICA_VERSION);
-
-        $this->element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => $jcropStyle,
-                                     'media' => 'screen, projection, tv'));
+        $this->cssLink('css/jquery.Jcrop.css','base','screen, projection, tv');
     }
 
     /**
@@ -448,13 +442,8 @@ class GrouplogoAction extends GroupDesignAction
         parent::showScripts();
 
         if ($this->mode == 'crop') {
-            $jcropPack = common_path('js/jcrop/jquery.Jcrop.pack.js');
-            $jcropGo   = common_path('js/jcrop/jquery.Jcrop.go.js');
-
-            $this->element('script', array('type' => 'text/javascript',
-                                           'src' => $jcropPack));
-            $this->element('script', array('type' => 'text/javascript',
-                                           'src' => $jcropGo));
+            $this->script('js/jcrop/jquery.Jcrop.pack.js');
+            $this->script('js/jcrop/jquery.Jcrop.go.js');
         }
     }
 
index a5244371a5def60d0bf6635336044dba41a36185..1c6170693f46deaed714764aa70596c462e44b2b 100644 (file)
@@ -193,21 +193,12 @@ class Action extends HTMLOutputter // lawsuit
         if (Event::handle('StartShowStyles', array($this))) {
 
             if (Event::handle('StartShowLaconicaStyles', array($this))) {
-                $this->element('link', array('rel' => 'stylesheet',
-                                             'type' => 'text/css',
-                                             'href' => theme_path('css/display.css', null) . '?version=' . LACONICA_VERSION,
-                                             'media' => 'screen, projection, tv'));
+                $this->cssLink('css/display.css',null,'screen, projection, tv');
                 if (common_config('site', 'mobile')) {
-                    $this->element('link', array('rel' => 'stylesheet',
-                                                 'type' => 'text/css',
-                                                 'href' => theme_path('css/mobile.css', 'base') . '?version=' . LACONICA_VERSION,
-                                                 // TODO: "handheld" CSS for other mobile devices
-                                                 'media' => 'only screen and (max-device-width: 480px)')); // Mobile WebKit
+                    // TODO: "handheld" CSS for other mobile devices
+                    $this->cssLink('css/mobile.css','base','only screen and (max-device-width: 480px)'); // Mobile WebKit
                 }
-                $this->element('link', array('rel' => 'stylesheet',
-                                             'type' => 'text/css',
-                                             'href' => theme_path('css/print.css', 'base') . '?version=' . LACONICA_VERSION,
-                                             'media' => 'print'));
+                $this->cssLink('css/print.css','base','print');
                 Event::handle('EndShowLaconicaStyles', array($this));
             }
 
@@ -253,26 +244,14 @@ class Action extends HTMLOutputter // lawsuit
     {
         if (Event::handle('StartShowScripts', array($this))) {
             if (Event::handle('StartShowJQueryScripts', array($this))) {
-                $this->element('script', array('type' => 'text/javascript',
-                                               'src' => common_path('js/jquery.min.js')),
-                               ' ');
-                $this->element('script', array('type' => 'text/javascript',
-                                               'src' => common_path('js/jquery.form.js')),
-                               ' ');
-
-                $this->element('script', array('type' => 'text/javascript',
-                                               'src' => common_path('js/jquery.joverlay.min.js')),
-                               ' ');
-
+                $this->script('js/jquery.min.js');
+                $this->script('js/jquery.form.js');
+                $this->script('js/jquery.joverlay.min.js');
                 Event::handle('EndShowJQueryScripts', array($this));
             }
             if (Event::handle('StartShowLaconicaScripts', array($this))) {
-                $this->element('script', array('type' => 'text/javascript',
-                                               'src' => common_path('js/xbImportNode.js')),
-                               ' ');
-                $this->element('script', array('type' => 'text/javascript',
-                                               'src' => common_path('js/util.js?version='.LACONICA_VERSION)),
-                               ' ');
+                $this->script('js/xbImportNode.js');
+                $this->script('js/util.js');
                 // Frame-busting code to avoid clickjacking attacks.
                 $this->element('script', array('type' => 'text/javascript'),
                                'if (window.top !== window.self) { window.top.location.href = window.self.location.href; }');
index 1b0e62166926ac7dbe60db6b5b1a8058fd862b68..a48ec9d2274531fecdfd24a39af3f3080dfdabee 100644 (file)
@@ -311,13 +311,7 @@ class DesignSettingsAction extends AccountSettingsAction
     function showStylesheets()
     {
         parent::showStylesheets();
-        $farbtasticStyle =
-          common_path('theme/base/css/farbtastic.css?version='.LACONICA_VERSION);
-
-        $this->element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => $farbtasticStyle,
-                                     'media' => 'screen, projection, tv'));
+        $this->cssLink('css/farbtastic.css','base','screen, projection, tv');
     }
 
     /**
@@ -330,13 +324,8 @@ class DesignSettingsAction extends AccountSettingsAction
     {
         parent::showScripts();
 
-        $farbtasticPack = common_path('js/farbtastic/farbtastic.js');
-        $userDesignGo   = common_path('js/userdesign.go.js');
-
-        $this->element('script', array('type' => 'text/javascript',
-                                       'src' => $farbtasticPack));
-        $this->element('script', array('type' => 'text/javascript',
-                                       'src' => $userDesignGo));
+        $this->script('js/farbtastic/farbtastic.js');
+        $this->script('js/farbtastic/farbtastic.go.js');
     }
 
     /**
index 5be2f2fe6603f9296a870e4ad7f99ae9b47dcb0f..ab11b613ed781709b3ef249696ee81b1a41beb0e 100644 (file)
@@ -95,34 +95,13 @@ class FacebookAction extends Action
 
     function showStylesheets()
     {
-        // Add a timestamp to the file so Facebook cache wont ignore our changes
-        $ts = filemtime(INSTALLDIR.'/theme/base/css/display.css');
-
-    $this->element('link', array('rel' => 'stylesheet',
-               'type' => 'text/css',
-               'href' => theme_path('css/display.css', 'base') . '?ts=' . $ts));
-
-        $theme = common_config('site', 'theme');
-
-        $ts = filemtime(INSTALLDIR. '/theme/' . $theme .'/css/display.css');
-
-        $this->element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => theme_path('css/display.css', null) . '?ts=' . $ts));
-
-        $ts = filemtime(INSTALLDIR.'/theme/base/css/facebookapp.css');
-
-        $this->element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => theme_path('css/facebookapp.css', 'base') . '?ts=' . $ts));
+        $this->cssLink('css/display.css', 'base');
+        $this->cssLink('css/facebookapp.css', 'base');
     }
 
     function showScripts()
     {
-        // Add a timestamp to the file so Facebook cache wont ignore our changes
-        $ts = filemtime(INSTALLDIR.'/js/facebookapp.js');
-
-        $this->element('script', array('src' => common_path('js/facebookapp.js') . '?ts=' . $ts));
+        $this->script('js/facebookapp.js');
     }
 
     /**