本文整理汇总了PHP中wppa_dbg_msg函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_dbg_msg函数的具体用法?PHP wppa_dbg_msg怎么用?PHP wppa_dbg_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_dbg_msg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wppa_get_user
function wppa_get_user($type = 'login')
{
global $current_user;
if (is_user_logged_in()) {
get_currentuserinfo();
switch ($type) {
case 'login':
return $current_user->user_login;
break;
case 'display':
return $current_user->display_name;
break;
case 'id':
return $current_user->ID;
break;
case 'firstlast':
return $current_user->user_firstname . ' ' . $current_user->user_lastname;
break;
default:
wppa_dbg_msg('Un-implemented type: ' . $type . ' in wppa_get_user()', 'red', 'force');
return '';
}
} else {
return $_SERVER['REMOTE_ADDR'];
}
}
开发者ID:billadams,项目名称:forever-frame,代码行数:26,代码来源:wppa-users.php
示例2: wppa_get_user
function wppa_get_user($type = 'login')
{
static $current_user;
if (!$current_user) {
$current_user = wp_get_current_user();
}
if ($current_user->exists()) {
switch ($type) {
case 'login':
return $current_user->user_login;
break;
case 'display':
return $current_user->display_name;
break;
case 'id':
return $current_user->ID;
break;
case 'firstlast':
return $current_user->user_firstname . ' ' . $current_user->user_lastname;
break;
default:
wppa_dbg_msg('Un-implemented type: ' . $type . ' in wppa_get_user()', 'red', 'force');
return '';
}
} else {
return $_SERVER['REMOTE_ADDR'];
}
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:28,代码来源:wppa-users.php
示例3: wppa_cdn
function wppa_cdn($side)
{
// What did we specify in the settings page?
$cdn = wppa_opt('cdn_service');
// Check for fully configured and active
switch ($cdn) {
case 'cloudinary':
case 'cloudinarymaintenance':
if (wppa_opt('cdn_cloud_name') && wppa_opt('cdn_api_key') && wppa_opt('cdn_api_secret')) {
if ($side == 'admin') {
// Admin: always return cloudinary
$cdn = 'cloudinary';
} elseif ($side == 'front') {
// Front: NOT if in maintenance
if ($cdn == 'cloudinarymaintenance') {
$cdn = false;
}
} else {
wppa_dbg_msg('dbg', 'Wrong arg:' . $side . ' in wppa_cdn()', 'red', 'force');
$cdn = false;
}
} else {
wppa_dbg_msg('dbg', 'Incomplete configuration of Cloudinary', 'red', 'force');
$cdn = false;
// Incomplete configuration
}
break;
default:
$cdn = false;
}
return $cdn;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:32,代码来源:wppa-utils.php
示例4: wppa_microtime
function wppa_microtime($txt = '')
{
static $old;
$new = microtime(true);
if ($old) {
$delta = $new - $old;
$old = $new;
$msg = sprintf('%s took %7.3f s.', $txt, $delta);
wppa_dbg_msg($msg, 'green', true);
} else {
$old = $new;
}
}
开发者ID:billadams,项目名称:forever-frame,代码行数:13,代码来源:wppa-utils.php
示例5: wppa_import_dir_to_album
function wppa_import_dir_to_album($file, $parent)
{
global $photocount;
global $wpdb;
global $wppa_session;
// Session should survive the default hour
wppa_extend_session();
// see if album exists
if (is_dir($file)) {
// Check parent
if (wppa_switch('import_parent_check')) {
$alb = wppa_get_album_id(basename($file), $parent);
// If parent = 0 ( top-level album ) and album not found,
// try a 'separate' album ( i.e. parent = -1 ) with this name
if (!$alb && $parent == '0') {
$alb = wppa_get_album_id(basename($file), '-1');
}
} else {
$alb = wppa_get_album_id(basename($file), false);
}
if (!$alb) {
// Album must be created
$name = basename($file);
$uplim = wppa_opt('upload_limit_count') . '/' . wppa_opt('upload_limit_time');
$alb = wppa_create_album_entry(array('name' => $name, 'a_parent' => $parent));
if ($alb === false) {
wppa_error_message(__('Could not create album.', 'wp-photo-album-plus') . '<br/>Query = ' . $query);
wp_die('Sorry, cannot continue');
} else {
wppa_set_last_album($alb);
wppa_flush_treecounts($alb);
wppa_index_add('album', $alb);
wppa_create_pl_htaccess();
wppa_ok_message(__('Album #', 'wp-photo-album-plus') . ' ' . $alb . ' ( ' . $name . ' ) ' . __('Added.', 'wp-photo-album-plus'));
if (wppa_switch('newpag_create') && $parent <= '0') {
// Create post object
$my_post = array('post_title' => $name, 'post_content' => str_replace('w#album', $alb, wppa_opt('newpag_content')), 'post_status' => wppa_opt('newpag_status'), 'post_type' => wppa_opt('newpag_type'));
// Insert the post into the database
$pagid = wp_insert_post($my_post);
if ($pagid) {
wppa_ok_message(sprintf(__('Page <a href="%s" target="_blank" >%s</a> created.', 'wp-photo-album-plus'), home_url() . '?page_id=' . $pagid, $name));
$wpdb->query($wpdb->prepare("UPDATE `" . WPPA_ALBUMS . "` SET `cover_linkpage` = %s WHERE `id` = %s", $pagid, $alb));
} else {
wppa_error_message(__('Could not create page.', 'wp-photo-album-plus'));
}
}
}
}
// Now import the files
$photofiles = glob($file . '/*');
if ($photofiles) {
foreach ($photofiles as $photofile) {
if (!is_dir($photofile)) {
if (!isset($wppa_session[$photofile]) || !wppa_switch('keep_import_files')) {
if (wppa_albumphoto_exists($alb, basename($photofile))) {
if (!wppa_switch('keep_import_files')) {
wppa_warning_message('Photo ' . basename($photofile) . ' already exists in album ' . $alb . '. Removed. (2)');
}
} else {
$bret = wppa_insert_photo($photofile, $alb, basename($photofile));
$photocount++;
}
if (!wppa_switch('keep_import_files')) {
@unlink($photofile);
}
$wppa_session[$photofile] = true;
}
if (wppa_is_time_up($photocount)) {
return false;
}
}
}
}
// Now go deeper, process the subdirs
$subdirs = glob($file . '/*');
if ($subdirs) {
foreach ($subdirs as $subdir) {
if (is_dir($subdir)) {
if (basename($subdir) != '.' && basename($subdir) != '..') {
$bret = wppa_import_dir_to_album($subdir, $alb);
if (!$bret) {
return false;
}
// Time out
}
}
}
}
@rmdir($file);
// Try to remove dir, ignore error
} else {
wppa_dbg_msg('Invalid file in wppa_import_dir_to_album(): ' . $file);
return false;
}
return true;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:96,代码来源:wppa-import.php
示例6: wppa_slide_filmstrip
//.........这里部分代码省略.........
}
if (!$do_it) {
return;
}
// Don't do it
$t = -microtime(true);
$alb = wppa_get_get('album');
$thumbs = wppa_get_thumbs();
if (!$thumbs || count($thumbs) < 1) {
return;
}
$preambule = wppa_get_preambule();
$width = (wppa_opt('tf_width') + wppa_opt('tn_margin')) * (count($thumbs) + 2 * $preambule);
$width += wppa_opt('tn_margin') + 2;
$topmarg = wppa_opt('thumbsize') / 2 - 16;
$height = wppa_opt('thumbsize') + wppa_opt('tn_margin');
$height1 = wppa_opt('thumbsize');
$marg = '42';
// 32
$fs = '24';
$fw = '42';
if (wppa_in_widget()) {
$width /= 2;
$topmarg /= 2;
$height /= 2;
$height1 /= 2;
$marg = '21';
$fs = '12';
$fw = '21';
}
$conw = wppa_get_container_width();
if ($conw < 1) {
$conw *= 640;
}
$w = $conw - (2 * 6 + 2 * 42 + 2 * wppa_opt('bwidth'));
/* 2*padding + 2*arrows + 2*border */
if (wppa_in_widget()) {
$w = $conw - (2 * 6 + 2 * 21 + 2 * wppa_opt('bwidth'));
}
/* 2*padding + 2*arrow + 2*border */
$IE6 = 'width: ' . $w . 'px;';
$pagsiz = round($w / (wppa_opt('thumbsize') + wppa_opt('tn_margin')));
if (wppa_in_widget()) {
$pagsiz = round($w / (wppa_opt('thumbsize') / 2 + wppa_opt('tn_margin') / 2));
}
wppa_add_js_page_data('<script type="text/javascript">');
wppa_add_js_page_data('wppaFilmPageSize[' . wppa('mocc') . '] = ' . $pagsiz . ';');
wppa_add_js_page_data('</script>');
if (is_feed()) {
wppa_out('<div style="' . __wcs('wppa-box') . __wcs('wppa-nav') . '">');
} else {
wppa_out('<div' . ' class="wppa-box wppa-nav"' . ' style="text-align:center; ' . __wcs('wppa-box') . __wcs('wppa-nav') . 'height:' . $height . 'px;"' . ' >' . '<div' . ' style="float:left; text-align:left; cursor:pointer; margin-top:' . $topmarg . 'px; width: ' . $fw . 'px; font-size: ' . $fs . 'px;"' . ' >' . '<a' . ' class="wppa-prev-' . wppa('mocc') . ' wppa-arrow"' . ' style="' . __wcs('wppa-arrow') . '"' . ' id="prev-film-arrow-' . wppa('mocc') . '"' . ' onclick="wppaFirst(' . wppa('mocc') . ');"' . ' title="' . __('First', 'wp-photo-album-plus') . '"' . ' >' . '«' . '</a>' . '<a' . ' class="wppa-prev-' . wppa('mocc') . ' wppa-arrow"' . ' style="' . __wcs('wppa-arrow') . '"' . ' id="prev-film-arrow-1-' . wppa('mocc') . '"' . ' onclick="wppaPrev(' . wppa('mocc') . ');"' . ' title="' . __('Previous', 'wp-photo-album-plus') . '"' . ' >' . '‹' . '</a>' . '</div>' . '<div' . ' style="float:right; text-align:right; cursor:pointer; margin-top:' . $topmarg . 'px; width: ' . $fw . 'px; font-size: ' . $fs . 'px;"' . ' >' . '<a' . ' class="wppa-next-' . wppa('mocc') . ' wppa-arrow"' . ' style="' . __wcs('wppa-arrow') . '"' . ' id="next-film-arrow-1-' . wppa('mocc') . '"' . ' onclick="wppaNext(' . wppa('mocc') . ');"' . ' title="' . __('Next', 'wp-photo-album-plus') . '"' . ' >' . '›' . '</a>' . '<a' . ' class="wppa-next-' . wppa('mocc') . ' wppa-arrow"' . ' style="' . __wcs('wppa-arrow') . '"' . ' id="next-film-arrow-' . wppa('mocc') . '"' . ' onclick="wppaLast(' . wppa('mocc') . ');"' . ' title="' . __('Last', 'wp-photo-album-plus') . '"' . ' >' . '»' . '</a>' . '</div>' . '<div' . ' id="filmwindow-' . wppa('mocc') . '"' . ' class="filmwindow"' . ' style="' . $IE6 . ' position:absolute; display: block; height:' . $height . 'px; margin: 0 0 0 ' . $marg . 'px; overflow:hidden;"' . ' >' . '<div' . ' id="wppa-filmstrip-' . wppa('mocc') . '"' . ' style="height:' . $height1 . 'px; width:' . $width . 'px; max-width:' . $width . 'px;margin-left: -100px;"' . ' >');
}
wppa_out('<style type="text/css" scoped >' . '.thumbnail-frame { ' . wppa_get_thumb_frame_style(false, 'film') . ' }' . '.wppa-filmthumb-active { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }' . '</style>');
$cnt = count($thumbs);
$start = $cnt - $preambule;
$end = $cnt;
$idx = $start;
// Preambule
while ($idx < $end) {
$glue = $cnt == $idx + 1 ? true : false;
$ix = $idx;
while ($ix < 0) {
$ix += $cnt;
}
$thumb = $thumbs[$ix];
wppa_do_filmthumb($thumb['id'], $ix, false, $glue);
$idx++;
}
// Real thumbs
$idx = 0;
foreach ($thumbs as $tt) {
$thumb = $tt;
$glue = $cnt == $idx + 1 ? true : false;
wppa_do_filmthumb($thumb['id'], $idx, true, $glue);
$idx++;
}
// Postambule
$start = '0';
$end = $preambule;
$idx = $start;
while ($idx < $end) {
$ix = $idx;
while ($ix >= $cnt) {
$ix -= $cnt;
}
$thumb = $thumbs[$ix];
wppa_do_filmthumb($thumb['id'], $ix, false);
$idx++;
}
if (is_feed()) {
wppa_out('</div>');
} else {
wppa_out('</div>');
wppa_out('</div>');
wppa_out('</div>');
}
$t += microtime(true);
wppa_dbg_msg('Filmstrip took ' . $t . ' seconds.');
}
开发者ID:lchen01,项目名称:STEdwards,代码行数:101,代码来源:wppa-slideshow.php
示例7: __wcs
//.........这里部分代码省略.........
}
$opt = wppa_opt('wppa_fontcolor_fulltitle');
if ($opt) {
$result .= 'color:' . $opt . '; ';
}
$opt = wppa_opt('wppa_fontweight_fulltitle');
if ($opt) {
$result .= 'font-weight:' . $opt . '; ';
}
break;
case 'wppa-custom':
$opt = wppa_opt('wppa_bgcolor_cus');
if ($opt) {
$result .= 'background-color:' . $opt . '; ';
}
$opt = wppa_opt('wppa_bcolor_cus');
if ($opt) {
$result .= 'border-color:' . $opt . '; ';
}
break;
case 'wppa-upload':
$opt = wppa_opt('wppa_bgcolor_upload');
if ($opt) {
$result .= 'background-color:' . $opt . '; ';
}
$opt = wppa_opt('wppa_bcolor_upload');
if ($opt) {
$result .= 'border-color:' . $opt . '; ';
}
break;
case 'wppa-multitag':
$opt = wppa_opt('wppa_bgcolor_multitag');
if ($opt) {
$result .= 'background-color:' . $opt . '; ';
}
$opt = wppa_opt('wppa_bcolor_multitag');
if ($opt) {
$result .= 'border-color:' . $opt . '; ';
}
break;
case 'wppa-bestof':
$opt = wppa_opt('wppa_bgcolor_bestof');
if ($opt) {
$result .= 'background-color:' . $opt . '; ';
}
$opt = wppa_opt('wppa_bcolor_bestof');
if ($opt) {
$result .= 'border-color:' . $opt . '; ';
}
break;
case 'wppa-tagcloud':
$opt = wppa_opt('wppa_bgcolor_tagcloud');
if ($opt) {
$result .= 'background-color:' . $opt . '; ';
}
$opt = wppa_opt('wppa_bcolor_tagcloud');
if ($opt) {
$result .= 'border-color:' . $opt . '; ';
}
break;
case 'wppa-superview':
$opt = wppa_opt('wppa_bgcolor_superview');
if ($opt) {
$result .= 'background-color:' . $opt . '; ';
}
$opt = wppa_opt('wppa_bcolor_superview');
if ($opt) {
$result .= 'border-color:' . $opt . '; ';
}
break;
case 'wppa-search':
$opt = wppa_opt('wppa_bgcolor_search');
if ($opt) {
$result .= 'background-color:' . $opt . '; ';
}
$opt = wppa_opt('wppa_bcolor_search');
if ($opt) {
$result .= 'border-color:' . $opt . '; ';
}
break;
case 'wppa-black':
// $opt = wppa_opt( 'wppa_black' );
// if ( $opt ) $result .= 'color:' . $opt . '; ';
// break;
break;
case 'wppa-arrow':
$opt = wppa_opt('wppa_arrow_color');
if ($opt) {
$result .= 'color:' . $opt . '; ';
}
break;
case 'wppa-td':
$result .= 'padding: 3px 2px 3px 0; border: 0';
break;
default:
wppa_dbg_msg('Unexpected error in __wcs, unknown class: ' . $class, 'red');
wppa_log('Err', 'Unexpected error in __wcs, unknown class: ' . $class);
}
return $result;
}
开发者ID:billadams,项目名称:forever-frame,代码行数:101,代码来源:wppa-styles.php
示例8: wppa_get_widgetphotos
function wppa_get_widgetphotos($alb, $option = '')
{
global $wpdb;
$photos = false;
$query = '';
// Compile status clause
switch (wppa_opt('widget_status_filter')) {
case 'publish':
$statusclause = " `status` = 'publish' ";
break;
case 'featured':
$statusclause = " `status` = 'featured' ";
break;
case 'gold':
$statusclause = " `status` = 'gold' ";
break;
case 'silver':
$statusclause = " `status` = 'silver' ";
break;
case 'bronze':
$statusclause = " `status` = 'bronze' ";
break;
case 'anymedal':
$statusclause = " `status` IN ( 'gold', 'silver', 'bronze' ) ";
break;
default:
$statusclause = " `status` <> 'scheduled' ";
if (!is_user_logged_in()) {
$statusclause .= " AND `status` <> 'private' ";
}
}
// Is it a single album?
if (wppa_is_int($alb)) {
$query = $wpdb->prepare("SELECT `id`, `p_order` FROM `" . WPPA_PHOTOS . "` WHERE `album` = %s " . " AND " . $statusclause . $option, $alb);
} elseif (strchr($alb, ',')) {
$alb = trim($alb, ',');
// Test for numeric only ( security test )
$t = str_replace(',', '', $alb);
if (is_numeric($t)) {
$query = "SELECT `id`, `p_order` FROM `" . WPPA_PHOTOS . "` " . "WHERE `album` IN ( " . $alb . " ) " . "AND " . $statusclause . $option;
}
} elseif ($alb == 'all') {
$query = "SELECT `id`, `p_order` FROM `" . WPPA_PHOTOS . "` " . " WHERE " . $statusclause . $option;
} elseif ($alb == 'sep') {
$albs = $wpdb->get_results("SELECT `id`, `a_parent` FROM `" . WPPA_ALBUMS . "`", ARRAY_A);
$query = "SELECT `id`, `p_order` FROM `" . WPPA_PHOTOS . "` WHERE ( `album` = '0' ";
$first = true;
foreach ($albs as $a) {
if ($a['a_parent'] == '-1') {
$query .= "OR `album` = '" . $a['id'] . "' ";
}
}
$query .= ") AND " . $statusclause . $option;
} elseif ($alb == 'all-sep') {
$albs = $wpdb->get_results("SELECT `id`, `a_parent` FROM `" . WPPA_ALBUMS . "`", ARRAY_A);
$query = "SELECT `id`, `p_order` FROM `" . WPPA_PHOTOS . "` WHERE ( `album` IN ('0'";
foreach ($albs as $a) {
if ($a['a_parent'] != '-1') {
$query .= ",'" . $a['id'] . "'";
}
}
$query .= ") ) AND " . $statusclause . $option;
} elseif ($alb == 'topten') {
// Find the 'top' policy
switch (wppa_opt('topten_sortby')) {
case 'mean_rating':
$sortby = '`mean_rating` DESC, `rating_count` DESC, `views` DESC';
break;
case 'rating_count':
$sortby = '`rating_count` DESC, `mean_rating` DESC, `views` DESC';
break;
case 'views':
$sortby = '`views` DESC, `mean_rating` DESC, `rating_count` DESC';
break;
default:
wppa_error_message('Unimplemented sorting method');
$sortby = '';
break;
}
// It is assumed that status is ok for top rated photos
$query = "SELECT `id`, `p_order` FROM `" . WPPA_PHOTOS . "` ORDER BY " . $sortby . " LIMIT " . wppa_opt('topten_count');
$query .= $option;
}
// Do the query
if ($query) {
$photos = $wpdb->get_results($query, ARRAY_A);
wppa_dbg_q('Q-Potd');
wppa_dbg_msg('Potd query: ' . $query);
} else {
$photos = array();
}
// Ready
return $photos;
}
开发者ID:lchen01,项目名称:STEdwards,代码行数:94,代码来源:wppa-widget-functions.php
示例9: wppa_get_thumb_masonry
function wppa_get_thumb_masonry($id)
{
global $wpdb;
// Init
if (!$id) {
wppa_dbg_msg('Please check file wppa-theme.php or any other php file that calls wppa_thumb_masonry(). Argument 1: photo id is missing!', 'red', 'force');
die('Please check your configuration');
}
$result = '';
$cont_width = wppa_get_container_width();
$count_cols = ceil($cont_width / wppa_opt('thumbsize'));
// Get the photo info
$thumb = wppa_cache_thumb($id);
// Get the album info
$album = wppa_cache_album($thumb['album']);
// Get photo info
$is_video = wppa_is_video($id);
$has_audio = wppa_has_audio($id);
$imgsrc = wppa_fix_poster_ext(wppa_get_thumb_path($id), $id);
if (!wppa_is_video($id) && !is_file($imgsrc)) {
$result .= '<div' . ' class=""' . ' style="' . 'font-size:10px;' . 'color:red;' . 'width:' . wppa_opt('thumbsize') . 'px;' . 'position:static;' . 'float:left;' . '"' . ' >' . sprintf(__('Missing thumbnail image #%s', 'wp-photo-album-plus'), $id) . '</div>';
return $result;
}
$alt = $album['alt_thumbsize'] == 'yes' ? '_alt' : '';
$imgattr_a = wppa_get_imgstyle_a($id, $imgsrc, wppa_opt('thumbsize' . $alt), 'optional', 'thumb');
// Verical style ?
if (wppa_opt('thumbtype') == 'masonry-v') {
$imgwidth = wppa_opt('thumbsize');
$imgheight = $imgwidth * wppa_get_thumbratioyx($id);
$imgstyle = 'width:100%; height:auto; margin:0; position:relative; box-sizing:border-box;';
$frame_h = '';
} else {
$imgheight = wppa_opt('thumbsize');
$imgwidth = $imgheight * wppa_get_thumbratioxy($id);
$imgstyle = 'height:100%;' . 'width:auto;' . 'margin:0;' . 'position:relative;' . 'box-sizing:border-box;' . '';
$frame_h = 'height:100%; ';
}
// Mouseover effect?
if (wppa_switch('use_thumb_opacity')) {
$opac = wppa_opt('thumb_opacity');
$imgstyle .= ' opacity:' . $opac / 100 . '; filter:alpha( opacity=' . $opac . ' );';
}
// Padding
if (wppa_is_int(wppa_opt('tn_margin') / 2)) {
$imgstyle .= ' padding:' . wppa_opt('tn_margin') / 2 . 'px;';
} else {
$p1 = floor(wppa_opt('tn_margin') / 2);
$p2 = ceil(wppa_opt('tn_margin') / 2);
$imgstyle .= ' padding:' . $p1 . 'px ' . $p2 . 'px ' . $p2 . 'px ' . $p1 . 'px;';
}
// Cursor
$cursor = $imgattr_a['cursor'];
// Popup ?
if (wppa_switch('use_thumb_popup')) {
// Landscape?
if ($imgwidth > $imgheight) {
$popwidth = wppa_opt('popupsize');
$popheight = round($popwidth * $imgheight / $imgwidth);
} else {
$popheight = wppa_opt('popupsize');
$popwidth = round($popheight * $imgwidth / $imgheight);
}
} else {
$popwidth = $imgwidth;
$popheight = $imgheight;
}
$imgurl = wppa_fix_poster_ext(wppa_get_thumb_url($id, '', $popwidth, $popheight), $id);
$events = wppa_get_imgevents('thumb', $id);
$imgalt = wppa_get_imgalt($id);
// returns something like ' alt="Any text" '
$title = esc_attr(wppa_get_masonry_title($id));
// esc_attr( wppa_get_photo_name( $id ) );
// Feed ?
if (is_feed()) {
$imgattr_a = wppa_get_imgstyle_a($id, $imgsrc, '100', '4', 'thumb');
$style = $imgattr_a['style'];
$result .= '<a href="' . get_permalink() . '">' . '<img' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' style="' . $style . '"' . ' />' . '</a>';
return;
}
// Get the image link
if (wppa('is_topten')) {
$no_album = !wppa('start_album');
if ($no_album) {
$tit = __('View the top rated photos', 'wp-photo-album-plus');
} else {
$tit = esc_attr(__(stripslashes($thumb['description'])));
}
$link = wppa_get_imglnk_a('thumb', $id, '', $tit, '', $no_album);
} else {
$link = wppa_get_imglnk_a('thumb', $id);
}
// voor parent uplr
// Open the thumbframe
// Add class wppa-mas-h-{mocc} for ie if horizontal
$is_ie_or_chrome = strpos($_SERVER["HTTP_USER_AGENT"], 'Trident') || strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome');
$result .= '
<div' . ' id="thumbnail_frame_masonry_' . $id . '_' . wppa('mocc') . '"' . ($is_ie_or_chrome && wppa_opt('thumbtype') == 'masonry-h' ? ' class="wppa-mas-h-' . wppa('mocc') . '"' : '') . ' style="' . $frame_h . 'position:static;' . 'float:left;' . 'font-size:12px;' . 'line-height:8px;' . 'overflow:hidden;' . 'box-sizing:content-box;' . '" >';
// The medals
$result .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'top'));
// See if ajax possible
//.........这里部分代码省略.........
开发者ID:lchen01,项目名称:STEdwards,代码行数:101,代码来源:wppa-thumbnails.php
示例10: wppa_dbg_q
function wppa_dbg_q($id)
{
global $wppa;
if (!$wppa['debug']) {
return;
}
// Nothing to do here
switch ($id) {
case 'init':
break;
case 'print':
if (!isset($wppa['queries'])) {
return;
}
if (!is_array($wppa['queries'])) {
return;
}
// Did nothing
$qtot = 0;
$gtot = 0;
$keys = array_keys($wppa['queries']);
sort($keys);
$line = 'Cumulative query stats: Q=query, G=cache<br />';
foreach ($keys as $k) {
if (substr($k, 0, 1) == 'Q') {
$line .= $k . '=>' . $wppa['queries'][$k] . ', ';
$qtot += $wppa['queries'][$k];
}
}
$line .= '<br />';
foreach ($keys as $k) {
if (substr($k, 0, 1) == 'G') {
$line .= $k . '=>' . $wppa['queries'][$k] . ', ';
$gtot += $wppa['queries'][$k];
}
}
$line .= '<br />';
$line .= sprintf('Total queries attempted: %d, Cash hits: %d, equals %4.2f%%, misses: %d.', $qtot + $gtot, $gtot, $gtot * 100 / ($qtot + $gtot), $qtot);
$line .= ' 2nd level cache entries: albums: ' . wppa_cache_album('count') . ', photos: ' . wppa_cache_photo('count') . ' NQ=' . get_num_queries();
wppa_dbg_msg($line);
// ob_start();
// print_r( $wppa['queries'] );
// wppa_dbg_msg( ob_get_clean() );
break;
default:
if ($wppa['debug']) {
if (!isset($wppa['queries'][$id])) {
$wppa['queries'][$id] = 1;
} else {
$wppa['queries'][$id]++;
}
}
break;
}
}
开发者ID:billadams,项目名称:forever-frame,代码行数:55,代码来源:wppa-common-functions.php
示例11: wppa_get_imglnk_a
//.........这里部分代码省略.........
$hig = $imgsize['1'];
}
else {
$wid = '0';
$hig = '0';
}
*/
$url = wppa_fix_poster_ext(wppa_get_photo_url($id, '', $wid, $hig), $id);
$result['url'] = esc_attr('wppaFullPopUp( ' . wppa('mocc') . ', ' . $id . ', "' . $url . '", ' . $wid . ', ' . $hig . ' )');
}
$result['title'] = $title;
$result['is_url'] = false;
$result['is_lightbox'] = false;
return $result;
break;
case 'custom':
if ($wich == 'potdwidget') {
$result['url'] = wppa_opt('widget_linkurl');
$result['title'] = wppa_opt('widget_linktitle');
$result['is_url'] = true;
$result['is_lightbox'] = false;
return $result;
}
break;
case 'slide':
// for album widget
$result['url'] = wppa_get_permalink(wppa_opt('album_widget_linkpage')) . 'wppa-album=' . $album . '&slide';
$result['title'] = '';
$result['is_url'] = true;
$result['is_lightbox'] = false;
break;
case 'autopage':
if (!wppa_switch('auto_page')) {
wppa_dbg_msg('Auto page has been switched off, but there are still links to it (' . $wich . ')', 'red', 'force');
$result['url'] = '';
} else {
$result['url'] = wppa_get_permalink(wppa_get_the_auto_page($id));
}
$result['title'] = '';
$result['is_url'] = true;
$result['is_lightbox'] = false;
break;
case 'plainpage':
$result['url'] = get_permalink($page);
$result['title'] = $wpdb->get_var($wpdb->prepare("SELECT `post_title` FROM `" . $wpdb->prefix . "posts` WHERE `ID` = %s", $page));
$result['is_url'] = true;
$result['is_lightbox'] = false;
return $result;
break;
default:
wppa_dbg_msg('Error, wrong type: ' . $type . ' in wppa_get_imglink_a', 'red');
return false;
break;
}
if ($type != 'thumbalbum') {
if (wppa('calendar')) {
$result['url'] .= '&wppa-calendar=' . wppa('calendar') . '&wppa-caldate=' . wppa('caldate');
}
if (wppa('supersearch')) {
$result['url'] .= '&wppa-supersearch=' . urlencode(wppa('supersearch'));
}
if (wppa('src') && !wppa('is_related') && !wppa_in_widget()) {
$result['url'] .= '&wppa-searchstring=' . urlencode(wppa('searchstring'));
}
if ($wich == 'topten') {
$result['url'] .= '&wppa-topten=' . wppa_opt('topten_count');
开发者ID:lchen01,项目名称:STEdwards,代码行数:67,代码来源:wppa-links.php
示例12: wppa_bestof_html
function wppa_bestof_html($args, $widget = true)
{
// Copletify args
$args = wp_parse_args((array) $args, array('page' => '0', 'count' => '1', 'sortby' => 'maxratingcount', 'display' => 'photo', 'period' => 'thisweek', 'maxratings' => 'yes', 'meanrat' => 'yes', 'ratcount' => 'yes', 'linktype' => 'none', 'size' => wppa_opt('widget_width'), 'fontsize' => wppa_opt('fontsize_widget_thumb'), 'lineheight' => wppa_opt('fontsize_widget_thumb') * 1.5, 'height' => '200'));
// Make args into seperate vars
extract($args);
// Validate args
if (!in_array($sortby, array('maxratingcount', 'meanrating', 'ratingcount'))) {
wppa_dbg_msg('Invalid arg sortby "' . $sortby . '" must be "maxratingcount", "meanrating" or "ratingcount"', 'red', 'force');
}
if (!in_array($display, array('photo', 'owner'))) {
wppa_dbg_msg('Invalid arg display "' . $display . '" must be "photo" or "owner"', 'red', 'force');
}
if (!in_array($period, array('lastweek', 'thisweek', 'lastmonth', 'thismonth', 'lastyear', 'thisyear'))) {
wppa_dbg_msg('Invalid arg period "' . $period . '" must be "lastweek", "thisweek", "lastmonth", "thismonth", "lastyear" or "thisyear"', 'red', 'force');
}
if (!$widget) {
$size = $height;
}
$result = '';
$data = wppa_get_the_bestof($count, $period, $sortby, $display);
if ($display == 'photo') {
if (is_array($data)) {
foreach (array_keys($data) as $id) {
$thumb = wppa_cache_thumb($id);
if ($thumb) {
$imgsize = array(wppa_get_photox($id), wppa_get_photoy($id));
if ($widget) {
$maxw = $size;
$maxh = round($maxw * $imgsize['1'] / $imgsize['0']);
} else {
$maxh = $size;
$maxw = round($maxh * $imgsize['0'] / $imgsize['1']);
}
$totalh = $maxh + $lineheight;
if ($maxratings == 'yes') {
$totalh += $lineheight;
}
if ($meanrat == 'yes') {
$totalh += $lineheight;
}
if ($ratcount == 'yes') {
$totalh += $lineheight;
}
if ($widget) {
$clear = 'clear:both; ';
} else {
$clear = '';
}
$result .= "\n" . '<div' . ' class="wppa-widget"' . ' style="' . $clear . 'width:' . $maxw . 'px; height:' . $totalh . 'px; margin:4px; display:inline; text-align:center; float:left;"' . ' >';
// The medal if at the top
$result .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'top'));
// The link if any
if ($linktype != 'none') {
switch ($linktype) {
case 'owneralbums':
$href = wppa_get_permalink($page) . 'wppa-cover=1&wppa-owner=' . $thumb['owner'] . '&wppa-occur=1';
$title = __('See the authors albums', 'wp-photo-album-plus');
break;
case 'ownerphotos':
$href = wppa_get_permalink($page) . 'wppa-cover=0&wppa-owner=' . $thumb['owner'] . '&photos-only&wppa-occur=1';
$title = __('See the authors photos', 'wp-photo-album-plus');
break;
case 'upldrphotos':
$href = wppa_get_permalink($page) . 'wppa-cover=0&wppa-upldr=' . $thumb['owner'] . '&wppa-occur=1';
$title = __('See all the authors photos', 'wp-photo-album-plus');
break;
}
$result .= '<a href="' . wppa_convert_to_pretty($href) . '" title="' . $title . '" >';
}
// The image
$result .= '<img' . ' style="height:' . $maxh . 'px; width:' . $maxw . 'px;"' . ' src="' . wppa_fix_poster_ext(wppa_get_photo_url($id, '', $maxw, $maxh), $id) . '"' . ' ' . wppa_get_imgalt($id) . ' />';
// The /link
if ($linktype != 'none') {
$result .= '</a>';
}
// The medal if near the bottom
$result .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'bot'));
// The subtitles
$result .= "\n\t" . '<div style="font-size:' . $fontsize . 'px; line-height:' . $lineheight . 'px; position:absolute; width:' . $maxw . 'px; ">';
$result .= sprintf(__('Photo by: %s', 'wp-photo-album-plus'), $data[$id]['user']) . '<br />';
if ($maxratings == 'yes') {
$n = $data[$id]['maxratingcount'];
$result .= sprintf(_n('%d max rating', '%d max ratings', $n, 'wp-photo-album-plus'), $n) . '<br />';
}
if ($ratcount == 'yes') {
$n = $data[$id]['ratingcount'];
$result .= sprintf(_n('%d vote', '%d votes', 'wp-photo-album-plus'), $n) . '<br />';
}
if ($meanrat == 'yes') {
$m = $data[$id]['meanrating'];
$result .= sprintf(__('Rating: %4.2f.', 'wp-photo-album-plus'), $m) . '<br />';
}
$result .= '</div>';
$result .= '<div style="clear:both" ></div>';
$result .= "\n" . '</div>';
} else {
// No image
$result .= '<div>' . sprintf(__('Photo %s not found.', 'wp-photo-album-plus'), $id) . '</div>';
}
//.........这里部分代码省略.........
开发者ID:lchen01,项目名称:STEdwards,代码行数:101,代码来源:wppa-boxes-html.php
示例13: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $wpdb;
global $wppa;
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'] = 'alb';
$wppa['mocc']++;
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => '', 'parent' => 'none', 'name' => 'no', 'skip' => 'yes'));
$widget_title = apply_filters('widget_title', $instance['title']);
$page = in_array(wppa_opt('wppa_album_widget_linktype'), $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_album_widget_linkpage', __a('Photo Albums'));
$max = wppa_opt('wppa_album_widget_count');
if (!$max) {
$max = '10';
}
$parent = $instance['parent'];
$name = $instance['name'];
$skip = $instance['skip'];
if (is_numeric($parent)) {
$albums = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_ALBUMS . '` WHERE `a_parent` = %s ' . wppa_get_album_order($parent), $parent), ARRAY_A);
} else {
switch ($parent) {
case 'all':
$albums = $wpdb->get_results('SELECT * FROM `' . WPPA_ALBUMS . '` ' . wppa_get_album_order(), ARRAY_A);
break;
case 'last':
$albums = $wpdb->get_results('SELECT * FROM `' . WPPA_ALBUMS . '` ORDER BY `timestamp` DESC', ARRAY_A);
break;
default:
wppa_dbg_msg('Error, unimplemented album selection: ' . $parent . ' in Album widget.', 'red', true);
}
}
$widget_content = "\n" . '<!-- WPPA+ album Widget start -->';
$maxw = wppa_opt('wppa_album_widget_size');
$maxh = $maxw;
if ($name == 'yes') {
$maxh += 18;
}
$count = 0;
if ($albums) {
foreach ($albums as $album) {
if ($count < $max) {
global $thumb;
$imageid = wppa_get_coverphoto_id($album['id']);
$image = $wpdb->get_row($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `id` = %s', $imageid), ARRAY_A);
$imgcount = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . WPPA_PHOTOS . ' WHERE `album` = %s', $album['id']));
$subalbumcount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_ALBUMS . "` WHERE `a_parent` = %s", $album['id']));
$thumb = $image;
// Make the HTML for current picture
if ($image && ($imgcount > wppa_opt('wppa_min_thumbs') || $subalbumcount)) {
$link = wppa_get_imglnk_a('albwidget', $image['id']);
$file = wppa_get_thumb_path($image['id']);
$imgevents = wppa_get_imgevents('thumb', $image['id'], true);
$imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'albthumb');
$imgstyle = $imgstyle_a['style'];
$width = $imgstyle_a['width'];
$height = $imgstyle_a['height'];
$cursor = $imgstyle_a['cursor'];
if (wppa_switch('wppa_show_albwidget_tooltip')) {
$title = esc_attr(strip_tags(wppa_get_album_desc($album['id'])));
} else {
$title = '';
}
$imgurl = wppa_get_thumb_url($image['id'], '', $width, $height);
} else {
$link = '';
$file = '';
$imgevents = '';
$imgstyle = 'width:' . $maxw . ';height:' . $maxh . ';';
$width = $maxw;
$height = $maxw;
// !!
$cursor = 'default';
$title = sprintf(__a('Upload at least %d photos to this album!', 'wppa_theme'), wppa_opt('wppa_min_thumbs') - $imgcount + 1);
if ($imageid) {
// The 'empty album has a cover image
$file = wppa_get_thumb_path($image['id']);
$imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'albthumb');
$imgstyle = $imgstyle_a['style'];
$width = $imgstyle_a['width'];
$height = $imgstyle_a['height'];
$imgurl = wppa_get_thumb_url($image['id'], '', $width, $height);
} else {
$imgurl = wppa_get_imgdir() . 'album32.png';
}
}
$imgurl = wppa_fix_poster_ext($imgurl, $image['id']);
if ($imgcount > wppa_opt('wppa_min_thumbs') || $skip == 'no') {
$widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">';
if ($link) {
if ($link['is_url']) {
// Is a href
//.........这里部分代码省略.........
开发者ID:billadams,项目名称:forever-frame,代码行数:101,代码来源:wppa-album-widget.php
示例14: wppa_get_video_body
function wppa_get_video_body($id, $for_lb = false, $w = '0', $h = '0')
{
$is_video = wppa_is_video($id, true);
// Not a video? no go
if (!$is_video) {
return '';
}
// See what file types are present
extract(wp_parse_args($is_video, array('mp4' => false, 'ogv' => false, 'webm' => false)));
// Collect other data
$width = $w ? $w : wppa_get_videox($id);
$height = $h ? $h : wppa_get_videoy($id);
$source = wppa_get_photo_url($id);
$source = substr($source, 0, strrpos($source, '.'));
$class = $for_lb ? ' class="wppa-overlay-img"' : '';
$is_opera = strpos($_SERVER["HTTP_USER_AGENT"], 'OPR');
$is_ie = strpos($_SERVER["HTTP_USER_AGENT"], 'Trident');
$is_safari = strpos($_SERVER["HTTP_USER_AGENT"], 'Safari');
wppa_dbg_msg('Mp4:' . $mp4 . ', Opera:' . $is_opera . ', Ie:' . $is_ie . ', Saf:' . $is_safari);
// Assume the browser supports html5
$ext = '';
if ($is_opera) {
if ($ogv) {
$ext = 'ogv';
} elseif ($webm) {
$ext = 'webm';
} elseif ($mp4) {
$ext = 'mp4';
}
} elseif ($is_safari || $is_ie) {
if ($mp4) {
$ext = 'mp4';
}
} else {
if ($mp4) {
$ext = 'mp4';
} elseif ($webm) {
$ext = 'webm';
} elseif ($ogv) {
$ext = 'ogv';
}
}
if ($ext) {
$mime = str_replace('ogv', 'ogg', 'video/' . $ext);
$result = '<source src="' . $source . '.' . $ext . '" type="' . $mime . '">';
}
$result .= __a('There is no fil
|
请发表评论