├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── YourPackage ├── LICENSE ├── README.md ├── composer.json └── src │ └── YourPackageProvider.php ├── api ├── wpbones │ └── v2 │ │ └── route.php └── wpkirk │ └── v1 │ └── route.php ├── assets ├── banner-1544x500.afdesign ├── icon-256x256.afdesign └── readme.md ├── bones ├── bootstrap ├── autoload.php └── plugin.php ├── composer.json ├── composer.lock ├── config ├── api.php ├── custom.php ├── flags.yaml ├── menus.php ├── options.php ├── plugin.php └── routes.php ├── database ├── migrations │ ├── .gitkeep │ ├── 2015_12_12_134527_create_products_table.php │ └── 2024_10_10_134527_create_books_table.php └── seeders │ ├── BookSeeder.php │ └── ProductSeeder.php ├── deploy.php ├── functions.php ├── gulpfile.js ├── languages ├── it_IT.pot ├── wp-kirk-es_ES.mo ├── wp-kirk-es_ES.po ├── wp-kirk-it_IT-2fa1a8b4d52e5c72f54dd47636d2e1f4.json ├── wp-kirk-it_IT.mo ├── wp-kirk-it_IT.po ├── wp-kirk.mo ├── wp-kirk.po └── wp-kirk.pot ├── namespace ├── package-lock.json ├── package.json ├── pages └── custom_page.php ├── plugin ├── API │ └── WPKirkV1Controller.php ├── Ajax │ └── MyAjax.php ├── Console │ ├── Commands │ │ └── SampleCommand.php │ └── Kernel.php ├── CustomPostTypes │ ├── .gitkeep │ └── MyCustomPostType.php ├── CustomTaxonomyTypes │ └── MyCustomTaxonomy.php ├── Http │ └── Controllers │ │ ├── AssetsController.php │ │ ├── Controller.php │ │ ├── Dashboard │ │ ├── DashboardController.php │ │ └── DashboardResourceController.php │ │ ├── EloquentProduct.php │ │ ├── EloquentUser.php │ │ ├── ExampleAPIController.php │ │ ├── ExampleBladeController.php │ │ ├── ExampleDatabaseController.php │ │ ├── ExampleEloquentController.php │ │ ├── ExampleModelController.php │ │ ├── ExampleModelNoPrefixController.php │ │ ├── ExampleTable.php │ │ ├── ExampleTableController.php │ │ ├── ReactApplicationController.php │ │ └── SearchTable.php ├── Models │ ├── MyPluginBooks.php │ └── MyPluginProducts.php ├── Shortcodes │ └── MyShortcodes.php ├── Widgets │ └── MyWidget.php ├── activation.php ├── deactivation.php └── updated.php ├── public ├── apps │ ├── app-rtl.css │ ├── app.asset.php │ ├── app.css │ └── app.js ├── css │ ├── prism.css │ ├── wp-kirk-common.css │ ├── wp-kirk-dashboard.css │ ├── wp-kirk-variables.css │ ├── wp-kirk-widget.css │ └── wp-kirk.css ├── images │ ├── wpbones-logo-menu.png │ └── wpbones-logo.png └── js │ ├── prism.js │ ├── wp-kirk-main.js │ ├── wp-kirk-test.js │ └── wp-react-component.js ├── readme.txt ├── resources ├── assets │ ├── apps │ │ ├── app.jsx │ │ ├── app.module.scss │ │ └── components │ │ │ ├── Demo.jsx │ │ │ ├── Mantine.jsx │ │ │ ├── Overview.jsx │ │ │ ├── Settings.jsx │ │ │ └── Settings.module.css │ ├── css │ │ ├── prism.css │ │ ├── wp-kirk-common.less │ │ ├── wp-kirk-dashboard.less │ │ ├── wp-kirk-variables.less │ │ ├── wp-kirk-widget.less │ │ └── wp-kirk.scss │ └── js │ │ ├── prism.js │ │ ├── wp-kirk-main.js │ │ ├── wp-kirk-test.ts │ │ └── wp-react-component.jsx └── views │ ├── blade │ └── demo.blade.php │ ├── dashboard │ ├── api.php │ ├── assets.php │ ├── custom_page.php │ ├── database.php │ ├── eloquent.php │ ├── first_custom_page.php │ ├── html.php │ ├── index.php │ ├── model-no-prefix.php │ ├── model.php │ ├── options.php │ ├── optionsresview.php │ ├── optionsview.php │ ├── package.php │ ├── react-app.php │ ├── second.php │ ├── second_custom_page.php │ └── table.php │ └── widgets │ ├── form.php │ └── index.php └── wp-kirk.php /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | # WordPress Coding Standards 5 | # https://make.wordpress.org/core/handbook/coding-standards/ 6 | 7 | root = true 8 | 9 | [*] 10 | charset = utf-8 11 | end_of_line = lf 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | indent_style = tab 15 | 16 | [*.{yml,yaml}] 17 | indent_style = space 18 | indent_size = 2 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | resources/assets/vendor/ 3 | vendor/ 4 | .cache/ 5 | .php-cs-fixer.cache 6 | release.sh 7 | storage 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | WP Bones Logo 3 |

