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


PHP sfApplicationConfiguration::getActive方法代码示例

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


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

示例1: sendNotification

 public static function sendNotification($fromMember, $toMember, $diaryId)
 {
     $url = '/diary/' . $diaryId;
     sfApplicationConfiguration::getActive()->loadHelpers(array('I18N'));
     $message = format_number_choice('[1]1 diary has new comments|(1,Inf]%1% diaries have new comments', array('%1%' => '1'), 1);
     opNotificationCenter::notify($fromMember, $toMember, $message, array('category' => 'other', 'url' => $url, 'icon_url' => null));
 }
开发者ID:meruto,项目名称:opDiaryPlugin,代码行数:7,代码来源:opDiaryPluginUtil.class.php

示例2: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $this->checkPluginExists($arguments['plugin']);
     $this->pluginDir = sfApplicationConfiguration::getActive()->getPluginConfiguration($arguments['plugin'])->getRootDir();
     $this->interactive = !$options['non-interactive'];
     $cleanup = array();
     if (!file_exists($this->pluginDir . '/package.xml')) {
         $cleanup['temp_files'] = array();
         foreach (sfFinder::type('dir')->in($this->pluginDir) as $dir) {
             if (!sfFinder::type('any')->maxdepth(0)->in($dir)) {
                 $this->getFilesystem()->touch($file = $dir . '/.sf');
                 $cleanup['temp_files'][] = $file;
             }
         }
         $cleanup['package_file'] = true;
         $this->generatePackageFile($arguments, $options);
     }
     $cwd = getcwd();
     chdir($this->pluginDir);
     $this->getPluginManager()->configure();
     require_once 'PEAR/Packager.php';
     $packager = new PEAR_Packager();
     $package = $packager->package($this->pluginDir . '/package.xml', !$options['nocompress']);
     chdir($cwd);
     if (PEAR::isError($package)) {
         if (isset($cleanup['package_file'])) {
             $cleanup['package_file'] = '.error';
         }
         $this->cleanup($cleanup);
         throw new sfCommandException($package->getMessage());
     }
     $this->cleanup($cleanup);
 }
开发者ID:real-chocopanda,项目名称:sfTaskExtraPlugin,代码行数:36,代码来源:sfPluginPackageTask.class.php

示例3: Header

 public function Header()
 {
     $appConf = sfApplicationConfiguration::getActive();
     if (method_exists($appConf, 'configGet')) {
         $pdfLogo = $appConf->configGet('app_pdf_logo');
     } else {
         $pdfLogo = sfConfig::get('app_pdf_logo');
     }
     $logos = array("af" => sfConfig::get("app_appFlower_logo"), "partner" => $pdfLogo);
     if (!$logos["af"] || !file_exists($logos["af"]["file"])) {
         $logos["af"]["file"] = sfConfig::get("sf_root_dir") . "/plugins/appFlowerPlugin/web/images/logo.png";
     }
     $ps = $this->orientation == "P" ? 210 : 297;
     $this->Image($logos["af"]["file"], 10, 5, 0, 0, '', $logos["af"]["url"]);
     $p1 = getimagesize($logos["af"]["file"]);
     if ($logos["partner"]) {
         if (!file_exists($logos["partner"]["file"])) {
             $logos["partner"]["file"] = sfConfig::get("sf_root_dir") . "/web" . $logos["partner"]["file"];
         }
         if (file_exists($logos["partner"]["file"]) && is_file($logos["partner"]["file"])) {
             $p2 = getimagesize($logos["partner"]["file"]);
             $this->Image($logos["partner"]["file"], $ps - $this->getMMValue($p2[0]) - 10, 5, 0, 0, '', $logos["partner"]["url"]);
         } else {
             $p2 = array(0, 0);
         }
     } else {
         $p2 = array(0, 0);
     }
     $mh = max(array($p1[1], $p2[1]));
     $this->setY($mh / 72 * 25.4 + 5);
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(0, 10, ucwords($this->widget["title"]) . " Widget", "B", 1, "L");
     $this->Ln(5);
 }
开发者ID:cbsistem,项目名称:appflower_engine,代码行数:34,代码来源:afPDF.php

