Skip to content

Commit 8d7a011

Browse files
authored
add: review stars to plugins page (#420)
1 parent 6578aa3 commit 8d7a011

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

modules/core/module.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,45 @@ public function enqueue_scripts() : void {
6161
);
6262
}
6363

64+
/**
65+
* Add review link to plugin row meta
66+
*
67+
* @param array $links
68+
* @param string $file
69+
* @return array
70+
*
71+
*/
72+
public function add_plugin_row_meta( $links, $file ) {
73+
74+
if ( ! defined( 'EA11Y_BASE' ) || EA11Y_BASE !== $file ) {
75+
return $links;
76+
}
77+
78+
$links[] = '<a class="wp-ea11y-review"
79+
href="https://wordpress.org/support/plugin/pojo-accessibility/reviews/#new-post"
80+
target="_blank" rel="noopener noreferrer"
81+
title="' . esc_attr__( 'Review our plugin', 'pojo-accessibility' )
82+
. '">
83+
<span>★</span><span>★</span><span>★</span><span>★</span><span>★</span>
84+
</a>';
85+
86+
echo '<style>
87+
.wp-ea11y-review{ display: inline-flex;flex-direction: row-reverse;}
88+
.wp-ea11y-review span{ color:#888}
89+
.wp-ea11y-review span:hover{color:#ffa400}
90+
.wp-ea11y-review span:hover~span{color:#ffa400}
91+
</style>';
92+
93+
return $links;
94+
}
95+
6496
/**
6597
* Module constructor.
6698
*/
6799
public function __construct() {
68100
$this->register_components();
69101
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
70102
add_filter( 'plugin_action_links', [ $this, 'add_plugin_links' ], 10, 2 );
103+
add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
71104
}
72105
}

0 commit comments

Comments
 (0)