本文整理汇总了PHP中wppa_switch函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_switch函数的具体用法?PHP wppa_switch怎么用?PHP wppa_switch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_switch函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wppa_add_admin
function wppa_add_admin()
{
global $wp_roles;
global $wpdb;
// Make sure admin has access rights
if (current_user_can('administrator')) {
$wp_roles->add_cap('administrator', 'wppa_admin');
$wp_roles->add_cap('administrator', 'wppa_upload');
$wp_roles->add_cap('administrator', 'wppa_import');
$wp_roles->add_cap('administrator', 'wppa_moderate');
$wp_roles->add_cap('administrator', 'wppa_export');
$wp_roles->add_cap('administrator', 'wppa_settings');
$wp_roles->add_cap('administrator', 'wppa_potd');
$wp_roles->add_cap('administrator', 'wppa_comments');
$wp_roles->add_cap('administrator', 'wppa_help');
}
// See if there are comments pending moderation
$com_pending = '';
$com_pending_count = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_COMMENTS . "` WHERE `status` = 'pending'");
if ($com_pending_count) {
$com_pending = '<span class="update-plugins"><span class="plugin-count">' . $com_pending_count . '</span></span>';
}
// See if there are uploads pending moderation
$upl_pending = '';
$upl_pending_count = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `status` = 'pending'");
if ($upl_pending_count) {
$upl_pending = '<span class="update-plugins"><span class="plugin-count">' . $upl_pending_count . '</span></span>';
}
// Compute total pending moderation
$tot_pending = '';
$tot_pending_count = '0';
if (current_user_can('wppa_comments') || current_user_can('wppa_moderate')) {
$tot_pending_count += $com_pending_count;
}
if (current_user_can('wppa_admin') || current_user_can('wppa_moderate')) {
$tot_pending_count += $upl_pending_count;
}
if ($tot_pending_count) {
$tot_pending = '<span class="update-plugins"><span class="plugin-count">' . '<b>' . $tot_pending_count . '</b>' . '</span></span>';
}
$icon_url = WPPA_URL . '/images/camera16.png';
// page_title menu_title capability menu_slug function icon_url position
add_menu_page('WP Photo Album', __('Photo Albums', 'wppa') . $tot_pending, 'wppa_admin', 'wppa_admin_menu', 'wppa_admin', $icon_url);
//,'10' );
// parent_slug page_title menu_title capability menu_slug function
add_submenu_page('wppa_admin_menu', __('Album Admin', 'wppa'), __('Album Admin', 'wppa') . $upl_pending, 'wppa_admin', 'wppa_admin_menu', 'wppa_admin');
add_submenu_page('wppa_admin_menu', __('Upload Photos', 'wppa'), __('Upload Photos', 'wppa'), 'wppa_upload', 'wppa_upload_photos', 'wppa_page_upload');
// Uploader without album admin rights, but when the upload_edit switch set, may edit his own photos
if (!current_user_can('wppa_admin') && wppa_switch('wppa_upload_edit')) {
add_submenu_page('wppa_admin_menu', __('Edit Photos', 'wppa'), __('Edit Photos', 'wppa'), 'wppa_upload', 'wppa_edit_photo', 'wppa_edit_photo');
}
add_submenu_page('wppa_admin_menu', __('Import Photos', 'wppa'), __('Import Photos', 'wppa'), 'wppa_import', 'wppa_import_photos', 'wppa_page_import');
add_submenu_page('wppa_admin_menu', __('Moderate Photos', 'wppa'), __('Moderate Photos', 'wppa') . $tot_pending, 'wppa_moderate', 'wppa_moderate_photos', 'wppa_page_moderate');
add_submenu_page('wppa_admin_menu', __('Export Photos', 'wppa'), __('Export Photos', 'wppa'), 'wppa_export', 'wppa_export_photos', 'wppa_page_export');
add_submenu_page('wppa_admin_menu', __('Settings', 'wppa'), __('Settings', 'wppa'), 'wppa_settings', 'wppa_options', 'wppa_page_options');
add_submenu_page('wppa_admin_menu', __('Photo of the day Widget', 'wppa'), __('Photo of the day', 'wppa'), 'wppa_potd', 'wppa_photo_of_the_day', 'wppa_sidebar_page_options');
add_submenu_page('wppa_admin_menu', __('Manage comments', 'wppa'), __('Comments', 'wppa') . $com_pending, 'wppa_comments', 'wppa_manage_comments', 'wppa_comment_admin');
add_submenu_page('wppa_admin_menu', __('Help & Info', 'wppa'), __('Help & Info', 'wppa'), 'wppa_help', 'wppa_help', 'wppa_page_help');
}
开发者ID:billadams,项目名称:forever-frame,代码行数:59,代码来源:wppa-admin.php
示例2: filter_mce_plugin
function filter_mce_plugin($plugins)
{
// this plugin file will work the magic of our button
if (wppa_switch('wppa_use_scripts_in_tinymce')) {
$file = 'wppa-tinymce-scripts.js';
} else {
$file = 'wppa-tinymce-shortcodes.js';
}
$plugins['wppagallery'] = plugin_dir_url(__FILE__) . $file;
return $plugins;
}
开发者ID:billadams,项目名称:forever-frame,代码行数:11,代码来源:wppa-tinymce-shortcodes.php
示例3: wppa_create_wppa_htaccess_
function wppa_create_wppa_htaccess_($filename)
{
$file = fopen($filename, 'wb');
if ($file) {
// Make it
if (wppa_switch('wppa_cre_uploads_htaccess')) {
fwrite($file, '<IfModule mod_rewrite.c>');
fwrite($file, "\n" . 'RewriteEngine Off');
fwrite($file, "\n" . '</IfModule>');
fclose($file);
} else {
fclose($file);
@unlink($filename);
}
}
}
开发者ID:billadams,项目名称:forever-frame,代码行数:16,代码来源:wppa-htaccess.php
示例4: form
/** @see WP_Widget::form */
function form($instance)
{
global $wppa_opt;
//Defaults
$instance = wp_parse_args((array) $instance, array('title' => __('Last Ten Photos', 'wp-photo-album-plus'), 'album' => '0', 'albumenum' => '', 'timesince' => 'yes', 'display' => 'thumbs', 'includesubs' => 'no'));
$widget_title = apply_filters('widget_title', $instance['title']);
$album = $instance['album'];
$album_enum = $instance['albumenum'];
$timesince = $instance['timesince'];
$display = $instance['display'];
$subs = $instance['includesubs'];
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title:', 'wp-photo-album-plus');
?>
</label>
<input class="widefat" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" type="text" value="<?php
echo $widget_title;
?>
" />
</p>
<p><label for="<?php
echo $this->get_field_id('album');
?>
"><?php
_e('Album:', 'wp-photo-album-plus');
?>
</label>
<select class="widefat" id="<?php
echo $this->get_field_id('album');
?>
" name="<?php
echo $this->get_field_name('album');
?>
" >
<?php
echo wppa_album_select_a(array('selected' => $album, 'addall' => true, 'addmultiple' => true, 'addnumbers' => true, 'path' => wppa_switch('hier_albsel')));
?>
</select>
</p>
<p id="wppa-albums-enum" style="display:block;" ><label for="<?php
echo $this->get_field_id('albumenum');
?>
"><?php
_e('Albums:', 'wp-photo-album-plus');
?>
</label>
<small style="color:blue;" ><br /><?php
_e('Select --- multiple see below --- in the Album selection box. Then enter album numbers seperated by commas', 'wp-photo-album-plus');
?>
</small>
<input class="widefat" id="<?php
echo $this->get_field_id('albumenum');
?>
" name="<?php
echo $this->get_field_name('albumenum');
?>
" type="text" value="<?php
echo $album_enum;
?>
" />
</p>
<p>
<?php
_e('Include subalbums:', 'wp-photo-album-plus');
?>
<select id="<?php
echo $this->get_field_id('includesubs');
?>
" name="<?php
echo $this->get_field_name('includesubs');
?>
">
<option value="no" <?php
if ($subs == 'no') {
echo 'selected="selected"';
}
?>
><?php
_e('no', 'wp-photo-album-plus');
?>
</option>
<option value="yes" <?php
if ($subs == 'yes') {
echo 'selected="selected"';
}
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-lasten-widget.php
示例5: wppa_create_thumbnail
function wppa_create_thumbnail($id, $use_source = true)
{
// Find file to make thumbnail from
$source_path = wppa_fix_poster_ext(wppa_get_source_path($id), $id);
// Use source if requested and available
if ($use_source) {
if (!wppa_switch('watermark_thumbs') && is_file($source_path)) {
$file = $source_path;
// Use sourcefile
} else {
$file = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
// Use photofile
}
// Non standard orientation files: never use source
$orient = wppa_get_exif_orientation($file);
if ($orient > '1') {
$file = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
// Use photofile
}
} else {
$file = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
// Use photofile
}
// Max side
$max_side = wppa_get_minisize();
// Check file
if (!file_exists($file)) {
return false;
}
// No file, fail
$img_attr = getimagesize($file);
if (!$img_attr) {
return false;
}
// Not an image, fail
// Retrieve aspect
$asp_attr = explode(':', wppa_opt('thumb_aspect'));
// Get output path
$thumbpath = wppa_get_thumb_path($id);
if (wppa_get_ext($thumbpath) == 'xxx') {
// Video poster
$thumbpath = wppa_strip_ext($thumbpath) . '.jpg';
}
// Source size
$src_size_w = $img_attr[0];
$src_size_h = $img_attr[1];
// Temp convert width if stereo
if (wppa_get_photo_item($id, 'stereo')) {
$src_size_w /= 2;
}
// Mime type and thumb type
$mime = $img_attr[2];
$type = $asp_attr[2];
// Source native aspect
$src_asp = $src_size_h / $src_size_w;
// Required aspect
if ($type == 'none') {
$dst_asp = $src_asp;
} else {
$dst_asp = $asp_attr[0] / $asp_attr[1];
}
// Convert back width if stereo
if (wppa_get_photo_item($id, 'stereo')) {
$src_size_w *= 2;
}
// Create the source image
switch ($mime) {
// mime type
case 1:
// gif
$temp = @imagecreatefromgif($file);
if ($temp) {
$src = imagecreatetruecolor($src_size_w, $src_size_h);
imagecopy($src, $temp, 0, 0, 0, 0, $src_size_w, $src_size_h);
imagedestroy($temp);
} else {
$src = false;
}
break;
case 2:
// jpeg
if (!function_exists('wppa_imagecreatefromjpeg')) {
wppa_log('Error', 'Function wppa_imagecreatefromjpeg does not exist.');
}
$src = @wppa_imagecreatefromjpeg($file);
break;
case 3:
// png
$src = @imagecreatefrompng($file);
break;
}
if (!$src) {
wppa_log('Error', 'Image file ' . $file . ' is corrupt while creating thmbnail');
return true;
}
// Compute the destination image size
if ($dst_asp < 1.0) {
// Landscape
$dst_size_w = $max_side;
$dst_size_h = round($max_side * $dst_asp);
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-photo-files.php
示例6: wppa_get_album_desc
function wppa_get_album_desc($id)
{
if (!is_numeric($id) || $id < '1') {
wppa_dbg_msg('Invalid arg wppa_get_album_desc( ' . $id . ' )', 'red');
}
$album = wppa_cache_album($id);
$desc = $album['description'];
// Raw data
if (!$desc) {
return '';
}
// No content, need no filtering
$desc = stripslashes($desc);
// Unescape
$desc = __($desc);
// qTranslate
$desc = wppa_html($desc);
// Enable html
$desc = balanceTags($desc, true);
// Balance tags
if (strpos($desc, 'w#') !== false) {
// Is there any 'w#' ?
// Keywords
$keywords = array('name', 'owner', 'id', 'views');
foreach ($keywords as $keyword) {
$replacement = __(trim(stripslashes($album[$keyword])));
if ($replacement == '') {
$replacement = '‹' . __a('none', 'wppa') . '›';
}
$desc = str_replace('w#' . $keyword, $replacement, $desc);
}
// Timestamps
$timestamps = array('timestamp', 'modified');
// Identical, there is only timestamp, but it acts as modified
foreach ($timestamps as $timestamp) {
if ($album['timestamp']) {
$desc = str_replace('w#' . $timestamp, wppa_local_date(get_option('date_format', "F j, Y,") . ' ' . get_option('time_format', "g:i a"), $album['timestamp']), $desc);
} else {
$desc = str_replace('w#' . $timestamp, '‹' . __a('unknown') . '›', $desc);
}
}
}
// To prevent recursive rendering of scripts or shortcodes:
$desc = str_replace(array('%%wppa%%', '[wppa', '[/wppa]'), array('%-wppa-%', '{wppa', '{/wppa}'), $desc);
if (wppa_switch('wppa_allow_foreign_shortcodes_general')) {
$desc = do_shortcode($desc);
} else {
$desc = strip_shortcodes($desc);
}
// Convert links and mailto:
$desc = make_clickable($desc);
// CMTooltipGlossary on board?
$desc = wppa_filter_glossary($desc);
return $desc;
}
开发者ID:billadams,项目名称:forever-frame,代码行数:55,代码来源:wppa-items.php
示例7: wppa_get_medal_html_a
function wppa_get_medal_html_a($args)
{
// Completize args
$args = wp_parse_args((array) $args, array('id' => '0', 'size' => 'M', 'where' => ''));
// Validate args
if ($args['id'] == '0') {
return '';
}
// Missing required id
if (!in_array($args['size'], array('S', 'M', 'L', 'XL'))) {
return '';
}
// Missing or not implemented size spec
if (!in_array($args['where'], array('top', 'bot'))) {
return '';
}
// Missing or not implemented where
// Do it here?
if (strpos(wppa_opt('medal_position'), $args['where']) === false) {
return '';
}
// No
// Get rquired photo and config data
$id = $args['id'];
$new = wppa_is_photo_new($id);
$mod = wppa_is_photo_modified($id);
$status = wppa_get_photo_item($id, 'status');
$medal = in_array($status, array('gold', 'silver', 'bronze')) ? $status : '';
// Have a medal to show?
if (!$new && !$medal && !$mod) {
return '';
// No
}
// Init local vars
$result = '';
$color = wppa_opt('medal_color');
$left = strpos(wppa_opt('medal_position'), 'left') !== false;
$ctop = strpos(wppa_opt('medal_position'), 'top') === false ? '-32' : '0';
$sizes = array('S' => '16', 'M' => '20', 'L' => '24', 'XL' => '32');
$nsizes = array('S' => '14', 'M' => '16', 'L' => '20', 'XL' => '24');
$fsizes = array('S' => '9', 'M' => '10', 'L' => '14', 'XL' => '20');
$smargs = array('S' => '4', 'M' => '5', 'L' => '6', 'XL' => '8');
$lmargs = array('S' => '22', 'M' => '28', 'L' => '36', 'XL' => '48');
$tops = array('S' => '8', 'M' => '8', 'L' => '6', 'XL' => '0');
$ntops = array('S' => '10', 'M' => '10', 'L' => '8', 'XL' => '0');
$titles = array('gold' => __('Gold medal', 'wp-photo-album-plus'), 'silver' => __('Silver medal', 'wp-photo-album-plus'), 'bronze' => __('Bronze medal', 'wp-photo-album-plus'));
$size = $sizes[$args['size']];
$nsize = $nsizes[$args['size']];
$fsize = $fsizes[$args['size']];
$smarg = $smargs[$args['size']];
$lmarg = $lmargs[$args['size']];
$top = $tops[$args['size']];
$ntop = $ntops[$args['size']];
$title = $medal ? esc_attr($titles[$medal]) : '';
$sstyle = $left ? 'left:' . $smarg . 'px;' : 'right:' . $smarg . 'px;';
$lstyle = $left ? 'left:' . $lmarg . 'px;' : 'right:' . $lmarg . 'px;';
// The medal container
$result .= '<div style="position:relative;top:' . $ctop . 'px;z-index:10;">';
// The medal
if ($medal) {
$result .= '<img' . ' src="' . WPPA_URL . '/images/medal_' . $medal . '_' . $color . '.png"' . ' title="' . $title . '"' . ' alt="' . $title . '"' . ' style="' . $sstyle . 'top:4px;' . 'position:absolute;' . 'border:none;' . 'margin:0;' . 'padding:0;' . 'box-shadow:none;' . 'height:' . $size . 'px;' . 'top:' . $top . 'px;' . '"' . ' />';
}
// Is there a new or modified indicator to display?
if ($new) {
$type = 'new';
} elseif ($mod) {
$type = 'mod';
} else {
$type = '';
}
// Style adjustment if only a new/modified without a real medal
if (!$medal) {
$lstyle = $sstyle;
}
$do_image = !wppa_switch('wppa_new_mod_label_is_text');
// Yes there is one to display
if ($type) {
if ($do_image) {
$result .= '<img' . ' src="' . wppa_opt($type . '_label_url') . '"' . ' title="' . esc_attr(__('New', 'wp-photo-album-plus')) . '"' . ' alt="' . esc_attr(__('New', 'wp-photo-album-plus')) . '"' . ' class="wppa-thumbnew"' . ' style="' . $lstyle . 'top:' . $ntop . 'px;' . 'position:absolute;' . 'border:none;' . 'margin:0;' . 'padding:0;' . 'box-shadow:none;' . 'height:' . $nsize . 'px;' . '"' . ' />';
} else {
$result .= '<div' . ' style="' . $lstyle . 'position:absolute;' . 'top:' . $ntop . 'px;' . 'box-sizing:border-box;' . 'float:' . ($left ? 'left;' : 'right;') . 'font-size:' . $fsize . 'px;' . 'line-height:' . $fsize . 'px;' . 'font-family:\'Arial Black\', Gadget, sans-serif;' . 'border-radius:2px;' . 'border-width:1px;' . 'border-style:solid;' . 'padding:1px;' . wppa_get_text_medal_color_style($type) . '"' . ' >' . ' ' . __(wppa_opt($type . '_label_text')) . ' ' . '</div>';
}
}
// Close container
$result .= '</div>';
return $result;
}
开发者ID:lchen01,项目名称:STEdwards,代码行数:87,代码来源:wppa-thumbnails.php
示例8: 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);
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:71,代码来源:wppa-comment-widget.php
示例9: wppa_is_wanted_empty
function wppa_is_wanted_empty($thumbs)
{
if (!wppa_switch('show_empty_thumblist')) {
return false;
}
// Feature not enabled
if (is_array($thumbs) && count($thumbs) > wppa_get_mincount()) {
return false;
}
// Album is not empty
if (wppa_is_virtual()) {
return false;
}
// wanted empty only on real albums
if (wppa('albums_only')) {
return false;
}
// Explicitly no thumbs
// if ( wppa_switch( 'thumbs_first' ) && wppa_get_curpage() != '1' ) return false; // Only on page 1 if thumbs first
wppa('current_album', wppa('start_album'));
// Make sure upload knows the album
return true;
}
开发者ID:billadams,项目名称:forever-frame,代码行数:23,代码来源:wppa-theme.php
示例10: wppa_backend_upload_mail
function wppa_backend_upload_mail($id, $alb, $name)
{
$owner = wppa_get_user();
if ($owner == 'admin') {
return;
}
// Admin does not send mails to himself
if (wppa_switch('upload_backend_notify')) {
$to = get_bloginfo('admin_email');
$subj = sprintf(__('New photo uploaded: %s', 'wp-photo-album-plus'), wppa_sanitize_file_name($name));
$cont['0'] = sprintf(__('User %1$s uploaded photo %2$s into album %3$s', 'wp-photo-album-plus'), $owner, $id, wppa_get_album_name($alb));
if (wppa_switch('upload_moderate') && !current_user_can('wppa_admin')) {
$cont['1'] = __('This upload requires moderation', 'wp-photo-album-plus');
$cont['2'] = '<a href="' . get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=pmod&photo=' . $id . '" >' . __('Moderate manage photo', 'wp-photo-album-plus') . '</a>';
} else {
$cont['1'] = __('Details:', 'wp-photo-album-plus');
$cont['1'] .= ' <a href="' . get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=pmod&photo=' . $id . '" >' . __('Manage photo', 'wp-photo-album-plus') . '</a>';
}
wppa_send_mail($to, $subj, $cont, $id);
}
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:21,代码来源:wppa-upload.php
示例11: form
function form($instance)
{
global $wppa_opt;
$instance = wp_parse_args((array) $instance, array('title' => __('Upload Photos', 'wppa'), 'album' => '0'));
$title = $instance['title'];
$album = $instance['album'];
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title:', 'wppa');
?>
</label>
<input class="widefat" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" type="text" value="<?php
echo esc_attr($title);
?>
" /></p>
<p><label for="<?php
echo $this->get_field_id('album');
?>
"><?php
_e('Album:', 'wppa');
?>
</label>
<select class="widefat" id="<?php
echo $this->get_field_id('album');
?>
" name="<?php
echo $this->get_field_name('album');
?>
" >
<?php
echo wppa_album_select_a(array('path' => wppa_switch('wppa_hier_albsel'), 'selected' => $album, 'addselbox' => true));
?>
</select>
<?php
}
开发者ID:billadams,项目名称:forever-frame,代码行数:44,代码来源:wppa-upload-widget.php
示例12: wppa_bcitem
function wppa_bcitem($value = '', $href = '', $title = '', $class = '', $ajax = '')
{
static $sep;
// Convert url to pretty
$href = wppa_convert_to_pretty($href);
// Has content?
if (!$value) {
return;
}
// No content
if ($href) {
wppa_out('<a' . ($ajax && wppa_switch('allow_ajax') ? ' onclick="wppaDoAjaxRender(' . wppa('mocc') . ', \'' . $ajax . '\', \'' . $href . '\' );"' : ' href="' . $href . '"') . ' class="wppa-nav-text ' . $class . '"' . ' style="' . __wcs('wppa-nav-text') . '"' . ' title="' . esc_attr($title) . '" >' . $value . '</a>');
} else {
// No link, its the last item
wppa_out('<span' . ' id="bc-pname-' . wppa('mocc') . '"' . ' class="wppa-nav-text ' . $class . '"' . ' style="' . ($title ? 'cursor:pointer;' : '') . __wcs('wppa-nav-text') . '"' . ' title="' . esc_attr($title) . '"' . ' >' . $value . '</span>');
return;
}
// Add seperator
if (!$sep) {
// Compute the seperator
$temp = wppa_opt('bc_separator');
switch ($temp) {
case 'url':
$size = wppa_opt('fontsize_nav');
if ($size == '') {
$size = '12';
}
$style = 'height:' . $size . 'px;';
$sep = ' ' . '<img' . ' src="' . wppa_opt('bc_url') . '"' . ' class="no-shadow"' . ' style="' . $style . '"' . ' />' . ' ';
break;
case 'txt':
$sep = ' ' . html_entity_decode(stripslashes(wppa_opt('bc_txt')), ENT_QUOTES) . ' ';
break;
default:
$sep = ' &' . $temp . '; ';
}
}
wppa_out('<span' . ' class="wppa-nav-text ' . $class . '"' . ' style="' . __wcs('wppa-nav-text') . '"' . ' >' . $sep . '</span>');
}
开发者ID:lchen01,项目名称:STEdwards,代码行数:39,代码来源:wppa-breadcrumb.php
示例13: wppa_recuperate
function wppa_recuperate($id)
{
global $thumb;
global $wpdb;
wppa_cache_thumb($id);
$iptcfix = false;
$exiffix = false;
$file = wppa_get_source_path($id);
if (!is_file($file)) {
$file = wppa_get_photo_path($id);
}
if (is_file($file)) {
// Not a dir
$attr = getimagesize($file, $info);
if (is_array($attr)) {
// Is a picturefile
if ($attr[2] == IMAGETYPE_JPEG) {
// Is a jpg
if (wppa_switch('wppa_save_iptc')) {
// Save iptc
if (isset($info["APP13"])) {
// There is IPTC data
$is_iptc = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_IPTC . "` WHERE `photo` = %s", $id));
if (!$is_iptc) {
// No IPTC yet and there is: Recuperate
wppa_import_iptc($id, $info, 'nodelete');
$iptcfix = true;
}
}
}
if (wppa_switch('wppa_save_exif')) {
// Save exif
$image_type = exif_imagetype($file);
if ($image_type == IMAGETYPE_JPEG) {
// EXIF supported by server
$is_exif = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_EXIF . "` WHERE `photo`=%s", $id));
if (!$is_exif) {
// No EXIF yet
$exif = @exif_read_data($file, 'EXIF');
//@
if (is_array($exif)) {
// There is exif data present
wppa_import_exif($id, $file, 'nodelete');
$exiffix = true;
}
}
}
}
}
}
}
return array('iptcfix' => $iptcfix, 'exiffix' => $exiffix);
}
开发者ID:billadams,项目名称:forever-frame,代码行数:53,代码来源:wppa-maintenance.php
示例14: form
//.........这里部分代码省略.........
</p>
<p>
<input type="checkbox" <?php
if ($sub) {
echo 'checked="checked"';
}
?>
id="<?php
echo $this->get_field_id('sub');
?>
" name="<?php
echo $this->get_field_name('sub');
?>
" />
<label for="<?php
echo $this->get_field_id('sub');
?>
">
<?php
_e('Enable subsearch', 'wp-photo-album-plus');
?>
</label>
</p>
<p>
<label for="<?php
echo $this->get_field_id('landingpage');
?>
" >
<?php
_e('Landing page', 'wp-photo-album-plus');
echo ': ' . $landingpage;
?>
</label>
<select id="<?php
echo $this->get_field_id('landingpage');
?>
" name="<?php
echo $this->get_field_name('landingpage');
?>
" style="max-width:100%" >
<?php
// First option
$selected = $landingpage == '0' ? ' selected="selected"' : '';
?>
<option value="0" <?php
echo $selected;
?>
>
<?php
_e('--- Default ---', 'wp-photo-album-plus');
?>
</option>
<?php
// Pages if any
$query = "SELECT ID, post_title, post_content, post_parent " . "FROM " . $wpdb->posts . " " . "WHERE post_type = 'page' AND post_status = 'publish' " . "ORDER BY post_title ASC";
$pages = $wpdb->get_results($query, ARRAY_A);
if ($pages) {
// Add parents optionally OR translate only
if (wppa_switch('hier_pagesel')) {
$pages = wppa_add_parents($pages);
} else {
foreach (array_keys($pages) as $index) {
$pages[$index]['post_title'] = __(stripslashes($pages[$index]['post_title']));
}
}
// Sort alpahbetically
$pages = wppa_array_sort($pages, 'post_title');
// Display option
foreach ($pages as $page) {
$selected = $page['ID'] == $landingpage ? ' selected="selected"' : '';
$d = strpos($page['post_content'], '[wppa') === false && strpos($page['post_content'], '%%wppa%%') === false;
$disabled = $d ? ' disabled="disabled"' : '';
?>
<option value="<?php
echo $page['ID'];
?>
"<?php
echo $selected;
echo $disabled;
?>
>
<?php
_e($page['post_title']);
?>
</option>
<?php
}
}
?>
</select>
</p>
<p>
<small>
<?php
_e('The default page will be created automaticly', 'wp-photo-album-plus');
?>
</small>
</p>
<?php
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-search-widget.php
示例15: form
/** @see WP_Widget::form */
function form($instance)
{
//Defaults
$instance = wp_parse_args((array) $instance, array('title' => __('Thumbnail Photos', 'wp-photo-album-plus'), 'link' => '', 'linktitle' => '', 'album' => '0', 'name' => 'no', 'display' => 'thumbs', 'sortby' => wppa_get_photo_order('0'), 'limit' => wppa_opt('thumbnail_widget_count')));
$album = $instance['album'];
$name = $instance['name'];
$widget_title = $instance['title'];
$widget_link = $instance['link'];
$link_title = $instance['linktitle'];
$display = $instance['display'];
$sortby = $instance['sortby'];
$limit = $instance['limit'];
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title:', 'wp-photo-album-plus');
?>
</label> <input class="widefat" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" type="text" value="<?php
echo $widget_title;
?>
" /></p>
<p><label for="<?php
echo $this->get_field_id('link');
?>
"><?php
_e('Link from the title:', 'wp-photo-album-plus');
?>
</label> <input class="widefat" id="<?php
echo $this->get_field_id('link');
?>
" name="<?php
echo $this->get_field_name('link');
?>
" type="text" value="<?php
echo $widget_link;
?>
" /></p>
<p><label for="<?php
echo $this->get_field_id('link');
?>
"><?php
_e('Link Title ( tooltip ):', 'wp-photo-album-plus');
?>
</label> <input class="widefat" id="<?php
echo $this->get_field_id('linktitle');
?>
" name="<?php
echo $this->get_field_name('linktitle');
?>
" type="text" value="<?php
echo $widget_link;
?>
" /></p>
<p><label for="<?php
echo $this->get_field_id('album');
?>
"><?php
_e('Album:', 'wp-photo-album-plus');
?>
</label>
<select class="widefat" id="<?php
echo $this->get_field_id('album');
?>
" name="<?php
echo $this->get_field_name('album');
?>
" >
<?php
echo wppa_album_select_a(array('selected' => $album, 'addseparate' => true, 'addall' => true, 'path' => wppa_switch('wppa_hier_albsel')));
?>
</select>
</p>
<p>
<?php
_e('Sort by:', 'wp-photo-album-plus');
?>
<select class="widefat" id="<?php
echo $this->get_field_id('sortby');
?>
" name="<?php
echo $this->get_field_name('sortby');
?>
">
<option value="" <?php
if ($sortby == '') {
echo 'selected="selected"';
//.........这里部分代码省略.........
开发者ID:lchen01,项目名称:STEdwards,代码行数:101,代码来源:wppa-thumbnail-widget.php
示例16: wppa_get_imglnk_a
function wppa_get_imglnk_a($wich, $id, $lnk = '', $tit = '', $onc = '', $noalb = false, $album = '')
{
global $wpdb;
// make sure the photo data ia available
$thumb = wppa_cache_thumb($id);
if (!$thumb) {
return false;
}
// Is it a video?
$is_video = wppa_is_video($id, true);
// Photo Specific Overrule?
if ($wich == 'sphoto' && wppa_switch('sphoto_overrule') || $wich == 'mphoto' && wppa_switch('mphoto_overrule') || $wich == 'thumb' && wppa_switch('thumb_overrule') || $wich == 'topten' && wppa_switch('topten_overrule') || $wich == 'featen' && wppa_switch('featen_overrule') || $wich == 'lasten' && wppa_switch('lasten_overrule') || $wich == 'sswidget' && wppa_switch('sswidget_overrule') || $wich == 'potdwidget' && wppa_switch('potdwidget_overrule') || $wich == 'coverimg' && wppa_switch('coverimg_overrule') || $wich == 'comten' && wppa_switch('comment_overrule') || $wich == 'slideshow' && wppa_switch('slideshow_overrule') || $wich == 'tnwidget' && wppa_switch('thumbnail_widget_overrule')) {
// Look for a photo specific link
if ($thumb) {
// If it is there...
if ($thumb['linkurl']) {
// Use it. It superceeds other settings
$result['url'] = esc_attr($thumb['linkurl']);
$result['title'] = esc_attr(__(stripslashes($thumb['linktitle'])));
$result['is_url'] = true;
$result['is_lightbox'] = false;
$result['onclick'] = '';
$result['target'] = $thumb['linktarget'];
return $result;
}
}
}
$result['target'] = '_self';
$result['title'] = '';
$result['onclick'] = '';
switch ($wich) {
case 'sphoto':
$type = wppa_opt('sphoto_linktype');
$page = wppa_opt('sphoto_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('sphoto_blank')) {
$result['target'] = '_blank';
}
break;
case 'mphoto':
$type = wppa_opt('mphoto_linktype');
$page = wppa_opt('mphoto_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('mphoto_blank')) {
$result['target'] = '_blank';
}
break;
case 'thumb':
$type = wppa_opt('thumb_linktype');
$page = wppa_opt('thumb_linkpage');
if (wppa_switch('thumb_blank')) {
$result['target'] = '_blank';
}
break;
case 'topten':
$type = wppa_opt('topten_widget_linktype');
$page = wppa_opt('topten_widget_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('topten_blank')) {
$result['target'] = '_blank';
}
break;
case 'featen':
$type = wppa_opt('featen_widget_linktype');
$page = wppa_opt('featen_widget_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('featen_blank')) {
$result['target'] = '_blank';
}
break;
case 'lasten':
$type = wppa_opt('lasten_widget_linktype');
$page = wppa_opt('lasten_widget_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('lasten_blank')) {
$result['target'] = '_blank';
}
break;
case 'comten':
$type = wppa_opt('comment_widget_linktype');
$page = wppa_opt('comment_widget_linkpage');
if ($page == '0') {
$page = '-1';
}
if (wppa_switch('comment_blank')) {
$result['target'] = '_blank';
}
break;
case 'sswidget':
$type = wppa_opt('slideonly_widget_linktype');
//.........这里部分代码省略.........
开发者ID:lchen01,项目名称:STEdwards,代码行数:101,代码来源:wppa-links.php
|
请发表评论