Changeset 43109
- Timestamp:
- 05/02/2018 03:38:23 AM (7 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-includes/link-template.php
r43102 r43109 4114 4114 */ 4115 4115 function get_privacy_policy_url() { 4116 $url = ''; 4116 4117 $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); 4117 4118 4118 4119 if ( ! empty( $policy_page_id ) && get_post_status( $policy_page_id ) === 'publish' ) { 4119 return get_permalink( $policy_page_id ); 4120 $url = (string) get_permalink( $policy_page_id ); 4121 } 4122 4123 /** 4124 * Filters the URL of the privacy policy page. 4125 * 4126 * @since 4.9.6 4127 * 4128 * @param string $url The URL to the privacy policy page. Empty string 4129 * if it doesn't exist. 4130 * @param int $policy_page_id The ID of privacy policy page. 4131 */ 4132 return apply_filters( 'privacy_policy_url', $url, $policy_page_id ); 4133 } 4134 4135 /** 4136 * Displays the privacy policy link with formatting, when applicable. 4137 * 4138 * @since 4.9.6 4139 * 4140 * @param string $before Optional. Display before privacy policy link. Default empty. 4141 * @param string $after Optional. Display after privacy policy link. Default empty. 4142 */ 4143 function the_privacy_policy_link( $before = '', $after = '' ) { 4144 echo get_the_privacy_policy_link( $before, $after ); 4145 } 4146 4147 /** 4148 * Returns the privacy policy link with formatting, when applicable. 4149 * 4150 * @since 4.9.6 4151 * 4152 * @param string $before Optional. Display before privacy policy link. Default empty. 4153 * @param string $after Optional. Display after privacy policy link. Default empty. 4154 * 4155 * @return string Markup for the link and surrounding elements. Empty string if it 4156 * doesn't exist. 4157 */ 4158 function get_the_privacy_policy_link( $before = '', $after = '' ) { 4159 $link = ''; 4160 $privacy_policy_url = get_privacy_policy_url(); 4161 4162 if ( $privacy_policy_url ) { 4163 $link = sprintf( 4164 '<a class="privacy-policy-link" href="%s">%s</a>', 4165 esc_url( $privacy_policy_url ), 4166 __( 'Privacy Policy' ) 4167 ); 4168 } 4169 4170 /** 4171 * Filters the privacy policy link. 4172 * 4173 * @since 4.9.6 4174 * 4175 * @param string $link The privacy policy link. Empty string if it 4176 * doesn't exist. 4177 * @param string $privacy_policy_url The URL of the privacy policy. Empty string 4178 * if it doesn't exist. 4179 */ 4180 $link = apply_filters( 'the_privacy_policy_link', $link, $privacy_policy_url ); 4181 4182 if ( $link ) { 4183 return $before . $link . $after; 4120 4184 } 4121 4185
Note: See TracChangeset
for help on using the changeset viewer.