| Server IP : www.new.bangkokfinder.com / Your IP : 172.68.242.5 Web Server : nginx/1.20.1 System : Linux new 4.15.0-159-generic #167-Ubuntu SMP Tue Sep 21 08:55:05 UTC 2021 x86_64 User : bangkokfinder ( 1000) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/bangkokfinder/www/wp-content/plugins/bkfMod/ |
Upload File : |
<?php
/*
Plugin Name: bangkok finder Mooifications plugin
Description: bangkok finder Mooifications plugin
Version: 0.1
Author: Nikhil
*/
function bkf_script_for_next_prev() {
wp_register_script('bkf_script_for_next_prev', plugins_url('bkf_nextPrev.js', __FILE__), array('jquery'), '.1', TRUE);
wp_enqueue_script('bkf_script_for_next_prev', array('jquery'), '.1', TRUE);
}
add_action('wp_enqueue_scripts', 'bkf_script_for_next_prev');
/*
*
// ALternativbe attempt at adding rel= next/prev...
*
require(__DIR__ . '/QueryPath/QueryPath.php');
function bkfMod_check_element($ele) {
if (count($ele)) {
$attrClass = $ele->attr('class');
if ($attrClass) {
if (stristr($attrClass, 'disabled')) {
$ret = FALSE;
}
else {
$ret = $ele;
}
}
else {
$ret = $ele ;
}
}
else{
$ret = false ;
}
return $ret ;
}
$nextLink = false ;
add_filter('do_shortcode_tag', function ($content) {
global $nextLink ;
$qp = htmlqp($content)->branch()->find('.pagination');
if (bkfMod_check_element($qp)) {
if ($nextqp = bkfMod_check_element($qp->branch()->find('.next a') )) {
//add next to head element
$nextLink = $nextqp->attr('href');
do_action( 'my-home' );
}
if ($prevqp = bkfMod_check_element($qp->branch()->find('.prev a'))) {
$prevLink = $prevqp->attr('href');
add_action('wp_head', function () use ($prevLink) {
echo '<link rel="prev" href="' . $prevLink . '" />';
});
//add prev to head element
}
}
return $content;
},1);
function your_function() {
$page = ob_get_flush();
$qp = htmlqp($page)->branch()->find('.pagination');
if (bkfMod_check_element($qp)) {
if ($nextqp = bkfMod_check_element($qp->branch()->find('.next a') )) {
//add next to head element
$nextLink = $nextqp->attr('href');
if ($nextLink){
// var_dump('<link rel="next" href="'.$nextLink.'" />');die;
str_replace('</head>',PHP_EOL.'<link rel="next" href="'.$nextLink.'" />'.PHP_EOL.'</head>',$page);
}
}
if ($prevqp = bkfMod_check_element($qp->branch()->find('.prev a'))) {
$prevLink = $prevqp->attr('href');
if ($prevLink){
str_replace('<head>','<head>'.PHP_EOL.'<link rel="prev" href="'.$prevLink.'" />'.PHP_EOL,$page);
}
//add prev to head element
}
}
echo $page;
}
add_action( 'wp_footer', 'your_function', 100 );
add_action('init', function () {
ob_start();
});
*/