| @@ -1,15 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace WPDeveloper\BetterDocs\Core; |
| 3 | 4 | |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | - exit; | |
| 6 | -} | |
| 7 | - | |
| 8 | - | |
| 9 | 5 | use WPDeveloper\BetterDocs\Utils\Base; |
| 10 | 6 | use WPDeveloper\BetterDocs\Utils\Helper; |
| 11 | -use WPDeveloper\BetterDocs\FrontEnd\PrintTemplate; | |
| 12 | 7 | |
| 13 | 8 | class Scripts extends Base { |
| 14 | 9 | protected $settings; |
| 15 | 10 | |
| @@ -51,9 +46,8 @@ | ||
| 51 | 46 | $assets->register( 'betterdocs-pagination', 'public/css/pagination.css' ); |
| 52 | 47 | $assets->register( 'betterdocs-doc_category', 'public/css/tax-doc_category.css', [ 'betterdocs-breadcrumb', 'betterdocs-pagination' ] ); |
| 53 | 48 | $assets->register( 'betterdocs-category-archive-header', 'public/css/archive-header.css' ); |
| 54 | 49 | $assets->register( 'betterdocs-category-archive-doc-list', 'public/css/archive-doc-list.css' ); |
| 55 | - $assets->register( 'betterdocs-article-summary', 'public/css/article-summary.css' ); | |
| 56 | 50 | $assets->register( 'betterdocs-author', 'public/css/author.css' ); |
| 57 | 51 | |
| 58 | 52 | $assets->register( 'betterdocs-category-grid', 'public/css/category-grid.css', [ 'simplebar' ] ); |
| 59 | 53 | $assets->register( 'betterdocs-category-box', 'public/css/category-box.css' ); |
| @@ -77,25 +71,8 @@ | ||
| 77 | 71 | $assets->register( 'betterdocs-reactions', 'shortcodes/js/reactions.js', [ 'jquery' ] ); |
| 78 | 72 | $assets->register( 'betterdocs-search', 'shortcodes/js/search.js', [ 'jquery' ] ); |
| 79 | 73 | $assets->register( 'betterdocs-search-modal', 'shortcodes/js/search-modal.js', [ 'jquery' ] ); |
| 80 | 74 | |
| 81 | - /** | |
| 82 | - * Print template config for the single-doc Print / Save-as-PDF button. | |
| 83 | - * | |
| 84 | - * These values feed the print *popup* opened by the BetterDocs print | |
| 85 | - * icon. The browser's own Ctrl/Cmd+P route is handled separately by | |
| 86 | - * {@see PrintTemplate}, which resolves the same two values — see that | |
| 87 | - * class for why the two routes use different layout mechanisms. | |
| 88 | - * | |
| 89 | - * Both toggles live in `betterdocs_settings` (BetterDocs → Settings → | |
| 90 | - * Layout → Single Doc → General) rather than theme mods, so they stay | |
| 91 | - * reachable on block/FSE themes, which have no Customizer. Both default | |
| 92 | - * to OFF; while a toggle is off the value resolves empty and the print | |
| 93 | - * script renders nothing for it. | |
| 94 | - */ | |
| 95 | - $print_logo = PrintTemplate::get_logo(); | |
| 96 | - $print_footer = PrintTemplate::get_footer(); | |
| 97 | - | |
| 98 | 75 | $assets->localize( |
| 99 | 76 | 'betterdocs', |
| 100 | 77 | 'betterdocsConfig', |
| 101 | 78 | [ |
| @@ -100,15 +77,9 @@ | ||
| 100 | 77 | 'betterdocsConfig', |
| 101 | 78 | [ |
| 102 | 79 | 'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 103 | 80 | 'copy_text' => __( 'Copied', 'betterdocs' ), |
| 104 | - 'sticky_toc_offset' => $this->settings->get( 'sticky_toc_offset' ), | |
| 105 | - 'summary_nonce' => wp_create_nonce( 'betterdocs_article_summary_nonce' ), | |
| 106 | - 'summary_error' => __( 'Failed to generate doc summary. Please try again.', 'betterdocs' ), | |
| 107 | - 'print' => [ | |
| 108 | - 'logo' => $print_logo ? esc_url( $print_logo ) : '', | |
| 109 | - 'footer' => $print_footer ? wp_kses_post( $print_footer ) : '' | |
| 110 | - ] | |
| 81 | + 'sticky_toc_offset' => $this->settings->get( 'sticky_toc_offset' ) | |
| 111 | 82 | ] |
| 112 | 83 | ); |
| 113 | 84 | |
| 114 | 85 | $assets->localize( |
| @@ -143,33 +114,21 @@ | ||
| 143 | 114 | betterdocs()->assets->localize( |
| 144 | 115 | 'betterdocs-category-grid', |
| 145 | 116 | 'betterdocsCategoryGridConfig', |
| 146 | 117 | [ |
| 147 | - 'is_betterdocs_templates' => betterdocs()->helper->is_templates() ? true : false, | |
| 148 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), | |
| 149 | - 'lazy_load_action' => 'betterdocs_lazy_category_body' | |
| 118 | + 'is_betterdocs_templates' => betterdocs()->helper->is_templates() ? true : false | |
| 150 | 119 | ] |
| 151 | 120 | ); |
| 152 | 121 | |
| 153 | 122 | $this->blocks( $assets ); |
| 154 | - $this->admin_assets( $assets ); | |
| 155 | 123 | |
| 156 | 124 | return $assets; |
| 157 | 125 | } |
| 158 | 126 | |
| 159 | - | |
| 160 | - | |
| 161 | 127 | public function blocks( $assets ) { |
| 162 | 128 | $assets->register( 'betterdocs-fontawesome', 'vendor/css/font-awesome5.css' ); |
| 163 | 129 | $assets->register( 'betterdocs-blocks-category-box', 'blocks/categorybox/default.css' ); |
| 164 | 130 | $assets->register( 'betterdocs-blocks-category-grid', 'blocks/categorygrid/default.css' ); |
| 165 | - $assets->register( 'betterdocs-blocks-category-tech-layout', 'blocks/category-tech-layout/default.css' ); | |
| 166 | - $assets->register( 'betterdocs-blocks-category-slate-layout', 'blocks/category-slate-layout/default.css' ); | |
| 167 | 131 | $assets->register( 'betterdocs-feedback-form-editor', 'blocks/feedback-form/style-feedback-editor.css' ); |
| 168 | 132 | $assets->register( 'betterdocs-doc-archive-list', 'blocks/doc-archive-list/default.css' ); |
| 169 | - } | |
| 170 | - | |
| 171 | - public function admin_assets( $assets ) { | |
| 172 | - $assets->register( 'betterdocs-article-quality-score', 'admin/js/article-quality-score.js', [ 'jquery' ] ); | |
| 173 | - | |
| 174 | 133 | } |
| 175 | 134 | } |