public function configure()
 {
     $this->setWidgets(array('sf_plop_website_description' => new sfWidgetFormTextarea(array('default' => sfPlop::get('sf_plop_website_description'), 'label' => 'SEO description')), 'sf_plop_website_keywords' => new sfWidgetFormInputText(array('label' => 'SEO keywords'), array('value' => sfPlop::get('sf_plop_website_keywords'))), 'sf_plop_use_custom_page_title' => new sfWidgetFormInputCheckbox(array('label' => 'Use the website title in the page title ?'), array('checked' => sfPlop::get('sf_plop_use_custom_page_title') == true ? 'checked' : null)), 'sf_plop_website_title_position' => new sfWidgetFormSelect(array('choices' => array('before' => 'before', 'after' => 'after'), 'label' => 'Website title position'), array()), 'sf_plop_website_title' => new sfWidgetFormInputText(array('label' => 'Website title'), array('value' => sfPlop::get('sf_plop_website_title'))), 'sf_plop_website_title_prefix' => new sfWidgetFormInputText(array('label' => 'Website title prefix'), array('value' => sfPlop::get('sf_plop_website_title_prefix'))), 'sf_plop_website_title_suffix' => new sfWidgetFormInputText(array('label' => 'Website title suffix'), array('value' => sfPlop::get('sf_plop_website_title_suffix'))), 'sf_plop_use_title_in_seo_description' => new sfWidgetFormInputCheckbox(array('label' => 'Use the page title in the description ?'), array('checked' => sfPlop::get('sf_plop_use_title_in_seo_description') == true ? 'checked' : null))));
     $this->setDefault('sf_plop_website_title_position', sfPlop::get('sf_plop_website_title_position'));
     $this->setValidators(array('sf_plop_website_description' => new sfValidatorString(array('required' => false)), 'sf_plop_website_keywords' => new sfValidatorString(array('required' => false)), 'sf_plop_use_custom_page_title' => new sfValidatorBoolean(array('required' => false)), 'sf_plop_website_title_position' => new sfValidatorPass(), 'sf_plop_website_title' => new sfValidatorString(array('required' => false)), 'sf_plop_website_title_prefix' => new sfValidatorString(array('required' => false)), 'sf_plop_website_title_suffix' => new sfValidatorString(array('required' => false)), 'sf_plop_use_title_in_seo_description' => new sfValidatorBoolean(array('required' => false))));
     parent::configure();
 }
 public function configure()
 {
     parent::configure();
     unset($this['value'], $this['options']);
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('plopAdmin');
     $this->widgetSchema->getFormFormatter()->setHelpFormat(sfPlop::get('sf_plop_form_help_format'));
     $helps = array();
     $slotConfig = $this->getObject()->getsfPlopSlotConfig();
     $slotConfig->setCulture($this->getObject()->getCulture());
     $slotObject = $slotConfig->getSlot()->getTemplateObject();
     if ($slotObject->isContentEditable() || $slotObject->isContentOptionable()) {
         $fields = $slotObject->getFields($slotConfig);
         foreach ($fields as $field_name => $field_widget) {
             $this->widgetSchema[$field_name] = $field_widget;
             if ($field_name == 'value' && $slotObject->isContentEditable() && $this->getOption('isAjax', false)) {
                 $this->widgetSchema[$field_name]->setHidden(true);
             }
             if ($field_name == 'value') {
                 $this->setDefault($field_name, $slotConfig->getValue($this->getOption('culture')));
             } else {
                 $this->setDefault($field_name, $slotConfig->getOption($field_name, $field_widget->getOption('default'), $this->getOption('culture')));
             }
         }
         $this->widgetSchema->setHelps($slotObject->getFieldHelps($slotConfig));
         foreach ($slotObject->getValidators($slotConfig) as $field_name => $field_validator) {
             $this->validatorSchema[$field_name] = $field_validator;
         }
         $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'dumpOptions'), 'arguments' => array('slot_fields' => array_keys($fields)))));
     }
 }
 public function configure()
 {
     parent::configure();
     unset($this['tree_left'], $this['tree_right'], $this['tree_level'], $this['created_at'], $this['updated_at']);
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('plopAdmin');
     $this->validatorSchema->setOption('allow_extra_fields', true);
     $this->validatorSchema->setOption('filter_extra_fields', false);
     if ($this->isNew()) {
         if ($this->getOption('culture', sfPlop::get('sf_plop_default_culture'))) {
             $this->getObject()->setCulture($this->getOption('culture'));
         }
         $this->embedForm($this->getObject()->getCulture(), new sfPlopPageI18nForm($this->getObject()->getTranslation($this->getObject()->getCulture()), array('only_title' => true)));
         $this->widgetSchema->moveField($this->getObject()->getCulture(), sfWidgetFormSchema::FIRST);
     }
     $this->widgetSchema['theme'] = new sfWidgetFormPlopChoiceSubTheme(array('add_empty' => true));
     $this->validatorSchema['theme'] = new sfvalidatorPlopChoiceSubTheme(array('required' => false));
     $this->widgetSchema['is_published']->setLabel('Is published ?');
     $this->widgetSchema['is_category']->setLabel('Is category ?');
     $this->widgetSchema['icon'] = new sfWidgetFormAssetExtraChoice(array('label' => 'Icon'));
     $this->validatorSchema['icon'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema['template_id'] = new sfWidgetFormChoice(array('choices' => array('' => '') + $this->getTemplatePages()));
     $this->validatorSchema['template_id'] = new sfValidatorChoice(array('choices' => array_keys($this->getTemplatePages()), 'required' => false));
     if (!$this->getObject()->isRoot()) {
         $this->widgetSchema['position'] = new sfWidgetFormChoice(array('choices' => $this->getPositions(), 'expanded' => true));
         $this->validatorSchema['position'] = new sfValidatorChoice(array('choices' => array_keys($this->getPositions()), 'required' => false));
         $this->widgetSchema['position_relative'] = new sfWidgetFormChoice(array('label' => 'Relative position to', 'choices' => array('' => '') + sfPlopPagePeer::getPagesWithLevel()));
         $this->validatorSchema['position_relative'] = new sfValidatorChoice(array('choices' => array_keys(sfPlopPagePeer::getPagesWithLevel()), 'required' => false));
     }
     $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'checkPositions'))));
 }
 public function configure()
 {
     $this->setWidgets(array('sf_plop_allow_registration' => new sfWidgetFormInputCheckbox(array('label' => 'Allow registration ?'), array('checked' => sfPlop::get('sf_plop_allow_registration') == true ? 'checked' : null)), 'sf_plop_private_access' => new sfWidgetFormInputCheckbox(array('label' => 'Restrict public access ?'), array('checked' => sfPlop::get('sf_plop_private_access') == true ? 'checked' : null)), 'sf_plop_cache_lifetime' => new sfWidgetFormChoice(array('label' => 'Cache lifetime', 'choices' => $this->getCacheLifetimeValues()))));
     $this->setValidators(array('sf_plop_allow_registration' => new sfValidatorBoolean(), 'sf_plop_private_access' => new sfValidatorBoolean(), 'sf_plop_cache_lifetime' => new sfValidatorChoice(array('choices' => array_keys($this->getCacheLifetimeValues())))));
     $this->setDefault('sf_plop_cache_lifetime', sfPlop::get('sf_plop_cache_lifetime'));
     parent::configure();
 }
 /**
  * Constructor.
  */
 protected function configure($options = array(), $attributes = array())
 {
     parent::configure($options, $attributes);
     $this->addOption('culture', sfPlop::get('sf_plop_default_culture'));
     $this->addOption('url', '@sf_plop_ws_repository');
     $this->addOption('query_string', array('folder=/assets', 'type=file'));
 }
 protected function getParams($slot, $settings)
 {
     $page = $settings['page'];
     $relative_slug = $slot->getOption('relative_page', null, $settings['culture']);
     if ($relative_slug === null) {
         $relative_page = $page->isRoot() ? $page : sfPlopPageQuery::create()->findRoot();
     } elseif ($page->getSlug() == $relative_slug) {
         $relative_page = $page;
     } else {
         $relative_page = sfPlopPagePeer::retrieveBySlug($relative_slug);
     }
     if (!$relative_page) {
         $relative_page = $page->isRoot() ? $page : sfPlopPageQuery::create()->findRoot();
     }
     $level_depth = $slot->getOption('level_depth', null, $settings['culture']);
     if (isset($level_depth)) {
         $q = sfPlopPageQuery::create()->addCond('cond1', sfPlopPagePeer::TREE_LEVEL, $relative_page->getLevel() + $level_depth, Criteria::LESS_EQUAL)->addCond('cond2', sfPlopPagePeer::TREE_LEVEL, null, Criteria::ISNULL)->combine(array('cond1', 'cond2'), Criteria::LOGICAL_OR);
     } else {
         $q = sfPlopPageQuery::create();
     }
     $level1_nodes = $relative_page->getDescendants($q);
     $useAjax = sfPlop::get('sf_plop_use_ajax') === true ? true : false;
     $displays = $slot->getOption('displays', array(), $settings['culture']);
     $use_icon = in_array('icon', $displays) ? true : false;
     $use_subtitle = in_array('subtitle', $displays) ? true : false;
     $use_title = in_array('title', $displays) || !$use_icon && !$use_subtitle ? true : false;
     return array('relative_level' => $relative_page->getLevel() + 1, 'relative_page' => $relative_page, 'level_depth' => $level_depth, 'show_hidden_parent' => false, 'level1_nodes' => $level1_nodes, 'useAjax' => $useAjax, 'displays' => $displays, 'use_icon' => $use_icon, 'use_subtitle' => $use_subtitle, 'use_title' => $use_title, 'menu_class' => 'w-menu');
 }
 public function configure()
 {
     $this->setWidgets(array('sf_plop_use_statistics' => new sfWidgetFormInputCheckbox(array('label' => 'Use statistics ?'), array('checked' => sfPlop::get('sf_plop_use_statistics') == true ? 'checked' : null)), 'sf_plop_statistics_code' => new sfWidgetFormTextarea(array('default' => sfPlop::get('sf_plop_statistics_code'), 'label' => 'Statistics code')), 'sf_plop_statistics_reports_url' => new sfWidgetFormInputText(array('label' => 'Statistics reports url'), array('value' => sfPlop::get('sf_plop_statistics_reports_url')))));
     $this->setDefault('sf_plop_statistics_code', sfPlop::get('sf_plop_statistics_code'));
     $this->setValidators(array('sf_plop_use_statistics' => new sfValidatorBoolean(), 'sf_plop_statistics_code' => new sfValidatorString(array('required' => false)), 'sf_plop_statistics_reports_url' => new sfValidatorUrl(array('required' => false))));
     parent::configure();
 }
 public function configure()
 {
     $this->setWidgets(array('sf_plop_custom_favicon' => new sfWidgetFormAssetExtraChoice(array('label' => 'Favicon'), array('value' => sfPlop::get('sf_plop_custom_favicon'))), 'sf_plop_custom_webapp_favicon' => new sfWidgetFormAssetExtraChoice(array('label' => 'Webapp icon'), array('value' => sfPlop::get('sf_plop_custom_webapp_favicon'))), 'sf_plop_use_image_zoom' => new sfWidgetFormInputCheckbox(array('label' => 'Use image zoom ?'), array('checked' => sfPlop::get('sf_plop_use_image_zoom') === true ? 'checked' : null)), 'sf_plop_use_html5' => new sfWidgetFormInputCheckbox(array('label' => 'Use HTML5 ?'), array('checked' => sfPlop::get('sf_plop_use_html5') === true ? 'checked' : null)), 'sf_plop_use_ajax' => new sfWidgetFormInputCheckbox(array('label' => 'Use Ajax in navigation menus ?'), array('checked' => sfPlop::get('sf_plop_use_ajax') === true ? 'checked' : null)), 'sf_plop_css' => new sfWidgetFormAssetExtraChoice(array('label' => 'Stylesheet'), array('value' => sfPlop::get('sf_plop_css'))), 'sf_plop_js' => new sfWidgetFormAssetExtraChoice(array('label' => 'Javascript'), array('value' => sfPlop::get('sf_plop_js'))), 'sf_plop_admin_theme' => new sfWidgetFormPlopChoiceAdminTheme(array('label' => 'Admin theme', 'add_empty' => true))));
     $this->setDefault('sf_plop_admin_theme', sfPlop::get('sf_plop_admin_theme'));
     $this->setValidators(array('sf_plop_custom_favicon' => new sfValidatorString(array('required' => false)), 'sf_plop_custom_webapp_favicon' => new sfValidatorString(array('required' => false)), 'sf_plop_use_image_zoom' => new sfValidatorBoolean(), 'sf_plop_use_html5' => new sfValidatorBoolean(), 'sf_plop_use_ajax' => new sfValidatorBoolean(), 'sf_plop_admin_theme' => new sfValidatorPlopChoiceAdminTheme(array('required' => false)), 'sf_plop_css' => new sfValidatorString(array('required' => false)), 'sf_plop_js' => new sfValidatorString(array('required' => false))));
     $this->widgetSchema->setHelps(array('sf_plop_custom_webapp_favicon' => 'This is used on smartphones when you create a shorcut on the desktop.'));
     parent::configure();
 }
 public function configure()
 {
     parent::configure();
     $selector = 'body';
     $this->setWidgets(array('sf_plop_background_image' => new sfWidgetFormAssetExtraChoice(array('label' => 'Background image'), array('value' => sfPlop::get('sf_plop_background_image'), 'data-property' => 'background-image', 'data-target' => $selector)), 'sf_plop_background_color' => new sfWidgetFormInputColor(array('label' => 'Background color'), array('value' => sfPlop::get('sf_plop_background_color'), 'data-property' => 'background-color', 'data-target' => $selector)), 'sf_plop_background_repeat' => new sfWidgetFormCssProperty(array('property' => 'background-repeat', 'label' => 'Background repetition'), array('value' => sfPlop::get('sf_plop_background_repeat'), 'data-property' => 'background-repeat', 'data-target' => $selector)), 'sf_plop_background_position_horizontal' => new sfWidgetFormCssProperty(array('property' => 'background-position-x', 'label' => 'Horizontal background position'), array('value' => sfPlop::get('sf_plop_background_position_horizontal'), 'data-property' => 'background-position-x', 'data-target' => $selector)), 'sf_plop_background_position_vertical' => new sfWidgetFormCssProperty(array('property' => 'background-position-y', 'label' => 'Vertical background position'), array('value' => sfPlop::get('sf_plop_background_position_vertical'), 'data-property' => 'background-position-y', 'data-target' => $selector))));
     $this->setValidators(array('sf_plop_background_image' => new sfValidatorString(array('required' => false)), 'sf_plop_background_color' => new sfValidatorString(array('required' => false)), 'sf_plop_background_repeat' => new sfValidatorString(array('required' => false)), 'sf_plop_background_position_horizontal' => new sfValidatorString(array('required' => false)), 'sf_plop_background_position_vertical' => new sfValidatorString(array('required' => false))));
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('plopAdmin');
 }
 public function configure()
 {
     parent::configure();
     $selector = '#container .w-block';
     $this->setWidgets(array('sf_plop_block_text_font' => new sfWidgetFormCssProperty(array('property' => 'font-family', 'label' => 'Font family'), array('value' => sfPlop::get('sf_plop_block_text_font'), 'title' => 'font-family', 'data-target' => $selector)), 'sf_plop_block_text_size' => new sfWidgetFormCssProperty(array('property' => 'font-size', 'label' => 'Font size'), array('value' => sfPlop::get('sf_plop_block_text_size'), 'title' => 'font-size', 'data-target' => $selector)), 'sf_plop_block_text_color' => new sfWidgetFormInputColor(array('label' => 'Text color'), array('value' => sfPlop::get('sf_plop_block_text_color'), 'title' => 'color', 'data-target' => $selector)), 'sf_plop_block_link_color' => new sfWidgetFormInputColor(array('label' => 'Link color'), array('value' => sfPlop::get('sf_plop_block_link_color'), 'title' => 'color', 'data-target' => $selector . ' a')), 'sf_plop_block_bold_color' => new sfWidgetFormInputColor(array('label' => 'Bold text color'), array('value' => sfPlop::get('sf_plop_block_bold_color'), 'title' => 'color', 'data-target' => $selector . ' b,' . $selector . ' strong')), 'sf_plop_block_italic_color' => new sfWidgetFormInputColor(array('label' => 'Italic text color'), array('value' => sfPlop::get('sf_plop_block_italic_color'), 'title' => 'color', 'data-target' => $selector . ' i,' . $selector . ' em'))));
     $this->setValidators(array('sf_plop_block_text_font' => new sfValidatorString(array('required' => false)), 'sf_plop_block_text_size' => new sfValidatorString(array('required' => false)), 'sf_plop_block_text_color' => new sfValidatorString(array('required' => false)), 'sf_plop_block_link_color' => new sfValidatorString(array('required' => false)), 'sf_plop_block_bold_color' => new sfValidatorString(array('required' => false)), 'sf_plop_block_italic_color' => new sfValidatorString(array('required' => false))));
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('plopAdmin');
 }
 public function configure()
 {
     parent::configure();
     $selector = '#container';
     $this->setWidgets(array('sf_plop_icon' => new sfWidgetFormAssetExtraChoice(array('label' => 'Favicon'), array('value' => sfPlop::get('sf_plop_icon'))), 'sf_plop_css' => new sfWidgetFormAssetExtraChoice(array('label' => 'Stylesheet'), array('value' => sfPlop::get('sf_plop_css'))), 'sf_plop_js' => new sfWidgetFormAssetExtraChoice(array('label' => 'Javascript'), array('value' => sfPlop::get('sf_plop_js'))), 'sf_plop_website_width' => new sfWidgetFormCssProperty(array('property' => 'website-width', 'label' => 'Website width'), array('value' => sfPlop::get('sf_plop_website_width'), 'data-property' => 'width', 'data-target' => $selector))));
     $this->setValidators(array('sf_plop_icon' => new sfValidatorString(array('required' => false)), 'sf_plop_css' => new sfValidatorString(array('required' => false)), 'sf_plop_js' => new sfValidatorString(array('required' => false)), 'sf_plop_website_width' => new sfValidatorString(array('required' => false))));
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('plopAdmin');
 }
 public function configure()
 {
     parent::configure();
     unset($this['updated_at'], $this['role'], $this['phone'], $this['theme'], $this['is_public']);
     $this->widgetSchema['culture'] = new sfWidgetFormPlopI18nChoiceLanguage(array('languages' => sfPlop::get('sf_plop_cultures'), 'default' => $this->getOption('user_culture'), 'culture' => $this->getOption('culture')));
     $this->widgetSchema->setHelps(array('password' => null));
     $this->validatorSchema['password'] = new sfValidatorString(array('min_length' => 6, 'max_length' => 128));
 }
 public function configure()
 {
     parent::configure();
     unset($this['created_at'], $this['updated_at']);
     foreach (sfPlop::get('sf_plop_cultures') as $culture) {
         $this->embedForm($culture, new sfPlopShopDurationI18nForm($this->getObject()->getTranslation($culture)));
     }
 }
 public function configure()
 {
     $this->setWidgets(array('sf_plop_default_culture' => new sfWidgetFormI18nChoiceLanguage(array('culture' => sfPlop::get('sf_plop_default_culture'), 'languages' => sfPlop::get('sf_plop_cultures'))), 'sf_plop_cultures' => new sfWidgetFormPlopI18nChoiceLanguage(array('expanded' => true, 'culture' => sfPlop::get('sf_plop_default_culture'), 'multiple' => true))));
     $this->setDefault('sf_plop_default_culture', sfPlop::get('sf_plop_default_culture'));
     $this->setDefault('sf_plop_cultures', sfPlop::get('sf_plop_cultures'));
     $this->widgetSchema->setLabels(array('sf_plop_default_culture' => 'Default language', 'sf_plop_cultures' => 'Languages'));
     $this->setValidators(array('sf_plop_default_culture' => new sfValidatorI18nChoiceLanguage(array('languages' => sfPlop::get('sf_plop_cultures'))), 'sf_plop_cultures' => new sfValidatorI18nChoiceLanguage(array('multiple' => true))));
     parent::configure();
 }
 public function getChoices()
 {
     $choices = array();
     $themes = sfPlop::get('sf_plop_loaded_admin_themes');
     foreach ($themes as $theme) {
         $choices[$theme['name']] = $theme['description'];
     }
     return array_keys($choices);
 }
 public function configure()
 {
     parent::configure();
     unset($this['created_at'], $this['updated_at']);
     $this->widgetSchema['image_id'] = new sfWidgetFormAssetExtraInput();
     foreach (sfPlop::get('sf_plop_cultures') as $culture) {
         $this->embedForm($culture, new sfPlopShopProductI18nForm($this->getObject()->getTranslation($culture)));
     }
 }
 public function getSlots()
 {
     $config_slots = sfPlop::get('sf_plop_cms_slot_templates', true);
     $loaded_slots = sfPlop::get('sf_plop_cms_loaded_slot_templates');
     if (!$loaded_slots) {
         $loaded_slots = array();
     }
     return array_merge($config_slots, $loaded_slots);
 }
 protected function getParams($slot, $settings)
 {
     if (isset($settings['request_parameters']) && isset($settings['request_parameters']['theme'])) {
         $theme = $settings['request_parameters']['theme']['theme'];
     } else {
         $theme = sfPlop::get('sf_plop_theme');
     }
     return array('default_theme' => sfPlop::get('sf_plop_theme'), 'theme' => $theme, 'form' => new sfPlopPublicThemeSwitcherForm(null, array('default_theme' => sfPlop::get('sf_plop_theme'), 'theme' => $theme)));
 }
 protected function getParams($slot, $settings)
 {
     $relative_slug = $slot->getOption('relative_page', '', $settings['culture']);
     $localizations = sfPlop::get('sf_plop_cultures');
     $displays = $slot->getOption('displays', array(), $settings['culture']);
     $hide_current = $slot->getOption('hide_current', false, $settings['culture']);
     $use_flag = in_array('icon', $displays) ? true : false;
     $use_label = in_array('title', $displays) || !$use_flag ? true : false;
     return array('relative_slug' => $relative_slug, 'localizations' => $localizations, 'displays' => $displays, 'hide_current' => $hide_current, 'use_flag' => $use_flag, 'use_label' => $use_label);
 }
 public function getChoices()
 {
     $themes = sfPlop::get('sf_plop_loaded_themes');
     $theme = sfPlop::get('sf_plop_theme');
     $choices = array();
     if (isset($themes[$theme]['subthemes']) && is_array($themes[$theme]['subthemes'])) {
         $choices = array_keys($themes[$theme]['subthemes']);
     }
     return $choices;
 }
 public function getChoices()
 {
     $choices = array();
     $themes = sfPlop::get('sf_plop_loaded_admin_themes');
     foreach ($themes as $theme) {
         $choices[$theme['name']] = $theme['description'];
     }
     if ($this->options['add_empty'] === true) {
         $choices = array('' => '') + $choices;
     }
     return $choices;
 }
 protected function doSave($con = null)
 {
     $values = $this->values;
     parent::doSave($con);
     foreach (sfPlop::get('sf_plop_cultures') as $culture) {
         if ($values[$culture]['title'] == '') {
             $this->getObject()->setCulture($values[$culture]['locale']);
             $this->getObject()->setTitle('Page');
             $this->getObject()->save();
         }
     }
 }
 public function configure()
 {
     parent::configure();
     unset($this['updated_at']);
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('plopAdmin');
     $this->widgetSchema['culture'] = new sfWidgetFormPlopI18nChoiceLanguage(array('languages' => sfPlop::get('sf_plop_cultures'), 'default' => $this->getOption('user_culture'), 'culture' => $this->getOption('culture')));
     $this->validatorSchema['culture'] = new sfValidatorI18nChoiceLanguage();
     $this->widgetSchema['is_public']->setLabel('Is public ?');
     $this->widgetSchema['theme'] = new sfWidgetFormPlopChoiceAdminTheme(array('add_empty' => true));
     $this->validatorSchema['theme'] = new sfValidatorPlopChoiceAdminTheme(array('required' => false));
     $this->widgetSchema->getFormFormatter()->setHelpFormat(sfPlop::get('sf_plop_form_help_format'));
     $this->widgetSchema->setHelps(array('password' => 'To update the password, please fill the two "password" fields. Otherwise, let them empty.'));
 }
 public function getChoices()
 {
     $themes = sfPlop::get('sf_plop_loaded_themes');
     $theme = sfPlop::get('sf_plop_theme');
     $choices = array();
     if (isset($themes[$theme]['subthemes']) && is_array($themes[$theme]['subthemes'])) {
         $choices = $themes[$theme]['subthemes'];
         if ($this->options['add_empty'] === true) {
             $choices = array('' => '') + $choices;
         }
     }
     return $choices;
 }
 public function execute($filterChain)
 {
     if (sfConfig::get('sf_cache', false) !== false) {
         $context = $this->getContext();
         if (class_exists('sfPlop')) {
             $lifetime = sfPlop::get('sf_plop_cache_lifetime');
         } else {
             $lifetime = 86400;
         }
         $context->getViewCacheManager()->addCache('sfPlopCMS', '_slot', array('lifeTime' => $lifetime, 'contextual' => false, 'withLayout' => false));
     }
     $filterChain->execute();
 }
