';
echo wp_kses_post( $notice );
echo '
';
}
/**
* Init addon requirements.
*
* @since 1.8.2.2
*
* @param string $basename Addon basename.
*/
private function init_addon_requirements( $basename ) {
if ( ! array_key_exists( $basename, $this->requirements ) ) {
$this->requirements[ $basename ] = [];
}
// Set default addon version constant.
if ( array_key_exists( self::ADDON_VERSION_CONSTANT, $this->requirements[ $basename ] ) ) {
return;
}
$const = str_replace(
'-',
'_',
strtoupper( explode( '/', $basename )[0] ) . '_VERSION'
);
$this->requirements[ $basename ][ self::ADDON_VERSION_CONSTANT ] = $const;
}
/**
* Get comma-separated list string from requirements array.
*
* @since 1.8.2.2
*
* @param array $arr Array containing a list.
* @param bool $sep Separator of the last element.
*
* @return string
*/
private function list_array( $arr, $sep = true ) {
$separator = $sep ?
__( 'and', 'wpforms-lite' ) :
__( 'or', 'wpforms-lite' );
$last = array_slice( $arr, - 1 );
$first = implode( ', ', array_slice( $arr, 0, - 1 ) );
$both = array_filter( array_merge( [ $first ], $last ) );
return implode( ' ' . $separator . ' ', $both );
}
/**
* Get version from requirements array.
*
* @since 1.8.2.2
*
* @param array $arr Array containing a version.
*
* @return string
*/
private function list_version( $arr ) {
$compare = $arr[ self::COMPARE ];
$compare = $compare === '>=' ? '' : $compare . ' ';
return $compare . $arr[ self::VERSION ];
}
}