2005-09-18 20:47:58 -04:00
< ? php
2008-08-16 03:27:34 -04:00
/**
* Edit links form for inclusion in administration panels .
*
* @ package WordPress
* @ subpackage Administration
*/
2009-08-02 20:04:45 -04:00
// don't load directly
2017-11-30 18:11:00 -05:00
if ( ! defined ( 'ABSPATH' ) ) {
die ( '-1' );
}
2009-08-02 20:04:45 -04:00
2017-11-30 18:11:00 -05:00
if ( ! empty ( $link_id ) ) {
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
/* translators: %s: URL to Links screen */
2017-11-30 18:11:00 -05:00
$heading = sprintf ( __ ( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' );
$submit_text = __ ( 'Update Link' );
$form_name = 'editlink' ;
2006-05-26 19:08:05 -04:00
$nonce_action = 'update-bookmark_' . $link_id ;
2005-09-18 20:47:58 -04:00
} else {
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 13:13:59 -04:00
/* translators: %s: URL to Links screen */
2017-11-30 18:11:00 -05:00
$heading = sprintf ( __ ( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' );
$submit_text = __ ( 'Add Link' );
$form_name = 'addlink' ;
2006-05-02 18:36:06 -04:00
$nonce_action = 'add-bookmark' ;
2005-09-18 20:47:58 -04:00
}
2013-09-24 20:18:11 -04:00
require_once ( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
2008-02-20 03:06:03 -05:00
2017-11-30 18:11:00 -05:00
add_meta_box ( 'linksubmitdiv' , __ ( 'Save' ), 'link_submit_meta_box' , null , 'side' , 'core' );
add_meta_box ( 'linkcategorydiv' , __ ( 'Categories' ), 'link_categories_meta_box' , null , 'normal' , 'core' );
add_meta_box ( 'linktargetdiv' , __ ( 'Target' ), 'link_target_meta_box' , null , 'normal' , 'core' );
add_meta_box ( 'linkxfndiv' , __ ( 'Link Relationship (XFN)' ), 'link_xfn_meta_box' , null , 'normal' , 'core' );
add_meta_box ( 'linkadvanceddiv' , __ ( 'Advanced' ), 'link_advanced_meta_box' , null , 'normal' , 'core' );
2008-11-11 17:40:16 -05:00
2018-12-15 20:19:54 -05:00
/** This action is documented in wp-admin/includes/meta-boxes.php */
2013-11-11 08:16:09 -05:00
do_action ( 'add_meta_boxes' , 'link' , $link );
/**
2013-11-11 08:32:10 -05:00
* Fires when link - specific meta boxes are added .
*
* @ since 3.0 . 0
*
* @ param object $link Link object .
*/
2013-11-11 08:16:09 -05:00
do_action ( 'add_meta_boxes_link' , $link );
2010-04-09 11:17:57 -04:00
2018-12-15 20:19:54 -05:00
/** This action is documented in wp-admin/includes/meta-boxes.php */
2013-11-11 08:16:09 -05:00
do_action ( 'do_meta_boxes' , 'link' , 'normal' , $link );
2018-12-15 20:19:54 -05:00
/** This action is documented in wp-admin/includes/meta-boxes.php */
2013-11-11 08:16:09 -05:00
do_action ( 'do_meta_boxes' , 'link' , 'advanced' , $link );
2018-12-15 20:19:54 -05:00
/** This action is documented in wp-admin/includes/meta-boxes.php */
2013-11-11 08:16:09 -05:00
do_action ( 'do_meta_boxes' , 'link' , 'side' , $link );
2008-11-11 17:40:16 -05:00
2017-11-30 18:11:00 -05:00
add_screen_option (
2018-08-16 21:51:36 -04:00
'layout_columns' ,
array (
2017-11-30 18:11:00 -05:00
'max' => 2 ,
'default' => 2 ,
)
);
2010-10-07 15:34:18 -04:00
2017-11-30 18:11:00 -05:00
get_current_screen () -> add_help_tab (
array (
'id' => 'overview' ,
'title' => __ ( 'Overview' ),
'content' =>
'<p>' . __ ( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link’s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' .
'<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’t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' .
'<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>' ,
)
);
2011-11-01 23:12:37 -04:00
2011-11-02 16:14:10 -04:00
get_current_screen () -> set_help_sidebar (
2011-10-07 00:57:12 -04:00
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2016-10-04 16:27:33 -04:00
'<p>' . __ ( '<a href="https://codex.wordpress.org/Links_Add_New_Screen">Documentation on Creating Links</a>' ) . '</p>' .
2019-04-08 18:59:56 -04:00
'<p>' . __ ( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
2010-05-25 18:45:18 -04:00
);
2010-01-15 11:58:36 -05:00
2013-09-24 20:18:11 -04:00
require_once ( ABSPATH . 'wp-admin/admin-header.php' );
2008-11-11 17:40:16 -05:00
?>
2011-09-21 02:16:24 -04:00
2012-04-23 18:40:59 -04:00
< div class = " wrap " >
2017-11-30 18:11:00 -05:00
< h1 class = " wp-heading-inline " >
< ? php
2016-12-07 15:18:46 -05:00
echo esc_html ( $title );
2017-11-30 18:11:00 -05:00
?>
</ h1 >
2016-12-07 15:18:46 -05:00
< a href = " link-add.php " class = " page-title-action " >< ? php echo esc_html_x ( 'Add New' , 'link' ); ?> </a>
< hr class = " wp-header-end " >
2008-09-13 15:12:55 -04:00
2008-11-14 18:01:16 -05:00
< ? php if ( isset ( $_GET [ 'added' ] ) ) : ?>
2017-11-30 18:11:00 -05:00
< div id = " message " class = " updated notice is-dismissible " >< p >< ? php _e ( 'Link added.' ); ?> </p></div>
2008-11-11 17:40:16 -05:00
< ? php endif ; ?>
2014-05-18 18:07:15 -04:00
< form name = " <?php echo esc_attr( $form_name ); ?> " id = " <?php echo esc_attr( $form_name ); ?> " method = " post " action = " link.php " >
2008-09-28 00:11:27 -04:00
< ? php
2014-05-18 18:07:15 -04:00
if ( ! empty ( $link_added ) ) {
2008-11-03 22:22:24 -05:00
echo $link_added ;
2014-05-18 18:07:15 -04:00
}
2008-09-28 00:11:27 -04:00
wp_nonce_field ( $nonce_action );
wp_nonce_field ( 'closedpostboxes' , 'closedpostboxesnonce' , false );
2017-11-30 18:11:00 -05:00
wp_nonce_field ( 'meta-box-order' , 'meta-box-order-nonce' , false );
?>
2008-08-20 17:42:31 -04:00
2012-03-23 17:41:00 -04:00
< div id = " poststuff " >
2008-08-20 17:42:31 -04:00
2012-04-24 16:46:04 -04:00
< div id = " post-body " class = " metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?> " >
2009-04-04 06:21:43 -04:00
< div id = " post-body-content " >
2008-08-20 17:42:31 -04:00
< div id = " namediv " class = " stuffbox " >
2017-11-30 18:11:00 -05:00
< h2 >< label for = " link_name " >< ? php _ex ( 'Name' , 'link name' ); ?> </label></h2>
2008-08-20 17:42:31 -04:00
< div class = " inside " >
2017-11-30 18:11:00 -05:00
< input type = " text " name = " link_name " size = " 30 " maxlength = " 255 " value = " <?php echo esc_attr( $link->link_name ); ?> " id = " link_name " />
< p >< ? php _e ( 'Example: Nifty blogging software' ); ?> </p>
2008-08-20 17:42:31 -04:00
</ div >
</ div >
< div id = " addressdiv " class = " stuffbox " >
2017-11-30 18:11:00 -05:00
< h2 >< label for = " link_url " >< ? php _e ( 'Web Address' ); ?> </label></h2>
2008-08-20 17:42:31 -04:00
< div class = " inside " >
2017-11-30 18:11:00 -05:00
< input type = " text " name = " link_url " size = " 30 " maxlength = " 255 " class = " code " value = " <?php echo esc_attr( $link->link_url ); ?> " id = " link_url " />
< p >< ? php _e ( 'Example: <code>http://wordpress.org/</code> — don’t forget the <code>http://</code>' ); ?> </p>
2008-08-20 17:42:31 -04:00
</ div >
</ div >
< div id = " descriptiondiv " class = " stuffbox " >
2017-11-30 18:11:00 -05:00
< h2 >< label for = " link_description " >< ? php _e ( 'Description' ); ?> </label></h2>
2008-08-20 17:42:31 -04:00
< div class = " inside " >
2017-11-30 18:11:00 -05:00
< 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 " />
< p >< ? php _e ( 'This will be shown when someone hovers over the link in the blogroll, or optionally below the link.' ); ?> </p>
2008-08-20 17:42:31 -04:00
</ div >
</ div >
2012-03-23 17:41:00 -04:00
</ div ><!-- / post - body - content -->
2008-08-20 17:42:31 -04:00
2012-03-23 17:41:00 -04:00
< div id = " postbox-container-1 " class = " postbox-container " >
2008-12-09 13:03:31 -05:00
< ? php
2008-08-20 17:42:31 -04:00
2014-04-25 02:34:15 -04:00
/** This action is documented in wp-admin/includes/meta-boxes.php */
2013-11-11 08:16:09 -05:00
do_action ( 'submitlink_box' );
2012-03-23 17:41:00 -04:00
$side_meta_boxes = do_meta_boxes ( 'link' , 'side' , $link );
?>
</ div >
< div id = " postbox-container-2 " class = " postbox-container " >
< ? php
2011-09-21 02:16:24 -04:00
2017-11-30 18:11:00 -05:00
do_meta_boxes ( null , 'normal' , $link );
2006-02-26 23:57:30 -05:00
2017-11-30 18:11:00 -05:00
do_meta_boxes ( null , 'advanced' , $link );
2008-02-08 16:06:15 -05:00
2012-03-23 17:41:00 -04:00
?>
</ div >
< ? php
2017-11-30 18:11:00 -05:00
if ( $link_id ) :
2018-08-16 21:51:36 -04:00
?>
2006-02-26 23:57:30 -05:00
< input type = " hidden " name = " action " value = " save " />
< input type = " hidden " name = " link_id " value = " <?php echo (int) $link_id ; ?> " />
2017-11-30 18:11:00 -05:00
< input type = " hidden " name = " cat_id " value = " <?php echo (int) $cat_id ; ?> " />
< ? php else : ?>
2006-02-26 23:57:30 -05:00
< input type = " hidden " name = " action " value = " add " />
2005-09-18 20:47:58 -04:00
< ? php endif ; ?>
2008-01-31 15:04:54 -05:00
2008-08-20 17:42:31 -04:00
</ div >
</ div >
2008-01-31 15:04:54 -05:00
</ form >
2008-10-16 23:49:43 -04:00
</ div >