示例4: AddComment

 private function AddComment(sfWebRequest $request)
 {
     $text = $request->getParameter('comment_text');
     if ($request->isMethod("GET")) {
         $text = urldecode($text);
     }
     if ($this->getRequestParameter('comment_picture_url')) {
         $filename = jrFileUploader::UploadRemote($request->getParameter('comment_picture_url'));
         if ($text) {
             $text .= "<br/>";
         }
         $text .= "<img src='http://" . $request->getHost() . "/uploads/" . $filename . "' />";
     }
     if (!trim($text)) {
         return;
     }
     sfApplicationConfiguration::getActive()->loadHelpers(array('Parse', 'Text', 'Tag', 'I18N', 'Url'));
     $user = $this->getUser()->getGuardUser();
     $comment = new PostComment();
     $comment->setUser($user);
     $comment->setPost($this->post);
     if ($this->parent) {
         $comment->setParent($this->parent);
     }
     $comment->setComment(parsetext($text));
     $comment->setCommentOriginal($text);
     $comment->save();
     $this->curUser = $this->getUser()->getGuardUser();
     if ($this->curUser) {
         Cookie::setCookie($this->curUser, "comments" . $this->post->getId(), $this->post->getAllComments('count'), time() + 24 * 60 * 60);
         Cookie::setCookie($this->curUser, "comments" . $this->post->getId() . "Time", date("Y-m-d H:i:s"), time() + 24 * 60 * 60);
     }
 }
开发者ID:auphau,项目名称:joyreactor,代码行数:33,代码来源:actions.class.php

示例5: 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

示例6: get_sympal_admin_menu_object

function get_sympal_admin_menu_object($class = 'sfSympalMenuAdminMenu')
{
    static $menu;
    if (!$menu) {
        $sympalContext = sfSympalContext::getInstance();
        $menu = new $class('Sympal Admin', '@sympal_dashboard');
        if ($sympalContext->isAdminModule()) {
            $menu->addChild(sprintf('Go to %s', $sympalContext->getSite()->getTitle()), '@homepage', 'id=sympal_go_to_switch');
        } else {
            if (sfContext::getInstance()->getUser()->hasCredential('ViewDashboard')) {
                $menu->addChild('Go to Admin', '@sympal_dashboard', 'id=sympal_go_to_switch');
            }
        }
        if (sfContext::getInstance()->getUser()->hasCredential('ClearCache')) {
            $menu->addChild('Clear Cache', '@sympal_clear_cache', 'id=sympal_clear_cache_fancybox');
        }
        $menu->addChild('Content', '@sympal_content_types_index', array('label' => 'Site Content'));
        $menu->addChild('Site Administration', '@sympal_sites_edit?id=' . $sympalContext->getSite()->getId(), array('label' => 'Site Setup'));
        $menu->addChild('Security', '@sympal_users', array('label' => 'Users & Security'));
        $menu->addChild('Administration', '@sympal_sites', array('label' => 'Global Setup'));
        sfApplicationConfiguration::getActive()->getEventDispatcher()->notify(new sfEvent($menu, 'sympal.load_admin_menu'));
        $sympalContext = sfSympalContext::getInstance();
        $contentRecord = $sympalContext->getCurrentContent();
        $menuItem = $sympalContext->getCurrentMenuItem();
        if ($contentRecord) {
            sfApplicationConfiguration::getActive()->getEventDispatcher()->notify(new sfEvent($menu, 'sympal.load_editor', array('content' => $contentRecord, 'menuItem' => $menuItem)));
        }
    }
    return $menu;
}
开发者ID:slemoigne,项目名称:sympal,代码行数:30,代码来源:AdminHelper.php

示例7: execute

 protected function execute($arguments = array(), $options = array())
 {
     $pluginDir = sfApplicationConfiguration::getActive()->getPluginConfiguration('sfTwigPlugin')->getRootDir();
     $helperDir = sfApplicationConfiguration::getActive()->getSymfonyLibDir() . '/helper/';
     $command = sprintf('cd %s; ./helpers.sh %s', $pluginDir, $helperDir);
     exec($command, $output);
     echo implode(PHP_EOL, $output), "\n";
 }
开发者ID:videlalvaro,项目名称:sfTwigPlugin,代码行数:8,代码来源:sfTwigHelperToExtensionTask.class.php

