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/wp-conte.../plugins/sitepres.../classes/options
File: class-wpml-option-manager.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* @author OnTheGo Systems
[2] Fix | Delete
*/
[3] Fix | Delete
[4] Fix | Delete
namespace WPML\WP;
[5] Fix | Delete
[6] Fix | Delete
class OptionManager implements \IWPML_Backend_Action {
[7] Fix | Delete
[8] Fix | Delete
private $group_keys_key = 'WPML_Group_Keys';
[9] Fix | Delete
[10] Fix | Delete
public function add_hooks() {
[11] Fix | Delete
add_filter( 'wpml_reset_options', array( $this, 'reset_options' ) );
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Get a WordPress option that is stored by group.
[16] Fix | Delete
*
[17] Fix | Delete
* @param string $group
[18] Fix | Delete
* @param string $key
[19] Fix | Delete
* @param mixed $default
[20] Fix | Delete
*
[21] Fix | Delete
* @return mixed
[22] Fix | Delete
*/
[23] Fix | Delete
public function get( $group, $key, $default = false ) {
[24] Fix | Delete
$data = get_option( $this->get_key( $group ), array() );
[25] Fix | Delete
return isset( $data[ $key ] ) ? $data[ $key ] : $default;
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Save a WordPress option that is stored by group
[30] Fix | Delete
* The value is then stored by key in the group.
[31] Fix | Delete
*
[32] Fix | Delete
* eg. set( 'TM-wizard', 'complete', 'true' ) will create or add to the option WPML(TM-wizard)
[33] Fix | Delete
* The dat in the option will then be an array of items stored by key.
[34] Fix | Delete
*
[35] Fix | Delete
* @param string $group
[36] Fix | Delete
* @param string $key
[37] Fix | Delete
* @param mixed $value
[38] Fix | Delete
* @param bool $autoload
[39] Fix | Delete
*/
[40] Fix | Delete
public function set( $group, $key, $value, $autoload = true ) {
[41] Fix | Delete
$group_key = $this->get_key( $group );
[42] Fix | Delete
[43] Fix | Delete
$data = get_option( $group_key, array() );
[44] Fix | Delete
$data[ $key ] = $value;
[45] Fix | Delete
update_option( $group_key, $data, $autoload );
[46] Fix | Delete
[47] Fix | Delete
$this->store_group_key( $group_key );
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
/**
[51] Fix | Delete
* @param string $group
[52] Fix | Delete
*
[53] Fix | Delete
* @return string
[54] Fix | Delete
*/
[55] Fix | Delete
private function get_key( $group ) {
[56] Fix | Delete
return 'WPML(' . $group . ')';
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
/**
[60] Fix | Delete
* @param $group_key
[61] Fix | Delete
*/
[62] Fix | Delete
private function store_group_key( $group_key ) {
[63] Fix | Delete
$group_keys = get_option( $this->group_keys_key, array() );
[64] Fix | Delete
$group_keys[] = $group_key;
[65] Fix | Delete
update_option( $this->group_keys_key, array_unique( $group_keys ) );
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
/**
[69] Fix | Delete
* Returns all the options that need to be deleted on WPML reset.
[70] Fix | Delete
*
[71] Fix | Delete
* @param array $options
[72] Fix | Delete
*
[73] Fix | Delete
* @return array
[74] Fix | Delete
*/
[75] Fix | Delete
public function reset_options( $options ) {
[76] Fix | Delete
$options[] = $this->group_keys_key;
[77] Fix | Delete
return array_merge( $options, get_option( $this->group_keys_key, array() ) );
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function