Ejemplo n.º 26
0
 /**
  * Override the default method retrieving the [title] column value.
  *
  * @return string
  */
 public function getTitle()
 {
     $t = parent::getTitle();
     if (is_null($t)) {
         if ($this->getCulture() == sfPlop::get('sf_plop_default_culture')) {
             $title = 'Page';
         } else {
             $title = $this->getTranslation(sfPlop::get('sf_plop_default_culture'))->getTitle();
         }
         $this->setTitle($title);
         $this->save();
     }
     return parent::getTitle();
 }
 public function configure()
 {
     parent::configure();
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('plopAdmin');
     $this->widgetSchema->getFormFormatter()->setHelpFormat(sfPlop::get('sf_plop_form_help_format'));
     if ($this->getOption('only_title') === true) {
         unset($this['subtitle'], $this['seo_title'], $this['seo_description'], $this['seo_keywords']);
     } else {
         $this->validatorSchema['locale'] = new sfValidatorChoice(array('choices' => sfPlop::get('sf_plop_cultures'), 'required' => false));
         $this->widgetSchema['seo_title']->setLabel('SEO title');
         $this->widgetSchema['seo_description']->setLabel('SEO description');
         $this->widgetSchema['seo_keywords']->setLabel('SEO keywords');
         $this->widgetSchema->setHelps(array('seo_title' => 'If this field is filled, this will override the complete title.'));
     }
 }
