From f3b2c8b84f3d93bef734e34dbe8ed729535e45e9 Mon Sep 17 00:00:00 2001 From: Yassine Doghri <yassine@doghri.fr> Date: Wed, 10 Jun 2020 15:00:12 +0000 Subject: [PATCH] feat(episodes): add create form and view pages for episode - add james-heinrich/getid3 library as a dependency to composer.json - update DEPENDENCIES.md file - fix episodes table migration script - add js devDependencies: prettier, @prettier/plugin-php and lint-staged to automatically format staged files before commit - reformat all files to the prettier format - refactor code by separating some logic as helper functions - overwrite existing files when uploading new files with the same name fixes #1 --- .devcontainer/devcontainer.json | 5 +- .gitignore | 11 +- .prettierrc.json | 13 + DEPENDENCIES.md | 1 + Dockerfile | 5 + README.md | 3 +- app/Config/App.php | 87 +- app/Config/Autoload.php | 133 ++- app/Config/Boot/production.php | 9 +- app/Config/Cache.php | 68 +- app/Config/Constants.php | 31 +- app/Config/ContentSecurityPolicy.php | 57 +- app/Config/Database.php | 186 ++-- app/Config/DocTypes.php | 61 +- app/Config/Email.php | 324 ++++--- app/Config/Encryption.php | 9 +- app/Config/Events.php | 42 +- app/Config/Exceptions.php | 12 +- app/Config/Filters.php | 52 +- app/Config/ForeignCharacters.php | 1 - app/Config/Format.php | 71 +- app/Config/Honeypot.php | 49 +- app/Config/Images.php | 44 +- app/Config/Kint.php | 34 +- app/Config/Logger.php | 118 ++- app/Config/Migrations.php | 13 +- app/Config/Mimes.php | 851 +++++++---------- app/Config/Modules.php | 60 +- app/Config/Pager.php | 16 +- app/Config/Paths.php | 119 +-- app/Config/Routes.php | 22 +- app/Config/Services.php | 17 +- app/Config/Toolbar.php | 34 +- app/Config/UserAgents.php | 390 ++++---- app/Config/Validation.php | 56 +- app/Config/View.php | 54 +- app/Controllers/BaseController.php | 48 +- app/Controllers/Episodes.php | 113 +++ app/Controllers/Home.php | 20 +- app/Controllers/Migrate.php | 8 +- app/Controllers/Podcasts.php | 96 +- .../2020-05-29-152000_add_categories.php | 11 +- .../2020-05-30-101000_add_languages.php | 11 +- .../2020-05-30-101500_add_podcasts.php | 57 +- .../2020-06-05-170000_add_episodes.php | 11 +- .../2020-06-05-190000_add_platforms.php | 12 +- .../2020-06-08-160000_add_platformlinks.php | 8 +- app/Database/Seeds/CategorySeeder.php | 900 +++++++++++++++--- app/Database/Seeds/LanguageSeeder.php | 805 ++++++++++++---- app/Database/Seeds/PlatformSeeder.php | 341 ++++++- app/Entities/Category.php | 5 + app/Entities/Episode.php | 5 + app/Entities/Language.php | 7 +- app/Entities/Podcast.php | 5 + app/Helpers/database_helper.php | 33 + app/Helpers/file_helper.php | 53 ++ app/Helpers/misc_helper.php | 23 + app/Language/en/Episodes.php | 24 + app/Language/en/Home.php | 6 +- app/Language/en/Podcasts.php | 6 +- app/Models/CategoryModel.php | 9 +- app/Models/EpisodeModel.php | 8 +- app/Models/LanguageModel.php | 9 +- app/Models/PlatformLinkModel.php | 4 +- app/Models/PlatformModel.php | 4 +- app/Models/PodcastModel.php | 6 + app/ThirdParty/.gitkeep | 0 app/Views/episodes/create.php | 92 ++ app/Views/episodes/view.php | 16 + app/Views/home.php | 20 +- app/Views/layouts/default.php | 8 +- app/Views/podcasts/create.php | 88 +- app/Views/podcasts/view.php | 45 +- app/index.html | 20 +- builds | 246 +++-- commitlint.config.js | 2 +- composer.json | 59 +- composer.lock | 87 +- package-lock.json | 627 ++++++++++++ package.json | 11 +- postcss.config.js | 7 +- public/index.php | 8 +- spark | 14 +- tailwind.config.js | 4 +- 84 files changed, 4784 insertions(+), 2276 deletions(-) create mode 100644 .prettierrc.json create mode 100644 app/Controllers/Episodes.php create mode 100644 app/Helpers/database_helper.php create mode 100644 app/Helpers/file_helper.php create mode 100644 app/Helpers/misc_helper.php create mode 100644 app/Language/en/Episodes.php delete mode 100644 app/ThirdParty/.gitkeep create mode 100644 app/Views/episodes/create.php create mode 100644 app/Views/episodes/view.php diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 835fe7703d..869ffed789 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,7 +12,8 @@ "streetsidesoftware.code-spell-checker", "naumovs.color-highlight", "heybourn.headwind", - "anish-m.ci-snippets2", - "wayou.vscode-todo-highlight" + "wayou.vscode-todo-highlight", + "esbenp.prettier-vscode", + "bradlc.vscode-tailwindcss" ] } diff --git a/.gitignore b/.gitignore index 353e854388..65ea29f018 100644 --- a/.gitignore +++ b/.gitignore @@ -125,15 +125,16 @@ nb-configuration.xml /phpunit*.xml /.phpunit.*.cache -# Media files -public/media/* - # npm yarn.lock node_modules -# potcss generated file -public/index.css +# public folder +public/* +!public/.htaccess +!public/favicon.ico +!public/index.php +!public/robots.txt #------------------------- # Docker volumes diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000000..fe8eb4697a --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,13 @@ +{ + "trailingComma": "es5", + "overrides": [ + { + "files": "*.php", + "options": { + "phpVersion": "7.2", + "singleQuote": true, + "trailingCommaPHP": true + } + } + ] +} diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index a8cf76a8f2..429d526302 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -11,3 +11,4 @@ Castopod uses the following components: - [User agent list](https://github.com/opawg/user-agents) ([by Open Podcast Analytics Working Group](https://github.com/opawg)) ([MIT license](https://github.com/opawg/user-agents/blob/master/LICENSE)) - [WhichBrowser/Parser-PHP](https://github.com/WhichBrowser/Parser-PHP) ([MIT License](https://github.com/WhichBrowser/Parser-PHP/blob/master/LICENSE)) - [Quill Rich Text Editor](https://github.com/quilljs/quill) ([BSD 3-Clause "New" or "Revised" License](https://github.com/quilljs/quill/blob/develop/LICENSE)) +- [getID3](https://github.com/JamesHeinrich/getID3) ([GNU General Public License v3](https://github.com/JamesHeinrich/getID3/blob/2.0/licenses/license.gpl-30.txt)) diff --git a/Dockerfile b/Dockerfile index 26cdf049e5..4c81d5f65c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,3 +12,8 @@ RUN apt-get update && apt-get install -y \ && docker-php-ext-install intl RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli + +RUN echo "file_uploads = On\n" \ + "memory_limit = 100M\n" \ + "upload_max_filesize = 100M\n" \ + > /usr/local/etc/php/conf.d/uploads.ini diff --git a/README.md b/README.md index 5ddf961715..c219d56e06 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ Moreover Podcasters can choose to publish on Castopod while keeping their existi You can check castopod's documentation for [setting up a development environment](./docs/setup-development.md). - ## Support -[Castopod](https://nlnet.nl/project/Castopod/) was funded through the [NGI0 Discovery](https://nlnet.nl/discovery/) Fund, a fund established by NLnet with financial support from the European Commission's [Next Generation Internet](https://www.ngi.eu/) programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 825322. +[Castopod](https://nlnet.nl/project/Castopod/) was funded through the [NGI0 Discovery](https://nlnet.nl/discovery/) Fund, a fund established by NLnet with financial support from the European Commission's [Next Generation Internet](https://www.ngi.eu/) programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 825322. diff --git a/app/Config/App.php b/app/Config/App.php index 1c482f8aa4..cc58ca46dd 100644 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -6,8 +6,7 @@ use CodeIgniter\Config\BaseConfig; class App extends BaseConfig { - - /* + /* |-------------------------------------------------------------------------- | Base Site URL |-------------------------------------------------------------------------- @@ -23,9 +22,9 @@ class App extends BaseConfig | environments. | */ - public $baseURL = 'http://localhost:8080/'; + public $baseURL = 'http://localhost:8080/'; - /* + /* |-------------------------------------------------------------------------- | Index File |-------------------------------------------------------------------------- @@ -35,9 +34,9 @@ class App extends BaseConfig | variable so that it is blank. | */ - public $indexPage = 'index.php'; + public $indexPage = 'index.php'; - /* + /* |-------------------------------------------------------------------------- | URI PROTOCOL |-------------------------------------------------------------------------- @@ -52,9 +51,9 @@ class App extends BaseConfig | | WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! */ - public $uriProtocol = 'REQUEST_URI'; + public $uriProtocol = 'REQUEST_URI'; - /* + /* |-------------------------------------------------------------------------- | Default Locale |-------------------------------------------------------------------------- @@ -65,9 +64,9 @@ class App extends BaseConfig | should run under for this request. | */ - public $defaultLocale = 'en'; + public $defaultLocale = 'en'; - /* + /* |-------------------------------------------------------------------------- | Negotiate Locale |-------------------------------------------------------------------------- @@ -78,9 +77,9 @@ class App extends BaseConfig | If false, no automatic detection will be performed. | */ - public $negotiateLocale = true; + public $negotiateLocale = true; - /* + /* |-------------------------------------------------------------------------- | Supported Locales |-------------------------------------------------------------------------- @@ -90,9 +89,9 @@ class App extends BaseConfig | found, the first locale will be used. | */ - public $supportedLocales = ['en']; + public $supportedLocales = ['en']; - /* + /* |-------------------------------------------------------------------------- | Application Timezone |-------------------------------------------------------------------------- @@ -101,9 +100,9 @@ class App extends BaseConfig | dates with the date helper, and can be retrieved through app_timezone() | */ - public $appTimezone = 'America/Chicago'; + public $appTimezone = 'America/Chicago'; - /* + /* |-------------------------------------------------------------------------- | Default Character Set |-------------------------------------------------------------------------- @@ -114,9 +113,9 @@ class App extends BaseConfig | See http://php.net/htmlspecialchars for a list of supported charsets. | */ - public $charset = 'UTF-8'; + public $charset = 'UTF-8'; - /* + /* |-------------------------------------------------------------------------- | URI PROTOCOL |-------------------------------------------------------------------------- @@ -126,9 +125,9 @@ class App extends BaseConfig | secure, the user will be redirected to a secure version of the page | and the HTTP Strict Transport Security header will be set. */ - public $forceGlobalSecureRequests = false; + public $forceGlobalSecureRequests = false; - /* + /* |-------------------------------------------------------------------------- | Session Variables |-------------------------------------------------------------------------- @@ -183,15 +182,15 @@ class App extends BaseConfig | except for 'cookie_prefix' and 'cookie_httponly', which are ignored here. | */ - public $sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler'; - public $sessionCookieName = 'ci_session'; - public $sessionExpiration = 7200; - public $sessionSavePath = WRITEPATH . 'session'; - public $sessionMatchIP = false; - public $sessionTimeToUpdate = 300; - public $sessionRegenerateDestroy = false; + public $sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler'; + public $sessionCookieName = 'ci_session'; + public $sessionExpiration = 7200; + public $sessionSavePath = WRITEPATH . 'session'; + public $sessionMatchIP = false; + public $sessionTimeToUpdate = 300; + public $sessionRegenerateDestroy = false; - /* + /* |-------------------------------------------------------------------------- | Cookie Related Variables |-------------------------------------------------------------------------- @@ -206,13 +205,13 @@ class App extends BaseConfig | 'cookie_httponly') will also affect sessions. | */ - public $cookiePrefix = ''; - public $cookieDomain = ''; - public $cookiePath = '/'; - public $cookieSecure = false; - public $cookieHTTPOnly = false; + public $cookiePrefix = ''; + public $cookieDomain = ''; + public $cookiePath = '/'; + public $cookieSecure = false; + public $cookieHTTPOnly = false; - /* + /* |-------------------------------------------------------------------------- | Reverse Proxy IPs |-------------------------------------------------------------------------- @@ -228,9 +227,9 @@ class App extends BaseConfig | Comma-separated: '10.0.1.200,192.168.5.0/24' | Array: array('10.0.1.200', '192.168.5.0/24') */ - public $proxyIPs = ''; + public $proxyIPs = ''; - /* + /* |-------------------------------------------------------------------------- | Cross Site Request Forgery |-------------------------------------------------------------------------- @@ -245,14 +244,14 @@ class App extends BaseConfig | CSRFRegenerate = Regenerate token on every submission | CSRFRedirect = Redirect to previous page with error on failure */ - public $CSRFTokenName = 'csrf_test_name'; - public $CSRFHeaderName = 'X-CSRF-TOKEN'; - public $CSRFCookieName = 'csrf_cookie_name'; - public $CSRFExpire = 7200; - public $CSRFRegenerate = true; - public $CSRFRedirect = true; + public $CSRFTokenName = 'csrf_test_name'; + public $CSRFHeaderName = 'X-CSRF-TOKEN'; + public $CSRFCookieName = 'csrf_cookie_name'; + public $CSRFExpire = 7200; + public $CSRFRegenerate = true; + public $CSRFRedirect = true; - /* + /* |-------------------------------------------------------------------------- | Content Security Policy |-------------------------------------------------------------------------- @@ -266,5 +265,5 @@ class App extends BaseConfig | - http://www.html5rocks.com/en/tutorials/security/content-security-policy/ | - http://www.w3.org/TR/CSP/ */ - public $CSPEnabled = false; + public $CSPEnabled = false; } diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index 8462d8d50e..fe07d52e6b 100644 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -13,80 +13,79 @@ require_once SYSTEMPATH . 'Config/AutoloadConfig.php'; */ class Autoload extends \CodeIgniter\Config\AutoloadConfig { - public $psr4 = [ - 'App' => APPPATH, - ]; + public $psr4 = [ + 'App' => APPPATH, + ]; - public $classmap = []; + public $classmap = []; - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- - /** - * Collects the application-specific autoload settings and merges - * them with the framework's required settings. - * - * NOTE: If you use an identical key in $psr4 or $classmap, then - * the values in this file will overwrite the framework's values. - */ - public function __construct() - { - parent::__construct(); + /** + * Collects the application-specific autoload settings and merges + * them with the framework's required settings. + * + * NOTE: If you use an identical key in $psr4 or $classmap, then + * the values in this file will overwrite the framework's values. + */ + public function __construct() + { + parent::__construct(); - /** - * ------------------------------------------------------------------- - * Namespaces - * ------------------------------------------------------------------- - * This maps the locations of any namespaces in your application - * to their location on the file system. These are used by the - * Autoloader to locate files the first time they have been instantiated. - * - * The '/app' and '/system' directories are already mapped for - * you. You may change the name of the 'App' namespace if you wish, - * but this should be done prior to creating any namespaced classes, - * else you will need to modify all of those classes for this to work. - * - * DO NOT change the name of the CodeIgniter namespace or your application - * WILL break. * - * Prototype: - * - * $Config['psr4'] = [ - * 'CodeIgniter' => SYSPATH - * `]; - */ - $psr4 = [ - 'App' => APPPATH, // To ensure filters, etc still found, - APP_NAMESPACE => APPPATH, // For custom namespace - 'Config' => APPPATH . 'Config', - ]; + /** + * ------------------------------------------------------------------- + * Namespaces + * ------------------------------------------------------------------- + * This maps the locations of any namespaces in your application + * to their location on the file system. These are used by the + * Autoloader to locate files the first time they have been instantiated. + * + * The '/app' and '/system' directories are already mapped for + * you. You may change the name of the 'App' namespace if you wish, + * but this should be done prior to creating any namespaced classes, + * else you will need to modify all of those classes for this to work. + * + * DO NOT change the name of the CodeIgniter namespace or your application + * WILL break. * + * Prototype: + * + * $Config['psr4'] = [ + * 'CodeIgniter' => SYSPATH + * `]; + */ + $psr4 = [ + 'App' => APPPATH, // To ensure filters, etc still found, + APP_NAMESPACE => APPPATH, // For custom namespace + 'Config' => APPPATH . 'Config', + ]; - /** - * ------------------------------------------------------------------- - * Class Map - * ------------------------------------------------------------------- - * The class map provides a map of class names and their exact - * location on the drive. Classes loaded in this manner will have - * slightly faster performance because they will not have to be - * searched for within one or more directories as they would if they - * were being autoloaded through a namespace. - * - * Prototype: - * - * $Config['classmap'] = [ - * 'MyClass' => '/path/to/class/file.php' - * ]; - */ - $classmap = []; + /** + * ------------------------------------------------------------------- + * Class Map + * ------------------------------------------------------------------- + * The class map provides a map of class names and their exact + * location on the drive. Classes loaded in this manner will have + * slightly faster performance because they will not have to be + * searched for within one or more directories as they would if they + * were being autoloaded through a namespace. + * + * Prototype: + * + * $Config['classmap'] = [ + * 'MyClass' => '/path/to/class/file.php' + * ]; + */ + $classmap = []; - //-------------------------------------------------------------------- - // Do Not Edit Below This Line - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Do Not Edit Below This Line + //-------------------------------------------------------------------- - $this->psr4 = array_merge($this->psr4, $psr4); - $this->classmap = array_merge($this->classmap, $classmap); + $this->psr4 = array_merge($this->psr4, $psr4); + $this->classmap = array_merge($this->classmap, $classmap); - unset($psr4, $classmap); - } - - //-------------------------------------------------------------------- + unset($psr4, $classmap); + } + //-------------------------------------------------------------------- } diff --git a/app/Config/Boot/production.php b/app/Config/Boot/production.php index c54bdbdd9c..c852b03e07 100644 --- a/app/Config/Boot/production.php +++ b/app/Config/Boot/production.php @@ -8,7 +8,14 @@ | it and display a generic error message. */ ini_set('display_errors', '0'); -error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); +error_reporting( + E_ALL & + ~E_NOTICE & + ~E_DEPRECATED & + ~E_STRICT & + ~E_USER_NOTICE & + ~E_USER_DEPRECATED +); /* |-------------------------------------------------------------------------- diff --git a/app/Config/Cache.php b/app/Config/Cache.php index 015bd6fd68..4ac1bf6d01 100644 --- a/app/Config/Cache.php +++ b/app/Config/Cache.php @@ -4,7 +4,7 @@ use CodeIgniter\Config\BaseConfig; class Cache extends BaseConfig { - /* + /* |-------------------------------------------------------------------------- | Primary Handler |-------------------------------------------------------------------------- @@ -13,9 +13,9 @@ class Cache extends BaseConfig | it is not available, the $backupHandler will be used in its place. | */ - public $handler = 'file'; + public $handler = 'file'; - /* + /* |-------------------------------------------------------------------------- | Backup Handler |-------------------------------------------------------------------------- @@ -25,9 +25,9 @@ class Cache extends BaseConfig | always available, though that's not always practical for the app. | */ - public $backupHandler = 'dummy'; + public $backupHandler = 'dummy'; - /* + /* |-------------------------------------------------------------------------- | Cache Directory Path |-------------------------------------------------------------------------- @@ -36,9 +36,9 @@ class Cache extends BaseConfig | system. | */ - public $storePath = WRITEPATH . 'cache/'; + public $storePath = WRITEPATH . 'cache/'; - /* + /* |-------------------------------------------------------------------------- | Cache Include Query String |-------------------------------------------------------------------------- @@ -54,9 +54,9 @@ class Cache extends BaseConfig | of query parameters. | */ - public $cacheQueryString = false; + public $cacheQueryString = false; - /* + /* |-------------------------------------------------------------------------- | Key Prefix |-------------------------------------------------------------------------- @@ -65,9 +65,9 @@ class Cache extends BaseConfig | if you run multiple applications with the same cache engine. | */ - public $prefix = ''; + public $prefix = ''; - /* + /* | ------------------------------------------------------------------------- | Memcached settings | ------------------------------------------------------------------------- @@ -77,14 +77,14 @@ class Cache extends BaseConfig | See: https://codeigniter.com/user_guide/libraries/caching.html#memcached | */ - public $memcached = [ - 'host' => '127.0.0.1', - 'port' => 11211, - 'weight' => 1, - 'raw' => false, - ]; + public $memcached = [ + 'host' => '127.0.0.1', + 'port' => 11211, + 'weight' => 1, + 'raw' => false, + ]; - /* + /* | ------------------------------------------------------------------------- | Redis settings | ------------------------------------------------------------------------- @@ -92,15 +92,15 @@ class Cache extends BaseConfig | the Redis or Predis drivers. | */ - public $redis = [ - 'host' => '127.0.0.1', - 'password' => null, - 'port' => 6379, - 'timeout' => 0, - 'database' => 0, - ]; + public $redis = [ + 'host' => '127.0.0.1', + 'password' => null, + 'port' => 6379, + 'timeout' => 0, + 'database' => 0, + ]; - /* + /* |-------------------------------------------------------------------------- | Available Cache Handlers |-------------------------------------------------------------------------- @@ -109,12 +109,12 @@ class Cache extends BaseConfig | that are listed here are allowed to be used. | */ - public $validHandlers = [ - 'dummy' => \CodeIgniter\Cache\Handlers\DummyHandler::class, - 'file' => \CodeIgniter\Cache\Handlers\FileHandler::class, - 'memcached' => \CodeIgniter\Cache\Handlers\MemcachedHandler::class, - 'predis' => \CodeIgniter\Cache\Handlers\PredisHandler::class, - 'redis' => \CodeIgniter\Cache\Handlers\RedisHandler::class, - 'wincache' => \CodeIgniter\Cache\Handlers\WincacheHandler::class, - ]; + public $validHandlers = [ + 'dummy' => \CodeIgniter\Cache\Handlers\DummyHandler::class, + 'file' => \CodeIgniter\Cache\Handlers\FileHandler::class, + 'memcached' => \CodeIgniter\Cache\Handlers\MemcachedHandler::class, + 'predis' => \CodeIgniter\Cache\Handlers\PredisHandler::class, + 'redis' => \CodeIgniter\Cache\Handlers\RedisHandler::class, + 'wincache' => \CodeIgniter\Cache\Handlers\WincacheHandler::class, + ]; } diff --git a/app/Config/Constants.php b/app/Config/Constants.php index b25f71cdcc..f890af0e9f 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -21,7 +21,8 @@ defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App'); | The path that Composer's autoload file is expected to live. By default, | the vendor folder is in the Root directory, but you can customize that here. */ -defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php'); +defined('COMPOSER_PATH') || + define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php'); /* |-------------------------------------------------------------------------- @@ -33,11 +34,11 @@ defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload. */ defined('SECOND') || define('SECOND', 1); defined('MINUTE') || define('MINUTE', 60); -defined('HOUR') || define('HOUR', 3600); -defined('DAY') || define('DAY', 86400); -defined('WEEK') || define('WEEK', 604800); -defined('MONTH') || define('MONTH', 2592000); -defined('YEAR') || define('YEAR', 31536000); +defined('HOUR') || define('HOUR', 3600); +defined('DAY') || define('DAY', 86400); +defined('WEEK') || define('WEEK', 604800); +defined('MONTH') || define('MONTH', 2592000); +defined('YEAR') || define('YEAR', 31536000); defined('DECADE') || define('DECADE', 315360000); /* @@ -65,13 +66,13 @@ defined('DECADE') || define('DECADE', 315360000); | http://tldp.org/LDP/abs/html/exitcodes.html | */ -defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors -defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error -defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error -defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found -defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class +defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors +defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error +defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error +defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found +defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member -defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input -defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error -defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code -defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code +defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input +defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error +defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code +defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code diff --git a/app/Config/ContentSecurityPolicy.php b/app/Config/ContentSecurityPolicy.php index 0e6955a526..2a0f15682a 100644 --- a/app/Config/ContentSecurityPolicy.php +++ b/app/Config/ContentSecurityPolicy.php @@ -16,33 +16,32 @@ use CodeIgniter\Config\BaseConfig; */ class ContentSecurityPolicy extends BaseConfig { - // broadbrush CSP management - - public $reportOnly = false; // default CSP report context - public $reportURI = null; // URL to send violation reports to - public $upgradeInsecureRequests = false; // toggle for forcing https - - // sources allowed; string or array of strings - // Note: once you set a policy to 'none', it cannot be further restricted - - public $defaultSrc = null; // will default to self if not over-ridden - public $scriptSrc = 'self'; - public $styleSrc = 'self'; - public $imageSrc = 'self'; - public $baseURI = null; // will default to self if not over-ridden - public $childSrc = 'self'; - public $connectSrc = 'self'; - public $fontSrc = null; - public $formAction = 'self'; - public $frameAncestors = null; - public $mediaSrc = null; - public $objectSrc = 'self'; - public $manifestSrc = null; - - // mime types allowed; string or array of strings - public $pluginTypes = null; - - // list of actions allowed; string or array of strings - public $sandbox = null; - + // broadbrush CSP management + + public $reportOnly = false; // default CSP report context + public $reportURI = null; // URL to send violation reports to + public $upgradeInsecureRequests = false; // toggle for forcing https + + // sources allowed; string or array of strings + // Note: once you set a policy to 'none', it cannot be further restricted + + public $defaultSrc = null; // will default to self if not over-ridden + public $scriptSrc = 'self'; + public $styleSrc = 'self'; + public $imageSrc = 'self'; + public $baseURI = null; // will default to self if not over-ridden + public $childSrc = 'self'; + public $connectSrc = 'self'; + public $fontSrc = null; + public $formAction = 'self'; + public $frameAncestors = null; + public $mediaSrc = null; + public $objectSrc = 'self'; + public $manifestSrc = null; + + // mime types allowed; string or array of strings + public $pluginTypes = null; + + // list of actions allowed; string or array of strings + public $sandbox = null; } diff --git a/app/Config/Database.php b/app/Config/Database.php index b31541a83b..235a49a313 100644 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -8,107 +8,105 @@ class Database extends \CodeIgniter\Database\Config { - /** - * The directory that holds the Migrations - * and Seeds directories. - * - * @var string - */ - public $filesPath = APPPATH . 'Database/'; + /** + * The directory that holds the Migrations + * and Seeds directories. + * + * @var string + */ + public $filesPath = APPPATH . 'Database/'; - /** - * Lets you choose which connection group to - * use if no other is specified. - * - * @var string - */ - public $defaultGroup = 'default'; + /** + * Lets you choose which connection group to + * use if no other is specified. + * + * @var string + */ + public $defaultGroup = 'default'; - /** - * The default database connection. - * - * @var array - */ - public $default = [ - 'DSN' => '', - 'hostname' => 'localhost', - 'username' => '', - 'password' => '', - 'database' => '', - 'DBDriver' => 'MySQLi', - 'DBPrefix' => '', - 'pConnect' => false, - 'DBDebug' => (ENVIRONMENT !== 'production'), - 'cacheOn' => false, - 'cacheDir' => '', - 'charset' => 'utf8', - 'DBCollat' => 'utf8_general_ci', - 'swapPre' => '', - 'encrypt' => false, - 'compress' => false, - 'strictOn' => false, - 'failover' => [], - 'port' => 3306, - ]; + /** + * The default database connection. + * + * @var array + */ + public $default = [ + 'DSN' => '', + 'hostname' => 'localhost', + 'username' => '', + 'password' => '', + 'database' => '', + 'DBDriver' => 'MySQLi', + 'DBPrefix' => '', + 'pConnect' => false, + 'DBDebug' => ENVIRONMENT !== 'production', + 'cacheOn' => false, + 'cacheDir' => '', + 'charset' => 'utf8', + 'DBCollat' => 'utf8_general_ci', + 'swapPre' => '', + 'encrypt' => false, + 'compress' => false, + 'strictOn' => false, + 'failover' => [], + 'port' => 3306, + ]; - /** - * This database connection is used when - * running PHPUnit database tests. - * - * @var array - */ - public $tests = [ - 'DSN' => '', - 'hostname' => '127.0.0.1', - 'username' => '', - 'password' => '', - 'database' => ':memory:', - 'DBDriver' => 'SQLite3', - 'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS - 'pConnect' => false, - 'DBDebug' => (ENVIRONMENT !== 'production'), - 'cacheOn' => false, - 'cacheDir' => '', - 'charset' => 'utf8', - 'DBCollat' => 'utf8_general_ci', - 'swapPre' => '', - 'encrypt' => false, - 'compress' => false, - 'strictOn' => false, - 'failover' => [], - 'port' => 3306, - ]; + /** + * This database connection is used when + * running PHPUnit database tests. + * + * @var array + */ + public $tests = [ + 'DSN' => '', + 'hostname' => '127.0.0.1', + 'username' => '', + 'password' => '', + 'database' => ':memory:', + 'DBDriver' => 'SQLite3', + 'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS + 'pConnect' => false, + 'DBDebug' => ENVIRONMENT !== 'production', + 'cacheOn' => false, + 'cacheDir' => '', + 'charset' => 'utf8', + 'DBCollat' => 'utf8_general_ci', + 'swapPre' => '', + 'encrypt' => false, + 'compress' => false, + 'strictOn' => false, + 'failover' => [], + 'port' => 3306, + ]; - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- - public function __construct() - { - parent::__construct(); + public function __construct() + { + parent::__construct(); - // Ensure that we always set the database group to 'tests' if - // we are currently running an automated test suite, so that - // we don't overwrite live data on accident. - if (ENVIRONMENT === 'testing') - { - $this->defaultGroup = 'tests'; + // Ensure that we always set the database group to 'tests' if + // we are currently running an automated test suite, so that + // we don't overwrite live data on accident. + if (ENVIRONMENT === 'testing') { + $this->defaultGroup = 'tests'; - // Under Travis-CI, we can set an ENV var named 'DB_GROUP' - // so that we can test against multiple databases. - if ($group = getenv('DB')) - { - if (is_file(TESTPATH . 'travis/Database.php')) - { - require TESTPATH . 'travis/Database.php'; + // Under Travis-CI, we can set an ENV var named 'DB_GROUP' + // so that we can test against multiple databases. + if ($group = getenv('DB')) { + if (is_file(TESTPATH . 'travis/Database.php')) { + require TESTPATH . 'travis/Database.php'; - if (! empty($dbconfig) && array_key_exists($group, $dbconfig)) - { - $this->tests = $dbconfig[$group]; - } - } - } - } - } - - //-------------------------------------------------------------------- + if ( + !empty($dbconfig) && + array_key_exists($group, $dbconfig) + ) { + $this->tests = $dbconfig[$group]; + } + } + } + } + } + //-------------------------------------------------------------------- } diff --git a/app/Config/DocTypes.php b/app/Config/DocTypes.php index 67d5dd208e..d203af7159 100644 --- a/app/Config/DocTypes.php +++ b/app/Config/DocTypes.php @@ -8,26 +8,43 @@ class DocTypes { - public $list = - [ - 'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', - 'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', - 'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', - 'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">', - 'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">', - 'html5' => '<!DOCTYPE html>', - 'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', - 'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">', - 'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">', - 'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">', - 'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">', - 'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">', - 'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">', - 'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">', - 'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">', - 'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">', - 'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">', - 'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">', - 'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">', - ]; + public $list = [ + 'xhtml11' => + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', + 'xhtml1-strict' => + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', + 'xhtml1-trans' => + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', + 'xhtml1-frame' => + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">', + 'xhtml-basic11' => + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">', + 'html5' => '<!DOCTYPE html>', + 'html4-strict' => + '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', + 'html4-trans' => + '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">', + 'html4-frame' => + '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">', + 'mathml1' => + '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">', + 'mathml2' => + '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">', + 'svg10' => + '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">', + 'svg11' => + '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">', + 'svg11-basic' => + '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">', + 'svg11-tiny' => + '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">', + 'xhtml-math-svg-xh' => + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">', + 'xhtml-math-svg-sh' => + '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">', + 'xhtml-rdfa-1' => + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">', + 'xhtml-rdfa-2' => + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">', + ]; } diff --git a/app/Config/Email.php b/app/Config/Email.php index d9ca1420f6..d1703a595e 100644 --- a/app/Config/Email.php +++ b/app/Config/Email.php @@ -5,167 +5,165 @@ use CodeIgniter\Config\BaseConfig; class Email extends BaseConfig { - - /** - * @var string - */ - public $fromEmail; - - /** - * @var string - */ - public $fromName; - - /** - * @var string - */ - public $recipients; - - /** - * The "user agent" - * - * @var string - */ - public $userAgent = 'CodeIgniter'; - - /** - * The mail sending protocol: mail, sendmail, smtp - * - * @var string - */ - public $protocol = 'mail'; - - /** - * The server path to Sendmail. - * - * @var string - */ - public $mailPath = '/usr/sbin/sendmail'; - - /** - * SMTP Server Address - * - * @var string - */ - public $SMTPHost; - - /** - * SMTP Username - * - * @var string - */ - public $SMTPUser; - - /** - * SMTP Password - * - * @var string - */ - public $SMTPPass; - - /** - * SMTP Port - * - * @var integer - */ - public $SMTPPort = 25; - - /** - * SMTP Timeout (in seconds) - * - * @var integer - */ - public $SMTPTimeout = 5; - - /** - * Enable persistent SMTP connections - * - * @var boolean - */ - public $SMTPKeepAlive = false; - - /** - * SMTP Encryption. Either tls or ssl - * - * @var string - */ - public $SMTPCrypto = 'tls'; - - /** - * Enable word-wrap - * - * @var boolean - */ - public $wordWrap = true; - - /** - * Character count to wrap at - * - * @var integer - */ - public $wrapChars = 76; - - /** - * Type of mail, either 'text' or 'html' - * - * @var string - */ - public $mailType = 'text'; - - /** - * Character set (utf-8, iso-8859-1, etc.) - * - * @var string - */ - public $charset = 'UTF-8'; - - /** - * Whether to validate the email address - * - * @var boolean - */ - public $validate = false; - - /** - * Email Priority. 1 = highest. 5 = lowest. 3 = normal - * - * @var integer - */ - public $priority = 3; - - /** - * Newline character. (Use “\r\n†to comply with RFC 822) - * - * @var string - */ - public $CRLF = "\r\n"; - - /** - * Newline character. (Use “\r\n†to comply with RFC 822) - * - * @var string - */ - public $newline = "\r\n"; - - /** - * Enable BCC Batch Mode. - * - * @var boolean - */ - public $BCCBatchMode = false; - - /** - * Number of emails in each BCC batch - * - * @var integer - */ - public $BCCBatchSize = 200; - - /** - * Enable notify message from server - * - * @var boolean - */ - public $DSN = false; - + /** + * @var string + */ + public $fromEmail; + + /** + * @var string + */ + public $fromName; + + /** + * @var string + */ + public $recipients; + + /** + * The "user agent" + * + * @var string + */ + public $userAgent = 'CodeIgniter'; + + /** + * The mail sending protocol: mail, sendmail, smtp + * + * @var string + */ + public $protocol = 'mail'; + + /** + * The server path to Sendmail. + * + * @var string + */ + public $mailPath = '/usr/sbin/sendmail'; + + /** + * SMTP Server Address + * + * @var string + */ + public $SMTPHost; + + /** + * SMTP Username + * + * @var string + */ + public $SMTPUser; + + /** + * SMTP Password + * + * @var string + */ + public $SMTPPass; + + /** + * SMTP Port + * + * @var integer + */ + public $SMTPPort = 25; + + /** + * SMTP Timeout (in seconds) + * + * @var integer + */ + public $SMTPTimeout = 5; + + /** + * Enable persistent SMTP connections + * + * @var boolean + */ + public $SMTPKeepAlive = false; + + /** + * SMTP Encryption. Either tls or ssl + * + * @var string + */ + public $SMTPCrypto = 'tls'; + + /** + * Enable word-wrap + * + * @var boolean + */ + public $wordWrap = true; + + /** + * Character count to wrap at + * + * @var integer + */ + public $wrapChars = 76; + + /** + * Type of mail, either 'text' or 'html' + * + * @var string + */ + public $mailType = 'text'; + + /** + * Character set (utf-8, iso-8859-1, etc.) + * + * @var string + */ + public $charset = 'UTF-8'; + + /** + * Whether to validate the email address + * + * @var boolean + */ + public $validate = false; + + /** + * Email Priority. 1 = highest. 5 = lowest. 3 = normal + * + * @var integer + */ + public $priority = 3; + + /** + * Newline character. (Use “\r\n†to comply with RFC 822) + * + * @var string + */ + public $CRLF = "\r\n"; + + /** + * Newline character. (Use “\r\n†to comply with RFC 822) + * + * @var string + */ + public $newline = "\r\n"; + + /** + * Enable BCC Batch Mode. + * + * @var boolean + */ + public $BCCBatchMode = false; + + /** + * Number of emails in each BCC batch + * + * @var integer + */ + public $BCCBatchSize = 200; + + /** + * Enable notify message from server + * + * @var boolean + */ + public $DSN = false; } diff --git a/app/Config/Encryption.php b/app/Config/Encryption.php index 2cee271a3d..d21657d16a 100644 --- a/app/Config/Encryption.php +++ b/app/Config/Encryption.php @@ -11,7 +11,7 @@ use CodeIgniter\Config\BaseConfig; */ class Encryption extends BaseConfig { - /* + /* |-------------------------------------------------------------------------- | Encryption Key Starter |-------------------------------------------------------------------------- @@ -21,9 +21,9 @@ class Encryption extends BaseConfig | See the user guide for more info. */ - public $key = ''; + public $key = ''; - /* + /* |-------------------------------------------------------------------------- | Encryption driver to use |-------------------------------------------------------------------------- @@ -31,6 +31,5 @@ class Encryption extends BaseConfig | One of the supported drivers, eg 'OpenSSL' or 'Sodium'. | The default driver, if you don't specify one, is 'OpenSSL'. */ - public $driver = 'OpenSSL'; - + public $driver = 'OpenSSL'; } diff --git a/app/Config/Events.php b/app/Config/Events.php index 085cc4ac0c..9d26d71717 100644 --- a/app/Config/Events.php +++ b/app/Config/Events.php @@ -20,27 +20,27 @@ use CodeIgniter\Events\Events; */ Events::on('pre_system', function () { - if (ENVIRONMENT !== 'testing') - { - while (\ob_get_level() > 0) - { - \ob_end_flush(); - } + if (ENVIRONMENT !== 'testing') { + while (\ob_get_level() > 0) { + \ob_end_flush(); + } - \ob_start(function ($buffer) { - return $buffer; - }); - } + \ob_start(function ($buffer) { + return $buffer; + }); + } - /* - * -------------------------------------------------------------------- - * Debug Toolbar Listeners. - * -------------------------------------------------------------------- - * If you delete, they will no longer be collected. - */ - if (ENVIRONMENT !== 'production') - { - Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'); - Services::toolbar()->respond(); - } + /* + * -------------------------------------------------------------------- + * Debug Toolbar Listeners. + * -------------------------------------------------------------------- + * If you delete, they will no longer be collected. + */ + if (ENVIRONMENT !== 'production') { + Events::on( + 'DBQuery', + 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect' + ); + Services::toolbar()->respond(); + } }); diff --git a/app/Config/Exceptions.php b/app/Config/Exceptions.php index c0245b2a60..a58ea923c5 100644 --- a/app/Config/Exceptions.php +++ b/app/Config/Exceptions.php @@ -8,7 +8,7 @@ class Exceptions { - /* + /* |-------------------------------------------------------------------------- | LOG EXCEPTIONS? |-------------------------------------------------------------------------- @@ -17,18 +17,18 @@ class Exceptions | | Default: true */ - public $log = true; + public $log = true; - /* + /* |-------------------------------------------------------------------------- | DO NOT LOG STATUS CODES |-------------------------------------------------------------------------- | Any status codes here will NOT be logged if logging is turned on. | By default, only 404 (Page Not Found) exceptions are ignored. */ - public $ignoreCodes = [ 404 ]; + public $ignoreCodes = [404]; - /* + /* |-------------------------------------------------------------------------- | Error Views Path |-------------------------------------------------------------------------- @@ -37,5 +37,5 @@ class Exceptions | | Default: APPPATH.'Views/errors' */ - public $errorViewPath = APPPATH . 'Views/errors'; + public $errorViewPath = APPPATH . 'Views/errors'; } diff --git a/app/Config/Filters.php b/app/Config/Filters.php index 11359e7c9d..f76ceb2016 100644 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -4,33 +4,33 @@ use CodeIgniter\Config\BaseConfig; class Filters extends BaseConfig { - // Makes reading things below nicer, - // and simpler to change out script that's used. - public $aliases = [ - 'csrf' => \CodeIgniter\Filters\CSRF::class, - 'toolbar' => \CodeIgniter\Filters\DebugToolbar::class, - 'honeypot' => \CodeIgniter\Filters\Honeypot::class, - ]; + // Makes reading things below nicer, + // and simpler to change out script that's used. + public $aliases = [ + 'csrf' => \CodeIgniter\Filters\CSRF::class, + 'toolbar' => \CodeIgniter\Filters\DebugToolbar::class, + 'honeypot' => \CodeIgniter\Filters\Honeypot::class, + ]; - // Always applied before every request - public $globals = [ - 'before' => [ - //'honeypot' - // 'csrf', - ], - 'after' => [ - 'toolbar', - //'honeypot' - ], - ]; + // Always applied before every request + public $globals = [ + 'before' => [ + //'honeypot' + // 'csrf', + ], + 'after' => [ + 'toolbar', + //'honeypot' + ], + ]; - // Works on all of a particular HTTP method - // (GET, POST, etc) as BEFORE filters only - // like: 'post' => ['CSRF', 'throttle'], - public $methods = []; + // Works on all of a particular HTTP method + // (GET, POST, etc) as BEFORE filters only + // like: 'post' => ['CSRF', 'throttle'], + public $methods = []; - // List filter aliases and any before/after uri patterns - // that they should run on, like: - // 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']], - public $filters = []; + // List filter aliases and any before/after uri patterns + // that they should run on, like: + // 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']], + public $filters = []; } diff --git a/app/Config/ForeignCharacters.php b/app/Config/ForeignCharacters.php index 8ee6f113d7..fb9da5c160 100644 --- a/app/Config/ForeignCharacters.php +++ b/app/Config/ForeignCharacters.php @@ -2,5 +2,4 @@ class ForeignCharacters extends \CodeIgniter\Config\ForeignCharacters { - } diff --git a/app/Config/Format.php b/app/Config/Format.php index 5f64b702f4..989bcfe35d 100644 --- a/app/Config/Format.php +++ b/app/Config/Format.php @@ -4,7 +4,7 @@ use CodeIgniter\Config\BaseConfig; class Format extends BaseConfig { - /* + /* |-------------------------------------------------------------------------- | Available Response Formats |-------------------------------------------------------------------------- @@ -18,13 +18,13 @@ class Format extends BaseConfig | method is an array. | */ - public $supportedResponseFormats = [ - 'application/json', - 'application/xml', // machine-readable XML - 'text/xml', // human-readable XML - ]; + public $supportedResponseFormats = [ + 'application/json', + 'application/xml', // machine-readable XML + 'text/xml', // human-readable XML + ]; - /* + /* |-------------------------------------------------------------------------- | Formatters |-------------------------------------------------------------------------- @@ -34,38 +34,39 @@ class Format extends BaseConfig | can be retrieved through the getFormatter() method. | */ - public $formatters = [ - 'application/json' => \CodeIgniter\Format\JSONFormatter::class, - 'application/xml' => \CodeIgniter\Format\XMLFormatter::class, - 'text/xml' => \CodeIgniter\Format\XMLFormatter::class, - ]; + public $formatters = [ + 'application/json' => \CodeIgniter\Format\JSONFormatter::class, + 'application/xml' => \CodeIgniter\Format\XMLFormatter::class, + 'text/xml' => \CodeIgniter\Format\XMLFormatter::class, + ]; - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- - /** - * A Factory method to return the appropriate formatter for the given mime type. - * - * @param string $mime - * - * @return \CodeIgniter\Format\FormatterInterface - */ - public function getFormatter(string $mime) - { - if (! array_key_exists($mime, $this->formatters)) - { - throw new \InvalidArgumentException('No Formatter defined for mime type: ' . $mime); - } + /** + * A Factory method to return the appropriate formatter for the given mime type. + * + * @param string $mime + * + * @return \CodeIgniter\Format\FormatterInterface + */ + public function getFormatter(string $mime) + { + if (!array_key_exists($mime, $this->formatters)) { + throw new \InvalidArgumentException( + 'No Formatter defined for mime type: ' . $mime + ); + } - $class = $this->formatters[$mime]; + $class = $this->formatters[$mime]; - if (! class_exists($class)) - { - throw new \BadMethodCallException($class . ' is not a valid Formatter.'); - } + if (!class_exists($class)) { + throw new \BadMethodCallException( + $class . ' is not a valid Formatter.' + ); + } - return new $class(); - } - - //-------------------------------------------------------------------- + return new $class(); + } + //-------------------------------------------------------------------- } diff --git a/app/Config/Honeypot.php b/app/Config/Honeypot.php index f4444a5d6c..e49a268192 100644 --- a/app/Config/Honeypot.php +++ b/app/Config/Honeypot.php @@ -4,31 +4,30 @@ use CodeIgniter\Config\BaseConfig; class Honeypot extends BaseConfig { + /** + * Makes Honeypot visible or not to human + * + * @var boolean + */ + public $hidden = true; + /** + * Honeypot Label Content + * + * @var string + */ + public $label = 'Fill This Field'; - /** - * Makes Honeypot visible or not to human - * - * @var boolean - */ - public $hidden = true; - /** - * Honeypot Label Content - * - * @var string - */ - public $label = 'Fill This Field'; + /** + * Honeypot Field Name + * + * @var string + */ + public $name = 'honeypot'; - /** - * Honeypot Field Name - * - * @var string - */ - public $name = 'honeypot'; - - /** - * Honeypot HTML Template - * - * @var string - */ - public $template = '<label>{label}</label><input type="text" name="{name}" value=""/>'; + /** + * Honeypot HTML Template + * + * @var string + */ + public $template = '<label>{label}</label><input type="text" name="{name}" value=""/>'; } diff --git a/app/Config/Images.php b/app/Config/Images.php index 730ddee759..a66c993e34 100644 --- a/app/Config/Images.php +++ b/app/Config/Images.php @@ -4,28 +4,28 @@ use CodeIgniter\Config\BaseConfig; class Images extends BaseConfig { - /** - * Default handler used if no other handler is specified. - * - * @var string - */ - public $defaultHandler = 'gd'; + /** + * Default handler used if no other handler is specified. + * + * @var string + */ + public $defaultHandler = 'gd'; - /** - * The path to the image library. - * Required for ImageMagick, GraphicsMagick, or NetPBM. - * - * @var string - */ - public $libraryPath = '/usr/local/bin/convert'; + /** + * The path to the image library. + * Required for ImageMagick, GraphicsMagick, or NetPBM. + * + * @var string + */ + public $libraryPath = '/usr/local/bin/convert'; - /** - * The available handler classes. - * - * @var array - */ - public $handlers = [ - 'gd' => \CodeIgniter\Images\Handlers\GDHandler::class, - 'imagick' => \CodeIgniter\Images\Handlers\ImageMagickHandler::class, - ]; + /** + * The available handler classes. + * + * @var array + */ + public $handlers = [ + 'gd' => \CodeIgniter\Images\Handlers\GDHandler::class, + 'imagick' => \CodeIgniter\Images\Handlers\ImageMagickHandler::class, + ]; } diff --git a/app/Config/Kint.php b/app/Config/Kint.php index 09db83dd59..c9f89c5447 100644 --- a/app/Config/Kint.php +++ b/app/Config/Kint.php @@ -5,7 +5,7 @@ use Kint\Renderer\Renderer; class Kint extends BaseConfig { - /* + /* |-------------------------------------------------------------------------- | Kint |-------------------------------------------------------------------------- @@ -18,45 +18,45 @@ class Kint extends BaseConfig | */ - /* + /* |-------------------------------------------------------------------------- | Global Settings |-------------------------------------------------------------------------- */ - public $plugins = null; + public $plugins = null; - public $maxDepth = 6; + public $maxDepth = 6; - public $displayCalledFrom = true; + public $displayCalledFrom = true; - public $expanded = false; + public $expanded = false; - /* + /* |-------------------------------------------------------------------------- | RichRenderer Settings |-------------------------------------------------------------------------- */ - public $richTheme = 'aante-light.css'; + public $richTheme = 'aante-light.css'; - public $richFolder = false; + public $richFolder = false; - public $richSort = Renderer::SORT_FULL; + public $richSort = Renderer::SORT_FULL; - public $richObjectPlugins = null; + public $richObjectPlugins = null; - public $richTabPlugins = null; + public $richTabPlugins = null; - /* + /* |-------------------------------------------------------------------------- | CLI Settings |-------------------------------------------------------------------------- */ - public $cliColors = true; + public $cliColors = true; - public $cliForceUTF8 = false; + public $cliForceUTF8 = false; - public $cliDetectWidth = true; + public $cliDetectWidth = true; - public $cliMinWidth = 40; + public $cliMinWidth = 40; } diff --git a/app/Config/Logger.php b/app/Config/Logger.php index 93d38f6f63..597924faaf 100644 --- a/app/Config/Logger.php +++ b/app/Config/Logger.php @@ -4,7 +4,7 @@ use CodeIgniter\Config\BaseConfig; class Logger extends BaseConfig { - /* + /* |-------------------------------------------------------------------------- | Error Logging Threshold |-------------------------------------------------------------------------- @@ -32,9 +32,9 @@ class Logger extends BaseConfig | your log files will fill up very fast. | */ - public $threshold = 3; + public $threshold = 3; - /* + /* |-------------------------------------------------------------------------- | Date Format for Logs |-------------------------------------------------------------------------- @@ -43,9 +43,9 @@ class Logger extends BaseConfig | codes to set your own date formatting | */ - public $dateFormat = 'Y-m-d H:i:s'; + public $dateFormat = 'Y-m-d H:i:s'; - /* + /* |-------------------------------------------------------------------------- | Log Handlers |-------------------------------------------------------------------------- @@ -69,64 +69,62 @@ class Logger extends BaseConfig | the handler on top and continuing down. | */ - public $handlers = [ + public $handlers = [ + //-------------------------------------------------------------------- + // File Handler + //-------------------------------------------------------------------- - //-------------------------------------------------------------------- - // File Handler - //-------------------------------------------------------------------- + 'CodeIgniter\Log\Handlers\FileHandler' => [ + /* + * The log levels that this handler will handle. + */ + 'handles' => [ + 'critical', + 'alert', + 'emergency', + 'debug', + 'error', + 'info', + 'notice', + 'warning', + ], - 'CodeIgniter\Log\Handlers\FileHandler' => [ + /* + * The default filename extension for log files. + * An extension of 'php' allows for protecting the log files via basic + * scripting, when they are to be stored under a publicly accessible directory. + * + * Note: Leaving it blank will default to 'log'. + */ + 'fileExtension' => '', - /* - * The log levels that this handler will handle. - */ - 'handles' => [ - 'critical', - 'alert', - 'emergency', - 'debug', - 'error', - 'info', - 'notice', - 'warning', - ], + /* + * The file system permissions to be applied on newly created log files. + * + * IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal + * integer notation (i.e. 0700, 0644, etc.) + */ + 'filePermissions' => 0644, - /* - * The default filename extension for log files. - * An extension of 'php' allows for protecting the log files via basic - * scripting, when they are to be stored under a publicly accessible directory. - * - * Note: Leaving it blank will default to 'log'. - */ - 'fileExtension' => '', + /* + * Logging Directory Path + * + * By default, logs are written to WRITEPATH . 'logs/' + * Specify a different destination here, if desired. + */ + 'path' => '', + ], - /* - * The file system permissions to be applied on newly created log files. - * - * IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal - * integer notation (i.e. 0700, 0644, etc.) - */ - 'filePermissions' => 0644, - - /* - * Logging Directory Path - * - * By default, logs are written to WRITEPATH . 'logs/' - * Specify a different destination here, if desired. - */ - 'path' => '', - ], - - /** - * The ChromeLoggerHandler requires the use of the Chrome web browser - * and the ChromeLogger extension. Uncomment this block to use it. - */ - // 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [ - // /* - // * The log levels that this handler will handle. - // */ - // 'handles' => ['critical', 'alert', 'emergency', 'debug', - // 'error', 'info', 'notice', 'warning'], - // ] - ]; + /** + * The ChromeLoggerHandler requires the use of the Chrome web browser + * and the ChromeLogger extension. Uncomment this block to use it. + */ + // 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [ + // /* + // * The log levels that this handler will handle. + // */ + // 'handles' => ['critical', 'alert', 'emergency', 'debug', + // 'error', 'info', 'notice', 'warning'], + // ] + ]; } diff --git a/app/Config/Migrations.php b/app/Config/Migrations.php index b83fe907ff..efb48dbec9 100644 --- a/app/Config/Migrations.php +++ b/app/Config/Migrations.php @@ -4,7 +4,7 @@ use CodeIgniter\Config\BaseConfig; class Migrations extends BaseConfig { - /* + /* |-------------------------------------------------------------------------- | Enable/Disable Migrations |-------------------------------------------------------------------------- @@ -14,9 +14,9 @@ class Migrations extends BaseConfig | and disable it back when you're done. | */ - public $enabled = true; + public $enabled = true; - /* + /* |-------------------------------------------------------------------------- | Migrations table |-------------------------------------------------------------------------- @@ -28,9 +28,9 @@ class Migrations extends BaseConfig | will migrate up. This must be set. | */ - public $table = 'migrations'; + public $table = 'migrations'; - /* + /* |-------------------------------------------------------------------------- | Timestamp Format |-------------------------------------------------------------------------- @@ -45,6 +45,5 @@ class Migrations extends BaseConfig | Y_m_d_His_ | */ - public $timestampFormat = 'Y-m-d-His_'; - + public $timestampFormat = 'Y-m-d-His_'; } diff --git a/app/Config/Mimes.php b/app/Config/Mimes.php index 41014d406b..0e246852d6 100644 --- a/app/Config/Mimes.php +++ b/app/Config/Mimes.php @@ -15,516 +15,365 @@ */ class Mimes { - /** - * Map of extensions to mime types. - * - * @var array - */ - public static $mimes = [ - 'hqx' => [ - 'application/mac-binhex40', - 'application/mac-binhex', - 'application/x-binhex40', - 'application/x-mac-binhex40', - ], - 'cpt' => 'application/mac-compactpro', - 'csv' => [ - 'text/csv', - 'text/x-comma-separated-values', - 'text/comma-separated-values', - 'application/octet-stream', - 'application/vnd.ms-excel', - 'application/x-csv', - 'text/x-csv', - 'application/csv', - 'application/excel', - 'application/vnd.msexcel', - 'text/plain', - ], - 'bin' => [ - 'application/macbinary', - 'application/mac-binary', - 'application/octet-stream', - 'application/x-binary', - 'application/x-macbinary', - ], - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => [ - 'application/octet-stream', - 'application/x-msdownload', - ], - 'class' => 'application/octet-stream', - 'psd' => [ - 'application/x-photoshop', - 'image/vnd.adobe.photoshop', - ], - 'so' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => [ - 'application/pdf', - 'application/force-download', - 'application/x-download', - 'binary/octet-stream', - ], - 'ai' => [ - 'application/pdf', - 'application/postscript', - ], - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => [ - 'application/vnd.ms-excel', - 'application/msexcel', - 'application/x-msexcel', - 'application/x-ms-excel', - 'application/x-excel', - 'application/x-dos_ms_excel', - 'application/xls', - 'application/x-xls', - 'application/excel', - 'application/download', - 'application/vnd.ms-office', - 'application/msword', - ], - 'ppt' => [ - 'application/vnd.ms-powerpoint', - 'application/powerpoint', - 'application/vnd.ms-office', - 'application/msword', - ], - 'pptx' => [ - 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'application/x-zip', - 'application/zip', - ], - 'wbxml' => 'application/wbxml', - 'wmlc' => 'application/wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'gz' => 'application/x-gzip', - 'gzip' => 'application/x-gzip', - 'php' => [ - 'application/x-php', - 'application/x-httpd-php', - 'application/php', - 'text/php', - 'text/x-php', - 'application/x-httpd-php-source', - ], - 'php4' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => [ - 'application/x-javascript', - 'text/plain', - ], - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => [ - 'application/x-tar', - 'application/x-gzip-compressed', - ], - 'z' => 'application/x-compress', - 'xhtml' => 'application/xhtml+xml', - 'xht' => 'application/xhtml+xml', - 'zip' => [ - 'application/x-zip', - 'application/zip', - 'application/x-zip-compressed', - 'application/s-compressed', - 'multipart/x-zip', - ], - 'rar' => [ - 'application/x-rar', - 'application/rar', - 'application/x-rar-compressed', - ], - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mpga' => 'audio/mpeg', - 'mp2' => 'audio/mpeg', - 'mp3' => [ - 'audio/mpeg', - 'audio/mpg', - 'audio/mpeg3', - 'audio/mp3', - ], - 'aif' => [ - 'audio/x-aiff', - 'audio/aiff', - ], - 'aiff' => [ - 'audio/x-aiff', - 'audio/aiff', - ], - 'aifc' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'rv' => 'video/vnd.rn-realvideo', - 'wav' => [ - 'audio/x-wav', - 'audio/wave', - 'audio/wav', - ], - 'bmp' => [ - 'image/bmp', - 'image/x-bmp', - 'image/x-bitmap', - 'image/x-xbitmap', - 'image/x-win-bitmap', - 'image/x-windows-bmp', - 'image/ms-bmp', - 'image/x-ms-bmp', - 'application/bmp', - 'application/x-bmp', - 'application/x-win-bitmap', - ], - 'gif' => 'image/gif', - 'jpg' => [ - 'image/jpeg', - 'image/pjpeg', - ], - 'jpeg' => [ - 'image/jpeg', - 'image/pjpeg', - ], - 'jpe' => [ - 'image/jpeg', - 'image/pjpeg', - ], - 'jp2' => [ - 'image/jp2', - 'video/mj2', - 'image/jpx', - 'image/jpm', - ], - 'j2k' => [ - 'image/jp2', - 'video/mj2', - 'image/jpx', - 'image/jpm', - ], - 'jpf' => [ - 'image/jp2', - 'video/mj2', - 'image/jpx', - 'image/jpm', - ], - 'jpg2' => [ - 'image/jp2', - 'video/mj2', - 'image/jpx', - 'image/jpm', - ], - 'jpx' => [ - 'image/jp2', - 'video/mj2', - 'image/jpx', - 'image/jpm', - ], - 'jpm' => [ - 'image/jp2', - 'video/mj2', - 'image/jpx', - 'image/jpm', - ], - 'mj2' => [ - 'image/jp2', - 'video/mj2', - 'image/jpx', - 'image/jpm', - ], - 'mjp2' => [ - 'image/jp2', - 'video/mj2', - 'image/jpx', - 'image/jpm', - ], - 'png' => [ - 'image/png', - 'image/x-png', - ], - 'tif' => 'image/tiff', - 'tiff' => 'image/tiff', - 'css' => [ - 'text/css', - 'text/plain', - ], - 'html' => [ - 'text/html', - 'text/plain', - ], - 'htm' => [ - 'text/html', - 'text/plain', - ], - 'shtml' => [ - 'text/html', - 'text/plain', - ], - 'txt' => 'text/plain', - 'text' => 'text/plain', - 'log' => [ - 'text/plain', - 'text/x-log', - ], - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => [ - 'application/xml', - 'text/xml', - 'text/plain', - ], - 'xsl' => [ - 'application/xml', - 'text/xsl', - 'text/xml', - ], - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - 'avi' => [ - 'video/x-msvideo', - 'video/msvideo', - 'video/avi', - 'application/x-troff-msvideo', - ], - 'movie' => 'video/x-sgi-movie', - 'doc' => [ - 'application/msword', - 'application/vnd.ms-office', - ], - 'docx' => [ - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'application/zip', - 'application/msword', - 'application/x-zip', - ], - 'dot' => [ - 'application/msword', - 'application/vnd.ms-office', - ], - 'dotx' => [ - 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'application/zip', - 'application/msword', - ], - 'xlsx' => [ - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'application/zip', - 'application/vnd.ms-excel', - 'application/msword', - 'application/x-zip', - ], - 'word' => [ - 'application/msword', - 'application/octet-stream', - ], - 'xl' => 'application/excel', - 'eml' => 'message/rfc822', - 'json' => [ - 'application/json', - 'text/json', - ], - 'pem' => [ - 'application/x-x509-user-cert', - 'application/x-pem-file', - 'application/octet-stream', - ], - 'p10' => [ - 'application/x-pkcs10', - 'application/pkcs10', - ], - 'p12' => 'application/x-pkcs12', - 'p7a' => 'application/x-pkcs7-signature', - 'p7c' => [ - 'application/pkcs7-mime', - 'application/x-pkcs7-mime', - ], - 'p7m' => [ - 'application/pkcs7-mime', - 'application/x-pkcs7-mime', - ], - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'crt' => [ - 'application/x-x509-ca-cert', - 'application/x-x509-user-cert', - 'application/pkix-cert', - ], - 'crl' => [ - 'application/pkix-crl', - 'application/pkcs-crl', - ], - 'der' => 'application/x-x509-ca-cert', - 'kdb' => 'application/octet-stream', - 'pgp' => 'application/pgp', - 'gpg' => 'application/gpg-keys', - 'sst' => 'application/octet-stream', - 'csr' => 'application/octet-stream', - 'rsa' => 'application/x-pkcs7', - 'cer' => [ - 'application/pkix-cert', - 'application/x-x509-ca-cert', - ], - '3g2' => 'video/3gpp2', - '3gp' => [ - 'video/3gp', - 'video/3gpp', - ], - 'mp4' => 'video/mp4', - 'm4a' => 'audio/x-m4a', - 'f4v' => [ - 'video/mp4', - 'video/x-f4v', - ], - 'flv' => 'video/x-flv', - 'webm' => 'video/webm', - 'aac' => 'audio/x-acc', - 'm4u' => 'application/vnd.mpegurl', - 'm3u' => 'text/plain', - 'xspf' => 'application/xspf+xml', - 'vlc' => 'application/videolan', - 'wmv' => [ - 'video/x-ms-wmv', - 'video/x-ms-asf', - ], - 'au' => 'audio/x-au', - 'ac3' => 'audio/ac3', - 'flac' => 'audio/x-flac', - 'ogg' => [ - 'audio/ogg', - 'video/ogg', - 'application/ogg', - ], - 'kmz' => [ - 'application/vnd.google-earth.kmz', - 'application/zip', - 'application/x-zip', - ], - 'kml' => [ - 'application/vnd.google-earth.kml+xml', - 'application/xml', - 'text/xml', - ], - 'ics' => 'text/calendar', - 'ical' => 'text/calendar', - 'zsh' => 'text/x-scriptzsh', - '7zip' => [ - 'application/x-compressed', - 'application/x-zip-compressed', - 'application/zip', - 'multipart/x-zip', - ], - 'cdr' => [ - 'application/cdr', - 'application/coreldraw', - 'application/x-cdr', - 'application/x-coreldraw', - 'image/cdr', - 'image/x-cdr', - 'zz-application/zz-winassoc-cdr', - ], - 'wma' => [ - 'audio/x-ms-wma', - 'video/x-ms-asf', - ], - 'jar' => [ - 'application/java-archive', - 'application/x-java-application', - 'application/x-jar', - 'application/x-compressed', - ], - 'svg' => [ - 'image/svg+xml', - 'application/xml', - 'text/xml', - ], - 'vcf' => 'text/x-vcard', - 'srt' => [ - 'text/srt', - 'text/plain', - ], - 'vtt' => [ - 'text/vtt', - 'text/plain', - ], - 'ico' => [ - 'image/x-icon', - 'image/x-ico', - 'image/vnd.microsoft.icon', - ], - ]; + /** + * Map of extensions to mime types. + * + * @var array + */ + public static $mimes = [ + 'hqx' => [ + 'application/mac-binhex40', + 'application/mac-binhex', + 'application/x-binhex40', + 'application/x-mac-binhex40', + ], + 'cpt' => 'application/mac-compactpro', + 'csv' => [ + 'text/csv', + 'text/x-comma-separated-values', + 'text/comma-separated-values', + 'application/octet-stream', + 'application/vnd.ms-excel', + 'application/x-csv', + 'text/x-csv', + 'application/csv', + 'application/excel', + 'application/vnd.msexcel', + 'text/plain', + ], + 'bin' => [ + 'application/macbinary', + 'application/mac-binary', + 'application/octet-stream', + 'application/x-binary', + 'application/x-macbinary', + ], + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => ['application/octet-stream', 'application/x-msdownload'], + 'class' => 'application/octet-stream', + 'psd' => ['application/x-photoshop', 'image/vnd.adobe.photoshop'], + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => [ + 'application/pdf', + 'application/force-download', + 'application/x-download', + 'binary/octet-stream', + ], + 'ai' => ['application/pdf', 'application/postscript'], + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => [ + 'application/vnd.ms-excel', + 'application/msexcel', + 'application/x-msexcel', + 'application/x-ms-excel', + 'application/x-excel', + 'application/x-dos_ms_excel', + 'application/xls', + 'application/x-xls', + 'application/excel', + 'application/download', + 'application/vnd.ms-office', + 'application/msword', + ], + 'ppt' => [ + 'application/vnd.ms-powerpoint', + 'application/powerpoint', + 'application/vnd.ms-office', + 'application/msword', + ], + 'pptx' => [ + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/x-zip', + 'application/zip', + ], + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'php' => [ + 'application/x-php', + 'application/x-httpd-php', + 'application/php', + 'text/php', + 'text/x-php', + 'application/x-httpd-php-source', + ], + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => ['application/x-javascript', 'text/plain'], + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => ['application/x-tar', 'application/x-gzip-compressed'], + 'z' => 'application/x-compress', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => [ + 'application/x-zip', + 'application/zip', + 'application/x-zip-compressed', + 'application/s-compressed', + 'multipart/x-zip', + ], + 'rar' => [ + 'application/x-rar', + 'application/rar', + 'application/x-rar-compressed', + ], + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => ['audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'], + 'aif' => ['audio/x-aiff', 'audio/aiff'], + 'aiff' => ['audio/x-aiff', 'audio/aiff'], + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => ['audio/x-wav', 'audio/wave', 'audio/wav'], + 'bmp' => [ + 'image/bmp', + 'image/x-bmp', + 'image/x-bitmap', + 'image/x-xbitmap', + 'image/x-win-bitmap', + 'image/x-windows-bmp', + 'image/ms-bmp', + 'image/x-ms-bmp', + 'application/bmp', + 'application/x-bmp', + 'application/x-win-bitmap', + ], + 'gif' => 'image/gif', + 'jpg' => ['image/jpeg', 'image/pjpeg'], + 'jpeg' => ['image/jpeg', 'image/pjpeg'], + 'jpe' => ['image/jpeg', 'image/pjpeg'], + 'jp2' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'j2k' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'jpf' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'jpg2' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'jpx' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'jpm' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'mj2' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'mjp2' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], + 'png' => ['image/png', 'image/x-png'], + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'css' => ['text/css', 'text/plain'], + 'html' => ['text/html', 'text/plain'], + 'htm' => ['text/html', 'text/plain'], + 'shtml' => ['text/html', 'text/plain'], + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => ['text/plain', 'text/x-log'], + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => ['application/xml', 'text/xml', 'text/plain'], + 'xsl' => ['application/xml', 'text/xsl', 'text/xml'], + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => [ + 'video/x-msvideo', + 'video/msvideo', + 'video/avi', + 'application/x-troff-msvideo', + ], + 'movie' => 'video/x-sgi-movie', + 'doc' => ['application/msword', 'application/vnd.ms-office'], + 'docx' => [ + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/zip', + 'application/msword', + 'application/x-zip', + ], + 'dot' => ['application/msword', 'application/vnd.ms-office'], + 'dotx' => [ + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/zip', + 'application/msword', + ], + 'xlsx' => [ + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/zip', + 'application/vnd.ms-excel', + 'application/msword', + 'application/x-zip', + ], + 'word' => ['application/msword', 'application/octet-stream'], + 'xl' => 'application/excel', + 'eml' => 'message/rfc822', + 'json' => ['application/json', 'text/json'], + 'pem' => [ + 'application/x-x509-user-cert', + 'application/x-pem-file', + 'application/octet-stream', + ], + 'p10' => ['application/x-pkcs10', 'application/pkcs10'], + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7c' => ['application/pkcs7-mime', 'application/x-pkcs7-mime'], + 'p7m' => ['application/pkcs7-mime', 'application/x-pkcs7-mime'], + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'crt' => [ + 'application/x-x509-ca-cert', + 'application/x-x509-user-cert', + 'application/pkix-cert', + ], + 'crl' => ['application/pkix-crl', 'application/pkcs-crl'], + 'der' => 'application/x-x509-ca-cert', + 'kdb' => 'application/octet-stream', + 'pgp' => 'application/pgp', + 'gpg' => 'application/gpg-keys', + 'sst' => 'application/octet-stream', + 'csr' => 'application/octet-stream', + 'rsa' => 'application/x-pkcs7', + 'cer' => ['application/pkix-cert', 'application/x-x509-ca-cert'], + '3g2' => 'video/3gpp2', + '3gp' => ['video/3gp', 'video/3gpp'], + 'mp4' => 'video/mp4', + 'm4a' => 'audio/x-m4a', + 'f4v' => ['video/mp4', 'video/x-f4v'], + 'flv' => 'video/x-flv', + 'webm' => 'video/webm', + 'aac' => 'audio/x-acc', + 'm4u' => 'application/vnd.mpegurl', + 'm3u' => 'text/plain', + 'xspf' => 'application/xspf+xml', + 'vlc' => 'application/videolan', + 'wmv' => ['video/x-ms-wmv', 'video/x-ms-asf'], + 'au' => 'audio/x-au', + 'ac3' => 'audio/ac3', + 'flac' => 'audio/x-flac', + 'ogg' => ['audio/ogg', 'video/ogg', 'application/ogg'], + 'kmz' => [ + 'application/vnd.google-earth.kmz', + 'application/zip', + 'application/x-zip', + ], + 'kml' => [ + 'application/vnd.google-earth.kml+xml', + 'application/xml', + 'text/xml', + ], + 'ics' => 'text/calendar', + 'ical' => 'text/calendar', + 'zsh' => 'text/x-scriptzsh', + '7zip' => [ + 'application/x-compressed', + 'application/x-zip-compressed', + 'application/zip', + 'multipart/x-zip', + ], + 'cdr' => [ + 'application/cdr', + 'application/coreldraw', + 'application/x-cdr', + 'application/x-coreldraw', + 'image/cdr', + 'image/x-cdr', + 'zz-application/zz-winassoc-cdr', + ], + 'wma' => ['audio/x-ms-wma', 'video/x-ms-asf'], + 'jar' => [ + 'application/java-archive', + 'application/x-java-application', + 'application/x-jar', + 'application/x-compressed', + ], + 'svg' => ['image/svg+xml', 'application/xml', 'text/xml'], + 'vcf' => 'text/x-vcard', + 'srt' => ['text/srt', 'text/plain'], + 'vtt' => ['text/vtt', 'text/plain'], + 'ico' => ['image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'], + ]; - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- - /** - * Attempts to determine the best mime type for the given file extension. - * - * @param string $extension - * - * @return string|null The mime type found, or none if unable to determine. - */ - public static function guessTypeFromExtension(string $extension) - { - $extension = trim(strtolower($extension), '. '); + /** + * Attempts to determine the best mime type for the given file extension. + * + * @param string $extension + * + * @return string|null The mime type found, or none if unable to determine. + */ + public static function guessTypeFromExtension(string $extension) + { + $extension = trim(strtolower($extension), '. '); - if (! array_key_exists($extension, static::$mimes)) - { - return null; - } + if (!array_key_exists($extension, static::$mimes)) { + return null; + } - return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension]; - } + return is_array(static::$mimes[$extension]) + ? static::$mimes[$extension][0] + : static::$mimes[$extension]; + } - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- - /** - * Attempts to determine the best file extension for a given mime type. - * - * @param string $type - * @param string $proposed_extension - default extension (in case there is more than one with the same mime type) - * - * @return string|null The extension determined, or null if unable to match. - */ - public static function guessExtensionFromType(string $type, ?string $proposed_extension = null) - { - $type = trim(strtolower($type), '. '); + /** + * Attempts to determine the best file extension for a given mime type. + * + * @param string $type + * @param string $proposed_extension - default extension (in case there is more than one with the same mime type) + * + * @return string|null The extension determined, or null if unable to match. + */ + public static function guessExtensionFromType( + string $type, + ?string $proposed_extension = null + ) { + $type = trim(strtolower($type), '. '); - $proposed_extension = trim(strtolower($proposed_extension)); + $proposed_extension = trim(strtolower($proposed_extension)); - if (! is_null($proposed_extension) && array_key_exists($proposed_extension, static::$mimes) && in_array($type, is_string(static::$mimes[$proposed_extension]) ? [static::$mimes[$proposed_extension]] : static::$mimes[$proposed_extension])) - { - return $proposed_extension; - } + if ( + !is_null($proposed_extension) && + array_key_exists($proposed_extension, static::$mimes) && + in_array( + $type, + is_string(static::$mimes[$proposed_extension]) + ? [static::$mimes[$proposed_extension]] + : static::$mimes[$proposed_extension] + ) + ) { + return $proposed_extension; + } - foreach (static::$mimes as $ext => $types) - { - if ((is_string($types) && $types === $type) || (is_array($types) && in_array($type, $types))) - { - return $ext; - } - } + foreach (static::$mimes as $ext => $types) { + if ( + (is_string($types) && $types === $type) || + (is_array($types) && in_array($type, $types)) + ) { + return $ext; + } + } - return null; - } - - //-------------------------------------------------------------------- + return null; + } + //-------------------------------------------------------------------- } diff --git a/app/Config/Modules.php b/app/Config/Modules.php index 28bbc7d930..e179f48969 100644 --- a/app/Config/Modules.php +++ b/app/Config/Modules.php @@ -3,7 +3,7 @@ // Cannot extend BaseConfig or looping resources occurs. class Modules { - /* + /* |-------------------------------------------------------------------------- | Auto-Discovery Enabled? |-------------------------------------------------------------------------- @@ -12,9 +12,9 @@ class Modules | $activeExplorers below. If false, no auto-discovery will happen at all, | giving a slight performance boost. */ - public $enabled = true; + public $enabled = true; - /* + /* |-------------------------------------------------------------------------- | Auto-Discovery Within Composer Packages Enabled? |-------------------------------------------------------------------------- @@ -22,9 +22,9 @@ class Modules | If true, then auto-discovery will happen across all namespaces loaded | by Composer, as well as the namespaces configured locally. */ - public $discoverInComposer = true; + public $discoverInComposer = true; - /* + /* |-------------------------------------------------------------------------- | Auto-discover Rules |-------------------------------------------------------------------------- @@ -33,35 +33,29 @@ class Modules | and used during the current application request. If it is not | listed here, only the base application elements will be used. */ - public $activeExplorers = [ - 'events', - 'registrars', - 'routes', - 'services', - ]; + public $activeExplorers = ['events', 'registrars', 'routes', 'services']; - /** - * Should the application auto-discover the requested resources. - * - * Valid values are: - * - events - * - registrars - * - routes - * - services - * - * @param string $alias - * - * @return boolean - */ - public function shouldDiscover(string $alias) - { - if (! $this->enabled) - { - return false; - } + /** + * Should the application auto-discover the requested resources. + * + * Valid values are: + * - events + * - registrars + * - routes + * - services + * + * @param string $alias + * + * @return boolean + */ + public function shouldDiscover(string $alias) + { + if (!$this->enabled) { + return false; + } - $alias = strtolower($alias); + $alias = strtolower($alias); - return in_array($alias, $this->activeExplorers); - } + return in_array($alias, $this->activeExplorers); + } } diff --git a/app/Config/Pager.php b/app/Config/Pager.php index 9b6ed83cb9..e3ada2e6c0 100644 --- a/app/Config/Pager.php +++ b/app/Config/Pager.php @@ -4,7 +4,7 @@ use CodeIgniter\Config\BaseConfig; class Pager extends BaseConfig { - /* + /* |-------------------------------------------------------------------------- | Templates |-------------------------------------------------------------------------- @@ -17,13 +17,13 @@ class Pager extends BaseConfig | and the desired group as $pagerGroup; | */ - public $templates = [ - 'default_full' => 'CodeIgniter\Pager\Views\default_full', - 'default_simple' => 'CodeIgniter\Pager\Views\default_simple', - 'default_head' => 'CodeIgniter\Pager\Views\default_head', - ]; + public $templates = [ + 'default_full' => 'CodeIgniter\Pager\Views\default_full', + 'default_simple' => 'CodeIgniter\Pager\Views\default_simple', + 'default_head' => 'CodeIgniter\Pager\Views\default_head', + ]; - /* + /* |-------------------------------------------------------------------------- | Items Per Page |-------------------------------------------------------------------------- @@ -31,5 +31,5 @@ class Pager extends BaseConfig | The default number of results shown in a single page. | */ - public $perPage = 20; + public $perPage = 20; } diff --git a/app/Config/Paths.php b/app/Config/Paths.php index 6251124c64..9c126be19f 100644 --- a/app/Config/Paths.php +++ b/app/Config/Paths.php @@ -11,67 +11,68 @@ class Paths { - /* - *--------------------------------------------------------------- - * SYSTEM FOLDER NAME - *--------------------------------------------------------------- - * - * This variable must contain the name of your "system" folder. - * Include the path if the folder is not in the same directory - * as this file. - */ - public $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system'; + /* + *--------------------------------------------------------------- + * SYSTEM FOLDER NAME + *--------------------------------------------------------------- + * + * This variable must contain the name of your "system" folder. + * Include the path if the folder is not in the same directory + * as this file. + */ + public $systemDirectory = + __DIR__ . '/../../vendor/codeigniter4/framework/system'; - /* - *--------------------------------------------------------------- - * APPLICATION FOLDER NAME - *--------------------------------------------------------------- - * - * If you want this front controller to use a different "app" - * folder than the default one you can set its name here. The folder - * can also be renamed or relocated anywhere on your getServer. If - * you do, use a full getServer path. For more info please see the user guide: - * http://codeigniter.com/user_guide/general/managing_apps.html - * - * NO TRAILING SLASH! - */ - public $appDirectory = __DIR__ . '/..'; + /* + *--------------------------------------------------------------- + * APPLICATION FOLDER NAME + *--------------------------------------------------------------- + * + * If you want this front controller to use a different "app" + * folder than the default one you can set its name here. The folder + * can also be renamed or relocated anywhere on your getServer. If + * you do, use a full getServer path. For more info please see the user guide: + * http://codeigniter.com/user_guide/general/managing_apps.html + * + * NO TRAILING SLASH! + */ + public $appDirectory = __DIR__ . '/..'; - /* - * --------------------------------------------------------------- - * WRITABLE DIRECTORY NAME - * --------------------------------------------------------------- - * - * This variable must contain the name of your "writable" directory. - * The writable directory allows you to group all directories that - * need write permission to a single place that can be tucked away - * for maximum security, keeping it out of the app and/or - * system directories. - */ - public $writableDirectory = __DIR__ . '/../../writable'; + /* + * --------------------------------------------------------------- + * WRITABLE DIRECTORY NAME + * --------------------------------------------------------------- + * + * This variable must contain the name of your "writable" directory. + * The writable directory allows you to group all directories that + * need write permission to a single place that can be tucked away + * for maximum security, keeping it out of the app and/or + * system directories. + */ + public $writableDirectory = __DIR__ . '/../../writable'; - /* - * --------------------------------------------------------------- - * TESTS DIRECTORY NAME - * --------------------------------------------------------------- - * - * This variable must contain the name of your "tests" directory. - * The writable directory allows you to group all directories that - * need write permission to a single place that can be tucked away - * for maximum security, keeping it out of the app and/or - * system directories. - */ - public $testsDirectory = __DIR__ . '/../../tests'; + /* + * --------------------------------------------------------------- + * TESTS DIRECTORY NAME + * --------------------------------------------------------------- + * + * This variable must contain the name of your "tests" directory. + * The writable directory allows you to group all directories that + * need write permission to a single place that can be tucked away + * for maximum security, keeping it out of the app and/or + * system directories. + */ + public $testsDirectory = __DIR__ . '/../../tests'; - /* - * --------------------------------------------------------------- - * VIEW DIRECTORY NAME - * --------------------------------------------------------------- - * - * This variable must contain the name of the directory that - * contains the view files used by your application. By - * default this is in `app/Views`. This value - * is used when no value is provided to `Services::renderer()`. - */ - public $viewDirectory = __DIR__ . '/../Views'; + /* + * --------------------------------------------------------------- + * VIEW DIRECTORY NAME + * --------------------------------------------------------------- + * + * This variable must contain the name of the directory that + * contains the view files used by your application. By + * default this is in `app/Views`. This value + * is used when no value is provided to `Services::renderer()`. + */ + public $viewDirectory = __DIR__ . '/../Views'; } diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 4ceab49121..dbdb709701 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -1,4 +1,6 @@ -<?php namespace Config; +<?php + +namespace Config; // Create a new instance of our RouteCollection class. $routes = Services::routes(); @@ -20,7 +22,8 @@ $routes->setDefaultMethod('index'); $routes->setTranslateURIDashes(false); $routes->set404Override(); $routes->setAutoRoute(false); -$routes->addPlaceholder('podcastName', '^@[a-z0-9\_]{1,191}$'); +$routes->addPlaceholder('podcastSlug', '@[a-z0-9\_]{1,191}'); +$routes->addPlaceholder('episodeSlug', '[a-z0-9\-]{1,191}'); /** * -------------------------------------------------------------------- @@ -30,9 +33,18 @@ $routes->addPlaceholder('podcastName', '^@[a-z0-9\_]{1,191}$'); // We get a performance increase by specifying the default // route since we don't have to scan directories. -$routes->get('/', 'Home::index'); -$routes->add('/podcasts/create', 'Podcasts::create'); -$routes->add('/(:podcastName)', 'Podcasts::podcastByHandle/$1'); +$routes->get('/', 'Home::index', ['as' => 'home']); +$routes->add('new-podcast', 'Podcasts::create', ['as' => 'podcasts_create']); + +$routes->group('(:podcastSlug)', function ($routes) { + $routes->add('/', 'Podcasts::view/$1', ['as' => 'podcasts_view']); + $routes->add('new-episode', 'Episodes::create/$1', [ + 'as' => 'episodes_create', + ]); + $routes->add('(:episodeSlug)', 'Episodes::view/$1/$2', [ + 'as' => 'episodes_view', + ]); +}); /** * -------------------------------------------------------------------- diff --git a/app/Config/Services.php b/app/Config/Services.php index fb85a734fe..2fe37be6aa 100644 --- a/app/Config/Services.php +++ b/app/Config/Services.php @@ -19,14 +19,11 @@ require_once SYSTEMPATH . 'Config/Services.php'; */ class Services extends CoreServices { - - // public static function example($getShared = true) - // { - // if ($getShared) - // { - // return static::getSharedInstance('example'); - // } - // - // return new \CodeIgniter\Example(); - // } + // public static function example($getShared = true) +// { +// if ($getShared) { +// return static::getSharedInstance('example'); +// } +// return new \CodeIgniter\Example(); +// } } diff --git a/app/Config/Toolbar.php b/app/Config/Toolbar.php index 8af156e89b..ba4087a61d 100644 --- a/app/Config/Toolbar.php +++ b/app/Config/Toolbar.php @@ -4,7 +4,7 @@ use CodeIgniter\Config\BaseConfig; class Toolbar extends BaseConfig { - /* + /* |-------------------------------------------------------------------------- | Debug Toolbar |-------------------------------------------------------------------------- @@ -16,18 +16,18 @@ class Toolbar extends BaseConfig | toolbarMaxHistory = Number of history files, 0 for none or -1 for unlimited | */ - public $collectors = [ - \CodeIgniter\Debug\Toolbar\Collectors\Timers::class, - \CodeIgniter\Debug\Toolbar\Collectors\Database::class, - \CodeIgniter\Debug\Toolbar\Collectors\Logs::class, - \CodeIgniter\Debug\Toolbar\Collectors\Views::class, - // \CodeIgniter\Debug\Toolbar\Collectors\Cache::class, - \CodeIgniter\Debug\Toolbar\Collectors\Files::class, - \CodeIgniter\Debug\Toolbar\Collectors\Routes::class, - \CodeIgniter\Debug\Toolbar\Collectors\Events::class, - ]; + public $collectors = [ + \CodeIgniter\Debug\Toolbar\Collectors\Timers::class, + \CodeIgniter\Debug\Toolbar\Collectors\Database::class, + \CodeIgniter\Debug\Toolbar\Collectors\Logs::class, + \CodeIgniter\Debug\Toolbar\Collectors\Views::class, + // \CodeIgniter\Debug\Toolbar\Collectors\Cache::class, + \CodeIgniter\Debug\Toolbar\Collectors\Files::class, + \CodeIgniter\Debug\Toolbar\Collectors\Routes::class, + \CodeIgniter\Debug\Toolbar\Collectors\Events::class, + ]; - /* + /* |-------------------------------------------------------------------------- | Max History |-------------------------------------------------------------------------- @@ -40,9 +40,9 @@ class Toolbar extends BaseConfig | 0 (zero) to not have any history stored, or -1 for unlimited history. | */ - public $maxHistory = 20; + public $maxHistory = 20; - /* + /* |-------------------------------------------------------------------------- | Toolbar Views Path |-------------------------------------------------------------------------- @@ -50,9 +50,9 @@ class Toolbar extends BaseConfig | MUST have a trailing slash. | */ - public $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/'; + public $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/'; - /* + /* |-------------------------------------------------------------------------- | Max Queries |-------------------------------------------------------------------------- @@ -64,5 +64,5 @@ class Toolbar extends BaseConfig | $maxQueries defines the maximum amount of queries that will be stored. | */ - public $maxQueries = 100; + public $maxQueries = 100; } diff --git a/app/Config/UserAgents.php b/app/Config/UserAgents.php index 326a5d8a60..8cf7b2f691 100644 --- a/app/Config/UserAgents.php +++ b/app/Config/UserAgents.php @@ -4,7 +4,7 @@ use CodeIgniter\Config\BaseConfig; class UserAgents extends BaseConfig { - /* + /* | ------------------------------------------------------------------- | USER AGENT TYPES | ------------------------------------------------------------------- @@ -13,206 +13,206 @@ class UserAgents extends BaseConfig | mobile device data. The array keys are used to identify the device | and the array values are used to set the actual name of the item. */ - public $platforms = [ - 'windows nt 10.0' => 'Windows 10', - 'windows nt 6.3' => 'Windows 8.1', - 'windows nt 6.2' => 'Windows 8', - 'windows nt 6.1' => 'Windows 7', - 'windows nt 6.0' => 'Windows Vista', - 'windows nt 5.2' => 'Windows 2003', - 'windows nt 5.1' => 'Windows XP', - 'windows nt 5.0' => 'Windows 2000', - 'windows nt 4.0' => 'Windows NT 4.0', - 'winnt4.0' => 'Windows NT 4.0', - 'winnt 4.0' => 'Windows NT', - 'winnt' => 'Windows NT', - 'windows 98' => 'Windows 98', - 'win98' => 'Windows 98', - 'windows 95' => 'Windows 95', - 'win95' => 'Windows 95', - 'windows phone' => 'Windows Phone', - 'windows' => 'Unknown Windows OS', - 'android' => 'Android', - 'blackberry' => 'BlackBerry', - 'iphone' => 'iOS', - 'ipad' => 'iOS', - 'ipod' => 'iOS', - 'os x' => 'Mac OS X', - 'ppc mac' => 'Power PC Mac', - 'freebsd' => 'FreeBSD', - 'ppc' => 'Macintosh', - 'linux' => 'Linux', - 'debian' => 'Debian', - 'sunos' => 'Sun Solaris', - 'beos' => 'BeOS', - 'apachebench' => 'ApacheBench', - 'aix' => 'AIX', - 'irix' => 'Irix', - 'osf' => 'DEC OSF', - 'hp-ux' => 'HP-UX', - 'netbsd' => 'NetBSD', - 'bsdi' => 'BSDi', - 'openbsd' => 'OpenBSD', - 'gnu' => 'GNU/Linux', - 'unix' => 'Unknown Unix OS', - 'symbian' => 'Symbian OS', - ]; + public $platforms = [ + 'windows nt 10.0' => 'Windows 10', + 'windows nt 6.3' => 'Windows 8.1', + 'windows nt 6.2' => 'Windows 8', + 'windows nt 6.1' => 'Windows 7', + 'windows nt 6.0' => 'Windows Vista', + 'windows nt 5.2' => 'Windows 2003', + 'windows nt 5.1' => 'Windows XP', + 'windows nt 5.0' => 'Windows 2000', + 'windows nt 4.0' => 'Windows NT 4.0', + 'winnt4.0' => 'Windows NT 4.0', + 'winnt 4.0' => 'Windows NT', + 'winnt' => 'Windows NT', + 'windows 98' => 'Windows 98', + 'win98' => 'Windows 98', + 'windows 95' => 'Windows 95', + 'win95' => 'Windows 95', + 'windows phone' => 'Windows Phone', + 'windows' => 'Unknown Windows OS', + 'android' => 'Android', + 'blackberry' => 'BlackBerry', + 'iphone' => 'iOS', + 'ipad' => 'iOS', + 'ipod' => 'iOS', + 'os x' => 'Mac OS X', + 'ppc mac' => 'Power PC Mac', + 'freebsd' => 'FreeBSD', + 'ppc' => 'Macintosh', + 'linux' => 'Linux', + 'debian' => 'Debian', + 'sunos' => 'Sun Solaris', + 'beos' => 'BeOS', + 'apachebench' => 'ApacheBench', + 'aix' => 'AIX', + 'irix' => 'Irix', + 'osf' => 'DEC OSF', + 'hp-ux' => 'HP-UX', + 'netbsd' => 'NetBSD', + 'bsdi' => 'BSDi', + 'openbsd' => 'OpenBSD', + 'gnu' => 'GNU/Linux', + 'unix' => 'Unknown Unix OS', + 'symbian' => 'Symbian OS', + ]; - // The order of this array should NOT be changed. Many browsers return - // multiple browser types so we want to identify the sub-type first. - public $browsers = [ - 'OPR' => 'Opera', - 'Flock' => 'Flock', - 'Edge' => 'Spartan', - 'Chrome' => 'Chrome', - // Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string - 'Opera.*?Version' => 'Opera', - 'Opera' => 'Opera', - 'MSIE' => 'Internet Explorer', - 'Internet Explorer' => 'Internet Explorer', - 'Trident.* rv' => 'Internet Explorer', - 'Shiira' => 'Shiira', - 'Firefox' => 'Firefox', - 'Chimera' => 'Chimera', - 'Phoenix' => 'Phoenix', - 'Firebird' => 'Firebird', - 'Camino' => 'Camino', - 'Netscape' => 'Netscape', - 'OmniWeb' => 'OmniWeb', - 'Safari' => 'Safari', - 'Mozilla' => 'Mozilla', - 'Konqueror' => 'Konqueror', - 'icab' => 'iCab', - 'Lynx' => 'Lynx', - 'Links' => 'Links', - 'hotjava' => 'HotJava', - 'amaya' => 'Amaya', - 'IBrowse' => 'IBrowse', - 'Maxthon' => 'Maxthon', - 'Ubuntu' => 'Ubuntu Web Browser', - 'Vivaldi' => 'Vivaldi', - ]; + // The order of this array should NOT be changed. Many browsers return + // multiple browser types so we want to identify the sub-type first. + public $browsers = [ + 'OPR' => 'Opera', + 'Flock' => 'Flock', + 'Edge' => 'Spartan', + 'Chrome' => 'Chrome', + // Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string + 'Opera.*?Version' => 'Opera', + 'Opera' => 'Opera', + 'MSIE' => 'Internet Explorer', + 'Internet Explorer' => 'Internet Explorer', + 'Trident.* rv' => 'Internet Explorer', + 'Shiira' => 'Shiira', + 'Firefox' => 'Firefox', + 'Chimera' => 'Chimera', + 'Phoenix' => 'Phoenix', + 'Firebird' => 'Firebird', + 'Camino' => 'Camino', + 'Netscape' => 'Netscape', + 'OmniWeb' => 'OmniWeb', + 'Safari' => 'Safari', + 'Mozilla' => 'Mozilla', + 'Konqueror' => 'Konqueror', + 'icab' => 'iCab', + 'Lynx' => 'Lynx', + 'Links' => 'Links', + 'hotjava' => 'HotJava', + 'amaya' => 'Amaya', + 'IBrowse' => 'IBrowse', + 'Maxthon' => 'Maxthon', + 'Ubuntu' => 'Ubuntu Web Browser', + 'Vivaldi' => 'Vivaldi', + ]; - public $mobiles = [ - // legacy array, old values commented out - 'mobileexplorer' => 'Mobile Explorer', - // 'openwave' => 'Open Wave', - // 'opera mini' => 'Opera Mini', - // 'operamini' => 'Opera Mini', - // 'elaine' => 'Palm', - 'palmsource' => 'Palm', - // 'digital paths' => 'Palm', - // 'avantgo' => 'Avantgo', - // 'xiino' => 'Xiino', - 'palmscape' => 'Palmscape', - // 'nokia' => 'Nokia', - // 'ericsson' => 'Ericsson', - // 'blackberry' => 'BlackBerry', - // 'motorola' => 'Motorola' + public $mobiles = [ + // legacy array, old values commented out + 'mobileexplorer' => 'Mobile Explorer', + // 'openwave' => 'Open Wave', + // 'opera mini' => 'Opera Mini', + // 'operamini' => 'Opera Mini', + // 'elaine' => 'Palm', + 'palmsource' => 'Palm', + // 'digital paths' => 'Palm', + // 'avantgo' => 'Avantgo', + // 'xiino' => 'Xiino', + 'palmscape' => 'Palmscape', + // 'nokia' => 'Nokia', + // 'ericsson' => 'Ericsson', + // 'blackberry' => 'BlackBerry', + // 'motorola' => 'Motorola' - // Phones and Manufacturers - 'motorola' => 'Motorola', - 'nokia' => 'Nokia', - 'palm' => 'Palm', - 'iphone' => 'Apple iPhone', - 'ipad' => 'iPad', - 'ipod' => 'Apple iPod Touch', - 'sony' => 'Sony Ericsson', - 'ericsson' => 'Sony Ericsson', - 'blackberry' => 'BlackBerry', - 'cocoon' => 'O2 Cocoon', - 'blazer' => 'Treo', - 'lg' => 'LG', - 'amoi' => 'Amoi', - 'xda' => 'XDA', - 'mda' => 'MDA', - 'vario' => 'Vario', - 'htc' => 'HTC', - 'samsung' => 'Samsung', - 'sharp' => 'Sharp', - 'sie-' => 'Siemens', - 'alcatel' => 'Alcatel', - 'benq' => 'BenQ', - 'ipaq' => 'HP iPaq', - 'mot-' => 'Motorola', - 'playstation portable' => 'PlayStation Portable', - 'playstation 3' => 'PlayStation 3', - 'playstation vita' => 'PlayStation Vita', - 'hiptop' => 'Danger Hiptop', - 'nec-' => 'NEC', - 'panasonic' => 'Panasonic', - 'philips' => 'Philips', - 'sagem' => 'Sagem', - 'sanyo' => 'Sanyo', - 'spv' => 'SPV', - 'zte' => 'ZTE', - 'sendo' => 'Sendo', - 'nintendo dsi' => 'Nintendo DSi', - 'nintendo ds' => 'Nintendo DS', - 'nintendo 3ds' => 'Nintendo 3DS', - 'wii' => 'Nintendo Wii', - 'open web' => 'Open Web', - 'openweb' => 'OpenWeb', + // Phones and Manufacturers + 'motorola' => 'Motorola', + 'nokia' => 'Nokia', + 'palm' => 'Palm', + 'iphone' => 'Apple iPhone', + 'ipad' => 'iPad', + 'ipod' => 'Apple iPod Touch', + 'sony' => 'Sony Ericsson', + 'ericsson' => 'Sony Ericsson', + 'blackberry' => 'BlackBerry', + 'cocoon' => 'O2 Cocoon', + 'blazer' => 'Treo', + 'lg' => 'LG', + 'amoi' => 'Amoi', + 'xda' => 'XDA', + 'mda' => 'MDA', + 'vario' => 'Vario', + 'htc' => 'HTC', + 'samsung' => 'Samsung', + 'sharp' => 'Sharp', + 'sie-' => 'Siemens', + 'alcatel' => 'Alcatel', + 'benq' => 'BenQ', + 'ipaq' => 'HP iPaq', + 'mot-' => 'Motorola', + 'playstation portable' => 'PlayStation Portable', + 'playstation 3' => 'PlayStation 3', + 'playstation vita' => 'PlayStation Vita', + 'hiptop' => 'Danger Hiptop', + 'nec-' => 'NEC', + 'panasonic' => 'Panasonic', + 'philips' => 'Philips', + 'sagem' => 'Sagem', + 'sanyo' => 'Sanyo', + 'spv' => 'SPV', + 'zte' => 'ZTE', + 'sendo' => 'Sendo', + 'nintendo dsi' => 'Nintendo DSi', + 'nintendo ds' => 'Nintendo DS', + 'nintendo 3ds' => 'Nintendo 3DS', + 'wii' => 'Nintendo Wii', + 'open web' => 'Open Web', + 'openweb' => 'OpenWeb', - // Operating Systems - 'android' => 'Android', - 'symbian' => 'Symbian', - 'SymbianOS' => 'SymbianOS', - 'elaine' => 'Palm', - 'series60' => 'Symbian S60', - 'windows ce' => 'Windows CE', + // Operating Systems + 'android' => 'Android', + 'symbian' => 'Symbian', + 'SymbianOS' => 'SymbianOS', + 'elaine' => 'Palm', + 'series60' => 'Symbian S60', + 'windows ce' => 'Windows CE', - // Browsers - 'obigo' => 'Obigo', - 'netfront' => 'Netfront Browser', - 'openwave' => 'Openwave Browser', - 'mobilexplorer' => 'Mobile Explorer', - 'operamini' => 'Opera Mini', - 'opera mini' => 'Opera Mini', - 'opera mobi' => 'Opera Mobile', - 'fennec' => 'Firefox Mobile', + // Browsers + 'obigo' => 'Obigo', + 'netfront' => 'Netfront Browser', + 'openwave' => 'Openwave Browser', + 'mobilexplorer' => 'Mobile Explorer', + 'operamini' => 'Opera Mini', + 'opera mini' => 'Opera Mini', + 'opera mobi' => 'Opera Mobile', + 'fennec' => 'Firefox Mobile', - // Other - 'digital paths' => 'Digital Paths', - 'avantgo' => 'AvantGo', - 'xiino' => 'Xiino', - 'novarra' => 'Novarra Transcoder', - 'vodafone' => 'Vodafone', - 'docomo' => 'NTT DoCoMo', - 'o2' => 'O2', + // Other + 'digital paths' => 'Digital Paths', + 'avantgo' => 'AvantGo', + 'xiino' => 'Xiino', + 'novarra' => 'Novarra Transcoder', + 'vodafone' => 'Vodafone', + 'docomo' => 'NTT DoCoMo', + 'o2' => 'O2', - // Fallback - 'mobile' => 'Generic Mobile', - 'wireless' => 'Generic Mobile', - 'j2me' => 'Generic Mobile', - 'midp' => 'Generic Mobile', - 'cldc' => 'Generic Mobile', - 'up.link' => 'Generic Mobile', - 'up.browser' => 'Generic Mobile', - 'smartphone' => 'Generic Mobile', - 'cellphone' => 'Generic Mobile', - ]; + // Fallback + 'mobile' => 'Generic Mobile', + 'wireless' => 'Generic Mobile', + 'j2me' => 'Generic Mobile', + 'midp' => 'Generic Mobile', + 'cldc' => 'Generic Mobile', + 'up.link' => 'Generic Mobile', + 'up.browser' => 'Generic Mobile', + 'smartphone' => 'Generic Mobile', + 'cellphone' => 'Generic Mobile', + ]; - // There are hundreds of bots but these are the most common. - public $robots = [ - 'googlebot' => 'Googlebot', - 'msnbot' => 'MSNBot', - 'baiduspider' => 'Baiduspider', - 'bingbot' => 'Bing', - 'slurp' => 'Inktomi Slurp', - 'yahoo' => 'Yahoo', - 'ask jeeves' => 'Ask Jeeves', - 'fastcrawler' => 'FastCrawler', - 'infoseek' => 'InfoSeek Robot 1.0', - 'lycos' => 'Lycos', - 'yandex' => 'YandexBot', - 'mediapartners-google' => 'MediaPartners Google', - 'CRAZYWEBCRAWLER' => 'Crazy Webcrawler', - 'adsbot-google' => 'AdsBot Google', - 'feedfetcher-google' => 'Feedfetcher Google', - 'curious george' => 'Curious George', - 'ia_archiver' => 'Alexa Crawler', - 'MJ12bot' => 'Majestic-12', - 'Uptimebot' => 'Uptimebot', - ]; + // There are hundreds of bots but these are the most common. + public $robots = [ + 'googlebot' => 'Googlebot', + 'msnbot' => 'MSNBot', + 'baiduspider' => 'Baiduspider', + 'bingbot' => 'Bing', + 'slurp' => 'Inktomi Slurp', + 'yahoo' => 'Yahoo', + 'ask jeeves' => 'Ask Jeeves', + 'fastcrawler' => 'FastCrawler', + 'infoseek' => 'InfoSeek Robot 1.0', + 'lycos' => 'Lycos', + 'yandex' => 'YandexBot', + 'mediapartners-google' => 'MediaPartners Google', + 'CRAZYWEBCRAWLER' => 'Crazy Webcrawler', + 'adsbot-google' => 'AdsBot Google', + 'feedfetcher-google' => 'Feedfetcher Google', + 'curious george' => 'Curious George', + 'ia_archiver' => 'Alexa Crawler', + 'MJ12bot' => 'Majestic-12', + 'Uptimebot' => 'Uptimebot', + ]; } diff --git a/app/Config/Validation.php b/app/Config/Validation.php index 97f08c7526..ba4ac7cd4f 100644 --- a/app/Config/Validation.php +++ b/app/Config/Validation.php @@ -2,35 +2,35 @@ class Validation { - //-------------------------------------------------------------------- - // Setup - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Setup + //-------------------------------------------------------------------- - /** - * Stores the classes that contain the - * rules that are available. - * - * @var array - */ - public $ruleSets = [ - \CodeIgniter\Validation\Rules::class, - \CodeIgniter\Validation\FormatRules::class, - \CodeIgniter\Validation\FileRules::class, - \CodeIgniter\Validation\CreditCardRules::class, - ]; + /** + * Stores the classes that contain the + * rules that are available. + * + * @var array + */ + public $ruleSets = [ + \CodeIgniter\Validation\Rules::class, + \CodeIgniter\Validation\FormatRules::class, + \CodeIgniter\Validation\FileRules::class, + \CodeIgniter\Validation\CreditCardRules::class, + ]; - /** - * Specifies the views that are used to display the - * errors. - * - * @var array - */ - public $templates = [ - 'list' => 'CodeIgniter\Validation\Views\list', - 'single' => 'CodeIgniter\Validation\Views\single', - ]; + /** + * Specifies the views that are used to display the + * errors. + * + * @var array + */ + public $templates = [ + 'list' => 'CodeIgniter\Validation\Views\list', + 'single' => 'CodeIgniter\Validation\Views\single', + ]; - //-------------------------------------------------------------------- - // Rules - //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + // Rules + //-------------------------------------------------------------------- } diff --git a/app/Config/View.php b/app/Config/View.php index f66b2532f0..9e8f2a2542 100644 --- a/app/Config/View.php +++ b/app/Config/View.php @@ -2,33 +2,33 @@ class View extends \CodeIgniter\Config\View { - /** - * When false, the view method will clear the data between each - * call. This keeps your data safe and ensures there is no accidental - * leaking between calls, so you would need to explicitly pass the data - * to each view. You might prefer to have the data stick around between - * calls so that it is available to all views. If that is the case, - * set $saveData to true. - */ - public $saveData = true; + /** + * When false, the view method will clear the data between each + * call. This keeps your data safe and ensures there is no accidental + * leaking between calls, so you would need to explicitly pass the data + * to each view. You might prefer to have the data stick around between + * calls so that it is available to all views. If that is the case, + * set $saveData to true. + */ + public $saveData = true; - /** - * Parser Filters map a filter name with any PHP callable. When the - * Parser prepares a variable for display, it will chain it - * through the filters in the order defined, inserting any parameters. - * To prevent potential abuse, all filters MUST be defined here - * in order for them to be available for use within the Parser. - * - * Examples: - * { title|esc(js) } - * { created_on|date(Y-m-d)|esc(attr) } - */ - public $filters = []; + /** + * Parser Filters map a filter name with any PHP callable. When the + * Parser prepares a variable for display, it will chain it + * through the filters in the order defined, inserting any parameters. + * To prevent potential abuse, all filters MUST be defined here + * in order for them to be available for use within the Parser. + * + * Examples: + * { title|esc(js) } + * { created_on|date(Y-m-d)|esc(attr) } + */ + public $filters = []; - /** - * Parser Plugins provide a way to extend the functionality provided - * by the core Parser by creating aliases that will be replaced with - * any callable. Can be single or tag pair. - */ - public $plugins = []; + /** + * Parser Plugins provide a way to extend the functionality provided + * by the core Parser by creating aliases that will be replaced with + * any callable. Can be single or tag pair. + */ + public $plugins = []; } diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 252692f08b..22c55eb72e 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -1,4 +1,5 @@ <?php + namespace App\Controllers; /** @@ -18,29 +19,30 @@ use CodeIgniter\Controller; class BaseController extends Controller { + /** + * An array of helpers to be loaded automatically upon + * class instantiation. These helpers will be available + * to all other controllers that extend BaseController. + * + * @var array + */ + protected $helpers = []; - /** - * An array of helpers to be loaded automatically upon - * class instantiation. These helpers will be available - * to all other controllers that extend BaseController. - * - * @var array - */ - protected $helpers = []; - - /** - * Constructor. - */ - public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) - { - // Do Not Edit This Line - parent::initController($request, $response, $logger); - - //-------------------------------------------------------------------- - // Preload any models, libraries, etc, here. - //-------------------------------------------------------------------- - // E.g.: - // $this->session = \Config\Services::session(); - } + /** + * Constructor. + */ + public function initController( + \CodeIgniter\HTTP\RequestInterface $request, + \CodeIgniter\HTTP\ResponseInterface $response, + \Psr\Log\LoggerInterface $logger + ) { + // Do Not Edit This Line + parent::initController($request, $response, $logger); + //-------------------------------------------------------------------- + // Preload any models, libraries, etc, here. + //-------------------------------------------------------------------- + // E.g.: + // $this->session = \Config\Services::session(); + } } diff --git a/app/Controllers/Episodes.php b/app/Controllers/Episodes.php new file mode 100644 index 0000000000..a3527ece2f --- /dev/null +++ b/app/Controllers/Episodes.php @@ -0,0 +1,113 @@ +<?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ + +namespace App\Controllers; + +use App\Models\EpisodeModel; +use App\Models\PodcastModel; + +class Episodes extends BaseController +{ + public function create($podcast_slug) + { + helper(['form', 'database', 'file']); + + $episode_model = new EpisodeModel(); + $podcast_model = new PodcastModel(); + $podcast_name = substr($podcast_slug, 1); + $podcast = $podcast_model->where('name', $podcast_name)->first(); + + if ( + !$this->validate([ + 'episode_file' => + 'uploaded[episode_file]|ext_in[episode_file,mp3,m4a]', + 'title' => 'required', + 'slug' => 'required', + 'description' => 'required', + ]) + ) { + $data = [ + 'podcast' => $podcast, + 'episode_types' => field_enums( + $episode_model->prefixTable('episodes'), + 'type' + ), + ]; + + echo view('episodes/create', $data); + } else { + $episode_slug = $this->request->getVar('slug'); + + $episode_file = $this->request->getFile('episode_file'); + $episode_file_metadata = get_file_metadata($episode_file); + $episode_file_name = + $episode_slug . '.' . $episode_file->getExtension(); + $episode_path = save_podcast_media( + $episode_file, + $podcast_name, + $episode_file_name + ); + + $image = $this->request->getFile('image'); + $image_path = ''; + if ($image->isValid()) { + $image_name = $episode_slug . '.' . $image->getExtension(); + $image_path = save_podcast_media( + $image, + $podcast_name, + $image_name + ); + } + + $episode_model->save([ + 'podcast_id' => $podcast->id, + 'title' => $this->request->getVar('title'), + 'slug' => $episode_slug, + 'enclosure_url' => $episode_path, + 'enclosure_length' => $episode_file->getSize(), + 'enclosure_type' => $episode_file_metadata['mime_type'], + 'guid' => $podcast_slug . '/' . $episode_slug, + 'pub_date' => $this->request->getVar('pub_date'), + 'description' => $this->request->getVar('description'), + 'duration' => $episode_file_metadata['playtime_seconds'], + 'image' => $image_path, + 'explicit' => $this->request->getVar('explicit') or false, + 'episode_number' => + $this->request->getVar('episode_number') or null, + 'season_number' => + $this->request->getVar('season_number') or null, + 'type' => $this->request->getVar('type'), + 'block' => $this->request->getVar('block') or false, + ]); + + return redirect()->to( + base_url( + route_to( + 'episodes_view', + '/@' . $podcast_name, + $episode_slug + ) + ) + ); + } + } + + public function view($podcast_slug, $episode_slug) + { + $podcast_model = new PodcastModel(); + $episode_model = new EpisodeModel(); + + $data = [ + 'podcast' => $podcast_model + ->where('name', substr($podcast_slug, 1)) + ->first(), + 'episode' => $episode_model->where('slug', $episode_slug)->first(), + ]; + + return view('episodes/view.php', $data); + } +} diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index f4dde8dc8e..e68ff7eb49 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -1,4 +1,9 @@ <?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Controllers; @@ -6,14 +11,11 @@ use App\Models\PodcastModel; class Home extends BaseController { - public function index() - { - $model = new PodcastModel(); - $data = ["podcasts" => $model->findAll()]; - - return view('home', $data); - } - - //-------------------------------------------------------------------- + public function index() + { + $model = new PodcastModel(); + $data = ['podcasts' => $model->findAll()]; + return view('home', $data); + } } diff --git a/app/Controllers/Migrate.php b/app/Controllers/Migrate.php index 6a5db34e61..0155b49be5 100644 --- a/app/Controllers/Migrate.php +++ b/app/Controllers/Migrate.php @@ -1,12 +1,16 @@ <?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Controllers; -use \CodeIgniter\Controller; +use CodeIgniter\Controller; class Migrate extends Controller { - public function index() { $migrate = \Config\Services::migrations(); diff --git a/app/Controllers/Podcasts.php b/app/Controllers/Podcasts.php index 161d6f95b0..f118a163aa 100644 --- a/app/Controllers/Podcasts.php +++ b/app/Controllers/Podcasts.php @@ -1,61 +1,68 @@ -<?php namespace App\Controllers; +<?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ + +namespace App\Controllers; use App\Models\CategoryModel; +use App\Models\EpisodeModel; use App\Models\LanguageModel; use App\Models\PodcastModel; -use RuntimeException; class Podcasts extends BaseController { - public function index() - { - return view('podcast/index.php'); - } - public function create() { - $model = new PodcastModel(); - helper(['form', 'url']); - - if (!$this->validate([ - 'title' => 'required', - 'name' => 'required|regex_match[^[a-z0-9\_]{1,191}$]', - 'description' => 'required|max_length[4000]', - 'image' => 'uploaded[image]|is_image[image]|ext_in[image,jpg,png]|max_dims[image,3000,3000]', - 'owner_email' => 'required|valid_email|permit_empty', - 'type' => 'required', - ])) { - $langs = explode(',', $this->request->getServer('HTTP_ACCEPT_LANGUAGE')); - $browser_lang = ''; - if (!empty($langs)) { - $browser_lang = substr($langs[0], 0, 2); - } + helper(['form', 'database', 'file', 'misc']); + $podcast_model = new PodcastModel(); + if ( + !$this->validate([ + 'title' => 'required', + 'name' => 'required|regex_match[^[a-z0-9\_]{1,191}$]', + 'description' => 'required|max_length[4000]', + 'image' => + 'uploaded[image]|is_image[image]|ext_in[image,jpg,png]|max_dims[image,3000,3000]', + 'owner_email' => 'required|valid_email|permit_empty', + 'type' => 'required', + ]) + ) { $languageModel = new LanguageModel(); $categoryModel = new CategoryModel(); $data = [ 'languages' => $languageModel->findAll(), 'categories' => $categoryModel->findAll(), - 'browser_lang' => $browser_lang, + 'browser_lang' => get_browser_language( + $this->request->getServer('HTTP_ACCEPT_LANGUAGE') + ), + 'podcast_types' => field_enums( + $podcast_model->prefixTable('podcasts'), + 'type' + ), ]; echo view('podcasts/create', $data); } else { $image = $this->request->getFile('image'); - if (!$image->isValid()) { - throw new RuntimeException($image->getErrorString() . '(' . $image->getError() . ')'); - } $podcast_name = $this->request->getVar('name'); $image_name = 'cover.' . $image->getExtension(); - $image_storage_folder = 'media/' . $podcast_name . '/'; - $image->move($image_storage_folder, $image_name); + $image_path = save_podcast_media( + $image, + $podcast_name, + $image_name + ); - $model->save([ + $podcast_model->save([ 'title' => $this->request->getVar('title'), 'name' => $podcast_name, 'description' => $this->request->getVar('description'), - 'episode_description_footer' => $this->request->getVar('episode_description_footer'), - 'image' => $image_storage_folder . $image_name, + 'episode_description_footer' => $this->request->getVar( + 'episode_description_footer' + ), + 'image' => $image_path, 'language' => $this->request->getVar('language'), 'category' => $this->request->getVar('category'), 'explicit' => $this->request->getVar('explicit') or false, @@ -66,21 +73,32 @@ class Podcasts extends BaseController 'copyright' => $this->request->getVar('copyright'), 'block' => $this->request->getVar('block') or false, 'complete' => $this->request->getVar('complete') or false, - 'custom_html_head' => $this->request->getVar('custom_html_head'), + 'custom_html_head' => $this->request->getVar( + 'custom_html_head' + ), ]); - return redirect()->to(base_url('/@' . $podcast_name)); + return redirect()->to( + base_url(route_to('podcasts_view', '@' . $podcast_name)) + ); } } - public function podcastByHandle($handle) + public function view($slug) { - $model = new PodcastModel(); + $podcast_model = new PodcastModel(); + $episode_model = new EpisodeModel(); - $podcast_name = substr($handle, 1); + $podcast_name = substr($slug, 1); - $data['podcast'] = $model->where('name', $podcast_name)->first(); + $podcast = $podcast_model->where('name', $podcast_name)->first(); + $data = [ + 'podcast' => $podcast, + 'episodes' => $episode_model + ->where('podcast_id', $podcast->id) + ->findAll(), + ]; - return view('podcasts/view.php', $data); + return view('podcasts/view', $data); } } diff --git a/app/Database/Migrations/2020-05-29-152000_add_categories.php b/app/Database/Migrations/2020-05-29-152000_add_categories.php index 0eba773a7f..86f062ce47 100644 --- a/app/Database/Migrations/2020-05-29-152000_add_categories.php +++ b/app/Database/Migrations/2020-05-29-152000_add_categories.php @@ -1,12 +1,19 @@ <?php +/** + * Class AddCategories + * Creates categories table in database + * + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Database\Migrations; -use \CodeIgniter\Database\Migration; +use CodeIgniter\Database\Migration; class AddCategories extends Migration { - public function up() { $this->forge->addField([ diff --git a/app/Database/Migrations/2020-05-30-101000_add_languages.php b/app/Database/Migrations/2020-05-30-101000_add_languages.php index c2c058aa6e..fa7c0b71e2 100644 --- a/app/Database/Migrations/2020-05-30-101000_add_languages.php +++ b/app/Database/Migrations/2020-05-30-101000_add_languages.php @@ -1,12 +1,19 @@ <?php +/** + * Class AddLanguages + * Creates languages table in database + * + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Database\Migrations; -use \CodeIgniter\Database\Migration; +use CodeIgniter\Database\Migration; class AddLanguages extends Migration { - public function up() { $this->forge->addField([ diff --git a/app/Database/Migrations/2020-05-30-101500_add_podcasts.php b/app/Database/Migrations/2020-05-30-101500_add_podcasts.php index 5a649cbe0d..fae5b0f9b3 100644 --- a/app/Database/Migrations/2020-05-30-101500_add_podcasts.php +++ b/app/Database/Migrations/2020-05-30-101500_add_podcasts.php @@ -1,12 +1,19 @@ <?php +/** + * Class AddPodcasts + * Creates podcasts table in database + * + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Database\Migrations; -use \CodeIgniter\Database\Migration; +use CodeIgniter\Database\Migration; class AddPodcasts extends Migration { - public function up() { $this->forge->addField([ @@ -20,7 +27,8 @@ class AddPodcasts extends Migration 'title' => [ 'type' => 'VARCHAR', 'constraint' => 1024, - 'comment' => 'The show title. It’s important to have a clear, concise name for your podcast. Make your title specific. A show titled Our Community Bulletin is too vague to attract many subscribers, no matter how compelling the content. Pay close attention to the title as Apple Podcasts uses this field for search. If you include a long list of keywords in an attempt to game podcast search, your show may be removed from the Apple directory.', + 'comment' => + 'The show title. It’s important to have a clear, concise name for your podcast. Make your title specific. A show titled Our Community Bulletin is too vague to attract many subscribers, no matter how compelling the content. Pay close attention to the title as Apple Podcasts uses this field for search. If you include a long list of keywords in an attempt to game podcast search, your show may be removed from the Apple directory.', ], 'name' => [ 'type' => 'VARCHAR', @@ -31,81 +39,94 @@ class AddPodcasts extends Migration 'description' => [ 'type' => 'TEXT', 'null' => true, - 'comment' => 'The show description. Where description is text containing one or more sentences describing your podcast to potential listeners. The maximum amount of text allowed for this tag is 4000 characters. To include links in your description or rich HTML, adhere to the following technical guidelines: enclose all portions of your XML that contain embedded HTML in a CDATA section to prevent formatting issues, and to ensure proper link functionality.', - 'null' => true, + 'comment' => + 'The show description. Where description is text containing one or more sentences describing your podcast to potential listeners. The maximum amount of text allowed for this tag is 4000 characters. To include links in your description or rich HTML, adhere to the following technical guidelines: enclose all portions of your XML that contain embedded HTML in a CDATA section to prevent formatting issues, and to ensure proper link functionality.', ], 'image' => [ 'type' => 'VARCHAR', 'constraint' => 1024, - 'comment' => 'The artwork for the show. Specify your show artwork by providing a URL linking to it. Depending on their device, subscribers see your podcast artwork in varying sizes. Therefore, make sure your design is effective at both its original size and at thumbnail size. You should include a show title, brand, or source name as part of your podcast artwork. Artwork must be a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels, in JPEG or PNG format, 72 dpi, with appropriate file extensions (.jpg, .png), and in the RGB colorspace.', + 'comment' => + 'The artwork for the show. Specify your show artwork by providing a URL linking to it. Depending on their device, subscribers see your podcast artwork in varying sizes. Therefore, make sure your design is effective at both its original size and at thumbnail size. You should include a show title, brand, or source name as part of your podcast artwork. Artwork must be a minimum size of 1400 x 1400 pixels and a maximum size of 3000 x 3000 pixels, in JPEG or PNG format, 72 dpi, with appropriate file extensions (.jpg, .png), and in the RGB colorspace.', ], 'language' => [ 'type' => 'VARCHAR', 'constraint' => 2, - 'comment' => 'The language spoken on the show. Because Apple Podcasts is available in territories around the world, it is critical to specify the language of a podcast. Apple Podcasts only supports values from the ISO 639 list (two-letter language codes, with some possible modifiers, such as "en-us"). Invalid language codes will cause your feed to fail Apple validation.', + 'comment' => + 'The language spoken on the show. Because Apple Podcasts is available in territories around the world, it is critical to specify the language of a podcast. Apple Podcasts only supports values from the ISO 639 list (two-letter language codes, with some possible modifiers, such as "en-us"). Invalid language codes will cause your feed to fail Apple validation.', ], 'category' => [ 'type' => 'VARCHAR', 'constraint' => 1024, - 'comment' => 'The show category information. For a complete list of categories and subcategories, see Apple Podcasts categories. Select the category that best reflects the content of your show. If available, you can also define a subcategory. Although you can specify more than one category and subcategory in your RSS feed, Apple Podcasts only recognizes the first category and subcategory. When specifying categories and subcategories, be sure to properly escape ampersands.', + 'comment' => + 'The show category information. For a complete list of categories and subcategories, see Apple Podcasts categories. Select the category that best reflects the content of your show. If available, you can also define a subcategory. Although you can specify more than one category and subcategory in your RSS feed, Apple Podcasts only recognizes the first category and subcategory. When specifying categories and subcategories, be sure to properly escape ampersands.', 'null' => true, ], 'explicit' => [ 'type' => 'TINYINT', 'constraint' => 1, 'default' => 0, - 'comment' => 'The podcast parental advisory information. The explicit value can be one of the following: True: If you specify true, indicating the presence of explicit content, Apple Podcasts displays an Explicit parental advisory graphic for your podcast. Podcasts containing explicit material aren’t available in some Apple Podcasts territories. False: If you specify false, indicating that your podcast doesn’t contain explicit language or adult content, Apple Podcasts displays a Clean parental advisory graphic for your podcast.', + 'comment' => + 'The podcast parental advisory information. The explicit value can be one of the following: True: If you specify true, indicating the presence of explicit content, Apple Podcasts displays an Explicit parental advisory graphic for your podcast. Podcasts containing explicit material aren’t available in some Apple Podcasts territories. False: If you specify false, indicating that your podcast doesn’t contain explicit language or adult content, Apple Podcasts displays a Clean parental advisory graphic for your podcast.', ], 'author' => [ 'type' => 'VARCHAR', 'constraint' => 1024, - 'comment' => 'The group responsible for creating the show. Show author most often refers to the parent company or network of a podcast, but it can also be used to identify the host(s) if none exists. Author information is especially useful if a company or organization publishes multiple podcasts. Providing this information will allow listeners to see all shows created by the same entity.', + 'comment' => + 'The group responsible for creating the show. Show author most often refers to the parent company or network of a podcast, but it can also be used to identify the host(s) if none exists. Author information is especially useful if a company or organization publishes multiple podcasts. Providing this information will allow listeners to see all shows created by the same entity.', 'null' => true, ], 'owner_name' => [ 'type' => 'VARCHAR', 'constraint' => 1024, - 'owner_name' => 'The podcast owner name. Note: The owner information is for administrative communication about the podcast and isn’t displayed in Apple Podcasts.', + 'owner_name' => + 'The podcast owner name. Note: The owner information is for administrative communication about the podcast and isn’t displayed in Apple Podcasts.', 'null' => true, ], 'owner_email' => [ 'type' => 'VARCHAR', 'constraint' => 1024, - 'owner_email' => 'The podcast owner email address. Note: The owner information is for administrative communication about the podcast and isn’t displayed in Apple Podcasts. Please make sure the email address is active and monitored.', + 'owner_email' => + 'The podcast owner email address. Note: The owner information is for administrative communication about the podcast and isn’t displayed in Apple Podcasts. Please make sure the email address is active and monitored.', 'null' => true, ], 'type' => [ 'type' => 'ENUM', 'constraint' => ['episodic', 'serial'], 'default' => 'episodic', - 'comment' => 'The type of show. If your show is Serial you must use this tag. Its values can be one of the following: episodic (default). Specify episodic when episodes are intended to be consumed without any specific order. Apple Podcasts will present newest episodes first and display the publish date (required) of each episode. If organized into seasons, the newest season will be presented first - otherwise, episodes will be grouped by year published, newest first. For new subscribers, Apple Podcasts adds the newest, most recent episode in their Library. serial. Specify serial when episodes are intended to be consumed in sequential order. Apple Podcasts will present the oldest episodes first and display the episode numbers (required) of each episode. If organized into seasons, the newest season will be presented first and <itunes:episode> numbers must be given for each episode. For new subscribers, Apple Podcasts adds the first episode to their Library, or the entire current season if using seasons', + 'comment' => + 'The type of show. If your show is Serial you must use this tag. Its values can be one of the following: episodic (default). Specify episodic when episodes are intended to be consumed without any specific order. Apple Podcasts will present newest episodes first and display the publish date (required) of each episode. If organized into seasons, the newest season will be presented first - otherwise, episodes will be grouped by year published, newest first. For new subscribers, Apple Podcasts adds the newest, most recent episode in their Library. serial. Specify serial when episodes are intended to be consumed in sequential order. Apple Podcasts will present the oldest episodes first and display the episode numbers (required) of each episode. If organized into seasons, the newest season will be presented first and <itunes:episode> numbers must be given for each episode. For new subscribers, Apple Podcasts adds the first episode to their Library, or the entire current season if using seasons', ], 'copyright' => [ 'type' => 'VARCHAR', 'constraint' => 1024, - 'comment' => 'The show copyright details. If your show is copyrighted you should use this tag.', + 'comment' => + 'The show copyright details. If your show is copyrighted you should use this tag.', 'null' => true, ], 'block' => [ 'type' => 'TINYINT', 'constraint' => 1, 'default' => 0, - 'comment' => 'The podcast show or hide status. If you want your show removed from the Apple directory, use this tag. Specifying the <itunes:block> tag with a Yes value, prevents the entire podcast from appearing in Apple Podcasts. Specifying any value other than Yes has no effect.', + 'comment' => + 'The podcast show or hide status. If you want your show removed from the Apple directory, use this tag. Specifying the <itunes:block> tag with a Yes value, prevents the entire podcast from appearing in Apple Podcasts. Specifying any value other than Yes has no effect.', ], 'complete' => [ 'type' => 'TINYINT', 'constraint' => 1, 'default' => 0, - 'comment' => 'The podcast update status. If you will never publish another episode to your show, use this tag. Specifying the <itunes:complete> tag with a Yes value indicates that a podcast is complete and you will not post any more episodes in the future. Specifying any value other than Yes has no effect.', + 'comment' => + 'The podcast update status. If you will never publish another episode to your show, use this tag. Specifying the <itunes:complete> tag with a Yes value indicates that a podcast is complete and you will not post any more episodes in the future. Specifying any value other than Yes has no effect.', ], 'episode_description_footer' => [ 'type' => 'TEXT', - 'comment' => 'The text that will be added in every episode description (show notes).', + 'comment' => + 'The text that will be added in every episode description (show notes).', 'null' => true, ], 'custom_html_head' => [ 'type' => 'TEXT', - 'comment' => 'The HTML code that will be added to evey page for this podcast. (You could add Google Analytics tracking code here for instance.)', + 'comment' => + 'The HTML code that will be added to evey page for this podcast. (You could add Google Analytics tracking code here for instance.)', 'null' => true, ], 'created_at' => [ diff --git a/app/Database/Migrations/2020-06-05-170000_add_episodes.php b/app/Database/Migrations/2020-06-05-170000_add_episodes.php index 2255940f53..35a9d7322d 100644 --- a/app/Database/Migrations/2020-06-05-170000_add_episodes.php +++ b/app/Database/Migrations/2020-06-05-170000_add_episodes.php @@ -1,4 +1,12 @@ <?php +/** + * Class AddEpisodes + * Creates episodes table in database + * + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Database\Migrations; @@ -31,7 +39,6 @@ class AddEpisodes extends Migration 'slug' => [ 'type' => 'VARCHAR', 'constraint' => 191, - 'unique' => true, 'comment' => 'Episode slug for URLs', ], 'enclosure_url' => [ @@ -94,6 +101,7 @@ class AddEpisodes extends Migration 'type' => 'INT', 'constraint' => 10, 'unsigned' => true, + 'null' => true, 'comment' => 'An episode number. If all your episodes have numbers and you would like them to be ordered based on them use this tag for each one. Episode numbers are optional for <itunes:type> episodic shows, but are mandatory for serial shows. Where episode is a non-zero integer (1, 2, 3, etc.) representing your episode number.', ], @@ -127,7 +135,6 @@ class AddEpisodes extends Migration ], ]); $this->forge->addKey('id', true); - $this->forge->addKey('podcast_id', true); $this->forge->addUniqueKey(['podcast_id', 'slug']); $this->forge->addForeignKey('podcast_id', 'podcasts', 'id'); $this->forge->createTable('episodes'); diff --git a/app/Database/Migrations/2020-06-05-190000_add_platforms.php b/app/Database/Migrations/2020-06-05-190000_add_platforms.php index baed7d9cf7..7a96523d54 100644 --- a/app/Database/Migrations/2020-06-05-190000_add_platforms.php +++ b/app/Database/Migrations/2020-06-05-190000_add_platforms.php @@ -2,18 +2,18 @@ /** * Class AddPlatforms * Creates platforms table in database - * @author Benjamin Bellamy <ben@podlibre.org> + * * @copyright 2020 Podlibre * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @link https://castopod.org/ */ + namespace App\Database\Migrations; -use \CodeIgniter\Database\Migration; +use CodeIgniter\Database\Migration; class AddPlatforms extends Migration { - public function up() { $this->forge->addField([ @@ -62,7 +62,8 @@ class AddPlatforms extends Migration 'type' => 'TINYINT', 'constraint' => 1, 'default' => 0, - 'comment' => 'True if the platform link should be displayed by default.', + 'comment' => + 'True if the platform link should be displayed by default.', ], 'ios_deeplink' => [ 'type' => 'TINYINT', @@ -74,7 +75,8 @@ class AddPlatforms extends Migration 'type' => 'TINYINT', 'constraint' => 1, 'default' => 0, - 'comment' => 'Android deeplinking for this platform: 0=No, 1=Manual, 2=Automatic.', + 'comment' => + 'Android deeplinking for this platform: 0=No, 1=Manual, 2=Automatic.', ], 'logo_file_name' => [ 'type' => 'VARCHAR', diff --git a/app/Database/Migrations/2020-06-08-160000_add_platformlinks.php b/app/Database/Migrations/2020-06-08-160000_add_platformlinks.php index 77a609a53c..49938f26e4 100644 --- a/app/Database/Migrations/2020-06-08-160000_add_platformlinks.php +++ b/app/Database/Migrations/2020-06-08-160000_add_platformlinks.php @@ -1,19 +1,19 @@ <?php /** * Class AddPlatformsLinks - * Creates platformlinks table in database - * @author Benjamin Bellamy <ben@podlibre.org> + * Creates platform_links table in database + * * @copyright 2020 Podlibre * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @link https://castopod.org/ */ + namespace App\Database\Migrations; -use \CodeIgniter\Database\Migration; +use CodeIgniter\Database\Migration; class AddPlatformLinks extends Migration { - public function up() { $this->forge->addField([ diff --git a/app/Database/Seeds/CategorySeeder.php b/app/Database/Seeds/CategorySeeder.php index d97a56b1cd..d256acc55a 100644 --- a/app/Database/Seeds/CategorySeeder.php +++ b/app/Database/Seeds/CategorySeeder.php @@ -1,4 +1,12 @@ <?php +/** + * Class CategorySeeder + * Inserts values in categories table in database + * + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Database\Seeds; @@ -8,119 +16,785 @@ class CategorySeeder extends Seeder { public function run() { - $data = array( - array('parent_id' => 0, 'id' => 0, 'code' => 'uncategorized', 'apple_category' => 'uncategorized', 'google_category' => 'uncategorized'), - array('parent_id' => 0, 'id' => 1, 'code' => 'arts', 'apple_category' => 'Arts', 'google_category' => 'Arts'), - array('parent_id' => 0, 'id' => 2, 'code' => 'business', 'apple_category' => 'Business', 'google_category' => 'Business'), - array('parent_id' => 0, 'id' => 3, 'code' => 'comedy', 'apple_category' => 'Comedy', 'google_category' => 'Comedy'), - array('parent_id' => 0, 'id' => 4, 'code' => 'education', 'apple_category' => 'Education', 'google_category' => 'Education'), - array('parent_id' => 0, 'id' => 5, 'code' => 'fiction', 'apple_category' => 'Fiction', 'google_category' => ''), - array('parent_id' => 0, 'id' => 6, 'code' => 'government', 'apple_category' => 'Government', 'google_category' => 'Government & Organizations'), - array('parent_id' => 0, 'id' => 7, 'code' => 'health_and_fitness', 'apple_category' => 'Health & Fitness', 'google_category' => 'Health'), - array('parent_id' => 0, 'id' => 8, 'code' => 'history', 'apple_category' => 'History', 'google_category' => ''), - array('parent_id' => 0, 'id' => 9, 'code' => 'kids_and_family', 'apple_category' => 'Kids & Family', 'google_category' => 'Kids & Family'), - array('parent_id' => 0, 'id' => 10, 'code' => 'leisure', 'apple_category' => 'Leisure', 'google_category' => 'Games & Hobbies'), - array('parent_id' => 0, 'id' => 11, 'code' => 'music', 'apple_category' => 'Music', 'google_category' => 'Music'), - array('parent_id' => 0, 'id' => 12, 'code' => 'news', 'apple_category' => 'News', 'google_category' => 'News & Politics'), - array('parent_id' => 0, 'id' => 13, 'code' => 'religion_and_spirituality', 'apple_category' => 'Religion & Spirituality', 'google_category' => 'Religion & Spirituality'), - array('parent_id' => 0, 'id' => 14, 'code' => 'science', 'apple_category' => 'Science', 'google_category' => 'Science & Medicine'), - array('parent_id' => 0, 'id' => 15, 'code' => 'society_and_culture', 'apple_category' => 'Society & Culture', 'google_category' => 'Society & Culture'), - array('parent_id' => 0, 'id' => 16, 'code' => 'sports', 'apple_category' => 'Sports', 'google_category' => 'Sports & Recreation'), - array('parent_id' => 0, 'id' => 17, 'code' => 'technology', 'apple_category' => 'Technology', 'google_category' => 'Technology'), - array('parent_id' => 0, 'id' => 18, 'code' => 'true_crime', 'apple_category' => 'True Crime', 'google_category' => ''), - array('parent_id' => 0, 'id' => 19, 'code' => 'tv_and_film', 'apple_category' => 'TV & Film', 'google_category' => 'TV & Film'), - array('parent_id' => 1, 'id' => 20, 'code' => 'books', 'apple_category' => 'Books', 'google_category' => ''), - array('parent_id' => 1, 'id' => 21, 'code' => 'design', 'apple_category' => 'Design', 'google_category' => ''), - array('parent_id' => 1, 'id' => 22, 'code' => 'fashion_and_beauty', 'apple_category' => 'Fashion & Beauty', 'google_category' => ''), - array('parent_id' => 1, 'id' => 23, 'code' => 'food', 'apple_category' => 'Food', 'google_category' => ''), - array('parent_id' => 1, 'id' => 24, 'code' => 'performing_arts', 'apple_category' => 'Performing Arts', 'google_category' => ''), - array('parent_id' => 1, 'id' => 25, 'code' => 'visual_arts', 'apple_category' => 'Visual Arts', 'google_category' => ''), - array('parent_id' => 2, 'id' => 26, 'code' => 'careers', 'apple_category' => 'Careers', 'google_category' => ''), - array('parent_id' => 2, 'id' => 27, 'code' => 'entrepreneurship', 'apple_category' => 'Entrepreneurship', 'google_category' => ''), - array('parent_id' => 2, 'id' => 28, 'code' => 'investing', 'apple_category' => 'Investing', 'google_category' => ''), - array('parent_id' => 2, 'id' => 29, 'code' => 'management', 'apple_category' => 'Management', 'google_category' => ''), - array('parent_id' => 2, 'id' => 30, 'code' => 'marketing', 'apple_category' => 'Marketing', 'google_category' => ''), - array('parent_id' => 2, 'id' => 31, 'code' => 'non_profit', 'apple_category' => 'Non-Profit', 'google_category' => ''), - array('parent_id' => 3, 'id' => 32, 'code' => 'comedy_interviews', 'apple_category' => 'Comedy Interviews', 'google_category' => ''), - array('parent_id' => 3, 'id' => 33, 'code' => 'improv', 'apple_category' => 'Improv', 'google_category' => ''), - array('parent_id' => 3, 'id' => 34, 'code' => 'stand_up', 'apple_category' => 'Stand-Up', 'google_category' => ''), - array('parent_id' => 4, 'id' => 35, 'code' => 'courses', 'apple_category' => 'Courses', 'google_category' => ''), - array('parent_id' => 4, 'id' => 36, 'code' => 'how_to', 'apple_category' => 'How To', 'google_category' => ''), - array('parent_id' => 4, 'id' => 37, 'code' => 'language_learning', 'apple_category' => 'Language Learning', 'google_category' => ''), - array('parent_id' => 4, 'id' => 38, 'code' => 'self_improvement', 'apple_category' => 'Self-Improvement', 'google_category' => ''), - array('parent_id' => 5, 'id' => 39, 'code' => 'comedy_fiction', 'apple_category' => 'Comedy Fiction', 'google_category' => ''), - array('parent_id' => 5, 'id' => 40, 'code' => 'drama', 'apple_category' => 'Drama', 'google_category' => ''), - array('parent_id' => 5, 'id' => 41, 'code' => 'science_fiction', 'apple_category' => 'Science Fiction', 'google_category' => ''), - array('parent_id' => 7, 'id' => 42, 'code' => 'alternative_health', 'apple_category' => 'Alternative Health', 'google_category' => ''), - array('parent_id' => 7, 'id' => 43, 'code' => 'fitness', 'apple_category' => 'Fitness', 'google_category' => ''), - array('parent_id' => 7, 'id' => 44, 'code' => 'medicine', 'apple_category' => 'Medicine', 'google_category' => ''), - array('parent_id' => 7, 'id' => 45, 'code' => 'mental_health', 'apple_category' => 'Mental Health', 'google_category' => ''), - array('parent_id' => 7, 'id' => 46, 'code' => 'nutrition', 'apple_category' => 'Nutrition', 'google_category' => ''), - array('parent_id' => 7, 'id' => 47, 'code' => 'sexuality', 'apple_category' => 'Sexuality', 'google_category' => ''), - array('parent_id' => 9, 'id' => 48, 'code' => 'education_for_kids', 'apple_category' => 'Education for Kids', 'google_category' => ''), - array('parent_id' => 9, 'id' => 49, 'code' => 'parenting', 'apple_category' => 'Parenting', 'google_category' => ''), - array('parent_id' => 9, 'id' => 50, 'code' => 'pets_and_animals', 'apple_category' => 'Pets & Animals', 'google_category' => ''), - array('parent_id' => 9, 'id' => 51, 'code' => 'stories_for_kids', 'apple_category' => 'Stories for Kids', 'google_category' => ''), - array('parent_id' => 10, 'id' => 52, 'code' => 'animation_and_manga', 'apple_category' => 'Animation & Manga', 'google_category' => ''), - array('parent_id' => 10, 'id' => 53, 'code' => 'automotive', 'apple_category' => 'Automotive', 'google_category' => ''), - array('parent_id' => 10, 'id' => 54, 'code' => 'aviation', 'apple_category' => 'Aviation', 'google_category' => ''), - array('parent_id' => 10, 'id' => 55, 'code' => 'crafts', 'apple_category' => 'Crafts', 'google_category' => ''), - array('parent_id' => 10, 'id' => 56, 'code' => 'games', 'apple_category' => 'Games', 'google_category' => ''), - array('parent_id' => 10, 'id' => 57, 'code' => 'hobbies', 'apple_category' => 'Hobbies', 'google_category' => ''), - array('parent_id' => 10, 'id' => 58, 'code' => 'home_and_garden', 'apple_category' => 'Home & Garden', 'google_category' => ''), - array('parent_id' => 10, 'id' => 59, 'code' => 'video_games', 'apple_category' => 'Video Games', 'google_category' => ''), - array('parent_id' => 11, 'id' => 60, 'code' => 'music_commentary', 'apple_category' => 'Music Commentary', 'google_category' => ''), - array('parent_id' => 11, 'id' => 61, 'code' => 'music_history', 'apple_category' => 'Music History', 'google_category' => ''), - array('parent_id' => 11, 'id' => 62, 'code' => 'music_interviews', 'apple_category' => 'Music Interviews', 'google_category' => ''), - array('parent_id' => 12, 'id' => 63, 'code' => 'business_news', 'apple_category' => 'Business News', 'google_category' => ''), - array('parent_id' => 12, 'id' => 64, 'code' => 'daily_news', 'apple_category' => 'Daily News', 'google_category' => ''), - array('parent_id' => 12, 'id' => 65, 'code' => 'entertainment_news', 'apple_category' => 'Entertainment News', 'google_category' => ''), - array('parent_id' => 12, 'id' => 66, 'code' => 'news_commentary', 'apple_category' => 'News Commentary', 'google_category' => ''), - array('parent_id' => 12, 'id' => 67, 'code' => 'politics', 'apple_category' => 'Politics', 'google_category' => ''), - array('parent_id' => 12, 'id' => 68, 'code' => 'sports_news', 'apple_category' => 'Sports News', 'google_category' => ''), - array('parent_id' => 12, 'id' => 69, 'code' => 'tech_news', 'apple_category' => 'Tech News', 'google_category' => ''), - array('parent_id' => 13, 'id' => 70, 'code' => 'buddhism', 'apple_category' => 'Buddhism', 'google_category' => ''), - array('parent_id' => 13, 'id' => 71, 'code' => 'christianity', 'apple_category' => 'Christianity', 'google_category' => ''), - array('parent_id' => 13, 'id' => 72, 'code' => 'hinduism', 'apple_category' => 'Hinduism', 'google_category' => ''), - array('parent_id' => 13, 'id' => 73, 'code' => 'islam', 'apple_category' => 'Islam', 'google_category' => ''), - array('parent_id' => 13, 'id' => 74, 'code' => 'judaism', 'apple_category' => 'Judaism', 'google_category' => ''), - array('parent_id' => 13, 'id' => 75, 'code' => 'religion', 'apple_category' => 'Religion', 'google_category' => ''), - array('parent_id' => 13, 'id' => 76, 'code' => 'spirituality', 'apple_category' => 'Spirituality', 'google_category' => ''), - array('parent_id' => 14, 'id' => 77, 'code' => 'astronomy', 'apple_category' => 'Astronomy', 'google_category' => ''), - array('parent_id' => 14, 'id' => 78, 'code' => 'chemistry', 'apple_category' => 'Chemistry', 'google_category' => ''), - array('parent_id' => 14, 'id' => 79, 'code' => 'earth_sciences', 'apple_category' => 'Earth Sciences', 'google_category' => ''), - array('parent_id' => 14, 'id' => 80, 'code' => 'life_sciences', 'apple_category' => 'Life Sciences', 'google_category' => ''), - array('parent_id' => 14, 'id' => 81, 'code' => 'mathematics', 'apple_category' => 'Mathematics', 'google_category' => ''), - array('parent_id' => 14, 'id' => 82, 'code' => 'natural_sciences', 'apple_category' => 'Natural Sciences', 'google_category' => ''), - array('parent_id' => 14, 'id' => 83, 'code' => 'nature', 'apple_category' => 'Nature', 'google_category' => ''), - array('parent_id' => 14, 'id' => 84, 'code' => 'physics', 'apple_category' => 'Physics', 'google_category' => ''), - array('parent_id' => 14, 'id' => 85, 'code' => 'social_sciences', 'apple_category' => 'Social Sciences', 'google_category' => ''), - array('parent_id' => 15, 'id' => 86, 'code' => 'documentary', 'apple_category' => 'Documentary', 'google_category' => ''), - array('parent_id' => 15, 'id' => 87, 'code' => 'personal_journals', 'apple_category' => 'Personal Journals', 'google_category' => ''), - array('parent_id' => 15, 'id' => 88, 'code' => 'philosophy', 'apple_category' => 'Philosophy', 'google_category' => ''), - array('parent_id' => 15, 'id' => 89, 'code' => 'places_and_travel', 'apple_category' => 'Places & Travel', 'google_category' => ''), - array('parent_id' => 15, 'id' => 90, 'code' => 'relationships', 'apple_category' => 'Relationships', 'google_category' => ''), - array('parent_id' => 16, 'id' => 91, 'code' => 'baseball', 'apple_category' => 'Baseball', 'google_category' => ''), - array('parent_id' => 16, 'id' => 92, 'code' => 'basketball', 'apple_category' => 'Basketball', 'google_category' => ''), - array('parent_id' => 16, 'id' => 93, 'code' => 'cricket', 'apple_category' => 'Cricket', 'google_category' => ''), - array('parent_id' => 16, 'id' => 94, 'code' => 'fantasy_sports', 'apple_category' => 'Fantasy Sports', 'google_category' => ''), - array('parent_id' => 16, 'id' => 95, 'code' => 'football', 'apple_category' => 'Football', 'google_category' => ''), - array('parent_id' => 16, 'id' => 96, 'code' => 'golf', 'apple_category' => 'Golf', 'google_category' => ''), - array('parent_id' => 16, 'id' => 97, 'code' => 'hockey', 'apple_category' => 'Hockey', 'google_category' => ''), - array('parent_id' => 16, 'id' => 98, 'code' => 'rugby', 'apple_category' => 'Rugby', 'google_category' => ''), - array('parent_id' => 16, 'id' => 99, 'code' => 'running', 'apple_category' => 'Running', 'google_category' => ''), - array('parent_id' => 16, 'id' => 100, 'code' => 'soccer', 'apple_category' => 'Soccer', 'google_category' => ''), - array('parent_id' => 16, 'id' => 101, 'code' => 'swimming', 'apple_category' => 'Swimming', 'google_category' => ''), - array('parent_id' => 16, 'id' => 102, 'code' => 'tennis', 'apple_category' => 'Tennis', 'google_category' => ''), - array('parent_id' => 16, 'id' => 103, 'code' => 'volleyball', 'apple_category' => 'Volleyball', 'google_category' => ''), - array('parent_id' => 16, 'id' => 104, 'code' => 'wilderness', 'apple_category' => 'Wilderness', 'google_category' => ''), - array('parent_id' => 16, 'id' => 105, 'code' => 'wrestling', 'apple_category' => 'Wrestling', 'google_category' => ''), - array('parent_id' => 19, 'id' => 106, 'code' => 'after_shows', 'apple_category' => 'After Shows', 'google_category' => ''), - array('parent_id' => 19, 'id' => 107, 'code' => 'film_history', 'apple_category' => 'Film History', 'google_category' => ''), - array('parent_id' => 19, 'id' => 108, 'code' => 'film_interviews', 'apple_category' => 'Film Interviews', 'google_category' => ''), - array('parent_id' => 19, 'id' => 109, 'code' => 'film_reviews', 'apple_category' => 'Film Reviews', 'google_category' => ''), - array('parent_id' => 19, 'id' => 110, 'code' => 'tv_reviews', 'apple_category' => 'TV Reviews', 'google_category' => ''), - ); + $data = [ + [ + 'parent_id' => 0, + 'id' => 0, + 'code' => 'uncategorized', + 'apple_category' => 'uncategorized', + 'google_category' => 'uncategorized', + ], + [ + 'parent_id' => 0, + 'id' => 1, + 'code' => 'arts', + 'apple_category' => 'Arts', + 'google_category' => 'Arts', + ], + [ + 'parent_id' => 0, + 'id' => 2, + 'code' => 'business', + 'apple_category' => 'Business', + 'google_category' => 'Business', + ], + [ + 'parent_id' => 0, + 'id' => 3, + 'code' => 'comedy', + 'apple_category' => 'Comedy', + 'google_category' => 'Comedy', + ], + [ + 'parent_id' => 0, + 'id' => 4, + 'code' => 'education', + 'apple_category' => 'Education', + 'google_category' => 'Education', + ], + [ + 'parent_id' => 0, + 'id' => 5, + 'code' => 'fiction', + 'apple_category' => 'Fiction', + 'google_category' => '', + ], + [ + 'parent_id' => 0, + 'id' => 6, + 'code' => 'government', + 'apple_category' => 'Government', + 'google_category' => 'Government & Organizations', + ], + [ + 'parent_id' => 0, + 'id' => 7, + 'code' => 'health_and_fitness', + 'apple_category' => 'Health & Fitness', + 'google_category' => 'Health', + ], + [ + 'parent_id' => 0, + 'id' => 8, + 'code' => 'history', + 'apple_category' => 'History', + 'google_category' => '', + ], + [ + 'parent_id' => 0, + 'id' => 9, + 'code' => 'kids_and_family', + 'apple_category' => 'Kids & Family', + 'google_category' => 'Kids & Family', + ], + [ + 'parent_id' => 0, + 'id' => 10, + 'code' => 'leisure', + 'apple_category' => 'Leisure', + 'google_category' => 'Games & Hobbies', + ], + [ + 'parent_id' => 0, + 'id' => 11, + 'code' => 'music', + 'apple_category' => 'Music', + 'google_category' => 'Music', + ], + [ + 'parent_id' => 0, + 'id' => 12, + 'code' => 'news', + 'apple_category' => 'News', + 'google_category' => 'News & Politics', + ], + [ + 'parent_id' => 0, + 'id' => 13, + 'code' => 'religion_and_spirituality', + 'apple_category' => 'Religion & Spirituality', + 'google_category' => 'Religion & Spirituality', + ], + [ + 'parent_id' => 0, + 'id' => 14, + 'code' => 'science', + 'apple_category' => 'Science', + 'google_category' => 'Science & Medicine', + ], + [ + 'parent_id' => 0, + 'id' => 15, + 'code' => 'society_and_culture', + 'apple_category' => 'Society & Culture', + 'google_category' => 'Society & Culture', + ], + [ + 'parent_id' => 0, + 'id' => 16, + 'code' => 'sports', + 'apple_category' => 'Sports', + 'google_category' => 'Sports & Recreation', + ], + [ + 'parent_id' => 0, + 'id' => 17, + 'code' => 'technology', + 'apple_category' => 'Technology', + 'google_category' => 'Technology', + ], + [ + 'parent_id' => 0, + 'id' => 18, + 'code' => 'true_crime', + 'apple_category' => 'True Crime', + 'google_category' => '', + ], + [ + 'parent_id' => 0, + 'id' => 19, + 'code' => 'tv_and_film', + 'apple_category' => 'TV & Film', + 'google_category' => 'TV & Film', + ], + [ + 'parent_id' => 1, + 'id' => 20, + 'code' => 'books', + 'apple_category' => 'Books', + 'google_category' => '', + ], + [ + 'parent_id' => 1, + 'id' => 21, + 'code' => 'design', + 'apple_category' => 'Design', + 'google_category' => '', + ], + [ + 'parent_id' => 1, + 'id' => 22, + 'code' => 'fashion_and_beauty', + 'apple_category' => 'Fashion & Beauty', + 'google_category' => '', + ], + [ + 'parent_id' => 1, + 'id' => 23, + 'code' => 'food', + 'apple_category' => 'Food', + 'google_category' => '', + ], + [ + 'parent_id' => 1, + 'id' => 24, + 'code' => 'performing_arts', + 'apple_category' => 'Performing Arts', + 'google_category' => '', + ], + [ + 'parent_id' => 1, + 'id' => 25, + 'code' => 'visual_arts', + 'apple_category' => 'Visual Arts', + 'google_category' => '', + ], + [ + 'parent_id' => 2, + 'id' => 26, + 'code' => 'careers', + 'apple_category' => 'Careers', + 'google_category' => '', + ], + [ + 'parent_id' => 2, + 'id' => 27, + 'code' => 'entrepreneurship', + 'apple_category' => 'Entrepreneurship', + 'google_category' => '', + ], + [ + 'parent_id' => 2, + 'id' => 28, + 'code' => 'investing', + 'apple_category' => 'Investing', + 'google_category' => '', + ], + [ + 'parent_id' => 2, + 'id' => 29, + 'code' => 'management', + 'apple_category' => 'Management', + 'google_category' => '', + ], + [ + 'parent_id' => 2, + 'id' => 30, + 'code' => 'marketing', + 'apple_category' => 'Marketing', + 'google_category' => '', + ], + [ + 'parent_id' => 2, + 'id' => 31, + 'code' => 'non_profit', + 'apple_category' => 'Non-Profit', + 'google_category' => '', + ], + [ + 'parent_id' => 3, + 'id' => 32, + 'code' => 'comedy_interviews', + 'apple_category' => 'Comedy Interviews', + 'google_category' => '', + ], + [ + 'parent_id' => 3, + 'id' => 33, + 'code' => 'improv', + 'apple_category' => 'Improv', + 'google_category' => '', + ], + [ + 'parent_id' => 3, + 'id' => 34, + 'code' => 'stand_up', + 'apple_category' => 'Stand-Up', + 'google_category' => '', + ], + [ + 'parent_id' => 4, + 'id' => 35, + 'code' => 'courses', + 'apple_category' => 'Courses', + 'google_category' => '', + ], + [ + 'parent_id' => 4, + 'id' => 36, + 'code' => 'how_to', + 'apple_category' => 'How To', + 'google_category' => '', + ], + [ + 'parent_id' => 4, + 'id' => 37, + 'code' => 'language_learning', + 'apple_category' => 'Language Learning', + 'google_category' => '', + ], + [ + 'parent_id' => 4, + 'id' => 38, + 'code' => 'self_improvement', + 'apple_category' => 'Self-Improvement', + 'google_category' => '', + ], + [ + 'parent_id' => 5, + 'id' => 39, + 'code' => 'comedy_fiction', + 'apple_category' => 'Comedy Fiction', + 'google_category' => '', + ], + [ + 'parent_id' => 5, + 'id' => 40, + 'code' => 'drama', + 'apple_category' => 'Drama', + 'google_category' => '', + ], + [ + 'parent_id' => 5, + 'id' => 41, + 'code' => 'science_fiction', + 'apple_category' => 'Science Fiction', + 'google_category' => '', + ], + [ + 'parent_id' => 7, + 'id' => 42, + 'code' => 'alternative_health', + 'apple_category' => 'Alternative Health', + 'google_category' => '', + ], + [ + 'parent_id' => 7, + 'id' => 43, + 'code' => 'fitness', + 'apple_category' => 'Fitness', + 'google_category' => '', + ], + [ + 'parent_id' => 7, + 'id' => 44, + 'code' => 'medicine', + 'apple_category' => 'Medicine', + 'google_category' => '', + ], + [ + 'parent_id' => 7, + 'id' => 45, + 'code' => 'mental_health', + 'apple_category' => 'Mental Health', + 'google_category' => '', + ], + [ + 'parent_id' => 7, + 'id' => 46, + 'code' => 'nutrition', + 'apple_category' => 'Nutrition', + 'google_category' => '', + ], + [ + 'parent_id' => 7, + 'id' => 47, + 'code' => 'sexuality', + 'apple_category' => 'Sexuality', + 'google_category' => '', + ], + [ + 'parent_id' => 9, + 'id' => 48, + 'code' => 'education_for_kids', + 'apple_category' => 'Education for Kids', + 'google_category' => '', + ], + [ + 'parent_id' => 9, + 'id' => 49, + 'code' => 'parenting', + 'apple_category' => 'Parenting', + 'google_category' => '', + ], + [ + 'parent_id' => 9, + 'id' => 50, + 'code' => 'pets_and_animals', + 'apple_category' => 'Pets & Animals', + 'google_category' => '', + ], + [ + 'parent_id' => 9, + 'id' => 51, + 'code' => 'stories_for_kids', + 'apple_category' => 'Stories for Kids', + 'google_category' => '', + ], + [ + 'parent_id' => 10, + 'id' => 52, + 'code' => 'animation_and_manga', + 'apple_category' => 'Animation & Manga', + 'google_category' => '', + ], + [ + 'parent_id' => 10, + 'id' => 53, + 'code' => 'automotive', + 'apple_category' => 'Automotive', + 'google_category' => '', + ], + [ + 'parent_id' => 10, + 'id' => 54, + 'code' => 'aviation', + 'apple_category' => 'Aviation', + 'google_category' => '', + ], + [ + 'parent_id' => 10, + 'id' => 55, + 'code' => 'crafts', + 'apple_category' => 'Crafts', + 'google_category' => '', + ], + [ + 'parent_id' => 10, + 'id' => 56, + 'code' => 'games', + 'apple_category' => 'Games', + 'google_category' => '', + ], + [ + 'parent_id' => 10, + 'id' => 57, + 'code' => 'hobbies', + 'apple_category' => 'Hobbies', + 'google_category' => '', + ], + [ + 'parent_id' => 10, + 'id' => 58, + 'code' => 'home_and_garden', + 'apple_category' => 'Home & Garden', + 'google_category' => '', + ], + [ + 'parent_id' => 10, + 'id' => 59, + 'code' => 'video_games', + 'apple_category' => 'Video Games', + 'google_category' => '', + ], + [ + 'parent_id' => 11, + 'id' => 60, + 'code' => 'music_commentary', + 'apple_category' => 'Music Commentary', + 'google_category' => '', + ], + [ + 'parent_id' => 11, + 'id' => 61, + 'code' => 'music_history', + 'apple_category' => 'Music History', + 'google_category' => '', + ], + [ + 'parent_id' => 11, + 'id' => 62, + 'code' => 'music_interviews', + 'apple_category' => 'Music Interviews', + 'google_category' => '', + ], + [ + 'parent_id' => 12, + 'id' => 63, + 'code' => 'business_news', + 'apple_category' => 'Business News', + 'google_category' => '', + ], + [ + 'parent_id' => 12, + 'id' => 64, + 'code' => 'daily_news', + 'apple_category' => 'Daily News', + 'google_category' => '', + ], + [ + 'parent_id' => 12, + 'id' => 65, + 'code' => 'entertainment_news', + 'apple_category' => 'Entertainment News', + 'google_category' => '', + ], + [ + 'parent_id' => 12, + 'id' => 66, + 'code' => 'news_commentary', + 'apple_category' => 'News Commentary', + 'google_category' => '', + ], + [ + 'parent_id' => 12, + 'id' => 67, + 'code' => 'politics', + 'apple_category' => 'Politics', + 'google_category' => '', + ], + [ + 'parent_id' => 12, + 'id' => 68, + 'code' => 'sports_news', + 'apple_category' => 'Sports News', + 'google_category' => '', + ], + [ + 'parent_id' => 12, + 'id' => 69, + 'code' => 'tech_news', + 'apple_category' => 'Tech News', + 'google_category' => '', + ], + [ + 'parent_id' => 13, + 'id' => 70, + 'code' => 'buddhism', + 'apple_category' => 'Buddhism', + 'google_category' => '', + ], + [ + 'parent_id' => 13, + 'id' => 71, + 'code' => 'christianity', + 'apple_category' => 'Christianity', + 'google_category' => '', + ], + [ + 'parent_id' => 13, + 'id' => 72, + 'code' => 'hinduism', + 'apple_category' => 'Hinduism', + 'google_category' => '', + ], + [ + 'parent_id' => 13, + 'id' => 73, + 'code' => 'islam', + 'apple_category' => 'Islam', + 'google_category' => '', + ], + [ + 'parent_id' => 13, + 'id' => 74, + 'code' => 'judaism', + 'apple_category' => 'Judaism', + 'google_category' => '', + ], + [ + 'parent_id' => 13, + 'id' => 75, + 'code' => 'religion', + 'apple_category' => 'Religion', + 'google_category' => '', + ], + [ + 'parent_id' => 13, + 'id' => 76, + 'code' => 'spirituality', + 'apple_category' => 'Spirituality', + 'google_category' => '', + ], + [ + 'parent_id' => 14, + 'id' => 77, + 'code' => 'astronomy', + 'apple_category' => 'Astronomy', + 'google_category' => '', + ], + [ + 'parent_id' => 14, + 'id' => 78, + 'code' => 'chemistry', + 'apple_category' => 'Chemistry', + 'google_category' => '', + ], + [ + 'parent_id' => 14, + 'id' => 79, + 'code' => 'earth_sciences', + 'apple_category' => 'Earth Sciences', + 'google_category' => '', + ], + [ + 'parent_id' => 14, + 'id' => 80, + 'code' => 'life_sciences', + 'apple_category' => 'Life Sciences', + 'google_category' => '', + ], + [ + 'parent_id' => 14, + 'id' => 81, + 'code' => 'mathematics', + 'apple_category' => 'Mathematics', + 'google_category' => '', + ], + [ + 'parent_id' => 14, + 'id' => 82, + 'code' => 'natural_sciences', + 'apple_category' => 'Natural Sciences', + 'google_category' => '', + ], + [ + 'parent_id' => 14, + 'id' => 83, + 'code' => 'nature', + 'apple_category' => 'Nature', + 'google_category' => '', + ], + [ + 'parent_id' => 14, + 'id' => 84, + 'code' => 'physics', + 'apple_category' => 'Physics', + 'google_category' => '', + ], + [ + 'parent_id' => 14, + 'id' => 85, + 'code' => 'social_sciences', + 'apple_category' => 'Social Sciences', + 'google_category' => '', + ], + [ + 'parent_id' => 15, + 'id' => 86, + 'code' => 'documentary', + 'apple_category' => 'Documentary', + 'google_category' => '', + ], + [ + 'parent_id' => 15, + 'id' => 87, + 'code' => 'personal_journals', + 'apple_category' => 'Personal Journals', + 'google_category' => '', + ], + [ + 'parent_id' => 15, + 'id' => 88, + 'code' => 'philosophy', + 'apple_category' => 'Philosophy', + 'google_category' => '', + ], + [ + 'parent_id' => 15, + 'id' => 89, + 'code' => 'places_and_travel', + 'apple_category' => 'Places & Travel', + 'google_category' => '', + ], + [ + 'parent_id' => 15, + 'id' => 90, + 'code' => 'relationships', + 'apple_category' => 'Relationships', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 91, + 'code' => 'baseball', + 'apple_category' => 'Baseball', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 92, + 'code' => 'basketball', + 'apple_category' => 'Basketball', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 93, + 'code' => 'cricket', + 'apple_category' => 'Cricket', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 94, + 'code' => 'fantasy_sports', + 'apple_category' => 'Fantasy Sports', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 95, + 'code' => 'football', + 'apple_category' => 'Football', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 96, + 'code' => 'golf', + 'apple_category' => 'Golf', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 97, + 'code' => 'hockey', + 'apple_category' => 'Hockey', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 98, + 'code' => 'rugby', + 'apple_category' => 'Rugby', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 99, + 'code' => 'running', + 'apple_category' => 'Running', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 100, + 'code' => 'soccer', + 'apple_category' => 'Soccer', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 101, + 'code' => 'swimming', + 'apple_category' => 'Swimming', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 102, + 'code' => 'tennis', + 'apple_category' => 'Tennis', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 103, + 'code' => 'volleyball', + 'apple_category' => 'Volleyball', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 104, + 'code' => 'wilderness', + 'apple_category' => 'Wilderness', + 'google_category' => '', + ], + [ + 'parent_id' => 16, + 'id' => 105, + 'code' => 'wrestling', + 'apple_category' => 'Wrestling', + 'google_category' => '', + ], + [ + 'parent_id' => 19, + 'id' => 106, + 'code' => 'after_shows', + 'apple_category' => 'After Shows', + 'google_category' => '', + ], + [ + 'parent_id' => 19, + 'id' => 107, + 'code' => 'film_history', + 'apple_category' => 'Film History', + 'google_category' => '', + ], + [ + 'parent_id' => 19, + 'id' => 108, + 'code' => 'film_interviews', + 'apple_category' => 'Film Interviews', + 'google_category' => '', + ], + [ + 'parent_id' => 19, + 'id' => 109, + 'code' => 'film_reviews', + 'apple_category' => 'Film Reviews', + 'google_category' => '', + ], + [ + 'parent_id' => 19, + 'id' => 110, + 'code' => 'tv_reviews', + 'apple_category' => 'TV Reviews', + 'google_category' => '', + ], + ]; $this->db->table('categories')->insertBatch($data); } diff --git a/app/Database/Seeds/LanguageSeeder.php b/app/Database/Seeds/LanguageSeeder.php index fbf0434c73..aa91eeafa3 100644 --- a/app/Database/Seeds/LanguageSeeder.php +++ b/app/Database/Seeds/LanguageSeeder.php @@ -1,9 +1,19 @@ <?php +/** + * Class LanguageSeeder + * Inserts values in languages table in database + * + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ + /** * From https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes * (cc) Creative Commons Attribution-ShareAlike 3.0 * 2020-06-07 */ + namespace App\Database\Seeds; use CodeIgniter\Database\Seeder; @@ -12,192 +22,615 @@ class LanguageSeeder extends Seeder { public function run() { - $data = array( - array('code'=>'aa','name'=>'Afar','native_name'=>'Afaraf'), - array('code'=>'ab','name'=>'Abkhazian','native_name'=>'аҧÑуа бызшәа, аҧÑшәа'), - array('code'=>'ae','name'=>'Avestan','native_name'=>'avesta'), - array('code'=>'af','name'=>'Afrikaans','native_name'=>'Afrikaans'), - array('code'=>'ak','name'=>'Akan','native_name'=>'Akan'), - array('code'=>'am','name'=>'Amharic','native_name'=>'አማáˆáŠ›'), - array('code'=>'an','name'=>'Aragonese','native_name'=>'aragonés'), - array('code'=>'ar','name'=>'Arabic','native_name'=>'العربية'), - array('code'=>'as','name'=>'Assamese','native_name'=>'অসমীয়া'), - array('code'=>'av','name'=>'Avaric','native_name'=>'авар мацӀ, магӀарул мацӀ'), - array('code'=>'ay','name'=>'Aymara','native_name'=>'aymar aru'), - array('code'=>'az','name'=>'Azerbaijani','native_name'=>'azÉ™rbaycan dili'), - array('code'=>'ba','name'=>'Bashkir','native_name'=>'башҡорт теле'), - array('code'=>'be','name'=>'Belarusian','native_name'=>'беларуÑÐºÐ°Ñ Ð¼Ð¾Ð²Ð°'), - array('code'=>'bg','name'=>'Bulgarian','native_name'=>'българÑки език'), - array('code'=>'bh','name'=>'Bihari languages','native_name'=>'à¤à¥‹à¤œà¤ªà¥à¤°à¥€'), - array('code'=>'bi','name'=>'Bislama','native_name'=>'Bislama'), - array('code'=>'bm','name'=>'Bambara','native_name'=>'bamanankan'), - array('code'=>'bn','name'=>'Bengali','native_name'=>'বাংলা'), - array('code'=>'bo','name'=>'Tibetan','native_name'=>'བོད་ཡིག'), - array('code'=>'br','name'=>'Breton','native_name'=>'brezhoneg'), - array('code'=>'bs','name'=>'Bosnian','native_name'=>'bosanski jezik'), - array('code'=>'ca','name'=>'Catalan, Valencian','native_name'=>'català , valencià '), - array('code'=>'ce','name'=>'Chechen','native_name'=>'нохчийн мотт'), - array('code'=>'ch','name'=>'Chamorro','native_name'=>'Chamoru'), - array('code'=>'co','name'=>'Corsican','native_name'=>'corsu, lingua corsa'), - array('code'=>'cr','name'=>'Cree','native_name'=>'á“€á¦áƒá”ááá£'), - array('code'=>'cs','name'=>'Czech','native_name'=>'ÄeÅ¡tina, Äeský jazyk'), - array('code'=>'cu','name'=>'Church Slavic, Old Slavonic, Church Slavonic, Old Bulgarian, Old Church Slavonic','native_name'=>'ѩзыкъ ÑловѣньÑкъ'), - array('code'=>'cv','name'=>'Chuvash','native_name'=>'чӑваш чӗлхи'), - array('code'=>'cy','name'=>'Welsh','native_name'=>'Cymraeg'), - array('code'=>'da','name'=>'Danish','native_name'=>'dansk'), - array('code'=>'de','name'=>'German','native_name'=>'Deutsch'), - array('code'=>'dv','name'=>'Divehi, Dhivehi, Maldivian','native_name'=>'Þ‹Þ¨ÞˆÞ¬Þ€Þ¨'), - array('code'=>'dz','name'=>'Dzongkha','native_name'=>'རྫོང་à½'), - array('code'=>'ee','name'=>'Ewe','native_name'=>'EÊ‹egbe'), - array('code'=>'el','name'=>'Greek, Modern (1453–)','native_name'=>'ελληνικά'), - array('code'=>'en','name'=>'English','native_name'=>'English'), - array('code'=>'eo','name'=>'Esperanto','native_name'=>'Esperanto'), - array('code'=>'es','name'=>'Spanish, Castilian','native_name'=>'Español'), - array('code'=>'et','name'=>'Estonian','native_name'=>'eesti, eesti keel'), - array('code'=>'eu','name'=>'Basque','native_name'=>'euskara, euskera'), - array('code'=>'fa','name'=>'Persian','native_name'=>'Ùارسی'), - array('code'=>'ff','name'=>'Fulah','native_name'=>'Fulfulde, Pulaar, Pular'), - array('code'=>'fi','name'=>'Finnish','native_name'=>'suomi, suomen kieli'), - array('code'=>'fj','name'=>'Fijian','native_name'=>'vosa Vakaviti'), - array('code'=>'fo','name'=>'Faroese','native_name'=>'føroyskt'), - array('code'=>'fr','name'=>'French','native_name'=>'français, langue française'), - array('code'=>'fy','name'=>'Western Frisian','native_name'=>'Frysk'), - array('code'=>'ga','name'=>'Irish','native_name'=>'Gaeilge'), - array('code'=>'gd','name'=>'Gaelic, Scottish Gaelic','native_name'=>'Gà idhlig'), - array('code'=>'gl','name'=>'Galician','native_name'=>'Galego'), - array('code'=>'gn','name'=>'Guarani','native_name'=>'Avañe\'ẽ'), - array('code'=>'gu','name'=>'Gujarati','native_name'=>'ગà«àªœàª°àª¾àª¤à«€'), - array('code'=>'gv','name'=>'Manx','native_name'=>'Gaelg, Gailck'), - array('code'=>'ha','name'=>'Hausa','native_name'=>'(Hausa) Ù‡ÙŽÙˆÙسَ'), - array('code'=>'he','name'=>'Hebrew','native_name'=>'עברית'), - array('code'=>'hi','name'=>'Hindi','native_name'=>'हिनà¥à¤¦à¥€, हिंदी'), - array('code'=>'ho','name'=>'Hiri Motu','native_name'=>'Hiri Motu'), - array('code'=>'hr','name'=>'Croatian','native_name'=>'hrvatski jezik'), - array('code'=>'ht','name'=>'Haitian, Haitian Creole','native_name'=>'Kreyòl ayisyen'), - array('code'=>'hu','name'=>'Hungarian','native_name'=>'magyar'), - array('code'=>'hy','name'=>'Armenian','native_name'=>'Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶'), - array('code'=>'hz','name'=>'Herero','native_name'=>'Otjiherero'), - array('code'=>'ia','name'=>'Interlingua (International Auxiliary Language Association)','native_name'=>'Interlingua'), - array('code'=>'id','name'=>'Indonesian','native_name'=>'Bahasa Indonesia'), - array('code'=>'ie','name'=>'Interlingue, Occidental','native_name'=>'(originally:) Occidental, (after WWII:) Interlingue'), - array('code'=>'ig','name'=>'Igbo','native_name'=>'Asụsụ Igbo'), - array('code'=>'ii','name'=>'Sichuan Yi, Nuosu','native_name'=>'ê†ˆêŒ ê’¿ Nuosuhxop'), - array('code'=>'ik','name'=>'Inupiaq','native_name'=>'Iñupiaq, Iñupiatun'), - array('code'=>'io','name'=>'Ido','native_name'=>'Ido'), - array('code'=>'is','name'=>'Icelandic','native_name'=>'Ãslenska'), - array('code'=>'it','name'=>'Italian','native_name'=>'Italiano'), - array('code'=>'iu','name'=>'Inuktitut','native_name'=>'áƒá“„ᒃᑎá‘ᑦ'), - array('code'=>'ja','name'=>'Japanese','native_name'=>'日本語 (ã«ã»ã‚“ã”)'), - array('code'=>'jv','name'=>'Javanese','native_name'=>'ꦧꦱꦗꦮ, Basa Jawa'), - array('code'=>'ka','name'=>'Georgian','native_name'=>'ქáƒáƒ თული'), - array('code'=>'kg','name'=>'Kongo','native_name'=>'Kikongo'), - array('code'=>'ki','name'=>'Kikuyu, Gikuyu','native_name'=>'GÄ©kÅ©yÅ©'), - array('code'=>'kj','name'=>'Kuanyama, Kwanyama','native_name'=>'Kuanyama'), - array('code'=>'kk','name'=>'Kazakh','native_name'=>'қазақ тілі'), - array('code'=>'kl','name'=>'Kalaallisut, Greenlandic','native_name'=>'kalaallisut, kalaallit oqaasii'), - array('code'=>'km','name'=>'Central Khmer','native_name'=>'ážáŸ’មែរ, ážáŸáž˜ážšáž—ាសា, ភាសាážáŸ’មែរ'), - array('code'=>'kn','name'=>'Kannada','native_name'=>'ಕನà³à²¨à²¡'), - array('code'=>'ko','name'=>'Korean','native_name'=>'í•œêµì–´'), - array('code'=>'kr','name'=>'Kanuri','native_name'=>'Kanuri'), - array('code'=>'ks','name'=>'Kashmiri','native_name'=>'कशà¥à¤®à¥€à¤°à¥€, كشميري‎'), - array('code'=>'ku','name'=>'Kurdish','native_name'=>'Kurdî, کوردی‎'), - array('code'=>'kv','name'=>'Komi','native_name'=>'коми кыв'), - array('code'=>'kw','name'=>'Cornish','native_name'=>'Kernewek'), - array('code'=>'ky','name'=>'Kirghiz, Kyrgyz','native_name'=>'Кыргызча, Кыргыз тили'), - array('code'=>'la','name'=>'Latin','native_name'=>'latine, lingua latina'), - array('code'=>'lb','name'=>'Luxembourgish, Letzeburgesch','native_name'=>'Lëtzebuergesch'), - array('code'=>'lg','name'=>'Ganda','native_name'=>'Luganda'), - array('code'=>'li','name'=>'Limburgan, Limburger, Limburgish','native_name'=>'Limburgs'), - array('code'=>'ln','name'=>'Lingala','native_name'=>'Lingála'), - array('code'=>'lo','name'=>'Lao','native_name'=>'ພາສາລາວ'), - array('code'=>'lt','name'=>'Lithuanian','native_name'=>'lietuvių kalba'), - array('code'=>'lu','name'=>'Luba-Katanga','native_name'=>'Kiluba'), - array('code'=>'lv','name'=>'Latvian','native_name'=>'latvieÅ¡u valoda'), - array('code'=>'mg','name'=>'Malagasy','native_name'=>'fiteny malagasy'), - array('code'=>'mh','name'=>'Marshallese','native_name'=>'Kajin M̧ajeļ'), - array('code'=>'mi','name'=>'Maori','native_name'=>'te reo MÄori'), - array('code'=>'mk','name'=>'Macedonian','native_name'=>'македонÑки јазик'), - array('code'=>'ml','name'=>'Malayalam','native_name'=>'മലയാളം'), - array('code'=>'mn','name'=>'Mongolian','native_name'=>'Монгол Ñ…Ñл'), - array('code'=>'mr','name'=>'Marathi','native_name'=>'मराठी'), - array('code'=>'ms','name'=>'Malay','native_name'=>'Bahasa Melayu, بهاس ملايو‎'), - array('code'=>'mt','name'=>'Maltese','native_name'=>'Malti'), - array('code'=>'my','name'=>'Burmese','native_name'=>'ဗမာစာ'), - array('code'=>'na','name'=>'Nauru','native_name'=>'Dorerin Naoero'), - array('code'=>'nb','name'=>'Norwegian BokmÃ¥l','native_name'=>'Norsk BokmÃ¥l'), - array('code'=>'nd','name'=>'North Ndebele','native_name'=>'isiNdebele'), - array('code'=>'ne','name'=>'Nepali','native_name'=>'नेपाली'), - array('code'=>'ng','name'=>'Ndonga','native_name'=>'Owambo'), - array('code'=>'nl','name'=>'Dutch, Flemish','native_name'=>'Nederlands, Vlaams'), - array('code'=>'nn','name'=>'Norwegian Nynorsk','native_name'=>'Norsk Nynorsk'), - array('code'=>'no','name'=>'Norwegian','native_name'=>'Norsk'), - array('code'=>'nr','name'=>'South Ndebele','native_name'=>'isiNdebele'), - array('code'=>'nv','name'=>'Navajo, Navaho','native_name'=>'Diné bizaad'), - array('code'=>'ny','name'=>'Chichewa, Chewa, Nyanja','native_name'=>'chiCheŵa, chinyanja'), - array('code'=>'oc','name'=>'Occitan','native_name'=>'occitan, lenga d’òc'), - array('code'=>'oj','name'=>'Ojibwa','native_name'=>'áŠá“‚ᔑᓈá¯á’§áŽá“'), - array('code'=>'om','name'=>'Oromo','native_name'=>'Afaan Oromoo'), - array('code'=>'or','name'=>'Oriya','native_name'=>'ଓଡ଼ିଆ'), - array('code'=>'os','name'=>'Ossetian, Ossetic','native_name'=>'ирон æвзаг'), - array('code'=>'pa','name'=>'Punjabi, Panjabi','native_name'=>'ਪੰਜਾਬੀ, پنجابی‎'), - array('code'=>'pi','name'=>'Pali','native_name'=>'पालि, पाळि'), - array('code'=>'pl','name'=>'Polish','native_name'=>'jÄ™zyk polski, polszczyzna'), - array('code'=>'ps','name'=>'Pashto, Pushto','native_name'=>'پښتو'), - array('code'=>'pt','name'=>'Portuguese','native_name'=>'Português'), - array('code'=>'qu','name'=>'Quechua','native_name'=>'Runa Simi, Kichwa'), - array('code'=>'rm','name'=>'Romansh','native_name'=>'Rumantsch Grischun'), - array('code'=>'rn','name'=>'Rundi','native_name'=>'Ikirundi'), - array('code'=>'ro','name'=>'Romanian, Moldavian, Moldovan','native_name'=>'Română'), - array('code'=>'ru','name'=>'Russian','native_name'=>'руÑÑкий'), - array('code'=>'rw','name'=>'Kinyarwanda','native_name'=>'Ikinyarwanda'), - array('code'=>'sa','name'=>'Sanskrit','native_name'=>'संसà¥à¤•à¥ƒà¤¤à¤®à¥'), - array('code'=>'sc','name'=>'Sardinian','native_name'=>'sardu'), - array('code'=>'sd','name'=>'Sindhi','native_name'=>'सिनà¥à¤§à¥€, سنڌي، سندھی‎'), - array('code'=>'se','name'=>'Northern Sami','native_name'=>'Davvisámegiella'), - array('code'=>'sg','name'=>'Sango','native_name'=>'yângâ tî sängö'), - array('code'=>'si','name'=>'Sinhala, Sinhalese','native_name'=>'සිංහල'), - array('code'=>'sk','name'=>'Slovak','native_name'=>'SlovenÄina, Slovenský Jazyk'), - array('code'=>'sl','name'=>'Slovenian','native_name'=>'Slovenski Jezik, SlovenÅ¡Äina'), - array('code'=>'sm','name'=>'Samoan','native_name'=>'gagana fa\'a Samoa'), - array('code'=>'sn','name'=>'Shona','native_name'=>'chiShona'), - array('code'=>'so','name'=>'Somali','native_name'=>'Soomaaliga, af Soomaali'), - array('code'=>'sq','name'=>'Albanian','native_name'=>'Shqip'), - array('code'=>'sr','name'=>'Serbian','native_name'=>'ÑрпÑки језик'), - array('code'=>'ss','name'=>'Swati','native_name'=>'SiSwati'), - array('code'=>'st','name'=>'Southern Sotho','native_name'=>'Sesotho'), - array('code'=>'su','name'=>'Sundanese','native_name'=>'Basa Sunda'), - array('code'=>'sv','name'=>'Swedish','native_name'=>'Svenska'), - array('code'=>'sw','name'=>'Swahili','native_name'=>'Kiswahili'), - array('code'=>'ta','name'=>'Tamil','native_name'=>'தமிழà¯'), - array('code'=>'te','name'=>'Telugu','native_name'=>'తెలà±à°—à±'), - array('code'=>'tg','name'=>'Tajik','native_name'=>'тоҷикӣ, toçikÄ«, تاجیکی‎'), - array('code'=>'th','name'=>'Thai','native_name'=>'ไทย'), - array('code'=>'ti','name'=>'Tigrinya','native_name'=>'ትáŒáˆáŠ›'), - array('code'=>'tk','name'=>'Turkmen','native_name'=>'Türkmen, Түркмен'), - array('code'=>'tl','name'=>'Tagalog','native_name'=>'Wikang Tagalog'), - array('code'=>'tn','name'=>'Tswana','native_name'=>'Setswana'), - array('code'=>'to','name'=>'Tonga (Tonga Islands)','native_name'=>'Faka Tonga'), - array('code'=>'tr','name'=>'Turkish','native_name'=>'Türkçe'), - array('code'=>'ts','name'=>'Tsonga','native_name'=>'Xitsonga'), - array('code'=>'tt','name'=>'Tatar','native_name'=>'татар теле, tatar tele'), - array('code'=>'tw','name'=>'Twi','native_name'=>'Twi'), - array('code'=>'ty','name'=>'Tahitian','native_name'=>'Reo Tahiti'), - array('code'=>'ug','name'=>'Uighur, Uyghur','native_name'=>'ئۇيغۇرچە‎, Uyghurche'), - array('code'=>'uk','name'=>'Ukrainian','native_name'=>'УкраїнÑька'), - array('code'=>'ur','name'=>'Urdu','native_name'=>'اردو'), - array('code'=>'uz','name'=>'Uzbek','native_name'=>'OÊ»zbek, Ўзбек, أۇزبÛك‎'), - array('code'=>'ve','name'=>'Venda','native_name'=>'Tshivenḓa'), - array('code'=>'vi','name'=>'Vietnamese','native_name'=>'Tiếng Việt'), - array('code'=>'vo','name'=>'Volapük','native_name'=>'Volapük'), - array('code'=>'wa','name'=>'Walloon','native_name'=>'Walon'), - array('code'=>'wo','name'=>'Wolof','native_name'=>'Wollof'), - array('code'=>'xh','name'=>'Xhosa','native_name'=>'isiXhosa'), - array('code'=>'yi','name'=>'Yiddish','native_name'=>'ייִדיש'), - array('code'=>'yo','name'=>'Yoruba','native_name'=>'Yorùbá'), - array('code'=>'za','name'=>'Zhuang, Chuang','native_name'=>'Saɯ cueÅ‹Æ…, Saw cuengh'), - array('code'=>'zh','name'=>'Chinese','native_name'=>'ä¸æ–‡ (ZhÅngwén), 汉è¯, 漢語'), - array('code'=>'zu','name'=>'Zulu','native_name'=>'isiZulu'), - ); + $data = [ + ['code' => 'aa', 'name' => 'Afar', 'native_name' => 'Afaraf'], + [ + 'code' => 'ab', + 'name' => 'Abkhazian', + 'native_name' => 'аҧÑуа бызшәа, аҧÑшәа', + ], + ['code' => 'ae', 'name' => 'Avestan', 'native_name' => 'avesta'], + [ + 'code' => 'af', + 'name' => 'Afrikaans', + 'native_name' => 'Afrikaans', + ], + ['code' => 'ak', 'name' => 'Akan', 'native_name' => 'Akan'], + ['code' => 'am', 'name' => 'Amharic', 'native_name' => 'አማáˆáŠ›'], + [ + 'code' => 'an', + 'name' => 'Aragonese', + 'native_name' => 'aragonés', + ], + ['code' => 'ar', 'name' => 'Arabic', 'native_name' => 'العربية'], + ['code' => 'as', 'name' => 'Assamese', 'native_name' => 'অসমীয়া'], + [ + 'code' => 'av', + 'name' => 'Avaric', + 'native_name' => 'авар мацӀ, магӀарул мацӀ', + ], + ['code' => 'ay', 'name' => 'Aymara', 'native_name' => 'aymar aru'], + [ + 'code' => 'az', + 'name' => 'Azerbaijani', + 'native_name' => 'azÉ™rbaycan dili', + ], + [ + 'code' => 'ba', + 'name' => 'Bashkir', + 'native_name' => 'башҡорт теле', + ], + [ + 'code' => 'be', + 'name' => 'Belarusian', + 'native_name' => 'беларуÑÐºÐ°Ñ Ð¼Ð¾Ð²Ð°', + ], + [ + 'code' => 'bg', + 'name' => 'Bulgarian', + 'native_name' => 'българÑки език', + ], + [ + 'code' => 'bh', + 'name' => 'Bihari languages', + 'native_name' => 'à¤à¥‹à¤œà¤ªà¥à¤°à¥€', + ], + ['code' => 'bi', 'name' => 'Bislama', 'native_name' => 'Bislama'], + [ + 'code' => 'bm', + 'name' => 'Bambara', + 'native_name' => 'bamanankan', + ], + ['code' => 'bn', 'name' => 'Bengali', 'native_name' => 'বাংলা'], + ['code' => 'bo', 'name' => 'Tibetan', 'native_name' => 'བོད་ཡིག'], + ['code' => 'br', 'name' => 'Breton', 'native_name' => 'brezhoneg'], + [ + 'code' => 'bs', + 'name' => 'Bosnian', + 'native_name' => 'bosanski jezik', + ], + [ + 'code' => 'ca', + 'name' => 'Catalan, Valencian', + 'native_name' => 'català , valencià ', + ], + [ + 'code' => 'ce', + 'name' => 'Chechen', + 'native_name' => 'нохчийн мотт', + ], + ['code' => 'ch', 'name' => 'Chamorro', 'native_name' => 'Chamoru'], + [ + 'code' => 'co', + 'name' => 'Corsican', + 'native_name' => 'corsu, lingua corsa', + ], + ['code' => 'cr', 'name' => 'Cree', 'native_name' => 'á“€á¦áƒá”ááá£'], + [ + 'code' => 'cs', + 'name' => 'Czech', + 'native_name' => 'ÄeÅ¡tina, Äeský jazyk', + ], + [ + 'code' => 'cu', + 'name' => + 'Church Slavic, Old Slavonic, Church Slavonic, Old Bulgarian, Old Church Slavonic', + 'native_name' => 'ѩзыкъ ÑловѣньÑкъ', + ], + [ + 'code' => 'cv', + 'name' => 'Chuvash', + 'native_name' => 'чӑваш чӗлхи', + ], + ['code' => 'cy', 'name' => 'Welsh', 'native_name' => 'Cymraeg'], + ['code' => 'da', 'name' => 'Danish', 'native_name' => 'dansk'], + ['code' => 'de', 'name' => 'German', 'native_name' => 'Deutsch'], + [ + 'code' => 'dv', + 'name' => 'Divehi, Dhivehi, Maldivian', + 'native_name' => 'Þ‹Þ¨ÞˆÞ¬Þ€Þ¨', + ], + ['code' => 'dz', 'name' => 'Dzongkha', 'native_name' => 'རྫོང་à½'], + ['code' => 'ee', 'name' => 'Ewe', 'native_name' => 'EÊ‹egbe'], + [ + 'code' => 'el', + 'name' => 'Greek, Modern (1453–)', + 'native_name' => 'ελληνικά', + ], + ['code' => 'en', 'name' => 'English', 'native_name' => 'English'], + [ + 'code' => 'eo', + 'name' => 'Esperanto', + 'native_name' => 'Esperanto', + ], + [ + 'code' => 'es', + 'name' => 'Spanish, Castilian', + 'native_name' => 'Español', + ], + [ + 'code' => 'et', + 'name' => 'Estonian', + 'native_name' => 'eesti, eesti keel', + ], + [ + 'code' => 'eu', + 'name' => 'Basque', + 'native_name' => 'euskara, euskera', + ], + ['code' => 'fa', 'name' => 'Persian', 'native_name' => 'Ùارسی'], + [ + 'code' => 'ff', + 'name' => 'Fulah', + 'native_name' => 'Fulfulde, Pulaar, Pular', + ], + [ + 'code' => 'fi', + 'name' => 'Finnish', + 'native_name' => 'suomi, suomen kieli', + ], + [ + 'code' => 'fj', + 'name' => 'Fijian', + 'native_name' => 'vosa Vakaviti', + ], + ['code' => 'fo', 'name' => 'Faroese', 'native_name' => 'føroyskt'], + [ + 'code' => 'fr', + 'name' => 'French', + 'native_name' => 'français, langue française', + ], + [ + 'code' => 'fy', + 'name' => 'Western Frisian', + 'native_name' => 'Frysk', + ], + ['code' => 'ga', 'name' => 'Irish', 'native_name' => 'Gaeilge'], + [ + 'code' => 'gd', + 'name' => 'Gaelic, Scottish Gaelic', + 'native_name' => 'Gà idhlig', + ], + ['code' => 'gl', 'name' => 'Galician', 'native_name' => 'Galego'], + ['code' => 'gn', 'name' => 'Guarani', 'native_name' => 'Avañe\'ẽ'], + ['code' => 'gu', 'name' => 'Gujarati', 'native_name' => 'ગà«àªœàª°àª¾àª¤à«€'], + [ + 'code' => 'gv', + 'name' => 'Manx', + 'native_name' => 'Gaelg, Gailck', + ], + [ + 'code' => 'ha', + 'name' => 'Hausa', + 'native_name' => '(Hausa) Ù‡ÙŽÙˆÙسَ', + ], + ['code' => 'he', 'name' => 'Hebrew', 'native_name' => 'עברית'], + [ + 'code' => 'hi', + 'name' => 'Hindi', + 'native_name' => 'हिनà¥à¤¦à¥€, हिंदी', + ], + [ + 'code' => 'ho', + 'name' => 'Hiri Motu', + 'native_name' => 'Hiri Motu', + ], + [ + 'code' => 'hr', + 'name' => 'Croatian', + 'native_name' => 'hrvatski jezik', + ], + [ + 'code' => 'ht', + 'name' => 'Haitian, Haitian Creole', + 'native_name' => 'Kreyòl ayisyen', + ], + ['code' => 'hu', 'name' => 'Hungarian', 'native_name' => 'magyar'], + ['code' => 'hy', 'name' => 'Armenian', 'native_name' => 'Õ€Õ¡ÕµÕ¥Ö€Õ¥Õ¶'], + ['code' => 'hz', 'name' => 'Herero', 'native_name' => 'Otjiherero'], + [ + 'code' => 'ia', + 'name' => + 'Interlingua (International Auxiliary Language Association)', + 'native_name' => 'Interlingua', + ], + [ + 'code' => 'id', + 'name' => 'Indonesian', + 'native_name' => 'Bahasa Indonesia', + ], + [ + 'code' => 'ie', + 'name' => 'Interlingue, Occidental', + 'native_name' => + '(originally:) Occidental, (after WWII:) Interlingue', + ], + ['code' => 'ig', 'name' => 'Igbo', 'native_name' => 'Asụsụ Igbo'], + [ + 'code' => 'ii', + 'name' => 'Sichuan Yi, Nuosu', + 'native_name' => 'ê†ˆêŒ ê’¿ Nuosuhxop', + ], + [ + 'code' => 'ik', + 'name' => 'Inupiaq', + 'native_name' => 'Iñupiaq, Iñupiatun', + ], + ['code' => 'io', 'name' => 'Ido', 'native_name' => 'Ido'], + [ + 'code' => 'is', + 'name' => 'Icelandic', + 'native_name' => 'Ãslenska', + ], + ['code' => 'it', 'name' => 'Italian', 'native_name' => 'Italiano'], + ['code' => 'iu', 'name' => 'Inuktitut', 'native_name' => 'áƒá“„ᒃᑎá‘ᑦ'], + [ + 'code' => 'ja', + 'name' => 'Japanese', + 'native_name' => '日本語 (ã«ã»ã‚“ã”)', + ], + [ + 'code' => 'jv', + 'name' => 'Javanese', + 'native_name' => 'ꦧꦱꦗꦮ, Basa Jawa', + ], + ['code' => 'ka', 'name' => 'Georgian', 'native_name' => 'ქáƒáƒ თული'], + ['code' => 'kg', 'name' => 'Kongo', 'native_name' => 'Kikongo'], + [ + 'code' => 'ki', + 'name' => 'Kikuyu, Gikuyu', + 'native_name' => 'GÄ©kÅ©yÅ©', + ], + [ + 'code' => 'kj', + 'name' => 'Kuanyama, Kwanyama', + 'native_name' => 'Kuanyama', + ], + ['code' => 'kk', 'name' => 'Kazakh', 'native_name' => 'қазақ тілі'], + [ + 'code' => 'kl', + 'name' => 'Kalaallisut, Greenlandic', + 'native_name' => 'kalaallisut, kalaallit oqaasii', + ], + [ + 'code' => 'km', + 'name' => 'Central Khmer', + 'native_name' => 'ážáŸ’មែរ, ážáŸáž˜ážšáž—ាសា, ភាសាážáŸ’មែរ', + ], + ['code' => 'kn', 'name' => 'Kannada', 'native_name' => 'ಕನà³à²¨à²¡'], + ['code' => 'ko', 'name' => 'Korean', 'native_name' => 'í•œêµì–´'], + ['code' => 'kr', 'name' => 'Kanuri', 'native_name' => 'Kanuri'], + [ + 'code' => 'ks', + 'name' => 'Kashmiri', + 'native_name' => 'कशà¥à¤®à¥€à¤°à¥€, كشميري‎', + ], + [ + 'code' => 'ku', + 'name' => 'Kurdish', + 'native_name' => 'Kurdî, کوردی‎', + ], + ['code' => 'kv', 'name' => 'Komi', 'native_name' => 'коми кыв'], + ['code' => 'kw', 'name' => 'Cornish', 'native_name' => 'Kernewek'], + [ + 'code' => 'ky', + 'name' => 'Kirghiz, Kyrgyz', + 'native_name' => 'Кыргызча, Кыргыз тили', + ], + [ + 'code' => 'la', + 'name' => 'Latin', + 'native_name' => 'latine, lingua latina', + ], + [ + 'code' => 'lb', + 'name' => 'Luxembourgish, Letzeburgesch', + 'native_name' => 'Lëtzebuergesch', + ], + ['code' => 'lg', 'name' => 'Ganda', 'native_name' => 'Luganda'], + [ + 'code' => 'li', + 'name' => 'Limburgan, Limburger, Limburgish', + 'native_name' => 'Limburgs', + ], + ['code' => 'ln', 'name' => 'Lingala', 'native_name' => 'Lingála'], + ['code' => 'lo', 'name' => 'Lao', 'native_name' => 'ພາສາລາວ'], + [ + 'code' => 'lt', + 'name' => 'Lithuanian', + 'native_name' => 'lietuvių kalba', + ], + [ + 'code' => 'lu', + 'name' => 'Luba-Katanga', + 'native_name' => 'Kiluba', + ], + [ + 'code' => 'lv', + 'name' => 'Latvian', + 'native_name' => 'latvieÅ¡u valoda', + ], + [ + 'code' => 'mg', + 'name' => 'Malagasy', + 'native_name' => 'fiteny malagasy', + ], + [ + 'code' => 'mh', + 'name' => 'Marshallese', + 'native_name' => 'Kajin M̧ajeļ', + ], + [ + 'code' => 'mi', + 'name' => 'Maori', + 'native_name' => 'te reo MÄori', + ], + [ + 'code' => 'mk', + 'name' => 'Macedonian', + 'native_name' => 'македонÑки јазик', + ], + ['code' => 'ml', 'name' => 'Malayalam', 'native_name' => 'മലയാളം'], + [ + 'code' => 'mn', + 'name' => 'Mongolian', + 'native_name' => 'Монгол Ñ…Ñл', + ], + ['code' => 'mr', 'name' => 'Marathi', 'native_name' => 'मराठी'], + [ + 'code' => 'ms', + 'name' => 'Malay', + 'native_name' => 'Bahasa Melayu, بهاس ملايو‎', + ], + ['code' => 'mt', 'name' => 'Maltese', 'native_name' => 'Malti'], + ['code' => 'my', 'name' => 'Burmese', 'native_name' => 'ဗမာစာ'], + [ + 'code' => 'na', + 'name' => 'Nauru', + 'native_name' => 'Dorerin Naoero', + ], + [ + 'code' => 'nb', + 'name' => 'Norwegian BokmÃ¥l', + 'native_name' => 'Norsk BokmÃ¥l', + ], + [ + 'code' => 'nd', + 'name' => 'North Ndebele', + 'native_name' => 'isiNdebele', + ], + ['code' => 'ne', 'name' => 'Nepali', 'native_name' => 'नेपाली'], + ['code' => 'ng', 'name' => 'Ndonga', 'native_name' => 'Owambo'], + [ + 'code' => 'nl', + 'name' => 'Dutch, Flemish', + 'native_name' => 'Nederlands, Vlaams', + ], + [ + 'code' => 'nn', + 'name' => 'Norwegian Nynorsk', + 'native_name' => 'Norsk Nynorsk', + ], + ['code' => 'no', 'name' => 'Norwegian', 'native_name' => 'Norsk'], + [ + 'code' => 'nr', + 'name' => 'South Ndebele', + 'native_name' => 'isiNdebele', + ], + [ + 'code' => 'nv', + 'name' => 'Navajo, Navaho', + 'native_name' => 'Diné bizaad', + ], + [ + 'code' => 'ny', + 'name' => 'Chichewa, Chewa, Nyanja', + 'native_name' => 'chiCheŵa, chinyanja', + ], + [ + 'code' => 'oc', + 'name' => 'Occitan', + 'native_name' => 'occitan, lenga d’òc', + ], + ['code' => 'oj', 'name' => 'Ojibwa', 'native_name' => 'áŠá“‚ᔑᓈá¯á’§áŽá“'], + [ + 'code' => 'om', + 'name' => 'Oromo', + 'native_name' => 'Afaan Oromoo', + ], + ['code' => 'or', 'name' => 'Oriya', 'native_name' => 'ଓଡ଼ିଆ'], + [ + 'code' => 'os', + 'name' => 'Ossetian, Ossetic', + 'native_name' => 'ирон æвзаг', + ], + [ + 'code' => 'pa', + 'name' => 'Punjabi, Panjabi', + 'native_name' => 'ਪੰਜਾਬੀ, پنجابی‎', + ], + ['code' => 'pi', 'name' => 'Pali', 'native_name' => 'पालि, पाळि'], + [ + 'code' => 'pl', + 'name' => 'Polish', + 'native_name' => 'jÄ™zyk polski, polszczyzna', + ], + [ + 'code' => 'ps', + 'name' => 'Pashto, Pushto', + 'native_name' => 'پښتو', + ], + [ + 'code' => 'pt', + 'name' => 'Portuguese', + 'native_name' => 'Português', + ], + [ + 'code' => 'qu', + 'name' => 'Quechua', + 'native_name' => 'Runa Simi, Kichwa', + ], + [ + 'code' => 'rm', + 'name' => 'Romansh', + 'native_name' => 'Rumantsch Grischun', + ], + ['code' => 'rn', 'name' => 'Rundi', 'native_name' => 'Ikirundi'], + [ + 'code' => 'ro', + 'name' => 'Romanian, Moldavian, Moldovan', + 'native_name' => 'Română', + ], + ['code' => 'ru', 'name' => 'Russian', 'native_name' => 'руÑÑкий'], + [ + 'code' => 'rw', + 'name' => 'Kinyarwanda', + 'native_name' => 'Ikinyarwanda', + ], + [ + 'code' => 'sa', + 'name' => 'Sanskrit', + 'native_name' => 'संसà¥à¤•à¥ƒà¤¤à¤®à¥', + ], + ['code' => 'sc', 'name' => 'Sardinian', 'native_name' => 'sardu'], + [ + 'code' => 'sd', + 'name' => 'Sindhi', + 'native_name' => 'सिनà¥à¤§à¥€, سنڌي، سندھی‎', + ], + [ + 'code' => 'se', + 'name' => 'Northern Sami', + 'native_name' => 'Davvisámegiella', + ], + [ + 'code' => 'sg', + 'name' => 'Sango', + 'native_name' => 'yângâ tî sängö', + ], + [ + 'code' => 'si', + 'name' => 'Sinhala, Sinhalese', + 'native_name' => 'සිංහල', + ], + [ + 'code' => 'sk', + 'name' => 'Slovak', + 'native_name' => 'SlovenÄina, Slovenský Jazyk', + ], + [ + 'code' => 'sl', + 'name' => 'Slovenian', + 'native_name' => 'Slovenski Jezik, SlovenÅ¡Äina', + ], + [ + 'code' => 'sm', + 'name' => 'Samoan', + 'native_name' => 'gagana fa\'a Samoa', + ], + ['code' => 'sn', 'name' => 'Shona', 'native_name' => 'chiShona'], + [ + 'code' => 'so', + 'name' => 'Somali', + 'native_name' => 'Soomaaliga, af Soomaali', + ], + ['code' => 'sq', 'name' => 'Albanian', 'native_name' => 'Shqip'], + [ + 'code' => 'sr', + 'name' => 'Serbian', + 'native_name' => 'ÑрпÑки језик', + ], + ['code' => 'ss', 'name' => 'Swati', 'native_name' => 'SiSwati'], + [ + 'code' => 'st', + 'name' => 'Southern Sotho', + 'native_name' => 'Sesotho', + ], + [ + 'code' => 'su', + 'name' => 'Sundanese', + 'native_name' => 'Basa Sunda', + ], + ['code' => 'sv', 'name' => 'Swedish', 'native_name' => 'Svenska'], + ['code' => 'sw', 'name' => 'Swahili', 'native_name' => 'Kiswahili'], + ['code' => 'ta', 'name' => 'Tamil', 'native_name' => 'தமிழà¯'], + ['code' => 'te', 'name' => 'Telugu', 'native_name' => 'తెలà±à°—à±'], + [ + 'code' => 'tg', + 'name' => 'Tajik', + 'native_name' => 'тоҷикӣ, toçikÄ«, تاجیکی‎', + ], + ['code' => 'th', 'name' => 'Thai', 'native_name' => 'ไทย'], + ['code' => 'ti', 'name' => 'Tigrinya', 'native_name' => 'ትáŒáˆáŠ›'], + [ + 'code' => 'tk', + 'name' => 'Turkmen', + 'native_name' => 'Türkmen, Түркмен', + ], + [ + 'code' => 'tl', + 'name' => 'Tagalog', + 'native_name' => 'Wikang Tagalog', + ], + ['code' => 'tn', 'name' => 'Tswana', 'native_name' => 'Setswana'], + [ + 'code' => 'to', + 'name' => 'Tonga (Tonga Islands)', + 'native_name' => 'Faka Tonga', + ], + ['code' => 'tr', 'name' => 'Turkish', 'native_name' => 'Türkçe'], + ['code' => 'ts', 'name' => 'Tsonga', 'native_name' => 'Xitsonga'], + [ + 'code' => 'tt', + 'name' => 'Tatar', + 'native_name' => 'татар теле, tatar tele', + ], + ['code' => 'tw', 'name' => 'Twi', 'native_name' => 'Twi'], + [ + 'code' => 'ty', + 'name' => 'Tahitian', + 'native_name' => 'Reo Tahiti', + ], + [ + 'code' => 'ug', + 'name' => 'Uighur, Uyghur', + 'native_name' => 'ئۇيغۇرچە‎, Uyghurche', + ], + [ + 'code' => 'uk', + 'name' => 'Ukrainian', + 'native_name' => 'УкраїнÑька', + ], + ['code' => 'ur', 'name' => 'Urdu', 'native_name' => 'اردو'], + [ + 'code' => 'uz', + 'name' => 'Uzbek', + 'native_name' => 'OÊ»zbek, Ўзбек, أۇزبÛك‎', + ], + ['code' => 've', 'name' => 'Venda', 'native_name' => 'Tshivenḓa'], + [ + 'code' => 'vi', + 'name' => 'Vietnamese', + 'native_name' => 'Tiếng Việt', + ], + ['code' => 'vo', 'name' => 'Volapük', 'native_name' => 'Volapük'], + ['code' => 'wa', 'name' => 'Walloon', 'native_name' => 'Walon'], + ['code' => 'wo', 'name' => 'Wolof', 'native_name' => 'Wollof'], + ['code' => 'xh', 'name' => 'Xhosa', 'native_name' => 'isiXhosa'], + ['code' => 'yi', 'name' => 'Yiddish', 'native_name' => 'ייִדיש'], + ['code' => 'yo', 'name' => 'Yoruba', 'native_name' => 'Yorùbá'], + [ + 'code' => 'za', + 'name' => 'Zhuang, Chuang', + 'native_name' => 'Saɯ cueÅ‹Æ…, Saw cuengh', + ], + [ + 'code' => 'zh', + 'name' => 'Chinese', + 'native_name' => 'ä¸æ–‡ (ZhÅngwén), 汉è¯, 漢語', + ], + ['code' => 'zu', 'name' => 'Zulu', 'native_name' => 'isiZulu'], + ]; $this->db->table('languages')->insertBatch($data); } diff --git a/app/Database/Seeds/PlatformSeeder.php b/app/Database/Seeds/PlatformSeeder.php index 7c09fdfe2e..ddbf3e1dbd 100644 --- a/app/Database/Seeds/PlatformSeeder.php +++ b/app/Database/Seeds/PlatformSeeder.php @@ -1,8 +1,8 @@ <?php /** * Class PlatformsSeeder - * Insert values in platforms table in database - * @author Benjamin Bellamy <ben@podlibre.org> + * Inserts values in platforms table in database + * * @copyright 2020 Podlibre * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @link https://castopod.org/ @@ -16,32 +16,319 @@ class PlatformSeeder extends Seeder { public function run() { - $data = array( - array('name' => 'Apple Podcasts', 'home_url' => 'https://www.apple.com/itunes/podcasts/', 'submit_url' => 'https://podcastsconnect.apple.com/my-podcasts/new-feed', 'iosapp_url' => 'https://apps.apple.com/app/apple-podcasts/id525463029', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 1, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'ApplePodcasts.png'), - array('name' => 'Blubrry', 'home_url' => 'https://www.blubrry.com/', 'submit_url' => 'https://www.blubrry.com/addpodcast.php', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'blubrry.png'), - array('name' => 'Castbox', 'home_url' => 'https://castbox.fm/', 'submit_url' => 'https://helpcenter.castbox.fm/portal/kb/articles/submit-my-podcast', 'iosapp_url' => 'https://apps.apple.com/app/castbox-the-podcast-app/id1243410543', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=fm.castbox.audiobook.radio.podcast&hl=fr', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'Castbox.png'), - array('name' => 'Castro', 'home_url' => 'http://castro.fm/', 'submit_url' => '', 'iosapp_url' => 'https://apps.apple.com/app/apple-store/id1080840241?ign-mpt=uo%3D4', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'Castro.png'), - array('name' => 'Chartable', 'home_url' => 'https://chartable.com/', 'submit_url' => 'https://chartable.com/podcasts/submit', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'Chartable.png'), - array('name' => 'Deezer', 'home_url' => 'https://www.deezer.com/', 'submit_url' => 'https://podcasters.deezer.com/submission', 'iosapp_url' => 'https://apps.apple.com/app/deezer-music-podcast-player/id292738169', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=deezer.android.app', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'Deezer.png'), - array('name' => 'Google Podcasts', 'home_url' => 'https://podcasts.google.com/about', 'submit_url' => 'https://search.google.com/search-console/about', 'iosapp_url' => '', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.google.android.apps.podcasts', 'comment' => '', 'display_by_default' => 1, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'GooglePodcasts.png'), - array('name' => 'Ivoox', 'home_url' => 'https://www.ivoox.com/', 'submit_url' => '', 'iosapp_url' => 'https://apps.apple.com/app/apple-store/id542673545', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.ivoox.app', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'ivoox.png'), - array('name' => 'ListenNotes', 'home_url' => 'https://www.listennotes.com/', 'submit_url' => 'https://www.listennotes.com/submit/', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'ListenNotes.png'), + $data = [ + [ + 'name' => 'Apple Podcasts', + 'home_url' => 'https://www.apple.com/itunes/podcasts/', + 'submit_url' => + 'https://podcastsconnect.apple.com/my-podcasts/new-feed', + 'iosapp_url' => + 'https://apps.apple.com/app/apple-podcasts/id525463029', + 'androidapp_url' => '', + 'comment' => '', + 'display_by_default' => 1, + 'ios_deeplink' => 0, + 'android_deeplink' => 0, + 'logo_file_name' => 'ApplePodcasts.png', + ], + [ + 'name' => 'Blubrry', + 'home_url' => 'https://www.blubrry.com/', + 'submit_url' => 'https://www.blubrry.com/addpodcast.php', + 'iosapp_url' => '', + 'androidapp_url' => '', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 0, + 'logo_file_name' => 'blubrry.png', + ], + [ + 'name' => 'Castbox', + 'home_url' => 'https://castbox.fm/', + 'submit_url' => + 'https://helpcenter.castbox.fm/portal/kb/articles/submit-my-podcast', + 'iosapp_url' => + 'https://apps.apple.com/app/castbox-the-podcast-app/id1243410543', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=fm.castbox.audiobook.radio.podcast&hl=fr', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 2, + 'logo_file_name' => 'Castbox.png', + ], + [ + 'name' => 'Castro', + 'home_url' => 'http://castro.fm/', + 'submit_url' => '', + 'iosapp_url' => + 'https://apps.apple.com/app/apple-store/id1080840241?ign-mpt=uo%3D4', + 'androidapp_url' => '', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 0, + 'logo_file_name' => 'Castro.png', + ], + [ + 'name' => 'Chartable', + 'home_url' => 'https://chartable.com/', + 'submit_url' => 'https://chartable.com/podcasts/submit', + 'iosapp_url' => '', + 'androidapp_url' => '', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 0, + 'logo_file_name' => 'Chartable.png', + ], + [ + 'name' => 'Deezer', + 'home_url' => 'https://www.deezer.com/', + 'submit_url' => 'https://podcasters.deezer.com/submission', + 'iosapp_url' => + 'https://apps.apple.com/app/deezer-music-podcast-player/id292738169', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=deezer.android.app', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 2, + 'logo_file_name' => 'Deezer.png', + ], + [ + 'name' => 'Google Podcasts', + 'home_url' => 'https://podcasts.google.com/about', + 'submit_url' => + 'https://search.google.com/search-console/about', + 'iosapp_url' => '', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=com.google.android.apps.podcasts', + 'comment' => '', + 'display_by_default' => 1, + 'ios_deeplink' => 0, + 'android_deeplink' => 1, + 'logo_file_name' => 'GooglePodcasts.png', + ], + [ + 'name' => 'Ivoox', + 'home_url' => 'https://www.ivoox.com/', + 'submit_url' => '', + 'iosapp_url' => + 'https://apps.apple.com/app/apple-store/id542673545', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=com.ivoox.app', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 0, + 'logo_file_name' => 'ivoox.png', + ], + [ + 'name' => 'ListenNotes', + 'home_url' => 'https://www.listennotes.com/', + 'submit_url' => 'https://www.listennotes.com/submit/', + 'iosapp_url' => '', + 'androidapp_url' => '', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 0, + 'logo_file_name' => 'ListenNotes.png', + ], //array('name' => 'Majelan', 'home_url' => 'https://www.majelan.com/', 'submit_url' => 'https://support.majelan.com/article/64-how-to-add-my-podcast-on-majelan', 'iosapp_url' => 'https://apps.apple.com/app/majelan-best-audio-stories/id1443711081', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.majelanapp', 'comment' => 'Uses public podcasts indexes. Send a DM if you are not listed.', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'Majelan.png'), // https://aide.majelan.com/article/130-pourquoi-nouvelle-application-7-juillet - array('name' => 'Mytuner', 'home_url' => 'https://mytuner-radio.com/', 'submit_url' => 'https://mytuner-radio.com/broadcasters/', 'iosapp_url' => 'https://apps.apple.com/app/apple-store/id520502858', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.appgeneration.itunerfree', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'myTuner.png'), - array('name' => 'Overcast', 'home_url' => 'https://overcast.fm/', 'submit_url' => 'https://overcast.fm/podcasterinfo', 'iosapp_url' => 'https://apps.apple.com/us/app/overcast-podcast-player/id888422857', 'androidapp_url' => '', 'comment' => 'Overcast uses Apple Podcasts index, no podcast submission needed.', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'Overcast.png'), - array('name' => 'Player.Fm', 'home_url' => 'https://player.fm/', 'submit_url' => 'https://player.fm/importer/feed', 'iosapp_url' => 'https://apps.apple.com/app/podcast-app-by-player-fm/id940568467', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=fm.player', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'PlayerFM.png'), - array('name' => 'Pocketcasts', 'home_url' => 'https://www.pocketcasts.com/', 'submit_url' => 'https://www.pocketcasts.com/submit/', 'iosapp_url' => 'https://apps.apple.com/app/pocket-casts/id414834813', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=au.com.shiftyjelly.pocketcasts', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'PocketCasts.png'), - array('name' => 'Podbean', 'home_url' => 'https://www.podbean.com/', 'submit_url' => 'https://www.podbean.com/site/submitPodcast', 'iosapp_url' => 'https://apps.apple.com/app/apple-store/id973361050', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.podbean.app.podcast', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'Podbean.png'), - array('name' => 'Podcastland', 'home_url' => 'https://podcastland.com/', 'submit_url' => '', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => 'Uses Apple Podcasts index.', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'PodcastLand.png'), - array('name' => 'Podcastrepublic', 'home_url' => 'https://www.podcastrepublic.net/', 'submit_url' => 'https://www.podcastrepublic.net/for-podcast-publisher', 'iosapp_url' => '', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.itunestoppodcastplayer.app', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'PodcastRepublic.png'), - array('name' => 'Podchaser', 'home_url' => 'https://www.podchaser.com/', 'submit_url' => 'https://www.podchaser.com/creators/edit', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'Podchaser.png'), - array('name' => 'Podtail', 'home_url' => 'https://podtail.com/', 'submit_url' => 'https://podtail.com/about/faq/', 'iosapp_url' => '', 'androidapp_url' => '', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 0, 'logo_file_name' => 'Podtail.png'), - array('name' => 'Radiopublic', 'home_url' => 'https://radiopublic.com/', 'submit_url' => 'https://podcasters.radiopublic.com/signup', 'iosapp_url' => 'https://apps.apple.com/app/radiopublic-free-podcasts/id1113752736', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.radiopublic.android', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'RadioPublic.png'), - array('name' => 'Spotify', 'home_url' => 'https://www.spotify.com/', 'submit_url' => 'https://podcasters.spotify.com/submit', 'iosapp_url' => 'https://apps.apple.com/app/spotify-music/id324684580', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.spotify.music', 'comment' => '', 'display_by_default' => 1, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'Spotify.png'), - array('name' => 'Spreaker', 'home_url' => 'https://www.spreaker.com/', 'submit_url' => 'https://www.spreaker.com/cms/shows/rss-import', 'iosapp_url' => 'https://apps.apple.com/app/spreaker-podcast-radio/id388449677', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.spreaker.android', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'Spreaker.png'), - array('name' => 'Stitcher', 'home_url' => 'https://www.stitcher.com/', 'submit_url' => 'https://www.stitcher.com/content-providers', 'iosapp_url' => 'https://apps.apple.com/app/id288087905', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=com.stitcher.app', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 1, 'logo_file_name' => 'Stitcher.png'), - array('name' => 'TuneIn', 'home_url' => 'https://tunein.com/', 'submit_url' => 'https://help.tunein.com/contact/add-podcast-S19TR3Sdf', 'iosapp_url' => 'https://apps.apple.com/app/tunein-radio/id418987775', 'androidapp_url' => 'https://play.google.com/store/apps/details?id=tunein.player', 'comment' => '', 'display_by_default' => 0, 'ios_deeplink' => 0, 'android_deeplink' => 2, 'logo_file_name' => 'TuneIn.png'), - ); + [ + 'name' => 'Mytuner', + 'home_url' => 'https://mytuner-radio.com/', + 'submit_url' => 'https://mytuner-radio.com/broadcasters/', + 'iosapp_url' => + 'https://apps.apple.com/app/apple-store/id520502858', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=com.appgeneration.itunerfree', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 1, + 'logo_file_name' => 'myTuner.png', + ], + [ + 'name' => 'Overcast', + 'home_url' => 'https://overcast.fm/', + 'submit_url' => 'https://overcast.fm/podcasterinfo', + 'iosapp_url' => + 'https://apps.apple.com/us/app/overcast-podcast-player/id888422857', + 'androidapp_url' => '', + 'comment' => + 'Overcast uses Apple Podcasts index, no podcast submission needed.', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 1, + 'logo_file_name' => 'Overcast.png', + ], + [ + 'name' => 'Player.Fm', + 'home_url' => 'https://player.fm/', + 'submit_url' => 'https://player.fm/importer/feed', + 'iosapp_url' => + 'https://apps.apple.com/app/podcast-app-by-player-fm/id940568467', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=fm.player', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 1, + 'logo_file_name' => 'PlayerFM.png', + ], + [ + 'name' => 'Pocketcasts', + 'home_url' => 'https://www.pocketcasts.com/', + 'submit_url' => 'https://www.pocketcasts.com/submit/', + 'iosapp_url' => + 'https://apps.apple.com/app/pocket-casts/id414834813', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=au.com.shiftyjelly.pocketcasts', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 0, + 'logo_file_name' => 'PocketCasts.png', + ], + [ + 'name' => 'Podbean', + 'home_url' => 'https://www.podbean.com/', + 'submit_url' => 'https://www.podbean.com/site/submitPodcast', + 'iosapp_url' => + 'https://apps.apple.com/app/apple-store/id973361050', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=com.podbean.app.podcast', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 2, + 'logo_file_name' => 'Podbean.png', + ], + [ + 'name' => 'Podcastland', + 'home_url' => 'https://podcastland.com/', + 'submit_url' => '', + 'iosapp_url' => '', + 'androidapp_url' => '', + 'comment' => 'Uses Apple Podcasts index.', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 0, + 'logo_file_name' => 'PodcastLand.png', + ], + [ + 'name' => 'Podcastrepublic', + 'home_url' => 'https://www.podcastrepublic.net/', + 'submit_url' => + 'https://www.podcastrepublic.net/for-podcast-publisher', + 'iosapp_url' => '', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=com.itunestoppodcastplayer.app', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 1, + 'logo_file_name' => 'PodcastRepublic.png', + ], + [ + 'name' => 'Podchaser', + 'home_url' => 'https://www.podchaser.com/', + 'submit_url' => 'https://www.podchaser.com/creators/edit', + 'iosapp_url' => '', + 'androidapp_url' => '', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 0, + 'logo_file_name' => 'Podchaser.png', + ], + [ + 'name' => 'Podtail', + 'home_url' => 'https://podtail.com/', + 'submit_url' => 'https://podtail.com/about/faq/', + 'iosapp_url' => '', + 'androidapp_url' => '', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 0, + 'logo_file_name' => 'Podtail.png', + ], + [ + 'name' => 'Radiopublic', + 'home_url' => 'https://radiopublic.com/', + 'submit_url' => 'https://podcasters.radiopublic.com/signup', + 'iosapp_url' => + 'https://apps.apple.com/app/radiopublic-free-podcasts/id1113752736', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=com.radiopublic.android', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 1, + 'logo_file_name' => 'RadioPublic.png', + ], + [ + 'name' => 'Spotify', + 'home_url' => 'https://www.spotify.com/', + 'submit_url' => 'https://podcasters.spotify.com/submit', + 'iosapp_url' => + 'https://apps.apple.com/app/spotify-music/id324684580', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=com.spotify.music', + 'comment' => '', + 'display_by_default' => 1, + 'ios_deeplink' => 0, + 'android_deeplink' => 2, + 'logo_file_name' => 'Spotify.png', + ], + [ + 'name' => 'Spreaker', + 'home_url' => 'https://www.spreaker.com/', + 'submit_url' => 'https://www.spreaker.com/cms/shows/rss-import', + 'iosapp_url' => + 'https://apps.apple.com/app/spreaker-podcast-radio/id388449677', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=com.spreaker.android', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 1, + 'logo_file_name' => 'Spreaker.png', + ], + [ + 'name' => 'Stitcher', + 'home_url' => 'https://www.stitcher.com/', + 'submit_url' => 'https://www.stitcher.com/content-providers', + 'iosapp_url' => 'https://apps.apple.com/app/id288087905', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=com.stitcher.app', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 1, + 'logo_file_name' => 'Stitcher.png', + ], + [ + 'name' => 'TuneIn', + 'home_url' => 'https://tunein.com/', + 'submit_url' => + 'https://help.tunein.com/contact/add-podcast-S19TR3Sdf', + 'iosapp_url' => + 'https://apps.apple.com/app/tunein-radio/id418987775', + 'androidapp_url' => + 'https://play.google.com/store/apps/details?id=tunein.player', + 'comment' => '', + 'display_by_default' => 0, + 'ios_deeplink' => 0, + 'android_deeplink' => 2, + 'logo_file_name' => 'TuneIn.png', + ], + ]; $this->db->table('platforms')->insertBatch($data); } } diff --git a/app/Entities/Category.php b/app/Entities/Category.php index 6ef0bd3262..d15e52d839 100644 --- a/app/Entities/Category.php +++ b/app/Entities/Category.php @@ -1,4 +1,9 @@ <?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Entities; diff --git a/app/Entities/Episode.php b/app/Entities/Episode.php index 3c8ec0c423..1593da5e43 100644 --- a/app/Entities/Episode.php +++ b/app/Entities/Episode.php @@ -1,4 +1,9 @@ <?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Entities; diff --git a/app/Entities/Language.php b/app/Entities/Language.php index dbe7270099..f2b91440d8 100644 --- a/app/Entities/Language.php +++ b/app/Entities/Language.php @@ -1,4 +1,9 @@ <?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Entities; @@ -8,6 +13,6 @@ class Language extends Entity { protected $casts = [ 'code' => 'string', - 'native_name' => 'string' + 'native_name' => 'string', ]; } diff --git a/app/Entities/Podcast.php b/app/Entities/Podcast.php index 4e9c757f4d..28034b9fd2 100644 --- a/app/Entities/Podcast.php +++ b/app/Entities/Podcast.php @@ -1,4 +1,9 @@ <?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Entities; diff --git a/app/Helpers/database_helper.php b/app/Helpers/database_helper.php new file mode 100644 index 0000000000..bd0e07bfb8 --- /dev/null +++ b/app/Helpers/database_helper.php @@ -0,0 +1,33 @@ +<?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ + +/** + * Get all possible enum values for a table field + * + * @param string $table + * @param string $field + * + * @return array $enums + */ +function field_enums($table = '', $field = '') +{ + $enums = []; + if ($table == '' || $field == '') { + return $enums; + } + $db = \Config\Database::connect(); + preg_match_all( + "/'(.*?)'/", + $db->query("SHOW COLUMNS FROM {$table} LIKE '{$field}'")->getRow() + ->Type, + $matches + ); + foreach ($matches[1] as $value) { + $enums[$value] = $value; + } + return $enums; +} diff --git a/app/Helpers/file_helper.php b/app/Helpers/file_helper.php new file mode 100644 index 0000000000..6b9e313354 --- /dev/null +++ b/app/Helpers/file_helper.php @@ -0,0 +1,53 @@ +<?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ + +use JamesHeinrich\GetID3\GetID3; + +/** + * Saves a file to the corresponding podcast folder in `public/media` + * + * @param UploadedFile $file + * @param string $podcast_name + * @param string $file_name + * + * @return string The absolute path of the file + */ +function save_podcast_media($file, $podcast_name, $file_name) +{ + $image_storage_folder = 'media/' . $podcast_name . '/'; + + // overwrite file if already existing + $file->move($image_storage_folder, $file_name, true); + + return $image_storage_folder . $file_name; +} + +/** + * Gets audio file metadata and ID3 info + * + * @param UploadedFile $file + * + * @return array + */ +function get_file_metadata($file) +{ + if (!$file->isValid()) { + throw new RuntimeException( + $file->getErrorString() . '(' . $file->getError() . ')' + ); + } + + $getID3 = new GetID3(); + $FileInfo = $getID3->analyze($file); + + return [ + 'cover_picture' => $FileInfo['comments']['picture'][0]['data'], + 'filesize' => $FileInfo['filesize'], + 'mime_type' => $FileInfo['mime_type'], + 'playtime_seconds' => $FileInfo['playtime_seconds'], + ]; +} diff --git a/app/Helpers/misc_helper.php b/app/Helpers/misc_helper.php new file mode 100644 index 0000000000..804e5a4976 --- /dev/null +++ b/app/Helpers/misc_helper.php @@ -0,0 +1,23 @@ +<?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ + +/** + * Gets the browser default language using the request header key `HTTP_ACCEPT_LANGUAGE` + * + * @param mixed $http_accept_language + * + * @return string|null ISO 639-1 language code or null + */ +function get_browser_language($http_accept_language) +{ + $langs = explode(',', $http_accept_language); + if (!empty($langs)) { + return substr($langs[0], 0, 2); + } + + return null; +} diff --git a/app/Language/en/Episodes.php b/app/Language/en/Episodes.php new file mode 100644 index 0000000000..319b1f8d0f --- /dev/null +++ b/app/Language/en/Episodes.php @@ -0,0 +1,24 @@ +<? + +return [ + 'create' => 'Add an episode', + 'form' => [ + 'file' => 'Audio file', + 'title' => 'Title', + 'slug' => 'Slug', + 'description' => 'Description', + 'pub_date' => 'Publication date', + 'image' => 'Image', + 'explicit' => 'Explicit', + 'type' => [ + 'label' => 'Type', + 'full' => 'Full', + 'trailer' => 'Trailer', + 'bonus' => 'Bonus', + ], + 'episode_number' => 'Episode number', + 'season_number' => 'Season number', + 'block' => 'Block', + 'submit' => 'Create episode', + ] +]; \ No newline at end of file diff --git a/app/Language/en/Home.php b/app/Language/en/Home.php index 00a631c7f7..3cb0366cb8 100644 --- a/app/Language/en/Home.php +++ b/app/Language/en/Home.php @@ -1,6 +1,6 @@ <? return [ - "all_podcasts" => "All podcasts", - "no_podcast" => "No podcast found" -]; \ No newline at end of file + 'all_podcasts' => 'All podcasts', + 'no_podcast' => 'No podcast found', +]; diff --git a/app/Language/en/Podcasts.php b/app/Language/en/Podcasts.php index 01024efd7d..af04529337 100644 --- a/app/Language/en/Podcasts.php +++ b/app/Language/en/Podcasts.php @@ -1,8 +1,8 @@ <? return [ - "create" => "Create a Podcast", - "form" => [ + 'create' => 'Create a Podcast', + 'form' => [ 'title' => 'Title', 'name' => 'Name', 'description' => 'Description', @@ -138,4 +138,6 @@ return [ 'film_reviews' => 'Film Reviews', 'tv_reviews' => 'TV Reviews', ], + 'list_of_episodes' => 'List of episodes', + 'no_episode' => 'No episode found' ]; \ No newline at end of file diff --git a/app/Models/CategoryModel.php b/app/Models/CategoryModel.php index 9cc753e177..1013920c8e 100644 --- a/app/Models/CategoryModel.php +++ b/app/Models/CategoryModel.php @@ -1,4 +1,9 @@ <?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Models; @@ -9,9 +14,7 @@ class CategoryModel extends Model protected $table = 'categories'; protected $primaryKey = 'id'; - protected $allowedFields = [ - 'apple_category', 'google_category', - ]; + protected $allowedFields = ['apple_category', 'google_category']; protected $returnType = 'App\Entities\Category'; protected $useSoftDeletes = false; diff --git a/app/Models/EpisodeModel.php b/app/Models/EpisodeModel.php index e0c1c4d87c..22c9b4dc8c 100644 --- a/app/Models/EpisodeModel.php +++ b/app/Models/EpisodeModel.php @@ -1,4 +1,9 @@ <?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Models; @@ -10,8 +15,9 @@ class EpisodeModel extends Model protected $primaryKey = 'id'; protected $allowedFields = [ - 'slug', + 'podcast_id', 'title', + 'slug', 'enclosure_url', 'enclosure_length', 'enclosure_type', diff --git a/app/Models/LanguageModel.php b/app/Models/LanguageModel.php index a6c25392dd..98143567a1 100644 --- a/app/Models/LanguageModel.php +++ b/app/Models/LanguageModel.php @@ -1,4 +1,9 @@ <?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Models; @@ -9,9 +14,7 @@ class LanguageModel extends Model protected $table = 'languages'; protected $primaryKey = 'id'; - protected $allowedFields = [ - 'code', 'native_name' - ]; + protected $allowedFields = ['code', 'native_name']; protected $returnType = 'App\Entities\Language'; protected $useSoftDeletes = false; diff --git a/app/Models/PlatformLinkModel.php b/app/Models/PlatformLinkModel.php index 8642a2df88..a8fb1a1fc8 100644 --- a/app/Models/PlatformLinkModel.php +++ b/app/Models/PlatformLinkModel.php @@ -2,7 +2,7 @@ /** * Class PlatformLinkModel * Model for platform links table in database - * @author Benjamin Bellamy <ben@podlibre.org> + * * @copyright 2020 Podlibre * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @link https://castopod.org/ @@ -28,4 +28,4 @@ class PlatformLinkModel extends Model protected $useSoftDeletes = false; protected $useTimestamps = true; -} \ No newline at end of file +} diff --git a/app/Models/PlatformModel.php b/app/Models/PlatformModel.php index 58765cd642..782bf0ff3c 100644 --- a/app/Models/PlatformModel.php +++ b/app/Models/PlatformModel.php @@ -2,7 +2,7 @@ /** * Class PlatformModel * Model for platforms table in database - * @author Benjamin Bellamy <ben@podlibre.org> + * * @copyright 2020 Podlibre * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 * @link https://castopod.org/ @@ -33,4 +33,4 @@ class PlatformModel extends Model protected $useSoftDeletes = false; protected $useTimestamps = true; -} \ No newline at end of file +} diff --git a/app/Models/PodcastModel.php b/app/Models/PodcastModel.php index 01bcb80485..3fe1c70c2b 100644 --- a/app/Models/PodcastModel.php +++ b/app/Models/PodcastModel.php @@ -1,4 +1,9 @@ <?php +/** + * @copyright 2020 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ namespace App\Models; @@ -10,6 +15,7 @@ class PodcastModel extends Model protected $primaryKey = 'id'; protected $allowedFields = [ + 'id', 'title', 'name', 'description', diff --git a/app/ThirdParty/.gitkeep b/app/ThirdParty/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/app/Views/episodes/create.php b/app/Views/episodes/create.php new file mode 100644 index 0000000000..4015d28c89 --- /dev/null +++ b/app/Views/episodes/create.php @@ -0,0 +1,92 @@ +<?= $this->extend('layouts/default') ?> + +<?= $this->section('content') ?> + +<h1 class="mb-6 text-xl"><?= lang('Episodes.create') ?></h1> + +<div class="mb-8"> + <?= \Config\Services::validation()->listErrors() ?> +</div> + +<?= form_open_multipart(route_to('episodes_create', '@' . $podcast->name), [ + 'method' => 'post', + 'class' => 'flex flex-col max-w-md', +]) ?> +<?= csrf_field() ?> + +<div class="flex flex-col mb-4"> + <label for="episode_file"><?= lang('Episodes.form.file') ?></label> + <input type="file" class="form-input" id="episode_file" name="episode_file" required accept=".mp3,.m4a" /> +</div> + +<div class="flex flex-col mb-4"> + <label for="title"><?= lang('Episodes.form.title') ?></label> + <input type="text" class="form-input" id="title" name="title" required /> +</div> + +<div class="flex flex-col mb-4"> + <label for="slug"><?= lang('Episodes.form.slug') ?></label> + <input type="text" class="form-input" id="slug" name="slug" required /> +</div> + +<div class="flex flex-col mb-4"> + <label for="description"><?= lang('Episodes.form.description') ?></label> + <textarea class="form-textarea" id="description" name="description" required></textarea> +</div> + +<div class="flex flex-col mb-4"> + <label for="pub_date"><?= lang('Episodes.form.pub_date') ?></label> + <input type="date" class="form-input" id="pub_date" name="pub_date" value="<?= date( + 'Y-m-d' + ) ?>" /> +</div> + +<div class="flex flex-col mb-4"> + <label for="image"><?= lang('Episodes.form.image') ?></label> + <input type="file" class="form-input" id="image" name="image" accept=".jpg,.jpeg,.png" /> +</div> + +<div class="flex flex-col mb-4"> + <label for="episode_number"><?= lang( + 'Episodes.form.episode_number' + ) ?></label> + <input type="number" class="form-input" id="episode_number" name="episode_number" + <?= $podcast->type == 'serial' ? 'required' : '' ?> /> +</div> + +<div class="flex flex-col mb-4"> + <label for="season_number"><?= lang( + 'Episodes.form.season_number' + ) ?></label> + <input type="number" class="form-input" id="season_number" name="season_number" /> +</div> + +<div class="inline-flex items-center mb-4"> + <input type="checkbox" id="explicit" name="explicit" class="form-checkbox" /> + <label for="explicit" class="pl-2"><?= lang( + 'Episodes.form.explicit' + ) ?></label> +</div> + +<fieldset class="flex flex-col mb-4"> + <legend><?= lang('Episodes.form.type.label') ?></legend> + <?php foreach ($episode_types as $type): ?> + <label for="<?= $type ?>" class="inline-flex items-center"> + <input type="radio" class="form-radio" value="<?= $type ?>" id="<?= $type ?>" name="type" required /> + <span class="ml-2"><?= lang('Episodes.form.type.' . $type) ?></span> + </label> + <?php endforeach; ?> +</fieldset> + +<div class="inline-flex items-center mb-4"> + <input type="checkbox" id="block" name="block" class="form-checkbox" /> + <label for="block" class="pl-2"><?= lang('Episodes.form.block') ?></label> +</div> + +<button type="submit" name="submit" class="self-end px-4 py-2 bg-gray-200"><?= lang( + 'Episodes.form.submit' +) ?></button> +<?= form_close() ?> + + +<?= $this->endSection() ?> diff --git a/app/Views/episodes/view.php b/app/Views/episodes/view.php new file mode 100644 index 0000000000..345bd29363 --- /dev/null +++ b/app/Views/episodes/view.php @@ -0,0 +1,16 @@ +<?= $this->extend('layouts/default') ?> + +<?= $this->section('content') ?> + +<h1 class="text-xl"><?= $episode->title ?></h1> +<img src="<?= base_url( + $episode->image ? $episode->image : $podcast->image +) ?>" alt="Episode cover" class="object-cover w-40 h-40 mb-6" /> +<audio controls> + <source src="<?= base_url( + $episode->enclosure_url + ) ?>" type="<?= $episode->enclosure_type ?>"> + Your browser does not support the audio tag. +</audio> + +<?= $this->endSection() ?> diff --git a/app/Views/home.php b/app/Views/home.php index 1b7b2393fd..a0587247da 100644 --- a/app/Views/home.php +++ b/app/Views/home.php @@ -2,21 +2,23 @@ <?= $this->section('content') ?> -<h1 class="mb-2 text-xl"><?= lang("Home.all_podcasts") ?> (<?= count($podcasts) ?>)</h1> +<h1 class="mb-2 text-xl"><?= lang('Home.all_podcasts') ?> (<?= count( + $podcasts + ) ?>)</h1> <section class="flex flex-wrap"> - <?php if ($podcasts) : ?> - <?php foreach ($podcasts as $podcast) : ?> - <a href="/@<?= $podcast->name ?>"> + <?php if ($podcasts): ?> + <?php foreach ($podcasts as $podcast): ?> + <a href="<?= route_to('podcasts_view', '@' . $podcast->name) ?>"> <article class="w-48 p-2 mb-4 mr-4 border shadow-sm hover:bg-gray-100 hover:shadow"> <img alt="<?= $podcast->title ?>" src="<?= $podcast->image ?>" class="object-cover w-full h-40 mb-2" /> <h2 class="font-semibold leading-tight"><?= $podcast->title ?></h2> <p class="text-gray-600">@<?= $podcast->name ?></p> </article> </a> - <?php endforeach ?> - <?php else : ?> - <p class="italic"><?= lang("Home.no_podcast") ?></p> - <?php endif ?> + <?php endforeach; ?> + <?php else: ?> + <p class="italic"><?= lang('Home.no_podcast') ?></p> + <?php endif; ?> </section> -<?= $this->endSection() ?> \ No newline at end of file +<?= $this->endSection() ?> diff --git a/app/Views/layouts/default.php b/app/Views/layouts/default.php index e2b3bb9c1d..f0c27589b4 100644 --- a/app/Views/layouts/default.php +++ b/app/Views/layouts/default.php @@ -13,9 +13,11 @@ <body class="flex flex-col min-h-screen mx-auto"> <header class="border-b"> <div class="container flex items-center justify-between px-2 py-4 mx-auto"> - <a href="/" class="text-2xl">Castopod</a> + <a href="<?= route_to('home') ?>" class="text-2xl">Castopod</a> <nav> - <a class="px-4 py-2 border hover:bg-gray-100" href="/podcasts/create">New podcast</a> + <a class="px-4 py-2 border hover:bg-gray-100" href="<?= route_to( + 'podcasts_create' + ) ?>">New podcast</a> </nav> </div> </header> @@ -23,6 +25,6 @@ <?= $this->renderSection('content') ?> </main> <footer class="container px-2 py-4 mx-auto text-sm text-right border-t"> - Powered by <a class="underline hover:no-underline" href="https://code.podlibre.org/podlibre/castopod">Castopod</a>, a <a class="underline hover:no-underline" href="https://podlibre.org/">Podlibre</a> initiative. + Powered by <a class="underline hover:no-underline" href="https://castopod.org">Castopod</a>, a <a class="underline hover:no-underline" href="https://podlibre.org/">Podlibre</a> initiative. </footer> </body> \ No newline at end of file diff --git a/app/Views/podcasts/create.php b/app/Views/podcasts/create.php index b0e8aa3734..69fd68974f 100644 --- a/app/Views/podcasts/create.php +++ b/app/Views/podcasts/create.php @@ -2,109 +2,127 @@ <?= $this->section('content') ?> -<h1 class="mb-6 text-xl"><?= lang("Podcasts.create") ?></h1> +<h1 class="mb-6 text-xl"><?= lang('Podcasts.create') ?></h1> -<!-- <div class="mb-8"> - \Config\Services::validation()->listErrors() -</div> --> +<div class="mb-8"> + <?= \Config\Services::validation()->listErrors() ?> +</div> -<?= form_open_multipart('podcasts/create', ["method" => "post", "class" => "flex flex-col max-w-md"]) ?> +<?= form_open_multipart(base_url(route_to('podcasts_create')), [ + 'method' => 'post', + 'class' => 'flex flex-col max-w-md', +]) ?> <?= csrf_field() ?> <div class="flex flex-col mb-4"> - <label for="title"><?= lang("Podcasts.form.title") ?></label> + <label for="title"><?= lang('Podcasts.form.title') ?></label> <input type="text" class="form-input" id="title" name="title" required /> </div> <div class="flex flex-col mb-4"> - <label for="name"><?= lang("Podcasts.form.name") ?></label> + <label for="name"><?= lang('Podcasts.form.name') ?></label> <input type="text" class="form-input" id="name" name="name" required /> </div> <div class="flex flex-col mb-4"> - <label for="description"><?= lang("Podcasts.form.description") ?></label> + <label for="description"><?= lang('Podcasts.form.description') ?></label> <textarea class="form-textarea" id="description" name="description" required></textarea> </div> <div class="flex flex-col mb-4"> - <label for="episode_description_footer"><?= lang("Podcasts.form.episode_description_footer") ?></label> + <label for="episode_description_footer"><?= lang( + 'Podcasts.form.episode_description_footer' + ) ?></label> <textarea class="form-textarea" id="episode_description_footer" name="episode_description_footer"></textarea> </div> <div class="flex flex-col mb-4"> - <label for="image"><?= lang("Podcasts.form.image") ?></label> + <label for="image"><?= lang('Podcasts.form.image') ?></label> <input type="file" class="form-input" id="image" name="image" required /> </div> <div class="flex flex-col mb-4"> - <label for="language"><?= lang("Podcasts.form.language") ?></label> + <label for="language"><?= lang('Podcasts.form.language') ?></label> <select id="language" name="language" autocomplete="off" class="form-select" required> - <?php foreach ($languages as $language) : ?> - <option <?= ($language->code == $browser_lang) ? "selected='selected'" : "" ?> value="<?= $language->code ?>"><?= $language->native_name ?></option> - <?php endforeach ?> + <?php foreach ($languages as $language): ?> + <option <?= $language->code == $browser_lang + ? "selected='selected'" + : '' ?> value="<?= $language->code ?>"><?= $language->native_name ?></option> + <?php endforeach; ?> </select> </div> <div class="flex flex-col mb-4"> - <label for="category"><?= lang("Podcasts.form.category") ?></label> + <label for="category"><?= lang('Podcasts.form.category') ?></label> <select id="category" name="category" class="form-select" required> - <?php foreach ($categories as $category) : ?> - <option value="<?= $category->code ?>"><?= lang("Podcasts.category_options." . $category->code) ?></option> - <?php endforeach ?> + <?php foreach ($categories as $category): ?> + <option value="<?= $category->code ?>"><?= lang( + 'Podcasts.category_options.' . $category->code +) ?></option> + <?php endforeach; ?> </select> </div> <div class="inline-flex items-center mb-4"> <input type="checkbox" id="explicit" name="explicit" class="form-checkbox" /> - <label for="explicit" class="pl-2"><?= lang("Podcasts.form.explicit") ?></label> + <label for="explicit" class="pl-2"><?= lang( + 'Podcasts.form.explicit' + ) ?></label> </div> <div class="flex flex-col mb-4"> - <label for="author"><?= lang("Podcasts.form.author") ?></label> + <label for="author"><?= lang('Podcasts.form.author') ?></label> <input type="text" class="form-input" id="author" name="author" /> </div> <div class="flex flex-col mb-4"> - <label for="owner_name"><?= lang("Podcasts.form.owner_name") ?></label> + <label for="owner_name"><?= lang('Podcasts.form.owner_name') ?></label> <input type="text" class="form-input" id="owner_name" name="owner_name" /> </div> <div class="flex flex-col mb-4"> - <label for="owner_email"><?= lang("Podcasts.form.owner_email") ?></label> + <label for="owner_email"><?= lang('Podcasts.form.owner_email') ?></label> <input type="email" class="form-input" id="owner_email" name="owner_email" required /> </div> -<fieldset class="mb-4"> - <legend><?= lang("Podcasts.form.type.label") ?></legend> - <input type="radio" class="form-radio" value="episodic" id="episodic" name="type" checked="checked" /> - <label for="episodic"><?= lang("Podcasts.form.type.episodic") ?></label><br /> - - <input type="radio" class="form-radio" value="serial" id="serial" name="type" /> - <label for="serial"><?= lang("Podcasts.form.type.serial") ?></label><br /> +<fieldset class="flex flex-col mb-4"> + <legend><?= lang('Podcasts.form.type.label') ?></legend> + <?php foreach ($podcast_types as $type): ?> + <label for="<?= $type ?>" class="inline-flex items-center"> + <input type="radio" class="form-radio" value="<?= $type ?>" id="<?= $type ?>" name="type" required /> + <span class="ml-2"><?= lang('Podcasts.form.type.' . $type) ?></span> + </label> + <?php endforeach; ?> </fieldset> <div class="flex flex-col mb-4"> - <label for="copyright"><?= lang("Podcasts.form.copyright") ?></label> + <label for="copyright"><?= lang('Podcasts.form.copyright') ?></label> <input type="text" class="form-input" id="copyright" name="copyright" /> </div> <div class="inline-flex items-center mb-4"> <input type="checkbox" id="block" name="block" class="form-checkbox" /> - <label for="block" class="pl-2"><?= lang("Podcasts.form.block") ?></label> + <label for="block" class="pl-2"><?= lang('Podcasts.form.block') ?></label> </div> <div class="inline-flex items-center mb-4"> <input type="checkbox" id="complete" name="complete" class="form-checkbox" /> - <label for="complete" class="pl-2"><?= lang("Podcasts.form.complete") ?></label> + <label for="complete" class="pl-2"><?= lang( + 'Podcasts.form.complete' + ) ?></label> </div> <div class="flex flex-col mb-4"> - <label for="custom_html_head"><?= esc(lang("Podcasts.form.custom_html_head")) ?></label> + <label for="custom_html_head"><?= esc( + lang('Podcasts.form.custom_html_head') + ) ?></label> <textarea class="form-textarea" id="custom_html_head" name="custom_html_head"></textarea> </div> -<button type="submit" name="submit" class="self-end px-4 py-2 bg-gray-200"><?= lang("Podcasts.form.submit") ?></button> +<button type="submit" name="submit" class="self-end px-4 py-2 bg-gray-200"><?= lang( + 'Podcasts.form.submit' +) ?></button> <?= form_close() ?> -<?= $this->endSection() ?> \ No newline at end of file +<?= $this->endSection() ?> diff --git a/app/Views/podcasts/view.php b/app/Views/podcasts/view.php index a567ee790e..ae35991cee 100644 --- a/app/Views/podcasts/view.php +++ b/app/Views/podcasts/view.php @@ -1,7 +1,46 @@ <?= $this->extend('layouts/default') ?> <?= $this->section('content') ?> -<h1 class="text-xl"><?= $podcast->title ?></h1> -<img src="<?= base_url($podcast->image) ?>" alt="Podcast cover" /> +<header class="py-4 border-b"> + <h1 class="text-2xl"><?= $podcast->title ?></h1> + <img src="<?= base_url( + $podcast->image + ) ?>" alt="Podcast cover" class="w-40 h-40 mb-6" /> +<a class="inline-flex px-4 py-2 border hover:bg-gray-100" href="<?= route_to( + 'episodes_create', + '@' . $podcast->name +) ?>">New Episode</a> +</header> -<?= $this->endSection() ?> \ No newline at end of file +<section class="flex flex-col py-4"> + <h2 class="mb-4 text-xl"><?= lang( + 'Podcasts.list_of_episodes' + ) ?> (<?= count($episodes) ?>)</h2> + <?php if ($episodes): ?> + <?php foreach ($episodes as $episode): ?> + <article class="flex w-full max-w-lg p-4 mb-4 border shadow"> + <img src="<?= base_url( + $episode->image ? $episode->image : $podcast->image + ) ?>" alt="<?= $episode->title ?>" class="w-32 h-32 mr-4" /> + <div class="flex flex-col flex-1"> + <a href="<?= route_to( + 'episodes_view', + '@' . $podcast->name, + $episode->slug + ) ?>"> + <h3 class="text-xl font-semibold underline hover:no-underline"><?= $episode->title ?></h3> + </a> + <audio controls class="mt-auto"> + <source src="<?= $episode->enclosure_url ?>" type="<?= $episode->enclosure_type ?>"> + Your browser does not support the audio tag. + </audio> + </div> + </article> + <?php endforeach; ?> + <?php else: ?> + <p class="italic"><?= lang('Podcasts.no_episode') ?></p> + <?php endif; ?> +</section> + + +<?= $this->endSection() ?> diff --git a/app/index.html b/app/index.html index a1379e04d4..5caba05a87 100644 --- a/app/index.html +++ b/app/index.html @@ -1,14 +1,10 @@ <!DOCTYPE html> <html> - -<head> - <title>403 Forbidden</title> -</head> - -<body> - - <p>Directory access is forbidden.</p> - -</body> - -</html> \ No newline at end of file + <head> + <title>403 Forbidden</title> + </head> + + <body> + <p>Directory access is forbidden.</p> + </body> +</html> diff --git a/builds b/builds index 268e7a819c..08b02e16e5 100644 --- a/builds +++ b/builds @@ -1,6 +1,5 @@ #!/usr/bin/env php <?php - define('LATEST_RELEASE', '^4.0'); define('GITHUB_URL', 'https://github.com/codeigniter4/codeigniter4'); @@ -15,10 +14,9 @@ define('GITHUB_URL', 'https://github.com/codeigniter4/codeigniter4'); */ // Determine the requested stability -if (empty($argv[1]) || ! in_array($argv[1], ['release', 'development'])) -{ - echo 'Usage: php builds [release|development]' . PHP_EOL; - exit; +if (empty($argv[1]) || !in_array($argv[1], ['release', 'development'])) { + echo 'Usage: php builds [release|development]' . PHP_EOL; + exit(); } $dev = $argv[1] == 'development'; @@ -29,135 +27,127 @@ $modified = []; // Composer.json $file = __DIR__ . DIRECTORY_SEPARATOR . 'composer.json'; -if (is_file($file)) -{ - // Make sure we can read it - if ($contents = file_get_contents($file)) - { - if ($array = json_decode($contents, true)) - { - // Development - if ($dev) - { - // Set 'minimum-stability' - $array['minimum-stability'] = 'dev'; - $array['prefer-stable'] = true; - - // Make sure the repo is configured - if (! isset($array['repositories'])) - { - $array['repositories'] = []; - } - - // Check for the CodeIgniter repo - $found = false; - foreach ($array['repositories'] as $repository) - { - if ($repository['url'] == GITHUB_URL) - { - $found = true; - break; - } - } - - // Add the repo if it was not found - if (! $found) - { - $array['repositories'][] = [ - 'type' => 'vcs', - 'url' => GITHUB_URL, - ]; - } - - // Define the "require" - $array['require']['codeigniter4/codeigniter4'] = 'dev-develop'; - unset($array['require']['codeigniter4/framework']); - } - - // Release - else - { - // Clear 'minimum-stability' - unset($array['minimum-stability']); - - // If the repo is configured then clear it - if (isset($array['repositories'])) - { - // Check for the CodeIgniter repo - foreach ($array['repositories'] as $i => $repository) - { - if ($repository['url'] == GITHUB_URL) - { - unset($array['repositories'][$i]); - break; - } - } - if (empty($array['repositories'])) - { - unset($array['repositories']); - } - } - - // Define the "require" - $array['require']['codeigniter4/framework'] = LATEST_RELEASE; - unset($array['require']['codeigniter4/codeigniter4']); - } - - // Write out a new composer.json - file_put_contents($file, json_encode($array, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES) . PHP_EOL); - $modified[] = $file; - } - else - { - echo 'Warning: Unable to decode composer.json! Skipping...' . PHP_EOL; - } - } - else - { - echo 'Warning: Unable to read composer.json! Skipping...' . PHP_EOL; - } +if (is_file($file)) { + // Make sure we can read it + if ($contents = file_get_contents($file)) { + if ($array = json_decode($contents, true)) { + // Development + if ($dev) { + // Set 'minimum-stability' + $array['minimum-stability'] = 'dev'; + $array['prefer-stable'] = true; + + // Make sure the repo is configured + if (!isset($array['repositories'])) { + $array['repositories'] = []; + } + + // Check for the CodeIgniter repo + $found = false; + foreach ($array['repositories'] as $repository) { + if ($repository['url'] == GITHUB_URL) { + $found = true; + break; + } + } + + // Add the repo if it was not found + if (!$found) { + $array['repositories'][] = [ + 'type' => 'vcs', + 'url' => GITHUB_URL, + ]; + } + + // Define the "require" + $array['require']['codeigniter4/codeigniter4'] = 'dev-develop'; + unset($array['require']['codeigniter4/framework']); + } + + // Release + else { + // Clear 'minimum-stability' + unset($array['minimum-stability']); + + // If the repo is configured then clear it + if (isset($array['repositories'])) { + // Check for the CodeIgniter repo + foreach ($array['repositories'] as $i => $repository) { + if ($repository['url'] == GITHUB_URL) { + unset($array['repositories'][$i]); + break; + } + } + if (empty($array['repositories'])) { + unset($array['repositories']); + } + } + + // Define the "require" + $array['require']['codeigniter4/framework'] = LATEST_RELEASE; + unset($array['require']['codeigniter4/codeigniter4']); + } + + // Write out a new composer.json + file_put_contents( + $file, + json_encode( + $array, + JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES + ) . PHP_EOL + ); + $modified[] = $file; + } else { + echo 'Warning: Unable to decode composer.json! Skipping...' . + PHP_EOL; + } + } else { + echo 'Warning: Unable to read composer.json! Skipping...' . PHP_EOL; + } } // Paths config and PHPUnit XMLs $files = [ - __DIR__ . DIRECTORY_SEPARATOR . 'app/Config/Paths.php', - __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml.dist', - __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml', + __DIR__ . DIRECTORY_SEPARATOR . 'app/Config/Paths.php', + __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml.dist', + __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml', ]; -foreach ($files as $file) -{ - if (is_file($file)) - { - $contents = file_get_contents($file); - - // Development - if ($dev) - { - $contents = str_replace('vendor/codeigniter4/framework', 'vendor/codeigniter4/codeigniter4', $contents); - } - - // Release - else - { - $contents = str_replace('vendor/codeigniter4/codeigniter4', 'vendor/codeigniter4/framework', $contents); - } - - file_put_contents($file, $contents); - $modified[] = $file; - } +foreach ($files as $file) { + if (is_file($file)) { + $contents = file_get_contents($file); + + // Development + if ($dev) { + $contents = str_replace( + 'vendor/codeigniter4/framework', + 'vendor/codeigniter4/codeigniter4', + $contents + ); + } + + // Release + else { + $contents = str_replace( + 'vendor/codeigniter4/codeigniter4', + 'vendor/codeigniter4/framework', + $contents + ); + } + + file_put_contents($file, $contents); + $modified[] = $file; + } } -if (empty($modified)) -{ - echo 'No files modified' . PHP_EOL; -} -else -{ - echo 'The following files were modified:' . PHP_EOL; - foreach ($modified as $file) - { - echo " * {$file}" . PHP_EOL; - } - echo 'Run `composer update` to sync changes with your vendor folder' . PHP_EOL; +if (empty($modified)) { + echo 'No files modified' . PHP_EOL; +} else { + echo 'The following files were modified:' . PHP_EOL; + foreach ($modified as $file) { + echo " * {$file}" . PHP_EOL; + } + echo 'Run `composer update` to sync changes with your vendor folder' . + PHP_EOL; } + diff --git a/commitlint.config.js b/commitlint.config.js index 4fedde6daf..5073c20db1 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1 +1 @@ -module.exports = { extends: ['@commitlint/config-conventional'] } +module.exports = { extends: ["@commitlint/config-conventional"] }; diff --git a/composer.json b/composer.json index 8c683a3345..fd9651f445 100644 --- a/composer.json +++ b/composer.json @@ -1,31 +1,32 @@ { - "name": "codeigniter4/appstarter", - "type": "project", - "description": "CodeIgniter4 starter app", - "homepage": "https://codeigniter.com", - "license": "MIT", - "require": { - "php": ">=7.2", - "codeigniter4/framework": "^4" - }, - "require-dev": { - "mikey179/vfsstream": "1.6.*", - "phpunit/phpunit": "8.5.*" - }, - "autoload-dev": { - "psr-4": { - "Tests\\Support\\": "tests/_support" - } - }, - "scripts": { - "test": "phpunit", - "post-update-cmd": [ - "@composer dump-autoload" - ] - }, - "support": { - "forum": "http://forum.codeigniter.com/", - "source": "https://github.com/codeigniter4/CodeIgniter4", - "slack": "https://codeigniterchat.slack.com" - } + "name": "podlibre/castopod", + "type": "project", + "description": "Castopod is an open-source hosting platform made for podcasters who want engage and interact with their audience.", + "homepage": "https://castopod.org", + "license": "AGPL-3.0-or-later", + "require": { + "php": ">=7.2", + "codeigniter4/framework": "^4", + "james-heinrich/getid3": "~2.0.0-dev" + }, + "require-dev": { + "mikey179/vfsstream": "1.6.*", + "phpunit/phpunit": "8.5.*" + }, + "autoload-dev": { + "psr-4": { + "Tests\\Support\\": "tests/_support" + } + }, + "scripts": { + "test": "phpunit", + "post-update-cmd": [ + "@composer dump-autoload" + ] + }, + "support": { + "forum": "http://forum.codeigniter.com/", + "source": "https://github.com/codeigniter4/CodeIgniter4", + "slack": "https://codeigniterchat.slack.com" + } } diff --git a/composer.lock b/composer.lock index 94be36a0b0..58dd0941ac 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8c49469ea6df972381be63807c7e127d", + "content-hash": "a524161e65f809ee6dcfd5f842f4031c", "packages": [ { "name": "codeigniter4/framework", @@ -50,6 +50,87 @@ "homepage": "https://codeigniter.com", "time": "2020-05-01T05:01:20+00:00" }, + { + "name": "james-heinrich/getid3", + "version": "2.0.x-dev", + "source": { + "type": "git", + "url": "https://github.com/JamesHeinrich/getID3.git", + "reference": "8cf765ec4c42ed732993a9aa60b638ee398df154" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JamesHeinrich/getID3/zipball/8cf765ec4c42ed732993a9aa60b638ee398df154", + "reference": "8cf765ec4c42ed732993a9aa60b638ee398df154", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "^0.9 || ^1.0", + "phpunit/phpunit": "^4.8|^5.0" + }, + "suggest": { + "ext-SimpleXML": "SimpleXML extension is required to analyze RIFF/WAV/BWF audio files (also requires `ext-libxml`).", + "ext-com_dotnet": "COM extension is required when loading files larger than 2GB on Windows.", + "ext-ctype": "ctype extension is required when loading files larger than 2GB on 32-bit PHP (also on 64-bit PHP on Windows) or executing `getid3_lib::CopyTagsToComments`.", + "ext-dba": "DBA extension is required to use the DBA database as a cache storage.", + "ext-exif": "EXIF extension is required for graphic modules.", + "ext-iconv": "iconv extension is required to work with different character sets (when `ext-mbstring` is not available).", + "ext-json": "JSON extension is required to analyze Apple Quicktime videos.", + "ext-libxml": "libxml extension is required to analyze RIFF/WAV/BWF audio files.", + "ext-mbstring": "mbstring extension is required to work with different character sets.", + "ext-mysql": "MySQL extension is required to use the MySQL database as a cache storage (deprecated in PHP 5.5, removed in PHP >= 7.0, use `ext-mysqli` instead).", + "ext-mysqli": "MySQLi extension is required to use the MySQL database as a cache storage.", + "ext-rar": "RAR extension is required for RAR archive module.", + "ext-sqlite3": "SQLite3 extension is required to use the SQLite3 database as a cache storage.", + "ext-xml": "XML extension is required for graphic modules to analyze the XML metadata.", + "ext-zlib": "Zlib extension is required for archive modules and compressed metadata." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JamesHeinrich\\GetID3\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-1.0-or-later", + "LGPL-3.0-only", + "MPL-2.0" + ], + "authors": [ + { + "name": "James Heinrich", + "email": "info@getid3.org", + "homepage": "https://github.com/JamesHeinrich", + "role": "Developer" + }, + { + "name": "Craig Duncan", + "email": "git@duncanc.co.uk", + "homepage": "https://github.com/duncan3dc", + "role": "Developer" + } + ], + "description": "Extract and write useful information to/from popular multimedia file formats", + "homepage": "https://www.getid3.org/", + "keywords": [ + "audio", + "codecs", + "id3", + "metadata", + "tags", + "video" + ], + "time": "2019-07-22T12:33:16+00:00" + }, { "name": "kint-php/kint", "version": "3.3", @@ -1876,7 +1957,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "james-heinrich/getid3": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/package-lock.json b/package-lock.json index e06203fa5f..d67b0a1a99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -410,6 +410,17 @@ "fastq": "^1.6.0" } }, + "@prettier/plugin-php": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/@prettier/plugin-php/-/plugin-php-0.14.2.tgz", + "integrity": "sha512-sG713Vb/eKtlB4rsL1+7mDD85jC2cjop8z/LE2QZHBtbopemfa4okEha01fgCqMaLJ80NBwGP9SZIwY9MR/w6w==", + "dev": true, + "requires": { + "linguist-languages": "^7.5.1", + "mem": "^6.0.1", + "php-parser": "github:glayzzle/php-parser#5a0e2e1bf12517bd1c544c0f4e68482d0362a7b5" + } + }, "@tailwindcss/custom-forms": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/@tailwindcss/custom-forms/-/custom-forms-0.2.1.tgz", @@ -478,6 +489,22 @@ "integrity": "sha512-wdlPY2tm/9XBr7QkKlq0WQVgiuGTX6YWPyRyBviSoScBuLfTVQhvwg6wJ369GJ/1nPfTLMfnrFIfjqVg6d+jQQ==", "dev": true }, + "aggregate-error": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", + "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ansi-colors": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", + "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", + "dev": true + }, "ansi-escapes": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", @@ -572,6 +599,12 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, "at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", @@ -987,6 +1020,12 @@ } } }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, "cli-cursor": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", @@ -996,6 +1035,50 @@ "restore-cursor": "^2.0.0" } }, + "cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "requires": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, "cli-width": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", @@ -1259,6 +1342,28 @@ "parse-json": "^4.0.0" } }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "dependencies": { + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "css-unit-converter": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.2.tgz", @@ -1465,6 +1570,24 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "enquirer": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.5.tgz", + "integrity": "sha512-BNT1C08P9XD0vNg3J475yIUG+mVdp9T6towYFHUv897X0KoHBjB1shyrNmhmtHWKP17iSWgo7Gqh7BBuzLZMSA==", + "dev": true, + "requires": { + "ansi-colors": "^3.2.1" + } + }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1494,6 +1617,40 @@ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "execa": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.0.2.tgz", + "integrity": "sha512-QI2zLa6CjGWdiQsmSkZoGtDx2N+cQIGb3yNolGTdjSQzydzLgYYf8LRuagp7S7fPimjcrzUDSUFd/MgzELMi4Q==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + }, + "dependencies": { + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + } + } + }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -1827,12 +1984,27 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, + "get-own-enumerable-property-symbols": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz", + "integrity": "sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==", + "dev": true + }, "get-stdin": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", "dev": true }, + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -2010,6 +2182,12 @@ "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", "dev": true }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "dev": true + }, "husky": { "version": "4.2.5", "resolved": "https://registry.npmjs.org/husky/-/husky-4.2.5.tgz", @@ -2336,6 +2514,18 @@ "isobject": "^3.0.1" } }, + "is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=", + "dev": true + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, "is-text-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", @@ -2424,6 +2614,172 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", "dev": true }, + "linguist-languages": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/linguist-languages/-/linguist-languages-7.9.0.tgz", + "integrity": "sha512-saKTpS7BH8vOOwzrZNTkFL/DuT2JN7cg6oHWY8nAjt89+pV1qFcpbjEEcZdAv9ogc4DcxVFHkXmjeyU/DiFHQw==", + "dev": true + }, + "lint-staged": { + "version": "10.2.9", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.2.9.tgz", + "integrity": "sha512-ziRAuXEqvJLSXg43ezBpHxRW8FOJCXISaXU//BWrxRrp5cBdRkIx7g5IsB3OI45xYGE0S6cOacfekSjDyDKF2g==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "cli-truncate": "2.1.0", + "commander": "^5.1.0", + "cosmiconfig": "^6.0.0", + "debug": "^4.1.1", + "dedent": "^0.7.0", + "enquirer": "^2.3.5", + "execa": "^4.0.1", + "listr2": "^2.1.0", + "log-symbols": "^4.0.0", + "micromatch": "^4.0.2", + "normalize-path": "^3.0.0", + "please-upgrade-node": "^3.2.0", + "string-argv": "0.3.1", + "stringify-object": "^3.3.0" + }, + "dependencies": { + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "dev": true, + "requires": { + "chalk": "^4.0.0" + } + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "parse-json": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz", + "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1", + "lines-and-columns": "^1.1.6" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, + "listr2": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-2.1.3.tgz", + "integrity": "sha512-6oy3QhrZAlJGrG8oPcRp1hix1zUpb5AvyvZ5je979HCyf48tIj3Hn1TG5+rfyhz30t7HfySH/OIaVbwrI2kruA==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "cli-truncate": "^2.1.0", + "figures": "^3.2.0", + "indent-string": "^4.0.0", + "log-update": "^4.0.0", + "p-map": "^4.0.0", + "rxjs": "^6.5.5", + "through": "^2.3.8" + }, + "dependencies": { + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + } + } + }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -2524,6 +2880,111 @@ } } }, + "log-update": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dev": true, + "requires": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", + "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "dev": true, + "requires": { + "type-fest": "^0.11.0" + } + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + }, + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true + } + } + }, "longest": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-2.0.1.tgz", @@ -2540,6 +3001,15 @@ "signal-exit": "^3.0.0" } }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "dev": true, + "requires": { + "p-defer": "^1.0.0" + } + }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -2561,6 +3031,24 @@ "object-visit": "^1.0.0" } }, + "mem": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-6.1.0.tgz", + "integrity": "sha512-RlbnLQgRHk5lwqTtpEkBTQ2ll/CG/iB+J4Hy2Wh97PjgZgXgWJWrFF+XXujh3UUVLvR4OOTgZzcWMMwnehlEUg==", + "dev": true, + "requires": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^3.0.0" + }, + "dependencies": { + "mimic-fn": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-3.0.0.tgz", + "integrity": "sha512-PiVO95TKvhiwgSwg1IdLYlCTdul38yZxZMIcnDSFIBUm4BNZha2qpQ4GpJ++15bHoKDtrW2D69lMfFwdFYtNZQ==", + "dev": true + } + } + }, "meow": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz", @@ -2753,6 +3241,12 @@ "integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==", "dev": true }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -2946,6 +3440,15 @@ "integrity": "sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==", "dev": true }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, "num2fraction": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", @@ -3037,6 +3540,12 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "dev": true + }, "p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -3055,6 +3564,15 @@ "p-limit": "^2.2.0" } }, + "p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -3112,6 +3630,12 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", @@ -3124,6 +3648,11 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, + "php-parser": { + "version": "github:glayzzle/php-parser#5a0e2e1bf12517bd1c544c0f4e68482d0362a7b5", + "from": "github:glayzzle/php-parser#5a0e2e1bf12517bd1c544c0f4e68482d0362a7b5", + "dev": true + }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -3491,6 +4020,12 @@ "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==", "dev": true }, + "prettier": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "dev": true + }, "pretty-hrtime": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", @@ -3503,6 +4038,16 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "purgecss": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-2.2.1.tgz", @@ -3889,6 +4434,21 @@ } } }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -3910,6 +4470,50 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + } + } + }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -4131,6 +4735,12 @@ } } }, + "string-argv": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", + "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", + "dev": true + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -4161,6 +4771,17 @@ "safe-buffer": "~5.1.0" } }, + "stringify-object": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz", + "integrity": "sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==", + "dev": true, + "requires": { + "get-own-enumerable-property-symbols": "^3.0.0", + "is-obj": "^1.0.1", + "is-regexp": "^1.0.0" + } + }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -4184,6 +4805,12 @@ "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", "dev": true }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, "strip-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", diff --git a/package.json b/package.json index 799bb76430..54011307a9 100644 --- a/package.json +++ b/package.json @@ -16,20 +16,27 @@ "devDependencies": { "@commitlint/cli": "^8.3.5", "@commitlint/config-conventional": "^8.3.4", + "@prettier/plugin-php": "^0.14.2", "@tailwindcss/custom-forms": "^0.2.1", "cz-conventional-changelog": "^3.2.0", "husky": "^4.2.5", + "lint-staged": "^10.2.9", "postcss-cli": "^7.1.1", + "prettier": "2.0.5", "tailwindcss": "^1.4.6" }, "husky": { "hooks": { - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS", + "pre-commit": "lint-staged" } }, + "lint-staged": { + "*.{js,css,md,php}": "prettier --write" + }, "config": { "commitizen": { "path": "cz-conventional-changelog" } } -} \ No newline at end of file +} diff --git a/postcss.config.js b/postcss.config.js index 4ffa3beb3f..116848f66a 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,6 +1,3 @@ module.exports = { - plugins: [ - require('tailwindcss'), - require('autoprefixer'), - ] -} + plugins: [require("tailwindcss"), require("autoprefixer")], +}; diff --git a/public/index.php b/public/index.php index 3eaa592a1a..9e1f9d1a44 100644 --- a/public/index.php +++ b/public/index.php @@ -2,9 +2,11 @@ // Valid PHP Version? $minPHPVersion = '7.2'; -if (phpversion() < $minPHPVersion) -{ - die("Your PHP version must be {$minPHPVersion} or higher to run CodeIgniter. Current version: " . phpversion()); +if (phpversion() < $minPHPVersion) { + die( + "Your PHP version must be {$minPHPVersion} or higher to run CodeIgniter. Current version: " . + phpversion() + ); } unset($minPHPVersion); diff --git a/spark b/spark index 396ad59c48..a02ea6e43e 100644 --- a/spark +++ b/spark @@ -1,6 +1,5 @@ #!/usr/bin/env php <?php - /* * -------------------------------------------------------------------- * CodeIgniter command-line tools @@ -24,9 +23,10 @@ define('SPARKED', true); */ // Refuse to run when called from php-cgi -if (substr(php_sapi_name(), 0, 3) === 'cgi') -{ - die("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n"); +if (substr(php_sapi_name(), 0, 3) === 'cgi') { + die( + "The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n" + ); } // Path to the front controller @@ -55,7 +55,7 @@ $console->showHeader(); // fire off the command in the main framework. $response = $console->run(); -if ($response->getStatusCode() >= 300) -{ - exit($response->getStatusCode()); +if ($response->getStatusCode() >= 300) { + exit($response->getStatusCode()); } + diff --git a/tailwind.config.js b/tailwind.config.js index 5dfa337560..12964786ae 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -4,5 +4,5 @@ module.exports = { extend: {}, }, variants: {}, - plugins: [require('@tailwindcss/custom-forms')], -} + plugins: [require("@tailwindcss/custom-forms")], +}; -- GitLab