Markers
Table of Contents
Settings_Page.php
| Type | Line | Description |
|---|---|---|
| 33 | Register our custom settings types. | |
| 37 | Add sections & settings. | |
| 41 | Support old settings structure. | |
| 44 | Sanitize settings | |
| 51 | Add plugin promo section. | |
| 64 | Check we're on the correct settings section | |
| 69 | Settings wrapper. | |
| 78 | License key setting. | |
| 98 | Table design settings. | |
| 789 | Check for empty settings. | |
| 824 | Check integer settings. |
Ajax_Handler.php
| Type | Line | Description |
|---|---|---|
| 48 | Build the args to update | |
| 58 | Set sort column and direction | |
| 73 | Set search term | |
| 77 | Don't search unless they've typed at least 3 characters. | |
| 83 | Set search filters | |
| 102 | Merge layered nav params (if passed) into $_GET so WooCommerce picks them up. | |
| 107 | Retrieve the new table and convert to array | |
| 110 | Build output | |
| 119 | We don't need the cell attributes, so flatten data and append row attributes under the key '__attributes'. | |
| 149 | Return fragments | |
| 152 | If there was an error adding to the cart | |
| 173 | Return fragments | |
| 182 | Clear any errors which were added for products which couldn't be added. | |
| 190 | If there was an error adding to the cart | |
| 224 | Get mini cart | |
| 232 | Fragments and mini cart are returned |
Cart_Handler.php
| Type | Line | Description |
|---|---|---|
| 30 | Make sure we don't process the form twice when adding via AJAX. | |
| 76 | If using Product Addons, we need to remove and add some filters to process the multi cart data correctly. | |
| 120 | Bail if product not doesn't exist or isn't published. | |
| 126 | @deprecated 2.7.1 Replaced by 'wc_product_table_[product_type]_add_to_cart' | |
| 129 | Allow products to be handled by themes/plugins. | |
| 135 | Grouped and external products not allowed. | |
| 140 | Check product passes validation checks. | |
| 167 | Back compat addons v2. | |
| 189 | If type is heading, skip. | |
| 236 | Throw exception for add_to_cart to pickup. |
Theme_Compat.php
| Type | Line | Description |
|---|---|---|
| 44 | Some themes take it upon themselves to remove core WC scripts which we rely on, so let's re-register them just in case. | |
| 79 | Remove Avada styling for select elements in product tables | |
| 95 | Prevent any other handlers changing the quantity |
woocommerce-compat.php
| Type | Line | Description |
|---|---|---|
| 10 | Prevent direct file access | |
| 28 | Escape quotes in attribute nodes only. | |
| 29 | json_encode() outputs UTF-8 (really just ASCII), not the blog's charset. | |
| 30 | Double escape entities: `&` -> `&`. |
Config_Builder.php
| Type | Line | Description |
|---|---|---|
| 63 | Remove any default page lengths that are too close to 'rows_per_page' | |
| 66 | Add 'rows_per_page' to length menu and sort | |
| 71 | Add show all to menu | |
| 78 | Set responsive control column | |
| 90 | If date column used and date format contains no spaces, make sure we 'nowrap' this column | |
| 97 | Back-compat: For 3rd party code relying on old add-to-cart class. | |
| 109 | Set numeric data type for SKU column if required. DataTables will use alphanumeric sorting by default which overrides our WP_Query sorting. | |
| 115 | Set responsive display function | |
| 123 | Set custom messages | |
| 131 | Set initial search term | |
| 134 | DOM option - @see https://datatables.net/reference/option/dom | |
| 160 | 't' = the <table> element | |
| 198 | Set the selected option if a filter widget is currently active. | |
| 200 | Get the first selected term as we only allow a single selection in the filters | |
| 213 | 1. Use custom filter heading if set. | |
| 216 | 2. Use custom column heading if set, and we're showing the filter and column together. | |
| 226 | 3. Use the taxonomy label (singular). | |
| 233 | 4. Fallback if taxonomy not found - use the filter column name. | |
| 238 | @deprecated 2.7.1 Replaced by wc_product_table_search_filter_heading_[filter] | |
| 262 | Attribute filter | |
| 293 | Product category filter | |
| 295 | If we're excluding a category from table, remove this and all descendant terms from the category search filter | |
| 299 | If we're including a specific category (or categories), find all descendents and include them in term query | |
| 302 | Remove any excludes as exclude_tree is ingnored when we set include | |
| 309 | Filter is for a custom taxonomy - we may need to restrict terms if 'term' option set | |
| 315 | Split term around the colon and check valid | |
| 341 | @deprecated 2.7.1 Replaced by wc_product_table_search_filter_terms_[filter] | |
| 343 | @deprecated 2.7.1 Replaced by wc_product_table_search_filter_terms_[filter] | |
| 346 | Filter the terms. | |
| 349 | Re-key array and convert WP_Term objects to arrays. | |
| 352 | Build term hierarchy so we can create the nested filter items. | |
| 357 | Just return term name, slug and child terms for the filter. | |
| 378 | If we're at the top level branch (parent = 0) and there are terms remaining, we need to | |
| 379 | loop through each and build the tree for that term. | |
| 387 | Only build tree if term won't be 'picked up' by its parent term. |
Abstract_Product_Data.php
| Type | Line | Description |
|---|---|---|
| 32 | subclasses override if they need to add filter data. | |
| 36 | subclasses override if they need to add sort data. | |
| 126 | Strip the product table shortcode from content - processing a shortcode within a shortcode could cause an infinite loop. |
Data_Factory.php
| Type | Line | Description |
|---|---|---|
| 77 | Attribute column. | |
| 80 | Custom taxonomy column. | |
| 83 | Custom field column. | |
| 86 | Hidden filter column. |
Product_Attribute.php
| Type | Line | Description |
|---|---|---|
| 29 | Should the attributes be formatted as links? | |
| 32 | Only show links for text attributes if not using lazy load. | |
| 40 | If attribute not set for a variation product, check the parent variable product. | |
| 46 | Bail if attribute not found. | |
| 54 | Most product types. | |
| 62 | E.g. for variation products the attribute value itself is stored (not as an object). | |
| 72 | Back-compat WC < 3.0. | |
| 85 | Filter the result. |
Product_Cart.php
| Type | Line | Description |
|---|---|---|
| 42 | If variations are disabled then variable products cannot be purchased. | |
| 47 | Composite products cannot be purchased from table. | |
| 61 | Out of stock products, grouped products, external products, etc. | |
| 82 | Normalize whitespace then strip all new line characters. | |
| 99 | Check the product ID matches. | |
| 119 | Check the product ID matches. | |
| 167 | Variation data | |
| 185 | Product Addons data | |
| 199 | Data key for radio buttons needs to end with [] to match the one in the cart form. | |
| 208 | Filter data to allow more to be added | |
| 211 | Loop through each piece of cart data and render a hidden field | |
| 223 | Render the hidden field - we need to use 'p' in front of product ID to allow serializeObject in JS to work. |
Product_Custom_Field.php
| Type | Line | Description |
|---|---|---|
| 30 | We use the parent product (if any) for retrieving the ACF field. | |
| 38 | Advanced Custom Fields field. | |
| 42 | Normal custom field. | |
| 46 | Flatten field. | |
| 49 | Format as date if this is a date custom field and we have a date format. | |
| 53 | Convert to timestamp - we don't pass date_format here as that specifies the desired output format, not the input format. | |
| 55 | Format date using desired format. | |
| 60 | Format as link if custom field is a URL - link text defaults to URL, minus the 'http://' | |
| 62 | ', 'https://' ], '', $cf_value ); | |
| 69 | Filter the result. | |
| 81 | Format the hidden date column for sorting | |
| 86 | Need to return non-empty string to ensure all cells have a data-sort value. | |
| 113 | Use 'date_format' option if specified, otherwise use the 'return format' for the date field | |
| 207 | @todo: Other layout field types? |
Product_Custom_Taxonomy.php
| Type | Line | Description |
|---|---|---|
| 33 | If taxonomy is a date and there's only 1 term, format value in required date format. | |
| 40 | Filter the result. | |
| 56 | Format the hidden date column for sorting | |
| 61 | Need to return non-empty string to ensure all cells have a data-sort value. |
Product_Description.php
| Type | Line | Description |
|---|---|---|
| 16 | number of words | |
| 29 | For variations, if no variation description is set fall back to the parent variable product description | |
| 34 | Format the description and (optionally) process shortcodes | |
| 37 | Check length | |
| 39 | wp_trim_words() will also strip tags |
Product_Hidden_Filter.php
| Type | Line | Description |
|---|---|---|
| 29 | We don't need any data if using lazy load, as filtering is handled by the server. | |
| 37 | Attribute filter. | |
| 38 | Bail if not a taxonomy (i.e. global) attribute. | |
| 46 | If attribute not set for a variation product, check the parent variable product. | |
| 52 | Bail if attribute not found. | |
| 58 | Most product types. | |
| 61 | E.g. for variation products the attribute slug itself is stored. | |
| 64 | Back-compat WC < 3.0. | |
| 68 | Taxonomy filter. | |
| 75 | If tax is hierarchical, we need to add any ancestor terms for each term this product has | |
| 79 | Get the ancestors term IDs for all terms for this product | |
| 84 | Remove duplicates | |
| 88 | If not already in term list, convert ancestor to WP_Term object and add to results | |
| 100 | Return as a space-separated list of term slugs. |
Product_Image.php
| Type | Line | Description |
|---|---|---|
| 45 | back-compat: product-table-image class. Remove in future release | |
| 48 | Caption fallback | |
| 51 | Alt fallbacks | |
| 56 | Get the image | |
| 61 | Maybe wrap with lightbox or product link |
deprecated.php
| Type | Line | Description |
|---|---|---|
| 23 | Prevent direct file access | |
| 28 | phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound, PSR1.Classes.ClassDeclaration.MultipleClasses, PSR1.Classes.ClassDeclaration.MissingNamespace, Generic.Commenting.DocComment.MissingShort, Squiz.Commenting.FunctionComment.Missing | |
| 75 | Not deprecated for the time being while other plugins update. | |
| 80 | Not deprecated for the time being while other plugins update. |
Frontend_Scripts.php
| Type | Line | Description |
|---|---|---|
| 46 | Register front-end styles and scripts | |
| 47 | after WooCommerce load_scripts() | |
| 48 | after WooCommerce load_scripts() | |
| 65 | Add RTL data - we need suffix to correctly format RTL stylesheet when minified. | |
| 69 | Add custom styles (if enabled) | |
| 74 | Header styles - we just a dummy handle as we only need inline styles in <head>. | |
| 77 | Ensure tables don't 'flicker' on page load - visibility is set by JS when table initialised. | |
| 91 | We need to use a unique handle for our serialize object script to distinguish it from the built-in WordPress version. | |
| 132 | @deprecated 2.7.1 wc_product_table_filter_label replaced by wc_product_table_search_filter_label. | |
| 157 | Queue the main table styles and scripts. | |
| 162 | Add fitVids for responsive video if we're displaying shortcodes. | |
| 168 | Queue media element and playlist scripts/styles. | |
| 180 | Enqueue and localize add to cart script if not queued already. | |
| 185 | Make sure product add-on scripts are queued. | |
| 195 | Enqueue Photoswipe for image lightbox. |
Hook_Manager.php
| Type | Line | Description |
|---|---|---|
| 31 | Maybe add target="_blank" for add to cart buttons | |
| 34 | Adjust class for button when using loop add to cart template | |
| 37 | Remove srcset and sizes for images in table as they don't apply (to reduce bandwidth) | |
| 40 | Filter stock HTML | |
| 43 | Wrap quantity and add to cart button with extra div | |
| 49 | Override the 'add to cart' form action for each product. | |
| 53 | Move variation description, price & stock below the add to cart button and variations. | |
| 57 | Use custom template for the add to cart area for variable products. | |
| 61 | Format variation price | |
| 64 | Set image variation props | |
| 67 | Custom add to cart for separate variations. | |
| 78 | Product Addons extension | |
| 80 | Adjust template for <select> type product addons. | |
| 83 | Reset the product add-ons hooks after displaying add-ons for variable products, as it affects subsequent products in the table. | |
| 87 | Move the product add-on totals below the add to cart form | |
| 112 | Hide stock text in add to cart column, unless it's out of stock or a variable product | |
| 119 | For WC < 3.0 only | |
| 157 | Replace thumb with correct size needed for table | |
| 168 | Caption fallback | |
| 292 | foreach product | |
| 297 | Make sure external product button text is not blank | |
| 309 | Back compat: Add 'single_variation_wrap' class for compatibilitiy with WC 2.4 | |
| 323 | Get available variations? | |
| 346 | Set the default variation if the product has a default attribute. | |
| 349 | Append a random number to the attribute ID to prevent clashes with multiple attributes in the same table. | |
| 370 | if available variations ?> |
Plugin.php
| Type | Line | Description |
|---|---|---|
| 50 | Bail if WooCommerce not installed & active. | |
| 98 | Register the product table widgets |
Product_Table.php
| Type | Line | Description |
|---|---|---|
| 43 | Initialize helpers | |
| 74 | Add table to cache. | |
| 77 | Reset the table | |
| 82 | Enqueue the scripts for this table. | |
| 85 | Add attriutes and table headings. | |
| 89 | Fetch the data. | |
| 102 | Include any 'add to cart' messages above table. | |
| 131 | Fetch the data. | |
| 136 | Build the output. | |
| 176 | Work out what changed | |
| 181 | If any of the post paramaters are updated, reset posts array and totals | |
| 189 | If just the table paramaters are updated, reset posts but not totals | |
| 194 | If our search term or search filters changed from last time, reset products and filtered total, but leave the overall total. | |
| 201 | If we have an original search term and a user applied search term, we need to reset the total to avoid conflicts. | |
| 206 | Don't use cache if lazy loading and query params have been modified (e.g. rows_per_page, sort_by, etc) | |
| 207 | We don't check offset here as we cache each page of results separately using offset in the cache key. | |
| 212 | Next we update the args - this will update the args object in all helper classes as objects are stored by reference. | |
| 223 | Reset the table data | |
| 229 | No cache found, or caching disabled. | |
| 232 | Register the data hooks. | |
| 235 | Add all products to the table. | |
| 238 | Reset hooks. | |
| 241 | Update the cache. | |
| 265 | Bail if no products to add | |
| 270 | To make sure the post and product globals are reset, we store them here and set it back after our product loop. | |
| 274 | Get required columns to walk through | |
| 277 | Loop through array of WC_Products and add data for each. | |
| 280 | If it's a variable product and we're displaying separate variations, process variations and continue to next product. | |
| 290 | Add an empty cell if we're using the control column for responsive child rows | |
| 295 | Add the data for this product | |
| 299 | Reset main WP query as we called setup_postdata | |
| 314 | Get data object for this column | |
| 325 | Back compat: data object not found (e.g. custom column) so run filter | |
| 334 | Set table attributes. | |
| 340 | This is required otherwise tables can expand beyond their container. | |
| 343 | Add the table config as JSON encoded data. | |
| 347 | Set table ordering during initialisation - default to no ordering (i.e. use post order returned from WP_Query). | |
| 350 | If column is sortable, set initial sort order for DataTables. | |
| 355 | 'sort_order' has to be in double quotes (@see https://datatables.net/manual/options). | |
| 363 | Add the control column for responsive layouts if required (the column that contains the + / - icon) | |
| 368 | Add column headings | |
| 374 | used to easily pick out column in JS, e.g. dataTable.column( 'sku:name' ). | |
| 382 | Data source required only for lazy load - used to identify the column from JSON data. | |
| 389 | Add hidden columns | |
| 400 | Data source required only for lazy load. | |
| 412 | attributes not needed in footer. | |
| 420 | need this for compatibility with add-to-cart-variation.js | |
| 456 | Set global post object, so that any code referring to 'global $post' (e.g. get_the_content) works correctly. | |
| 459 | Setup global post data (id, authordata, etc) and global product. | |
| 470 | Ensure Javascript functions are defined as a function, not a string. |
Query_Hooks.php
| Type | Line | Description |
|---|---|---|
| 38 | Query optimisations. | |
| 43 | Adjust the meta query SQL for SKU searching using lazy load. | |
| 49 | Post clauses for price filter widget. | |
| 93 | We need the content as well, in case we need to auto-generate the excerpt from the content | |
| 110 | A user search (i.e. via the search box) takes precedence over search term used on load. | |
| 113 | Build SKU where clause. | |
| 118 | Perform a match on the search SQL so we can inject our SKU meta query into it. | |
| 124 | Add the post_password = '' clause if found. | |
| 136 | Add the meta query groupby clause. | |
| 141 | Add our meta query join. We always need to do a separate join as other post meta joins may be present. | |
| 150 | Requires lookup table added in 3.6. | |
| 159 | WPCS: input var ok, CSRF ok. | |
| 160 | WPCS: input var ok, CSRF ok. | |
| 167 | Uses standard tax class. |
Table_Args.php
| Type | Line | Description |
|---|---|---|
| 27 | built from columns | |
| 38 | built from filters | |
| 97 | any from $standard_columns, any attribute (att:pa_colour), taxonomy (tax:product_vendor) or custom field (cf:my_field) | |
| 103 | inline or column | |
| 105 | child_row, child_row_visible, or modal | |
| 113 | button, button_checkbox, checkbox | |
| 117 | number of words | |
| 119 | allowed: all, none, or any combination of id, sku, name, image, tags, categories, terms, attributes | |
| 142 | no default set - @see parse_args | |
| 145 | list of slugs or IDs | |
| 147 | list of slugs or IDs | |
| 149 | list of slugs or IDs | |
| 151 | list of terms of the form <taxonomy>:<term> | |
| 153 | set to true if using categories, tags or terms with numeric slugs | |
| 155 | list of custom fields of the form <field_key>:<field_value> | |
| 157 | four digit year, e.g. 2011 | |
| 159 | two digit month, e.g. 12 | |
| 161 | two digit day, e.g. 03 | |
| 163 | list of post IDs | |
| 165 | list of post IDs | |
| 217 | Back-compat: old property name. | |
| 231 | Check for old arg names. | |
| 234 | Lazy load args need to be merged in. | |
| 241 | Update by merging new args into previous args. | |
| 244 | Parse/validate args & update properties. | |
| 255 | Define custom validation callbacks. | |
| 281 | Setup validation array. | |
| 383 | Internal params | |
| 385 | Lazy load params | |
| 397 | Sanitize/validate all args. | |
| 400 | Set properties from the sanitized args. | |
| 403 | Fill in any blanks. | |
| 410 | Make sure boolean args are definitely booleans - sometimes filter_var_array doesn't convert them properly | |
| 415 | Convert some list args to arrays - columns, filters, links, category, tag, term, and cf are handled separately. | |
| 420 | Columns, headings and filters. | |
| 424 | Column widths | |
| 429 | Responsive options | |
| 446 | Variations | |
| 453 | Separate variations not currently supported for lazy load | |
| 458 | Cart button | |
| 463 | Add selected button | |
| 468 | Text for 'button' column button | |
| 473 | Display options (page length, etc) | |
| 480 | Links - used to control whether certain data items are links or plain text | |
| 491 | Paging type | |
| 496 | Image size | |
| 502 | One number, so use for both width and height | |
| 505 | Width and height specified | |
| 507 | otherwise assume it's a text-based image size, e.g. 'thumbnail' | |
| 511 | Disable lightbox if Photoswipe not available | |
| 516 | Disable lightbox if explicitly linking from image column | |
| 521 | Validate date columns - only custom fields or taxonomies allowed | |
| 526 | Sort by | |
| 529 | If sorting by attribute, make sure it uses the full attribute name. | |
| 534 | Sort order - set default if not specified or invalid | |
| 538 | Default to descending if sorting by date, ascending for everything else | |
| 542 | Search terms | |
| 551 | Product limit | |
| 554 | Description length & rows per page - can be positive int or -1 | |
| 556 | Sanity check in case filter set an invalid value | |
| 565 | Ignore product limit if lazy loading and the default product limit is used. | |
| 570 | If enabling shortcodes, display the full content | |
| 575 | If auto width disabled, we must use the inline +/- control otherwise control column is always shown | |
| 640 | Custom field, product attribute or taxonomy. | |
| 644 | no custom field, attribute, or taxonomy specified | |
| 648 | invalid taxonomy | |
| 653 | Standard or custom column. | |
| 656 | Check for common typos in column names. | |
| 665 | Only add column if valid and not added already. | |
| 668 | fetch rest of heading | |
| 682 | If filters is true, set based on table columns. | |
| 686 | If displaying variations, we add all attribute filters to the list by including 'attributes' in the filters list. | |
| 698 | Re-key. | |
| 701 | If the 'attributes' keyword is specified, replace it with all attribute taxonomies. | |
| 703 | 'attributes' keyword found - replace with all global product attributes. | |
| 715 | Custom taxonomy filter. | |
| 722 | Attribute filter. | |
| 725 | Only global attributes (i.e. taxonomies) are allowed as a filter | |
| 730 | Categories or tags filter. | |
| 775 | 'add_selected_text' used to be stored in the table args. | |
| 786 | Custom filter option | |
| 795 | Custom sort by option | |
| 804 | Unset settings that don't map to shortcode args | |
| 808 | Check for empty settings | |
| 815 | Ensure int settings are valid | |
| 841 | _deprecated_function( __METHOD__, '2.8', self::class . '::get_user_defaults' ); |
Table_Cache.php
| Type | Line | Description |
|---|---|---|
| 76 | Existing table found, so update it. | |
| 86 | No existing table in cache, so add it. | |
| 97 | Check for old cached data abd delete if found. | |
| 110 | Limit maximum size of cacheable data to prevent storing very large transients | |
| 118 | Flush cache if not using | |
| 134 | Disable caching if filter widgets are active | |
| 139 | Disable caching if WC Password Protected Categories is active, as product list will vary if there are protected or private categories. | |
| 154 | For lazy load, cache each page of data based on offset |
Table_Columns.php
| Type | Line | Description |
|---|---|---|
| 48 | sanity check | |
| 131 | Only allow filtering if column is searchable. | |
| 150 | Only allow filtering if column is sortable. |
Table_Factory.php
| Type | Line | Description |
|---|---|---|
| 25 | Merge in the default args, so our table ID reflects the full list of args including user settings. |
Table_Query.php
| Type | Line | Description |
|---|---|---|
| 44 | Build query args and retrieve the products for our table. | |
| 47 | Convert posts to products and store the results. | |
| 56 | Support for wc_get_products function | |
| 72 | If we have search term 'on load' and a user applied search, we set the total to match the filtered total to avoid a mismatch. | |
| 75 | If showing all products on a single page, the total is the count of products array. | |
| 92 | If we've already calculated the filtered total. | |
| 99 | If we already have products, then this must be the filtered list, so return count of this array. | |
| 102 | Otherwise we need to calculate total by running a new query. | |
| 127 | Ensure WC post filters run on this query | |
| 179 | Category handling. | |
| 187 | Tag handling. | |
| 192 | Custom taxonomy/term handling. | |
| 205 | Custom terms are in format <taxonomy>:<term slug or id> or a list using just one taxonomy, e.g. product_cat:term1,term2. | |
| 210 | Split term around the colon and check valid | |
| 227 | If no tax query, set the whole tax query to the custom terms query, otherwise append terms as inner query. | |
| 261 | Add tax queries for search filter drop-downs. | |
| 263 | Search filters always use term IDs | |
| 269 | If no tax query, set the whole tax query to the filters query, otherwise append filters as inner query | |
| 271 | If no tax query, set the whole tax query to the filters query. | |
| 274 | If tax query is an OR, nest it with the search filters query and join with AND. | |
| 281 | Otherwise append search filters and ensure it's AND. | |
| 290 | Retrieve the current user's orders | |
| 300 | Loop through the orders and retrieve the product IDs | |
| 305 | Quit checking orders if the product limit is reached | |
| 318 | Prevent all products from being displayed if no user products | |
| 330 | Comma-delimited list = OR, plus-delimited list = AND | |
| 339 | If no field provided, work out whether we have term slugs or ids. | |
| 345 | There's a strange bug when using 'operator' => 'AND' for individual tax queries. | |
| 346 | So we need to split these into separate 'IN' arrays joined by and outer relation => 'AND' | |
| 371 | First, build the WooCommerce meta query. | |
| 378 | Comma-delimited = OR, plus-delimited = AND. | |
| 386 | Custom fields are in format <field_key>:<field_value> | |
| 388 | Split custom field around the colon and check valid | |
| 392 | We have a field key and value | |
| 397 | If we're selecting based on an ACF field, field value could be stored as an array, so use RLIKE with a test for serialized array pattern | |
| 409 | Field key only, so do an 'exists' check instead | |
| 418 | If only one CF query, we can use as a top-level meta query, otherwise we need to add a relation. | |
| 427 | if $this->args->cf | |
| 429 | Are we sorting by custom field? If so, we add a custom order clause. | |
| 439 | Sort by SKU. | |
| 470 | Use named order clause if we have one. | |
| 474 | Replace column name with correct sort_by item used by WP_Query. | |
| 479 | Bail if we don't have a valid orderby arg. | |
| 480 | Note! Custom field and SKU sorting is handled by build_meta_query(). | |
| 485 | Use WC to get standard ordering args and add extra query filters. | |
| 488 | Additional orderby options. | |
| 517 | @todo: Use 'wc_get_products' instead of WP_Query. We can't yet as price filter widget and other meta queries are not passed through. | |
| 518 | Run the product query. | |
| 523 | We call WC()->query->get_catalogue_ordering_args() while building our product query, which adds various filters. | |
| 524 | These can interfere with any subsequent queries while building table data, so we need to remove them. |
Table_Shortcode.php
| Type | Line | Description |
|---|---|---|
| 49 | Return the table as HTML | |
| 54 | Don't run in the search results. | |
| 66 | _deprecated_function( __METHOD__, '2.8', Table_Args::class . '::back_compat_args' ); |
template-functions.php
| Type | Line | Description |
|---|---|---|
| 6 | Prevent direct file access | |
| 40 | Create and return the table as HTML | |
| 53 | phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
Template_Handler.php
| Type | Line | Description |
|---|---|---|
| 68 | Replace Genesis loop with product table | |
| 104 | Product category archive | |
| 107 | Product tag archive | |
| 110 | Other product taxonomy archive | |
| 114 | Product search results page | |
| 118 | Display the product table |
Columns_Util.php
| Type | Line | Description |
|---|---|---|
| 27 | Priority values are used to determine visiblity at small screen sizes (1 = highest priority). | |
| 125 | Certain classes are reserved for use by DataTables Responsive, so we need to strip these to prevent conflicts. | |
| 132 | '.' not allowed in data source | |
| 137 | ':' not allowed in column name as not compatible with DataTables API. |
Settings.php
| Type | Line | Description |
|---|---|---|
| 47 | Back-compat: add_selected_text used to be stored in the table defaults. | |
| 88 | Merge with defaults. | |
| 93 | Convert 'yes'/'no' options to booleans. |
Util.php
| Type | Line | Description |
|---|---|---|
| 25 | ARRAYS | |
| 81 | Return empty array if there are no keys to extract | |
| 88 | Make sure we have an array to pluck from | |
| 112 | SANITIZING / VALIDATION | |
| 135 | Allows any "word" (letter, digit, underscore), comma, full-stop, colon, hyphen, plus, forward slash, and (optionally) a space. | |
| 149 | Allows decimal digit or comma | |
| 180 | TERMS / TAXONOMIES | |
| 213 | Remove duplicates | |
| 220 | Default to product categories if not set | |
| 224 | Arguments for get_terms() changed in WP 4.5 | |
| 240 | ATTRIBUTES / VARIATIONS | |
| 267 | Return from label cache if present | |
| 273 | Cache attribute label to prevent additional DB calls | |
| 297 | Hide out of stock variations if 'Hide out of stock items from the catalog' is checked | |
| 302 | Filter 'woocommerce_hide_invisible_variations' to optionally hide invisible variations (disabled variations and variations with empty price). | |
| 320 | Sanity check, in case non-variable product is passed | |
| 329 | CUSTOM FIELDS | |
| 335 | If we're not getting field for a specific post, just check field exists (ACF Pro only) | |
| 342 | In ACF v4 and below, date picker fields used jQuery date formats and 'return_format' was called 'date_format' | |
| 345 | In ACF v4 and below, display_format used jQuery date format | |
| 355 | PRODUCTS | |
| 358 | @todo: Is this function still needed or does WooCommerce correctly handle variation names? | |
| 365 | Get the name of the parent product | |
| 368 | Name contains attributes if the parent name is different to the variation's name | |
| 371 | Older versions of WC used 'Variation #1234 of...' as the product name, so use parent instead | |
| 388 | If this is a term slug, get the term's nice name | |
| 490 | WIDGETS | |
| 495 | Get the just the layered nav params (e.g. min_price) from the current request. | |
| 508 | DATES AND TIMES | |
| 512 | api.jqueryui.com/datepicker/ for jQuery formats. | |
| 534 | It's EU format if the day comes first | |
| 561 | Already a UNIX timestamp so return as int. | |
| 568 | SEARCH | |
| 575 | IMAGES | |
| 594 | SHORTCODE | |
| 609 | First, we store the current in_the_loop and current_post values so we can set them back afterwards. | |
| 617 | Start an output buffer (discarded below) as some plugins generate output when calling the_post() | |
| 629 | Rewind posts as we called the_post(), then end output buffer | |
| 634 | Set back query properties to previous state as have_posts() and the_post() override them. | |
| 641 | CSS | |
| 652 | PATHS / URLs | |
| 669 | OTHER | |
| 672 | Print WC notices (e.g. add to cart notifications) |
class-wc-product-table-widget.php
| Type | Line | Description |
|---|---|---|
| 24 | Add .woocommerce to body class if product table used on page, so filter widgets pick up correct styles in certain themes (Genesis, Total, etc). | |
| 80 | if WC_Widget exists |
class-wcpt-widget-layered-nav-filters.php
| Type | Line | Description |
|---|---|---|
| 64 | Attributes | |
| 114 | if WC_Product_Table_Widget |
class-wcpt-widget-layered-nav.php
| Type | Line | Description |
|---|---|---|
| 175 | Force found when option is selected - do not force found on taxonomy attributes | |
| 220 | If on a term page, skip that term in widget list. | |
| 225 | Get count based on current view. | |
| 229 | Only show options with count > 0. | |
| 254 | Update value on change. | |
| 259 | Submit form on change if standard dropdown. | |
| 265 | Use Select2 enhancement if possible | |
| 315 | Generate query | |
| 335 | We have a query - let's see if cached results of this query already exist. | |
| 340 | @codingStandardsIgnoreLine | |
| 358 | List display. | |
| 370 | Skip the term for the current archive. | |
| 375 | Only show options with count > 0. | |
| 392 | Add current filters to URL. | |
| 394 | Exclude query arg for current term archive term. | |
| 399 | Exclude self so filter can be unset on click. | |
| 409 | Add Query type Arg to URL. | |
| 430 | foreach attribute term | |
| 439 | if WC_Product_Table_Widget |
class-wcpt-widget-price-filter.php
| Type | Line | Description |
|---|---|---|
| 48 | Back compat - WC 2.6 | |
| 73 | Find min and max price in current result set | |
| 155 | if WC_Product_Table_Widget |
class-wcpt-widget-rating-filter.php
| Type | Line | Description |
|---|---|---|
| 51 | Unset current rating filter. | |
| 59 | Set new rating filter. | |
| 70 | WC < 3.0 | |
| 150 | if WC_Product_Table_Widget |
class-html-data-table.php
| Type | Line | Description |
|---|---|---|
| 34 | Ignore null attributes and empty strings | |
| 43 | If attribute contains a double-quote, wrap it in single-quotes to avoid parsing errors | |
| 47 | Escape the attribute, then convert double-quotes back | |
| 194 | deprecated | |
| 195 | deprecated | |
| 270 | @deprecated | |
| 320 | if class doesn't exist |
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 |