Index: branches/5.2.x/core/units/helpers/page_helper.php =================================================================== diff -u -N -r16513 -r16634 --- branches/5.2.x/core/units/helpers/page_helper.php (.../page_helper.php) (revision 16513) +++ branches/5.2.x/core/units/helpers/page_helper.php (.../page_helper.php) (revision 16634) @@ -1,6 +1,6 @@ isLoaded(); } + + /** + * Returns revision content + * + * @param integer $page_revision_id Page revision Id. + * + * @return array + */ + public function getRevisionContent($page_revision_id) + { + $sql = 'SELECT * + FROM ' . TABLE_PREFIX . 'PageContent + WHERE RevisionId = ' . $page_revision_id; + $blocks = $this->Conn->GetIterator($sql); + + /** @var kMultiLanguageHelper $ml_helper */ + $ml_helper = $this->Application->recallObject('kMultiLanguageHelper'); + $content = array(); + + foreach ( $ml_helper->getLanguages() as $lang_id ) { + $parts = array(); + + foreach ( $blocks as $block_data ) { + if ( (string)$block_data['l' . $lang_id . '_Content'] !== '' ) { + $parts[] = $this->makeSearchable($block_data['l' . $lang_id . '_Content']); + } + } + + $content['l' . $lang_id . '_PageContent'] = implode(' ', $parts); + } + + return $content; + } + + /** + * Unescapes and removes tags + * + * @param string $content Content. + * + * @return string + */ + protected function makeSearchable($content) + { + return trim(strip_tags(html_entity_decode($content, ENT_QUOTES, 'UTF-8'))); + } + }