コード例 #1
1
 public function onNotFound(\Event $event)
 {
     $controller = new \Controller(\App::getInstance());
     $page = $controller->twigInit()->render(\Config::get('view::notfound_page'));
     $response = new \Response($page, 404);
     \Container::getInstance()->setResponse($response);
 }
コード例 #2
0
 public static function dispatch()
 {
     if (empty($_GET['path'])) {
         $action = App::getInstance()->getConfig('default_action');
         $controller = App::getInstance()->getConfig('default_controller');
     } else {
         $requestedPath = $_GET['path'];
         $route = explode('/', $requestedPath);
         if (count($route) == 1) {
             $action = 'index';
             $controller = $route[0];
         } else {
             $action = $route[1];
             $controller = $route[0];
             if (count($route) > 2) {
                 unset($route[0]);
                 unset($route[1]);
                 //@todo send params to controller function
             }
         }
     }
     $action = self::sanitizeAction($action);
     $controller = self::sanitizeController($controller);
     if (!file_exists(__DIR__ . '/Controller/' . $controller . '.php')) {
         self::return404();
     }
     $controller = '\\Todos\\Controller\\' . $controller;
     $controllerInstance = new $controller();
     if (!method_exists($controllerInstance, $action)) {
         self::return404();
     }
     call_user_func_array(array($controllerInstance, $action), array());
 }
コード例 #3
0
 protected function getGroups()
 {
     // get app instance
     $app = App::getInstance('zoo');
     // Merge the select item option into existing groups
     return array_merge(array(array($app->html->_('select.option', '', '- ' . JText::_('Select Item') . ' -', 'value', 'text'))), parent::getGroups());
 }
コード例 #4
0
ファイル: herdboyzoo.php プロジェクト: knigherrant/decopatio
 /**
  * onAfterInitialise handler
  *
  *
  * @access	public
  * @return null
  */
 public function onAfterInitialise()
 {
     // make sure ZOO exists
     jimport('joomla.filesystem.file');
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) {
         return;
     }
     // load zoo
     require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
     // check if Zoo > 2.4 is loaded
     if (!class_exists('App')) {
         return;
     }
     // get zoo instance
     $this->zoo = App::getInstance('zoo');
     // check if Zoo > 2.5
     if (version_compare($this->zoo->zoo->version(), '2.5') < 0) {
         return;
     }
     // load zoo language file
     $this->zoo->system->language->load('com_' . $this->zoo->id);
     // register plugin paths
     $path = $this->zoo->path->path('plugins:system/herdboyzoo/');
     // register element path
     $this->zoo->path->register($path . '/elements', 'elements');
 }
コード例 #5
0
ファイル: RegisterForm.php プロジェクト: nsedenkov/phpsu
 /**
  * validate
  *
  * Run validation process
  *
  * @return null
  */
 public function validate()
 {
     parent::validate();
     // compare protection code
     if (property_exists($this->_data, 'protection_code')) {
         $protectionCode = \Storage::read('protection-code-register');
         \Storage::remove('protection-code-register');
         if ($this->_data->protection_code !== $protectionCode) {
             $this->addMessage('protection_code', \View::$language->register_form_protection_code_invalid);
         }
     }
     // compare password confirmation
     if (property_exists($this->_data, 'password') && property_exists($this->_data, 'confirm_password') && $this->_data->password !== $this->_data->confirm_password) {
         $this->addMessage('confirm_password', \View::$language->register_form_password_confirm_mismatch);
     }
     // check for existence
     if ($this->isValid()) {
         $checkedFields = array('email', 'login');
         $UserModel = \App::getInstance('common\\UserModel');
         foreach ($checkedFields as $fName) {
             if ($UserModel->isExists($fName, $this->_data->{$fName})) {
                 $mKey = 'register_form_' . $fName . '_is_exists';
                 $this->addMessage($fName, \View::$language->{$mKey});
             }
         }
     }
 }
コード例 #6
0
ファイル: offline.php プロジェクト: knigherrant/decopatio
 public function render($data = array())
 {
     $app = App::getInstance('zoo');
     $data['order']->state = $app->zoocart->getConfig()->get('payment_pending_orderstate', 4);
     $app->zoocart->table->orders->save($data['order']);
     return parent::render($data);
 }