4 | 5 | # WP Bones Demo 6 | 7 | WP Kirk is a demo plugin written by using [WP Bones](https://wpbones.com/) Framework Library. 8 | You may start from here to create a [WP Bones](https://wpbones.com/) WordPress plugin. 9 | 10 | ## See it in action 11 | 12 | You can see the plugin in action by clicking [here](https://playground.wordpress.net/?blueprint-url=https://wpbones.com/blueprint.json). 13 | 14 | ## Installation 15 | 16 | ```bash 17 | git clone -b main https://github.com/wpbones/WPKirk.git 18 | cd 19 | composer install 20 | ``` 21 | 22 | ## Documentation 23 | 24 | You'll find the [complete docs here](https://wpbones.com/docs). 25 | 26 | ## Contributors 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /YourPackage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024, Giovambattista Fazioli 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /YourPackage/README.md: -------------------------------------------------------------------------------- 1 | # Your Package for WP Bones 2 | 3 | Your package description for WP Bones 4 | 5 | [![Latest Stable Version](https://poser.pugx.org/yourName/yourPackage/v/stable)](https://packagist.org/packages/yourName/yourPackage) 6 | [![Total Downloads](https://poser.pugx.org/yourName/yourPackage/downloads)](https://packagist.org/packages/yourName/yourPackage) 7 | [![License](https://poser.pugx.org/yourName/yourPackage/license)](https://packagist.org/packages/yourName/yourPackage) 8 | 9 | ## Installation 10 | 11 | You can install third party packages by using: 12 | 13 | ```sh 14 | php bones require yourName/yourPackage 15 | ``` 16 | 17 | I advise to use this command instead of `composer require` because doing this an automatic renaming will done. 18 | 19 | You can use composer to install this package: 20 | 21 | ```sh 22 | composer require yourName/yourPackage 23 | ``` 24 | 25 | You may also to add `"yourName/yourPackage": "^1.0"` in the `composer.json` file of your plugin: 26 | 27 | ```json 28 | "require": { 29 | "php": ">=7.0", 30 | "wpbones/wpbones": "~1.0", 31 | "yourName/yourPackage": "~1.0" 32 | }, 33 | ``` 34 | 35 | 36 | and run 37 | 38 | ```sh 39 | composer install 40 | ``` 41 | 42 | ## How to 43 | 44 | Your package usage instructions for WP Bones 45 | -------------------------------------------------------------------------------- /YourPackage/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yourName/yourPackage", 3 | "version": "1.0.0", 4 | "homepage": "https://github.com/yourName/yourPackage", 5 | "license": "MIT", 6 | "type": "library", 7 | "description": "Your package description", 8 | "keywords": ["WP Table", "WP Bones"], 9 | "authors": [ 10 | { 11 | "name": "Giovambattista Fazioli", 12 | "email": "giovambattista.fazioli@gmail.com", 13 | "homepage": "http://undolog.com" 14 | } 15 | ], 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/yourName/yourPackage.git" 19 | }, 20 | "support": { 21 | "email": "giovambattista.fazioli@gmail.com", 22 | "issues": "https://github.com/yourName/yourPackage/issues" 23 | }, 24 | "autoload": { 25 | "psr-4": { 26 | "WPKirk\\YourPackage\\": "src/" 27 | } 28 | }, 29 | "minimum-stability": "stable", 30 | "prefer-stable": true 31 | } 32 | -------------------------------------------------------------------------------- /YourPackage/src/YourPackageProvider.php: -------------------------------------------------------------------------------- 1 | "v1.0.0"]); 7 | }); 8 | -------------------------------------------------------------------------------- /api/wpkirk/v1/route.php: -------------------------------------------------------------------------------- 1 | "v1.0.0"]); 13 | }); 14 | 15 | // right way to use a simple response 16 | Route::get('/example_response', function () { 17 | return Route::response(["tag" => "v1.0.0"]); 18 | }); 19 | 20 | // very simple example with args 21 | Route::get('/example_args', function (WP_REST_Request $request) { 22 | $value = var_export($request, true); 23 | 24 | /** 25 | * // You can access parameters via direct array access on the object: 26 | * $param = $request['some_param']; 27 | * 28 | * // Or via the helper method: 29 | * $param = $request->get_param( 'some_param' ); 30 | * 31 | * // You can get the combined, merged set of parameters: 32 | * $parameters = $request->get_params(); 33 | * 34 | * // The individual sets of parameters are also available, if needed: 35 | * $parameters = $request->get_url_params(); 36 | * $parameters = $request->get_query_params(); 37 | * $parameters = $request->get_body_params(); 38 | * $parameters = $request->get_json_params(); 39 | * $parameters = $request->get_default_params(); 40 | * 41 | * // Uploads aren't merged in, but can be accessed separately: 42 | * $parameters = $request->get_file_params(); 43 | */ 44 | 45 | return Route::response( 46 | [ 47 | "request" => $value, 48 | "ROUTE" => $request->get_route(), 49 | ] 50 | ); 51 | }); 52 | 53 | // invalid example 54 | Route::get('/invalid', function () { 55 | return new WP_Error('no_author', 'Invalid author', ['status' => 404]); 56 | }); 57 | 58 | // right way to use an error response 59 | Route::get('/error', function () { 60 | return Route::responseError('no_author', 'Invalid author', ['status' => 404]); 61 | }); 62 | 63 | // may use the same route for different methods 64 | Route::get('/version', '\WPKirk\API\WPKirkV1Controller@version'); 65 | 66 | Route::post('/version', '\WPKirk\API\WPKirkV1Controller@version'); 67 | 68 | // another way to use the same route for different methods 69 | Route::request(['get', 'POST'], '/multiple', '\WPKirk\API\WPKirkV1Controller@multiple'); 70 | 71 | // controller error example 72 | Route::get('/error/controller', '\WPKirk\API\WPKirkV1Controller@error'); 73 | 74 | // controller args example 75 | Route::get('/controller_args', '\WPKirk\API\WPKirkV1Controller@controller_args'); 76 | 77 | Route::get('/protected', function () { 78 | return 'Hello World!'; 79 | }, ['permission_callback' => function () { 80 | return false; 81 | }]); 82 | -------------------------------------------------------------------------------- /assets/banner-1544x500.afdesign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpbones/WPKirk/fea4527c268d0f5600cb31092cfe7c6a22725b90/assets/banner-1544x500.afdesign -------------------------------------------------------------------------------- /assets/icon-256x256.afdesign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpbones/WPKirk/fea4527c268d0f5600cb31092cfe7c6a22725b90/assets/icon-256x256.afdesign -------------------------------------------------------------------------------- /assets/readme.md: -------------------------------------------------------------------------------- 1 | ## Assets 2 | 3 | Here you'll find some useful assets to publish your plugin in the WordPress repository. 4 | You can delete this folder in your trnk before submitting. 5 | 6 | You should provides the following files: 7 | 8 | * icon-256x256.png 9 | * icon-128x128.png 10 | * banner-1544x500.jpg 11 | * banner-772x256.jpg 12 | 13 | Also, you can provides some screenshot: 14 | 15 | * screenshot-1.jpg 16 | * screenshot-2.jpg 17 | * ... -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | =8.2", 25 | "wpbones/wpbones": "dev-dev", 26 | "wpbones/pure-css-tabs": "~1.0", 27 | "wpbones/pure-css-switch": "~1.0", 28 | "wpbones/wptables": "~1.0", 29 | "wpbones/useragent": "~1.0", 30 | "wpbones/flags": "~1.0", 31 | "illuminate/database": "~11.0" 32 | }, 33 | "autoload": { 34 | "psr-4": { 35 | "WPKirk\\": "plugin/", 36 | "WPKirk\\YourPackage\\": "YourPackage/src/" 37 | }, 38 | "files": [ 39 | "functions.php" 40 | ] 41 | }, 42 | "scripts": { 43 | "post-autoload-dump": [ 44 | "php -r \"copy('vendor/wpbones/wpbones/src/Console/bin/bones', 'bones');\"", 45 | "php bones rename --update" 46 | ] 47 | } 48 | } -------------------------------------------------------------------------------- /config/api.php: -------------------------------------------------------------------------------- 1 | [ 19 | 'require_authentication' => false, // will affect all routes. 20 | ], 21 | 22 | // your custom rest api 23 | 'custom' => [ 24 | 'path' => '/api', 25 | 'enabled' => true, 26 | ], 27 | 28 | // authentication 29 | 'auth' => [ 30 | // embed basic authentication handler 31 | 'basic' => true, 32 | ], 33 | ]; 34 | -------------------------------------------------------------------------------- /config/custom.php: -------------------------------------------------------------------------------- 1 | config( 'custom.sample' )`. 15 | | 16 | */ 17 | 18 | return [ 19 | 'sample' => __('Hello, Captain!', 'wp-kirk'), 20 | ]; 21 | -------------------------------------------------------------------------------- /config/flags.yaml: -------------------------------------------------------------------------------- 1 | # WPBones Flags 2 | # 3 | # This is an example of a (feature) flag file for the WPBones plugin. 4 | # The file is in YAML format. It's used to enable or disable features of the WPBones plugin. 5 | # In general, you can use this file to change the behavior of the plugin. 6 | # 7 | # !! Why use flags instead the PHP code? !! 8 | # The flags file is specifically designed to be used by non-developers. It's easier to understand and modify. 9 | # For this reason, it's recommended to use YAML flags instead of PHP code. 10 | # You can provide this file to your clients or users, and they can easily change the behavior of the plugin. 11 | # Remember that the flags file is optional. You can use it or not. 12 | # The current plugin.php, menus.php, etc. files are written and used to bootstrap the plugin. And should be used by developers. 13 | # 14 | # You can find more information about YAML here: https://yaml.org/ 15 | # 16 | # !! How to use the flags file? !! 17 | # You can use any instance of the plugin, for example: 18 | # 19 | # WPKirk()->flags->get('example.enabled'); 20 | # 21 | # This will return the value of the flag. If the flag is not set, it will return the default value. 22 | # 23 | # WPKirk()->flags->get('example.throttle', 10); // 10 is the default value 24 | # 25 | 26 | # The version of the file is 1.0.0 27 | version: "1.0.0" 28 | example: 29 | # Enable or disable the Example feature 30 | enabled: true 31 | # Throttle request time in minutes 32 | # By setting this value to 0, the feature will be disabled 33 | throttle: 5 34 | # Request timeout 35 | timeout: 0 -------------------------------------------------------------------------------- /config/menus.php: -------------------------------------------------------------------------------- 1 | [ 19 | 'menu_title' => 'WP Kirk Menu', 20 | 'capability' => 'read', 21 | 'icon' => 'wpbones-logo-menu.png', 22 | 'items' => [ 23 | [ 24 | 'menu_title' => __('Main View', 'wp-kirk'), 25 | 'route' => [ 26 | 'get' => 'Dashboard\DashboardController@firstMenu', 27 | ], 28 | ], 29 | 'assets' => [ 30 | 'menu_title' => __('Assets', 'wp-kirk'), 31 | 'route' => [ 32 | 'get' => 'AssetsController@index', 33 | ], 34 | ], 35 | [ 36 | 'menu_title' => __('React Application', 'wp-kirk'), 37 | 'route' => [ 38 | 'get' => 'ReactApplicationController@index', 39 | ], 40 | ], 41 | [ 42 | 'menu_title' => __('React Settings', 'wp-kirk'), 43 | 'route' => [ 44 | 'get' => 'ReactApplicationController@reactSettings', 45 | ], 46 | ], 47 | [ 48 | 'menu_title' => __('Ajax Example', 'wp-kirk'), 49 | 'route' => [ 50 | 'get' => 'Dashboard\DashboardController@secondMenu', 51 | ], 52 | ], 53 | 'options_submenu' => [ 54 | 'menu_title' => __('Options', 'wp-kirk'), 55 | 'route' => [ 56 | 'get' => 'Dashboard\DashboardController@optionsMenu', 57 | ], 58 | ], 59 | [ 60 | 'menu_title' => __('Options View', 'wp-kirk'), 61 | 'route' => [ 62 | 'get' => 'Dashboard\DashboardController@optionsView', 63 | 'post' => 'Dashboard\DashboardController@saveOptions', 64 | ], 65 | ], 66 | [ 67 | 'menu_title' => __('Options Resource', 'wp-kirk'), 68 | 'route' => [ 69 | 'load' => 'Dashboard\DashboardResourceController@load', 70 | 'resource' => 'Dashboard\DashboardResourceController', 71 | ], 72 | ], 73 | [ 74 | 'menu_title' => __('HTML', 'wp-kirk'), 75 | 'route' => [ 76 | 'get' => 'Dashboard\DashboardController@html', 77 | ], 78 | ], 79 | [ 80 | 'menu_title' => __('Official Packages', 'wp-kirk'), 81 | 'route' => [ 82 | 'get' => 'Dashboard\DashboardController@package', 83 | 'post' => 'Dashboard\DashboardController@packagePost', 84 | ], 85 | ], 86 | [ 87 | 'menu_title' => __('Tables Example #1', 'wp-kirk'), 88 | 'route' => [ 89 | 'load' => 'ExampleTableController@load', 90 | 'get' => 'ExampleTableController@index', 91 | ], 92 | ], 93 | [ 94 | 'menu_title' => __('Tables Example #2', 'wp-kirk'), 95 | 'route' => [ 96 | 'load' => 'ExampleTableController@loadFluentExample', 97 | 'get' => 'ExampleTableController@indexFluentExample', 98 | ], 99 | ], 100 | [ 101 | 'menu_title' => __('Tables Example #3', 'wp-kirk'), 102 | 'route' => [ 103 | 'load' => 'ExampleTableController@loadSearchExample', 104 | 'get' => 'ExampleTableController@indexSearchExample', 105 | ], 106 | ], 107 | [ 108 | 'menu_title' => __('API', 'wp-kirk'), 109 | 'route' => [ 110 | 'get' => 'ExampleAPIController@index', 111 | ], 112 | ], 113 | [ 114 | 'menu_title' => __('Database', 'wp-kirk'), 115 | 'route' => [ 116 | 'get' => 'ExampleDatabaseController@index', 117 | ], 118 | ], 119 | [ 120 | 'menu_title' => __('Model', 'wp-kirk'), 121 | 'route' => [ 122 | 'get' => 'ExampleModelController@index', 123 | ], 124 | ], 125 | [ 126 | 'menu_title' => __('Model No Prefix', 'wp-kirk'), 127 | 'route' => [ 128 | 'get' => 'ExampleModelNoPrefixController@index', 129 | ], 130 | ], 131 | [ 132 | 'menu_title' => __('Eloquent ORM', 'wp-kirk'), 133 | 'route' => [ 134 | 'get' => 'ExampleEloquentController@index', 135 | ], 136 | ], 137 | [ 138 | 'menu_title' => __('Blade', 'wp-kirk'), 139 | 'route' => [ 140 | 'get' => 'ExampleBladeController@index', 141 | ], 142 | ], 143 | ], 144 | ], 145 | ]; 146 | -------------------------------------------------------------------------------- /config/options.php: -------------------------------------------------------------------------------- 1 | options` property 16 | | 17 | */ 18 | 19 | return [ 20 | 'version' => '1.0', 21 | 'General' => [ 22 | 'option_1' => 'true', 23 | 'option_2' => 'true', 24 | 'option_3' => [ 25 | 'sub_option_of_3' => __('Hello', 'wp-kirk'), 26 | ], 27 | 'option_4' => 'to delete', 28 | 'option_5' => null 29 | ], 30 | 31 | 'Special' => [ 32 | 'Name' => 'James Kirk', 33 | ], 34 | ]; 35 | -------------------------------------------------------------------------------- /config/plugin.php: -------------------------------------------------------------------------------- 1 | [ 18 | /** 19 | * Type of log. 20 | * Available Settings: "single", "daily", "errorlog". 21 | * 22 | * - "errorlog", the log will be saved in the default WordPress log file. 23 | * Usually, this is located in the wp-content/debug.log file. 24 | * 25 | * - "single", the log will be saved in a single file in the log_path directory. 26 | * Default: [plugin-path]/storage/logs/debug.log 27 | * 28 | * - "daily", the log will be saved in a daily file in the log_path directory. 29 | * Default: [plugin-path]/storage/logs/[Y-m-d].log 30 | * Example: [plugin-path]/storage/logs/2024-10-09.log 31 | */ 32 | "type" => "errorlog", 33 | 34 | /** 35 | * The path where the log will be saved. 36 | * Default: [plugin-path]/storage/logs/ 37 | */ 38 | //"path" => '', 39 | 40 | /** 41 | * Daily format. 42 | * Default: 'Y-m-d' 43 | */ 44 | "daily_format" => 'Y-m-d', 45 | 46 | /** 47 | * The timestamp format used in the log. 48 | * Default: 'd-M-Y H:i:s T' 49 | * Example: [09-Oct-2024 12:51:22 UTC] [debug]: This is a debug message 50 | */ 51 | "timestamp_format" => 'd-M-Y H:i:s T', 52 | ], 53 | 54 | /* 55 | |-------------------------------------------------------------------------- 56 | | Screen options 57 | |-------------------------------------------------------------------------- 58 | | 59 | | Here is where you can register the screen options for List Table. 60 | | 61 | */ 62 | 63 | 'screen_options' => [], 64 | 65 | /* 66 | |-------------------------------------------------------------------------- 67 | | Custom Post Types 68 | |-------------------------------------------------------------------------- 69 | | 70 | | Here is where you can register the Custom Post Types. 71 | | 72 | */ 73 | 74 | 'custom_post_types' => ['\WPKirk\CustomPostTypes\MyCustomPostType'], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Custom Taxonomies 79 | |-------------------------------------------------------------------------- 80 | | 81 | | Here is where you can register the Custom Taxonomy Types. 82 | | 83 | */ 84 | 85 | 'custom_taxonomy_types' => ['\WPKirk\CustomTaxonomyTypes\MyCustomTaxonomy'], 86 | 87 | /* 88 | |-------------------------------------------------------------------------- 89 | | Shortcodes 90 | |-------------------------------------------------------------------------- 91 | | 92 | | Here is where you can register the Shortcodes. 93 | | 94 | */ 95 | 96 | 'shortcodes' => ['\WPKirk\Shortcodes\MyShortcodes'], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Widgets 101 | |-------------------------------------------------------------------------- 102 | | 103 | | Here is where you can register all the Widget for a plugin. 104 | | 105 | */ 106 | 107 | 'widgets' => ['\WPKirk\Widgets\MyWidget'], 108 | 109 | /* 110 | |-------------------------------------------------------------------------- 111 | | Ajax 112 | |-------------------------------------------------------------------------- 113 | | 114 | | Here is where you can register your own Ajax actions. 115 | | 116 | */ 117 | 118 | 'ajax' => ['\WPKirk\Ajax\MyAjax'], 119 | 120 | /* 121 | |-------------------------------------------------------------------------- 122 | | Autoloader Service Providers 123 | |-------------------------------------------------------------------------- 124 | | 125 | | The service providers listed here will be automatically loaded on the 126 | | init to your plugin. Feel free to add your own services to 127 | | this array to grant expanded functionality to your applications. 128 | | 129 | */ 130 | 131 | 'providers' => [], 132 | ]; 133 | -------------------------------------------------------------------------------- /config/routes.php: -------------------------------------------------------------------------------- 1 | getPageUrl( 'custom_page' ) to get the URL. 14 | | 15 | */ 16 | 17 | return [ 18 | 'first_custom_page' => [ 19 | 'title' => __('Title of page', 'wp-kirk'), 20 | 'capability' => 'read', 21 | 'route' => [ 22 | 'get' => 'Dashboard\DashboardController@customPage', 23 | 'post' => 'Dashboard\DashboardController@customPage', 24 | ], 25 | ], 26 | 'second_custom_page' => [ 27 | 'title' => __('Second', 'wp-kirk'), 28 | 'capability' => 'read', 29 | 'route' => [ 30 | 'post' => 'Dashboard\DashboardController@secondCustomPage', 31 | ], 32 | ], 33 | ]; 34 | -------------------------------------------------------------------------------- /database/migrations/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpbones/WPKirk/fea4527c268d0f5600cb31092cfe7c6a22725b90/database/migrations/.gitkeep -------------------------------------------------------------------------------- /database/migrations/2015_12_12_134527_create_products_table.php: -------------------------------------------------------------------------------- 1 | create( 9 | 'my_plugin_products', 10 | "( 11 | id bigint(20) unsigned NOT NULL auto_increment, 12 | user_id bigint(20) unsigned NOT NULL default '0', 13 | name varchar(20) NOT NULL default '', 14 | description varchar(20) NOT NULL default '', 15 | price bigint(20) unsigned NOT NULL default '0', 16 | created_at datetime NOT NULL default '0000-00-00 00:00:00', 17 | updated_at datetime NOT NULL default '0000-00-00 00:00:00', 18 | foo_bar varchar(20) NOT NULL default '1', 19 | `foo-bar` varchar(20) NOT NULL default '2', 20 | PRIMARY KEY (id), 21 | KEY user_id (user_id) 22 | ) {$this->charsetCollate};" 23 | ); 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /database/migrations/2024_10_10_134527_create_books_table.php: -------------------------------------------------------------------------------- 1 | create( 12 | 'my_plugin_books', 13 | "( 14 | id bigint(20) unsigned NOT NULL auto_increment, 15 | user_id bigint(20) unsigned NOT NULL default '0', 16 | name varchar(20) NOT NULL default '', 17 | description varchar(20) NOT NULL default '', 18 | price bigint(20) unsigned NOT NULL default '0', 19 | created_at datetime NOT NULL default '0000-00-00 00:00:00', 20 | updated_at datetime NOT NULL default '0000-00-00 00:00:00', 21 | foo_bar varchar(20) NOT NULL default '1', 22 | `foo-bar` varchar(20) NOT NULL default '2', 23 | PRIMARY KEY (id), 24 | KEY user_id (user_id) 25 | ) {$this->charsetCollate};" 26 | ); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /database/seeders/BookSeeder.php: -------------------------------------------------------------------------------- 1 | 'Book iMac', 'price' => '100000'], 30 | ['name' => 'Book iPhone', 'price' => '20000'], 31 | ['name' => 'Book iPad', 'price' => '30000'], 32 | ['name' => 'Book iPod', 'price' => '10000'], 33 | ]); 34 | 35 | // insert by using the Seeder class 36 | // $this->insert( 37 | // "(name) VALUES 38 | // ('Book iMac'), 39 | // ('Book iPod'), 40 | // ('Book iPhone'), 41 | // ('Book iPad') 42 | // " 43 | // ); 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /database/seeders/ProductSeeder.php: -------------------------------------------------------------------------------- 1 | 'iMac', 'price' => '100000'], 22 | ['name' => 'iPhone', 'price' => '20000'], 23 | ['name' => 'iPad', 'price' => '30000'], 24 | ['name' => 'iPod', 'price' => '10000'], 25 | ]); 26 | 27 | // insert by using the Seeder class 28 | // $this->insert( 29 | // "(name) VALUES 30 | // ('iMac'), 31 | // ('iPod'), 32 | // ('iPhone'), 33 | // ('iPad') 34 | // " 35 | // ); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /deploy.php: -------------------------------------------------------------------------------- 1 | deleteDirectory("{$path}/docs"); 16 | * 17 | * 18 | */ 19 | 20 | /** 21 | * Fired when the deploy command is started 22 | * 23 | * @param object $console Instance of WPBones Console 24 | * @param string $path Destination path 25 | */ 26 | add_action('wpbones_console_deploy_start', function ($console, $path) { 27 | // Do something 28 | }, 10, 2); 29 | 30 | /** 31 | * Fired before building assets 32 | * 33 | * @param object $console Instance of WPBones Console 34 | * @param string $path Destination path 35 | */ 36 | add_action('wpbones_console_deploy_before_build_assets', function ($console, $path) { 37 | // Do something 38 | }, 10, 2); 39 | 40 | /** 41 | * Fired after building assets 42 | * 43 | * @param object $console Instance of WPBones Console 44 | * @param string $path Destination path 45 | */ 46 | add_action('wpbones_console_deploy_after_build_assets', function ($console, $path) { 47 | // Do something 48 | }, 10, 2); 49 | 50 | /** 51 | * Filter the list of the folder to skip for the deploy version 52 | * 53 | * @param array $folders List of folders to skip 54 | * @return array List of folders to skip 55 | */ 56 | add_filter('wpbones_console_deploy_skip_folders', function ($folders) { 57 | return $folders; 58 | }); 59 | 60 | /** 61 | * Fired when the deploy command is completed 62 | * 63 | * @param object $console Instance of WPBones Console 64 | * @param string $path Destination path 65 | */ 66 | add_action('wpbones_console_deploy_completed', function ($console, $path) { 67 | // Do something 68 | }, 10, 2); 69 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | \n" 8 | "Language-Team: LANGUAGE \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "POT-Creation-Date: 2024-09-05T15:12:14+00:00\n" 13 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 | "X-Generator: WP-CLI 2.11.0\n" 15 | "X-Domain: wp-kirk\n" 16 | 17 | #. Plugin Name of the plugin 18 | #: wp-kirk.php 19 | msgid "WP Kirk" 20 | msgstr "" 21 | 22 | #. Plugin URI of the plugin 23 | #: wp-kirk.php 24 | msgid "https://github.com/wpbones/WPKirk" 25 | msgstr "" 26 | 27 | #. Description of the plugin 28 | #: wp-kirk.php 29 | msgid "WP Bones Demo WordPress plugin" 30 | msgstr "" 31 | 32 | #. Author of the plugin 33 | #: wp-kirk.php 34 | msgid "Giovambattista Fazioli" 35 | msgstr "" 36 | 37 | #. Author URI of the plugin 38 | #: wp-kirk.php 39 | msgid "http://undolog.com" 40 | msgstr "" 41 | 42 | #: config/custom.php:19 43 | msgid "Hello, Captain!" 44 | msgstr "" 45 | 46 | #: config/menus.php:24 47 | msgid "Main View" 48 | msgstr "" 49 | 50 | #: config/menus.php:30 51 | #: resources/views/dashboard/assets.php:12 52 | #: resources/views/dashboard/assets.php:23 53 | msgid "Assets" 54 | msgstr "" 55 | 56 | #: config/menus.php:36 57 | msgid "React Application" 58 | msgstr "" 59 | 60 | #: config/menus.php:42 61 | msgid "React Settings" 62 | msgstr "" 63 | 64 | #: config/menus.php:48 65 | msgid "Ajax Example" 66 | msgstr "" 67 | 68 | #: config/menus.php:54 69 | msgid "Options" 70 | msgstr "" 71 | 72 | #: config/menus.php:60 73 | msgid "Options View" 74 | msgstr "" 75 | 76 | #: config/menus.php:67 77 | msgid "Options Resource" 78 | msgstr "" 79 | 80 | #: config/menus.php:74 81 | msgid "HTML" 82 | msgstr "" 83 | 84 | #: config/menus.php:80 85 | msgid "Official Packages" 86 | msgstr "" 87 | 88 | #: config/menus.php:87 89 | msgid "Tables Example #1" 90 | msgstr "" 91 | 92 | #: config/menus.php:94 93 | msgid "Tables Example #2" 94 | msgstr "" 95 | 96 | #: config/menus.php:101 97 | msgid "Tables Example #3" 98 | msgstr "" 99 | 100 | #: config/menus.php:108 101 | msgid "API" 102 | msgstr "" 103 | 104 | #: config/menus.php:114 105 | #: resources/views/dashboard/database.php:13 106 | msgid "Database" 107 | msgstr "" 108 | 109 | #: config/menus.php:120 110 | msgid "Model" 111 | msgstr "" 112 | 113 | #: config/menus.php:126 114 | #: resources/views/dashboard/eloquent.php:16 115 | msgid "Eloquent ORM" 116 | msgstr "" 117 | 118 | #: config/menus.php:132 119 | msgid "Blade" 120 | msgstr "" 121 | 122 | #: config/options.php:25 123 | msgid "Hello" 124 | msgstr "" 125 | 126 | #: config/routes.php:19 127 | msgid "Title of page" 128 | msgstr "" 129 | 130 | #: config/routes.php:27 131 | msgid "Second" 132 | msgstr "" 133 | 134 | #: pages/custom_page.php:9 135 | msgid "Hello, Custom Page!" 136 | msgstr "" 137 | 138 | #: plugin/Ajax/MyAjax.php:35 139 | msgid "You have clicked Ajax Trusted" 140 | msgstr "" 141 | 142 | #: plugin/Ajax/MyAjax.php:42 143 | msgid "You have clicked Ajax Logged" 144 | msgstr "" 145 | 146 | #: plugin/Ajax/MyAjax.php:49 147 | msgid "You have clicked Ajax notLogged" 148 | msgstr "" 149 | 150 | #: plugin/Http/Controllers/SearchTable.php:17 151 | msgid "My amazing list of Cakes" 152 | msgstr "" 153 | 154 | #: plugin/Http/Controllers/SearchTable.php:26 155 | msgid "Description" 156 | msgstr "" 157 | 158 | #: plugin/Http/Controllers/SearchTable.php:27 159 | msgid "Ingredients" 160 | msgstr "" 161 | 162 | #: resources/views/dashboard/api.php:22 163 | msgid "REST API" 164 | msgstr "" 165 | 166 | #: resources/views/dashboard/api.php:23 167 | #: resources/views/dashboard/api.php:40 168 | msgid "Routing" 169 | msgstr "" 170 | 171 | #: resources/views/dashboard/api.php:24 172 | #: resources/views/dashboard/api.php:61 173 | msgid "HTTP Methods" 174 | msgstr "" 175 | 176 | #: resources/views/dashboard/api.php:34 177 | msgid "From release v0.13+ WPBones provides a simple way to handle the WordPress Rest API." 178 | msgstr "" 179 | 180 | #: resources/views/dashboard/api.php:35 181 | msgid "To create your custom API, you have to create a new folder into" 182 | msgstr "" 183 | 184 | #: resources/views/dashboard/api.php:35 185 | msgid "in the root of your plugin. The main folder will be the vendor. Usually, into the vendor folder you'll create the version folder as well. For example, you may create" 186 | msgstr "" 187 | 188 | #: resources/views/dashboard/api.php:42 189 | msgid "Now, we can start to create the Rest API route by adding a new file in the our structure. For example, we'll use" 190 | msgstr "" 191 | 192 | #: resources/views/dashboard/api.php:48 193 | #: resources/views/dashboard/api.php:68 194 | #: resources/views/dashboard/api.php:81 195 | msgid "Let's see a simple implementation of" 196 | msgstr "" 197 | 198 | #: resources/views/dashboard/api.php:58 199 | msgid "You can try the API" 200 | msgstr "" 201 | 202 | #: resources/views/dashboard/api.php:59 203 | msgid "here" 204 | msgstr "" 205 | 206 | #: resources/views/dashboard/api.php:63 207 | msgid "The Route class supports the following HTTP methods:" 208 | msgstr "" 209 | 210 | #: resources/views/dashboard/api.php:64 211 | msgid "In short, the same supported by the WordPress REST API and defined in the" 212 | msgstr "" 213 | 214 | #: resources/views/dashboard/api.php:68 215 | #: resources/views/dashboard/api.php:81 216 | msgid "using the" 217 | msgstr "" 218 | 219 | #: resources/views/dashboard/api.php:68 220 | #: resources/views/dashboard/api.php:81 221 | msgid "method" 222 | msgstr "" 223 | 224 | #: resources/views/dashboard/api.php:79 225 | msgid "Instead of use the static method" 226 | msgstr "" 227 | 228 | #: resources/views/dashboard/api.php:79 229 | msgid "and so on, you can use the" 230 | msgstr "" 231 | 232 | #: resources/views/dashboard/api.php:79 233 | msgid "instead. You will be able to use multiple HTTP verbs at the same time." 234 | msgstr "" 235 | 236 | #: resources/views/dashboard/api.php:105 237 | msgid "You will find further information and details in the" 238 | msgstr "" 239 | 240 | #: resources/views/dashboard/api.php:106 241 | msgid "Official WP Bones docs" 242 | msgstr "" 243 | 244 | #: resources/views/dashboard/assets.php:16 245 | msgid "Styles" 246 | msgstr "" 247 | 248 | #: resources/views/dashboard/assets.php:17 249 | msgid "Javascript" 250 | msgstr "" 251 | 252 | #: resources/views/dashboard/assets.php:18 253 | #: resources/views/dashboard/assets.php:45 254 | msgid "ReactJS and Typescript" 255 | msgstr "" 256 | 257 | #: resources/views/dashboard/assets.php:25 258 | msgid "WP Bones provides a simple way to include assets in your plugin. You can include styles and scripts in the admin area and in the public area." 259 | msgstr "" 260 | 261 | #: resources/views/dashboard/assets.php:29 262 | msgid "Currently, WP Bones supports the following styles: standard CSS files, SCSS files, and LESS files. You may create your styles in the resources/assets/css directory." 263 | msgstr "" 264 | 265 | #: resources/views/dashboard/assets.php:30 266 | msgid "The files .css, .scss, and .less will be compiled and you will find the css compiled in the public/css directory." 267 | msgstr "" 268 | 269 | #: resources/views/dashboard/assets.php:31 270 | msgid "Next, you can include your styles by using the usual way" 271 | msgstr "" 272 | 273 | #: resources/views/dashboard/assets.php:42 274 | msgid "Javascript files work in the same way as styles. You can create your javascript files in the resources/assets/js directory." 275 | msgstr "" 276 | 277 | #: resources/views/dashboard/assets.php:43 278 | msgid "You can find more details in the Assets documentation." 279 | msgstr "" 280 | 281 | #: resources/views/dashboard/assets.php:47 282 | msgid "You may use gulp to compile simple React components. you will be able to compile .jsx files and .tsx files. The compiled files will be in the public/js directory." 283 | msgstr "" 284 | 285 | #: resources/views/dashboard/assets.php:49 286 | msgid "React component is a JavaScript file that contains a component. It can be a simple component or a complex one. You can use it to create a custom page or a custom widget. Now it's available to use in your WordPress environment." 287 | msgstr "" 288 | 289 | #: resources/views/dashboard/assets.php:51 290 | msgid "Step 1 - create a placeholder" 291 | msgstr "" 292 | 293 | #: resources/views/dashboard/assets.php:53 294 | msgid "We create a placeholder div with an id." 295 | msgstr "" 296 | 297 | #: resources/views/dashboard/assets.php:57 298 | msgid "Step 2 - include the JavaScript file" 299 | msgstr "" 300 | 301 | #: resources/views/dashboard/assets.php:59 302 | msgid "In the Dashboard controller we include the JavaScript file. It's a simple example, but you can include it in a more complex way." 303 | msgstr "" 304 | 305 | #: resources/views/dashboard/assets.php:71 306 | msgid "Step 3 - create the React component" 307 | msgstr "" 308 | 309 | #: resources/views/dashboard/assets.php:73 310 | msgid "In the" 311 | msgstr "" 312 | 313 | #: resources/views/dashboard/assets.php:73 314 | msgid "directory we create a new file" 315 | msgstr "" 316 | 317 | #: resources/views/dashboard/assets.php:73 318 | msgid "with the following content:" 319 | msgstr "" 320 | 321 | #: resources/views/dashboard/assets.php:111 322 | msgid "Step 4 - compile" 323 | msgstr "" 324 | 325 | #: resources/views/dashboard/assets.php:113 326 | msgid "Run the following command to compile the JavaScript file:" 327 | msgstr "" 328 | 329 | #: resources/views/dashboard/assets.php:117 330 | msgid "Step 5 - check the result below" 331 | msgstr "" 332 | 333 | #: resources/views/dashboard/custom_page.php:11 334 | msgid "Hello, I'm a Custom Page defined in" 335 | msgstr "" 336 | 337 | #: resources/views/dashboard/custom_page.php:11 338 | msgid "folder" 339 | msgstr "" 340 | 341 | #: resources/views/dashboard/custom_page.php:13 342 | msgid "You may create a PHP file in" 343 | msgstr "" 344 | 345 | #: resources/views/dashboard/custom_page.php:13 346 | msgid "folder and name it" 347 | msgstr "" 348 | 349 | #: resources/views/dashboard/custom_page.php:38 350 | msgid "Back" 351 | msgstr "" 352 | 353 | #: resources/views/dashboard/database.php:17 354 | #: resources/views/dashboard/database.php:24 355 | msgid "Query Builder" 356 | msgstr "" 357 | 358 | #: resources/views/dashboard/database.php:18 359 | #: resources/views/dashboard/database.php:34 360 | msgid "Example" 361 | msgstr "" 362 | 363 | #: resources/views/dashboard/database.php:26 364 | msgid "WP Bones's database query builder provides a convenient, fluent interface to creating and running database queries. It can be used to perform most database operations in your WordPress instance." 365 | msgstr "" 366 | 367 | #: resources/views/dashboard/database.php:47 368 | msgid "You can find more" 369 | msgstr "" 370 | 371 | #: resources/views/dashboard/database.php:47 372 | msgid "example here" 373 | msgstr "" 374 | 375 | #: resources/views/dashboard/eloquent.php:18 376 | msgid "You may include the Eloquent ORM to provide a beautiful, simple ActiveRecord implementation for working with your database. Each database table has a corresponding \"Model\" which is used to interact with that table. Models allow you to query for data in your tables, as well as insert new records into the table." 377 | msgstr "" 378 | 379 | #: resources/views/dashboard/eloquent.php:20 380 | msgid "You may install Eloquent ORM in your plugin by using" 381 | msgstr "" 382 | 383 | #: resources/views/dashboard/eloquent.php:24 384 | msgid "As we are using the complete illuminate database package, for further documentation on using the various database facilities this library provides, consult the" 385 | msgstr "" 386 | 387 | #: resources/views/dashboard/eloquent.php:24 388 | #: resources/views/dashboard/eloquent.php:94 389 | msgid "Laravel framework documentation" 390 | msgstr "" 391 | 392 | #: resources/views/dashboard/eloquent.php:26 393 | msgid "Query WordPress users table" 394 | msgstr "" 395 | 396 | #: resources/views/dashboard/eloquent.php:34 397 | #: resources/views/dashboard/eloquent.php:63 398 | msgid "Output" 399 | msgstr "" 400 | 401 | #: resources/views/dashboard/eloquent.php:40 402 | msgid "Find" 403 | msgstr "" 404 | 405 | #: resources/views/dashboard/eloquent.php:42 406 | msgid "Of course, you'll be able to use all eloquent features" 407 | msgstr "" 408 | 409 | #: resources/views/dashboard/eloquent.php:53 410 | msgid "Custom Table" 411 | msgstr "" 412 | 413 | #: resources/views/dashboard/eloquent.php:55 414 | msgid "Alongside the WordPress table you may use eloquent for your custom database table" 415 | msgstr "" 416 | 417 | #: resources/views/dashboard/eloquent.php:69 418 | msgid "and get single column value" 419 | msgstr "" 420 | 421 | #: resources/views/dashboard/eloquent.php:80 422 | msgid "Loop into" 423 | msgstr "" 424 | 425 | #: resources/views/dashboard/eloquent.php:94 426 | msgid "For further documentation on using the various database facilities this library provides, consult the" 427 | msgstr "" 428 | 429 | #: resources/views/dashboard/index.php:12 430 | msgid "Hello, I'm the first %s view" 431 | msgstr "" 432 | 433 | #: resources/views/dashboard/index.php:17 434 | #: resources/views/dashboard/index.php:68 435 | msgid "Passing data to view" 436 | msgstr "" 437 | 438 | #: resources/views/dashboard/index.php:18 439 | #: resources/views/dashboard/index.php:74 440 | msgid "Configuration" 441 | msgstr "" 442 | 443 | #: resources/views/dashboard/index.php:19 444 | #: resources/views/dashboard/index.php:84 445 | msgid "Plugin information" 446 | msgstr "" 447 | 448 | #: resources/views/dashboard/index.php:20 449 | #: resources/views/dashboard/index.php:97 450 | msgid "Custom Pages" 451 | msgstr "" 452 | 453 | #: resources/views/dashboard/index.php:25 454 | msgid "Welcome to the WP Bones template WordPress plugin" 455 | msgstr "" 456 | 457 | #: resources/views/dashboard/index.php:26 458 | msgid "This is a simple template plugin for WordPress. It is based on the WP Bones framework." 459 | msgstr "" 460 | 461 | #: resources/views/dashboard/index.php:27 462 | msgid "It is a plugin that shows most of the features of the WP Bones framework. It is a good starting point for creating your own plugin." 463 | msgstr "" 464 | 465 | #: resources/views/dashboard/index.php:35 466 | msgid "This view is displayed by a Controller connected to the menu you have selected." 467 | msgstr "" 468 | 469 | #: resources/views/dashboard/index.php:36 470 | msgid "The menu is defined in the" 471 | msgstr "" 472 | 473 | #: resources/views/dashboard/index.php:36 474 | #: resources/views/dashboard/index.php:53 475 | #: resources/views/dashboard/index.php:66 476 | msgid "file." 477 | msgstr "" 478 | 479 | #: resources/views/dashboard/index.php:53 480 | msgid "The controller is located in the" 481 | msgstr "" 482 | 483 | #: resources/views/dashboard/index.php:66 484 | msgid "The HTML part view is located in the" 485 | msgstr "" 486 | 487 | #: resources/views/dashboard/index.php:70 488 | msgid "You may get variable from the controller. For example, the variable" 489 | msgstr "" 490 | 491 | #: resources/views/dashboard/index.php:70 492 | msgid "is" 493 | msgstr "" 494 | 495 | #: resources/views/dashboard/index.php:75 496 | msgid "Get the" 497 | msgstr "" 498 | 499 | #: resources/views/dashboard/index.php:75 500 | msgid "configuration by using" 501 | msgstr "" 502 | 503 | #: resources/views/dashboard/index.php:79 504 | msgid "It will return" 505 | msgstr "" 506 | 507 | #: resources/views/dashboard/index.php:85 508 | msgid "You may get the plugin information by using" 509 | msgstr "" 510 | 511 | #: resources/views/dashboard/index.php:99 512 | msgid "To create a custom pages without a menu, you may config the" 513 | msgstr "" 514 | 515 | #: resources/views/dashboard/index.php:99 516 | #: resources/views/dashboard/index.php:104 517 | msgid "file in the" 518 | msgstr "" 519 | 520 | #: resources/views/dashboard/index.php:101 521 | msgid "folder of the Plugin" 522 | msgstr "" 523 | 524 | #: resources/views/dashboard/index.php:104 525 | msgid "For example, you may create a" 526 | msgstr "" 527 | 528 | #: resources/views/dashboard/index.php:105 529 | msgid "folder of the plugin" 530 | msgstr "" 531 | 532 | #: resources/views/dashboard/index.php:107 533 | msgid "Here is an example of" 534 | msgstr "" 535 | 536 | #: resources/views/dashboard/index.php:140 537 | msgid "You can get the custom page URL by using" 538 | msgstr "" 539 | 540 | #: resources/views/dashboard/index.php:147 541 | msgid "Custom Page" 542 | msgstr "" 543 | 544 | #: resources/views/dashboard/second.php:12 545 | msgid "Hello, I'm a second view" 546 | msgstr "" 547 | 548 | #: resources/views/dashboard/second.php:14 549 | msgid "You can localize me" 550 | msgstr "" 551 | 552 | #: resources/views/dashboard/second.php:16 553 | msgid "Click me for Ajax logged" 554 | msgstr "" 555 | 556 | #: resources/views/dashboard/second.php:17 557 | msgid "Click me for Ajax trusted" 558 | msgstr "" 559 | 560 | #: resources/views/dashboard/second.php:18 561 | msgid "Click me for Ajax notLogged" 562 | msgstr "" 563 | 564 | #: public/apps/app.js:1 565 | msgid "The %s is a collection of React components that are designed to be simple, easy to use, and accessible. The library is built with TypeScript and has a small bundle size, making it a great choice for building modern web applications." 566 | msgstr "" 567 | 568 | #: public/apps/app.js:1 569 | msgid "Some of the key features of Mantine include:" 570 | msgstr "" 571 | 572 | #: public/apps/app.js:1 573 | msgid "Simple and easy-to-use components" 574 | msgstr "" 575 | 576 | #: public/apps/app.js:1 577 | msgid "Accessible design and keyboard navigation" 578 | msgstr "" 579 | 580 | #: public/apps/app.js:1 581 | msgid "Dark mode support" 582 | msgstr "" 583 | 584 | #: public/apps/app.js:1 585 | msgid "Customizable styles and themes" 586 | msgstr "" 587 | 588 | #: public/apps/app.js:1 589 | msgid "Support for TypeScript" 590 | msgstr "" 591 | 592 | #: public/apps/app.js:1 593 | msgid "Small bundle size" 594 | msgstr "" 595 | 596 | #: public/apps/app.js:1 597 | msgid "Active development and community support" 598 | msgstr "" 599 | 600 | #: public/apps/app.js:1 601 | msgid "And much more!" 602 | msgstr "" 603 | 604 | #: public/apps/app.js:1 605 | msgid "In this Demo we are using the %s to create a simple tabbed interface. And we are using the %s to handle the routing." 606 | msgstr "" 607 | 608 | #: public/apps/app.js:1 609 | msgid "This is a React component that is rendered inside a div with the id react-app." 610 | msgstr "" 611 | 612 | #: public/apps/app.js:1 613 | msgid "The component was created using the official WordPress package for React" 614 | msgstr "" 615 | 616 | #: public/apps/app.js:1 617 | msgid "Obviously, this is a very simple example, but it should give you a good starting point for creating more complex interfaces. And remember, you can use any React library you want, not just Mantine." 618 | msgstr "" 619 | 620 | #: public/apps/app.js:1 621 | msgid "Swimming challenge" 622 | msgstr "" 623 | 624 | #: public/apps/app.js:1 625 | msgid "32 km / week" 626 | msgstr "" 627 | 628 | #: public/apps/app.js:1 629 | msgid "Progress" 630 | msgstr "" 631 | 632 | #: public/apps/app.js:1 633 | msgid "4 days left" 634 | msgstr "" 635 | 636 | #: public/apps/app.js:1 637 | msgid "Overview" 638 | msgstr "" 639 | 640 | #: public/apps/app.js:1 641 | msgid "Mantine UI" 642 | msgstr "" 643 | 644 | #: public/apps/app.js:1 645 | msgid "Settings" 646 | msgstr "" 647 | 648 | #: public/apps/app.js:1 649 | msgid "Say Hello, Mantine Application" 650 | msgstr "" 651 | -------------------------------------------------------------------------------- /languages/wp-kirk-es_ES.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpbones/WPKirk/fea4527c268d0f5600cb31092cfe7c6a22725b90/languages/wp-kirk-es_ES.mo -------------------------------------------------------------------------------- /languages/wp-kirk-es_ES.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: WP Kirk\n" 4 | "POT-Creation-Date: 2024-09-05 12:17+0200\n" 5 | "PO-Revision-Date: 2024-09-05 12:18+0200\n" 6 | "Last-Translator: \n" 7 | "Language-Team: Giovambattista Fazioli \n" 8 | "Language: es_ES\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 13 | "X-Generator: Poedit 3.5\n" 14 | "X-Poedit-Basepath: ..\n" 15 | "X-Poedit-Flags-xgettext: --add-comments=translators:\n" 16 | "X-Poedit-WPHeader: wp-kirk.php\n" 17 | "X-Poedit-SourceCharset: UTF-8\n" 18 | "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" 19 | "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" 20 | "_nx_noop:3c,1,2;__ngettext_noop:1,2\n" 21 | "X-Poedit-SearchPath-0: .\n" 22 | "X-Poedit-SearchPathExcluded-0: node_modules\n" 23 | "X-Poedit-SearchPathExcluded-1: vendor\n" 24 | "X-Poedit-SearchPathExcluded-2: resources/assets\n" 25 | 26 | #: config/custom.php:19 27 | msgid "Hello, Captain!" 28 | msgstr "¡Hola, capitán!" 29 | 30 | #: config/menus.php:24 31 | msgid "Main View" 32 | msgstr "Vista principal" 33 | 34 | #: config/menus.php:30 35 | msgid "Assets" 36 | msgstr "Activos" 37 | 38 | #: config/menus.php:36 39 | msgid "React Application" 40 | msgstr "Aplicación React" 41 | 42 | #: config/menus.php:42 43 | msgid "React Settings" 44 | msgstr "Configuración de React" 45 | 46 | #: config/menus.php:48 47 | msgid "Ajax Example" 48 | msgstr "Ejemplo de Ajax" 49 | 50 | #: config/menus.php:54 51 | msgid "Options" 52 | msgstr "Opciones" 53 | 54 | #: config/menus.php:60 55 | msgid "Options View" 56 | msgstr "Vista de opciones" 57 | 58 | #: config/menus.php:67 59 | msgid "Options Resource" 60 | msgstr "Recurso de opciones" 61 | 62 | #: config/menus.php:74 63 | msgid "HTML" 64 | msgstr "HTML" 65 | 66 | #: config/menus.php:80 67 | msgid "Official Packages" 68 | msgstr "Paquetes Oficiales" 69 | 70 | #: config/menus.php:87 71 | msgid "Tables Example #1" 72 | msgstr "Ejemplo de Tablas #1" 73 | 74 | #: config/menus.php:94 75 | msgid "Tables Example #2" 76 | msgstr "Ejemplo de tablas #2" 77 | 78 | #: config/menus.php:101 79 | msgid "Tables Example #3" 80 | msgstr "Ejemplo de Tablas #3" 81 | 82 | #: config/menus.php:108 83 | msgid "API" 84 | msgstr "API" 85 | 86 | #: config/menus.php:114 87 | msgid "Database" 88 | msgstr "Base de datos" 89 | 90 | #: config/menus.php:120 91 | msgid "Model" 92 | msgstr "Modelo" 93 | 94 | #: config/menus.php:126 95 | msgid "Eloquent ORM" 96 | msgstr "ORM elocuente" 97 | 98 | #: config/menus.php:132 99 | msgid "Blade" 100 | msgstr "Blade" 101 | 102 | #: config/options.php:25 103 | msgid "Hello" 104 | msgstr "Hola" 105 | 106 | #: config/routes.php:19 107 | msgid "Title of page" 108 | msgstr "Título de la página" 109 | 110 | #: config/routes.php:27 111 | msgid "Second" 112 | msgstr "Segundo" 113 | 114 | #: pages/custom_page.php:9 115 | msgid "Hello, Custom Page!" 116 | msgstr "¡Hola, página personalizada!" 117 | 118 | #: plugin/Ajax/MyAjax.php:35 119 | msgid "You have clicked Ajax Trusted" 120 | msgstr "Ha hecho clic en Ajax Trusted" 121 | 122 | #: plugin/Ajax/MyAjax.php:42 123 | msgid "You have clicked Ajax Logged" 124 | msgstr "Ha hecho clic en Ajax Registrado" 125 | 126 | #: plugin/Ajax/MyAjax.php:49 127 | msgid "You have clicked Ajax notLogged" 128 | msgstr "Ha hecho clic en Ajax notLogged" 129 | 130 | #: plugin/Http/Controllers/SearchTable.php:17 131 | msgid "My amazing list of Cakes" 132 | msgstr "Mi increíble lista de pasteles" 133 | 134 | #: plugin/Http/Controllers/SearchTable.php:26 135 | msgid "Description" 136 | msgstr "Descripción" 137 | 138 | #: plugin/Http/Controllers/SearchTable.php:27 139 | msgid "Ingredients" 140 | msgstr "Ingredientes" 141 | 142 | #: plugin/Http/Controllers/SearchTable.php:89 143 | msgid "Search Cakes" 144 | msgstr "Buscar Pasteles" 145 | 146 | #: plugin/Http/Controllers/SearchTable.php:122 147 | msgid "Delete" 148 | msgstr "Borrar" 149 | 150 | #: plugin/Http/Controllers/SearchTable.php:123 151 | msgid "Keep Trash" 152 | msgstr "Guarda la basura" 153 | 154 | #: plugin/Http/Controllers/SearchTable.php:124 155 | msgid "Choccolate" 156 | msgstr "Chocolate" 157 | 158 | #: resources/views/dashboard/index.php:12 159 | #, php-format 160 | msgid "Hello, I'm the first %s view" 161 | msgstr "Hola, soy el primero %s ver" 162 | 163 | #: resources/views/dashboard/index.php:17 164 | #: resources/views/dashboard/index.php:68 165 | msgid "Passing data to view" 166 | msgstr "Pasar datos a la vista" 167 | 168 | #: resources/views/dashboard/index.php:18 169 | #: resources/views/dashboard/index.php:74 170 | msgid "Configuration" 171 | msgstr "Configuración" 172 | 173 | #: resources/views/dashboard/index.php:19 174 | #: resources/views/dashboard/index.php:84 175 | msgid "Plugin information" 176 | msgstr "Información del plugin" 177 | 178 | #: resources/views/dashboard/index.php:20 179 | #: resources/views/dashboard/index.php:97 180 | msgid "Custom Pages" 181 | msgstr "Páginas personalizadas" 182 | 183 | #: resources/views/dashboard/index.php:25 184 | msgid "Welcome to the WP Bones template WordPress plugin" 185 | msgstr "Bienvenido al plugin de WordPress de plantillas WP Bones" 186 | 187 | #: resources/views/dashboard/index.php:26 188 | msgid "" 189 | "This is a simple template plugin for WordPress. It is based on the WP Bones " 190 | "framework." 191 | msgstr "" 192 | "Este es un complemento de plantilla simple para WordPress. Se basa en el " 193 | "marco WP Bones." 194 | 195 | #: resources/views/dashboard/index.php:27 196 | msgid "" 197 | "It is a plugin that shows most of the features of the WP Bones framework. It " 198 | "is a good starting point for creating your own plugin." 199 | msgstr "" 200 | "Es un complemento que muestra la mayoría de las características del marco WP " 201 | "Bones. Es un buen punto de partida para crear tu propio plugin." 202 | 203 | #: resources/views/dashboard/index.php:35 204 | msgid "" 205 | "This view is displayed by a Controller connected to the menu you have " 206 | "selected." 207 | msgstr "" 208 | "Esta vista se muestra mediante un controlador conectado al menú que ha " 209 | "seleccionado." 210 | 211 | #: resources/views/dashboard/index.php:36 212 | msgid "The menu is defined in the" 213 | msgstr "El menú se define en el archivo" 214 | 215 | #: resources/views/dashboard/index.php:36 216 | #: resources/views/dashboard/index.php:53 217 | #: resources/views/dashboard/index.php:66 218 | msgid "file." 219 | msgstr "archivo." 220 | 221 | #: resources/views/dashboard/index.php:53 222 | msgid "The controller is located in the" 223 | msgstr "El controlador se encuentra en el" 224 | 225 | #: resources/views/dashboard/index.php:66 226 | msgid "The HTML part view is located in the" 227 | msgstr "La vista de parte HTML se encuentra en el archivo" 228 | 229 | #: resources/views/dashboard/index.php:70 230 | msgid "You may get variable from the controller. For example, the variable" 231 | msgstr "Puede obtener una variable del controlador. Por ejemplo, la variable" 232 | 233 | #: resources/views/dashboard/index.php:70 234 | msgid "is" 235 | msgstr "es" 236 | 237 | #: resources/views/dashboard/index.php:75 238 | msgid "Get the" 239 | msgstr "Obtener el" 240 | 241 | #: resources/views/dashboard/index.php:75 242 | msgid "configuration by using" 243 | msgstr "configuración mediante el uso de" 244 | 245 | #: resources/views/dashboard/index.php:79 246 | msgid "It will return" 247 | msgstr "Volverá" 248 | 249 | #: resources/views/dashboard/index.php:85 250 | msgid "You may get the plugin information by using" 251 | msgstr "Puede obtener la información del complemento mediante el uso de" 252 | 253 | #: resources/views/dashboard/index.php:99 254 | msgid "To create a custom pages without a menu, you may config the" 255 | msgstr "" 256 | "Para crear páginas personalizadas sin un menú, puede configurar el archivo" 257 | 258 | #: resources/views/dashboard/index.php:99 259 | #: resources/views/dashboard/index.php:104 260 | msgid "file in the" 261 | msgstr "en el archivo" 262 | 263 | #: resources/views/dashboard/index.php:101 264 | msgid "folder of the Plugin" 265 | msgstr "carpeta del Plugin" 266 | 267 | #: resources/views/dashboard/index.php:104 268 | msgid "For example, you may create a" 269 | msgstr "Por ejemplo, puede crear un archivo" 270 | 271 | #: resources/views/dashboard/index.php:105 272 | msgid "folder of the plugin" 273 | msgstr "carpeta del plugin" 274 | 275 | #: resources/views/dashboard/index.php:107 276 | msgid "Here is an example of" 277 | msgstr "A continuación, se muestra un ejemplo de" 278 | 279 | #: resources/views/dashboard/index.php:140 280 | msgid "You can get the custom page URL by using" 281 | msgstr "Puede obtener la dirección URL de la página personalizada mediante" 282 | 283 | #: resources/views/dashboard/index.php:147 284 | msgid "Custom Page" 285 | msgstr "Personalice Página" 286 | 287 | #: resources/views/dashboard/second.php:14 288 | msgid "You can localize me" 289 | msgstr "Puedes localizarme" 290 | 291 | #. Plugin Name of the plugin/theme 292 | msgid "WP Kirk" 293 | msgstr "WP Kirk" 294 | 295 | #. Plugin URI of the plugin/theme 296 | msgid "https://github.com/wpbones/WPKirk" 297 | msgstr "https://github.com/wpbones/WPKirk" 298 | 299 | #. Description of the plugin/theme 300 | msgid "WP Bones Demo WordPress plugin" 301 | msgstr "Plugin de WordPress WP Bones Demo" 302 | 303 | #. Author of the plugin/theme 304 | msgid "Giovambattista Fazioli" 305 | msgstr "Giovambattista Fazioli" 306 | 307 | #. Author URI of the plugin/theme 308 | msgid "http://undolog.com" 309 | msgstr "http://undolog.com" 310 | -------------------------------------------------------------------------------- /languages/wp-kirk-it_IT-2fa1a8b4d52e5c72f54dd47636d2e1f4.json: -------------------------------------------------------------------------------- 1 | {"translation-revision-date":"2024-09-15 17:09+0200","generator":"WP-CLI\/2.11.0","source":"public\/apps\/app.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"it_IT","plural-forms":"nplurals=2; plural=(n != 1);"},"The %s is a collection of React components that are designed to be simple, easy to use, and accessible. The library is built with TypeScript and has a small bundle size, making it a great choice for building modern web applications.":["La %s \u00e8 una collezione di componenti React che sono progettati per essere semplici, facili da usare e accessibili. La libreria \u00e8 costruita con TypeScript e ha una dimensione del pacchetto ridotta, rendendola una scelta eccellente per lo sviluppo di applicazioni web moderne."],"Some of the key features of Mantine include:":["Alcune delle caratteristiche principali di Mantine includono:"],"Simple and easy-to-use components":["Componenti semplici e facili da usare"],"Accessible design and keyboard navigation":["Design accessibile e navigazione da tastiera"],"Dark mode support":["Supporto della modalit\u00e0 oscura"],"Customizable styles and themes":["Stili e temi personalizzabili"],"Support for TypeScript":["Supporto per TypeScript"],"Small bundle size":["Fascio di piccole dimensioni"],"Active development and community support":["Sviluppo attivo e sostegno alla comunit\u00e0"],"And much more!":["E molto altro!"],"In this Demo we are using the %s to create a simple tabbed interface. And we are using the %s to handle the routing.":["In questa demo stiamo usando il %s per creare un\u2019interfaccia a schede semplice. E stiamo usando il %s per gestire il routing."],"This is a React component that is rendered inside a div with the id react-app.":["Questo \u00e8 un componente React che viene renderizzato all'interno di un div con l'id react-app."],"The component was created using the official WordPress package for React":["Il componente \u00e8 stato creato utilizzando il pacchetto WordPress ufficiale per React"],"Obviously, this is a very simple example, but it should give you a good starting point for creating more complex interfaces. And remember, you can use any React library you want, not just Mantine.":["Ovviamente, questo \u00e8 un esempio molto semplice, ma dovrebbe darti un buon punto di partenza per creare interfacce pi\u00f9 complesse. E ricorda, puoi usare qualsiasi libreria React che desideri, non solo Mantine."],"Swimming challenge":["Sfida di nuoto"],"32 km \/ week":["32 km \/ settimana"],"Progress":["Progresso"],"4 days left":["4 giorni rimasti"],"Overview":["Panoramica"],"Mantine UI":["Mantine UI"],"Settings":["Impostazioni"],"Say Hello, Mantine Application":["Di Ciao, Applicazione Mantine"]}}} -------------------------------------------------------------------------------- /languages/wp-kirk-it_IT.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpbones/WPKirk/fea4527c268d0f5600cb31092cfe7c6a22725b90/languages/wp-kirk-it_IT.mo -------------------------------------------------------------------------------- /languages/wp-kirk.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpbones/WPKirk/fea4527c268d0f5600cb31092cfe7c6a22725b90/languages/wp-kirk.mo -------------------------------------------------------------------------------- /languages/wp-kirk.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: WP Kirk\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2018-01-05 17:56+0100\n" 6 | "PO-Revision-Date: 2018-01-05 17:56+0100\n" 7 | "Last-Translator: \n" 8 | "Language-Team: Giovambattista Fazioli \n" 9 | "Language: en_US\n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | "X-Poedit-KeywordsList: __;_e;_n:1,2;_nx:1,2\n" 14 | "X-Poedit-Basepath: ..\n" 15 | "X-Poedit-SourceCharset: UTF-8\n" 16 | "X-Generator: Poedit 2.0.5\n" 17 | "Plural-Forms: nplurals=2; plural=n != 1;\n" 18 | "X-Poedit-SearchPath-0: .\n" 19 | "X-Poedit-SearchPathExcluded-0: node_modules\n" 20 | "X-Poedit-SearchPathExcluded-1: vendor\n" 21 | 22 | #: plugin/Http/Controllers/SearchTable.php:90 23 | msgid "Search Cakes" 24 | msgstr "" 25 | 26 | #: plugin/Http/Controllers/SearchTable.php:132 27 | msgid "Delete" 28 | msgstr "" 29 | 30 | #: plugin/Http/Controllers/SearchTable.php:133 31 | msgid "Keep Trash" 32 | msgstr "" 33 | 34 | #: plugin/Http/Controllers/SearchTable.php:134 35 | msgid "Choccolate" 36 | msgstr "" 37 | 38 | #: resources/views/dashboard/second.php:14 39 | msgid "You can localize me" 40 | msgstr "" 41 | 42 | #~ msgid "Description" 43 | #~ msgstr "Descrizione" 44 | 45 | #~ msgid "Placeholders" 46 | #~ msgstr "Segnaposti" 47 | 48 | #~ msgid "Environment" 49 | #~ msgstr "Ambienti" 50 | 51 | #~ msgid "Places" 52 | #~ msgstr "Posti" 53 | 54 | #~ msgid "Status" 55 | #~ msgstr "Stato" 56 | 57 | #~ msgid "Name" 58 | #~ msgstr "Nome" 59 | 60 | #~ msgid "Publish" 61 | #~ msgstr "Pubblica" 62 | 63 | #~ msgid "Trash" 64 | #~ msgstr "Cestino" 65 | 66 | #~ msgid "Edit" 67 | #~ msgstr "Modifica" 68 | 69 | #~ msgid "Restore" 70 | #~ msgstr "Repristina" 71 | 72 | #~ msgid "Icon" 73 | #~ msgstr "Icona" 74 | 75 | #~ msgid "Move to Trash" 76 | #~ msgstr "Sposta nel cestino" 77 | 78 | #~ msgid "Add" 79 | #~ msgstr "Aggiungi" 80 | 81 | #~ msgid "Update" 82 | #~ msgstr "Aggiorna" 83 | -------------------------------------------------------------------------------- /namespace: -------------------------------------------------------------------------------- 1 | WP Kirk,WPKirk -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@wpbones/wpkirk", 3 | "version": "1.7.0", 4 | "scripts": { 5 | "start:gulp": "gulp watch", 6 | "build:gulp": "gulp build", 7 | "build:apps": "wp-scripts build resources/assets/apps/app --output-path=public/apps/", 8 | "start:apps": "wp-scripts start resources/assets/apps/app --output-path=public/apps/", 9 | "build": "run-s build:gulp build:apps", 10 | "start": "run-s start:gulp start:apps", 11 | "make-pot": "wp i18n make-pot . languages/wp-kirk.pot --slug=wp-kirk --domain=wp-kirk --exclude=node_modules,resources/assets", 12 | "make-json": "wp i18n make-json languages/ --no-purge", 13 | "packages-update": "wp-scripts packages-update", 14 | "check-engines": "wp-scripts check-engines", 15 | "check-licenses": "wp-scripts check-licenses", 16 | "format": "wp-scripts format" 17 | }, 18 | "license": "GPL-3.0", 19 | "author": "Giovambattista Fazioli ", 20 | "devDependencies": { 21 | "@babel/core": "^7.24.3", 22 | "@babel/preset-env": "^7.24.3", 23 | "@babel/preset-react": "^7.24.1", 24 | "@wordpress/scripts": "^29.0.0", 25 | "gulp": "^4.0.2", 26 | "gulp-babel": "^8.0.0", 27 | "gulp-clean-css": "^4.3.0", 28 | "gulp-less": "^5.0.0", 29 | "gulp-sass": "^5.1.0", 30 | "gulp-typescript": "^2.12.2", 31 | "gulp-uglify": "^3.0.2", 32 | "gulp-watch": "^5.0.1", 33 | "npm-run-all": "^4.1.5", 34 | "sass": "^1.72.0" 35 | }, 36 | "dependencies": { 37 | "@mantine/core": "^7.12.1", 38 | "@mantine/hooks": "^7.12.1", 39 | "@tabler/icons-react": "^3.2.0", 40 | "react-router-dom": "^6.23.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /pages/custom_page.php: -------------------------------------------------------------------------------- 1 | plugin 15 | ->view('dashboard.custom_page') 16 | ->withAdminStyle('prism') 17 | ->withAdminScript('prism') 18 | ->withAdminStyle('wp-kirk-common'); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /plugin/API/WPKirkV1Controller.php: -------------------------------------------------------------------------------- 1 | response(['version' => '1.0.0']); 20 | } 21 | 22 | return $this->responseError( 23 | 'Oops!', 24 | 'Something goes wrong >> ' . $this->request->get_header('user_agent') 25 | ); 26 | } 27 | 28 | public function multiple(): WP_REST_Response 29 | { 30 | return $this->response(['multiple' => '1.0.0']); 31 | } 32 | 33 | public function error(): WP_Error 34 | { 35 | error_log('Vendor ' . $this->vendor); 36 | 37 | logger()->debug('Vendor', $this->vendor); 38 | logger()->debug('REQUEST get_method', $this->request->get_method()); 39 | logger()->debug('REQUEST get_headers', $this->request->get_headers()); 40 | logger()->debug( 41 | 'REQUEST get_query_params', 42 | $this->request->get_query_params() 43 | ); 44 | logger()->debug('REQUEST get_attributes', $this->request->get_attributes()); 45 | logger()->info('REQUEST get_attributes', $this->request->get_attributes()); 46 | 47 | return $this->responseError( 48 | 'Oops!', 49 | 'Something goes wrong >> ' . $this->request->get_header('user_agent') 50 | ); 51 | } 52 | 53 | public function controller_args(WP_REST_Request $request): WP_REST_Response 54 | { 55 | $value = var_export($request, true); 56 | 57 | return $this->response([ 58 | 'request' => $value, 59 | 'ROUTE' => $request->get_route(), 60 | ]); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /plugin/Ajax/MyAjax.php: -------------------------------------------------------------------------------- 1 | options('name')) { 21 | $this->line('Hello, ' . $this->options('name')); 22 | } else { 23 | $this->line('Hello, World!'); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /plugin/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | 'captain', 21 | 'with_front' => true, 22 | 'pages' => true, 23 | 'ep_mask' => EP_PERMALINK, 24 | ]; 25 | 26 | /** 27 | * You may override this method in order to register your own actions and filters. 28 | */ 29 | public function boot() 30 | { 31 | // You may override this method 32 | } 33 | 34 | /** 35 | * Override this method to save/update your custom data. 36 | * This method is called by hook action save_post_{post_type}`. 37 | * 38 | * @param int|string $post_id Post ID 39 | * @param object $post Optional. Post object 40 | */ 41 | public function update($post_id, $post) 42 | { 43 | // You can override this method to save your own data 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /plugin/CustomTaxonomyTypes/MyCustomTaxonomy.php: -------------------------------------------------------------------------------- 1 | view('dashboard.assets') 11 | ->withAdminStyle('wp-kirk-common') 12 | ->withAdminStyle('prism') 13 | ->withAdminScript('prism') 14 | ->withAdminScript('wp-react-component', ['wp-element']); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | view('dashboard.index') 25 | ->withAdminStyle('wp-kirk-common') 26 | ->withAdminStyle('prism') 27 | ->withAdminScript('prism') 28 | ->with('my_inject_variable', 'Captain'); 29 | } 30 | 31 | public function secondMenu() 32 | { 33 | return WPKirk() 34 | ->view('dashboard.second') 35 | ->withAdminStyle('wp-kirk-common') 36 | ->withAdminScript('wp-kirk-main'); 37 | } 38 | 39 | public function optionsMenu() 40 | { 41 | return WPKirk() 42 | ->view('dashboard.options') 43 | ->withAdminStyle('prism') 44 | ->withAdminScript('prism') 45 | ->withAdminStyle('wp-kirk-common'); 46 | } 47 | 48 | public function optionsView() 49 | { 50 | return WPKirk() 51 | ->view('dashboard.optionsview') 52 | ->withAdminStyle('prism') 53 | ->withAdminScript('prism') 54 | ->withAdminStyle('wp-kirk-common'); 55 | } 56 | 57 | public function html() 58 | { 59 | return WPKirk() 60 | ->view('dashboard.html') 61 | ->withAdminStyle('wp-kirk-common') 62 | ->withAdminStyle('prism') 63 | ->withAdminScript('prism') 64 | ->withAdminStyle('wp-kirk-dashboard'); 65 | } 66 | 67 | public function package() 68 | { 69 | PureCSSTabsProvider::enqueueStyles(); 70 | 71 | PureCSSSwitchProvider::enqueueStyles(); 72 | 73 | return WPKirk() 74 | ->view('dashboard.package') 75 | ->withAdminStyle('wp-kirk-common') 76 | ->withAdminStyle('prism') 77 | ->withAdminScript('prism'); 78 | } 79 | 80 | public function packagePost() 81 | { 82 | PureCSSTabsProvider::enqueueStyles(); 83 | 84 | PureCSSSwitchProvider::enqueueStyles(); 85 | 86 | return WPKirk() 87 | ->view('dashboard.package') 88 | ->withAdminStyle('wp-kirk-common') 89 | ->withAdminStyle('prism') 90 | ->withAdminScript('prism'); 91 | } 92 | 93 | public function saveOptions() 94 | { 95 | if ($this->request->verifyNonce('Options')) { 96 | WPKirk()->options->update($this->request->getAsOptions()); 97 | 98 | return WPKirk() 99 | ->view('dashboard.optionsview') 100 | ->withAdminStyle('wp-kirk-common') 101 | ->withAdminStyle('prism') 102 | ->withAdminScript('prism') 103 | ->with('feedback', 'Options updated!'); 104 | } else { 105 | return WPKirk() 106 | ->view('dashboard.optionsview') 107 | ->withAdminStyle('wp-kirk-common') 108 | ->withAdminStyle('prism') 109 | ->withAdminScript('prism') 110 | ->with('feedback', 'Action Not Allowed!'); 111 | } 112 | } 113 | 114 | public function customPage() 115 | { 116 | return WPKirk() 117 | ->view('dashboard.first_custom_page') 118 | ->withAdminStyle('wp-kirk-common') 119 | ->withAdminStyle('prism') 120 | ->withAdminScript('prism') 121 | ->with('method', $this->request->method); 122 | } 123 | 124 | public function secondCustomPage() 125 | { 126 | return WPKirk() 127 | ->view('dashboard.second_custom_page') 128 | ->withAdminStyle('wp-kirk-common') 129 | ->withAdminStyle('prism') 130 | ->withAdminScript('prism') 131 | ->with('method', $this->request->method); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/Dashboard/DashboardResourceController.php: -------------------------------------------------------------------------------- 1 | request->get('_redirect')) { 12 | $this->redirect($this->request->get('_redirect')); 13 | exit(); 14 | } 15 | } 16 | 17 | // GET 18 | public function index() 19 | { 20 | return WPKirk() 21 | ->view('dashboard.optionsresview') 22 | ->with('method', 'GET'); 23 | } 24 | 25 | // POST 26 | public function store() 27 | { 28 | return WPKirk() 29 | ->view('dashboard.optionsresview') 30 | ->with('method', 'POST'); 31 | } 32 | 33 | // PUT AND PATCH 34 | public function update() 35 | { 36 | return WPKirk() 37 | ->view('dashboard.optionsresview') 38 | ->with('method', 'PUT AND PATCH'); 39 | } 40 | 41 | // DELETE 42 | public function destroy() 43 | { 44 | return WPKirk() 45 | ->view('dashboard.optionsresview') 46 | ->with('method', 'DELETE'); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/EloquentProduct.php: -------------------------------------------------------------------------------- 1 | view('dashboard.api') 11 | ->withAdminStyle('prism') 12 | ->withAdminScript('prism') 13 | ->withAdminStyle('wp-kirk-common'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/ExampleBladeController.php: -------------------------------------------------------------------------------- 1 | view('blade.demo', ['users' => User::all()]) 24 | ->withAdminStyle('prism') 25 | ->withAdminScript('prism') 26 | ->withAdminStyle('wp-kirk-common'); 27 | } 28 | } 29 | EOT; 30 | 31 | $code = '@foreach ($users as $user) 32 |

