GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Static Public Member Functions | Data Fields | Static Private Attributes
ProductManager Class Reference

Public Member Functions

 activate_product ( $product)
 Activates a product. More...
 
 ajax_activate_product (array $payload)
 AJAX request wrapper for the activate_product() method. More...
 
 ajax_deactivate_product (array $payload)
 AJAX request wrapper for the deactivate_product() method. More...
 
 ajax_get_products_data (array $payload)
 AJAX request wrapper for the {. More...
 
 ajax_install_product (array $payload)
 AJAX request wrapper for the install_product() method. More...
 
 ajax_update_product (array $payload)
 AJAX request wrapper for the update_product() method. More...
 
 configure_ajax_routes (array $routes)
 Configures AJAX routes handled by this class. More...
 
 deactivate_product ( $product)
 Deactivates a product. More...
 
 display_product_action_links ( $links, $product_path)
 Displays action links (e.g., Settings, Support, etc.) for each product in the Plugins page. More...
 
 get_products_data (array $args=[])
 Returns a list of all GravityKit products with associated installation/activation/licensing data. More...
 
 get_remote_products ()
 Returns a list of all GravityKit products from the API grouped by category (e.g., plugins, extensions, etc.). More...
 
 init ()
 Initializes the class. More...
 
 install_product (array $product)
 Installs a product. More...
 
 is_product_active_in_current_context ( $plugin)
 Checks if plugin is activated in the current context (network or site). More...
 
 update_product ( $product_path)
 Updates a product. More...
 
 update_submenu_badge_count ()
 Optionally updates the Licenses submenu badge count if any of the products have newer versions available. More...
 
 validate_product_plugin_dependencies ( $dependencies)
 Validates product plugin dependencies. More...
 
 validate_product_system_requirements ( $requirements)
 Validates product system requirements. More...
 

Static Public Member Functions

static get_instance ()
 Returns class instance. More...
 

Data Fields

const EDD_PRODUCTS_API_ENDPOINT = 'https://www.gravitykit.com/edd-api/products/'
 
const EDD_PRODUCTS_API_KEY = 'e4c7321c4dcf342c9cb078e27bf4ba97'
 
const EDD_PRODUCTS_API_TOKEN = 'e031fd350b03bc223b10f04d8b5dde42'
 

Static Private Attributes

static $_instance
 

Detailed Description

Definition at line 20 of file ProductManager.php.

Member Function Documentation

◆ activate_product()

activate_product (   $product)

Activates a product.

Since
1.0.0
Parameters
string$product
Exceptions
Exception
Returns
array{active: bool, network_activated: bool}

Definition at line 243 of file ProductManager.php.

References ProductManager\is_product_active_in_current_context().

Referenced by ProductManager\ajax_activate_product(), ProductManager\install_product(), and ProductManager\update_product().

◆ ajax_activate_product()

ajax_activate_product ( array  $payload)

AJAX request wrapper for the activate_product() method.

Since
1.0.0
Parameters
array$payload
Exceptions
Exception
Returns
array{active: bool, network_activated: bool}

Definition at line 220 of file ProductManager.php.

References ProductManager\activate_product(), and Framework\get_instance().

◆ ajax_deactivate_product()

ajax_deactivate_product ( array  $payload)

AJAX request wrapper for the deactivate_product() method.

Since
1.0.0
Parameters
array$payload
Exceptions
Exception
Returns
array

Definition at line 271 of file ProductManager.php.

References ProductManager\deactivate_product(), and Framework\get_instance().

◆ ajax_get_products_data()

ajax_get_products_data ( array  $payload)

AJAX request wrapper for the {.

See also
get_products_data()} method.
Since
1.0.0
Parameters
array$payload
Exceptions
Exception
Returns
array

Definition at line 510 of file ProductManager.php.

References Encryption\get_instance(), Framework\get_instance(), ProductManager\get_products_data(), and Core\get_request_unique_string().

◆ ajax_install_product()

ajax_install_product ( array  $payload)

AJAX request wrapper for the install_product() method.

Since
1.0.0
Parameters
array$payload
Exceptions
Exception
Returns
array{path: string, active: bool, network_activated: bool, activation_error: null|string}

Definition at line 104 of file ProductManager.php.

References Framework\get_instance(), and ProductManager\install_product().

◆ ajax_update_product()

ajax_update_product ( array  $payload)

AJAX request wrapper for the update_product() method.

Since
1.0.0
Parameters
array$payload
Exceptions
Exception
Returns
array{active: bool, network_activated: bool, installed_version: string, update_available: bool}

Definition at line 322 of file ProductManager.php.

References Framework\get_instance(), and ProductManager\update_product().

◆ configure_ajax_routes()

configure_ajax_routes ( array  $routes)

Configures AJAX routes handled by this class.

Since
1.0.0
See also
Core::process_ajax_request()
Parameters
array$routesAJAX action to class method map.
Returns
array

Definition at line 83 of file ProductManager.php.

◆ deactivate_product()

deactivate_product (   $product)

Deactivates a product.

Since
1.0.0
Parameters
string$product
Exceptions
Exception
Returns
array{active: bool, network_activated: bool}

Definition at line 294 of file ProductManager.php.

References ProductManager\is_product_active_in_current_context().

Referenced by ProductManager\ajax_deactivate_product().

◆ display_product_action_links()

display_product_action_links (   $links,
  $product_path 
)

Displays action links (e.g., Settings, Support, etc.) for each product in the Plugins page.

Since
1.0.3
Parameters
array$linksLinks associated with the product.
string$product_pathProduct path.
Returns
array
Runs Filter:
gk/foundation/products/{$product_slug}/action-links Sets product action links in the Plugins page.
Since
1.0.3
Parameters
array$linksCombined GravityKit and original action links.
array$gk_linksGravityKit-added action links.
array$linkOriginal action links.

Definition at line 762 of file ProductManager.php.

References ProductManager\get_products_data().

◆ get_instance()

static get_instance ( )
static

◆ get_products_data()

get_products_data ( array  $args = [])

Returns a list of all GravityKit products with associated installation/activation/licensing data.

Since
1.0.0
Parameters
array$args(optional) Additional arguments. Default: ['skip_cache' => false, 'group_by_category' => false, 'key_by' => 'path'].
Exceptions
Exception
Returns
array
Runs Filter:
gk/foundation/settings/{$product_slug}/settings-url Sets link to the product settings page.
Since
1.0.3
Parameters
string$settings_urlURL to the product settings page.
Runs Filter:
gk/foundation/products/data Modifies products data object.
Since
1.0.3
Parameters
array$productsProducts data.
array$argsAdditional arguments passed to the get_products_data() method.

Definition at line 552 of file ProductManager.php.

References $args, LicenseManager\get_instance(), ProductManager\get_remote_products(), Framework\ID, ProductManager\validate_product_plugin_dependencies(), and ProductManager\validate_product_system_requirements().

Referenced by ProductManager\ajax_get_products_data(), ProductManager\display_product_action_links(), ProductManager\update_product(), and ProductManager\update_submenu_badge_count().

◆ get_remote_products()

get_remote_products ( )

Returns a list of all GravityKit products from the API grouped by category (e.g., plugins, extensions, etc.).

Since
1.0.0
Exceptions
Exception
Returns
array

Definition at line 417 of file ProductManager.php.

References Arr\get(), and Helpers\query_api().

Referenced by ProductManager\get_products_data().

◆ init()

init ( )

Initializes the class.

Since
1.0.0
Returns
void

Definition at line 56 of file ProductManager.php.

References Framework\AJAX_ROUTER, and ProductManager\update_submenu_badge_count().

◆ install_product()

install_product ( array  $product)

Installs a product.

Since
1.0.0
Parameters
array$product
Exceptions
Exception
Returns
array{path: string, active: bool, network_activated: bool, activation_error: null|string}

Definition at line 129 of file ProductManager.php.

References ProductManager\activate_product(), and LicenseManager\get_instance().

Referenced by ProductManager\ajax_install_product().

◆ is_product_active_in_current_context()

is_product_active_in_current_context (   $plugin)

Checks if plugin is activated in the current context (network or site).

Since
1.0.0
Returns
bool

Definition at line 647 of file ProductManager.php.

Referenced by ProductManager\activate_product(), and ProductManager\deactivate_product().

◆ update_product()

update_product (   $product_path)

Updates a product.

Since
1.0.0
Parameters
string$product_path
Exceptions
Exception
Returns
array{active: bool, network_activated: bool, installed_version: string, update_available: bool}

Definition at line 345 of file ProductManager.php.

References $args, $url, ProductManager\activate_product(), EDD\get_instance(), and ProductManager\get_products_data().

Referenced by ProductManager\ajax_update_product().

◆ update_submenu_badge_count()

update_submenu_badge_count ( )

Optionally updates the Licenses submenu badge count if any of the products have newer versions available.

Since
1.0.0
Returns
void

Definition at line 658 of file ProductManager.php.

References $update_count, Framework\get_instance(), ProductManager\get_products_data(), and Framework\ID.

Referenced by ProductManager\init().

◆ validate_product_plugin_dependencies()

validate_product_plugin_dependencies (   $dependencies)

Validates product plugin dependencies.

Since
1.0.0
Parameters
array$dependencies
Returns
array|null An array of failed dependencies or null if all dependencies are met.

Definition at line 732 of file ProductManager.php.

Referenced by ProductManager\get_products_data().

◆ validate_product_system_requirements()

validate_product_system_requirements (   $requirements)

Validates product system requirements.

Since
1.0.0
Parameters
array$requirements
Returns
array|null An array of failed requirements or null if all requirements are met.

Definition at line 696 of file ProductManager.php.

Referenced by ProductManager\get_products_data().

Field Documentation

◆ $_instance

$_instance
staticprivate

Definition at line 32 of file ProductManager.php.

◆ EDD_PRODUCTS_API_ENDPOINT

const EDD_PRODUCTS_API_ENDPOINT = 'https://www.gravitykit.com/edd-api/products/'

Definition at line 21 of file ProductManager.php.

◆ EDD_PRODUCTS_API_KEY

const EDD_PRODUCTS_API_KEY = 'e4c7321c4dcf342c9cb078e27bf4ba97'

Definition at line 23 of file ProductManager.php.

◆ EDD_PRODUCTS_API_TOKEN

const EDD_PRODUCTS_API_TOKEN = 'e031fd350b03bc223b10f04d8b5dde42'

Definition at line 25 of file ProductManager.php.


The documentation for this class was generated from the following file: