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/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.php 5
src/Admin/Category_Edit.php 7
src/Admin/Product_Edit.php 5
src/Admin/Settings_Page.php 5
src/Handlers/Add_To_Cart.php 8
src/Handlers/Quantity_Input.php 36
src/Plugin.php 2
src/Rules/Abstract_Min_Max_Rule.php 3
src/Rules/Abstract_Rule.php 7
src/Rules/Quantity_Step.php 3
src/Rules/Quantity_Step_Shared.php 3
src/Util/Cart.php 10
src/Util/Field.php 4
src/Util/Util.php 2
woocommerce-quantity-manager.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).

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.php

Type Line Description
43 Load admin scripts.
68 Min Max Field
75 Settings
81 Category
88 Product

Category_Edit.php

Type Line Description
22 Quantity Rules
29 Value Rules
36 Default Quantity
43 Quantity Step
171 Use legacy WDQ key
256 Bail if no quantity rules to save (e.g. on 'quick edit')
274 Bail if no quantity rules to save (e.g. on 'quick edit')

Product_Edit.php

Type Line Description
336 Quantity Rules
340 Value Rules
344 Default Quantity
349 Quantity Step
354 Save Product

Settings_Page.php

Type Line Description
53 Add plugin promo.
59 Min / Max custom field
64 Register settings and section
68 Sanitize and save license data
81 Redo the description as WC runs wp_kes_post() on it which messes up any inline CSS

Add_To_Cart.php

Type Line Description
61 clone cart to test our validations
64 add the item(s) and get the cart item key
67 calculates new totals for validations
70 clear any notices that might have been generated by add_to_cart (e.g stock limit, not purchasable...)
75 get the validatiosn
78 destroy the test cart shipping cache
86 destroy the test cart
90 gets the cart validations specific to the product being added

Quantity_Input.php

Type Line Description
146 Quantity Step
156 Max Quantity
160 If the max value is not a multiple of step get the closest valid multiple
176 Min Quantity
184 If the min value is not a multiple of step get the closest valid multiple
218 Max Quantity
229 Min Quantity
252 Default Quantity
264 Quantity Step
269 Set step
275 Max Quantity
279 If the max value is not a multiple of step get the closest valid multiple
292 Set Max
296 Min Quantity
300 If the min value is not a multiple of step get the closest valid multiple
305 Set Min
309 Change min to 0 if we have default quantity of 0
314 Don't allow min to be higher than max
319 If we don't have a min and we have a step set min to step
325 Set input value to step if is not a multiple of step. (ignore default quantity 0)
330 If we still don't have an input value set it to the step if we have one
335 If we still don't have an input value set it to the min if we have one
340 If we still don't have an input value set it to 1
345 Don't allow max to be less than input value
350 Don't allow min to be more than input value
368 Default Quantity
382 Max Quantity
390 Set Max
394 Min Quantity
398 Set Min
402 Change min to 0 if we have default quantity of 0
407 Don't allow min to be higher than max
413 If we still don't have an input value set it to the min if we have one
418 If we still don't have an input value set it to 1
423 Don't allow max to be less than input value
428 Don't allow min to be more than input value

Plugin.php

Type Line Description
57 Don't load anything if WooCommerce not active.
100 woocommerce.com/', true ),

Abstract_Min_Max_Rule.php

Type Line Description
54 'no_cart'
58 'no_rule'
64 'invalid_rule_level'

Abstract_Rule.php

Type Line Description
53 1. Variation
60 1. Variable (Variation Parent Product)
69 3. Product
78 4. Category
87 5. Global
225 Grab our values
229 Check parents

Quantity_Step.php

Type Line Description
37 'no_cart'
41 'no_rule'
47 'invalid_rule_level'

Quantity_Step_Shared.php

Type Line Description
37 'no_cart'
41 'no_rule'
47 'invalid_rule_level'

Cart.php

Type Line Description
76 check for intersections
78 skip if passed
83 don't include quantity step if calculation is shared
92 only look at max values for quantity and value rules
97 direct validation
102 any categories which match the added product
149 If this is a variation get data to create cart_id
156 Load cart item data - may be added by other plugins.
159 Generate a ID based on product ID, variation ID, variation data, and other cart item data.
162 Find the cart item key in the existing cart.

Field.php

Type Line Description
34 legacy (WDQ)
35 legacy (WDQ)
36 legacy (WDQ)
57 atts are escaped

Util.php

Type Line Description
35 indicator for logged out users
38 MS compat: super administrator privilege

woocommerce-quantity-manager.php

Type Line Description
14 barn2.com/wordpress-plugins/woocommerce-quantity-manager/
18 barn2.com
27 www.gnu.org/licenses/gpl-3.0.html
32 Prevent direct file access.
38 Include autoloader.
50 Load the plugin.

Search results