久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

返回列表 發帖
查看: 826|回復: 1

[求助] 關于前端鉤子 按鈕顯示的問題 大佬們幫我看看 哪個地方有有問題

53

主題

280

回帖

390

積分

應用開發者

貢獻
7 點
金幣
9 個
QQ
樓主
發表于 2024-9-8 00:35:24 | 只看樓主 |倒序瀏覽 |閱讀模式
關于前端鉤子 按鈕顯示的問題 大佬們幫我看看 哪個地方有問題

最終想顯示的是
發帖框頂部 發帖框中部 發帖框底部 還有 帖子和列表頁的  快速回復區域顯示

xml文件里面的代碼
  1. <item id="hooks">
  2.     <item id="post_top">
  3.         <item id="qier_thread_top"><![CDATA[qier_thread_post_top]]></item>
  4.     </item>
  5.     <item id="post_middle">
  6.         <item id="qier_thread_middle"><![CDATA[qier_thread_post_middle]]></item>
  7.     </item>
  8.     <item id="post_bottom">
  9.         <item id="qier_thread_button"><![CDATA[qier_thread_post_button]]></item>
  10.     </item>
  11.     <item id="viewthread_fastpost_content">
  12.         <item id="qier_thread_viewthread_fastpost_content"><![CDATA[qier_thread_viewthread_fastpost_content]]></item>
  13.     </item>
  14.     <item id="forumdisplay_postbutton_bottom">
  15.         <item id="qier_thread_forumdisplay_postbutton_bottom"><![CDATA[qier_thread_forumdisplay_postbutton_bottom]]></item>
  16.     </item>
  17. </item>
復制代碼
class.php里面的代碼
  1. <?php
  2. if(!defined('IN_DISCUZ')) {
  3.     exit('Access Denied');
  4. }

  5. class plugin_qier_thread {
  6.     public function post_top() {
  7.         if (!$this->is_plugin_enabled()) return '';
  8.         return $this->qier_thread_button('post_top');
  9.     }

  10.     public function post_middle() {
  11.         if (!$this->is_plugin_enabled()) return '';
  12.         return $this->qier_thread_button('post_middle');
  13.     }

  14.     public function post_bottom() {
  15.         if (!$this->is_plugin_enabled()) return '';
  16.         return $this->qier_thread_button('post_bottom');
  17.     }

  18.     public function viewthread_fastpost_content() {
  19.         if (!$this->is_plugin_enabled()) return '';
  20.         global $_G;
  21.         if($_G['cache']['plugin']['qier_thread']['show_in_fastpost']) {
  22.             return $this->_get_button_html();
  23.         }
  24.         return '';
  25.     }

  26.     public function global_header() {
  27.         if (!$this->is_plugin_enabled()) return;
  28.         global $_G;
  29.         $button_position = $this->get_button_position();
  30.         $button_text = $_G['cache']['plugin']['qier_thread']['custom_button_text'] ?: lang('plugin/qier_thread', 'qier_thread_generate_article');
  31.         
  32.         // 只在發帖頁面顯示按鈕
  33.         if(CURSCRIPT == 'forum' && (CURMODULE == 'post' || CURMODULE == 'viewthread')) {
  34.             include template('qier_thread:qier_thread_post');
  35.         }
  36.     }

  37.     public function forumdisplay_postbutton_bottom() {
  38.         if (!$this->is_plugin_enabled()) return '';
  39.         global $_G;
  40.         if($_G['cache']['plugin']['qier_thread']['show_in_fastpost']) {
  41.             return $this->_get_button_html();
  42.         }
  43.         return '';
  44.     }

  45.     private function qier_thread_button($position) {
  46.         global $_G;
  47.         
  48.         $enable = $_G['cache']['plugin']['qier_thread']['enable'];
  49.         $button_position = $_G['cache']['plugin']['qier_thread']['button_position'];
  50.         
  51.         if (!$enable) {
  52.             return '';
  53.         }
  54.         
  55.         $position_map = [
  56.             'post_top' => '1',
  57.             'post_middle' => '2',
  58.             'post_bottom' => '3'
  59.         ];
  60.         
  61.         if ($button_position !== $position_map[$position]) {
  62.             return '';
  63.         }
  64.         
  65.         return $this->get_button_html();
  66.     }

  67.     private function _get_button_html() {
  68.         global $_G;
  69.         $button_text = $_G['cache']['plugin']['qier_thread']['custom_button_text'] ?: '這是個按鈕';
  70.         include template('qier_thread:button');
  71.         return $return;
  72.     }

  73.     private function get_button_html() {
  74.         $css_url = 'source/plugin/qier_thread/static/css/style.css';
  75.         $js_url = 'source/plugin/qier_thread/static/js/qier_thread.js';
  76.         
  77.         $output = '<link rel="stylesheet" type="text/css" href="' . $css_url . '" />';
  78.         $output .= '<script type="text/javascript" src="' . $js_url . '"></script>';
  79.         
  80.         $button = '<button type="button" id="qier_thread_button" class="qier-thread-button">';
  81.         $button .= '<span class="qier-thread-icon"></span>';
  82.         $button .= '<span class="qier-thread-text">' . $button_text . '</span>';
  83.         $button .= '</button>';
  84.         
  85.         return $output . $button;
  86.     }

  87.     private function get_position_for_hook($hook) {
  88.         switch ($hook) {
  89.             case 'post_top': return 1;
  90.             case 'post_middle': return 2;
  91.             case 'post_bottom': return 3;
  92.             default: return 0;
  93.         }
  94.     }

  95.     public function get_button_position() {
  96.         global $_G;
  97.         return $_G['cache']['plugin']['qier_thread']['button_position'];
  98.     }

  99.     private function is_plugin_enabled() {
  100.         global $_G;
  101.         return !empty($_G['cache']['plugin']['qier_thread']['enable']);
  102.     }
  103. }
復制代碼


試過好多方案  就是不能正常的顯示出按鈕 查看網頁源代碼 也沒用相關插件的js或者css文件路徑

也就是說沒啟動插件

不知道什么原因【上面的代碼是改了好幾種方案的其中一種了 都不顯示】

日志全開  日志頁抓不到。

我知道答案 回答被采納將會獲得1 貢獻 已有1人回答
回復

使用道具 舉報

19

主題

911

回帖

1036

積分

已臻大成

貢獻
12 點
金幣
15 個
QQ
沙發
發表于 2024-9-15 08:40:34 | 只看Ta
綜合法務服務,這個網站,我看看唄
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

  • 關注公眾號
  • 有償服務微信
  • 有償服務QQ

手機版|小黑屋|Discuz! 官方交流社區 ( 皖ICP備16010102號 |皖公網安備34010302002376號 )|網站地圖|star

GMT+8, 2025-7-2 19:14 , Processed in 0.046070 second(s), 12 queries , Redis On.

Powered by Discuz! W1.0 Licensed

Cpoyright © 2001-2025 Discuz! Team.

關燈 在本版發帖
有償服務QQ
有償服務微信
返回頂部
快速回復 返回頂部 返回列表