user_nicename: {{ $user->user_nicename }}

33 |

user_email: {{ $user->user_email }}

34 | @endforeach'; 35 | 36 | 37 | return WPKirk() 38 | ->view('blade.demo', ['users' => User::all(), 'code' => $code, 'controller' => $controller]) 39 | ->withAdminStyle('prism') 40 | ->withAdminScript('prism') 41 | ->withAdminStyle('wp-kirk-common'); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/ExampleDatabaseController.php: -------------------------------------------------------------------------------- 1 | view('dashboard.database') 11 | ->withAdminStyle('prism') 12 | ->withAdminScript('prism') 13 | ->withAdminStyle('wp-kirk-common'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/ExampleEloquentController.php: -------------------------------------------------------------------------------- 1 | view('dashboard.eloquent') 11 | ->withAdminStyle('prism') 12 | ->withAdminScript('prism') 13 | ->withAdminStyle('wp-kirk-common'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/ExampleModelController.php: -------------------------------------------------------------------------------- 1 | view('dashboard.model') 11 | ->withAdminStyle('prism') 12 | ->withAdminScript('prism') 13 | ->withAdminStyle('wp-kirk-common'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/ExampleModelNoPrefixController.php: -------------------------------------------------------------------------------- 1 | view('dashboard.model-no-prefix') 11 | ->withAdminStyle('prism') 12 | ->withAdminScript('prism') 13 | ->withAdminStyle('wp-kirk-common'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/ExampleTable.php: -------------------------------------------------------------------------------- 1 | 'Name', 20 | 'description' => 'Description', 21 | ]; 22 | } 23 | 24 | public function getItems($args = []): array 25 | { 26 | $fake = []; 27 | 28 | for ($i = 0; $i < 20; $i++) { 29 | $fake[] = [ 30 | 'id' => "Disco {$i}", 31 | 'description' => 'Some description...', 32 | ]; 33 | } 34 | 35 | return $fake; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/ExampleTableController.php: -------------------------------------------------------------------------------- 1 | view('dashboard.table')->with('table', $table); 19 | } 20 | 21 | public function loadFluentExample() 22 | { 23 | WPTable::name('Books') 24 | ->columns([ 25 | 'id' => 'Name', 26 | 'description' => 'Description', 27 | ]) 28 | ->screenOptionLabel('Rows') 29 | ->registerScreenOption(); 30 | } 31 | 32 | public function indexFluentExample() 33 | { 34 | $items = []; 35 | 36 | for ($i = 0; $i < 20; $i++) { 37 | $items[] = [ 38 | 'id' => "Book {$i}", 39 | 'description' => 'Some description...', 40 | ]; 41 | } 42 | 43 | $table = WPTable::name('Books') 44 | ->title('My Awesome Books') 45 | ->columns([ 46 | 'id' => 'Name', 47 | 'description' => 'Description', 48 | ]) 49 | ->setItems($items); 50 | 51 | return WPKirk()->view('dashboard.table')->with('table', $table); 52 | } 53 | 54 | public function loadSearchExample() 55 | { 56 | SearchTable::registerScreenOption(); 57 | } 58 | 59 | public function indexSearchExample() 60 | { 61 | $table = new SearchTable(); 62 | 63 | return WPKirk()->view('dashboard.table')->with('table', $table); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/ReactApplicationController.php: -------------------------------------------------------------------------------- 1 | view('dashboard.react-app')->withAdminAppsScript('app'); 10 | } 11 | 12 | public function reactSettings() 13 | { 14 | return WPKirk() 15 | ->view('dashboard.react-app') 16 | ->withAdminAppsScript('app', true, 'ReactApp', [ 17 | 'tab' => 'settings', 18 | ]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /plugin/Http/Controllers/SearchTable.php: -------------------------------------------------------------------------------- 1 | title = __('My amazing list of Cakes', 'wp-kirk'); 18 | 19 | $this->name = 'cakes'; 20 | } 21 | 22 | public function getColumnsAttribute(): array 23 | { 24 | return [ 25 | 'id' => 'Name', 26 | 'description' => __('Description', 'wp-kirk'), 27 | 'ingredients' => __('Ingredients', 'wp-kirk'), 28 | ]; 29 | } 30 | 31 | public function getItems($args = []) 32 | { 33 | $fakes = []; 34 | 35 | $ingredients = ['Cream', 'Vodka', 'Choccolate', 'Milk']; 36 | 37 | for ($i = 0; $i < 10; $i++) { 38 | shuffle($ingredients); 39 | 40 | $fakes[] = [ 41 | 'id' => "Cake {$i}", 42 | 'description' => 'Some description...', 43 | 'ingredients' => $ingredients[0], 44 | ]; 45 | } 46 | 47 | $currentView = $this->getCurrentView(); 48 | 49 | if ($currentView !== 'all') { 50 | $filtered = []; 51 | 52 | foreach ($fakes as $fake) { 53 | if (strtolower($fake['ingredients']) == $currentView) { 54 | $filtered[] = $fake; 55 | } 56 | } 57 | 58 | $fakes = $filtered; 59 | } 60 | 61 | $search = $this->getSearchValue(); 62 | 63 | if ($search) { 64 | $filtered = []; 65 | 66 | foreach ($fakes as $fake) { 67 | if (strtolower($fake['id']) == strtolower($search)) { 68 | $filtered[] = $fake; 69 | } 70 | } 71 | 72 | $fakes = $filtered; 73 | } 74 | 75 | return $fakes; 76 | } 77 | 78 | public function getCurrentView() 79 | { 80 | if (isset($_REQUEST['ingredients']) && !empty($_REQUEST['ingredients'])) { 81 | return $_REQUEST['ingredients']; 82 | } 83 | 84 | return parent::getCurrentView(); 85 | } 86 | 87 | public function getSearchBoxButtonLabelAttribute() 88 | { 89 | return __('Search Cakes'); 90 | } 91 | 92 | public function getViews() 93 | { 94 | return [ 95 | 'cream' => 'Cream', 96 | ]; 97 | } 98 | 99 | public function getViewCountCream(): int 100 | { 101 | $count = 0; 102 | 103 | foreach ($this->items as $item) { 104 | if ($item['ingredients'] == 'Cream') { 105 | $count++; 106 | } 107 | } 108 | 109 | return $count; 110 | } 111 | 112 | public function getViewQueryArgCream(): array 113 | { 114 | return [ 115 | 'ingredients' => 'cream', 116 | ]; 117 | } 118 | 119 | public function getBulkActionsForView($view) 120 | { 121 | return [ 122 | 'delete' => __('Delete'), 123 | 'keep_on_trash' => __('Keep Trash'), 124 | 'fill_withChoccolate' => __('Choccolate'), 125 | ]; 126 | } 127 | 128 | public function processBulkActionDelete($items) 129 | { 130 | // TODO: delete items 131 | 132 | $this->successMessage = 'Done, deleted ' . implode(',', $items); 133 | 134 | $this->warningMessage = 'Calm! This is a demo'; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /plugin/Models/MyPluginBooks.php: -------------------------------------------------------------------------------- 1 | 'myShortcodeMethod', 16 | 'wpbones_is_category' => 'wpBonesIsCategory', 17 | ]; 18 | 19 | /** 20 | * Example of shortcode. 21 | * 22 | * @param array $atts Optional.Attribute into the shortcode 23 | * @param null $content Optional. HTML content 24 | * 25 | * @return string 26 | */ 27 | public function myShortcodeMethod($atts = [], $content = null) 28 | { 29 | // Default values for shortcode 30 | $defaults = [ 31 | 'computer' => false, 32 | ]; 33 | 34 | $atts = shortcode_atts($defaults, $atts, 'wp_kirk'); 35 | 36 | return 'Computer, engage'; 37 | } 38 | 39 | public function wpBonesIsCategory($atts = [], $content = null) 40 | { 41 | global $post; 42 | 43 | $defaults = [ 44 | 'post_type' => false, 45 | 'taxonomy' => false, 46 | 'category' => false, 47 | ]; 48 | 49 | $atts = shortcode_atts($defaults, $atts, 'wpBonesIsCategory'); 50 | 51 | if ( 52 | empty($atts['post_type']) || 53 | empty($atts['taxonomy']) || 54 | empty($atts['category']) 55 | ) { 56 | return $content; 57 | } 58 | 59 | if ( 60 | $post->post_type === $atts['post_type'] && 61 | has_term($atts['category'], $atts['taxonomy']) 62 | ) { 63 | return $content; 64 | } 65 | 66 | return ''; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /plugin/Widgets/MyWidget.php: -------------------------------------------------------------------------------- 1 | 'WP Kirk Demo Widget Description']; 33 | 34 | /** 35 | * Optional. Passed to wp_register_widget_control() 36 | * 37 | * - width: required if more than 250px 38 | * - height: currently not used but may be needed in the future 39 | * 40 | * @var array 41 | */ 42 | public $control_options = [ 43 | 'width' => 400, 44 | 'height' => 350, 45 | ]; 46 | 47 | public function update($new_instance, $old_instance) 48 | { 49 | $old_instance['title'] = $new_instance['title']; 50 | 51 | return $old_instance; 52 | } 53 | 54 | public function viewForm($instance): string 55 | { 56 | $instance = array_merge($this->defaults(), $instance); 57 | 58 | return WPKirk() 59 | ->view('widgets.form') 60 | ->with(['instance' => $instance, 'widget' => $this]); 61 | } 62 | 63 | /** 64 | * Return a key pairs array with the default value for widget. 65 | * 66 | * @return array 67 | */ 68 | public function defaults(): array 69 | { 70 | return ['title' => 'My Title']; 71 | } 72 | 73 | public function viewWidget($args, $instance) 74 | { 75 | return WPKirk() 76 | ->view('widgets.index') 77 | ->with(['args' => $args, 'instance' => $instance]) 78 | ->withStyles('wp-kirk-widget'); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /plugin/activation.php: -------------------------------------------------------------------------------- 1 | array('react', 'react-dom', 'wp-i18n'), 'version' => 'b73ed3bb5195820fb11f'); 2 | -------------------------------------------------------------------------------- /public/css/prism.css: -------------------------------------------------------------------------------- 1 | code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}pre[class*=language-].line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}div.code-toolbar{position:relative}div.code-toolbar>.toolbar{position:absolute;z-index:10;top:.3em;right:.2em;transition:opacity .3s ease-in-out;opacity:0}div.code-toolbar:hover>.toolbar{opacity:1}div.code-toolbar:focus-within>.toolbar{opacity:1}div.code-toolbar>.toolbar>.toolbar-item{display:inline-block}div.code-toolbar>.toolbar>.toolbar-item>a{cursor:pointer}div.code-toolbar>.toolbar>.toolbar-item>button{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}div.code-toolbar>.toolbar>.toolbar-item>a,div.code-toolbar>.toolbar>.toolbar-item>button,div.code-toolbar>.toolbar>.toolbar-item>span{color:#bbb;font-size:.8em;padding:0 .5em;background:#f5f2f0;background:rgba(224,224,224,.2);box-shadow:0 2px 0 0 rgba(0,0,0,.2);border-radius:.5em}div.code-toolbar>.toolbar>.toolbar-item>a:focus,div.code-toolbar>.toolbar>.toolbar-item>a:hover,div.code-toolbar>.toolbar>.toolbar-item>button:focus,div.code-toolbar>.toolbar>.toolbar-item>button:hover,div.code-toolbar>.toolbar>.toolbar-item>span:focus,div.code-toolbar>.toolbar>.toolbar-item>span:hover{color:inherit;text-decoration:none} -------------------------------------------------------------------------------- /public/css/wp-kirk-common.css: -------------------------------------------------------------------------------- 1 | .wp-kirk pre{border-radius:6px}.wp-kirk code.inline{border-radius:3px;font-size:.9em;padding:2px 6px}.wp-kirk.wp-kirk-sample p{font-size:16px}.clearfix:after,.clearfix:before{display:table!important;line-height:0!important;content:""!important}.clearfix:after{clear:both!important}.wp-kirk-align{display:block;clear:both}.wp-kirk-align-left{text-align:left}.wp-kirk-toc{float:left;position:fixed;background-color:#fff;padding:8px;border:1px solid #ddd;width:180px}.wp-kirk-toc-content{float:right;width:calc(100% - 220px)}@media (max-width:1000px){.wp-kirk-toc{float:none;position:relative;width:auto}.wp-kirk-toc li{margin-right:12px;float:left}.wp-kirk-toc-content{float:none;width:auto}} -------------------------------------------------------------------------------- /public/css/wp-kirk-dashboard.css: -------------------------------------------------------------------------------- 1 | .wp-kirk-dashboard{color:red}.wp-kirk-textarea-code{font-family:"Courier New",Courier,monospace;width:100%;min-height:100px} -------------------------------------------------------------------------------- /public/css/wp-kirk-variables.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpbones/WPKirk/fea4527c268d0f5600cb31092cfe7c6a22725b90/public/css/wp-kirk-variables.css -------------------------------------------------------------------------------- /public/css/wp-kirk-widget.css: -------------------------------------------------------------------------------- 1 | .wp-kirk-widget-title{color:red} -------------------------------------------------------------------------------- /public/css/wp-kirk.css: -------------------------------------------------------------------------------- 1 | .text{color:#333;font-size:16px} -------------------------------------------------------------------------------- /public/images/wpbones-logo-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpbones/WPKirk/fea4527c268d0f5600cb31092cfe7c6a22725b90/public/images/wpbones-logo-menu.png -------------------------------------------------------------------------------- /public/images/wpbones-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpbones/WPKirk/fea4527c268d0f5600cb31092cfe7c6a22725b90/public/images/wpbones-logo.png -------------------------------------------------------------------------------- /public/js/wp-kirk-main.js: -------------------------------------------------------------------------------- 1 | !function(t){"use strict";alert("Hi there, and Hello World!\n The jQuery version is "+t().jquery),t("#ajax-trusted").on("click",function(){t.post(ajaxurl,{action:"trusted"},function(t){alert(t)})}),t("#ajax-logged").on("click",function(){t.post(ajaxurl,{action:"logged"},function(t){alert(t)})}),t("#ajax-notLogged").on("click",function(){t.post(ajaxurl,{action:"notLogged"},function(t){alert(t)})})}(jQuery); -------------------------------------------------------------------------------- /public/js/wp-kirk-test.js: -------------------------------------------------------------------------------- 1 | var testAlert=function(){alert("Hello, World!")}; -------------------------------------------------------------------------------- /public/js/wp-react-component.js: -------------------------------------------------------------------------------- 1 | "use strict";var _excluded=["children","primary"];function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r { 13 | const pathname = window.location.pathname; 14 | const baseName = pathname.substring(0, pathname.indexOf('/admin.php')); 15 | 16 | return ( 17 | 18 |

