Skip to content

Commit

Permalink
fix: class references
Browse files Browse the repository at this point in the history
fixed
- class references
- warning for dynamic property
  • Loading branch information
sapayth committed Feb 1, 2024
1 parent 1130bcf commit 100c5a0
Show file tree
Hide file tree
Showing 39 changed files with 138 additions and 77 deletions.
8 changes: 4 additions & 4 deletions Lib/Appsero/Insights.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct($client, $name = null, $file = null)
/**
* Don't show the notice
*
* @return \self
* @return self
*/
public function hide_notice()
{
Expand All @@ -77,7 +77,7 @@ public function hide_notice()
/**
* Add plugin data if needed
*
* @return \self
* @return self
*/
public function add_plugin_data()
{
Expand All @@ -91,7 +91,7 @@ public function add_plugin_data()
*
* @param array $data
*
* @return \self
* @return self
*/
public function add_extra($data = [])
{
Expand All @@ -105,7 +105,7 @@ public function add_extra($data = [])
*
* @param string $text
*
* @return \self
* @return self
*/
public function notice($text = '')
{
Expand Down
5 changes: 3 additions & 2 deletions Lib/invisible_recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
*
*/

#[AllowDynamicProperties]
class Invisible_Recaptcha{

private static $_signupUrl = "https://www.google.com/recaptcha/admin";

public function __construct( $site_key, $secret_key ){

if ( $secret_key == null || $secret_key == "" ) {
die("To use reCAPTCHA you must get an API key from <a href='"
. self::$_signupUrl . "'>" . self::$_signupUrl . "</a>");
Expand All @@ -32,7 +33,7 @@ public function __construct( $site_key, $secret_key ){
);
}


public function verifyResponse($recaptcha){

$remoteIp = $this->getIPAddress();
Expand Down
8 changes: 5 additions & 3 deletions admin/class-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
/**
* WPUF settings
*/

#[AllowDynamicProperties]
class WPUF_Admin_Settings {

/**
* Settings API
*
* @var \WeDevs_Settings_API
* @var WeDevs_Settings_API
*/
private $settings_api;

/**
* Static instance of this class
*
* @var \self
* @var self
*/
private static $_instance;

/**
* Public instance of this class
*
* @var \self
* @var self
*/
public $subscribers_list_table_obj;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

<div v-if="'logged_in' === selected" class="condiotional-logic-container">

<?php $roles = get_editable_roles(); ?>
<?php use WeDevs\Wpuf\Admin\Subscription;

$roles = get_editable_roles(); ?>

<ul>
<?php
Expand All @@ -36,7 +38,7 @@
<?php

if ( class_exists( 'WPUF_Subscription' ) ) {
$subscriptions = (new \WeDevs\Wpuf\Admin\Subscription())->get_subscriptions();
$subscriptions = (new Subscription())->get_subscriptions();

if ( $subscriptions ) {
foreach ( $subscriptions as $pack ) {
Expand Down
6 changes: 4 additions & 2 deletions assets/js-templates/form-components.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<script type="text/x-template" id="tmpl-wpuf-builder-stage">
<div id="form-preview-stage" class="wpuf-style">
<h4 v-if="!form_fields.length" class="text-center">
<?php _e( 'Add fields by dragging the fields from the right sidebar to this area.', 'wp-user-frontend' ); ?>
<?php use WeDevs\Wpuf\Admin\Subscription;

_e( 'Add fields by dragging the fields from the right sidebar to this area.', 'wp-user-frontend' ); ?>
</h4>

<ul :class="['wpuf-form', 'sortable-list', 'form-label-' + label_type]">
Expand Down Expand Up @@ -396,7 +398,7 @@ class="option-chooser-radio"
<?php

if ( class_exists( 'WPUF_Subscription' ) ) {
$subscriptions = (new \WeDevs\Wpuf\Admin\Subscription())->get_subscriptions();
$subscriptions = (new Subscription())->get_subscriptions();

if ( $subscriptions ) {
foreach ( $subscriptions as $pack ) {
Expand Down
8 changes: 4 additions & 4 deletions class/subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ public function get_subscriptions( $args = [] ) {
*
* @since 2.2
*
* @param int $subscription_id
* @param \WP_Post $pack_post
* @param int $subscription_id
* @param WP_Post $pack_post
*
* @return array
*/
Expand Down Expand Up @@ -353,8 +353,8 @@ public function change_default_title( $title ) {
/**
* Save form data
*
* @param int $post_ID
* @param \WP_Post $post
* @param int $post_ID
* @param WP_Post $post
*
* @return void
*/
Expand Down
8 changes: 5 additions & 3 deletions includes/Admin/Admin_Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace WeDevs\Wpuf\Admin;

use WeDevs_Settings_API;

/**
* WPUF settings
*/
Expand All @@ -10,7 +12,7 @@ class Admin_Settings {
/**
* Settings API
*
* @var \WeDevs_Settings_API
* @var WeDevs_Settings_API
*/
private $settings_api;

Expand All @@ -27,7 +29,7 @@ public function __construct() {
wpuf_require_once( WPUF_INCLUDES . '/functions/settings-options.php' );
wpuf_require_once( WPUF_ROOT . '/Lib/WeDevs_Settings_API.php' );

$this->settings_api = new \WeDevs_Settings_API();
$this->settings_api = new WeDevs_Settings_API();
add_action( 'admin_init', [ $this, 'admin_init' ] );
}

Expand Down Expand Up @@ -173,7 +175,7 @@ public function is_admin_menu_page( $screen ) {
*
* @since 4.0.0
*
* @return \WeDevs_Settings_API
* @return WeDevs_Settings_API
*/
public function get_settings_api() {
return $this->settings_api;
Expand Down
6 changes: 4 additions & 2 deletions includes/Admin/Admin_Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace WeDevs\Wpuf\Admin;

use WP_Query;

/**
* Manage Import Export
*
Expand Down Expand Up @@ -255,7 +257,7 @@ public static function export_to_json( $post_type, $post_ids = [] ) {
'post__in' => ( !empty( $ids ) ) ? $ids : '',
];

$query = new \WP_Query( $args );
$query = new WP_Query( $args );

foreach ( $query->posts as $post ) {
$postdata = get_object_vars( $post );
Expand Down Expand Up @@ -520,7 +522,7 @@ public function check_filetype_and_ext( $info ) {
* @return void
*/
public function delete_post_type( $post_type ) {
$query = new \WP_Query(
$query = new WP_Query(
[
'post_type' => $post_type,
'posts_per_page' => -1,
Expand Down
11 changes: 7 additions & 4 deletions includes/Admin/Dashboard_Metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace WeDevs\Wpuf\Admin;

use DOMDocument;
use DomXPath;

class Dashboard_Metabox {
const URL = 'https://wedevs.com/category/user-frontend-pro';
const OPT_KEY = 'wpuf_admin_db_mb';
Expand Down Expand Up @@ -67,7 +70,7 @@ public function render_metabox() {
?>
<li><a href="<?php echo esc_url( $article['href'] ); ?>"
target="_blank"><?php echo $article['title']; ?></a></li>
<?php }; ?>
<?php } ?>
</ul>
</div>
<div class="wpuf-divider-bottom"></div>
Expand All @@ -84,7 +87,7 @@ public function render_metabox() {
target="_blank"><?php esc_html_e( $link['title'], 'wp-user-frontend' ); ?>
<span aria-hidden="true" class="dashicons dashicons-external"></span></a>
</li>
<?php }; ?>
<?php } ?>
</ul>
</div>
</div>
Expand All @@ -101,9 +104,9 @@ private function fetch_articles() {
return [];
}
$body = wp_remote_retrieve_body( $response );
$dom = new \DOMDocument();
$dom = new DOMDocument();
@$dom->loadHTML( $body );
$finder = new \DomXPath( $dom );
$finder = new DomXPath( $dom );
$classname = 'post__title';
$nodes = $finder->query( "//*[contains(concat(' ', normalize-space(@class), ' '), ' $classname ')]" );
if ( empty( $nodes ) ) {
Expand Down
3 changes: 2 additions & 1 deletion includes/Admin/Forms/Field_Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace WeDevs\Wpuf\Admin\Forms;

use WeDevs\Wpuf\Admin\Subscription;
use WeDevs\Wpuf\Fields\Field_Contract;
use WeDevs\Wpuf\Fields\Form_Field_Checkbox;
use WeDevs\Wpuf\Fields\Form_Field_Column;
use WeDevs\Wpuf\Fields\Form_Field_Dropdown;
Expand Down Expand Up @@ -66,7 +67,7 @@ public function get_fields() {
*
* @param string $field_type
*
* @return \WeDevs\Wpuf\Fields\Field_Contract
* @return Field_Contract
*/
public function get_field( $field_type ) {
$fields = $this->get_fields();
Expand Down
1 change: 1 addition & 0 deletions includes/Admin/Forms/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace WeDevs\Wpuf\Admin\Forms;

#[AllowDynamicProperties]
class Form {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace WeDevs\Wpuf\Admin\Forms\Post\Templates;

use WP_List_Table;
use WP_Query;

if ( ! class_exists( 'WP_List_Table' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
Expand Down Expand Up @@ -269,7 +270,7 @@ public function item_query( $args ) {

$args['post_type'] = 'wpuf_forms';

$query = new \WP_Query( $args );
$query = new WP_Query( $args );

$forms = [];

Expand Down
3 changes: 3 additions & 0 deletions includes/Admin/Forms/Post/Templates/Pro_Form_Preview_EDD.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?php

namespace WeDevs\Wpuf\Admin\Forms\Post\Templates;
use AllowDynamicProperties;

/**
* Easy Digital Downloads post form template preview
*/
#[AllowDynamicProperties]
class Pro_Form_Preview_EDD {
/**
* Template title
Expand Down
4 changes: 3 additions & 1 deletion includes/Admin/List_Table_Subscribers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

namespace WeDevs\Wpuf\Admin;

use WP_List_Table;

if ( ! class_exists( 'WP_List_Table' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
}

/**
* List table class
*/
class List_Table_Subscribers extends \WP_List_Table {
class List_Table_Subscribers extends WP_List_Table {

public function __construct() {
parent::__construct(
Expand Down
3 changes: 2 additions & 1 deletion includes/Admin/List_Table_Transactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
namespace WeDevs\Wpuf\Admin;

use WeDevs\Wpuf\Frontend\Payment;
use WP_List_Table;

if ( ! class_exists( 'WP_List_Table' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
}

class List_Table_Transactions extends \WP_List_Table {
class List_Table_Transactions extends WP_List_Table {

/**
* Constructor.
Expand Down
7 changes: 5 additions & 2 deletions includes/Admin/Promotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace WeDevs\Wpuf\Admin;

use DateTime;
use DateTimeZone;

/**
* Promotional offer class
*/
Expand Down Expand Up @@ -73,8 +76,8 @@ public function promotional_offer() {
* @return string
*/
public function convert_utc_to_est() {
$dt = new \DateTime( 'now', new \DateTimeZone( 'UTC' ) );
$dt->setTimezone( new \DateTimeZone( 'EST' ) );
$dt = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
$dt->setTimezone( new DateTimeZone( 'EST' ) );

return $dt->format( 'Y-m-d H:i:s T' );
}
Expand Down
5 changes: 3 additions & 2 deletions includes/Admin/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use WeDevs\Wpuf\Admin\Forms\Form;
use WeDevs\Wpuf\Traits\TaxableTrait;
use WeDevs\Wpuf\User_Subscription;
use WP_Post;

/**
* WPUF subscription manager
Expand Down Expand Up @@ -269,7 +270,7 @@ public function get_subscriptions( $args = [] ) {
* @since 2.2
*
* @param int $subscription_id
* @param \WP_Post $pack_post
* @param WP_Post $pack_post
*
* @return array
*/
Expand Down Expand Up @@ -348,7 +349,7 @@ public function change_default_title( $title ) {
* Save form data
*
* @param int $post_ID
* @param \WP_Post $post
* @param WP_Post $post
*
* @return void
*/
Expand Down
Loading

0 comments on commit 100c5a0

Please sign in to comment.