コード例 #7
0
ファイル: jbtemplate.php プロジェクト: alexmixaylov/real
 /**
  * JBTemplate constructor.
  *
  * @param $event
  */
 public function __construct($event)
 {
     $this->event = $event;
     $this->app = App::getInstance('zoo');
     $this->application = $this->event->getSubject();
     $this->params = $this->application->params;
 }
コード例 #8
0
ファイル: jbcategoryorder.php プロジェクト: alexmixaylov/real
 /**
  * Get input HTML
  * @return string
  */
 public function getInput()
 {
     $app = App::getInstance('zoo');
     $params = $app->jborder->getCatOrderings(false);
     $app->jbassets->jQuery();
     $app->jbassets->js("jbapp:joomla/fields/jbcategoryorder.js");
     $orderId = uniqid('jbcategoryorder-');
     $value = array('order' => $this->value, 'reverse' => 0, 'random' => 0);
     if (!empty($this->value)) {
         if ($this->value == 'random' || $this->value == 'rrandom') {
             $value['random'] = 1;
         } else {
             if (preg_match('#^r#', $this->value)) {
                 $cleanValue = preg_replace('#^r#', '', $this->value);
                 if (isset($params[$cleanValue])) {
                     $value['reverse'] = 1;
                     $value['order'] = $cleanValue;
                 }
             } else {
                 $value['order'] = $this->value;
             }
         }
     }
     $html[] = '<div id="' . $orderId . '" style="float: left;width: 250px;">';
     $html[] = $app->jbhtml->select($params, "", array('class' => 'order-select'), $value['order']);
     $html[] = '<label class="order-reverse-wrap"><input class="order-reverse" type="checkbox">' . JText::_('JBZOO_ORDER_REVERSE') . '</label> ';
     $html[] = '<label class="order-random-wrap"><input class="order-random" type="checkbox">' . JText::_('JBZOO_ORDER_RANDOM') . '</label>';
     $html[] = $app->jbhtml->hidden($this->getName($this->fieldname), $this->value, array('class' => 'hidden-value'));
     $html[] = '</div>';
     $html[] = $app->jbassets->widget('#' . $orderId, 'JBCategoryOrder', $value, true);
     return implode(PHP_EOL, $html);
 }
コード例 #9
0
 public function deleteAction()
 {
     $app = App::getInstance();
     $id = (int) $app->getUrlParam('id');
     Options::delete($id);
     $app->redirect(__HOME__ . '/options/');
 }
コード例 #10
0
ファイル: helper.php プロジェクト: alexmixaylov/real
 public static function getMarkers($params, $renderer)
 {
     $app = App::getInstance('zoo');
     //чтоб работал выбор категории в модуле
     $category_id = $params->get('category');
     //чтоб отображало текущую категорию
     // $category_id = $app->jbrequest->getSystem('category');
     //var_dump($category_id);
     $conditions = " a.state = 1 " . ($params->get('application') ? " AND a.application_id = " . $params->get('application') : '') . ($category_id ? " AND cc.category_id " . (is_array($category_id) ? ' IN (' . implode(',', $category_id) . ')' : ' = ' . $category_id) : '') . " GROUP BY a.id";
     $options = array('select' => "a.*", 'from' => "#__zoo_item AS a" . ($category_id ? " LEFT JOIN #__zoo_category_item as cc on a.id=cc.item_id" : ""), 'conditions' => $conditions);
     $items = $app->table->item->all($options);
     foreach ($items as $item) {
         $elements = $item->getElements();
         foreach ($elements as $element) {
             if ($element->getElementType() == 'yamap' && $element->hasValue()) {
                 foreach ($element->data() as $value) {
                     $coordinatesArr = explode(',', $value["coordinates"]);
                     $lng = trim($coordinatesArr[1]);
                     $lat = trim($coordinatesArr[0]);
                     $name = htmlspecialchars($item->name, ENT_QUOTES);
                     $text = modZoomapHelper::relToAbs($renderer->render('item.' . str_replace('_:', '', $params->get('layout', 'default')), compact('item', 'params')));
                     $markers[] = array(array($lat, $lng), $name, $item->id, JFactory::getApplication()->getMenu()->getActive()->id);
                 }
             }
         }
     }
     return $markers;
 }
