选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
(.*?)<\/[hH][1-6].*?>/us', $content, $headers); $header_count = count($headers[0]); if($top_level < 1){$top_level = 1;} if($top_level > 6){$top_level = 6;} $current_depth = $top_level - 1; $prev_depth = $top_level - 1; $max_depth = (($depth == 0) ? 6 : intval($depth)) - $top_level + 1; if($header_count > 0){ $toc_list .= '<' . $list_tag . (($current_depth == $top_level - 1) ? ' class="toc-list open"' : '') . '>'; } for($i=0;$i < $header_count;$i++){ $depth = 0; switch(strtolower($headers[1][$i])){ case 'h1': $depth = 1 - $top_level + 1; break; case 'h2': $depth = 2 - $top_level + 1; break; case 'h3': $depth = 3 - $top_level + 1; break; case 'h4': $depth = 4 - $top_level + 1; break; case 'h5': $depth = 5 - $top_level + 1; break; case 'h6': $depth = 6 - $top_level + 1; break; } if($depth >= 1 && $depth <= $max_depth){ if($current_depth == $depth && $i != 0){ $toc_list .= ''; $counters[$current_depth - 1] ++; } while($current_depth > $depth){ $toc_list .= ''; $current_depth--; $counters[$current_depth] = 0; $counters[$current_depth - 1] ++; } if($current_depth != $prev_depth){ $toc_list .= ''; $counters[$current_depth - 1] ++; } while($current_depth < $depth){ $toc_list .= '<'.$list_tag.'>'; $current_depth++; $counters[$current_depth - 1] ++; } $hide_class = null; if ( $depth_option != 0 && $depth >= $depth_option ) { $hide_class = ' class="display-none"'; } $counter++; $text = strip_tags($headers[2][$i]); if (is_toc_heading_inner_html_tag_enable()) { $text = $headers[2][$i]; $text = preg_replace('{(.*?)}', "$1", $text); } $toc_list .= '' . $text . ''; $prev_depth = $depth; } } while($current_depth >= 1 ){ $toc_list .= ''; $current_depth--; } /////////////////////////////////////////// // 目次タグの生成 /////////////////////////////////////////// if($id!==''){$id = ' id="' . $id . '"';}else{$id = '';} if (is_toc_toggle_switch_enable()) { $checked = null; $is_visible = apply_filters('is_toc_content_visible', is_toc_content_visible()); if ($is_visible) { $checked = ' checked'; } $title_elm = 'label'; // if ($is_widget) { // $toc_check = null; // $label_for = null; // } else { // global $_TOC_INDEX; // $toc_id = 'toc-checkbox-'.$_TOC_INDEX; // $toc_check = ''; // $label_for = ' for="'.$toc_id.'"'; // $_TOC_INDEX++; // } global $_TOC_INDEX; $toc_id = 'toc-checkbox-'.$_TOC_INDEX; $toc_check = ''; $label_for = ' for="'.$toc_id.'"'; $_TOC_INDEX++; } else { $title_elm = 'div'; $toc_check = null; $label_for = null; } $html .= ' '.$toc_check. '<'.$title_elm.' class="toc-title"'.$label_for.'>' . $title . '
' . $toc_list .'
'; global $_TOC_AVAILABLE_H_COUNT; $_TOC_AVAILABLE_H_COUNT = $counter; if (!is_toc_display_count_available($counter)){ return ; } return apply_filters('get_toc_tag',$html, $harray, $is_widget ); } endif; if ( !function_exists( 'is_total_the_page_toc_visible' ) ): function is_total_the_page_toc_visible(){ //プラグインのフォーラムページの場合 if (is_plugin_fourm_page()) { return false; } //投稿・固定・カテゴリー・タブページでない場合 if (!is_singular() && !is_category() && !is_tag()) { return false; } //目次が非表示の場合 if (!is_toc_visible()) { return false; } //投稿ページだと表示しない if (!is_single_toc_visible() && is_single()) { return false; } //固定ページだと表示しない if (!is_page_toc_visible() && is_page()) { return false; } //カテゴリーページだと表示しない if (!is_category_toc_visible() && is_category()) { return false; } //タグページだと表示しない if (!is_tag_toc_visible() && is_tag()) { return false; } //投稿ページで非表示になっていると表示しない if (!is_the_page_toc_visible()) { return false; } return true; } endif; //最初のH2タグの前に目次を挿入する //ref:https://qiita.com/wkwkrnht/items/c2ee485ff1bbd81325f9 add_filter('the_content', 'add_toc_before_1st_h2', get_toc_filter_priority()); add_filter('the_category_content', 'add_toc_before_1st_h2', get_toc_filter_priority()); add_filter('the_tag_content', 'add_toc_before_1st_h2', get_toc_filter_priority()); if ( !function_exists( 'add_toc_before_1st_h2' ) ): function add_toc_before_1st_h2($the_content){ global $_TOC_WIDGET_OR_SHORTCODE_USED; //Table of Contents Plusプラグインが有効な際は目次機能は無効 if (class_exists( 'toc' )) { return $the_content; } //プラグインのフォーラムページの場合は目次機能は無効 if (is_plugin_fourm_page()) { return $the_content; } //ページ上で目次が非表示設定(ショートコードも未使用)になっている場合 if (!is_total_the_page_toc_visible() && !$_TOC_WIDGET_OR_SHORTCODE_USED && !is_active_widget( false, false, 'toc', true )) { return $the_content; } $harray = array(); $depth = intval(get_toc_depth()); //2-6 0で全て $set_depth = $depth;// if (intval($set_depth) == 0) { $set_depth = 6; } $html = get_toc_tag($the_content, $harray); //目次タグが出力されない(目次が不要)時は、そのまま本文を返す if (!$html) { return $the_content; } /////////////////////////////////////// // PHPの見出し処理(条件によっては失敗するかも) /////////////////////////////////////// $res = preg_match_all('/(<('.implode('|', $harray).')[^>]*?>)(.*?)(<\/h[2-6]>)/is', $the_content, $m); $tag_all_index = 0; $tag_index = 1; $h_index = 2; $h_content_index = 3; $tag_end_index = 4; if ($res && $m[0]) { $i = 0; $count = 1; foreach ($m[$tag_all_index] as $value) { //var_dump($m[0][$i]); $tag_all = $m[$tag_all_index][$i]; $tag = $m[$tag_index][$i]; $h = $m[$h_index][$i]; $h_content = get_h_inner_content($m[$h_content_index][$i]); $tag_end = $m[$tag_end_index][$i]; $now_depth = intval(str_replace('h', '', $h)); //設定より見出しが深い場合はスキップ if ($set_depth < $now_depth) { $i++; continue; } $new = $tag.''.$h_content.''.$tag_end; $the_content = preg_replace('/'.preg_quote($value, '/').'/', $new, $the_content, 1); $i++; $count++; } } //機能が有効な時のみ(ショートコードでは実行しない) if (is_total_the_page_toc_visible()) { $h2result = get_h2_included_in_body( $the_content );//本文にH2タグが含まれていれば取得 $html = str_replace('