コード例 #1
0
	public function  __construct($atts = null) {
		parent::__construct($atts);

		$opts = \Core\Licenses\Factory::GetAsOptions();

		$this->set('options', $opts);
	}
コード例 #2
0
	private function _getAsImageHTML(){
		if(sizeof($this->getMetas())){
			// If there are no meta tags associated, nothing to do!
			$metatitle   = $this->getMetaTitle('title');
			$metaauthor  = $this->getMetaTitle('author');
			$metalicense = $this->getMeta('license');
			$metaurl     = $this->getMetaTitle('url');
			$metatags    = $this->getMetaTitle('keywords');
			$url         = $this->_file->getURL();

			$metacredithtml = '';
			if($metaauthor){
				$metacredithtml .=
					'Photo by <span itemprop="author">' .
					($metaurl ? '<a href="' . $metaurl . '" target="_BLANK">' . $metaauthor . '</a>' : $metaauthor) .
					'</span>';
			}
			if($metalicense){
				$lic = \Core\Licenses\Factory::GetLicense($metalicense->get('meta_value'));
				$licimg = \Core\resolve_asset('assets/images/licenses/' . $metalicense->get('meta_value') . '-sm.png');

				if($lic){
					$metacredithtml .= ($metacredithtml ? ' ' : '') . '<a href="' . $lic['url'] . '" target="_BLANK"><img src="' . $licimg . '" alt="' . $lic['title'] . '" title="' . $lic['title'] . '"/></a>';
				}
				else{
					$metacredithtml .= ($metacredithtml ? ' // ' : '') . $metalicense->get('meta_value_title');
				}
			}

			// Wrap it!
			$metaheader = '<div class="image-metadata" itemscope itemtype="http://schema.org/ImageObject">';
			$metafooter = '</div><!-- END .image-metadata-wrapper -->';

			// Some extra inline attributes
			$metacredithtml .=
				'<meta itemprop="image" content="' . $url . '"/>' .
				'<meta itemprop="url" content="' . ($metaurl ? $metaurl : $url) . '"/>' .
				($metatitle ? '<meta itemprop="name" content="' . $metatitle . '"/>' : '') .
				(is_array($metatags) && sizeof($metatags) ? '<meta itemprop="keywords" content="' . htmlspecialchars(implode(', ', $metatags)) . '"/>' : '');


			// Merge everything together!
			return $metaheader . $metacredithtml . $metafooter;
		}
	}