/** * {@inheritdoc} */ public function boot(ContainerInterface $container) { if (empty($this->options)) { throw new \RuntimeException('You must provide options for the Symfony 1.4 kernel.'); } if ($this->isBooted()) { return; } if ($this->classLoader && !$this->classLoader->isAutoloaded()) { $this->classLoader->autoload(); } $dispatcher = $container->get('event_dispatcher'); $event = new LegacyKernelBootEvent($container->get('request'), $this->options); $dispatcher->dispatch(LegacyKernelEvents::BOOT, $event); $this->options = $event->getOptions(); require_once $this->rootDir . '/config/ProjectConfiguration.class.php'; $application = $this->options['application']; $environment = $this->options['environment']; $debug = $this->options['debug']; $this->configuration = \ProjectConfiguration::getApplicationConfiguration($application, $environment, $debug, $this->getRootDir()); $this->configuration->loadHelpers(array('Url')); // Create a context to use with some helpers like Url. if (!\sfContext::hasInstance()) { $session = $container->get('session'); if ($session->isStarted()) { $session->save(); } ob_start(); \sfContext::createInstance($this->configuration); ob_end_flush(); $session->migrate(); } $this->isBooted = true; }
public function __construct(sfApplicationConfiguration $applicationConfiguration, $yaml_handler = 'sfYaml') { $this->checkYamlHandler($yaml_handler); $this->environment = $applicationConfiguration->getEnvironment(); $this->application_configuration = $applicationConfiguration; $this->config_path = $this->getConfigurationPath(); $this->entry = $this->getEntry(); }
/** * Initializes this class. * * Available options: * * * culture: The culture * * source: The i18n source (XLIFF by default) * * debug: Whether to enable debug or not (false by default) * * database: The database name (default by default) * * untranslated_prefix: The prefix to use when a message is not translated * * untranslated_suffix: The suffix to use when a message is not translated * * @param sfApplicationConfiguration $configuration A sfApplicationConfiguration instance * @param sfCache $cache A sfCache instance * @param array $options An array of options */ public function initialize(sfApplicationConfiguration $configuration, sfCache $cache = null, $options = array()) { $this->configuration = $configuration; $this->dispatcher = $configuration->getEventDispatcher(); $this->cache = $cache; if (isset($options['culture'])) { $this->setCulture($options['culture']); unset($options['culture']); } $this->options = array_merge(array('source' => 'XLIFF', 'debug' => false, 'database' => 'default', 'untranslated_prefix' => '[T]', 'untranslated_suffix' => '[/T]'), $options); $this->dispatcher->connect('user.change_culture', array($this, 'listenToChangeCultureEvent')); if ($this->isMessageSourceFileBased($this->options['source'])) { $this->dispatcher->connect('controller.change_action', array($this, 'listenToChangeActionEvent')); } }
/** * Initializes the current sfContext instance. * * @param sfApplicationConfiguration $configuration An sfApplicationConfiguration instance */ public function initialize(sfApplicationConfiguration $configuration) { $this->configuration = $configuration; $this->dispatcher = $configuration->getEventDispatcher(); try { $this->loadFactories(); } catch (sfException $e) { $e->printStackTrace(); } catch (Exception $e) { sfException::createFromException($e)->printStackTrace(); } $this->dispatcher->connect('template.filter_parameters', array($this, 'filterTemplateParameters')); // register our shutdown function register_shutdown_function(array($this, 'shutdown')); }
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)); }
public function initialize() { parent::initialize(); if (!sfConfig::get('sf_cli') && false !== sfConfig::get('app_frontend_csrf_secret')) { sfForm::enableCSRFProtection(sfConfig::get('app_frontend_csrf_secret')); } }
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); }
/** * @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); }
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); } }
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')); }
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; }
protected function findTemplate($path) { $path = $this->normalizeName($path); $this->parseName($path, $namespace, $tplPath); if ($namespace === 'root') { $fullFileName = sprintf('%s/%s', sfConfig::get('sf_app_template_dir'), $tplPath); $error = !is_file($fullFileName); } else { $fullFileName = $this->configuration->getTemplatePath($namespace, $tplPath); $error = $fullFileName === null; } if ($error) { throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (full file name "%s")', $path, $fullFileName)); } return $fullFileName; }
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"; }
/** * Tries to find given file in config subdirectory * * @param string $fileName Name to look for * @param boolean $throwException should exception be thrown when file is not found ? * @return mixed path to the file or false if file was not found */ function getConfigFilePath($fileName, $throwException = false) { $path = $this->getFilePath('config/' . $fileName); if ($path) { return $path; } $additionalPaths = array(); $application = $this->appConf->getApplication(); $rootDir = $this->appConf->getRootDir(); $additionalPaths[] = "{$rootDir}/apps/{$application}/config/pages"; $additionalPaths[] = "{$rootDir}/plugins/appFlowerPlugin/config/pages"; $path = $this->getFilePath($fileName, $additionalPaths); if (!$path && $throwException) { throw new XmlParserException("The '{$fileName}' config file for {$this->moduleName} module could not be found"); } return $path; }
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)); }
/** * 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; } }
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')); }
/** * 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; } }
/** * 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(); }
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'); } }
/** * 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); }
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); }
/** * Loads standard extensions for Symfony into the view. */ protected function loadExtensions() { // should be replaced with sf_twig_standard_extensions $prefixes = array_merge(array('Helper', 'Url', 'Asset', 'Tag', 'Escaping', 'Partial', 'I18N'), sfConfig::get('sf_standard_helpers')); foreach ($prefixes as $prefix) { $class_name = $prefix . '_Twig_Extension'; if (class_exists($class_name)) { $this->twig->addExtension(new $class_name()); } } // for now the extensions needs the original helpers so lets load thoose. $this->configuration->loadHelpers($prefixes); // makes it possible to load custom twig extensions. foreach (sfConfig::get('sf_twig_extensions', array()) as $extension) { if (!class_exists($extension)) { throw new InvalidArgumentException(sprintf('Unable to load "%s" as an Twig_Extension into Twig_Environment', $extension)); } $this->twig->addExtension(new $extension()); } }
/** * Renders the inline edit menu, which consists of buttons such as the * assets and links buttons * * @return string */ function get_sympal_inline_edit_bar_buttons() { $sympalContext = sfSympalContext::getInstance(); $content = $sympalContext->getCurrentContent(); $menuItem = $sympalContext->getCurrentMenuItem(); $menu = new sfSympalMenuInlineEditBarButtons('Inline Edit Bar Buttons'); $menu->setUlClass('sympal_inline_edit_bar_buttons'); if ($content->getEditableSlotsExistOnPage()) { $menu->addChild('Links', '@sympal_editor_links')->isEditModeButton(true)->setShortcut('Ctrl+Shift+L')->setInputClass('toggle_sympal_links')->setCredentials('InsertLinks'); } sfApplicationConfiguration::getActive()->getEventDispatcher()->notify(new sfEvent($menu, 'sympal.load_inline_edit_bar_buttons', array('content' => $content, 'menuItem' => $menuItem))); return $menu->render(); }
public function executeUser(sfWebRequest $request) { sfApplicationConfiguration::getActive()->loadHelpers(array('I18N', 'Parse')); $this->user = sfGuardUser::getUserByUsername($request->getParameter('username')); $this->forward404Unless($this->user); if ($request->getParameter('id')) { $this->blog = Doctrine::getTable('Blog')->find(array($request->getParameter('id'))); } else { $this->blog = Blog::getByTag($request->getParameter('name')); } $this->forward404Unless($this->blog); $this->getResponse()->setTitle($this->blog->getName() . " / " . $this->user->getUsername() . " / " . __("JoyReactor – твое хорошее настроние. Картинки, приколы, видео, демотиваторы.")); }
public function configure() { sfApplicationConfiguration::getActive()->loadHelpers('I18N'); unset($this['collectIcqStatus'], $this['user_id'], $this['validate'], $this['created_at'], $this['updated_at'], $this['rating'], $this['isNew']); $this->setWidget('ljpassword', new sfWidgetFormInputPassword(array('always_render_empty' => false))); $this->setWidget('avatar', new sfWidgetFormInputFileEditable(array('file_src' => $this->getObject()->getAvatar(), 'is_image' => true, 'edit_mode' => $this->getObject()->getAvatar(), 'with_delete' => $this->getObject()->getAvatar(), 'template' => '<div>%file%<br />%input%<br />%delete% %delete_label%</div>', 'delete_label' => __('Удалить аватар')))); $this->validatorSchema['avatar'] = new sfValidatorFile(array('path' => sfConfig::get('sf_upload_dir'), 'validated_file_class' => 'sfResizedFile', 'mime_types' => 'web_images', 'required' => false)); $this->widgetSchema->setLabels(array('email' => 'Адрес E-Mail:', 'fullname' => 'Имя и фамилия:', 'icq' => 'Номер ICQ:', 'jabber' => 'Jabber/GoogleTalk:', 'commentsToJabber' => 'Отправлять уведомления в Jabber:', 'commentsToIcq' => 'Отправлять уведомления в ICQ:', 'commentsToMail' => 'Отправлять уведомления по почте:', 'useCrossposting' => 'Использовать кросспостинг в ЖЖ:', 'collectJabberStatus' => 'Собирать jabber-статусы', 'notifyFriendline' => 'Уведомлять о новых постах друзей', 'ljlogin' => 'Живой Журнал:', 'ljpassword' => 'Пароль от ЖЖ:', 'avatar' => 'Аватар:', 'about' => 'О себе:')); $this->validatorSchema->setOption('allow_extra_fields', true); $this->validatorSchema->setOption('filter_extra_fields', false); $this->widgetSchema->setFormFormatterName('list'); $this->widgetSchema->setNameFormat('sfApplySettings[%s]'); }
public function __construct($comment = null, array $options = null) { sfApplicationConfiguration::getActive()->loadHelpers(array('Tag', 'Date', 'Partial')); $this->_comment = $comment; if (null !== $options) { $this->_rootListType = $options['root']['list-type']; $this->_rootListClass = $options['root']['list-class']; $this->_childListType = $options['child']['list-type']; $this->_childListClass = $options['child']['list-class']; $this->_itemListClass = $options['item']['list-class']; } }
/** * Настройки Doctrine */ public function configureDoctrine(Doctrine_Manager $manager) { parent::configureDoctrine($manager); if ('test' == $this->getEnvironment()) { $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE, new Doctrine_Cache_Array()); $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE_LIFESPAN, 0); } else { $servers = array('host' => 'localhost', 'port' => 11211, 'persistent' => true); $cacheDriver = new Doctrine_Cache_Memcache(array('servers' => $servers, 'compression' => true)); $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver); $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE_LIFESPAN, 600); //10m } }
/** * Calls provider's OAuth request token service * and returns whatever it gets from it * * @param String $provider * @return Array */ public static function getRequestToken($provider) { sfApplicationConfiguration::getActive()->loadHelpers(array('Url')); $config = sfConfig::get('app_cacophony'); $oauth = self::getInstance($provider); try { return $oauth->getRequestToken($config['providers'][$provider]['request_token_url'], sfContext::getInstance()->getRouting()->hasRouteName('sf_cacophony_callback') ? url_for(sprintf('@sf_cacophony_callback?provider=%s', $provider), true) : 'oob'); } catch (OAuthException $e) { if (sfConfig::get('sf_logging_enabled')) { sfContext::getInstance()->getLogger()->err($e->lastResponse); } return false; } }
public function setup() { parent::setup(); // site slug is used to generate symfony app // but symfony restricts allowed characters for app name if ($this->isNew()) { $this->setValidator('slug', new sfValidatorAnd(array($this->getValidator('slug'), new sfValidatorRegex(array('pattern' => '/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/'), array('invalid' => 'Site slug must consist of only letters, digits and underscores. ' . 'It also must not start with digit.'))), array('required' => $this->getValidator('slug')->getOption('required')))); } else { $this->getWidget('slug')->setAttribute('readonly', 'readonly'); $this->setValidator('slug', new sfValidatorChoice(array('choices' => array($this->getObject()->getSlug())))); } $field = sfApplicationConfiguration::getActive()->getPluginConfiguration('sfThemePlugin')->getThemeToolkit()->getThemeWidgetAndValidator(); $this->widgetSchema['theme'] = $field['widget']; $this->validatorSchema['theme'] = $field['validator']; }