19 | {__('Say Hello, Mantine Application', 'wp-kirk')} 20 |

21 | 22 | 23 | 24 | } /> 25 | 26 | 27 |
28 | ); 29 | }; 30 | 31 | render(, document.getElementById('react-app')); 32 | -------------------------------------------------------------------------------- /resources/assets/apps/app.module.scss: -------------------------------------------------------------------------------- 1 | // style.scss 2 | 3 | $text-color: #2271B1; 4 | $text-size: 26px; 5 | 6 | .title { 7 | color: $text-color; 8 | font-size: $text-size; 9 | } -------------------------------------------------------------------------------- /resources/assets/apps/components/Demo.jsx: -------------------------------------------------------------------------------- 1 | import { Tabs } from '@mantine/core'; 2 | import { __ } from '@wordpress/i18n'; 3 | import { useLocation, useNavigate } from 'react-router-dom'; 4 | import { Mantine } from './Mantine'; 5 | import { Overview } from './Overview'; 6 | import { Settings } from './Settings'; 7 | 8 | export const Demo = () => { 9 | const navigate = useNavigate(); 10 | const location = useLocation(); 11 | const tabValue = location.hash.slice(1); 12 | const query = new URLSearchParams(location.search); 13 | const page = query.get('page'); 14 | const defaultTab = window?.ReactApp?.tab || 'overview'; 15 | 16 | return ( 17 | navigate(`?page=${page}#${value}`)}> 21 | 22 | {__('Overview', 'wp-kirk')} 23 | {__('Mantine UI', 'wp-kirk')} 24 | {__('Settings', 'wp-kirk')} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | ); 40 | }; 41 | -------------------------------------------------------------------------------- /resources/assets/apps/components/Mantine.jsx: -------------------------------------------------------------------------------- 1 | import { List } from '@mantine/core'; 2 | import { __, sprintf } from '@wordpress/i18n'; 3 | 4 | export const Mantine = () => { 5 | const text = sprintf( 6 | __( 7 | 'The %s is a collection of React components that are designed to be simple, easy to use, and accessible. The library is built with TypeScript and has a small bundle size, making it a great choice for building modern web applications.', 8 | 'wp-kirk', 9 | ), 10 | 'Mantine UI Library', 11 | ); 12 | 13 | return ( 14 | <> 15 |

