PHP code example of rarst / wps

1. Go to this page and download the library: Download rarst/wps library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rarst / wps example snippets


global $wps;

// Silence notices and warnings for any path. 
$wps['run']->silenceErrorsInPaths( '~.*~', E_NOTICE | E_WARNING );

// Silence for specific directory.
$wps['run']->silenceErrorsInPaths( '~/wp-admin/~', E_NOTICE | E_WARNING );

// Silence _except_ specific directory.
$wps['run']->silenceErrorsInPaths( '~^((?!/my-plugin/).)*$~', E_NOTICE | E_WARNING );

// Silence for plugins _except_ specific plugin.
$wps['run']->silenceErrorsInPaths( '~/wp-content/plugins/(?!my-plugin)~', E_NOTICE | E_WARNING );