Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/hopeinstoughton_www/wp-content/plugins/xapian-search/ |
Upload File : |
<?php
// register widget
class XapianSearchWidget extends WP_Widget {
function __construct() {
parent::WP_Widget(false, $name = 'Keyword Search');
}
private function _asDuration($x) {
$duration = $x;
$hours = floor($duration / 3600);
$duration %= 3600;
$duration = sprintf('%d:%02d:%02d', $hours, floor($duration / 60), $duration % 60);
return $duration;
}
/** @see WP_Widget::widget */
public function widget($args, $instance) {
global $MEDIASEARCH;
extract( $args );
if (is_object($MEDIASEARCH)) {
$searchbox = $MEDIASEARCH->_shortcode_searchbar(['width'=> '100%', 'action' => '/members/search']);
} else {
$searchbox = '';
}
$table = '';
$info = get_option('media-manager-stats');
foreach($info as $entry) {
$link = '';
switch($entry['type']) {
case 'ex': $desc = 'Exhortations'; $link='/members/video-archive-by-speaker/'; break;
case 'ac': $desc = 'Adult Class'; $link='/members/classes/'; break;
case 'bc': $desc = 'Bible Class'; $link='/members/classes/'; break;
case 'mt': $desc = 'Moorestown Audio'; $link='/members/audio-archive'; break;
case 'cbt': $desc = 'Christo Bible Talks'; $link='/members/audio-archive'; break;
}
$hours = floor($entry['duration'] / 3600);
if ($link != '') {
$desc = "<a href=\"$link\">$desc</a>";
}
$table .= "<tr><td>$desc</td><td style=\"text-align:right\">{$entry['speakers']}</td><td style=\"text-align:right\">{$entry['talks']}</td><td style=\"text-align:right\">{$hours}hr</td></tr>";
}
$title = apply_filters('widget_title', $instance['title']);
echo <<<BLOCK
$before_widget$before_title$title$after_title
<div style="padding: 0 10px 10px;">
$searchbox
{$instance['text']}
</div>
<h4 class="widgettitle">Archive Statistics</h4>
<div style="padding: 0 10px 10px;">
<table border="0" cellpadding="0" cellspacing="2" style="width:100%">
<tr><td>Source</td><td style="text-align:right">Speakers</td><td style="text-align:right">Talks</td><td style="text-align:right">Duration</td></tr>
$table
</table>
</div>
$after_widget
BLOCK;
//echo '<pre>' . htmlspecialchars(var_export($args, 1)) . '</pre>';
}
/** @see WP_Widget::update */
public function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['text'] = $new_instance['text'];
return $instance;
}
/** @see WP_Widget::form */
public function form($instance) {
if (empty($instance['title'])) $instance['title'] = 'Search';
if (empty($instance['text'])) $instance['text'] = '<p>Search Exhorts, Classes and Bible Schools<p>';
//Defaults
$title = esc_attr( $instance['title'] );
$fieldid = $this->get_field_id('title');
$fieldname = $this->get_field_name('title');
$t = translate( 'Title:', 'default');
echo <<<BLOCK
<p><label for="$fieldid">$t <input class="widefat" id="$fieldid" name="$fieldname" type="text" value="$title" /></label></p>
BLOCK;
$title = esc_attr( $instance['text'] );
$fieldid = $this->get_field_id('text');
$fieldname = $this->get_field_name('text');
$t = translate( 'Text:', 'default');
echo <<<BLOCK
<p><label for="$fieldid">$t</label> <textarea class="widefat" rows="6" cols="20" id="$fieldid" name="$fieldname">$title</textarea></p>
BLOCK;
}
}
function XapianSearchWidget_register() {
register_widget( 'XapianSearchWidget' );
}
add_action( 'widgets_init', 'XapianSearchWidget_register' );