post_type || false !== strpos( (string) $screen->id, Wp360_Shortlink_Service_Admin_Page::SLUG ); } public static function add_meta_boxes() { add_meta_box( 'wp360-sl-target', __( 'Shortlink', '360-orbit-shortlink-service' ), array( __CLASS__, 'render_target_box' ), Wp360_Shortlink_Service_Post_Type::POST_TYPE, 'normal', 'high' ); } /** * @param string $title Vorgabetext des Titelfelds. * @param WP_Post $post Aktueller Beitrag. * @return string */ public static function title_placeholder( $title, $post ) { if ( $post && Wp360_Shortlink_Service_Post_Type::POST_TYPE === $post->post_type ) { return __( 'Name of the link (for your own overview)', '360-orbit-shortlink-service' ); } return $title; } /** * Quick-Edit liesse den Slug und den Titel an der Maske vorbei aendern. * * @param bool $enabled Ob Quick-Edit angeboten wird. * @param string $post_type Beitragstyp. * @return bool */ public static function disable_quick_edit( $enabled, $post_type ) { return Wp360_Shortlink_Service_Post_Type::POST_TYPE === $post_type ? false : $enabled; } /** * @param WP_Post $post Aktueller Shortlink. */ public static function render_target_box( $post ) { $slug = Wp360_Shortlink_Service_Post_Type::get_slug( $post->ID ); $url = Wp360_Shortlink_Service_Post_Type::get_target_url( $post->ID ); wp_nonce_field( Wp360_Shortlink_Service_Post_Type::URL_NONCE_ACTION, Wp360_Shortlink_Service_Post_Type::URL_NONCE_FIELD ); ?>

%2$s

', esc_attr( $type ), esc_html( $notice['message'] ) ); } if ( '' === (string) get_option( 'permalink_structure' ) ) { printf( '

%1$s %3$s

', esc_html__( 'Short links only work with pretty permalinks. Your site currently uses the "Plain" structure, so /shortlinks/… will show a 404 page.', '360-orbit-shortlink-service' ), esc_url( admin_url( 'options-permalink.php' ) ), esc_html__( 'Change permalinks', '360-orbit-shortlink-service' ) ); } } /** * @param string $hook Aktuelle Admin-Seite. */ public static function enqueue_assets( $hook ) { if ( ! self::is_plugin_screen() ) { return; } wp_enqueue_style( 'wp360-sl-admin', WP360_SL_URL . 'assets/admin.css', array(), WP360_SL_VERSION ); wp_enqueue_script( 'wp360-sl-admin', WP360_SL_URL . 'assets/admin.js', array(), WP360_SL_VERSION, true ); wp_localize_script( 'wp360-sl-admin', 'wp360ShortlinkService', array( 'strings' => array( 'copied' => __( 'Copied', '360-orbit-shortlink-service' ), 'copyFailed' => __( 'Press Ctrl+C to copy', '360-orbit-shortlink-service' ), ), ) ); } }