public function init() { parent::init(); Requirements::themedCSS('reset'); Requirements::themedCSS('layout'); Requirements::themedCSS('form'); Requirements::themedCSS('typography'); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::css('mysite/css/demo.css'); Requirements::css('mysite/css/moduleSupport.css'); Requirements::customScript(<<<JS (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-84547-17', 'auto', { 'allowLinker': true }); ga('require', 'linker'); ga('linker:autoLink', [ \t'www.silverstripe.com', \t'www.silverstripe.org', \t'addons.silverstripe.org', \t'api.silverstripe.org', \t'docs.silverstripe.org', \t'userhelp.silverstripe.org', \t'demo.silverstripe.org' ]); ga('send', 'pageview'); JS ); }
/** * Standard SS method. * Runs after the Page::init method is called. */ function onAfterInit() { Requirements::javascript(EcommerceConfig::get("EcommerceConfigAjax", "cart_js_file_location")); Requirements::javascript(EcommerceConfig::get("EcommerceConfigAjax", "dialogue_js_file_location")); Requirements::themedCSS("Cart"); Requirements::themedCSS("jquery.colorbox"); }
function init() { parent::init(); Requirements::themedCSS("YouTubeGalleryHolderPage"); Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js"); Requirements::javascript("youtubegallery/javascript/YouTubeGalleryHolderPage.js"); }
public function init() { parent::init(); // Note: you should use SS template require tags inside your templates // instead of putting Requirements calls here. However these are // included so that our older themes still work Requirements::themedCSS('layout'); Requirements::themedCSS('comments'); Requirements::themedCSS('typography'); Requirements::themedCSS('form'); Requirements::themedCSS('slick'); if (!Cookie::get($StoryModeCookie)) { Cookie::set($StoryModeCookie, 'Normal'); } if (!Cookie::get($StorySizeCookie)) { Cookie::set($StorySizeCookie, 'Normal'); } // Increment page view counter $pagecounter = DataObject::get_one("PageCounter", "PageID='{$this->ID}'"); if (!$pagecounter) { $pagecounter = new PageCounter(); $pagecounter->PageID = $this->ID; } $pagecounter->Counter = $pagecounter->Counter + 1; $pagecounter->write(); }
public function init() { parent::init(); Requirements::clear(); Requirements::insertHeadTags('<meta http-equiv="Content-language" content="' . i18n::get_locale() . '" />'); Requirements::themedCSS('sendfriend', 'screen'); }
public function init() { parent::init(); Requirements::themedCSS('reset'); Requirements::themedCSS('layout'); Requirements::themedCSS('form'); Requirements::themedCSS('typography'); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::css('mysite/css/demo.css'); Requirements::css('mysite/css/moduleSupport.css'); Requirements::customScript(<<<JS var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-84547-11']); _gaq.push(['_setDomainName', 'none']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); JS ); }
public function onAfterInit() { $cssTemplate = Object::get_static('GalleristPageDecorator', 'css_template'); if ((bool)$cssTemplate && $this->owner->hasMethod('data')) { Requirements::customCSS($this->owner->data()->renderWith($cssTemplate)); } Requirements::themedCSS('gallerist'); }
/** * Return an absolute URL based on the BlogHolder * that this widget is located on. * * @return string */ function RSSLink() { Requirements::themedCSS('subscribersswidget'); $blogHolder = $this->getBlogHolder(); if($blogHolder) { return $blogHolder->Link() . 'rss'; } }
function init() { parent::init(); Requirements::themedCSS("layout"); Requirements::themedCSS("typography"); Requirements::themedCSS("form"); }
function Field($properties = array()) { Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-form/jquery.form.js'); Requirements::javascript('pagerater/javascript/jquery.rating.pack.js'); Requirements::javascript('pagerater/javascript/PageRater.js'); if ($this->Config()->get("extra_form_selector")) { Requirements::customScript("PageRater.set_extra_form_selector('" . $this->Config()->get("extra_form_selector") . "');"); } Requirements::themedCSS('jquery.rating', "pagerater"); $html = ""; $name = $this->getName(); $id = $this->id(); for ($i = 1; $i < $this->starOptions + 1; $i++) { if ($i == $this->Value()) { $html .= "<input name='{$id}' class='{$id}' type='radio' checked='checked' value='{$i}' />"; } else { $html .= "<input name='{$id}' class='{$id}' type='radio' value='{$i}' />"; } } $html .= "<input name='{$name}' type='hidden' id='{$id}' />"; Requirements::customScript(<<<JS \t\t\tjQuery('.{$id}').rating({ \t\t\t\trequired: true, \t\t\t\tcallback: function(value, link) { \t\t\t\t\tjQuery('#{$id}').val(value); \t\t\t\t} \t\t\t}); JS ); return $html; }
function Dates() { Requirements::themedCSS('archivewidget'); $results = new DataObjectSet(); $container = BlogTree::current(); $ids = $container->BlogHolderIDs(); $stage = Versioned::current_stage(); $suffix = !$stage || $stage == 'Stage' ? "" : "_{$stage}"; $monthclause = method_exists(DB::getConn(), 'formattedDatetimeClause') ? DB::getConn()->formattedDatetimeClause('"Date"', '%m') : 'MONTH("Date")'; $yearclause = method_exists(DB::getConn(), 'formattedDatetimeClause') ? DB::getConn()->formattedDatetimeClause('"Date"', '%Y') : 'YEAR("Date")'; $sqlResults = DB::query("\n\t\t\tSELECT DISTINCT CAST({$monthclause} AS " . DB::getConn()->dbDataType('unsigned integer') . ") AS \"Month\", {$yearclause} AS \"Year\"\n\t\t\tFROM \"SiteTree{$suffix}\" INNER JOIN \"BlogEntry{$suffix}\" ON \"SiteTree{$suffix}\".\"ID\" = \"BlogEntry{$suffix}\".\"ID\"\n\t\t\tWHERE \"ParentID\" IN (" . implode(', ', $ids) . ")\n\t\t\tORDER BY \"Year\" DESC, \"Month\" DESC;"); if ($this->ShowLastYears == 0) { $cutOffYear = 0; } else { $cutOffYear = (int) date("Y") - $this->ShowLastYears; } $years = array(); if (Director::get_current_page()->ClassName == 'BlogHolder') { $urlParams = Director::urlParams(); $yearParam = $urlParams['ID']; $monthParam = $urlParams['OtherID']; } else { $date = new DateTime(Director::get_current_page()->Date); $yearParam = $date->format("Y"); $monthParam = $date->format("m"); } if ($sqlResults) { foreach ($sqlResults as $sqlResult) { $isMonthDisplay = true; $year = $sqlResult['Year'] ? (int) $sqlResult['Year'] : date('Y'); $isMonthDisplay = $year > $cutOffYear; // $dateFormat = 'Month'; else $dateFormat = 'Year'; $monthVal = isset($sqlResult['Month']) ? (int) $sqlResult['Month'] : 1; $month = $isMonthDisplay ? $monthVal : 1; $date = DBField::create('Date', array('Day' => 1, 'Month' => $month, 'Year' => $year)); if ($isMonthDisplay) { $link = $container->Link('date') . '/' . $sqlResult['Year'] . '/' . sprintf("%'02d", $monthVal); } else { $link = $container->Link('date') . '/' . $sqlResult['Year']; } if ($isMonthDisplay || !$isMonthDisplay && !in_array($year, $years)) { $years[] = $year; $current = false; $children = new DataObjectSet(); $LinkingMode = "link"; if ($isMonthDisplay && $yearParam == $year && $monthParam == $month || !$isMonthDisplay && $yearParam == $year) { $LinkingMode = "current"; $current = true; if ($this->ShowChildren && $isMonthDisplay) { $filter = $yearclause . ' = ' . $year . ' AND ' . $monthclause . ' = ' . $month; $children = DataObject::get('BlogEntry', $filter, "Date DESC"); } } $results->push(new ArrayData(array('Date' => $date, 'Year' => $year, 'Link' => $link, 'NoMonth' => !$isMonthDisplay, 'LinkingMode' => $LinkingMode, 'Children' => $children))); unset($children); } } } return $results; }
function init() { parent::init(); Requirements::themedCSS('editor'); Requirements::javascript('mysite/js/signup-now.js'); SSViewer::setOption('rewriteHashlinks', false); }
function Dates() { Requirements::themedCSS('archivewidget'); $results = new DataObjectSet(); $container = BlogTree::current(); $ids = $container->BlogHolderIDs(); $stage = Versioned::current_stage(); $suffix = !$stage || $stage == 'Stage' ? "" : "_{$stage}"; $monthclause = method_exists(DB::getConn(), 'formattedDatetimeClause') ? DB::getConn()->formattedDatetimeClause('"Date"', '%m') : 'MONTH("Date")'; $yearclause = method_exists(DB::getConn(), 'formattedDatetimeClause') ? DB::getConn()->formattedDatetimeClause('"Date"', '%Y') : 'YEAR("Date")'; if ($this->DisplayMode == 'month') { $sqlResults = DB::query("\n\t\t\t\tSELECT DISTINCT CAST({$monthclause} AS " . DB::getConn()->dbDataType('unsigned integer') . ") AS \"Month\", {$yearclause} AS \"Year\"\n\t\t\t\tFROM \"SiteTree{$suffix}\" INNER JOIN \"BlogEntry{$suffix}\" ON \"SiteTree{$suffix}\".\"ID\" = \"BlogEntry{$suffix}\".\"ID\"\n\t\t\t\tWHERE \"ParentID\" IN (" . implode(', ', $ids) . ")\n\t\t\t\tORDER BY \"Year\" DESC, \"Month\" DESC;"); } else { $sqlResults = DB::query("\n\t\t\t\tSELECT DISTINCT {$yearclause} AS \"Year\" \n\t\t\t\tFROM \"SiteTree{$suffix}\" INNER JOIN \"BlogEntry{$suffix}\" ON \"SiteTree{$suffix}\".\"ID\" = \"BlogEntry{$suffix}\".\"ID\"\n\t\t\t\tWHERE \"ParentID\" IN (" . implode(', ', $ids) . ")\n\t\t\t\tORDER BY \"Year\" DESC"); } if ($sqlResults) { foreach ($sqlResults as $sqlResult) { $isMonthDisplay = $this->DisplayMode == 'month'; $monthVal = isset($sqlResult['Month']) ? (int) $sqlResult['Month'] : 1; $month = $isMonthDisplay ? $monthVal : 1; $year = $sqlResult['Year'] ? (int) $sqlResult['Year'] : date('Y'); $date = DBField::create('Date', array('Day' => 1, 'Month' => $month, 'Year' => $year)); if ($isMonthDisplay) { $link = $container->Link('date') . '/' . $sqlResult['Year'] . '/' . sprintf("%'02d", $monthVal); } else { $link = $container->Link('date') . '/' . $sqlResult['Year']; } $results->push(new ArrayData(array('Date' => $date, 'Link' => $link))); } } return $results; }
/** * Constructor * * @param Controller $controller The parent controller, necessary to * create the appropriate form action tag. * @param string $name The method on the controller that will return this * form object. * @param FieldSet|FormField $fields All of the fields in the form - a * {@link FieldSet} of {@link FormField} * objects. * @param FieldSet|FormAction $actions All of the action buttons in the * form - a {@link FieldSet} of * {@link FormAction} objects * @param bool $checkCurrentUser If set to TRUE, it will be checked if a * the user is currently logged in, and if * so, only a logout button will be rendered */ function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true) { $this->authenticator_class = 'OpenIDAuthenticator'; Requirements::themedCSS('openid_login'); if (isset($_REQUEST['BackURL'])) { $backURL = $_REQUEST['BackURL']; } else { $backURL = Session::get('BackURL'); } if ($checkCurrentUser && Member::currentUserID()) { $fields = new FieldSet(); $actions = new FieldSet(new FormAction("logout", _t('Member.BUTTONLOGINOTHER'))); } else { if (!$fields) { $fields = new FieldSet(new LiteralField("OpenIDDescription", _t('OpenIDLoginForm.DESC', '<div id="OpenIDDescription"><p>OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account. For more information visit <a href="http://openid.net">openid.net</a>.</p></div> ')), new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this), new TextField("OpenIDURL", _t('OpenIDLoginForm.URL', "OpenID URL"), Session::get('SessionForms.OpenIDLoginForm.OpenIDURL'), null, $this), new CheckboxField("Remember", _t('Member.REMEMBERME'), Session::get('SessionForms.OpenIDLoginForm.Remember'), $this)); } if (!$actions) { $actions = new FieldSet(new FormAction("dologin", _t('Member.BUTTONLOGIN'))); } } if (isset($backURL)) { $fields->push(new HiddenField('BackURL', 'BackURL', $backURL)); } parent::__construct($controller, $name, $fields, $actions); }
function contentcontrollerInit() { Requirements::themedCSS("colorbox"); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript("colorbox/javascript/jquery.colorbox-min.js"); Requirements::javascript("colorbox/javascript/colorbox.js"); }
public function onAfterInit() { Requirements::themedCSS('swipestreak'); Requirements::javascript('framework/thirdparty/jquery/jquery.min.js'); Requirements::javascript('framework/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js'); Requirements::javascript('swipestreak/js/swipestreak.js'); }
function init() { parent::init(); Requirements::themedCSS('ElectricVehicleCalculator', 'electric-vehicle-calculator'); Requirements::javascript("framework/thirdparty/jquery/jquery.js"); Requirements::javascript("electric-vehicle-calculator/thirdparty/chartjs/Chart.min.js"); }
/** *NOTE: we semi-enforce using the OrderModifier_Controller here to deal with the submission of the OrderModifierForm * You can use your own modifiers or an extension of OrderModifier_Controller by setting the first parameter (optionalController) * to your own controller. * *@param $optionalController Controller *@param $name String *@param $fields FieldList *@param $actions FieldList *@param $validator SS_Validator **/ function __construct(Controller $optionalController = null, $name, FieldList $fields, FieldList $actions, Validator $optionalValidator = null) { if (!$optionalController) { $controllerClassName = EcommerceConfig::get("OrderModifierForm", "controller_class"); $optionalController = new $controllerClassName(); } if (!$optionalValidator) { $validatorClassName = EcommerceConfig::get("OrderModifierForm", "validator_class"); $optionalValidator = new $validatorClassName(); } parent::__construct($optionalController, $name, $fields, $actions, $optionalValidator); //extension point $this->extend('updateFields', $fields); $this->setFields($fields); $this->extend('updateActions', $actions); $this->setActions($actions); $this->extend('updateValidator', $optionalValidator); $this->setValidator($optionalValidator); $this->setAttribute("autocomplete", "off"); Requirements::themedCSS($this->ClassName, 'ecommerce'); $this->addExtraClass($this->myLcFirst(ucwords($name))); Requirements::javascript(THIRDPARTY_DIR . "/jquery-form/jquery.form.js"); //add JS for the modifier - added in modifier $oldData = Session::get("FormInfo.{$this->FormName()}.data"); if ($oldData && (is_array($oldData) || is_object($oldData))) { $this->loadDataFrom($oldData); } $this->extend('updateOrderModifierForm', $this); }
public function init() { parent::init(); Requirements::themedCSS('AdvancedReportsAdmin'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js'); Requirements::javascript('advancedreports/javascript/advancedreports.js'); }
/** * Initialise the controller */ function init() { Requirements::themedCSS('Forum'); $member = $this->Member() ? $this->Member() : null; $nicknameText = $member ? $member->Nickname . '\'s ' : ''; $this->Title = DBField::create('HTMLText', Convert::raw2xml($nicknameText) . _t('ForumMemberProfile.USERPROFILE', 'User Profile')); parent::init(); }
function SocialNetworks() { Requirements::themedCSS('SocialNetworking', "sharethis"); if (Config::inst()->get("SocialNetworksSTE", "use_font_awesome")) { Requirements::css("http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"); } return SocialNetworkingLinksDataObject::get(); }
function AbsoluteLink($IDString = "FlowPlayer") { Requirements::javascript("flowplayer/thirdparty/flowplayer-3.2.4.min.js"); Requirements::javascript(self::get_flow_player_config_file()); Requirements::customScript('$f("' . $IDString . '", "' . self::get_swf_file() . '", FlowPlayerConfig);', "FlowPlayerSWF"); Requirements::themedCSS("FlowPlayer"); return $this->getAbsoluteURL(); }
function RandomDidYouKnowItem() { Requirements::themedCSS("widgets_didyouknow"); $do = DataObject::get_one("DidYouKnow_Statement", null, $cache = true, "RAND() DESC"); if ($do) { return $do->Content; } }
public function init() { parent::init(); // Note: you should use SS template require tags inside your templates // instead of putting Requirements calls here. However these are // included so that our older themes still work Requirements::themedCSS("form"); }
public function init() { parent::init(); Requirements::themedCSS("site"); $this->disqus = file_get_contents(BASE_PATH . DIRECTORY_SEPARATOR . 'extensionmanager/thirdparty/disqus.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript('themes/AddOns-Theme/bootstrap/js/bootstrap-tab.js'); }
/** * Return an absolute URL based on the BlogHolder * that this widget is located on. * * @return string */ function RSSLink() { Requirements::themedCSS('subscribersswidget'); $container = BlogTree::current(); if ($container) { return $container->Link() . 'rss'; } }
function init() { parent::init(); Requirements::themedCSS('ElectricVehicleCalculatorSelectPage', 'electric-vehicle-calculator'); Requirements::javascript("framework/thirdparty/jquery/jquery.js"); Requirements::javascript('electric-vehicle-calculator/javascript/EVCSelectPage.js'); Requirements::customScript("EVCSelectPage.baseLink = '" . $this->AbsoluteLink() . "';", "EVCSelectPageBasics"); }
function init() { parent::init(); Requirements::themedCSS('jquery-filestyle.min'); Requirements::javascript('mysite/js/jquery-filestyle.min.js'); Requirements::javascript('mysite/js/create-heatmap.js'); SSViewer::setOption('rewriteHashlinks', false); }
function TagsCollection() { Requirements::themedCSS("tagcloud"); $allTags = array(); $max = 0; $container = BlogTree::current(); $entries = $container->Entries(); if ($entries) { foreach ($entries as $entry) { $theseTags = split(" *, *", mb_strtolower(trim($entry->Tags))); foreach ($theseTags as $tag) { if ($tag != "") { $allTags[$tag] = isset($allTags[$tag]) ? $allTags[$tag] + 1 : 1; //getting the count into key => value map $max = $allTags[$tag] > $max ? $allTags[$tag] : $max; } } } if ($allTags) { //TODO: move some or all of the sorts to the database for more efficiency if ($this->Limit > 0) { $allTags = array_slice($allTags, 0, $this->Limit, true); } if ($this->Sortby == "alphabet") { $this->natksort($allTags); } else { uasort($allTags, array($this, "column_sort_by_popularity")); // sort by frequency } $sizes = array(); foreach ($allTags as $tag => $count) { $sizes[$count] = true; } $offset = 0; $numsizes = count($sizes) - 1; //Work out the number of different sizes $buckets = count(self::$popularities) - 1; // If there are more frequencies than buckets, divide frequencies into buckets if ($numsizes > $buckets) { $numsizes = $buckets; } else { $offset = round(($buckets - $numsizes) / 2); } foreach ($allTags as $tag => $count) { $popularity = round($count / $max * $numsizes) + $offset; $popularity = min($buckets, $popularity); $class = self::$popularities[$popularity]; $allTags[$tag] = array("Tag" => $tag, "Count" => $count, "Class" => $class, "Link" => $container->Link('tag') . '/' . urlencode($tag)); } } $output = new DataObjectSet(); foreach ($allTags as $tag => $fields) { $output->push(new ArrayData($fields)); } return $output; } return; }
public function init() { // include extra js requirements for this page Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(ECOMMERCE_DIR . '/javascript/CheckoutPage.js'); // include stylesheet for the checkout page Requirements::themedCSS('CheckoutPage'); parent::init(); }