| [ Index ] |
PHP Cross Reference of YOURLS |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Display <h1> header and logo 5 * 6 * @return void 7 */ 8 function yourls_html_logo() { 9 yourls_do_action( 'pre_html_logo' ); 10 ?> 11 <header role="banner"> 12 <h1> 13 <a href="<?php echo yourls_admin_url( 'index.php' ) ?>" title="YOURLS"><span>YOURLS</span>: <span>Y</span>our <span>O</span>wn <span>URL</span> <span>S</span>hortener<br/> 14 <img src="<?php yourls_site_url(); ?>/images/yourls-logo.svg?v=<?php echo YOURLS_VERSION; ?>" id="yourls-logo" alt="YOURLS" title="YOURLS" /></a> 15 </h1> 16 </header> 17 <?php 18 yourls_do_action( 'html_logo' ); 19 } 20 21 /** 22 * Display HTML head and <body> tag 23 * 24 * @param string $context Context of the page (stats, index, infos, ...) 25 * @param string $title HTML title of the page 26 * @return void 27 */ 28 function yourls_html_head( $context = 'index', $title = '' ) { 29 30 yourls_do_action( 'pre_html_head', $context, $title ); 31 32 // All components to false, except when specified true 33 $share = $insert = $tablesorter = $tabs = $cal = $charts = false; 34 35 // Load components as needed 36 switch ( $context ) { 37 case 'infos': 38 $share = $tabs = $charts = true; 39 break; 40 41 case 'bookmark': 42 $share = $insert = $tablesorter = true; 43 break; 44 45 case 'index': 46 $insert = $tablesorter = $cal = $share = true; 47 break; 48 49 case 'plugins': 50 case 'tools': 51 $tablesorter = true; 52 break; 53 54 case 'login': 55 $_title_page = 'Login'; 56 break; 57 58 case 'install': 59 case 'new': 60 case 'upgrade': 61 break; 62 } 63 64 // Force no cache for all admin pages 65 if( yourls_is_admin() && !headers_sent() ) { 66 yourls_no_cache_headers(); 67 yourls_no_frame_header(); 68 yourls_content_type_header( yourls_apply_filter( 'html_head_content-type', 'text/html' ) ); 69 yourls_do_action( 'admin_headers', $context, $title ); 70 } 71 72 // Store page context 73 yourls_set_html_context($context); 74 75 // Body class 76 $bodyclass = yourls_apply_filter( 'bodyclass', '' ); 77 $bodyclass .= ( yourls_is_mobile_device() ? 'mobile' : 'desktop' ); 78 79 // Page title 80 $_title = 'YOURLS — Your Own URL Shortener | ' . yourls_link(); 81 $_title = empty($_title_page) ? $_title : $_title_page . ' — ' . $_title; 82 $title = $title ? $title . " « " . $_title : $_title; 83 $title = yourls_apply_filter( 'html_title', $title, $context ); 84 85 ?> 86 <!DOCTYPE html> 87 <html <?php yourls_html_language_attributes(); ?>> 88 <head> 89 <title><?php echo yourls_esc_html($title); ?></title> 90 <meta http-equiv="Content-Type" content="<?php echo yourls_apply_filter( 'html_head_meta_content-type', 'text/html; charset=utf-8' ); ?>" /> 91 <meta name="generator" content="YOURLS <?php echo YOURLS_VERSION ?>" /> 92 <meta name="description" content="YOURLS » Your Own URL Shortener' | <?php yourls_site_url(); ?>" /> 93 <?php yourls_do_action('html_head_meta', $context); ?> 94 <?php yourls_html_favicon(); ?> 95 <script src="<?php yourls_site_url(); ?>/js/jquery-3.5.1.min.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> 96 <script src="<?php yourls_site_url(); ?>/js/common.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> 97 <script src="<?php yourls_site_url(); ?>/js/jquery.notifybar.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> 98 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/style.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" /> 99 <?php if ( $tabs ) { ?> 100 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/infos.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" /> 101 <script src="<?php yourls_site_url(); ?>/js/infos.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> 102 <?php } ?> 103 <?php if ( $tablesorter ) { ?> 104 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/tablesorter.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" /> 105 <script src="<?php yourls_site_url(); ?>/js/jquery-3.tablesorter.min.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> 106 <script src="<?php yourls_site_url(); ?>/js/tablesorte.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> 107 <?php } ?> 108 <?php if ( $insert ) { ?> 109 <script src="<?php yourls_site_url(); ?>/js/insert.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> 110 <?php } ?> 111 <?php if ( $share ) { ?> 112 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/share.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" /> 113 <script src="<?php yourls_site_url(); ?>/js/share.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> 114 <script src="<?php yourls_site_url(); ?>/js/clipboard.min.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> 115 <?php } ?> 116 <?php if ( $cal ) { ?> 117 <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/cal.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" /> 118 <?php yourls_l10n_calendar_strings(); ?> 119 <script src="<?php yourls_site_url(); ?>/js/jquery.cal.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> 120 <?php } ?> 121 <?php if ( $charts ) { ?> 122 <script type="text/javascript" src="https://www.google.com/jsapi"></script> 123 <script type="text/javascript"> 124 google.load('visualization', '1.0', {'packages':['corechart', 'geochart']}); 125 </script> 126 <?php } ?> 127 <script type="text/javascript"> 128 //<![CDATA[ 129 var ajaxurl = '<?php echo yourls_admin_url( 'admin-ajax.php' ); ?>'; 130 //]]> 131 </script> 132 <?php yourls_do_action( 'html_head', $context ); ?> 133 </head> 134 <body class="<?php echo yourls_esc_attr($context); ?> <?php echo yourls_esc_attr($bodyclass); ?>"> 135 <div id="wrap"> 136 <?php 137 } 138 139 /** 140 * Display HTML footer (including closing body & html tags) 141 * 142 * Function yourls_die() will call this function with the optional param set to false: most likely, if we're using yourls_die(), 143 * there's a problem, so don't maybe add to it by sending another SQL query 144 * 145 * @param bool $can_query If set to false, will not try to send another query to DB server 146 * @return void 147 */ 148 function yourls_html_footer($can_query = true) { 149 if($can_query & yourls_get_debug_mode()) { 150 $num_queries = yourls_get_num_queries(); 151 $num_queries = ' – '. sprintf( yourls_n( '1 query', '%s queries', $num_queries ), $num_queries ); 152 } else { 153 $num_queries = ''; 154 } 155 156 ?> 157 </div><?php // wrap ?> 158 <footer id="footer" role="contentinfo"><p> 159 <?php 160 $footer = yourls_s( 'Powered by %s', '<a href="http://yourls.org/" title="YOURLS">YOURLS</a> v ' . YOURLS_VERSION ); 161 $footer .= $num_queries; 162 echo yourls_apply_filter( 'html_footer_text', $footer ); 163 ?> 164 </p></footer> 165 <?php if( yourls_get_debug_mode() ) { 166 echo '<div style="text-align:left"><pre>'; 167 echo join( "\n", yourls_get_debug_log() ); 168 echo '</pre></div>'; 169 } ?> 170 <?php yourls_do_action( 'html_footer', yourls_get_html_context() ); ?> 171 </body> 172 </html> 173 <?php 174 } 175 176 /** 177 * Display "Add new URL" box 178 * 179 * @param string $url URL to prefill the input with 180 * @param string $keyword Keyword to prefill the input with 181 * @return mixed void unless the 'shunt_html_addnew' filter is used 182 */ 183 function yourls_html_addnew( string $url = '', string $keyword = '' ) { 184 $pre = yourls_apply_filter( 'shunt_html_addnew', yourls_shunt_default(), $url, $keyword ); 185 if ( yourls_shunt_default() !== $pre ) { 186 return $pre; 187 } 188 ?> 189 <main role="main"> 190 <div id="new_url"> 191 <div> 192 <form id="new_url_form" action="" method="get"> 193 <div> 194 <label for="add-url"><strong><?php yourls_e( 'Enter the URL' ); ?></strong></label>: 195 <input type="text" id="add-url" name="url" value="<?php echo yourls_esc_attr($url); ?>" class="text" size="80" placeholder="https://" /> 196 <label for="add-keyword"><?php yourls_e( 'Optional '); ?> : <strong><?php yourls_e('Custom short URL'); ?></strong></label>: 197 <input type="text" id="add-keyword" name="keyword" value="<?php echo yourls_esc_attr($keyword); ?>" class="text" size="8" /> 198 <?php yourls_nonce_field( 'add_url', 'nonce-add' ); ?> 199 <input type="button" id="add-button" name="add-button" value="<?php yourls_e( 'Shorten The URL' ); ?>" class="button" onclick="add_link();" /> 200 </div> 201 </form> 202 <div id="feedback" style="display:none"></div> 203 </div> 204 <?php yourls_do_action( 'html_addnew' ); ?> 205 </div> 206 <?php 207 } 208 209 /** 210 * Display hidden modal for link delete confirmation 211 * 212 * @since 1.10.3 213 * @param void 214 * @return void 215 */ 216 function yourls_delete_link_modal() { 217 ?> 218 <dialog id="delete-confirm-dialog"> 219 <div name="dialog_title"><?php yourls_e( 'Delete confirmation' ) ?></div> 220 <div class="confirm-message"> 221 <p><strong><?php yourls_e( 'Really delete?' ) ?></strong></p> 222 <ul> 223 <li><?php yourls_e( 'Short URL' ) ?>: <span name="short_url"></span></li> 224 <li><?php yourls_e( 'Title' ) ?>: <span name="title"></span></li> 225 <li><?php yourls_e( 'URL' ) ?>: <span name="url"></span></li> 226 </ul> 227 </div> 228 <div class="button-group"> 229 <input type="button" class="button primary" value="<?php yourls_e( 'Delete' ) ?>" onclick="remove_link_confirmed();"> 230 <input type="reset" class="button" value="<?php yourls_e( 'Cancel' ) ?>" onclick="remove_link_canceled(); return false;"> 231 <input type="hidden" name="keyword_id" value=""> 232 </div> 233 </dialog> 234 <?php 235 } 236 237 /** 238 * Display main table's footer 239 * 240 * The $param array is defined in /admin/index.php, check the yourls_html_tfooter() call 241 * 242 * @param array $params Array of all required parameters 243 * @return void 244 */ 245 function yourls_html_tfooter( array $params = [] ):void { 246 // Manually extract all parameters from the array. We prefer doing it this way, over using extract(), 247 // to make things clearer and more explicit about what var is used. 248 $search = $params['search']; 249 $search_text = $params['search_text']; 250 $search_in = $params['search_in']; 251 $sort_by = $params['sort_by']; 252 $sort_order = $params['sort_order']; 253 $page = $params['page']; 254 $perpage = $params['perpage']; 255 $click_filter = $params['click_filter']; 256 $click_limit = $params['click_limit']; 257 $total_pages = $params['total_pages']; 258 $date_filter = $params['date_filter']; 259 $date_first = $params['date_first']; 260 $date_second = $params['date_second']; 261 262 ?> 263 <tfoot> 264 <tr> 265 <th colspan="6"> 266 <div id="filter_form"> 267 <form action="" method="get"> 268 <div id="filter_options"> 269 <?php 270 271 // First search control: text to search 272 $_input = '<input aria-label="' .yourls__( 'Search for' ). '" type="text" name="search" class="text" size="12" value="' . yourls_esc_attr( $search_text ) . '" />'; 273 $_options = array( 274 'all' => yourls__( 'All fields' ), 275 'keyword' => yourls__( 'Short URL' ), 276 'url' => yourls__( 'URL' ), 277 'title' => yourls__( 'Title' ), 278 'ip' => yourls__( 'IP' ), 279 ); 280 $_select = yourls_html_select( 'search_in', $_options, $search_in, false, yourls__( 'Search in' ) ); 281 /* //translators: "Search for <input field with text to search> in <select dropdown with URL, title...>" */ 282 yourls_se( 'Search for %1$s in %2$s', $_input , $_select ); 283 echo "–\n"; 284 285 // Second search control: order by 286 $_options = array( 287 'keyword' => yourls__( 'Short URL' ), 288 'url' => yourls__( 'URL' ), 289 'title' => yourls__( 'Title' ), 290 'timestamp' => yourls__( 'Date' ), 291 'ip' => yourls__( 'IP' ), 292 'clicks' => yourls__( 'Clicks' ), 293 ); 294 $_select = yourls_html_select( 'sort_by', $_options, $sort_by, false, yourls__( 'Sort by' ) ); 295 $sort_order = isset( $sort_order ) ? $sort_order : 'desc' ; 296 $_options = array( 297 'asc' => yourls__( 'Ascending' ), 298 'desc' => yourls__( 'Descending' ), 299 ); 300 $_select2 = yourls_html_select( 'sort_order', $_options, $sort_order, false, yourls__( 'Sort order' ) ); 301 /* //translators: "Order by <criteria dropdown (date, clicks...)> in <order dropdown (Descending or Ascending)>" */ 302 yourls_se( 'Order by %1$s %2$s', $_select , $_select2 ); 303 echo "–\n"; 304 305 // Third search control: Show XX rows 306 /* //translators: "Show <text field> rows" */ 307 $_input = '<input aria-label="' .yourls__( 'Number of rows to show' ). '" type="text" name="perpage" class="text" size="2" value="' . yourls_esc_attr($perpage) . '" />'; 308 yourls_se( 'Show %s rows', $_input ); 309 echo "<br/>\n"; 310 311 // Fourth search control: Show links with more than XX clicks 312 $_options = array( 313 'more' => yourls__( 'more' ), 314 'less' => yourls__( 'less' ), 315 ); 316 $_select = yourls_html_select( 'click_filter', $_options, $click_filter, false, yourls__( 'Show links with' ) ); 317 $_input = '<input aria-label="' .yourls__( 'Number of clicks' ). '" type="text" name="click_limit" class="text" size="4" value="' . yourls_esc_attr($click_limit) . '" /> '; 318 /* //translators: "Show links with <more/less> than <text field> clicks" */ 319 yourls_se( 'Show links with %1$s than %2$s clicks', $_select, $_input ); 320 echo "<br/>\n"; 321 322 // Fifth search control: Show links created before/after/between ... 323 $_options = array( 324 'before' => yourls__('before'), 325 'after' => yourls__('after'), 326 'between' => yourls__('between'), 327 ); 328 $_select = yourls_html_select( 'date_filter', $_options, $date_filter, false, yourls__('Show links created') ); 329 $_input = '<input aria-label="' .yourls__('Select a date') . '" type="text" name="date_first" id="date_first" class="text" size="12" value="' . yourls_esc_attr($date_first) . '" />'; 330 $_and = '<span id="date_and"' . ( $date_filter === 'between' ? ' style="display:inline"' : '' ) . '> & </span>'; 331 $_input2 = '<input aria-label="' .yourls__('Select an end date') . '" type="text" name="date_second" id="date_second" class="text" size="12" value="' . yourls_esc_attr($date_second) . '"' . ( $date_filter === 'between' ? ' style="display:inline"' : '' ) . '/>'; 332 /* //translators: "Show links created <before/after/between> <date input> <"and" if applicable> <date input if applicable>" */ 333 yourls_se( 'Show links created %1$s %2$s %3$s %4$s', $_select, $_input, $_and, $_input2 ); 334 ?> 335 336 <div id="filter_buttons"> 337 <input type="submit" id="submit-sort" value="<?php yourls_e('Search'); ?>" class="button primary" /> 338 339 <input type="button" id="submit-clear-filter" value="<?php yourls_e('Clear'); ?>" class="button" onclick="window.parent.location.href = 'index.php'" /> 340 </div> 341 342 </div> 343 </form> 344 </div> 345 346 <?php 347 // Remove empty keys from the $params array so it doesn't clutter the pagination links 348 $params = array_filter( $params, function($val){ return $val !== '';} ); // remove keys with empty values 349 350 if( isset( $search_text ) ) { 351 $params['search'] = $search_text; 352 unset( $params['search_text'] ); 353 } 354 ?> 355 356 <div id="pagination"> 357 <span class="navigation"> 358 <?php if( $total_pages > 1 ) { ?> 359 <span class="nav_total"><?php echo sprintf( yourls_n( '1 page', '%s pages', $total_pages ), $total_pages ); ?></span> 360 <?php 361 $base_page = yourls_admin_url( 'index.php' ); 362 // Pagination offsets: min( max ( zomg! ) ); 363 $p_start = max( min( $total_pages - 4, $page - 2 ), 1 ); 364 $p_end = min( max( 5, $page + 2 ), $total_pages ); 365 if( $p_start >= 2 ) { 366 $link = yourls_add_query_arg( array_merge( $params, array( 'page' => 1 ) ), $base_page ); 367 echo '<span class="nav_link nav_first"><a href="' . $link . '" title="' . yourls_esc_attr__('Go to First Page') . '">' . yourls__( '« First' ) . '</a></span>'; 368 echo '<span class="nav_link nav_prev"></span>'; 369 } 370 for( $i = $p_start ; $i <= $p_end; $i++ ) { 371 if( $i == $page ) { 372 echo "<span class='nav_link nav_current'>$i</span>"; 373 } else { 374 $link = yourls_add_query_arg( array_merge( $params, array( 'page' => $i ) ), $base_page ); 375 echo '<span class="nav_link nav_goto"><a href="' . $link . '" title="' . sprintf( yourls_esc_attr( 'Page %s' ), $i ) .'">'.$i.'</a></span>'; 376 } 377 } 378 if( ( $p_end ) < $total_pages ) { 379 $link = yourls_add_query_arg( array_merge( $params, array( 'page' => $total_pages ) ), $base_page ); 380 echo '<span class="nav_link nav_next"></span>'; 381 echo '<span class="nav_link nav_last"><a href="' . $link . '" title="' . yourls_esc_attr__('Go to Last Page') . '">' . yourls__( 'Last »' ) . '</a></span>'; 382 } 383 ?> 384 <?php } ?> 385 </span> 386 </div> 387 </th> 388 </tr> 389 <?php yourls_do_action( 'html_tfooter' ); ?> 390 </tfoot> 391 <?php 392 } 393 394 /** 395 * Return or display a select dropdown field 396 * 397 * @since 1.6 398 * 399 * @param string $name HTML 'name' (also use as the HTML 'id') 400 * @param array $options array of 'value' => 'Text displayed' 401 * @param string $selected optional 'value' from the $options array that will be highlighted 402 * @param boolean $display false (default) to return, true to echo 403 * @param string $label ARIA label of the element 404 * @return string HTML content of the select element 405 */ 406 function yourls_html_select( string $name, array $options, string $selected = '', bool $display = false, string $label = '' ):string { 407 // Allow plugins to filter the options -- see #3262 408 $options = yourls_apply_filter( 'html_select_options', $options, $name, $selected, $display, $label ); 409 $_name = yourls_esc_attr( $name ); 410 $_label = yourls_esc_attr( $label ); 411 $html = "<select aria-label='$_label' name='$_name' id='$_name' size='1'>\n"; 412 foreach( $options as $value => $text ) { 413 $_value = yourls_esc_attr( $value ); 414 $_text = yourls_esc_html( $text ); 415 $html .= "<option value='$_value' "; 416 $html .= $selected == $value ? ' selected="selected"' : ''; 417 $html .= ">$_text</option>\n"; 418 } 419 $html .= "</select>\n"; 420 $html = yourls_apply_filter( 'html_select', $html, $name, $options, $selected, $display ); 421 if( $display ) 422 echo $html; 423 return $html; 424 } 425 426 427 /** 428 * Display the Quick Share box 429 * 430 * @param string $longurl Long URL 431 * @param string $shorturl Short URL 432 * @param string $title Title 433 * @param string $text Text to display 434 * @param string $shortlink_title Optional replacement for 'Your short link' 435 * @param string $share_title Optional replacement for 'Quick Share' 436 * @param bool $hidden Optional. Hide the box by default (with css "display:none") 437 * @return void 438 */ 439 function yourls_share_box( $longurl, $shorturl, $title = '', $text='', $shortlink_title = '', $share_title = '', $hidden = false ) { 440 if ( $shortlink_title == '' ) 441 $shortlink_title = '<h2>' . yourls__( 'Your short link' ) . '</h2>'; 442 if ( $share_title == '' ) 443 $share_title = '<h2>' . yourls__( 'Quick Share' ) . '</h2>'; 444 445 // Allow plugins to short-circuit the whole function 446 $pre = yourls_apply_filter( 'shunt_share_box', yourls_shunt_default() ); 447 if ( yourls_shunt_default() !== $pre ) { 448 return $pre; 449 } 450 451 // Make sure IDN domains are in their UTF8 form 452 $shorturl = yourls_normalize_uri($shorturl); 453 454 $text = ( $text ? '"'.$text.'" ' : '' ); 455 $title = ( $title ? "$title " : '' ); 456 $share = yourls_esc_textarea( $title.$text.$shorturl ); 457 $count = 280 - strlen( $share ); 458 $hidden = ( $hidden ? 'style="display:none;"' : '' ); 459 460 // Allow plugins to filter all data 461 $data = compact( 'longurl', 'shorturl', 'title', 'text', 'shortlink_title', 'share_title', 'share', 'count', 'hidden' ); 462 $data = yourls_apply_filter( 'share_box_data', $data ); 463 extract( $data ); 464 465 $_share = rawurlencode( $share ); 466 $_url = rawurlencode( $shorturl ); 467 ?> 468 469 <div id="shareboxes" <?php echo $hidden; ?>> 470 471 <?php yourls_do_action( 'shareboxes_before', $longurl, $shorturl, $title, $text ); ?> 472 473 <div id="copybox" class="share"> 474 <?php echo $shortlink_title; ?> 475 <p><input id="copylink" class="text" size="32" value="<?php echo yourls_esc_url( $shorturl ); ?>" /></p> 476 <p><small><?php yourls_e( 'Long link' ); ?>: <a id="origlink" href="<?php echo yourls_esc_url( $longurl ); ?>"><?php echo yourls_esc_url( $longurl ); ?></a></small> 477 <?php if( yourls_do_log_redirect() ) { ?> 478 <br/><small><?php yourls_e( 'Stats' ); ?>: <a id="statlink" href="<?php echo yourls_esc_url( $shorturl ); ?>+"><?php echo yourls_esc_url( $shorturl ); ?>+</a></small> 479 <input type="hidden" id="titlelink" value="<?php echo yourls_esc_attr( $title ); ?>" /> 480 <?php } ?> 481 </p> 482 </div> 483 484 <?php yourls_do_action( 'shareboxes_middle', $longurl, $shorturl, $title, $text ); ?> 485 486 <div id="sharebox" class="share"> 487 <?php echo $share_title; ?> 488 <div id="tweet"> 489 <span id="charcount" class="hide-if-no-js"><?php echo $count; ?></span> 490 <textarea id="tweet_body"><?php echo $share; ?></textarea> 491 </div> 492 <p id="share_links"><?php yourls_e( 'Share with' ); ?> 493 <a id="share_tw" href="https://twitter.com/intent/tweet?text=<?php echo $_share; ?>" title="<?php yourls_e( 'Tweet this!' ); ?>" onclick="share('tw');return false">Twitter</a> 494 <a id="share_fb" href="https://www.facebook.com/share.php?u=<?php echo $_url; ?>" title="<?php yourls_e( 'Share on Facebook' ); ?>" onclick="share('fb');return false;">Facebook</a> 495 <?php 496 yourls_do_action( 'share_links', $longurl, $shorturl, $title, $text ); 497 // Note: on the main admin page, there are no parameters passed to the sharebox when it's drawn. 498 ?> 499 </p> 500 </div> 501 502 <?php yourls_do_action( 'shareboxes_after', $longurl, $shorturl, $title, $text ); ?> 503 504 </div> 505 506 <?php 507 } 508 509 /** 510 * Die die die 511 * 512 * @see https://www.youtube.com/watch?v=zSiKETBjARk 513 * @param string $message 514 * @param string $title 515 * @param int $header_code 516 * @return void 517 */ 518 function yourls_die( string $message = '', string $title = '', int $header_code = 200 ) { 519 yourls_do_action( 'pre_yourls_die', $message, $title, $header_code ); 520 521 yourls_status_header( $header_code ); 522 523 if( !yourls_did_action( 'html_head' ) ) { 524 yourls_html_head(); 525 yourls_html_logo(); 526 } 527 echo yourls_esc_html( yourls_apply_filter( 'die_title', "<h2>$title</h2>" ) ); 528 echo yourls_esc_html( yourls_apply_filter( 'die_message', "<p>$message</p>" ) ); 529 // Hook into 'yourls_die' to add more elements or messages to that page 530 yourls_do_action( 'yourls_die' ); 531 if( !yourls_did_action( 'html_footer' ) ) { 532 yourls_html_footer(false); 533 } 534 535 // die with a value in case we're running tests, so PHPUnit doesn't exit with 0 as if success 536 die(1); 537 } 538 539 /** 540 * Return an "Edit" row for the main table 541 * 542 * @param string $keyword Keyword to edit 543 * @param string $id 544 * @return string HTML of the edit row 545 */ 546 function yourls_table_edit_row( $keyword, $id ) { 547 $keyword = yourls_sanitize_keyword($keyword); 548 $url = yourls_get_keyword_longurl( $keyword ); 549 $title = htmlspecialchars( yourls_get_keyword_title( $keyword ) ); 550 $safe_url = yourls_esc_attr( $url ); 551 $safe_title = yourls_esc_attr( $title ); 552 $safe_keyword = yourls_esc_attr( $keyword ); 553 554 // Make strings sprintf() safe: '%' -> '%%' 555 $safe_url = str_replace( '%', '%%', $safe_url ); 556 $safe_title = str_replace( '%', '%%', $safe_title ); 557 558 $www = yourls_link(); 559 560 $nonce = yourls_create_nonce( 'edit-save_'.$id ); 561 562 if( $url ) { 563 $return = <<<RETURN 564 <tr id="edit-$id" class="edit-row"><td colspan="5" class="edit-row"><strong>%s</strong>:<input type="text" id="edit-url-$id" name="edit-url-$id" value="$safe_url" class="text" size="70" /><br/><strong>%s</strong>: $www<input type="text" id="edit-keyword-$id" name="edit-keyword-$id" value="$safe_keyword" class="text" size="10" /><br/><strong>%s</strong>: <input type="text" id="edit-title-$id" name="edit-title-$id" value="$safe_title" class="text" size="60" /></td><td colspan="1"><input type="button" id="edit-submit-$id" name="edit-submit-$id" value="%s" title="%s" class="button" onclick="edit_link_save('$id');" /> <input type="button" id="edit-close-$id" name="edit-close-$id" value="%s" title="%s" class="button" onclick="edit_link_hide('$id');" /><input type="hidden" id="old_keyword_$id" value="$safe_keyword"/><input type="hidden" id="nonce_$id" value="$nonce"/></td></tr> 565 RETURN; 566 $return = sprintf( $return, yourls__( 'Long URL' ), yourls__( 'Short URL' ), yourls__( 'Title' ), yourls__( 'Save' ), yourls__( 'Save new values' ), yourls__( 'Cancel' ), yourls__( 'Cancel editing' ) ); 567 } else { 568 $return = '<tr class="edit-row notfound"><td colspan="6" class="edit-row notfound">' . yourls__( 'Error, URL not found' ) . '</td></tr>'; 569 } 570 571 $return = yourls_apply_filter( 'table_edit_row', $return, $keyword, $url, $title ); 572 573 return $return; 574 } 575 576 /** 577 * Return an "Add" row for the main table 578 * 579 * @param string $keyword Keyword (short URL) 580 * @param string $url URL (long URL) 581 * @param string $title Title 582 * @param string $ip IP 583 * @param int|string $clicks Number of clicks 584 * @param string $timestamp Timestamp 585 * @param int $row_id Numeric value used to form row IDs, defaults to one 586 * @return string HTML of the row 587 */ 588 function yourls_table_add_row( string $keyword, string $url, string $title, string $ip, int|string $clicks, string $timestamp, int $row_id = 1 ):string { 589 $keyword = yourls_sanitize_keyword($keyword); 590 $id = yourls_unique_element_id('yid', $row_id); 591 $shorturl = yourls_link( $keyword ); 592 593 $statlink = yourls_statlink( $keyword ); 594 595 $delete_link = yourls_nonce_url( 'delete-link_'.$id, 596 yourls_add_query_arg( array( 'id' => $id, 'action' => 'delete', 'keyword' => $keyword ), yourls_admin_url( 'admin-ajax.php' ) ) 597 ); 598 599 $edit_link = yourls_nonce_url( 'edit-link_'.$id, 600 yourls_add_query_arg( array( 'id' => $id, 'action' => 'edit', 'keyword' => $keyword ), yourls_admin_url( 'admin-ajax.php' ) ) 601 ); 602 603 // Action link buttons: the array 604 $actions = array( 605 'stats' => array( 606 'href' => $statlink, 607 'id' => "statlink-$id", 608 'title' => yourls_esc_attr__( 'Stats' ), 609 'anchor' => yourls__( 'Stats' ), 610 ), 611 'share' => array( 612 'href' => '', 613 'id' => "share-button-$id", 614 'title' => yourls_esc_attr__( 'Share' ), 615 'anchor' => yourls__( 'Share' ), 616 'onclick' => "toggle_share('$id');return false;", 617 ), 618 'edit' => array( 619 'href' => $edit_link, 620 'id' => "edit-button-$id", 621 'title' => yourls_esc_attr__( 'Edit' ), 622 'anchor' => yourls__( 'Edit' ), 623 'onclick' => "edit_link_display('$id');return false;", 624 ), 625 'delete' => array( 626 'href' => $delete_link, 627 'id' => "delete-button-$id", 628 'title' => yourls_esc_attr__( 'Delete' ), 629 'anchor' => yourls__( 'Delete' ), 630 'onclick' => "remove_link('$id');return false;", 631 ) 632 ); 633 $actions = yourls_apply_filter( 'table_add_row_action_array', $actions, $keyword ); 634 635 // Action link buttons: the HTML 636 $action_links = ''; 637 foreach( $actions as $key => $action ) { 638 $onclick = isset( $action['onclick'] ) ? 'onclick="' . $action['onclick'] . '"' : '' ; 639 $action_links .= sprintf( '<a href="%s" id="%s" title="%s" class="%s" %s>%s</a>', 640 $action['href'], $action['id'], $action['title'], 'button button_'.$key, $onclick, $action['anchor'] 641 ); 642 } 643 $action_links = yourls_apply_filter( 'action_links', $action_links, $keyword, $url, $ip, $clicks, $timestamp ); 644 645 if( ! $title ) 646 $title = $url; 647 648 $protocol_warning = ''; 649 if( ! in_array( yourls_get_protocol( $url ) , array( 'http://', 'https://' ) ) ) 650 $protocol_warning = yourls_apply_filter( 'add_row_protocol_warning', '<span class="warning" title="' . yourls__( 'Not a common link' ) . '">★</span>' ); 651 652 // Row cells: the array 653 $cells = array( 654 'keyword' => array( 655 'template' => '<a href="%shorturl%">%keyword_html%</a>', 656 'shorturl' => yourls_esc_url( $shorturl ), 657 'keyword_html' => yourls_esc_html( $keyword ), 658 ), 659 'url' => array( 660 'template' => '<a href="%long_url%" title="%title_attr%">%title_html%</a><br/><small>%warning%<a href="%long_url%">%long_url_html%</a></small>', 661 'long_url' => yourls_esc_url( $url ), 662 'title_attr' => yourls_esc_attr( $title ), 663 'title_html' => yourls_esc_html( yourls_trim_long_string( $title ) ), 664 'long_url_html' => yourls_esc_html( yourls_trim_long_string( urldecode( $url ) ) ), 665 'warning' => $protocol_warning, 666 ), 667 'timestamp' => array( 668 'template' => '<span class="timestamp" aria-hidden="true">%timestamp%</span> %date%', 669 'timestamp' => $timestamp, 670 'date' => yourls_date_i18n( yourls_get_datetime_format(yourls__('M d, Y H:i')), yourls_get_timestamp( $timestamp )), 671 ), 672 'ip' => array( 673 'template' => '%ip%', 674 'ip' => yourls_sanitize_ip($ip), 675 ), 676 'clicks' => array( 677 'template' => '%clicks%', 678 'clicks' => yourls_number_format_i18n( $clicks, 0 ), 679 ), 680 'actions' => array( 681 'template' => '%actions% <input type="hidden" id="keyword_%id%" value="%keyword%"/>', 682 'actions' => $action_links, 683 'id' => $id, 684 'keyword' => $keyword, 685 ), 686 ); 687 $cells = yourls_apply_filter( 'table_add_row_cell_array', $cells, $keyword, $url, $title, $ip, $clicks, $timestamp ); 688 689 // Row cells: the HTML. Replace every %stuff% in 'template' with 'stuff' value. 690 $row = "<tr id=\"id-$id\">"; 691 foreach( $cells as $cell_id => $elements ) { 692 $row .= sprintf( '<td class="%s" id="%s">', $cell_id, $cell_id . '-' . $id ); 693 $row .= preg_replace_callback( '/%([^%]+)?%/', function( $match ) use ( $elements ) { return $elements[ $match[1] ]; }, $elements['template'] ); 694 $row .= '</td>'; 695 } 696 $row .= "</tr>"; 697 $row = yourls_apply_filter( 'table_add_row', $row, $keyword, $url, $title, $ip, $clicks, $timestamp ); 698 699 return $row; 700 } 701 702 /** 703 * Echo the main table head 704 * 705 * @return void 706 */ 707 function yourls_table_head() { 708 $start = '<table id="main_table" class="tblSorter" cellpadding="0" cellspacing="1"><thead><tr>'."\n"; 709 echo yourls_apply_filter( 'table_head_start', $start ); 710 711 $cells = yourls_apply_filter( 'table_head_cells', array( 712 'shorturl' => yourls__( 'Short URL' ), 713 'longurl' => yourls__( 'Original URL' ), 714 'date' => yourls__( 'Date' ), 715 'ip' => yourls__( 'IP' ), 716 'clicks' => yourls__( 'Clicks' ), 717 'actions' => yourls__( 'Actions' ) 718 ) ); 719 foreach( $cells as $k => $v ) { 720 echo "<th id='main_table_head_$k'><span>$v</span></th>\n"; 721 } 722 723 $end = "</tr></thead>\n"; 724 echo yourls_apply_filter( 'table_head_end', $end ); 725 } 726 727 /** 728 * Echo the tbody start tag 729 * 730 * @return void 731 */ 732 function yourls_table_tbody_start() { 733 echo yourls_apply_filter( 'table_tbody_start', '<tbody>' ); 734 } 735 736 /** 737 * Echo the tbody end tag 738 * 739 * @return void 740 */ 741 function yourls_table_tbody_end() { 742 echo yourls_apply_filter( 'table_tbody_end', '</tbody>' ); 743 } 744 745 /** 746 * Echo the table start tag 747 * 748 * @return void 749 */ 750 function yourls_table_end() { 751 echo yourls_apply_filter( 'table_end', '</table></main>' ); 752 } 753 754 755 756 /** 757 * Echo HTML tag for a link 758 * 759 * @param string $href URL to link to 760 * @param string $anchor Anchor text 761 * @param string $element Element id 762 * @return void 763 */ 764 function yourls_html_link( $href, $anchor = '', $element = '' ) { 765 if( !$anchor ) 766 $anchor = $href; 767 if( $element ) 768 $element = sprintf( 'id="%s"', yourls_esc_attr( $element ) ); 769 $link = sprintf( '<a href="%s" %s>%s</a>', yourls_esc_url( $href ), $element, yourls_esc_html( $anchor ) ); 770 echo yourls_apply_filter( 'html_link', $link ); 771 } 772 773 /** 774 * Display the login screen. Nothing past this point. 775 * 776 * @param string $error_msg Optional error message to display 777 * @return void 778 */ 779 function yourls_login_screen( string $error_msg = '' ) { 780 yourls_html_head( 'login' ); 781 782 $action = ( isset( $_GET['action'] ) && $_GET['action'] == 'logout' ? '?' : '' ); 783 784 yourls_html_logo(); 785 ?> 786 <main role="main"> 787 <div id="login"> 788 <form method="post" action="<?php echo yourls_esc_attr($action); ?>"> <?php // reset any QUERY parameters ?> 789 <?php 790 if( !empty( $error_msg ) ) { 791 echo '<p id="error-message" class="error">'. yourls_esc_html($error_msg).'</p>'; 792 } 793 yourls_do_action( 'login_form_top' ); 794 ?> 795 <p> 796 <label for="username"><?php yourls_e( 'Username' ); ?></label><br /> 797 <input type="text" id="username" aria-describedby="error-message" name="username" class="text" autocomplete="username" /> 798 </p> 799 <p> 800 <label for="password"><?php yourls_e( 'Password' ); ?></label><br /> 801 <input type="password" id="password" name="password" class="text" autocomplete="current-password" /> 802 </p> 803 <?php 804 yourls_do_action( 'login_form_bottom' ); 805 ?> 806 <p style="text-align: right;"> 807 <?php yourls_nonce_field('admin_login'); ?> 808 <input type="submit" id="submit" name="submit" value="<?php yourls_e( 'Login' ); ?>" class="button" /> 809 </p> 810 <?php 811 yourls_do_action( 'login_form_end' ); 812 ?> 813 </form> 814 <script type="text/javascript">$('#username').focus();</script> 815 </div> 816 </main> 817 <?php 818 yourls_html_footer(); 819 die(); 820 } 821 822 823 /** 824 * Display the admin menu 825 * 826 * @return void 827 */ 828 function yourls_html_menu() { 829 // Build menu links 830 if( defined( 'YOURLS_USER' ) ) { 831 // Create a logout link with a nonce associated to fake user 'logout' : the user is not yet defined 832 // when the logout check is done -- see yourls_is_valid_user() 833 $logout_url = yourls_nonce_url( 'admin_logout', 834 yourls_add_query_arg(['action' => 'logout'], yourls_admin_url('index.php')), 'nonce', 'logout'); 835 $logout_link = yourls_apply_filter('logout_link', sprintf( yourls__('Hello <strong>%s</strong>'), YOURLS_USER ) . ' (<a href="' . $logout_url . '" title="' . yourls_esc_attr__( 'Logout' ) . '">' . yourls__( 'Logout' ) . '</a>)' ); 836 } else { 837 $logout_link = yourls_apply_filter( 'logout_link', '' ); 838 } 839 $help_link = yourls_apply_filter( 'help_link', '<a href="' . yourls_site_url( false ) .'/readme.html">' . yourls__( 'Help' ) . '</a>' ); 840 841 $admin_links = array(); 842 $admin_sublinks = array(); 843 844 $admin_links['admin'] = array( 845 'url' => yourls_admin_url( 'index.php' ), 846 'title' => yourls__( 'Go to the admin interface' ), 847 'anchor' => yourls__( 'Admin interface' ) 848 ); 849 850 if( yourls_is_admin() ) { 851 $admin_links['tools'] = array( 852 'url' => yourls_admin_url( 'tools.php' ), 853 'anchor' => yourls__( 'Tools' ) 854 ); 855 $admin_links['plugins'] = array( 856 'url' => yourls_admin_url( 'plugins.php' ), 857 'anchor' => yourls__( 'Manage Plugins' ) 858 ); 859 $admin_sublinks['plugins'] = yourls_list_plugin_admin_pages(); 860 } 861 862 $admin_links = yourls_apply_filter( 'admin_links', $admin_links ); 863 $admin_sublinks = yourls_apply_filter( 'admin_sublinks', $admin_sublinks ); 864 865 // Now output menu 866 echo '<nav role="navigation"><ul id="admin_menu">'."\n"; 867 if ( yourls_is_private() && !empty( $logout_link ) ) 868 echo '<li id="admin_menu_logout_link">' . $logout_link .'</li>'; 869 870 foreach( (array)$admin_links as $link => $ar ) { 871 if( isset( $ar['url'] ) ) { 872 $anchor = isset( $ar['anchor'] ) ? $ar['anchor'] : $link; 873 $title = isset( $ar['title'] ) ? 'title="' . $ar['title'] . '"' : ''; 874 printf( '<li id="admin_menu_%s_link" class="admin_menu_toplevel"><a href="%s" %s>%s</a>', $link, $ar['url'], $title, $anchor ); 875 } 876 // Output submenu if any. TODO: clean up, too many code duplicated here 877 if( isset( $admin_sublinks[$link] ) ) { 878 echo "<ul>\n"; 879 foreach( $admin_sublinks[$link] as $link => $ar ) { 880 if( isset( $ar['url'] ) ) { 881 $anchor = isset( $ar['anchor'] ) ? $ar['anchor'] : $link; 882 $title = isset( $ar['title'] ) ? 'title="' . $ar['title'] . '"' : ''; 883 printf( '<li id="admin_menu_%s_link" class="admin_menu_sublevel admin_menu_sublevel_%s"><a href="%s" %s>%s</a>', $link, $link, $ar['url'], $title, $anchor ); 884 } 885 } 886 echo "</ul>\n"; 887 } 888 } 889 890 if ( isset( $help_link ) ) 891 echo '<li id="admin_menu_help_link">' . $help_link .'</li>'; 892 893 yourls_do_action( 'admin_menu' ); 894 echo "</ul></nav>\n"; 895 yourls_do_action( 'admin_notices' ); 896 yourls_do_action( 'admin_notice' ); // because I never remember if it's 'notices' or 'notice' 897 /* 898 To display a notice: 899 $message = "<div>OMG, dude, I mean!</div>" ); 900 yourls_add_action( 'admin_notices', function() use ( $message ) { echo (string) $message; } ); 901 */ 902 } 903 904 /** 905 * Wrapper function to display admin notices 906 * 907 * @param string $message Message to display 908 * @param string $style Message style (default: 'notice') 909 * @return void 910 */ 911 function yourls_add_notice( $message, $style = 'notice' ) { 912 // Escape single quotes in $message to avoid breaking the anonymous function 913 $message = yourls_notice_box( strtr( $message, array( "'" => "\'" ) ), $style ); 914 yourls_add_action( 'admin_notices', function() use ( $message ) { echo (string) $message; } ); 915 } 916 917 /** 918 * Return a formatted notice 919 * 920 * @param string $message Message to display 921 * @param string $style CSS class to use for the notice 922 * @return string HTML of the notice 923 */ 924 function yourls_notice_box( string $message, string $style = 'notice' ):string { 925 $style = yourls_esc_attr( $style ); 926 $allowed = [ 927 'a' => ['href' => true, 'title' => true], 928 'strong' => [], 929 'em' => [], 930 'code' => [], 931 'br' => [], 932 'p' => ['class' => true], 933 ]; 934 $message = yourls_esc_html_with_whitelist($message, $allowed); 935 936 return <<<HTML 937 <div class="$style"> 938 <p>$message</p> 939 </div> 940 HTML; 941 } 942 943 /** 944 * Display a page 945 * 946 * Includes content of a PHP file from the YOURLS_PAGEDIR directory, as if it 947 * were a standard short URL (ie http://sho.rt/$page) 948 * 949 * @since 1.0 950 * @param string $page PHP file to display 951 * @return void 952 */ 953 function yourls_page( $page ) { 954 if( !yourls_is_page($page)) { 955 yourls_die( yourls_s('Page "%1$s" not found', $page), yourls__('Not found'), 404 ); 956 } 957 958 yourls_do_action( 'pre_page', $page ); 959 $load = yourls_include_file_sandbox(YOURLS_PAGEDIR . "/$page.php"); 960 if (is_string($load)) { 961 yourls_die( $load, yourls__('Not found'), 404 ); 962 } 963 yourls_do_action( 'post_page', $page ); 964 } 965 966 /** 967 * Display the language attributes for the HTML tag. 968 * 969 * Builds up a set of html attributes containing the text direction and language 970 * information for the page. Stolen from WP. 971 * 972 * @since 1.6 973 * @return void 974 */ 975 function yourls_html_language_attributes() { 976 $attributes = array(); 977 $output = ''; 978 979 $attributes[] = ( yourls_is_rtl() ? 'dir="rtl"' : 'dir="ltr"' ); 980 981 $doctype = yourls_apply_filter( 'html_language_attributes_doctype', 'html' ); 982 // Experimental: get HTML lang from locale. Should work. Convert fr_FR -> fr-FR 983 if ( $lang = str_replace( '_', '-', yourls_get_locale() ) ) { 984 if( $doctype == 'xhtml' ) { 985 $attributes[] = "xml:lang=\"$lang\""; 986 } else { 987 $attributes[] = "lang=\"$lang\""; 988 } 989 } 990 991 $output = implode( ' ', $attributes ); 992 $output = yourls_apply_filter( 'html_language_attributes', $output ); 993 echo $output; 994 } 995 996 /** 997 * Output translated strings used by the Javascript calendar 998 * 999 * @since 1.6 1000 * @return void 1001 */ 1002 function yourls_l10n_calendar_strings() { 1003 echo "\n<script>\n"; 1004 echo "var l10n_cal_month = " . json_encode( array_values( yourls_l10n_months() ) ) . ";\n"; 1005 echo "var l10n_cal_days = " . json_encode( array_values( yourls_l10n_weekday_initial() ) ) . ";\n"; 1006 echo "var l10n_cal_today = \"" . yourls_esc_js( yourls__( 'Today' ) ) . "\";\n"; 1007 echo "var l10n_cal_close = \"" . yourls_esc_js( yourls__( 'Close' ) ) . "\";\n"; 1008 echo "</script>\n"; 1009 1010 // Dummy returns, to initialize l10n strings used in the calendar 1011 yourls__( 'Today' ); 1012 yourls__( 'Close' ); 1013 } 1014 1015 1016 /** 1017 * Display a notice if there is a newer version of YOURLS available 1018 * 1019 * @since 1.7 1020 * @param string $compare_with Optional, YOURLS version to compare to 1021 * @return void 1022 */ 1023 function yourls_new_core_version_notice($compare_with = null) { 1024 $compare_with = $compare_with ?: YOURLS_VERSION; 1025 1026 $checks = yourls_get_option( 'core_version_checks' ); 1027 $latest = isset($checks->last_result->latest) ? yourls_sanitize_version($checks->last_result->latest) : false; 1028 1029 if( $latest AND version_compare( $latest, $compare_with, '>' ) ) { 1030 yourls_do_action('new_core_version_notice', $latest); 1031 $msg = yourls_s( '<a href="%s">YOURLS version %s</a> is available. Please update!', 'http://yourls.org/download', $latest ); 1032 yourls_add_notice( $msg ); 1033 } 1034 } 1035 1036 /** 1037 * Display or return HTML for a bookmarklet link 1038 * 1039 * @since 1.7.1 1040 * @param string $href bookmarklet link (presumably minified code with "javascript:" scheme) 1041 * @param string $anchor link anchor 1042 * @param bool $echo true to display, false to return the HTML 1043 * @return string the HTML for a bookmarklet link 1044 */ 1045 function yourls_bookmarklet_link( string $href, string $anchor, bool $echo = true ):string { 1046 $alert = yourls_esc_attr__( 'Drag to your toolbar!' ); 1047 $href = yourls_esc_attr( $href ); 1048 $anchor = yourls_esc_html( $anchor ); 1049 $link = <<<LINK 1050 <a href="$href" class="bookmarklet" onclick="alert('$alert');return false;">$anchor</a> 1051 LINK; 1052 1053 if( $echo ) { 1054 echo $link; 1055 } 1056 return $link; 1057 } 1058 1059 /** 1060 * Set HTML context (stats, index, infos, ...) 1061 * 1062 * @since 1.7.3 1063 * @param string $context 1064 * @return void 1065 */ 1066 function yourls_set_html_context($context) { 1067 yourls_get_db('read-set_html_context')->set_html_context($context); 1068 } 1069 1070 /** 1071 * Get HTML context (stats, index, infos, ...) 1072 * 1073 * @since 1.7.3 1074 * @return string 1075 */ 1076 function yourls_get_html_context() { 1077 return yourls_get_db('read-get_html_context')->get_html_context(); 1078 } 1079 1080 /** 1081 * Print HTML link for favicon 1082 * 1083 * @since 1.7.10 1084 * @return mixed|void 1085 */ 1086 function yourls_html_favicon() { 1087 // Allow plugins to short-circuit the whole function 1088 $pre = yourls_apply_filter( 'shunt_html_favicon', yourls_shunt_default() ); 1089 if ( yourls_shunt_default() !== $pre ) { 1090 return $pre; 1091 } 1092 1093 printf( '<link rel="shortcut icon" href="%s" />', yourls_get_yourls_favicon_url(false) ); 1094 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sun Jun 14 05:10:17 2026 | Cross-referenced by PHPXref 0.7.1 |