本文整理汇总了PHP中Kit::GetXiboRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP Kit::GetXiboRoot方法的具体用法?PHP Kit::GetXiboRoot怎么用?PHP Kit::GetXiboRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kit
的用法示例。
在下文中一共展示了Kit::GetXiboRoot方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Session
require_once 'install/upgradestep.class.php';
$page = 'upgrade';
if (Kit::GetParam('includes', _POST, _BOOL)) {
$upgradeFrom = Kit::GetParam('upgradeFrom', _POST, _INT);
$upgradeTo = Kit::GetParam('upgradeTo', _POST, _INT);
for ($i = $upgradeFrom + 1; $i <= $upgradeTo; $i++) {
if (file_exists('install/database/' . $i . '.php')) {
include_once 'install/database/' . $i . '.php';
}
}
}
}
// Create a Session
$session = new Session();
// Work out the location of this service
$serviceLocation = Kit::GetXiboRoot();
// OAuth
require_once 'lib/oauth.inc.php';
// Assign the page name to the session
$session->set_page(session_id(), $page);
// Create a user
$user = new User($db);
// Create Page
try {
$pageManager = new PageManager($db, $user, $page);
$pageManager->Authenticate();
$pageManager->Render();
} catch (Exception $e) {
trigger_error($e->getMessage(), E_USER_ERROR);
}
die;
示例2: InstallFonts
private function InstallFonts()
{
$media = new Media();
$fontTemplate = '
@font-face {
font-family: \'[family]\';
src: url(\'[url]\');
}
';
// Save a fonts.css file to the library for use as a module
try {
$dbh = PDOConnect::init();
$sth = $dbh->prepare('SELECT mediaID, name, storedAs FROM `media` WHERE type = :type AND IsEdited = 0 ORDER BY name');
$sth->execute(array('type' => 'font'));
$fonts = $sth->fetchAll();
if (count($fonts) < 1) {
return;
}
$css = '';
$localCss = '';
$ckeditorString = '';
foreach ($fonts as $font) {
// Separate out the display name and the referenced name (referenced name cannot contain any odd characters or numbers)
$displayName = $font['name'];
$familyName = preg_replace('/\\s+/', ' ', preg_replace('/\\d+/u', '', $font['name']));
// Css for the client contains the actual stored as location of the font.
$css .= str_replace('[url]', $font['storedAs'], str_replace('[family]', $displayName, $fontTemplate));
// Css for the local CMS contains the full download path to the font
$relativeRoot = explode('://', Kit::GetXiboRoot());
$url = '//' . $relativeRoot[1] . '?p=module&mod=font&q=Exec&method=GetResource&download=1&downloadFromLibrary=1&mediaid=' . $font['mediaID'];
$localCss .= str_replace('[url]', $url, str_replace('[family]', $familyName, $fontTemplate));
// CKEditor string
$ckeditorString .= $displayName . '/' . $familyName . ';';
}
file_put_contents('modules/preview/fonts.css', $css);
// Install it (doesn't expire, is a system file, force update)
$media->addModuleFile('modules/preview/fonts.css', 0, true, true);
// Generate a fonts.css file for use locally (in the CMS)
file_put_contents('modules/preview/fonts.css', $localCss);
// Edit the CKEditor file
$ckeditor = file_get_contents('theme/default/libraries/ckeditor/config.js');
$replace = "/*REPLACE*/ config.font_names = '" . $ckeditorString . "' + config.font_names; /*ENDREPLACE*/";
$ckeditor = preg_replace('/\\/\\*REPLACE\\*\\/.*?\\/\\*ENDREPLACE\\*\\//', $replace, $ckeditor);
file_put_contents('theme/default/libraries/ckeditor/config.js', $ckeditor);
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
if (!$this->IsError()) {
$this->SetError(1, __('Unknown Error'));
}
return false;
}
}
示例3: JqueryFileUpload
/**
* End point for jQuery file uploader
*/
public function JqueryFileUpload()
{
$db =& $this->db;
require_once "3rdparty/jquery-file-upload/XiboUploadHandler.php";
$type = Kit::GetParam('type', _REQUEST, _WORD);
Kit::ClassLoader('file');
$fileObject = new File($db);
$libraryFolder = Config::GetSetting('LIBRARY_LOCATION');
// Make sure the library exists
$fileObject->EnsureLibraryExists();
// Get Valid Extensions
Kit::ClassLoader('media');
$media = new Media($db);
$validExt = $media->ValidExtensions($type);
$options = array('db' => $this->db, 'user' => $this->user, 'upload_dir' => $libraryFolder . 'temp/', 'download_via_php' => true, 'script_url' => Kit::GetXiboRoot() . '?p=content&q=JqueryFileUpload', 'upload_url' => Kit::GetXiboRoot() . '?p=content&q=JqueryFileUpload', 'image_versions' => array(), 'accept_file_types' => '/\\.' . implode('|', $validExt) . '$/i');
// Hand off to the Upload Handler provided by jquery-file-upload
$handler = new XiboUploadHandler($options);
// Must commit if in a transaction
try {
$dbh = PDOConnect::init();
$dbh->commit();
} catch (Exception $e) {
Debug::LogEntry('audit', 'Unable to commit/rollBack');
}
// Must prevent from continuing (framework will try to issue a response)
exit;
}
示例4: __construct
public function __construct()
{
$this->serviceLocation = Kit::GetXiboRoot();
}
示例5: RequiredFiles
//.........这里部分代码省略.........
$fileSize = strlen($xml);
if ($this->isAuditing == 1) {
Debug::Audit('MD5 for layoutId ' . $id . ' is: [' . $md5 . ']', $this->displayId);
}
// Add nonce
$nonce->AddXmdsNonce('layout', $this->displayId, NULL, $fileSize, NULL, $id);
$pathsAdded[] = 'layout_' . $id;
} else {
if ($recordType == 'media') {
// Check we haven't added this before
if (in_array('media_' . $path, $pathsAdded)) {
continue;
}
// If they are empty calculate them and save them back to the media.
if ($md5 == '' || $fileSize == 0) {
$md5 = md5_file($libraryLocation . $path);
$fileSize = filesize($libraryLocation . $path);
// Update the media record with this information
$mediaSth->execute(array('md5' => $md5, 'size' => $fileSize, 'mediaid' => $id));
}
// Add nonce
$mediaNonce = $nonce->AddXmdsNonce('file', $this->displayId, $id, $fileSize, $path);
$pathsAdded[] = 'media_' . $path;
} else {
continue;
}
}
// Add the file node
$file = $requiredFilesXml->createElement("file");
$file->setAttribute("type", $recordType);
$file->setAttribute("id", $id);
$file->setAttribute("size", $fileSize);
$file->setAttribute("md5", $md5);
if ($recordType == 'media' && $sendFileMode != 'Off') {
// Serve a link instead (standard HTTP link)
$file->setAttribute("path", Kit::GetXiboRoot() . '?file=' . $mediaNonce);
$file->setAttribute("saveAs", $path);
$file->setAttribute("download", 'http');
} else {
$file->setAttribute("download", 'xmds');
$file->setAttribute("path", $path);
}
$fileElements->appendChild($file);
}
} catch (Exception $e) {
Debug::Error('Unable to get a list of required files. ' . $e->getMessage(), $this->displayId);
return new SoapFault('Sender', 'Unable to get a list of files');
}
// Go through each layout and see if we need to supply any resource nodes.
foreach ($layouts as $layoutId) {
// Load the layout XML and work out if we have any ticker / text / data set media items
$layout = new Layout();
$layoutInformation = $layout->LayoutInformation($layoutId);
foreach ($layoutInformation['regions'] as $region) {
foreach ($region['media'] as $media) {
if ($media['render'] == 'html' || $media['mediatype'] == 'ticker' || $media['mediatype'] == 'text' || $media['mediatype'] == 'datasetview' || $media['mediatype'] == 'webpage' || $media['mediatype'] == 'embedded') {
// Append this item to required files
$file = $requiredFilesXml->createElement("file");
$file->setAttribute('type', 'resource');
$file->setAttribute('id', rand());
$file->setAttribute('layoutid', $layoutId);
$file->setAttribute('regionid', $region['regionid']);
$file->setAttribute('mediaid', $media['mediaid']);
$file->setAttribute('updated', isset($media['updated']) ? $media['updated'] : 0);
$fileElements->appendChild($file);
$nonce->AddXmdsNonce('resource', $this->displayId, NULL, NULL, NULL, $layoutId, $region['regionid'], $media['mediaid']);
}
}
}
}
// Add a blacklist node
$blackList = $requiredFilesXml->createElement("file");
$blackList->setAttribute("type", "blacklist");
$fileElements->appendChild($blackList);
try {
$dbh = PDOConnect::init();
$sth = $dbh->prepare('SELECT MediaID FROM blacklist WHERE DisplayID = :displayid AND isIgnored = 0');
$sth->execute(array('displayid' => $this->displayId));
// Add a black list element for each file
foreach ($sth->fetchAll() as $row) {
$file = $requiredFilesXml->createElement("file");
$file->setAttribute("id", $row['MediaID']);
$blackList->appendChild($file);
}
} catch (Exception $e) {
Debug::Error('Unable to get a list of blacklisted files. ' . $e->getMessage(), $this->displayId);
return new SoapFault('Sender', 'Unable to get a list of blacklisted files');
}
// Phone Home?
$this->PhoneHome();
if ($this->isAuditing == 1) {
Debug::Audit($requiredFilesXml->saveXML(), $this->displayId);
}
// Return the results of requiredFiles()
$requiredFilesXml->formatOutput = true;
$output = $requiredFilesXml->saveXML();
// Log Bandwidth
$this->LogBandwidth($this->displayId, Bandwidth::$RF, strlen($output));
return $output;
}