Skip to content

Deprecated null parameter for strpos() #15

@hnccox

Description

@hnccox

Replace deprecated null values for empty strings

AuthenticationController.php
line 25
line 55

<?php

namespace WordProof\SDK\Controllers;

use WordProof\SDK\Support\Authentication;

class AuthenticationController
{
    /**
     * Triggers the authentication flow.
     *
     * @param null $redirectUrl
     */
    public function authenticate($redirectUrl = null)
    {
        return Authentication::authorize($redirectUrl);
    }

    /**
     * Adds admin page that redirects to the authentication flow.
     */
    public function addRedirectPage()
    {
        \add_submenu_page(
            '',
            'WordProof Authenticate',
            'WordProof Authenticate',
            'publish_pages',
            'wordproof-redirect-authenticate',
            [$this, 'redirectPageContent']
        );
    }

    /**
     * The content for the redirect page.
     */
    public function redirectPageContent()
    {
    }

    /**
     * Gets triggered by the 'load-admin_page_' hook of the redirect page
     */
    public function redirectOnLoad()
    {
        \do_action('wordproof_authenticate', \admin_url('admin.php?page=wordproof-close-after-redirect'));
    }

    /**
     * Adds self destruct admin page.
     */
    public function addSelfDestructPage()
    {
        \add_submenu_page(
            '',
            'WordProof After Authenticate',
            'WordProof After Authenticate',
            'publish_pages',
            'wordproof-close-after-redirect',
            [$this, 'closeOnLoadContent']
        );
    }

    /**
     * Adds a script to the loaded page to close on load.
     */
    public function closeOnLoadContent()
    {
        echo '<script type="text/javascript">';
        echo 'window.close();';
        echo '</script>';
    }
}

SettingsController.php
line 28

<?php

namespace WordProof\SDK\Controllers;

use WordProof\SDK\Support\Settings;

class SettingsController
{
    /**
     * Redirects user to the settings page. Returns false if not authenticated.
     *
     * @param null|string $redirectUrl
     * @return false
     */
    public function redirect($redirectUrl = null)
    {
        return Settings::redirect($redirectUrl);
    }

    /**
     * Adds admin page that will redirect the user to a predefined url.
     *
     * @action admin_menu
     */
    public function addRedirectPage()
    {
        \add_submenu_page(
            '',
            'WordProof Settings',
            'WordProof Settings',
            'publish_pages',
            'wordproof-redirect-settings',
            [$this, 'redirectPageContent']
        );
    }

    /**
     * The content for the redirect page. Triggered by addRedirectPage().
     */
    public function redirectPageContent()
    {
        return;
    }

    /**
     * Redirects user on admin page load to the settings page on the WordProof My.
     *
     * @action load-admin_page_settings
     */
    public function redirectOnLoad()
    {
        $closeWindowUrl = \admin_url('admin.php?page=wordproof-close-after-redirect');

        if ($this->redirect($closeWindowUrl) === false) {
            \do_action('wordproof_authenticate', $closeWindowUrl);
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions