Error when setting constants
-
PHP Warning: include_once(): Failed opening '/classes/class.rslib.php' for inclusion (include_path='.;C:\php\pear\') in on line 26
I logged this error in the log, debug and found the only file that makes this include. At the time of debugging everything worked correctly, but still do not know the cause of the error.
Apparently at some point
dirname(__FILE__)
He returned null. There is an alternativedirname(_FILE__)
?<?php
/* * Redsand Wordpress Library * Version: 2.1.4 * Modify: 12/29/2014 * Author: RedSand Team * */ session_start(); /// CONST //\ define('RS_LIB_PATH', dirname(__FILE__)); define('RS_LIB_URL', strpos(RS_LIB_PATH, 'wp-content/plugins') > 0 ? plugins_url('rslib', RS_LIB_PATH) : get_stylesheet_directory_uri() . '/rslib'); define('RS_META_KEY_PREFIX', 'rs-'); define('RS_NOT_SET', '__RS_NOT_SET__'); define('LANGUAGES_PATH', get_template_directory() . '/languages'); define('RS_VERSION', '2.1.4'); /// RS CLASS /// if (version_compare(PHP_VERSION, '5.3.0') >= 0) { include_once(RS_LIB_PATH . '/classes/class.rslib.php'); global $RS; $RS = new RS(); $RS->init(); } else{ wp_die('Sorry, Your site only run with PHP 5.3.0 or higher but current PHP version is '. PHP_VERSION . '.<br/>Please contact system administrator to upgrade it.'); }
-
Try this:
define('RS_LIB_PATH', __DIR__);