'; echo 'i.mce-i-rt_tpg_scg{'; echo "background: url('" . esc_url( rtTPG()->get_assets_uri( 'images/icon-20x20.png' ) ) . "');"; echo '}'; echo ''; } } /** * Adds tinymce plugin * * @param array $plugin_array Plugins. * * @return array */ public function mce_external_plugins( $plugin_array ) { $plugin_array[ $this->sc_tag ] = rtTPG()->get_assets_uri( 'js/mce-button.js' ); return $plugin_array; } /** * Adds tinymce button * * @param array $buttons Buttons. * * @return array */ public function mce_buttons( $buttons ) { array_push( $buttons, $this->sc_tag ); return $buttons; } /** * Pro alert * * @return void */ public function pro_alert_html() { global $typenow; if ( rtTPG()->hasPro() ) { return; } if ( ( isset( $_GET['page'] ) && 'rttpg_settings' !== $_GET['page'] ) || rtTPG()->post_type !== $typenow ) { return; } $html = ''; $html .= '

' . esc_html__( 'Pro field alert!', 'the-post-grid' ) . '

' . esc_html__( 'Sorry! this is a Pro field. To use this field, you need to use Pro plugin.', 'the-post-grid' ) . '

' . esc_html__( 'Upgrade to Pro', 'the-post-grid' ) . ' x
'; Fns::print_html( $html ); } /** * Dequeue styles * * @return void */ public function tpg_dequeue_unnecessary_styles() { $settings = get_option( rtTPG()->options['settings'] ); if ( isset( $settings['tpg_skip_fa'] ) ) { wp_dequeue_style( 'rt-fontawsome' ); wp_deregister_style( 'rt-fontawsome' ); } } /** * Admin scripts * * @return void */ public function settings_admin_enqueue_scripts() { global $pagenow, $typenow; if ( ! in_array( $pagenow, [ 'edit.php' ], true ) ) { return; } if ( rtTPG()->post_type !== $typenow ) { return; } wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'rt-tpg-admin' ); // styles. wp_enqueue_style( 'rt-tpg-admin' ); $nonce = wp_create_nonce( rtTPG()->nonceText() ); wp_localize_script( 'rt-tpg-admin', 'rttpg', [ 'nonceID' => esc_attr( rtTPG()->nonceId() ), 'nonce' => esc_attr( $nonce ), 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ), ] ); } /** * Marketing * * @param array $links Links. * @return array */ public function marketing( $links ) { $links[] = 'Demo'; $links[] = 'Documentation'; if ( ! rtTPG()->hasPro() ) { $links[] = 'Get Pro'; } return $links; } /** * Submenu * * @return void */ public function register() { add_submenu_page( 'edit.php?post_type=' . rtTPG()->post_type, esc_html__( 'Settings', 'the-post-grid' ), esc_html__( 'Settings', 'the-post-grid' ), 'administrator', 'rttpg_settings', [ $this, 'settings' ] ); add_submenu_page( 'edit.php?post_type=' . rtTPG()->post_type, esc_html__( 'Get Help', 'the-post-grid' ), esc_html__( 'Get Help', 'the-post-grid' ), 'administrator', 'rttpg_get_help', [ $this, 'get_help' ] ); } /** * Get help view * * @return void */ public function get_help() { Fns::view( 'page.help' ); } /** * Settings view * * @return void */ public function settings() { Fns::view( 'settings.settings' ); } }