本文整理汇总了PHP中iaUtil::getPageContent方法的典型用法代码示例。如果您正苦于以下问题:PHP iaUtil::getPageContent方法的具体用法?PHP iaUtil::getPageContent怎么用?PHP iaUtil::getPageContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iaUtil
的用法示例。
在下文中一共展示了iaUtil::getPageContent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _launch
protected function _launch($id)
{
//$this->getHelper()->run($id);
// implemented via remote request because potentially some package's cron task
// may use front classes which will cause conflicts if executed from backend side.
// otherwise, the only call of iaCore::run() would be enough
$cronUrl = IA_CLEAR_URL . 'cron/?_t&t=' . (int) $id;
iaUtil::getPageContent($cronUrl, 300);
//
$this->_iaCore->iaView->setMessages(iaLanguage::get('scheduled_task_ran'), iaView::SUCCESS);
iaUtil::go_to($this->getPath());
}
示例2: _getRemotePlugins
private function _getRemotePlugins($start, $limit, $dir, $filter)
{
$pluginsData = array();
if ($cachedData = $this->_iaCore->iaCache->get('subrion_plugins', 3600, true)) {
$pluginsData = $cachedData;
} else {
if ($response = iaUtil::getPageContent(iaUtil::REMOTE_TOOLS_URL . 'list/plugin/' . IA_VERSION)) {
$response = iaUtil::jsonDecode($response);
if (!empty($response['error'])) {
$this->addMessage($response['error']);
} elseif ($response['total'] > 0) {
if (isset($response['extensions']) && is_array($response['extensions'])) {
$pluginsData = array();
$installedPlugins = $this->_iaDb->keyvalue(array('name', 'version'), iaDb::convertIds(iaExtra::TYPE_PLUGIN, 'type'));
foreach ($response['extensions'] as $entry) {
$pluginInfo = (array) $entry;
$pluginInfo['install'] = 0;
// exclude installed plugins
if (!array_key_exists($pluginInfo['name'], $installedPlugins)) {
$pluginsData['pluginsList'][$pluginInfo['name']] = $pluginInfo['title'];
if (isset($pluginInfo['compatibility']) && version_compare($pluginInfo['compatibility'], IA_VERSION, '<=')) {
$pluginInfo['install'] = 1;
}
$pluginInfo['date'] = gmdate(iaDb::DATE_FORMAT, $pluginInfo['date']);
$pluginInfo['file'] = $pluginInfo['name'];
$pluginInfo['readme'] = false;
$pluginInfo['reinstall'] = false;
$pluginInfo['uninstall'] = false;
$pluginInfo['remove'] = false;
$pluginInfo['removable'] = false;
$pluginsData['plugins'][$pluginInfo['name']] = $pluginInfo;
}
}
// cache well-formed results
$this->_iaCore->iaCache->write('subrion_plugins', $pluginsData);
} else {
$this->addMessage('error_incorrect_format_from_subrion');
}
}
} else {
$this->addMessage('error_incorrect_response_from_subrion');
}
}
return $this->getMessages() ? array('result' => false, 'message' => $this->getMessages()) : $this->_sortPlugins($pluginsData, $start, $limit, $dir, $filter);
}
示例3: _getList
private function _getList()
{
$templates = $this->getHelper()->getList();
// get list of available local templates
$remoteTemplates = array();
if ($this->_iaCore->get('allow_remote_templates')) {
if ($cachedData = $this->_iaCore->iaCache->get('subrion_templates', 3600, true)) {
$remoteTemplates = $cachedData;
// get templates list from cache, cache lives for 1 hour
} else {
if ($response = iaUtil::getPageContent(iaUtil::REMOTE_TOOLS_URL . 'list/template/' . IA_VERSION)) {
$response = iaUtil::jsonDecode($response);
if (!empty($response['error'])) {
$this->_messages[] = $response['error'];
$this->_error = true;
} elseif ($response['total'] > 0) {
if (isset($response['extensions']) && is_array($response['extensions'])) {
foreach ($response['extensions'] as $entry) {
$templateInfo = (array) $entry;
// exclude installed templates
if (!array_key_exists($templateInfo['name'], $templates)) {
$templateInfo['date'] = gmdate(iaDb::DATE_FORMAT, $templateInfo['date']);
$templateInfo['buttons'] = '';
$templateInfo['notes'] = array();
$templateInfo['remote'] = true;
$remoteTemplates[] = $templateInfo;
}
}
// cache well-formed results
$this->_iaCore->iaCache->write('subrion_templates', $remoteTemplates);
} else {
$this->addMessage('error_incorrect_format_from_subrion');
$this->_error = true;
}
}
} else {
$this->addMessage('error_incorrect_response_from_subrion');
$this->_error = true;
}
}
}
return array_merge($templates, $remoteTemplates);
}
示例4: _checkForUpdates
private function _checkForUpdates()
{
$url = sprintf(iaUtil::REMOTE_TOOLS_URL . 'get/updates/%s/', IA_VERSION);
$content = iaUtil::getPageContent($url);
if (!$content) {
return;
}
$content = iaUtil::jsonDecode($content);
if (is_array($content) && $content) {
$messages = array();
foreach ($content as $entry) {
switch ($entry['type']) {
case self::UPDATE_TYPE_INFO:
$messages[] = array($entry['id'], $entry['message']);
break;
case self::UPDATE_TYPE_PATCH:
$version = explode('.', $entry['version']);
if (count($version) > 3) {
if ($this->_iaCore->get('auto_apply_critical_upgrades')) {
$result = iaSystem::forceUpgrade($entry['version']);
if (is_bool($result) && $result) {
$this->_iaCore->factory('cache')->clearGlobalCache();
$message = iaLanguage::getf('script_upgraded', array('version' => $entry['version']));
$this->_iaCore->iaView->setMessages($message, iaView::SUCCESS);
iaUtil::go_to(IA_SELF);
} else {
iaDebug::debug($result, 'Forced upgrade to the version ' . $entry['version']);
}
}
} else {
$url = sprintf('%sinstall/upgrade/check/%s/', IA_CLEAR_URL, $entry['version']);
$this->_iaCore->iaView->setMessages(iaLanguage::getf('upgrade_available', array('url' => $url, 'version' => $entry['version'])), iaView::SYSTEM);
}
}
}
$this->_iaCore->iaView->assign('updatesInfo', $messages);
}
}
示例5: getRemoteList
private function getRemoteList($localPackages)
{
$remotePackages = array();
if ($cachedData = $this->_iaCore->iaCache->get('subrion_packages', 3600 * 24 * 7, true)) {
$remotePackages = $cachedData;
// get templates list from cache, cache lives for 1 hour
} else {
if ($response = iaUtil::getPageContent(iaUtil::REMOTE_TOOLS_URL . 'list/package/' . IA_VERSION)) {
$response = iaUtil::jsonDecode($response);
if (!empty($response['error'])) {
$this->_messages[] = $response['error'];
$this->_error = true;
} elseif ($response['total'] > 0) {
if (isset($response['extensions']) && is_array($response['extensions'])) {
foreach ($response['extensions'] as $entry) {
$packageInfo = (array) $entry;
// exclude uploaded packages
if (!in_array($packageInfo['name'], $localPackages)) {
$packageInfo['date'] = gmdate(iaDb::DATE_FORMAT, $packageInfo['date']);
$packageInfo['status'] = '';
$packageInfo['summary'] = $packageInfo['description'];
$packageInfo['buttons'] = false;
$packageInfo['remote'] = true;
$remotePackages[] = $packageInfo;
}
}
// cache well-formed results
$this->_iaCore->iaCache->write('subrion_packages', $remotePackages);
} else {
$this->addMessage('error_incorrect_format_from_subrion');
$this->_error = true;
}
}
} else {
$this->addMessage('error_incorrect_response_from_subrion');
$this->_error = true;
}
}
return $remotePackages;
}
示例6: _indexPage
//.........这里部分代码省略.........
default:
$classInstance = $iaCore->factoryPackage($itemName, $pluginType, iaCore::ADMIN);
}
if (!$customizationMode && in_array($itemName, $disabledWidgets)) {
continue;
}
if ($classInstance) {
if (method_exists($classInstance, self::STATISTICS_GETTER_METHOD)) {
if ($classInstance->dashboardStatistics) {
$data = $classInstance->{self::STATISTICS_GETTER_METHOD}();
isset($data['icon']) || ($data['icon'] = $itemName);
isset($data['caption']) || ($data['caption'] = $itemName);
$data['caption'] = iaLanguage::get($data['caption'], $data['caption']);
$widgetFormat = isset($data['_format']) && in_array($data['_format'], $validSizes) ? $data['_format'] : $validSizes[0];
$statistics[$widgetFormat][$itemName] = $data;
}
}
}
}
$iaView->assign('statistics', $statistics);
//
if (($customizationMode || !in_array('changelog', $disabledWidgets)) && $iaCore->get('display_changelog') && is_file(IA_HOME . 'changelog.txt')) {
$index = 0;
$log = array();
$titles = array();
$lines = file(IA_HOME . 'changelog.txt');
foreach ($lines as $line_num => $line) {
$line = trim($line);
if ($line) {
if ($line[0] == '>') {
$index++;
$log[$index] = array('title' => trim($line, '<> '), 'added' => '', 'modified' => '', 'bugfixes' => '', 'other' => '');
$titles[trim($line, '<> ')] = $index;
} elseif ($index > 0) {
switch ($line[0]) {
case '+':
$class = 'added';
break;
case '-':
$class = 'bugfixes';
break;
case '*':
$class = 'modified';
break;
default:
$class = 'other';
}
$issue = preg_replace('/#(\\d+)/', '<a href="http://dev.subrion.org/issues/$1" target="_blank">#$1</a>', ltrim($line, '+-* '));
$log[$index][$class] .= '<li>' . $issue . '</li>';
}
}
}
unset($log[0]);
ksort($titles);
$titles = array_reverse($titles);
$iaView->assign('changelog_titles', $titles);
$iaView->assign('changelog', $log);
}
// twitter widget
if ($customizationMode || !in_array('twitter', $disabledWidgets)) {
$data = iaUtil::getPageContent('http://tools.intelliants.com/timeline/');
$iaView->assign('timeline', iaUtil::jsonDecode($data));
}
if ($customizationMode || !in_array('recent-activity', $disabledWidgets)) {
$data = $iaCore->factory('log')->get();
$iaView->assign('activity_log', $data);
}
if ($customizationMode || !in_array('website-visits', $disabledWidgets)) {
$data = $iaCore->factory('users')->getVisitorsInfo();
$iaView->assign('online_members', $data);
}
if ($iaCore->get('check_for_updates')) {
if ($content = iaUtil::getPageContent(iaUtil::REMOTE_TOOLS_URL . 'get/patch/')) {
$content = iaUtil::jsonDecode($content);
if (is_array($content) && $content) {
foreach ($content as $versionFrom => $versionTo) {
if (version_compare($versionFrom, IA_VERSION) === 0 && version_compare($versionTo, IA_VERSION)) {
$version = explode('.', $versionTo);
if (count($version) > 3) {
if ($iaCore->get('auto_apply_critical_upgrades')) {
$result = iaSystem::forceUpgrade($versionTo);
if (is_bool($result) && $result) {
$iaCore->factory('cache')->clearGlobalCache();
$message = iaLanguage::getf('script_upgraded', array('version' => $versionTo));
$iaView->setMessages($message, iaView::SUCCESS);
iaUtil::go_to(IA_SELF);
} else {
iaDebug::debug($result, 'Forced upgrade to the version ' . $versionTo);
}
}
} else {
$url = sprintf('%sinstall/upgrade/check/%s/', IA_CLEAR_URL, $versionTo);
$iaView->setMessages(iaLanguage::getf('upgrade_available', array('url' => $url, 'version' => $versionTo)), iaView::SYSTEM);
}
}
}
}
}
}
}