diff --git a/metadata.json b/metadata.json index 6db57f6..e1dd0c9 100644 --- a/metadata.json +++ b/metadata.json @@ -7,4 +7,5 @@ "author_uri": "http://armi.in/arjun", "license": "GPLv2", "min_q2a": "1.5" + "load_order": "after_db_init" } diff --git a/qlist-desc-layer.php b/qlist-desc-layer.php index f81ce4b..d20849c 100644 --- a/qlist-desc-layer.php +++ b/qlist-desc-layer.php @@ -57,22 +57,52 @@ public function q_list($q_list) $blockwordspreg = qa_get_block_words_preg(); // Now add the popup to the title for each question +foreach ($q_list['qs'] as $index => $question) { - foreach ($q_list['qs'] as $index => $question) { - if (isset($postinfo[$question['raw']['postid']])) { - $thispost = $postinfo[$question['raw']['postid']]; - $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg)); - $text = htmlspecialchars(preg_replace('/\s+/', ' ', $text)); // Remove duplicated blanks, new line characters, tabs, etc - //$text = qa_shorten_string_line($text, $maxlength); - if($this->template =='blogs') - $title = $thispost['title']; - else $title = isset($question['title']) ? $question['title'] : ''; - if(strlen($title) < $minlength){ - $text = $title.'
'. qa_shorten_string_line($text, $maxlength -strlen($title)); - $q_list['qs'][$index]['title'] = $text; - } - } - } +if (isset($postinfo[$question['raw']['postid']])) { + +$thispost = $postinfo[$question['raw']['postid']]; + +$text = qa_viewer_text($thispost['content'], $thispost['format']); + +$text = htmlspecialchars(preg_replace('/\s+/', ' ', $text)); // Remove duplicated blanks, new line characters, tabs, etc + +//$text = qa_shorten_string_line($text, $maxlength); + +if($this->template =='blogs') + +$title = $thispost['title']; + +else $title = isset($question['title']) ? $question['title'] : ''; + +if(strlen($title) < $minlength){ + +$text = '
'. qa_substr($text,0,$maxlength).'...
'; + +$q_list['qs'][$index]['title'] = $title; + +$q_list['qs'][$index]['content'] = $text; + +} + +} + +} +// foreach ($q_list['qs'] as $index => $question) { +// if (isset($postinfo[$question['raw']['postid']])) { +// $thispost = $postinfo[$question['raw']['postid']]; +// $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg)); +// $text = htmlspecialchars(preg_replace('/\s+/', ' ', $text)); // Remove duplicated blanks, new line characters, tabs, etc +// //$text = qa_shorten_string_line($text, $maxlength); +// if($this->template =='blogs') +// $title = $thispost['title']; +// else $title = isset($question['title']) ? $question['title'] : ''; +// if(strlen($title) < $minlength){ +// $text = $title.'
'. qa_shorten_string_line($text, $maxlength -strlen($title)); +// $q_list['qs'][$index]['title'] = $text; +// } +// } +// } } }