/** * Searches through the content and extracts out any matches. The return * value is a formatted array of what needs to be replaced * * Returned syntax will look like this: * array( * 'link' => array( * 3 => array('options' => array(), 'replace' => '[link:3]'), * 5 => array('options' => array('option' => 'value'), 'replace' => '[link:5 option=value]'), * ), asset => array( * 10 => array('options' => array(), 'replace' => '[asset:10]'), * ), * ) * * @return array */ private function _parseSyntaxes($content) { // create the replacement string (e.g. link|asset|myObject) $replacementString = implode('|', array_keys(sfSympalConfig::get('content_syntax_types'))); preg_match_all("/\\[({$replacementString}):(.*?)\\]/", $content, $matches); if (isset($matches[0]) && $matches[0]) { $replacements = array(); $types = $matches[1]; $bodies = $matches[2]; foreach ($types as $type) { $replacements[$type] = array(); } /* * body matches (e.g. "3" or "5 option=value") */ foreach ($bodies as $key => $body) { // use the key to find the corresponding type $typeKey = $types[$key]; $e = explode(' ', $body); $slug = $e[0]; $replacements[$typeKey][$slug] = array('options' => _parse_attributes(substr($body, strlen($e[0]))), 'replace' => $matches[0][$key]); } return $replacements; } else { return false; } }
/** * Returns the config form and checks the file permissions * * @return sfSympalConfigForm */ protected function _getForm() { $this->checkFilePermissions(); $class = sfSympalConfig::get('config_form_class', null, 'sfSympalConfigForm'); $this->form = new $class(); return $this->form; }
/** * Enable Sympal result cache for this query if it is enabled via configuration * * @param string $key * @return Doctrine_Query $query */ public function enableSympalResultCache($key) { if ($lifetime = sfSympalConfig::shouldUseResultCache($key)) { $this->useResultCache(true, $lifetime, $key); } return $this; }
public function uninstall($delete = null) { if ($delete !== null) { $this->setOption('delete_plugin_files', $delete); } $this->logSection('sympal', sprintf('Uninstalling Sympal plugin named "%s"', $this->_pluginName)); if ($this->hasModels()) { if ($this->getOption('build_all_classes')) { $this->_buildAllClasses(); } if ($this->getOption('delete_related_data')) { $this->_deleteRelatedData(); } if ($this->getOption('delete_other_data')) { $this->_deleteOtherData(); } if ($this->getOption('drop_database_tables')) { $this->_dropDatabaseTables(); } } if ($this->getOption('run_custom_install')) { $this->_runCustomUninstall(); } if ($this->getOption('delete_plugin_files')) { $this->_deletePluginFiles(); } if ($this->getOption('publish_assets')) { $this->_publishAssets(); } $this->_clearCache(); sfSympalConfig::writeSetting($this->_pluginName, 'installed', false); }
/** * Instantiate the sfSympalCache instance and prime the cache for this Sympal * project * * @see sfSympalConfiguration * @see sfSympalPluginConfiguration * @param sfSympalConfiguration $sympalConfiguration */ public function __construct(sfSympalConfiguration $sympalConfiguration) { $this->_sympalConfiguration = $sympalConfiguration; $this->_projectConfiguration = $sympalConfiguration->getProjectConfiguration(); $this->_cacheDriver = call_user_func_array(sfSympalConfig::get('get_cache_driver_callback'), array($this)); $this->primeCache(); }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { foreach ($arguments['configure'] as $value) { list($key, $value) = explode('=', $value); $e = explode('.', $key); $group = isset($e[1]) ? $e[0] : null; $key = isset($e[1]) ? $e[1] : $e[0]; $value = is_numeric($value) ? (int) $value : $value; $value = $value == 'false' ? false : $value; $value = $value == 'true' ? true : $value; $infoValue = $value; if (in_array(substr($value, 0, 1), array('[', '{'))) { $value = sfYamlInline::load($value); $infoValue = 'YAML: ' . $infoValue; } $writeToApp = isset($options['application']) && $options['application'] ? true : false; if ($group) { $this->logSection('sympal', sprintf('Writing setting "%s" with a value of "%s" under the "%s" group.', $key, $infoValue, $group)); sfSympalConfig::writeSetting($group, $key, $value, $writeToApp); } else { $this->logSection('sympal', sprintf('Writing setting "%s" with a value of "%s".', $key, $infoValue, $group)); sfSympalConfig::writeSetting($key, $value, null, $writeToApp); } } }
/** * Handles the form submit for a given slot. This could come from two sources: * 1) Inline, frontend editing. (ajax request) * 2) Admin, non-inline editing (non-ajax request) */ public function executeSlot_save(sfWebRequest $request) { $this->contentSlot = $this->setupContentSlot($request); $this->form = $this->contentSlot->getEditForm(); $this->form->bind($request->getParameter($this->form->getName())); if ($this->form->isValid()) { $this->form->save(); $this->getUser()->setFlash('saved', __('Slot saved'), false); // if we close editor on save, just return the flash js and the editor close js if ($request->isXmlHttpRequest() && sfSympalConfig::get('inline_editing', 'close_editor_on_save', false)) { $this->getContext()->getConfiguration()->loadHelpers('SympalContentSlotEditor'); $this->renderText(trigger_flash_from_user($this->getUser())); $this->renderText(sprintf(' <script type="text/javascript"> $(document).ready(function() { $("#sympal_slot_wrapper_%s").sympalSlot("closeEditor"); }); </script> ', $this->contentSlot->id)); return sfView::NONE; } } else { $this->getUser()->setFlash('error', __('There was an error saving your slot'), false); } // we need to route the response appropriately based on ajax/non-ajax if ($request->isXmlHttpRequest()) { // ajax, just re-show the form $this->renderPartial('sympal_edit_slot/slot_editor_form'); } else { // handle non-ajax, which come from sympal_content/edit_slots // this is a bit of a hack, we redirect even on errors, which is technically a fail $this->redirect('@sympal_content_edit_slots?id=' . $this->contentSlot->getContentRenderedFor()->id); } return sfView::NONE; }
public function loadEditorAssets() { if (!$this->_editorAssetsLoaded) { $this->configuration->loadHelpers('SympalContentSlotEditor'); sfSympalToolkit::useJQuery(array('ui')); $response = sfContext::getInstance()->getResponse(); // Load jquery tools/plugins that the inline editor requires $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jQuery.cookie.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jQuery.elastic.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/jquery.Jcrop.min.js')); // Load markitup markdown editor if (sfSympalConfig::get('enable_markdown_editor')) { $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/jquery.markitup.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/sets/markdown/set.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/skins/markitup/style.css')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/markitup/sets/markdown/style.css')); } // Load tinymce $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/tiny_mce/tiny_mce.js')); // Load the sympal editor js and css $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/editor.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/css/editor.css')); // Fancybox $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/fancybox/jquery.fancybox.js')); $response->addStylesheet(sfSympalConfig::getAssetPath('/sfSympalPlugin/fancybox/jquery.fancybox.css')); // Shortcuts $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/shortcuts.js')); $this->_editorAssetsLoaded = true; } }
/** * Check if Sympal is installed and redirect to installer if not. * Do some other install checks as well. * * @return void */ private function _checkInstalled() { $request = $this->_symfonyContext->getRequest(); // Prepare the symfony application if it has not been prepared yet if (!$this->_symfonyContext->getUser() instanceof sfSympalUser) { chdir(sfConfig::get('sf_root_dir')); $task = new sfSympalEnableForAppTask($this->_dispatcher, new sfFormatter()); $task->run(array($this->_invoker->getProjectConfiguration()->getApplication()), array()); $this->_symfonyContext->getController()->redirect('@homepage'); } /* * Redirect to install module if... * * not in test environment * * sympal has not been installed * * module is not already sympal_install */ if (sfConfig::get('sf_environment') != 'test' && !sfSympalConfig::get('installed') && $request->getParameter('module') != 'sympal_install') { $this->_symfonyContext->getController()->redirect('@sympal_install'); } /* * Redirect to homepage if no site record exists so we can prompt the * user to create a site record for this application. * * This check is only ran in dev mode */ if (sfConfig::get('sf_environment') == 'dev' && !$this->_sympalContext->getSite() && $this->_symfonyContext->getRequest()->getPathInfo() != '/') { $this->_symfonyContext->getController()->redirect('@homepage'); } }
public function install() { if ($this->getOption('uninstall_first')) { $uninstall = new sfSympalPluginManagerUninstall($this->_pluginName, $this->_configuration, $this->_formatter); $uninstall->setOption('publish_assets', false); $uninstall->uninstall(); } $this->logSection('sympal', sprintf('Installing Sympal plugin named "%s"', $this->_pluginName)); try { if ($this->getOption('create_tables')) { $this->_createDatabaseTables(); } if ($this->getOption('load_data')) { $this->_loadData(); } if ($this->getOption('publish_assets')) { $this->_publishAssets(); } if ($this->getOption('clear_cache')) { $this->_clearCache(); } sfSympalConfig::writeSetting($this->_pluginName, 'installed', true); } catch (Exception $e) { $uninstall = new sfSympalPluginManagerUninstall($this->_pluginName, $this->_configuration); $uninstall->uninstall(); throw $e; } }
public function getEmbed($options = array()) { $url = $this->getUrl(); $width = isset($options['width']) ? $options['width'] : sfSympalConfig::get('default_video_width', null, 400); $height = isset($options['height']) ? $options['height'] : sfSympalConfig::get('default_video_height', null, 400); $extension = $this->getExtension(); $id = $this->getDoctrineAsset()->getId(); if ($extension == 'swf') { return sprintf('<object width="%s" height="%s"> <param name="movie" value="%s"> <embed src="%s" width="%s" height="%s"> </embed> </object>', $width, $height, $url, $url, $width, $height); } else { if ($extension == 'flv') { sympal_use_jquery(); sympal_use_javascript('/sfSympalPlugin/js/flowplayer.min.js'); return sprintf('<a href="%s" style="display:block;width:%spx;height:%spx;" id="asset_%s"></a> <script language="JavaScript"> flowplayer("asset_%s", "%s"); </script>', $url, $width, $height, $id, $id, _compute_public_path('/sfSympalPlugin/js/flowplayer.swf', 'swf', 'swf')); } else { return $this->getLink($options); } } }
/** * Renders an edit form for a slot * * @param sfSympalContent $content The content on which the slot should be rendered * @param sfSympalContentSlot $slot The slot to render in a form * @param array $options An options array. Available options include: * * edit_mode * */ function get_sympal_content_slot_editor($content, $slot, $options = array()) { $slot->setContentRenderedFor($content); // merge in some global default slot options $options = array_merge(array('edit_mode' => sfSympalConfig::get('inline_editing', 'default_edit_mode'), 'view_url' => url_for('sympal_content_slot_view', array('id' => $slot->id, 'content_id' => $slot->getContentRenderedFor()->id))), $options); // merge the default config for this slot into the given config $slotOptions = sfSympalConfig::get($slot->getContentRenderedFor()->Type->slug, 'content_slots', array()); if (isset($slotOptions[$slot->name])) { $options = array_merge($slotOptions[$slot->name], $options); } /* * Finally, override the "type" option, it should be set to whatever's * in the database, regardless of what the original slot options were */ $options['type'] = $slot->type; /* * Give the slot a default value if it's blank. * * @todo Move this somewhere where it can be specified on a type-by-type * basis (e.g., if we had an "image" content slot, it might say * "Click to choose image" */ $renderedValue = $slot->render(); if (!$renderedValue) { $renderedValue = __('[Hover over and click edit to change.]'); } $inlineContent = sprintf('<a href="%s" class="sympal_slot_button">' . __('Edit') . '</a>', url_for('sympal_content_slot_form', array('id' => $slot->id, 'content_id' => $slot->getContentRenderedFor()->id))); $inlineContent .= sprintf('<span class="sympal_slot_content">%s</span>', $renderedValue); return sprintf('<span class="sympal_slot_wrapper %s" id="sympal_slot_wrapper_%s">%s</span>', htmlentities(json_encode($options)), $slot->id, $inlineContent); }
public function setup() { parent::setup(); $q = Doctrine_Query::create()->from('sfSympalMenuItem m'); if ($this->object->exists()) { $q->andWhere('m.id != ?', $this->object->id); } if (sfSympalConfig::isI18nEnabled('sfSympalMenuItem')) { $q->leftJoin('m.Translation mt'); } $q->andWhere('m.site_id = ?', sfSympalContext::getInstance()->getService('site_manager')->getSite()->getId()); $this->widgetSchema['parent_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'sfSympalMenuItem', 'add_empty' => __('~ (object is at root level)'), 'order_by' => array('root_id, lft', ''), 'query' => $q, 'method' => 'getIndentedName')); $this->validatorSchema['parent_id'] = new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'sfSympalMenuItem')); $this->setDefault('parent_id', $this->object->getParentId()); $this->widgetSchema->setLabel('parent_id', 'Child of'); $this->widgetSchema['move'] = new sfWidgetFormDoctrineChoice(array('model' => 'sfSympalMenuItem', 'add_empty' => true, 'order_by' => array('root_id, lft', ''), 'query' => $q, 'method' => 'getIndentedName')); $this->validatorSchema['move'] = new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'sfSympalMenuItem')); $this->widgetSchema->setLabel('move', 'Position menu item'); $choices = array('' => '', 'Prev' => 'Before', 'Next' => 'After'); $this->widgetSchema['where_to_move'] = new sfWidgetFormChoice(array('choices' => $choices)); $this->validatorSchema['where_to_move'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($choices))); $this->widgetSchema->setLabel('where_to_move', 'Position before or after?'); unset($this['site_id'], $this['Content'], $this['root_id'], $this['lft'], $this['rgt'], $this['level']); $this->validatorSchema['slug']->setOption('required', true); }
public function run(sfEvent $event, $content) { // The following were removed, but should probably be there //$request->isXmlHttpRequest() //$controller->getRenderMode() != sfView::RENDER_CLIENT || $response = $event->getSubject(); if (strpos($response->getContentType(), 'html') === false || $response->getStatusCode() == 304 || in_array($response->getStatusCode(), array(302, 301)) || $response->isHeaderOnly()) { return $content; } if ($code = sfSympalConfig::get('google_analytics_code')) { $js = <<<EOF <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); \tdocument.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { \tvar pageTracker = _gat._getTracker("{$code}"); \tpageTracker._trackPageview(); } catch(err) {}</script> EOF; return str_replace('</body>', $js . '</body>', $content); } else { return $content; } }
public function executeCreate_asset(sfWebRequest $request) { $form = new sfSympalAssetUploadForm(); $upload = $request->getParameter($form->getName()); $form->setUploadDirectory($upload['directory']); $form->bind($upload, $request->getFiles($form->getName())); if ($form->isValid()) { $postFile = $form->getValue('file'); $fileName = $postFile->getOriginalName(); $name = Doctrine_Inflector::urlize(sfSympalAssetToolkit::getNameFromFile($fileName)); $extension = pathinfo($fileName, PATHINFO_EXTENSION); $fullName = $extension ? $name . '.' . $extension : $name; $destinationDirectory = sfConfig::get('sf_web_dir') . '/' . sfSympalConfig::get('assets', 'root_dir') . $upload['directory']; $this->getUser()->setFlash('notice', 'File uploaded successfully.'); $postFile->save($destinationDirectory . '/' . $fullName); $assetObject = sfSympalAssetToolkit::createAssetObject($upload['directory'] . '/' . $fullName); if (!($asset = $assetObject->getDoctrineAsset())) { $asset = new sfSympalAsset(); } $asset->path = $assetObject->getRelativePathDirectory(); $asset->name = $assetObject->getName(); $asset->save(); } else { $this->getUser()->setFlash('error', 'Could not upload file.'); } if ($this->isAjax) { $this->redirect('@sympal_assets_select?is_ajax=' . $this->isAjax . '&dir=' . $upload['directory']); } else { $this->redirect('@sympal_assets?is_ajax=' . $this->isAjax . '&dir=' . $upload['directory']); } }
public function executeLanguage(sfWebRequest $request) { $this->form = new sfFormLanguage($this->getUser(), array('languages' => sfSympalConfig::getLanguageCodes())); unset($this->form[$this->form->getCSRFFieldName()]); $widgetSchema = $this->form->getWidgetSchema(); $widgetSchema->setLabel('language', 'Select Language'); }
public function executeIndex() { $response = $this->getResponse(); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalPlugin/js/shortcuts.js')); $response->addJavascript(sfSympalConfig::getAssetPath('/sfSympalAdminPlugin/js/shortcuts.js')); if (sfSympalConfig::get('check_for_upgrades_on_dashboard', null, false)) { $this->upgrade = new sfSympalUpgradeFromWeb($this->getContext()->getConfiguration(), $this->getContext()->getEventDispatcher(), new sfFormatter()); $this->hasNewVersion = $this->upgrade->hasNewVersion(); } else { $this->hasNewVersion = false; } $this->dashboardRight = new sfSympalMenu('Sympal Dashboard Right'); $numUsers = Doctrine_Core::getTable('sfGuardUser')->count(); $this->dashboardRight->addChild(sprintf('<label>Users</label> %s', $numUsers), '@sympal_users'); $numSites = Doctrine_Core::getTable('sfSympalSite')->count(); $this->dashboardRight->addChild(sprintf('<label>Sites</label> %s', $numSites), '@sympal_sites'); $numContentTypes = Doctrine_Core::getTable('sfSympalContentType')->count(); $this->dashboardRight->addChild(sprintf('<label>Content Types</label> %s', $numContentTypes), '@sympal_content_types'); $contentTypes = Doctrine::getTable('sfSympalContentType')->getAllContentTypes(); foreach ($contentTypes as $contentType) { $numPublishedContent = Doctrine_Core::getTable('sfSympalContent')->createQuery('c')->where('c.date_published < NOW()')->andWhere('c.content_type_id = ?', $contentType->getId())->count(); $this->dashboardRight->addChild(sprintf('<label>Published %s Content</label> %s', $contentType->getLabel(), $numPublishedContent), '@sympal_content_list_type?type=' . $contentType->getId() . '&published=1'); $numUnPublishedContent = Doctrine_Core::getTable('sfSympalContent')->createQuery('c')->where('c.date_published >= NOW() OR c.date_published IS NULL')->andWhere('c.content_type_id = ?', $contentType->getId())->count(); $this->dashboardRight->addChild(sprintf('<label>Un-Published %s Content</label> %s', $contentType->getLabel(), $numUnPublishedContent), '@sympal_content_list_type?type=' . $contentType->getId() . '&published=0'); } sfApplicationConfiguration::getActive()->getEventDispatcher()->notify(new sfEvent($this->dashboardRight, 'sympal.load_dashboard_right')); }
/** * Include a content slot in your template. * * This replaces get_sympal_content_slot() and is intended to be easier * to use. This also taps into the app.yml config for its options * * @param string $name The name of the slot * @param array $options An array of options for this slot * * Available options include * * content An sfSympalContent instance to render the slot for * * type The rendering type to use for this slot (e.g. Markdown) * * default_value A default value to give this slot the first time it's created * * edit_mode How to edit this slot (popup (default), inline) */ function _get_sympal_content_slot($name, $options = array()) { if (isset($options['content'])) { $content = $options['content']; unset($options['content']); } else { $content = sfSympalContext::getInstance()->getCurrentContent(); } // mark this content record as having content slots $content->setEditableSlotsExistOnPage(true); // merge the default config for this slot into the given config $slotOptions = sfSympalConfig::get($content->Type->slug, 'content_slots', array()); if (isset($slotOptions[$name])) { $options = array_merge($slotOptions[$name], $options); } // retrieve the slot if ($name instanceof sfSympalContentSlot) { $slot = $name; $name = $name->getName(); } else { $slot = $content->getOrCreateSlot($name, $options); unset($options['default_value']); } $slot->setContentRenderedFor($content); /** * Either render the raw value or the editor for the slot */ if (sfSympalContext::getInstance()->shouldLoadFrontendEditor()) { use_helper('SympalContentSlotEditor'); return get_sympal_content_slot_editor($content, $slot, $options); } else { return $slot->render(); } }
/** * Returns the anchor tag to a comment's website * * @param string $url The url of the website to link to * @param string $label The text to include inside the link * @param array $options An array of link options * @return string */ function link_to_sympal_comment_website($comment, $options = array()) { if (sfSympalConfig::get('sfSympalCommentsPlugin', 'websites_no_follow')) { $options['rel'] = 'nofollow'; } return link_to($comment['author_name'], $comment['website'], $options); }
public function buildDataGrid(sfWebRequest $request) { if ($this->table_method) { $typeTable = Doctrine_Core::getTable($this->ContentType->name); $method = $this->table_method; $q = $typeTable->{$method}($this, $request); if ($q instanceof sfSympalDataGrid) { $dataGrid = $q; } else { if ($q instanceof sfDoctrinePager || $q instanceof Doctrine_Query_Abstract) { $dataGrid = sfSympalDataGrid::create($q); } else { throw new sfException(sprintf('ContentList table_method must return an instance of sfSympalDataGrid, sfDoctrinePager or Doctrine_Query_Abstract. An instance of "%s" was returned.', get_class($q))); } } } else { $pager = new sfDoctrinePager('sfSympalContent'); $pager->setQuery($this->_buildQuery($request)); $dataGrid = sfSympalDataGrid::create($pager)->addColumn('c.title', 'renderer=sympal_data_grid/default_title')->addColumn('c.date_published')->addColumn('u.username', 'label=Created By'); } if ($this->sort_column) { $dataGrid->setDefaultSort($this->sort_column, $this->sort_order); } $dataGrid->setMaxPerPage($this->rows_per_page > 0 ? $this->rows_per_page : sfSympalConfig::get('rows_per_page', null, 10)); $dataGridRequestInfo = $request->getParameter($dataGrid->getId()); return $dataGrid; }
/** * Returns the query that should be used if we need to query out * and get a collection of sfSympalContent objects */ protected function _getQueryForContentObjects($slugs) { $q = Doctrine_Core::getTable('sfSympalContent')->createQuery('c')->select('c.*, t.*')->from('sfSympalContent c')->innerJoin('c.Type t')->innerJoin('c.Site s')->whereIn('c.slug', array_unique($slugs))->andWhere('s.slug = ?', sfConfig::get('sf_app'))->orderBy('c.slug ASC'); if (sfSympalConfig::isI18nEnabled('sfSympalContent')) { $q->leftJoin('c.Translation ct'); } return $q; }
public function copyOriginal() { $dir = $this->getPathDirectory() . '/' . sfSympalConfig::get('assets', 'originals_dir'); if (!is_dir($dir)) { mkdir($dir, 0777, true); } copy($this->getPath(), $dir . '/' . $this->getName()); }
/** * Sets the $_params array as sfConfig variables */ protected function _prepareParams() { foreach ($this->_params as $key => $value) { if ($value) { sfSympalConfig::set('sympal_install_admin_' . $key, $value); } } }
public function loadAdminMenu(sfEvent $event) { $menu = $event->getSubject(); if (sfSympalConfig::get('sfSympalCommentsPlugin', 'installed', false) && sfSympalConfig::get('sfSympalCommentsPlugin', 'enabled')) { $commentTable = Doctrine::getTable('sfSympalComment')->getNumPending(); $menu->getChild('Content')->addChild('Comments (' . $commentTable . ')', '@sympal_comments'); } }
public function getPathAsString() { $children = array(); foreach ($this->_children as $child) { $children[] = $child->renderLabel(); } return implode(sfSympalConfig::get('breadcrumbs_separator', null, ' / '), $children); }
public function getActionToRenderWith() { if ($actionName = $this->_get('action')) { return $actionName; } else { return sfSympalConfig::get($this->getSlug(), 'default_rendering_action', sfSympalConfig::get('default_rendering_action', null, 'index')); } }
/** * Check if Sympal is not online and act accordingly * * @return void */ private function _checkOnlineConfiguration() { if (sfSympalConfig::get('offline', 'enabled', false) && !$this->_checkedOnline) { $this->_checkedOnline = true; $this->_invoker->getSymfonyContext()->getController()->forward(sfSympalConfig::get('offline', 'module'), sfSympalConfig::get('offline', 'action')); throw new sfStopException(); } }
public function upgrade() { $result = parent::upgrade(); $versionHistory = sfSympalConfig::get('upgrade_version_history', null, array()); $versionHistory[] = $this->_version . '__' . $this->_number; sfSympalConfig::writeSetting('upgrade_version_history', $versionHistory); return $result; }
/** * Check if we are inside an admin module * * @return boolean */ public function isAdminModule() { if (!($sympalContext = $this->getSympalContext())) { return false; } $module = $sympalContext->getSymfonyContext()->getRequest()->getParameter('module'); $adminModules = sfSympalConfig::get('admin_modules'); return array_key_exists($module, $adminModules); }
public function getDefaultPagesDataGrid() { $dataGrid = sfSympalDataGrid::create(Doctrine_Core::getTable('sfSympalContent')->getFullTypeQuery('sfSympalPage')); if (sfSympalConfig::isI18nEnabled()) { return $dataGrid->addColumn('crt.title', 'renderer=sympal_page/data_grid_title')->addColumn('c.date_published')->addColumn('u.username', 'label=Created By')->setDefaultSort('crt.title'); } else { return $dataGrid->addColumn('cr.title', 'renderer=sympal_page/data_grid_title')->addColumn('c.date_published')->addColumn('u.username', 'label=Created By')->setDefaultSort('cr.title'); } }