PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
← All changes | extensions/blocks/rating-star/rating-star.php +6 -29 12.4.2 → 16.3-beta View file →
@@ -11,10 +11,11 @@
11 11
12 12 use Automattic\Jetpack\Blocks;
13 13 use Jetpack_Gutenberg;
14 14
15 -const FEATURE_NAME = 'rating-star';
16 -const BLOCK_NAME = 'jetpack/' . FEATURE_NAME;
15 +if ( ! defined( 'ABSPATH' ) ) {
16 + exit( 0 );
17 +}
17 18
18 19 // Load generic function definitions.
19 20 require_once __DIR__ . '/rating-meta.php';
20 21
@@ -24,35 +25,11 @@
24 25 * registration if we need to.
25 26 */
26 27 function register_block() {
27 28 Blocks::jetpack_register_block(
28 - BLOCK_NAME,
29 + __DIR__,
29 30 array(
30 31 'render_callback' => __NAMESPACE__ . '\render_block',
31 - 'attributes' => array(
32 - 'rating' => array(
33 - 'type' => 'number',
34 - 'default' => 1,
35 - ),
36 - 'maxRating' => array(
37 - 'type' => 'number',
38 - 'default' => 5,
39 - ),
40 - 'color' => array(
41 - 'type' => 'string',
42 - ),
43 - 'ratingStyle' => array(
44 - 'type' => 'string',
45 - 'default' => 'star',
46 - ),
47 - 'className' => array(
48 - 'type' => 'string',
49 - ),
50 - 'align' => array(
51 - 'type' => 'string',
52 - 'default' => 'left',
53 - ),
54 - ),
55 32 )
56 33 );
57 34 }
58 35 add_action( 'init', __NAMESPACE__ . '\register_block' );
@@ -65,9 +42,9 @@
65 42 * @return string
66 43 */
67 44 function render_block( $attributes ) {
68 45 // Tell Jetpack to load the assets registered via jetpack_register_block.
69 - Jetpack_Gutenberg::load_assets_as_required( FEATURE_NAME );
46 + Jetpack_Gutenberg::load_assets_as_required( __DIR__ );
70 47
71 48 return jetpack_rating_meta_render_block( $attributes );
72 49 }
73 50
@@ -76,9 +53,9 @@
76 53 * Newer versions of AMP (1.4.1+) seem OK, but need the screen-reader text hidden
77 54 */
78 55 function amp_add_inline_css() {
79 56 if ( defined( 'AMP__VERSION' ) && version_compare( AMP__VERSION, '1.4.1', '>=' ) ) {
80 - echo '.wp-block-jetpack-rating-star span.screen-reader-text { border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal; }';
57 + echo '.wp-block-jetpack-rating-star span.screen-reader-text { border: 0; clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal; }';
81 58 } else {
82 59 echo '.wp-block-jetpack-rating-star span:not([aria-hidden="true"]) { display: none; }';
83 60 }
84 61 }