Skip to content

Commit

Permalink
Merge pull request #353 from weMail/hotfix/remove-deprecated-stringy-…
Browse files Browse the repository at this point in the history
…plugin

Remove stringy deprecated library.
  • Loading branch information
sumaisa-mou authored May 21, 2024
2 parents 05bb2f3 + 346624a commit 8bb0644
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 166 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"require": {
"php": ">=5.5",
"league/csv": "^7.2",
"danielstjules/stringy": "~3.1.0",
"appsero/client": "^1.1"
},
"require-dev": {
Expand Down
230 changes: 85 additions & 145 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions includes/Core/Api/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace WeDevs\WeMail\Core\Api;

use Stringy\StaticStringy;
use WeDevs\WeMail\Traits\Stringy;
use WP_Error;
use WeDevs\WeMail\Traits\Hooker;
use WeDevs\WeMail\Traits\Singleton;

class Api {

use Singleton;
use Singleton, Stringy;

use Hooker;

Expand Down Expand Up @@ -124,7 +124,7 @@ public function has_api_key() {
*/
public function __call( $name, $args ) {
if ( ! method_exists( $this, $name ) ) {
$this->url .= '/' . StaticStringy::dasherize( $name );
$this->url .= '/' . $this->dasherize( $name );

if ( $args ) {
$this->url .= '/' . array_pop( $args );
Expand Down
5 changes: 3 additions & 2 deletions includes/Core/Form/Integrations/AbstractIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace WeDevs\WeMail\Core\Form\Integrations;

use Stringy\StaticStringy;
use WeDevs\WeMail\Traits\Stringy;
use WP_Error;

abstract class AbstractIntegration {
use Stringy;

/**
* Hold the value if plugin active or not
Expand Down Expand Up @@ -112,7 +113,7 @@ public function save( $data ) {
$form_ids[] = $form_id;
}

$response = wemail()->api->forms()->integrations( StaticStringy::dasherize( $this->slug ) )->post( $settings );
$response = wemail()->api->forms()->integrations( $this->dasherize( $this->slug ) )->post( $settings );

if ( is_wp_error( $response ) ) {
return $response;
Expand Down
9 changes: 5 additions & 4 deletions includes/Core/Form/Integrations/Rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace WeDevs\WeMail\Core\Form\Integrations;

use Stringy\StaticStringy;
use WeDevs\WeMail\RestController;
use WeDevs\WeMail\Traits\Stringy;

class Rest extends RestController {
use Stringy;

/**
* REST Base
Expand Down Expand Up @@ -35,12 +36,12 @@ class Rest extends RestController {
* @return void|object
*/
public function __get( $prop ) {
$integration = StaticStringy::underscored( $prop );
$integration = $this->underscored( $prop );

if ( array_key_exists( $integration, $this->integrations ) ) {
return $this->integrations[ $integration ];
} elseif ( array_key_exists( $integration, wemail()->form->integrations() ) ) {
$class_name = StaticStringy::upperCamelize( $integration );
$class_name = $this->upperCamelize( $integration );
$integration_class = "\\WeDevs\\WeMail\\Core\\Form\\Integrations\\$class_name";
if ( class_exists( $integration_class ) ) {
$this->integrations[ $integration ] = $integration_class::instance();
Expand Down Expand Up @@ -114,7 +115,7 @@ public function forms( $request ) {
*/
public function save( $request ) {
$integration = $request->get_param( 'name' );
$integration = StaticStringy::underscored( $integration );
$integration = $this->underscored( $integration );

if ( ! $this->$integration->is_active ) {
return $this->$integration->inactivity_message();
Expand Down
1 change: 0 additions & 1 deletion includes/Core/Import/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace WeDevs\WeMail\Core\Import;

use Stringy\StaticStringy;
use WeDevs\WeMail\Traits\Singleton;

class Import {
Expand Down
6 changes: 3 additions & 3 deletions includes/Core/Settings/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace WeDevs\WeMail\Core\Settings;

use Stringy\StaticStringy;
use WeDevs\WeMail\Traits\Core;
use WeDevs\WeMail\Traits\Stringy;

class Settings {

use Core;
use Core, Stringy;

/**
* Get site settings
Expand All @@ -19,7 +19,7 @@ class Settings {
* @return array|string
*/
public function get( $name ) {
$name = StaticStringy::underscored( $name );
$name = $this->underscored( $name );

$settings = wemail()->api->settings()->$name()->get();

Expand Down
Loading

0 comments on commit 8bb0644

Please sign in to comment.