]> git.mxchange.org Git - friendica.git/commitdiff
Replace current_theme() and current_theme_url() calls
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 28 Apr 2018 22:37:04 +0000 (18:37 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Sat, 28 Apr 2018 22:37:25 +0000 (18:37 -0400)
include/text.php
index.php
src/Core/Addon.php
src/Core/Theme.php
src/Model/Profile.php
src/Render/FriendicaSmarty.php
src/Render/FriendicaSmartyEngine.php
view/theme/frio/php/frio_boot.php
view/theme/frio/php/scheme.php

index 5e189d58f14857f480d4b291e8d513a16dacc0b3..52b51bdb0cd1e34c71389134f738cca04aee01cb 100644 (file)
@@ -513,7 +513,7 @@ function load_view_file($s) {
                return $content;
        }
 
-       $theme = current_theme();
+       $theme = $a->getCurrentTheme();
 
        if (file_exists("$d/theme/$theme/$b")) {
                $stamp1 = microtime(true);
index 2f23ea791a6e525009f5109652c911742c18096c..b7ae6f1d4ada6a9457c526cd17f40116e0d7a8d8 100644 (file)
--- a/index.php
+++ b/index.php
@@ -330,7 +330,7 @@ if (strlen($a->module)) {
 /**
  * Load current theme info
  */
-$theme_info_file = "view/theme/".current_theme()."/theme.php";
+$theme_info_file = 'view/theme/' . $a->getCurrentTheme() . '/theme.php';
 if (file_exists($theme_info_file)) {
        require_once $theme_info_file;
 }
@@ -363,8 +363,8 @@ if ($a->module_loaded) {
                $func($a);
        }
 
-       if (function_exists(str_replace('-', '_', current_theme()) . '_init')) {
-               $func = str_replace('-', '_', current_theme()) . '_init';
+       if (function_exists(str_replace('-', '_', $a->getCurrentTheme()) . '_init')) {
+               $func = str_replace('-', '_', $a->getCurrentTheme()) . '_init';
                $func($a);
        }
 
@@ -402,8 +402,8 @@ if ($a->module_loaded) {
                $a->page['content'] .= $arr['content'];
        }
 
-       if (function_exists(str_replace('-', '_', current_theme()) . '_content_loaded')) {
-               $func = str_replace('-', '_', current_theme()) . '_content_loaded';
+       if (function_exists(str_replace('-', '_', $a->getCurrentTheme()) . '_content_loaded')) {
+               $func = str_replace('-', '_', $a->getCurrentTheme()) . '_content_loaded';
                $func($a);
        }
 }
@@ -478,7 +478,7 @@ if ($a->is_mobile || $a->is_tablet) {
  */
 
 if (!$a->theme['stylesheet']) {
-       $stylesheet = current_theme_url();
+       $stylesheet = $a->getCurrentThemeStylesheetPath();
 } else {
        $stylesheet = $a->theme['stylesheet'];
 }
index 3adc7fc0ec284d0714fa96135a42c8e8ff161287..50247d240f42fbffb1480493273b3416412c59a4 100644 (file)
@@ -228,14 +228,15 @@ class Addon
        /**
         * @brief Calls a single hook.
         *
-        * @param string $name of the hook to call
-        * @param array $hook Hook data
-        * @param string|array &$data to transmit to the callback handler
+        * @param \Friendica\App $a
+        * @param string         $name of the hook to call
+        * @param array          $hook Hook data
+        * @param string|array   &$data to transmit to the callback handler
         */
-       public static function callSingleHook($a, $name, $hook, &$data = null)
+       public static function callSingleHook(\Friendica\App $a, $name, $hook, &$data = null)
        {
                // Don't run a theme's hook if the user isn't using the theme
-               if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/'.current_theme()) === false) {
+               if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . $a->getCurrentTheme()) === false) {
                        return;
                }
 
index fe38d09ede3ea0bbd06a6c4f518ce75c6d99b348..c64ed08d3babdd315dd570c041878c89b8ea644d 100644 (file)
@@ -162,7 +162,7 @@ class Theme
                } else {
                        $parent = 'NOPATH';
                }
-               $theme = current_theme();
+               $theme = get_app()->getCurrentTheme();
                $thname = $theme;
                $ext = substr($file, strrpos($file, '.') + 1);
                $paths = [
index d4773a806233795bbe51ff42873e828ebaff01df..8bb519448e32d18a2fd179f7fe881b0668ab86c4 100644 (file)
@@ -152,7 +152,7 @@ class Profile
 
                $a->set_template_engine(); // reset the template engine to the default in case the user's theme doesn't specify one
 
-               $theme_info_file = 'view/theme/' . current_theme() . '/theme.php';
+               $theme_info_file = 'view/theme/' . $a->getCurrentTheme() . '/theme.php';
                if (file_exists($theme_info_file)) {
                        require_once $theme_info_file;
                }
index ab19993081a293e972e95769861281a7e11a345d..8c8e637630dd1c37214dd2537d46a951cd805f27 100644 (file)
@@ -22,7 +22,7 @@ class FriendicaSmarty extends Smarty
                parent::__construct();
 
                $a = get_app();
-               $theme = current_theme();
+               $theme = $a->getCurrentTheme();
 
                // setTemplateDir can be set to an array, which Smarty will parse in order.
                // The order is thus very important here
index 949ac58c82d1f4b1a82c9babeac4acc1a7ea512e..c6e95ee068498ca0505577597057e761f5ac273e 100644 (file)
@@ -62,7 +62,7 @@ class FriendicaSmartyEngine implements ITemplateEngine
                        $root = $root . '/';
                }
 
-               $theme = current_theme();
+               $theme = $a->getCurrentTheme();
                $filename = $template::SMARTY3_TEMPLATE_FOLDER . '/' . $file;
 
                if (file_exists("{$root}view/theme/$theme/$filename")) {
index 243ea5c72c4aeb46b1dd9c11e53fb9b50e5fb533..3f8ed1ed0b0e87a857aff5e56c84781768d8bbff 100644 (file)
@@ -21,12 +21,12 @@ function load_page(App $a)
        } elseif ((isset($_GET['mode']) && ($_GET['mode'] == 'none'))) {
                require 'view/theme/frio/none.php';
        } else {
-               $template = 'view/theme/' . current_theme() . '/'
+               $template = 'view/theme/' . $a->getCurrentTheme() . '/'
                        . ((x($a->page, 'template')) ? $a->page['template'] : 'default' ) . '.php';
                if (file_exists($template)) {
                        require_once $template;
                } else {
-                       require_once str_replace('theme/' . current_theme() . '/', '', $template);
+                       require_once str_replace('theme/' . $a->getCurrentTheme() . '/', '', $template);
                }
        }
 }
index 02de0a0359675db5427073de134cee387e68d7c8..538839b2c256f8623b3b66a80c7acaa0816082aa 100644 (file)
  */
 use Friendica\Core\PConfig;
 
+require_once 'boot.php';
+
 function get_scheme_info($scheme)
 {
-       $theme = current_theme();
+       $theme = get_app()->getCurrentTheme();
        $themepath = 'view/theme/' . $theme . '/';
        $scheme = PConfig::get(local_user(), 'frio', 'scheme', PConfig::get(local_user(), 'frio', 'scheme'));