Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename licence -> license throughout codebase #2554

Merged
merged 10 commits into from
Aug 7, 2023
42 changes: 21 additions & 21 deletions assets/css/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
}
}

a.wpjm-activate-licence-link,
a.wpjm-activate-licence-link:link,
a.wpjm-activate-licence-link:hover,
a.wpjm-activate-licence-link:visited,
a.wpjm-activate-licence-link:active {
a.wpjm-activate-license-link,
a.wpjm-activate-license-link:link,
a.wpjm-activate-license-link:hover,
a.wpjm-activate-license-link:visited,
a.wpjm-activate-license-link:active {
color: orangered;
}

.wpjm-licences {
.wpjm-licenses {
margin-top: 10px;

.licence-row {
.license-row {
align-items: center;
border: solid 1px #e2e0e2;
display: flex;
Expand All @@ -41,34 +41,34 @@ a.wpjm-activate-licence-link:active {
font-weight: 400;
}
}
.plugin-licence {
.plugin-license {
flex: 1;
flex-basis: 40%;
padding-bottom: 5px;
}
.plugin-licence-icon {
.plugin-license-icon {
width: 44px;
height: 44px;
margin: 14px 16px 14px 12px;
}
.plugin-licence-form {
.plugin-license-form {
text-align: right;
margin-right: 24px;
line-height: 36px;
height: 36px;
}
.plugin-licence-checkmark {
.plugin-license-checkmark {
// The resulting color shoudl be #008A20. Computed using https://codepen.io/sosuke/pen/Pjoqqp
filter: invert(23%) sepia(74%) saturate(6542%) hue-rotate(143deg) brightness(100%) contrast(101%);
vertical-align: middle;
}
.plugin-licence-label {
.plugin-license-label {
line-height: 36px;
font-weight: 600;
margin-left: 22px;
white-space: nowrap;
}
.plugin-licence-field {
.plugin-license-field {
height: 36px;
margin-left: 25px;
width: 100%;
Expand All @@ -77,13 +77,13 @@ a.wpjm-activate-licence-link:active {
border: 1px solid #CC1818;
}
}
.plugin-licence-button {
.plugin-license-button {
margin-left: 30px;
height: 36px;
width: 100%;
max-width: 140px;
}
.plugin-licence-notice {
.plugin-license-notice {
width: 100%;
margin: 0 24px 14px 12px;
// Apply background colors from gutenberg notices in the HTML for each notice type
Expand Down Expand Up @@ -162,26 +162,26 @@ a.wpjm-activate-licence-link:active {
}
}

.plugin-licence-search {
.plugin-license-search {
width: 100%;
margin: 18px 0;
display: flex;
justify-content: end;
min-height: 40px;
.plugin-licence-search-field {
.plugin-license-search-field {
max-width: 180px;
width: 100%;
min-height: 40px;
margin-right: 3px;
}
.plugin-licence-search-button {
.plugin-license-search-button {
min-height: 40px;
max-width: 75px;
width: 100%;
}
}

.plugin-licence-section {
.plugin-license-section {
font-size: 13px;
line-height: 16px;
font-weight: 700;
Expand Down Expand Up @@ -733,13 +733,13 @@ tr.email-setting-row {
*/
@media only screen and (max-width: 782px) {

.wpjm-licences {
.wpjm-licenses {

.plugin-info {
padding: 10px;
}

.plugin-licence {
.plugin-license {
padding: 10px;
}
}
Expand Down
2 changes: 1 addition & 1 deletion includes/3rd-party/wpcom.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function wpjm_dotcom_marketplace_configure_license_for_wp_job_manager_addon( $re
}

$helper = WP_Job_Manager_Helper::instance();
$helper->activate_licence( $payload['wpjm_product_slug'], $payload['license_code'], $payload['email_address'] );
$helper->activate_license( $payload['wpjm_product_slug'], $payload['license_code'], $payload['email_address'] );

$messages = $helper->get_messages( $payload['wpjm_product_slug'] );

Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-wp-job-manager-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function admin_enqueue_scripts() {
public function admin_menu() {
add_submenu_page( 'edit.php?post_type=job_listing', __( 'Settings', 'wp-job-manager' ), __( 'Settings', 'wp-job-manager' ), 'manage_options', 'job-manager-settings', [ $this->settings_page, 'output' ] );

if ( WP_Job_Manager_Helper::instance()->has_licenced_products() || apply_filters( 'job_manager_show_addons_page', true ) ) {
if ( WP_Job_Manager_Helper::instance()->has_licensed_products() || apply_filters( 'job_manager_show_addons_page', true ) ) {
add_submenu_page( 'edit.php?post_type=job_listing', __( 'WP Job Manager Add-ons', 'wp-job-manager' ), __( 'Add-ons', 'wp-job-manager' ), 'manage_options', 'job-manager-addons', [ $this, 'addons_page' ] );
}
}
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wp-job-manager-usage-tracking-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ private static function get_official_extensions( $licensed_only ) {

if ( $licensed_only ) {
foreach ( $active_plugins as $plugin_slug => $data ) {
if ( ! $helper->has_plugin_licence( $plugin_slug ) ) {
if ( ! $helper->has_plugin_license( $plugin_slug ) ) {
unset( $active_plugins[ $plugin_slug ] );
}
}
Expand Down
24 changes: 15 additions & 9 deletions includes/helper/class-wp-job-manager-helper-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ public function plugin_information( $args ) {
}

/**
* Attempt to activate a plugin licence.
* Attempt to activate a plugin license.
*
* @param array $args The arguments to pass to the API.
* @return array|false JSON response or false if failed.
*/
public function activate( $args ) {
$args = wp_parse_args( $args );
$product_slug = $args['api_product_id'];
$response = $this->bulk_activate( $args['licence_key'], [ $product_slug ] );
$response = $this->bulk_activate( $args['license_key'], [ $product_slug ] );
if ( false === $response || ! array_key_exists( $product_slug, $response ) ) {
return false;
}
Expand All @@ -115,21 +115,21 @@ public function activate( $args ) {
}

/**
* Attempt to activate multiple WPJM products with a single licence key.
* Attempt to activate multiple WPJM products with a single license key.
*
* @param string $licence_key The licence key to activate.
* @param string $license_key The license key to activate.
* @param array $product_slugs The slugs of the products to activate.
* @return array|false The response, or false if the request failed.
*/
public function bulk_activate( $licence_key, $product_slugs ) {
public function bulk_activate( $license_key, $product_slugs ) {
return $this->request_endpoint(
'wp-json/wpjmcom-licensing/v1/activate',
[
'method' => 'POST',
'body' => wp_json_encode(
[
'site_url' => $this->get_site_url(),
'license_key' => $licence_key,
'license_key' => $license_key,
'product_slugs' => $product_slugs,
]
),
Expand All @@ -138,7 +138,7 @@ public function bulk_activate( $licence_key, $product_slugs ) {
}

/**
* Attempt to deactivate a plugin licence.
* Attempt to deactivate a plugin license.
*
* @param array|string $args
* @return array|false JSON response or false if failed.
Expand All @@ -151,14 +151,20 @@ public function deactivate( $args ) {
}

/**
* Make a licence helper API request.
* Make a license helper API request.
*
* @param array $args The arguments to pass to the API.
* @param bool $return_error If we should return the error details or not.
*
* @return array|false The response as an array, or false if the request failed.
*/
protected function request( $args, $return_error = false ) {
// These legacy endpoints are temporary. For now, translate `license_key` => `licence_key` at this point.
if ( ! empty( $args['license_key'] ) ) {
$args['licence_key'] = $args['license_key'];
unset( $args['license_key'] );
}

$defaults = [
'instance' => $this->get_site_url(),
'plugin_name' => '',
Expand All @@ -183,7 +189,7 @@ protected function request( $args, $return_error = false ) {
}

/**
* Make a licence helper API request to a WP REST API Endpoint.
* Make a license helper API request to a WP REST API Endpoint.
*
* @param string $endpoint The endpoint to make the API request to.
* @param array $args The arguments to pass to the request.
Expand Down
Loading