16 |

{__('Some of the key features of Mantine include:', 'wp-kirk')}

17 |

18 | 19 | 20 | {__('Simple and easy-to-use components', 'wp-kirk')} 21 | 22 | 23 | {__('Accessible design and keyboard navigation', 'wp-kirk')} 24 | 25 | {__('Dark mode support', 'wp-kirk')} 26 | 27 | {__('Customizable styles and themes', 'wp-kirk')} 28 | 29 | {__('Support for TypeScript', 'wp-kirk')} 30 | {__('Small bundle size', 'wp-kirk')} 31 | 32 | {__('Active development and community support', 'wp-kirk')} 33 | 34 | {__('And much more!', 'wp-kirk')} 35 | 36 |

37 | 38 | ); 39 | }; 40 | -------------------------------------------------------------------------------- /resources/assets/apps/components/Overview.jsx: -------------------------------------------------------------------------------- 1 | import { __, sprintf } from '@wordpress/i18n'; 2 | 3 | export const Overview = () => { 4 | const text = sprintf( 5 | __( 6 | 'In this Demo we are using the %s to create a simple tabbed interface. And we are using the %s to handle the routing.', 7 | 'wp-kirk', 8 | ), 9 | 'Mantine UI library', 10 | 'react-router-dom library', 11 | ); 12 | return ( 13 | <> 14 |

15 | {__( 16 | 'This is a React component that is rendered inside a div with the id react-app.', 17 | 'wp-kirk', 18 | )} 19 |

20 |

21 | {__( 22 | 'The component was created using the official WordPress package for React', 23 | 'wp-kirk', 24 | )}{' '} 25 | 26 | @wordpress/scripts 27 | 28 | . 29 |

30 |

31 |

32 | {__( 33 | 'Obviously, this is a very simple example, but it should give you a good starting point for creating more complex interfaces. And remember, you can use any React library you want, not just Mantine.', 34 | 'wp-kirk', 35 | )} 36 |

37 | 38 | ); 39 | }; 40 | -------------------------------------------------------------------------------- /resources/assets/apps/components/Settings.jsx: -------------------------------------------------------------------------------- 1 | import { 2 | Badge, 3 | Group, 4 | Paper, 5 | Progress, 6 | rem, 7 | Text, 8 | ThemeIcon, 9 | } from '@mantine/core'; 10 | import { IconSwimming } from '@tabler/icons-react'; 11 | import { __ } from '@wordpress/i18n'; 12 | import classes from './Settings.module.css'; 13 | 14 | export function Settings() { 15 | return ( 16 | 17 | 18 | 22 | 23 | 24 | 25 | {__('Swimming challenge', 'wp-kirk')} 26 | 27 | 28 | {__('32 km / week', 'wp-kirk')} 29 | 30 | 31 | 32 | 33 | {__('Progress', 'wp-kirk')} 34 | 35 | 36 | 62% 37 | 38 | 39 | 40 | 41 | 42 | 43 | 20 / 36 km 44 | {__('4 days left', 'wp-kirk')} 45 | 46 | 47 | ); 48 | } 49 | -------------------------------------------------------------------------------- /resources/assets/apps/components/Settings.module.css: -------------------------------------------------------------------------------- 1 | .card { 2 | position: relative; 3 | overflow: visible; 4 | padding: var(--mantine-spacing-xl); 5 | padding-top: calc(var(--mantine-spacing-xl) * 1.5 + 20px); 6 | width: 300px; 7 | margin: 32px auto; 8 | } 9 | 10 | .icon { 11 | position: absolute; 12 | top: -20px; 13 | left: calc(50% - 30px); 14 | } 15 | 16 | .title { 17 | font-family: 18 | Greycliff CF, 19 | var(--mantine-font-family); 20 | line-height: 1; 21 | } 22 | -------------------------------------------------------------------------------- /resources/assets/css/prism.css: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.29.0 2 | https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript&plugins=line-numbers+file-highlight+show-language+highlight-keywords+toolbar+copy-to-clipboard */ 3 | code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green} 4 | pre[class*=language-].line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right} 5 | div.code-toolbar{position:relative}div.code-toolbar>.toolbar{position:absolute;z-index:10;top:.3em;right:.2em;transition:opacity .3s ease-in-out;opacity:0}div.code-toolbar:hover>.toolbar{opacity:1}div.code-toolbar:focus-within>.toolbar{opacity:1}div.code-toolbar>.toolbar>.toolbar-item{display:inline-block}div.code-toolbar>.toolbar>.toolbar-item>a{cursor:pointer}div.code-toolbar>.toolbar>.toolbar-item>button{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}div.code-toolbar>.toolbar>.toolbar-item>a,div.code-toolbar>.toolbar>.toolbar-item>button,div.code-toolbar>.toolbar>.toolbar-item>span{color:#bbb;font-size:.8em;padding:0 .5em;background:#f5f2f0;background:rgba(224,224,224,.2);box-shadow:0 2px 0 0 rgba(0,0,0,.2);border-radius:.5em}div.code-toolbar>.toolbar>.toolbar-item>a:focus,div.code-toolbar>.toolbar>.toolbar-item>a:hover,div.code-toolbar>.toolbar>.toolbar-item>button:focus,div.code-toolbar>.toolbar>.toolbar-item>button:hover,div.code-toolbar>.toolbar>.toolbar-item>span:focus,div.code-toolbar>.toolbar>.toolbar-item>span:hover{color:inherit;text-decoration:none} 6 | -------------------------------------------------------------------------------- /resources/assets/css/wp-kirk-common.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Less sample file. 3 | * 4 | * You can keep a bound between css class and plugin name/namespace. 5 | * To do this, you have to use the right naming for the css id and class. 6 | * 7 | */ 8 | @import (reference) "wp-kirk-variables"; 9 | 10 | .wp-kirk { 11 | 12 | pre { 13 | border-radius: 6px; 14 | } 15 | 16 | code.inline { 17 | border-radius: 3px; 18 | font-size: 0.9em; 19 | padding: 2px 6px; 20 | } 21 | 22 | &.wp-kirk-sample { 23 | p { 24 | font-size: 16px; 25 | } 26 | } 27 | } 28 | 29 | .clearfix { 30 | *zoom: 1 !important; 31 | 32 | &:before, 33 | &:after { 34 | display: table !important; 35 | line-height: 0 !important; 36 | content: "" !important; 37 | } 38 | 39 | &:after { 40 | clear: both !important; 41 | } 42 | } 43 | 44 | .wp-kirk-align { 45 | display: block; 46 | clear: both; 47 | } 48 | 49 | .wp-kirk-align-left { 50 | text-align: left; 51 | } 52 | 53 | .wp-kirk-toc { 54 | float: left; 55 | position: fixed; 56 | background-color: #fff; 57 | padding: 8px; 58 | border: 1px solid #ddd; 59 | width: 180px; 60 | } 61 | 62 | .wp-kirk-toc-content { 63 | float: right; 64 | width: calc(~"100% - 220px"); 65 | } 66 | 67 | @media (max-width: 1000px) { 68 | .wp-kirk-toc { 69 | float: none; 70 | position: relative; 71 | width: auto; 72 | 73 | li { 74 | margin-right: 12px; 75 | float: left; 76 | } 77 | } 78 | 79 | .wp-kirk-toc-content { 80 | float: none; 81 | width: auto; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /resources/assets/css/wp-kirk-dashboard.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Dashboard style 3 | * 4 | * You can keep a bound between css class and plugin name/namespace. 5 | * To do this, you have to use the right naming for the css id and class. 6 | * 7 | */ 8 | 9 | .wp-kirk-dashboard 10 | { 11 | color: #f00; 12 | } 13 | 14 | .wp-kirk-textarea-code { 15 | font-family: "Courier New", Courier, monospace; 16 | width: 100%; 17 | min-height: 100px; 18 | } -------------------------------------------------------------------------------- /resources/assets/css/wp-kirk-variables.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Less variable example. 3 | * 4 | * To learn more about LESS see http://lesscss.org/ 5 | */ 6 | 7 | @main-background-color: #ff0; -------------------------------------------------------------------------------- /resources/assets/css/wp-kirk-widget.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Frontend widget style 3 | * 4 | * You can keep a bound between css class and plugin name/namespace. 5 | * To do this, you have to use the right naming for the css id and class. 6 | * 7 | */ 8 | 9 | .wp-kirk-widget-title 10 | { 11 | color: #f00; 12 | } 13 | -------------------------------------------------------------------------------- /resources/assets/css/wp-kirk.scss: -------------------------------------------------------------------------------- 1 | // style.scss 2 | 3 | $text-color: #333; 4 | $text-size: 16px; 5 | 6 | .text { 7 | color: $text-color; 8 | font-size: $text-size; 9 | } 10 | -------------------------------------------------------------------------------- /resources/assets/js/wp-kirk-main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Javascript sample. 3 | * 4 | * You can use this Javascript as start for your project. 5 | * 6 | */ 7 | 8 | 9 | (function ($) { 10 | 11 | "use strict"; 12 | 13 | function openAlert() { 14 | alert("Hi there, and Hello World!\n The jQuery version is " + $().jquery); 15 | 16 | // Ajax 17 | $('#ajax-trusted').on('click', function () { 18 | 19 | // Action executed by both logged and not logged users. 20 | $.post( 21 | ajaxurl, 22 | { action: 'trusted' }, 23 | function (data) { 24 | alert(data); 25 | }); 26 | }); 27 | 28 | // Action executed only by logged in users. 29 | $('#ajax-logged').on('click', function () { 30 | 31 | // logged 32 | $.post( 33 | ajaxurl, 34 | { action: 'logged' }, 35 | function (data) { 36 | alert(data); 37 | }); 38 | 39 | }); 40 | 41 | 42 | // Action executed only by not logged in user, usually from frontend. 43 | $('#ajax-notLogged').on('click', function () { 44 | 45 | // notLogged 46 | $.post( 47 | ajaxurl, 48 | { action: 'notLogged' }, 49 | function (data) { 50 | alert(data); 51 | }); 52 | 53 | }); 54 | } 55 | 56 | openAlert(); 57 | 58 | })(jQuery); -------------------------------------------------------------------------------- /resources/assets/js/wp-kirk-test.ts: -------------------------------------------------------------------------------- 1 | const testAlert = () => { 2 | alert("Hello, World!"); 3 | }; 4 | -------------------------------------------------------------------------------- /resources/assets/js/wp-react-component.jsx: -------------------------------------------------------------------------------- 1 | const { render, useState } = wp.element; 2 | 3 | const WordPressButton = ({ children, primary, ...others }) => { 4 | return ( 5 | 8 | ); 9 | }; 10 | 11 | const FlexContainer = ({ children, justifyContent, alignItems, gap }) => { 12 | return
{children}
; 13 | }; 14 | 15 | const MyComponent = () => { 16 | const [count, setCount] = useState(0); 17 | 18 | return ( 19 |
20 |

Hello, React World!

21 |

22 | This is a simple React component rendered in a WordPress plugin. It is a counter that increments every time you 23 | click the button. 24 |

25 | 26 | 27 | setCount(count + 1)}>Click me 28 | {count} 29 | 30 |
31 | ); 32 | }; 33 | 34 | render(, document.getElementById('react-test')); 35 | -------------------------------------------------------------------------------- /resources/views/blade/demo.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 |

