本文整理汇总了PHP中getResource函数的典型用法代码示例。如果您正苦于以下问题:PHP getResource函数的具体用法?PHP getResource怎么用?PHP getResource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getResource函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCurrentURI
/**
* @return string the requested menu item URI
*/
function getCurrentURI()
{
$menu = getResource();
if (array_key_exists($_SERVER['REQUEST_URI'], $menu)) {
return $_SERVER['REQUEST_URI'];
} else {
foreach (array_keys(getResource()) as $href) {
if (preg_match("@^/rest{$href}@", $_SERVER['REQUEST_URI'])) {
return $href;
}
}
}
return key($menu);
}
示例2: avatar
/**
* Return an image tag containing a member's avatar.
*
* @param array $member An array of the member's details. (email is required in this implementation.)
* @param string $avatarFormat The format of the member's avatar (as stored in the database - jpg|gif|png.)
* @param string $className CSS class names to apply to the avatar.
*/
function avatar($member = array(), $className = "")
{
$esoTalkDefault = getResource("core/skin/avatar.png", true);
if (empty($member["email"])) {
$url = $esoTalkDefault;
} else {
$default = C("plugin.Gravatar.default");
if (!$default or empty($member)) {
$default = $esoTalkDefault;
}
$protocol = C("esoTalk.https") ? "https" : "http";
$url = "{$protocol}://www.gravatar.com/avatar/" . md5(strtolower(trim($member["email"]))) . "?d=" . urlencode($default) . "&s=64";
}
return "<img src='{$url}' alt='' class='avatar {$className}'/>";
}
示例3: URL
?>
<a href='<?php
echo URL("admin/plugins/toggle/{$k}?token=" . ET::$session->token);
?>
' class='button toggle'><?php
echo $plugin["loaded"] ? "<i class='icon-check'></i> " . T("Enabled") : "<i class='icon-check-empty'></i> " . T("Enable");
?>
</a>
</span>
</div>
<?php
if (file_exists(PATH_PLUGINS . "/{$k}/icon.png")) {
?>
<img src='<?php
echo getResource("addons/plugins/{$k}/icon.png");
?>
' alt=''/><?php
}
?>
<strong><?php
echo $plugin["info"]["name"];
?>
</strong>
<small class='description'><?php
echo $plugin["info"]["description"];
?>
</small>
</li>
<?php
示例4: URL
?>
<a href='<?php
echo URL("admin/plugins/toggle/{$k}?token=" . ET::$session->token);
?>
' class='button toggle'><?php
echo $plugin["loaded"] ? "<span class='icon-tick'></span> " . T("Disable") : T("Enable");
?>
</a>
</span>
</div>
<?php
if (file_exists(PATH_PLUGINS . "/{$k}/icon.png")) {
?>
<img src='<?php
echo getResource("plugins/{$k}/icon.png");
?>
' alt=''/><?php
}
?>
<strong><?php
echo $plugin["info"]["name"];
?>
</strong>
<small class='version'><?php
echo $plugin["info"]["version"];
?>
</small>
<small class='description'><?php
echo $plugin["info"]["description"];
?>
示例5: FormatBotAutoReplies
function FormatBotAutoReplies($_chat, $_answers, $_alternate = true, $html = "", $single = "")
{
global $LZLANG, $GROUPS, $CONFIG;
$tth = ".";
$bind = " " . $LZLANG["client_or"] . " ";
if (!empty($GROUPS[$_chat->DesiredChatGroup]) && $GROUPS[$_chat->DesiredChatGroup]->IsHumanAvailable()) {
$resultpc = queryDB(false, "SELECT * FROM `" . DB_PREFIX . DATABASE_POSTS . "` WHERE `chat_id`='" . DBManager::RealEscape($_chat->ChatId) . "' AND `repost`=0 AND `receiver`='" . DBManager::RealEscape($this->SystemId) . "';");
if ($this->WelcomeManager && DBManager::GetRowCount($resultpc) >= $this->WelcomeManagerOfferHumanChatAfter) {
$tth = " " . $LZLANG["client_or"] . " <a class=\"lz_chat_human\" onclick=\"var _this = this;lz_chat_set_talk_to_human(true,true);this.className='';this.style.cursor='wait';setTimeout(function(){_this.style.cursor='default'; },3000);\">" . $LZLANG["client_talk_to_human"] . "</a>.";
$bind = ", ";
}
}
$lm = empty($CONFIG["gl_dtfbc"]) ? $bind . " <a class=\"lz_chat_mail\" onclick=\"lz_chat_require_leave_message();\">" . $LZLANG["client_leave_a_message"] . "</a>" : "";
if (count($_answers) == 0) {
return $LZLANG["client_bot_no_result_found"] . $lm . $tth;
} else {
if (count($_answers) > 0) {
$html .= $LZLANG["client_your_result"] . "<br>";
$html .= "<ul class=\"lz_chat_bot_resource\">";
foreach ($_answers as $qa) {
if (!empty($qa->ResourceId)) {
$res = getResource($qa->ResourceId);
$target = $qa->NewWindow ? "target=\"_blank\" " : "";
$html .= "<li>";
if ($res["type"] == 2) {
$html .= "<a class=\"lz_chat_link\" href=\"" . $res["value"] . "\" " . $target . ">" . $res["title"] . "</a>";
} else {
if ($res["type"] == 3 || $res["type"] == 4) {
$html .= "<a class=\"lz_chat_link\" href=\"" . LIVEZILLA_URL . "getfile.php?id=" . $res["id"] . "\" " . $target . ">" . $res["title"] . "</a>";
} else {
$html .= "<b>" . $res["title"] . "</b><br><br>" . str_replace("<a ", "<a " . $target, str_replace("<A", "<a", $res["value"]));
}
}
$html .= "</li>";
} else {
if (!empty($qa->Answer)) {
$single = $qa->Answer . "<br><br>";
break;
}
}
}
$html .= "</ul>";
}
}
if (!empty($single)) {
$html = $single;
}
return $html . ($_alternate ? $LZLANG["client_bot_result_found"] . $lm . $tth : "");
}
示例6: SEND_PHP_MAIL
private function SEND_PHP_MAIL($_receiver = "", $result = "")
{
if (strpos($_receiver, ",") !== false) {
$emails = explode(",", $_receiver);
foreach ($emails as $mail) {
if (!empty($mail)) {
$result = $this->SEND_PHP_MAIL(trim($mail), $result);
}
}
return $result;
}
$mailtext = $this->MailText;
$ehash = md5(date('r', time()));
$EOL = "\r\n";
if (empty($this->FakeSender)) {
$headers = "From: " . $this->Account->Email . $EOL;
} else {
$headers = "From: " . $this->FakeSender . $EOL;
}
$headers .= "Reply-To: " . $this->ReplyTo . $EOL;
$headers .= "Date: " . date("r") . $EOL;
$headers .= "MIME-Version: 1.0" . $EOL;
$headers .= "X-Mailer: LiveZilla.net/" . VERSION . $EOL;
if ($this->Attachments != null) {
$headers .= "Content-Type: multipart/mixed; boundary=\"" . $ehash . "\"" . $EOL . $EOL;
$headers .= "--" . $ehash . $EOL;
$headers .= "Content-Type: text/plain; charset=UTF-8; format=flowed" . $EOL;
$headers .= "Content-Transfer-Encoding: 8bit" . $EOL . $EOL;
$headers .= $mailtext . $EOL . $EOL;
$headers .= "--" . $ehash . $EOL;
foreach ($this->Attachments as $resId) {
$res = getResource($resId);
if ($res == null) {
continue;
}
$content = chunk_split(base64_encode(file_get_contents("./uploads/" . $res["value"])));
$headers .= "Content-Type: application/octet-stream; name=\"" . $res["title"] . "\"" . $EOL;
$headers .= "Content-Transfer-Encoding: base64" . $EOL;
$headers .= "Content-Disposition: attachment; filename=\"" . $res["title"] . "\"" . $EOL . $EOL;
$headers .= $content . $EOL . $EOL;
$headers .= "--" . $ehash . $EOL;
}
$mailtext = "";
$headers .= "--" . $ehash . "--" . $EOL;
} else {
$headers .= "Content-Type: text/plain; charset=UTF-8; format=flowed" . $EOL;
$headers .= "Content-Transfer-Encoding: 8bit" . $EOL . $EOL;
}
if (@mail($_receiver, $this->Subject, $mailtext, $headers)) {
return 1;
} else {
return "The email could not be sent using PHP mail(). Please try another Return Email Address or use SMTP.";
}
}
示例7: URL
?>
<li><a href='<?php
echo URL("admin/appearance/uninstall/{$k}?token=" . ET::$session->token);
?>
'><i class='icon-remove'></i><?php
echo T("Uninstall");
?>
</a></li>
</ul>
<div class='preview'>
<?php
if (file_exists(PATH_SKINS . "/{$k}/preview.jpg")) {
?>
<img src='<?php
echo getResource("addons/skins/{$k}/preview.jpg");
?>
' alt='<?php
echo $k;
?>
'/>
<?php
} else {
?>
<span><?php
echo T("No preview");
?>
</span><?php
}
?>
</div>
示例8: error_reporting
<?php
/* yadl_spaceid - Skip Stamping */
error_reporting(E_ALL);
function getResource($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$url = 'http://search.yahooapis.com/NewsSearchService/V1/newsSearch?appid=YahooDemo&language=en&output=php&' . getenv('QUERY_STRING');
//$response = file_get_contents($url);
$response = getResource($url);
if ($response === false) {
die('Request failed');
}
$resultSet = unserialize($response);
$resultSet = $resultSet['ResultSet'];
$list = '';
// HTML output
$headlines = array();
// track headlines to filter dupes
foreach ($resultSet['Result'] as $result) {
if (!isset($headlines[$result['Title']])) {
$headlines[$result['Title']] = true;
$list .= <<<END_OF_HTML
<li>
<a href="{$result['ClickUrl']}"><q>{$result['Title']}</q></a>
示例9: define
/****************************************************************************************
* LiveZilla getfile.php
*
* Copyright 2014 LiveZilla GmbH
* All rights reserved.
* LiveZilla is a registered trademark.
*
* Improper changes to this file may cause critical errors.
***************************************************************************************/
define("IN_LIVEZILLA", true);
if (!defined("LIVEZILLA_PATH")) {
define("LIVEZILLA_PATH", "./");
}
require LIVEZILLA_PATH . "_definitions/definitions.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php";
require LIVEZILLA_PATH . "_lib/functions.global.inc.php";
require LIVEZILLA_PATH . "_lib/objects.global.users.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php";
if (isset($_GET["id"]) && initDataProvider()) {
$id = $_GET["id"];
if (strpos($id, ".") === false && !isnull($res = getResource($id))) {
if (file_exists("./uploads/" . $res["value"]) && strpos($res["value"], "..") === false) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize("./uploads/" . $res["value"]));
header('Content-Disposition: attachment; filename=' . urlencode($res["title"]));
exit(file_get_contents("./uploads/" . $res["value"]));
}
}
}
header("HTTP/1.0 404 Not Found");
示例10: GetMatches
static function GetMatches($_list, $_question, $_language)
{
$answers = array();
foreach ($_list as $reply) {
if ($reply->SearchType != 5) {
$reply->Tags = str_replace(array("!", ".", "?", "=", ")", "(", "-", "_", ":", "#", "~", "?"), "", strtolower($reply->Tags));
}
if (!$reply->MatchesLanguage($_language)) {
continue;
}
$tags = explode(",", $reply->Tags);
$count = 0;
foreach ($tags as $tag) {
if ($reply->SearchType == 5) {
if (@preg_match($reply->Tags, $_question) === 1) {
$count++;
}
} else {
if ($reply->SearchType < 4 && strpos($_question, $tag) !== false || jokerCompare($tag, $_question)) {
$count++;
}
}
}
if ($reply->SearchType == 0 && $count == substr_count($reply->Tags, ",") + 1 || $reply->SearchType > 0 && $count >= $reply->SearchType || $reply->SearchType >= 4 && $count > 0) {
if (empty($reply->Answer)) {
if (getResource($reply->ResourceId) !== null) {
$answers[$count . "-" . count($answers)] = $reply;
}
} else {
$answers = array();
$answers[$count . "-" . count($answers)] = $reply;
break;
}
}
}
krsort($answers);
return $answers;
}
示例11: avatar
/**
* Return an image tag containing a member's avatar.
*
* @param int $memberId The member's ID.
* @param string $avatarFormat The format of the member's avatar (as stored in the database - jpg|gif|png.)
* @param string $className CSS class names to apply to the avatar.
*/
function avatar($memberId = 0, $avatarFormat = "", $className = "")
{
// Otherwise, construct the avatar path from the provided information.
if ($memberId and $avatarFormat) {
$file = "uploads/avatars/{$memberId}.{$avatarFormat}";
$url = getWebPath($file);
}
// If the user doesn't have an avatar, return the skin's default one.
if (!$avatarFormat) {
$url = getResource("skins/base/avatar.png");
}
return "<img src='{$url}' alt='' class='avatar {$className}'/>";
}
示例12: sanitizeHTML
<title><?php
echo sanitizeHTML($data["pageTitle"]);
?>
</title>
<?php
echo $data["head"];
?>
<link rel="icon" type="image/png" href="<?php
echo getResource("core/skin/favicon.png");
?>
"> +v<link rel="apple-touch-icon" href="<?php
echo getResource("core/skin/apple-touch-icon.png");
?>
">
<link rel="apple-touch-icon" href="<?php
echo getResource("core/skin/apple-touch-icon.png");
?>
">
</head>
<body class='<?php
echo $data["bodyClass"];
?>
'>
<?php
$this->trigger("pageStart");
?>
<div id='messages'>
<?php
foreach ($data["messages"] as $message) {
示例13: URL
?>
<li><a href='<?php
echo URL("admin/appearance/uninstall/{$k}?token=" . ET::$session->token);
?>
'><?php
echo T("Uninstall");
?>
</a></li>
</ul>
<div class='preview'>
<?php
if (file_exists(PATH_SKINS . "/{$k}/preview.jpg")) {
?>
<img src='<?php
echo getResource("skins/{$k}/preview.jpg");
?>
' alt='<?php
echo $k;
?>
'/>
<?php
} else {
?>
<span><?php
echo T("No preview");
?>
</span><?php
}
?>
</div>
示例14: GetMatches
static function GetMatches($_list, $_question, $_language, $_chat, $_internal, $lmsi = false, $lmse = false, $lpi = null, $lpe = null)
{
$answers = array();
foreach ($_list as $reply) {
if ($_chat != null) {
$reply->Answer = $_chat->TextReplace($reply->Answer);
}
if ($_internal != null) {
$reply->Answer = $_internal->TextReplace($reply->Answer);
}
if ($reply->SearchType != 5) {
$reply->Tags = str_replace(array("!", ".", "?", "=", ")", "(", "-", "_", ":", "#", "~", "?"), "", strtolower($reply->Tags));
}
if (!$reply->MatchesLanguage($_language)) {
continue;
}
if (empty($_chat->AllocatedTime) && !$reply->Waiting) {
if (!($_internal != null && $_internal->IsBot)) {
continue;
}
}
$tags = explode(",", $reply->Tags);
$count = 0;
if (!empty($_chat)) {
if ($lmsi === false && ($reply->SendInactivityTimeInternal > -1 || $reply->SendInactivityTimeExternal > -1)) {
$lpi = Chat::GetLastPost($_chat->ChatId, true);
$lpe = Chat::GetLastPost($_chat->ChatId, false);
$lmsi = $lpi != null ? $lpi->Created : 0;
$lmse = $lpe != null ? $lpe->Created : 0;
}
$lm = max($lmsi, $lmse);
$lastMessageExternal = $lmse > $lmsi && !empty($lm);
$lastMessageInternal = $lmsi >= $lmse;
if (empty($lm)) {
$lm = $_chat->AllocatedTime;
}
if (!empty($lm)) {
if ($reply->SendInactivityTimeInternal > -1 && $lastMessageExternal && $lmsi > 0) {
if (time() - $lm > $reply->SendInactivityTimeInternal) {
$answers[$count . "-" . count($answers)] = $reply;
}
}
if ($reply->SendInactivityTimeExternal > -1 && $lastMessageInternal) {
if (time() - $lm > $reply->SendInactivityTimeExternal) {
if (!($lpi != null && $reply->Answer == $lpi->Text)) {
$answers[$count . "-" . count($answers)] = $reply;
}
}
}
if ($reply->CloseChat && !empty($_chat) && !empty($_internal)) {
if (count($answers) > 0 && isset($answers["0-0"]) && $answers["0-0"] == $reply) {
$_chat->InternalClose($_internal->SystemId);
}
}
}
}
if ($reply->SendInactivityTimeInternal == -1 && $reply->SendInactivityTimeExternal == -1) {
foreach ($tags as $tag) {
if ($reply->SearchType == 5) {
if (@preg_match($reply->Tags, $_question) === 1) {
$count++;
}
} else {
if ($reply->SearchType < 4 && strpos($_question, $tag) !== false || jokerCompare($tag, $_question)) {
$count++;
}
}
}
if ($reply->SearchType == 0 && $count == substr_count($reply->Tags, ",") + 1 || $reply->SearchType > 0 && $count >= $reply->SearchType || $reply->SearchType >= 4 && $count > 0) {
if (empty($reply->Answer)) {
if (getResource($reply->ResourceId) !== null) {
$answers[$count . "-" . count($answers)] = $reply;
}
} else {
$answers = array();
$answers[$count . "-" . count($answers)] = $reply;
break;
}
}
}
}
return $answers;
}
示例15: header
<?php
/* yadl_spaceid - Skip Stamping */
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Content-Type:text/xml");
$url = 'http://xml.weather.yahoo.com/forecastrss?' . getenv('QUERY_STRING');
function getResource($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$feed = getResource($url);
echo $feed;