本文整理汇总了PHP中Settings::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::getValue方法的具体用法?PHP Settings::getValue怎么用?PHP Settings::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
$template = new Template();
$template->load("plugins");
$plugins = new PluginList();
$plugins->loadAll();
foreach ($plugins->plugins as $plugin) {
$index = $template->add_loop_item("PLUGINS");
if (isset($_GET['activate']) && $_GET['activate'] == $plugin->path) {
$plugin->activate();
} elseif (isset($_GET['deactivate']) && $_GET['deactivate'] == $plugin->path) {
$plugin->deactivate();
}
$template->assign_loop_var("PLUGINS", $index, "NAME", htmlentities($plugin->name));
$template->assign_loop_var("PLUGINS", $index, "PATH", htmlentities($plugin->path));
$template->assign_loop_var("PLUGINS", $index, "DESCRIPTION", htmlentities($plugin->getDescription()));
$template->assign_loop_var("PLUGINS", $index, "VERSION", $plugin->version);
$template->assign_loop_var("PLUGINS", $index, "AUTHORLINK", $plugin->authorLink);
$template->assign_loop_var("PLUGINS", $index, "AUTHORNAME", htmlentities($plugin->authorName));
$template->assign_loop_var("PLUGINS", $index, "LICENSE", htmlentities($plugin->license));
$template->assign_loop_var("PLUGINS", $index, "LICENSEURL", htmlentities($plugin->licenseUrl));
if ($plugin->isActivated()) {
$myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "deactivate=" . urlencode($plugin->path));
$disable = Language::DirectTranslateHtml("DISABLE");
$template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $disable . "</a>");
} else {
$myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "activate=" . urlencode($plugin->path));
$enable = Language::DirectTranslateHtml("ENABLE");
$template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $enable . "</a>");
}
}
$template->assign_var("HOST", Settings::getValue("host"));
$template->assign_var("APIKEY", Settings::getValue("apikey"));
$template->output();
}
示例2: add_comment
public function add_comment()
{
if (!$this->post->commentsEnabled()) {
return $this->redirect("/articles/" . $this->post->getUrl());
}
// very basic honeypot stuff
if ($this->request->getVar("details")) {
$this->setErrors(array("details" => "Please do not fill in the details field"));
return $this->render("view_post");
}
$comment = Table::factory('Comments')->newObject();
$name = $this->request->getVar("name") != "" ? $this->request->getVar("name") : "Anonymous";
$data = array("post_id" => $this->post->getId(), "name" => $name, "email" => $this->request->getVar("email"), "content" => $this->request->getVar("content"), "approved" => false, "ip" => $this->request->getIp(), "notifications" => $this->request->getVar("notifications"));
if ($comment->setValues($data)) {
$comment->save();
$address = Settings::getValue("contact.address");
$subject = "New comment submission (paynedigital.com)";
$from = $comment->name . " <" . $comment->email . ">";
$email = Email::factory();
$email->setFrom($from);
$email->setTo($address);
$email->setSubject($subject);
$email->setBody($this->fetchTemplate("emails/comment", array("post" => $this->post, "comment" => $comment)));
$email->send();
if (!$this->request->isAjax()) {
$this->setFlash("comment_thanks");
return $this->redirect("/articles/" . $this->post->getUrl() . "/comment/thanks#comments");
}
} else {
$this->setErrors($comment->getErrors());
}
return $this->render("view_post");
}
示例3: load
/**
*
* @param mixed $data
* @param boolean $loadforbreadcrumb
*/
function load($data, $loadforbreadcrumb = false)
{
if ($data) {
$this->id = $data->id;
$this->title = $data->title;
$this->ownerid = $data->owner;
$this->menu = $data->menu;
$this->alias = $data->alias;
$this->editorContent = $data->content;
$this->loadforbeadrcumb = $loadforbreadcrumb;
$this->editorText = $data->editor;
$this->canonical = $data->canonical;
$this->advancedHtmlHeader = $data->advanced_html_header;
$this->changeFrequence = $data->change_frequence;
$this->priority = $data->priority;
$this->inSitemap = $data->in_sitemap_ifnull == 1;
if (!isset(User::Current()->role) || !User::Current()->role->canAccess($this)) {
if (Settings::getValue("accessdenied") != $this->id) {
throw new AccessDeniedException("Access denied: " . $this->alias);
}
}
} else {
throw new FileNotFoundException("File Not Found: " . $this->alias);
}
}
示例4: run
function run()
{
$theme = Settings::getValue('theme');
$module = ($result = explode('/', Request::get('module'))) && sizeof($result) > 1 ? $result[sizeof($result) - 1] : Request::get('module');
$this->template = App::getAppName() . strtoupper(substr($module, 0, 1)) . substr($module, 1) . strtoupper(substr(Request::get('action'), 0, 1)) . substr(Request::get('action'), 1);
$this->defaultVar = array('theme_name' => $theme, 'theme_url' => App::getAppUrl() . APP_TEMPLATES_DIR . DS . 'themes' . DS . $theme . DS, 'dir_include_frontend' => APP_DIR . DS . 'connection' . DS . APP_TEMPLATES_DIR . DS . 'frontend' . DS . 'include');
$assign = is_array($result = $this->execute()) ? $result : array();
if ($this->exit) {
return;
}
if ($this->notFound) {
$this->setSeoPage('404');
}
$seo = connectionSeoModel::create()->getByLocale($this->seoPage, Language::getActiveLanguageISO());
if (empty($this->default['page_title'])) {
$this->default['page_title'] = $seo['title'];
}
if (empty($this->default['page_meta']['description'])) {
$this->default['page_meta']['description'] = $seo['description'];
}
if (empty($this->default['page_meta']['keywords'])) {
$this->default['page_meta']['keywords'] = $seo['keywords'];
}
if ($this->notFound) {
$sourceAction = $this->fenom->fetch('themes/' . $theme . '/404.html', array_merge($assign, $this->defaultVar));
} else {
$sourceAction = $this->fenom->fetch(Request::get('module') . DS . $this->template . '.html', array_merge($assign, $this->defaultVar));
}
if ($this->frame) {
$this->fenom->display('themes/' . $theme . '/index.html', array_merge(array('action' => $sourceAction), $this->default, $this->defaultVar));
} else {
echo $sourceAction;
}
}
示例5: index
public function index()
{
if ($this->request->isGet()) {
$this->assign("columns", Table::factory('Contacts')->getColumns());
}
if ($this->request->isPost()) {
$contact = Table::factory('Contacts')->newObject();
if ($contact->setValues($this->request->getPost())) {
// all good. add, and stuff
$contact->save();
$address = Settings::getValue("contact.address");
$subject = "Enquiry via paynedigital.com";
$from = $contact->name . " <" . $contact->email . ">";
$email = Email::factory();
$email->setFrom($from);
$email->setTo($address);
$email->setSubject($subject);
$email->setBody($this->fetchTemplate("emails/contact", array("query" => $contact->content, "name" => $contact->name)));
$email->send();
if (!$this->request->isAjax()) {
$this->setFlash("contact_thanks");
return $this->redirectAction("thanks");
}
} else {
$this->setErrors($contact->getErrors());
}
}
}
示例6: getColors
/**
* Farbeinstellungen des Benutzers auslesen
*
* @return array Farbwerte aus der global.ini als Array
*/
function getColors()
{
// Einstellungen aus der global.ini auslesen
$hColors = Settings::getValue('global', 'colors');
if (!$hColors) {
say("Farbeinstellungen konnten nicht ausgelesen werden");
return false;
}
$hSettingsToChange = array();
// Hauptfarbe nicht vorhanden -> Alles abbrechen
if (!array_key_exists('main', $hColors) || $hColors['main'] === '{{hauptfarbe}}') {
say('Es fehlt die Hauptfarbe in der global.ini! ');
say('Bitte stellen Sie sicher, dass ein Bereich [colors] vorhanden ist. ');
say('Setzen Sie darunter eine Zeile mit dem Inhalt main="#<ihrefarbe>". ');
say('Beispiel: ');
say('main="#027a8b"');
// Nach Hauptfarbe fragen
$sMainColor = null;
do {
if ($sMainColor !== null) {
say('Ihre angegebene Farbe ist keine Hex-Farbe.');
}
$sMainColor = ask("Bitte geben Sie Ihre Hauptfarbe im Format #rrggbb an: ");
} while (!preg_match('/^#[0-9a-z]{3}([0-9a-z]{3})?$/i', $sMainColor));
$hColors['main'] = $sMainColor;
$hSettingsToChange['main'] = '"' . $sMainColor . '"';
}
// Akzentfarbe nicht angegeben -> Hauptfarbe uebernehmen
if (!array_key_exists('accent', $hColors) || $hColors['accent'] === '{{akzentfarbe}}') {
say('Es wurde keine Akzentfarbe angegeben. Verwende Hauptfarbe als Akzentfarbe. ');
say('Damit eine Akzentfarbe verwendet werden kann, muss in der global.ini ');
say('eine Zeile mit dem Inhalt accent="#<ihrefarbe>" vorhanden sein. ');
say('Beispiel: ');
say('accent="#f59000"');
// Nach Akzentfarbe fragen
$sAccentColor = null;
do {
if ($sAccentColor !== null) {
say('Ihre angegebene Farbe ist keine Hex-Farbe.');
}
$sAccentColor = ask("Bitte geben Sie Ihre Akzentfarbe im Format #rrggbb an: ");
} while (!preg_match('/^#[0-9a-z]{3}([0-9a-z]{3})?$/i', $sAccentColor));
$hColors['accent'] = $sAccentColor;
$hSettingsToChange['accent'] = '"' . $sAccentColor . '"';
}
// Darkmode nicht angegeben -> nicht aktivieren
if (!array_key_exists('darkmode', $hColors) || $hColors['darkmode'] === '{{farben-invertieren}}') {
say('In den Einstellungen fehlt die Angabe der Invertierung. ');
say('Soll der Text weiss auf schwarz dargestellt werden? (y/n): ');
$hColors['darkmode'] = getCliBool();
$hSettingsToChange['darkmode'] = $hColors['darkmode'] ? 'true' : 'false';
}
// Farbcode-Angaben auch in der global.ini uebernehmen
if (count($hSettingsToChange) > 0) {
updateGlobalConfig($hSettingsToChange);
}
return $hColors;
}
示例7: execute
function execute()
{
$limit = (int) Settings::getValue('users_on_page');
$page = Request::get('page') ? Request::get('page') : 1;
$users = ConnectionSearchUser::create()->search(array('online' => 1), $limit, ($page - 1) * $limit, Request::get('sort') ? Request::get('sort') : 'date');
$pages = ceil($users['count'] / $limit);
$this->setSeoPage('online');
return array('online_page' => $page, 'online_pages' => $pages, 'online_count' => $users['count'], 'users' => $users['result']);
}
示例8: execute
function execute()
{
$path = Request::post('path');
$theme = Settings::getValue('theme', 'connection');
$dir = APP_DIR . DS . 'connection' . DS . APP_TEMPLATES_DIR . DS . 'themes' . DS . $theme . DS . $path;
$info = pathinfo($dir);
Language::$active = false;
return array('file' => file_get_contents($dir), 'type' => strtolower($info['extension']), 'path' => $path);
}
示例9: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$roles = $this->role->paginate(Settings::getValue('TABLE_ELEMENTS'));
if (Request::ajax()) {
$roles = Role::where('role', 'like', '%' . Input::get('term', '') . '%')->get(array('id', 'role'));
return $roles;
}
return View::make('backend.roles.index', compact('roles'));
}
示例10: RaiseEvent
/**
*
* @param string $name
* @param array $args
*/
public static function RaiseEvent($name, $args)
{
$handler = self::getHandler($name);
if ($handler) {
foreach ($handler as $file) {
include_once Settings::getValue("root") . $file;
}
}
}
示例11: execute
function execute()
{
$locale = new Locales('connection');
$list = $locale->getList();
$pageModel = new connectionPagesModel();
$this->smarty->assign('pages', $pageModel->fetchAll());
$this->smarty->assign('lang', $list);
$this->smarty->assign('page_url', Settings::getValue('page_url'));
}
示例12: fetch
protected function fetch($userAgent = null, $cookie = null, $referrer = null, \Proxy $proxy = null)
{
sleep(Settings::getValue(Settings::GOOGLE_SEARCH_COOLDOWN));
$body = file_get_contents($this->getUrl());
$json = json_decode($body);
if ($json->responseStatus != 200) {
throw new Exception(String::build('Can\'t fetch results from {search_engine}. Response status: {status} ({details})', array('search_engine' => $this->getSearchEngine(), 'status' => $json->responseStatus, 'details' => $json->responseDetails)));
}
return $json->responseData->results;
}
示例13: getDescription
/**
*
* @return string description of the plugin
*/
public function getDescription()
{
$res = "";
$tokens = array();
@(include Settings::getValue("root") . "system/plugins/" . $this->path . "/languages/" . strtolower(Language::GetGlobal()->language) . ".php");
if (isset($tokens['plugin_description'])) {
$res = $tokens['plugin_description'];
}
return $res;
}
示例14: init
public function init()
{
$append = trim(file_get_contents(PROJECT_ROOT . ".append"));
$this->assign('assetPath', $append);
$section = null;
$segments = explode("/", $this->request->getUrl());
if (count($segments) > 1) {
$section = $segments[1];
}
$this->assign('section', $section);
$this->assign('static_path', Settings::getValue("site.static_path"));
}
示例15: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$filter = array_fill_keys($this->proposal->getAllColumnsNames(), "");
$stop_fields = array('filter', 'user_id');
$input = Input::all();
if (isset($input['filter']) && $input['filter'] == 'apply') {
$filter = array_merge($filter, $input);
Session::put("PROPOSALS_FILTER", $filter);
}
if (isset($input['filter']) && $input['filter'] == 'reset') {
Session::forget('PROPOSALS_FILTER');
}
if (isset($input['sort_value'])) {
$sort = $input['sort_value'];
$sort_dir = $input['sort_dir'];
Session::put("PROPOSALS_SORT", array('value' => $sort, 'dir' => $sort_dir));
}
$sort = Session::get('PROPOSALS_SORT');
if (isset($input['filter']) && $input['filter'] == 'reset') {
Session::forget('PROPOSALS_FILTER');
}
if (Session::has('PROPOSALS_FILTER')) {
$filter = Session::get('PROPOSALS_FILTER');
$proposals = $this->proposal->where('id', '>', '0');
foreach ($filter as $k => $v) {
if (!in_array($k, $stop_fields) && $v != '') {
$proposals = $proposals->where($k, 'like', '%' . $v . '%');
}
}
if ($filter['user_id']) {
$users = User::where('username', 'like', '%' . $filter['user_id'] . '%')->get();
$proposals = $proposals->whereIn('user_id', $users->pluck('id')->all());
}
if (Session::has('PROPOSALS_SORT') && $sort['value'] != '') {
$proposals = $proposals->orderBy($sort['value'], $sort['dir'] == '1' ? 'desc' : '');
}
$proposals = $proposals->paginate(Settings::getValue('TABLE_ELEMENTS'));
} else {
if (Session::has('PROPOSALS_SORT') && $sort['value'] != '') {
$proposals = $this->proposal->orderBy($sort['value'], $sort['dir'] == '1' ? 'desc' : 'asc');
} else {
$proposals = $this->proposal;
}
$proposals = $proposals->paginate(Settings::getValue('TABLE_ELEMENTS'));
}
$sort_options = Proposal::getSortOptions();
return View::make('backend.proposals.index', compact("proposals", 'filter', 'sort_options', 'sort'));
}