Demo Blade

4 | 5 | BladeOne ogo 6 | 7 |

Starting from version 1.4.0, you can use blade templates in your plugin.

8 |

We're using the BladeOne template engine. BladeOne is a standalone version of Blade Template Engine that uses a single PHP file and can be ported and used in different projects. It allows you to use blade template outside Laravel.

9 | 10 |

In this example, we have created a classic Controller. The same one used in the other examples.

11 | 12 |
{{ $controller }}
13 | 14 |

We created a folder /resources/views/blade for clarity, but any other folder would be fine. In the example, we passed the WordPress User model as a parameter

15 | 16 |

Finally, we have inserted the Blade directives into our file /resources/views/blade/demo.blade.php

17 | 18 |
{{ $code }}
19 | 20 |

The result is:

21 | 22 | @foreach ($users as $user) 23 |

user_nicename: {{ $user->user_nicename }}

24 |

user_email: {{ $user->user_email }}

25 | @endforeach 26 | 27 |

For more information, please visit the BladeOne Wiki pages.

28 | 29 |
30 | -------------------------------------------------------------------------------- /resources/views/dashboard/api.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 15 | 16 |
17 | 18 |

API

19 | 20 |
21 |
    22 |
  • 23 |
  • 24 |
  • 25 |
26 |
27 | 28 |
29 | 30 | 31 |
32 |

REST API

33 | 34 |

35 |

/api

36 | 37 | 38 |
/api/vendor/v1
39 | 40 |

41 | 42 |

43 | route.php 44 |

45 | 46 |
/api/vendor/v1/route.php
47 | 48 |

route.php

49 | 50 |
<?php
 51 |     use WPKirk\WPBones\Routing\API\Route;
 52 | 
 53 |     Route::get('/example', function () {
 54 |         return 'Hello World!';
 55 |     });
56 | 57 | 58 |

/wp-json/wpkirk/v1/example

60 | 61 |

62 | 63 |

get, post, put, 64 | patch, delete 65 | WP_REST_Server class. 66 |

67 | 68 |

route.php post

69 | 70 |
<?php
 71 |     use WPKirk\WPBones\Routing\API\Route;
 72 | 
 73 |     Route::post('/example', function () {
 74 |         return 'Hello World!';
 75 |     });
76 | 77 | 78 | 79 |

Route::get(), Route::post(), ::request()

80 | 81 |

route.php ::request()

82 | 83 |
<?php
 84 |     use WPKirk\WPBones\Routing\API\Route;
 85 | 
 86 |     Route::request('get', '/get_request', function () {
 87 |         return 'Hello World!';
 88 |     });
 89 | 
 90 |     // HTTP verb is case insensitive
 91 |     Route::request('GET', '/get_request', function () {
 92 |         return 'Hello World!';
 93 |     });
 94 | 
 95 |     // you may use both strings and arrays
 96 |     Route::request(['get'], '/get_request', function () {
 97 |         return 'Hello World!';
 98 |     });
 99 | 
100 |     // you may use multiple HTTP verbs
101 |     Route::request(['get', 'POST'], '/multiple', function () {
102 |         return 'Hello World!';
103 |     });
104 | 105 |

107 |
108 |
109 | -------------------------------------------------------------------------------- /resources/views/dashboard/assets.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | 12 |

13 | 14 |
15 |
    16 |
  • 17 |
  • 18 |
  • 19 |
20 |
21 | 22 |
23 |

24 | 25 |

26 | 27 |

Styles

28 | 29 |

resources/assets/css directory.', 'wp-kirk'); ?>

30 |

.css, .scss, and .less will be compiled and you will find the css compiled in the public/css directory.', 'wp-kirk'); ?>

31 |

32 | 33 |
public function assets()
 34 | {
 35 |   return WPKirk()
 36 |     ->view('dashboard.assets')
 37 |     ->withAdminStyle('my-styles');
 38 |   }
39 | 40 |

Javascript

41 | 42 |

resources/assets/js directory.', 'wp-kirk'); ?>

43 |

Assets documentation.', 'wp-kirk'); ?>

44 | 45 |

46 | 47 |

public/js directory.', 'wp-kirk'); ?>

48 | 49 |

50 | 51 |

52 | 53 |

div with an id.', 'wp-kirk'); ?>

54 | 55 |
<div id="react-test"></div>
56 | 57 |

58 | 59 |

60 | 61 |
public function assets()
 62 | {
 63 | return WPKirk()
 64 |   ->view('dashboard.assets')
 65 |   ->withAdminStyle('wp-kirk-common')
 66 |   ->withAdminStyle('prism')
 67 |   ->withAdminScript('prism')
 68 |   ->withAdminScript('wp-react-component', ['wp-element']); // wp-element is a dependency
 69 | }
70 | 71 |

72 | 73 |

resources/assets/js/ wp-react-component.js

74 | 75 |
const { render, useState } = wp.element;
 76 | 
 77 | const WordPressButton = ({ children, primary, ...others }) => {
 78 | return (
 79 |   <button className={`button ${primary ? "button-primary" : ""}`} {...others}>
 80 |     {children}
 81 |   </button>
 82 | );
 83 | };
 84 | 
 85 | const FlexContainer = ({ children, justifyContent, alignItems, gap }) => {
 86 | return <div style={{ display: "flex", justifyContent: "alignItems", gap }}>{children}</div>;
 87 | };
 88 | 
 89 | const MyComponent = () => {
 90 | const [count, setCount] = useState(0);
 91 | 
 92 | return (
 93 |   <div>
 94 |     <h2>Hello, React World!</h2>
 95 |     <p>
 96 |       This is a simple React component rendered in a WordPress plugin. It is a counter that increments every time you
 97 |       click the button.
 98 |     </p>
 99 | 
100 |     <FlexContainer gap={14} alignItems="center">
101 |       <WordPressButton onClick={() => setCount(count + 1)}>Click me</WordPressButton>
102 |       <span>{count}</span>
103 |     </FlexContainer>
104 |   </div>
105 | );
106 | };
107 | 
108 | render(<MyComponent />, document.getElementById("react-test"));
109 | 110 | 111 |

112 | 113 |

114 | 115 |
npm run build
116 | 117 |

118 | 119 |
120 |
121 | 122 |
123 |
124 | -------------------------------------------------------------------------------- /resources/views/dashboard/custom_page.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |

pages

12 | 13 |

pages custom_page.php.