コード例 #11
0
ファイル: file.script.php プロジェクト: Jougito/DynWeb
 public function postflight($type, $parent, $results)
 {
     if (class_exists('AppRequirements')) {
         $requirements = new AppRequirements();
         $requirements->checkRequirements();
         $requirements->displayResults();
     }
     if (class_exists('App')) {
         // get zoo instance
         $app = App::getInstance('zoo');
         $app->module->enable('mod_zooquickicon', 'icon');
         $app->plugin->enable('zooshortcode');
         $app->plugin->enable('zoosmartsearch');
         $app->plugin->enable('zoosearch');
         $app->plugin->enable('zooevent');
     }
     // updateservers url update workaround
     if ('update' == $type) {
         JFactory::getDBO()->setQuery("DELETE a, b, c FROM `#__update_sites_extensions` a" . " LEFT JOIN `#__update_sites` b ON b.update_site_id = a.update_site_id" . " LEFT JOIN `#__updates` c ON c.update_site_id = a.update_site_id" . " WHERE a.extension_id = (SELECT `extension_id` FROM `#__extensions` WHERE `type` = 'package' AND `element` = 'pkg_zoo')")->execute();
     }
     $extensions = array();
     foreach ($results as $result) {
         $extensions[] = (object) array('name' => $result['name'] == 'com_zoo' ? 'ZOO extension' : $result['name'], 'status' => $result['result'], 'message' => $result['result'] ? ($type == 'update' ? 'Updated' : 'Installed') . ' successfully' : 'NOT Installed');
     }
     // display extension installation results
     self::displayResults($extensions, 'Extensions', 'Extension');
 }
コード例 #12
0
ファイル: FindEventsUseCase.php プロジェクト: servandserv/sf
 public function execute()
 {
     $app = \App::getInstance();
     $conn = $app->DB_CONNECT;
     $evs = new \Archive\Port\Adaptor\Data\Archive\Events();
     $params = array();
     $start = isset($app->QUERY['start']) ? intval($app->QUERY['start']) : 0;
     $count = isset($app->QUERY['count']) ? intval($app->QUERY['count']) : (isset($app->QUERY['search']) ? 100 : 100);
     $where = "";
     if (isset($app->QUERY['type']) && $app->QUERY['type'] != "") {
         $where = " AND `ek`.`type`= :type";
         $id = trim($app->QUERY['id']);
         $params[":type"] = $type;
         $ref = new \Archive\Port\Adaptor\Data\Archive\Refs\Ref();
         $ref->setRel("type");
         $ref->setHref($id);
         $evs->setRef($ref);
     }
     $query = "SELECT `r`.`autoid`,`r`.`xmlview` FROM `resources` AS `r` \n\t\t            LEFT JOIN `events_keys` AS `ek` ON `ek`.`eventId`=`r`.`id`\n\t\t            WHERE `r`.`type`='event' {$where}\n\t\t            ORDER BY `ek`.`dt` LIMIT {$start},{$count};";
     $sth = $conn->prepare($query);
     $sth->execute(array());
     while ($row = $sth->fetch()) {
         $ev = new \Archive\Port\Adaptor\Data\Archive\Events\Event();
         $ev->fromXmlStr($row["xmlview"]);
         $evs->setEvent($ev);
     }
     $evs->setPI(str_replace($app->API_VERSION . $app->PATH_INFO, "", $_SERVER["SCRIPT_URI"]) . "/stylesheets/Archive/Timeline.xsl");
     return $evs;
 }
コード例 #13
0
ファイル: apps.php プロジェクト: unrealprojects/journal
 public function &getItemList($overrideLimits = false, $group = '')
 {
     if (empty($this->list)) {
         // make sure ZOO exist
         if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) {
             return;
         }
         // load zoo
         require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
         // check if Zoo > 2.4 is loaded
         if (!class_exists('App')) {
             return;
         }
         // Get the ZOO App instance
         $zoo = App::getInstance('zoo');
         $elements = array();
         $apps = $zoo->zoo->getApplicationGroups();
         $applications = array();
         foreach ($apps as $app) {
             $author = strtolower($app->getMetaData('author'));
             if ($author == 'zoolanders' || $author == 'joolanders') {
                 $applications[] = $app;
             }
         }
         $this->list = $applications;
     }
     return $this->list;
 }
