heraspec 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -22
- package/README.md +188 -119
- package/bin/heraspec.js +4800 -1126
- package/bin/heraspec.js.map +4 -4
- package/dist/core/templates/skills/CHANGELOG.md +117 -117
- package/dist/core/templates/skills/README-template.md +58 -58
- package/dist/core/templates/skills/README.md +38 -38
- package/dist/core/templates/skills/content-optimization-skill.md +104 -104
- package/dist/core/templates/skills/data/design-systems.csv +54 -0
- package/dist/core/templates/skills/data/pages-proposed.csv +21 -21
- package/dist/core/templates/skills/data/pages.csv +9 -9
- package/dist/core/templates/skills/data/typography.csv +57 -57
- package/dist/core/templates/skills/deploy-documentation-skill.md +408 -0
- package/dist/core/templates/skills/design-system-skill.md +176 -0
- package/dist/core/templates/skills/documents/templates/documentation-landing-page.html +63 -63
- package/dist/core/templates/skills/documents/templates/documentation.html +49 -49
- package/dist/core/templates/skills/documents/templates/landing-script.js +38 -38
- package/dist/core/templates/skills/documents/templates/landing-style.css +158 -158
- package/dist/core/templates/skills/documents/templates/script.js +56 -56
- package/dist/core/templates/skills/documents/templates/style.css +155 -155
- package/dist/core/templates/skills/documents/templates/technical-doc-template.md +16 -16
- package/dist/core/templates/skills/documents/templates/user-guide-template.md +16 -16
- package/dist/core/templates/skills/documents-skill.md +104 -104
- package/dist/core/templates/skills/e2e-test-skill.md +119 -119
- package/dist/core/templates/skills/git-embed-skill.md +57 -0
- package/dist/core/templates/skills/integration-test-skill.md +118 -118
- package/dist/core/templates/skills/knowledge/README.md +63 -0
- package/dist/core/templates/skills/knowledge/design-systems/airbnb/DESIGN.md +246 -0
- package/dist/core/templates/skills/knowledge/design-systems/airtable/DESIGN.md +89 -0
- package/dist/core/templates/skills/knowledge/design-systems/apple/DESIGN.md +313 -0
- package/dist/core/templates/skills/knowledge/design-systems/bmw/DESIGN.md +180 -0
- package/dist/core/templates/skills/knowledge/design-systems/cal/DESIGN.md +259 -0
- package/dist/core/templates/skills/knowledge/design-systems/claude/DESIGN.md +312 -0
- package/dist/core/templates/skills/knowledge/design-systems/clay/DESIGN.md +304 -0
- package/dist/core/templates/skills/knowledge/design-systems/clickhouse/DESIGN.md +281 -0
- package/dist/core/templates/skills/knowledge/design-systems/cohere/DESIGN.md +266 -0
- package/dist/core/templates/skills/knowledge/design-systems/coinbase/DESIGN.md +129 -0
- package/dist/core/templates/skills/knowledge/design-systems/composio/DESIGN.md +307 -0
- package/dist/core/templates/skills/knowledge/design-systems/cursor/DESIGN.md +309 -0
- package/dist/core/templates/skills/knowledge/design-systems/elevenlabs/DESIGN.md +265 -0
- package/dist/core/templates/skills/knowledge/design-systems/expo/DESIGN.md +281 -0
- package/dist/core/templates/skills/knowledge/design-systems/figma/DESIGN.md +220 -0
- package/dist/core/templates/skills/knowledge/design-systems/framer/DESIGN.md +246 -0
- package/dist/core/templates/skills/knowledge/design-systems/hashicorp/DESIGN.md +278 -0
- package/dist/core/templates/skills/knowledge/design-systems/ibm/DESIGN.md +332 -0
- package/dist/core/templates/skills/knowledge/design-systems/index.json +72 -0
- package/dist/core/templates/skills/knowledge/design-systems/intercom/DESIGN.md +146 -0
- package/dist/core/templates/skills/knowledge/design-systems/kraken/DESIGN.md +125 -0
- package/dist/core/templates/skills/knowledge/design-systems/linear.app/DESIGN.md +367 -0
- package/dist/core/templates/skills/knowledge/design-systems/lovable/DESIGN.md +298 -0
- package/dist/core/templates/skills/knowledge/design-systems/minimax/DESIGN.md +257 -0
- package/dist/core/templates/skills/knowledge/design-systems/mintlify/DESIGN.md +326 -0
- package/dist/core/templates/skills/knowledge/design-systems/miro/DESIGN.md +108 -0
- package/dist/core/templates/skills/knowledge/design-systems/mistral.ai/DESIGN.md +261 -0
- package/dist/core/templates/skills/knowledge/design-systems/mongodb/DESIGN.md +266 -0
- package/dist/core/templates/skills/knowledge/design-systems/notion/DESIGN.md +309 -0
- package/dist/core/templates/skills/knowledge/design-systems/nvidia/DESIGN.md +293 -0
- package/dist/core/templates/skills/knowledge/design-systems/ollama/DESIGN.md +267 -0
- package/dist/core/templates/skills/knowledge/design-systems/opencode.ai/DESIGN.md +281 -0
- package/dist/core/templates/skills/knowledge/design-systems/pinterest/DESIGN.md +230 -0
- package/dist/core/templates/skills/knowledge/design-systems/posthog/DESIGN.md +256 -0
- package/dist/core/templates/skills/knowledge/design-systems/raycast/DESIGN.md +268 -0
- package/dist/core/templates/skills/knowledge/design-systems/replicate/DESIGN.md +261 -0
- package/dist/core/templates/skills/knowledge/design-systems/resend/DESIGN.md +303 -0
- package/dist/core/templates/skills/knowledge/design-systems/revolut/DESIGN.md +185 -0
- package/dist/core/templates/skills/knowledge/design-systems/runwayml/DESIGN.md +244 -0
- package/dist/core/templates/skills/knowledge/design-systems/sanity/DESIGN.md +357 -0
- package/dist/core/templates/skills/knowledge/design-systems/sentry/DESIGN.md +262 -0
- package/dist/core/templates/skills/knowledge/design-systems/spacex/DESIGN.md +194 -0
- package/dist/core/templates/skills/knowledge/design-systems/spotify/DESIGN.md +246 -0
- package/dist/core/templates/skills/knowledge/design-systems/stripe/DESIGN.md +322 -0
- package/dist/core/templates/skills/knowledge/design-systems/supabase/DESIGN.md +255 -0
- package/dist/core/templates/skills/knowledge/design-systems/superhuman/DESIGN.md +252 -0
- package/dist/core/templates/skills/knowledge/design-systems/together.ai/DESIGN.md +263 -0
- package/dist/core/templates/skills/knowledge/design-systems/uber/DESIGN.md +295 -0
- package/dist/core/templates/skills/knowledge/design-systems/vercel/DESIGN.md +310 -0
- package/dist/core/templates/skills/knowledge/design-systems/voltagent/DESIGN.md +323 -0
- package/dist/core/templates/skills/knowledge/design-systems/warp/DESIGN.md +253 -0
- package/dist/core/templates/skills/knowledge/design-systems/webflow/DESIGN.md +92 -0
- package/dist/core/templates/skills/knowledge/design-systems/wise/DESIGN.md +173 -0
- package/dist/core/templates/skills/knowledge/design-systems/x.ai/DESIGN.md +257 -0
- package/dist/core/templates/skills/knowledge/design-systems/zapier/DESIGN.md +328 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/codeigniter/rise-cms/profile.json +27 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/codeigniter/rise-cms/structure.md +137 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/laravel/botble/profile.json +39 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/laravel/botble/structure.md +208 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/wordpress/core/profile.json +51 -0
- package/dist/core/templates/skills/knowledge/frameworks/php/wordpress/core/structure.md +369 -0
- package/dist/core/templates/skills/knowledge/index.json +65 -0
- package/dist/core/templates/skills/module-codebase-skill.md +110 -110
- package/dist/core/templates/skills/plugin-directory-skill.md +396 -396
- package/dist/core/templates/skills/project-memory-skill.md +222 -0
- package/dist/core/templates/skills/project-memory-skill.vi.md +223 -0
- package/dist/core/templates/skills/scripts/CODE_EXPLANATION.md +394 -394
- package/dist/core/templates/skills/scripts/SEARCH_ALGORITHMS_COMPARISON.md +421 -421
- package/dist/core/templates/skills/scripts/SEARCH_MODES_GUIDE.md +238 -238
- package/dist/core/templates/skills/scripts/__pycache__/core.cpython-311.pyc +0 -0
- package/dist/core/templates/skills/scripts/core.py +391 -385
- package/dist/core/templates/skills/scripts/search.py +1 -1
- package/dist/core/templates/skills/smart-explore-skill.md +141 -0
- package/dist/core/templates/skills/sourcecode-analyzer-skill.md +210 -0
- package/dist/core/templates/skills/sourcecode-analyzer-skill.vi.md +210 -0
- package/dist/core/templates/skills/suggestion-skill.md +118 -118
- package/dist/core/templates/skills/templates/accessibility-checklist.md +40 -40
- package/dist/core/templates/skills/templates/example-prompt-full-theme.md +333 -333
- package/dist/core/templates/skills/templates/page-types-guide.md +338 -338
- package/dist/core/templates/skills/templates/pages-proposed-summary.md +273 -273
- package/dist/core/templates/skills/templates/pre-delivery-checklist.md +42 -42
- package/dist/core/templates/skills/templates/prompt-template-full-theme.md +313 -313
- package/dist/core/templates/skills/templates/responsive-design.md +40 -40
- package/dist/core/templates/skills/ui-ux-skill.md +595 -584
- package/dist/core/templates/skills/unit-test-skill.md +111 -111
- package/dist/core/templates/skills/ux-element/templates/Controller.php +50 -50
- package/dist/core/templates/skills/ux-element/templates/Shortcode.php +23 -23
- package/dist/core/templates/skills/ux-element/templates/Template.html +20 -20
- package/dist/core/templates/skills/ux-element/templates/Thumbnail.svg +8 -8
- package/dist/core/templates/skills/ux-element/templates/View.php +21 -21
- package/dist/core/templates/skills/ux-element-skill.md +83 -83
- package/dist/core/templates/skills/wordpress-plugin-check-skill.md +151 -151
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-dashboard.php +47 -47
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/admin-settings.php +60 -60
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-css.css +22 -22
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/assets/admin-js.js +15 -15
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/plugin-main.php +169 -169
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/readme.txt +41 -41
- package/dist/core/templates/skills/wordpress-plugin-standard/templates/uninstall.php +21 -21
- package/dist/core/templates/skills/wordpress-plugin-standard-skill.md +100 -100
- package/dist/index.js +4068 -278
- package/package.json +75 -72
|
@@ -1,169 +1,169 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* Plugin Name: {{plugin_name}}
|
|
4
|
-
* Description: A high-quality WordPress plugin following WP.org standards.
|
|
5
|
-
* Version: 1.0.0
|
|
6
|
-
* Author: Your Name
|
|
7
|
-
* Author URI: https://example.com
|
|
8
|
-
* License: GPL-2.0-or-later
|
|
9
|
-
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
10
|
-
* Text Domain: {{text_domain}}
|
|
11
|
-
* Domain Path: /languages
|
|
12
|
-
*
|
|
13
|
-
* @package {{namespace}}
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
// If this file is called directly, abort.
|
|
17
|
-
if ( ! defined( 'ABSPATH' ) ) {
|
|
18
|
-
exit;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The core plugin class.
|
|
23
|
-
*/
|
|
24
|
-
class {{namespace}}\Main {
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Instance of this class.
|
|
28
|
-
*
|
|
29
|
-
* @var object
|
|
30
|
-
*/
|
|
31
|
-
protected static $instance = null;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Initialize the plugin.
|
|
35
|
-
*/
|
|
36
|
-
public function __construct() {
|
|
37
|
-
$this->define_constants();
|
|
38
|
-
$this->includes();
|
|
39
|
-
$this->init_hooks();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Return an instance of this class.
|
|
44
|
-
*/
|
|
45
|
-
public static function get_instance() {
|
|
46
|
-
if ( null === self::$instance ) {
|
|
47
|
-
self::$instance = new self();
|
|
48
|
-
}
|
|
49
|
-
return self::$instance;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Define constants.
|
|
54
|
-
*/
|
|
55
|
-
private function define_constants() {
|
|
56
|
-
define( '{{prefix|upper}}VERSION', '1.0.0' );
|
|
57
|
-
define( '{{prefix|upper}}PATH', plugin_dir_path( __FILE__ ) );
|
|
58
|
-
define( '{{prefix|upper}}URL', plugin_dir_url( __FILE__ ) );
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Include required files.
|
|
63
|
-
*/
|
|
64
|
-
private function includes() {
|
|
65
|
-
// Include admin classes, helpers, etc.
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Initialize hooks.
|
|
70
|
-
*/
|
|
71
|
-
private function init_hooks() {
|
|
72
|
-
add_action( 'admin_menu', [ $this, 'add_menu_pages' ] );
|
|
73
|
-
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] );
|
|
74
|
-
|
|
75
|
-
// Activation / Deactivation hooks
|
|
76
|
-
register_activation_hook( __FILE__, [ $this, 'activate' ] );
|
|
77
|
-
register_deactivation_hook( __FILE__, [ $this, 'deactivate' ] );
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Add Admin Menu Pages.
|
|
82
|
-
*/
|
|
83
|
-
public function add_menu_pages() {
|
|
84
|
-
add_menu_page(
|
|
85
|
-
__( '{{plugin_name}}', '{{text_domain}}' ),
|
|
86
|
-
__( '{{plugin_name}}', '{{text_domain}}' ),
|
|
87
|
-
'manage_options',
|
|
88
|
-
'{{plugin_slug}}',
|
|
89
|
-
[ $this, 'render_dashboard_page' ],
|
|
90
|
-
'dashicons-admin-generic',
|
|
91
|
-
100
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
add_submenu_page(
|
|
95
|
-
'{{plugin_slug}}',
|
|
96
|
-
__( 'Dashboard', '{{text_domain}}' ),
|
|
97
|
-
__( 'Dashboard', '{{text_domain}}' ),
|
|
98
|
-
'manage_options',
|
|
99
|
-
'{{plugin_slug}}',
|
|
100
|
-
[ $this, 'render_dashboard_page' ]
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
add_submenu_page(
|
|
104
|
-
'{{plugin_slug}}',
|
|
105
|
-
__( 'Settings', '{{text_domain}}' ),
|
|
106
|
-
__( 'Settings', '{{text_domain}}' ),
|
|
107
|
-
'manage_options',
|
|
108
|
-
'{{plugin_slug}}-settings',
|
|
109
|
-
[ $this, 'render_settings_page' ]
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Enqueue Admin Assets.
|
|
115
|
-
*/
|
|
116
|
-
public function enqueue_admin_assets( $hook ) {
|
|
117
|
-
// Only load on our plugin pages
|
|
118
|
-
if ( strpos( $hook, '{{plugin_slug}}' ) === false ) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
wp_enqueue_style( '{{plugin_slug}}-admin', {{prefix|upper}}URL . 'assets/css/admin.css', [], {{prefix|upper}}VERSION );
|
|
123
|
-
wp_enqueue_script( '{{plugin_slug}}-admin', {{prefix|upper}}URL . 'assets/js/admin.js', [ 'jquery' ], {{prefix|upper}}VERSION, true );
|
|
124
|
-
|
|
125
|
-
wp_localize_script( '{{plugin_slug}}-admin', '{{prefix}}params', [
|
|
126
|
-
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
|
127
|
-
'nonce' => wp_create_nonce( '{{prefix}}nonce' ),
|
|
128
|
-
]);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Render Dashboard Page.
|
|
133
|
-
*/
|
|
134
|
-
public function render_dashboard_page() {
|
|
135
|
-
// Include template file
|
|
136
|
-
include {{prefix|upper}}PATH . 'templates/admin-dashboard.php';
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Render Settings Page.
|
|
141
|
-
*/
|
|
142
|
-
public function render_settings_page() {
|
|
143
|
-
// Include template file
|
|
144
|
-
include {{prefix|upper}}PATH . 'templates/admin-settings.php';
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Activation logic.
|
|
149
|
-
*/
|
|
150
|
-
public function activate() {
|
|
151
|
-
// Setup database tables, default options, etc.
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Deactivation logic.
|
|
156
|
-
*/
|
|
157
|
-
public function deactivate() {
|
|
158
|
-
// Clear scheduled tasks, etc.
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Initialize the plugin.
|
|
164
|
-
*/
|
|
165
|
-
function {{prefix}}init() {
|
|
166
|
-
return {{namespace}}\Main::get_instance();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
add_action( 'plugins_loaded', '{{prefix}}init' );
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: {{plugin_name}}
|
|
4
|
+
* Description: A high-quality WordPress plugin following WP.org standards.
|
|
5
|
+
* Version: 1.0.0
|
|
6
|
+
* Author: Your Name
|
|
7
|
+
* Author URI: https://example.com
|
|
8
|
+
* License: GPL-2.0-or-later
|
|
9
|
+
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
10
|
+
* Text Domain: {{text_domain}}
|
|
11
|
+
* Domain Path: /languages
|
|
12
|
+
*
|
|
13
|
+
* @package {{namespace}}
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// If this file is called directly, abort.
|
|
17
|
+
if ( ! defined( 'ABSPATH' ) ) {
|
|
18
|
+
exit;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The core plugin class.
|
|
23
|
+
*/
|
|
24
|
+
class {{namespace}}\Main {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Instance of this class.
|
|
28
|
+
*
|
|
29
|
+
* @var object
|
|
30
|
+
*/
|
|
31
|
+
protected static $instance = null;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Initialize the plugin.
|
|
35
|
+
*/
|
|
36
|
+
public function __construct() {
|
|
37
|
+
$this->define_constants();
|
|
38
|
+
$this->includes();
|
|
39
|
+
$this->init_hooks();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Return an instance of this class.
|
|
44
|
+
*/
|
|
45
|
+
public static function get_instance() {
|
|
46
|
+
if ( null === self::$instance ) {
|
|
47
|
+
self::$instance = new self();
|
|
48
|
+
}
|
|
49
|
+
return self::$instance;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Define constants.
|
|
54
|
+
*/
|
|
55
|
+
private function define_constants() {
|
|
56
|
+
define( '{{prefix|upper}}VERSION', '1.0.0' );
|
|
57
|
+
define( '{{prefix|upper}}PATH', plugin_dir_path( __FILE__ ) );
|
|
58
|
+
define( '{{prefix|upper}}URL', plugin_dir_url( __FILE__ ) );
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Include required files.
|
|
63
|
+
*/
|
|
64
|
+
private function includes() {
|
|
65
|
+
// Include admin classes, helpers, etc.
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Initialize hooks.
|
|
70
|
+
*/
|
|
71
|
+
private function init_hooks() {
|
|
72
|
+
add_action( 'admin_menu', [ $this, 'add_menu_pages' ] );
|
|
73
|
+
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] );
|
|
74
|
+
|
|
75
|
+
// Activation / Deactivation hooks
|
|
76
|
+
register_activation_hook( __FILE__, [ $this, 'activate' ] );
|
|
77
|
+
register_deactivation_hook( __FILE__, [ $this, 'deactivate' ] );
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Add Admin Menu Pages.
|
|
82
|
+
*/
|
|
83
|
+
public function add_menu_pages() {
|
|
84
|
+
add_menu_page(
|
|
85
|
+
__( '{{plugin_name}}', '{{text_domain}}' ),
|
|
86
|
+
__( '{{plugin_name}}', '{{text_domain}}' ),
|
|
87
|
+
'manage_options',
|
|
88
|
+
'{{plugin_slug}}',
|
|
89
|
+
[ $this, 'render_dashboard_page' ],
|
|
90
|
+
'dashicons-admin-generic',
|
|
91
|
+
100
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
add_submenu_page(
|
|
95
|
+
'{{plugin_slug}}',
|
|
96
|
+
__( 'Dashboard', '{{text_domain}}' ),
|
|
97
|
+
__( 'Dashboard', '{{text_domain}}' ),
|
|
98
|
+
'manage_options',
|
|
99
|
+
'{{plugin_slug}}',
|
|
100
|
+
[ $this, 'render_dashboard_page' ]
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
add_submenu_page(
|
|
104
|
+
'{{plugin_slug}}',
|
|
105
|
+
__( 'Settings', '{{text_domain}}' ),
|
|
106
|
+
__( 'Settings', '{{text_domain}}' ),
|
|
107
|
+
'manage_options',
|
|
108
|
+
'{{plugin_slug}}-settings',
|
|
109
|
+
[ $this, 'render_settings_page' ]
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Enqueue Admin Assets.
|
|
115
|
+
*/
|
|
116
|
+
public function enqueue_admin_assets( $hook ) {
|
|
117
|
+
// Only load on our plugin pages
|
|
118
|
+
if ( strpos( $hook, '{{plugin_slug}}' ) === false ) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
wp_enqueue_style( '{{plugin_slug}}-admin', {{prefix|upper}}URL . 'assets/css/admin.css', [], {{prefix|upper}}VERSION );
|
|
123
|
+
wp_enqueue_script( '{{plugin_slug}}-admin', {{prefix|upper}}URL . 'assets/js/admin.js', [ 'jquery' ], {{prefix|upper}}VERSION, true );
|
|
124
|
+
|
|
125
|
+
wp_localize_script( '{{plugin_slug}}-admin', '{{prefix}}params', [
|
|
126
|
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
|
127
|
+
'nonce' => wp_create_nonce( '{{prefix}}nonce' ),
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Render Dashboard Page.
|
|
133
|
+
*/
|
|
134
|
+
public function render_dashboard_page() {
|
|
135
|
+
// Include template file
|
|
136
|
+
include {{prefix|upper}}PATH . 'templates/admin-dashboard.php';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Render Settings Page.
|
|
141
|
+
*/
|
|
142
|
+
public function render_settings_page() {
|
|
143
|
+
// Include template file
|
|
144
|
+
include {{prefix|upper}}PATH . 'templates/admin-settings.php';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Activation logic.
|
|
149
|
+
*/
|
|
150
|
+
public function activate() {
|
|
151
|
+
// Setup database tables, default options, etc.
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Deactivation logic.
|
|
156
|
+
*/
|
|
157
|
+
public function deactivate() {
|
|
158
|
+
// Clear scheduled tasks, etc.
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Initialize the plugin.
|
|
164
|
+
*/
|
|
165
|
+
function {{prefix}}init() {
|
|
166
|
+
return {{namespace}}\Main::get_instance();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
add_action( 'plugins_loaded', '{{prefix}}init' );
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
=== {{plugin_name}} ===
|
|
2
|
-
Contributors: yourname
|
|
3
|
-
Tags: wordpress, plugin, standard
|
|
4
|
-
Requires at least: 6.0
|
|
5
|
-
Tested up to: 6.4
|
|
6
|
-
Requires PHP: 7.4
|
|
7
|
-
Stable tag: 1.0.0
|
|
8
|
-
License: GPLv2 or later
|
|
9
|
-
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
10
|
-
|
|
11
|
-
{{plugin_name}} is a high-quality WordPress plugin built with HeraSpec.
|
|
12
|
-
|
|
13
|
-
== Description ==
|
|
14
|
-
|
|
15
|
-
Describe your plugin features here.
|
|
16
|
-
|
|
17
|
-
== Installation ==
|
|
18
|
-
|
|
19
|
-
1. Upload the plugin files to the `/wp-content/plugins/{{plugin_slug}}` directory.
|
|
20
|
-
2. Activate the plugin through the 'Plugins' screen in WordPress.
|
|
21
|
-
3. Go to {{plugin_name}} -> Settings to configure.
|
|
22
|
-
|
|
23
|
-
== Frequently Asked Questions ==
|
|
24
|
-
|
|
25
|
-
= Is this plugin free? =
|
|
26
|
-
|
|
27
|
-
Yes!
|
|
28
|
-
|
|
29
|
-
== Screenshots ==
|
|
30
|
-
|
|
31
|
-
1. Dashboard view.
|
|
32
|
-
|
|
33
|
-
== Changelog ==
|
|
34
|
-
|
|
35
|
-
= 1.0.0 =
|
|
36
|
-
* Initial release.
|
|
37
|
-
|
|
38
|
-
== Upgrade Notice ==
|
|
39
|
-
|
|
40
|
-
= 1.0.0 =
|
|
41
|
-
* First version.
|
|
1
|
+
=== {{plugin_name}} ===
|
|
2
|
+
Contributors: yourname
|
|
3
|
+
Tags: wordpress, plugin, standard
|
|
4
|
+
Requires at least: 6.0
|
|
5
|
+
Tested up to: 6.4
|
|
6
|
+
Requires PHP: 7.4
|
|
7
|
+
Stable tag: 1.0.0
|
|
8
|
+
License: GPLv2 or later
|
|
9
|
+
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
10
|
+
|
|
11
|
+
{{plugin_name}} is a high-quality WordPress plugin built with HeraSpec.
|
|
12
|
+
|
|
13
|
+
== Description ==
|
|
14
|
+
|
|
15
|
+
Describe your plugin features here.
|
|
16
|
+
|
|
17
|
+
== Installation ==
|
|
18
|
+
|
|
19
|
+
1. Upload the plugin files to the `/wp-content/plugins/{{plugin_slug}}` directory.
|
|
20
|
+
2. Activate the plugin through the 'Plugins' screen in WordPress.
|
|
21
|
+
3. Go to {{plugin_name}} -> Settings to configure.
|
|
22
|
+
|
|
23
|
+
== Frequently Asked Questions ==
|
|
24
|
+
|
|
25
|
+
= Is this plugin free? =
|
|
26
|
+
|
|
27
|
+
Yes!
|
|
28
|
+
|
|
29
|
+
== Screenshots ==
|
|
30
|
+
|
|
31
|
+
1. Dashboard view.
|
|
32
|
+
|
|
33
|
+
== Changelog ==
|
|
34
|
+
|
|
35
|
+
= 1.0.0 =
|
|
36
|
+
* Initial release.
|
|
37
|
+
|
|
38
|
+
== Upgrade Notice ==
|
|
39
|
+
|
|
40
|
+
= 1.0.0 =
|
|
41
|
+
* First version.
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* Fired when the plugin is uninstalled.
|
|
4
|
-
*
|
|
5
|
-
* @package {{namespace}}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// If uninstall not called from WordPress, then exit.
|
|
9
|
-
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
|
10
|
-
exit;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Clean up plugin data.
|
|
15
|
-
*/
|
|
16
|
-
delete_option( '{{prefix}}version' );
|
|
17
|
-
delete_option( '{{prefix}}api_key' );
|
|
18
|
-
|
|
19
|
-
// Delete custom tables if any...
|
|
20
|
-
// global $wpdb;
|
|
21
|
-
// $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}your_table_name" );
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Fired when the plugin is uninstalled.
|
|
4
|
+
*
|
|
5
|
+
* @package {{namespace}}
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// If uninstall not called from WordPress, then exit.
|
|
9
|
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
|
10
|
+
exit;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Clean up plugin data.
|
|
15
|
+
*/
|
|
16
|
+
delete_option( '{{prefix}}version' );
|
|
17
|
+
delete_option( '{{prefix}}api_key' );
|
|
18
|
+
|
|
19
|
+
// Delete custom tables if any...
|
|
20
|
+
// global $wpdb;
|
|
21
|
+
// $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}your_table_name" );
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
# Skill: WordPress Plugin Standard (WP.org Compliant)
|
|
2
|
-
|
|
3
|
-
This skill guides the creation of a high-quality, secure, and WordPress.org compliant plugin. It focuses on adherence to the Plugin Check (PCP) requirements and provides a robust structure including admin interfaces.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
Standardize WordPress plugin development to ensure acceptance into the official repository, maximize security, and promote maintainability through strict separation of concerns.
|
|
7
|
-
|
|
8
|
-
## Required Variables
|
|
9
|
-
- `{{plugin_name}}`: Human-readable name (e.g., My Awesome Plugin).
|
|
10
|
-
- `{{plugin_slug}}`: Unique slug (e.g., my-awesome-plugin).
|
|
11
|
-
- `{{namespace}}`: PHP Namespace (e.g., PolyXGO\MyPlugin).
|
|
12
|
-
- `{{prefix}}`: Unique prefix for functions/variables (e.g., pxmp_).
|
|
13
|
-
- `{{text_domain}}`: I18n text domain (usually same as plugin slug).
|
|
14
|
-
|
|
15
|
-
## Core Requirements (WordPress.org & PCP)
|
|
16
|
-
|
|
17
|
-
### 1. Security & Protection
|
|
18
|
-
- **Direct Access**: Use `if ( ! defined( 'ABSPATH' ) ) exit;` at the top of every PHP file.
|
|
19
|
-
- **Nonces**: Verify nonces for all form submissions and AJAX requests.
|
|
20
|
-
- **Validation & Sanitization**: Sanitize all inputs (`sanitize_text_field`, `absint`, etc.) and validate data before processing.
|
|
21
|
-
- **Escaping**: Escape all outputs strictly based on context (`esc_html`, `esc_attr`, `wp_kses`, etc.).
|
|
22
|
-
- **Capabilities**: Explicitly check user capabilities (`current_user_can`) for all admin actions.
|
|
23
|
-
|
|
24
|
-
### 2. Code Organization & Standards
|
|
25
|
-
- **Naming**: Use the `{{prefix}}` for all global functions, variables, and constants.
|
|
26
|
-
- **Namespace**: Use PSR-4 namespacing (`{{namespace}}`) to avoid class collisions.
|
|
27
|
-
- **Separation of Concerns**: Keep CSS and JS in separate files. AVOID inline styles or scripts unless dynamically generated values are required (use `wp_localize_script` or `wp_add_inline_style` only when necessary).
|
|
28
|
-
- **No Prohibited Constructs**: Never use `eval()`, `base64_decode()` for obfuscation, or short tags (`<?`).
|
|
29
|
-
|
|
30
|
-
### 3. Required Components
|
|
31
|
-
- **Main Plugin File**: Must contain the required header comment.
|
|
32
|
-
- **`readme.txt`**: Standard WordPress.org format.
|
|
33
|
-
- **Admin Interface**:
|
|
34
|
-
- A top-level or sub-menu item for the **Dashboard**.
|
|
35
|
-
- A dedicated **Settings** page for configuration.
|
|
36
|
-
- **Uninstallation**: Provide an `uninstall.php` file to clean up data (options, tables) when the plugin is deleted.
|
|
37
|
-
|
|
38
|
-
## Implementation Steps
|
|
39
|
-
|
|
40
|
-
### Step 1: Initialize Main Structure
|
|
41
|
-
1. Create the main plugin file `{{plugin_slug}}.php` with the correct header.
|
|
42
|
-
2. Initialize the main class with a singleton or static instance.
|
|
43
|
-
3. Hook into `plugins_loaded` to start the plugin logic.
|
|
44
|
-
|
|
45
|
-
### Step 2: Register Admin Menu
|
|
46
|
-
1. Hook into `admin_menu`.
|
|
47
|
-
2. Add a menu page and a sub-page for Settings.
|
|
48
|
-
3. Enqueue admin-specific assets (CSS/JS) only on plugin pages.
|
|
49
|
-
|
|
50
|
-
### Step 3: Integrate UI/UX Skill
|
|
51
|
-
When designing the Dashboard or Settings page:
|
|
52
|
-
1. **Call Skill**: Use `(skill: ui-ux)` to define the design language.
|
|
53
|
-
2. **Apply Styles**: Use the colors, typography, and spacing defined by the `ui-ux` skill result.
|
|
54
|
-
3. Write styles in `assets/admin.css`.
|
|
55
|
-
|
|
56
|
-
### Step 4: Handle Data Persistence
|
|
57
|
-
1. Use the Options API (`get_option`, `update_option`) for settings.
|
|
58
|
-
2. Ensure all data saved to the database is sanitized.
|
|
59
|
-
3. Ensure all data retrieved from the database is escaped on output.
|
|
60
|
-
|
|
61
|
-
## Standards and Rules
|
|
62
|
-
|
|
63
|
-
### The Prefixing Rule
|
|
64
|
-
Every global identifier MUST start with `{{prefix}}`.
|
|
65
|
-
- ✅ `{{prefix}}get_settings()`
|
|
66
|
-
- ❌ `get_settings()`
|
|
67
|
-
|
|
68
|
-
### The "No Inline" Rule
|
|
69
|
-
- CSS must be in `assets/css/admin.css`.
|
|
70
|
-
- JS must be in `assets/js/admin.js`.
|
|
71
|
-
- Use `wp_enqueue_style` and `wp_enqueue_script` correctly.
|
|
72
|
-
|
|
73
|
-
### The "Smart Flush" Rule (Friendly URLs)
|
|
74
|
-
If the plugin uses custom post types or custom permalink structures, you MUST implement a "Queue & Flush" mechanism to update rewrite rules automatically. **NEVER** call `flush_rewrite_rules()` on every page load or `init` hook directly without a condition.
|
|
75
|
-
|
|
76
|
-
**Implementation Pattern:**
|
|
77
|
-
1. **Queue Flush**: When settings verify (e.g., via `update_option` hook), set a temporary flag.
|
|
78
|
-
```php
|
|
79
|
-
add_action('update_option_{{prefix}}permalink_settings', function($old, $new) {
|
|
80
|
-
update_option('{{prefix}}flush_rewrite_flag', true);
|
|
81
|
-
}, 10, 2);
|
|
82
|
-
```
|
|
83
|
-
2. **Execute Flush**: On the next `admin_init`, check and flush.
|
|
84
|
-
```php
|
|
85
|
-
add_action('admin_init', function() {
|
|
86
|
-
if (get_option('{{prefix}}flush_rewrite_flag')) {
|
|
87
|
-
flush_rewrite_rules();
|
|
88
|
-
delete_option('{{prefix}}flush_rewrite_flag');
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Templates
|
|
94
|
-
- [plugin-main.php](templates/plugin-main.php)
|
|
95
|
-
- [admin-dashboard.php](templates/admin-dashboard.php)
|
|
96
|
-
- [admin-settings.php](templates/admin-settings.php)
|
|
97
|
-
- [readme.txt](templates/readme.txt)
|
|
98
|
-
- [uninstall.php](templates/uninstall.php)
|
|
99
|
-
- [assets/admin-css.css](templates/assets/admin-css.css)
|
|
100
|
-
- [assets/admin-js.js](templates/assets/admin-js.js)
|
|
1
|
+
# Skill: WordPress Plugin Standard (WP.org Compliant)
|
|
2
|
+
|
|
3
|
+
This skill guides the creation of a high-quality, secure, and WordPress.org compliant plugin. It focuses on adherence to the Plugin Check (PCP) requirements and provides a robust structure including admin interfaces.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
Standardize WordPress plugin development to ensure acceptance into the official repository, maximize security, and promote maintainability through strict separation of concerns.
|
|
7
|
+
|
|
8
|
+
## Required Variables
|
|
9
|
+
- `{{plugin_name}}`: Human-readable name (e.g., My Awesome Plugin).
|
|
10
|
+
- `{{plugin_slug}}`: Unique slug (e.g., my-awesome-plugin).
|
|
11
|
+
- `{{namespace}}`: PHP Namespace (e.g., PolyXGO\MyPlugin).
|
|
12
|
+
- `{{prefix}}`: Unique prefix for functions/variables (e.g., pxmp_).
|
|
13
|
+
- `{{text_domain}}`: I18n text domain (usually same as plugin slug).
|
|
14
|
+
|
|
15
|
+
## Core Requirements (WordPress.org & PCP)
|
|
16
|
+
|
|
17
|
+
### 1. Security & Protection
|
|
18
|
+
- **Direct Access**: Use `if ( ! defined( 'ABSPATH' ) ) exit;` at the top of every PHP file.
|
|
19
|
+
- **Nonces**: Verify nonces for all form submissions and AJAX requests.
|
|
20
|
+
- **Validation & Sanitization**: Sanitize all inputs (`sanitize_text_field`, `absint`, etc.) and validate data before processing.
|
|
21
|
+
- **Escaping**: Escape all outputs strictly based on context (`esc_html`, `esc_attr`, `wp_kses`, etc.).
|
|
22
|
+
- **Capabilities**: Explicitly check user capabilities (`current_user_can`) for all admin actions.
|
|
23
|
+
|
|
24
|
+
### 2. Code Organization & Standards
|
|
25
|
+
- **Naming**: Use the `{{prefix}}` for all global functions, variables, and constants.
|
|
26
|
+
- **Namespace**: Use PSR-4 namespacing (`{{namespace}}`) to avoid class collisions.
|
|
27
|
+
- **Separation of Concerns**: Keep CSS and JS in separate files. AVOID inline styles or scripts unless dynamically generated values are required (use `wp_localize_script` or `wp_add_inline_style` only when necessary).
|
|
28
|
+
- **No Prohibited Constructs**: Never use `eval()`, `base64_decode()` for obfuscation, or short tags (`<?`).
|
|
29
|
+
|
|
30
|
+
### 3. Required Components
|
|
31
|
+
- **Main Plugin File**: Must contain the required header comment.
|
|
32
|
+
- **`readme.txt`**: Standard WordPress.org format.
|
|
33
|
+
- **Admin Interface**:
|
|
34
|
+
- A top-level or sub-menu item for the **Dashboard**.
|
|
35
|
+
- A dedicated **Settings** page for configuration.
|
|
36
|
+
- **Uninstallation**: Provide an `uninstall.php` file to clean up data (options, tables) when the plugin is deleted.
|
|
37
|
+
|
|
38
|
+
## Implementation Steps
|
|
39
|
+
|
|
40
|
+
### Step 1: Initialize Main Structure
|
|
41
|
+
1. Create the main plugin file `{{plugin_slug}}.php` with the correct header.
|
|
42
|
+
2. Initialize the main class with a singleton or static instance.
|
|
43
|
+
3. Hook into `plugins_loaded` to start the plugin logic.
|
|
44
|
+
|
|
45
|
+
### Step 2: Register Admin Menu
|
|
46
|
+
1. Hook into `admin_menu`.
|
|
47
|
+
2. Add a menu page and a sub-page for Settings.
|
|
48
|
+
3. Enqueue admin-specific assets (CSS/JS) only on plugin pages.
|
|
49
|
+
|
|
50
|
+
### Step 3: Integrate UI/UX Skill
|
|
51
|
+
When designing the Dashboard or Settings page:
|
|
52
|
+
1. **Call Skill**: Use `(skill: ui-ux)` to define the design language.
|
|
53
|
+
2. **Apply Styles**: Use the colors, typography, and spacing defined by the `ui-ux` skill result.
|
|
54
|
+
3. Write styles in `assets/admin.css`.
|
|
55
|
+
|
|
56
|
+
### Step 4: Handle Data Persistence
|
|
57
|
+
1. Use the Options API (`get_option`, `update_option`) for settings.
|
|
58
|
+
2. Ensure all data saved to the database is sanitized.
|
|
59
|
+
3. Ensure all data retrieved from the database is escaped on output.
|
|
60
|
+
|
|
61
|
+
## Standards and Rules
|
|
62
|
+
|
|
63
|
+
### The Prefixing Rule
|
|
64
|
+
Every global identifier MUST start with `{{prefix}}`.
|
|
65
|
+
- ✅ `{{prefix}}get_settings()`
|
|
66
|
+
- ❌ `get_settings()`
|
|
67
|
+
|
|
68
|
+
### The "No Inline" Rule
|
|
69
|
+
- CSS must be in `assets/css/admin.css`.
|
|
70
|
+
- JS must be in `assets/js/admin.js`.
|
|
71
|
+
- Use `wp_enqueue_style` and `wp_enqueue_script` correctly.
|
|
72
|
+
|
|
73
|
+
### The "Smart Flush" Rule (Friendly URLs)
|
|
74
|
+
If the plugin uses custom post types or custom permalink structures, you MUST implement a "Queue & Flush" mechanism to update rewrite rules automatically. **NEVER** call `flush_rewrite_rules()` on every page load or `init` hook directly without a condition.
|
|
75
|
+
|
|
76
|
+
**Implementation Pattern:**
|
|
77
|
+
1. **Queue Flush**: When settings verify (e.g., via `update_option` hook), set a temporary flag.
|
|
78
|
+
```php
|
|
79
|
+
add_action('update_option_{{prefix}}permalink_settings', function($old, $new) {
|
|
80
|
+
update_option('{{prefix}}flush_rewrite_flag', true);
|
|
81
|
+
}, 10, 2);
|
|
82
|
+
```
|
|
83
|
+
2. **Execute Flush**: On the next `admin_init`, check and flush.
|
|
84
|
+
```php
|
|
85
|
+
add_action('admin_init', function() {
|
|
86
|
+
if (get_option('{{prefix}}flush_rewrite_flag')) {
|
|
87
|
+
flush_rewrite_rules();
|
|
88
|
+
delete_option('{{prefix}}flush_rewrite_flag');
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Templates
|
|
94
|
+
- [plugin-main.php](templates/plugin-main.php)
|
|
95
|
+
- [admin-dashboard.php](templates/admin-dashboard.php)
|
|
96
|
+
- [admin-settings.php](templates/admin-settings.php)
|
|
97
|
+
- [readme.txt](templates/readme.txt)
|
|
98
|
+
- [uninstall.php](templates/uninstall.php)
|
|
99
|
+
- [assets/admin-css.css](templates/assets/admin-css.css)
|
|
100
|
+
- [assets/admin-js.js](templates/assets/admin-js.js)
|