From 735964af49d1978355995956fa00251ed2168a5c Mon Sep 17 00:00:00 2001 From: Andreas Rudolph Date: Thu, 27 Nov 2014 16:11:43 +0100 Subject: [PATCH] version 0.1.7 / 0.2.7 imported --- README.md | 8 ++- release.sh | 4 +- src/joomla-1.5/com_openestate.xml | 4 +- src/joomla-1.5/openestate.wrapper.php | 83 ++++++++++++++-------- src/joomla-2.5/openestate.xml | 4 +- src/joomla-2.5/site/openestate.wrapper.php | 78 ++++++++++++++------ 6 files changed, 125 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 2c8d141..010919d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -OpenEstate-PHP-Wrapper for Joomla 0.1.6 / 0.2.6 +OpenEstate-PHP-Wrapper for Joomla 0.1.7 / 0.2.7 =============================================== This extension integrates [OpenEstate-PHP-Export](https://github.com/OpenEstate/OpenEstate-PHP-Export) @@ -34,6 +34,12 @@ Webseite integriert werden. Changelog --------- +### 0.1.7 / 0.2.7 + +- make use of meta elements, that were specified for the menu entry +- put the configured `$MetaDescriptionTexts` from `myconfig.php` into the meta + `description` element of property listing pages + ### 0.1.6 / 0.2.6 - Some smaller fixes diff --git a/release.sh b/release.sh index 408ae0f..bcee1dc 100755 --- a/release.sh +++ b/release.sh @@ -1,8 +1,8 @@ #!/bin/bash NAME="com_openestate" -VERSION15="0.1.6" -VERSION25="0.2.6" +VERSION15="0.1.7" +VERSION25="0.2.7" PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" rm -Rf $PROJECT_DIR/release diff --git a/src/joomla-1.5/com_openestate.xml b/src/joomla-1.5/com_openestate.xml index f100d43..3b5b5ab 100644 --- a/src/joomla-1.5/com_openestate.xml +++ b/src/joomla-1.5/com_openestate.xml @@ -2,13 +2,13 @@ OpenEstate - January 2012 + October 2012 Andreas Rudolph, Walter Wagner info@openindex.de http://openestate.org (C) 2010-2012 All rights reserved. GNU/GPL3 - 0.1.6 + 0.1.7 OpenEstate-PHP-Wrapper

This component integrates PHP-exported properties from OpenEstate-ImmoTool into Joomla. You can find further informations at OpenEstate.org

]]>
diff --git a/src/joomla-1.5/openestate.wrapper.php b/src/joomla-1.5/openestate.wrapper.php index d9b4175..38521b7 100644 --- a/src/joomla-1.5/openestate.wrapper.php +++ b/src/joomla-1.5/openestate.wrapper.php @@ -1,7 +1,7 @@ get( 'filter' ) ); - if (is_array($filters)) { - foreach ($filters as $filter=>$value) { - if (!is_array($_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ])) { - $_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ] = array(); - } - if (!isset($_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ][$filter])) { - $_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ][$filter] = $value; - } + foreach ($filters as $filter=>$value) { + if (!isset($_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ]) || !is_array($_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ])) { + $_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ] = array(); + } + if (!isset($_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ][$filter])) { + $_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ][$filter] = $value; } } } @@ -193,32 +196,43 @@ function wrap( $defaultView, $scriptName, &$params, &$hiddenParams ) { //ob_clean(); ob_end_clean(); - // Stylesheets - $setup = new immotool_setup(); - if (is_callable(array('immotool_myconfig', 'load_config_default'))) immotool_myconfig::load_config_default( $setup ); - $stylesheets = array( IMMOTOOL_BASE_URL . 'style.php' ); - if (is_string($setup->AdditionalStylesheet) && strlen($setup->AdditionalStylesheet)>0) - $stylesheets[] = $setup->AdditionalStylesheet; + // Konfiguration ermitteln + $setup = null; + if ($wrap=='expose') { + $setup = new immotool_setup_expose(); + if (is_callable(array('immotool_myconfig', 'load_config_expose'))) immotool_myconfig::load_config_expose( $setup ); + } + else { + $setup = new immotool_setup_index(); + if (is_callable(array('immotool_myconfig', 'load_config_index'))) immotool_myconfig::load_config_index( $setup ); + } // Nachträgliche Bearbeitung am Dokument - $document = &JFactory::getDocument(); $lang = (isset($_REQUEST[ IMMOTOOL_PARAM_LANG ]))? $_REQUEST[ IMMOTOOL_PARAM_LANG ]: $params->get( 'lang' ); if (is_string($lang)) { $document->setLanguage( $lang ); $document->setMetaData( 'language', $lang ); } + + // Stylesheets registrieren + $stylesheets = array( IMMOTOOL_BASE_URL . 'style.php?wrapped=1' ); + if (is_string($setup->AdditionalStylesheet) && strlen($setup->AdditionalStylesheet)>0) { + $stylesheets[] = $setup->AdditionalStylesheet; + } foreach ($stylesheets as $stylesheet) { $document->addStyleSheet( $stylesheet ); } // Nachträgliche Bearbeitung am Dokument, Exposéansicht + $metaDescription = null; + $metaKeywords = null; if ($wrap=='expose') { $exposeId = (isset($_REQUEST[ IMMOTOOL_PARAM_EXPOSE_ID ]))? $_REQUEST[ IMMOTOOL_PARAM_EXPOSE_ID ]: null; $exposeObj = (is_string($exposeId))? immotool_functions::get_object( $exposeId ): null; $exposeTxt = (is_string($exposeId))? immotool_functions::get_text( $exposeId ): null; if (is_array($exposeObj)) { - // Titel aus Immobilie übernehmen + // Titel der Immobilie ins Dokument übernehmen $title = (is_string($lang) && isset($exposeObj['title'][$lang]))? $exposeObj['title'][$lang]: null; if (is_string($title)) { $title = trim( strip_tags( html_entity_decode( $title, ENT_NOQUOTES, $setup->Charset ) ) ); @@ -228,24 +242,37 @@ function wrap( $defaultView, $scriptName, &$params, &$hiddenParams ) { if (is_array($exposeTxt)) { // Keywords aus Immobilie übernehmen - $keywords = (is_string($lang) && isset($exposeTxt['keywords'][$lang]))? $exposeTxt['keywords'][$lang]: null; - if (is_string($keywords)) { - $keywords = trim( strip_tags( html_entity_decode( $keywords, ENT_NOQUOTES, $setup->Charset ) ) ); - $document->setMetaData( 'keywords', $keywords ); + $txt = (is_string($lang) && isset($exposeTxt['keywords'][$lang]))? $exposeTxt['keywords'][$lang]: null; + if (is_string($txt)) { + $metaKeywords = trim( strip_tags( html_entity_decode( $txt, ENT_NOQUOTES, $setup->Charset ) ) ); } // Description aus Immobilie übernehmen - $description = (is_string($lang) && isset($exposeTxt['short_description'][$lang]))? $exposeTxt['short_description'][$lang]: null; - if (is_null($description)) { - $description = (is_string($lang) && isset($exposeTxt['kurz_beschr'][$lang]))? $exposeTxt['kurz_beschr'][$lang]: null; - } - if (is_string($description)) { - $description = trim( strip_tags( html_entity_decode( $description, ENT_NOQUOTES, $setup->Charset ) ) ); - $document->setMetaData( 'description', $description ); + if (is_array($setup->MetaDescriptionTexts)) { + foreach ($setup->MetaDescriptionTexts as $attrib) { + $txt = (isset($objectTexts[$attrib][$lang])) ? $objectTexts[$attrib][$lang] : null; + if (is_string($txt) && strlen(trim($txt))>0) { + $metaDescription = trim( strip_tags( html_entity_decode( $txt, ENT_NOQUOTES, $setup->Charset ) ) ); + break; + } + else { + $txt = null; + } + } } } } + // Meta-Description ggf. ins Dokument übernehmen + if (is_string($metaDescription) && strlen(trim($metaDescription))>0) { + $document->setMetaData( 'description', trim($metaDescription) ); + } + + // Meta-Keywords ggf. ins Dokument übernehmen + if (is_string($metaKeywords) && strlen(trim($metaKeywords))>0) { + $document->setMetaData( 'keywords', trim($metaKeywords) ); + } + // Ausgabe erzeugen return immotool_functions::wrap_page( $page, $wrap, $scriptName, IMMOTOOL_BASE_URL, array(), $hiddenParams ); } diff --git a/src/joomla-2.5/openestate.xml b/src/joomla-2.5/openestate.xml index b2ebd88..f98c217 100644 --- a/src/joomla-2.5/openestate.xml +++ b/src/joomla-2.5/openestate.xml @@ -1,13 +1,13 @@ COM_OPENESTATE - January 2012 + October 2012 Andreas Rudolph, Walter Wagner info@openindex.de http://openestate.org (C) 2010-2012 All rights reserved. GNU/GPL3 - 0.2.6 + 0.2.7 COM_OPENESTATE_DESCRIPTION http://wiki.openestate.org/mediawiki/images/e/e9/Joomla25_extension.xml diff --git a/src/joomla-2.5/site/openestate.wrapper.php b/src/joomla-2.5/site/openestate.wrapper.php index fda441d..3e5057b 100644 --- a/src/joomla-2.5/site/openestate.wrapper.php +++ b/src/joomla-2.5/site/openestate.wrapper.php @@ -1,7 +1,7 @@ getMenu(): null; + $menu = (is_object($menus))? $menus->getActive(): null; + // Script ermitteln $wrap = (isset($_REQUEST['wrap']) && is_string($_REQUEST['wrap']))? $_REQUEST['wrap']: $defaultView; @@ -186,7 +194,7 @@ function wrap( $defaultView, $scriptName, &$params, &$hiddenParams ) { $filters = OpenEstateWrapper::parseValuesFromTxt( $params->get( 'filter' ) ); if (is_array($filters)) { foreach ($filters as $filter=>$value) { - if (!is_array($_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ])) { + if (!isset($_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ]) || !is_array($_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ])) { $_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ] = array(); } if (!isset($_REQUEST[ IMMOTOOL_PARAM_INDEX_FILTER ][$filter])) { @@ -205,24 +213,39 @@ function wrap( $defaultView, $scriptName, &$params, &$hiddenParams ) { //ob_clean(); ob_end_clean(); - // Stylesheets - $setup = new immotool_setup(); - if (is_callable(array('immotool_myconfig', 'load_config_default'))) immotool_myconfig::load_config_default( $setup ); - $stylesheets = array( IMMOTOOL_BASE_URL . 'style.php' ); - if (is_string($setup->AdditionalStylesheet) && strlen($setup->AdditionalStylesheet)>0) - $stylesheets[] = $setup->AdditionalStylesheet; + // Konfiguration ermitteln + $setup = null; + if ($wrap=='expose') { + $setup = new immotool_setup_expose(); + if (is_callable(array('immotool_myconfig', 'load_config_expose'))) immotool_myconfig::load_config_expose( $setup ); + } + else { + $setup = new immotool_setup_index(); + if (is_callable(array('immotool_myconfig', 'load_config_index'))) immotool_myconfig::load_config_index( $setup ); + } // Nachträgliche Bearbeitung am Dokument - $document = &JFactory::getDocument(); $lang = (isset($_REQUEST[ IMMOTOOL_PARAM_LANG ]))? $_REQUEST[ IMMOTOOL_PARAM_LANG ]: $params->get( 'lang' ); if (is_string($lang)) { $document->setLanguage( $lang ); $document->setMetaData( 'language', $lang ); } + + // Stylesheets registrieren + $stylesheets = array( IMMOTOOL_BASE_URL . 'style.php?wrapped=1' ); + if (is_string($setup->AdditionalStylesheet) && strlen($setup->AdditionalStylesheet)>0) { + $stylesheets[] = $setup->AdditionalStylesheet; + } foreach ($stylesheets as $stylesheet) { $document->addStyleSheet( $stylesheet ); } + // Meta-Description des Menü-Eintrages ermitteln + $metaDescription = (is_object($menu))? $menu->params->get('menu-meta_description'): null; + + // Meta-Keywords des Menü-Eintrages ermitteln + $metaKeywords = (is_object($menu))? $menu->params->get('menu-meta_keywords'): null; + // Nachträgliche Bearbeitung am Dokument, Exposéansicht if ($wrap=='expose') { $exposeId = (isset($_REQUEST[ IMMOTOOL_PARAM_EXPOSE_ID ]))? $_REQUEST[ IMMOTOOL_PARAM_EXPOSE_ID ]: null; @@ -230,7 +253,7 @@ function wrap( $defaultView, $scriptName, &$params, &$hiddenParams ) { $exposeTxt = (is_string($exposeId))? immotool_functions::get_text( $exposeId ): null; if (is_array($exposeObj)) { - // Titel aus Immobilie übernehmen + // Titel der Immobilie ins Dokument übernehmen $title = (is_string($lang) && isset($exposeObj['title'][$lang]))? $exposeObj['title'][$lang]: null; if (is_string($title)) { $title = trim( strip_tags( html_entity_decode( $title, ENT_NOQUOTES, $setup->Charset ) ) ); @@ -240,24 +263,37 @@ function wrap( $defaultView, $scriptName, &$params, &$hiddenParams ) { if (is_array($exposeTxt)) { // Keywords aus Immobilie übernehmen - $keywords = (is_string($lang) && isset($exposeTxt['keywords'][$lang]))? $exposeTxt['keywords'][$lang]: null; - if (is_string($keywords)) { - $keywords = trim( strip_tags( html_entity_decode( $keywords, ENT_NOQUOTES, $setup->Charset ) ) ); - $document->setMetaData( 'keywords', $keywords ); + $txt = (is_string($lang) && isset($exposeTxt['keywords'][$lang]))? $exposeTxt['keywords'][$lang]: null; + if (is_string($txt)) { + $metaKeywords = trim( strip_tags( html_entity_decode( $txt, ENT_NOQUOTES, $setup->Charset ) ) ); } // Description aus Immobilie übernehmen - $description = (is_string($lang) && isset($exposeTxt['short_description'][$lang]))? $exposeTxt['short_description'][$lang]: null; - if (is_null($description)) { - $description = (is_string($lang) && isset($exposeTxt['kurz_beschr'][$lang]))? $exposeTxt['kurz_beschr'][$lang]: null; - } - if (is_string($description)) { - $description = trim( strip_tags( html_entity_decode( $description, ENT_NOQUOTES, $setup->Charset ) ) ); - $document->setMetaData( 'description', $description ); + if (is_array($setup->MetaDescriptionTexts)) { + foreach ($setup->MetaDescriptionTexts as $attrib) { + $txt = (isset($objectTexts[$attrib][$lang])) ? $objectTexts[$attrib][$lang] : null; + if (is_string($txt) && strlen(trim($txt))>0) { + $metaDescription = trim( strip_tags( html_entity_decode( $txt, ENT_NOQUOTES, $setup->Charset ) ) ); + break; + } + else { + $txt = null; + } + } } } } + // Meta-Description ggf. ins Dokument übernehmen + if (is_string($metaDescription) && strlen(trim($metaDescription))>0) { + $document->setMetaData( 'description', trim($metaDescription) ); + } + + // Meta-Keywords ggf. ins Dokument übernehmen + if (is_string($metaKeywords) && strlen(trim($metaKeywords))>0) { + $document->setMetaData( 'keywords', trim($metaKeywords) ); + } + // Ausgabe erzeugen return immotool_functions::wrap_page( $page, $wrap, $scriptName, IMMOTOOL_BASE_URL, array(), $hiddenParams ); }