123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- function _s_backbone_get_request_path() {
- global $wp_rewrite;
- if ( $wp_rewrite->using_permalinks() ) {
- global $wp;
-
- if ( ! isset( $wp->request ) ) {
- return false;
- }
-
- if ( false != preg_match( '#' . $wp_rewrite->pagination_base . '/\d+/?$#i', $wp->request ) ) {
- $path = preg_replace( '#' . $wp_rewrite->pagination_base . '/\d+$#i', $wp_rewrite->pagination_base . '/%d', $wp->request );
- } else {
- $path = $wp->request . '/' . $wp_rewrite->pagination_base . '/%d';
- }
-
- if ( 0 !== strpos( $path, '/' ) )
- $path = '/' . $path;
- $path = user_trailingslashit( $path );
- } else {
-
- $path = array_map( 'sanitize_text_field', $_REQUEST );
- $path = array_filter( $path );
- $path['paged'] = '%d';
- $path = add_query_arg( $path, '/' );
- }
- return empty( $path ) ? false : $path;
- }
- function _s_backbone_get_request_parameters() {
- $uri = $_SERVER[ 'REQUEST_URI' ];
- $uri = preg_replace( '/^[^?]*(\?.*$)/', '$1', $uri, 1, $count );
- if ( $count != 1 ) {
- return '';
- }
- return $uri;
- }
- function pull_til() {
- include('lib/html_dom.php');
- $url = 'https://davidawindham.com/til/index.html';
- $html = file_get_html($url);
- $i = 0;
- foreach ($html->find('ul li ul li') as $li) {
- echo $li;
- if (++$i == 17) break;
- }
- }
- function pull_til_all() {
- include('lib/html_dom.php');
- $url = 'https://davidawindham.com/til/index.html';
- $html = file_get_html($url);
- $i = 0;
- foreach ($html->find('ul li ul li') as $li) {
- echo $li;
- }
- }
- function bookmarks_all() {
- require_once('lib/html_dom.php');
- $url = 'https://davidawindham.com/bookmarks/';
- $html = file_get_html($url);
- $i = 0;
- foreach ($html->find('.linklist-item-title h2 a') as $li) {
- if (!empty($html)) {
- echo $li . '<br />';
- }
- }
- }
|