using_permalinks() ) {
global $wp;
// If called too early, bail
if ( ! isset( $wp->request ) ) {
return false;
}
// Determine path for paginated version of current request
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';
}
// Slashes everywhere we need them
if ( 0 !== strpos( $path, '/' ) )
$path = '/' . $path;
$path = user_trailingslashit( $path );
} else {
// Clean up raw $_REQUEST input
$path = array_map( 'sanitize_text_field', $_REQUEST );
$path = array_filter( $path );
$path['paged'] = '%d';
$path = add_query_arg( $path, '/' );
}
return empty( $path ) ? false : $path;
}
/**
* Return query string for current request, prefixed with '?'.
*
* @return string
*/
function _s_backbone_get_request_parameters() {
$uri = $_SERVER[ 'REQUEST_URI' ];
$uri = preg_replace( '/^[^?]*(\?.*$)/', '$1', $uri, 1, $count );
if ( $count != 1 ) {
return '';
}
return $uri;
}
/*******************
< PHP 7.3 include file as dom.php
>= PHP 7.3 include file as html_dom.php
**********************/
function til() {
require_once('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 == 9) break;
}
}
function pull_til() {
require_once('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 == 43) break;
}
}
function pull_til_all() {
require_once('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() {
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 . '
';
if (++$i == 9) break;
}
}
}
function bookmarks_pull() {
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 . '
';
if (++$i == 27) break;
}
}
}
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 . '
';
}
}
}
function photo() {
require_once('lib/html_dom.php');
$url = 'https://photo.davidwindham.com/#16734437965516';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('.photo .overlay h1') as $li) {
if (!empty($html)) {
echo str_replace('href="/', 'href="https://photo.davidawindham.com/', $li . ' ');
if (++$i == 18) break;
}
}
}
function todo() {
require_once('lib/html_dom.php');
$url = 'https://davidawindham.com/til/lists/todo';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('.markdown ul li') as $li) {
if (!empty($html)) {
echo $li->childNodes(0);
if (++$i == 9) break;
}
}
}
function code() {
require_once('lib/html_dom.php');
$url = 'https://code.davidawindham.com/david';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('.item a.name, p.has-emoji, span.time-since') as $li) {
if (!empty($html)) {
//$time = find('.time-since') as $time;
echo str_replace('href="/', 'href="https://code.davidawindham.com/', $li . ' ');
//echo $time . ' ';
if (++$i == 9) break;
}
}
}
function docs() {
require_once('lib/html_dom.php');
$url = 'https://davidawindham.com/til/docs';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('.markdown ul li') as $li) {
if (!empty($html)) {
echo $li;
if (++$i == 7) break;
}
}
}
function docs_code() {
require_once('lib/html_dom.php');
$url = 'https://code.davidawindham.com/david/til/src/main/docs';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('table tr td') as $li) {
if (!empty($html)) {
//if($i++ == 1) continue;
echo str_replace('href="/', 'href="https://code.davidawindham.com/', $li);
if(!($i++ % 3)) {
echo '
';
}
if (++$i == 1) break;
}
}
}
function lists() {
require_once('lib/html_dom.php');
$url = 'https://davidawindham.com/til/lists/';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('.markdown ul li') as $li) {
if (!empty($html)) {
echo $li;
if (++$i == 7) break;
}
}
}
function lists_code() {
require_once('lib/html_dom.php');
$url = 'https://code.davidawindham.com/david/til/src/main/lists';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('table tr td') as $li) {
if (!empty($html)) {
//if($i++ == 1) continue;
if (++$i == 2) break;
echo str_replace('href="/', 'href="https://code.davidawindham.com/', $li);
if(!($i++ % 3)) {
echo '
';
}
}
}
}
function notes() {
require_once('lib/html_dom.php');
$url = 'https://davidawindham.com/til/notes/';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('.markdown ul li') as $li) {
if (!empty($html)) {
echo $li;
if (++$i == 7) break;
}
}
}
function listening() {
require_once('lib/html_dom.php');
$url = 'https://davidawindham.com/studio/music/';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('ul .wtracks li') as $li) {
if (!empty($html)) {
echo $li;
if (++$i == 7) break;
}
}
}
function reading() {
require_once('lib/html_dom.php');
$url = 'https://davidawindham.com/til/lists/now/reading';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('.markdown ul li') as $li) {
if (!empty($html)) {
echo $li;
if (++$i == 7) break;
}
}
}
function playing() {
require_once('lib/html_dom.php');
$url = 'https://davidawindham.com/til/lists/now/playing';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('.markdown ul li') as $li) {
if (!empty($html)) {
echo $li;
if (++$i == 7) break;
}
}
}
function watching() {
require_once('lib/html_dom.php');
$url = 'https://davidawindham.com/til/lists/now/watching';
$html = file_get_html($url);
$i = 0;
foreach ($html->find('.markdown ul li') as $li) {
if (!empty($html)) {
echo $li;
if (++$i == 7) break;
}
}
}