: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
public function field_after() {
public function field_classes( $args, $class = null ) {
'pum-field-' . $args['id'],
'pum-field-' . $args['type'],
if ( '' !== $args['doclink'] ) {
$classes[] = 'pum-field--has-doclink';
$classes[] = is_array( $args['class'] ) ? implode( ' ', $args['class'] ) : $args['class'];
$classes[] = is_array( $class ) ? implode( ' ', $class ) : $class;
return implode( ' ', $classes );
public function field_description( $args ) {
if ( '' !== $args['desc'] ) {
<p class="pum-desc"><?php echo esc_html( $args['desc'] ); ?></p>
if ( $args['doclink'] != '' ) { ?>
<a href="<?php echo esc_url( $args['doclink'] ); ?>" target="_blank" class="pum-doclink dashicons dashicons-editor-help"></a><?php
public function field_label( $args ) {
if ( ! empty( $args['label'] ) ) {
<label for="<?php echo esc_attr( $args['id'] ); ?>">
echo esc_html( $args['label'] );
if ( '' !== $args['doclink'] ) {
<a href="<?php echo esc_url( $args['doclink'] ); ?>" target="_blank" class="pum-doclink dashicons dashicons-editor-help"></a>
public function sanitize_field( $args, $value = null ) {
// If no type default to text.
$type = ! empty( $args['type'] ) ? $args['type'] : 'text';
* Check if any actions hooked to this type of field and load run those.
if ( has_filter( "pum_{$type}_sanitize" ) ) {
$value = apply_filters( "pum_{$type}_sanitize", $value, $args );
* Check if override or custom function exists and load that.
if ( function_exists( "pum_{$type}_sanitize" ) ) {
$function_name = "pum_{$type}_sanitize";
* Check if core method exists and load that.
*/ elseif ( method_exists( $this, $type . '_sanitize' ) ) {
$function_name = [ $this, $type . '_sanitize' ];
* Call the determined method, passing the field args & $value to the callback.
$value = call_user_func_array( $function_name, [ $value, $args ] );
$value = apply_filters( 'pum_settings_sanitize', $value, $args );
* @return array|mixed $input Sanitized value
* @internal param array $input The value inputted in the field
public function sanitize_fields( $values = [] ) {
foreach ( $this->get_all_fields() as $section => $fields ) {
foreach ( $fields as $field ) {
$value = isset( $values[ $section ][ $field['id'] ] ) ? $values[ $section ][ $field['id'] ] : null;
$value = $this->sanitize_field( $field, $value );
if ( ! is_null( $value ) ) {
$sanitized_values[ $section ][ $field['id'] ] = $value;
return $sanitized_values;
* Sort array by priority value
protected function sort_by_priority( $a, $b ) {
if ( ! isset( $a['priority'] ) || ! isset( $b['priority'] ) || $a['priority'] === $b['priority'] ) {
return ( $a['priority'] < $b['priority'] ) ? - 1 : 1;
public function checkbox_sanitize( $value = null, $args = [] ) {
if ( intval( $value ) === 1 ) {
* Adds a do_action() hook in place of the field
* @param array $args Arguments passed by the setting
public function hook_callback( $args ) {
do_action( 'popmake_' . $args['id'] );