Markers

Table of Contents

lib/class-wc-settings-plugin-promo.php 1
lib/Plugin/Admin/Admin_Links.php 5
lib/Plugin/Admin/Plugin_Updater.php 9
lib/Plugin/License/Admin/edd-settings-functions.php 4
lib/Plugin/License/Admin/License_Key_Setting.php 14
lib/Plugin/License/Admin/License_Notices.php 9
lib/Plugin/License/EDD_Licensing.php 5
lib/Plugin/License/Plugin_License.php 46
lib/Plugin/Premium_Plugin.php 1
lib/Plugin/Simple_Plugin.php 2
lib/Rest/Base_Server.php 2
lib/Scheduled_Task.php 3
lib/Service_Container.php 1
lib/Util.php 4
lib/vendor/admin-notices/src/Dismiss.php 14
lib/vendor/admin-notices/src/Notice.php 22
lib/vendor/admin-notices/src/Notices.php 5
lib/WooCommerce/Admin/Custom_Settings_Fields.php 6
src/Admin/Admin_Controller.php 2
src/Admin/Settings_Page.php 8
src/deprecated.php 1
src/Integration/theme-function-overrides.php 8
src/Integration/Theme_Compat.php 8
src/Plugin.php 6
src/Sitemaps.php 13
src/Store_Login.php 6
src/Store_Protector.php 21
src/Util.php 3
woocommerce-private-store.php 6

class-wc-settings-plugin-promo.php

Type Line Description
42 Check we're on the correct settings section

Admin_Links.php

Type Line Description
30 Add settings link from Plugins page.
33 Add documentation link to meta info on Plugins page.
42 Don't add link if it's a WooCommerce plugin but WooCommerce is not active.
47 Don't add link if it's an EDD plugin but EDD is not active.
61 Bail if there's no documentation URL.

Plugin_Updater.php

Type Line Description
70 First check if plugin info already exists in the WP transient.
114 Add note about license key if no automatic update available (i.e. no update package).
138 Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
141 Add an ID for the update details.
144 Check the license before returning.
157 Prevent automatic plugin update if license is invalid. Clearing the package URL will do this.
165 First check the cache.
169 Nothing in cache, so get latest version from API.
193 We cache the version info for 4 hours, to reduce the number of API requests.

edd-settings-functions.php

Type Line Description
5 Prevent direct access.
23 Change setting back to a 'text' input. We set the type to 'barn2_license' initially so we can provide our own callback.
26 Settings_API_Helper uses input_class instead of class.
30 Ensure a default is set.

License_Key_Setting.php

Type Line Description
41 Include EDD settings callbacks.
44 Handle the license settings message for EDD.
47 Add hidden field to WooCommerce settings.
99 EDD uses title case for setting names, so let's keep things consistent.
102 Set type to 'barn2_license' so the callback to render setting will be 'edd_barn2_license_callback'.
105 EDD uses 'name' instead of 'title'.
150 Deactivate old license key first if it was valid.
155 If new license key is different to current key, or current key isn't active, attempt to activate.
186 Clear any other messages (e.g. 'Settings Updated') so we only show our license message.
189 Need to use 'edd-notices' setting to get message to show in EDD settings pages.
198 Check if we're overriding the license activation.
240 @todo: Spinner icon
250 If we have a license key and it's not active, mark it red for user to take action.
252 ...except if the user has just deactivated, in which case just show a plain confirmation message.

License_Notices.php

Type Line Description
41 Don't add notices if we're doing a post (e.g. saving the settings).
49 Add first activation notice.
52 Add expired license notice.
55 Add disabled license notice
58 Add 'site moved to new URL' notice.
64 Don't add the notice if it's a WooCommerce plugin and WooCommerce is not installed, as license page won't be available.
69 Ditto for EDD plugins.
156 Clear notice dismissal transients when license is activated.
180 Check data is valid.

EDD_Licensing.php

Type Line Description
18 barn2.com/edd-sl';
142 We're forced to use the (potentially usafe) maybe_unserialize here as the
143 EDD Software Licensing API serializes some of the returned plugin data.
152 Call the Software Licensing API.
160 Build the result.

Plugin_License.php