Ejemplo n.º 28
0
 /**
  * Check if the config needs to be updated given to his value.
  * @param String $name
  * @param String $value
  * @param PropelPDO $con
  */
 public static function addOrUpdate($name, $value, $con = null)
 {
     $config = sfPlopConfigPeer::retrieveByName($name, $con);
     $config_static = self::dump(sfPlop::get($name, true));
     $value_dump = self::dump($value);
     if ($config && !self::isIdentical($config->getValue(), $value_dump)) {
         if (is_string($value_dump) && trim($value_dump) == '' || self::isIdentical($value_dump, $config_static)) {
             $config->delete();
         } elseif (!self::isIdentical($value_dump, $config_static)) {
             $config->setValue($value_dump);
             $config->save();
         }
     } elseif (!$config && trim($value_dump) != '' && !self::isIdentical($value_dump, $config_static)) {
         $config = new sfPlopConfig();
         $config->setName($name);
         $config->setValue($value_dump);
         $config->save();
     }
     sfPlop::set($name, $value);
 }
 public function initialize()
 {
     // LISTENERS
     $this->dispatcher->connect('plop.messaging', array('sfPlopListeners', 'listenToMessagingEvent'));
     // CONFIG
     sfConfig::add(array('sf_plop_version' => '2', 'sf_plop_website_description' => 'Plop CMS - a fully customizable CMS', 'sf_plop_website_keywords' => 'plop, cms', 'sf_plop_use_custom_page_title' => true, 'sf_plop_website_title' => 'Plop CMS', 'sf_plop_website_title_position' => 'after', 'sf_plop_website_title_prefix' => '-', 'sf_plop_website_title_suffix' => '', 'sf_plop_use_title_in_seo_description' => true, 'sf_plop_default_culture' => 'fr', 'sf_plop_cultures' => array('fr', 'en'), 'sf_plop_use_country_flags' => true, 'sf_plop_country_flags_path' => '/sfPlopPlugin/vendor/famfamfam/flags/', 'sf_plop_loaded_admin_themes' => array('admin' => array('name' => 'admin', 'description' => 'Default admin theme', 'color' => '#444'), 'admin-theme-light' => array('name' => 'admin-theme-light', 'description' => 'Light version of the default admin theme', 'color' => '#eee')), 'sf_plop_admin_theme' => 'admin', 'sf_plop_loaded_themes' => array('none' => false, 'victor' => array('name' => 'victor', 'description' => 'Victor grey', 'location' => '/sfPlopPlugin/themes/victor/', 'css' => array('/sfPlopPlugin/themes/victor/css/theme.css', 'http://fonts.googleapis.com/css?family=Kreon'), 'subthemes' => array('victor victor-black' => 'Victor black', 'victor victor-blue' => 'Victor blue')), 'dark' => array('name' => 'dark', 'description' => 'Dark', 'location' => '/sfPlopPlugin/themes/dark/', 'css' => '/sfPlopPlugin/themes/dark/css/theme.css'), 'florentine' => array('name' => 'florentine', 'description' => 'Florentine', 'location' => '/sfPlopPlugin/themes/florentine/', 'css' => '/sfPlopPlugin/themes/florentine/css/theme.css'), 'metal' => array('name' => 'metal', 'description' => 'Metal', 'location' => '/sfPlopPlugin/themes/metal/', 'css' => '/sfPlopPlugin/themes/metal/css/theme.css'), 'canvas' => array('name' => 'mfgallery', 'description' => 'Canvas', 'location' => '/sfPlopPlugin/themes/canvas/', 'css' => '/sfPlopPlugin/themes/canvas/css/theme.css'), 'kerbi' => array('name' => 'kerbi', 'description' => 'Kerbi', 'location' => '/sfPlopPlugin/themes/kerbi/', 'css' => array('/sfPlopPlugin/themes/kerbi/css/theme.css', 'http://fonts.googleapis.com/css?family=Kreon')), 'architect' => array('name' => 'architect', 'description' => 'Architect', 'location' => '/sfPlopPlugin/themes/architect/', 'css' => array('/sfPlopPlugin/themes/architect/css/theme.css', 'http://fonts.googleapis.com/css?family=Terminal+Dosis'))), 'sf_plop_theme' => 'victor', 'sf_plop_custom_css' => null, 'sf_plop_custom_js' => null, 'sf_plop_custom_favicon' => '/sfPlopPlugin/images/favicon.ico', 'sf_plop_custom_webapp_favicon' => '/sfPlopPlugin/images/apple-touch-icon.png', 'sf_plop_use_html5' => true, 'sf_plop_use_image_zoom' => false, 'sf_plop_use_ajax' => false, 'sf_plop_form_help_format' => '<div class="widget-form-help">%help%</div>', 'sf_plop_use_statistics' => false, 'sf_plop_statistics_code' => '', 'sf_plop_slots_class_prefix' => 'sfPlopSlot', 'sf_plop_allow_registration' => false, 'sf_plop_private_access' => false, 'sf_plop_menu_items' => array('icon' => 'icon', 'title' => 'title', 'subtitle' => 'subtitle'), 'sf_plop_slot_layouts' => array('l' => 'left', 'c' => 'center', 'r' => 'right', 'lc' => 'left + center', 'cr' => 'center + right', 'ml' => 'midleft', 'mr' => 'midright', 'lcr' => 'left + center + right'), 'sf_plop_loaded_slots' => array('RichText' => 'Rich text', 'Text' => 'Simple text', 'PageTitle' => 'Page title', 'Area' => 'Blocks area', 'PageHeader' => 'Page header', 'PageFooter' => 'Page footer', 'MainNavigation' => 'Main navigation', 'SecondNavigation' => 'Second navigation', 'LocaleNavigation' => 'Localization navigation', 'LoginLinks' => 'Login links', 'Breadcrumb' => 'Breadcrumb trail', 'SiteMap' => 'Site map', 'ContactForm' => 'Contact form', 'LoginForm' => 'Login form', 'RegisterForm' => 'Register form', 'Code' => 'Code block', 'XmlFeed' => 'Xml feed', 'Date' => 'Date', 'PoweredByPlopCMS' => 'Powered by Plop CMS', 'ThemeSwitcher' => 'Theme switcher', 'DistantGallery' => 'Distant gallery'), 'sf_plop_loaded_modules' => array('sf_plop_cms' => array('name' => 'Contents', 'route' => '@sf_plop_homepage', 'culture' => 'default'), 'sf_plop_dashboard' => array('name' => 'Dashboard', 'route' => '@sf_plop_dashboard')), 'sf_plop_loaded_links' => array('sf_plop_homepage' => array('name' => 'Homepage', 'route' => '@sf_plop_homepage', 'culture' => 'default')), 'sf_plop_cache_lifetime' => 86400, 'sf_plop_uncached_slots' => array('Date', 'ContactForm', 'LoginForm', 'RegisterForm'), 'sf_plop_richtext_editors' => array('aloha-editor'), 'sf_plop_richtext_editor' => 'aloha-editor', 'sf_plop_richtext_editor_aloha-editor_bridge' => '/sfPlopPlugin/js/admin.aloha.js', 'sf_plop_richtext_editor_aloha-editor_css' => '/sfPlopPlugin/vendor/aloha-editor/src/css/aloha.css', 'sf_plop_richtext_editor_aloha-editor_script' => array('src' => '/sfPlopPlugin/vendor/aloha-editor/src/lib/aloha.js', 'data-aloha-plugins' => 'common/format,common/table,common/list,common/link,common/undo,common/paste,common/contenthandler,common/characterpicker,common/image,common/align,plopcms/plopcms,aloha-editor-extra-plugins/hr/hr')));
     // Enabled slots and modules for sfPlopCMS
     sfConfig::add(array('sf_plop_enabled_slots' => array('RichText', 'Text', 'PageTitle', 'Area', 'PageHeader', 'PageFooter', 'MainNavigation', 'SecondNavigation', 'LocaleNavigation', 'LoginLinks', 'Breadcrumb', 'SiteMap', 'ContactForm', 'LoginForm', 'RegisterForm', 'Code', 'Date', 'XmlFeed', 'ThemeSwitcher', 'PoweredByPlopCMS', 'DistantGallery', 'Asset', 'AssetGallery', 'CustomGalleryAsset', 'AssetGalleryNavigation', 'GoogleMaps', 'GoogleMapsFilter', 'GoogleMapsPosition'), 'sf_plop_enabled_modules' => array('sf_plop_cms', 'sf_plop_dashboard', 'sfAssetLibrary', 'sfAssetGallery'), 'sf_plop_enabled_links' => array('sf_plop_homepage')));
     // Configuration for sfPlopDashoard
     sfConfig::add(array('sf_plop_dashboard_show_welcome_message' => true, 'sf_plop_dashboard_show_browser_recommandations' => true, 'sf_plop_dashboard_show_news' => false, 'sf_plop_dashboard_show_stats' => false));
     // Configuration for sfPlopDashoard / non-overridable settings
     sfConfig::add(array('sf_plop_dashboard_settings_tabs' => array('seo' => 'SEO', 'pluginModules' => 'Modules manager', 'pluginSlots' => 'Content blocks manager', 'statistics' => 'Statistics', 'culture' => 'Content languages', 'messaging' => 'Messaging', 'appearance' => 'Appearance', 'access' => 'Public access')));
     // Configuration for sfPlopMessaging
     sfConfig::add(array('sf_plop_messaging_from_email' => '*****@*****.**', 'sf_plop_messaging_from_name' => 'Anon YMOUS', 'sf_plop_messaging_to_email' => '*****@*****.**', 'sf_plop_messaging_to_name' => 'Anon YMOUS', 'sf_plop_messaging_subject' => 'Your plop website has a message for you', 'sf_plop_messaging_message' => 'Message from your plop website'));
     // Load dynamic config
     sfPlop::check();
     sfPlop::loadPlugin(array('slots' => sfPlop::get('sf_plop_loaded_slots', true), 'modules' => sfPlop::get('sf_plop_loaded_modules', true), 'themes' => sfPlop::get('sf_plop_loaded_themes', true), 'links' => sfPlop::get('sf_plop_loaded_links', true)));
     // CSS values
     sfConfig::add(array('sf_plop_css_background-repeat' => array('no-repeat' => 'No repetition', 'repeat' => 'Repetition', 'repeat-x' => 'Horizontal repetition', 'repeat-y' => 'Vertical repetition'), 'sf_plop_css_background-position-x' => array('left' => 'Left', 'center' => 'Center', 'right' => 'Right'), 'sf_plop_css_background-position-y' => array('top' => 'Top', 'center' => 'Middle', 'bottom' => 'Bottom'), 'sf_plop_css_border-style' => array('solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted'), 'sf_plop_css_font-family' => array('Arial, Helvetica, sans-serif' => 'Arial, Helvetica, sans-serif', 'Verdana, Arial, Helvetica, sans-serif' => 'Verdana, Arial, Helvetica, sans-serif', 'Georgia, "Times New Roman", Times, serif' => 'Georgia, "Times New Roman", Times, serif', '"Times New Roman", Times, serif' => '"Times New Roman", Times, serif', '"Courier New", Courier, mono' => '"Courier New", Courier, mono'), 'sf_plop_css_font-size' => array('.75em' => '1 (75%)', '1em' => '2 (100%)', '1.2em' => '3 (120%)', '1.4em' => '4 (140%)', '1.6em' => '5 (160%)'), 'sf_plop_css_border-width' => array('0px' => '0px', '1px' => '1px', '2px' => '2px', '3px' => '3px', '4px' => '4px', '5px' => '5px', '6px' => '6px', '7px' => '7px', '8px' => '8px', '9px' => '9px', '10px' => '10px'), 'sf_plop_css_website-width' => array('100%' => 'Fluid layout (100%)', '1000px' => 'Screen resolution of 1280x1024 (1000px)', '960px' => 'Screen resolution of 1024x768 (960px)', '750px' => 'Screen resolution of 800x600 (750px)', '320px' => 'Mobile (320px)')));
 }
Ejemplo n.º 30
0
 public function configure()
 {
     parent::configure();
     unset($this['is_published'], $this['is_editable'], $this['sortable_rank'], $this['created_at'], $this['updated_at']);
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('plopAdmin');
     $this->widgetSchema['page_id'] = new sfWidgetFormInputHidden();
     if ($this->getOption('page_id')) {
         $this->widgetSchema['page_id']->setDefault($this->getOption('page_id'));
     }
     $this->widgetSchema['layout'] = new sfWidgetFormChoice(array('choices' => sfPlop::get('sf_plop_slot_layouts')));
     $this->validatorSchema['layout'] = new sfValidatorChoice(array('choices' => array_keys(sfPlop::get('sf_plop_slot_layouts')), 'required' => false));
     $templates = sfPlop::getSafePluginSlots();
     if ($this->getOption('unset_area') === true && isset($templates['Area'])) {
         unset($templates['Area']);
     }
     $this->widgetSchema['template'] = new sfWidgetFormChoice(array('choices' => $templates));
     $this->validatorSchema['template'] = new sfValidatorChoice(array('choices' => array_keys($templates), 'required' => false));
     // post validator for template which can't be area if the page or the template page has already one
     // remove  Area when page contains already one
 }