Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted to PSR-2 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions code/SocialPageControllerExtension.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?php

class SocialPageControllerExtension extends DataExtension {

public function googlePlusJS() {
Requirements::customScript("
class SocialPageControllerExtension extends DataExtension
{

public function googlePlusJS()
{
Requirements::customScript("
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
");
}

}
}
}
76 changes: 39 additions & 37 deletions code/SocialSiteConfig.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
<?php

class SocialSiteConfig extends DataExtension {

private static $db = array(
"Publisher" => "Varchar(127)",
"gPlusURL" => "Varchar(127)",
"gPlusButton" => "HTMLVarchar(127)",
"useOpenGraph" => "Boolean",
"ogSiteName" => "Varchar(64)",
"fbAppID" => "Varchar(32)",
"fbAdmins" => "Varchar(127)",
"fbURL" => "Varchar(127)",
"twitterURL" => "Varchar(127)",
"vimeoURL" => "Varchar(127)",
"youtubeURL" => "Varchar(127)",
"linkedInURL" => "Varchar(127)"
);

private static $has_one = array(
"ogImage" => "Image"
);

public function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab("Root.Social", TextField::create("Publisher", "Publisher (g+)"));
$fields->addFieldToTab("Root.Social", TextField::create("gPlusURL", "Adresa pre Google Plus"));
$fields->addFieldToTab("Root.Social", TextField::create("gPlusButton", "Google Plus Button")->setDescription("Aby sa button začal zobrazovať, treba uviesť atribúty g+ buttonu, t.j. minimálne veľkosť buttonu v tvare: <strong>data-size=\"tall\"</strong> (small|medium|standard|tall), viac info <a href='https://developers.google.com/+/web/+1button/#tag_parameters' target='_blank'>v g+ dokumentácii</a>.<br>Šablóna musí podporovať vloženie g+ buttonu!"));
$fields->addFieldToTab("Root.Social", CheckboxField::create("useOpenGraph", "Pridať Open Graph do hlavičky?"));
$fields->addFieldToTab("Root.Social", TextField::create("ogSiteName", "Open Graph - Názov stránky")->setDescription("Ak nezadáte, zobrazí sa Titulok webu, t.j. <strong>".$this->owner->Title."</strong>"));
$fields->addFieldToTab("Root.Social", UploadField::create("ogImage", "Open Graph obrázok"));
$fields->addFieldToTab("Root.Social", TextField::create("fbAppID", "Facebook App ID")->setDescription("If set, Facebook admin field bellow will be ignored"));
$fields->addFieldToTab("Root.Social", TextField::create("fbAdmins", "Facebook admin")->setDescription("Bez zadania Facebook ID sa nevytvorí prepojenie Web &#8596; Facebook. Facebook ID zistíte napr. tu: <a href='http://findmyfacebookid.com/' target='_blank'>findmyfacebookid.com</a>"));
$fields->addFieldToTab("Root.Social", TextField::create("fbURL", "Adresa pre Facebook"));
$fields->addFieldToTab("Root.Social", TextField::create("twitterURL", "Adresa pre Twitter"));
$fields->addFieldToTab("Root.Social", TextField::create("vimeoURL", "Adresa pre Vimeo"));
$fields->addFieldToTab("Root.Social", TextField::create("youtubeURL", "Adresa pre YouTube"));
$fields->addFieldToTab("Root.Social", TextField::create("linkedInURL", "Adresa pre LinkedIn"));

class SocialSiteConfig extends DataExtension
{

private static $db = array(
"Publisher" => "Varchar(127)",
"gPlusURL" => "Varchar(127)",
"gPlusButton" => "HTMLVarchar(127)",
"useOpenGraph" => "Boolean",
"ogSiteName" => "Varchar(64)",
"fbAppID" => "Varchar(32)",
"fbAdmins" => "Varchar(127)",
"fbURL" => "Varchar(127)",
"twitterURL" => "Varchar(127)",
"vimeoURL" => "Varchar(127)",
"youtubeURL" => "Varchar(127)",
"linkedInURL" => "Varchar(127)"
);

private static $has_one = array(
"ogImage" => "Image"
);

public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab("Root.Social", TextField::create("Publisher", "Publisher (g+)"));
$fields->addFieldToTab("Root.Social", TextField::create("gPlusURL", "Adresa pre Google Plus"));
$fields->addFieldToTab("Root.Social", TextField::create("gPlusButton", "Google Plus Button")->setDescription("Aby sa button začal zobrazovať, treba uviesť atribúty g+ buttonu, t.j. minimálne veľkosť buttonu v tvare: <strong>data-size=\"tall\"</strong> (small|medium|standard|tall), viac info <a href='https://developers.google.com/+/web/+1button/#tag_parameters' target='_blank'>v g+ dokumentácii</a>.<br>Šablóna musí podporovať vloženie g+ buttonu!"));
$fields->addFieldToTab("Root.Social", CheckboxField::create("useOpenGraph", "Pridať Open Graph do hlavičky?"));
$fields->addFieldToTab("Root.Social", TextField::create("ogSiteName", "Open Graph - Názov stránky")->setDescription("Ak nezadáte, zobrazí sa Titulok webu, t.j. <strong>".$this->owner->Title."</strong>"));
$fields->addFieldToTab("Root.Social", UploadField::create("ogImage", "Open Graph obrázok"));
$fields->addFieldToTab("Root.Social", TextField::create("fbAppID", "Facebook App ID")->setDescription("If set, Facebook admin field bellow will be ignored"));
$fields->addFieldToTab("Root.Social", TextField::create("fbAdmins", "Facebook admin")->setDescription("Bez zadania Facebook ID sa nevytvorí prepojenie Web &#8596; Facebook. Facebook ID zistíte napr. tu: <a href='http://findmyfacebookid.com/' target='_blank'>findmyfacebookid.com</a>"));
$fields->addFieldToTab("Root.Social", TextField::create("fbURL", "Adresa pre Facebook"));
$fields->addFieldToTab("Root.Social", TextField::create("twitterURL", "Adresa pre Twitter"));
$fields->addFieldToTab("Root.Social", TextField::create("vimeoURL", "Adresa pre Vimeo"));
$fields->addFieldToTab("Root.Social", TextField::create("youtubeURL", "Adresa pre YouTube"));
$fields->addFieldToTab("Root.Social", TextField::create("linkedInURL", "Adresa pre LinkedIn"));
}

}

// EOF