Type Line Description
45 early, before any is_valid() checks.
57 A 'valid' license is one which is active or expired.
58 For expired licenses the plugin will still work (i.e. is valid) but plugin updates will be disabled.
130 Check a license was supplied.
147 Successful response - now check whether license is valid.
150 $response->license will be 'valid' or 'invalid'.
157 Invalid license.
162 Store the returned license info.
165 API error - set license to invalid as we can't activate.
182 Bail early if already inactive.
187 If license is overridden bypass API and set status manually.
193 We can't deactivate a license if it's not currently active.
204 Successful response - now check whether license is valid.
208 $response->license will be 'deactivated' or 'failed'.
210 License deactivated, so update status.
213 Store returned license info.
217 Deactivation failed - reasons: already deactivated via Account page, license has expired, bad data, etc.
218 In this case we refresh license data to ensure we have correct state stored in database.
224 API error
240 No point refreshing if license doesn't exist.
245 If license is overridden, we shouldn't refresh as it will lose override state.
254 We use the home url when checking the license, as the license result should reflect the current site, not any previous site.
258 Successful response returned.
262 Valid (and active) license.
265 Invalid license - $response->license will contain the reason for the invalid license - e.g. expired, inactive, site_inactive, etc.
270 Store returned license info.
275 API error - store the error but don't change license status (e.g. temporary communication error).
357 See if we have a valid expiry date by checking first 4 chars are numbers (the expiry year).
358 This is only a rough check - createFromFormat() will validate fully and return a DateTime object if valid.
400 Exclude overridden licenses - we don't want to automatically deactivate these or show admin notice to user.
438 Migrate from legacy license data.
454 Remove legacy license data.
466 We don't use home_url() here as this runs the 'home_url' filter which other plugins hook into (e.g. multi-lingual plugins).
485 To lowercase.
488 Strip www.
489 www.', ':/www.' ), '://', $url );
491 Strip scheme.
492 ', 'https://', 'http:/', 'https:/' ), '', $url );
494 Remove trailing slash.
537 Clear any previous error before updating.
541 Merge current data with new $data before setting.
553 License is invalid if there's no license key.
579 License info should always return the expiry date, so it's considered valid if this is present.
581 Cast response to array.
584 Remove the stuff we don't need.
597 Status is sanitized during update_license_data().

Premium_Plugin.php

Type Line Description
70 Default to plugin settings URL if there's no license setting path.

Simple_Plugin.php

Type Line Description
41 Check for 'item_id' in case 'id' not set.
46 WooCommerce plugins cannot be EDD plugins (and vice-versa).

Base_Server.php

Type Line Description
42 implemented in sub-class.
46 implemented in sub-class.

Scheduled_Task.php

Type Line Description
25 Attach the action to run when the cron event is fired.
28 Schedule the cron event if not already scheduled.
33 Unschedule event on plugin deactivation.

Service_Container.php

Type Line Description
29 Overidden by classes using this trait.

Util.php

Type Line Description
24 barn2.com';
25 barn2.com';
26 barn2.com';
31 barn2.com.

Dismiss.php

Type Line Description
1 phpcs:ignore WordPress.Files.FileName
8 www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
9 github.com/WPTRT/admin-notices
58 Set the object properties.
63 Handle AJAX requests to dismiss the notice.
76 Create a nonce.
83 Add an event listener to the dismiss button.
88 Build the data to send in our request.
89 Data has to be formatted as a string here.
112 Check if the notice has been dismissed when using user-meta.
130 Sanity check: Early exit if we're not on a wptrt_dismiss_notice action.
135 Sanity check: Early exit if the ID of the notice is not the one from this object.
140 Security check: Make sure nonce is OK.
143 If we got this far, we need to dismiss the notice.

Notice.php

Type Line Description
1 phpcs:ignore WordPress.Files.FileName
10 www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
11 github.com/WPTRT/admin-notices
128 Set the object properties.
134 Sanity check: Early exit if ID or message are empty.
148 Instantiate the Dismiss object.
161 Early exit if we don't want to show this notice.
169 Print the notice.
172 The ID.
173 The classes.
174 The HTML.
187 Don't show if the user doesn't have the required capability.
192 Don't show if we're not on the right screen.
197 Don't show if notice has been dismissed.
218 Make sure the defined type is allowed.
221 Add the class for notice-type.
224 Do we want alt styles?
229 Combine classes to a string.
242 Sanity check: Early exit if no title is defined.
273 If screen is empty we want this shown on all screens.
278 Make sure the get_current_screen function exists.
283 Check if we're on one of the defined screens.

