本文整理汇总了PHP中Frontend类的典型用法代码示例。如果您正苦于以下问题:PHP Frontend类的具体用法?PHP Frontend怎么用?PHP Frontend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Frontend类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: checkLoginFromAdmin
function checkLoginFromAdmin($userid_from_zend)
{
$front = Frontend::getInstance();
if (isset($userid_from_zend) && $userid_from_zend != "" && $userid_from_zend != -2) {
//echo "0*".$userid_from_zend."*";
$user_id = (int) $userid_from_zend;
if ($user_id == 0) {
die("Admin session expired");
}
if ($front->isUserLoggedIn() && isset($_SESSION["userid"]) && $_SESSION["userid"] != 0 && $_SESSION["userid"] == $user_id) {
// already logged nothing to do
} else {
if ($front->isUserLoggedIn() && isset($_SESSION["userid"]) && $_SESSION["userid"] != 0 && $_SESSION["userid"] != $user_id) {
die("You are logged in Love application with another userid in this session. Please, logout from Love application!" . $_SESSION["userid"] . "**" . $user_id);
} else {
$sql = "SELECT " . USERS . ".*, " . COMPANY . ".name as company_name " . "FROM " . USERS . ", " . COMPANY . " " . "WHERE " . USERS . ".id = " . mysql_real_escape_string($user_id) . " AND " . USERS . ".company_id = " . COMPANY . ".id";
$row = doQuery($sql);
$username = $row->username;
$nickname = $row->nickname;
// $admin = $row->admin;
$_SESSION["userid"] = $user_id;
$_SESSION["username"] = $username;
$_SESSION["nickname"] = $nickname;
// $_SESSION["admin"] = $admin;
$_SESSION['running'] = "true";
if (!$front->isUserLoggedIn()) {
$front = new Frontend();
if (!$front->isUserLoggedIn()) {
clearSession();
die("You are still not logged! Click on another tab, and come back back here it could work");
}
}
if (!isAdmin($user_id)) {
clearSession();
die("You should have admin right to get access to this page." . $admin . "**" . USERS);
}
}
}
}
if (!$front->isUserLoggedIn()) {
clearSession();
$front->getUser()->askUserToAuthenticate();
}
if (!isAdmin($_SESSION["userid"])) {
clearSession();
die("You should have admin right to get access to this page.");
}
}
开发者ID:highfidelity,项目名称:love,代码行数:48,代码来源:loginFromAdmin.php
示例2: __dbConnectionResource
private static function __dbConnectionResource()
{
if (class_exists('Frontend')) {
return Frontend::instance()->Database->getConnectionResource();
}
return Administration::instance()->Database->getConnectionResource();
}
开发者ID:bauhouse,项目名称:sym-spectrum-members,代码行数:7,代码来源:class.asdc.php
示例3: setting
/**
* setting
*
* @param VirtualConnectionInterface $conn database connection
* @param bool $revision 리비전 처리
* @return \Illuminate\View\View
*/
public function setting(VirtualConnectionInterface $conn, $revision = false)
{
/** @var \Xpressengine\DynamicField\DynamicFieldHandler $dynamicField */
$dynamicField = app('xe.dynamicField');
$parent = $dynamicField->getConfigHandler()->parent($this->group);
$configs = [];
if ($parent !== null) {
/**
* @var ConfigEntity $config
*/
foreach (Cfg::children($parent) as $config) {
if ($config->get('use') === true) {
$configs[$config->get('id')] = $config;
}
}
}
/**
* @var \Xpressengine\DynamicField\RegisterHandler $registerHandler
*/
$dynamicFieldHandler = app('xe.dynamicField');
$registerHandler = $dynamicFieldHandler->getRegisterHandler();
$types = $registerHandler->getTypes($dynamicFieldHandler);
$fieldTypes = [];
foreach ($types as $types) {
$fieldTypes[] = $types;
}
\Frontend::rule('dynamicFieldSection', $this->getRules());
return View::make('dynamicField.setting', ['databaseName' => $conn->getName(), 'group' => $this->group, 'configs' => $configs, 'fieldTypes' => $fieldTypes, 'revision' => $revision]);
}
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:36,代码来源:DynamicFieldSection.php
示例4: instance
public static function instance()
{
if (!self::$_instance instanceof Frontend) {
self::$_instance = new self();
}
return self::$_instance;
}
开发者ID:njmcgee,项目名称:taxcheck,代码行数:7,代码来源:class.frontend.php
示例5: getLoveHistory
public function getLoveHistory($page, $justUser = false)
{
$front = Frontend::getInstance();
$page--;
$l = $this->getLimit() * $page;
$where = '';
$sql = "SELECT count(*) " . "FROM " . LOVE_LOVE;
$res = mysql_query($sql);
$row = mysql_fetch_row($res);
$loves = $row[0];
$sql = "SELECT count(*) " . "FROM " . LOVE_LOVE . " " . "WHERE " . LOVE_LOVE . ".receiver = '" . $front->getUser()->getUsername() . "' " . "OR " . LOVE_LOVE . ".giver = '" . $front->getUser()->getUsername() . "' " . ($sql .= $justUser ? '' : "OR " . LOVE_LOVE . ".company_id = '" . $front->getUser()->getCompany_id() . "' ");
$sql .= $where . " " . "ORDER BY id DESC";
$res = mysql_query($sql);
$row = mysql_fetch_row($res);
$count = $row[0];
$cPages = ceil($count / $this->getLimit());
$sql = "SELECT id,giver,receiver,why,private,TIMESTAMPDIFF(SECOND,at,NOW()) as delta " . "FROM " . LOVE_LOVE . " " . "WHERE " . LOVE_LOVE . ".receiver = '" . $front->getUser()->getUsername() . "' " . "OR " . LOVE_LOVE . ".giver = '" . $front->getUser()->getUsername() . "' ";
$sql .= $justUser ? '' : "OR " . LOVE_LOVE . ".company_id = '" . $front->getUser()->getCompany_id() . "' ";
$sql .= $where . " " . "ORDER BY id DESC " . "LIMIT " . $l . "," . $this->getLimit();
$res = mysql_query($sql);
// Construct json for history
$this->pages = array(array($page, $cPages, number_format($loves)));
for ($i = 1; $row = mysql_fetch_assoc($res); $i++) {
$givernickname = getNickName($row['giver']);
$givernickname = !empty($givernickname) ? $givernickname : $row['giver'];
$receivernickname = getNickName($row['receiver']);
$receivernickname = !empty($receivernickname) ? $receivernickname : $row['receiver'];
$why = $row['why'];
if ($row['private']) {
$why .= " (love sent quietly)";
}
$history[] = array("id" => $row['id'], "giver" => $row['giver'], "giverNickname" => $givernickname, "receiver" => $row['receiver'], "receiverNickname" => $receivernickname, "why" => $why, "delta" => Utils::relativeTime($row['delta']));
}
return $history;
}
开发者ID:highfidelity,项目名称:love,代码行数:35,代码来源:Love.class.php
示例6: Database
public static function Database()
{
if (class_exists('Frontend')) {
return Frontend::instance()->Database;
}
return Administration::instance()->Database;
}
开发者ID:bauhouse,项目名称:sym-spectrum,代码行数:7,代码来源:class.symphony.php
示例7: start
public static function start($lifetime = 0, $path = '/', $domain = NULL)
{
if (!self::$_initialized) {
## Crude method of determining if we're in the admin or frontend
if (class_exists('Frontend')) {
self::$_db =& Frontend::instance()->Database;
} elseif (class_exists('Administration')) {
self::$_db =& Administration::instance()->Database;
} else {
return false;
}
if (!is_object(self::$_db) || !self::$_db->isConnected()) {
return false;
}
self::$_cache = new Cacheable(self::$_db);
$installed = self::$_cache->check('_session_config');
if (!$installed) {
if (!self::createTable()) {
return false;
}
self::$_cache->write('_session_config', true);
}
ini_set('session.save_handler', 'user');
session_set_save_handler(array('Session', 'open'), array('Session', 'close'), array('Session', 'read'), array('Session', 'write'), array('Session', 'destroy'), array('Session', 'gc'));
session_set_cookie_params($lifetime, $path, $domain ? $domain : self::getDomain(), false, false);
self::$_initialized = true;
if (session_id() == '') {
session_start();
}
}
return session_id();
}
开发者ID:bauhouse,项目名称:sym-fluid960gs,代码行数:32,代码来源:class.session.php
示例8: driver
public static function driver()
{
if (class_exists('Administration')) {
return Administration::instance()->Configuration;
}
return Frontend::instance()->Configuration;
}
开发者ID:bauhouse,项目名称:library,代码行数:7,代码来源:class.configurationaccessor.php
示例9: makeView
/**
* makeView
*
* @param $target
* @param $instanceId
* @param $mode
*
* @return \Illuminate\Contracts\View\View
*/
protected function makeView($target, $instanceId, $mode)
{
/** @var SkinHandler $skinHandler */
$skinHandler = app('xe.skin');
$skinInstanceId = $skinHandler->mergeKey($target, $instanceId);
$selectedSkin = $skinHandler->getAssigned([$target, $instanceId], $mode);
if ($selectedSkin !== null) {
$settingView = $selectedSkin->getSettingView();
} else {
$settingView = null;
}
// get skin list
$skinList = $skinHandler->getList($target);
$skins = function ($skinList, $selectedSkin) {
(yield ['text' => '선택하세요', 'selected' => false]);
foreach ($skinList as $id => $skin) {
$support = [];
$support[] = $skin->supportDesktop() ? '데스크탑' : '';
$support[] = $skin->supportMobile() ? '모바일' : '';
$support = '[' . implode('|', $support) . ']';
(yield ['value' => $id, 'text' => $skin->getTitle() . $support, 'selected' => $selectedSkin === null ? false : $id === $selectedSkin->getId()]);
}
};
$skins = $skins($skinList, $selectedSkin);
\Frontend::js('assets/skin/section.js')->load();
$url = route('settings.skin.section.setting');
\Frontend::html('skin.loadSkinSetting')->content("<script>\n XE.\$(function(\$){\n \$('.__xe_skinSetting').xeSkinSetting({\n 'loadUrl': '{$url}',\n 'saveUrl': '{$url}'\n });\n });\n </script>")->load();
return View::make('skin.setting', compact('skinInstanceId', 'settingView', 'skins', 'mode', 'selectedSkin'));
}
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:38,代码来源:SkinSection.php
示例10: getForTemplate
/**
* Generate array representation for download
*
* @param bool $blnOrderPaid
*
* @return array
*/
public function getForTemplate($blnOrderPaid = false)
{
global $objPage;
$objDownload = $this->getRelated('download_id');
if (null === $objDownload) {
return array();
}
$arrDownloads = array();
$allowedDownload = trimsplit(',', strtolower($GLOBALS['TL_CONFIG']['allowedDownload']));
foreach ($objDownload->getFiles() as $objFileModel) {
$objFile = new \File($objFileModel->path, true);
if (!in_array($objFile->extension, $allowedDownload) || preg_match('/^meta(_[a-z]{2})?\\.txt$/', $objFile->basename)) {
continue;
}
// Send file to the browser
if ($blnOrderPaid && $this->canDownload() && \Input::get('download') == $objDownload->id && \Input::get('file') == $objFileModel->path) {
$this->download($objFileModel->path);
}
$arrMeta = \Frontend::getMetaData($objFileModel->meta, $objPage->language);
// Use the file name as title if none is given
if ($arrMeta['title'] == '') {
$arrMeta['title'] = specialchars(str_replace('_', ' ', preg_replace('/^[0-9]+_/', '', $objFile->filename)));
}
$strHref = '';
if (TL_MODE == 'FE') {
$strHref = \Haste\Util\Url::addQueryString('download=' . $objDownload->id . '&file=' . $objFileModel->path);
}
// Add the image
$arrDownloads[] = array('id' => $this->id, 'name' => $objFile->basename, 'title' => $arrMeta['title'], 'link' => $arrMeta['title'], 'caption' => $arrMeta['caption'], 'href' => $strHref, 'filesize' => \System::getReadableSize($objFile->filesize, 1), 'icon' => TL_ASSETS_URL . 'assets/contao/images/' . $objFile->icon, 'mime' => $objFile->mime, 'meta' => $arrMeta, 'extension' => $objFile->extension, 'path' => $objFile->dirname, 'remaining' => $objDownload->downloads_allowed > 0 ? sprintf($GLOBALS['TL_LANG']['MSC']['downloadsRemaining'], intval($this->downloads_remaining)) : '', 'downloadable' => $blnOrderPaid && $this->canDownload());
}
return $arrDownloads;
}
开发者ID:rpquadrat,项目名称:core,代码行数:39,代码来源:ProductCollectionDownload.php
示例11: Context
public function Context()
{
if (class_exists('Frontend')) {
return (object) Frontend::instance();
}
return (object) Administration::instance();
}
开发者ID:klaftertief,项目名称:entry_versions,代码行数:7,代码来源:class.entryversionsmanager.php
示例12: lookup
public static function lookup($ip)
{
$ch = curl_init();
// Notice: the request back to the Symphony services API includes your domain name
// and the version of Symphony that you're using
$version = Frontend::instance()->Configuration->get('version', 'symphony');
$domain = $_SERVER[SERVER_NAME];
curl_setopt($ch, CURLOPT_URL, "http://symphony-cms.net/_netspeed/1.0/?symphony=" . $version . "&domain=" . $domain . "&ip=" . $ip);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$speedinfo = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
if ($speedinfo === false || $info['http_code'] != 200) {
return;
} else {
$speedinfo = explode(',', $speedinfo);
}
$result = new XMLElement("netspeed");
$included = array('id', 'connection', 'error');
$i = 0;
foreach ($included as $netspeed) {
$result->appendChild(new XMLElement($netspeed, $speedinfo[$i]));
$i++;
}
return $result;
}
开发者ID:josephdenne,项目名称:netspeed-service,代码行数:27,代码来源:class.netspeed_service.php
示例13: frontendPreRenderHeaders
public function frontendPreRenderHeaders($context)
{
$page = Frontend::Page();
foreach (self::$headers as $name => $value) {
$page->addHeaderToPage($name, $value);
}
}
开发者ID:psychoticmeowArchives,项目名称:rewrite,代码行数:7,代码来源:extension.driver.php
示例14: renderer
function renderer($mode = 'frontend')
{
if (!in_array($mode, array('frontend', 'administration'))) {
throw new Exception('Invalid Symphony Renderer mode specified. Must be either "frontend" or "administration".');
}
require_once CORE . "/class.{$mode}.php";
return $mode == 'administration' ? Administration::instance() : Frontend::instance();
}
开发者ID:nils-werner,项目名称:symphony-2,代码行数:8,代码来源:index.php
示例15: setup
/**
* Register hooks and load options.
*
* @since 1.0.0
*/
public static function setup()
{
// Setup the registry
Registry::load();
// Register the hooks of the subsystems
Frontend::register_hooks();
Backend::register_hooks();
}
开发者ID:dougwollison,项目名称:index-pages,代码行数:13,代码来源:class-indexpages-system.php
示例16: renderer_json
function renderer_json($mode)
{
if (strtolower($mode) == 'administration') {
throw new Lib\Exceptions\InvalidModeException('JSON Renderer launcher is only available on the frontend');
}
$renderer = Frontend::instance();
// Check if we should enable exception debug information
$exceptionDebugEnabled = Symphony::isLoggedIn();
// Use the JSON exception and error handlers instead of the Symphony one.
Lib\ExceptionHandler::initialise($exceptionDebugEnabled);
Lib\ErrorHandler::initialise($exceptionDebugEnabled);
// #1808
if (isset($_SERVER['HTTP_MOD_REWRITE'])) {
throw new Exception("mod_rewrite is required, however is not enabled.");
}
$output = $renderer->display(getCurrentPage());
cleanup_session_cookies();
if (in_array('JSON', Frontend::Page()->pageData()['type'])) {
// Load the output into a SimpleXML Container and convert to JSON
try {
$xml = new SimpleXMLElement($output, LIBXML_NOCDATA);
// Convert the XML to a plain array. This step is necessary as we cannot
// use JSON_PRETTY_PRINT directly on a SimpleXMLElement object
$outputArray = json_decode(json_encode($xml), true);
// Get the transforer object ready. Other extensions will
// add their transormations to this.
$transformer = new Lib\Transformer();
/**
* Allow other extensions to add their own transformers
*/
Symphony::ExtensionManager()->notifyMembers('APIFrameworkJSONRendererAppendTransformations', '/frontend/', ['transformer' => &$transformer]);
// Apply transformations
$outputArray = $transformer->run($outputArray);
// Now put the array through a json_encode
$output = json_encode($outputArray, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
} catch (\Exception $e) {
// This happened because the input was not valid XML. This could
// occur for a few reasons, but there are two scenarios
// we are interested in.
// 1) This is a devkit page (profile, debug etc). We want the data
// to be passed through and displayed rather than converted into
// JSON. There is no easy way in Symphony to tell if a devkit has
// control over the page, so instead lets inspect the output for
// any signs a devkit is rendering the page.
// 2) It is actually bad XML. In that case we need to let the error
// bubble through.
// Currently the easiest method is to check for the devkit.min.css
// in the output. This may fail in the furture if this file is
// renamed or moved.
if (!preg_match("@\\/symphony\\/assets\\/css\\/devkit.min.css@", $output)) {
throw $e;
}
}
}
echo $output;
return $renderer;
}
开发者ID:pointybeard,项目名称:api_framework,代码行数:57,代码来源:JsonRendererLauncher.php
示例17: display
public function display($page)
{
self::$_page = new FrontendPage($this);
####
# Delegate: FrontendInitialised
$this->ExtensionManager->notifyMembers('FrontendInitialised', '/frontend/');
$output = self::$_page->generate($page);
return $output;
}
开发者ID:bauhouse,项目名称:sym-fluidgrids,代码行数:9,代码来源:class.frontend.php
示例18: __construct
public function __construct($message)
{
parent::__construct($message);
$this->error = NULL;
$bFoundFile = false;
if (XSLProc::getErrors() instanceof MessageStack) {
foreach (XSLProc::getErrors() as $e) {
if ($e->type == XSLProc::ERROR_XML) {
$this->error = $errors[0];
$this->file = XSLProc::lastXML();
$this->line = $this->error->line;
$bFoundFile = true;
break;
} elseif (strlen(trim($e->file)) == 0) {
continue;
}
$this->error = $errors[0];
$this->file = $this->error->file;
$this->line = $this->error->line;
$bFoundFile = true;
break;
}
if (is_null($this->error)) {
foreach (XSLProc::getErrors() as $e) {
if (preg_match_all('/(\\/?[^\\/\\s]+\\/.+.xsl) line (\\d+)/i', $e->message, $matches, PREG_SET_ORDER)) {
$this->file = $matches[0][1];
$this->line = $matches[0][2];
$bFoundFile = true;
break;
} elseif (preg_match_all('/([^:]+): (.+) line (\\d+)/i', $e->message, $matches, PREG_SET_ORDER)) {
//throw new Exception("Fix XSLPROC Frontend doesn't have access to Page");
$this->line = $matches[0][3];
$this->file = VIEWS . '/' . Frontend::instance()->loadedView()->templatePathname();
$bFoundFile = true;
}
}
}
}
/*
// FIXME: This happens when there is an error in the page XSL. Since it is loaded in to a string then passed to the processor it does not return a file
if(!$bFoundFile){
$page = Symphony::parent()->Page()->pageData();
$this->file = VIEWS . '/' . $page['filelocation'];
$this->line = 0;
// Need to look for a potential line number, since
// it will not have been grabbed
foreach($errors as $e){
if($e->line > 0){
$this->line = $e->line;
break;
}
}
}
*/
}
开发者ID:brendo,项目名称:symphony-3,代码行数:56,代码来源:class.xslproc.php
示例19: setContentDisposition
public function setContentDisposition(array $context = NULL)
{
$page_data = Frontend::Page()->pageData();
foreach ($page_data['type'] as $type) {
if (substr($type, 0, 1) == ".") {
$FileName = $page_data['handle'];
Frontend::Page()->addHeaderToPage('Content-Disposition', 'attachment; filename=' . $FileName . $type);
}
}
}
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:10,代码来源:extension.driver.php
示例20: handle
/**
* The main handler for the specfied handle.
*
* @param string $handle The instance handle.
*
* @return Handler
*/
public function handle($handle)
{
// Sanitize the handle name.
$this->handle = $this->utility->sanitize_handle($handle);
// Register this handle with the frontend class.
$this->frontend->register_handle($this->handle);
// Register the Ajax handler in the WordPress hook system.
add_action('wp_ajax_' . $this->handle, array($this, 'ajax_handler'));
add_action('wp_ajax_nopriv_' . $this->handle, array($this, 'ajax_handler'));
return $this;
}
开发者ID:philipnewcomer,项目名称:wp-ajax-helper,代码行数:18,代码来源:Handler.php
注:本文中的Frontend类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论