Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/ninja-fo.../includes/Admin/Menus
File: Licenses.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Class NF_Admin_Menus_Licenses
[3] Fix | Delete
*/
[4] Fix | Delete
final class NF_Admin_Menus_Licenses
[5] Fix | Delete
{
[6] Fix | Delete
private $licenses = array();
[7] Fix | Delete
[8] Fix | Delete
public function __construct()
[9] Fix | Delete
{
[10] Fix | Delete
add_action( 'admin_init', array( $this, 'register_licenses' ), 10 );
[11] Fix | Delete
add_action( 'admin_init', array( $this, 'submit_listener' ), 11 );
[12] Fix | Delete
add_action( 'admin_init', array( $this, 'add_meta_boxes' ), 12 );
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
public function submit_listener()
[16] Fix | Delete
{
[17] Fix | Delete
if( ! current_user_can( apply_filters( 'ninja_forms_admin_license_update_capabilities', 'manage_options' ) ) ) return;
[18] Fix | Delete
[19] Fix | Delete
if( ! isset( $_POST[ 'ninja_forms_license' ] ) || ! $_POST[ 'ninja_forms_license' ] ) return;
[20] Fix | Delete
[21] Fix | Delete
$key = sanitize_text_field( $_POST[ 'ninja_forms_license' ][ 'key' ] );
[22] Fix | Delete
$name = sanitize_text_field( $_POST[ 'ninja_forms_license' ][ 'name' ] );
[23] Fix | Delete
$action = sanitize_text_field( $_POST[ 'ninja_forms_license' ][ 'action' ] );
[24] Fix | Delete
[25] Fix | Delete
switch( $action ){
[26] Fix | Delete
case 'activate':
[27] Fix | Delete
$this->activate_license( $name, $key );
[28] Fix | Delete
break;
[29] Fix | Delete
case 'deactivate':
[30] Fix | Delete
$this->deactivate_license( $name );
[31] Fix | Delete
break;
[32] Fix | Delete
}
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
public function register_licenses()
[36] Fix | Delete
{
[37] Fix | Delete
$this->licenses = apply_filters( 'ninja_forms_settings_licenses_addons', array() );
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
public function add_meta_boxes()
[41] Fix | Delete
{
[42] Fix | Delete
add_meta_box(
[43] Fix | Delete
'nf_settings_licenses',
[44] Fix | Delete
esc_html__( 'Add-On Licenses', 'ninja-forms' ) . ' <a href="
[45] Fix | Delete
https://ninjaforms.com/docs/licensing/?utm_source=Ninja+Forms+Plugin&utm_medium=Settings&utm_campaign=Documentation&utm_content=Licensing+Documentation" target="_blank"><img src="' . Ninja_Forms::$url . 'assets/img/help_icon.png" alt="Documentation Link" width="35" height="35"></a>',
[46] Fix | Delete
array( $this, 'display' ),
[47] Fix | Delete
'nf_settings_licenses'
[48] Fix | Delete
);
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
public function display()
[52] Fix | Delete
{
[53] Fix | Delete
$data = array();
[54] Fix | Delete
foreach( $this->licenses as $license ){
[55] Fix | Delete
$data[] = array(
[56] Fix | Delete
'id' => $license->product_name,
[57] Fix | Delete
'name' => $license->product_nice_name,
[58] Fix | Delete
'version' => $license->version,
[59] Fix | Delete
'is_valid' => $license->is_valid(),
[60] Fix | Delete
'license' => $this->get_license( $license->product_name ),
[61] Fix | Delete
'error' => Ninja_Forms()->get_setting( $license->product_name . '_license_error' ),
[62] Fix | Delete
);
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
Ninja_Forms()->template( 'admin-menu-settings-licenses.html.php', array( 'licenses' => $data ) );
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
private function get_license( $name )
[69] Fix | Delete
{
[70] Fix | Delete
return Ninja_Forms()->get_setting( $name . '_license' );
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
private function activate_license( $name, $key )
[74] Fix | Delete
{
[75] Fix | Delete
foreach( $this->licenses as $license ){
[76] Fix | Delete
[77] Fix | Delete
if( $name != $license->product_name ) continue;
[78] Fix | Delete
[79] Fix | Delete
$license->activate_license( $key );
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
private function deactivate_license( $name )
[84] Fix | Delete
{
[85] Fix | Delete
foreach( $this->licenses as $license ){
[86] Fix | Delete
[87] Fix | Delete
if( $name != $license->product_name ) continue;
[88] Fix | Delete
[89] Fix | Delete
$license->deactivate_license();
[90] Fix | Delete
}
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
} // End Class NF_Admin_Menus_Licenses
[94] Fix | Delete
[95] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function