Commit 1d3e4f83 authored by Sigrid Suski's avatar Sigrid Suski

(#) Reversal of Commit 8b171710 as anchors do not longer work then

parent cc574352
......@@ -41,6 +41,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
(!) Not setting cookie in the search itself because if we didn't received it we weren't able to send it
(#) Undefined variable: fieldNids
(#) Reversal of Commit 8b171710 as anchors do not longer work then
......
......@@ -80,10 +80,12 @@ class SPJ16MainFrame extends SPJoomlaMainFrame implements SPMainframeInterface
* @param array $head
*
* @return bool
* @throws SPException
* @throws \Sobi\Error\Exception
*/
public function addHead( $head )
{
if ( strlen( SPRequest::cmd( 'format' ) ) && SPRequest::cmd( 'format' ) != 'html' ) {
if ( strlen( Input::Cmd( 'format' ) ) && Input::Cmd( 'format' ) != 'html' ) {
return true;
}
/** @var JDocument $document */
......@@ -98,82 +100,86 @@ class SPJ16MainFrame extends SPJoomlaMainFrame implements SPMainframeInterface
$canonicalSet = false;
foreach ( $head as $type => $code ) {
switch ( $type ) {
default: {
if ( count( $code ) ) {
foreach ( $code as $html ) {
++$c;
$document->addCustomTag( $html );
if ( $type == 'links' && strstr( $html, 'canonical' ) ) {
$canonicalSet = true;
default:
{
if ( count( $code ) ) {
foreach ( $code as $html ) {
++$c;
$document->addCustomTag( $html );
if ( $type == 'links' && strstr( $html, 'canonical' ) ) {
$canonicalSet = true;
}
}
}
break;
}
break;
}
case 'robots' :
case 'author': {
$document->setMetaData( $type, implode( ', ', $code ) );
case 'author':
{
$document->setMetaData( $type, implode( ', ', $code ) );
// $document->setHeadData( array( $type => implode( ', ', $code ) ) );
break;
}
case 'keywords': {
$metaKeys = trim( implode( ', ', $code ) );
if ( Sobi::Cfg( 'meta.keys_append', true ) ) {
$metaKeys .= Sobi::Cfg( 'string.meta_keys_separator', ',' ) . $document->getMetaData( 'keywords' );
break;
}
$metaKeys = explode( Sobi::Cfg( 'string.meta_keys_separator', ',' ), $metaKeys );
if ( count( $metaKeys ) ) {
$metaKeys = array_unique( $metaKeys );
foreach ( $metaKeys as $i => $p ) {
if ( strlen( trim( $p ) ) ) {
$metaKeys[ $i ] = trim( $p );
}
else {
unset( $metaKeys[ $i ] );
}
case 'keywords':
{
$metaKeys = trim( implode( ', ', $code ) );
if ( Sobi::Cfg( 'meta.keys_append', true ) ) {
$metaKeys .= Sobi::Cfg( 'string.meta_keys_separator', ',' ) . $document->getMetaData( 'keywords' );
}
$metaKeys = implode( ', ', $metaKeys );
}
else {
$metaKeys = null;
}
$document->setMetadata( 'keywords', $metaKeys );
break;
}
case 'description': {
$metaDesc = implode( Sobi::Cfg( 'string.meta_desc_separator', ' ' ), $code );
if ( strlen( $metaDesc ) ) {
if ( Sobi::Cfg( 'meta.desc_append', true ) ) {
$metaDesc .= $this->getMetaDescription( $document );
}
$metaDesc = explode( ' ', $metaDesc );
if ( count( $metaDesc ) ) {
foreach ( $metaDesc as $i => $p ) {
$metaKeys = explode( Sobi::Cfg( 'string.meta_keys_separator', ',' ), $metaKeys );
if ( count( $metaKeys ) ) {
$metaKeys = array_unique( $metaKeys );
foreach ( $metaKeys as $i => $p ) {
if ( strlen( trim( $p ) ) ) {
$metaDesc[ $i ] = trim( $p );
$metaKeys[ $i ] = trim( $p );
}
else {
unset( $metaDesc[ $i ] );
unset( $metaKeys[ $i ] );
}
}
$metaDesc = implode( ' ', $metaDesc );
$metaKeys = implode( ', ', $metaKeys );
}
else {
$metaDesc = null;
$metaKeys = null;
}
$document->setDescription( $metaDesc );
$document->setMetadata( 'keywords', $metaKeys );
break;
}
case 'description':
{
$metaDesc = implode( Sobi::Cfg( 'string.meta_desc_separator', ' ' ), $code );
if ( strlen( $metaDesc ) ) {
if ( Sobi::Cfg( 'meta.desc_append', true ) ) {
$metaDesc .= $this->getMetaDescription( $document );
}
$metaDesc = explode( ' ', $metaDesc );
if ( count( $metaDesc ) ) {
foreach ( $metaDesc as $i => $p ) {
if ( strlen( trim( $p ) ) ) {
$metaDesc[ $i ] = trim( $p );
}
else {
unset( $metaDesc[ $i ] );
}
}
$metaDesc = implode( ' ', $metaDesc );
}
else {
$metaDesc = null;
}
$document->setDescription( $metaDesc );
}
break;
}
break;
}
}
}
$jsUrl = FileSystem::FixPath( self::url( [ 'task' => 'txt.js', 'format' => 'json' ], true, false, false ) );
$document->addCustomTag( "\n\t<script type=\"text/javascript\" src=\"" . str_replace( '&', '&amp;', $jsUrl ) . "\"></script>\n" );
$c++;
$document->addCustomTag( "\n\t<!-- SobiPro ({$c}) Head Tags Output -->\n" );
if ( !( defined( 'SOBIPRO_ADM' ) ) && ( Input::String( 'option' ) != 'com_menus' ) ) {
$document->setBase( Sobi::Cfg( 'live_site' ) );
}
// if ( !( defined( 'SOBIPRO_ADM' ) ) && ( Input::String( 'option' ) != 'com_menus' ) ) {
// $document->setBase( Sobi::Cfg( 'live_site' ) );
// }
// we would like to set our own canonical please :P
// https://groups.google.com/forum/?fromgroups=#!topic/joomla-dev-cms/sF3-JBQspQU
if ( count( $document->_links ) && $canonicalSet ) {
......@@ -204,6 +210,7 @@ class SPJ16MainFrame extends SPJoomlaMainFrame implements SPMainframeInterface
protected function JConfigValue( $value )
{
$value = str_replace( 'config.', null, $value );
return JFactory::getConfig()->get( $value );
}
......@@ -216,6 +223,7 @@ class SPJ16MainFrame extends SPJoomlaMainFrame implements SPMainframeInterface
if ( !( $mf ) || !( $mf instanceof self ) ) {
$mf = new self();
}
return $mf;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment