本文整理汇总了PHP中is_local函数的典型用法代码示例。如果您正苦于以下问题:PHP is_local函数的具体用法?PHP is_local怎么用?PHP is_local使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_local函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_js
function add_js($script = '')
{
/*
* if the paramter an array then pass
* each element to the array again .
* */
if (is_array($script)) {
foreach ($script as $item) {
add_js($item);
}
} else {
/* get full URL if script path
* is local script
* */
$script = trim($script);
$CI =& get_instance();
if (is_local($script)) {
$script = base_url() . $script;
}
// push script to vunsy JS array .
if (!in_array($script, $CI->vunsy->js)) {
array_push($CI->vunsy->js, $script);
}
}
}
示例2: testIsLocal
public function testIsLocal()
{
// arrange
$env = 'api-local';
// act
$result = is_local($env);
// assert
$this->assertEquals(true, $result);
}
示例3: handler
/**
* Exception handler.
*
* @return void
*/
public static final function handler()
{
return function (\Throwable $e) {
// if not local no error display (so set & store option)
if (!is_local()) {
set_global('display_errors', ini_set('display_errors', '0'));
}
// will be catched in shutdown handler
throw $e;
};
}
示例4: remove_cms_from_admin_url
/**
* Force Wordpress to know when a user is logged in or anonymous and
* accommodate the correct SSL and proxying.
*/
function remove_cms_from_admin_url($url, $forced = false)
{
global $blog_id;
if (!is_local() && !is_admin() && empty($_SERVER['REMOTE_USER']) && $blog_id != 1 && !preg_match('/\\b(wp-admin|wp-login|\\/login)\\b/i', $_SERVER['REQUEST_URI']) && !is_user_logged_in() || $forced) {
$url = str_replace('.edu/cms/', '.edu/', $url);
$url = str_replace('https:', 'http:', $url);
// relative urls
if (strpos($url, 'http') === false) {
$url = str_replace('/cms/', '/', $url);
}
}
return $url;
}
示例5: add_js
function add_js($script = '')
{
if (is_array($script)) {
foreach ($script as $item) {
add_js($item);
}
} else {
$CI =& get_instance();
if (is_local($script)) {
$script = base_url() . $script;
}
if (!in_array($script, $CI->vunsy->js)) {
array_push($CI->vunsy->js, $script);
}
}
}
示例6: ps_ax
function ps_ax($server)
{
if (empty($server) || is_local($server)) {
$data = shell_exec("ps axo user:30,pid,args");
} else {
$data = shell_exec("ssh {$server} ps axo user:30,pid,args");
}
$results = array();
foreach (explode("\n", trim($data)) as $line) {
$result = array();
$result['user'] = trim(substr($line, 0, 30));
$result['pid'] = intval(substr($line, 30, 35));
$result['cmd'] = trim(substr($line, 36));
$results[] = $result;
}
return $results;
}
示例7: _view
function _view($page_name)
{
// this is only used internally
$page = $this->Page->get_by_name($page_name);
if (!$page) {
return $this->_form("Unknown page: {$page_name}");
}
$feed = $this->Feed->get($page->feed_id);
$feed_url = $feed->feed_url;
// allow dynamic feed URLs
if ($feed->id == 0) {
if ($feed_url = $this->input->post('ext_feed_url')) {
set_cookie(array('name' => 'ext_feed_url', 'value' => $feed_url, 'expire' => $this->config->item('cookie_lifetime')));
} elseif (!($feed_url = $this->input->cookie('ext_feed_url'))) {
$feed_url = 'http://feedvolley.com/recent';
}
}
$html = $this->Page->get_html($page->id);
$rss = $this->Feed->load($feed_url);
$this->load->library('Tparser');
$this->load->library('ThemeParser');
$this->load->helper('edit_bar');
$output = $this->themeparser->render($rss, $html, $page->title);
// insert edit/duplicate bar
$output = preg_replace('/(<body.*?>)/msi', '$1 ' . edit_bar($page, $this->User->has_code($page->admin_code)), $output);
$output = preg_replace('/(<\\/body.*?>)/msi', google_analytics() . '$1', $output);
// if local request --- this is currently pointless until a better is_local() is created
if (is_local() && stripos($output, '<body>') === false) {
$output = edit_bar($page, $this->User->has_code($page->admin_code)) . $output;
}
// echo $output;
// using a view, to enable caching
$data['content'] = $output;
$this->load->view('pages/render_page', $data);
if (!$this->User->has_code($page->admin_code)) {
$this->output->cache(3);
}
}
示例8: __construct
/**
* Constructor.
*/
private final function __construct(array $options = [])
{
// merge options
$this->options = array_merge($this->options, $options);
// store name
$this->name = $this->options['name'];
// check length
if (!in_array($this->options['length'], $this->options['length_available'])) {
$this->options['length'] = $this->options['length_default'];
}
// session is active?
if (!$this->isStarted || session_status() != PHP_SESSION_ACTIVE) {
// use hex hash
// ini_set('session.session.hash_function', 1);
// ini_set('session.hash_bits_per_character', 4);
// if save path provided @tmp?
if (is_local() && isset($this->options['save_path'])) {
if (!is_dir($this->options['save_path'])) {
mkdir($this->options['save_path'], 0777, true);
chmod($this->options['save_path'], 0777);
}
ini_set('session.save_path', $this->options['save_path']);
// set perms
foreach (glob($this->options['save_path'] . '/*') as $file) {
chmod($file, 0777);
}
}
// set defaults
session_set_cookie_params((int) $this->options['lifetime'], (string) $this->options['path'], (string) $this->options['domain'], (bool) $this->options['secure'], (bool) $this->options['httponly']);
// set session name
session_name($this->name);
// reset session data and start session
$this->reset();
$this->start();
}
}
示例9: getConfig
public static function getConfig()
{
return array('host' => (is_local() ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'], 'path' => '/auth/', 'debug' => false, 'callback_url' => '/auth/callback/', 'security_salt' => self::SECURITY_SALT, 'security_timeout' => '5 minutes', 'Strategy' => array('Facebook' => array('app_id' => FACEBOOK_APP_ID, 'app_secret' => FACEBOOK_APP_SECRET, 'scope' => 'email,user_friends', 'redirect_uri' => '{host}{path}?param=facebook&action=int_callback'), 'VKontakte' => array('app_id' => VK_APP_ID, 'app_secret' => VK_APP_SECRET, 'scope' => 'friends,email', 'redirect_uri' => '{host}{path}?param=vkontakte&action=int_callback'), 'Odnoklassniki' => array('app_id' => ODNOKLASSNIKI_APP_ID, 'app_public' => ODNOKLASSNIKI_APP_PUBLIC, 'app_secret' => ODNOKLASSNIKI_APP_SECRET, 'redirect_uri' => '{host}{path}?param=odnoklassniki&action=int_callback')));
}
示例10: HTTP_Get
<?php
/**
* Created by PhpStorm.
* User: william mcmillian
* Date: 7/12/15
* Time: 8:49 AM
*/
include './header.php';
$newTopicUrl = 'http://boards.endoftheinter.net/postmsg.php?tag=' . $request->tag;
$newTopicPage = HTTP_Get($newTopicUrl, $_SESSION['eticookie']);
if (is_local()) {
$newTopicPage = file_get_contents('../test_data/test_new_topic.html');
}
$doc = new DOMDocument();
@$doc->loadHTML($newTopicPage);
$signature = $doc->getElementsByTagName('textarea')->item(1)->nodeValue;
$hiddenValue = $doc->getElementsByTagName('input')->item(2)->getAttribute('value');
$messageBody = $request->message;
$fields = array('title' => urlencode($request->title), 'message' => urlencode($messageBody . "\n" . $signature), 'h' => urlencode($hiddenValue), 'tag' => urlencode($request->tag), 'submit' => urlencode('Post Message'));
$newTopicUrl = 'http://boards.endoftheinter.net/postmsg.php';
$newTopic = HTTP_Post($newTopicUrl, $fields);
preg_match('~Location:.*?topic=(\\d+)~su', $newTopic, $topicIdMatch);
$newTopicId = $topicIdMatch[1];
if (is_local()) {
$newTopicId = '98765';
}
$result = array();
$result['topicId'] = $newTopicId;
echo json_encode($result);
示例11: fixAttachUrl
function fixAttachUrl($url)
{
if (is_local()) {
return str_replace('//', '/', getRootUrl() . $url);
//防止双斜杠的出现
} else {
return $url;
}
}
示例12: switch
#
#
#
#
#
#
# Get settings
require "../settings.php";
require "../core-settings.php";
require "../libs/ext.lib.php";
if (isset($_POST["key"])) {
switch ($_POST["key"]) {
case "method":
if (strlen($_POST["accnum"]) == 0) {
# redirect if not local supplier
if (!is_local("customers", "cusnum", $_POST["cusid"])) {
// print "SpaceBar";
header("Location: bank-recpt-inv-int.php?cusid={$_POST['cusid']}");
exit;
}
}
$OUTPUT = method($_POST["cusid"]);
break;
case "alloc":
$OUTPUT = alloc($_POST);
break;
case "confirm":
$OUTPUT = confirm($_POST);
break;
case "write":
$OUTPUT = write($_POST);
示例13: _fatal
function _fatal($code = 404, $errfile = '', $errline = '', $errmsg = '', $errno = 0)
{
sql_close();
switch ($code)
{
case 504:
echo '<b>PHP Notice</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $errmsg . '</b><br>';
break;
case 505:
echo '<b>Another Error</b>: in file <b>' . basename($errfile) . '</b> on line <b>' . $errline . '</b>: <b>' . $errmsg . '</b><br>';
break;
case 506:
die('USER_ERROR: ' . $errmsg);
break;
default:
$error_path = './style/server-error/%s.htm';
switch ($errno)
{
case 2: $filepath = sprintf($error_path, 'no' . $errno); break;
default: $filepath = sprintf($error_path, $code); break;
}
if (!@file_exists($filepath))
{
$filepath = sprintf($error_path, 'default');
}
$v_host = get_protocol() . get_host();
// MySQL error
if ($code == 507)
{
global $core;
if (is_array($errmsg) && isset($errmsg['sql'])) {
$errmsg = $errmsg['sql'];
}
$e_mysql = explode('///', $errmsg);
$i_errmsg = str_replace(array("\n", "\t"), array('<br>', ' '), implode('<br><br>', $e_mysql));
$v_time = @date('r', time());
$mail_extra = "From: info@nopticon.com\n" . "Return-Path: info@nopticon.com\nMessage-ID: <" . md5(uniqid(time())) . "@nopticon.com>\nMIME-Version: 1.0\nContent-type: text/html; charset=ISO-8859-1\nContent-transfer-encoding: 8bit\nDate: " . $v_time . "\nX-Priority: 2\nX-MSMail-Priority: High\n";
$mail_to = (!empty($_SERVER['SERVER_ADMIN'])) ? $_SERVER['SERVER_ADMIN'] : 'mysql@nopticon.com';
$mail_result = @mail($mail_to, 'MySQL: Error', preg_replace("#(?<!\r)\n#s", "\n", _page() . '<br />' . $v_time . '<br /><br />' . $i_errmsg), $mail_extra, '-finfo@nopticon.com');
$errmsg = (is_local()) ? '<br><br>' . $i_errmsg : '';
}
$repl = array(
array('{ERROR_LINE}', '{ERROR_FILE}', '{ERROR_MSG}', '{HTTP_HOST}', '{REQUEST_URL}'),
array($errline, $errfile, $errmsg, $v_host . str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']), $_SERVER['REQUEST_URI'])
);
header("HTTP/1.1 404 Not Found");
header("Status: 404 Not Found");
echo str_replace($repl[0], $repl[1], implode('', @file($filepath)));
exit();
break;
}
return;
}
示例14: loader_not_installed
function loader_not_installed()
{
$loader = get_loaderinfo();
$sysinfo = get_sysinfo();
$stype = get_request_parameter('stype');
$manual_select = get_request_parameter('manual');
if (!isset($stype)) {
echo '<p>To use files that have been protected by the <a href="' . ENCODER_URL . '" target=encoder>ionCube PHP Encoder</a>, a component called the ionCube Loader must be installed.</p>';
}
if (!is_array($loader)) {
if ($loader == ERROR_WINDOWS_64_BIT) {
echo '<p>Loaders for 64-bit PHP on Windows are not currently available. However, if you <b>install and run 32-bit PHP</b> the corresponding 32-bit Loader for Windows should work.</p>';
if ($sysinfo['THREAD_SAFE']) {
echo '<li>Download one of the following archives of 32-bit Windows x86 Loaders:';
$basename = LOADERS_PACKAGE_PREFIX . 'win_x86';
} else {
$basename = LOADERS_PACKAGE_PREFIX . 'win_nonts_x86';
echo '<li>Download one of the following archives of 32-bit Windows non-TS x86 Loaders:';
}
echo make_archive_list($basename);
} else {
echo '<p>There may not be a Loader available for your type of system at the moment, however if you create a <a href="' . SUPPORT_SITE . '">support ticket</a> more advice and information may be available to assist. Please include the URL for this Wizard in your ticket.</p>';
}
} else {
if (!is_supported_php_version()) {
echo '<p>Your server is running PHP version ' . PHP_VERSION . ' and is
unsupported by ionCube Loaders. Recommended PHP 4 versions are PHP 4.2 or higher,
and PHP 5.1 or higher for PHP 5.</p>';
} elseif (!$sysinfo['SUPPORTED_COMPILER']) {
$supported_compilers = supported_win_compilers();
$supported_compiler_string = join('/', $supported_compilers);
echo '<p>At the current time the ionCube Loader requires PHP to be built with ' . $supported_compiler_string . '. Your PHP software has been built using ' . $sysinfo['PHP_COMPILER'] . '. Supported builds of PHP are available from <a href="http://windows.php.net/download/">PHP.net</a>.';
} else {
if (!in_array($stype, array('s', 'd', 'l'))) {
if (!$manual_select && is_local()) {
local_install();
} elseif (!$manual_select && !is_possibly_dedicated_or_local()) {
shared_server();
} else {
echo server_selection_form();
}
} else {
switch ($stype) {
case 's':
shared_server();
break;
case 'd':
dedicated_server();
break;
case 'l':
local_install();
break;
}
}
}
}
}
示例15: html_compress
/**
* Compress.
* @param string $input
* @return string
*/
function html_compress(string $input = null) : string
{
if ($input === null) {
return '';
}
// scripts
$input = preg_replace_callback('~(<script>(.*?)</script>)~sm', function ($match) {
$input = trim($match[2]);
// line comments (protect http:// etc)
if (is_local()) {
$input = preg_replace('~(^|[^:])//([^\\r\\n]+)$~sm', '', $input);
} else {
$input = preg_replace('~(^|[^:])//.*?[\\r\\n]$~sm', '', $input);
}
// doc comments
preg_match_all('~\\s*/[\\*]+(?:.*?)[\\*]/\\s*~sm', $input, $matchAll);
foreach ($matchAll as $key => $value) {
$input = str_replace($value, "\n\n", $input);
}
return sprintf('<script>%s</script>', trim($input));
}, $input);
// remove comments
$input = preg_replace('~<!--[^-]\\s*(.*?)\\s*[^-]-->~sm', '', $input);
// remove tabs
$input = preg_replace('~^[\\t ]+~sm', '', $input);
// remove tag spaces
$input = preg_replace('~>\\s+<(/?)([\\w\\d-]+)~sm', '><\\1\\2', $input);
// textarea \n problem
$textareaTpl = '%{{{TEXTAREA}}}';
$textareaCount = preg_match_all('~(<textarea(.*?)>(.*?)</textarea>)~sm', $input, $matchAll);
// fix textareas
if ($textareaCount) {
foreach ($matchAll[0] as $match) {
$input = str_replace($match, $textareaTpl, $input);
}
}
// reduce white spaces
$input = preg_replace('~\\s+~', ' ', $input);
// fix textareas
if ($textareaCount) {
foreach ($matchAll[0] as $match) {
$input = preg_replace("~{$textareaTpl}~", $match, $input, 1);
}
}
return trim($input);
}