本文整理汇总了PHP中gpFiles::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP gpFiles::Get方法的具体用法?PHP gpFiles::Get怎么用?PHP gpFiles::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpFiles
的用法示例。
在下文中一共展示了gpFiles::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetClasses
/**
* Get the current classes
*
*/
static function GetClasses()
{
$classes = gpFiles::Get('_config/classes');
if ($classes) {
return $classes;
}
//defaults
return self::Defaults();
}
示例2: SessionStart
public function SessionStart()
{
common::GetConfig();
$username = 'phpunit-username';
$users = gpFiles::Get('_site/users');
$userinfo = $users[$username];
$session_id = gpsession::create($userinfo, $username, $sessions);
$logged_in = gpsession::start($session_id, $sessions);
self::AssertTrue($logged_in, 'Not Logged In');
}
示例3: GetAddonData
/**
* Get addon history and review data
*
*/
function GetAddonData()
{
global $dataDir;
$this->dataFile = $dataDir . '/data/_site/addonData.php';
$addonData = gpFiles::Get('_site/addonData');
if ($addonData) {
$this->addonHistory = $addonData['history'];
$this->addonReviews = $addonData['reviews'];
}
}
示例4: connect
/**
* Connect to ftp server using either Post or saved values
* Connection values will not be kept in $config in case they're being used for a system revert which will replace the config.php file
* Also handle moving ftp connection values from $config to a sep
*
* @return bool true if connected, error message otherwise
*/
public function connect()
{
global $config, $dataDir, $langmessage;
$save_values = false;
$connect_args = \gpFiles::Get('_updates/connect', 'connect_args');
if (!$connect_args || !isset($connect_args['ftp_user'])) {
if (isset($config['ftp_user'])) {
$connect_args['ftp_user'] = $config['ftp_user'];
$connect_args['ftp_server'] = $config['ftp_server'];
$connect_args['ftp_pass'] = $config['ftp_pass'];
$connect_args['ftp_root'] = $config['ftp_root'];
$save_values = true;
}
}
if (isset($_POST['ftp_pass'])) {
$connect_args = $_POST;
$save_values = true;
}
$connect_args = $this->get_connect_vars($connect_args);
$connected = $this->connect_handler($connect_args);
if ($connected !== true) {
return $connected;
}
//get the ftp_root
if (empty($connect_args['ftp_root']) || $save_values) {
$this->ftp_root = $this->get_base_dir();
if (!$this->ftp_root) {
return $langmessage['couldnt_connect'] . ' (Couldn\'t find root)';
}
$connect_args['ftp_root'] = $this->ftp_root;
$save_values = true;
} else {
$this->ftp_root = $connect_args['ftp_root'];
}
//save ftp info
if (!$save_values) {
return $connected;
}
$connection_file = $dataDir . '/data/_updates/connect.php';
if (!\gpFiles::SaveData($connection_file, 'connect_args', $connect_args)) {
return $connected;
}
/*
* Remove from $config if it's not a safe mode installation
*/
if (!isset($config['useftp']) && isset($config['ftp_user'])) {
unset($config['ftp_user']);
unset($config['ftp_server']);
unset($config['ftp_pass']);
unset($config['ftp_root']);
\admin_tools::SaveConfig();
}
return $connected;
}
示例5: GetData
/**
* Get Gallery Index
*
* @static
*/
static function GetData()
{
$galleries = gpFiles::Get('_site/galleries');
if (!$galleries) {
return array();
}
if (version_compare(gpFiles::$last_version, '2.2', '<=')) {
special_galleries::UpdateData($galleries);
}
return $galleries;
}
示例6: VersionData
/**
* Get or cache data about available versions of gpEasy and addons
*
*/
static function VersionData(&$update_data)
{
global $dataDir;
$file = $dataDir . '/data/_updates/updates.php';
//set
if (!is_null($update_data)) {
return gpFiles::SaveData($file, 'update_data', $update_data);
}
$update_data = gpFiles::Get('_updates/updates', 'update_data');
$update_data += array('packages' => array());
return gpFiles::$last_modified;
}
示例7: AddRedirect
/**
* Add instructions for a 301 or 302 redirect
*
*/
function AddRedirect($source, $target)
{
global $dataDir;
$datafile = $dataDir . '/data/_site/error_data.php';
$error_data = gpFiles::Get('_site/error_data');
if (!$error_data) {
$error_data = array();
}
$changed = false;
//remove redirects from the $target
if (isset($error_data['redirects'][$target])) {
unset($error_data['redirects'][$target]);
$changed = true;
}
//redirect already exists for $source
if (!isset($error_data['redirects'][$source])) {
$error_data['redirects'][$source]['target'] = $target;
$error_data['redirects'][$source]['code'] = '301';
$changed = true;
}
if ($changed) {
gpFiles::SaveData($datafile, 'error_data', $error_data);
}
}
示例8: IncludePage
/**
* Include the content of a normal page
* @param string $requested The name of the page to include
*
*/
static function IncludePage($requested)
{
global $gp_index;
$requested = str_replace(' ', '_', $requested);
if (!isset($gp_index[$requested])) {
return '{{' . htmlspecialchars($requested) . '}}';
}
$file = gpFiles::PageFile($requested);
$file_sections = gpFiles::Get($file, 'file_sections');
if (!$file_sections) {
return '{{' . htmlspecialchars($requested) . '}}';
}
return self::Render($file_sections, self::$title, self::$meta);
}
示例9: GetUsage
/**
* Get usage information about a image
*
*/
static function GetUsage($index)
{
return gpFiles::Get('_resized/' . $index . '/data', 'usage');
}
示例10: Cron
/**
* Perform regular tasks
* Once an hour only when admin is logged in
*
*/
static function Cron()
{
$cron_info = gpFiles::Get('_site/cron_info');
$file_stats = gpFiles::$last_stats;
$file_stats += array('modified' => 0);
if (time() - $file_stats['modified'] < 3600) {
return;
}
self::CleanTemp();
gpFiles::SaveData('_site/cron_info', 'cron_info', $cron_info);
}
示例11: ViewTrashFile
/**
* View the contents of a trash file
*
*/
function ViewTrashFile($trash_index)
{
global $dataDir, $langmessage, $trash_file;
$title_info = admin_trash::GetInfo($trash_index);
//delete / restore links
echo '<div class="pull-right">';
echo common::Link('Admin_Trash', $langmessage['restore'], 'cmd=RestoreDeleted&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
echo ' ';
echo common::Link('Admin_Trash', $langmessage['delete'], 'cmd=DeleteFromTrash&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
echo '</div>';
echo '<h2 class="hmargin">';
echo common::Link('Admin_Trash', $langmessage['trash']);
echo ' » ';
echo htmlspecialchars($title_info['title']);
echo '</h2>';
echo '<hr>';
//get file sections
$file_sections = gpFiles::Get($title_info['page_file'], 'file_sections');
if ($file_sections) {
echo section_content::Render($file_sections, $title_info['title']);
} else {
echo '<p>This page no longer has any content</p>';
}
}
示例12: ExtraContent
/**
* Get and return the extra content specified by $title
*
*/
static function ExtraContent($title, &$file_stats = array())
{
$file = '_extra/' . $title;
$extra_content = array();
if (gpFiles::Exists($file)) {
ob_start();
$extra_content = gpFiles::Get($file, 'extra_content');
$extra_content_string = ob_get_clean();
if (!count($extra_content)) {
$extra_content['content'] = $extra_content_string;
}
}
return $extra_content + array('type' => 'text', 'content' => '');
}
示例13: TransferSession
/**
* Make sure the current user stays logged in after a revert is completed
*
*/
function TransferSession()
{
global $gpAdmin, $dataDir;
$username = $gpAdmin['username'];
// get user info
include $dataDir . '/data/_site/users.php';
$userinfo =& $users[$username];
$session_id = gpsession::create($userinfo, $username);
if (!$session_id) {
return;
}
//set the cookie for the new data
$config = gpFiles::Get('_site/config');
$session_cookie = 'gpEasy_' . substr(sha1($config['gpuniq']), 12, 12);
gpsession::cookie($session_cookie, $session_id);
//set the update gpuniq value for the post_nonce
$GLOBALS['config']['gpuniq'] = $config['gpuniq'];
}
示例14: CreateNew
/**
* Create a new page from a user post
*
*/
function CreateNew()
{
global $gp_index, $gp_titles, $langmessage, $gpAdmin;
includeFile('tool/editing_page.php');
includeFile('tool/editing.php');
$title = $_POST['title'];
$title = admin_tools::CheckPostedNewPage($title, $message);
if ($title === false) {
message($message);
return false;
}
$type = $_POST['content_type'];
$section = gp_edit::DefaultContent($type);
if ($section['content'] === false) {
return false;
}
$label = admin_tools::PostedLabel($_POST['title']);
if ($type == 'text') {
$section['content'] = '<h2>' . strip_tags($_POST['title']) . '</h2>' . $section['content'];
}
//add to $gp_index first!
$index = common::NewFileIndex();
$gp_index[$title] = $index;
if (!gpFiles::NewTitle($title, $section, $type)) {
message($langmessage['OOPS'] . ' (cn1)');
unset($gp_index[$title]);
return false;
}
//add to gp_titles
$new_titles = array();
$new_titles[$index]['label'] = $label;
$new_titles[$index]['type'] = $type;
$gp_titles += $new_titles;
//add to users editing
if ($gpAdmin['editing'] != 'all') {
$gpAdmin['editing'] = rtrim($gpAdmin['editing'], ',') . ',' . $index . ',';
$users = gpFiles::Get('_site/users');
$users[$gpAdmin['username']]['editing'] = $gpAdmin['editing'];
gpFiles::SaveData('_site/users', 'users', $users);
}
return $index;
}
示例15: Init
function Init()
{
$this->datafile = '_site/error_data';
$this->error_data = gpFiles::Get($this->datafile, 'error_data');
}