コード例 #14
0
 public function patch(\Archive\Port\Adaptor\Data\Archive\Documents\Document $doc, \Archive\Port\Adaptor\Data\Archive\Documents\Document $old)
 {
     $app = \App::getInstance();
     $handler = new \Happymeal\Port\Adaptor\Data\ValidationHandler();
     $doc->validateType($handler);
     if ($handler->hasErrors()) {
         $errors = $handler->getErrors();
         foreach ($errors as $code => $err) {
             $app->throwError(new \Exception(implode(";", $err), $code));
         }
     } else {
         $conn = $app->DB_CONNECT;
         $old->setYear($doc->getYear());
         $old->setType($doc->getType());
         $old->setPublished($doc->getPublished());
         $old->setComments($doc->getComments());
         $params = array();
         $qb = new \Archive\Port\Adaptor\Persistence\QueryBuilder($params);
         $query = $qb->update()->t("resources")->set()->c("xmlview")->eq()->val($old->toXmlStr())->where()->c("id")->eq()->val($old->getID())->fi();
         $sth1 = $conn->prepare($query);
         $sth1->execute($params);
         $params = [];
         $qb = new \Archive\Port\Adaptor\Persistence\QueryBuilder($params);
         $query = $qb->update()->t("documents_keys")->set()->c("type")->eq()->val($old->getType(), $qb::NOT_NULL)->c("year")->eq()->val($old->getYear(), $qb::NOT_NULL)->c("published")->eq()->val($old->getPublished(), $qb::NOT_NULL)->where()->c("documentId")->eq()->val($old->getID())->fi();
         $sth2 = $conn->prepare($query);
         $sth2->execute($params);
         return $old;
     }
 }
コード例 #15
0
ファイル: elements.php プロジェクト: unrealprojects/journal
 public function &getItemList($overrideLimits = false, $group = '')
 {
     if (empty($this->list)) {
         // Find ZL Elements plugin (if installed)
         $plugin = JPluginHelper::getPlugin('system', 'zoo_zlelements');
         if ($plugin) {
             // make sure ZOO exist
             if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) {
                 return;
             }
             // load zoo
             require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
             // check if Zoo > 2.4 is loaded
             if (!class_exists('App')) {
                 return;
             }
             // Get the ZOO App instance
             $zoo = App::getInstance('zoo');
             $elements = array();
             $apps = $zoo->zoo->getApplicationGroups();
             foreach ($apps as $app) {
                 $el = $zoo->element->getAll($app);
                 foreach ($el as $e) {
                     if (!in_array($e, $elements)) {
                         $elements[] = $e;
                     }
                 }
             }
             $this->list = $elements;
         }
     }
     return $this->list;
 }
コード例 #16
0
 /**
  * processAction
  *
  * Member registration process
  *
  * @return null
  */
 public function processAction()
 {
     // set json context
     \View::setOutputContext('json');
     \View::lockOutputContext();
     // validate form
     $registerForm = new forms\RegisterForm();
     $registerForm->validate();
     if (!$registerForm->isValid()) {
         throw new \MemberErrorException(array('title' => \View::$language->register_error, 'description' => \View::$language->register_proc_err_descr, 'form_messages' => $registerForm->getMessages()));
     }
     $userData = $registerForm->getData();
     // set new user defaults
     $hCnf = \App::getConfig('hosts');
     $mCnf = \App::getConfig('member-defaults');
     $pass = \common\CryptHelper::generateHash($userData->password);
     $userData->group_id = $mCnf->group_id;
     $userData->cookie = \common\HashHelper::getUniqueKey();
     $userData->password = $pass;
     $userData->time_zone = $mCnf->time_zone;
     $userData->status = $mCnf->status;
     $userData->activation_hash = \common\HashHelper::getUniqueKey();
     $userData->avatar = '//' . $hCnf->st . $mCnf->avatar;
     // create a new user
     $UserModel = \App::getInstance('common\\UserModel');
     $UserModel->createUser($userData);
     // TODO send email notification of account activation
     \App::dump($userData);
     // redirect to complete page
     \Storage::write('__register_complete', true);
     throw new \MemberSuccessException(array('redirection' => '/user/register/complete'));
 }
