Skip to content

Commit

Permalink
Bhin and aioseo (#88)
Browse files Browse the repository at this point in the history
* Add sas for aioseo.

* Update links for BH India on coming soon page.

* Fix issues with @wordpress/env

* Fix basic linting issues

* Bump plugin version.

Co-authored-by: Mike Hansen <[email protected]>
Co-authored-by: Micah Wood <[email protected]>
  • Loading branch information
3 people authored Mar 24, 2021
1 parent 3f160d9 commit aeeb968
Show file tree
Hide file tree
Showing 21 changed files with 33,226 additions and 730 deletions.
2 changes: 1 addition & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": true
},
"phpVersion": "5.6",
"phpVersion": "7.2",
"plugins": [
"."
],
Expand Down
4 changes: 2 additions & 2 deletions bluehost-wordpress-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Bluehost
* Description: This plugin integrates your WordPress site with the Bluehost control panel, including performance, security, and update features.
* Version: 2.5.5
* Version: 2.5.6
* Requires at least: 4.7
* Requires PHP: 5.6
* Author: Bluehost
Expand All @@ -27,7 +27,7 @@
}

// Define constants
define( 'BLUEHOST_PLUGIN_VERSION', '2.5.5' );
define( 'BLUEHOST_PLUGIN_VERSION', '2.5.6' );
define( 'BLUEHOST_PLUGIN_FILE', __FILE__ );
define( 'BLUEHOST_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'BLUEHOST_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
Expand Down
118 changes: 69 additions & 49 deletions compat/safe-mode.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion compat/scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ protected function evaluate() {
// check for plugin using plugin name
if ( is_plugin_active( $plugin ) ) {
list( $plugin_slug ) = explode( '/', $plugin );
$this->result = 'plugin-compat-clash-' . $plugin_slug;
$this->result = 'plugin-compat-clash-' . $plugin_slug;
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions inc/RestApi/CachingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public function register_routes() {
register_rest_route(
$this->namespace,
'/caching',
[
array(
'methods' => \WP_REST_Server::DELETABLE,
'callback' => [ $this, 'purge_all' ],
'permission_callback' => [ $this, 'check_permission' ],
]
'callback' => array( $this, 'purge_all' ),
'permission_callback' => array( $this, 'check_permission' ),
)
);

}
Expand Down
20 changes: 10 additions & 10 deletions inc/RestApi/MojoItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base,
[
[
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => [ $this, 'query_mojo_item' ],
'permission_callback' => [ $this, 'get_items_permissions_check' ],
'args' => [
'id' => [
'callback' => array( $this, 'query_mojo_item' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => array(
'id' => array(
'required' => true,
],
],
],
]
),
),
),
)
);
}