示例8: sendNewCommentNotification

 public static function sendNewCommentNotification($fromMember, $toMember, $topicId)
 {
     $rootPath = sfContext::getInstance()->getRequest()->getRelativeUrlRoot();
     $url = $rootPath . '/communityTopic/' . $topicId;
     sfApplicationConfiguration::getActive()->loadHelpers(array('I18N'));
     $message = format_number_choice('[1]1 topic has new comments|(1,Inf]%1% topics have new comments', array('%1%' => '1'), 1);
     opNotificationCenter::notify($fromMember, $toMember, $message, array('category' => 'other', 'url' => $url, 'icon_url' => null));
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:8,代码来源:opCommunityTopicPluginUtil.class.php

示例9: checkPluginExists

 /**
  * Checks if a plugin exists.
  * 
  * The plugin directory must exist and have at least one file or folder
  * inside for that plugin to exist.
  * 
  * @param   string  $plugin
  * @param   boolean $boolean Whether to throw exception if plugin exists (false) or doesn't (true)
  * 
  * @throws  sfException If the plugin does not exist
  */
 public static function checkPluginExists($plugin, $boolean = true)
 {
     try {
         sfApplicationConfiguration::getActive()->getPluginConfiguration($plugin);
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:jmiridis,项目名称:atcsf1,代码行数:20,代码来源:sfTaskExtraBaseTask.class.php

示例10: checkPluginExists

 /**
  * Checks if a plugin exists.
  *
  * The plugin directory must exist and have at least one file or folder
  * inside for that plugin to exist.
  *
  * @param   string  $plugin
  *
  * @return  boolean True if the plugin exist, false otherwise
  */
 protected function checkPluginExists($plugin)
 {
     try {
         sfApplicationConfiguration::getActive()->getPluginConfiguration($plugin);
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:19,代码来源:sfTestBaseTask.class.php

示例11: save

 public function save()
 {
     $array = $this->_buildArrayToWrite();
     $this->_path = sfConfig::get('sf_app_dir') . '/config/app.yml';
     file_put_contents($this->_path, sfYaml::dump($array, 4));
     chdir(sfConfig::get('sf_root_dir'));
     $task = new sfCacheClearTask(sfApplicationConfiguration::getActive()->getEventDispatcher(), new sfFormatter());
     $task->run(array(), array('type' => 'config'));
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:9,代码来源:sfSympalConfigForm.class.php

示例12: doIsEditModeCheck

 /**
  * Perform the check to determine if we are in edit mode or not
  *
  * @return void
  */
 public function doIsEditModeCheck()
 {
     $content = sfSympalContext::getInstance()->getCurrentContent();
     if ($content && $content->getPubliclyEditable() || $content && $content->getAllEditPermissions() && $this->hasCredential($content->getAllEditPermissions()) || $this->isAuthenticated() && $this->hasCredential('ManageContent')) {
         $this->_isEditMode = true;
     } else {
         $this->_isEditMode = false;
     }
     $this->_isEditMode = sfApplicationConfiguration::getActive()->getEventDispatcher()->filter(new sfEvent($this, 'sympal.filter_is_edit_mode'), $this->_isEditMode)->getReturnValue();
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:15,代码来源:sfSympalUser.class.php

示例13: preExecute

 public function preExecute()
 {
     parent::preExecute();
     if ($this->getUser()->hasAttribute('api_log')) {
         $dispatcher = sfApplicationConfiguration::getActive()->getEventDispatcher();
         $string = $this->getUser()->getAttribute('api_log');
         $dispatcher->notify(new sfEvent('Api', 'application.log', array('priority' => sfLogger::WARNING, $string)));
         $this->getUser()->getAttributeHolder()->remove('api_log');
     }
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:10,代码来源:actions.class.php

示例14: getThemeWidgetAndValidator

 /**
  * Builds and returns an array with the widget and validator to use with
  * any choice field for a theme
  *
  * @return array $widgetAndValidator
  */
 public function getThemeWidgetAndValidator()
 {
     $themes = sfApplicationConfiguration::getActive()->getPluginConfiguration('sfThemePlugin')->getThemeManager()->getAvailableThemes();
     $options = array('' => '');
     foreach ($themes as $name => $theme) {
         $options[$name] = sfInflector::humanize($name);
     }
     $widget = new sfWidgetFormChoice(array('choices' => $options));
     $validator = new sfValidatorChoice(array('choices' => array_keys($options), 'required' => false));
     return array('widget' => $widget, 'validator' => $validator);
 }
开发者ID:rafaelgou,项目名称:sfThemePlugin,代码行数:17,代码来源:sfThemeToolkit.class.php

示例15: init

 protected function init()
 {
     sfApplicationConfiguration::getActive()->loadHelpers(array('Url'));
     $header1 = new ListHeader();
     $header1->populateFromArray(array('name' => 'Report Name', 'width' => '400', 'isSortable' => true, 'sortField' => 'name', 'elementType' => 'label', 'elementProperty' => array('getter' => 'getName')));
     $header2 = new ListHeader();
     $header2->populateFromArray(array('name' => '', 'width' => '95', 'isSortable' => false, 'elementType' => 'link', 'textAlignmentStyle' => 'left', 'elementProperty' => array('label' => __('Run'), 'placeholderGetters' => array('id' => 'getReportId'), 'urlPattern' => url_for('core/displayPredefinedReport') . '?reportId={id}')));
     $header3 = new ListHeader();
     $header3->populateFromArray(array('name' => '', 'width' => '95', 'isSortable' => false, 'elementType' => 'link', 'textAlignmentStyle' => 'left', 'elementProperty' => array('label' => __('Edit'), 'placeholderGetters' => array('id' => 'getReportId'), 'urlPattern' => url_for('core/definePredefinedReport') . '?reportId={id}')));
     $this->headers = array($header1, $header2, $header3);
 }
开发者ID:THM068,项目名称:orangehrm,代码行数:11,代码来源:ViewDefinedPredefinedReportsConfigurationFactory.php


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