Notices.php

Type Line Description
1 phpcs:ignore WordPress.Files.FileName
10 www.gnu.org/licenses/gpl-2.0.html GPL-2.0-or-later
11 github.com/WPTRT/admin-notices
43 Add the notice.
46 Print the script to the footer.

Custom_Settings_Fields.php

Type Line Description
46 atts are escaped
55 Redo the description as WC runs wp_kes_post() on it which messes up any inline CSS
64 atts are escaped
114 Get current values
122 atts are escaped
188 atts are escaped

Admin_Controller.php

Type Line Description
41 Add settings page.
44 Load admin scripts.

Settings_Page.php

Type Line Description
11 Bail if WooCommerce class not found.
36 Call parent constructor last as it registers actions using $this->id
41 Register custom field types.
45 Sanitize options on save.
48 Add plugin promo.
94 ',
179 settings array
199 Remove blank passwords

deprecated.php

Type Line Description
3 Prevent direct file access

theme-function-overrides.php

Type Line Description
3 Prevent direct file access
19 Avada
23 do nothing
28 Kallyas
32 do nothing
37 Divi
41 do nothing
46 Storefront

Theme_Compat.php

Type Line Description
39 Avada
42 Bridge
47 Storefront
51 Loom
54 Total
57 X
65 Enfold
89 Uncode theme.

Plugin.php

Type Line Description
60 Don't load anything if WooCommerce not active.
72 Create the admin service.
77 Create core services if license is valid.
87 Integrations
102 Cookie has to be same one used by WP for password protected posts, as all caching plugins exclude it.
115 woocommerce.com/', true ),

Sitemaps.php

Type Line Description
23 All in One SEO Pack
28 WordPress SEO
32 Maybe clear sitemap cache (cache_1 = root sitemap)
35 Always clear sitemap cache if product stuff is accessed
40 Add store pages to excluded-posts option in WP SEO
43 Prevent products and product taxonomies being added to sitemap
48 @todo: Other sitemap plugins
56 Remove product post type
62 Remove product taxonomies
67 Remove store pages
100 Clear WPSEO cache once when WCPS is first run. If WPSEO is later deactivated, reset option.
112 Remove WooCommerce types from current sitemap cache
115 Get root sitemap

Store_Login.php

Type Line Description
23 Register login shortcode
26 Handle login when form is submitted
42 Set password cooke to 'unlock' the store
45 Redirect to the unlocked store
141 Check the passed form ID matches the one in $_POST
152 If we have a password, and we're doing a POST request (therefore we haven't redirected), then the password must be wrong.

Store_Protector.php

Type Line Description
32 Prevent caching and search indexing if showing protected store page - done on 'wp' hook as certain caching plugins require this.
35 Protect store pages (shop, products, taxonomies, etc) - late priority so we run after WC_Template_Loader::unsupported_theme_init().
38 Hide WooCommerce widgets
41 Hide WC pages in Pages widget
44 Remove hidden categories and/or products in nav menus
47 Exclude store pages from search
50 Exclude products from search
53 Remove and replace WooCommerce shortcodes
94 Remove menu item if it's a product, product taxonomy or WooCommerce page
103 Now find and remove any children of any removed menu item
114 Update the removed list with the removed child items and start over
184 Set headers to prevent caching
187 Set constants to prevent caching in cache plugins
211 Spoof main WP query with dummy page which holds our login shortcode
212 to avoid clash with a valid post
223 append random number to avoid clash
225 important
226 Convert to WP_Post object
229 Add our fake post to the cache
233 Update main query
269 Update globals

Util.php

Type Line Description
39 If there's role overlap, the current user has at least one of the required roles, so store is unlocked.
42 No roles selected, so unlock for all roles.
67 @todo: Deprecate in future

woocommerce-private-store.php

Type Line Description
13 barn2.com/wordpress-plugins/woocommerce-private-store/
17 barn2.com
26 www.gnu.org/licenses/gpl-3.0.html
31 Prevent direct access.
39 Include autoloader.
60 Load the plugin.

Search results