PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / modules / mcp / abilities / wordpress-best-practices-ability.php

wordpress-best-practices-ability.php in Elementor Website Builder – more than just a page builder 4.3.0-beta3, at modules/mcp/abilities/wordpress-best-practices-ability.php

49 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\Mcp\Abilities;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 class Wordpress_Best_Practices_Ability extends Abstract_Ability {
10 const URI = 'elementor://wordpress/best-practices';
11 const FILE_PATH = __DIR__ . '/../static-resources/wordpress/best-practices.md';
12
13 protected function get_ability_id(): string {
14 return 'elementor/wordpress-best-practices';
15 }
16
17 protected function get_definition(): Ability_Definition {
18 return new Ability_Definition(
19 __( 'WordPress Best Practices', 'elementor' ),
20 __( 'Opinionated WordPress patterns for Elementor builds: repeating layouts (single template vs N pages), include-all + exclude-exceptions condition scoping, Post Content placement, dynamic tags.', 'elementor' ),
21 'elementor',
22 [ 'type' => 'string' ],
23 [
24 'mcp' => [
25 'type' => 'resource',
26 'uri' => self::URI,
27 'public' => true,
28 'mimeType' => 'text/markdown',
29 'description' => __( 'Opinionated WordPress patterns for Elementor builds: repeating layouts (single template vs N pages), include-all + exclude-exceptions condition scoping, Post Content placement, dynamic tags.', 'elementor' ),
30 ],
31 ],
32 fn() => current_user_can( 'edit_posts' )
33 );
34 }
35
36 public function execute( $input = [] ) {
37 if ( ! file_exists( self::FILE_PATH ) ) {
38 return new \WP_Error(
39 'resource_not_found',
40 __( 'Static resource file not found', 'elementor' ),
41 [ 'status' => 404 ]
42 );
43 }
44
45 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
46 return file_get_contents( self::FILE_PATH );
47 }
48 }
49