Skip to content

Instantly share code, notes, and snippets.

@NARKOZ
Created September 2, 2010 15:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NARKOZ/562405 to your computer and use it in GitHub Desktop.
Save NARKOZ/562405 to your computer and use it in GitHub Desktop.
<?php
/**********************
*
* Errors / Dev
*
**********************/
//
//Force enviroment to Dev ** REMOVE FOR LIVE SITES **
Director::set_environment_type("dev");
//
//Force cache to flush on page load if in Dev mode (prevents needing ?flush=1 on the end of a URL)
if (Director::isDev()) {
SSViewer::flush_template_cache();
}
//(v2.4) Log errors to an email address
SS_Log::add_writer(new SS_LogEmailWriter('me@mydomain.com'), SS_Log::ERR);
//
//(v2.4) Log errors to a file
SS_Log::add_writer(new SS_LogFileWriter('error_log.txt'), SS_Log::ERR);
//
/**********************
*
* CMS Rebranding
*
**********************/
//
//Set the CMS application name, logo and loading image
LeftAndMain::setApplicationName("My application");
LeftAndMain::setLogo("themes/MyTheme/images/CMSLogo.png", "margin-top: -3px;");
LeftAndMain::set_loading_image('themes/MyTheme/images/CMSLoading.gif');
//
/**********************
*
* Security
*
**********************/
//
//Set default login
Security::setDefaultAdmin('admin','pass');
//
//Define the password validator
$pwdValidator = new PasswordValidator();
$pwdValidator->minLength(8);
$pwdValidator->checkHistoricalPasswords(2);
$pwdValidator->characterStrength(2,array('lowercase','digits'));
Member::set_password_validator($pwdValidator);
//
// Set the site locale
i18n::set_locale('en_UK');
//
/**********************
*
* Templates / ULRs
*
**********************/
//
//Remove Prototype / Behaviour validation and use your own
Validator::set_javascript_validation_handler('none');
//
// Set the theme
SSViewer::set_theme('FBO');
//Enable Search, use $SearchForm in template
FulltextSearchable::enable();
//
//Turn off # link rewriting
SSViewer::setOption('rewriteHashlinks', false);
//
//Force redirect to www.
Director::forceWWW();
//
//(v2.4) enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();
//
// Set the Breadcrumb divider
SiteTree::$breadcrumbs_delimiter = " >> ";
//
// Set the resizing image quality
GD::set_default_quality(95);
//
/**********************
*
* CMS UI
*
**********************/
//
//Hide a main CMS Tab
LeftAndMain::remove_menu_item('Reports');
//
//Make a data objects sortable (for DOM)
SortableDataObject::add_sortable_classes(array(
'DataObject',
'AnotherDataObject'
));
//
//Set HTML EDitor Config
HtmlEditorConfig::get('cms')->setOption('convert_fonts_to_spans', false);
//
HtmlEditorConfig::get('cms')->enablePlugins('searchreplace');
//
HtmlEditorConfig::get('cms')->insertButtonsAfter('pasteword', 'replace');
//
HtmlEditorConfig::get('cms')->setOptions(array( 'content_css' => 'static/css/editor.css' ));
//
//Add requirments to the CMS
LeftAndMain::require_javascript('mysite/javascript/jquery.cms.js');
//
LeftAndMain::require_css('themes/mytheme/css/cms.css');
//
/**********************
*
* Classes / Objects
*
**********************/
//
//Add an extention to an object and DataObject
Object::add_extension('SiteConfig', 'CustomSiteConfig');
DataObject::add_extension('DataObject', 'DataObjectExtension');
//
// Use a custom class instead of a core one
Object::useCustomClass('MemberLoginForm', 'CustomLoginForm');
//
//Set allowed file types
File::$allowed_extensions[] = "f4v";
//
/**********************
*
* Emails
*
**********************/
//
//Set the admin email address
Email::setAdminEmail('me@mydomain.com');
//
//Set to CC all emails to
Email::cc_all_emails_to('me@mydomain.com');
//
/**********************
*
* Comments
*
**********************/
//
//Enable comment spam protection
MathSpamProtection::setEnabled();
//
//Enable comment moderation
PageComment::enableModeration();
//
//Force user to be logged in to post a comment
PageCommentInterface::set_comments_require_login(true);
/**
*
*/
// Enable template paths to be included in the output
SSViewer::set_source_file_comments(true);
// multilingual content and i18n
Translatable::set_allowed_locales(array('ru_RU', 'az_AZ', 'en_US'));
i18n::$common_locales['az_AZ'] = 'Azeri';
Translatable::set_default_locale('ru_RU');
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable'); // 2.4 or newer only
RedirectorPage::$icon = array('mysite/images/icons/redirector',"file");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment