Skip to content

Commit b51dbc7

Browse files
feat: add license script enqueueing
1 parent e4acb10 commit b51dbc7

File tree

2 files changed

+30
-29
lines changed

2 files changed

+30
-29
lines changed

includes/admin/feedzy-rss-feeds-admin.php

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,31 @@ public function enqueue_styles() {
128128
}
129129
wp_register_style( $this->plugin_name, FEEDZY_ABSURL . 'css/feedzy-rss-feeds.css', array(), $this->version, 'all' );
130130
}
131+
132+
/**
133+
* Helper function to enqueue the license script with localization
134+
*/
135+
private function enqueue_license_script() {
136+
wp_enqueue_script(
137+
$this->plugin_name . '_license',
138+
FEEDZY_ABSURL . 'js/feedzy-license.js',
139+
array( 'jquery' ),
140+
$this->version,
141+
true
142+
);
143+
144+
wp_localize_script(
145+
$this->plugin_name . '_license',
146+
'feedzyLicense',
147+
array(
148+
'l10n' => array(
149+
'licenseKey' => __( 'License Key', 'feedzy-rss-feeds' ),
150+
'checkBtn' => __( 'Check License', 'feedzy-rss-feeds' ),
151+
'errorMsg' => __( 'An error occurred while checking the license. Please try again.', 'feedzy-rss-feeds' ),
152+
),
153+
)
154+
);
155+
}
131156

132157
/**
133158
* Register the stylesheets for the admin area.
@@ -207,19 +232,7 @@ public function enqueue_styles_admin() {
207232
)
208233
);
209234

210-
wp_enqueue_script( $this->plugin_name . '_license', FEEDZY_ABSURL . 'js/feedzy-license.js', array( 'jquery' ), $this->version, true );
211-
212-
wp_localize_script(
213-
$this->plugin_name . '_license',
214-
'feedzyLicense',
215-
array(
216-
'l10n' => array(
217-
'licenseKey' => __( 'License Key', 'feedzy-rss-feeds' ),
218-
'checkBtn' => __( 'Check License', 'feedzy-rss-feeds' ),
219-
'errorMsg' => __( 'An error occurred while checking the license. Please try again.', 'feedzy-rss-feeds' ),
220-
),
221-
)
222-
);
235+
$this->enqueue_license_script();
223236
}
224237

225238
$upsell_screens = array( 'feedzy-rss_page_feedzy-settings', 'feedzy-rss_page_feedzy-admin-menu-pro-upsell' );
@@ -314,19 +327,7 @@ public function enqueue_styles_admin() {
314327
)
315328
);
316329

317-
wp_enqueue_script( $this->plugin_name . '_license', FEEDZY_ABSURL . 'js/feedzy-license.js', array( 'jquery' ), $this->version, true );
318-
319-
wp_localize_script(
320-
$this->plugin_name . '_license',
321-
'feedzyLicense',
322-
array(
323-
'l10n' => array(
324-
'licenseKey' => __( 'License Key', 'feedzy-rss-feeds' ),
325-
'checkBtn' => __( 'Check License', 'feedzy-rss-feeds' ),
326-
'errorMsg' => __( 'An error occurred while checking the license. Please try again.', 'feedzy-rss-feeds' ),
327-
),
328-
)
329-
);
330+
$this->enqueue_license_script();
330331

331332
wp_set_script_translations( $this->plugin_name . '_feedback', 'feedzy-rss-feeds' );
332333
}
@@ -1019,7 +1020,7 @@ public function feedzy_menu_pages() {
10191020
}
10201021

10211022
/**
1022-
* Method to render the support page.
1023+
* Handle the RSS to Social menu item.
10231024
*
10241025
* @access public
10251026
*/

includes/layouts/feedzy-support.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class="<?php echo 'improve' === $active_tab ? 'active' : ''; ?>"><?php esc_html_
3939
</li>
4040
<li>
4141
<a href="<?php echo esc_url( admin_url( 'admin.php?page=feedzy-settings' ) ); ?>"
42-
onclick="window.location.href='<?php echo esc_url( admin_url( 'admin.php?page=feedzy-settings' ) ); ?>'; return false;">
42+
class="<?php echo 'settings' === $active_tab ? 'active' : ''; ?>">
4343
<?php esc_html_e( 'Settings', 'feedzy-rss-feeds' ); ?>
4444
<span class="dashicons dashicons-external"></span>
4545
</a>
4646
</li>
4747
<li>
4848
<a href="<?php echo esc_url( admin_url( 'admin.php?page=feedzy-integration' ) ); ?>"
49-
onclick="window.location.href='<?php echo esc_url( admin_url( 'admin.php?page=feedzy-integration' ) ); ?>'; return false;">
49+
class="<?php echo 'integration' === $active_tab ? 'active' : ''; ?>">
5050
<?php esc_html_e( 'Integration', 'feedzy-rss-feeds' ); ?>
5151
<span class="dashicons dashicons-external"></span>
5252
</a>

0 commit comments

Comments
 (0)