男的舔女的下面视频在线播放-少妇愉情理仑片高潮日本-久久久久久国产一区二区三区-麻豆精品一区二区综合-国产精品超碰在线观看-网红极品女神精品视频在线-国产亚洲综合777-高清性视频一区二区播放-中文字幕第一页亚洲天堂

返回列表 發(fā)帖
查看: 1280|回復(fù): 1

[求助] 關(guān)于前端鉤子 按鈕顯示的問(wèn)題 大佬們幫我看看 哪個(gè)地方有有問(wèn)題

68

主題

295

回帖

1

粉絲

應(yīng)用開(kāi)發(fā)者

貢獻(xiàn)
7 點(diǎn)
金幣
9 個(gè)
QQ
樓主
發(fā)表于 2024-9-8 00:35:24 |安徽| 只看樓主 |倒序?yàn)g覽 |閱讀模式
關(guān)于前端鉤子 按鈕顯示的問(wèn)題 大佬們幫我看看 哪個(gè)地方有問(wèn)題

最終想顯示的是
發(fā)帖框頂部 發(fā)帖框中部 發(fā)帖框底部 還有 帖子和列表頁(yè)的  快速回復(fù)區(qū)域顯示

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>
復(fù)制代碼
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.         // 只在發(fā)帖頁(yè)面顯示按鈕
  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'] ?: '這是個(gè)按鈕';
  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. }
復(fù)制代碼


試過(guò)好多方案  就是不能正常的顯示出按鈕 查看網(wǎng)頁(yè)源代碼 也沒(méi)用相關(guān)插件的js或者css文件路徑

也就是說(shuō)沒(méi)啟動(dòng)插件

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

日志全開(kāi)  日志頁(yè)抓不到。

我知道答案 回答被采納將會(huì)獲得1 貢獻(xiàn) 已有1人回答
回復(fù)

使用道具 舉報(bào)

21

主題

1025

回帖

1

粉絲

已臻大成

貢獻(xiàn)
16 點(diǎn)
金幣
17 個(gè)
QQ
沙發(fā)
發(fā)表于 2024-9-15 08:40:34 |遼寧| 只看Ta
綜合法務(wù)服務(wù),這個(gè)網(wǎng)站,我看看唄
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

  • 關(guān)注公眾號(hào)
  • 有償服務(wù)微信
  • 有償服務(wù)QQ

手機(jī)版|小黑屋|Discuz! 官方交流社區(qū) ( 皖I(lǐng)CP備16010102號(hào) |皖公網(wǎng)安備34010302002376號(hào) )|網(wǎng)站地圖|star

GMT+8, 2026-4-14 17:43 , Processed in 0.044919 second(s), 13 queries , Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2026 Discuz! Team.

關(guān)燈 在本版發(fā)帖
有償服務(wù)QQ
有償服務(wù)微信
返回頂部
快速回復(fù) 返回頂部 返回列表