14 | 15 |
<?php
16 | 
17 | use WPKirk\WPBones\Routing\Pages\Support\Page;
18 | 
19 | class CustomPage extends Page
20 | {
21 |     public function title(): string
22 |     {
23 |         return "Hello, Custom Page!";
24 |     }
25 | 
26 |     public function render()
27 |     {
28 |         return $this->plugin
29 |         ->view('dashboard.custom_page')
30 |         ->withAdminStyle('prism')
31 |         ->withAdminScript('prism')
32 |         ->withAdminStyle('wp-kirk-common');
33 |     }
34 | }
35 | 36 |
38 | 39 |
40 |
41 | -------------------------------------------------------------------------------- /resources/views/dashboard/database.php: -------------------------------------------------------------------------------- 1 | 9 | 12 | 13 |
14 | 15 |

16 | 17 |
18 |
    19 |
  • 20 |
  • 21 |
22 |
23 | 24 |
25 | 26 |

27 | 28 |

29 | 30 |
DB::table('users')->all()
31 | 32 |
all()
34 |       ->dump(); ?>
35 | 36 |

37 | 38 |
foreach (DB::table('users')->get() as $user) {
39 |   echo "{$user->user_login}\n";
40 | }
41 | 42 |
get() as $user
44 |     ) {
45 |         echo "{$user->user_login}\n";
46 |     } ?>
47 | 48 |

49 | 50 |
51 |
52 | -------------------------------------------------------------------------------- /resources/views/dashboard/eloquent.php: -------------------------------------------------------------------------------- 1 | 9 | 13 | 14 |
15 | 16 |

17 | 18 |

19 | 20 |

21 | 22 |
composer install illuminate/database
23 | 24 |

25 | 26 |

27 | 28 |
<?php
29 |   use WPKirk\Http\Controllers\User;
30 | 
31 |   var_dump(User::all());
32 | 33 |
34 | 35 |

36 |   
37 |   
38 |
39 | 40 |

41 | 42 |

43 | 44 |
<?php
45 |   use WPKirk\Http\Controllers\User;
46 | 
47 |   var_dump(User::find(1)->user_email);
48 | 49 |
user_email
51 | ); ?>
52 | 53 |

54 | 55 |

56 | 57 |
<?php
58 |   use WPKirk\Http\Controllers\Product;
59 | 
60 |   var_dump(Product::find([3,4]));
61 | 62 |
63 | 64 |

65 |   
66 |   
67 |
68 | 69 |

70 | 71 |
<?php
72 |   use WPKirk\Http\Controllers\Product;
73 | 
74 |   var_dump(Product::find(3)->name);
75 | 76 |
name
78 |   ); ?>
79 | 80 |

81 | 82 |
<?php
83 |   use WPKirk\Http\Controllers\Product;
84 | 
85 |   Product::all()->each(function ($e) {
86 |     var_dump($e->id);
87 |   });
88 | 89 | 90 |
each(function ($e) {
91 |     var_dump($e->id);
92 |   }); ?>
93 | 94 |

95 |
96 | -------------------------------------------------------------------------------- /resources/views/dashboard/first_custom_page.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |

Hello, I'm a Custom Page without menu

12 | 13 |
14 | 15 |

Handle the same page

16 | 17 |

Below an example of how to post some data to the same page

18 | 19 |
Current Method 
21 | 22 |
<form method="post">
23 |   <button class="button button-hero button-primary">Post Here</button>
24 | </form>
25 | 26 |
27 | 28 |
29 | 30 |
31 | 32 |

Send data to a different custom page

33 | 34 |

Below, how to send a post message to a different custom page

35 | 36 |
<form method="post" action="<?php echo $plugin->getPageUrl('second_custom_page') ?>">
37 |     <button class="button button-hero button-primary">Test Post</button>
38 | </form>
39 | 40 |
42 | 43 |
44 | 45 |
46 | 47 |

Custom page from folder

48 | 49 |

You may also use the pages folder to create your own pages.

50 | 51 |
<a class="button button-hero button-primary" href="<?php echo $plugin->getPageUrl('custom_page') ?>">Load custom page</a>
52 | 53 |

Load 55 | custom page

56 |
-------------------------------------------------------------------------------- /resources/views/dashboard/html.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | 12 |

HTML Tags Support

13 | 14 |
15 | 29 |
30 | 31 |
32 | 33 |

Here you'll find some example about HTML support.

34 | 35 |

Html facade

36 | 37 |

You can render a HTML component in different ways

38 | 39 |
echo WPKirk\Html::button( "Hello, world!" );
40 | 41 |
42 | 43 |
44 | 45 |
46 | 47 |

Fluent Example

48 | 49 |
$html = WPKirk\Html::button( "Hello, world!" )->html();
 50 | echo $html;
51 | 52 | 53 |
54 | html(); 56 | echo $html; 57 | ?> 58 |
59 | 60 |

By explicit render() method

61 | 62 |
WPKirk\Html::button( "Hello, world!" )->render();
63 | 64 |
65 | render(); ?> 66 |
67 | 68 |
69 | 70 |

Attributes

71 |

You can use the attributes in several ways

72 | 73 |
$button = WPKirk\Html::button( "Hello, world!" );
 74 | $button->class = 'button button-primary';
 75 | echo $button;
76 | 77 |
78 | class = 'button button-primary'; 81 | echo $button; 82 | ?> 83 |
84 | 85 |

Of course, you may use the fluent way

86 | 87 |
echo WPKirk\Html::button( "Hello, world!" )->class( 'button' );
88 | 89 |
90 | class('button'); ?> 91 |
92 | 93 |
echo WPKirk\Html::button( "Hello, world!" )->class( 'button button-primary’);
94 | 95 |
96 | class( 97 | 'button button-primary' 98 | ); ?> 99 |
100 | 101 |
echo WPKirk\Html::button( "Hello, world!" )->class( [ 'button', 'button-primary' ] );
102 | 103 |
104 | class([ 105 | 'button', 106 | 'button-primary', 107 | ]); ?> 108 |
109 | 110 |
echo WPKirk\Html::button( [ 'content' => "Hello, world!", 'class' => 'button button-hero' ] );
111 | 112 |
113 | 'Hello, world!', 115 | 'class' => 'button button-hero', 116 | ]); ?> 117 |
118 | 119 |
120 | 121 |

Styles

122 | 123 |

You may change the HTML component styles immediately by using style()

124 | 125 |
echo WPKirk\Html::button("Hello, world!")->style('color', 'red')
126 | 127 |
128 | style('color', 'red'); ?> 129 |
130 | 131 |
echo WPKirk\Html::button("Hello, world!")->style('color', 'red', 'font-weight', 'bold')
132 | 133 |
134 | style( 135 | 'color', 136 | 'red', 137 | 'font-weight', 138 | 'bold' 139 | ); ?> 140 |
141 | 142 |
echo WPKirk\Html::button("Hello, world!")->style([ 'background-color' => 'red', 'color' => 'white' ])
143 | 144 |
145 | style([ 146 | 'background-color' => 'red', 147 | 'color' => 'white', 148 | ]); ?> 149 |
150 | 151 |
152 | 153 |

Available HTML tags

154 | 155 |

a

156 | 157 |
echo WPKirk\Html::a('Click me')->href('http://undolog.com')
158 | 159 |
160 | href('http://undolog.com'); ?> 161 |
162 | 163 |
164 | 165 |

button

166 | 167 |
echo WPKirk\Html::button('Hello, world!')->class('button button-primary')
168 | 169 |
170 | class( 171 | 'button button-primary' 172 | ); ?> 173 |
174 | 175 |
176 | 177 |

Form

178 | 179 |
echo WPKirk\Html::form()->acceptcharset('ISO-8859-1')
180 | 181 |
182 | acceptcharset('ISO-8859-1'); ?> 183 |
184 | 185 |
186 | 187 |

Input

188 | 189 |
echo WPKirk\Html::input()->type('text')->value('Hello')
190 | 191 |
192 | type('text')->value('Hello'); ?> 193 |
194 | 195 |
196 | 197 |

Checkbox

198 | 199 |
echo WPKirk\Html::checkbox()->name('myname')->value('Hello')
200 | 201 |
202 | name('myname')->value('Hello'); ?> 203 |
204 | 205 |

The HTML markup output consists in two input fields in order to support the unchecked value as well

206 | 207 |
<input type="hidden" name="myname" value="off" />
208 | <input type="checkbox" name="myname" value="Hello" />
209 | 
210 | 211 |
212 | 213 |

Select

214 | 215 |

To use a select you have to define the options as well. Below, you'll see different ways to do that. 216 | The first 217 | one is using the option component

218 | 219 |
echo WPKirk\Html::select(WPKirk\Html::option('Item')->html())
220 | 221 |
222 | html()); ?> 223 |
224 | 225 |

You may use also options fluent way

226 | 227 |
echo WPKirk\Html::select()->options([ 'Item 1', 'Item 2' ])
228 | 229 |
230 | options(['Item 1', 'Item 2']); ?> 231 |
232 | 233 |
<select>
234 |   <option selected="selected">Item 1</option>
235 |   <option>Item 2</option>
236 | </select>
237 | 238 |

Options with array keys

239 | 240 |
echo WPKirk\Html::select()->options([ 'item-1' => 'Item 1', 'item-2' => 'Item 2' ])
241 | 242 |
243 | options([ 244 | 'item-1' => 'Item 1', 245 | 'item-2' => 'Item 2', 246 | ]); ?> 247 |
248 | 249 |
<select>
250 |   <option value="item-1">Item 1</option>
251 |   <option value="item-2">Item 2</option>
252 | </select>
253 | 
254 | 255 |

Preselect an option

256 | 257 |
echo WPKirk\Html::select()->options([ 'item-4' => 'Item 4', 'item-5' => 'Item 5'])->selected('item-5')
258 | 259 |
260 | options(['item-4' => 'Item 4', 'item-5' => 'Item 5']) 262 | ->selected('item-5'); ?> 263 |
264 | 265 |

Multiple select

266 | 267 |

multiple method to enable multiple selection', 'wp-kirk') ?>

268 | 269 |
echo WPKirk\Html::select()
270 |       ->multiple(true)
271 |       ->options([
272 |         'item-1' => 'Item 1',
273 |         'item-2' => 'Item 2',
274 |         'item-3' => 'Item 3',
275 |         'item-4' => 'Item 4',
276 |         'item-5' => 'Item 5'
277 |       ])
278 |       ->selected('item-2,item-1');
279 | 280 |

281 | 282 |
283 | multiple(true) 285 | ->options([ 286 | 'item-1' => 'Item 1', 287 | 'item-2' => 'Item 2', 288 | 'item-3' => 'Item 3', 289 | 'item-4' => 'Item 4', 290 | 'item-5' => 'Item 5' 291 | ]) 292 | ->selected('item-2,item-1'); ?> 293 |
294 | 295 |
echo WPKirk\Html::select()
296 |       ->multiple(true)
297 |       ->options([
298 |         'item-1' => 'Item 1',
299 |         'item-2' => 'Item 2',
300 |         'item-3' => 'Item 3',
301 |         'item-4' => 'Item 4',
302 |         'item-5' => 'Item 5'
303 |       ])
304 |       ->selected(['item-2', 'item-4']);
305 | 306 |
307 | multiple(true) 309 | ->options([ 310 | 'item-1' => 'Item 1', 311 | 'item-2' => 'Item 2', 312 | 'item-3' => 'Item 3', 313 | 'item-4' => 'Item 4', 314 | 'item-5' => 'Item 5' 315 | ]) 316 | ->selected(['item-2', 'item-4']); ?> 317 |
318 | 319 |
320 | 321 |

Textarea

322 | 323 |
echo WPKirk\Html::textarea('Hi there, How are you?')
324 | 325 |
326 | 327 |
328 | 329 |
330 | 331 |

Datetime

332 | 333 |
334 | 335 |
echo WPKirk\Html::datetime([ 'name' => 'finalStart' ])
336 | 337 | 'finalStart']); ?> 338 | 339 |
echo WPKirk\Html::datetime()->complete(true)
340 | complete(true); ?> 341 | 342 |
echo WPKirk\Html::datetime()->value('now')
343 | value('now'); ?> 344 | 345 |
echo WPKirk\Html::datetime()->now(true)
346 | now(true); ?> 347 | 348 |
echo WPKirk\Html::datetime()->now(true)->clear(true)
349 | now(true)->clear(true); ?> 350 | 351 |
echo WPKirk\Html::datetime()->value(time() + (60 * 60))
352 | value(time() + 60 * 60); ?> 353 | 354 |
echo WPKirk\Html::datetime()->value("2015-11-10 12:13")
355 | value('2015-11-10 12:13'); ?> 356 |
357 | 358 |
359 | 360 |

Custom attributes

361 | 362 |

You may also set any custom attributes in the HTML component

363 | 364 |
echo WPKirk\Html::button('Click me!')->attributes('hello', 'world')
365 | 366 |
367 | attributes( 368 | 'hello', 369 | 'world' 370 | ); ?> 371 |
372 | 373 |

The HTM -------------------------------------------------------------------------------- /resources/views/dashboard/index.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |

11 | 12 |

Name); ?>

13 | 14 | 15 |
16 |
    17 |
  • 18 |
  • 19 |
  • 20 |
  • 21 |
22 |
23 | 24 |
25 |

26 |

27 |

28 | 29 |
30 | 31 |

PHP Version

32 | 33 |
34 | 35 |

36 |

config/menus.php

37 | 38 |
return [
 39 |       'wp_kirk_slug_menu' => [
 40 |         'menu_title' => 'WP Kirk Menu',
 41 |         'capability' => 'read',
 42 |         'icon' => 'wpbones-logo-menu.png',
 43 |         'items' => [
 44 |           [
 45 |             'menu_title' => __('Main View', 'wp-kirk'),
 46 |             'route' => [
 47 |               'get' => 'Dashboard\DashboardController@firstMenu',
 48 |             ],
 49 |           ],
 50 |           ...
51 | 52 | 53 |

/plugin/Http/Controllers/Dashboard/DashboardController.php

54 | 55 |
class DashboardController extends Controller {
 56 |       public function firstMenu() {
 57 |         return WPKirk()
 58 |           ->view('dashboard.index')
 59 |           ->withAdminStyle('wp-kirk-common')
 60 |           ->withAdminStyle('prism')
 61 |           ->withAdminScript('prism')
 62 |           ->with('my_inject_variable', 'Captain');
 63 |       }
 64 |   }
65 | 66 |

resources/views/dashboard/index.php

67 | 68 |

69 | 70 |

my_inject_variable 71 |

72 | 73 |
74 |

75 |

custom

76 | 77 |
<?php echo $plugin->config('custom.sample') ?>
78 | 79 |

80 | 81 |
config("custom.sample"); ?>
82 | 83 |
84 |

85 |

86 | 87 | 88 |
<?php echo $plugin->Author ?> // Author; ?>
89 | 90 |
<?php echo $plugin->Description ?> // Description; ?>
91 | 92 |
<?php echo $plugin->Version ?> // Version; ?>
93 | 94 |
<?php echo $plugin->TextDomain ?> // TextDomain; ?>
95 | 96 |
97 |

98 | 99 |

route.php 100 | config 101 | 102 |

103 | 104 |

route.php config 105 |

106 | 107 |

route.php

108 | 109 |
<?php
110 | /*
111 | |--------------------------------------------------------------------------
112 | | Custom page routes
113 | |--------------------------------------------------------------------------
114 | |
115 | | Here is where you can register all page routes for your custom view.
116 | | Then you will use $plugin->getPageUrl( 'custom_page' ) to get the URL.
117 | |
118 | */
119 | 
120 | return [
121 | 
122 |   'first_custom_page' => [
123 |     'title'      => 'Title of page',
124 |     'capability' => 'read',
125 |     'route'      => [
126 |       'get' => 'Dashboard\DashboardController@customPage',
127 |       'post' => 'Dashboard\DashboardController@customPage',
128 |     ]
129 |   ],
130 |   'second_custom_page' => [
131 |     'title'      => 'Second',
132 |     'capability' => 'read',
133 |     'route'      => [
134 |       'post' => 'Dashboard\DashboardController@secondCustomPage',
135 |     ]
136 |   ],
137 | ];
138 | 139 | 140 |

141 | 142 | getPageUrl("first_custom_page"); ?> 143 | 144 |
<?php echo $plugin->getPageUrl( 'first_custom_page' ) ?> // 
145 | 146 |

147 | "> 148 |

149 | 150 | getMenuUrl("assets"); ?> 151 |
<?php echo $plugin->getMenuUrl( 'assets' ) ?> // 
152 | 153 |

154 | 155 |

156 | 157 | getMenuUrl(5); ?> 158 |
<?php echo $plugin->getMenuUrl(5) ?> // 
159 |

160 | 161 |

162 | 163 | view( 'dashboard.index', [ 'var' => 'value' ] ); 7 | | 8 | --> 9 | 14 | 15 |
16 | 17 |

Model

18 | 19 |
20 | 24 |
25 | 26 |
27 | 28 |

In your Plugin you may use the Database Model class instead of the Query 30 | Builder.

31 |

To use the Model convection you need to extend the Model class:

32 | 33 |
<?php
34 | namespace WPKirk\Models;
35 | 
36 | use WPKirk\WPBones\Database\Model;
37 | 
38 | class MyPluginBooks extends Model
39 | {
40 | }
41 | 
42 | 43 |

We don't support the automatic plural naming of the table at the moment. Anyway, the default table name will be 44 | the "snake case" of the class name. For example, the class Users will be associated with the table 45 | users. The class UsersLogged will be associated with the table 46 | users_logged. 47 |

48 | 49 |

If your model's corresponding database table does not fit this convention, you may manually specify the model's 50 | table name by defining a table property on the model:

51 | 52 |
<?php
53 | namespace WPKirk\Models;
54 | 
55 | use WPKirk\WPBones\Database\Model;
56 | 
57 | class MyPluginBooks extends Model
58 | {
59 |   protected $table = 'my_plugin_products';
60 |   protected $usePrefix = false;
61 | }
62 | 63 |

Example

64 | 65 |
<?php MyPluginBooks::all()
66 | 67 | 68 | 69 |

70 |   dump(); ?>
71 |   
72 | 73 | 74 |

You can find more example 76 | here 77 | 78 |

79 |
-------------------------------------------------------------------------------- /resources/views/dashboard/model.php: -------------------------------------------------------------------------------- 1 | 9 | 12 | 13 |
14 | 15 |

Model

16 | 17 |
18 | 22 |
23 | 24 |
25 | 26 |

In your Plugin you may use the Database Model class instead of the Query 28 | Builder.

29 |

To use the Model convection you need to extend the Model class:

30 | 31 |
<?php
32 | namespace WPKirk\Models;
33 | 
34 | use WPKirk\WPBones\Database\Model;
35 | 
36 | class MyPluginProducts extends Model
37 | {
38 | }
39 | 
40 | 41 |

We don't support the automatic plural naming of the table at the moment. Anyway, the default table name will be 42 | the "snake case" of the class name. For example, the class Users will be associated with the table 43 | users. The class UsersLogged will be associated with the table 44 | users_logged. 45 |

46 | 47 |

If your model's corresponding database table does not fit this convention, you may manually specify the model's 48 | table name by defining a table property on the model:

49 | 50 |
<?php
51 | namespace WPKirk\Models;
52 | 
53 | use WPKirk\WPBones\Database\Model;
54 | 
55 | class MyPluginProducts extends Model
56 | {
57 |   protected $table = 'my_plugin_products';
58 | }
59 | 60 |

Example

61 | 62 |
<?php MyPluginProducts::all()
63 | 64 | 65 | 66 |

67 |   dump(); ?>
68 |   
69 | 70 | 71 |

You can find more example 73 | here 74 | 75 |

76 |
77 | -------------------------------------------------------------------------------- /resources/views/dashboard/options.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | 12 |

Options

13 | 14 | 25 | 26 |
27 | 28 | 29 |
30 |

Current options

31 | 32 |

Here you can see he current options are:

33 | 34 |
echo $plugin->options;
35 | 36 |
options; ?>
37 | 38 |

Get option

39 |

As you can see you'll be able to get the options by using the dot notation

40 | 41 |
echo $plugin->options->get( 'General.option_2'); // options->get(
 42 |                     'General.option_2'
 43 |                 ); ?>
44 | 45 |

You may also store null values

46 | 47 |
$value = $plugin->options->get( 'General.option_5'); echo is_null($value) ? 'null' : $value; // options->get(
 48 |                     'General.option_5'
 49 |                 );
 50 |                 echo is_null($value) ? 'null' : $value ?>
51 | 52 |

Get option by an array

53 |

You may also retrieve an option sub-branch as an Array

54 | 55 |
echo $plugin->options['General'];
56 | 57 |
options['General'],
 59 |                     true
 60 |                 ); ?>