コード例 #17
0
ファイル: registerController.php プロジェクト: esterio/phpsu
 /**
  * processAction
  *
  * Member registration process
  *
  * @return null
  */
 public function processAction()
 {
     // set json context
     \View::setOutputContext('json');
     \View::lockOutputContext();
     // validate form
     $registerForm = \App::getInstance('\\modules\\user\\RegisterForm');
     $registerForm->validate();
     // invalid form data
     if (!$registerForm->isValid()) {
         throw new \MemberErrorException(array('title' => \View::$language->register_error, 'description' => \View::$language->register_proc_err_descr, 'form_messages' => $registerForm->getMessages()));
     }
     // create a new user
     $userData = $registerForm->getData();
     // set new user defaults
     $userData->group_id = 0;
     // TODO get default user group ID
     $userData->password = $userData->password;
     // TODO need hash password algorythm
     $userData->time_zone = '+00:00';
     // TODO get default user time zone
     $userData->status = 0;
     // TODO get default new registered user status
     $userData->activation_hash = 'xxx';
     // TODO need algorythm for generation of activation hash
     $userData->avatar = 'no-avatar.png';
     // TODO get default user avatar
     $UserModel = \App::getInstance('common\\UserModel');
     $UserModel->createUser($userData);
     // TODO send email notification of account activation
     \App::dump($userData);
     // redirect to complete page
     \Storage::write('__register_complete', true);
     throw new \MemberSuccessException(array('redirection' => '/user/register/complete'));
 }
コード例 #18
0
ファイル: Arxmin.php プロジェクト: php-arx/arxmin
 /**
  * Create a new arxmin instance.
  *
  * @param \Illuminate\Foundation\Application $app
  */
 public function __construct($app = null)
 {
     if (!$app) {
         $app = \App::getInstance();
     }
     $this->app = $app;
 }
コード例 #19
0
ファイル: item.php プロジェクト: alexmixaylov/real
 /**
  * Constructor
  * @param Element|String $element
  * @param Item           $item
  * @param array          $options
  */
 function __construct($element, Item $item = null, $options = array())
 {
     // get Zoo app
     $this->app = App::getInstance('zoo');
     // set inner vars
     if (isset($options['elementId'])) {
         $this->_identifier = $options['elementId'];
         $this->_item = $item;
         $this->_element = $this->_item->getElement($this->_identifier);
     } else {
         if (is_object($element)) {
             $this->_element = $element;
             $this->_item = $element->getItem();
             $this->_identifier = $element->identifier;
         } else {
             $this->_identifier = $element;
         }
     }
     // set repeatable flag
     if (is_object($this->_element) && is_subclass_of($this->_element, 'ElementRepeatable')) {
         $this->_isRepeatable = true;
     }
     // set Item object
     if (!$this->_item && $item) {
         $this->_item = $item;
     }
     // get current value for export)
     if ($this->_item && $this->_identifier && isset($this->_item->elements[$this->_identifier])) {
         $this->_value = $this->_item->elements[$this->_identifier];
     }
     $this->_config = JBModelConfig::model();
     $this->_exportParams = $this->_config->getGroup('export.items', array());
     $this->_importParams = $this->_config->getGroup('import.items', array());
     $this->_lastImportParams = $this->_config->getGroup('import.last.items', array());
 }
コード例 #20
0
ファイル: _zlmenu.php プロジェクト: knigherrant/decopatio
 public static function activeFilter(AppMenuItem $item)
 {
     // init vars
     $id = '';
     $app = App::getInstance('zoo');
     $controller = $app->request->getWord('controller');
     $task = $app->request->getWord('task');
     $classes = array();
     // set id
     if ($controller == 'zoolanders') {
         $id = $task;
     } else {
         $id = $controller;
     }
     // save current class attribute
     $class = $item->getAttribute('class');
     if (!empty($class)) {
         $classes[] = $class;
     }
     // set active class
     if ($item->getId() == $id || $item->hasChild($id, true)) {
         $classes[] = 'uk-active';
     }
     // replace the old class attribute
     $item->setAttribute('class', implode(' ', $classes));
 }
