├── .github
├── FUNDING.yml
├── dependabot.yml
├── issue_template.md
├── pull_request_template.md
└── workflows
│ ├── deploy.yml
│ └── trunk.yml
├── .gitignore
├── .wordpress-org
├── banner-772x250.jpg
├── banner.psd
└── icon.svg
├── LICENSE.txt
├── README.md
├── admin
├── class-jwt-auth-admin.php
├── class-jwt-auth-cron.php
└── ui
│ ├── .nvmrc
│ ├── build
│ ├── index.asset.php
│ ├── index.css
│ └── index.js
│ ├── package.json
│ ├── src
│ ├── components
│ │ ├── cta.js
│ │ ├── main-view.js
│ │ ├── newsletter.js
│ │ └── settings-screen.js
│ ├── index.js
│ └── index.scss
│ └── yarn.lock
├── composer.json
├── composer.lock
├── includes
├── class-jwt-auth-i18n.php
├── class-jwt-auth-loader.php
├── class-jwt-auth.php
├── class-jwt-namespace-wrapper.php
├── index.php
└── vendor
│ ├── autoload.php
│ ├── composer
│ ├── ClassLoader.php
│ ├── InstalledVersions.php
│ ├── LICENSE
│ ├── autoload_classmap.php
│ ├── autoload_namespaces.php
│ ├── autoload_psr4.php
│ ├── autoload_real.php
│ ├── autoload_static.php
│ ├── installed.json
│ ├── installed.php
│ ├── installers
│ │ ├── .github
│ │ │ └── workflows
│ │ │ │ ├── continuous-integration.yml
│ │ │ │ ├── lint.yml
│ │ │ │ └── phpstan.yml
│ │ ├── LICENSE
│ │ ├── composer.json
│ │ ├── phpstan.neon.dist
│ │ └── src
│ │ │ ├── Composer
│ │ │ └── Installers
│ │ │ │ ├── AglInstaller.php
│ │ │ │ ├── AimeosInstaller.php
│ │ │ │ ├── AnnotateCmsInstaller.php
│ │ │ │ ├── AsgardInstaller.php
│ │ │ │ ├── AttogramInstaller.php
│ │ │ │ ├── BaseInstaller.php
│ │ │ │ ├── BitrixInstaller.php
│ │ │ │ ├── BonefishInstaller.php
│ │ │ │ ├── CakePHPInstaller.php
│ │ │ │ ├── ChefInstaller.php
│ │ │ │ ├── CiviCrmInstaller.php
│ │ │ │ ├── ClanCatsFrameworkInstaller.php
│ │ │ │ ├── CockpitInstaller.php
│ │ │ │ ├── CodeIgniterInstaller.php
│ │ │ │ ├── Concrete5Installer.php
│ │ │ │ ├── CraftInstaller.php
│ │ │ │ ├── CroogoInstaller.php
│ │ │ │ ├── DecibelInstaller.php
│ │ │ │ ├── DframeInstaller.php
│ │ │ │ ├── DokuWikiInstaller.php
│ │ │ │ ├── DolibarrInstaller.php
│ │ │ │ ├── DrupalInstaller.php
│ │ │ │ ├── ElggInstaller.php
│ │ │ │ ├── EliasisInstaller.php
│ │ │ │ ├── ExpressionEngineInstaller.php
│ │ │ │ ├── EzPlatformInstaller.php
│ │ │ │ ├── FuelInstaller.php
│ │ │ │ ├── FuelphpInstaller.php
│ │ │ │ ├── GravInstaller.php
│ │ │ │ ├── HuradInstaller.php
│ │ │ │ ├── ImageCMSInstaller.php
│ │ │ │ ├── Installer.php
│ │ │ │ ├── ItopInstaller.php
│ │ │ │ ├── JoomlaInstaller.php
│ │ │ │ ├── KanboardInstaller.php
│ │ │ │ ├── KirbyInstaller.php
│ │ │ │ ├── KnownInstaller.php
│ │ │ │ ├── KodiCMSInstaller.php
│ │ │ │ ├── KohanaInstaller.php
│ │ │ │ ├── LanManagementSystemInstaller.php
│ │ │ │ ├── LaravelInstaller.php
│ │ │ │ ├── LavaLiteInstaller.php
│ │ │ │ ├── LithiumInstaller.php
│ │ │ │ ├── MODULEWorkInstaller.php
│ │ │ │ ├── MODXEvoInstaller.php
│ │ │ │ ├── MagentoInstaller.php
│ │ │ │ ├── MajimaInstaller.php
│ │ │ │ ├── MakoInstaller.php
│ │ │ │ ├── MantisBTInstaller.php
│ │ │ │ ├── MauticInstaller.php
│ │ │ │ ├── MayaInstaller.php
│ │ │ │ ├── MediaWikiInstaller.php
│ │ │ │ ├── MiaoxingInstaller.php
│ │ │ │ ├── MicroweberInstaller.php
│ │ │ │ ├── ModxInstaller.php
│ │ │ │ ├── MoodleInstaller.php
│ │ │ │ ├── OctoberInstaller.php
│ │ │ │ ├── OntoWikiInstaller.php
│ │ │ │ ├── OsclassInstaller.php
│ │ │ │ ├── OxidInstaller.php
│ │ │ │ ├── PPIInstaller.php
│ │ │ │ ├── PantheonInstaller.php
│ │ │ │ ├── PhiftyInstaller.php
│ │ │ │ ├── PhpBBInstaller.php
│ │ │ │ ├── PimcoreInstaller.php
│ │ │ │ ├── PiwikInstaller.php
│ │ │ │ ├── PlentymarketsInstaller.php
│ │ │ │ ├── Plugin.php
│ │ │ │ ├── PortoInstaller.php
│ │ │ │ ├── PrestashopInstaller.php
│ │ │ │ ├── ProcessWireInstaller.php
│ │ │ │ ├── PuppetInstaller.php
│ │ │ │ ├── PxcmsInstaller.php
│ │ │ │ ├── RadPHPInstaller.php
│ │ │ │ ├── ReIndexInstaller.php
│ │ │ │ ├── Redaxo5Installer.php
│ │ │ │ ├── RedaxoInstaller.php
│ │ │ │ ├── RoundcubeInstaller.php
│ │ │ │ ├── SMFInstaller.php
│ │ │ │ ├── ShopwareInstaller.php
│ │ │ │ ├── SilverStripeInstaller.php
│ │ │ │ ├── SiteDirectInstaller.php
│ │ │ │ ├── StarbugInstaller.php
│ │ │ │ ├── SyDESInstaller.php
│ │ │ │ ├── SyliusInstaller.php
│ │ │ │ ├── Symfony1Installer.php
│ │ │ │ ├── TYPO3CmsInstaller.php
│ │ │ │ ├── TYPO3FlowInstaller.php
│ │ │ │ ├── TaoInstaller.php
│ │ │ │ ├── TastyIgniterInstaller.php
│ │ │ │ ├── TheliaInstaller.php
│ │ │ │ ├── TuskInstaller.php
│ │ │ │ ├── UserFrostingInstaller.php
│ │ │ │ ├── VanillaInstaller.php
│ │ │ │ ├── VgmcpInstaller.php
│ │ │ │ ├── WHMCSInstaller.php
│ │ │ │ ├── WinterInstaller.php
│ │ │ │ ├── WolfCMSInstaller.php
│ │ │ │ ├── WordPressInstaller.php
│ │ │ │ ├── YawikInstaller.php
│ │ │ │ ├── ZendInstaller.php
│ │ │ │ └── ZikulaInstaller.php
│ │ │ └── bootstrap.php
│ └── platform_check.php
│ └── firebase
│ └── php-jwt
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ ├── composer.json
│ └── src
│ ├── BeforeValidException.php
│ ├── CachedKeySet.php
│ ├── ExpiredException.php
│ ├── JWK.php
│ ├── JWT.php
│ ├── Key.php
│ └── SignatureInvalidException.php
├── index.php
├── jwt-auth.php
├── languages
└── jwt-auth.pot
├── public
├── class-jwt-auth-public.php
└── index.php
└── readme.txt
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: tmeister
4 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "composer"
9 | directory: "/"
10 | schedule:
11 | interval: "weekly"
12 |
--------------------------------------------------------------------------------
/.github/issue_template.md:
--------------------------------------------------------------------------------
1 | # Issue Name
2 | ## Prerequisites
3 |
4 | Please answer the following questions for yourself before submitting an issue.
5 |
6 | - [ ] I am running the latest plugin version
7 | - [ ] I am running the latest WordPress version
8 | - [ ] I know what PHP version I'm using
9 | - [ ] I checked the documentation and found no answer
10 | - [ ] I checked to make sure that this issue has not already been filed
11 |
12 | ## Context
13 |
14 | Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
15 |
16 | * WordPress version
17 | * PHP Version
18 | * Plugin A name and version
19 | * Plugin B name and version
20 |
21 | ## Expected Behavior
22 |
23 | Please describe the behavior you are expecting.
24 |
25 | ## Current Behavior
26 |
27 | What is the current behavior?
28 |
29 | ## Failure Information (for bugs)
30 |
31 | Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
32 |
33 | ### Steps to Reproduce
34 |
35 | Please provide detailed steps for reproducing the issue.
36 |
37 | 1. Step 1
38 | 2. Step 2
39 | 3. You get it...
40 |
41 | ### Failure Logs
42 |
43 | Please include any relevant log snippets or files here.
44 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | # Description
2 |
3 | Please include a summary of the change or changes and which issue is fixed. Please also include relevant motivation and context.
4 |
5 | Fixes #(issue)
6 |
7 | ## Type of change
8 |
9 | - [ ] Bug fix (non-breaking change which fixes an issue)
10 | - [ ] New feature (non-breaking change which adds functionality)
11 | - [ ] Breaking change (fix or feature that would cause existing functionality not to work as expected)
12 | - [ ] This change requires a documentation update
13 |
14 | # How has this been tested?
15 |
16 | Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and if you use specific plugins.
17 |
18 | - [ ] Describe test A
19 | - [ ] Describe test B
20 |
21 | **Test Configuration**:
22 | * WordPress version
23 | * PHP version
24 | * Plugin name and version
25 | * Plugin B name and version
26 |
27 | # Checklist:
28 |
29 | - [ ] My code follows the style guidelines of this project (WordPress code standards)
30 | - [ ] I have performed a self-review of my own code
31 | - [ ] I have commented on my code, particularly in hard-to-understand areas
32 | - [ ] I have made corresponding changes to the documentation (if needed)
33 | - [ ] My changes generate no new warnings
34 | - [ ] I have described how I made my tests that prove my fix is effective or that my feature works
35 |
--------------------------------------------------------------------------------
/.github/workflows/deploy.yml:
--------------------------------------------------------------------------------
1 | name: Deploy to WordPress.org
2 | on:
3 | push:
4 | tags:
5 | - "*"
6 | jobs:
7 | tag:
8 | name: New tag
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Install Subversion
12 | run: sudo apt-get update && sudo apt-get install -y subversion
13 | - name: WordPress Plugin Deploy
14 | uses: actions/checkout@master
15 | - name: WordPress Plugin Deploy
16 | uses: 10up/action-wordpress-plugin-deploy@stable
17 | env:
18 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
19 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
20 | SLUG: jwt-authentication-for-wp-rest-api
21 |
--------------------------------------------------------------------------------
/.github/workflows/trunk.yml:
--------------------------------------------------------------------------------
1 | name: Plugin asset/readme update
2 | on:
3 | push:
4 | branches:
5 | - trunk
6 | jobs:
7 | trunk:
8 | name: Push to trunk
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Install Subversion
12 | run: sudo apt-get update && sudo apt-get install -y subversion
13 | - name: Checkout code
14 | uses: actions/checkout@master
15 | - name: WordPress.org plugin asset/readme update
16 | uses: 10up/action-wordpress-plugin-asset-update@stable
17 | env:
18 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
19 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
20 | SLUG: jwt-authentication-for-wp-rest-api
21 | IGNORE_OTHER_FILES: true
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | .DS_Store
3 | includes/vendor/bin
4 | includes/vendor/dealerdirect
5 | includes/vendor/squizlabs
6 | includes/vendor/wp-coding-standards
7 | admin/ui/node_modules
8 |
--------------------------------------------------------------------------------
/.wordpress-org/banner-772x250.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tmeister/wp-api-jwt-auth/53330942cfda81dbcd13e283d7b162241fd72973/.wordpress-org/banner-772x250.jpg
--------------------------------------------------------------------------------
/.wordpress-org/banner.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tmeister/wp-api-jwt-auth/53330942cfda81dbcd13e283d7b162241fd72973/.wordpress-org/banner.psd
--------------------------------------------------------------------------------
/.wordpress-org/icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | icon
5 | Created with Sketch.
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/admin/class-jwt-auth-admin.php:
--------------------------------------------------------------------------------
1 |
9 | * @since 1.3.4
10 | */
11 | class Jwt_Auth_Admin {
12 | /**
13 | * The ID of this plugin.
14 | *
15 | * @since 1.3.4
16 | *
17 | * @var string The ID of this plugin.
18 | */
19 | private string $plugin_name;
20 |
21 | /**
22 | * The version of this plugin.
23 | *
24 | * @since 1.3.4
25 | *
26 | * @var string The current version of this plugin.
27 | */
28 | private string $version;
29 |
30 | /**
31 | * Initialize the class and set its properties.
32 | *
33 | * @param string $plugin_name The name of the plugin.
34 | * @param string $version The version of this plugin.
35 | *
36 | * @since 1.3.4
37 | */
38 | public function __construct( string $plugin_name, string $version ) {
39 | $this->plugin_name = $plugin_name;
40 | $this->version = $version;
41 | }
42 |
43 | /**
44 | * Register a new settings page under Settings main menu
45 | * .
46 | * @return void
47 | * @since 1.3.4
48 | */
49 | public function register_menu_page() {
50 | add_submenu_page(
51 | 'options-general.php',
52 | __( 'JWT Authentication', 'jwt-auth' ),
53 | __( 'JWT Authentication', 'jwt-auth' ),
54 | 'manage_options',
55 | 'jwt_authentication',
56 | [ $this, 'render_admin_page' ]
57 | );
58 |
59 | // Add Upgrade to PRO submenu item
60 | $base_pro_url = 'https://jwtauth.pro';
61 | $utm_params = [
62 | 'utm_source' => 'wpadmin',
63 | 'utm_medium' => 'submenu',
64 | 'utm_campaign' => 'pro-submenu-link',
65 | 'utm_content' => 'upgrade-to-pro',
66 | ];
67 | $pro_link_url = add_query_arg($utm_params, $base_pro_url);
68 |
69 | add_submenu_page(
70 | 'options-general.php',
71 | __('Upgrade to PRO', 'jwt-auth'),
72 | '' . __(' ↳ Upgrade to PRO', 'jwt-auth') . ' ',
73 | 'manage_options',
74 | esc_url($pro_link_url),
75 | null // No callback function needed for external link
76 | );
77 | }
78 |
79 | /**
80 | * Shows an admin notice on the admin dashboard to notify the new settings page.
81 | * This is only shown once and the message is dismissed.
82 | *
83 | * @return void
84 | * @since 1.3.4
85 | */
86 | public function display_admin_notice() {
87 | if (! get_option('jwt_auth_pro_notice_01')) {
88 | ?>
89 |
100 | plugin_name . '-settings',
135 | plugins_url( 'ui/build/index.js', __FILE__ ),
136 | $asset['dependencies'],
137 | $asset['version'],
138 | [
139 | 'in_footer' => true,
140 | ]
141 | );
142 |
143 | // Enqueue the style file for the Gutenberg components
144 | foreach ( $asset['dependencies'] as $style ) {
145 | wp_enqueue_style( $style );
146 | }
147 |
148 | // Enqueue the style file
149 | wp_enqueue_style(
150 | $this->plugin_name . '-settings',
151 | plugins_url( 'ui/build/index.css', __FILE__ ),
152 | [],
153 | $asset['version']
154 | );
155 | }
156 |
157 | /**
158 | * Register the plugin settings.
159 | *
160 | * @return void
161 | * @since 1.3.4
162 | */
163 | public function register_plugin_settings() {
164 | register_setting( 'jwt_auth', 'jwt_auth_options', [
165 | 'type' => 'object',
166 | 'default' => [
167 | 'share_data' => false,
168 | ],
169 | 'show_in_rest' => [
170 | 'schema' => [
171 | 'type' => 'object',
172 | 'properties' => [
173 | 'share_data' => [
174 | 'type' => 'boolean',
175 | 'default' => false,
176 | ],
177 | ],
178 | ],
179 | ]
180 | ] );
181 | }
182 |
183 | /**
184 | * Render the plugin settings page.
185 | * This is a React application that will be rendered on the admin page.
186 | *
187 | * @return void
188 | * @since 1.3.4
189 | */
190 | public function render_admin_page() {
191 | ?>
192 |
193 | [
210 | 'text' => 'Get JWT Auth Pro ',
211 | 'utm_content' => 'get-jwt-auth-pro-cta',
212 | ],
213 | 1 => [
214 | 'text' => 'Unlock Pro Features ',
215 | 'utm_content' => 'unlock-pro-features-cta',
216 | ],
217 | ];
218 |
219 | $selected_variation_key = rand(0, 1);
220 | $selected_variation = $cta_variations[$selected_variation_key];
221 |
222 | $base_pro_url = 'https://jwtauth.pro';
223 | $utm_params = [
224 | 'utm_source' => 'wpadmin',
225 | 'utm_medium' => 'plugin-link',
226 | 'utm_campaign' => 'pro-plugin-action-link',
227 | 'utm_content' => $selected_variation['utm_content'],
228 | ];
229 |
230 | $pro_link_url = add_query_arg($utm_params, $base_pro_url);
231 | $pro_link_style = 'style="color: #00a32a; font-weight: 700; text-decoration: none;" onmouseover="this.style.color=\'#008a20\';" onmouseout="this.style.color=\'#00a32a\';"';
232 |
233 | $pro_link_text = $selected_variation['text'];
234 | $links[] = '' . $pro_link_text . ' ';
235 | }
236 |
237 | return $links;
238 | }
239 | }
240 |
--------------------------------------------------------------------------------
/admin/class-jwt-auth-cron.php:
--------------------------------------------------------------------------------
1 |
7 | * @since 1.3.4
8 | */
9 | class Jwt_Auth_Cron {
10 | public static string $remote_api_url = 'https://track.wpjwt.com';
11 |
12 | /**
13 | * If the user agrees to share data, then we will send some data.
14 | *
15 | * @return void|null
16 | * @since 1.3.4
17 | */
18 | static public function collect() {
19 | // if the user doesn't agree to share data, then we don't do anything
20 | if ( ! self::allow_shared_data() ) {
21 | return null;
22 | }
23 |
24 | // get the PHP version
25 | $php_version = phpversion();
26 | // get the WP version
27 | $wp_version = get_bloginfo( 'version' );
28 | // get the list of activated plugins
29 | $active_plugins = get_option( 'active_plugins' );
30 | // get the number of activated plugins
31 | $plugins_count = count( $active_plugins );
32 | // is WooCommerce installed and activated?
33 | $woocommerce_installed = in_array( 'woocommerce/woocommerce.php', $active_plugins );
34 | // get the WooCommerce version
35 | $woocommerce_version = $woocommerce_installed ? get_option( 'woocommerce_version' ) : null;
36 | // get the site URL and hash it (we don't want to store the URL in plain text)
37 | $site_url_hash = hash( 'sha256', get_site_url() );
38 |
39 | $data = [
40 | 'php_version' => $php_version,
41 | 'wp_version' => $wp_version,
42 | 'plugins_count' => $plugins_count,
43 | 'woocommerce_version' => $woocommerce_version
44 | ];
45 |
46 | // Wrap the request in a try/catch to avoid fatal errors
47 | // and set the timeout to 5 seconds to avoid long delays
48 | try {
49 | $api_url = self::$remote_api_url . '/api/collect';
50 | wp_remote_post( $api_url . '/' . $site_url_hash, [
51 | 'body' => $data,
52 | 'timeout' => 5,
53 | ] );
54 | } catch ( Exception $e ) {
55 | error_log( 'Error adding site to remote database' );
56 | error_log( $e->getMessage() );
57 | }
58 | }
59 |
60 | /**
61 | * If the user agrees to share data, then we will remove the site from the remote database.
62 | *
63 | * @return void|null
64 | * @since 1.3.4
65 | */
66 | static public function remove() {
67 | // First we remove the scheduled event
68 | wp_clear_scheduled_hook( 'jwt_auth_share_data' );
69 | // Then we remove the site from the remote database
70 | $site_url_hash = hash( 'sha256', get_site_url() );
71 | // Wrap the request in a try/catch to avoid fatal errors
72 | // and set the timeout to 5 seconds to avoid long delays
73 | try {
74 | $api_url = self::$remote_api_url . '/api/destroy';
75 | wp_remote_post( $api_url . '/' . $site_url_hash, [
76 | 'timeout' => 5,
77 | ] );
78 | } catch ( Exception $e ) {
79 | error_log( 'Error removing site from remote database' );
80 | error_log( $e->getMessage() );
81 | }
82 | }
83 |
84 | /**
85 | * Check if the user agrees to share data.
86 | * @return bool
87 | * @since 1.3.4
88 | */
89 | static public function allow_shared_data(): bool {
90 | $jwt_auth_options = get_option( 'jwt_auth_options' );
91 |
92 | return ( isset( $jwt_auth_options['share_data'] ) && $jwt_auth_options['share_data'] );
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/admin/ui/.nvmrc:
--------------------------------------------------------------------------------
1 | v18.16.1
2 |
--------------------------------------------------------------------------------
/admin/ui/build/index.asset.php:
--------------------------------------------------------------------------------
1 | array('wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'e890c3bfe7a39fbbc7f7');
2 |
--------------------------------------------------------------------------------
/admin/ui/build/index.css:
--------------------------------------------------------------------------------
1 | .jwt-auth-box{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 0 10px rgba(0,0,0,.1);padding:1rem;position:relative}.jwt-auth-cta-button{background:#0073aa;border:none;border-radius:4px;box-shadow:0 0 0;color:#fff;cursor:pointer;display:block;font-size:1rem;padding:1rem;text-align:center;text-decoration:none}.jwt-auth-cta-button:disabled{background:#ddd;color:#000;cursor:not-allowed}.jwt-auth-cta-button:disabled:hover{background:#ddd;color:#000}.jwt-auth-cta-button:hover{color:#fff}.jwt-auth-text-small{font-size:12px;font-weight:400}.jwt-auth-settings{gap:2rem;margin-top:2rem}.jwt-auth-settings .jwt-auth-options{width:100%}.jwt-auth-settings .jwt-auth-cta{margin-top:1rem;width:100%}.jwt-auth-settings .jwt-auth-cta .jwt-auth-cta-wrapper{display:inline-block;position:relative;width:100%}.jwt-auth-settings .jwt-auth-toggle-holder{padding:1rem 0}.jwt-auth-settings .jwt-auth-toggle-holder .jwt-auth-toggle-control{display:flex;font-weight:700;gap:1rem;margin-bottom:4px}.jwt-auth-settings .jwt-auth-newsletter{background:#353a45;color:#fff;margin-top:1rem;padding:1rem}.jwt-auth-settings .jwt-auth-newsletter h3{color:#fff}.jwt-auth-settings .jwt-auth-newsletter .jwt-auth-newsletter-form{display:flex;flex-direction:column;gap:.5rem;margin-top:1rem}.jwt-auth-settings .jwt-auth-newsletter .jwt-auth-newsletter-form input{border:1px solid #ddd;border-radius:4px;font-size:1rem;padding:.5rem}.jwt-auth-settings .jwt-auth-newsletter .jwt-auth-newsletter-form .jwt-auth-thank-you{color:#fff;font-size:1rem;margin-top:12px;text-align:center}@media screen and (min-width:1024px){.jwt-auth-settings{display:flex}.jwt-auth-settings .jwt-auth-options{width:66%}.jwt-auth-settings .jwt-auth-cta{margin-top:0;max-width:380px;width:33%}}
2 |
--------------------------------------------------------------------------------
/admin/ui/build/index.js:
--------------------------------------------------------------------------------
1 | !function(){"use strict";var e=window.wp.element,t=window.wp.i18n,a=window.wp.data,n=()=>{const{email:n}=(0,a.useSelect)((e=>{var t;return null!==(t=e("core").getEntityRecord("root","site"))&&void 0!==t?t:{}}),[]),[l,r]=(0,e.useState)(""),[o,u]=(0,e.useState)(!1),[i,s]=(0,e.useState)(!1);return(0,e.useEffect)((()=>{r(n)}),[n]),(0,e.createElement)("div",{className:"jwt-auth-newsletter-holder"},(0,e.createElement)("h3",null,(0,t.__)("Newsletter","jwt-auth")),(0,e.createElement)("p",null,(0,t.__)("Sign up for our newsletter to get the latest news and updates!","jwt-auth")),(0,e.createElement)("form",{onSubmit:async e=>{e.preventDefault(),s(!0),(await fetch("https://track.wpjwt.com/api/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:l})})).ok&&u(!0),s(!1)},className:"jwt-auth-newsletter-form"},(0,e.createElement)("input",{type:"email",required:!0,value:l,onChange:e=>{r(e.target.value)}}),(0,e.createElement)("button",{className:"jwt-auth-cta-button",type:"submit",disabled:i},i?(0,t.__)("Signing up...","jwt-auth"):(0,t.__)("Sign up","jwt-auth")),o,o&&(0,e.createElement)("span",{className:"jwt-auth-thank-you"},(0,t.__)("Thank you for subscribing","jwt-auth")," 🤘")))},l=()=>(0,e.createElement)("div",{className:"jwt-auth-cta"},(0,e.createElement)("div",{className:"jwt-auth-box"},(0,e.createElement)("h3",null,(0,t.__)("Be the First to Join the Early Beta!","jwt-auth")),(0,e.createElement)("p",null,(0,t.__)("After numerous requests from users, I've decided to create a Pro version of this plugin, offering enhanced features and greater flexibility for developers.","jwt-auth")),(0,e.createElement)("p",null,(0,t.__)("Sign up now for the Early Beta of JWT Authentication Pro! As a beta participant, you'll not only gain early access to advanced features but also enjoy exclusive discounts when the Pro version officially launches.","jwt-auth")),(0,e.createElement)("p",null,(0,t.__)("By joining the Early Beta, you'll have the opportunity to test cutting-edge features and provide valuable feedback to help improve the Pro version.","jwt-auth")),(0,e.createElement)("p",null,(0,t.__)("Take advantage of this opportunity to influence the Pro version’s development and secure exclusive discounts—sign up now!","jwt-auth")),(0,e.createElement)("div",{className:"jwt-auth-cta-wrapper"},(0,e.createElement)("a",{href:"http://jwtauth.pro?utm_source=wpadmin&utm_medium=settings&utm_campaign=early-beta",target:"_blank",className:"jwt-auth-cta-button"},(0,t.__)("Sign Up for Early Beta","jwt-auth")))),(0,e.createElement)("div",{className:"jwt-auth-box jwt-auth-newsletter"},(0,e.createElement)(n,null))),r=window.wp.coreData,o=window.wp.components,u=()=>{const[n,l]=(0,r.useEntityProp)("root","site","jwt_auth_options"),{saveEditedEntityRecord:u}=(0,a.useDispatch)("core");return(0,e.createElement)("div",{className:"jwt-auth-options"},(0,e.createElement)("div",{className:"jwt-auth-box"},(0,e.createElement)("div",null,(0,e.createElement)("div",null,(0,e.createElement)("h2",null,(0,t.__)("Help Me improve JWT Authentication for WP REST API!","jwt-auth")),(0,e.createElement)("p",null,(0,t.__)("Hello there! I'm always working to make the JWT Authentication for WP REST API plugin better for you. To do this, I'd like to understand the environment where the plugin is used. Could you share the following information with me?","jwt-auth")),(0,e.createElement)("ul",null,(0,e.createElement)("li",null,(0,e.createElement)("strong",null,(0,t.__)("- PHP Version:")),(0,t.__)("This helps me ensure compatibility and decide when it's time to phase out older versions.","jwt-auth")),(0,e.createElement)("li",null,(0,e.createElement)("strong",null,(0,t.__)("- WordPress Version:","jwt-auth")," "),(0,t.__)("Knowing this helps me optimize the plugin for the most common WordPress setups.","jwt-auth")),(0,e.createElement)("li",null,(0,e.createElement)("strong",null,(0,t.__)("- WooCommerce Version:","jwt-auth")),(0,t.__)("Knowing this helps me to understand if I need to focus more on WooCommerce compatibility.","jwt-auth")),(0,e.createElement)("li",null,(0,e.createElement)("strong",null,(0,t.__)("- Activated Plugins Count:","jwt-auth")),(0,t.__)("This helps to know the complexity of the WP installs.","jwt-auth"))),(0,e.createElement)("p",null,(0,t.__)("I promise that:","jwt-auth")),(0,e.createElement)("ol",null,(0,e.createElement)("li",null,(0,t.__)("I'll only collect the above information.","jwt-auth")),(0,e.createElement)("li",null,(0,t.__)("Your data will remain confidential and won't be shared with third parties.","jwt-auth")),(0,e.createElement)("li",null,(0,t.__)("No personal or site information is shared.","jwt-auth")),(0,e.createElement)("li",null,(0,t.__)("This feature will in no way affect your website's performance.","jwt-auth"))),(0,e.createElement)("p",null,(0,t.__)("By sharing this information, you're helping me make JWT Authentication for WP REST API even better for everyone.","jwt-auth")," "),(0,e.createElement)("p",null,(0,t.__)("Thank you for your trust and support!","jwt-auth")),(0,e.createElement)("p",null,"Enrique Chavez."),(0,e.createElement)("hr",null),n&&(0,e.createElement)("div",{className:"jwt-auth-toggle-holder"},(0,e.createElement)("div",{className:"jwt-auth-toggle-control"},(0,e.createElement)("span",null,n.share_data?(0,t.__)("You are currently sharing data.","jwt-auth"):(0,t.__)("You are not currently sharing data.","jwt-auth")),(0,e.createElement)(o.FormToggle,{checked:n.share_data,onChange:()=>(l({...n,share_data:!n.share_data}),void u("root","site"))})),(0,e.createElement)("span",{className:"jwt-auth-text-small"},(0,t.__)("Click the toggle button to change your preferences.","jwt-auth")))))))},i=()=>(0,e.createElement)("div",{className:"wrap"},(0,e.createElement)("h1",{className:"wp-heading-inline"},"JWT Authentication"),(0,e.createElement)("div",{className:"jwt-auth-settings"},(0,e.createElement)(u,null),(0,e.createElement)(l,null)));const s=document.getElementById("jwt-auth-holder");e.createRoot?(0,e.createRoot)(s).render((0,e.createElement)(i,null)):(0,e.render)((0,e.createElement)(i,null),s)}();
--------------------------------------------------------------------------------
/admin/ui/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jwt-auth-admin-ui",
3 | "version": "1.0.0",
4 | "main": "build/index.js",
5 | "license": "GPL-2.0-or-later",
6 | "author": "Enrique Chavez",
7 | "scripts": {
8 | "build": "wp-scripts build",
9 | "start": "wp-scripts start",
10 | "format": "wp-scripts format",
11 | "lint:js": "wp-scripts lint-js",
12 | "lint:js:fix": "wp-scripts lint-js --fix",
13 | "lint:css": "wp-scripts lint-css",
14 | "lint:css:fix": "wp-scripts lint-css --fix",
15 | "packages-update": "wp-scripts packages-update"
16 | },
17 | "devDependencies": {
18 | "@wordpress/scripts": "^26.12.0"
19 | },
20 | "dependencies": {
21 | "@wordpress/api-fetch": "^6.38.0",
22 | "@wordpress/components": "^25.7.0",
23 | "@wordpress/core-data": "^6.18.0",
24 | "@wordpress/data": "^9.11.0",
25 | "@wordpress/element": "^5.18.0",
26 | "@wordpress/i18n": "^4.41.0"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/admin/ui/src/components/cta.js:
--------------------------------------------------------------------------------
1 | import {__} from '@wordpress/i18n';
2 | import Newsletter from './newsletter';
3 |
4 | const CTA = () => {
5 | return (
6 |
7 |
8 |
{__(`Be the First to Join the Early Beta!`, 'jwt-auth')}
9 |
10 | {__(
11 | `After numerous requests from users, I've decided to create a Pro version of this plugin, offering enhanced features and greater flexibility for developers.`,
12 | 'jwt-auth'
13 | )}
14 |
15 |
16 | {__(
17 | `Sign up now for the Early Beta of JWT Authentication Pro! As a beta participant, you'll not only gain early access to advanced features but also enjoy exclusive discounts when the Pro version officially launches.`,
18 | 'jwt-auth'
19 | )}
20 |
21 |
22 | {__(
23 | `By joining the Early Beta, you'll have the opportunity to test cutting-edge features and provide valuable feedback to help improve the Pro version.`,
24 | 'jwt-auth'
25 | )}
26 |
27 |
28 | {__(
29 | `Take advantage of this opportunity to influence the Pro version’s development and secure exclusive discounts—sign up now!`,
30 | 'jwt-auth'
31 | )}
32 |
33 |
42 |
43 |
44 |
45 |
46 |
47 | );
48 | };
49 |
50 | export default CTA;
51 |
--------------------------------------------------------------------------------
/admin/ui/src/components/main-view.js:
--------------------------------------------------------------------------------
1 | import { useEntityProp } from '@wordpress/core-data';
2 | import { useDispatch } from '@wordpress/data';
3 | import { FormToggle } from '@wordpress/components';
4 | import { __ } from '@wordpress/i18n';
5 |
6 | const MainView = () => {
7 | // Get the plugin settings
8 | const [ settings, setSettings ] = useEntityProp(
9 | 'root',
10 | 'site',
11 | 'jwt_auth_options'
12 | );
13 | // Get the save edited entity record function
14 | const { saveEditedEntityRecord } = useDispatch( 'core' );
15 |
16 | // Handle the save settings action
17 | const saveSettings = () => {
18 | // Update the settings values
19 | setSettings( {
20 | ...settings,
21 | share_data: ! settings.share_data,
22 | } );
23 |
24 | // Save the settings
25 | saveEditedEntityRecord( 'root', 'site' );
26 | };
27 |
28 | return (
29 |
30 |
31 |
32 |
33 |
34 | { __(
35 | 'Help Me improve JWT Authentication for WP REST API!',
36 | 'jwt-auth'
37 | ) }
38 |
39 |
40 | { __(
41 | `Hello there! I'm always working to make the JWT Authentication for WP REST API plugin better for you. To do this, I'd like to understand the environment where the plugin is used. Could you share the following information with me?`,
42 | 'jwt-auth'
43 | ) }
44 |
45 |
46 |
47 | { __( `- PHP Version:` ) }
48 | { __(
49 | `This helps me ensure compatibility and decide when it's time to phase out older versions.`,
50 | 'jwt-auth'
51 | ) }
52 |
53 |
54 |
55 | { __( `- WordPress Version:`, 'jwt-auth' ) }{ ' ' }
56 |
57 | { __(
58 | `Knowing this helps me optimize the plugin for the most common WordPress setups.`,
59 | 'jwt-auth'
60 | ) }
61 |
62 |
63 |
64 | { __(
65 | `- WooCommerce Version:`,
66 | 'jwt-auth'
67 | ) }
68 |
69 | { __(
70 | `Knowing this helps me to understand if I need to focus more on WooCommerce compatibility.`,
71 | 'jwt-auth'
72 | ) }
73 |
74 |
75 |
76 | { __(
77 | `- Activated Plugins Count:`,
78 | 'jwt-auth'
79 | ) }
80 |
81 | { __(
82 | `This helps to know the complexity of the WP installs.`,
83 | 'jwt-auth'
84 | ) }
85 |
86 |
87 |
{ __( `I promise that:`, 'jwt-auth' ) }
88 |
89 |
90 | { __(
91 | `I'll only collect the above information.`,
92 | 'jwt-auth'
93 | ) }
94 |
95 |
96 | { __(
97 | `Your data will remain confidential and won't be shared with third parties.`,
98 | 'jwt-auth'
99 | ) }
100 |
101 |
102 | { __(
103 | `No personal or site information is shared.`,
104 | 'jwt-auth'
105 | ) }
106 |
107 |
108 | { __(
109 | `This feature will in no way affect your website's performance.`,
110 | 'jwt-auth'
111 | ) }
112 |
113 |
114 |
115 | { __(
116 | `By sharing this information, you're helping me make JWT Authentication for WP REST API even better for everyone.`,
117 | 'jwt-auth'
118 | ) }{ ' ' }
119 |
120 |
121 | { __(
122 | `Thank you for your trust and support!`,
123 | 'jwt-auth'
124 | ) }
125 |
126 |
Enrique Chavez.
127 |
128 | { settings && (
129 |
130 |
131 |
132 | { settings.share_data
133 | ? __(
134 | `You are currently sharing data.`,
135 | 'jwt-auth'
136 | )
137 | : __(
138 | `You are not currently sharing data.`,
139 | 'jwt-auth'
140 | ) }
141 |
142 | saveSettings() }
145 | />
146 |
147 |
148 | { __(
149 | `Click the toggle button to change your preferences.`,
150 | 'jwt-auth'
151 | ) }
152 |
153 |
154 | ) }
155 |
156 |
157 |
158 |
159 | );
160 | };
161 |
162 | export default MainView;
163 |
--------------------------------------------------------------------------------
/admin/ui/src/components/newsletter.js:
--------------------------------------------------------------------------------
1 | import { useSelect } from '@wordpress/data';
2 | import { __ } from '@wordpress/i18n';
3 | import { useEffect, useState } from '@wordpress/element';
4 |
5 | const Newsletter = () => {
6 | // Get the site admin email using the core data API
7 | const { email } = useSelect(
8 | ( select ) => select( 'core' ).getEntityRecord( 'root', 'site' ) ?? {},
9 | []
10 | );
11 | // Set the initial states
12 | const [ subscribedEmail, setSubscribedEmail ] = useState( '' );
13 | const [ subscribed, setSubscribed ] = useState( false );
14 | const [ loading, setLoading ] = useState( false );
15 |
16 | // Update the subscribed email state when the email changes
17 | useEffect( () => {
18 | setSubscribedEmail( email );
19 | }, [ email ] );
20 |
21 | // Handle the subscribe form
22 | const handleSubscribeForm = async ( e ) => {
23 | e.preventDefault();
24 | setLoading( true );
25 | const apiUrl = 'https://track.wpjwt.com/api/subscribe';
26 | const response = await fetch( apiUrl, {
27 | method: 'POST',
28 | headers: {
29 | 'Content-Type': 'application/json',
30 | },
31 | body: JSON.stringify( {
32 | email: subscribedEmail,
33 | } ),
34 | } );
35 |
36 | // If the response is ok, set the subscribed state to true
37 | if ( response.ok ) {
38 | setSubscribed( true );
39 | }
40 |
41 | // Set the loading state to false after the request is done
42 | setLoading( false );
43 | };
44 |
45 | return (
46 |
47 |
{ __( `Newsletter`, 'jwt-auth' ) }
48 |
49 | { __(
50 | `Sign up for our newsletter to get the latest news and updates!`,
51 | 'jwt-auth'
52 | ) }
53 |
54 |
82 |
83 | );
84 | };
85 |
86 | export default Newsletter;
87 |
--------------------------------------------------------------------------------
/admin/ui/src/components/settings-screen.js:
--------------------------------------------------------------------------------
1 | import CTA from './cta';
2 | import MainView from './main-view';
3 |
4 | const SettingsScreen = () => {
5 | return (
6 |
7 |
JWT Authentication
8 |
9 |
10 |
11 |
12 |
13 | );
14 | };
15 |
16 | export default SettingsScreen;
17 |
--------------------------------------------------------------------------------
/admin/ui/src/index.js:
--------------------------------------------------------------------------------
1 | import './index.scss';
2 | import { createRoot, render } from '@wordpress/element';
3 |
4 | const domElement = document.getElementById( 'jwt-auth-holder' );
5 | // Internal dependencies
6 | import SettingsScreen from './components/settings-screen';
7 |
8 | // Mounts the main component to the DOM.
9 | if ( createRoot ) {
10 | createRoot( domElement ).render( );
11 | } else {
12 | render( , domElement );
13 | }
14 |
--------------------------------------------------------------------------------
/admin/ui/src/index.scss:
--------------------------------------------------------------------------------
1 | .jwt-auth-box {
2 | border: 1px solid #ddd;
3 | border-radius: 4px;
4 | box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
5 | padding: 1rem;
6 | position: relative;
7 | background: white;
8 | }
9 |
10 | .jwt-auth-cta-button {
11 | display: block;
12 | text-align: center;
13 | padding: 1rem;
14 | border-radius: 4px;
15 | background: #0073aa;
16 | color: #fff;
17 | text-decoration: none;
18 | font-size: 1rem;
19 | border: none;
20 | box-shadow: 0 0 0;
21 | cursor: pointer;
22 |
23 | &:disabled {
24 | background: #ddd;
25 | color: black;
26 | cursor: not-allowed;
27 | &:hover {
28 | background: #ddd;
29 | color: black;
30 | }
31 | }
32 |
33 | &:hover {
34 | color: white;
35 | }
36 | }
37 |
38 | .jwt-auth-text-small {
39 | font-size: 12px;
40 | font-weight: normal;
41 | }
42 |
43 | .jwt-auth-settings {
44 | margin-top: 2rem;
45 | gap: 2rem;
46 |
47 | .jwt-auth-options {
48 | width: 100%;
49 | }
50 |
51 | .jwt-auth-cta {
52 | width: 100%;
53 | margin-top: 1rem;
54 |
55 | .jwt-auth-cta-wrapper {
56 | position: relative;
57 | display: inline-block;
58 | width: 100%;
59 |
60 |
61 | }
62 | }
63 |
64 | .jwt-auth-toggle-holder {
65 | padding: 1rem 0;
66 |
67 | .jwt-auth-toggle-control {
68 | display: flex;
69 | gap: 1rem;
70 | font-weight: bold;
71 | margin-bottom: 4px;
72 | }
73 | }
74 |
75 | .jwt-auth-newsletter {
76 | margin-top: 1rem;
77 | padding: 1rem;
78 | background: #353A45;
79 | color: white;
80 |
81 | h3 {
82 | color: white;
83 | }
84 |
85 | .jwt-auth-newsletter-form {
86 | display: flex;
87 | flex-direction: column;
88 | gap: 0.5rem;
89 | margin-top: 1rem;
90 |
91 | input {
92 | padding: 0.5rem;
93 | border-radius: 4px;
94 | border: 1px solid #ddd;
95 | font-size: 1rem;
96 | }
97 |
98 | .jwt-auth-thank-you {
99 | font-size: 1rem;
100 | margin-top: 12px;
101 | color: white;
102 | text-align: center;
103 | }
104 | }
105 | }
106 | }
107 |
108 | // media query
109 | @media screen and (min-width: 1024px) {
110 | .jwt-auth-settings {
111 | display: flex;
112 |
113 | .jwt-auth-options {
114 | width: 66%;
115 | }
116 |
117 | .jwt-auth-cta {
118 | width: 33%;
119 | max-width: 380px;
120 | margin-top: 0;
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tmeister/wp-api-jwt-auth",
3 | "description": "A simple plugin to add JSON Web Token (JWT) Authentication to WP REST API.",
4 | "homepage": "https://github.com/Tmeister/wp-api-jwt-auth/",
5 | "type": "wordpress-plugin",
6 | "license": "GPL-2.0+",
7 | "authors": [
8 | {
9 | "name": "Enrique Chavez",
10 | "homepage": "https://enriquechavez.co"
11 | }
12 | ],
13 | "support": {
14 | "issues": "https://github.com/Tmeister/wp-api-jwt-auth/issues",
15 | "source": "https://github.com/Tmeister/wp-api-jwt-auth/"
16 | },
17 | "config": {
18 | "vendor-dir": "includes/vendor",
19 | "allow-plugins": {
20 | "composer/installers": true,
21 | "dealerdirect/phpcodesniffer-composer-installer": true
22 | }
23 | },
24 | "require": {
25 | "php": ">=7.4",
26 | "composer/installers": "~1.0",
27 | "firebase/php-jwt": "^6.3"
28 | },
29 | "require-dev": {
30 | "dealerdirect/phpcodesniffer-composer-installer": "*",
31 | "squizlabs/php_codesniffer": "3.*",
32 | "wp-coding-standards/wpcs": "*"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/includes/class-jwt-auth-i18n.php:
--------------------------------------------------------------------------------
1 |
22 | */
23 | class Jwt_Auth_i18n {
24 | /**
25 | * The domain specified for this plugin.
26 | *
27 | * @since 1.0.0
28 | *
29 | * @var string The domain identifier for this plugin.
30 | */
31 | private string $domain;
32 |
33 | /**
34 | * Load the plugin text domain for translation.
35 | *
36 | * @since 1.0.0
37 | */
38 | public function load_plugin_textdomain() {
39 | load_plugin_textdomain(
40 | $this->domain,
41 | false,
42 | dirname( plugin_basename( __FILE__ ), 2 ) . '/languages/'
43 | );
44 | }
45 |
46 | /**
47 | * Set the domain equal to that of the specified domain.
48 | *
49 | * @param string $domain The domain that represents the locale of this plugin.
50 | *
51 | * @since 1.0.0
52 | *
53 | */
54 | public function set_domain( string $domain ) {
55 | $this->domain = $domain;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/includes/class-jwt-auth-loader.php:
--------------------------------------------------------------------------------
1 |
18 | */
19 | class Jwt_Auth_Loader {
20 | /**
21 | * The array of actions registered with WordPress.
22 | *
23 | * @since 1.0.0
24 | *
25 | * @var array The actions registered with WordPress to fire when the plugin loads.
26 | */
27 | protected array $actions;
28 |
29 | /**
30 | * The array of filters registered with WordPress.
31 | *
32 | * @since 1.0.0
33 | *
34 | * @var array The filters registered with WordPress to fire when the plugin loads.
35 | */
36 | protected array $filters;
37 |
38 | /**
39 | * Initialize the collections used to maintain the actions and filters.
40 | *
41 | * @since 1.0.0
42 | */
43 | public function __construct() {
44 | $this->actions = [];
45 | $this->filters = [];
46 | }
47 |
48 | /**
49 | * Add a new action to the collection to be registered with WordPress.
50 | *
51 | * @param string $hook The name of the WordPress action that is being registered.
52 | * @param object $component A reference to the instance of the object on which the action is defined.
53 | * @param string $callback The name of the function definition on the $component.
54 | * @param int $priority Optional $priority The priority at which the function should be fired.
55 | * @param int $accepted_args Optional $accepted_args The number of arguments that should be passed to the $callback.
56 | *
57 | * @since 1.0.0
58 | *
59 | */
60 | public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
61 | $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
62 | }
63 |
64 | /**
65 | * Add a new filter to the collection to be registered with WordPress.
66 | *
67 | * @param string $hook The name of the WordPress filter that is being registered.
68 | * @param object $component A reference to the instance of the object on which the filter is defined.
69 | * @param string $callback The name of the function definition on the $component.
70 | * @param int $priority Optional $priority The priority at which the function should be fired.
71 | * @param int $accepted_args Optional $accepted_args The number of arguments that should be passed to the $callback.
72 | *
73 | * @since 1.0.0
74 | *
75 | */
76 | public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
77 | $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
78 | }
79 |
80 | /**
81 | * A utility function that is used to register the actions and hooks into a single
82 | * collection.
83 | *
84 | * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
85 | * @param string $hook The name of the WordPress filter that is being registered.
86 | * @param object $component A reference to the instance of the object on which the filter is defined.
87 | * @param string $callback The name of the function definition on the $component.
88 | * @param int $priority Optional $priority The priority at which the function should be fired.
89 | * @param int $accepted_args Optional $accepted_args The number of arguments that should be passed to the $callback.
90 | *
91 | * @since 1.0.0
92 | *
93 | */
94 | private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ): array {
95 | $hooks[] = [
96 | 'hook' => $hook,
97 | 'component' => $component,
98 | 'callback' => $callback,
99 | 'priority' => $priority,
100 | 'accepted_args' => $accepted_args,
101 | ];
102 |
103 | return $hooks;
104 | }
105 |
106 | /**
107 | * Register the filters and actions with WordPress.
108 | *
109 | * @since 1.0.0
110 | */
111 | public function run() {
112 | foreach ( $this->filters as $hook ) {
113 | add_filter( $hook['hook'], [ $hook['component'], $hook['callback'] ], $hook['priority'], $hook['accepted_args'] );
114 | }
115 |
116 | foreach ( $this->actions as $hook ) {
117 | add_action( $hook['hook'], [ $hook['component'], $hook['callback'] ], $hook['priority'], $hook['accepted_args'] );
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/includes/class-jwt-auth.php:
--------------------------------------------------------------------------------
1 |
25 | */
26 | class Jwt_Auth {
27 | /**
28 | * The loader that's responsible for maintaining and registering all hooks that power
29 | * the plugin.
30 | *
31 | * @since 1.0.0
32 | *
33 | * @var Jwt_Auth_Loader Maintains and registers all hooks for the plugin.
34 | */
35 | protected Jwt_Auth_Loader $loader;
36 |
37 | /**
38 | * The unique identifier of this plugin.
39 | *
40 | * @since 1.0.0
41 | *
42 | * @var string The string used to uniquely identify this plugin.
43 | */
44 | protected string $plugin_name;
45 |
46 | /**
47 | * The current version of the plugin.
48 | *
49 | * @since 1.0.0
50 | *
51 | * @var string The current version of the plugin.
52 | */
53 | protected string $version;
54 |
55 | /**
56 | * Define the core functionality of the plugin.
57 | *
58 | * Set the plugin name and the plugin version that can be used throughout the plugin.
59 | * Load the dependencies, define the locale, and set the hooks for the admin area and
60 | * the public-facing side of the site.
61 | *
62 | * @since 1.0.0
63 | */
64 | public function __construct() {
65 | $this->plugin_name = 'jwt-auth';
66 | $this->version = '1.3.7';
67 |
68 | $this->load_dependencies();
69 | $this->set_locale();
70 | $this->define_public_hooks();
71 | $this->define_admin_hooks();
72 | }
73 |
74 | /**
75 | * Load the required dependencies for this plugin.
76 | *
77 | * Include the following files that make up the plugin:
78 | *
79 | * - Jwt_Auth_Loader. Orchestrates the hooks of the plugin.
80 | * - Jwt_Auth_i18n. Defines internationalization functionality.
81 | * - Jwt_Auth_Admin. Defines all hooks for the admin area.
82 | * - Jwt_Auth_Public. Defines all hooks for the public side of the site.
83 | *
84 | * Create an instance of the loader which will be used to register the hooks
85 | * with WordPress.
86 | *
87 | * @since 1.0.0
88 | */
89 | private function load_dependencies() {
90 |
91 | /**
92 | * Load dependencies managed by composer.
93 | */
94 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/vendor/autoload.php';
95 |
96 | /**
97 | * The class responsible for orchestrating the actions and filters of the
98 | * core plugin.
99 | */
100 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-jwt-auth-loader.php';
101 |
102 | /**
103 | * The class responsible for defining internationalization functionality
104 | * of the plugin.
105 | */
106 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-jwt-auth-i18n.php';
107 |
108 | /**
109 | * Class responsible for creating a `wrapper namespace` to load the Firebase's JWT & Key
110 | * classes and prevent conflicts with other plugins using the same library
111 | * with different versions.
112 | */
113 | require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-jwt-namespace-wrapper.php';
114 |
115 | /**
116 | * The class responsible for defining all actions that occur in the public-facing
117 | * side of the site.
118 | */
119 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-jwt-auth-public.php';
120 |
121 | /**
122 | * The class responsible for defining all actions that occur in the admin-facing
123 | * side of the site.
124 | */
125 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-jwt-auth-admin.php';
126 |
127 | $this->loader = new Jwt_Auth_Loader();
128 | }
129 |
130 | /**
131 | * Define the locale for this plugin for internationalization.
132 | *
133 | * Uses the Jwt_Auth_i18n class in order to set the domain and to register the hook
134 | * with WordPress.
135 | *
136 | * @since 1.0.0
137 | */
138 | private function set_locale() {
139 | $plugin_i18n = new Jwt_Auth_i18n();
140 | $plugin_i18n->set_domain( $this->get_plugin_name() );
141 | $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
142 | }
143 |
144 | /**
145 | * Register all the hooks related to the public-facing functionality
146 | * of the plugin.
147 | *
148 | * @since 1.0.0
149 | */
150 | private function define_public_hooks() {
151 | $plugin_public = new Jwt_Auth_Public( $this->get_plugin_name(), $this->get_version() );
152 | $this->loader->add_action( 'rest_api_init', $plugin_public, 'add_api_routes' );
153 | $this->loader->add_filter( 'rest_api_init', $plugin_public, 'add_cors_support' );
154 | $this->loader->add_filter( 'rest_pre_dispatch', $plugin_public, 'rest_pre_dispatch', 10, 2 );
155 | $this->loader->add_filter( 'determine_current_user', $plugin_public, 'determine_current_user' );
156 | }
157 |
158 | /**
159 | * Register all the hooks related to the admin-facing functionality
160 | * of the plugin.
161 | *
162 | * @since 1.3.4
163 | */
164 | private function define_admin_hooks() {
165 | $plugin_admin = new Jwt_Auth_Admin( $this->get_plugin_name(), $this->get_version() );
166 | $this->loader->add_action( 'admin_menu', $plugin_admin, 'register_menu_page' );
167 | $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_plugin_assets' );
168 | $this->loader->add_action( 'admin_init', $plugin_admin, 'register_plugin_settings' );
169 | $this->loader->add_action( 'rest_api_init', $plugin_admin, 'register_plugin_settings' );
170 | $this->loader->add_action( 'admin_notices', $plugin_admin, 'display_admin_notice' );
171 | $this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'add_action_link', 10, 2 );
172 | }
173 |
174 | /**
175 | * Run the loader to execute all the hooks with WordPress.
176 | *
177 | * @since 1.0.0
178 | */
179 | public function run() {
180 | $this->loader->run();
181 | }
182 |
183 | /**
184 | * The name of the plugin used to uniquely identify it within the context of
185 | * WordPress and to define internationalization functionality.
186 | *
187 | * @return string The name of the plugin.
188 | * @since 1.0.0
189 | *
190 | */
191 | public function get_plugin_name(): string {
192 | return $this->plugin_name;
193 | }
194 |
195 | /**
196 | * The reference to the class that orchestrates the hooks with the plugin.
197 | *
198 | * @return Jwt_Auth_Loader Orchestrates the hooks of the plugin.
199 | * @since 1.0.0
200 | *
201 | */
202 | public function get_loader(): Jwt_Auth_Loader {
203 | return $this->loader;
204 | }
205 |
206 | /**
207 | * Retrieve the version number of the plugin.
208 | *
209 | * @return string The version number of the plugin.
210 | * @since 1.0.0
211 | *
212 | */
213 | public function get_version(): string {
214 | return $this->version;
215 | }
216 | }
217 |
--------------------------------------------------------------------------------
/includes/class-jwt-namespace-wrapper.php:
--------------------------------------------------------------------------------
1 | array($vendorDir . '/firebase/php-jwt/src'),
10 | 'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src/Composer/Installers'),
11 | );
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/autoload_real.php:
--------------------------------------------------------------------------------
1 | register(true);
35 |
36 | return $loader;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installed.json:
--------------------------------------------------------------------------------
1 | {
2 | "packages": [
3 | {
4 | "name": "composer/installers",
5 | "version": "v1.12.0",
6 | "version_normalized": "1.12.0.0",
7 | "source": {
8 | "type": "git",
9 | "url": "https://github.com/composer/installers.git",
10 | "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19"
11 | },
12 | "dist": {
13 | "type": "zip",
14 | "url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19",
15 | "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19",
16 | "shasum": ""
17 | },
18 | "require": {
19 | "composer-plugin-api": "^1.0 || ^2.0"
20 | },
21 | "replace": {
22 | "roundcube/plugin-installer": "*",
23 | "shama/baton": "*"
24 | },
25 | "require-dev": {
26 | "composer/composer": "1.6.* || ^2.0",
27 | "composer/semver": "^1 || ^3",
28 | "phpstan/phpstan": "^0.12.55",
29 | "phpstan/phpstan-phpunit": "^0.12.16",
30 | "symfony/phpunit-bridge": "^4.2 || ^5",
31 | "symfony/process": "^2.3"
32 | },
33 | "time": "2021-09-13T08:19:44+00:00",
34 | "type": "composer-plugin",
35 | "extra": {
36 | "class": "Composer\\Installers\\Plugin",
37 | "branch-alias": {
38 | "dev-main": "1.x-dev"
39 | }
40 | },
41 | "installation-source": "dist",
42 | "autoload": {
43 | "psr-4": {
44 | "Composer\\Installers\\": "src/Composer/Installers"
45 | }
46 | },
47 | "notification-url": "https://packagist.org/downloads/",
48 | "license": [
49 | "MIT"
50 | ],
51 | "authors": [
52 | {
53 | "name": "Kyle Robinson Young",
54 | "email": "kyle@dontkry.com",
55 | "homepage": "https://github.com/shama"
56 | }
57 | ],
58 | "description": "A multi-framework Composer library installer",
59 | "homepage": "https://composer.github.io/installers/",
60 | "keywords": [
61 | "Craft",
62 | "Dolibarr",
63 | "Eliasis",
64 | "Hurad",
65 | "ImageCMS",
66 | "Kanboard",
67 | "Lan Management System",
68 | "MODX Evo",
69 | "MantisBT",
70 | "Mautic",
71 | "Maya",
72 | "OXID",
73 | "Plentymarkets",
74 | "Porto",
75 | "RadPHP",
76 | "SMF",
77 | "Starbug",
78 | "Thelia",
79 | "Whmcs",
80 | "WolfCMS",
81 | "agl",
82 | "aimeos",
83 | "annotatecms",
84 | "attogram",
85 | "bitrix",
86 | "cakephp",
87 | "chef",
88 | "cockpit",
89 | "codeigniter",
90 | "concrete5",
91 | "croogo",
92 | "dokuwiki",
93 | "drupal",
94 | "eZ Platform",
95 | "elgg",
96 | "expressionengine",
97 | "fuelphp",
98 | "grav",
99 | "installer",
100 | "itop",
101 | "joomla",
102 | "known",
103 | "kohana",
104 | "laravel",
105 | "lavalite",
106 | "lithium",
107 | "magento",
108 | "majima",
109 | "mako",
110 | "mediawiki",
111 | "miaoxing",
112 | "modulework",
113 | "modx",
114 | "moodle",
115 | "osclass",
116 | "pantheon",
117 | "phpbb",
118 | "piwik",
119 | "ppi",
120 | "processwire",
121 | "puppet",
122 | "pxcms",
123 | "reindex",
124 | "roundcube",
125 | "shopware",
126 | "silverstripe",
127 | "sydes",
128 | "sylius",
129 | "symfony",
130 | "tastyigniter",
131 | "typo3",
132 | "wordpress",
133 | "yawik",
134 | "zend",
135 | "zikula"
136 | ],
137 | "support": {
138 | "issues": "https://github.com/composer/installers/issues",
139 | "source": "https://github.com/composer/installers/tree/v1.12.0"
140 | },
141 | "funding": [
142 | {
143 | "url": "https://packagist.com",
144 | "type": "custom"
145 | },
146 | {
147 | "url": "https://github.com/composer",
148 | "type": "github"
149 | },
150 | {
151 | "url": "https://tidelift.com/funding/github/packagist/composer/composer",
152 | "type": "tidelift"
153 | }
154 | ],
155 | "install-path": "./installers"
156 | },
157 | {
158 | "name": "firebase/php-jwt",
159 | "version": "v6.4.0",
160 | "version_normalized": "6.4.0.0",
161 | "source": {
162 | "type": "git",
163 | "url": "https://github.com/firebase/php-jwt.git",
164 | "reference": "4dd1e007f22a927ac77da5a3fbb067b42d3bc224"
165 | },
166 | "dist": {
167 | "type": "zip",
168 | "url": "https://api.github.com/repos/firebase/php-jwt/zipball/4dd1e007f22a927ac77da5a3fbb067b42d3bc224",
169 | "reference": "4dd1e007f22a927ac77da5a3fbb067b42d3bc224",
170 | "shasum": ""
171 | },
172 | "require": {
173 | "php": "^7.1||^8.0"
174 | },
175 | "require-dev": {
176 | "guzzlehttp/guzzle": "^6.5||^7.4",
177 | "phpspec/prophecy-phpunit": "^1.1",
178 | "phpunit/phpunit": "^7.5||^9.5",
179 | "psr/cache": "^1.0||^2.0",
180 | "psr/http-client": "^1.0",
181 | "psr/http-factory": "^1.0"
182 | },
183 | "suggest": {
184 | "ext-sodium": "Support EdDSA (Ed25519) signatures",
185 | "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
186 | },
187 | "time": "2023-02-09T21:01:23+00:00",
188 | "type": "library",
189 | "installation-source": "dist",
190 | "autoload": {
191 | "psr-4": {
192 | "Firebase\\JWT\\": "src"
193 | }
194 | },
195 | "notification-url": "https://packagist.org/downloads/",
196 | "license": [
197 | "BSD-3-Clause"
198 | ],
199 | "authors": [
200 | {
201 | "name": "Neuman Vong",
202 | "email": "neuman+pear@twilio.com",
203 | "role": "Developer"
204 | },
205 | {
206 | "name": "Anant Narayanan",
207 | "email": "anant@php.net",
208 | "role": "Developer"
209 | }
210 | ],
211 | "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
212 | "homepage": "https://github.com/firebase/php-jwt",
213 | "keywords": [
214 | "jwt",
215 | "php"
216 | ],
217 | "support": {
218 | "issues": "https://github.com/firebase/php-jwt/issues",
219 | "source": "https://github.com/firebase/php-jwt/tree/v6.4.0"
220 | },
221 | "install-path": "../firebase/php-jwt"
222 | }
223 | ],
224 | "dev": false,
225 | "dev-package-names": []
226 | }
227 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installed.php:
--------------------------------------------------------------------------------
1 | array(
3 | 'name' => 'tmeister/wp-api-jwt-auth',
4 | 'pretty_version' => 'dev-develop',
5 | 'version' => 'dev-develop',
6 | 'reference' => '449f3d07c2827945108cae1202d8e369c3fe7c51',
7 | 'type' => 'wordpress-plugin',
8 | 'install_path' => __DIR__ . '/../../../',
9 | 'aliases' => array(),
10 | 'dev' => false,
11 | ),
12 | 'versions' => array(
13 | 'composer/installers' => array(
14 | 'pretty_version' => 'v1.12.0',
15 | 'version' => '1.12.0.0',
16 | 'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
17 | 'type' => 'composer-plugin',
18 | 'install_path' => __DIR__ . '/./installers',
19 | 'aliases' => array(),
20 | 'dev_requirement' => false,
21 | ),
22 | 'firebase/php-jwt' => array(
23 | 'pretty_version' => 'v6.4.0',
24 | 'version' => '6.4.0.0',
25 | 'reference' => '4dd1e007f22a927ac77da5a3fbb067b42d3bc224',
26 | 'type' => 'library',
27 | 'install_path' => __DIR__ . '/../firebase/php-jwt',
28 | 'aliases' => array(),
29 | 'dev_requirement' => false,
30 | ),
31 | 'roundcube/plugin-installer' => array(
32 | 'dev_requirement' => false,
33 | 'replaced' => array(
34 | 0 => '*',
35 | ),
36 | ),
37 | 'shama/baton' => array(
38 | 'dev_requirement' => false,
39 | 'replaced' => array(
40 | 0 => '*',
41 | ),
42 | ),
43 | 'tmeister/wp-api-jwt-auth' => array(
44 | 'pretty_version' => 'dev-develop',
45 | 'version' => 'dev-develop',
46 | 'reference' => '449f3d07c2827945108cae1202d8e369c3fe7c51',
47 | 'type' => 'wordpress-plugin',
48 | 'install_path' => __DIR__ . '/../../../',
49 | 'aliases' => array(),
50 | 'dev_requirement' => false,
51 | ),
52 | ),
53 | );
54 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/.github/workflows/continuous-integration.yml:
--------------------------------------------------------------------------------
1 | name: "Continuous Integration"
2 |
3 | on:
4 | - push
5 | - pull_request
6 |
7 | env:
8 | COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
9 | SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"
10 |
11 | jobs:
12 | tests:
13 | name: "CI"
14 |
15 | runs-on: ubuntu-latest
16 |
17 | strategy:
18 | matrix:
19 | php-version:
20 | - "5.3"
21 | - "5.4"
22 | - "5.5"
23 | - "5.6"
24 | - "7.0"
25 | - "7.1"
26 | - "7.2"
27 | - "7.3"
28 | - "7.4"
29 | - "8.0"
30 | - "8.1"
31 | dependencies: [locked]
32 | include:
33 | - php-version: "5.3"
34 | dependencies: lowest
35 | - php-version: "8.1"
36 | dependencies: lowest
37 |
38 | steps:
39 | - name: "Checkout"
40 | uses: "actions/checkout@v2"
41 |
42 | - name: "Install PHP"
43 | uses: "shivammathur/setup-php@v2"
44 | with:
45 | coverage: "none"
46 | php-version: "${{ matrix.php-version }}"
47 | tools: composer:snapshot
48 |
49 | - name: Get composer cache directory
50 | id: composercache
51 | run: echo "::set-output name=dir::$(composer config cache-files-dir)"
52 |
53 | - name: Cache dependencies
54 | uses: actions/cache@v2
55 | with:
56 | path: ${{ steps.composercache.outputs.dir }}
57 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
58 | restore-keys: ${{ runner.os }}-composer-
59 |
60 | - name: "Handle lowest dependencies update"
61 | if: "contains(matrix.dependencies, 'lowest')"
62 | run: "echo \"COMPOSER_FLAGS=$COMPOSER_FLAGS --prefer-lowest\" >> $GITHUB_ENV"
63 |
64 | - name: "Upgrade phpunit-bridge if needed for php 8 lowest build"
65 | if: "contains(matrix.php-version, '8.')"
66 | run: |
67 | composer require symfony/phpunit-bridge:^5.3.3 --dev --no-update
68 |
69 | - name: "Install latest dependencies"
70 | run: |
71 | # Remove PHPStan as it requires a newer PHP
72 | composer remove phpstan/phpstan phpstan/phpstan-phpunit --dev --no-update
73 | composer update ${{ env.COMPOSER_FLAGS }}
74 |
75 | - name: "Run tests"
76 | run: "vendor/bin/simple-phpunit --verbose"
77 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/.github/workflows/lint.yml:
--------------------------------------------------------------------------------
1 | name: "PHP Lint"
2 |
3 | on:
4 | - push
5 | - pull_request
6 |
7 | jobs:
8 | tests:
9 | name: "Lint"
10 |
11 | runs-on: ubuntu-latest
12 |
13 | strategy:
14 | matrix:
15 | php-version:
16 | - "5.3"
17 | - "8.0"
18 |
19 | steps:
20 | - name: "Checkout"
21 | uses: "actions/checkout@v2"
22 |
23 | - name: "Install PHP"
24 | uses: "shivammathur/setup-php@v2"
25 | with:
26 | coverage: "none"
27 | php-version: "${{ matrix.php-version }}"
28 |
29 | - name: "Lint PHP files"
30 | run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"
31 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/.github/workflows/phpstan.yml:
--------------------------------------------------------------------------------
1 | name: "PHPStan"
2 |
3 | on:
4 | - push
5 | - pull_request
6 |
7 | env:
8 | COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
9 | SYMFONY_PHPUNIT_VERSION: ""
10 |
11 | jobs:
12 | tests:
13 | name: "PHPStan"
14 |
15 | runs-on: ubuntu-latest
16 |
17 | strategy:
18 | matrix:
19 | php-version:
20 | # pinned to 7.4 because we need PHPUnit 7.5 which does not support PHP 8
21 | - "7.4"
22 |
23 | steps:
24 | - name: "Checkout"
25 | uses: "actions/checkout@v2"
26 |
27 | - name: "Install PHP"
28 | uses: "shivammathur/setup-php@v2"
29 | with:
30 | coverage: "none"
31 | php-version: "${{ matrix.php-version }}"
32 |
33 | - name: Get composer cache directory
34 | id: composercache
35 | run: echo "::set-output name=dir::$(composer config cache-files-dir)"
36 |
37 | - name: Cache dependencies
38 | uses: actions/cache@v2
39 | with:
40 | path: ${{ steps.composercache.outputs.dir }}
41 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
42 | restore-keys: ${{ runner.os }}-composer-
43 |
44 | - name: "Install latest dependencies"
45 | run: "composer update ${{ env.COMPOSER_FLAGS }}"
46 |
47 | - name: Run PHPStan
48 | # Locked to phpunit 7.5 here as newer ones have void return types which break inheritance
49 | run: |
50 | composer require --dev phpunit/phpunit:^7.5.20 --with-all-dependencies ${{ env.COMPOSER_FLAGS }}
51 | vendor/bin/phpstan analyse
52 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 Kyle Robinson Young
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is furnished
8 | to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "composer/installers",
3 | "type": "composer-plugin",
4 | "license": "MIT",
5 | "description": "A multi-framework Composer library installer",
6 | "keywords": [
7 | "installer",
8 | "Aimeos",
9 | "AGL",
10 | "AnnotateCms",
11 | "Attogram",
12 | "Bitrix",
13 | "CakePHP",
14 | "Chef",
15 | "Cockpit",
16 | "CodeIgniter",
17 | "concrete5",
18 | "Craft",
19 | "Croogo",
20 | "DokuWiki",
21 | "Dolibarr",
22 | "Drupal",
23 | "Elgg",
24 | "Eliasis",
25 | "ExpressionEngine",
26 | "eZ Platform",
27 | "FuelPHP",
28 | "Grav",
29 | "Hurad",
30 | "ImageCMS",
31 | "iTop",
32 | "Joomla",
33 | "Kanboard",
34 | "Known",
35 | "Kohana",
36 | "Lan Management System",
37 | "Laravel",
38 | "Lavalite",
39 | "Lithium",
40 | "Magento",
41 | "majima",
42 | "Mako",
43 | "MantisBT",
44 | "Mautic",
45 | "Maya",
46 | "MODX",
47 | "MODX Evo",
48 | "MediaWiki",
49 | "Miaoxing",
50 | "OXID",
51 | "osclass",
52 | "MODULEWork",
53 | "Moodle",
54 | "Pantheon",
55 | "Piwik",
56 | "pxcms",
57 | "phpBB",
58 | "Plentymarkets",
59 | "PPI",
60 | "Puppet",
61 | "Porto",
62 | "ProcessWire",
63 | "RadPHP",
64 | "ReIndex",
65 | "Roundcube",
66 | "shopware",
67 | "SilverStripe",
68 | "SMF",
69 | "Starbug",
70 | "SyDES",
71 | "Sylius",
72 | "symfony",
73 | "TastyIgniter",
74 | "Thelia",
75 | "TYPO3",
76 | "WHMCS",
77 | "WolfCMS",
78 | "WordPress",
79 | "YAWIK",
80 | "Zend",
81 | "Zikula"
82 | ],
83 | "homepage": "https://composer.github.io/installers/",
84 | "authors": [
85 | {
86 | "name": "Kyle Robinson Young",
87 | "email": "kyle@dontkry.com",
88 | "homepage": "https://github.com/shama"
89 | }
90 | ],
91 | "autoload": {
92 | "psr-4": { "Composer\\Installers\\": "src/Composer/Installers" }
93 | },
94 | "autoload-dev": {
95 | "psr-4": { "Composer\\Installers\\Test\\": "tests/Composer/Installers/Test" }
96 | },
97 | "extra": {
98 | "class": "Composer\\Installers\\Plugin",
99 | "branch-alias": {
100 | "dev-main": "1.x-dev"
101 | }
102 | },
103 | "replace": {
104 | "shama/baton": "*",
105 | "roundcube/plugin-installer": "*"
106 | },
107 | "require": {
108 | "composer-plugin-api": "^1.0 || ^2.0"
109 | },
110 | "require-dev": {
111 | "composer/composer": "1.6.* || ^2.0",
112 | "composer/semver": "^1 || ^3",
113 | "symfony/phpunit-bridge": "^4.2 || ^5",
114 | "phpstan/phpstan": "^0.12.55",
115 | "symfony/process": "^2.3",
116 | "phpstan/phpstan-phpunit": "^0.12.16"
117 | },
118 | "scripts": {
119 | "test": "SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 vendor/bin/simple-phpunit",
120 | "phpstan": "vendor/bin/phpstan analyse"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/phpstan.neon.dist:
--------------------------------------------------------------------------------
1 | parameters:
2 | level: 5
3 | paths:
4 | - src
5 | - tests
6 | excludes_analyse:
7 | - tests/Composer/Installers/Test/PolyfillTestCase.php
8 |
9 | includes:
10 | - vendor/phpstan/phpstan-phpunit/extension.neon
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/AglInstaller.php:
--------------------------------------------------------------------------------
1 | 'More/{$name}/',
8 | );
9 |
10 | /**
11 | * Format package name to CamelCase
12 | */
13 | public function inflectPackageVars($vars)
14 | {
15 | $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) {
16 | return strtoupper($matches[1]);
17 | }, $vars['name']);
18 |
19 | return $vars;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php:
--------------------------------------------------------------------------------
1 | 'ext/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php:
--------------------------------------------------------------------------------
1 | 'addons/modules/{$name}/',
8 | 'component' => 'addons/components/{$name}/',
9 | 'service' => 'addons/services/{$name}/',
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php:
--------------------------------------------------------------------------------
1 | 'Modules/{$name}/',
8 | 'theme' => 'Themes/{$name}/'
9 | );
10 |
11 | /**
12 | * Format package name.
13 | *
14 | * For package type asgard-module, cut off a trailing '-plugin' if present.
15 | *
16 | * For package type asgard-theme, cut off a trailing '-theme' if present.
17 | *
18 | */
19 | public function inflectPackageVars($vars)
20 | {
21 | if ($vars['type'] === 'asgard-module') {
22 | return $this->inflectPluginVars($vars);
23 | }
24 |
25 | if ($vars['type'] === 'asgard-theme') {
26 | return $this->inflectThemeVars($vars);
27 | }
28 |
29 | return $vars;
30 | }
31 |
32 | protected function inflectPluginVars($vars)
33 | {
34 | $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
35 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
36 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
37 |
38 | return $vars;
39 | }
40 |
41 | protected function inflectThemeVars($vars)
42 | {
43 | $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
44 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
45 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
46 |
47 | return $vars;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php:
--------------------------------------------------------------------------------
1 | composer = $composer;
25 | $this->package = $package;
26 | $this->io = $io;
27 | }
28 |
29 | /**
30 | * Return the install path based on package type.
31 | *
32 | * @param PackageInterface $package
33 | * @param string $frameworkType
34 | * @return string
35 | */
36 | public function getInstallPath(PackageInterface $package, $frameworkType = '')
37 | {
38 | $type = $this->package->getType();
39 |
40 | $prettyName = $this->package->getPrettyName();
41 | if (strpos($prettyName, '/') !== false) {
42 | list($vendor, $name) = explode('/', $prettyName);
43 | } else {
44 | $vendor = '';
45 | $name = $prettyName;
46 | }
47 |
48 | $availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type'));
49 |
50 | $extra = $package->getExtra();
51 | if (!empty($extra['installer-name'])) {
52 | $availableVars['name'] = $extra['installer-name'];
53 | }
54 |
55 | if ($this->composer->getPackage()) {
56 | $extra = $this->composer->getPackage()->getExtra();
57 | if (!empty($extra['installer-paths'])) {
58 | $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type, $vendor);
59 | if ($customPath !== false) {
60 | return $this->templatePath($customPath, $availableVars);
61 | }
62 | }
63 | }
64 |
65 | $packageType = substr($type, strlen($frameworkType) + 1);
66 | $locations = $this->getLocations();
67 | if (!isset($locations[$packageType])) {
68 | throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type));
69 | }
70 |
71 | return $this->templatePath($locations[$packageType], $availableVars);
72 | }
73 |
74 | /**
75 | * For an installer to override to modify the vars per installer.
76 | *
77 | * @param array $vars This will normally receive array{name: string, vendor: string, type: string}
78 | * @return array
79 | */
80 | public function inflectPackageVars($vars)
81 | {
82 | return $vars;
83 | }
84 |
85 | /**
86 | * Gets the installer's locations
87 | *
88 | * @return array map of package types => install path
89 | */
90 | public function getLocations()
91 | {
92 | return $this->locations;
93 | }
94 |
95 | /**
96 | * Replace vars in a path
97 | *
98 | * @param string $path
99 | * @param array $vars
100 | * @return string
101 | */
102 | protected function templatePath($path, array $vars = array())
103 | {
104 | if (strpos($path, '{') !== false) {
105 | extract($vars);
106 | preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches);
107 | if (!empty($matches[1])) {
108 | foreach ($matches[1] as $var) {
109 | $path = str_replace('{$' . $var . '}', $$var, $path);
110 | }
111 | }
112 | }
113 |
114 | return $path;
115 | }
116 |
117 | /**
118 | * Search through a passed paths array for a custom install path.
119 | *
120 | * @param array $paths
121 | * @param string $name
122 | * @param string $type
123 | * @param string $vendor = NULL
124 | * @return string|false
125 | */
126 | protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL)
127 | {
128 | foreach ($paths as $path => $names) {
129 | $names = (array) $names;
130 | if (in_array($name, $names) || in_array('type:' . $type, $names) || in_array('vendor:' . $vendor, $names)) {
131 | return $path;
132 | }
133 | }
134 |
135 | return false;
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php:
--------------------------------------------------------------------------------
1 | .`.
10 | * - `bitrix-d7-component` — copy the component to directory `bitrix/components//`.
11 | * - `bitrix-d7-template` — copy the template to directory `bitrix/templates/_`.
12 | *
13 | * You can set custom path to directory with Bitrix kernel in `composer.json`:
14 | *
15 | * ```json
16 | * {
17 | * "extra": {
18 | * "bitrix-dir": "s1/bitrix"
19 | * }
20 | * }
21 | * ```
22 | *
23 | * @author Nik Samokhvalov
24 | * @author Denis Kulichkin
25 | */
26 | class BitrixInstaller extends BaseInstaller
27 | {
28 | protected $locations = array(
29 | 'module' => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
30 | 'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
31 | 'theme' => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
32 | 'd7-module' => '{$bitrix_dir}/modules/{$vendor}.{$name}/',
33 | 'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/',
34 | 'd7-template' => '{$bitrix_dir}/templates/{$vendor}_{$name}/',
35 | );
36 |
37 | /**
38 | * @var array Storage for informations about duplicates at all the time of installation packages.
39 | */
40 | private static $checkedDuplicates = array();
41 |
42 | /**
43 | * {@inheritdoc}
44 | */
45 | public function inflectPackageVars($vars)
46 | {
47 | if ($this->composer->getPackage()) {
48 | $extra = $this->composer->getPackage()->getExtra();
49 |
50 | if (isset($extra['bitrix-dir'])) {
51 | $vars['bitrix_dir'] = $extra['bitrix-dir'];
52 | }
53 | }
54 |
55 | if (!isset($vars['bitrix_dir'])) {
56 | $vars['bitrix_dir'] = 'bitrix';
57 | }
58 |
59 | return parent::inflectPackageVars($vars);
60 | }
61 |
62 | /**
63 | * {@inheritdoc}
64 | */
65 | protected function templatePath($path, array $vars = array())
66 | {
67 | $templatePath = parent::templatePath($path, $vars);
68 | $this->checkDuplicates($templatePath, $vars);
69 |
70 | return $templatePath;
71 | }
72 |
73 | /**
74 | * Duplicates search packages.
75 | *
76 | * @param string $path
77 | * @param array $vars
78 | */
79 | protected function checkDuplicates($path, array $vars = array())
80 | {
81 | $packageType = substr($vars['type'], strlen('bitrix') + 1);
82 | $localDir = explode('/', $vars['bitrix_dir']);
83 | array_pop($localDir);
84 | $localDir[] = 'local';
85 | $localDir = implode('/', $localDir);
86 |
87 | $oldPath = str_replace(
88 | array('{$bitrix_dir}', '{$name}'),
89 | array($localDir, $vars['name']),
90 | $this->locations[$packageType]
91 | );
92 |
93 | if (in_array($oldPath, static::$checkedDuplicates)) {
94 | return;
95 | }
96 |
97 | if ($oldPath !== $path && file_exists($oldPath) && $this->io && $this->io->isInteractive()) {
98 |
99 | $this->io->writeError(' Duplication of packages: ');
100 | $this->io->writeError(' Package ' . $oldPath . ' will be called instead package ' . $path . ' ');
101 |
102 | while (true) {
103 | switch ($this->io->ask(' Delete ' . $oldPath . ' [y,n,?]? ', '?')) {
104 | case 'y':
105 | $fs = new Filesystem();
106 | $fs->removeDirectory($oldPath);
107 | break 2;
108 |
109 | case 'n':
110 | break 2;
111 |
112 | case '?':
113 | default:
114 | $this->io->writeError(array(
115 | ' y - delete package ' . $oldPath . ' and to continue with the installation',
116 | ' n - don\'t delete and to continue with the installation',
117 | ));
118 | $this->io->writeError(' ? - print help');
119 | break;
120 | }
121 | }
122 | }
123 |
124 | static::$checkedDuplicates[] = $oldPath;
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/BonefishInstaller.php:
--------------------------------------------------------------------------------
1 | 'Packages/{$vendor}/{$name}/'
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php:
--------------------------------------------------------------------------------
1 | 'Plugin/{$name}/',
11 | );
12 |
13 | /**
14 | * Format package name to CamelCase
15 | */
16 | public function inflectPackageVars($vars)
17 | {
18 | if ($this->matchesCakeVersion('>=', '3.0.0')) {
19 | return $vars;
20 | }
21 |
22 | $nameParts = explode('/', $vars['name']);
23 | foreach ($nameParts as &$value) {
24 | $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
25 | $value = str_replace(array('-', '_'), ' ', $value);
26 | $value = str_replace(' ', '', ucwords($value));
27 | }
28 | $vars['name'] = implode('/', $nameParts);
29 |
30 | return $vars;
31 | }
32 |
33 | /**
34 | * Change the default plugin location when cakephp >= 3.0
35 | */
36 | public function getLocations()
37 | {
38 | if ($this->matchesCakeVersion('>=', '3.0.0')) {
39 | $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
40 | }
41 | return $this->locations;
42 | }
43 |
44 | /**
45 | * Check if CakePHP version matches against a version
46 | *
47 | * @param string $matcher
48 | * @param string $version
49 | * @return bool
50 | * @phpstan-param Constraint::STR_OP_* $matcher
51 | */
52 | protected function matchesCakeVersion($matcher, $version)
53 | {
54 | $repositoryManager = $this->composer->getRepositoryManager();
55 | if (! $repositoryManager) {
56 | return false;
57 | }
58 |
59 | $repos = $repositoryManager->getLocalRepository();
60 | if (!$repos) {
61 | return false;
62 | }
63 |
64 | return $repos->findPackage('cakephp/cakephp', new Constraint($matcher, $version)) !== null;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php:
--------------------------------------------------------------------------------
1 | 'Chef/{$vendor}/{$name}/',
8 | 'role' => 'Chef/roles/{$name}/',
9 | );
10 | }
11 |
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/CiviCrmInstaller.php:
--------------------------------------------------------------------------------
1 | 'ext/{$name}/'
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php:
--------------------------------------------------------------------------------
1 | 'CCF/orbit/{$name}/',
8 | 'theme' => 'CCF/app/themes/{$name}/',
9 | );
10 | }
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php:
--------------------------------------------------------------------------------
1 | 'cockpit/modules/addons/{$name}/',
8 | );
9 |
10 | /**
11 | * Format module name.
12 | *
13 | * Strip `module-` prefix from package name.
14 | *
15 | * {@inheritDoc}
16 | */
17 | public function inflectPackageVars($vars)
18 | {
19 | if ($vars['type'] == 'cockpit-module') {
20 | return $this->inflectModuleVars($vars);
21 | }
22 |
23 | return $vars;
24 | }
25 |
26 | public function inflectModuleVars($vars)
27 | {
28 | $vars['name'] = ucfirst(preg_replace('/cockpit-/i', '', $vars['name']));
29 |
30 | return $vars;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php:
--------------------------------------------------------------------------------
1 | 'application/libraries/{$name}/',
8 | 'third-party' => 'application/third_party/{$name}/',
9 | 'module' => 'application/modules/{$name}/',
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php:
--------------------------------------------------------------------------------
1 | 'concrete/',
8 | 'block' => 'application/blocks/{$name}/',
9 | 'package' => 'packages/{$name}/',
10 | 'theme' => 'application/themes/{$name}/',
11 | 'update' => 'updates/{$name}/',
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php:
--------------------------------------------------------------------------------
1 | 'craft/plugins/{$name}/',
14 | );
15 |
16 | /**
17 | * Strip `craft-` prefix and/or `-plugin` suffix from package names
18 | *
19 | * @param array $vars
20 | *
21 | * @return array
22 | */
23 | final public function inflectPackageVars($vars)
24 | {
25 | return $this->inflectPluginVars($vars);
26 | }
27 |
28 | private function inflectPluginVars($vars)
29 | {
30 | $vars['name'] = preg_replace('/-' . self::NAME_SUFFIX . '$/i', '', $vars['name']);
31 | $vars['name'] = preg_replace('/^' . self::NAME_PREFIX . '-/i', '', $vars['name']);
32 |
33 | return $vars;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php:
--------------------------------------------------------------------------------
1 | 'Plugin/{$name}/',
8 | 'theme' => 'View/Themed/{$name}/',
9 | );
10 |
11 | /**
12 | * Format package name to CamelCase
13 | */
14 | public function inflectPackageVars($vars)
15 | {
16 | $vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name']));
17 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
18 |
19 | return $vars;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/DecibelInstaller.php:
--------------------------------------------------------------------------------
1 | 'app/{$name}/',
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/DframeInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$vendor}/{$name}/',
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php:
--------------------------------------------------------------------------------
1 | 'lib/plugins/{$name}/',
8 | 'template' => 'lib/tpl/{$name}/',
9 | );
10 |
11 | /**
12 | * Format package name.
13 | *
14 | * For package type dokuwiki-plugin, cut off a trailing '-plugin',
15 | * or leading dokuwiki_ if present.
16 | *
17 | * For package type dokuwiki-template, cut off a trailing '-template' if present.
18 | *
19 | */
20 | public function inflectPackageVars($vars)
21 | {
22 |
23 | if ($vars['type'] === 'dokuwiki-plugin') {
24 | return $this->inflectPluginVars($vars);
25 | }
26 |
27 | if ($vars['type'] === 'dokuwiki-template') {
28 | return $this->inflectTemplateVars($vars);
29 | }
30 |
31 | return $vars;
32 | }
33 |
34 | protected function inflectPluginVars($vars)
35 | {
36 | $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']);
37 | $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
38 |
39 | return $vars;
40 | }
41 |
42 | protected function inflectTemplateVars($vars)
43 | {
44 | $vars['name'] = preg_replace('/-template$/', '', $vars['name']);
45 | $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']);
46 |
47 | return $vars;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php:
--------------------------------------------------------------------------------
1 |
9 | */
10 | class DolibarrInstaller extends BaseInstaller
11 | {
12 | //TODO: Add support for scripts and themes
13 | protected $locations = array(
14 | 'module' => 'htdocs/custom/{$name}/',
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php:
--------------------------------------------------------------------------------
1 | 'core/',
8 | 'module' => 'modules/{$name}/',
9 | 'theme' => 'themes/{$name}/',
10 | 'library' => 'libraries/{$name}/',
11 | 'profile' => 'profiles/{$name}/',
12 | 'database-driver' => 'drivers/lib/Drupal/Driver/Database/{$name}/',
13 | 'drush' => 'drush/{$name}/',
14 | 'custom-theme' => 'themes/custom/{$name}/',
15 | 'custom-module' => 'modules/custom/{$name}/',
16 | 'custom-profile' => 'profiles/custom/{$name}/',
17 | 'drupal-multisite' => 'sites/{$name}/',
18 | 'console' => 'console/{$name}/',
19 | 'console-language' => 'console/language/{$name}/',
20 | 'config' => 'config/sync/',
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php:
--------------------------------------------------------------------------------
1 | 'mod/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/EliasisInstaller.php:
--------------------------------------------------------------------------------
1 | 'components/{$name}/',
8 | 'module' => 'modules/{$name}/',
9 | 'plugin' => 'plugins/{$name}/',
10 | 'template' => 'templates/{$name}/',
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php:
--------------------------------------------------------------------------------
1 | 'system/expressionengine/third_party/{$name}/',
13 | 'theme' => 'themes/third_party/{$name}/',
14 | );
15 |
16 | private $ee3Locations = array(
17 | 'addon' => 'system/user/addons/{$name}/',
18 | 'theme' => 'themes/user/{$name}/',
19 | );
20 |
21 | public function getInstallPath(PackageInterface $package, $frameworkType = '')
22 | {
23 |
24 | $version = "{$frameworkType}Locations";
25 | $this->locations = $this->$version;
26 |
27 | return parent::getInstallPath($package, $frameworkType);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/EzPlatformInstaller.php:
--------------------------------------------------------------------------------
1 | 'web/assets/ezplatform/',
8 | 'assets' => 'web/assets/ezplatform/{$name}/',
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php:
--------------------------------------------------------------------------------
1 | 'fuel/app/modules/{$name}/',
8 | 'package' => 'fuel/packages/{$name}/',
9 | 'theme' => 'fuel/app/themes/{$name}/',
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php:
--------------------------------------------------------------------------------
1 | 'components/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/GravInstaller.php:
--------------------------------------------------------------------------------
1 | 'user/plugins/{$name}/',
8 | 'theme' => 'user/themes/{$name}/',
9 | );
10 |
11 | /**
12 | * Format package name
13 | *
14 | * @param array $vars
15 | *
16 | * @return array
17 | */
18 | public function inflectPackageVars($vars)
19 | {
20 | $restrictedWords = implode('|', array_keys($this->locations));
21 |
22 | $vars['name'] = strtolower($vars['name']);
23 | $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui',
24 | '$1',
25 | $vars['name']
26 | );
27 |
28 | return $vars;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
8 | 'theme' => 'plugins/{$name}/',
9 | );
10 |
11 | /**
12 | * Format package name to CamelCase
13 | */
14 | public function inflectPackageVars($vars)
15 | {
16 | $nameParts = explode('/', $vars['name']);
17 | foreach ($nameParts as &$value) {
18 | $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
19 | $value = str_replace(array('-', '_'), ' ', $value);
20 | $value = str_replace(' ', '', ucwords($value));
21 | }
22 | $vars['name'] = implode('/', $nameParts);
23 | return $vars;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ImageCMSInstaller.php:
--------------------------------------------------------------------------------
1 | 'templates/{$name}/',
8 | 'module' => 'application/modules/{$name}/',
9 | 'library' => 'application/libraries/{$name}/',
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ItopInstaller.php:
--------------------------------------------------------------------------------
1 | 'extensions/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php:
--------------------------------------------------------------------------------
1 | 'components/{$name}/',
8 | 'module' => 'modules/{$name}/',
9 | 'template' => 'templates/{$name}/',
10 | 'plugin' => 'plugins/{$name}/',
11 | 'library' => 'libraries/{$name}/',
12 | );
13 |
14 | // TODO: Add inflector for mod_ and com_ names
15 | }
16 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php:
--------------------------------------------------------------------------------
1 | 'site/plugins/{$name}/',
8 | 'field' => 'site/fields/{$name}/',
9 | 'tag' => 'site/tags/{$name}/'
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/KnownInstaller.php:
--------------------------------------------------------------------------------
1 | 'IdnoPlugins/{$name}/',
8 | 'theme' => 'Themes/{$name}/',
9 | 'console' => 'ConsolePlugins/{$name}/',
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php:
--------------------------------------------------------------------------------
1 | 'cms/plugins/{$name}/',
8 | 'media' => 'cms/media/vendor/{$name}/'
9 | );
10 | }
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/LanManagementSystemInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
10 | 'template' => 'templates/{$name}/',
11 | 'document-template' => 'documents/templates/{$name}/',
12 | 'userpanel-module' => 'userpanel/modules/{$name}/',
13 | );
14 |
15 | /**
16 | * Format package name to CamelCase
17 | */
18 | public function inflectPackageVars($vars)
19 | {
20 | $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
21 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
22 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
23 |
24 | return $vars;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php:
--------------------------------------------------------------------------------
1 | 'libraries/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php:
--------------------------------------------------------------------------------
1 | 'packages/{$vendor}/{$name}/',
8 | 'theme' => 'public/themes/{$name}/',
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php:
--------------------------------------------------------------------------------
1 | 'libraries/{$name}/',
8 | 'source' => 'libraries/_source/{$name}/',
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php:
--------------------------------------------------------------------------------
1 | 'assets/snippets/{$name}/',
11 | 'plugin' => 'assets/plugins/{$name}/',
12 | 'module' => 'assets/modules/{$name}/',
13 | 'template' => 'assets/templates/{$name}/',
14 | 'lib' => 'assets/lib/{$name}/'
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php:
--------------------------------------------------------------------------------
1 | 'app/design/frontend/{$name}/',
8 | 'skin' => 'skin/frontend/default/{$name}/',
9 | 'library' => 'lib/{$name}/',
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MajimaInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
12 | );
13 |
14 | /**
15 | * Transforms the names
16 | * @param array $vars
17 | * @return array
18 | */
19 | public function inflectPackageVars($vars)
20 | {
21 | return $this->correctPluginName($vars);
22 | }
23 |
24 | /**
25 | * Change hyphenated names to camelcase
26 | * @param array $vars
27 | * @return array
28 | */
29 | private function correctPluginName($vars)
30 | {
31 | $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
32 | return strtoupper($matches[0][1]);
33 | }, $vars['name']);
34 | $vars['name'] = ucfirst($camelCasedName);
35 | return $vars;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php:
--------------------------------------------------------------------------------
1 | 'app/packages/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MantisBTInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
10 | );
11 |
12 | /**
13 | * Format package name to CamelCase
14 | */
15 | public function inflectPackageVars($vars)
16 | {
17 | $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
18 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
19 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
20 |
21 | return $vars;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MauticInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
10 | 'theme' => 'themes/{$name}/',
11 | 'core' => 'app/',
12 | );
13 |
14 | private function getDirectoryName()
15 | {
16 | $extra = $this->package->getExtra();
17 | if (!empty($extra['install-directory-name'])) {
18 | return $extra['install-directory-name'];
19 | }
20 |
21 | return $this->toCamelCase($this->package->getPrettyName());
22 | }
23 |
24 | /**
25 | * @param string $packageName
26 | *
27 | * @return string
28 | */
29 | private function toCamelCase($packageName)
30 | {
31 | return str_replace(' ', '', ucwords(str_replace('-', ' ', basename($packageName))));
32 | }
33 |
34 | /**
35 | * Format package name of mautic-plugins to CamelCase
36 | */
37 | public function inflectPackageVars($vars)
38 | {
39 |
40 | if ($vars['type'] == 'mautic-plugin' || $vars['type'] == 'mautic-theme') {
41 | $directoryName = $this->getDirectoryName();
42 | $vars['name'] = $directoryName;
43 | }
44 |
45 | return $vars;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MayaInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$name}/',
8 | );
9 |
10 | /**
11 | * Format package name.
12 | *
13 | * For package type maya-module, cut off a trailing '-module' if present.
14 | *
15 | */
16 | public function inflectPackageVars($vars)
17 | {
18 | if ($vars['type'] === 'maya-module') {
19 | return $this->inflectModuleVars($vars);
20 | }
21 |
22 | return $vars;
23 | }
24 |
25 | protected function inflectModuleVars($vars)
26 | {
27 | $vars['name'] = preg_replace('/-module$/', '', $vars['name']);
28 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
29 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
30 |
31 | return $vars;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php:
--------------------------------------------------------------------------------
1 | 'core/',
8 | 'extension' => 'extensions/{$name}/',
9 | 'skin' => 'skins/{$name}/',
10 | );
11 |
12 | /**
13 | * Format package name.
14 | *
15 | * For package type mediawiki-extension, cut off a trailing '-extension' if present and transform
16 | * to CamelCase keeping existing uppercase chars.
17 | *
18 | * For package type mediawiki-skin, cut off a trailing '-skin' if present.
19 | *
20 | */
21 | public function inflectPackageVars($vars)
22 | {
23 |
24 | if ($vars['type'] === 'mediawiki-extension') {
25 | return $this->inflectExtensionVars($vars);
26 | }
27 |
28 | if ($vars['type'] === 'mediawiki-skin') {
29 | return $this->inflectSkinVars($vars);
30 | }
31 |
32 | return $vars;
33 | }
34 |
35 | protected function inflectExtensionVars($vars)
36 | {
37 | $vars['name'] = preg_replace('/-extension$/', '', $vars['name']);
38 | $vars['name'] = str_replace('-', ' ', $vars['name']);
39 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
40 |
41 | return $vars;
42 | }
43 |
44 | protected function inflectSkinVars($vars)
45 | {
46 | $vars['name'] = preg_replace('/-skin$/', '', $vars['name']);
47 |
48 | return $vars;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MiaoxingInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php:
--------------------------------------------------------------------------------
1 | 'userfiles/modules/{$install_item_dir}/',
8 | 'module-skin' => 'userfiles/modules/{$install_item_dir}/templates/',
9 | 'template' => 'userfiles/templates/{$install_item_dir}/',
10 | 'element' => 'userfiles/elements/{$install_item_dir}/',
11 | 'vendor' => 'vendor/{$install_item_dir}/',
12 | 'components' => 'components/{$install_item_dir}/'
13 | );
14 |
15 | /**
16 | * Format package name.
17 | *
18 | * For package type microweber-module, cut off a trailing '-module' if present
19 | *
20 | * For package type microweber-template, cut off a trailing '-template' if present.
21 | *
22 | */
23 | public function inflectPackageVars($vars)
24 | {
25 |
26 |
27 | if ($this->package->getTargetDir()) {
28 | $vars['install_item_dir'] = $this->package->getTargetDir();
29 | } else {
30 | $vars['install_item_dir'] = $vars['name'];
31 | if ($vars['type'] === 'microweber-template') {
32 | return $this->inflectTemplateVars($vars);
33 | }
34 | if ($vars['type'] === 'microweber-templates') {
35 | return $this->inflectTemplatesVars($vars);
36 | }
37 | if ($vars['type'] === 'microweber-core') {
38 | return $this->inflectCoreVars($vars);
39 | }
40 | if ($vars['type'] === 'microweber-adapter') {
41 | return $this->inflectCoreVars($vars);
42 | }
43 | if ($vars['type'] === 'microweber-module') {
44 | return $this->inflectModuleVars($vars);
45 | }
46 | if ($vars['type'] === 'microweber-modules') {
47 | return $this->inflectModulesVars($vars);
48 | }
49 | if ($vars['type'] === 'microweber-skin') {
50 | return $this->inflectSkinVars($vars);
51 | }
52 | if ($vars['type'] === 'microweber-element' or $vars['type'] === 'microweber-elements') {
53 | return $this->inflectElementVars($vars);
54 | }
55 | }
56 |
57 |
58 | return $vars;
59 | }
60 |
61 | protected function inflectTemplateVars($vars)
62 | {
63 | $vars['install_item_dir'] = preg_replace('/-template$/', '', $vars['install_item_dir']);
64 | $vars['install_item_dir'] = preg_replace('/template-$/', '', $vars['install_item_dir']);
65 |
66 | return $vars;
67 | }
68 |
69 | protected function inflectTemplatesVars($vars)
70 | {
71 | $vars['install_item_dir'] = preg_replace('/-templates$/', '', $vars['install_item_dir']);
72 | $vars['install_item_dir'] = preg_replace('/templates-$/', '', $vars['install_item_dir']);
73 |
74 | return $vars;
75 | }
76 |
77 | protected function inflectCoreVars($vars)
78 | {
79 | $vars['install_item_dir'] = preg_replace('/-providers$/', '', $vars['install_item_dir']);
80 | $vars['install_item_dir'] = preg_replace('/-provider$/', '', $vars['install_item_dir']);
81 | $vars['install_item_dir'] = preg_replace('/-adapter$/', '', $vars['install_item_dir']);
82 |
83 | return $vars;
84 | }
85 |
86 | protected function inflectModuleVars($vars)
87 | {
88 | $vars['install_item_dir'] = preg_replace('/-module$/', '', $vars['install_item_dir']);
89 | $vars['install_item_dir'] = preg_replace('/module-$/', '', $vars['install_item_dir']);
90 |
91 | return $vars;
92 | }
93 |
94 | protected function inflectModulesVars($vars)
95 | {
96 | $vars['install_item_dir'] = preg_replace('/-modules$/', '', $vars['install_item_dir']);
97 | $vars['install_item_dir'] = preg_replace('/modules-$/', '', $vars['install_item_dir']);
98 |
99 | return $vars;
100 | }
101 |
102 | protected function inflectSkinVars($vars)
103 | {
104 | $vars['install_item_dir'] = preg_replace('/-skin$/', '', $vars['install_item_dir']);
105 | $vars['install_item_dir'] = preg_replace('/skin-$/', '', $vars['install_item_dir']);
106 |
107 | return $vars;
108 | }
109 |
110 | protected function inflectElementVars($vars)
111 | {
112 | $vars['install_item_dir'] = preg_replace('/-elements$/', '', $vars['install_item_dir']);
113 | $vars['install_item_dir'] = preg_replace('/elements-$/', '', $vars['install_item_dir']);
114 | $vars['install_item_dir'] = preg_replace('/-element$/', '', $vars['install_item_dir']);
115 | $vars['install_item_dir'] = preg_replace('/element-$/', '', $vars['install_item_dir']);
116 |
117 | return $vars;
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ModxInstaller.php:
--------------------------------------------------------------------------------
1 | 'core/packages/{$name}/'
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php:
--------------------------------------------------------------------------------
1 | 'mod/{$name}/',
8 | 'admin_report' => 'admin/report/{$name}/',
9 | 'atto' => 'lib/editor/atto/plugins/{$name}/',
10 | 'tool' => 'admin/tool/{$name}/',
11 | 'assignment' => 'mod/assignment/type/{$name}/',
12 | 'assignsubmission' => 'mod/assign/submission/{$name}/',
13 | 'assignfeedback' => 'mod/assign/feedback/{$name}/',
14 | 'auth' => 'auth/{$name}/',
15 | 'availability' => 'availability/condition/{$name}/',
16 | 'block' => 'blocks/{$name}/',
17 | 'booktool' => 'mod/book/tool/{$name}/',
18 | 'cachestore' => 'cache/stores/{$name}/',
19 | 'cachelock' => 'cache/locks/{$name}/',
20 | 'calendartype' => 'calendar/type/{$name}/',
21 | 'fileconverter' => 'files/converter/{$name}/',
22 | 'format' => 'course/format/{$name}/',
23 | 'coursereport' => 'course/report/{$name}/',
24 | 'customcertelement' => 'mod/customcert/element/{$name}/',
25 | 'datafield' => 'mod/data/field/{$name}/',
26 | 'datapreset' => 'mod/data/preset/{$name}/',
27 | 'editor' => 'lib/editor/{$name}/',
28 | 'enrol' => 'enrol/{$name}/',
29 | 'filter' => 'filter/{$name}/',
30 | 'gradeexport' => 'grade/export/{$name}/',
31 | 'gradeimport' => 'grade/import/{$name}/',
32 | 'gradereport' => 'grade/report/{$name}/',
33 | 'gradingform' => 'grade/grading/form/{$name}/',
34 | 'local' => 'local/{$name}/',
35 | 'logstore' => 'admin/tool/log/store/{$name}/',
36 | 'ltisource' => 'mod/lti/source/{$name}/',
37 | 'ltiservice' => 'mod/lti/service/{$name}/',
38 | 'message' => 'message/output/{$name}/',
39 | 'mnetservice' => 'mnet/service/{$name}/',
40 | 'plagiarism' => 'plagiarism/{$name}/',
41 | 'portfolio' => 'portfolio/{$name}/',
42 | 'qbehaviour' => 'question/behaviour/{$name}/',
43 | 'qformat' => 'question/format/{$name}/',
44 | 'qtype' => 'question/type/{$name}/',
45 | 'quizaccess' => 'mod/quiz/accessrule/{$name}/',
46 | 'quiz' => 'mod/quiz/report/{$name}/',
47 | 'report' => 'report/{$name}/',
48 | 'repository' => 'repository/{$name}/',
49 | 'scormreport' => 'mod/scorm/report/{$name}/',
50 | 'search' => 'search/engine/{$name}/',
51 | 'theme' => 'theme/{$name}/',
52 | 'tinymce' => 'lib/editor/tinymce/plugins/{$name}/',
53 | 'profilefield' => 'user/profile/field/{$name}/',
54 | 'webservice' => 'webservice/{$name}/',
55 | 'workshopallocation' => 'mod/workshop/allocation/{$name}/',
56 | 'workshopeval' => 'mod/workshop/eval/{$name}/',
57 | 'workshopform' => 'mod/workshop/form/{$name}/'
58 | );
59 | }
60 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$name}/',
8 | 'plugin' => 'plugins/{$vendor}/{$name}/',
9 | 'theme' => 'themes/{$vendor}-{$name}/'
10 | );
11 |
12 | /**
13 | * Format package name.
14 | *
15 | * For package type october-plugin, cut off a trailing '-plugin' if present.
16 | *
17 | * For package type october-theme, cut off a trailing '-theme' if present.
18 | *
19 | */
20 | public function inflectPackageVars($vars)
21 | {
22 | if ($vars['type'] === 'october-plugin') {
23 | return $this->inflectPluginVars($vars);
24 | }
25 |
26 | if ($vars['type'] === 'october-theme') {
27 | return $this->inflectThemeVars($vars);
28 | }
29 |
30 | return $vars;
31 | }
32 |
33 | protected function inflectPluginVars($vars)
34 | {
35 | $vars['name'] = preg_replace('/^oc-|-plugin$/', '', $vars['name']);
36 | $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
37 |
38 | return $vars;
39 | }
40 |
41 | protected function inflectThemeVars($vars)
42 | {
43 | $vars['name'] = preg_replace('/^oc-|-theme$/', '', $vars['name']);
44 | $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
45 |
46 | return $vars;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/OntoWikiInstaller.php:
--------------------------------------------------------------------------------
1 | 'extensions/{$name}/',
8 | 'theme' => 'extensions/themes/{$name}/',
9 | 'translation' => 'extensions/translations/{$name}/',
10 | );
11 |
12 | /**
13 | * Format package name to lower case and remove ".ontowiki" suffix
14 | */
15 | public function inflectPackageVars($vars)
16 | {
17 | $vars['name'] = strtolower($vars['name']);
18 | $vars['name'] = preg_replace('/.ontowiki$/', '', $vars['name']);
19 | $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
20 | $vars['name'] = preg_replace('/-translation$/', '', $vars['name']);
21 |
22 | return $vars;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php:
--------------------------------------------------------------------------------
1 | 'oc-content/plugins/{$name}/',
10 | 'theme' => 'oc-content/themes/{$name}/',
11 | 'language' => 'oc-content/languages/{$name}/',
12 | );
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php:
--------------------------------------------------------------------------------
1 | .+)\/.+/';
9 |
10 | protected $locations = array(
11 | 'module' => 'modules/{$name}/',
12 | 'theme' => 'application/views/{$name}/',
13 | 'out' => 'out/{$name}/',
14 | );
15 |
16 | /**
17 | * getInstallPath
18 | *
19 | * @param PackageInterface $package
20 | * @param string $frameworkType
21 | * @return string
22 | */
23 | public function getInstallPath(PackageInterface $package, $frameworkType = '')
24 | {
25 | $installPath = parent::getInstallPath($package, $frameworkType);
26 | $type = $this->package->getType();
27 | if ($type === 'oxid-module') {
28 | $this->prepareVendorDirectory($installPath);
29 | }
30 | return $installPath;
31 | }
32 |
33 | /**
34 | * prepareVendorDirectory
35 | *
36 | * Makes sure there is a vendormetadata.php file inside
37 | * the vendor folder if there is a vendor folder.
38 | *
39 | * @param string $installPath
40 | * @return void
41 | */
42 | protected function prepareVendorDirectory($installPath)
43 | {
44 | $matches = '';
45 | $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46 | if (!$hasVendorDirectory) {
47 | return;
48 | }
49 |
50 | $vendorDirectory = $matches['vendor'];
51 | $vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52 | if (!file_exists($vendorPath)) {
53 | mkdir($vendorPath, 0755, true);
54 | }
55 |
56 | $vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57 | touch($vendorMetaDataPath);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PantheonInstaller.php:
--------------------------------------------------------------------------------
1 | */
8 | protected $locations = array(
9 | 'script' => 'web/private/scripts/quicksilver/{$name}',
10 | 'module' => 'web/private/scripts/quicksilver/{$name}',
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php:
--------------------------------------------------------------------------------
1 | 'bundles/{$name}/',
8 | 'library' => 'libraries/{$name}/',
9 | 'framework' => 'frameworks/{$name}/',
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php:
--------------------------------------------------------------------------------
1 | 'ext/{$vendor}/{$name}/',
8 | 'language' => 'language/{$name}/',
9 | 'style' => 'styles/{$name}/',
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
8 | );
9 |
10 | /**
11 | * Format package name to CamelCase
12 | */
13 | public function inflectPackageVars($vars)
14 | {
15 | $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
16 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
17 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
18 |
19 | return $vars;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
16 | );
17 |
18 | /**
19 | * Format package name to CamelCase
20 | * @param array $vars
21 | *
22 | * @return array
23 | */
24 | public function inflectPackageVars($vars)
25 | {
26 | $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
27 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
28 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
29 |
30 | return $vars;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php:
--------------------------------------------------------------------------------
1 | '{$name}/'
8 | );
9 |
10 | /**
11 | * Remove hyphen, "plugin" and format to camelcase
12 | * @param array $vars
13 | *
14 | * @return array
15 | */
16 | public function inflectPackageVars($vars)
17 | {
18 | $vars['name'] = explode("-", $vars['name']);
19 | foreach ($vars['name'] as $key => $name) {
20 | $vars['name'][$key] = ucfirst($vars['name'][$key]);
21 | if (strcasecmp($name, "Plugin") == 0) {
22 | unset($vars['name'][$key]);
23 | }
24 | }
25 | $vars['name'] = implode("",$vars['name']);
26 |
27 | return $vars;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/Plugin.php:
--------------------------------------------------------------------------------
1 | installer = new Installer($io, $composer);
16 | $composer->getInstallationManager()->addInstaller($this->installer);
17 | }
18 |
19 | public function deactivate(Composer $composer, IOInterface $io)
20 | {
21 | $composer->getInstallationManager()->removeInstaller($this->installer);
22 | }
23 |
24 | public function uninstall(Composer $composer, IOInterface $io)
25 | {
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PortoInstaller.php:
--------------------------------------------------------------------------------
1 | 'app/Containers/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$name}/',
8 | 'theme' => 'themes/{$name}/',
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ProcessWireInstaller.php:
--------------------------------------------------------------------------------
1 | 'site/modules/{$name}/',
9 | );
10 |
11 | /**
12 | * Format package name to CamelCase
13 | */
14 | public function inflectPackageVars($vars)
15 | {
16 | $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
17 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
18 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
19 |
20 | return $vars;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$name}/',
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php:
--------------------------------------------------------------------------------
1 | 'app/Modules/{$name}/',
8 | 'theme' => 'themes/{$name}/',
9 | );
10 |
11 | /**
12 | * Format package name.
13 | *
14 | * @param array $vars
15 | *
16 | * @return array
17 | */
18 | public function inflectPackageVars($vars)
19 | {
20 | if ($vars['type'] === 'pxcms-module') {
21 | return $this->inflectModuleVars($vars);
22 | }
23 |
24 | if ($vars['type'] === 'pxcms-theme') {
25 | return $this->inflectThemeVars($vars);
26 | }
27 |
28 | return $vars;
29 | }
30 |
31 | /**
32 | * For package type pxcms-module, cut off a trailing '-plugin' if present.
33 | *
34 | * return string
35 | */
36 | protected function inflectModuleVars($vars)
37 | {
38 | $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
39 | $vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
40 | $vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
41 | $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
42 | $vars['name'] = ucwords($vars['name']); // make module name camelcased
43 |
44 | return $vars;
45 | }
46 |
47 |
48 | /**
49 | * For package type pxcms-module, cut off a trailing '-plugin' if present.
50 | *
51 | * return string
52 | */
53 | protected function inflectThemeVars($vars)
54 | {
55 | $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
56 | $vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
57 | $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
58 | $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
59 | $vars['name'] = ucwords($vars['name']); // make module name camelcased
60 |
61 | return $vars;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/RadPHPInstaller.php:
--------------------------------------------------------------------------------
1 | 'src/{$name}/'
8 | );
9 |
10 | /**
11 | * Format package name to CamelCase
12 | */
13 | public function inflectPackageVars($vars)
14 | {
15 | $nameParts = explode('/', $vars['name']);
16 | foreach ($nameParts as &$value) {
17 | $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
18 | $value = str_replace(array('-', '_'), ' ', $value);
19 | $value = str_replace(' ', '', ucwords($value));
20 | }
21 | $vars['name'] = implode('/', $nameParts);
22 | return $vars;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php:
--------------------------------------------------------------------------------
1 | 'themes/{$name}/',
8 | 'plugin' => 'plugins/{$name}/'
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/Redaxo5Installer.php:
--------------------------------------------------------------------------------
1 | 'redaxo/src/addons/{$name}/',
8 | 'bestyle-plugin' => 'redaxo/src/addons/be_style/plugins/{$name}/'
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php:
--------------------------------------------------------------------------------
1 | 'redaxo/include/addons/{$name}/',
8 | 'bestyle-plugin' => 'redaxo/include/addons/be_style/plugins/{$name}/'
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
8 | );
9 |
10 | /**
11 | * Lowercase name and changes the name to a underscores
12 | *
13 | * @param array $vars
14 | * @return array
15 | */
16 | public function inflectPackageVars($vars)
17 | {
18 | $vars['name'] = strtolower(str_replace('-', '_', $vars['name']));
19 |
20 | return $vars;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php:
--------------------------------------------------------------------------------
1 | 'Sources/{$name}/',
8 | 'theme' => 'Themes/{$name}/',
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php:
--------------------------------------------------------------------------------
1 | 'engine/Shopware/Plugins/Local/Backend/{$name}/',
12 | 'core-plugin' => 'engine/Shopware/Plugins/Local/Core/{$name}/',
13 | 'frontend-plugin' => 'engine/Shopware/Plugins/Local/Frontend/{$name}/',
14 | 'theme' => 'templates/{$name}/',
15 | 'plugin' => 'custom/plugins/{$name}/',
16 | 'frontend-theme' => 'themes/Frontend/{$name}/',
17 | );
18 |
19 | /**
20 | * Transforms the names
21 | * @param array $vars
22 | * @return array
23 | */
24 | public function inflectPackageVars($vars)
25 | {
26 | if ($vars['type'] === 'shopware-theme') {
27 | return $this->correctThemeName($vars);
28 | }
29 |
30 | return $this->correctPluginName($vars);
31 | }
32 |
33 | /**
34 | * Changes the name to a camelcased combination of vendor and name
35 | * @param array $vars
36 | * @return array
37 | */
38 | private function correctPluginName($vars)
39 | {
40 | $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
41 | return strtoupper($matches[0][1]);
42 | }, $vars['name']);
43 |
44 | $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName);
45 |
46 | return $vars;
47 | }
48 |
49 | /**
50 | * Changes the name to a underscore separated name
51 | * @param array $vars
52 | * @return array
53 | */
54 | private function correctThemeName($vars)
55 | {
56 | $vars['name'] = str_replace('-', '_', $vars['name']);
57 |
58 | return $vars;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php:
--------------------------------------------------------------------------------
1 | '{$name}/',
10 | 'theme' => 'themes/{$name}/',
11 | );
12 |
13 | /**
14 | * Return the install path based on package type.
15 | *
16 | * Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework
17 | * must be installed to 'sapphire' and not 'framework' if the version is <3.0.0
18 | *
19 | * @param PackageInterface $package
20 | * @param string $frameworkType
21 | * @return string
22 | */
23 | public function getInstallPath(PackageInterface $package, $frameworkType = '')
24 | {
25 | if (
26 | $package->getName() == 'silverstripe/framework'
27 | && preg_match('/^\d+\.\d+\.\d+/', $package->getVersion())
28 | && version_compare($package->getVersion(), '2.999.999') < 0
29 | ) {
30 | return $this->templatePath($this->locations['module'], array('name' => 'sapphire'));
31 | }
32 |
33 | return parent::getInstallPath($package, $frameworkType);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/SiteDirectInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$vendor}/{$name}/',
9 | 'plugin' => 'plugins/{$vendor}/{$name}/'
10 | );
11 |
12 | public function inflectPackageVars($vars)
13 | {
14 | return $this->parseVars($vars);
15 | }
16 |
17 | protected function parseVars($vars)
18 | {
19 | $vars['vendor'] = strtolower($vars['vendor']) == 'sitedirect' ? 'SiteDirect' : $vars['vendor'];
20 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
21 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
22 |
23 | return $vars;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/StarbugInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$name}/',
8 | 'theme' => 'themes/{$name}/',
9 | 'custom-module' => 'app/modules/{$name}/',
10 | 'custom-theme' => 'app/themes/{$name}/'
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/SyDESInstaller.php:
--------------------------------------------------------------------------------
1 | 'app/modules/{$name}/',
8 | 'theme' => 'themes/{$name}/',
9 | );
10 |
11 | /**
12 | * Format module name.
13 | *
14 | * Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.
15 | *
16 | * {@inerhitDoc}
17 | */
18 | public function inflectPackageVars($vars)
19 | {
20 | if ($vars['type'] == 'sydes-module') {
21 | return $this->inflectModuleVars($vars);
22 | }
23 |
24 | if ($vars['type'] === 'sydes-theme') {
25 | return $this->inflectThemeVars($vars);
26 | }
27 |
28 | return $vars;
29 | }
30 |
31 | public function inflectModuleVars($vars)
32 | {
33 | $vars['name'] = preg_replace('/(^sydes-|-module$)/i', '', $vars['name']);
34 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
35 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
36 |
37 | return $vars;
38 | }
39 |
40 | protected function inflectThemeVars($vars)
41 | {
42 | $vars['name'] = preg_replace('/(^sydes-|-theme$)/', '', $vars['name']);
43 | $vars['name'] = strtolower($vars['name']);
44 |
45 | return $vars;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/SyliusInstaller.php:
--------------------------------------------------------------------------------
1 | 'themes/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 | class Symfony1Installer extends BaseInstaller
10 | {
11 | protected $locations = array(
12 | 'plugin' => 'plugins/{$name}/',
13 | );
14 |
15 | /**
16 | * Format package name to CamelCase
17 | */
18 | public function inflectPackageVars($vars)
19 | {
20 | $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
21 | return strtoupper($matches[0][1]);
22 | }, $vars['name']);
23 |
24 | return $vars;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class TYPO3CmsInstaller extends BaseInstaller
12 | {
13 | protected $locations = array(
14 | 'extension' => 'typo3conf/ext/{$name}/',
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php:
--------------------------------------------------------------------------------
1 | 'Packages/Application/{$name}/',
11 | 'framework' => 'Packages/Framework/{$name}/',
12 | 'plugin' => 'Packages/Plugins/{$name}/',
13 | 'site' => 'Packages/Sites/{$name}/',
14 | 'boilerplate' => 'Packages/Boilerplates/{$name}/',
15 | 'build' => 'Build/{$name}/',
16 | );
17 |
18 | /**
19 | * Modify the package name to be a TYPO3 Flow style key.
20 | *
21 | * @param array $vars
22 | * @return array
23 | */
24 | public function inflectPackageVars($vars)
25 | {
26 | $autoload = $this->package->getAutoload();
27 | if (isset($autoload['psr-0']) && is_array($autoload['psr-0'])) {
28 | $namespace = key($autoload['psr-0']);
29 | $vars['name'] = str_replace('\\', '.', $namespace);
30 | }
31 | if (isset($autoload['psr-4']) && is_array($autoload['psr-4'])) {
32 | $namespace = key($autoload['psr-4']);
33 | $vars['name'] = rtrim(str_replace('\\', '.', $namespace), '.');
34 | }
35 |
36 | return $vars;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/TaoInstaller.php:
--------------------------------------------------------------------------------
1 | '{$name}'
13 | );
14 |
15 | public function inflectPackageVars($vars)
16 | {
17 | $extra = $this->package->getExtra();
18 |
19 | if (array_key_exists(self::EXTRA_TAO_EXTENSION_NAME, $extra)) {
20 | $vars['name'] = $extra[self::EXTRA_TAO_EXTENSION_NAME];
21 | return $vars;
22 | }
23 |
24 | $vars['name'] = str_replace('extension-', '', $vars['name']);
25 | $vars['name'] = str_replace('-', ' ', $vars['name']);
26 | $vars['name'] = lcfirst(str_replace(' ', '', ucwords($vars['name'])));
27 |
28 | return $vars;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/TastyIgniterInstaller.php:
--------------------------------------------------------------------------------
1 | 'extensions/{$vendor}/{$name}/',
9 | 'theme' => 'themes/{$name}/',
10 | );
11 |
12 | /**
13 | * Format package name.
14 | *
15 | * Cut off leading 'ti-ext-' or 'ti-theme-' if present.
16 | * Strip vendor name of characters that is not alphanumeric or an underscore
17 | *
18 | */
19 | public function inflectPackageVars($vars)
20 | {
21 | if ($vars['type'] === 'tastyigniter-extension') {
22 | $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
23 | $vars['name'] = preg_replace('/^ti-ext-/', '', $vars['name']);
24 | }
25 |
26 | if ($vars['type'] === 'tastyigniter-theme') {
27 | $vars['name'] = preg_replace('/^ti-theme-/', '', $vars['name']);
28 | }
29 |
30 | return $vars;
31 | }
32 | }
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php:
--------------------------------------------------------------------------------
1 | 'local/modules/{$name}/',
8 | 'frontoffice-template' => 'templates/frontOffice/{$name}/',
9 | 'backoffice-template' => 'templates/backOffice/{$name}/',
10 | 'email-template' => 'templates/email/{$name}/',
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php:
--------------------------------------------------------------------------------
1 |
6 | */
7 | class TuskInstaller extends BaseInstaller
8 | {
9 | protected $locations = array(
10 | 'task' => '.tusk/tasks/{$name}/',
11 | 'command' => '.tusk/commands/{$name}/',
12 | 'asset' => 'assets/tusk/{$name}/',
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/UserFrostingInstaller.php:
--------------------------------------------------------------------------------
1 | 'app/sprinkles/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php:
--------------------------------------------------------------------------------
1 | 'plugins/{$name}/',
8 | 'theme' => 'themes/{$name}/',
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php:
--------------------------------------------------------------------------------
1 | 'src/{$vendor}/{$name}/',
8 | 'theme' => 'themes/{$name}/'
9 | );
10 |
11 | /**
12 | * Format package name.
13 | *
14 | * For package type vgmcp-bundle, cut off a trailing '-bundle' if present.
15 | *
16 | * For package type vgmcp-theme, cut off a trailing '-theme' if present.
17 | *
18 | */
19 | public function inflectPackageVars($vars)
20 | {
21 | if ($vars['type'] === 'vgmcp-bundle') {
22 | return $this->inflectPluginVars($vars);
23 | }
24 |
25 | if ($vars['type'] === 'vgmcp-theme') {
26 | return $this->inflectThemeVars($vars);
27 | }
28 |
29 | return $vars;
30 | }
31 |
32 | protected function inflectPluginVars($vars)
33 | {
34 | $vars['name'] = preg_replace('/-bundle$/', '', $vars['name']);
35 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
36 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
37 |
38 | return $vars;
39 | }
40 |
41 | protected function inflectThemeVars($vars)
42 | {
43 | $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
44 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
45 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
46 |
47 | return $vars;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/addons/{$vendor}_{$name}/',
9 | 'fraud' => 'modules/fraud/{$vendor}_{$name}/',
10 | 'gateways' => 'modules/gateways/{$vendor}_{$name}/',
11 | 'notifications' => 'modules/notifications/{$vendor}_{$name}/',
12 | 'registrars' => 'modules/registrars/{$vendor}_{$name}/',
13 | 'reports' => 'modules/reports/{$vendor}_{$name}/',
14 | 'security' => 'modules/security/{$vendor}_{$name}/',
15 | 'servers' => 'modules/servers/{$vendor}_{$name}/',
16 | 'social' => 'modules/social/{$vendor}_{$name}/',
17 | 'support' => 'modules/support/{$vendor}_{$name}/',
18 | 'templates' => 'templates/{$vendor}_{$name}/',
19 | 'includes' => 'includes/{$vendor}_{$name}/'
20 | );
21 | }
22 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/WinterInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$name}/',
8 | 'plugin' => 'plugins/{$vendor}/{$name}/',
9 | 'theme' => 'themes/{$name}/'
10 | );
11 |
12 | /**
13 | * Format package name.
14 | *
15 | * For package type winter-plugin, cut off a trailing '-plugin' if present.
16 | *
17 | * For package type winter-theme, cut off a trailing '-theme' if present.
18 | *
19 | */
20 | public function inflectPackageVars($vars)
21 | {
22 | if ($vars['type'] === 'winter-module') {
23 | return $this->inflectModuleVars($vars);
24 | }
25 |
26 | if ($vars['type'] === 'winter-plugin') {
27 | return $this->inflectPluginVars($vars);
28 | }
29 |
30 | if ($vars['type'] === 'winter-theme') {
31 | return $this->inflectThemeVars($vars);
32 | }
33 |
34 | return $vars;
35 | }
36 |
37 | protected function inflectModuleVars($vars)
38 | {
39 | $vars['name'] = preg_replace('/^wn-|-module$/', '', $vars['name']);
40 |
41 | return $vars;
42 | }
43 |
44 | protected function inflectPluginVars($vars)
45 | {
46 | $vars['name'] = preg_replace('/^wn-|-plugin$/', '', $vars['name']);
47 | $vars['vendor'] = preg_replace('/[^a-z0-9_]/i', '', $vars['vendor']);
48 |
49 | return $vars;
50 | }
51 |
52 | protected function inflectThemeVars($vars)
53 | {
54 | $vars['name'] = preg_replace('/^wn-|-theme$/', '', $vars['name']);
55 |
56 | return $vars;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php:
--------------------------------------------------------------------------------
1 | 'wolf/plugins/{$name}/',
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php:
--------------------------------------------------------------------------------
1 | 'wp-content/plugins/{$name}/',
8 | 'theme' => 'wp-content/themes/{$name}/',
9 | 'muplugin' => 'wp-content/mu-plugins/{$name}/',
10 | 'dropin' => 'wp-content/{$name}/',
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php:
--------------------------------------------------------------------------------
1 | 'module/{$name}/',
16 | );
17 |
18 | /**
19 | * Format package name to CamelCase
20 | * @param array $vars
21 | *
22 | * @return array
23 | */
24 | public function inflectPackageVars($vars)
25 | {
26 | $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
27 | $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
28 | $vars['name'] = str_replace(' ', '', ucwords($vars['name']));
29 |
30 | return $vars;
31 | }
32 | }
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php:
--------------------------------------------------------------------------------
1 | 'library/{$name}/',
8 | 'extra' => 'extras/library/{$name}/',
9 | 'module' => 'module/{$name}/',
10 | );
11 | }
12 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php:
--------------------------------------------------------------------------------
1 | 'modules/{$vendor}-{$name}/',
8 | 'theme' => 'themes/{$vendor}-{$name}/'
9 | );
10 | }
11 |
--------------------------------------------------------------------------------
/includes/vendor/composer/installers/src/bootstrap.php:
--------------------------------------------------------------------------------
1 | = 70400)) {
8 | $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
9 | }
10 |
11 | if ($issues) {
12 | if (!headers_sent()) {
13 | header('HTTP/1.1 500 Internal Server Error');
14 | }
15 | if (!ini_get('display_errors')) {
16 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
17 | fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
18 | } elseif (!headers_sent()) {
19 | echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
20 | }
21 | }
22 | trigger_error(
23 | 'Composer detected issues in your platform: ' . implode(' ', $issues),
24 | E_USER_ERROR
25 | );
26 | }
27 |
--------------------------------------------------------------------------------
/includes/vendor/firebase/php-jwt/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## [6.4.0](https://github.com/firebase/php-jwt/compare/v6.3.2...v6.4.0) (2023-02-08)
4 |
5 |
6 | ### Features
7 |
8 | * add support for W3C ES256K ([#462](https://github.com/firebase/php-jwt/issues/462)) ([213924f](https://github.com/firebase/php-jwt/commit/213924f51936291fbbca99158b11bd4ae56c2c95))
9 | * improve caching by only decoding jwks when necessary ([#486](https://github.com/firebase/php-jwt/issues/486)) ([78d3ed1](https://github.com/firebase/php-jwt/commit/78d3ed1073553f7d0bbffa6c2010009a0d483d5c))
10 |
11 | ## [6.3.2](https://github.com/firebase/php-jwt/compare/v6.3.1...v6.3.2) (2022-11-01)
12 |
13 |
14 | ### Bug Fixes
15 |
16 | * check kid before using as array index ([bad1b04](https://github.com/firebase/php-jwt/commit/bad1b040d0c736bbf86814c6b5ae614f517cf7bd))
17 |
18 | ## [6.3.1](https://github.com/firebase/php-jwt/compare/v6.3.0...v6.3.1) (2022-11-01)
19 |
20 |
21 | ### Bug Fixes
22 |
23 | * casing of GET for PSR compat ([#451](https://github.com/firebase/php-jwt/issues/451)) ([60b52b7](https://github.com/firebase/php-jwt/commit/60b52b71978790eafcf3b95cfbd83db0439e8d22))
24 | * string interpolation format for php 8.2 ([#446](https://github.com/firebase/php-jwt/issues/446)) ([2e07d8a](https://github.com/firebase/php-jwt/commit/2e07d8a1524d12b69b110ad649f17461d068b8f2))
25 |
26 | ## 6.3.0 / 2022-07-15
27 |
28 | - Added ES256 support to JWK parsing ([#399](https://github.com/firebase/php-jwt/pull/399))
29 | - Fixed potential caching error in `CachedKeySet` by caching jwks as strings ([#435](https://github.com/firebase/php-jwt/pull/435))
30 |
31 | ## 6.2.0 / 2022-05-14
32 |
33 | - Added `CachedKeySet` ([#397](https://github.com/firebase/php-jwt/pull/397))
34 | - Added `$defaultAlg` parameter to `JWT::parseKey` and `JWT::parseKeySet` ([#426](https://github.com/firebase/php-jwt/pull/426)).
35 |
36 | ## 6.1.0 / 2022-03-23
37 |
38 | - Drop support for PHP 5.3, 5.4, 5.5, 5.6, and 7.0
39 | - Add parameter typing and return types where possible
40 |
41 | ## 6.0.0 / 2022-01-24
42 |
43 | - **Backwards-Compatibility Breaking Changes**: See the [Release Notes](https://github.com/firebase/php-jwt/releases/tag/v6.0.0) for more information.
44 | - New Key object to prevent key/algorithm type confusion (#365)
45 | - Add JWK support (#273)
46 | - Add ES256 support (#256)
47 | - Add ES384 support (#324)
48 | - Add Ed25519 support (#343)
49 |
50 | ## 5.0.0 / 2017-06-26
51 | - Support RS384 and RS512.
52 | See [#117](https://github.com/firebase/php-jwt/pull/117). Thanks [@joostfaassen](https://github.com/joostfaassen)!
53 | - Add an example for RS256 openssl.
54 | See [#125](https://github.com/firebase/php-jwt/pull/125). Thanks [@akeeman](https://github.com/akeeman)!
55 | - Detect invalid Base64 encoding in signature.
56 | See [#162](https://github.com/firebase/php-jwt/pull/162). Thanks [@psignoret](https://github.com/psignoret)!
57 | - Update `JWT::verify` to handle OpenSSL errors.
58 | See [#159](https://github.com/firebase/php-jwt/pull/159). Thanks [@bshaffer](https://github.com/bshaffer)!
59 | - Add `array` type hinting to `decode` method
60 | See [#101](https://github.com/firebase/php-jwt/pull/101). Thanks [@hywak](https://github.com/hywak)!
61 | - Add all JSON error types.
62 | See [#110](https://github.com/firebase/php-jwt/pull/110). Thanks [@gbalduzzi](https://github.com/gbalduzzi)!
63 | - Bugfix 'kid' not in given key list.
64 | See [#129](https://github.com/firebase/php-jwt/pull/129). Thanks [@stampycode](https://github.com/stampycode)!
65 | - Miscellaneous cleanup, documentation and test fixes.
66 | See [#107](https://github.com/firebase/php-jwt/pull/107), [#115](https://github.com/firebase/php-jwt/pull/115),
67 | [#160](https://github.com/firebase/php-jwt/pull/160), [#161](https://github.com/firebase/php-jwt/pull/161), and
68 | [#165](https://github.com/firebase/php-jwt/pull/165). Thanks [@akeeman](https://github.com/akeeman),
69 | [@chinedufn](https://github.com/chinedufn), and [@bshaffer](https://github.com/bshaffer)!
70 |
71 | ## 4.0.0 / 2016-07-17
72 | - Add support for late static binding. See [#88](https://github.com/firebase/php-jwt/pull/88) for details. Thanks to [@chappy84](https://github.com/chappy84)!
73 | - Use static `$timestamp` instead of `time()` to improve unit testing. See [#93](https://github.com/firebase/php-jwt/pull/93) for details. Thanks to [@josephmcdermott](https://github.com/josephmcdermott)!
74 | - Fixes to exceptions classes. See [#81](https://github.com/firebase/php-jwt/pull/81) for details. Thanks to [@Maks3w](https://github.com/Maks3w)!
75 | - Fixes to PHPDoc. See [#76](https://github.com/firebase/php-jwt/pull/76) for details. Thanks to [@akeeman](https://github.com/akeeman)!
76 |
77 | ## 3.0.0 / 2015-07-22
78 | - Minimum PHP version updated from `5.2.0` to `5.3.0`.
79 | - Add `\Firebase\JWT` namespace. See
80 | [#59](https://github.com/firebase/php-jwt/pull/59) for details. Thanks to
81 | [@Dashron](https://github.com/Dashron)!
82 | - Require a non-empty key to decode and verify a JWT. See
83 | [#60](https://github.com/firebase/php-jwt/pull/60) for details. Thanks to
84 | [@sjones608](https://github.com/sjones608)!
85 | - Cleaner documentation blocks in the code. See
86 | [#62](https://github.com/firebase/php-jwt/pull/62) for details. Thanks to
87 | [@johanderuijter](https://github.com/johanderuijter)!
88 |
89 | ## 2.2.0 / 2015-06-22
90 | - Add support for adding custom, optional JWT headers to `JWT::encode()`. See
91 | [#53](https://github.com/firebase/php-jwt/pull/53/files) for details. Thanks to
92 | [@mcocaro](https://github.com/mcocaro)!
93 |
94 | ## 2.1.0 / 2015-05-20
95 | - Add support for adding a leeway to `JWT:decode()` that accounts for clock skew
96 | between signing and verifying entities. Thanks to [@lcabral](https://github.com/lcabral)!
97 | - Add support for passing an object implementing the `ArrayAccess` interface for
98 | `$keys` argument in `JWT::decode()`. Thanks to [@aztech-dev](https://github.com/aztech-dev)!
99 |
100 | ## 2.0.0 / 2015-04-01
101 | - **Note**: It is strongly recommended that you update to > v2.0.0 to address
102 | known security vulnerabilities in prior versions when both symmetric and
103 | asymmetric keys are used together.
104 | - Update signature for `JWT::decode(...)` to require an array of supported
105 | algorithms to use when verifying token signatures.
106 |
--------------------------------------------------------------------------------
/includes/vendor/firebase/php-jwt/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011, Neuman Vong
2 |
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above
12 | copyright notice, this list of conditions and the following
13 | disclaimer in the documentation and/or other materials provided
14 | with the distribution.
15 |
16 | * Neither the name of the copyright holder nor the names of other
17 | contributors may be used to endorse or promote products derived
18 | from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
--------------------------------------------------------------------------------
/includes/vendor/firebase/php-jwt/README.md:
--------------------------------------------------------------------------------
1 | 
2 | [](https://packagist.org/packages/firebase/php-jwt)
3 | [](https://packagist.org/packages/firebase/php-jwt)
4 | [](https://packagist.org/packages/firebase/php-jwt)
5 |
6 | PHP-JWT
7 | =======
8 | A simple library to encode and decode JSON Web Tokens (JWT) in PHP, conforming to [RFC 7519](https://tools.ietf.org/html/rfc7519).
9 |
10 | Installation
11 | ------------
12 |
13 | Use composer to manage your dependencies and download PHP-JWT:
14 |
15 | ```bash
16 | composer require firebase/php-jwt
17 | ```
18 |
19 | Optionally, install the `paragonie/sodium_compat` package from composer if your
20 | php is < 7.2 or does not have libsodium installed:
21 |
22 | ```bash
23 | composer require paragonie/sodium_compat
24 | ```
25 |
26 | Example
27 | -------
28 | ```php
29 | use Firebase\JWT\JWT;
30 | use Firebase\JWT\Key;
31 |
32 | $key = 'example_key';
33 | $payload = [
34 | 'iss' => 'http://example.org',
35 | 'aud' => 'http://example.com',
36 | 'iat' => 1356999524,
37 | 'nbf' => 1357000000
38 | ];
39 |
40 | /**
41 | * IMPORTANT:
42 | * You must specify supported algorithms for your application. See
43 | * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
44 | * for a list of spec-compliant algorithms.
45 | */
46 | $jwt = JWT::encode($payload, $key, 'HS256');
47 | $decoded = JWT::decode($jwt, new Key($key, 'HS256'));
48 |
49 | print_r($decoded);
50 |
51 | /*
52 | NOTE: This will now be an object instead of an associative array. To get
53 | an associative array, you will need to cast it as such:
54 | */
55 |
56 | $decoded_array = (array) $decoded;
57 |
58 | /**
59 | * You can add a leeway to account for when there is a clock skew times between
60 | * the signing and verifying servers. It is recommended that this leeway should
61 | * not be bigger than a few minutes.
62 | *
63 | * Source: http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#nbfDef
64 | */
65 | JWT::$leeway = 60; // $leeway in seconds
66 | $decoded = JWT::decode($jwt, new Key($key, 'HS256'));
67 | ```
68 | Example with RS256 (openssl)
69 | ----------------------------
70 | ```php
71 | use Firebase\JWT\JWT;
72 | use Firebase\JWT\Key;
73 |
74 | $privateKey = << 'example.org',
103 | 'aud' => 'example.com',
104 | 'iat' => 1356999524,
105 | 'nbf' => 1357000000
106 | ];
107 |
108 | $jwt = JWT::encode($payload, $privateKey, 'RS256');
109 | echo "Encode:\n" . print_r($jwt, true) . "\n";
110 |
111 | $decoded = JWT::decode($jwt, new Key($publicKey, 'RS256'));
112 |
113 | /*
114 | NOTE: This will now be an object instead of an associative array. To get
115 | an associative array, you will need to cast it as such:
116 | */
117 |
118 | $decoded_array = (array) $decoded;
119 | echo "Decode:\n" . print_r($decoded_array, true) . "\n";
120 | ```
121 |
122 | Example with a passphrase
123 | -------------------------
124 |
125 | ```php
126 | use Firebase\JWT\JWT;
127 | use Firebase\JWT\Key;
128 |
129 | // Your passphrase
130 | $passphrase = '[YOUR_PASSPHRASE]';
131 |
132 | // Your private key file with passphrase
133 | // Can be generated with "ssh-keygen -t rsa -m pem"
134 | $privateKeyFile = '/path/to/key-with-passphrase.pem';
135 |
136 | // Create a private key of type "resource"
137 | $privateKey = openssl_pkey_get_private(
138 | file_get_contents($privateKeyFile),
139 | $passphrase
140 | );
141 |
142 | $payload = [
143 | 'iss' => 'example.org',
144 | 'aud' => 'example.com',
145 | 'iat' => 1356999524,
146 | 'nbf' => 1357000000
147 | ];
148 |
149 | $jwt = JWT::encode($payload, $privateKey, 'RS256');
150 | echo "Encode:\n" . print_r($jwt, true) . "\n";
151 |
152 | // Get public key from the private key, or pull from from a file.
153 | $publicKey = openssl_pkey_get_details($privateKey)['key'];
154 |
155 | $decoded = JWT::decode($jwt, new Key($publicKey, 'RS256'));
156 | echo "Decode:\n" . print_r((array) $decoded, true) . "\n";
157 | ```
158 |
159 | Example with EdDSA (libsodium and Ed25519 signature)
160 | ----------------------------
161 | ```php
162 | use Firebase\JWT\JWT;
163 | use Firebase\JWT\Key;
164 |
165 | // Public and private keys are expected to be Base64 encoded. The last
166 | // non-empty line is used so that keys can be generated with
167 | // sodium_crypto_sign_keypair(). The secret keys generated by other tools may
168 | // need to be adjusted to match the input expected by libsodium.
169 |
170 | $keyPair = sodium_crypto_sign_keypair();
171 |
172 | $privateKey = base64_encode(sodium_crypto_sign_secretkey($keyPair));
173 |
174 | $publicKey = base64_encode(sodium_crypto_sign_publickey($keyPair));
175 |
176 | $payload = [
177 | 'iss' => 'example.org',
178 | 'aud' => 'example.com',
179 | 'iat' => 1356999524,
180 | 'nbf' => 1357000000
181 | ];
182 |
183 | $jwt = JWT::encode($payload, $privateKey, 'EdDSA');
184 | echo "Encode:\n" . print_r($jwt, true) . "\n";
185 |
186 | $decoded = JWT::decode($jwt, new Key($publicKey, 'EdDSA'));
187 | echo "Decode:\n" . print_r((array) $decoded, true) . "\n";
188 | ````
189 |
190 | Using JWKs
191 | ----------
192 |
193 | ```php
194 | use Firebase\JWT\JWK;
195 | use Firebase\JWT\JWT;
196 |
197 | // Set of keys. The "keys" key is required. For example, the JSON response to
198 | // this endpoint: https://www.gstatic.com/iap/verify/public_key-jwk
199 | $jwks = ['keys' => []];
200 |
201 | // JWK::parseKeySet($jwks) returns an associative array of **kid** to Firebase\JWT\Key
202 | // objects. Pass this as the second parameter to JWT::decode.
203 | JWT::decode($payload, JWK::parseKeySet($jwks));
204 | ```
205 |
206 | Using Cached Key Sets
207 | ---------------------
208 |
209 | The `CachedKeySet` class can be used to fetch and cache JWKS (JSON Web Key Sets) from a public URI.
210 | This has the following advantages:
211 |
212 | 1. The results are cached for performance.
213 | 2. If an unrecognized key is requested, the cache is refreshed, to accomodate for key rotation.
214 | 3. If rate limiting is enabled, the JWKS URI will not make more than 10 requests a second.
215 |
216 | ```php
217 | use Firebase\JWT\CachedKeySet;
218 | use Firebase\JWT\JWT;
219 |
220 | // The URI for the JWKS you wish to cache the results from
221 | $jwksUri = 'https://www.gstatic.com/iap/verify/public_key-jwk';
222 |
223 | // Create an HTTP client (can be any PSR-7 compatible HTTP client)
224 | $httpClient = new GuzzleHttp\Client();
225 |
226 | // Create an HTTP request factory (can be any PSR-17 compatible HTTP request factory)
227 | $httpFactory = new GuzzleHttp\Psr\HttpFactory();
228 |
229 | // Create a cache item pool (can be any PSR-6 compatible cache item pool)
230 | $cacheItemPool = Phpfastcache\CacheManager::getInstance('files');
231 |
232 | $keySet = new CachedKeySet(
233 | $jwksUri,
234 | $httpClient,
235 | $httpFactory,
236 | $cacheItemPool,
237 | null, // $expiresAfter int seconds to set the JWKS to expire
238 | true // $rateLimit true to enable rate limit of 10 RPS on lookup of invalid keys
239 | );
240 |
241 | $jwt = 'eyJhbGci...'; // Some JWT signed by a key from the $jwkUri above
242 | $decoded = JWT::decode($jwt, $keySet);
243 | ```
244 |
245 | Miscellaneous
246 | -------------
247 |
248 | #### Exception Handling
249 |
250 | When a call to `JWT::decode` is invalid, it will throw one of the following exceptions:
251 |
252 | ```php
253 | use Firebase\JWT\JWT;
254 | use Firebase\JWT\SignatureInvalidException;
255 | use Firebase\JWT\BeforeValidException;
256 | use Firebase\JWT\ExpiredException;
257 | use DomainException;
258 | use InvalidArgumentException;
259 | use UnexpectedValueException;
260 |
261 | try {
262 | $decoded = JWT::decode($payload, $keys);
263 | } catch (InvalidArgumentException $e) {
264 | // provided key/key-array is empty or malformed.
265 | } catch (DomainException $e) {
266 | // provided algorithm is unsupported OR
267 | // provided key is invalid OR
268 | // unknown error thrown in openSSL or libsodium OR
269 | // libsodium is required but not available.
270 | } catch (SignatureInvalidException $e) {
271 | // provided JWT signature verification failed.
272 | } catch (BeforeValidException $e) {
273 | // provided JWT is trying to be used before "nbf" claim OR
274 | // provided JWT is trying to be used before "iat" claim.
275 | } catch (ExpiredException $e) {
276 | // provided JWT is trying to be used after "exp" claim.
277 | } catch (UnexpectedValueException $e) {
278 | // provided JWT is malformed OR
279 | // provided JWT is missing an algorithm / using an unsupported algorithm OR
280 | // provided JWT algorithm does not match provided key OR
281 | // provided key ID in key/key-array is empty or invalid.
282 | }
283 | ```
284 |
285 | All exceptions in the `Firebase\JWT` namespace extend `UnexpectedValueException`, and can be simplified
286 | like this:
287 |
288 | ```php
289 | try {
290 | $decoded = JWT::decode($payload, $keys);
291 | } catch (LogicException $e) {
292 | // errors having to do with environmental setup or malformed JWT Keys
293 | } catch (UnexpectedValueException $e) {
294 | // errors having to do with JWT signature and claims
295 | }
296 | ```
297 |
298 | #### Casting to array
299 |
300 | The return value of `JWT::decode` is the generic PHP object `stdClass`. If you'd like to handle with arrays
301 | instead, you can do the following:
302 |
303 | ```php
304 | // return type is stdClass
305 | $decoded = JWT::decode($payload, $keys);
306 |
307 | // cast to array
308 | $decoded = json_decode(json_encode($decoded), true);
309 | ```
310 |
311 | Tests
312 | -----
313 | Run the tests using phpunit:
314 |
315 | ```bash
316 | $ pear install PHPUnit
317 | $ phpunit --configuration phpunit.xml.dist
318 | PHPUnit 3.7.10 by Sebastian Bergmann.
319 | .....
320 | Time: 0 seconds, Memory: 2.50Mb
321 | OK (5 tests, 5 assertions)
322 | ```
323 |
324 | New Lines in private keys
325 | -----
326 |
327 | If your private key contains `\n` characters, be sure to wrap it in double quotes `""`
328 | and not single quotes `''` in order to properly interpret the escaped characters.
329 |
330 | License
331 | -------
332 | [3-Clause BSD](http://opensource.org/licenses/BSD-3-Clause).
333 |
--------------------------------------------------------------------------------
/includes/vendor/firebase/php-jwt/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "firebase/php-jwt",
3 | "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
4 | "homepage": "https://github.com/firebase/php-jwt",
5 | "keywords": [
6 | "php",
7 | "jwt"
8 | ],
9 | "authors": [
10 | {
11 | "name": "Neuman Vong",
12 | "email": "neuman+pear@twilio.com",
13 | "role": "Developer"
14 | },
15 | {
16 | "name": "Anant Narayanan",
17 | "email": "anant@php.net",
18 | "role": "Developer"
19 | }
20 | ],
21 | "license": "BSD-3-Clause",
22 | "require": {
23 | "php": "^7.1||^8.0"
24 | },
25 | "suggest": {
26 | "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present",
27 | "ext-sodium": "Support EdDSA (Ed25519) signatures"
28 | },
29 | "autoload": {
30 | "psr-4": {
31 | "Firebase\\JWT\\": "src"
32 | }
33 | },
34 | "require-dev": {
35 | "guzzlehttp/guzzle": "^6.5||^7.4",
36 | "phpspec/prophecy-phpunit": "^1.1",
37 | "phpunit/phpunit": "^7.5||^9.5",
38 | "psr/cache": "^1.0||^2.0",
39 | "psr/http-client": "^1.0",
40 | "psr/http-factory": "^1.0"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/includes/vendor/firebase/php-jwt/src/BeforeValidException.php:
--------------------------------------------------------------------------------
1 |
18 | */
19 | class CachedKeySet implements ArrayAccess
20 | {
21 | /**
22 | * @var string
23 | */
24 | private $jwksUri;
25 | /**
26 | * @var ClientInterface
27 | */
28 | private $httpClient;
29 | /**
30 | * @var RequestFactoryInterface
31 | */
32 | private $httpFactory;
33 | /**
34 | * @var CacheItemPoolInterface
35 | */
36 | private $cache;
37 | /**
38 | * @var ?int
39 | */
40 | private $expiresAfter;
41 | /**
42 | * @var ?CacheItemInterface
43 | */
44 | private $cacheItem;
45 | /**
46 | * @var array>
47 | */
48 | private $keySet;
49 | /**
50 | * @var string
51 | */
52 | private $cacheKey;
53 | /**
54 | * @var string
55 | */
56 | private $cacheKeyPrefix = 'jwks';
57 | /**
58 | * @var int
59 | */
60 | private $maxKeyLength = 64;
61 | /**
62 | * @var bool
63 | */
64 | private $rateLimit;
65 | /**
66 | * @var string
67 | */
68 | private $rateLimitCacheKey;
69 | /**
70 | * @var int
71 | */
72 | private $maxCallsPerMinute = 10;
73 | /**
74 | * @var string|null
75 | */
76 | private $defaultAlg;
77 |
78 | public function __construct(
79 | string $jwksUri,
80 | ClientInterface $httpClient,
81 | RequestFactoryInterface $httpFactory,
82 | CacheItemPoolInterface $cache,
83 | int $expiresAfter = null,
84 | bool $rateLimit = false,
85 | string $defaultAlg = null
86 | ) {
87 | $this->jwksUri = $jwksUri;
88 | $this->httpClient = $httpClient;
89 | $this->httpFactory = $httpFactory;
90 | $this->cache = $cache;
91 | $this->expiresAfter = $expiresAfter;
92 | $this->rateLimit = $rateLimit;
93 | $this->defaultAlg = $defaultAlg;
94 | $this->setCacheKeys();
95 | }
96 |
97 | /**
98 | * @param string $keyId
99 | * @return Key
100 | */
101 | public function offsetGet($keyId): Key
102 | {
103 | if (!$this->keyIdExists($keyId)) {
104 | throw new OutOfBoundsException('Key ID not found');
105 | }
106 | return JWK::parseKey($this->keySet[$keyId], $this->defaultAlg);
107 | }
108 |
109 | /**
110 | * @param string $keyId
111 | * @return bool
112 | */
113 | public function offsetExists($keyId): bool
114 | {
115 | return $this->keyIdExists($keyId);
116 | }
117 |
118 | /**
119 | * @param string $offset
120 | * @param Key $value
121 | */
122 | public function offsetSet($offset, $value): void
123 | {
124 | throw new LogicException('Method not implemented');
125 | }
126 |
127 | /**
128 | * @param string $offset
129 | */
130 | public function offsetUnset($offset): void
131 | {
132 | throw new LogicException('Method not implemented');
133 | }
134 |
135 | /**
136 | * @return array
137 | */
138 | private function formatJwksForCache(string $jwks): array
139 | {
140 | $jwks = json_decode($jwks, true);
141 |
142 | if (!isset($jwks['keys'])) {
143 | throw new UnexpectedValueException('"keys" member must exist in the JWK Set');
144 | }
145 |
146 | if (empty($jwks['keys'])) {
147 | throw new InvalidArgumentException('JWK Set did not contain any keys');
148 | }
149 |
150 | $keys = [];
151 | foreach ($jwks['keys'] as $k => $v) {
152 | $kid = isset($v['kid']) ? $v['kid'] : $k;
153 | $keys[(string) $kid] = $v;
154 | }
155 |
156 | return $keys;
157 | }
158 |
159 | private function keyIdExists(string $keyId): bool
160 | {
161 | if (null === $this->keySet) {
162 | $item = $this->getCacheItem();
163 | // Try to load keys from cache
164 | if ($item->isHit()) {
165 | // item found! retrieve it
166 | $this->keySet = $item->get();
167 | // If the cached item is a string, the JWKS response was cached (previous behavior).
168 | // Parse this into expected format array instead.
169 | if (\is_string($this->keySet)) {
170 | $this->keySet = $this->formatJwksForCache($this->keySet);
171 | }
172 | }
173 | }
174 |
175 | if (!isset($this->keySet[$keyId])) {
176 | if ($this->rateLimitExceeded()) {
177 | return false;
178 | }
179 | $request = $this->httpFactory->createRequest('GET', $this->jwksUri);
180 | $jwksResponse = $this->httpClient->sendRequest($request);
181 | $this->keySet = $this->formatJwksForCache((string) $jwksResponse->getBody());
182 |
183 | if (!isset($this->keySet[$keyId])) {
184 | return false;
185 | }
186 |
187 | $item = $this->getCacheItem();
188 | $item->set($this->keySet);
189 | if ($this->expiresAfter) {
190 | $item->expiresAfter($this->expiresAfter);
191 | }
192 | $this->cache->save($item);
193 | }
194 |
195 | return true;
196 | }
197 |
198 | private function rateLimitExceeded(): bool
199 | {
200 | if (!$this->rateLimit) {
201 | return false;
202 | }
203 |
204 | $cacheItem = $this->cache->getItem($this->rateLimitCacheKey);
205 | if (!$cacheItem->isHit()) {
206 | $cacheItem->expiresAfter(1); // # of calls are cached each minute
207 | }
208 |
209 | $callsPerMinute = (int) $cacheItem->get();
210 | if (++$callsPerMinute > $this->maxCallsPerMinute) {
211 | return true;
212 | }
213 | $cacheItem->set($callsPerMinute);
214 | $this->cache->save($cacheItem);
215 | return false;
216 | }
217 |
218 | private function getCacheItem(): CacheItemInterface
219 | {
220 | if (\is_null($this->cacheItem)) {
221 | $this->cacheItem = $this->cache->getItem($this->cacheKey);
222 | }
223 |
224 | return $this->cacheItem;
225 | }
226 |
227 | private function setCacheKeys(): void
228 | {
229 | if (empty($this->jwksUri)) {
230 | throw new RuntimeException('JWKS URI is empty');
231 | }
232 |
233 | // ensure we do not have illegal characters
234 | $key = preg_replace('|[^a-zA-Z0-9_\.!]|', '', $this->jwksUri);
235 |
236 | // add prefix
237 | $key = $this->cacheKeyPrefix . $key;
238 |
239 | // Hash keys if they exceed $maxKeyLength of 64
240 | if (\strlen($key) > $this->maxKeyLength) {
241 | $key = substr(hash('sha256', $key), 0, $this->maxKeyLength);
242 | }
243 |
244 | $this->cacheKey = $key;
245 |
246 | if ($this->rateLimit) {
247 | // add prefix
248 | $rateLimitKey = $this->cacheKeyPrefix . 'ratelimit' . $key;
249 |
250 | // Hash keys if they exceed $maxKeyLength of 64
251 | if (\strlen($rateLimitKey) > $this->maxKeyLength) {
252 | $rateLimitKey = substr(hash('sha256', $rateLimitKey), 0, $this->maxKeyLength);
253 | }
254 |
255 | $this->rateLimitCacheKey = $rateLimitKey;
256 | }
257 | }
258 | }
259 |
--------------------------------------------------------------------------------
/includes/vendor/firebase/php-jwt/src/ExpiredException.php:
--------------------------------------------------------------------------------
1 | keyMaterial = $keyMaterial;
44 | $this->algorithm = $algorithm;
45 | }
46 |
47 | /**
48 | * Return the algorithm valid for this key
49 | *
50 | * @return string
51 | */
52 | public function getAlgorithm(): string
53 | {
54 | return $this->algorithm;
55 | }
56 |
57 | /**
58 | * @return string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate
59 | */
60 | public function getKeyMaterial()
61 | {
62 | return $this->keyMaterial;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/includes/vendor/firebase/php-jwt/src/SignatureInvalidException.php:
--------------------------------------------------------------------------------
1 | run();
91 | }
92 |
93 | run_jwt_auth();
94 |
--------------------------------------------------------------------------------
/languages/jwt-auth.pot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tmeister/wp-api-jwt-auth/53330942cfda81dbcd13e283d7b162241fd72973/languages/jwt-auth.pot
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 |