Skip to content

Commit

Permalink
fixing linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ramyakrishnai committed Apr 24, 2024
1 parent fb8055d commit 29fd1ef
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 8 deletions.
50 changes: 50 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "main"
allow:
- dependency-type: direct
schedule:
interval: "daily"
commit-message:
prefix: "GitHub Actions"
include: "scope"
labels:
- "dependencies"

# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/"
target-branch: "main"
allow:
- dependency-type: direct
schedule:
interval: "daily"
versioning-strategy: increase
commit-message:
prefix: "NPM"
prefix-development: "NPM Dev"
include: "scope"
labels:
- "dependencies"
- "javascript"

# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
target-branch: "main"
schedule:
interval: "daily"
allow:
- dependency-type: direct
versioning-strategy: increase
commit-message:
prefix: "Composer"
prefix-development: "Composer Dev"
include: "scope"
labels:
- "dependencies"
- "php"
7 changes: 7 additions & 0 deletions includes/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class Migration {
protected $container;

/**
* To create insta service instance
*
* @var insta_service
*/
protected $insta_service;
Expand All @@ -30,6 +32,11 @@ class Migration {
'NewfoldLabs\\WP\\Module\\Migration\\RestApi\\MigrateController',
);

/**
* Migration constructor.
*
* @param Container $container Container loaded from the brand plugin.
*/
public function __construct( Container $container ) {
$this->container = $container;
$this->insta_service = new InstaMigrateService();
Expand Down
37 changes: 31 additions & 6 deletions includes/RestApi/MigrateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,30 @@

use NewfoldLabs\WP\Module\Migration\Services\InstaMigrateService;


/**
* Class MigrateController
*/
class MigrateController {


/**
* REST namespace
*
* @var string
*/
protected $namespace = 'newfold-migration/v1';

/**
* REST base
*
* @var string
*/
protected $rest_base = '/migrate';

/**
* Registers rest routes for MigrateController.
*
* @return void
*/
public function register_routes() {
register_rest_route(
$this->namespace,
Expand All @@ -20,22 +36,31 @@ public function register_routes() {
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array( $this, 'connectInstawp' ),
'permission_callback' => array($this, 'rest_is_authorized_admin')
'permission_callback' => array( $this, 'rest_is_authorized_admin' ),
),
)
);
}

/**
* Initiates the connnection with instawp plugin
*
* @return array
*/
public function connectInstawp() {
$instaService = new InstaMigrateService();
$response = $instaService->InstallInstaWpConnect();

return $response;
}

public static function rest_is_authorized_admin()
{
/**
* Confirm REST API caller has ADMIN user capabilities.
*
* @return boolean
*/
public static function rest_is_authorized_admin() {
$admin = 'manage_options';
return \is_user_logged_in() && \current_user_can($admin);
return \is_user_logged_in() && \current_user_can( $admin );
}
}
4 changes: 2 additions & 2 deletions includes/Services/InstaMigrateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use InstaWP\Connect\Helpers\Installer;

/**
* InstaWP migrate service
* Class InstaMigrateService
*/
class InstaMigrateService {

Expand All @@ -17,7 +17,7 @@ class InstaMigrateService {
private $connect_plugin_slug = 'instawp-connect';

/**
* Set required api keys for insta to start the migration
* Set required api keys for insta to initiate the migration
*/
function __construct() {
Helper::set_api_domain( INSTAWP_API_DOMAIN );
Expand Down

0 comments on commit 29fd1ef

Please sign in to comment.