61 | 62 |

as well as

63 | 64 |
echo $plugin->options->get( 'General.option_3');
65 | 66 |
options->get('General.option_3')
 68 |                 ); ?>
69 | 70 |

Get option

71 |

You may also avoid to use the get() method, instead of use

72 | 73 |
echo $plugin->options->get( 'General.option_3.sub_option_of_3'); // options->get(
 74 |                     'General.option_3.sub_option_of_3'
 75 |                 ); ?>
76 | 77 |

you may use

78 | 79 |
echo $plugin->options[ 'General.option_3.sub_option_of_3' ]; // options['General.option_3.sub_option_of_3']; ?>
81 | 82 |

Get default option

83 |

Of course, you'll be able to define any default value if the branch/key doesn't exist.

84 | 85 |
echo $plugin->options->get( 'General.doNotExists', 'default' ); // options->get(
 86 |                     'General.doNotExists',
 87 |                     'default'
 88 |                 ); ?>
89 | 90 | 91 |
92 |

Update

93 |

You may update any options and branch tree in the same way, by using the dot notation

94 | 95 |
$plugin->options->set( 'Special.Name', null );
96 | 97 | options->set('Special.Name', null); ?> 98 |
options; ?>
99 | 100 |
$plugin->options->set( 'Special.Name', 'John' );
101 | 102 | options->set('Special.Name', 'John'); ?> 103 |
options; ?>
104 | 105 | options->set( 106 | 'General.option_3.sub_option_of_3', 107 | 'FooBar' 108 | ); ?> 109 | 110 |
$plugin->options->set( 'General.option_3.sub_option_of_3', 'FooBar' );
111 | 112 |
options; ?>
113 | 114 |

Change with mixed value

115 |

Of course, you may also change the type of the stored key. Below, we're going to use and Array 116 | instead of the previous string

117 | 118 | options->set('Special.Name', ['John', 'Good']); ?> 119 | 120 |
$plugin->options->set( 'Special.Name', [ 'John', 'Good' ] );
121 | 122 |
options; ?>
123 | 124 |

and again...

125 | 126 | options['Special.Name'] = ['Robin', 'Hood']; ?> 127 | 128 |
$plugin->options[ 'Special.Name' ] = [ 'Robin', 'Hood' ];
129 | 130 |
options; ?>
131 | 132 | 133 |
134 |

Add

135 |

Of course, adding new options will work in the same way by using the dot notation

136 | 137 | options->set('Special.null_value', null); ?> 138 | 139 |
$plugin->options->set( 'Special.null_value', null );
140 | 141 |
options; ?>
142 | 143 | options->set('Special.time', time()); ?> 144 | 145 |
$plugin->options->set( 'Special.time', time() );
146 | 147 |
options; ?>
148 | 149 | options['Special.timeZone'] = time(); ?> 150 | 151 |
$plugin->options[ 'Special.timeZone' ] = time();
152 | 153 |
options; ?>
154 | 155 | options['what-you-like'] = 'Simply is best'; ?> 156 | 157 |
$plugin->options[ 'what-you-like' ] = 'Simply is best';
158 | 159 |
options; ?>
160 | 161 | 162 |
163 |

Mass update

164 |

In accordance with the options structure, you may also update a whole subset of options instead of changing 165 | them individually.

166 | 167 | options->update([ 168 | 'General' => [ 169 | 'option_4' => [ 170 | 'color' => 'red', 171 | 'background' => 'transparent', 172 | 'images' => null 173 | ], 174 | ], 175 | ]); ?> 176 | 177 |
$plugin->options->update(
178 |   [ 'General' =>
179 |     [ 'option_4' =>
180 |       [ 'color' => 'red', 'background' => 'transparent', 'images' => null ]
181 |     ]
182 |   ]
183 | );
184 | 185 |
options; ?>
186 | 187 | 188 |
189 |

Mass insert

190 |

Of course, you may use the mass feature for the insert as well

191 | 192 | options->update([ 193 | 'General' => [ 194 | 'option_5' => [ 195 | 'color' => 'red', 196 | 'background' => 'transparent', 197 | 'images' => null 198 | ], 199 | ], 200 | ]); ?> 201 | 202 |
$plugin->options->update(
203 |   [ 'General' =>
204 |     [ 'option_5' =>
205 |       [ 'color' => 'red', 'background' => 'transparent', 'images' => null ]
206 |     ]
207 |   ]
208 | );
209 | 210 | 211 |
options; ?>
212 | 213 | 214 | 215 |
216 |

Delete

217 | 218 |

To delete an option, you have to use the delete() method

219 | 220 | options->delete('General.option_4'); ?> 221 | 222 |
$plugin->options->delete( 'General.option_4' );
223 | 224 |
options; ?>
225 | 226 |

Delete all

227 |

Finally, you may delete all

228 | 229 | options->delete(); ?> 230 | 231 |
$plugin->options->delete();
232 | 233 |
options; ?>
234 | 235 | 236 |
237 |

Reset to default

238 |

Don't worry, we can reset everything by using the original file

239 | 240 | options->reset(); ?> 241 | 242 |
$plugin->options->reset();
243 | 244 |
options; ?>
245 | 246 |
247 | 248 |
249 | -------------------------------------------------------------------------------- /resources/views/dashboard/optionsresview.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | 12 |

Options Resource View

13 | 14 |

Current Method

15 | 16 |
17 | 18 | 19 | 20 |
21 | 22 |
23 | 24 |
25 | 26 | 27 | 28 |
29 | 30 |
31 | 32 |
33 | 34 | 35 | 36 |
37 | 38 |
39 | 40 |
41 | 42 | 43 | 44 |
45 | 46 |
47 | 48 |
49 | 50 | 51 | 52 |
53 | 54 | 55 |
56 | -------------------------------------------------------------------------------- /resources/views/dashboard/optionsview.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | 12 |

Options View

13 |

Here you can try the ability to handle a form for the options.

14 | 15 |

The current options are:

16 | 17 |
echo $plugin->options;
18 | 19 |
options; ?>
20 | 21 | 22 |
23 |

24 | 25 |

26 |
27 | 28 | 29 |

Here we're using a very useful HTML markup to display and handle the form fields.

30 |

First of all we may use the nonce in this way

31 | 32 |
wp_nonce_field('Options');
33 | 34 |

The we may use special form fields

35 | 36 |
<form action="" method="post">
 37 |   <?php wp_nonce_field('Options'); ?>
 38 |   <div>
 39 |     <label for="General/option_1">General.option_1</label>
 40 |     <input type="hidden" name="General/option_1" value="false" />
 41 |     <input type="checkbox" name="General/option_1" id="General/option_1" <?php
 42 |     checked('true', $plugin->options->get('General.option_1')) ?>
 43 |     value="true"/>
 44 |   </div>
 45 |   <div>
 46 |     <label for="General/option_2">General.option_2</label>
 47 |     <input type="hidden" name="General/option_2" value="false" />
 48 |     <input type="checkbox" name="General/option_2" id="General/option_2" <?php
 49 |     checked('true', $plugin->options->get('General.option_2')) ?>
 50 |     value="true"/>
 51 |   </div>
 52 |   <div>
 53 |     <label for="Special/Name">Special.Name</label>
 54 |     <input type="text" name="Special/Name" id="Special/Name"
 55 |       value="<?php echo $plugin->options->get('Special.Name') ?>" />
 56 |   </div>
 57 |   <div>
 58 |     <label for="General/option_3/sub_option_of_3">General/option_3/sub_option_of_3</label>
 59 |     <input type="text" name="General/option_3/sub_option_of_3" id="General/option_3/
 60 | sub_option_of_3"
 61 |       value="<?php echo $plugin->options->get('General.option_3.sub_option_of_3') ?>" />
 62 |   </div>
 63 |   <button class="button button-primary">Update</button>
 64 | </form>
65 | 66 | 67 |
68 | 69 | 70 | 71 |

72 | 73 | 74 | options->get('General.option_1') 77 | ); ?> 78 | value="true"/> 79 |

80 | 81 |

82 | 83 | 84 | options->get('General.option_2') 87 | ); ?> 88 | value="true"/> 89 |

90 | 91 |

92 | 93 | 95 | 96 |

97 | 98 |

99 | 100 | 104 | 105 |

106 | 107 | 108 | 109 |
110 | 111 |
112 | -------------------------------------------------------------------------------- /resources/views/dashboard/package.php: -------------------------------------------------------------------------------- 1 |
2 | 3 |

Package sample

4 | 5 | 14 | 15 |
16 |

Overview

17 | 18 |

19 | Let me show you some useful package that you can use as extension of main framework. 20 |

21 |

22 | You'll find the complete list and the documentation of all packages in the official package repository. 24 |

25 | 26 |
27 |

Create your Package

28 | 29 |
<?php WPKirk\YourPackage\YourPackageProvider::yourPackageMethod(); ?>
30 | 31 | 32 | 33 |
34 |

Pure CSS Tabs

35 | 36 |

37 | Here we are using the Pure CSS Tabs package. 38 | To install it, you cn use: 39 |

40 | 41 |
php bones require wpbones/pure-css-tabs
42 | 43 |
44 | 45 | 46 | 51 | 52 |
53 |

Content for Database

54 |
55 | 56 | 57 | 58 | 59 | 60 | 61 |
62 |

Content for Posts

63 |
64 | 65 | 66 | 67 | 68 | 69 |
70 | 71 |

 74 | 
 75 |   
 76 |   
 81 | 
 82 |   
83 |

Content for Database

84 |
85 | 86 | 87 | 88 | 89 | 90 | 91 |
92 |

Content for Posts

93 |
94 | 95 | 96 | 97 | 98 | 99 |
100 | EOT; 101 | echo htmlspecialchars($code); 102 | ?> 103 | 104 | 105 |

* The tabs are responsive, try to resize your browser and you'll see them switch to accordion 106 | layout

107 | 108 |
109 | 110 |

Pure CSS Switch Button

111 | 112 |

113 | Here we are using the Pure CSS Switch package. 114 | To install it, you cn use: 115 |

116 | 117 |
php bones require wpbones/pure-css-switch
118 | 119 |

The you may use

120 | 121 |
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-1' ); 
122 | 123 |

You may add a left label

124 | 125 |

126 |

echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-2' )
127 | 			->left_label( 'Swipe me' ); 
128 | left_label('Swipe me'); ?> 131 |

132 | 133 |

as well as a right label

134 | 135 |

136 |

echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-3' )
137 | 			->right_label( 'Swipe me' ); 
138 | right_label('Swipe me'); ?> 141 |

142 | 143 | 144 |

Of course, you may use both left and right label

145 | 146 |

147 |

echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-4' )
148 | 			->left_label( 'Swipe me' )
149 | 			->right_label( 'Swipe me' );
150 | left_label('Swipe me') 154 | ->right_label('Swipe me'); ?> 155 |

156 | 157 |

You may preselect the default status by checked

158 | 159 |
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-5' )
160 | 			->left_label( 'Swipe me' )
161 | 			->checked( true );
162 | 163 |
164 | 165 |
166 |
167 | left_label('Swipe me') 171 | ->checked($value); ?> 172 |
173 | 176 |
177 |
178 |
179 | 180 |
181 | 182 |
183 | 184 |
185 |
186 | 187 |

as well as the disabled of the component

188 | 189 |
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-6' )
190 | 			->left_label( 'Swipe me' )
191 | 			->disabled( true );
192 | 193 |

194 | left_label('Swipe me') 198 | ->disabled(true); ?> 199 |

200 | 201 |

You may change the appearance by theme

202 | 203 |
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-7' )
204 | 			->theme( 'flat-square' );
205 | 206 |

207 | theme('flat-square'); ?> 210 |

211 | 212 |

Mode select (default is switch)

213 | 214 |
echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-8' )
215 | 			->left_label( 'Turn left' )
216 | 			->right_label( 'Turn right' )
217 | 			->mode( 'select' );
218 | 219 |

220 | left_label('Turn left') 224 | ->right_label('Turn right') 225 | ->mode('select'); ?> 226 |

227 | 228 |
229 | 230 |

User Agent

231 | 232 |

You may use this package to extend WP Bones with a Mobile Detect Library.

233 | 234 |

Installation

235 | 236 |
php bones require wpbones/useragent
237 | 238 |

I advise to use this command instead of composer require because doing this an automatic renaming 239 | will done.

240 | 241 | You can use composer to install this package: 242 | 243 |
composer require wpbones/useragent
244 | 245 |

You may also to add "wpbones/useragent": "^1.0" in the composer.json file of your 246 | plugin:

247 | 248 |
{
249 |   "require": {
250 |     "php": ">=7.2",
251 |     "wpbones/wpbones": "~0.8",
252 |     "wpbones/useragent": "~1.0"
253 |   },
254 | }
255 | 256 |

and run

257 | 258 |
composer install
259 | 260 |

Function

261 | 262 |

You will be able to use wpbones_user_agent() function to get an instance of Mobile Detect.

263 |

For example

264 | 265 |

266 | if (wpbones_user_agent()->isMobile()) {
267 |     echo "You're by Mobile";
268 |   } else {
269 |     echo "You're by Desktop";
270 |   }
271 | 272 | isMobile()): ?> 273 |

You're by Mobile

274 | 275 |

You're by Desktop

276 | 277 | 278 |

Some examples

279 | 280 |

Here are some examples of what you can do with this package.

281 | 282 |

For example, you can use the following methods:

283 | 284 |

285 | // Basic detection.
286 | wpbones_user_agent()->isMobile();
287 | wpbones_user_agent()->isTablet();
288 | 
289 | // Magic methods.
290 | wpbones_user_agent()->isIphone();
291 | wpbones_user_agent()->isSamsung();
292 | // [...]
293 | 
294 | // Alternative to magic methods.
295 | wpbones_user_agent()->is('iphone');
296 | 
297 | // Find the version of component.
298 | wpbones_user_agent()->version('Android');
299 | 
300 | 301 |

You may also

302 | 303 |

304 | // Any mobile device (phones or tablets).
305 | if ( wpbones_user_agent()->isMobile() ) {
306 | 
307 | }
308 | 
309 | // Any tablet device.
310 | if( wpbones_user_agent()->isTablet() ){
311 | 
312 | }
313 | 
314 | // Exclude tablets.
315 | if( wpbones_user_agent()->isMobile() && !wpbones_user_agent()->isTablet() ){
316 | 
317 | }
318 | 
319 | // Check for a specific platform with the help of the magic methods:
320 | if( wpbones_user_agent()->isiOS() ){
321 | 
322 | }
323 | 
324 | if( wpbones_user_agent()->isAndroidOS() ){
325 | 
326 | }
327 | 
328 | // Alternative method is() for checking specific properties.
329 | // WARNING: this method is in BETA, some keyword properties will change in the future.
330 | wpbones_user_agent()->is('Chrome')
331 | wpbones_user_agent()->is('iOS')
332 | wpbones_user_agent()->is('UCBrowser')
333 | wpbones_user_agent()->is('Opera')
334 | // [...]
335 | 
336 | 337 |
338 |

339 |

340 |

341 |
    342 |
  • 343 |
  • 344 |
  • 345 |
  • 346 |
  • 347 |
348 | 349 |
# The version of the file is 1.0.0
350 | version: "1.0.0"
351 | example:
352 |   # Enable or disable the Example feature
353 |   enabled: true
354 |   # Throttle request time in minutes
355 |   # By setting this value to 0, the feature will be disabled
356 |   throttle: 5
357 |   # Request timeout
358 |   timeout: 0)
359 | 360 |

361 | 362 |
wpbones_flags()->flags('flag_name')
363 | 364 |

365 |
wpbones_flags()->flags('flag_name.sub_flag')
366 | 367 |

368 |
WPkirk()->flags('version'); // flags('version'); ?>
369 |
WPkirk()->flags('example.throttle'); // flags('example.throttle'); ?>
370 |
WPkirk()->flags('example.miss', 'default-value'); // flags('example.miss', 'default-value'); ?>
371 | 372 | 373 | 374 |
375 |
376 | -------------------------------------------------------------------------------- /resources/views/dashboard/react-app.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | -------------------------------------------------------------------------------- /resources/views/dashboard/second.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | 12 |

13 | 14 |

15 | 16 | 17 | 18 | 19 | 20 |
21 | -------------------------------------------------------------------------------- /resources/views/dashboard/second_custom_page.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |

Hello, I'm a the second Custom Page without menu

12 | 13 |
Current Method 
15 | 16 |
<form method="post" action="<?php echo $plugin->getPageUrl('first_custom_page') ?>">
17 |     <button class="button button-hero button-primary">Back</button>
18 | </form>
19 | 20 |
22 | 23 |
24 | 25 |
26 | -------------------------------------------------------------------------------- /resources/views/dashboard/table.php: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 7 | 8 | 9 |
10 | -------------------------------------------------------------------------------- /resources/views/widgets/form.php: -------------------------------------------------------------------------------- 1 |

Widget Backend Form

2 | 3 |

4 | 6 | 11 |

12 | 13 | log()->info('Widget args backend', $instance); ?> 14 | 15 |

Name; ?> 16 |

17 | 2 | 5 |

Widget Output

6 | 9 |

Name; ?> 10 |

11 | 12 | log()->info('Widget args frontend', $args); ?> 13 | 14 | 15 | 16 |
17 | -------------------------------------------------------------------------------- /wp-kirk.php: -------------------------------------------------------------------------------- 1 |