Expand Down
12 changes: 6 additions & 6 deletions inc/RestApi/MojoItemsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ public function get_response( $api_response ) {

$status_code = absint( wp_remote_retrieve_response_code( $api_response ) );

$response = [
$response = array(
'status' => 'error',
'statusCode' => $status_code,
'message' => 'An unknown error occurred.',
];
);

if ( is_wp_error( $api_response ) ) {
return $response;
Expand All @@ -101,7 +101,7 @@ public function get_response( $api_response ) {
$response['message'] = 'Unable to parse response JSON.';
}

$response = array_merge( $data, [ 'statusCode' => $status_code ] );
$response = array_merge( $data, array( 'statusCode' => $status_code ) );

// Ensure page property is always an integer.
if ( isset( $response['page'] ) && ! is_int( $response['page'] ) ) {
Expand All @@ -114,11 +114,11 @@ function ( array $item ) {
if ( isset( $item['id'] ) ) {

$item['buy_url'] = mojo_build_link(
add_query_arg( [ 'item_id' => $item['id'] ], 'https://www.mojomarketplace.com/cart' ),
[
add_query_arg( array( 'item_id' => $item['id'] ), 'https://www.mojomarketplace.com/cart' ),
array(
'utm_medium' => 'plugin_admin',
'utm_content' => 'buy_now_preview',
]
)
);

if ( isset( $item['type'] ) && 'themes' === $item['type'] ) {
Expand Down
14 changes: 7 additions & 7 deletions inc/RestApi/MojoPluginsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base,
[
[
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => [ $this, 'get_items' ],
'permission_callback' => [ $this, 'get_items_permissions_check' ],
'callback' => array( $this, 'get_items' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => $this->get_collection_params(),
],
]
),
)
);
}

Expand All @@ -40,7 +40,7 @@ public function register_routes() {
* @return \WP_Error|\WP_REST_Response
*/
public function get_items( $request ) {
$params = [ 'item_type' => 'plugins' ];
$params = array( 'item_type' => 'plugins' );
$data = $this->query_mojo_search( $params, $request );

return rest_ensure_response( $data );
Expand Down
14 changes: 7 additions & 7 deletions inc/RestApi/MojoServicesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base,
[
[
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => [ $this, 'get_items' ],
'permission_callback' => [ $this, 'get_items_permissions_check' ],
'callback' => array( $this, 'get_items' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => $this->get_collection_params(),
],
]
),
)
);
}

Expand All @@ -40,7 +40,7 @@ public function register_routes() {
* @return \WP_Error|\WP_REST_Response
*/
public function get_items( $request ) {
$params = [ 'item_type' => 'services' ];
$params = array( 'item_type' => 'services' );
$data = $this->query_mojo_search( $params, $request );

return rest_ensure_response( $data );
Expand Down
14 changes: 7 additions & 7 deletions inc/RestApi/MojoThemesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base,
[
[
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => [ $this, 'get_items' ],
'permission_callback' => [ $this, 'get_items_permissions_check' ],
'callback' => array( $this, 'get_items' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => $this->get_collection_params(),
],
]
),
)
);
}

Expand All @@ -40,7 +40,7 @@ public function register_routes() {
* @return \WP_Error|\WP_REST_Response
*/
public function get_items( $request ) {
$params = [ 'item_type' => 'themes' ];
$params = array( 'item_type' => 'themes' );
$data = $this->query_mojo_search( $params, $request );

return rest_ensure_response( $data );
Expand Down
96 changes: 48 additions & 48 deletions inc/RestApi/StagingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,77 +38,77 @@ public function register_routes() {
register_rest_route(
$this->namespace,
'/staging',
[
[
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => [ $this, 'getStagingDetails' ],
'permission_callback' => [ $this, 'checkPermission' ],
],
[
'callback' => array( $this, 'getStagingDetails' ),
'permission_callback' => array( $this, 'checkPermission' ),
),
array(
'methods' => \WP_REST_Server::CREATABLE,
'callback' => [ $this, 'createStaging' ],
'permission_callback' => [ $this, 'checkPermission' ],
],
[
'callback' => array( $this, 'createStaging' ),
'permission_callback' => array( $this, 'checkPermission' ),
),
array(
'methods' => \WP_REST_Server::DELETABLE,
'callback' => [ $this, 'destroyStaging' ],
'permission_callback' => [ $this, 'checkPermission' ],
],
]
'callback' => array( $this, 'destroyStaging' ),
'permission_callback' => array( $this, 'checkPermission' ),
),
)
);

register_rest_route(
$this->namespace,
'/staging/clone',
[
[
array(
array(
'methods' => \WP_REST_Server::EDITABLE,
'callback' => [ $this, 'cloneProductionToStaging' ],
'permission_callback' => [ $this, 'checkPermission' ],
],
]
'callback' => array( $this, 'cloneProductionToStaging' ),
'permission_callback' => array( $this, 'checkPermission' ),
),
)
);

register_rest_route(
$this->namespace,
'/staging/deploy',
[
[
array(
array(
'methods' => \WP_REST_Server::EDITABLE,
'callback' => [ $this, 'deployToProduction' ],
'permission_callback' => [ $this, 'checkPermission' ],
'args' => [
'type' => [
'callback' => array( $this, 'deployToProduction' ),
'permission_callback' => array( $this, 'checkPermission' ),
'args' => array(
'type' => array(
'default' => 'all',
'enum' => [ 'all', 'db', 'files' ],
'enum' => array( 'all', 'db', 'files' ),
'validate_callback' => function ( $value ) {
return in_array( $value, [ 'all', 'db', 'files' ], true );
return in_array( $value, array( 'all', 'db', 'files' ), true );
},
],
],
],
]
),
),
),
)
);

register_rest_route(
$this->namespace,
'/staging/switch-to',
[
[
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => [ $this, 'switchTo' ],
'permission_callback' => [ $this, 'checkPermission' ],
'args' => [
'env' => [
'callback' => array( $this, 'switchTo' ),
'permission_callback' => array( $this, 'checkPermission' ),
'args' => array(
'env' => array(
'required' => true,
'enum' => [ 'staging', 'production' ],
'enum' => array( 'staging', 'production' ),
'validate_callback' => function ( $value ) {
return in_array( $value, [ 'staging', 'production' ], true );
return in_array( $value, array( 'staging', 'production' ), true );
},
],
],
],
]
),
),
),
)
);

}
Expand All @@ -131,7 +131,7 @@ public function createStaging() {
$payload = $this->staging->createStaging();
if ( ! is_wp_error( $payload ) ) {
$this->staging->getConfig( false );
$payload = [
$payload = array(
'creationDate' => $this->staging->getCreationDate(),
'currentEnvironment' => $this->staging->getEnvironment(),
'message' => $payload['message'],
Expand All @@ -143,7 +143,7 @@ public function createStaging() {
'stagingThumbnailUrl' => $this->staging->getStagingScreenshotUrl(),
'stagingUrl' => $this->staging->getStagingUrl(),
'status' => $payload['status'],
];
);
}

return rest_ensure_response( $payload );
Expand Down Expand Up @@ -185,7 +185,7 @@ public function destroyStaging() {
*/
public function getStagingDetails() {
return rest_ensure_response(
[
array(
'creationDate' => $this->staging->getCreationDate(),
'currentEnvironment' => $this->staging->getEnvironment(),
'productionDir' => $this->staging->getProductionDir(),
Expand All @@ -195,7 +195,7 @@ public function getStagingDetails() {
'stagingExists' => $this->staging->stagingExists(),
'stagingThumbnailUrl' => $this->staging->getStagingScreenshotUrl(),
'stagingUrl' => $this->staging->getStagingUrl(),
]
)
);
}

Expand Down
Loading

0 comments on commit aeeb968

Please sign in to comment.