Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-link-form.php

    r39537 r42343  
    88
    99// don't load directly
    10 if ( !defined('ABSPATH') )
    11     die('-1');
     10if ( ! defined( 'ABSPATH' ) ) {
     11    die( '-1' );
     12}
    1213
    13 if ( ! empty($link_id) ) {
    14     $heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' );
    15     $submit_text = __('Update Link');
    16     $form_name = 'editlink';
     14if ( ! empty( $link_id ) ) {
     15    $heading      = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' );
     16    $submit_text  = __( 'Update Link' );
     17    $form_name    = 'editlink';
    1718    $nonce_action = 'update-bookmark_' . $link_id;
    1819} else {
    19     $heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' );
    20     $submit_text = __('Add Link');
    21     $form_name = 'addlink';
     20    $heading      = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' );
     21    $submit_text  = __( 'Add Link' );
     22    $form_name    = 'addlink';
    2223    $nonce_action = 'add-bookmark';
    2324}
     
    2526require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
    2627
    27 add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', null, 'side', 'core');
    28 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', null, 'normal', 'core');
    29 add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', null, 'normal', 'core');
    30 add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', null, 'normal', 'core');
    31 add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', null, 'normal', 'core');
     28add_meta_box( 'linksubmitdiv', __( 'Save' ), 'link_submit_meta_box', null, 'side', 'core' );
     29add_meta_box( 'linkcategorydiv', __( 'Categories' ), 'link_categories_meta_box', null, 'normal', 'core' );
     30add_meta_box( 'linktargetdiv', __( 'Target' ), 'link_target_meta_box', null, 'normal', 'core' );
     31add_meta_box( 'linkxfndiv', __( 'Link Relationship (XFN)' ), 'link_xfn_meta_box', null, 'normal', 'core' );
     32add_meta_box( 'linkadvanceddiv', __( 'Advanced' ), 'link_advanced_meta_box', null, 'normal', 'core' );
    3233
    3334/** This action is documented in wp-admin/edit-form-advanced.php */
     
    5051do_action( 'do_meta_boxes', 'link', 'side', $link );
    5152
    52 add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
     53add_screen_option(
     54    'layout_columns', array(
     55        'max'     => 2,
     56        'default' => 2,
     57    )
     58);
    5359
    54 get_current_screen()->add_help_tab( array(
    55     'id'      => 'overview',
    56     'title'   => __('Overview'),
    57     'content' =>
    58     '<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link&#8217;s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' .
    59     '<p>' . __( 'The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don&#8217;t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' .
    60     '<p>' . __( 'XFN stands for <a href="http://gmpg.org/xfn/">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.' ) . '</p>'
    61 ) );
     60get_current_screen()->add_help_tab(
     61    array(
     62        'id'      => 'overview',
     63        'title'   => __( 'Overview' ),
     64        'content' =>
     65        '<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link&#8217;s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' .
     66        '<p>' . __( 'The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don&#8217;t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' .
     67        '<p>' . __( 'XFN stands for <a href="http://gmpg.org/xfn/">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.' ) . '</p>',
     68    )
     69);
    6270
    6371get_current_screen()->set_help_sidebar(
     
    7179
    7280<div class="wrap">
    73 <h1 class="wp-heading-inline"><?php
     81<h1 class="wp-heading-inline">
     82<?php
    7483echo esc_html( $title );
    75 ?></h1>
     84?>
     85</h1>
    7686
    7787<a href="link-add.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'link' ); ?></a>
     
    8090
    8191<?php if ( isset( $_GET['added'] ) ) : ?>
    82 <div id="message" class="updated notice is-dismissible"><p><?php _e('Link added.'); ?></p></div>
     92<div id="message" class="updated notice is-dismissible"><p><?php _e( 'Link added.' ); ?></p></div>
    8393<?php endif; ?>
    8494
     
    91101wp_nonce_field( $nonce_action );
    92102wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
    93 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
     103wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
     104?>
    94105
    95106<div id="poststuff">
     
    98109<div id="post-body-content">
    99110<div id="namediv" class="stuffbox">
    100 <h2><label for="link_name"><?php _ex( 'Name', 'link name' ) ?></label></h2>
     111<h2><label for="link_name"><?php _ex( 'Name', 'link name' ); ?></label></h2>
    101112<div class="inside">
    102     <input type="text" name="link_name" size="30" maxlength="255" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" />
    103     <p><?php _e('Example: Nifty blogging software'); ?></p>
     113    <input type="text" name="link_name" size="30" maxlength="255" value="<?php echo esc_attr( $link->link_name ); ?>" id="link_name" />
     114    <p><?php _e( 'Example: Nifty blogging software' ); ?></p>
    104115</div>
    105116</div>
    106117
    107118<div id="addressdiv" class="stuffbox">
    108 <h2><label for="link_url"><?php _e( 'Web Address' ) ?></label></h2>
     119<h2><label for="link_url"><?php _e( 'Web Address' ); ?></label></h2>
    109120<div class="inside">
    110     <input type="text" name="link_url" size="30" maxlength="255" class="code" value="<?php echo esc_attr($link->link_url); ?>" id="link_url" />
    111     <p><?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?></p>
     121    <input type="text" name="link_url" size="30" maxlength="255" class="code" value="<?php echo esc_attr( $link->link_url ); ?>" id="link_url" />
     122    <p><?php _e( 'Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>' ); ?></p>
    112123</div>
    113124</div>
    114125
    115126<div id="descriptiondiv" class="stuffbox">
    116 <h2><label for="link_description"><?php _e( 'Description' ) ?></label></h2>
     127<h2><label for="link_description"><?php _e( 'Description' ); ?></label></h2>
    117128<div class="inside">
    118     <input type="text" name="link_description" size="30" maxlength="255" value="<?php echo isset($link->link_description) ? esc_attr($link->link_description) : ''; ?>" id="link_description" />
    119     <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p>
     129    <input type="text" name="link_description" size="30" maxlength="255" value="<?php echo isset( $link->link_description ) ? esc_attr( $link->link_description ) : ''; ?>" id="link_description" />
     130    <p><?php _e( 'This will be shown when someone hovers over the link in the blogroll, or optionally below the link.' ); ?></p>
    120131</div>
    121132</div>
     
    134145<?php
    135146
    136 do_meta_boxes(null, 'normal', $link);
     147do_meta_boxes( null, 'normal', $link );
    137148
    138 do_meta_boxes(null, 'advanced', $link);
     149do_meta_boxes( null, 'advanced', $link );
    139150
    140151?>
     
    142153<?php
    143154
    144 if ( $link_id ) : ?>
     155if ( $link_id ) :
     156?>
    145157<input type="hidden" name="action" value="save" />
    146158<input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
    147 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
    148 <?php else: ?>
     159<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id; ?>" />
     160<?php else : ?>
    149161<input type="hidden" name="action" value="add" />
    150162<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.