本文整理汇总了PHP中bx_file_get_contents函数的典型用法代码示例。如果您正苦于以下问题:PHP bx_file_get_contents函数的具体用法?PHP bx_file_get_contents怎么用?PHP bx_file_get_contents使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bx_file_get_contents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isSpammer
/**
* Check if user is spammer
* @param $aValues - array with keys: ip, email, username
* @param $sDesc - desctiption, for example: join
* @return true - on positive detection, false - on error or no spammer detection
*/
public function isSpammer($aValues, $sDesc)
{
if (!getParam('bx_antispam_stopforumspam_enable')) {
return false;
}
if (!$aValues || !is_array($aValues)) {
return false;
}
$aRequestParams = array('f' => 'json');
foreach ($this->_aKeys as $k => $b) {
if (isset($aValues[$k])) {
$aRequestParams[$k] = rawurlencode($aValues[$k]);
}
}
$s = bx_file_get_contents('http://www.stopforumspam.com/api', $aRequestParams);
if (!$s) {
return false;
}
$aResult = json_decode($s, true);
if (null === $aResult || !$aResult['success']) {
return false;
}
foreach ($this->_aKeys as $k => $b) {
if (isset($aResult[$k]) && $aResult[$k]['appears']) {
$this->onPositiveDetection($sDesc);
return true;
}
}
return false;
}
示例2: getSplash
public function getSplash()
{
if ($this->_oConfig->getUri() != $this->getCode()) {
return '';
}
$sDownloadUrl = 'http://ci.boonex.com/';
$sVersion = '8.0';
$sVersionFull = '8.0.0';
$sBuild = '';
$mixedResponse = bx_file_get_contents($sDownloadUrl . "builds/latest-release-file.txt");
if ($mixedResponse !== false) {
$sFile = trim(bx_process_input($mixedResponse));
$aMatches = array();
if ((int) preg_match("/([0-9]\\.[0-9])\\.([0-9])-?([A-Z]*[a-z]*[0-9]{1,3})/", $sFile, $aMatches) > 0 && !empty($aMatches[1]) && !empty($aMatches[3])) {
$sDownloadUrl .= 'builds/' . $sFile;
$sVersion = $aMatches[1];
$sBuild = $aMatches[3];
}
if ((int) preg_match("/Trident-v\\.([0-9A-Za-z\\.-]+)\\.zip/", $sFile, $aMatches) > 0) {
$sVersionFull = $aMatches[1];
}
}
$this->addCss(array('splash-phone.css', 'splash-tablet.css', 'splash-desktop.css'));
return $this->parseHtmlByName('splash.html', array('download_url' => $sDownloadUrl, 'version_full' => $sVersionFull, 'version' => $sVersion, 'build' => $sBuild));
}
示例3: BxRSS
function BxRSS($url)
{
$this->items = array();
if ($url and $this->sXmlText = bx_file_get_contents($url)) {
$this->_doFillFromText();
} else {
return null;
}
}
示例4: actionHandle
function actionHandle()
{
// check CSRF token
if ($this->_getCsrfToken() != bx_get('state')) {
$this->_oTemplate->getPage(_t('_Error'), MsgBox(_t('_bx_dolphcon_state_invalid')));
return;
}
// check code
$sCode = bx_get('code');
if (!$sCode) {
$sErrorDescription = bx_get('error_description') ? bx_get('error_description') : _t('_Error occured');
$this->_oTemplate->getPage(_t('_Error'), MsgBox($sErrorDescription));
return;
}
// make request for token
$s = bx_file_get_contents($this->_oConfig->sApiUrl . 'token', array('client_id' => $this->_oConfig->sApiID, 'client_secret' => $this->_oConfig->sApiSecret, 'grant_type' => 'authorization_code', 'code' => $sCode, 'redirect_uri' => $this->_oConfig->sPageHandle), 'post');
// handle error
if (!$s || NULL === ($aResponse = json_decode($s, true)) || !isset($aResponse['access_token']) || isset($aResponse['error'])) {
$sErrorDescription = isset($aResponse['error_description']) ? $aResponse['error_description'] : _t('_Error occured');
$this->_oTemplate->getPage(_t('_Error'), MsgBox($sErrorDescription));
return;
}
// get the data, especially access_token
$sAccessToken = $aResponse['access_token'];
$sExpiresIn = $aResponse['expires_in'];
$sExpiresAt = new \DateTime('+' . $sExpiresIn . ' seconds');
$sRefreshToken = $aResponse['refresh_token'];
// request info about profile
$s = bx_file_get_contents($this->_oConfig->sApiUrl . 'api/me', array(), 'get', array('Authorization: Bearer ' . $sAccessToken));
// handle error
if (!$s || NULL === ($aResponse = json_decode($s, true)) || !$aResponse || isset($aResponse['error'])) {
$sErrorDescription = isset($aResponse['error_description']) ? $aResponse['error_description'] : _t('_Error occured');
$this->_oTemplate->getPage(_t('_Error'), MsgBox($sErrorDescription));
return;
}
$aRemoteProfileInfo = $aResponse;
if ($aRemoteProfileInfo) {
// check if user logged in before
$iLocalProfileId = $this->_oDb->getProfileId($aRemoteProfileInfo['id']);
if ($iLocalProfileId) {
// user already exists
$aLocalProfileInfo = getProfileInfo($iLocalProfileId);
$this->setLogged($iLocalProfileId, $aLocalProfileInfo['Password']);
} else {
// register new user
$sAlternativeNickName = '';
if (getID($aRemoteProfileInfo['NickName'])) {
$sAlternativeNickName = $this->getAlternativeName($aRemoteProfileInfo['NickName']);
}
$this->getJoinAfterPaymentPage($aRemoteProfileInfo);
$this->_createProfile($aRemoteProfileInfo, $sAlternativeNickName);
}
} else {
$this->_oTemplate->getPage(_t('_Error'), MsgBox(_t('_bx_dolphcon_profile_error_info')));
}
}
示例5: getVersionUpdateInfo
public function getVersionUpdateInfo()
{
$s = bx_file_get_contents($this->_sUrlVersionCheck, array('v' => bx_get_ver()));
if (!$s) {
return null;
}
$a = json_decode($s, true);
if (!isset($a['latest_version'])) {
return null;
}
return $a;
}
示例6: load
public function load($sUrl, $aParams = array())
{
$sContent = bx_file_get_contents($sUrl, $aParams);
if (empty($sContent)) {
return false;
}
//echo $sContent; exit; //--- Uncomment to debug
$mixedResult = json_decode($sContent, true);
if (is_null($mixedResult)) {
return false;
}
return $mixedResult;
}
示例7: getFeed
public function getFeed($mixedId, $iUserId = 0)
{
$sUrl = $this->getUrl($mixedId);
$aMarkers = array('SiteUrl' => BX_DOL_URL_ROOT);
if ($iUserId) {
$oProfile = BxDolProfile::getInstance($iUserId);
if (!$oProfile) {
$oProfile = BxDolProfileUndefined::getInstance();
}
$aMarkers['NickName'] = $oProfile->getDisplayName();
}
$sUrl = bx_replace_markers($sUrl, $aMarkers);
header('Content-Type: text/xml; charset=utf-8');
return bx_file_get_contents($sUrl . (defined('BX_PROFILER') && BX_PROFILER && 0 == strncmp(BX_DOL_URL_ROOT, $sUrl, strlen(BX_DOL_URL_ROOT)) ? '&bx_profiler_disable=1' : ''));
}
示例8: check
/**
* Check captcha.
*/
public function check()
{
$mixedResponce = bx_file_get_contents($this->sVerifyUrl, array('secret' => $this->_sKeyPrivate, 'response' => bx_process_input(bx_get('g-recaptcha-response')), 'remoteip' => getVisitorIP()));
if ($mixedResponce === false) {
return false;
}
$aResponce = json_decode($mixedResponce, true);
if (isset($aResponce['success']) && $aResponce['success'] === true) {
return true;
}
if (!empty($aResponce['error-codes'])) {
$this->_error = $aResponce['error-codes'];
}
return false;
}
示例9: _compileCss
/**
* Compile CSS files' structure(@see @import css_file_path) in one file.
*
* @param string $sAbsolutePath CSS file absolute path(full URL for external CSS/JS files).
* @param array $aIncluded an array of already included CSS files.
* @return string result of operation.
*/
function _compileCss($sAbsolutePath, &$aIncluded)
{
if (isset($aIncluded[$sAbsolutePath])) {
return '';
}
$bExternal = strpos($sAbsolutePath, "http://") !== false || strpos($sAbsolutePath, "https://") !== false;
if ($bExternal) {
$sPath = $sAbsolutePath;
$sName = '';
$sContent = bx_file_get_contents($sAbsolutePath);
} else {
$aFileInfo = pathinfo($sAbsolutePath);
$sPath = $aFileInfo['dirname'] . DIRECTORY_SEPARATOR;
$sName = $aFileInfo['basename'];
$sContent = file_get_contents($sPath . $sName);
}
if (empty($sContent)) {
return '';
}
$sUrl = bx_ltrim_str($sPath, realpath(BX_DIRECTORY_PATH_ROOT), BX_DOL_URL_ROOT);
$sUrl = str_replace(DIRECTORY_SEPARATOR, '/', $sPath);
$sContent = "\r\n/*--- BEGIN: " . $sUrl . $sName . "---*/\r\n" . $sContent . "\r\n/*--- END: " . $sUrl . $sName . "---*/\r\n";
$aIncluded[$sAbsolutePath] = 1;
$sContent = str_replace(array("\n\r", "\r\n", "\r"), "\n", $sContent);
if ($bExternal) {
$sContent = preg_replace(array("'@import\\s+url\\s*\\(\\s*[\\'|\"]*\\s*([a-zA-Z0-9\\.\\/_-]+)\\s*[\\'|\"]*\\s*\\)\\s*;'", "'url\\s*\\(\\s*[\\'|\"]*\\s*([a-zA-Z0-9\\.\\/\\?\\#_=-]+)\\s*[\\'|\"]*\\s*\\)'"), array("", "'url('" . $sPath . "'\\1)'"), $sContent);
} else {
try {
$oTemplate =& $this;
$sContent = preg_replace_callback("'@import\\s+url\\s*\\(\\s*[\\'|\"]*\\s*([a-zA-Z0-9\\.\\/_-]+)\\s*[\\'|\"]*\\s*\\)\\s*;'", function ($aMatches) use($oTemplate, $sPath, $aIncluded) {
return $oTemplate->_compileCss(realpath($sPath . dirname($aMatches[1])) . DIRECTORY_SEPARATOR . basename($aMatches[1]), $aIncluded);
}, $sContent);
$sContent = preg_replace_callback("'url\\s*\\(\\s*[\\'|\"]*\\s*([a-zA-Z0-9\\.\\/\\?\\#_=-]+)\\s*[\\'|\"]*\\s*\\)'", function ($aMatches) use($oTemplate, $sPath) {
$sFile = basename($aMatches[1]);
$sDirectory = dirname($aMatches[1]);
$sRootPath = realpath(BX_DIRECTORY_PATH_ROOT);
$sAbsolutePath = realpath(addslashes($sPath) . $sDirectory) . DIRECTORY_SEPARATOR . $sFile;
$sRootPath = str_replace(DIRECTORY_SEPARATOR, '/', $sRootPath);
$sAbsolutePath = str_replace(DIRECTORY_SEPARATOR, '/', $sAbsolutePath);
return 'url(' . bx_ltrim_str($sAbsolutePath, $sRootPath, BX_DOL_URL_ROOT) . ')';
}, $sContent);
} catch (Exception $oException) {
return '';
}
}
return $sContent;
}
示例10: _assignAvatar
/**
* Assign avatar to user
*
* @param $sAvatarUrl string
* @return void
*/
function _assignAvatar($sAvatarUrl, $iProfileId = false)
{
if (!$iProfileId) {
$iProfileId = getLoggedId();
}
if (BxDolInstallerUtils::isModuleInstalled('avatar')) {
BxDolService::call('avatar', 'make_avatar_from_image_url', array($sAvatarUrl));
}
if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) {
bx_import('BxDolPrivacyQuery');
$oPrivacy = new BxDolPrivacyQuery();
$sTmpFile = tempnam($GLOBALS['dir']['tmp'], 'bxoauth');
if (false !== file_put_contents($sTmpFile, bx_file_get_contents($sAvatarUrl))) {
$aFileInfo = array('medTitle' => _t('_sys_member_thumb_avatar'), 'medDesc' => _t('_sys_member_thumb_avatar'), 'medTags' => _t('_ProfilePhotos'), 'Categories' => array(_t('_ProfilePhotos')), 'album' => str_replace('{nickname}', getUsername($iProfileId), getParam('bx_photos_profile_album_name')), 'albumPrivacy' => $oPrivacy->getDefaultValueModule('photos', 'album_view'));
BxDolService::call('photos', 'perform_photo_upload', array($sTmpFile, $aFileInfo, false), 'Uploader');
@unlink($sTmpFile);
}
}
}
示例11: checkForUpdates
function checkForUpdates($aModule)
{
if (empty($aModule['update_url'])) {
return array();
}
$sData = bx_file_get_contents($aModule['update_url'], array('uri' => $aModule['uri'], 'path' => $aModule['path'], 'version' => $aModule['version'], 'domain' => $_SERVER['HTTP_HOST']));
$aValues = $aIndexes = array();
$rParser = xml_parser_create('UTF-8');
xml_parse_into_struct($rParser, $sData, $aValues, $aIndexes);
xml_parser_free($rParser);
$aInfo = array();
if (isset($aIndexes['VERSION'])) {
$aInfo['version'] = $aValues[$aIndexes['VERSION'][0]]['value'];
}
if (isset($aIndexes['LINK'])) {
$aInfo['link'] = $aValues[$aIndexes['LINK'][0]]['value'];
}
if (isset($aIndexes['PACKAGE'])) {
$aInfo['package'] = $aValues[$aIndexes['PACKAGE'][0]]['value'];
}
return $aInfo;
}
示例12: storeFileLocally_Queue
protected function storeFileLocally_Queue($mixedHandler)
{
$aQueue = $this->_oDb->getFromQueue($mixedHandler);
if (!$aQueue || !$aQueue['file_url_source']) {
return false;
}
$sFileData = bx_file_get_contents($aQueue['file_url_source']);
if (false === $sFileData) {
return false;
}
$sTmpFile = $this->getTmpFilename($mixedHandler);
if (!file_put_contents($sTmpFile, $sFileData)) {
return false;
}
return $sTmpFile;
}
示例13: _processLinkUpload
function _processLinkUpload()
{
$aOwner = $this->_oDb->getUser($this->_getAuthorId());
$sUrl = trim(process_db_input($_POST['url'], BX_TAGS_STRIP));
if (empty($sUrl)) {
return array('code' => 1, 'message' => '_wall_msg_link_empty_link');
}
$sContent = bx_file_get_contents($sUrl);
preg_match("/<title>(.*)<\\/title>/", $sContent, $aMatch);
$sTitle = $aMatch[1];
preg_match("/<meta.*name[='\" ]+description['\"].*content[='\" ]+(.*)['\"].*><\\/meta>/", $sContent, $aMatch);
$sDescription = $aMatch[1];
return array('object_id' => $aOwner['id'], 'content' => $this->_oTemplate->parseHtmlByName('common_link.html', array('title' => $sTitle, 'url' => strpos($sUrl, 'http://') === false && strpos($sUrl, 'https://') === false ? 'http://' . $sUrl : $sUrl, 'description' => $sDescription)), 'title' => $aOwner['username'] . ' ' . _t('_wall_shared_link'), 'description' => $sUrl . ' - ' . $sTitle);
}
示例14: array
<?php
/**
* Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
* CC-BY License - http://creativecommons.org/licenses/by/3.0/
*/
require_once './inc/header.inc.php';
require_once './inc/db.inc.php';
require_once './inc/profiles.inc.php';
$aPredefinedRssFeeds = array('boonex_news' => 'http://www.boonex.com/notes/featured_posts/?rss=1', 'boonex_version' => 'http://rss.boonex.com/', 'boonex_unity_market' => 'http://www.boonex.com/market/latest/?rss=1', 'boonex_unity_lang_files' => 'http://www.boonex.com/market/tag/translations&rss=1', 'boonex_unity_market_templates' => 'http://www.boonex.com/market/tag/templates&rss=1', 'boonex_unity_market_featured' => 'http://www.boonex.com/market/featured_posts?rss=1');
if (isset($aPredefinedRssFeeds[$_GET['ID']])) {
$sCont = $aPredefinedRssFeeds[$_GET['ID']];
} else {
$sQuery = "SELECT `Content` FROM `sys_page_compose` WHERE `ID` = " . (int) $_GET['ID'];
$sCont = db_value($sQuery);
if (!$sCont) {
exit;
}
}
list($sUrl) = explode('#', $sCont);
$sUrl = str_replace('{SiteUrl}', $site['url'], $sUrl);
$iMemID = (int) $_GET['member'];
if ($iMemID) {
$aMember = getProfileInfo($iMemID);
$sUrl = str_replace('{NickName}', $aMember['NickName'], $sUrl);
}
header('Content-Type: text/xml');
echo bx_file_get_contents($sUrl . (BX_PROFILER && 0 == strncmp($site['url'], $sUrl, strlen($site['url'])) ? '&bx_profiler_disable=1' : ''));
示例15: save
function save($path)
{
$s = bx_file_get_contents($this->oStorage->getFileUrlById($this->iFileId));
if (!$s) {
return false;
}
return file_put_contents($path, $s) ? true : false;
}