public function index() { if (isset($this->index)) { return $this->index; } if (r::cli()) { return $this->index = '/'; } else { return $this->index = url::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME')); } }
public function index() { if (isset($this->index)) { return $this->index; } // this value is used by the Panel $this->indexDetected = true; if (r::cli()) { return $this->index = '/'; } else { return $this->index = url::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME')); } }
public function index() { if (isset($this->index)) { return $this->index; } if (r::cli()) { $index = '/'; } else { $index = url::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME')); } // fix index URL for the Panel if (function_exists('panel')) { $index = dirname($index); } return $this->index = $index; }
/** * Dumps any array or object in a human readable way * * @param mixed $variable Whatever you like to inspect * @param boolean $echo * @return string */ function dump($variable, $echo = true) { if (r::cli()) { $output = print_r($variable, true) . PHP_EOL; } else { $output = '<pre>' . print_r($variable, true) . '</pre>'; } if ($echo == true) { echo $output; } return $output; }
/** * Returns the URL for document root no * matter what the path is. * * @return string */ public static function index() { if (r::cli()) { return '/'; } else { return static::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME')); } }
/** * Generates a fingerprint from the user agent string * * @return string */ public static function fingerprint() { if (!r::cli()) { return sha1($_SERVER['HTTP_USER_AGENT'] . (ip2long($_SERVER['REMOTE_ADDR']) & ip2long('255.255.0.0'))); } else { return ''; } }
/** * Generates a fingerprint from the user agent string * * @return string */ public static function fingerprint() { if (!r::cli()) { return sha1(Visitor::ua() . (ip2long($_SERVER['REMOTE_ADDR']) & ip2long('255.255.0.0'))); } else { return ''; } }
/** * Returns the proper base url for the installation * * @return string */ protected static function url() { // auto-detect the url if (empty(c::$data['url'])) { if (r::cli()) { return c::$data['url'] = '/'; } else { return c::$data['url'] = url::scheme() . '://' . server::get('HTTP_HOST') . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME')); } } else { return c::$data['url']; } }
public function testCli() { $this->assertTrue(r::cli()); }