本文整理汇总了PHP中wppa_initialize_runtime函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_initialize_runtime函数的具体用法?PHP wppa_initialize_runtime怎么用?PHP wppa_initialize_runtime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_initialize_runtime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
function widget($args, $instance)
{
global $wppa;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => __('WPPA+ Text', 'wppa'), 'text' => '', 'loggedinonly' => false));
if ($instance['loggedinonly'] && !is_user_logged_in()) {
return;
}
$title = apply_filters('widget_title', $instance['title']);
$wppa['in_widget'] = 'gp';
$wppa['mocc']++;
echo $before_widget;
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
$text = apply_filters('widget_text', $instance['text'], $instance);
// $text = apply_filters('widget_text', __($instance['text']));
if ($instance['filter']) {
$text = wpautop($text);
}
$text = '<div class="wppa-gp-widget" style="margin-top:2px; margin-left:2px;" >' . wppa_albums_filter(do_shortcode($text)) . '</div>';
echo $text;
echo '<div style="clear:both"></div>';
echo $after_widget;
$wppa['in_widget'] = false;
$wppa['fullsize'] = '';
// Reset to prevent inheritage of wrong size in case widget is rendered before main column
}
示例2: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $widget_content;
wppa('in_widget', 'multitag');
wppa_bump_mocc();
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => __('Photo Tags', 'wp-photo-album-plus'), 'cols' => '2', 'tags' => array()));
$widget_title = apply_filters('widget_title', $instance['title']);
// Display the widget
echo $before_widget;
if (!empty($widget_title)) {
echo $before_title . $widget_title . $after_title;
}
$tags = is_array($instance['tags']) ? implode(',', $instance['tags']) : '';
echo '<div class="wppa-multitag-widget" >' . wppa_get_multitag_html($instance['cols'], $tags) . '</div>';
echo '<div style="clear:both"></div>';
echo $after_widget;
wppa('in_widget', false);
}
示例3: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $widget_content;
global $wpdb;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
wppa('mocc', wppa('mocc') + 1);
wppa('in_widget', 'search');
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => __('Search Photos', 'wp-photo-album-plus'), 'label' => '', 'root' => false, 'sub' => false, 'album' => '', 'landingpage' => '0'));
$widget_title = apply_filters('widget_title', $instance['title']);
// Display the widget
echo $before_widget;
if (!empty($widget_title)) {
echo $before_title . $widget_title . $after_title;
}
echo wppa_get_search_html($instance['label'], $instance['sub'], $instance['root'], $instance['album'], $instance['landingpage']);
echo $after_widget;
wppa('in_widget', false);
}
示例4: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $widget_content;
global $wppa;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
$wppa['in_widget'] = 'tagcloud';
$wppa['mocc']++;
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => __('Photo Tags', 'wppa'), 'tags' => array()));
if (empty($instance['tags'])) {
$instance['tags'] = array();
}
$widget_title = apply_filters('widget_title', $instance['title']);
// Display the widget
echo $before_widget;
if (!empty($widget_title)) {
echo $before_title . $widget_title . $after_title;
}
echo '<div class="wppa-tagcloud-widget" >' . wppa_get_tagcloud_html(implode(',', $instance['tags'])) . '</div>';
echo '<div style="clear:both"></div>';
echo $after_widget;
}
示例5: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $wpdb;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
wppa('in_widget', 'stereo');
wppa_bump_mocc();
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => __('3D Stereo Settings', 'wp-photo-album-plus')));
$widget_title = apply_filters('widget_title', $instance['title']);
$widget_content = "\n" . '<!-- WPPA+ stereo Widget start -->';
$widget_content .= wppa_get_stereo_html();
$widget_content .= '<div style="clear:both"></div>';
$widget_content .= "\n" . '<!-- WPPA+ stereo Widget end -->';
echo "\n" . $before_widget;
if (!empty($widget_title)) {
echo $before_title . $widget_title . $after_title;
}
echo $widget_content . $after_widget;
wppa('in_widget', false);
}
示例6: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $wpdb;
global $widget_content;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('QR Widget', 'wp-photo-album-plus') : $instance['title']);
$qrsrc = 'http://api.qrserver.com/v1/create-qr-code/' . '?data=' . site_url() . '&size=' . wppa_opt('qr_size') . 'x' . wppa_opt('qr_size') . '&color=' . trim(wppa_opt('qr_color'), '#') . '&bgcolor=' . trim(wppa_opt('qr_bgcolor'));
$widget_content = '
<div style="text-align:center;" ><img id="wppa-qr-img" src="' . $qrsrc . '" title="" alt="' . __('QR code', 'wp-photo-album-plus') . '" /></div>
<div style="clear:both" ></div>';
$widget_content .= '
<script type="text/javascript">
/*[CDATA[*/
var wppaQRData = document.location.href;
var wppaQRDataOld = "";
var wppaQRSrc = "";
var workData = "";
wppaConsoleLog( "doc.loc.href = " + wppaQRData );
function wppaQRUpdate( arg ) {
if ( arg ) wppaQRData = arg;
if ( wppaQRData != wppaQRDataOld ) {
wppaQRDataOld = wppaQRData;
workData = wppaQRData;
wppaQRSrc = "http://api.qrserver.com/v1/create-qr-code/?data=" +
encodeURIComponent( workData ) +
"&size=' . wppa_opt('qr_size') . 'x' . wppa_opt('qr_size') . '&color=' . trim(wppa_opt('qr_color'), '#') . '&bgcolor=' . trim(wppa_opt('qr_bgcolor'), '#') . '";
document.getElementById( "wppa-qr-img" ).src = wppaQRSrc;
document.getElementById( "wppa-qr-img" ).title = workData;
}
return;
}
jQuery(document).ready(function(){
wppaQRUpdate();
});
/*]]*/
</script>';
echo $before_widget . $before_title . $title . $after_title . $widget_content . $after_widget;
}
示例7: widget
function widget($args, $instance)
{
global $wpdb;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => '', 'album' => '0'));
$title = apply_filters('widget_title', $instance['title']);
$album = $instance['album'];
if (!$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_ALBUMS . "` WHERE `id` = %d", $album))) {
$album = '0';
// Album vanished
}
wppa_user_upload();
// Do the upload if required
wppa('in_widget', 'upload');
wppa_bump_mocc();
$mocc = wppa('mocc');
$is_responsive = wppa_opt('colwidth') == 'auto';
if ($is_responsive) {
// Responsive widgetwppaAutoColumnWidth[1] = true;
$js = wppa_get_responsive_widget_js_html($mocc);
} else {
$js = '';
}
$create = wppa_get_user_create_html($album, wppa_opt('widget_width'), 'widget');
$upload = wppa_get_user_upload_html($album, wppa_opt('widget_width'), 'widget', $is_responsive);
if (!$create && !$upload) {
return;
}
// Nothing to do
$text = '<div id="wppa-container-' . $mocc . '" class="wppa-upload-widget" style="margin-top:2px; margin-left:2px;" >' . $js . $create . $upload . '</div>';
echo $before_widget;
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
echo $text;
echo '<div style="clear:both"></div>';
echo $after_widget;
wppa('in_widget', false);
}
示例8: widget
function widget($args, $instance)
{
global $wppa;
global $wppa_opt;
global $wpdb;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => '', 'album' => '0'));
$title = apply_filters('widget_title', $instance['title']);
$album = $instance['album'];
if (!$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_ALBUMS . "` WHERE `id` = %d", $album))) {
$album = '0';
// Album vanished
}
wppa_user_upload();
// Do the upload if required
$wppa['in_widget'] = 'upload';
$wppa['mocc']++;
$wppa['out'] = '';
if (wppa_switch('wppa_user_upload_login') && !is_user_logged_in()) {
return;
}
// Not logged in while login req'd for upload, no create also
wppa_user_create_html($album, $wppa_opt['wppa_widget_width'], 'widget');
wppa_user_upload_html($album, $wppa_opt['wppa_widget_width'], 'widget');
if (!$wppa['out']) {
return;
}
// No possibility to upload or create, skip the widget
$text = '<div class="wppa-upload-widget" style="margin-top:2px; margin-left:2px;" >' . $wppa['out'] . '</div>';
$wppa['out'] = '';
echo $before_widget;
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
echo $text;
echo '<div style="clear:both"></div>';
echo $after_widget;
$wppa['in_widget'] = false;
}
示例9: wppa_restore_settings
function wppa_restore_settings($fname, $type = '')
{
if (wppa('debug')) {
wppa_dbg_msg('Restoring from: ' . $fname);
}
if ($type == 'skin') {
$void_these = array('wppa_revision', 'wppa_resize_on_upload', 'wppa_allow_debug', 'wppa_thumb_linkpage', 'wppa_mphoto_linkpage', 'wppa_widget_linkpage', 'wppa_slideonly_widget_linkpage', 'wppa_topten_widget_linkpage', 'wppa_coverimg_linkpage', 'wppa_search_linkpage', 'permalink_structure', 'wppa_rating_max', 'wppa_file_system');
} else {
$void_these = array('wppa_revision', 'wppa_rating_max', 'wppa_file_system');
}
// Open file
$file = fopen($fname, 'r');
// Restore
if ($file) {
$buffer = fgets($file, 4096);
while (!feof($file)) {
$buflen = strlen($buffer);
if ($buflen > '0' && substr($buffer, 0, 1) != '/') {
// lines that start with '/' are comment
$cpos = strpos($buffer, ':');
$delta_l = $buflen - $cpos - 2;
if ($cpos && $delta_l >= 0) {
$slug = substr($buffer, 0, $cpos);
$value = substr($buffer, $cpos + 1, $delta_l);
$value = str_replace('\\n', "\n", $value);
// Replace substr '\n' by nl char value
$value = stripslashes($value);
//wppa_dbg_msg( 'Doing|'.$slug.'|'.$value );
if (!in_array($slug, $void_these)) {
wppa_update_option($slug, $value);
} else {
wppa_dbg_msg($slug . ' skipped');
}
}
}
$buffer = fgets($file, 4096);
}
fclose($file);
wppa_initialize_runtime(true);
return true;
} else {
wppa_error_message(__('Settings file not found', 'wp-photo-album-plus'));
return false;
}
}
示例10: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $wpdb;
global $wppa;
global $widget_content;
global $thumb;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
$wppa['in_widget'] = 'bestof';
$wppa['mocc']++;
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => '', 'count' => '1', 'sortby' => 'maxratingcount', 'display' => 'photo', 'period' => 'thisweek', 'maxratings' => 'yes', 'meanrat' => 'yes', 'ratcount' => 'yes', 'linktype' => 'none'));
$widget_title = apply_filters('widget_title', $instance['title']);
$page = in_array($instance['linktype'], $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_bestof_widget_linkpage', __a('Best Of Photos'));
$count = $instance['count'];
$sortby = $instance['sortby'];
$display = $instance['display'];
$period = $instance['period'];
$maxratings = $instance['maxratings'];
$meanrat = $instance['meanrat'];
$ratcount = $instance['ratcount'];
$linktype = $instance['linktype'];
$size = wppa_opt('wppa_widget_width');
// $data = wppa_get_the_bestof( $count, $period, $sortby, $display );
$lineheight = wppa_opt('wppa_fontsize_widget_thumb') * 1.5;
$widget_content = "\n" . '<!-- WPPA+ BestOf Widget start -->';
$widget_content .= wppa_bestof_html(array('page' => $page, 'count' => $count, 'sortby' => $sortby, 'display' => $display, 'period' => $period, 'maxratings' => $maxratings, 'meanrat' => $meanrat, 'ratcount' => $ratcount, 'linktype' => $linktype, 'size' => $size, 'lineheight' => $lineheight));
$widget_content .= '<div style="clear:both"></div>';
$widget_content .= "\n" . '<!-- WPPA+ BestOf Widget end -->';
echo "\n" . $before_widget;
if (!empty($widget_title)) {
echo $before_title . $widget_title . $after_title;
}
echo $widget_content . $after_widget;
}
示例11: widget
function widget($args, $instance)
{
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => __('WPPA+ Text', 'wp-photo-album-plus'), 'text' => '', 'loggedinonly' => false));
if ($instance['loggedinonly'] && !is_user_logged_in()) {
return;
}
$title = apply_filters('widget_title', $instance['title']);
wppa('in_widget', 'gp');
wppa_bump_mocc();
// Open the widget
echo $before_widget;
// Title optional
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
// Body
$text = $instance['text'];
if ($instance['filter']) {
// Do wpautop BEFORE do_shortcode
$text = wpautop($text);
}
$text = do_shortcode($text);
$text = apply_filters('widget_text', $text);
// If shortcode at wppa filter priority, insert result. See wppa-filter.php
echo '<div class="wppa-gp-widget" style="margin-top:2px; margin-left:2px;" >' . $text . '</div>';
echo '<div style="clear:both"></div>';
// Close widget
echo $after_widget;
wppa('in_widget', false);
wppa('fullsize', '');
// Reset to prevent inheritage of wrong size in case widget is rendered before main column
}
示例12: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $wpdb;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
wppa('in_widget', 'albnav');
wppa_bump_mocc();
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => '', 'parent' => '0', 'skip' => 'yes'));
$widget_title = apply_filters('widget_title', $instance['title']);
$page = wppa_get_the_landing_page('album_navigator_widget_linkpage', __('Photo Albums', 'wp-photo-album-plus'));
$parent = $instance['parent'];
$skip = $instance['skip'];
$widget_content = "\n" . '<!-- WPPA+ Album Navigator Widget start -->';
$widget_content .= '<div style="width:100%; overflow:hidden; position:relative; left: -12px;" >';
if ($parent == 'all') {
$widget_content .= $this->do_album_navigator('0', $page, $skip, '');
$widget_content .= $this->do_album_navigator('-1', $page, $skip, '');
} elseif ($parent == 'owner') {
$widget_content .= $this->do_album_navigator('0', $page, $skip, '', " AND ( `owner` = '--- public ---' OR `owner` = '" . wppa_get_user() . "' ) ");
$widget_content .= $this->do_album_navigator('-1', $page, $skip, '', " AND ( `owner` = '--- public ---' OR `owner` = '" . wppa_get_user() . "' ) ");
} else {
$widget_content .= $this->do_album_navigator($parent, $page, $skip, '');
}
$widget_content .= '</div>';
$widget_content .= '<div style="clear:both"></div>';
$widget_content .= "\n" . '<!-- WPPA+ Album Navigator Widget end -->';
echo "\n" . $before_widget;
if (!empty($widget_title)) {
echo $before_title . $widget_title . $after_title;
}
echo $widget_content . $after_widget;
wppa('in_widget', false);
}
示例13: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $wpdb;
global $widget_content;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => '', 'root' => '0', 'sort' => true));
$widget_title = apply_filters('widget_title', $instance['title']);
$album_root = $instance['root'];
$sort = $instance['sort'];
wppa('in_widget', 'superview');
wppa_bump_mocc();
$widget_content = wppa_get_superview_html($album_root, $sort);
wppa('in_widget', false);
echo $before_widget . $before_title . $widget_title . $after_title . $widget_content . $after_widget;
}
示例14: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $wpdb;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
wppa('in_widget', 'com');
wppa_bump_mocc();
// Hide widget if not logged in and login required to see comments
if (wppa_switch('comment_view_login') && !is_user_logged_in()) {
return;
}
extract($args);
$page = in_array(wppa_opt('comment_widget_linktype'), wppa('links_no_page')) ? '' : wppa_get_the_landing_page('wppa_comment_widget_linkpage', __('Recently commented photos', 'wp-photo-album-plus'));
$max = wppa_opt('comten_count');
$widget_title = apply_filters('widget_title', $instance['title']);
$photo_ids = wppa_get_comten_ids($max);
$widget_content = "\n" . '<!-- WPPA+ Comment Widget start -->';
$maxw = wppa_opt('comten_size');
$maxh = $maxw + 18;
if ($photo_ids) {
foreach ($photo_ids as $id) {
// Make the HTML for current comment
$widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">';
$image = wppa_cache_thumb($id);
if ($image) {
$link = wppa_get_imglnk_a('comten', $id, '', '', true);
$file = wppa_get_thumb_path($id);
$imgstyle_a = wppa_get_imgstyle_a($id, $file, $maxw, 'center', 'comthumb');
$imgstyle = $imgstyle_a['style'];
$width = $imgstyle_a['width'];
$height = $imgstyle_a['height'];
$cursor = $imgstyle_a['cursor'];
$imgurl = wppa_get_thumb_url($id, '', $width, $height);
$imgevents = wppa_get_imgevents('thumb', $id, true);
$title = '';
$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s ORDER BY `timestamp` DESC", $id), ARRAY_A);
if ($comments) {
$first_comment = $comments['0'];
foreach ($comments as $comment) {
$title .= $comment['user'] . ' ' . __('wrote', 'wp-photo-album-plus') . ' ' . wppa_get_time_since($comment['timestamp']) . ":\n";
$title .= $comment['comment'] . "\n\n";
}
}
$title = esc_attr(strip_tags(trim($title)));
$album = '0';
$display = 'thumbs';
$widget_content .= wppa_get_the_widget_thumb('comten', $image, $album, $display, $link, $title, $imgurl, $imgstyle_a, $imgevents);
} else {
$widget_content .= __('Photo not found.', 'wp-photo-album-plus');
}
$widget_content .= "\n\t" . '<span style="font-size:' . wppa_opt('fontsize_widget_thumb') . 'px; cursor:pointer;" title="' . esc_attr($first_comment['comment']) . '" >' . $first_comment['user'] . '</span>';
$widget_content .= "\n" . '</div>';
}
} else {
$widget_content .= 'There are no commented photos (yet).';
}
$widget_content .= '<div style="clear:both"></div>';
$widget_content .= "\n" . '<!-- WPPA+ comment Widget end -->';
echo "\n" . $before_widget;
if (!empty($widget_title)) {
echo $before_title . $widget_title . $after_title;
}
echo $widget_content . $after_widget;
wppa('in_widget', false);
}
示例15: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $wpdb;
global $wppa_opt;
global $wppa;
require_once dirname(__FILE__) . '/wppa-links.php';
require_once dirname(__FILE__) . '/wppa-styles.php';
require_once dirname(__FILE__) . '/wppa-functions.php';
require_once dirname(__FILE__) . '/wppa-thumbnails.php';
require_once dirname(__FILE__) . '/wppa-boxes-html.php';
require_once dirname(__FILE__) . '/wppa-slideshow.php';
wppa_initialize_runtime();
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => '', 'album' => ''));
$widget_title = apply_filters('widget_title', $instance['title']);
$page = in_array($wppa_opt['wppa_featen_widget_linktype'], $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_featen_widget_linkpage', __a('Featured photos'));
$max = $wppa_opt['wppa_featen_count'];
$album = $instance['album'];
$generic = $album == '-2';
if ($generic) {
$album = '0';
$max += '1000';
}
if ($album) {
$thumbs = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status`= 'featured' AND `album` = %s ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, $album), ARRAY_A);
} else {
$thumbs = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status` = 'featured' ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, ARRAY_A);
}
$widget_content = "\n" . '<!-- WPPA+ FeaTen Widget start -->';
$maxw = $wppa_opt['wppa_featen_size'];
$maxh = $maxw;
$lineheight = $wppa_opt['wppa_fontsize_widget_thumb'] * 1.5;
$maxh += $lineheight;
if (false) {
$maxh += $lineheight;
}
$count = '0';
if ($thumbs) {
foreach ($thumbs as $image) {
global $thumb;
$thumb = $image;
if ($generic && wppa_is_separate($thumb['album'])) {
continue;
}
// Make the HTML for current picture
$widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">';
if ($image) {
$no_album = !$album;
if ($no_album) {
$tit = __a('View the featured photos', 'wppa_theme');
} else {
$tit = esc_attr(wppa_qtrans(stripslashes($image['description'])));
}
$link = wppa_get_imglnk_a('featen', $image['id'], '', $tit, '', $no_album);
$file = wppa_get_thumb_path($image['id']);
$imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'ttthumb');
$imgstyle = $imgstyle_a['style'];
$width = $imgstyle_a['width'];
$height = $imgstyle_a['height'];
$cursor = $imgstyle_a['cursor'];
$imgurl = wppa_get_thumb_url($image['id'], '', $width, $height);
$imgevents = wppa_get_imgevents('thumb', $image['id'], true);
if ($link) {
$title = esc_attr(stripslashes($link['title']));
} else {
$title = '';
}
$album = '0';
$display = 'thumbs';
$widget_content .= wppa_get_the_widget_thumb('featen', $image, $album, $display, $link, $title, $imgurl, $imgstyle_a, $imgevents);
} else {
// No image
$widget_content .= __a('Photo not found.', 'wppa_theme');
}
$widget_content .= "\n" . '</div>';
$count++;
if ($count == $wppa_opt['wppa_featen_count']) {
break;
}
}
} else {
$widget_content .= 'There are no featured photos (yet).';
}
$widget_content .= '<div style="clear:both"></div>';
$widget_content .= "\n" . '<!-- WPPA+ FeaTen Widget end -->';
echo "\n" . $before_widget;
if (!empty($widget_title)) {
echo $before_title . $widget_title . $after_title;
}
echo $widget_content . $after_widget;
}