コード例 #21
0
 public function __construct()
 {
     $this->app = App::getInstance();
     $this->config = $this->app->getConfig();
     $this->view = View::getInstance();
     $this->input = InputData::getInstance();
 }
コード例 #22
0
ファイル: FindUnionsUseCase.php プロジェクト: servandserv/sf
 public function execute()
 {
     $app = \App::getInstance();
     $unions = new \Archive\Port\Adaptor\Data\Archive\Unions();
     $conn = $app->DB_CONNECT;
     $params = array();
     $start = isset($app->QUERY['start']) ? intval($app->QUERY['start']) : 0;
     $count = isset($app->QUERY['count']) ? intval($app->QUERY['count']) : (isset($app->QUERY['search']) ? 100 : 100);
     $where = "";
     if (isset($app->QUERY['type']) && $app->QUERY['type'] != "") {
         $where = " AND `uk`.`type` = :type";
         $params[":type"] = trim($app->QUERY['type']);
         $ref = new \Archive\Port\Adaptor\Data\Archive\Refs\Ref();
         $ref->setRel("type");
         $ref->setHref(trim($app->QUERY['type']));
         $unions->setRef($ref);
     }
     $query = "SELECT `r`.`xmlview` FROM `resources` AS `r` \n\t\t            LEFT JOIN `unions_keys` AS `uk` ON `uk`.`unionId`=`r`.`id`\n\t\t            WHERE `r`.`type`='union' {$where}\n\t\t            ORDER BY `uk`.`name` LIMIT {$start},{$count};";
     $sth = $conn->prepare($query);
     $sth->execute($params);
     while ($row = $sth->fetch()) {
         $union = new \Archive\Port\Adaptor\Data\Archive\Unions\Union();
         $union->fromXmlStr($row["xmlview"]);
         $unions->setUnion($union);
     }
     //$unions->setPI(str_replace($app->API_VERSION.$app->PATH_INFO,"",$_SERVER["SCRIPT_URI"])."/stylesheets/Archive/Unions.xsl");
     return $unions;
 }
コード例 #23
0
ファイル: jbcurrency.php プロジェクト: alexmixaylov/real
 /**
  * @return string
  */
 public function getInput()
 {
     // get app
     $app = App::getInstance('zoo');
     $currencyList = $app->jbmoney->getCurrencyList();
     if (isset($currencyList['%'])) {
         unset($currencyList['%']);
     }
     $isMultiply = (int) $this->element->attributes()->multiple;
     $defaultCode = (int) $this->element->attributes()->defaultCode;
     // create select
     $options = array();
     if (!$defaultCode) {
         unset($currencyList[JBCartValue::DEFAULT_CODE]);
     }
     foreach ($currencyList as $key => $currency) {
         $options[$key] = $currency;
     }
     $attrs = array();
     if ($isMultiply) {
         $attrs['multiple'] = 'multiple';
         $attrs['size'] = '5';
     }
     return $app->jbhtml->select($options, $this->getName($this->fieldname), $attrs, $this->value);
 }
コード例 #24
0
ファイル: ZLStorage.php プロジェクト: unrealprojects/journal
 /**
  * Class Constructor
  */
 public function __construct($adapter, $options = array())
 {
     // init vars
     $this->app = App::getInstance('zoo');
     // load the adapter
     $this->adapter = $this->getAdapterInstance($adapter, $options);
 }
