Exemple #1
0
 public function getCoreProperties()
 {
     if (!isset($this->_coreProperties)) {
         $this->_coreProperties = CoreProperties::getInstance();
     }
     return $this->_coreProperties;
 }
Exemple #2
0
 /**
  * Validates user email to ensure that it does not allow to change while changing user profile.
  */
 public function validateUsernameChange($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $properties = CoreProperties::getInstance();
         $existingUser = self::findById($this->id);
         if (isset($existingUser) && strcmp($existingUser->username, $this->username) != 0 && !$properties->isChangeUsername()) {
             $this->addError($attribute, Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_CHANGE_USERNAME));
         }
     }
 }
 private function generateFacebookTags($ogUrl, $banner)
 {
     $settings = FacebookSettings::getInstance();
     if ($settings->isActive()) {
         $coreProperties = CoreProperties::getInstance();
         $appId = $settings->getAppId();
         $siteName = $coreProperties->getSiteName();
         $locale = $coreProperties->getLocale();
         $page = $this->page;
         $content = $this->content;
         $metaContent = "<meta property='og:title' content='{$page->name}' />\n\t\t\t\t\t\t\t\t<meta property='og:site_name' content='{$siteName}'/>\n\t\t\t\t\t\t\t\t<meta property='og:url' content='{$ogUrl}' />\n\t\t\t\t\t\t\t\t<meta property='og:description' content='{$content->summary}'/>\t\t\n\t\t\t\t\t\t\t\t<meta property='og:locale' content='{$locale}' />\n\t\t\t\t\t\t\t\t<meta property='fb:app_id' content='{$appId}' />";
         if (isset($banner)) {
             $banner = $banner->getFileUrl();
             $metaContent .= "<meta property='og:image' content='{$banner}'>";
         }
         if ($this->page->isPost()) {
             $author = $settings->getAuthor();
             $publisher = $settings->getPublisher();
             $metaContent .= "<meta property='og:type' content='article' />\n\t\t\t\t\t\t\t\t\t<meta property='article:author' content='{$author}' />\n\t\t\t\t\t\t\t\t\t<meta property='article:publisher' content='{$publisher}' />";
         } else {
             $metaContent .= "<meta property='og:type' content='website' />";
         }
         return $metaContent;
     }
     return '';
 }