Completed
Pull Request — master (#9862)
by John
24:11
created
apps/accessibility/lib/Controller/AccessibilityController.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
 	 * @NoAdminRequired
99 99
 	 * @NoCSRFRequired
100 100
 	 *
101
-	 * @return DataResponse
101
+	 * @return DataDisplayResponse
102 102
 	 */
103 103
 	public function getCss(): DataDisplayResponse {
104 104
 
Please login to merge, or discard this patch.
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -38,131 +38,131 @@
 block discarded – undo
38 38
 
39 39
 class AccessibilityController extends Controller {
40 40
 
41
-	/** @var string */
42
-	protected $appName;
43
-
44
-	/** @var string */
45
-	protected $serverRoot;
46
-
47
-	/** @var IConfig */
48
-	private $config;
49
-
50
-	/** @var IUserManager */
51
-	private $userManager;
52
-
53
-	/** @var ILogger */
54
-	private $logger;
55
-
56
-	/** @var IURLGenerator */
57
-	private $urlGenerator;
58
-
59
-	/** @var ITimeFactory */
60
-	protected $timeFactory;
61
-
62
-	/** @var IUserSession */
63
-	private $userSession;
64
-
65
-	/**
66
-	 * Account constructor.
67
-	 *
68
-	 * @param string $appName
69
-	 * @param IRequest $request
70
-	 * @param IConfig $config
71
-	 * @param IUserManager $userManager
72
-	 * @param ILogger $logger
73
-	 * @param IURLGenerator $urlGenerator
74
-	 * @param ITimeFactory $timeFactory
75
-	 * @param IUserSession $userSession
76
-	 */
77
-	public function __construct(string $appName,
78
-		IRequest $request,
79
-		IConfig $config,
80
-		IUserManager $userManager,
81
-		ILogger $logger,
82
-		IURLGenerator $urlGenerator,
83
-		ITimeFactory $timeFactory,
84
-		IUserSession $userSession) {
85
-		parent::__construct($appName, $request);
86
-		$this->config       = $config;
87
-		$this->userManager  = $userManager;
88
-		$this->logger       = $logger;
89
-		$this->urlGenerator = $urlGenerator;
90
-		$this->timeFactory  = $timeFactory;
91
-		$this->userSession  = $userSession;
92
-
93
-		$this->serverRoot = \OC::$SERVERROOT;
94
-		$this->appRoot    = \OC_App::getAppPath($this->appName);
95
-	}
96
-
97
-	/**
98
-	 * @NoAdminRequired
99
-	 * @NoCSRFRequired
100
-	 *
101
-	 * @return DataResponse
102
-	 */
103
-	public function getCss(): DataDisplayResponse {
104
-
105
-		$css     = '';
106
-		$imports = '';
107
-
108
-		foreach ($this->getUserValues() as $scssFile) {
109
-			if ($scssFile !== false) {
110
-				$imports .= '@import "' . $scssFile . '";';
111
-			}
112
-		}
113
-
114
-		if ($imports !== '') {
115
-			$scss = new Compiler();
116
-			$scss->setImportPaths([
117
-				$this->appRoot . '/css/',
118
-				$this->serverRoot . '/core/css/'
119
-			]);
120
-
121
-			// Continue after throw
122
-			$scss->setIgnoreErrors(true);
123
-			$scss->setFormatter(Crunched::class);
124
-
125
-			// Compile
126
-			try {
127
-				$css .= $scss->compile(
128
-					$imports .
129
-					'@import "variables.scss";' .
130
-					'@import "css-variables.scss";'
131
-				);
132
-			} catch (ParserException $e) {
133
-				$this->logger->error($e->getMessage(), ['app' => 'core']);
134
-			}
135
-		}
136
-
137
-		// We don't want to override vars with url since path is different
138
-		$css = $this->filterOutRule('/[a-z-:]+url\([^;]+\)/mi', $css);
139
-
140
-		$response = new DataDisplayResponse($css, Http::STATUS_OK, ['Content-Type' => 'text/css']);
141
-
142
-		$ttl = 31536000;
143
-		$response->addHeader('Cache-Control', 'max-age=' . $ttl . ', immutable');
144
-
145
-		$expires = new \DateTime();
146
-		$expires->setTimestamp($this->timeFactory->getTime());
147
-		$expires->add(new \DateInterval('PT' . $ttl . 'S'));
148
-		$response->addHeader('Expires', $expires->format(\DateTime::RFC1123));
149
-		$response->addHeader('Pragma', 'cache');
150
-
151
-		return $response;
152
-	}
153
-
154
-	private function getUserValues() {
155
-		$userTheme = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'accessibility', 'theme', false);
156
-		$userFont  = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'accessibility', 'font', false);
157
-
158
-		return [
159
-			'theme' => $userTheme,
160
-			'font'  => $userFont
161
-		];
162
-	}
163
-
164
-	private function filterOutRule(string $rule, string $css) {
165
-		return preg_replace($rule, '', $css);
166
-	}
41
+    /** @var string */
42
+    protected $appName;
43
+
44
+    /** @var string */
45
+    protected $serverRoot;
46
+
47
+    /** @var IConfig */
48
+    private $config;
49
+
50
+    /** @var IUserManager */
51
+    private $userManager;
52
+
53
+    /** @var ILogger */
54
+    private $logger;
55
+
56
+    /** @var IURLGenerator */
57
+    private $urlGenerator;
58
+
59
+    /** @var ITimeFactory */
60
+    protected $timeFactory;
61
+
62
+    /** @var IUserSession */
63
+    private $userSession;
64
+
65
+    /**
66
+     * Account constructor.
67
+     *
68
+     * @param string $appName
69
+     * @param IRequest $request
70
+     * @param IConfig $config
71
+     * @param IUserManager $userManager
72
+     * @param ILogger $logger
73
+     * @param IURLGenerator $urlGenerator
74
+     * @param ITimeFactory $timeFactory
75
+     * @param IUserSession $userSession
76
+     */
77
+    public function __construct(string $appName,
78
+        IRequest $request,
79
+        IConfig $config,
80
+        IUserManager $userManager,
81
+        ILogger $logger,
82
+        IURLGenerator $urlGenerator,
83
+        ITimeFactory $timeFactory,
84
+        IUserSession $userSession) {
85
+        parent::__construct($appName, $request);
86
+        $this->config       = $config;
87
+        $this->userManager  = $userManager;
88
+        $this->logger       = $logger;
89
+        $this->urlGenerator = $urlGenerator;
90
+        $this->timeFactory  = $timeFactory;
91
+        $this->userSession  = $userSession;
92
+
93
+        $this->serverRoot = \OC::$SERVERROOT;
94
+        $this->appRoot    = \OC_App::getAppPath($this->appName);
95
+    }
96
+
97
+    /**
98
+     * @NoAdminRequired
99
+     * @NoCSRFRequired
100
+     *
101
+     * @return DataResponse
102
+     */
103
+    public function getCss(): DataDisplayResponse {
104
+
105
+        $css     = '';
106
+        $imports = '';
107
+
108
+        foreach ($this->getUserValues() as $scssFile) {
109
+            if ($scssFile !== false) {
110
+                $imports .= '@import "' . $scssFile . '";';
111
+            }
112
+        }
113
+
114
+        if ($imports !== '') {
115
+            $scss = new Compiler();
116
+            $scss->setImportPaths([
117
+                $this->appRoot . '/css/',
118
+                $this->serverRoot . '/core/css/'
119
+            ]);
120
+
121
+            // Continue after throw
122
+            $scss->setIgnoreErrors(true);
123
+            $scss->setFormatter(Crunched::class);
124
+
125
+            // Compile
126
+            try {
127
+                $css .= $scss->compile(
128
+                    $imports .
129
+                    '@import "variables.scss";' .
130
+                    '@import "css-variables.scss";'
131
+                );
132
+            } catch (ParserException $e) {
133
+                $this->logger->error($e->getMessage(), ['app' => 'core']);
134
+            }
135
+        }
136
+
137
+        // We don't want to override vars with url since path is different
138
+        $css = $this->filterOutRule('/[a-z-:]+url\([^;]+\)/mi', $css);
139
+
140
+        $response = new DataDisplayResponse($css, Http::STATUS_OK, ['Content-Type' => 'text/css']);
141
+
142
+        $ttl = 31536000;
143
+        $response->addHeader('Cache-Control', 'max-age=' . $ttl . ', immutable');
144
+
145
+        $expires = new \DateTime();
146
+        $expires->setTimestamp($this->timeFactory->getTime());
147
+        $expires->add(new \DateInterval('PT' . $ttl . 'S'));
148
+        $response->addHeader('Expires', $expires->format(\DateTime::RFC1123));
149
+        $response->addHeader('Pragma', 'cache');
150
+
151
+        return $response;
152
+    }
153
+
154
+    private function getUserValues() {
155
+        $userTheme = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'accessibility', 'theme', false);
156
+        $userFont  = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'accessibility', 'font', false);
157
+
158
+        return [
159
+            'theme' => $userTheme,
160
+            'font'  => $userFont
161
+        ];
162
+    }
163
+
164
+    private function filterOutRule(string $rule, string $css) {
165
+        return preg_replace($rule, '', $css);
166
+    }
167 167
 
