Skip to content

Commit 62d0e94

Browse files
authored
Updates
1 parent d7b59c6 commit 62d0e94

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

.github/workflows/ai-pr-review.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ jobs:
3131

3232
- name: Get PR diff safely
3333
id: pr-diff
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3436
run: |
3537
# SECURITY: Get diff without checking out untrusted code
3638
BASE_SHA="${{ github.event.pull_request.base.sha }}"
3739
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
3840
3941
# Use GitHub API to get diff instead of git checkout
40-
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
42+
# SECURITY: Use environment variable for token to avoid exposure in logs
43+
curl -H "Authorization: token $GITHUB_TOKEN" \
4144
-H "Accept: application/vnd.github.v3.diff" \
4245
"https://api.github.com/repos/${{ github.repository }}/compare/$BASE_SHA...$HEAD_SHA" \
4346
> pr_diff.txt

simple-wp-optimizer.php

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@
6666
* @since 1.6.0
6767
*/
6868
function es_optimizer_init_plugin() {
69-
// Clear options cache to ensure fresh data after all plugins are loaded
69+
// Clear options cache to ensure fresh data after all plugins are loaded.
7070
es_optimizer_clear_options_cache();
7171

72-
// Initialize admin functionality
72+
// Initialize admin functionality.
7373
es_optimizer_init_admin();
7474

75-
// Initialize frontend optimizations
75+
// Initialize frontend optimizations.
7676
es_optimizer_init_frontend_optimizations();
7777

78-
// Initialize plugin settings link
78+
// Initialize plugin settings link.
7979
es_optimizer_init_plugin_links();
8080
}
8181
add_action( 'plugins_loaded', 'es_optimizer_init_plugin' );
@@ -86,12 +86,12 @@ function es_optimizer_init_plugin() {
8686
* @since 1.6.0
8787
*/
8888
function es_optimizer_activate_plugin() {
89-
// Ensure default options are set on activation
89+
// Ensure default options are set on activation.
9090
if ( false === get_option( 'es_optimizer_options' ) ) {
9191
add_option( 'es_optimizer_options', es_optimizer_get_default_options() );
9292
}
9393

94-
// Clear any cached data
94+
// Clear any cached data.
9595
es_optimizer_clear_options_cache();
9696
}
9797
register_activation_hook( __FILE__, 'es_optimizer_activate_plugin' );
@@ -102,11 +102,11 @@ function es_optimizer_activate_plugin() {
102102
* @since 1.6.0
103103
*/
104104
function es_optimizer_deactivate_plugin() {
105-
// Clear any cached data on deactivation
105+
// Clear any cached data on deactivation.
106106
es_optimizer_clear_options_cache();
107107

108-
// Note: We don't delete options on deactivation to preserve user settings
109-
// Options are only deleted on plugin uninstall
108+
// Note: We don't delete options on deactivation to preserve user settings.
109+
// Options are only deleted on plugin uninstall.
110110
}
111111
register_deactivation_hook( __FILE__, 'es_optimizer_deactivate_plugin' );
112112

@@ -249,17 +249,6 @@ function es_optimizer_add_settings_page() {
249249
if ( ! is_admin() ) {
250250
return;
251251
}
252-
// Only enqueue scripts/styles if we're on the plugin settings page.
253-
}
254-
255-
/**
256-
* Enqueue admin scripts and styles for plugin settings page
257-
*
258-
* @since 1.5.13
259-
*/
260-
function es_optimizer_enqueue_admin_scripts() {
261-
// Add any future admin CSS/JS here - currently none needed.
262-
// This function is prepared for future admin styling if needed.
263252
}
264253

265254
/**
@@ -786,8 +775,8 @@ function disable_emojis() {
786775
*/
787776
function es_optimizer_add_settings_link( $links ) {
788777
// The admin_url function is used to properly generate a URL within the WordPress admin area.
789-
// Setting text is wrapped in translation function but doesn't need escaping here
790-
// as WordPress core handles this when rendering plugin links.
778+
// Setting text is wrapped in translation function but doesn't need escaping here.
779+
// WordPress core handles escaping when rendering plugin links.
791780
$settings_link = '<a href="' . admin_url( 'options-general.php?page=es-optimizer-settings' ) . '">' . __( 'Settings', 'simple-wp-optimizer' ) . '</a>';
792781
array_unshift( $links, $settings_link );
793782
return $links;

0 commit comments

Comments
 (0)