share = true; } if(!empty($pref['display_datestamp'])) { $this->datestamp = true; } } // Simply FAQ count when needed. function sc_faq_counter($parm='') { return $this->counter; } function sc_faq_question($parm='') { $tp = e107::getParser(); $parm = eHelper::scDualParams($parm); $param = $parm[1]; $params = $parm[2]; $new = e107::pref('faqs','new',3); $newDate = strtotime($new." days ago"); $faqNew = ($this->var['faq_datestamp'] > $newDate) ? " faq-new" : ""; if($param == 'expand' && !empty($this->var['faq_answer'])) { $id = "faq_".$this->var['faq_id']; $url = e107::url('faqs','item', $this->var, 'full'); $question = $tp->toHTML($this->var['faq_question'],true,'TITLE'); $hide = ($this->item != $this->var['faq_id']) ? 'e-hideme' : ''; $text = " ".$question."
"; $text .= $tp->toHTML($this->var['faq_answer'],true,'BODY'); $text .= "
"; if(vartrue($params['tags']) && $this->var['faq_tags']) { $text .= "
".LAN_FAQS_TAGS.": ".$this->sc_faq_tags()."
"; } if($this->datestamp == true) { $text .= "
".$tp->toDate($this->var['faq_datestamp'])."
"; } if($this->share == true) { $text .= "
".$tp->parseTemplate("{SOCIALSHARE: size=xs&type=basic&url=".$url."&title=".$question."&tags=".$this->var['faq_tags']."}",true)."
"; } $text .= "
"; } else { $text = $tp->toHTML($this->var['faq_question'],true, 'BODY'); } return $text; } function sc_faq_question_link($parm='') { $tp = e107::getParser(); return "var)."' >".$tp -> toHTML($this->var['faq_question'],true,'TITLE').""; } function sc_faq_answer() { return e107::getParser()->toHTML($this->var['faq_answer'],true,'BODY'); } function sc_faq_tags($parm='') { $tags = $this->var['faq_tags']; if(!$tags) return ''; if(!$parm) $parm = ' '; $ret = $urlparms = array(); if($this->category) $urlparms['category'] = $this->category; $tags = array_map('trim', explode(',', $tags)); foreach ($tags as $tag) { $urlparms['tag'] = $tag; // $url = e107::getUrl()->create('faqs/list/all', $urlparms); $url = e107::url('faqs', 'tag',$urlparms); $tag = htmlspecialchars($tag, ENT_QUOTES, 'utf-8'); $ret[] = ''.$tag.''; } return implode($parm, $ret); } function sc_faq_current_tag($parm='') { if(!$this->tag) return ''; $tag = $this->tag; if($parm == 'raw') return $tag; $urlparms = array(); if($this->category) $urlparms['category'] = $this->category; $urlparms['tag'] = $tag; // $url = e107::getUrl()->create('faqs/list/all', $urlparms); $url = e107::url('faqs', 'tag', $urlparms); if($parm == 'url') return $url; return ''.$tag.''; } function sc_faq_edit() { $tp = e107::getParser(); $faqpref = e107::getPlugConfig('faqs')->getPref(); if(($faqpref['add_faq'] && $this->var['faq_author'] == USERID) || ADMIN ) { // UNDER CONSTRUCTION //return "[ var['faq_id']."'>Edit ]"; } } function sc_faq_category($parm = '') { // $tp = e107::getParser(); // return $tp->toHTML($this->var['faq_info_title']); $tp = e107::getParser(); $url = e107::url('faqs','category', $this->var); //@See faqs/e_url.php return "".$tp->toHTML($this->var['faq_info_title']).""; /* return " $this->var['faq_info_id']))."'>".$tp->toHTML($this->var['faq_info_title']).""; $tp = e107::getParser(); if($parm == 'extend' && $this->tag) { return "".$tp->toHTML($this->var['faq_info_title'])." » ".$this->sc_faq_current_tag('raw').""; } if($parm == 'raw') { return $tp->toHTML($this->var['faq_info_title']); } return " $this->var['faq_info_id']))."'>".$tp->toHTML($this->var['faq_info_title']).""; */ } function sc_faq_category_description($parm='') { $tp = e107::getParser(); return $tp->toHTML($this->var['faq_info_about'],true, 'BODY'); } function sc_faq_caturl() { return e107::url('faqs', 'category', $this->var); } function sc_faq_datestamp($parm) { $type = vartrue($parm, 'relative'); return e107::getParser()->toDate($this->var['faq_datestamp'], $type); } function sc_faq_caption() { $customCaption = e107::pref('faqs', 'page_title'); if(!empty($customCaption)) { return e107::getParser()->toHtml($customCaption,true); } return LAN_PLUGIN_FAQS_FRONT_NAME; } function sc_faq_count() { $faqTotal = e107::pref('faqs', 'display_total'); if(!empty($faqTotal)) { return "(".($this->counter -1).")"; } return $this->var['f_count']; } function sc_faq_cat_diz() { $tp = e107::getParser(); return $tp->toHTML($this->var['faq_info_about'], true); } function sc_faq_icon() { return ""; } function sc_faq_submit_question($parms) { $faqpref = e107::pref('faqs'); if(empty($faqpref['submit_question_language']) && e107::getPref('sitelanguage') != e_LANGUAGE) { return false; } if(!empty($parms['expand']) && $faqpref['submit_question'] != e_UC_NOBODY) { $hide = 'e-hideme'; $button = "Ask a Question"; } else { $hide = ""; $button = ""; } if ($faqpref['submit_question'] != e_UC_NOBODY) { $frm = e107::getForm(); $text = $button; $text .= "
"; if(check_class($faqpref['submit_question'])) { $text .= $frm->open('faq-ask-question','post'); $text .= "
".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength'=>255, 'size'=>'xxlarge','placeholder'=>'Type your question here..', 'wrap'=>'soft')).'
'.$frm->submit('submit_a_question','Submit')."
"; $text .= $frm->close(); } elseif($faqpref['submit_question'] == e_UC_MEMBER) { $srp = array( '[' => "", ']' => "" ); //TODO LAN $text .= str_replace(array_keys($srp), array_values($srp), "Please [register] and/or login to post a question."); } else { //TODO LAN $text .= "Not permitted at this time."; } $text .= "
"; return $text; } } function sc_faq_submit_question_list() { $faqpref = e107::pref('faqs'); if (check_class($faqpref['submit_question'])) { $tp = e107::getParser(); $list = e107::getDb()->retrieve('faqs','faq_question,faq_datestamp',"faq_answer='' AND faq_author_ip = '".USERIP."' ORDER BY faq_datestamp DESC ", true); $text = ""; if(!empty($list)) { //TODO LAN $text = "
"; $text .= "

You have requested answers to the following questions:

"; $text .= ""; $text .= "
"; } return $text; } } function sc_faq_search($parm='') { $frm = e107::getForm(); $tp = e107::getParser(); $target = e107::url('faqs','search'); $text = $frm->open('faq-search-form','get', $target); $text .= ''; $text .= $frm->text('srch', $_GET['srch'], 20,'class=search-query&placeholder='.LAN_SEARCH).' '; $text .= ''; $text .= $frm->close(); return $text; } function sc_faq_breadcrumb() //TODO Category Detection. and proper SEF Urls with category names. { $array = array(); $array[0] = array('url'=> e_REQUEST_SELF, 'text'=>LAN_PLUGIN_FAQS_NAME); return e107::getForm()->breadcrumb($array); } }