Skip to content

Commit e67493a

Browse files
committed
Only included files will be converted with this version
1 parent 204a2ea commit e67493a

11 files changed

+280
-201
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
**Contributors:** sajjad67 \
55
**Requires at least:** 5.6 \
66
**Tested up to:** 6.7 \
7-
**Stable tag:** 2.0.0 \
7+
**Stable tag:** 2.0.1 \
88
**Requires PHP:** 8.0 \
99
**License:** GPLv2 \
1010
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
@@ -58,6 +58,9 @@ Just after installing the plugin, go to settings page and enable the compiler ac
5858

5959
## Changelog
6060

61+
### 2.0.1
62+
- Only included files will be converted with this version.
63+
6164
### 2.0.0
6265
- Minor changes in codebase only.
6366

admin/class-plugin-admin.php

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
/**
44
* The admin-specific functionality of the plugin.
55
*
6-
* Defines the plugin name, version, other methods and
7-
* enqueue the admin-specific stylesheet and JavaScript.
6+
* Defines the plugin name, version and other methods.
87
*
98
* @package Sass_To_Css_Compiler
109
* @subpackage Sass_To_Css_Compiler/admin
@@ -51,7 +50,8 @@ class Sass_To_Css_Compiler_Admin
5150
/**
5251
* Initialize the class and set its properties.
5352
*
54-
* @since 2.0.0
53+
* @since 2.0.0
54+
* @access public
5555
* @param string $plugin_name The name of this plugin.
5656
* @param string $version The version of this plugin.
5757
*/
@@ -69,7 +69,8 @@ public function __construct( $plugin_name, $version )
6969
/**
7070
* Register the stylesheets for the admin area.
7171
*
72-
* @since 2.0.0
72+
* @since 2.0.0
73+
* @access public
7374
*/
7475
public function enqueue_styles()
7576
{
@@ -85,7 +86,8 @@ public function enqueue_styles()
8586
/**
8687
* Register the JavaScript for the admin area.
8788
*
88-
* @since 2.0.0
89+
* @since 2.0.0
90+
* @access public
8991
*/
9092
public function enqueue_scripts()
9193
{
@@ -105,8 +107,8 @@ public function enqueue_scripts()
105107
/**
106108
* Adds a settings link to the plugin's action links on the plugin list table.
107109
*
108-
* @since 2.0.0
109-
*
110+
* @since 2.0.0
111+
* @access public
110112
* @param array $links The existing array of plugin action links.
111113
* @return array The updated array of plugin action links, including the settings link.
112114
*/
@@ -120,7 +122,8 @@ public function add_plugin_action_links( $links )
120122
/**
121123
* Adds the plugin settings page to the WordPress dashboard menu.
122124
*
123-
* @since 2.0.0
125+
* @since 2.0.0
126+
* @access public
124127
*/
125128
public function admin_menu()
126129
{
@@ -137,7 +140,8 @@ public function admin_menu()
137140
/**
138141
* Renders the plugin settings page form.
139142
*
140-
* @since 2.0.0
143+
* @since 2.0.0
144+
* @access public
141145
*/
142146
public function menu_page()
143147
{
@@ -147,7 +151,8 @@ public function menu_page()
147151
/**
148152
* Register Plugin Options Via Settings API
149153
*
150-
* @since 2.0.0
154+
* @since 2.0.0
155+
* @access public
151156
*/
152157
public function admin_init()
153158
{
@@ -163,9 +168,9 @@ public function admin_init()
163168
/**
164169
* Returns the settings sections for the plugin settings page.
165170
*
166-
* @since 2.0.0
167-
*
168-
* @return array An array of settings sections, where each section is an array
171+
* @since 2.0.0
172+
* @access public
173+
* @return array An array of settings sections, where each section is an array
169174
* with 'id' and 'title' keys.
170175
*/
171176
public function get_settings_sections()
@@ -183,9 +188,9 @@ public function get_settings_sections()
183188
/**
184189
* Returns all the settings fields for the plugin settings page.
185190
*
186-
* @since 2.0.0
187-
*
188-
* @return array An array of settings fields, organized by section ID. Each
191+
* @since 2.0.0
192+
* @access public
193+
* @return array An array of settings fields, organized by section ID. Each
189194
* section ID is a key in the array, and the value is an array
190195
* of settings fields for that section. Each settings field is
191196
* an array with 'name', 'label', 'type', 'desc', and other keys
@@ -217,24 +222,9 @@ public function get_settings_fields()
217222
'type' => 'checkbox',
218223
'desc' => __( 'Checking this box will enable compiling .scss files from themes & plugins folders', 'sass-to-css-compiler' )
219224
),
220-
array(
221-
'name' => 'skip_external',
222-
'label' => __( 'Ignore External Files', 'sass-to-css-compiler' ),
223-
'type' => 'checkbox',
224-
'always_checked' => 'on',
225-
'disabled'=> 'disabled',
226-
'desc' => __( 'Always Ignore .scss files from CDNs, other domains (external files) and relative paths (built in files)', 'sass-to-css-compiler' )
227-
),
228-
array(
229-
'name' => 'exclude',
230-
'label' => __( 'Exclude Files From Compiling', 'sass-to-css-compiler' ),
231-
'type' => 'text',
232-
'desc' => __( 'Add comma separated scss files name to exclude it from Compiling', 'sass-to-css-compiler' ),
233-
'placeholder' => __( 'admin.scss, plugins.scss, backend.scss', 'sass-to-css-compiler' )
234-
),
235225
array(
236226
'name' => 'include',
237-
'label' => __( 'Include Files From Compiling', 'sass-to-css-compiler' ),
227+
'label' => __( 'Files To Compile', 'sass-to-css-compiler' ),
238228
'type' => 'text',
239229
'desc' => __( 'Add comma separated scss files name to include it while Compiling... Note if added any! only those files will be compiled', 'sass-to-css-compiler' ),
240230
'placeholder' => __( 'menu.scss, footer.scss', 'sass-to-css-compiler' )
@@ -262,7 +252,8 @@ public function get_settings_fields()
262252
/**
263253
* Show plugin notices in the admin area.
264254
*
265-
* @since 2.0.0
255+
* @since 2.0.0
256+
* @access public
266257
*/
267258
public function admin_notices()
268259
{
@@ -298,23 +289,25 @@ public function admin_notices()
298289
/**
299290
* Add a admin node menu item for clearing the cache
300291
*
301-
* @since 2.0.0
292+
* @since 2.0.0
293+
* @access public
302294
* @param array $wp_admin_bar class WP_Admin_Bar object.
303295
*/
304296
public function admin_bar_menu( $wp_admin_bar )
305297
{
298+
// check if current page is plugin settings page
306299
// check if the user is logged in as well as admin bar is not disabled
307-
if ( current_user_can( 'manage_options' ) && is_admin_bar_showing() )
300+
if ( function_exists( 'get_current_screen' ) && current_user_can( 'manage_options' ) && is_admin_bar_showing() && get_current_screen()->id == 'toplevel_page_sass-to-css-compiler' )
308301
{
309-
$link = admin_url( 'admin.php?page=sass-to-css-compiler' );
302+
$link = admin_url( 'admin.php?page=sass-to-css-compiler' );
310303

311304
// Generate a nonce
312-
$nonce = wp_create_nonce( 'sass_to_css_compiler_action' );
305+
$nonce = wp_create_nonce( 'sass_to_css_compiler_action' );
313306

314307
// Add the nonce to the URL
315-
$link = add_query_arg( array( '_wpnonce' => $nonce, 'action' => 'purge_sass_to_css_compiled_files' ), $link );
308+
$link = add_query_arg( array( '_wpnonce' => $nonce, 'action' => 'purge_sass_to_css_compiled_files' ), $link );
316309

317-
$args = array(
310+
$args = array(
318311
'id' => 'sass-to-css-compiler-purge-cache',
319312
'title' => sprintf( '<a href="%s">%s</a>', esc_url( $link ), __( 'Purge Compiled SASS Cache', 'sass-to-css-compiler' ) )
320313
);

includes/class-plugin-activator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class Sass_To_Css_Compiler_Activator
1515
/**
1616
* Create cache folder for the plugin if not exists
1717
*
18-
* @since 2.0.0
18+
* @since 2.0.0
19+
* @access public
1920
*/
2021
public static function activate()
2122
{

includes/class-plugin-deactivator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class Sass_To_Css_Compiler_Deactivator
1515
/**
1616
* Does nothing right now
1717
*
18-
* @since 2.0.0
18+
* @since 2.0.0
19+
* @access public
1920
*/
2021
public static function deactivate()
2122
{

includes/class-plugin-i18n.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class Sass_To_Css_Compiler_i18n
1616
/**
1717
* Load the plugin text domain for translation.
1818
*
19-
* @since 2.0.0
19+
* @since 2.0.0
20+
* @access public
2021
*/
2122
public function load_plugin_textdomain()
2223
{

includes/class-plugin-loader.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class Sass_To_Css_Compiler_Loader
3434
/**
3535
* Initialize the collections used to maintain the actions and filters.
3636
*
37-
* @since 2.0.0
37+
* @since 2.0.0
38+
* @access public
3839
*/
3940
public function __construct()
4041
{
@@ -45,7 +46,8 @@ public function __construct()
4546
/**
4647
* Add a new action to the collection to be registered with WordPress.
4748
*
48-
* @since 2.0.0
49+
* @since 2.0.0
50+
* @access public
4951
* @param string $hook The name of the WordPress action that is being registered.
5052
* @param object $component A reference to the instance of the object on which the action is defined.
5153
* @param string $callback The name of the function definition on the $component.
@@ -60,7 +62,8 @@ public function add_action( $hook, $component, $callback, $priority = 10, $accep
6062
/**
6163
* Add a new filter to the collection to be registered with WordPress.
6264
*
63-
* @since 2.0.0
65+
* @since 2.0.0
66+
* @access public
6467
* @param string $hook The name of the WordPress filter that is being registered.
6568
* @param object $component A reference to the instance of the object on which the filter is defined.
6669
* @param string $callback The name of the function definition on the $component.
@@ -102,7 +105,8 @@ private function add( $hooks, $hook, $component, $callback, $priority, $accepted
102105
/**
103106
* Register the filters and actions with WordPress.
104107
*
105-
* @since 2.0.0
108+
* @since 2.0.0
109+
* @access public
106110
*/
107111
public function run()
108112
{

0 commit comments

Comments
 (0)