name = 'fonts'; $this->slug = 'fonts'; $this->type = 'extension'; $this->category = 'basic'; $this->public = false; $this->enabled = false; } /** * Initialize module */ public function initialize() { add_action( 'admin_menu', array( $this, 'register_options_page' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); add_filter( 'powerkit_fonts_choices', array( $this, 'kirki_fonts_choices' ) ); } /** * Register admin page * * @since 1.0.0 */ public function register_options_page() { add_theme_page( esc_html__( 'Fonts', 'powerkit' ), esc_html__( 'Fonts', 'powerkit' ), 'manage_options', powerkit_get_page_slug( $this->slug ), array( $this, 'settings_page' ) ); } /** * Build admin page * * @since 1.0.0 */ public function settings_page() { powerkit_uuid_hash(); // Check wpnonce. if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'] ) ) { // Input var ok; sanitization ok. return; } if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'You do not have sufficient rights to view this page.', 'powerkit' ) ); } ?>


array( 'google' => array(), 'families' => isset( $fonts_list['families'] ) ? $fonts_list['families'] : null, 'variants' => isset( $fonts_list['variants'] ) ? $fonts_list['variants'] : null, ), ); $fonts_settings = array_merge( (array) $fonts_settings, (array) $settings ); return $fonts_settings; } /** * Register the stylesheets and JavaScript for the admin area. * * @param string $page Current page. */ public function admin_enqueue_scripts( $page ) { if ( 'appearance_page_' . powerkit_get_page_slug( $this->slug ) === $page ) { wp_enqueue_media(); wp_enqueue_script( 'admin-powerkit-fonts', plugin_dir_url( __FILE__ ) . 'js/admin-powerkit-fonts.js', array( 'jquery' ), powerkit_get_setting( 'version' ), false ); wp_localize_script( 'admin-powerkit-fonts', 'powerkitFonts', array( 'delete' => esc_html__( 'Are you sure you want to delete this font and all the files downloaded from it?', 'powerkit' ), 'title' => esc_html__( 'Select or Upload Font', 'powerkit' ), 'button' => esc_html__( 'Use This File', 'powerkit' ), ) ); } } } new Powerkit_Fonts(); }