コード例 #25
0
ファイル: feeds.php プロジェクト: bizanto/Hooked
 function saveFeed($filename = "", $view)
 {
     if (Sanitize::getString($this->params, 'action') != 'xml') {
         return false;
     }
     $type = '.' . Sanitize::getString($this->params, 'type', 'rss2');
     $App =& App::getInstance();
     if (!isset($App->jreviewsPaths['Theme'][$this->c->viewTheme][$this->layout][$view . $type . '.thtml']) && !isset($App->jreviewsPaths['Theme']['default'][$this->layout][$view . $type . '.thtml'])) {
         return false;
     }
     $this->c->autoLayout = false;
     $this->c->autoRender = false;
     $rss = array('title' => $this->c->Config->rss_title, 'link' => WWW_ROOT, 'description' => $this->c->Config->rss_description, 'image_url' => WWW_ROOT . "images/stories/" . $this->c->Config->rss_image, 'image_link' => WWW_ROOT);
     $this->c->set(array('encoding' => $this->encoding, 'rss' => $rss));
     $feedFile = fopen($filename, "w+");
     if ($feedFile) {
         $feed = $this->c->render($this->layout, $view . $type);
         fputs($feedFile, $feed);
         fclose($feedFile);
         echo $feed;
         die;
     } else {
         echo "<br /><b>Error creating feed file, please check write permissions.</b><br />";
         die;
     }
 }
コード例 #26
0
ファイル: CreateLinkUseCase.php プロジェクト: servandserv/sf
 public function execute()
 {
     $app = \App::getInstance();
     $em = new \Archive\Port\Adaptor\Persistence\PDO\LinkEntityManager();
     $link = $em->create($app->REQUEST);
     return $link;
 }
コード例 #27
0
 private function __construct()
 {
     $this->_viewPath = App::getInstance()->getConfig()->app['views'];
     if ($this->_viewPath == null) {
         $this->_viewPath = realpath('../Views/');
     }
 }
コード例 #28
0
ファイル: jbcategorylist.php プロジェクト: alexmixaylov/real
 public function getInput()
 {
     // get app
     $app = App::getInstance('zoo');
     $categoryName = array();
     $attr = array();
     $options = array();
     $appList = JBModelApp::model()->getList();
     if ((int) $this->element->attributes()->multiple) {
         $attr['multiple'] = 'multiple';
     }
     if ((int) $this->element->attributes()->required) {
         $attr['required'] = 'required';
     }
     if ((int) $this->element->attributes()->size) {
         $attr['size'] = (int) $this->element->attributes()->size;
     } else {
         $attr['size'] = 10;
     }
     if (!empty($appList)) {
         foreach ($appList as $application) {
             $allCategories = $application->getCategories(true);
             if (!empty($allCategories)) {
                 foreach ($allCategories as $category) {
                     $categoryName[$category->id] = $category->name;
                 }
                 $options[$application->name] = $categoryName;
             }
         }
         return JHtml::_('select.groupedlist', $options, $this->getName($this->fieldname), array('list.attr' => $app->jbhtml->buildAttrs($attr), 'list.select' => $this->value, 'group.items' => null));
     }
 }
コード例 #29
0
ファイル: language.php プロジェクト: hiromi2424/mi
 /**
  * initialize method
  *
  * Merge settings and set Config.language to a valid locale
  *
  * @return void
  * @access public
  */
 function initialize(&$Controller, $config = array())
 {
     App::import('Vendor', 'Mi.MiCache');
     $lang = MiCache::setting('Site.lang');
     if (!$lang) {
         if (!defined('DEFAULT_LANGUAGE')) {
             return;
         }
         $lang = DEFAULT_LANGUAGE;
     } elseif (!defined('DEFAULT_LANGUAGE')) {
         define('DEFAULT_LANGUAGE', $lang);
     }
     Configure::write('Config.language', $lang);
     App::import('Core', 'I18n');
     $I18n =& I18n::getInstance();
     $I18n->domain = 'default_' . $lang;
     $I18n->__lang = $lang;
     $I18n->l10n->get($lang);
     if (!empty($Controller->plugin)) {
         $config['plugins'][] = Inflector::underscore($Controller->plugin);
     }
     if (!empty($config['plugins'])) {
         $plugins = array_intersect(MiCache::mi('plugins'), $config['plugins']);
         $Inst = App::getInstance();
         foreach ($plugins as $path => $name) {
             $Inst->locales[] = $path . DS . 'locale' . DS;
         }
     }
 }
コード例 #30
0
 /**
  * 初始化模板操作类
  * 
  * @return void
  */
 public function initView()
 {
     if (empty($this->view)) {
         $this->view = App::getInstance('View');
         $this->default_template_file = strtolower(App::$controller_name) . '/' . App::$action_name;
     }
 }