168 168
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare (strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * @copyright Copyright (c) 2018 John Molakvoæ (skjnldsv) <[email protected]>
5 5
  *
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
 
108 108
 		foreach ($this->getUserValues() as $scssFile) {
109 109
 			if ($scssFile !== false) {
110
-				$imports .= '@import "' . $scssFile . '";';
110
+				$imports .= '@import "'.$scssFile.'";';
111 111
 			}
112 112
 		}
113 113
 
114 114
 		if ($imports !== '') {
115 115
 			$scss = new Compiler();
116 116
 			$scss->setImportPaths([
117
-				$this->appRoot . '/css/',
118
-				$this->serverRoot . '/core/css/'
117
+				$this->appRoot.'/css/',
118
+				$this->serverRoot.'/core/css/'
119 119
 			]);
120 120
 
121 121
 			// Continue after throw
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 			// Compile
126 126
 			try {
127 127
 				$css .= $scss->compile(
128
-					$imports .
129
-					'@import "variables.scss";' .
128
+					$imports.
129
+					'@import "variables.scss";'.
130 130
 					'@import "css-variables.scss";'
131 131
 				);
132 132
 			} catch (ParserException $e) {
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
 		$response = new DataDisplayResponse($css, Http::STATUS_OK, ['Content-Type' => 'text/css']);
141 141
 
142 142
 		$ttl = 31536000;
143
-		$response->addHeader('Cache-Control', 'max-age=' . $ttl . ', immutable');
143
+		$response->addHeader('Cache-Control', 'max-age='.$ttl.', immutable');
144 144
 
145 145
 		$expires = new \DateTime();
146 146
 		$expires->setTimestamp($this->timeFactory->getTime());
147
-		$expires->add(new \DateInterval('PT' . $ttl . 'S'));
147
+		$expires->add(new \DateInterval('PT'.$ttl.'S'));
148 148
 		$response->addHeader('Expires', $expires->format(\DateTime::RFC1123));
149 149
 		$response->addHeader('Pragma', 'cache');
150 150
 
Please login to merge, or discard this patch.
apps/accessibility/lib/Settings/Personal.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -33,81 +33,81 @@
 block discarded – undo
33 33
 
34 34
 class Personal implements ISettings {
35 35
 
36
-	/** @var string */
37
-	protected $appName;
36
+    /** @var string */
37
+    protected $appName;
38 38
 
39
-	/** @var IConfig */
40
-	private $config;
39
+    /** @var IConfig */
40
+    private $config;
41 41
 
42
-	/** @var IUserSession */
43
-	private $userSession;
42
+    /** @var IUserSession */
43
+    private $userSession;
44 44
 
45
-	/** @var IL10N */
46
-	private $l;
45
+    /** @var IL10N */
46
+    private $l;
47 47
 
48
-	/** @var IURLGenerator */
49
-	private $urlGenerator;
48
+    /** @var IURLGenerator */
49
+    private $urlGenerator;
50 50
 
51
-	/** @var AccessibilityProvider */
52
-	private $accessibilityProvider;
51
+    /** @var AccessibilityProvider */
52
+    private $accessibilityProvider;
53 53
 
54
-	/**
55
-	 * Settings constructor.
56
-	 *
57
-	 * @param string $appName
58
-	 * @param IConfig $config
59
-	 * @param IUserSession $userSession
60
-	 * @param IL10N $l
61
-	 * @param IURLGenerator $urlGenerator
62
-	 * @param AccessibilityProvider $accessibilityProvider
63
-	 */
64
-	public function __construct(string $appName,
65
-								IConfig $config,
66
-								IUserSession $userSession,
67
-								IL10N $l,
68
-								IURLGenerator $urlGenerator,
69
-								AccessibilityProvider $accessibilityProvider) {
70
-		$this->appName               = $appName;
71
-		$this->config                = $config;
72
-		$this->userSession           = $userSession;
73
-		$this->l                     = $l;
74
-		$this->urlGenerator          = $urlGenerator;
75
-		$this->accessibilityProvider = $accessibilityProvider;
76
-	}
54
+    /**
55
+     * Settings constructor.
56
+     *
57
+     * @param string $appName
58
+     * @param IConfig $config
59
+     * @param IUserSession $userSession
60
+     * @param IL10N $l
61
+     * @param IURLGenerator $urlGenerator
62
+     * @param AccessibilityProvider $accessibilityProvider
63
+     */
64
+    public function __construct(string $appName,
65
+                                IConfig $config,
66
+                                IUserSession $userSession,
67
+                                IL10N $l,
68
+                                IURLGenerator $urlGenerator,
69
+                                AccessibilityProvider $accessibilityProvider) {
70
+        $this->appName               = $appName;
71
+        $this->config                = $config;
72
+        $this->userSession           = $userSession;
73
+        $this->l                     = $l;
74
+        $this->urlGenerator          = $urlGenerator;
75
+        $this->accessibilityProvider = $accessibilityProvider;
76
+    }
77 77
 
78
-	/**
79
-	 * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
80
-	 * @since 9.1
81
-	 */
82
-	public function getForm() {
78
+    /**
79
+     * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
80
+     * @since 9.1
81
+     */
82
+    public function getForm() {
83 83
 
84
-		$serverData = [
85
-			'themes' => $this->accessibilityProvider->getThemes(),
86
-			'fonts' => $this->accessibilityProvider->getFonts(),
87
-			'theme' => $this->config->getUserValue($this->userSession->getUser()->getUID(), 'accessibility', 'theme', 'dark'),
88
-			'font' => $this->config->getUserValue($this->userSession->getUser()->getUID(), 'accessibility', 'font', false)
89
-		];
84
+        $serverData = [
85
+            'themes' => $this->accessibilityProvider->getThemes(),
86
+            'fonts' => $this->accessibilityProvider->getFonts(),
87
+            'theme' => $this->config->getUserValue($this->userSession->getUser()->getUID(), 'accessibility', 'theme', 'dark'),
88
+            'font' => $this->config->getUserValue($this->userSession->getUser()->getUID(), 'accessibility', 'font', false)
89
+        ];
90 90
 
91
-		return new TemplateResponse('accessibility', 'settings-personal', ['serverData' => $serverData]);
92
-	}
91
+        return new TemplateResponse('accessibility', 'settings-personal', ['serverData' => $serverData]);
92
+    }
93 93
 
94
-	/**
95
-	 * @return string the section ID, e.g. 'sharing'
96
-	 * @since 9.1
97
-	 */
98
-	public function getSection() {
99
-		return 'accessibility';
100
-	}
94
+    /**
95
+     * @return string the section ID, e.g. 'sharing'
96
+     * @since 9.1
97
+     */
98
+    public function getSection() {
99
+        return 'accessibility';
100
+    }
101 101
 
102
-	/**
103
-	 * @return int whether the form should be rather on the top or bottom of
104
-	 * the admin section. The forms are arranged in ascending order of the
105
-	 * priority values. It is required to return a value between 0 and 100.
106
-	 *
107
-	 * E.g.: 70
108
-	 * @since 9.1
109
-	 */
110
-	public function getPriority() {
111
-		return 40;
112
-	}
102
+    /**
103
+     * @return int whether the form should be rather on the top or bottom of
104
+     * the admin section. The forms are arranged in ascending order of the
105
+     * priority values. It is required to return a value between 0 and 100.
106
+     *
107
+     * E.g.: 70
108
+     * @since 9.1
109
+     */
110
+    public function getPriority() {
111
+        return 40;
112
+    }
113 113
 }
Please login to merge, or discard this patch.
apps/accessibility/lib/Settings/PersonalSection.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -29,66 +29,66 @@
 block discarded – undo
29 29
 
30 30
 class PersonalSection implements IIconSection {
31 31
 
32
-	/** @var IURLGenerator */
33
-	private $urlGenerator;
32
+    /** @var IURLGenerator */
33
+    private $urlGenerator;
34 34
 
35
-	/** @var IL10N */
36
-	private $l;
35
+    /** @var IL10N */
36
+    private $l;
37 37
 
38
-	/**
39
-	 * Personal Section constructor.
40
-	 *
41
-	 * @param IURLGenerator $urlGenerator
42
-	 * @param IL10N $l
43
-	 */
44
-	public function __construct(IURLGenerator $urlGenerator,
45
-								IL10N $l) {
46
-		$this->urlGenerator = $urlGenerator;
47
-		$this->l            = $l;
48
-	}
38
+    /**
39
+     * Personal Section constructor.
40
+     *
41
+     * @param IURLGenerator $urlGenerator
42
+     * @param IL10N $l
43
+     */
44
+    public function __construct(IURLGenerator $urlGenerator,
45
+                                IL10N $l) {
46
+        $this->urlGenerator = $urlGenerator;
47
+        $this->l            = $l;
48
+    }
49 49
 
50
-	/**
51
-	 * returns the relative path to an 16*16 icon describing the section.
52
-	 * e.g. '/core/img/places/files.svg'
53
-	 *
54
-	 * @returns string
55
-	 * @since 13.0.0
56
-	 */
57
-	public function getIcon() {
58
-		return $this->urlGenerator->imagePath('accessibility', 'app-dark.svg');
59
-	}
50
+    /**
51
+     * returns the relative path to an 16*16 icon describing the section.
52
+     * e.g. '/core/img/places/files.svg'
53
+     *
54
+     * @returns string
55
+     * @since 13.0.0
56
+     */
57
+    public function getIcon() {
58
+        return $this->urlGenerator->imagePath('accessibility', 'app-dark.svg');
59
+    }
60 60
 
61
-	/**
62
-	 * returns the ID of the section. It is supposed to be a lower case string,
63
-	 * e.g. 'ldap'
64
-	 *
65
-	 * @returns string
66
-	 * @since 9.1
67
-	 */
68
-	public function getID() {
69
-		return 'accessibility';
70
-	}
61
+    /**
62
+     * returns the ID of the section. It is supposed to be a lower case string,
63
+     * e.g. 'ldap'
64
+     *
65
+     * @returns string
66
+     * @since 9.1
67
+     */
68
+    public function getID() {
69
+        return 'accessibility';
70
+    }
71 71
 
72
-	/**
73
-	 * returns the translated name as it should be displayed, e.g. 'LDAP / AD
74
-	 * integration'. Use the L10N service to translate it.
75
-	 *
76
-	 * @return string
77
-	 * @since 9.1
78
-	 */
79
-	public function getName() {
80
-		return $this->l->t('Accessibility');
81
-	}
72
+    /**
73
+     * returns the translated name as it should be displayed, e.g. 'LDAP / AD
74
+     * integration'. Use the L10N service to translate it.
75
+     *
76
+     * @return string
77
+     * @since 9.1
78
+     */
79
+    public function getName() {
80
+        return $this->l->t('Accessibility');
81
+    }
82 82
 
83
-	/**
84
-	 * @return int whether the form should be rather on the top or bottom of
85
-	 * the settings navigation. The sections are arranged in ascending order of
86
-	 * the priority values. It is required to return a value between 0 and 99.
87
-	 *
88
-	 * E.g.: 70
89
-	 * @since 9.1
90
-	 */
91
-	public function getPriority() {
92
-		return 15;
93
-	}
83
+    /**
84
+     * @return int whether the form should be rather on the top or bottom of
85
+     * the settings navigation. The sections are arranged in ascending order of
86
+     * the priority values. It is required to return a value between 0 and 99.
87
+     *
88
+     * E.g.: 70
89
+     * @since 9.1
90
+     */
91
+    public function getPriority() {
92
+        return 15;
93
+    }
94 94
 }
Please login to merge, or discard this patch.
apps/accessibility/lib/AppInfo/Application.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@
 block discarded – undo
27 27
 
28 28
 class Application extends App {
29 29
 
30
-	/** @var string */
31
-	protected $appName = 'accessibility';
30
+    /** @var string */
31
+    protected $appName = 'accessibility';
32 32
 
33
-	public function __construct() {
34
-		parent::__construct($this->appName);
33
+    public function __construct() {
34
+        parent::__construct($this->appName);
35 35
         
36 36
         // Inject the fake css on all pages
37 37
         \OCP\Util::addStyle('accessibility', 'user', true);
38
-	}
38
+    }
39 39
 }
Please login to merge, or discard this patch.
apps/accessibility/templates/settings-personal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,5 +25,5 @@
 block discarded – undo
25 25
 style('accessibility', 'style');
26 26
 ?>
27 27
 
28
-<span id="serverData" data-server="<?php p(json_encode($_['serverData']));?>"></span>
28
+<span id="serverData" data-server="<?php p(json_encode($_['serverData'])); ?>"></span>
29 29
 <span id="accessibility"></span>
30 30
\ No newline at end of file
Please login to merge, or discard this patch.