当前位置: 首页>>代码示例>>PHP>>正文


PHP sfSympalConfig::get方法代码示例

本文整理汇总了PHP中sfSympalConfig::get方法的典型用法代码示例。如果您正苦于以下问题:PHP sfSympalConfig::get方法的具体用法?PHP sfSympalConfig::get怎么用?PHP sfSympalConfig::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfSympalConfig的用法示例。


在下文中一共展示了sfSympalConfig::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getForm

 /**
  * 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;
 }
开发者ID:sympal,项目名称:sympal,代码行数:12,代码来源:Basesympal_configActions.class.php

示例2: executeIndex

 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'));
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:27,代码来源:Basesympal_dashboardActions.class.php

示例3: _parseSyntaxes

 /**
  * 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;
     }
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:43,代码来源:sfSympalContentReplacer.class.php

示例4: _get_sympal_content_slot

/**
 * 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();
    }
}
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:49,代码来源:SympalContentSlotHelper.php

示例5: link_to_sympal_comment_website

/**
 * 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);
}
开发者ID:slemoigne,项目名称:sympal,代码行数:15,代码来源:CommentsHelper.php

示例6: executeCreate_asset

 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']);
     }
 }
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:31,代码来源:Basesympal_assetsActions.class.php

示例7: buildDataGrid

 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;
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:27,代码来源:PluginsfSympalContentList.class.php

示例8: _checkInstalled

 /**
  * 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');
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:35,代码来源:sfSympalContextLoadFactoriesListener.class.php

示例9: run

    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;
        }
    }
开发者ID:sympal,项目名称:sympal,代码行数:26,代码来源:sfSympalRenderingResponseFilterContentListener.class.php

示例10: __construct

 /**
  * 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();
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:15,代码来源:sfSympalCache.class.php

示例11: executeSlot_save

 /**
  * 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;
 }
开发者ID:sympal,项目名称:sympal,代码行数:40,代码来源:Basesympal_edit_slotActions.class.php

示例12: loadEditorAssets

 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;
     }
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:30,代码来源:sfSympalEditorPluginConfiguration.class.php

示例13: get_sympal_content_slot_editor

/**
 * 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);
}
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:39,代码来源:SympalContentSlotEditorHelper.php

示例14: getEmbed

    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);
            }
        }
    }
开发者ID:sympal,项目名称:sympal,代码行数:26,代码来源:sfSympalAssetVideoObject.class.php

示例15: getPathAsString

 public function getPathAsString()
 {
     $children = array();
     foreach ($this->_children as $child) {
         $children[] = $child->renderLabel();
     }
     return implode(sfSympalConfig::get('breadcrumbs_separator', null, ' / '), $children);
 }
开发者ID:sympal,项目名称:sympal,代码行数:8,代码来源:sfSympalMenuBreadcrumbs.class.php


注:本文中的sfSympalConfig::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。