public function getAllDocuments() { $objStaticPage = new StaticPage($this->bdd, $this->_TABLES); $documents = $objStaticPage->getAllStaticPages(); if ($documents) { return $documents; } else { return null; } }
function &_returnStaticPageFromRow(&$row) { $staticPagesPlugin =& PluginRegistry::getPlugin('generic', 'StaticPagesPlugin'); $staticPagesPlugin->import('StaticPage'); $staticPage = new StaticPage(); $staticPage->setId($row['static_page_id']); $staticPage->setPath($row['path']); $staticPage->setConferenceId($row['conference_id']); $this->getDataObjectSettings('static_page_settings', 'static_page_id', $row['static_page_id'], $staticPage); return $staticPage; }
private function make_index() { $static = new StaticPage(); $time = 60; $saveDir = ROOT_PATH; $activePage = "http://" . $_SERVER['HTTP_HOST'] . "/index.php"; $fileName = $static->getPageName(basename($activePage), 'html'); $flag = $static->reMakeCondition($saveDir . '/' . $fileName, $time); if (!$flag) { } $static->makeStaticPage($activePage, 'html', $saveDir); }
/** * @return array CMenu-prepared links array */ public function mainMenuLinks() { $links = array(); foreach (StaticPage::model()->mainMenu()->findAll() as $p) { $links[] = array("label" => $p->title, "url" => array($this->actionView, "id" => $p->path ? $p->path : $p->id)); } return $links; }
/** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); DB::table('static_page')->delete(); StaticPage::create(array('id' => 1, 'title' => 'О Нас', 'url' => 'about-us', 'meta_keywords' => 'Used in the head of an individual article page template, the meta keywords tag is a single tag.', 'meta_description' => 'outputs nothing (yet) on posts, outputs the blog description on all other pages.', 'description' => 'I was really excited about my upcoming job interview because I read in the job description.', 'user_id' => 1)); StaticPage::create(array('id' => 2, 'title' => 'Наши услуги', 'url' => 'our-services', 'meta_keywords' => 'Used in the head of an individual', 'meta_description' => 'outputs nothing (yet)', 'description' => 'my upcoming job', 'user_id' => 2)); StaticPage::create(array('id' => 3, 'title' => 'Как нас найти', 'url' => 'how-can-you-find-us', 'meta_keywords' => 'Varizon', 'meta_description' => 'Verizon Communications Inc', 'description' => 'Verizon Communications Inc., branded as Verizon, is an American broadband and telecommunications company, the largest U.S. ', 'user_id' => 2)); StaticPage::create(array('id' => 4, 'title' => 'Залог успеха', 'url' => 'resept-of-successful-life', 'meta_keywords' => 'DROID Turbo', 'meta_description' => 'Smartphones', 'description' => 'The award-winning DROID Turbo is now available in textured and durable Gray Ballistic Nylon — Only on Verizon.', 'user_id' => 1)); $this->command->info('Static page table seeded!'); }
/** * Generates static page URL * * @param array $params * @param Smarty $smarty * @return string * * @package application.helper.smarty * @author Integry Systems */ function smarty_function_pageUrl($params, LiveCartSmarty $smarty) { if (!class_exists('StaticPage', false)) { ClassLoader::import('application.model.staticpage.StaticPage'); } if (isset($params['id'])) { $params['data'] = StaticPage::getInstanceById($params['id'], StaticPage::LOAD_DATA)->toArray(); } $urlParams = array('controller' => 'staticPage', 'action' => 'view', 'handle' => $params['data']['handle']); return $smarty->getApplication()->getRouter()->createUrl($urlParams, true); }
/** * Generates static page title * * @param array $params * @param Smarty $smarty * @return string * * @package application.helper.smarty * @author Integry Systems */ function smarty_function_pageName($params, Smarty_Internal_Template $smarty) { if (!class_exists('StaticPage', false)) { ClassLoader::import('application.model.staticpage.StaticPage'); } if (!isset($params['id'])) { return '<span style="color: red; font-weight: bold; font-size: larger;">No static page ID provided</span>'; } $page = StaticPage::getInstanceById($params['id'], StaticPage::LOAD_DATA)->toArray(); return $page[!empty($params['text']) ? 'text_lang' : 'title_lang']; }
function testUpdate() { $page = StaticPage::getNewInstance(); $page->setValueByLang('title', 'en', 'test title'); $page->save(); $page->setValueByLang('title', 'en', 'changed'); $page->save(); ActiveRecord::clearPool(); $instance = StaticPage::getInstanceById($page->getID()); $this->assertEqual($page->getValueByLang('title', 'en'), 'changed'); // test deleting a page $this->assertTrue(file_exists($page->getFileName())); $page->delete(); $this->assertFalse(file_exists($page->getFileName())); }
public function view() { $this->loadLanguageFile('Frontend'); $page = StaticPage::getInstanceByHandle($this->request->get('handle')); if ($parent = $page->parent->get()) { while ($parent) { $parent->load(); $urlParams = array('controller' => 'staticPage', 'action' => 'view', 'handle' => $parent->handle->get()); $this->addBreadCrumb($parent->getValueByLang('title'), $this->router->createUrl($urlParams, true)); $parent = $parent->parent->get(); } } $pageArray = $page->toArray(); $this->addBreadCrumb($pageArray['title_lang'], ''); $response = new ActionResponse('page', $pageArray); $response->set('subPages', $page->getSubPageArray()); return $response; }
/** * Caches menu items for a given entity and returns an array of the menu items * * @param \StaticPage $root_entity Root entity to fetch the menu items for * * @return array|false */ public static function generateMenuItemsCache(\StaticPage $root_entity) { if (!$root_entity instanceof \StaticPage) { return false; } $static_items = []; $priority = (int) $root_entity->order; if (empty($priority)) { $priority = (int) $root_entity->time_created; } $root_menu_options = ['name' => $root_entity->getGUID(), 'rel' => $root_entity->getGUID(), 'href' => $root_entity->getURL(), 'text' => elgg_format_element('span', [], $root_entity->title), 'priority' => $priority, 'section' => 'static']; if ($root_entity->canEdit()) { $root_menu_options['itemClass'] = ['static-sortable']; } // add main menu items $static_items[$root_entity->getGUID()] = \ElggMenuItem::factory($root_menu_options); // add all sub menu items so they are cacheable $ia = elgg_set_ignore_access(true); $submenu_entities = elgg_get_entities_from_relationship(['type' => 'object', 'subtype' => \StaticPage::SUBTYPE, 'relationship_guid' => $root_entity->getGUID(), 'relationship' => 'subpage_of', 'limit' => false, 'inverse_relationship' => true]); if ($submenu_entities) { foreach ($submenu_entities as $submenu_item) { if (!has_access_to_entity($submenu_item) && !$submenu_item->canEdit()) { continue; } $priority = (int) $submenu_item->order; if (empty($priority)) { $priority = (int) $submenu_item->time_created; } $static_items[$submenu_item->getGUID()] = \ElggMenuItem::factory(['name' => $submenu_item->getGUID(), 'rel' => $submenu_item->getGUID(), 'href' => $submenu_item->getURL(), 'text' => elgg_format_element('span', [], $submenu_item->title), 'priority' => $priority, 'parent_name' => $submenu_item->getContainerGUID(), 'section' => 'static']); } } elgg_set_ignore_access($ia); $file = new \ElggFile(); $file->owner_guid = $root_entity->getGUID(); $file->setFilename('static_menu_item_cache'); $file->open('write'); $file->write(serialize($static_items)); $file->close(); return $static_items; }
$parent_guid = $owner->getGUID(); } if ($can_write) { elgg_set_ignore_access($ia); } if ($guid) { $ia = elgg_set_ignore_access(true); $entity = get_entity($guid); elgg_set_ignore_access($ia); if (!elgg_instanceof($entity, 'object', 'static') || !$entity->canEdit()) { forward(REFERER); } } $new_entity = false; if (!$entity) { $entity = new \StaticPage(); $entity->owner_guid = $owner->getGUID(); $entity->container_guid = $parent_guid; $entity->access_id = $access_id; $ia = elgg_set_ignore_access(true); if (!$entity->save()) { elgg_set_ignore_access($ia); register_error(elgg_echo('actionunauthorized')); forward(REFERER); } elgg_set_ignore_access($ia); $new_entity = true; } if ($parent_guid !== $entity->getContainerGUID()) { // reset order if moved to another parent unset($entity->order);
protected function create_html($activePage, $filename = '', $saveDir) { $static = new StaticPage(); $static->makeStaticPage($activePage, 'html', $saveDir, $filename); }
<?php $login_required = FALSE; $use_theme = 'Beta'; //TODO : Remove this when new UI is completely implemented. include "includes/page.php"; require_once "{$path_prefix}/ext/StaticPage/StaticPage.php"; $msg = array(); $page = !empty($_GET['caption']) ? $_GET['caption'] : NULL; $static_page = StaticPage::get(array('url' => $page)); if (empty($static_page)) { $msg[] = MessagesHandler::get_message(12009); } function setup_module($column, $module, $obj) { global $static_page; switch ($module) { case 'StaticPageDisplayModule': if (!empty($msg)) { return 'skip'; } $obj->text = $static_page[0]->page_text; break; } } $page = new PageRenderer("setup_module", PAGE_STATIC_PAGE_DISPLAY, "Static Pages", "container_two_column.tpl", "header_user.tpl", NULL, PRI, $network_info); if (!empty($msg)) { for ($counter = 0; $counter < count($msg); $counter++) { $message .= $msg[$counter] . "<br>"; } }
<?php /** * Action file for add/Update of Static Pages * * @package addstaticPages_a.php * @section action/general */ if (!isset($stPageObj)) { include_once SITE_CLASS_APPLICATION . "class.StaticPage.php"; $stPageObj = new StaticPage(); } $view = PostVar("view"); $Data = PostVar("Data"); $iSPageId = PostVar("iSPageId"); $actionfile = GetVar("file"); $lang = $gdbobj->getLanguage(); for ($i = 0; $i < count($lang); $i++) { $Data['tContent_' . $lang[$i]['vLanguageCode']] = trim(stripslashes($Data['tContent_' . $lang[$i]['vLanguageCode']])); } /** This is for Check Duplicate Record-------------------------------------------*/ $generalobj->getRequestVars(); $redirect_file = "index.php?file={$file}&view={$view}&iSPageId={$iSPageId}"; $generalobj->checkDuplicate('iSPageId', PRJ_DB_PREFIX . "_static_pages", array('vFile' => $Data['vFile']), $redirect_file, PAGE_ALREADY_EXISTS, $iSPageId); if ($view == "add") { //prints($Data);exit; $stPageObj->setAllVar($Data); $result = $stPageObj->insert(); if ($result) { $var_msg = "Record Added Successfully."; } else {
<?php /** * Add/Update File For Static Pages * * @package addstaticPages.inc.php */ if (!isset($stPageObj)) { include_once SITE_CLASS_APPLICATION . "class.StaticPage.php"; $stPageObj = new StaticPage(); } $gdbobj->getRequestVars(); $view = GetVar("view"); $iSPageId = GetVar("iSPageId"); $actionfile = GetVar("file"); $arr = array(); if (count($_POST) > 0) { $arr[0] = $_POST; } else { if ($view == 'edit') { $arr = $stPageObj->getStaticPageDetail("*", "AND iSPageId = '{$iSPageId}'"); //prints($arr);exit; } else { $view = "add"; } } $arr[0]['vFile'] = isset($arr[0]['vFile']) ? $arr[0]['vFile'] : ''; include_once CK_EDITOR_PATH . 'ckeditor.php'; include_once CK_EDITOR_PATH . 'ckfinder/ckfinder.php'; $ckeditor = new CKEditor(); $ckeditor->basePath = CK_EDITOR_URL;
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { if (is_numeric($id)) { $model = StaticPage::model()->findByPk($id); } else { $model = StaticPage::model()->findByPath($id); } if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * POST Form for delete the specified resource. * * @return Response */ public function doDelete() { $aData = Input::all(); if (isset($aData['id'])) { $static_page = StaticPage::find($aData['id']); $static_page->delete(); return Redirect::route('page-list')->with('message', 'Static page removed'); } return Redirect::route('page-list')->with('message', 'Произошла ошибка удаления'); }
private function save(StaticPage $page, $updateMenu = true) { $request = $this->getRequest(); $page->getSpecification(); $page->loadRequestData($request); if ($updateMenu) { $menu = array('INFORMATION' => !!$request->get('menuInformation'), 'ROOT_CATEGORIES' => !!$request->get('menuRootCategories')); if ($menu['INFORMATION'] == false && $menu['ROOT_CATEGORIES'] == false) { $menu = null; } $page->menu->set($menu); } $page->save(); $arr = $page->toArray(); return new JSONResponse(array('id' => $page->getID(), 'title' => $arr['title_lang']), 'success', $this->translate('_page_has_been_successfully_saved')); }
function get_links() { $this->Paging["count"] = StaticPage::get(NULL, true); $footer_links = StaticPage::get(NULL, false, $this->Paging['page'], $this->Paging['show']); return $footer_links; }
if (isset($_COOKIE['bt_prc']) && isset($_SESSION['prc']) && $_COOKIE['bt_prc'] != $_SESSION['prc']) { // echo "Multi browsing in this site is not allowed !"; exit; } else { $dv[0] = ""; $dv[1] = calcGTzTime(date('Y-m-d H:i:s'), 'Y-m-d H:i:s'); $c = $generalobj->genUniqueCode($dv); $prc = $_SESSION['prc'] = $c . "/" . $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ID']; // setcookie('bt_prc',$prc); $smarty->assign("prc", $prc); } } } $dv = ""; if (!isset($stPageObj)) { include_once SITE_CLASS_APPLICATION . "class.StaticPage.php"; $stPageObj = new StaticPage(); } if (!isset($lhObj)) { include_once SITE_CLASS_APPLICATION . "class.LoginHistory.php"; $lhObj = new LoginHistory(); } if (!isset($orgObj)) { include_once SITE_CLASS_APPLICATION . "organization/class.Organization.php"; $orgObj = new Organization(); } if (!isset($orgUsrObj)) { require_once SITE_CLASS_APPLICATION . "user/class.OrganizationUser.php"; $orgUsrObj = new OrganizationUser(); } if (!isset($orgUserPerObj)) { require_once SITE_CLASS_APPLICATION . "user/class.OrganizationUserPermission.php";
public function getNextStaticPage() { if (!($data = $this->loadRecord('SELECT * FROM ' . $this->getTablePrefix() . 'aux_pages'))) { return null; } $page = StaticPage::getNewInstance(); $page->setValueByLang('title', $this->defLang, $data['aux_page_name']); $page->setValueByLang('text', $this->defLang, $data['aux_page_text']); $page->menu->set(array('INFORMATION' => true)); return $page; }
* For questions, help, comments, discussion, etc. please visit * http://www.cyberspace-networks.com * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ $login_required = TRUE; include_once "web/includes/cnpage.php"; require_once "web/includes/cnnetwork.php"; require_once "api/CNStaticPage/CNStaticPage.php"; require_once "web/includes/classes/CNPagination.php"; $msg = array(); $edit = FALSE; $error = false; // reset any previous errors if (!empty($_POST) && !empty($_POST['btn_static_pages'])) { // if page is submitted $static_page = new StaticPage(); filter_all_post($_POST); if (!empty($_REQUEST['id'])) { $static_page->id = $_REQUEST['id']; $msg_id = 12007; } else { $msg_id = 12008; } $mandatory_fields = array('caption' => __('Caption'), 'page_text' => __('Page Text')); foreach ($mandatory_fields as $key => $value) { if (empty($_POST[$key])) { $error = TRUE; $msg[] = sprintf("%s can't be emtpy.", $value); } } if (empty($_REQUEST['do'])) {
public function setConfig() { if (!$this->buildConfigValidator()->isValid()) { return new ActionRedirectResponse('install', 'config'); } Language::deleteCache(); // site name $this->config->setValueByLang('STORE_NAME', $this->request->get('language'), $this->request->get('name')); $this->config->save(); ClassLoader::import('application.model.Currency'); // create currency if (ActiveRecord::objectExists('Currency', $this->request->get('curr'))) { $currency = Currency::getInstanceByID($this->request->get('curr'), Currency::LOAD_DATA); } else { $currency = ActiveRecord::getNewInstance('Currency'); $currency->setID($this->request->get('curr')); $currency->isEnabled->set(true); $currency->isDefault->set(true); $currency->save(ActiveRecord::PERFORM_INSERT); } ClassLoader::import('application.model.system.Language'); // create language if (ActiveRecord::objectExists('Language', $this->request->get('language'))) { $language = Language::getInstanceByID($this->request->get('language'), Language::LOAD_DATA); } else { $language = ActiveRecord::getNewInstance('Language'); $language->setID($this->request->get('language')); $language->save(ActiveRecord::PERFORM_INSERT); $language->isEnabled->set(true); $language->isDefault->set(true); $language->save(); } // set root category name to "LiveCart" ClassLoader::import('application.model.category.Category'); $root = Category::getInstanceById(Category::ROOT_ID, Category::LOAD_DATA); $root->setValueByLang('name', $language->getID(), 'LiveCart'); $root->save(); // create a default shipping service ClassLoader::import('application.model.delivery.DeliveryZone'); ClassLoader::import('application.model.delivery.ShippingService'); ClassLoader::import('application.model.delivery.ShippingRate'); $service = ShippingService::getNewInstance(DeliveryZone::getDefaultZoneInstance(), 'Default Service', ShippingService::SUBTOTAL_BASED); $service->save(); $rate = ShippingRate::getNewInstance($service, 0, 100000); $rate->flatCharge->set(10); $rate->save(); // create a couple of blank static pages ClassLoader::import('application.model.staticpage.StaticPage'); $page = StaticPage::getNewInstance(); $page->setValueByLang('title', $language->getID(), 'Contact Info'); $page->setValueByLang('text', $language->getID(), 'Enter your contact information here'); $page->menu->set(array('INFORMATION' => true)); $page->save(); $page = StaticPage::getNewInstance(); $page->setValueByLang('title', $language->getID(), 'Shipping Policy'); $page->setValueByLang('text', $language->getID(), 'Enter your shipping rate & policy information here'); $page->menu->set(array('INFORMATION' => true)); $page->save(); // create an example site news post ClassLoader::import('application.model.sitenews.NewsPost'); $news = ActiveRecordModel::getNewInstance('NewsPost'); $news->setValueByLang('title', $language->getID(), 'Our store is open'); $news->setValueByLang('text', $language->getID(), 'Powered by LiveCart software, we have gone live! Of course, we will have to go to <a href="../backend">the backend area</a> and add some categories and products first...'); $news->setValueByLang('moreText', $language->getID(), 'Do not forget to delete this post when you actually go live :)'); $news->isEnabled->set(true); $news->save(); return new ActionRedirectResponse('install', 'finish'); }
function display_page($params = array()) { // canonicalize the input $area_name = $page_name = ""; // GET / if (count($params) == 0) { $area_name = "index"; $page_name = "index"; } // GET /area_name if (count($params) == 1) { $area_name = $params[0]; $page_name = "index"; } // GET /area_name/page_name if (count($params) > 1) { $area_name = $params[0]; $page_name = $params[1]; } if (ALIAS_INSTALL) { // Test the MyActiveRecord connection if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'alias'")) == 1) { // check the alias' in the database and see if there is a match $alias = Alias::FindAll(); /* die(print_r($alias)); */ foreach ($alias as $entry) { if ($entry->alias == $area_name || $entry->alias == "/" . $area_name) { redirect($entry->path); } } } } // check the routes to see if the requested page has an explicit route setup $page_options = $GLOBALS['ROUTES']; if (isset($page_options["/" . $area_name . "/" . $page_name])) { $page = StaticPage::FindByAreaAndName($area_name, $page_name); if (isset($page)) { display_admin_with_template($page); return true; } } // check for pages that are in the "global" area and have params (ie /calendar/2008/1) $global_area = Areas::FindByName('index'); $possible_page = Pages::FindByAreaAndName($global_area, $page_name) ? Pages::FindByAreaAndName($global_area, $area_name) : ''; if (!empty($possible_page)) { $area = $global_area; $page = $possible_page; } else { // for now, just include the first page that comes back. later we can handle multiple pages $area = Areas::FindByName($area_name); if (!isset($area)) { return false; } if (strstr($area_name, "-portfolio")) { if ($page_name != "index") { $page = Sections::FindByName($page_name); } else { $pages = $area->getSections(); $page = array_shift($pages); } } else { $page = Pages::FindPageOrIndex($area, $page_name); } } if (!isset($page)) { return false; } // check if the page is public or not $is_admin = false; $user = Users::GetCurrentUser(); if ($user) { $logged_in = true; } if ($page->public || !$page->public && $logged_in) { display_with_template($area, $page); } else { return false; } return true; }
protected function oldboxRootCategoryBlock() { ClassLoader::import('application.model.staticpage.StaticPage'); if ($this->config->get('TOP_MENU_HIDE')) { return; } if (!$this->config->get('TOP_MENU_HIDE_CATS')) { $topCategories = $this->getTopCategories($this->config->get('CAT_MENU_TOP_ROOT')); $ids = array(); foreach ($topCategories as $cat) { if ($cat['isEnabled']) { $ids[] = $cat['ID']; } } $f = new ARSelectFilter(new INCond(new ARFieldHandle('Category', 'parentNodeID'), $ids)); $f->setOrder(new ARFieldHandle('Category', 'parentNodeID')); $f->setOrder(new ARFieldHandle('Category', 'lft')); $subCategories = array(); foreach (ActiveRecordModel::getRecordSetArray('Category', $f) as $cat) { if ($cat['isEnabled']) { $subCategories[$cat['parentNodeID']][] = $cat; } } } $f = new ARSelectFilter(new IsNullCond(new ARFieldHandle('StaticPage', 'parentID'))); $f->mergeCondition(StaticPage::getIsRootCategoriesMenuCondition()); $f->setOrder(new ARFieldHandle('StaticPage', 'position')); $pages = ActiveRecordModel::getRecordSetArray('StaticPage', $f); $ids = array(); $subPages = array(); foreach ($pages as $page) { $ids[] = $page['ID']; } $f = new ARSelectFilter(new INCond(new ARFieldHandle('StaticPage', 'parentID'), $ids)); $f->setOrder(new ARFieldHandle('StaticPage', 'position')); foreach (ActiveRecordModel::getRecordSetArray('StaticPage', $f) as $page) { $subPages[$page['parentID']][] = $page; } if (empty($topCategories) && empty($pages)) { return; } $response = new BlockResponse(); $response->set('categories', $topCategories); $response->set('subCategories', $subCategories); $response->set('pages', $pages); $response->set('subPages', $subPages); $response->set('currentId', $this->getTopCategoryId()); return $response; }
public function save() { $data = $this->request->getJSON(); $page = StaticPage::getInstanceByID($data['ID'], true); $page->getSpecification(); $page->loadRequestModel($this->request); $menu = array('INFORMATION' => !empty($data['menuInformation']), 'ROOT_CATEGORIES' => !empty($data['menuRootCategories'])); if (!array_filter($menu)) { $menu = null; } $page->menu->set($menu); $page->save(); return new JSONResponse(array(), 'success', $this->translate('_page_has_been_successfully_saved')); }
/** * Save page into DB */ function save() { $plugin =& $this->plugin; $journalId = $this->journalId; $plugin->import('StaticPage'); $staticPagesDAO =& DAORegistry::getDAO('StaticPagesDAO'); if (isset($this->staticPageId)) { $staticPage =& $staticPagesDAO->getStaticPage($this->staticPageId); } if (!isset($staticPage)) { $staticPage = new StaticPage(); } $staticPage->setJournalId($journalId); $staticPage->setPath($this->getData('pagePath')); $staticPage->setTitle($this->getData('title'), null); // Localized $staticPage->setContent($this->getData('content'), null); // Localized if (isset($this->staticPageId)) { $staticPagesDAO->updateStaticPage($staticPage); } else { $staticPagesDAO->insertStaticPage($staticPage); } }
<?php ## Проверка виртуальных методов. require_once "StaticPage.php"; // Создаем статическую страницу $id = 3; $page = new StaticPage($id); $page->render(); echo $page->id($id);