]> git.mxchange.org Git - friendica.git/commitdiff
Fix docs for themes and theme_admin()
authorArt4 <art4@wlabs.de>
Mon, 18 Nov 2024 22:28:35 +0000 (22:28 +0000)
committerArt4 <art4@wlabs.de>
Mon, 18 Nov 2024 22:28:35 +0000 (22:28 +0000)
doc/AddonStorageBackend.md
doc/autoloader.md
view/theme/frio/config.php

index c3a6d1639cb76fb1c587b8c737294038531d990c..5053b641cbf00d2acd71bafd68447db1f5ad5eeb 100644 (file)
@@ -126,14 +126,14 @@ Override the two necessary instances:
 ```php
 use Friendica\Core\Storage\Capability\ICanWriteToStorage;
 
-abstract class StorageTest 
+abstract class StorageTest
 {
        // returns an instance of your newly created storage class
        abstract protected function getInstance();
 
        // Assertion for the option array you return for your new StorageClass
        abstract protected function assertOption(ICanWriteToStorage $storage);
-} 
+}
 ```
 
 ## Exception handling
@@ -158,7 +158,7 @@ Example:
 ```php
 use Friendica\Core\Storage\Capability\ICanWriteToStorage;
 
-class ExampleStorage implements ICanWriteToStorage 
+class ExampleStorage implements ICanWriteToStorage
 {
        public function get(string $reference) : string
        {
@@ -168,7 +168,7 @@ class ExampleStorage implements ICanWriteToStorage
                        throw new \Friendica\Core\Storage\Exception\StorageException(sprintf('The Example Storage throws an exception for reference %s', $reference), 500, $exception);
                }
        }
-} 
+}
 ```
 
 ## Example
@@ -200,11 +200,11 @@ class SampleStorageBackend implements ICanWriteToStorage
 
        /**
          * SampleStorageBackend constructor.
-         * 
+         *
          * You can add here every dynamic class as dependency you like and add them to a private field
-         * Friendica automatically creates these classes and passes them as argument to the constructor                                                                           
+         * Friendica automatically creates these classes and passes them as argument to the constructor
          */
-       public function __construct(string $filename) 
+       public function __construct(string $filename)
        {
                $this->filename = $filename;
        }
@@ -215,7 +215,7 @@ class SampleStorageBackend implements ICanWriteToStorage
                // a config key
                return file_get_contents($this->filename);
        }
-       
+
        public function put(string $data, string $reference = '')
        {
                if ($reference === '') {
@@ -224,13 +224,13 @@ class SampleStorageBackend implements ICanWriteToStorage
                // we don't save $data !
                return $reference;
        }
-       
+
        public function delete(string $reference)
        {
                // we pretend to delete the data
                return true;
        }
-       
+
        public function __toString()
        {
                return self::NAME;
@@ -261,11 +261,11 @@ class SampleStorageBackendConfig implements ICanConfigureStorage
 
        /**
          * SampleStorageBackendConfig constructor.
-         * 
+         *
          * You can add here every dynamic class as dependency you like and add them to a private field
-         * Friendica automatically creates these classes and passes them as argument to the constructor                                                                           
+         * Friendica automatically creates these classes and passes them as argument to the constructor
          */
-       public function __construct(IManageConfigValues $config, L10n $l10n) 
+       public function __construct(IManageConfigValues $config, L10n $l10n)
        {
                $this->config = $config;
                $this->l10n   = $l10n;
@@ -289,12 +289,12 @@ class SampleStorageBackendConfig implements ICanConfigureStorage
                        ],
                ];
        }
-       
+
        public function saveOptions(array $data)
        {
                // the keys in $data are the same keys we defined in getOptions()
                $newfilename = trim($data['filename']);
-               
+
                // this function should always validate the data.
                // in this example we check if file exists
                if (!file_exists($newfilename)) {
@@ -302,9 +302,9 @@ class SampleStorageBackendConfig implements ICanConfigureStorage
                        // ['optionname' => 'error message']
                        return ['filename' => 'The file doesn\'t exists'];
                }
-               
+
                $this->config->set('storage', 'samplestorage', $newfilename);
-               
+
                // no errors, return empty array
                return [];
        }
@@ -341,13 +341,13 @@ function samplestorage_storage_uninstall()
        DI::storageManager()->unregister(SampleStorageBackend::class);
 }
 
-function samplestorage_storage_instance(App $a, array &$data)
+function samplestorage_storage_instance(AppHelper $appHelper, array &$data)
 {
        $config          = new SampleStorageBackendConfig(DI::l10n(), DI::config());
        $data['storage'] = new SampleStorageBackendConfig($config->getFileName());
 }
 
-function samplestorage_storage_config(App $a, array &$data)
+function samplestorage_storage_config(AppHelper $appHelper, array &$data)
 {
        $data['storage_config'] = new SampleStorageBackendConfig(DI::l10n(), DI::config());
 }
@@ -360,7 +360,7 @@ function samplestorage_storage_config(App $a, array &$data)
 use Friendica\Core\Storage\Capability\ICanWriteToStorage;
 use Friendica\Test\src\Core\Storage\StorageTest;
 
-class SampleStorageTest extends StorageTest 
+class SampleStorageTest extends StorageTest
 {
        // returns an instance of your newly created storage class
        protected function getInstance()
@@ -382,5 +382,5 @@ class SampleStorageTest extends StorageTest
                        ],
                ], $storage->getOptions());
        }
-} 
+}
 ```
index 954c28813c870593834b54761222d3ef19aac688..5bc0bfe9b3f7201719a2a38c2bf2f371a345b04d 100644 (file)
@@ -46,9 +46,9 @@ The code will be something like:
 // mod/network.php
 <?php
 
-use Friendica\App;
+use Friendica\AppHelper;
 
-function network_content(App $a) {
+function network_content(AppHelper $appHelper) {
        $itemsmanager = new \Friendica\ItemsManager();
        $items = $itemsmanager->getAll();
 
index 8556420a1eb78149307aa38e8913ccd391fc2371..a2e120735ce96383b65f7d67a2ee56f582c6a9a8 100644 (file)
@@ -92,7 +92,7 @@ function theme_admin_post()
        }
 }
 
-function theme_content(App $a): string
+function theme_content(AppHelper $appHelper): string
 {
        if (!DI::userSession()->getLocalUserId()) {
                return '';
@@ -115,7 +115,7 @@ function theme_content(App $a): string
        return frio_form($arr);
 }
 
-function theme_admin(): string
+function theme_admin(AppHelper $appHelper): string
 {
        if (!DI::userSession()->getLocalUserId()) {
                return '';