public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeFieldFromTab("Root", "Content");
     $fields->addFieldToTab("Root.Main", new TextField("BlogURL", "Blog URL Segment (eg. 'blog', 'news', etc.)"));
     if ($this->BlogURL) {
         $fields->addFieldToTab("Root.WordpressLogin", new LiteralField("Desc1", "<div id='wp-login'><h1>WordPress</h1><a href='" . Director::AbsoluteBaseURL() . $this->BlogURL . "/wp-login.php' target='_blank'>Login</a></div>"));
     }
     return $fields;
 }
 private function _errorCheck($tweets)
 {
     if (array_key_exists('errors', $tweets)) {
         $message = 'We have encountered ' . count($tweets['errors']) . ' error(s): <br />';
         foreach ($tweets['errors'] as $error) {
             $message .= $error['message'] . ' Code:' . $error['code'] . '<br />';
         }
         if (Director::isDev()) {
             throw new Exception($message, 1);
         } else {
             if (Email::getAdminEmail()) {
                 $from = Email::getAdminEmail();
                 $to = Email::getAdminEmail();
                 $subject = "Twitter Feed Failure - " . Director::AbsoluteBaseURL();
                 $body = $message;
                 $body .= "<br /><br />Reported by " . Director::AbsoluteBaseURL();
                 $email = new Email($from, $to, $subject, $body);
                 $email->send();
             }
         }
         return true;
     }
 }
Ejemplo n.º 3
0
 /**
  * Initialise config
  *
  * @since version 1.0.0
  *
  * @return void
  **/
 public function __construct()
 {
     $this->objects = Config::inst()->get('SEO_Sitemap', 'objects');
     $this->url = substr(Director::AbsoluteBaseURL(), 0, -1);
 }
Ejemplo n.º 4
0
 /**
  * Initialise and return the SEO object
  *
  * @since version 1.0.0
  *
  * @return self Return the SEO instance
  **/
 public static function init()
 {
     if (null === static::$instance) {
         static::$instance = new static();
         // set the default URL for Meta tags like canonical
         self::setPageURL(Director::AbsoluteBaseURL() . substr(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), 1));
         // Initialise core objects
         self::$tags = new SEO_HeadTags();
         self::$sitemap = new SEO_Sitemap();
         self::$paginaton = new SEO_Pagination();
     }
     return static::$instance;
 }