function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { /* $requestparts=qa_request_parts(); $requestlower=strtolower(qa_request()); $firstlower=strtolower($requestparts[0]); $routing=qa_page_routing(); // unanswered & questions pages may contain categories. unset($routing['activity/']); unset($routing['unanswered/']); unset($routing['questions/']); if ( (isset($routing[$requestlower])) or (isset($routing[$firstlower.'/'])) or (is_numeric($requestparts[0])) ) return; $explicitqa=(strtolower($requestparts[0])=='qa' or strtolower($requestparts[0])=='unanswered' or strtolower($requestparts[0])=='questions' or strtolower($requestparts[0])=='activity'); if ($explicitqa) $slugs=array_slice($requestparts, 1); elseif (strlen($requestparts[0])) $slugs=$requestparts; else $slugs=array(); */ $slugs = useo_get_current_category_slug(); $countslugs = count($slugs); list($categories, $categoryid) = qa_db_select_with_pending(qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null); if ($countslugs && isset($categoryid)) { /* $categoryid is current categories ID $backpath = implode('/', array_reverse($slugs)); echo "countslugs: <pre>"; var_dump($countslugs); echo "</pre>"; $fullcategory=qa_db_select_with_pending(qa_db_full_category_selectspec($categoryid, true)); echo "fullcategory: <pre>"; var_dump($fullcategory); echo "</pre>"; echo "categoryid: <pre>"; var_dump($categoryid); echo "</pre>"; echo "slugs: <pre>"; var_dump($slugs); echo "</pre>"; echo "template: <pre>"; var_dump($template); echo "</pre>"; echo "request: <pre>"; var_dump($request); echo "</pre>"; */ require_once QA_INCLUDE_DIR . 'qa-db-metas.php'; $description = qa_db_categorymeta_get($categoryid, 'useo_cat_description'); if (!qa_opt('useo_cat_desc_format')) { $description = qa_html($description); } $editurlhtml = qa_path_html('category-edit/' . $categoryid); $allowediting = !qa_user_permit_error('useo_cat_desc_permit_edit'); if (strlen($description)) { echo '<SPAN CLASS="entry-content qa-category-description">'; echo $description; echo '</SPAN>'; if ($allowediting) { echo ' - <A HREF="' . $editurlhtml . '">edit</A>'; } } elseif ($allowediting) { echo '<A HREF="' . $editurlhtml . '">' . qa_lang_html('useo/create_desc_link') . '</A>'; } } }
function process_request($request) { $parts = explode('/', $request); $categoryid = $parts[1]; $fullcategory = qa_db_select_with_pending(qa_db_full_category_selectspec($categoryid, true)); $slugs = explode('/', $fullcategory['backpath']); $new_request = implode('/', array_reverse($slugs)); $qa_content = qa_content_prepare(); $qa_content['title'] = qa_lang_html_sub('useo/edit_desc_for_x', qa_html($fullcategory['title'])); if (qa_user_permit_error('useo_cat_desc_permit_edit')) { $qa_content['error'] = qa_lang_html('users/no_permission'); return $qa_content; } require_once QA_INCLUDE_DIR . 'qa-db-metas.php'; if (qa_clicked('dosave')) { require_once QA_INCLUDE_DIR . 'qa-util-string.php'; qa_db_categorymeta_set($categoryid, 'useo_cat_title', qa_post_text('useo_cat_title')); qa_db_categorymeta_set($categoryid, 'useo_cat_description', qa_post_text('useo_cat_description')); qa_redirect($new_request); } $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(array('label' => 'Link Title:', 'type' => 'text', 'rows' => 2, 'tags' => 'NAME="useo_cat_title" ID="useo_cat_title"', 'value' => qa_html(qa_db_categorymeta_get($categoryid, 'useo_cat_title'))), array('label' => 'Description:', 'type' => 'text', 'rows' => 4, 'tags' => 'NAME="useo_cat_description" ID="useo_cat_description"', 'value' => qa_html(qa_db_categorymeta_get($categoryid, 'useo_cat_description')))), 'buttons' => array(array('tags' => 'NAME="dosave"', 'label' => qa_lang_html('useo/save_desc_button')))); $qa_content['focusid'] = 'tagtitle'; return $qa_content; }
function doctype() { qa_html_theme_base::doctype(); if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) { // theme installation & update $version = qa_opt('IT_VERSION'); if (IT_VERSION > $version) { qa_redirect('it_installation'); } // admin/category form fields if ($this->request == 'admin/categories' && qa_get('edit') >= 1) { require_once QA_INCLUDE_DIR . 'qa-db-metas.php'; $categoryid = qa_get('edit'); $et_category = json_decode(qa_db_categorymeta_get($categoryid, 'et_category'), true); $et_category_link_title = $et_category['et_cat_title']; $et_category_description = $et_category['et_cat_desc']; $et_category_icon_48 = $et_category['et_cat_icon48']; $et_category_icon_64 = $et_category['et_cat_icon64']; $this->content['form']['fields'][] = array('tags' => 'NAME="et_category_link_title" ID="et_category_link_title"', 'label' => 'Category Link Title', 'value' => $et_category_link_title); $this->content['form']['fields'][] = array('tags' => 'NAME="et_category_description" ID="et_category_description"', 'label' => 'Category Sidebar Description', 'value' => $et_category_description); $this->content['form']['fields'][] = array('tags' => 'NAME="et_category_icon_48" ID="et_category_icon_48"', 'label' => 'Category Icon(48 pixel)', 'value' => $et_category_icon_48); $this->content['form']['fields'][] = array('tags' => 'NAME="et_category_icon_64" ID="et_category_icon_64"', 'label' => 'Category Icon(64 pixel)', 'value' => $et_category_icon_64); } } // ask form if ($this->template == 'ask' or $this->template == 'question' && substr(qa_get_state(), 0, 4) == 'edit') { // Form template if ($this->template == 'ask') { $form_name = 'form'; } else { $form_name = 'form_q_edit'; } // Featured Image if (qa_opt('it_feature_img_enable')) { $featured_image = ''; $featured_image_url = ''; $featured_image_style = ''; $featured_file_container_style = ''; if ($this->template != 'ask') { $postid = $this->content["q_view"]["raw"]["postid"]; require_once QA_INCLUDE_DIR . 'qa-db-metas.php'; $featured_image = qa_db_postmeta_get($postid, 'et_featured_image'); if (isset($featured_image)) { $featured_image_url = qa_opt('it_featured_url_abs') . 'featured/' . $featured_image; $featured_image_style = 'display: inline-block;'; $featured_file_container_style = 'display:none;'; } } $custom_field[0]['category_featured_upload']['label'] = ''; $custom_field[0]['category_featured_upload']['html'] = ' <div style="' . $featured_image_style . '" class="image-preview-container" id="image-preview-container"> <img class="image-preview img-thumbnail" id="image-preview" src="' . $featured_image_url . '"> <button class="btn btn-danger remove-featured-image" id="remove-featured-image" type="button">X</button> </div> <div id="featured_file_container" style="' . $featured_file_container_style . '"><div id="featured_file_upload"></div></div> <input type="hidden" value="' . $featured_image . '" name="featured_image" id="featured_image"> '; $custom_field[0]['category_featured_upload']['type'] = 'custom'; $count = count($this->content[$form_name]["fields"]); $featured_pos = 0; $this->content[$form_name]["fields"] = array_merge(array_slice($this->content[$form_name]["fields"], 0, $featured_pos), $custom_field[0], array_slice($this->content[$form_name]["fields"], $featured_pos, $count)); //v($custom_field); } else { $custom_field = array(); } // Excerpt Field if (qa_opt('it_excerpt_field_enable')) { if ($this->template == 'ask') { $excerpt_pos = (int) qa_opt('it_excerpt_pos_ask'); $excerit_text = ''; } else { $postid = $this->content["q_view"]["raw"]["postid"]; require_once QA_INCLUDE_DIR . 'qa-db-metas.php'; $excerpt_pos = (int) qa_opt('it_excerpt_pos_edit'); $excerit_text = qa_db_postmeta_get($postid, 'et_excerpt_text'); } } // Category Field if (qa_opt('it_cat_advanced_enable')) { if ($this->template == 'ask') { $category_pos = (int) qa_opt('it_cat_pos_ask'); //$field_value = qa_post_text('q_category'); } else { $category_pos = (int) qa_opt('it_cat_pos_edit'); } if (empty($this->content["q_view"]["raw"]["categoryid"])) { $this->content[$form_name]['fields']['category']['value'] = ''; } $this->content[$form_name]['fields']['category']['type'] = 'text'; $this->content[$form_name]['fields']['category']['label'] = ''; $this->content[$form_name]['fields']['category']['tags'] = 'name="q_category" id="category_tag" autocomplete="off" onkeyup="qa_cat_tag_hints();" onmouseup="qa_cat_tag_hints();"'; $this->content[$form_name]['fields']['category']['note_force'] = true; $custom_field[1]['category_tag_holder']['label'] = 'This tip is about:'; $custom_field[1]['category_tag_holder']['html'] = '<div id="category_tag_holder"></div>'; $custom_field[1]['category_tag_holder']['type'] = 'custom'; } else { $custom_field[1] = array(); $category_pos = 0; } // order of form elements $count = count($this->content[$form_name]["fields"]); $this->content[$form_name]["fields"] = array_merge(array_slice($this->content[$form_name]["fields"], 0, $category_pos), $custom_field[1], array_slice($this->content[$form_name]["fields"], $category_pos, $count)); // Excerpt Custom Fields if (qa_opt('it_excerpt_field_enable')) { $custom_field = array(); $custom_field[0]['excerpt']['label'] = 'Add Excerpt'; $custom_field[0]['excerpt']['html'] = ' <textarea name="q-excerpt" id="excerpt-input-placeholder" class="qa-form-tall-text" cols="40" rows="3" name="excerpt-input-placeholder" placeholder="If you add an excerpt it will be used in lists">' . $excerit_text . '</textarea> '; $custom_field[0]['excerpt']['type'] = 'custom'; $count = count($this->content[$form_name]["fields"]); $this->content[$form_name]["fields"] = array_merge(array_slice($this->content[$form_name]["fields"], 0, $excerpt_pos), $custom_field[0], array_slice($this->content[$form_name]["fields"], $excerpt_pos, $count)); } } }
function post_avatar($post, $class, $prefix = null) { if (qa_opt('it_layout_lists') == 'qlist') { qa_html_theme_base::post_avatar($post, $class, $prefix = null); return; } // check if it's a question list or question item if ($class != 'qa-q-item') { //if (!( ($this->template=='qa') or ($this->template=='questions') )) qa_html_theme_base::post_avatar($post, $class, $prefix); } else { $qlink = qa_q_path($post['raw']['postid'], $post['raw']['title'], true); $this->output('<div class="q-item-meta">'); // set avatar if (isset($post['avatar'])) { if (isset($prefix)) { $this->output($prefix); } $this->output('<section class="' . $class . '-avatar">' . $post['avatar']); $this->output('<section class="popup-user-avatar">'); qa_html_theme_base::post_meta_what($post, $class); qa_html_theme_base::post_meta_who($post, $class); $this->output('</section>'); $this->output('</section>'); } // set category if ($post["raw"]["categoryid"]) { require_once QA_INCLUDE_DIR . 'qa-db-metas.php'; $categoryid = $post["raw"]["categoryid"]; $catname = $post["raw"]["categoryname"]; $catbackpath = $post["raw"]["categorybackpath"]; $et_category = json_decode(qa_db_categorymeta_get($categoryid, 'et_category'), true); $this->output('<section class="' . $class . '-category">'); $categorypathprefix = 'questions/'; $this->output('<a class="' . $class . '-category-link" title="' . $et_category['et_cat_title'] . '" href="' . qa_path_html($categorypathprefix . implode('/', array_reverse(explode('/', $catbackpath)))) . '">'); if (!empty($et_category['et_cat_icon48'])) { $this->output('<img class="qa-category-image" width="48" height="48" alt="' . $et_category['et_cat_desc'] . '" src="' . $et_category['et_cat_icon48'] . '">'); } else { $this->output(qa_html($catname)); } $this->output('</a>'); if (!empty($et_category['et_cat_desc'])) { $this->output('<section class="' . $class . '-category-description">'); $this->output($et_category['et_cat_desc']); $this->output('</section>'); } $this->output('</section>'); } $this->output('</div>'); $this->output('<div class="qa-item-meta-bar">'); // Voting $this->voting_inner_html($post); // favourites if (qa_is_logged_in()) { $favourited = $post['favourited']; $favorite = qa_favorite_form(QA_ENTITY_QUESTION, $post['raw']['postid'], $favourited, qa_lang($favourited ? 'question/remove_q_favorites' : 'question/add_q_favorites')); if (isset($favorite)) { //$this->output('<form '.$favorite['form_tags'].'>'); $this->output('<div class="qa-favoriting qa-favoriting-' . $post['raw']['postid'] . '" ' . @$favorite['favorite_tags'] . '>'); $this->favorite_inner_html($favorite, $post['favourites']); $this->output('</div>'); $this->output('<input type="hidden" id="fav_code_' . $post['raw']['postid'] . '" name="fav_code" value="' . @$favorite['form_hidden']['code'] . '"/>'); //$this->output('</form>'); } } else { $this->output('<div class="qa-favoriting qa-favoriting-' . $post['raw']['postid'] . '" ' . @$favorite['favorite_tags'] . '>'); $this->output('<button class="btn btn-default btn-xs fa fa-heart qa-favorite" type="button" onclick="return qa_favorite_click(this);" name="favorite-login_q' . $post['raw']['postid'] . '" title="Favourite">' . $post['favourites'] . '</button>'); //<button class="btn btn-default btn-xs fa fa-heart qa-favorite" type="button" onclick="return qa_favorite_click(this);" name="favorite_Q_125_1" title="Add to my favorites">2</button> $this->output('</div>'); } // discussions $this->output('<div class="qa-list-discussions">'); $this->output('<a class="btn btn-default btn-xs fa fa-comment discussions-item-list" href="' . $qlink . '">' . ($post['comments'] + $post["answers_raw"]) . '</a>'); $this->output('</div>'); // Share $this->output('<div class="qa-list-share">'); $this->output('<button type="button" class="btn btn-default btn-xs fa fa-share-alt share-item-list" data-share-link="' . $qlink . '" data-share-title="' . $post['raw']['title'] . '"></button>'); $this->output('</div>'); $this->output('</div>'); } //qa_html_theme_base::voting_inner_html($post); }