function wppa_inject_js() { global $wppa_api_version; // Things that wppa-tinymce.js AND OTHER MODULES!!! need to know echo '<script type="text/javascript">' . "\n"; echo '/* <![CDATA[ */' . "\n"; echo "\t" . 'wppaImageDirectory = "' . wppa_get_imgdir() . '";' . "\n"; echo "\t" . 'wppaAjaxUrl = "' . admin_url('admin-ajax.php') . '";' . "\n"; echo "\t" . 'wppaPhotoDirectory = "' . WPPA_UPLOAD_URL . '/";' . "\n"; echo "\t" . 'wppaThumbDirectory = "' . WPPA_UPLOAD_URL . '/thumbs/";' . "\n"; echo "\t" . 'wppaTempDirectory = "' . WPPA_UPLOAD_URL . '/temp/";' . "\n"; echo "\t" . 'wppaFontDirectory = "' . WPPA_UPLOAD_URL . '/fonts/";' . "\n"; echo "\t" . 'wppaNoPreview = "' . __('No Preview available', 'wp-photo-album-plus') . '";' . "\n"; echo "\t" . 'wppaVersion = "' . $wppa_api_version . '";' . "\n"; echo "\t" . 'wppaSiteUrl = "' . site_url() . '";' . "\n"; echo "\t" . 'wppaWppaUrl = "' . WPPA_URL . '";' . "\n"; echo "\t" . 'wppaIncludeUrl = "' . trim(includes_url(), '/') . '";' . "\n"; echo "/* ]]> */\n"; echo "</script>\n"; }
/** @see WP_Widget::widget */ function widget($args, $instance) { global $wpdb; global $wppa; $wppa['in_widget'] = 'potd'; $wppa['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); $widget_title = apply_filters('widget_title', $instance['title']); // get the photo ($image) $image = wppa_get_potd(); // Make the HTML for current picture $widget_content = "\n" . '<!-- WPPA+ Photo of the day Widget start -->'; $ali = wppa_opt('wppa_potd_align'); if ($ali != 'none') { $align = 'text-align:' . $ali . ';'; } else { $align = ''; } $widget_content .= "\n" . '<div class="wppa-widget-photo" style="' . $align . ' padding-top:2px; ">'; if ($image) { $id = $image['id']; $w = wppa_opt('wppa_potd_widget_width'); $ratio = wppa_get_photoy($id) / wppa_get_photox($id); $h = round($w * $ratio); $usethumb = wppa_use_thumb_file($id, wppa_opt('wppa_widget_width'), '0'); $imgurl = wppa_fix_poster_ext($usethumb ? wppa_get_thumb_url($id, '', $w, $h) : wppa_get_photo_url($id, '', $w, $h), $id); $name = wppa_get_photo_name($id); $page = in_array(wppa_opt('wppa_widget_linktype'), $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_widget_linkpage', __a('Photo of the day')); $link = wppa_get_imglnk_a('potdwidget', $id); $is_video = wppa_is_video($id); $has_audio = wppa_has_audio($id); if ($link['is_lightbox']) { $lightbox = ($is_video ? ' data-videohtml="' . esc_attr(wppa_get_video_body($id)) . '"' . ' data-videonatwidth="' . wppa_get_videox($id) . '"' . ' data-videonatheight="' . wppa_get_videoy($id) . '"' : '') . ($has_audio ? ' data-audiohtml="' . esc_attr(wppa_get_audio_body($id)) . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '"'; } else { $lightbox = ''; } if ($link) { if ($link['is_lightbox']) { $cursor = ' cursor:url(' . wppa_get_imgdir() . wppa_opt('wppa_magnifier') . '),pointer;'; $title = wppa_zoom_in($id); $ltitle = wppa_get_lbtitle('potd', $id); } else { $cursor = ' cursor:pointer;'; $title = $link['title']; $ltitle = $title; } } else { $cursor = ' cursor:default;'; $title = esc_attr(stripslashes(__($image['name']))); } // The medal if on top $widget_content .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'top')); // The link, if any if ($link) { $widget_content .= "\n\t" . '<a href = "' . $link['url'] . '" target="' . $link['target'] . '" ' . $lightbox . ' ' . wppa('lbtitle') . '="' . $ltitle . '">'; } // The image if (wppa_is_video($id)) { $widget_content .= "\n\t\t" . wppa_get_video_html(array('id' => $id, 'width' => wppa_opt('wppa_potd_widget_width'), 'title' => $title, 'controls' => wppa_opt('widget_linktype') == 'none', 'cursor' => $cursor)); } else { $widget_content .= '<img' . ' src="' . $imgurl . '"' . ' style="width: ' . wppa_opt('wppa_potd_widget_width') . 'px;' . $cursor . '"' . ' ' . wppa_get_imgalt($id) . ($title ? 'title="' . $title . '"' : '') . '/ >'; } // Close the link if ($link) { $widget_content .= "\n\t" . '</a>'; } // The medal if at the bottom $widget_content .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'bot')); // Audio if (wppa_has_audio($id)) { $widget_content .= wppa_get_audio_html(array('id' => $id, 'width' => wppa_opt('wppa_potd_widget_width'), 'controls' => true)); } } else { // No image $widget_content .= __a('Photo not found.', 'wppa_theme'); } $widget_content .= "\n" . '</div>'; // Add subtitle, if any switch (wppa_opt('wppa_widget_subtitle')) { case 'none': break; case 'name': if ($image && $image['name'] != '') { $widget_content .= "\n" . '<div class="wppa-widget-text wppa-potd-text" style="' . $align . '">' . wppa_get_photo_name($id) . '</div>'; } break; case 'desc': if ($image && $image['description'] != '') { $widget_content .= "\n" . '<div class="wppa-widget-text wppa-potd-text" style="' . $align . '">' . wppa_get_photo_desc($id) . '</div>'; } break; case 'owner': if ($image) { $owner = $image['owner']; $user = get_user_by('login', $owner); $owner = $user->display_name; $widget_content .= "\n" . '<div class="wppa-widget-text wppa-potd-text" style="' . $align . '">' . __a('By:') . ' ' . $owner . '</div>'; } } $widget_content .= "\n" . '<!-- WPPA+ Photo of the day 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; }
function wppa_get_imgstyle_a($id, $file, $xmax_size, $xvalign = '', $type = '') { global $wppa; $result = array('style' => '', 'width' => '', 'height' => '', 'cursor' => '', 'margin-top' => '', 'margin-bottom' => ''); // Init wppa_cache_thumb($id); if (!$id) { return $result; } // no image: no dimensions if ($file == '') { return $result; } // no image: no dimensions if (wppa_has_audio($id)) { $file = wppa_fix_poster_ext($file, $id); } if (!wppa_is_video($id) && !is_file($file)) { wppa_dbg_msg('Please check file ' . $file . ' it is missing while expected. Id=' . $id, 'red'); return $result; // no file: no dimensions ( 2.3.0 ) } if (strpos($file, '/wppa/thumbs/')) { $image_attr = wppa_get_imagexy($id, 'thumb'); } else { $image_attr = wppa_get_imagexy($id, 'photo'); } // if ( wppa_is_video( $id ) ) { // $image_attr = array( '0' => wppa_get_videox( $id ), '1' => wppa_get_videoy( $id ) ); // } // else { // $image_attr = array( '0' => wppa_get_photox( $id ), '1' => wppa_get_photoy( $id ) ); // } if (!$image_attr || !isset($image_attr['0']) || !$image_attr['0'] || !isset($image_attr['1']) || !$image_attr['1']) { // File is corrupt wppa_dbg_msg('Please check file ' . $file . ' it is corrupted. If it is a thumbnail image,' . ' regenerate them using Table VIII-A4 of the Photo Albums -> Settings admin page.', 'red'); return $result; } // Adjust for 'border' if ($type == 'fullsize' && !$wppa['in_widget']) { switch (wppa_opt('wppa_fullimage_border_width')) { case '': $max_size = $xmax_size; break; case '0': $max_size = $xmax_size - '2'; break; default: $max_size = $xmax_size - '2' - 2 * wppa_opt('wppa_fullimage_border_width'); } } else { $max_size = $xmax_size; } $ratioref = wppa_opt('wppa_maxheight') / wppa_opt('wppa_fullsize'); $max_height = round($max_size * $ratioref); if ($type == 'fullsize') { if ($wppa['portrait_only']) { $width = $max_size; $height = round($width * $image_attr[1] / $image_attr[0]); } else { if (wppa_is_wider($image_attr[0], $image_attr[1])) { $width = $max_size; $height = round($width * $image_attr[1] / $image_attr[0]); } else { $height = round($ratioref * $max_size); $width = round($height * $image_attr[0] / $image_attr[1]); } if ($image_attr[0] < $width && $image_attr[1] < $height) { if (!$wppa['enlarge']) { $width = $image_attr[0]; $height = $image_attr[1]; } } } } else { if ($type == 'cover' && wppa_switch('wppa_coversize_is_height') && (wppa_opt('wppa_coverphoto_pos') == 'top' || wppa_opt('wppa_coverphoto_pos') == 'bottom')) { $height = $max_size; $width = round($max_size * $image_attr[0] / $image_attr[1]); } else { if (wppa_is_landscape($image_attr)) { $width = $max_size; $height = round($max_size * $image_attr[1] / $image_attr[0]); } else { $height = $max_size; $width = round($max_size * $image_attr[0] / $image_attr[1]); } } } switch ($type) { case 'cover': if (wppa_opt('wppa_bcolor_img') != '') { // There is a border color given $result['style'] .= ' border: 1px solid ' . wppa_opt('wppa_bcolor_img') . ';'; } else { // No border color: no border $result['style'] .= ' border-width: 0px;'; } $result['style'] .= ' width:' . $width . 'px; height:' . $height . 'px;'; if (wppa_switch('wppa_use_cover_opacity') && !is_feed()) { $opac = wppa_opt('wppa_cover_opacity'); $result['style'] .= ' opacity:' . $opac / 100 . '; filter:alpha( opacity=' . $opac . ' );'; } if (wppa_opt('wppa_coverimg_linktype') == 'lightbox') { $result['cursor'] = ' cursor:url( ' . wppa_get_imgdir() . wppa_opt('wppa_magnifier') . ' ),pointer;'; } break; case 'thumb': // Normal // Normal case 'ttthumb': // Topten // Topten case 'comthumb': // Comment widget // Comment widget case 'fthumb': // Filmthumb // Filmthumb case 'twthumb': // Thumbnail widget // Thumbnail widget case 'ltthumb': // Lasten widget // Lasten widget case 'albthumb': // Album widget if ($type == 'thumb' && wppa_get_get('hilite') == $id) { $result['style'] .= ' border:2px solid blue;box-sizing:border-box;'; } else { $result['style'] .= ' border-width: 0px;'; } $result['style'] .= ' width:' . $width . 'px; height:' . $height . 'px;'; if ($xvalign == 'optional') { $valign = wppa_opt('wppa_valign'); } else { $valign = $xvalign; } if ($valign != 'default') { // Center horizontally $delta = floor(($max_size - $width) / 2); if (is_numeric($valign)) { $delta += $valign; } if ($delta < '0') { $delta = '0'; } if ($delta > '0') { $result['style'] .= ' margin-left:' . $delta . 'px; margin-right:' . $delta . 'px;'; } } switch ($valign) { case 'top': $delta = $max_size - $height; if ($delta < '0') { $delta = '0'; } $result['style'] .= ' margin-bottom: ' . $delta . 'px;'; $result['margin-bottom'] = $delta; break; case 'center': $delta = round(($max_size - $height) / 2); if ($delta < '0') { $delta = '0'; } $result['style'] .= ' margin-top: ' . $delta . 'px; margin-bottom: ' . $delta . 'px;'; $result['margin-top'] = $delta; $result['margin-bottom'] = $delta; break; case 'bottom': $delta = $max_size - $height; if ($delta < '0') { $delta = '0'; } $result['style'] .= ' margin-top: ' . $delta . 'px;'; $result['margin-top'] = $delta; break; default: if (is_numeric($valign)) { $delta = $valign; $result['style'] .= ' margin-top: ' . $delta . 'px;'; $result['style'] .= ' margin-bottom: ' . $delta . 'px;'; $result['margin-top'] = $delta; $result['margin-bottom'] = $delta; } } if (wppa_switch('wppa_use_thumb_opacity') && !is_feed()) { $opac = wppa_opt('wppa_thumb_opacity'); $result['style'] .= ' opacity:' . $opac / 100 . '; filter:alpha( opacity=' . $opac . ' );'; } // Cursor $linktyp = ''; switch ($type) { case 'thumb': // Normal $linktyp = wppa_opt('wppa_thumb_linktype'); break; case 'ttthumb': // Topten v $linktyp = wppa_opt('wppa_topten_widget_linktype'); break; case 'comthumb': // Comment widget v $linktyp = wppa_opt('wppa_comment_widget_linktype'); break; case 'fthumb': // Filmthumb $linktyp = wppa_opt('wppa_film_linktype'); break; case 'twthumb': // Thumbnail widget v $linktyp = wppa_opt('wppa_thumbnail_widget_linktype'); break; case 'ltthumb': // Lasten widget v $linktyp = wppa_opt('wppa_lasten_widget_linktype'); break; case 'albthumb': // Album widget $linktyp = wppa_opt('wppa_album_widget_linktype'); } if ($linktyp == 'none') { $result['cursor'] = ' cursor:default;'; } elseif ($linktyp == 'lightbox') { $result['cursor'] = ' cursor:url(' . wppa_get_imgdir() . wppa_opt('wppa_magnifier') . '),pointer;'; } else { $result['cursor'] = ' cursor:pointer;'; } break; case 'fullsize': if ($wppa['auto_colwidth']) { // These sizes fit within the rectangle define by Table I-B1,2 // times 2 for responsive themes, // and are supplied for ver 4 browsers as they have undefined natural sizes. $result['style'] .= ' max-width:' . $width * 2 . 'px;'; $result['style'] .= ' max-height:' . $height * 2 . 'px;'; } else { // These sizes fit within the rectangle define by Table I-B1,2 // and are supplied for ver 4 browsers as they have undefined natural sizes. $result['style'] .= ' max-width:' . $width . 'px;'; $result['style'] .= ' max-height:' . $height . 'px;'; $result['style'] .= ' width:' . $width . 'px;'; $result['style'] .= ' height:' . $height . 'px;'; } if ($wppa['is_slideonly'] == '1') { if ($wppa['ss_widget_valign'] != '') { $valign = $wppa['ss_widget_valign']; } else { $valign = 'fit'; } } elseif ($xvalign == 'optional') { $valign = wppa_opt('wppa_fullvalign'); } else { $valign = $xvalign; } // Margin if ($valign != 'default') { $m_left = '0'; $m_right = '0'; $m_top = '0'; $m_bottom = '0'; // Center horizontally $delta = round(($max_size - $width) / 2); if ($delta < '0') { $delta = '0'; } if ($wppa['auto_colwidth']) { $m_left = 'auto'; $m_right = 'auto'; } else { $m_left = $delta; $m_right = '0'; } // Position vertically if ($wppa['in_widget'] == 'ss' && $wppa['in_widget_frame_height'] > '0') { $max_height = $wppa['in_widget_frame_height']; } $delta = '0'; if (!$wppa['auto_colwidth'] && !wppa_page('oneofone')) { switch ($valign) { case 'top': case 'fit': $delta = '0'; break; case 'center': $delta = round(($max_height - $height) / 2); if ($delta < '0') { $delta = '0'; } break; case 'bottom': $delta = $max_height - $height; if ($delta < '0') { $delta = '0'; } break; } } $m_top = $delta; $result['style'] .= wppa_combine_style('margin', $m_top, $m_left, $m_right, $m_bottom); } // Border and padding if (!$wppa['in_widget']) { switch (wppa_opt('wppa_fullimage_border_width')) { case '': break; case '0': $result['style'] .= ' border: 1px solid ' . wppa_opt('wppa_bcolor_fullimg') . ';'; break; default: $result['style'] .= ' border: 1px solid ' . wppa_opt('wppa_bcolor_fullimg') . ';'; $result['style'] .= ' background-color:' . wppa_opt('wppa_bgcolor_fullimg') . ';'; $result['style'] .= ' padding:' . wppa_opt('wppa_fullimage_border_width') . 'px;'; // If we do round corners... if (wppa_opt('wppa_bradius') > '0') { // then also here $result['style'] .= ' border-radius:' . wppa_opt('wppa_fullimage_border_width') . 'px;'; } } } break; default: $wppa['out'] .= 'Error wrong "$type" argument: ' . $type . ' in wppa_get_imgstyle_a'; } $result['width'] = $width; $result['height'] = $height; return $result; }
function wppa_set_defaults($force = false) { global $wppa_defaults; $npd = ' <a onClick="jQuery(\'.wppa-dtl\').css(\'display\', \'block\'); jQuery(\'.wppa-more\').css(\'display\', \'none\'); wppaOvlResize();"> <div class="wppa-more"> Camera info </div> </a> <a onClick="jQuery(\'.wppa-dtl\').css(\'display\', \'none\'); jQuery(\'.wppa-more\').css(\'display\', \'block\'); wppaOvlResize();"> <div class="wppa-dtl" style="display:none;" > Hide Camera info </div> </a> <div class="wppa-dtl" style="display:none;"> <br /> <style> .wppa-label { padding: 0 3px !important; border: none !important; } .wppa-value { padding: 0 3px 0 12px !important; border:none !important; } </style> <table style="margin:0; border:none;" > <tr><td class="wppa-label" >Date Time</td><td class="wppa-value" >E#0132</td></tr> <tr><td class="wppa-label" >Camera</td><td class="wppa-value" >E#0110</td></tr> <tr><td class="wppa-label" >Focal length</td><td class="wppa-value" >E#920A</td></tr> <tr><td class="wppa-label" >F-Stop</td><td class="wppa-value" >E#829D</td></tr> <tr><td class="wppa-label" >ISO Speed Rating</td><td class="wppa-value" >E#8827</td></tr> <tr><td class="wppa-label" >Exposure program</td><td class="wppa-value" >E#8822</td></tr> <tr><td class="wppa-label" >Metering mode</td><td class="wppa-value" >E#9207</td></tr> <tr><td class="wppa-label" >Flash</td><td class="wppa-value" >E#9209</td></tr> </table> </div>'; $wppa_defaults = array('wppa_revision' => '100', 'wppa_prevrev' => '100', 'wppa_max_users' => '1000', 'wppa_i_responsive' => '', 'wppa_i_downsize' => '', 'wppa_i_source' => '', 'wppa_i_userupload' => '', 'wppa_i_rating' => '', 'wppa_i_comment' => '', 'wppa_i_share' => '', 'wppa_i_iptc' => '', 'wppa_i_exif' => '', 'wppa_i_gpx' => '', 'wppa_i_fotomoto' => '', 'wppa_i_video' => '', 'wppa_i_stereo' => '', 'wppa_i_done' => '', 'wppa_colwidth' => 'auto', 'wppa_initial_colwidth' => '640', 'wppa_resize_on_upload' => 'yes', 'wppa_resize_to' => '0', 'wppa_min_thumbs' => '1', 'wppa_bwidth' => '1', 'wppa_bradius' => '6', 'wppa_box_spacing' => '8', 'wppa_pagelinks_max' => '7', 'wppa_max_filename_length' => '0', 'wppa_max_photoname_length' => '0', 'wppa_fullsize' => '640', 'wppa_maxheight' => '480', 'wppa_enlarge' => 'no', 'wppa_fullimage_border_width' => '', 'wppa_numbar_max' => '10', 'wppa_share_size' => '32', 'wppa_mini_treshold' => '500', 'wppa_slideshow_pagesize' => '0', 'wppa_thumbsize' => '100', 'wppa_thumbsize_alt' => '130', 'wppa_thumb_aspect' => '0:0:none', 'wppa_tf_width' => '100', 'wppa_tf_width_alt' => '130', 'wppa_tf_height' => '150', 'wppa_tf_height_alt' => '180', 'wppa_tn_margin' => '4', 'wppa_thumb_auto' => 'yes', 'wppa_thumb_page_size' => '0', 'wppa_popupsize' => '150', 'wppa_use_thumbs_if_fit' => 'yes', 'wppa_max_cover_width' => '1024', 'wppa_cover_minheight' => '0', 'wppa_head_and_text_frame_height' => '0', 'wppa_text_frame_height' => '54', 'wppa_smallsize' => '150', 'wppa_smallsize_multi' => '100', 'wppa_coversize_is_height' => 'no', 'wppa_album_page_size' => '0', 'wppa_rating_max' => '5', 'wppa_rating_prec' => '2', 'wppa_gravatar_size' => '40', 'wppa_ratspacing' => '30', 'wppa_topten_count' => '10', 'wppa_topten_size' => '86', 'wppa_comten_count' => '10', 'wppa_comten_size' => '86', 'wppa_featen_count' => '10', 'wppa_featen_size' => '86', 'wppa_thumbnail_widget_count' => '10', 'wppa_thumbnail_widget_size' => '86', 'wppa_lasten_count' => '10', 'wppa_lasten_size' => '86', 'wppa_album_widget_count' => '10', 'wppa_album_widget_size' => '86', 'wppa_related_count' => '10', 'wppa_tagcloud_min' => '8', 'wppa_tagcloud_max' => '24', 'wppa_ovl_txt_lines' => 'auto', 'wppa_magnifier' => 'magnifier-small.png', 'wppa_ovl_border_width' => '8', 'wppa_ovl_border_radius' => '12', 'wppa_video_width' => '640', 'wppa_video_height' => '480', 'wppa_show_bread_posts' => 'yes', 'wppa_show_bread_pages' => 'yes', 'wppa_bc_on_search' => 'yes', 'wppa_bc_on_topten' => 'yes', 'wppa_bc_on_lasten' => 'yes', 'wppa_bc_on_comten' => 'yes', 'wppa_bc_on_featen' => 'yes', 'wppa_bc_on_tag' => 'yes', 'wppa_bc_on_related' => 'yes', 'wppa_show_home' => 'yes', 'wppa_show_page' => 'yes', 'wppa_bc_separator' => 'raquo', 'wppa_bc_txt' => htmlspecialchars('<span style="color:red; font_size:24px;">•</span>'), 'wppa_bc_url' => wppa_get_imgdir() . 'arrow.gif', 'wppa_pagelink_pos' => 'bottom', 'wppa_bc_slide_thumblink' => 'no', 'wppa_show_startstop_navigation' => 'yes', 'wppa_show_browse_navigation' => 'yes', 'wppa_filmstrip' => 'yes', 'wppa_film_show_glue' => 'yes', 'wppa_show_full_name' => 'yes', 'wppa_show_full_owner' => 'no', 'wppa_show_full_desc' => 'yes', 'wppa_hide_when_empty' => 'no', 'wppa_rating_on' => 'yes', 'wppa_dislike_mail_every' => '5', 'wppa_dislike_set_pending' => '0', 'wppa_dislike_delete' => '0', 'wppa_dislike_show_count' => 'yes', 'wppa_rating_display_type' => 'graphic', 'wppa_show_avg_rating' => 'yes', 'wppa_show_comments' => 'yes', 'wppa_comment_gravatar' => 'monsterid', 'wppa_comment_gravatar_url' => 'http://', 'wppa_show_bbb' => 'no', 'wppa_show_ubb' => 'no', 'wppa_show_start_stop_icons' => 'no', 'wppa_custom_on' => 'no', 'wppa_custom_content' => '<div style="color:red; font-size:24px; font-weight:bold; text-align:center;">Hello world!</div><div style="text-align:center;" >You can change this text in Table II-B15</div>', 'wppa_show_slideshownumbar' => 'no', 'wppa_show_iptc' => 'no', 'wppa_show_iptc_open' => 'no', 'wppa_show_exif' => 'no', 'wppa_show_exif_open' => 'no', 'wppa_share_on' => 'no', 'wppa_share_hide_when_running' => 'yes', 'wppa_share_on_widget' => 'no', 'wppa_share_on_thumbs' => 'no', 'wppa_share_on_lightbox' => 'no', 'wppa_share_on_mphoto' => 'no', 'wppa_share_qr' => 'no', 'wppa_share_facebook' => 'yes', 'wppa_share_twitter' => 'yes', 'wppa_share_google' => 'yes', 'wppa_share_pinterest' => 'yes', 'wppa_share_linkedin' => 'yes', 'wppa_facebook_comments' => 'yes', 'wppa_facebook_like' => 'yes', 'wppa_fb_display' => 'standard', 'wppa_facebook_admin_id' => '', 'wppa_facebook_app_id' => '', 'wppa_load_facebook_sdk' => 'yes', 'wppa_share_single_image' => 'yes', 'wppa_thumb_text_name' => 'yes', 'wppa_thumb_text_owner' => 'no', 'wppa_thumb_text_desc' => 'yes', 'wppa_thumb_text_rating' => 'yes', 'wppa_thumb_text_comcount' => 'no', 'wppa_thumb_text_viewcount' => 'no', 'wppa_thumb_text_virt_album' => 'yes', 'wppa_thumb_video' => 'no', 'wppa_thumb_audio' => 'yes', 'wppa_popup_text_name' => 'yes', 'wppa_popup_text_owner' => 'no', 'wppa_popup_text_desc' => 'yes', 'wppa_popup_text_desc_strip' => 'no', 'wppa_popup_text_rating' => 'yes', 'wppa_popup_text_ncomments' => 'yes', 'wppa_show_rating_count' => 'no', 'wppa_albdesc_on_thumbarea' => 'none', 'wppa_albname_on_thumbarea' => 'none', 'wppa_show_empty_thumblist' => 'no', 'wppa_edit_thumb' => 'yes', 'wppa_show_cover_text' => 'yes', 'wppa_enable_slideshow' => 'yes', 'wppa_show_slideshowbrowselink' => 'yes', 'wppa_show_viewlink' => 'yes', 'wppa_show_treecount' => 'no', 'wppa_show_cats' => 'no', 'wppa_skip_empty_albums' => 'yes', 'wppa_show_bbb_widget' => 'no', 'wppa_show_ubb_widget' => 'no', 'wppa_ubb_color' => '', 'wppa_show_albwidget_tooltip' => 'yes', 'wppa_ovl_theme' => 'black', 'wppa_ovl_bgcolor' => 'black', 'wppa_ovl_slide_name' => 'no', 'wppa_ovl_slide_desc' => 'yes', 'wppa_ovl_thumb_name' => 'yes', 'wppa_ovl_thumb_desc' => 'no', 'wppa_ovl_potd_name' => 'yes', 'wppa_ovl_potd_desc' => 'no', 'wppa_ovl_sphoto_name' => 'yes', 'wppa_ovl_sphoto_desc' => 'no', 'wppa_ovl_mphoto_name' => 'yes', 'wppa_ovl_mphoto_desc' => 'no', 'wppa_ovl_alw_name' => 'yes', 'wppa_ovl_alw_desc' => 'no', 'wppa_ovl_cover_name' => 'yes', 'wppa_ovl_cover_desc' => 'no', 'wppa_ovl_show_counter' => 'yes', 'wppa_ovl_add_owner' => 'no', 'wppa_ovl_show_startstop' => 'yes', 'wppa_ovl_show_legenda' => 'yes', 'wppa_show_zoomin' => 'yes', 'wppa_ovl_fs_icons' => 'yes', 'wppa_owner_on_new_line' => 'no', 'wppa_user_upload_on' => 'no', 'wppa_user_upload_login' => 'yes', 'wppa_ajax_upload' => 'yes', 'wppa_copyright_on' => 'yes', 'wppa_copyright_notice' => __('<span style="color:red" >Warning: Do not upload copyrighted material!</span>', 'wp-photo-album-plus'), 'wppa_watermark_user' => 'no', 'wppa_name_user' => 'yes', 'wppa_apply_newphoto_desc_user' => 'no', 'wppa_desc_user' => 'yes', 'wppa_fe_custom_fields' => 'no', 'wppa_fe_upload_tags' => 'no', 'wppa_up_tagselbox_on_1' => 'yes', 'wppa_up_tagselbox_multi_1' => 'yes', 'wppa_up_tagselbox_title_1' => __('Select tags:', 'wp-photo-album-plus'), 'wppa_up_tagselbox_content_1' => '', 'wppa_up_tagselbox_on_2' => 'no', 'wppa_up_tagselbox_multi_2' => 'yes', 'wppa_up_tagselbox_title_2' => __('Select tags:', 'wp-photo-album-plus'), 'wppa_up_tagselbox_content_2' => '', 'wppa_up_tagselbox_on_3' => 'no', 'wppa_up_tagselbox_multi_3' => 'yes', 'wppa_up_tagselbox_title_3' => __('Select tags:', 'wp-photo-album-plus'), 'wppa_up_tagselbox_content_3' => '', 'wppa_up_tag_input_on' => 'yes', 'wppa_up_tag_input_title' => __('Enter new tags:', 'wp-photo-album-plus'), 'wppa_up_tag_preview' => 'yes', 'wppa_custom_fields' => 'no', 'wppa_custom_caption_0' => '', 'wppa_custom_visible_0' => 'no', 'wppa_custom_caption_1' => '', 'wppa_custom_visible_1' => 'no', 'wppa_custom_caption_2' => '', 'wppa_custom_visible_2' => 'no', 'wppa_custom_caption_3' => '', 'wppa_custom_visible_3' => 'no', 'wppa_custom_caption_4' => '', 'wppa_custom_visible_4' => 'no', 'wppa_custom_caption_5' => '', 'wppa_custom_visible_5' => 'no', 'wppa_custom_caption_6' => '', 'wppa_custom_visible_6' => 'no', 'wppa_custom_caption_7' => '', 'wppa_custom_visible_7' => 'no', 'wppa_custom_caption_8' => '', 'wppa_custom_visible_8' => 'no', 'wppa_custom_caption_9' => '', 'wppa_custom_visible_9' => 'no', 'wppa_start_symbol_url' => wppa_get_imgdir('start.png', 'abs'), 'wppa_pause_symbol_url' => wppa_get_imgdir('pause.png', 'abs'), 'wppa_stop_symbol_url' => wppa_get_imgdir('stop.png', 'abs'), 'wppa_left_symbol_url' => '', 'wppa_right_symbol_url' => '', 'wppa_start_pause_symbol_size' => '48', 'wppa_start_pause_symbol_bradius' => '24', 'wppa_stop_symbol_size' => '48', 'wppa_stop_symbol_bradius' => '24', 'wppa_left_right_symbol_size' => '32', 'wppa_left_right_symbol_bradius' => '4', 'wppa_close_text' => 'Close', 'wppa_bgcolor_even' => '#eeeeee', 'wppa_bcolor_even' => '#cccccc', 'wppa_bgcolor_alt' => '#dddddd', 'wppa_bcolor_alt' => '#bbbbbb', 'wppa_bgcolor_thumbnail' => '#000000', 'wppa_bgcolor_nav' => '#dddddd', 'wppa_bcolor_nav' => '#bbbbbb', 'wppa_bgcolor_namedesc' => '#dddddd', 'wppa_bcolor_namedesc' => '#bbbbbb', 'wppa_bgcolor_com' => '#dddddd', 'wppa_bcolor_com' => '#bbbbbb', 'wppa_bgcolor_img' => '#eeeeee', 'wppa_bcolor_img' => '', 'wppa_bgcolor_fullimg' => '#cccccc', 'wppa_bcolor_fullimg' => '#777777', 'wppa_bgcolor_cus' => '#dddddd', 'wppa_bcolor_cus' => '#bbbbbb', 'wppa_bgcolor_numbar' => '#cccccc', 'wppa_bcolor_numbar' => '#cccccc', 'wppa_bgcolor_numbar_active' => '#333333', 'wppa_bcolor_numbar_active' => '#333333', 'wppa_bgcolor_iptc' => '#dddddd', 'wppa_bcolor_iptc' => '#bbbbbb', 'wppa_bgcolor_exif' => '#dddddd', 'wppa_bcolor_exif' => '#bbbbbb', 'wppa_bgcolor_share' => '#dddddd', 'wppa_bcolor_share' => '#bbbbbb', 'wppa_bgcolor_upload' => '#dddddd', 'wppa_bcolor_upload' => '#bbbbbb', 'wppa_bgcolor_multitag' => '#dddddd', 'wppa_bcolor_multitag' => '#bbbbbb', 'wppa_bgcolor_tagcloud' => '#dddddd', 'wppa_bcolor_tagcloud' => '#bbbbbb', 'wppa_bgcolor_superview' => '#dddddd', 'wppa_bcolor_superview' => '#bbbbbb', 'wppa_bgcolor_search' => '#dddddd', 'wppa_bcolor_search' => '#bbbbbb', 'wppa_bgcolor_calendar' => '#dddddd', 'wppa_bcolor_calendar' => '#bbbbbb', 'wppa_bgcolor_bestof' => '#dddddd', 'wppa_bcolor_bestof' => '#bbbbbb', 'wppa_bgcolor_stereo' => '#dddddd', 'wppa_bcolor_stereo' => '#bbbbbb', 'wppa_allow_ajax' => 'yes', 'wppa_ajax_non_admin' => 'yes', 'wppa_use_photo_names_in_urls' => 'no', 'wppa_use_album_names_in_urls' => 'no', 'wppa_use_short_qargs' => 'yes', 'wppa_use_pretty_links' => 'yes', 'wppa_update_addressline' => 'yes', 'wppa_render_shortcode_always' => 'no', 'wppa_track_viewcounts' => 'yes', 'wppa_auto_page' => 'no', 'wppa_auto_page_type' => 'photo', 'wppa_auto_page_links' => 'bottom', 'wppa_defer_javascript' => 'no', 'wppa_inline_css' => 'yes', 'wppa_custom_style' => '', 'wppa_use_custom_style_file' => 'no', 'wppa_use_custom_theme_file' => 'no', 'wppa_cre_uploads_htaccess' => 'no', 'wppa_debug_trace_on' => 'no', 'wppa_lazy_or_htmlcomp' => 'no', 'wppa_relative_urls' => 'no', 'wppa_thumbs_first' => 'no', 'wppa_login_links' => 'yes', 'wppa_enable_video' => 'yes', 'wppa_enable_audio' => 'yes', 'wppa_enable_stereo' => 'no', 'wppa_fullvalign' => 'center', 'wppa_fullhalign' => 'center', 'wppa_start_slide' => 'run', 'wppa_start_slideonly' => 'yes', 'wppa_start_slide_video' => 'no', 'wppa_start_slide_audio' => 'no', 'wppa_animation_type' => 'fadeover', 'wppa_slideshow_timeout' => '2500', 'wppa_animation_speed' => '800', 'wppa_slide_pause' => 'no', 'wppa_slide_wrap' => 'yes', 'wppa_fulldesc_align' => 'center', 'wppa_clean_pbr' => 'yes', 'wppa_run_wpautop_on_desc' => 'no', 'wppa_auto_open_comments' => 'yes', 'wppa_film_hover_goto' => 'no', 'wppa_slide_swipe' => 'no', 'wppa_slideshow_page_allow_ajax' => 'yes', 'wppa_list_photos_by' => '0', 'wppa_thumbtype' => 'default', 'wppa_thumbphoto_left' => 'no', 'wppa_valign' => 'center', 'wppa_use_thumb_opacity' => 'yes', 'wppa_thumb_opacity' => '95', 'wppa_use_thumb_popup' => 'yes', 'wppa_align_thumbtext' => 'no', 'wppa_list_albums_by' => '0', 'wppa_main_photo' => '0', 'wppa_coverphoto_pos' => 'right', 'wppa_use_cover_opacity' => 'yes', 'wppa_cover_opacity' => '85', 'wppa_cover_type' => 'default', 'wppa_imgfact_count' => '10', 'wppa_rating_login' => 'yes', 'wppa_rating_change' => 'yes', 'wppa_rating_multi' => 'no', 'wppa_allow_owner_votes' => 'yes', 'wppa_vote_needs_comment' => 'no', 'wppa_dislike_value' => '-5', 'wppa_next_on_callback' => 'no', 'wppa_star_opacity' => '20', 'wppa_vote_button_text' => __('Vote for me!', 'wp-photo-album-plus'), 'wppa_voted_button_text' => __('Voted for me', 'wp-photo-album-plus'), 'wppa_vote_thumb' => 'no', 'wppa_medal_bronze_when' => '5', 'wppa_medal_silver_when' => '10', 'wppa_medal_gold_when' => '15', 'wppa_medal_color' => '2', 'wppa_medal_position' => 'botright', 'wppa_topten_sortby' => 'mean_rating', 'wppa_comment_login' => 'no', 'wppa_comment_view_login' => 'no', 'wppa_comments_desc' => 'no', 'wppa_comment_moderation' => 'logout', 'wppa_comment_email_required' => 'yes', 'wppa_comment_notify' => 'none', 'wppa_com_notify_previous' => 'no', 'wppa_comment_notify_added' => 'yes', 'wppa_comten_alt_display' => 'no', 'wppa_comten_alt_thumbsize' => '75', 'wppa_comment_smiley_picker' => 'no', 'wppa_mail_upl_email' => 'yes', 'wppa_ovl_opacity' => '80', 'wppa_ovl_onclick' => 'none', 'wppa_ovl_anim' => '300', 'wppa_ovl_slide' => '5000', 'wppa_ovl_chrome_at_top' => 'yes', 'wppa_lightbox_global' => 'no', 'wppa_lightbox_global_set' => 'no', 'wppa_lb_hres' => 'no', 'wppa_ovl_video_start' => 'yes', 'wppa_ovl_audio_start' => 'yes', 'wppa_fontfamily_title' => '', 'wppa_fontsize_title' => '', 'wppa_fontcolor_title' => '', 'wppa_fontweight_title' => 'bold', 'wppa_fontfamily_fulldesc' => '', 'wppa_fontsize_fulldesc' => '', 'wppa_fontcolor_fulldesc' => '', 'wppa_fontweight_fulldesc' => 'normal', 'wppa_fontfamily_fulltitle' => '', 'wppa_fontsize_fulltitle' => '', 'wppa_fontcolor_fulltitle' => '', 'wppa_fontweight_fulltitle' => 'normal', 'wppa_fontfamily_nav' => '', 'wppa_fontsize_nav' => '', 'wppa_fontcolor_nav' => '', 'wppa_fontweight_nav' => 'normal', 'wppa_fontfamily_thumb' => '', 'wppa_fontsize_thumb' => '', 'wppa_fontcolor_thumb' => '', 'wppa_fontweight_thumb' => 'normal', 'wppa_fontfamily_box' => '', 'wppa_fontsize_box' => '', 'wppa_fontcolor_box' => '', 'wppa_fontweight_box' => 'normal', 'wppa_fontfamily_numbar' => '', 'wppa_fontsize_numbar' => '', 'wppa_fontcolor_numbar' => '#777777', 'wppa_fontweight_numbar' => 'normal', 'wppa_fontfamily_numbar_active' => '', 'wppa_fontsize_numbar_active' => '', 'wppa_fontcolor_numbar_active' => '#777777', 'wppa_fontweight_numbar_active' => 'bold', 'wppa_fontfamily_lightbox' => '', 'wppa_fontsize_lightbox' => '10', 'wppa_fontcolor_lightbox' => '', 'wppa_fontweight_lightbox' => 'bold', 'wppa_fontsize_widget_thumb' => '9', 'wppa_sphoto_linktype' => 'photo', 'wppa_sphoto_linkpage' => '0', 'wppa_sphoto_blank' => 'no', 'wppa_sphoto_overrule' => 'no', 'wppa_mphoto_linktype' => 'photo', 'wppa_mphoto_linkpage' => '0', 'wppa_mphoto_blank' => 'no', 'wppa_mphoto_overrule' => 'no', 'wppa_thumb_linktype' => 'photo', 'wppa_thumb_linkpage' => '0', 'wppa_thumb_blank' => 'no', 'wppa_thumb_overrule' => 'no', 'wppa_topten_widget_linktype' => 'photo', 'wppa_topten_widget_linkpage' => '0', 'wppa_topten_blank' => 'no', 'wppa_topten_overrule' => 'no', 'wppa_topten_widget_album_linkpage' => '0', 'wppa_featen_widget_linktype' => 'photo', 'wppa_featen_widget_linkpage' => '0', 'wppa_featen_blank' => 'no', 'wppa_featen_overrule' => 'no', 'wppa_slideonly_widget_linktype' => 'widget', 'wppa_slideonly_widget_linkpage' => '0', 'wppa_sswidget_blank' => 'no', 'wppa_sswidget_overrule' => 'no', 'wppa_widget_linktype' => 'single', 'wppa_widget_linkpage' => '0', 'wppa_potd_blank' => 'no', 'wppa_potdwidget_overrule' => 'no', 'wppa_coverimg_linktype' => 'same', 'wppa_coverimg_linkpage' => '0', 'wppa_coverimg_blank' => 'no', 'wppa_coverimg_overrule' => 'no', 'wppa_comment_widget_linktype' => 'photo', 'wppa_comment_widget_linkpage' => '0', 'wppa_comment_blank' => 'no', 'wppa_comment_overrule' => 'no', 'wppa_slideshow_linktype' => 'none', 'wppa_slideshow_linkpage' => '0', 'wppa_slideshow_blank' => 'no', 'wppa_slideshow_overrule' => 'no', 'wppa_thumbnail_widget_linktype' => 'photo', 'wppa_thumbnail_widget_linkpage' => '0', 'wppa_thumbnail_widget_overrule' => 'no', 'wppa_thumbnail_widget_blank' => 'no', 'wppa_film_linktype' => 'slideshow', 'wppa_film_blank' => 'no', 'wppa_film_overrule' => 'no', 'wppa_lasten_widget_linktype' => 'photo', 'wppa_lasten_widget_linkpage' => '0', 'wppa_lasten_blank' => 'no', 'wppa_lasten_overrule' => 'no', 'wppa_art_monkey_link' => 'none', 'wppa_art_monkey_popup_link' => 'file', 'wppa_artmonkey_use_source' => 'no', 'wppa_art_monkey_display' => 'button', 'wppa_art_monkey_on_lightbox' => 'no', 'wppa_allow_download_album' => 'no', 'wppa_download_album_source' => 'yes', 'wppa_album_widget_linktype' => 'content', 'wppa_album_widget_linkpage' => '0', 'wppa_album_widget_blank' => 'no', 'wppa_tagcloud_linktype' => 'album', 'wppa_tagcloud_linkpage' => '0', 'wppa_tagcloud_blank' => 'no', 'wppa_multitag_linktype' => 'album', 'wppa_multitag_linkpage' => '0', 'wppa_multitag_blank' => 'no', 'wppa_super_view_linkpage' => '0', 'wppa_upldr_widget_linkpage' => '0', 'wppa_bestof_widget_linkpage' => '0', 'wppa_supersearch_linkpage' => '0', 'wppa_album_navigator_widget_linktype' => 'thumbs', 'wppa_album_navigator_widget_linkpage' => '0', 'wppa_widget_sm_linktype' => 'landing', 'wppa_widget_sm_linkpage' => '0', 'wppa_widget_sm_linkpage_oc' => '1', 'wppa_cover_sublinks' => 'none', 'wppa_cover_sublinks_display' => 'none', 'wppa_owner_only' => 'yes', 'wppa_upload_owner_only' => 'no', 'wppa_user_album_edit_on' => 'no', 'wppa_upload_moderate' => 'no', 'wppa_upload_edit' => 'no', 'wppa_owner_moderate_comment' => 'no', 'wppa_upload_notify' => 'no', 'wppa_upload_backend_notify' => 'no', 'wppa_upload_one_only' => 'no', 'wppa_memcheck_frontend' => 'yes', 'wppa_memcheck_admin' => 'yes', 'wppa_comment_captcha' => 'none', 'wppa_spam_maxage' => 'none', 'wppa_user_create_on' => 'no', 'wppa_user_create_login' => 'yes', 'wppa_user_destroy_on' => 'no', 'wppa_upload_fronend_maxsize' => '0', 'wppa_void_dups' => 'no', 'wppa_home_after_upload' => 'no', 'wppa_editor_upload_limit_count' => '0', 'wppa_editor_upload_limit_time' => '0', 'wppa_author_upload_limit_count' => '0', 'wppa_author_upload_limit_time' => '0', 'wppa_contributor_upload_limit_count' => '0', 'wppa_contributor_upload_limit_time' => '0', 'wppa_subscriber_upload_limit_count' => '0', 'wppa_subscriber_upload_limit_time' => '0', 'wppa_loggedout_upload_limit_count' => '0', 'wppa_loggedout_upload_limit_time' => '0', 'wppa_blacklist_user' => '', 'wppa_un_blacklist_user' => '', 'wppa_photo_owner_change' => 'no', 'wppa_setup' => '', 'wppa_backup' => '', 'wppa_load_skin' => '', 'wppa_skinfile' => 'default', 'wppa_regen_thumbs' => '', 'wppa_regen_thumbs_skip_one' => '', 'wppa_rerate' => '', 'wppa_cleanup' => '', 'wppa_recup' => '', 'wppa_file_system' => 'flat', 'wppa_remake' => '', 'wppa_remake_skip_one' => '', 'wppa_errorlog_purge' => '', 'wppa_comp_sizes' => '', 'wppa_rating_clear' => 'no', 'wppa_viewcount_clear' => 'no', 'wppa_iptc_clear' => '', 'wppa_exif_clear' => '', 'wppa_apply_new_photodesc_all' => '', 'wppa_remake_index' => '', 'wppa_extend_index' => '', 'wppa_list_index' => '', 'wppa_list_index_display_start' => '', 'wppa_append_text' => '', 'wppa_append_to_photodesc' => '', 'wppa_remove_text' => '', 'wppa_remove_from_photodesc' => '', 'wppa_remove_empty_albums' => '', 'wppa_watermark_all' => '', 'wppa_create_all_autopages' => '', 'wppa_delete_all_autopages' => '', 'wppa_readd_file_extensions' => '', 'wppa_zero_numbers' => '5', 'wppa_leading_zeros' => '', 'wppa_add_gpx_tag' => '', 'wppa_optimize_ewww' => '', 'wppa_tag_to_edit' => '', 'wppa_new_tag_value' => '', 'wppa_edit_tag' => '', 'wppa_sync_cloud' => '', 'wppa_sanitize_tags' => '', 'wppa_sanitize_cats' => '', 'wppa_test_proc' => '', 'wppa_maint_ignore_concurrency_error' => 'no', 'wppa_html' => 'yes', 'wppa_check_balance' => 'no', 'wppa_allow_debug' => 'no', 'wppa_filter_priority' => '1001', 'wppa_shortcode_priority' => '11', 'wppa_shortcode_at_priority' => 'no', 'wppa_shortcode_at_priority_widget' => 'no', 'wppa_lightbox_name' => 'wppa', 'wppa_allow_foreign_shortcodes_general' => 'no', 'wppa_allow_foreign_shortcodes' => 'no', 'wppa_allow_foreign_shortcodes_thumbs' => 'no', 'wppa_arrow_color' => 'black', 'wppa_meta_page' => 'yes', 'wppa_meta_all' => 'yes', 'wppa_use_wp_editor' => 'no', 'wppa_hier_albsel' => 'yes', 'wppa_hier_pagesel' => 'no', 'wppa_alt_type' => 'fullname', 'wppa_photo_admin_pagesize' => '20', 'wppa_comment_admin_pagesize' => '10', 'wppa_jpeg_quality' => '95', 'wppa_geo_edit' => 'no', 'wppa_auto_continue' => 'yes', 'wppa_max_execution_time' => '30', 'wppa_adminbarmenu_admin' => 'yes', 'wppa_adminbarmenu_frontend' => 'yes', 'wppa_feed_use_thumb' => 'no', 'wppa_enable_shortcode_wppa_set' => 'no', 'wppa_set_shortcodes' => 'wppa_thumbtype,wppa_tn_margin,wppa_thumbsize', 'wppa_og_tags_on' => 'yes', 'wppa_add_shortcode_to_post' => 'no', 'wppa_shortcode_to_add' => '[wppa type="album" album="#related,desc"][/wppa]', 'wppa_use_scripts_in_tinymce' => 'no', 'wppa_import_preview' => 'yes', 'wppa_audiostub_upload' => '', 'wppa_audiostub' => '', 'wppa_confirm_create' => 'yes', 'wppa_use_language' => 'yes', 'wppa_import_root' => ABSPATH . 'wp-content', 'wppa_allow_import_source' => 'no', 'wppa_max_album_newtime' => '0', 'wppa_max_photo_newtime' => '0', 'wppa_max_album_modtime' => '0', 'wppa_max_photo_modtime' => '0', 'wppa_new_mod_label_is_text' => 'yes', 'wppa_lasten_limit_new' => 'no', 'wppa_lasten_use_modified' => 'no', 'wppa_new_label_text' => __('NEW', 'wp-photo-album-plus'), 'wppa_new_label_color' => 'orange', 'wppa_mod_label_text' => __('MODIFIED', 'wp-photo-album-plus'), 'wppa_mod_label_color' => 'green', 'wppa_new_label_url' => wppa_get_imgdir('new.png'), 'wppa_mod_label_url' => wppa_get_imgdir('new.png'), 'wppa_apply_newphoto_desc' => 'no', 'wppa_newphoto_description' => $npd, 'wppa_upload_limit_count' => '0', 'wppa_upload_limit_time' => '0', 'wppa_show_album_full' => 'yes', 'wppa_grant_an_album' => 'no', 'wppa_grant_name' => 'display', 'wppa_grant_parent' => '0', 'wppa_default_parent' => '0', 'wppa_default_parent_always' => 'no', 'wppa_max_albums' => '0', 'wppa_alt_is_restricted' => 'no', 'wppa_link_is_restricted' => 'no', 'wppa_covertype_is_restricted' => 'no', 'wppa_porder_restricted' => 'no', 'wppa_reup_is_restricted' => 'yes', 'wppa_newphoto_name_method' => 'filename', 'wppa_default_coverimage_name' => 'Coverphoto', 'wppa_copy_timestamp' => 'no', 'wppa_copy_owner' => 'no', 'wppa_frontend_album_public' => 'no', 'wppa_optimize_new' => 'no', 'wppa_default_album_linktype' => 'content', 'wppa_search_linkpage' => '0', 'wppa_excl_sep' => 'no', 'wppa_search_tags' => 'no', 'wppa_search_cats' => 'no', 'wppa_search_comments' => 'no', 'wppa_photos_only' => 'no', 'wppa_max_search_photos' => '250', 'wppa_max_search_albums' => '25', 'wppa_tags_or_only' => 'no', 'wppa_tags_not_on' => 'no', 'wppa_wild_front' => 'no', 'wppa_search_display_type' => 'content', 'wppa_ss_name_max' => '0', 'wppa_ss_text_max' => '0', 'wppa_search_toptext' => '', 'wppa_search_in_section' => __('Search in current section', 'wp-photo-album-plus'), 'wppa_search_in_results' => __('Search in current results', 'wp-photo-album-plus'), 'wppa_watermark_on' => 'no', 'wppa_watermark_file' => 'specimen.png', 'wppa_watermark_pos' => 'cencen', 'wppa_textual_watermark_type' => 'tvstyle', 'wppa_textual_watermark_text' => "Copyright (c) 2014 w#site \n w#filename (w#owner)", 'wppa_textual_watermark_font' => 'system', 'wppa_textual_watermark_size' => '10', 'wppa_watermark_upload' => '', 'wppa_watermark_opacity' => '20', 'wppa_watermark_opacity_text' => '80', 'wppa_watermark_thumbs' => 'no', 'wppa_slide_order' => '0,1,2,3,4,5,6,7,8,9,10', 'wppa_slide_order_split' => '0,1,2,3,4,5,6,7,8,9,10,11', 'wppa_swap_namedesc' => 'no', 'wppa_split_namedesc' => 'no', 'wppa_keep_source_admin' => 'yes', 'wppa_keep_source_frontend' => 'yes', 'wppa_source_dir' => WPPA_ABSPATH . WPPA_UPLOAD . '/wppa-source', 'wppa_keep_sync' => 'yes', 'wppa_remake_add' => 'yes', 'wppa_save_iptc' => 'yes', 'wppa_save_exif' => 'yes', 'wppa_exif_max_array_size' => '10', 'wppa_chgsrc_is_restricted' => 'no', 'wppa_ext_status_restricted' => 'no', 'wppa_desc_is_restricted' => 'no', 'wppa_newpag_create' => 'no', 'wppa_newpag_content' => '[wppa type="cover" album="w#album" align="center"][/wppa]', 'wppa_newpag_type' => 'page', 'wppa_newpag_status' => 'publish', 'wppa_pl_dirname' => 'wppa-pl', 'wppa_import_parent_check' => 'yes', 'wppa_iptc_need_utf8' => 'yes', 'wppa_keep_import_files' => 'no', 'wppa_cp_points_comment' => '0', 'wppa_cp_points_rating' => '0', 'wppa_cp_points_upload' => '0', 'wppa_use_scabn' => 'no', 'wppa_use_CMTooltipGlossary' => 'no', 'wppa_cdn_service' => '', 'wppa_cdn_cloud_name' => '', 'wppa_cdn_api_key' => '', 'wppa_cdn_api_secret' => '', 'wppa_cdn_service_update' => 'no', 'wppa_delete_all_from_cloudinary' => '', 'wppa_delete_derived_from_cloudinary' => '', 'wppa_max_cloud_life' => '0', 'wppa_gpx_implementation' => 'none', 'wppa_map_height' => '300', 'wppa_map_apikey' => '', 'wppa_gpx_shortcode' => '[map style="width: auto; height:300px; margin:0; " marker="yes" lat="w#lat" lon="w#lon"]', 'wppa_fotomoto_on' => 'no', 'wppa_fotomoto_fontsize' => '', 'wppa_fotomoto_hide_when_running' => 'no', 'wppa_fotomoto_min_width' => '400', 'wppa_widgettitle' => __('Photo of the day', 'wp-photo-album-plus'), 'wppa_widget_linkurl' => __('Type your custom url here', 'wp-photo-album-plus'), 'wppa_widget_linktitle' => __('Type the title here', 'wp-photo-album-plus'), 'wppa_widget_subtitle' => 'none', 'wppa_widget_album' => 'all', 'wppa_widget_photo' => '', 'wppa_potd_align' => 'center', 'wppa_widget_method' => '4', 'wppa_widget_period' => '24', 'wppa_widget_width' => '200', 'wppa_potd_widget_width' => '200', 'wppa_widget_status_filter' => 'none', 'wppa_toptenwidgettitle' => __('Top Ten Photos', 'wp-photo-album-plus'), 'wppa_thumbnailwidgettitle' => __('Thumbnail Photos', 'wp-photo-album-plus'), 'wppa_searchwidgettitle' => __('Search photos', 'wp-photo-album-plus'), 'wppa_comadmin_show' => 'all', 'wppa_comadmin_order' => 'timestamp', 'wppa_qr_size' => '200', 'wppa_qr_color' => '#000000', 'wppa_qr_bgcolor' => '#FFFFFF'); array_walk($wppa_defaults, 'wppa_set_default', $force); return true; }
function _wppa_comment_admin() { global $wpdb; $continue = true; // Check input wppa_vfy_arg('tab', true); wppa_vfy_arg('edit_id'); wppa_vfy_arg('wppa-page'); wppa_vfy_arg('commentid'); wppa_vfy_arg('delete_id'); if (isset($_GET['tab'])) { if ($_GET['tab'] == 'edit') { $id = $_GET['edit_id']; $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WPPA_COMMENTS . " WHERE id = %s LIMIT 1", $id), ARRAY_A); if ($comment) { ?> <div class="wrap"> <?php $iconurl = WPPA_URL . '/img/comment.png'; ?> <div id="icon-album" class="icon32" style="background: transparent url(<?php echo $iconurl; ?> ) no-repeat"> <br /> </div> <h2><?php _e('Photo Albums -> Edit Comment', 'wp-photo-album-plus'); ?> </h2> <?php $action = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_manage_comments'); if (isset($_GET['wppa-page'])) { $action .= '&compage=' . strval(intval($_GET['wppa-page'])); } if (isset($_GET['commentid'])) { $action .= '&commentid=' . strval(intval($_GET['commentid'])); } ?> <form action="<?php echo $action; ?> " method="post"> <?php wp_nonce_field('$wppa_nonce', WPPA_NONCE); ?> <input type="hidden" name="edit_comment" value="<?php echo $comment['id']; ?> " /> <table class="form-table albumtable"> <tbody> <tr style="vertical-align:top" > <th> <?php $photo = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WPPA_PHOTOS . " WHERE id = %s", $comment['photo']), "ARRAY_A"); ?> <?php $url = wppa_fix_poster_ext(wppa_get_thumb_url($comment['photo']), $comment['photo']); ?> <img src="<?php echo $url; ?> " /> </th> <td> <?php echo __($photo['name']) . '<br/><br/>' . __(stripslashes($photo['description'])); ?> </td> </tr> <tr> <th scope="row"><label ><?php _e('Photo:', 'wp-photo-album-plus'); ?> </label></th> <td><?php echo $comment['photo']; ?> </td> </tr> <tr> <th scope="row"><label ><?php _e('Album:', 'wp-photo-album-plus'); ?> </label></th> <td><?php echo wppa_get_album_name($photo['album']); ?> </td> </tr> <tr> <th scope="row"><label ><?php _e('User:'******'wp-photo-album-plus'); ?> </label></th> <td><input style="width:300px;" type="text" name="user" value="<?php echo $comment['user']; ?> " /></td> </tr> <tr> <th scope="row"><label ><?php _e('Email:', 'wp-photo-album-plus'); ?> </label></th> <td><input style="width:300px;" type="text" name="email" value="<?php echo $comment['email']; ?> " /></td> </tr> <tr> <th scope="row"><label><?php _e('Comment:', 'wp-photo-album-plus'); ?> </label></th> <td><textarea style="width:300px; height:150px;" name="comment"><?php echo esc_textarea(stripslashes($comment['comment'])); ?> </textarea></td> </tr> </tbody> </table> <p> <input type="submit" class="button-primary" name="wppa_submit" value="<?php _e('Save Changes', 'wp-photo-album-plus'); ?> " /> </p> </form> <?php } $continue = false; } if ($_GET['tab'] == 'delete') { $id = strval(intval($_GET['delete_id'])); $photo = $wpdb->get_var($wpdb->prepare("SELECT `photo` FROM `" . WPPA_COMMENTS . "` WHERE `id` = %s", $id)); $iret = $wpdb->query($wpdb->prepare("DELETE FROM `" . WPPA_COMMENTS . "` WHERE `id` = %s LIMIT 1", $id)); if ($iret !== false) { if (wppa_switch('search_comments')) { wppa_index_update('photo', $photo); } wppa_update_message(__('Comment deleted', 'wp-photo-album-plus')); } else { wppa_error_message('Error deleting comment'); } $continue = true; } } if ($continue) { // Update anything or do bulkaction if (isset($_POST['wppa_submit'])) { // Security check check_admin_referer('$wppa_nonce', WPPA_NONCE); // Updates $iret = true; if (isset($_POST['wppa_comadmin_show'])) { wppa_update_option('wppa_comadmin_show', $_POST['wppa_comadmin_show']); } if (isset($_POST['wppa_comadmin_linkpage'])) { wppa_update_option('wppa_comadmin_linkpage', $_POST['wppa_comadmin_linkpage']); } if (isset($_POST['wppa_comadmin_order'])) { wppa_update_option('wppa_comadmin_order', $_POST['wppa_comadmin_order']); } if (isset($_POST['edit_comment'])) { $iret = wppa_edit_comment($_POST['edit_comment']); } // Bulk actions if (isset($_POST['bulkaction'])) { switch ($_POST['bulkaction']) { case 'approveall': $coms_to_proc = $wpdb->get_results("SELECT `id` FROM `" . WPPA_COMMENTS . "` WHERE status = 'pending'", ARRAY_A); $query = "UPDATE " . WPPA_COMMENTS . " SET status = 'approved' WHERE status = 'pending'"; if ($wpdb->query($query) === false) { wppa_error_message(__('Could not bulk update status', 'wp-photo-album-plus')); $iret = false; } else { if ($coms_to_proc) { foreach ($coms_to_proc as $item) { wppa_send_comment_approved_email($item['id']); } } $iret = true; } break; case 'spamall': $query = "UPDATE " . WPPA_COMMENTS . " SET status = 'spam' WHERE status = 'pending'"; if ($wpdb->query($query) === false) { wppa_error_message(__('Could not bulk update status', 'wp-photo-album-plus')); $iret = false; } else { $iret = true; } break; case 'delspam': $query = "DELETE FROM " . WPPA_COMMENTS . " WHERE status = 'spam'"; if ($wpdb->query($query) === false) { wppa_error_message(__('Could not bulk delete spam', 'wp-photo-album-plus')); $iret = false; } break; } } if ($iret) { wppa_update_message(__('Changes Saved', 'wp-photo-album-plus')); } // Clear (super)cache wppa_clear_cache(); } // Submit // Delete trash $query = "DELETE FROM " . WPPA_COMMENTS . " WHERE status = 'trash'"; $wpdb->query($query); // Initialize normal display $wppa_comadmin_linkpage = get_option('wppa_comadmin_linkpage', '0'); if ($wppa_comadmin_linkpage) { $exists = $wpdb->get_var("SELECT `post_title` FROM `" . $wpdb->posts . "` WHERE `ID` = " . $wppa_comadmin_linkpage); if (!$exists) { $wppa_comadmin_linkpage = '0'; update_option('wppa_comadmin_linkpage', '0'); } } $moderating = isset($_REQUEST['commentid']); ?> <div class="wrap"> <?php $iconurl = WPPA_URL . '/img/comment.png'; ?> <div id="icon-album" class="icon32" style="background: transparent url(<?php echo $iconurl; ?> ) no-repeat"> <br /> </div> <h2> <?php if ($moderating) { _e('Photo Albums -> Moderate Comment', 'wp-photo-album-plus'); } else { _e('Photo Albums -> Comment admin', 'wp-photo-album-plus'); } ?> </h2> <?php if (!wppa_switch('show_comments')) { _e('<h3>The Comment system is not activated</h3><p>To activate: check Table II item 18 on the <b>Photo Albums -> Settings</b> screen and press <b>Save Changes</b>', 'wp-photo-album-plus'); } ?> <?php if (!$moderating) { ?> <!-- Statistics --> <table> <tbody> <tr> <td><h3 style="margin:0; color:#777777;"><?php _e('Total:', 'wp-photo-album-plus'); ?> </h3></td> <td><h3 style="margin:0;"><?php $count = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_COMMENTS . "`"); echo $count; ?> </h3></td> </tr> <tr> <td><h3 style="margin:0; color:green;"><?php _e('Approved:', 'wp-photo-album-plus'); ?> </h3></td> <td><h3 style="margin:0;"><?php $count = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_COMMENTS . "` WHERE `status` = 'approved'"); echo $count; ?> </h3></td> </tr> <tr> <td><h3 style="margin:0; color:#e66f00;"><?php _e('Pending:', 'wp-photo-album-plus'); ?> </h3></td> <td><h3 style="margin:0;"><?php $count = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_COMMENTS . "` WHERE `status` = 'pending'"); echo $count; ?> </h3></td> </tr> <tr> <td><h3 style="margin:0; color:red;"><?php _e('Spam:', 'wp-photo-album-plus'); ?> </h3></td> <td><h3 style="margin:0;"><?php $count = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_COMMENTS . "` WHERE `status` = 'spam'"); echo $count; ?> </h3></td> </tr> <?php if (wppa_opt('spam_maxage') != 'none') { ?> <tr> <td><h3 style="margin:0; color:red;"><?php _e('Auto deleted spam:', 'wp-photo-album-plus'); ?> </h3></td> <td><h3 style="margin:0;"><?php echo get_option('wppa_spam_auto_delcount', '0'); ?> </h3></td> </tr> <?php } ?> </tbody> </table> <!-- end statistics --> <!-- Settings --> <div style="border:1px solid #ccc; padding:4px; margin:4px 0" > <h3><?php _e('Settings', 'wp-photo-album-plus'); ?> </h3> <form action="<?php echo wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_manage_comments'); ?> " method="post"> <p> <?php wp_nonce_field('$wppa_nonce', WPPA_NONCE); _e('Linkpage:', 'wp-photo-album-plus'); ?> <select name="wppa_comadmin_linkpage"> <option value="0" <?php if ($wppa_comadmin_linkpage == '0') { echo 'selected="selected"'; } ?> disabled="disabled" ><?php _e('--- Please select a page ---', 'wp-photo-album-plus'); ?> </option> <?php $query = "SELECT `ID`, `post_title`, `post_content` 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) { foreach ($pages as $page) { if (stripos($page['post_content'], '%%wppa%%') !== false || stripos($page['post_content'], '[wppa') !== false) { if ($wppa_comadmin_linkpage == $page['ID']) { $sel = 'selected="selected"'; } else { $sel = ''; } echo '<option value="' . $page['ID'] . '" ' . $sel . '>' . __($page['post_title'], 'wp-photo-album-plus') . '</option>'; } } } ?> </select> <?php _e('You can see the photo and all its comments on the selected page by clicking on the thumbnail image', 'wp-photo-album-plus'); ?> </p> <?php $comment_show = wppa_opt('comadmin_show'); ?> <p> <?php _e('Display status:', 'wp-photo-album-plus'); ?> <select name="wppa_comadmin_show"> <option value="all" <?php if ($comment_show == 'all') { echo 'selected="selected"'; } ?> ><?php _e('all', 'wp-photo-album-plus'); ?> </option> <option value="pending" <?php if ($comment_show == 'pending') { echo 'selected="selected"'; } ?> ><?php _e('pending', 'wp-photo-album-plus'); ?> </option> <option value="approved" <?php if ($comment_show == 'approved') { echo 'selected="selected"'; } ?> ><?php _e('approved', 'wp-photo-album-plus'); ?> </option> <option value="spam" <?php if ($comment_show == 'spam') { echo 'selected="selected"'; } ?> ><?php _e('spam', 'wp-photo-album-plus'); ?> </option> </select> <?php $comment_order = wppa_opt('comadmin_order'); ?> <?php _e('Display order:', 'wp-photo-album-plus'); ?> <select name="wppa_comadmin_order"> <option value="timestamp" <?php if ($comment_order == 'timestamp') { echo 'selected="selected"'; } ?> ><?php _e('timestamp', 'wp-photo-album-plus'); ?> </option> <option value="photo" <?php if ($comment_order == 'photo') { echo 'selected="selected"'; } ?> ><?php _e('photo', 'wp-photo-album-plus'); ?> </option> </select> <?php _e('Bulk action:', 'wp-photo-album-plus'); ?> <select name="bulkaction"> <option value=""><?php ?> </option> <option value="approveall"><?php _e('Approve all pending', 'wp-photo-album-plus'); ?> </option> <option value="spamall"><?php _e('Move all pending to spam', 'wp-photo-album-plus'); ?> </option> <option value="delspam"><?php _e('Delete all spam', 'wp-photo-album-plus'); ?> </option> </select> <input type="submit" class="button-primary" name="wppa_submit" value="<?php _e('Save Settings / Perform bulk action', 'wp-photo-album-plus'); ?> " /> </p> </form> </div> <!-- End Settings --> <?php } if ($moderating) { $pagesize = '1'; $where = " WHERE `id` = '" . $_REQUEST['commentid'] . "'"; $order = ''; $curpage = '1'; $limit = ''; } else { $pagsize = wppa_opt('comment_admin_pagesize'); $where = $comment_show == 'all' ? '' : " WHERE `status` = '" . $comment_show . "'"; $order = " ORDER BY `" . $comment_order . "`"; if ($comment_order == 'timestamp') { $order .= " DESC"; } if (isset($_GET['wppa-page'])) { $curpage = strval(intval($_GET['wppa-page'])); $offset = (strval(intval($_GET['wppa-page'])) - 1) * $pagsize; $limit = " LIMIT " . $offset . "," . $pagsize; } else { $limit = ' LIMIT 0,' . $pagsize; $curpage = '1'; } if ($pagsize == '0') { $limit = ''; } // Paginating is off $nitems = $wpdb->get_var("SELECT COUNT(*) FROM " . WPPA_COMMENTS . $where); $link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_manage_comments'); wppa_admin_page_links($curpage, $pagsize, $nitems, $link); } ?> <table class="widefat"> <thead style="font-weight: bold" class=""> <tr> <th scope="col"><?php _e('Photo', 'wp-photo-album-plus'); ?> <br /> <?php _e('(Album)', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('#', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('IP', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('User', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Email', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Time since', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Comment', 'wp-photo-album-plus'); ?> </th> <th scope="col" style="width: 130px;" ><?php _e('Status', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Edit', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Delete', 'wp-photo-album-plus'); ?> </th> </tr> </thead> <tbody class="wppa_table_1"> <?php $comments = $wpdb->get_results("SELECT * FROM `" . WPPA_COMMENTS . "`" . $where . $order . $limit, ARRAY_A); if ($comments) { foreach ($comments as $com) { ?> <tr> <?php $photo = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WPPA_PHOTOS . " WHERE id = %s", $com['photo']), 'ARRAY_A'); if ($photo) { $alb = $photo['album']; $pname = __($photo['name'], 'wp-photo-album-plus'); $albname = '(' . wppa_get_album_name($alb) . ')'; } else { $alb = ''; $pname = ''; $albname = ''; } if ($wppa_comadmin_linkpage == '0') { ?> <td style="text-align:center"> <img src="<?php echo wppa_fix_poster_ext(wppa_get_thumb_url($com['photo']), $com['photo']); ?> " style="max-height:64px;max-width:64px;" /> <br /> <?php echo $albname; ?> </td><?php } else { $url = get_page_link($wppa_comadmin_linkpage); if (strpos($url, '?')) { $url .= '&'; } else { $url .= '?'; } $url .= 'wppa-album=' . $alb . '&wppa-photo=' . $com['photo'] . '&wppa-occur=1'; ?> <td style="text-align:center"> <a href="<?php echo $url; ?> " target="_blank"> <img title="<?php _e('Click to see the fullsize photo and all comments', 'wp-photo-album-plus'); ?> " src="<?php echo wppa_fix_poster_ext(wppa_get_thumb_url($com['photo']), $com['photo']); ?> " style="max-height:64px;max-width:64px;" /> </a> <br /> <?php echo $albname; ?> </td><?php } ?> <td><?php echo $com['photo']; ?> </td> <td><?php echo $com['ip']; ?> </td> <td><?php echo $com['user']; ?> </td> <td><?php if ($com['email']) { $subject = str_replace(' ', '%20', sprintf(__('Reply to your comment on photo: %s on %s', 'wp-photo-album-plus'), $pname, get_bloginfo('name'))); echo '<a href="mailto:' . $com['email'] . '?Subject=' . $subject . '" title="' . __('Reply', 'wp-photo-album-plus') . '" >' . $com['email'] . '</a>'; } else { echo $com['email']; } ?> </td> <td><?php echo wppa_get_time_since($com['timestamp']); ?> </td> <td><?php echo stripslashes($com['comment']); ?> </td> <td> <input type="hidden" id="photo-nonce-<?php echo $com['photo']; ?> " value="<?php echo wp_create_nonce('wppa_nonce_' . $com['photo']); ?> " /> <select name="status['<?php echo $com['id']; ?> ']" onchange="jQuery('#wppa-comment-spin-<?php echo $com['id']; ?> ').css('visibility', 'visible'); wppaAjaxUpdateCommentStatus(<?php echo $com['photo']; ?> , <?php echo $com['id']; ?> , this.value)"> <option value="pending" <?php if ($com['status'] == 'pending') { echo 'selected="selected"'; } ?> ><?php _e('Pending', 'wp-photo-album-plus'); ?> </option> <option value="approved" <?php if ($com['status'] == 'approved') { echo 'selected="selected"'; } ?> ><?php _e('Approved', 'wp-photo-album-plus'); ?> </option> <option value="spam" <?php if ($com['status'] == 'spam') { echo 'selected="selected"'; } ?> ><?php _e('Spam', 'wp-photo-album-plus'); ?> </option> </select> <img id="wppa-comment-spin-<?php echo $com['id']; ?> " src="<?php echo wppa_get_imgdir() . 'spinner.gif'; ?> " style="visibility:hidden" /> </td> <?php $url = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_manage_comments&tab=edit&edit_id=' . $com['id']); if (isset($_GET['wppa-page'])) { $url .= '&compage=' . strval(intval($_GET['wppa-page'])); } if (isset($_GET['commentid'])) { $url .= '&commentid=' . strval(intval($_GET['commentid'])); } ?> <?php $delurl = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_manage_comments&tab=delete&delete_id=' . $com['id']); ?> <td style="color:green; cursor:pointer;" onclick="document.location='<?php echo $url; ?> '"><b><?php _e('Edit', 'wp-photo-album-plus'); ?> </b></td> <td style="color:red; cursor:pointer;" onclick="if (confirm('<?php _e('Are you sure you want to delete this comment?', 'wp-photo-album-plus'); ?> ')) document.location = '<?php echo $delurl; ?> ';"><b><?php _e('Delete', 'wp-photo-album-plus'); ?> </b></td> </tr> <?php } } ?> </tbody> <tfoot style="font-weight: bold" class=""> <tr> <th scope="col"><?php _e('Photo', 'wp-photo-album-plus'); ?> <br /> <?php _e('(Album)', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('#', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('IP', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('User', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Email', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Time since', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Comment', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Status', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Edit', 'wp-photo-album-plus'); ?> </th> <th scope="col"><?php _e('Delete', 'wp-photo-album-plus'); ?> </th> </tr> </tfoot> </table> <?php if (!$moderating) { wppa_admin_page_links($curpage, $pagsize, $nitems, $link); } ?> </form> </div> <?php } }
function wppa_create_wppa_init_js() { global $wppa_api_version; global $wppa_lang; global $wppa_init_js_data; // Init if (is_numeric(wppa_opt('fullimage_border_width'))) { $fbw = wppa_opt('fullimage_border_width') + '1'; } else { $fbw = '0'; } // Make content $content = '/* -- WPPA+ Runtime parameters /* /* Dynamicly Created on ' . date('c') . ' /* */ '; if ((WPPA_DEBUG || wppa_get_get('debug') || WP_DEBUG) && !wppa_switch('defer_javascript')) { $content .= ' /* Check if wppa.js and jQuery are present */ if (typeof(_wppaSlides) == \'undefined\') alert(\'There is a problem with your theme. The file wppa.js is not loaded when it is expected (Errloc = wppa_kickoff).\'); if (typeof(jQuery) == \'undefined\') alert(\'There is a problem with your theme. The jQuery library is not loaded when it is expected (Errloc = wppa_kickoff).\'); '; } /* This goes into wppa.js */ $content .= ' wppaVersion = "' . $wppa_api_version . '"; wppaDebug = ' . (wppa_switch('allow_debug') ? 'true' : 'false') . '; wppaBackgroundColorImage = "' . wppa_opt('bgcolor_img') . '"; wppaPopupLinkType = "' . wppa_opt('thumb_linktype') . '"; wppaAnimationType = "' . wppa_opt('animation_type') . '"; wppaAnimationSpeed = ' . wppa_opt('animation_speed') . '; wppaThumbnailAreaDelta = ' . wppa_get_thumbnail_area_delta() . '; wppaTextFrameDelta = ' . wppa_get_textframe_delta() . '; wppaBoxDelta = ' . wppa_get_box_delta() . '; wppaSlideShowTimeOut = ' . wppa_opt('slideshow_timeout') . '; wppaPreambule = ' . wppa_get_preambule() . '; wppaFilmShowGlue = ' . (wppa_switch('film_show_glue') ? 'true' : 'false') . '; wppaSlideShow = "' . __('Slideshow', 'wp-photo-album-plus') . '"; wppaStart = "' . __('Start', 'wp-photo-album-plus') . '"; wppaStop = "' . __('Stop', 'wp-photo-album-plus') . '"; wppaSlower = "' . __('Slower', 'wp-photo-album-plus') . '"; wppaFaster = "' . __('Faster', 'wp-photo-album-plus') . '"; wppaPhoto = "' . __('Photo', 'wp-photo-album-plus') . '"; wppaOf = "' . __('of', 'wp-photo-album-plus') . '"; wppaPreviousPhoto = "' . __('Previous photo', 'wp-photo-album-plus') . '"; wppaNextPhoto = "' . __('Next photo', 'wp-photo-album-plus') . '"; wppaPrevP = "' . __('Prev.', 'wp-photo-album-plus') . '"; wppaNextP = "' . __('Next', 'wp-photo-album-plus') . '"; wppaAvgRating = "' . __('Average rating', 'wp-photo-album-plus') . '"; wppaMyRating = "' . __('My rating', 'wp-photo-album-plus') . '"; wppaAvgRat = "' . __('Avg.', 'wp-photo-album-plus') . '"; wppaMyRat = "' . __('Mine', 'wp-photo-album-plus') . '"; wppaDislikeMsg = "' . __('You marked this image as inappropriate.', 'wp-photo-album-plus') . '"; wppaMiniTreshold = ' . (wppa_opt('mini_treshold') ? wppa_opt('mini_treshold') : '0') . '; wppaRatingOnce = ' . (wppa_switch('rating_change') || wppa_switch('rating_multi') ? 'false' : 'true') . '; wppaPleaseName = "' . __('Please enter your name', 'wp-photo-album-plus') . '"; wppaPleaseEmail = "' . __('Please enter a valid email address', 'wp-photo-album-plus') . '"; wppaPleaseComment = "' . __('Please enter a comment', 'wp-photo-album-plus') . '"; wppaHideWhenEmpty = ' . (wppa_switch('hide_when_empty') ? 'true' : 'false') . '; wppaBGcolorNumbar = "' . wppa_opt('bgcolor_numbar') . '"; wppaBcolorNumbar = "' . wppa_opt('bcolor_numbar') . '"; wppaBGcolorNumbarActive = "' . wppa_opt('bgcolor_numbar_active') . '"; wppaBcolorNumbarActive = "' . wppa_opt('bcolor_numbar_active') . '"; wppaFontFamilyNumbar = "' . wppa_opt('fontfamily_numbar') . '"; wppaFontSizeNumbar = "' . wppa_opt('fontsize_numbar') . 'px"; wppaFontColorNumbar = "' . wppa_opt('fontcolor_numbar') . '"; wppaFontWeightNumbar = "' . wppa_opt('fontweight_numbar') . '"; wppaFontFamilyNumbarActive = "' . wppa_opt('fontfamily_numbar_active') . '"; wppaFontSizeNumbarActive = "' . wppa_opt('fontsize_numbar_active') . 'px"; wppaFontColorNumbarActive = "' . wppa_opt('fontcolor_numbar_active') . '"; wppaFontWeightNumbarActive = "' . wppa_opt('fontweight_numbar_active') . '"; wppaNumbarMax = "' . wppa_opt('numbar_max') . '"; wppaLang = "' . $wppa_lang . '"; wppaNextOnCallback = ' . (wppa_switch('next_on_callback') ? 'true' : 'false') . '; wppaStarOpacity = ' . str_replace(',', '.', wppa_opt('star_opacity') / '100') . '; wppaSlideWrap = ' . (wppa_switch('slide_wrap') ? 'true' : 'false') . '; wppaEmailRequired = "' . wppa_opt('comment_email_required') . '"; wppaSlideBorderWidth = ' . $fbw . '; wppaAllowAjax = ' . (wppa_switch('allow_ajax') ? 'true' : 'false') . '; wppaUsePhotoNamesInUrls = ' . (wppa_switch('use_photo_names_in_urls') ? 'true' : 'false') . '; wppaThumbTargetBlank = ' . (wppa_switch('thumb_blank') ? 'true' : 'false') . '; wppaRatingMax = ' . wppa_opt('rating_max') . '; wppaRatingDisplayType = "' . wppa_opt('rating_display_type') . '"; wppaRatingPrec = ' . wppa_opt('rating_prec') . '; wppaStretch = ' . (wppa_switch('enlarge') ? 'true' : 'false') . '; wppaMinThumbSpace = ' . wppa_opt('tn_margin') . '; wppaThumbSpaceAuto = ' . (wppa_switch('thumb_auto') ? 'true' : 'false') . '; wppaMagnifierCursor = "' . wppa_opt('magnifier') . '"; wppaArtMonkyLink = "' . wppa_opt('art_monkey_link') . '"; wppaAutoOpenComments = ' . (wppa_switch('auto_open_comments') ? 'true' : 'false') . '; wppaUpdateAddressLine = ' . (wppa_switch('update_addressline') ? 'true' : 'false') . '; wppaFilmThumbTitle = "' . (wppa_opt('film_linktype') == 'lightbox' ? wppa_zoom_in(false) : __('Double click to start/stop slideshow running', 'wp-photo-album-plus')) . '"; wppaVoteForMe = "' . __(wppa_opt('vote_button_text'), 'wp-photo-album-plus') . '"; wppaVotedForMe = "' . __(wppa_opt('voted_button_text'), 'wp-photo-album-plus') . '"; wppaSlideSwipe = ' . (wppa_switch('slide_swipe') ? 'true' : 'false') . '; wppaMaxCoverWidth = ' . wppa_opt('max_cover_width') . '; wppaDownLoad = "' . __('Download', 'wp-photo-album-plus') . '"; wppaSlideToFullpopup = ' . (wppa_opt('slideshow_linktype') == 'fullpopup' ? 'true' : 'false') . '; wppaComAltSize = ' . wppa_opt('comten_alt_thumbsize') . '; wppaBumpViewCount = ' . (wppa_switch('track_viewcounts') ? 'true' : 'false') . '; wppaBumpClickCount = ' . (wppa_switch('track_clickcounts') ? 'true' : 'false') . '; wppaShareHideWhenRunning = ' . (wppa_switch('share_hide_when_running') ? 'true' : 'false') . '; wppaFotomoto = ' . (wppa_switch('fotomoto_on') ? 'true' : 'false') . '; wppaArtMonkeyButton = ' . (wppa_opt('art_monkey_display') == 'button' ? 'true' : 'false') . '; wppaFotomotoHideWhenRunning = ' . (wppa_switch('fotomoto_hide_when_running') ? 'true' : 'false') . '; wppaCommentRequiredAfterVote = ' . (wppa_switch('vote_needs_comment') ? 'true' : 'false') . '; wppaFotomotoMinWidth = ' . wppa_opt('fotomoto_min_width') . '; wppaShortQargs = ' . (wppa_switch('use_short_qargs') ? 'true' : 'false') . '; wppaOvlHires = ' . (wppa_switch('lb_hres') ? 'true' : 'false') . '; wppaSlideVideoStart = ' . (wppa_switch('start_slide_video') ? 'true' : 'false') . '; wppaSlideAudioStart = ' . (wppa_switch('start_slide_audio') ? 'true' : 'false') . '; wppaAudioHeight = ' . wppa_get_audio_control_height() . '; wppaRel = "' . (wppa_opt('lightbox_name') == 'wppa' ? 'data-rel' : 'rel') . '"; wppaOvlRadius = ' . wppa_opt('ovl_border_radius') . '; wppaOvlBorderWidth = ' . wppa_opt('ovl_border_width') . '; wppaEditPhotoWidth = "' . (wppa_opt('upload_edit') == 'new' ? 500 : 960) . '"; wppaThemeStyles = "' . (wppa_switch('upload_edit_theme_css') ? get_stylesheet_uri() : '') . '"; wppaStickyHeaderHeight = ' . wppa_opt('sticky_header_size') . '; wppaRenderModal = ' . (wppa_switch('ajax_render_modal') ? 'true' : 'false') . '; wppaModalQuitImg = "url(' . wppa_get_imgdir('smallcross-' . wppa_opt('ovl_theme') . '.gif') . ')"; wppaBoxRadius = "' . wppa_opt('bradius') . '"; wppaModalBgColor = "' . wppa_opt('bgcolor_modal') . '"; wppaUploadEdit = "' . wppa_opt('upload_edit') . '"; wppaSvgFillcolor = "' . wppa_opt('svg_color') . '"; wppaSvgBgcolor = "' . wppa_opt('svg_bg_color') . '"; wppaOvlSvgFillcolor = "' . wppa_opt('ovl_svg_color') . '"; wppaOvlSvgBgcolor = "' . wppa_opt('ovl_svg_bg_color') . '"; wppaSvgCornerStyle = "' . wppa_opt('icon_corner_style') . '"; '; // Open file $file = @fopen(WPPA_PATH . '/wppa-init.' . $wppa_lang . '.js', 'wb'); if ($file) { // Write file fwrite($file, $content); // Close file fclose($file); $wppa_init_js_data = ''; } else { $wppa_init_js_data = '<script type="text/javascript"> /* Warning: file wppa-init.' . $wppa_lang . '.js could not be created */ /* The content is therefor output here */ ' . $content . ' </script> '; } }
function wppa_admin_spinner() { $result = '<img' . ' id="wppa-admin-spinner"' . ' src="' . wppa_get_imgdir('loader.gif') . '"' . ' style="' . 'position:fixed;' . 'left:50%;' . 'top:50%;' . 'margin-left:-33px;' . 'margin-top:-33px;' . 'z-index:9999999;' . '"' . ' />' . '<script type="text/javascript" >' . 'jQuery( document ).ready( function() { ' . 'setTimeout( "wppaTestAdminReady()", 200 ); ' . '} );' . 'function wppaTestAdminReady() { ' . ' if ( document.readyState === "complete" ) {' . 'jQuery( "#wppa-admin-spinner" ).fadeOut(); ' . ' } else { ' . ' setTimeout( "wppaTestAdminReady()", 200 ); ' . '}' . '}' . '</script>'; echo $result; }
function wppa_sphoto() { $id = wppa('single_photo'); $width = wppa_get_container_width(); $height = floor($width / wppa_get_ratio($id)); $usethumb = wppa_use_thumb_file($id, $width, $height); $src = $usethumb ? wppa_get_thumb_url($id, '', $width, $height) : wppa_get_photo_url($id, '', $width, $height); if (wppa_has_audio($id)) { $src = wppa_fix_poster_ext($src, $id); } if (!wppa_in_widget()) { wppa_bump_viewcount('photo', $id); } $autocol = wppa('auto_colwidth') || $width > 0 && $width <= 1.0; // The initial width is $width if not autocol, else it should default to initial column width when auto // or initial column width * fraction if ($autocol) { if ($width == 'auto') { $contwidth = wppa_opt('initial_colwidth'); } else { $contwidth = wppa_opt('initial_colwidth') * $width; } } else { $contwidth = $width; } // Open the pseudo container wppa_out('<div' . ' id="wppa-container-' . wppa('mocc') . '"' . ' class="' . (wppa('align') ? 'align' . wppa('align') : '') . ' wppa-sphoto-' . wppa('mocc') . '"' . ' style="width:' . $contwidth . 'px;position:relative;"' . ' >'); // The script for responsive wppa_add_js_page_data("\n" . '<script type="text/javascript">'); if ($autocol) { wppa_add_js_page_data("\n" . 'wppaAutoColumnWidth[' . wppa('mocc') . '] = true;'); if ($width > 0 && $width <= 1.0) { wppa_add_js_page_data("\n" . 'wppaAutoColumnFrac[' . wppa('mocc') . '] = ' . $width . ';'); } else { wppa_add_js_page_data("\n" . 'wppaAutoColumnFrac[' . wppa('mocc') . '] = 1.0;'); } wppa_add_js_page_data("\n" . 'wppaColWidth[' . wppa('mocc') . '] = 0;'); } wppa_add_js_page_data("\n" . 'wppaTopMoc = ' . wppa('mocc') . ';'); wppa_add_js_page_data("\n" . '</script>'); wppa('portrait_only', true); $fis = wppa_get_fullimgstyle_a($id); $width = $fis['width']; $height = $fis['height']; $style = $fis['style']; $style .= 'box-sizing:content-box;vertical-align:middle;'; // The link $link = wppa_get_imglnk_a('sphoto', $id); if ($link) { if ($link['is_lightbox']) { $lbtitle = wppa_get_lbtitle('sphoto', $id); $videobody = esc_attr(wppa_get_video_body($id)); $audiobody = esc_attr(wppa_get_audio_body($id)); $videox = wppa_get_videox($id); $videoy = wppa_get_videoy($id); wppa_out('<a' . ' href="' . $link['url'] . '"' . ($lbtitle ? ' ' . wppa('lbtitle') . '="' . $lbtitle . '"' : '') . ($videobody ? ' data-videohtml="' . $videobody . '"' : '') . ($audiobody ? ' data-audiohtml="' . $audiobody . '"' : '') . ($videox ? ' data-videonatwidth="' . $videox . '"' : '') . ($videoy ? ' data-videonatheight="' . $videoy . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '"' . ($link['target'] ? ' target="' . $link['target'] . '"' : '') . ' class="thumb-img"' . ' id="a-' . $id . '-' . wppa('mocc') . '"' . ' >'); } else { wppa_out('<a' . ' href="' . $link['url'] . '"' . ' title="' . $link['title'] . '"' . ' target="' . $link['target'] . '"' . ' class="thumb-img"' . ' id="a-' . $id . '-' . wppa('mocc') . '"' . ' >'); } } // The image $title = $link ? esc_attr($link['title']) : esc_attr(stripslashes(wppa_get_photo_name($id))); if ($link['is_lightbox']) { $style .= ' cursor:url( ' . wppa_get_imgdir() . wppa_opt('magnifier') . ' ),pointer;'; $title = wppa_zoom_in($id); } if (wppa_is_video($id)) { if ($autocol) { wppa_out(wppa_get_video_html(array('id' => $id, 'controls' => !$link['is_lightbox'], 'style' => $style, 'class' => 'size-medium wppa-sphoto wppa-simg-' . wppa('mocc')))); } else { wppa_out(wppa_get_video_html(array('id' => $id, 'width' => $width, 'height' => $height, 'controls' => !$link['is_lightbox'], 'style' => $style, 'class' => 'size-medium wppa-sphoto wppa-simg-' . wppa('mocc')))); } } else { wppa_out('<img' . ' src="' . $src . '"' . ' ' . wppa_get_imgalt($id) . ' class="size-medium wppa-sphoto wppa-simg-' . wppa('mocc') . '"' . ' ' . wppa_get_imgalt($id) . ($title ? ' title="' . $title . '" ' : '') . ' style="' . $style . '"' . ($autocol ? '' : ' width="' . $width . '" height="' . $height . '" ') . '/ >'); } // Close the link if ($link) { wppa_out('</a>'); } // Add audio? sphoto if (wppa_has_audio($id)) { wppa_out('<div style="position:relative;z-index:11;" >'); $margl = wppa_opt('fullimage_border_width') === '' ? 0 : wppa_opt('fullimage_border_width') + 1; $margb = $margl; wppa_out(wppa_get_audio_html(array('id' => $id, 'cursor' => 'cursor:pointer;', 'style' => $style . 'position:absolute;' . 'left:' . $margl . 'px;' . 'bottom:' . $margb . 'px;' . 'padding:0;' . 'margin:0;' . 'border:none;' . 'height:' . wppa_get_audio_control_height() . 'px;' . 'border-radius:0;', 'class' => 'size-medium wppa-sphoto wppa-simg-' . wppa('mocc')))); wppa_out('</div>'); } // The pseudo container wppa_out('</div>'); }
function wppa_get_picture_html($args) { // Init $defaults = array('id' => '0', 'type' => '', 'class' => ''); $args = wp_parse_args($args, $defaults); $id = strval(intval($args['id'])); $type = $args['type']; $class = $args['class']; // Check existance of required args foreach (array('id', 'type') as $item) { if (!$args[$item]) { wppa_dbg_msg('Missing ' . $item . ' in call to wppa_get_picture_html()', 'red', 'force'); return false; } } // Check validity of args if (!wppa_photo_exists($id)) { wppa_dbg_msg('Photo ' . $id . ' does not exist in call to wppa_get_picture_html(). Type = ' . $type, 'red', 'force'); return false; } $types = array('sphoto', 'mphoto', 'xphoto', 'cover', 'thumb', 'ttthumb', 'comthumb', 'fthumb', 'twthumb', 'ltthumb', 'albthumb'); if (!in_array($type, $types)) { wppa_dbg_msg('Unimplemented type ' . $type . ' in call to wppa_get_picture_html()', 'red', 'force'); return false; } // Get other data $link = wppa_get_imglnk_a($type, $id); $isthumb = strpos($type, 'thumb') !== false; $file = wppa_fix_poster_ext($isthumb ? wppa_get_thumb_path($id) : wppa_get_photo_path($id), $id); $href = wppa_fix_poster_ext($isthumb ? wppa_get_thumb_url($id) : wppa_get_photo_url($id), $id); $autocol = wppa('auto_colwidth') || wppa('fullsize') > 0 && wppa('fullsize') <= 1.0; $title = $link ? esc_attr($link['title']) : esc_attr(stripslashes(wppa_get_photo_name($id))); $alt = wppa_get_imgalt($id); // Find image style switch ($type) { case 'sphoto': $style = 'width:100%;margin:0;'; if (!wppa_in_widget()) { switch (wppa_opt('fullimage_border_width')) { case '': $style .= 'padding:0;' . 'border:none;'; break; case '0': $style .= 'padding:0;' . 'border:1px solid ' . wppa_opt('bcolor_fullimg') . ';' . 'box-sizing:border-box;'; break; default: $style .= 'padding:' . (wppa_opt('fullimage_border_width') - '1') . 'px;' . 'border:1px solid ' . wppa_opt('bcolor_fullimg') . ';' . 'box-sizing:border-box;' . 'background-color:' . wppa_opt('bgcolor_fullimg') . ';'; // If we do round corners... if (wppa_opt('bradius') > '0') { // then also here $style .= 'border-radius:' . wppa_opt('fullimage_border_width') . 'px;'; } } } break; case 'mphoto': case 'xphoto': $style = 'width:100%;margin:0;padding:0;border:none;'; break; default: wppa_dbg_msg('Style for type ' . $type . ' is not implemented yet in wppa_get_picture_html()', 'red', 'force'); return false; } if ($link['is_lightbox']) { $style .= 'cursor:url( ' . wppa_get_imgdir() . wppa_opt('magnifier') . ' ),pointer;'; $title = wppa_zoom_in($id); } // Create the html $result = ''; // The link if ($link) { // Link is lightbox if ($link['is_lightbox']) { $lbtitle = wppa_get_lbtitle($type, $id); $videobody = esc_attr(wppa_get_video_body($id)); $audiobody = esc_attr(wppa_get_audio_body($id)); $videox = wppa_get_videox($id); $videoy = wppa_get_videoy($id); $result .= '<a' . ' href="' . $link['url'] . '"' . ($lbtitle ? ' ' . wppa('lbtitle') . '="' . $lbtitle . '"' : '') . ($videobody ? ' data-videohtml="' . $videobody . '"' : '') . ($audiobody ? ' data-audiohtml="' . $audiobody . '"' : '') . ($videox ? ' data-videonatwidth="' . $videox . '"' : '') . ($videoy ? ' data-videonatheight="' . $videoy . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '"' . ($link['target'] ? ' target="' . $link['target'] . '"' : '') . ' class="thumb-img"' . ' id="a-' . $id . '-' . wppa('mocc') . '"' . ' data-alt="' . esc_attr(wppa_get_imgalt($id, true)) . '"' . ' >'; } else { $result .= '<a' . (wppa_is_mobile() ? ' ontouchstart="wppaStartTime();" ontouchend="wppaTapLink(\'' . $id . '\',\'' . $link['url'] . '\');" ' : ' onclick="_bumpClickCount( \'' . $id . '\' );window.open(\'' . $link['url'] . '\', \'' . $link['target'] . '\' )"') . ' title="' . $link['title'] . '"' . ' class="thumb-img"' . ' id="a-' . $id . '-' . wppa('mocc') . '"' . ' >'; } } // The image // Video? if (wppa_is_video($id)) { $result .= wppa_get_video_html(array('id' => $id, 'controls' => !$link, 'style' => $style, 'class' => $class)); } else { $result .= '<img' . ' id="ph-' . $id . '-' . wppa('mocc') . '"' . ' src="' . $href . '"' . ' ' . wppa_get_imgalt($id) . ($class ? ' class="' . $class . '" ' : '') . ($title ? ' title="' . $title . '" ' : '') . ' style="' . $style . '"' . ' />'; } // Close the link if ($link) { $result .= '</a>'; } // Add audio? sphoto if (wppa_has_audio($id)) { $result .= '<div style="position:relative;z-index:11;" >'; // Find style for audio controls switch ($type) { case 'sphoto': $pad = wppa_opt('fullimage_border_width') === '' ? 0 : wppa_opt('fullimage_border_width') + 1; $bot = wppa_opt('fullimage_border_width') === '' ? 0 : wppa_opt('fullimage_border_width') - 1; $style = 'margin:0;' . 'padding:0 ' . $pad . 'px;' . 'bottom:' . $bot . 'px;'; $class = 'size-medium wppa-sphoto wppa-sphoto-' . wppa('mocc'); break; case 'mphoto': case 'xphoto': $style = 'margin:0;' . 'padding:0;' . 'bottom:0;'; $class = 'size-medium wppa-' . $type . ' wppa-' . $type . '-' . wppa('mocc'); break; default: $style = 'margin:0;' . 'padding:0;'; $class = ''; } // Get the html for audio $result .= wppa_get_audio_html(array('id' => $id, 'cursor' => 'cursor:pointer;', 'style' => $style . 'position:absolute;' . 'box-sizing:border-box;' . 'width:100%;' . 'border:none;' . 'height:' . wppa_get_audio_control_height() . 'px;' . 'border-radius:0;', 'class' => $class)); $result .= '</div>'; } // Update statistics if (!wppa_in_widget()) { wppa_bump_viewcount('photo', $id); } // Done ! return $result; }
/** @see WP_Widget::widget */ function widget($args, $instance) { global $wpdb; wppa('in_widget', 'potd'); 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); $widget_title = apply_filters('widget_title', $instance['title']); // get the photo ($image) $image = wppa_get_potd(); // Make the HTML for current picture $widget_content = "\n" . '<!-- WPPA+ Photo of the day Widget start -->'; $ali = wppa_opt('potd_align'); if ($ali != 'none') { $align = 'text-align:' . $ali . ';'; } else { $align = ''; } $widget_content .= "\n" . '<div class="wppa-widget-photo" style="' . $align . ' padding-top:2px;position:relative;" >'; if ($image) { $id = $image['id']; $w = wppa_opt('potd_widget_width'); $ratio = wppa_get_photoy($id) / wppa_get_photox($id); $h = round($w * $ratio); $usethumb = wppa_use_thumb_file($id, wppa_opt('potd_widget_width'), '0'); $imgurl = wppa_fix_poster_ext($usethumb ? wppa_get_thumb_url($id, '', $w, $h) : wppa_get_photo_url($id, '', $w, $h), $id); $name = wppa_get_photo_name($id); $page = in_array(wppa_opt('potd_linktype'), wppa('links_no_page')) && !wppa_switch('potd_counter') ? '' : wppa_get_the_landing_page('potd_linkpage', __('Photo of the day', 'wp-photo-album-plus')); $link = wppa_get_imglnk_a('potdwidget', $id); $is_video = wppa_is_video($id); $has_audio = wppa_has_audio($id); if ($link['is_lightbox']) { $lightbox = ($is_video ? ' data-videohtml="' . esc_attr(wppa_get_video_body($id)) . '"' . ' data-videonatwidth="' . wppa_get_videox($id) . '"' . ' data-videonatheight="' . wppa_get_videoy($id) . '"' : '') . ($has_audio ? ' data-audiohtml="' . esc_attr(wppa_get_audio_body($id)) . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '"' . ' data-alt="' . esc_attr(wppa_get_imgalt($id, true)) . '"'; } else { $lightbox = ''; } if ($link) { if ($link['is_lightbox']) { $cursor = ' cursor:url(' . wppa_get_imgdir() . wppa_opt('magnifier') . '),pointer;'; $title = wppa_zoom_in($id); $ltitle = wppa_get_lbtitle('potd', $id); } else { $cursor = ' cursor:pointer;'; $title = $link['title']; $ltitle = $title; } } else { $cursor = ' cursor:default;'; $title = esc_attr(stripslashes(__($image['name'], 'wp-photo-album-plus'))); } // The medal if on top $widget_content .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'top')); // The link, if any if ($link) { $widget_content .= "\n\t" . '<a href = "' . $link['url'] . '" target="' . $link['target'] . '" ' . $lightbox . ' ' . wppa('lbtitle') . '="' . $ltitle . '">'; } // The image if (wppa_is_video($id)) { $widget_content .= "\n\t\t" . wppa_get_video_html(array('id' => $id, 'width' => wppa_opt('potd_widget_width'), 'title' => $title, 'controls' => wppa_opt('potd_linktype') == 'none', 'cursor' => $cursor)); } else { $widget_content .= '<img' . ' src="' . $imgurl . '"' . ' style="width: ' . wppa_opt('potd_widget_width') . 'px;' . $cursor . '"' . ' ' . wppa_get_imgalt($id) . ($title ? 'title="' . $title . '"' : '') . ' />'; } // Close the link if ($link) { $widget_content .= '</a>'; } // The medal if at the bottom $widget_content .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'bot')); // The counter if (wppa_switch('potd_counter')) { // If we want this $alb = wppa_get_photo_item($id, 'album'); $c = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `album` = " . $alb) - 1; if ($c > 0) { if (wppa_opt('potd_counter_link') == 'thumbs') { $lnk = wppa_get_album_url($alb, $page, 'thumbs', '1'); } elseif (wppa_opt('potd_counter_link') == 'slide') { $lnk = wppa_get_slideshow_url($alb, $page, $id, '1'); } elseif (wppa_opt('potd_counter_link') == 'single') { $lnk = wppa_encrypt_url(get_permalink($page) . '?occur=1&photo=' . $id); // wppa_get_image_page_url_by_id( $id, true, false, $page ); } else { wppa_log('Err', 'Unimplemented counter link type in wppa-potd-widget: ' . wppa_opt('potd_counter_link')); } $widget_content .= '<a href="' . $lnk . '" >' . '<div style="font-size:12px;position:absolute;right:4px;bottom:4px;" >+' . $c . '</div>' . '</a>'; } } // Audio if (wppa_has_audio($id)) { $widget_content .= wppa_get_audio_html(array('id' => $id, 'width' => wppa_opt('potd_widget_width'), 'controls' => true)); } } else { // No image $widget_content .= __('Photo not found', 'wp-photo-album-plus'); } $widget_content .= "\n" . '</div>'; // Add subtitle, if any if ($image) { switch (wppa_opt('potd_subtitle')) { case 'none': break; case 'name': $widget_content .= '<div class="wppa-widget-text wppa-potd-text" style="' . $align . '">' . wppa_get_photo_name($id) . '</div>'; break; case 'desc': $widget_content .= "\n" . '<div class="wppa-widget-text wppa-potd-text" style="' . $align . '">' . wppa_get_photo_desc($id) . '</div>'; break; case 'owner': $owner = $image['owner']; $user = get_user_by('login', $owner); $owner = $user->display_name; $widget_content .= "\n" . '<div class="wppa-widget-text wppa-potd-text" style="' . $align . '">' . __('By:', 'wp-photo-album-plus') . ' ' . $owner . '</div>'; break; default: wppa_log('Err', 'Unimplemented potd_subtitle found in wppa-potd-widget: ' . wppa_opt('potd_subtitle')); } } $widget_content .= '<div style="clear:both;" ></div>'; $widget_content .= "\n" . '<!-- WPPA+ Photo of the day 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); }
function wppa_album_photos($album = '', $photo = '', $owner = '', $moderate = false) { global $wpdb; // Check input wppa_vfy_arg('wppa-page'); $pagesize = wppa_opt('photo_admin_pagesize'); $page = isset($_GET['wppa-page']) ? $_GET['wppa-page'] : '1'; $skip = ($page - '1') * $pagesize; $limit = $pagesize < '1' ? '' : ' LIMIT ' . $skip . ',' . $pagesize; if ($album) { if ($album == 'search') { $count = wppa_get_edit_search_photos('', 'count_only'); $photos = wppa_get_edit_search_photos($limit); $link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=edit&edit_id=' . $album . '&wppa-searchstring=' . wppa_sanitize_searchstring($_REQUEST['wppa-searchstring'])); } else { $counts = wppa_treecount_a($album); $count = $counts['selfphotos'] + $counts['pendphotos']; $photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `album` = %s ' . wppa_get_photo_order($album, 'norandom') . $limit, $album), ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=edit&edit_id=' . $album); } } elseif ($photo && !$moderate) { $count = '1'; $photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `id` = %s', $photo), ARRAY_A); $link = ''; } elseif ($owner) { $count = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM `' . WPPA_PHOTOS . '` WHERE `owner` = %s', $owner)); $photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `owner` = %s ORDER BY `timestamp` DESC' . $limit, $owner), ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_edit_photo'); } elseif ($moderate) { if (!current_user_can('wppa_moderate')) { wp_die(__('You do not have the rights to do this', 'wp-photo-album-plus')); } if ($photo) { $count = '1'; $photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `id` = %s', $photo), ARRAY_A); $link = ''; } else { // Photos with pending comments? $cmt = $wpdb->get_results("SELECT `photo` FROM `" . WPPA_COMMENTS . "` WHERE `status` = 'pending'", ARRAY_A); if ($cmt) { $orphotois = ''; foreach ($cmt as $c) { $orphotois .= "OR `id` = " . $c['photo'] . " "; } } else { $orphotois = ''; } $count = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM `' . WPPA_PHOTOS . '` WHERE `status` = %s ' . $orphotois, 'pending')); $photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `status` = %s ' . $orphotois . ' ORDER BY `timestamp` DESC' . $limit, 'pending'), ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_moderate_photos'); } if (empty($photos)) { if ($photo) { echo '<p>' . __('This photo is no longer awaiting moderation.', 'wp-photo-album-plus') . '</p>'; } else { echo '<p>' . __('There are no photos awaiting moderation at this time.', 'wp-photo-album-plus') . '</p>'; } if (current_user_can('administrator')) { echo '<h3>' . __('Manage all photos by timestamp', 'wp-photo-album-plus') . '</h3>'; $count = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "`"); $photos = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` ORDER BY `timestamp` DESC" . $limit, ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_moderate_photos'); } else { return; } } } else { wppa_dbg_msg('Missing required argument in wppa_album_photos() 1', 'red', 'force'); } if ($link && isset($_REQUEST['quick'])) { $link .= '&quick'; } wppa_show_search_statistics(); if (empty($photos)) { if ($photo) { echo '<div id="photoitem-' . $photo . '" class="photoitem" style="width: 99%; background-color: rgb( 255, 255, 224 ); border-color: rgb( 230, 219, 85 );"> <span style="color:red">' . sprintf(__('Photo %s has been removed.', 'wp-photo-album-plus'), $photo) . '</span> </div>'; } else { if (isset($_REQUEST['wppa-searchstring'])) { echo '<h3>' . __('No photos matching your search criteria.', 'wp-photo-album-plus') . '</h3>'; } else { echo '<h3>' . __('No photos yet in this album.', 'wp-photo-album-plus') . '</h3>'; } } } else { $wms = array('toplft' => __('top - left', 'wp-photo-album-plus'), 'topcen' => __('top - center', 'wp-photo-album-plus'), 'toprht' => __('top - right', 'wp-photo-album-plus'), 'cenlft' => __('center - left', 'wp-photo-album-plus'), 'cencen' => __('center - center', 'wp-photo-album-plus'), 'cenrht' => __('center - right', 'wp-photo-album-plus'), 'botlft' => __('bottom - left', 'wp-photo-album-plus'), 'botcen' => __('bottom - center', 'wp-photo-album-plus'), 'botrht' => __('bottom - right', 'wp-photo-album-plus')); $temp = wppa_get_water_file_and_pos('0'); $wmfile = isset($temp['select']) ? $temp['select'] : ''; $wmpos = isset($temp['pos']) && isset($wms[$temp['pos']]) ? $wms[$temp['pos']] : ''; wppa_admin_page_links($page, $pagesize, $count, $link); foreach ($photos as $photo) { $is_multi = wppa_is_multi($photo['id']); $is_video = wppa_is_video($photo['id']); $has_audio = wppa_has_audio($photo['id']); ?> <a id="photo_<?php echo $photo['id']; ?> " name="photo_<?php echo $photo['id']; ?> "></a> <div class="widefat wppa-table-wrap" id="photoitem-<?php echo $photo['id']; ?> " style="width:99%; position: relative;" > <!-- Left half starts here --> <div style="width:49.5%; float:left; border-right:1px solid #ccc; margin-right:0;"> <input type="hidden" id="photo-nonce-<?php echo $photo['id']; ?> " value="<?php echo wp_create_nonce('wppa_nonce_' . $photo['id']); ?> " /> <table class="wppa-table wppa-photo-table" style="width:98%" > <tbody> <!-- Preview --> <tr> <th> <label ><?php echo 'ID = ' . $photo['id'] . '. ' . __('Preview:', 'wp-photo-album-plus'); ?> </label> <br /> <?php echo sprintf(__('Album: %d<br />(%s)', 'wp-photo-album-plus'), $photo['album'], wppa_get_album_name($photo['album'])); ?> <br /><br /> <?php if (!$is_video) { ?> <?php _e('Rotate', 'wp-photo-album-plus'); ?> <a onclick="if ( confirm( '<?php _e('Are you sure you want to rotate this photo left?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'rotleft', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); " ><?php _e('left', 'wp-photo-album-plus'); ?> </a> <a onclick="if ( confirm( '<?php _e('Are you sure you want to rotate this photo 180°?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'rot180', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); " ><?php _e('180°', 'wp-photo-album-plus'); ?> </a> <a onclick="if ( confirm( '<?php _e('Are you sure you want to rotate this photo right?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'rotright', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); " ><?php _e('right', 'wp-photo-album-plus'); ?> </a> <br /> <span style="font-size: 9px; line-height: 10px; color:#666;"> <?php if (wppa('front_edit')) { _e('If it says \'Photo rotated\', the photo is rotated.', 'wp-photo-album-plus'); } else { $refresh = '<a onclick="wppaReload()" >' . __('Refresh', 'wp-photo-album-plus') . '</a>'; echo sprintf(__('If it says \'Photo rotated\', the photo is rotated. %s the page.', 'wp-photo-album-plus'), $refresh); } ?> </span> <?php } ?> </th> <td> <?php $src = wppa_get_thumb_url($photo['id']); $big = wppa_get_photo_url($photo['id']); if ($is_video) { reset($is_video); $big = str_replace('xxx', current($is_video), $big); ?> <a href="<?php echo $big; ?> " target="_blank" title="<?php _e('Preview fullsize video', 'wp-photo-album-plus'); ?> " > <?php echo wppa_get_video_html(array('id' => $photo['id'], 'width' => '160', 'height' => '160' * wppa_get_videoy($photo['id']) / wppa_get_videox($photo['id']), 'controls' => false, 'use_thumb' => true)); ?> </a><?php } else { if ($has_audio) { $big = wppa_fix_poster_ext($big, $photo['id']); $src = wppa_fix_poster_ext($src, $photo['id']); } ?> <a href="<?php echo $big; ?> " target="_blank" title="<?php _e('Preview fullsize photo', 'wp-photo-album-plus'); ?> " > <img src="<?php echo $src; ?> " alt="<?php echo $photo['name']; ?> " style="max-width: 160px; vertical-align:middle;" /> </a><?php if ($has_audio) { $audio = wppa_get_audio_html(array('id' => $photo['id'], 'width' => '160', 'controls' => true)); ?> <br /> <?php if ($audio) { echo $audio; } else { echo '<span style="color:red;">' . __('Audio disabled', 'wp-photo-album-plus') . '</span>'; } } } ?> </td> </tr> <!-- Upload --> <tr> <th > <label><?php _e('Upload:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $timestamp = $photo['timestamp']; if ($timestamp) { echo wppa_local_date(get_option('date_format', "F j, Y,") . ' ' . get_option('time_format', "g:i a"), $timestamp) . ' ' . __('local time', 'wp-photo-album-plus') . ' '; } if ($photo['owner']) { if (wppa_switch('photo_owner_change') && wppa_user_is('administrator')) { echo '</td></tr><tr><th><label>' . __('Owned by:', 'wp-photo-album-plus') . '</label></th><td>'; echo '<input type="text" onkeyup="wppaAjaxUpdatePhoto( \'' . $photo['id'] . '\', \'owner\', this )" onchange="wppaAjaxUpdatePhoto( \'' . $photo['id'] . '\', \'owner\', this )" value="' . $photo['owner'] . '" />'; } else { echo __('By:', 'wp-photo-album-plus') . ' ' . $photo['owner']; } } ?> </td> </tr> <!-- Modified --> <tr> <th> <label><?php _e('Modified:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $modified = $photo['modified']; if ($modified > $timestamp) { echo wppa_local_date(get_option('date_format', "F j, Y,") . ' ' . get_option('time_format', "g:i a"), $modified) . ' ' . __('local time', 'wp-photo-album-plus'); } else { _e('Not modified', 'wp-photo-album-plus'); } ?> </td> </tr> <!-- EXIF Date --> <tr> <th> <label><?php _e('EXIF Date', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php if (wppa_user_is('administrator')) { echo '<input type="text" onkeyup="wppaAjaxUpdatePhoto( \'' . $photo['id'] . '\', \'exifdtm\', this )" onchange="wppaAjaxUpdatePhoto( \'' . $photo['id'] . '\', \'exifdtm\', this )" value="' . $photo['exifdtm'] . '" />'; } else { echo $photo['exifdtm']; } ?> </td> </tr> <!-- Rating --> <tr > <th > <label><?php _e('Rating:', 'wp-photo-album-plus'); ?> </label> </th> <td class="wppa-rating" > <?php $entries = wppa_get_rating_count_by_id($photo['id']); if ($entries) { echo __('Entries:', 'wp-photo-album-plus') . ' ' . $entries . '. ' . __('Mean value:', 'wp-photo-album-plus') . ' ' . wppa_get_rating_by_id($photo['id'], 'nolabel') . '.'; } else { _e('No ratings for this photo.', 'wp-photo-album-plus'); } $dislikes = wppa_dislike_get($photo['id']); if ($dislikes) { echo ' <span style="color:red" >' . sprintf(__('Disliked by %d visitors', 'wp-photo-album-plus'), $dislikes) . '</span>'; } $pending = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_RATING . "` WHERE `photo` = %s AND `status` = 'pending'", $photo['id'])); if ($pending) { echo ' <span style="color:orange" >' . sprintf(__('%d pending votes.', 'wp-photo-album-plus'), $pending) . '</span>'; } ?> </td> </tr> <!-- Views --> <tr > <th > <label><?php _e('Views', 'wp-photo-album-plus'); ?> </label> </th> <td > <?php echo $photo['views']; ?> </td> </tr> <!-- P_order --> <?php if (!wppa_switch('porder_restricted') || current_user_can('administrator')) { ?> <tr > <th > <label><?php _e('Photo sort order #:', 'wp-photo-album-plus'); ?> </label> </th> <td > <input type="text" id="porder-<?php echo $photo['id']; ?> " value="<?php echo $photo['p_order']; ?> " style="width: 50px" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'p_order', this )" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'p_order', this )" /> </td> </tr> <?php } ?> <?php if (!isset($_REQUEST['quick'])) { ?> <?php if (!isset($album_select[$photo['album']])) { $album_select[$photo['album']] = wppa_album_select_a(array('checkaccess' => true, 'path' => wppa_switch('hier_albsel'), 'exclude' => $photo['album'], 'selected' => '0', 'addpleaseselect' => true)); } ?> <!-- Move --> <tr > <th > <input type="button" style="" onclick="if( document.getElementById( 'moveto-<?php echo $photo['id']; ?> ' ).value != 0 ) { if ( confirm( '<?php _e('Are you sure you want to move this photo?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'moveto', document.getElementById( 'moveto-<?php echo $photo['id']; ?> ' ) ) } else { alert( '<?php _e('Please select an album to move the photo to first.', 'wp-photo-album-plus'); ?> ' ); return false;}" value="<?php echo esc_attr(__('Move photo to', 'wp-photo-album-plus')); ?> " /> </th> <td > <select id="moveto-<?php echo $photo['id']; ?> " style="width:100%;" ><?php echo $album_select[$photo['album']]; ?> </select> </td> </tr> <!-- Copy --> <tr > <th > <input type="button" style="" onclick="if ( document.getElementById( 'copyto-<?php echo $photo['id']; ?> ' ).value != 0 ) { if ( confirm( '<?php _e('Are you sure you want to copy this photo?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'copyto', document.getElementById( 'copyto-<?php echo $photo['id']; ?> ' ) ) } else { alert( '<?php _e('Please select an album to copy the photo to first.', 'wp-photo-album-plus'); ?> ' ); return false;}" value="<?php echo esc_attr(__('Copy photo to', 'wp-photo-album-plus')); ?> " /> </th> <td > <select id="copyto-<?php echo $photo['id']; ?> " style="width:100%;" ><?php echo $album_select[$photo['album']]; ?> </select> </td> </tr> <?php } ?> <!-- Delete --> <?php if (!wppa('front_edit')) { ?> <tr > <th style="padding-top:0; padding-bottom:4px;"> <input type="button" style="color:red;" onclick="if ( confirm( '<?php _e('Are you sure you want to delete this photo?', 'wp-photo-album-plus'); ?> ' ) ) wppaAjaxDeletePhoto( <?php echo $photo['id']; ?> )" value="<?php echo esc_attr(__('Delete photo', 'wp-photo-album-plus')); ?> " /> </th> </tr> <?php } ?> <!-- Auto Page --> <?php if (wppa_switch('auto_page') && (current_user_can('edit_posts') || current_user_can('edit_pages'))) { ?> <tr style=="vertical-align:bottom;" > <th style="padding-top:0; padding-bottom:4px;"> <label> <?php _e('Autopage Permalink:', 'wp-photo-album-plus'); ?> </label> </th> <td > <?php echo get_permalink(wppa_get_the_auto_page($photo['id'])); ?> </td> </tr> <?php } ?> <!-- Link url --> <?php if (!wppa_switch('link_is_restricted') || current_user_can('administrator')) { ?> <tr > <th > <label><?php _e('Link url:', 'wp-photo-album-plus'); ?> </label> </th> <td > <input type="text" style="width:60%;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'linkurl', this )" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'linkurl', this )" value="<?php echo stripslashes($photo['linkurl']); ?> " /> <select style="float:right;" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'linktarget', this )" > <option value="_self" <?php if ($photo['linktarget'] == '_self') { echo 'selected="selected"'; } ?> ><?php _e('Same tab', 'wp-photo-album-plus'); ?> </option> <option value="_blank" <?php if ($photo['linktarget'] == '_blank') { echo 'selected="selected"'; } ?> ><?php _e('New tab', 'wp-photo-album-plus'); ?> </option> </select> </td> </tr> <!-- Link title --> <tr > <th > <label><?php _e('Link title:', 'wp-photo-album-plus'); ?> </label> </th> <td > <input type="text" style="width:97%;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'linktitle', this )" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'linktitle', this )" value="<?php echo stripslashes($photo['linktitle']); ?> " /> </td> </tr> <?php if (current_user_can('wppa_settings')) { ?> <tr style="padding-left:10px; font-size:9px; line-height:10px; color:#666;" > <td colspan="2" style="padding-top:0" > <?php _e('If you want this link to be used, check \'PS Overrule\' checkbox in table VI.', 'wp-photo-album-plus'); ?> </td> </tr> <?php } ?> <?php } ?> <!-- Alt custom field --> <?php if (wppa_opt('alt_type') == 'custom') { ?> <tr > <th > <label><?php _e('HTML Alt attribute:', 'wp-photo-album-plus'); ?> </label> </th> <td > <input type="text" style="width:100%;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'alt', this )" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'alt', this )" value="<?php echo stripslashes($photo['alt']); ?> " /> </td> </tr> <?php } ?> </tbody> </table> </div> <!-- Right half starts here --> <div style="width:50%; float:left; border-left:1px solid #ccc; margin-left:-1px;"> <table class="wppa-table wppa-photo-table" > <tbody> <!-- Filename --> <tr> <th> <label><?php _e('Filename:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php echo $photo['filename']; if (wppa_user_is('administrator') || !wppa_switch('reup_is_restricted')) { ?> <input type="button" onclick="jQuery( '#re-up-<?php echo $photo['id']; ?> ' ).css( 'display', '' );" value="<?php _e('Update file', 'wp-photo-album-plus'); ?> " /> <?php } ?> </td> </tr> <?php if (wppa_user_is('administrator') || !wppa_switch('reup_is_restricted')) { ?> <tr id="re-up-<?php echo $photo['id']; ?> " style="display:none" > <th> </th> <td> <form id="wppa-re-up-form-<?php echo $photo['id']; ?> " onsubmit="wppaReUpload( event,<?php echo $photo['id']; ?> , '<?php echo $photo['filename']; ?> ' )" > <input type="file" id="wppa-re-up-file-<?php echo $photo['id']; ?> " /> <input type="submit" id="wppa-re-up-butn-<?php echo $photo['id']; ?> " value="<?php _e('Upload', 'wp-photo-album-plus'); ?> " /> </form> </td> </tr> <?php } ?> <!--- Video sizes --> <?php if ($is_video) { ?> <tr> <th> <label><?php _e('Video size:', 'wp-photo-album-plus'); ?> </th> <td> <table class="wppa-subtable" > <tr> <td> <?php _e('Width:', 'wp-photo-album-plus'); ?> </td> <td> <input style="width:50px;margin:0 4px;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'videox', this ); " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'videox', this ); " value="<?php echo $photo['videox']; ?> " /><?php echo sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_width')); ?> </td> </tr> <tr> <td> <?php _e('Height:', 'wp-photo-album-plus'); ?> </td> <td> <input style="width:50px;margin:0 4px;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'videoy', this ); " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'videoy', this ); " value="<?php echo $photo['videoy']; ?> " /><?php echo sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_height')); ?> </td> </tr> </table> </td> </tr> <tr> <th> <label><?php _e('Formats:', 'wp-photo-album-plus'); ?> </th> <td> <table class="wppa-subtable" > <?php foreach ($is_video as $fmt) { echo '<tr>' . '<td>' . $fmt . '</td>' . '<td>' . __('Filesize:', 'wp-photo-album-plus') . '</td>' . '<td>' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($photo['id']))) . '</td>' . '</tr>'; } ?> </table> </td> </tr> <?php } ?> <!-- Audio --> <?php if ($has_audio) { ?> <tr> <th> <label><?php _e('Formats:', 'wp-photo-album-plus'); ?> </th> <td> <table class="wppa-subtable" > <?php foreach ($has_audio as $fmt) { echo '<tr>' . '<td>' . $fmt . '</td>' . '<td>' . __('Filesize:', 'wp-photo-album-plus') . '</td>' . '<td>' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($photo['id']))) . '</td>' . '</tr>'; } ?> </table> </td> </tr> <?php } ?> <!-- Filesizes --> <tr> <th> <label><?php $is_video || $has_audio ? _e('Poster:', 'wp-photo-album-plus') : _e('Photo sizes:', 'wp-photo-album-plus'); ?> </label> </th> <td> <table class="wppa-subtable" > <tr> <td> <?php _e('Source file:', 'wp-photo-album-plus'); ?> </td> <?php $sp = wppa_get_source_path($photo['id']); if (is_file($sp)) { $ima = getimagesize($sp); ?> <td> <?php echo $ima['0'] . ' x ' . $ima['1'] . ' px.'; ?> </td> <td> <?php echo wppa_get_filesize($sp); ?> </td> <td> <a style="cursor:pointer; font-weight:bold;" title="<?php _e('Remake display file and thumbnail file', 'wp-photo-album-plus'); ?> " onclick="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'remake', this )"><?php _e('Remake files', 'wp-photo-album-plus'); ?> </a> </td> <?php } else { ?> <td> <span style="color:orange;"><?php _e('Unavailable', 'wp-photo-album-plus'); ?> </span> </td> <td> </td> <td> </td> <?php } ?> </tr> <tr> <td> <?php _e('Display file:', 'wp-photo-album-plus'); ?> </td> <?php $dp = wppa_fix_poster_ext(wppa_get_photo_path($photo['id']), $photo['id']); if (is_file($dp)) { ?> <td> <?php echo floor(wppa_get_photox($photo['id'])) . ' x ' . floor(wppa_get_photoy($photo['id'])) . ' px.'; ?> </td> <td> <?php echo wppa_get_filesize($dp); ?> </td> <td> </td> <?php } else { ?> <td> <span style="color:red;"><?php _e('Unavailable', 'wp-photo-album-plus'); ?> </span> </td> <td> </td> <td> </td> <?php } ?> </tr> <tr> <td> <?php _e('Thumbnail file:', 'wp-photo-album-plus'); ?> </td> <?php $tp = wppa_fix_poster_ext(wppa_get_thumb_path($photo['id']), $photo['id']); if (is_file($tp)) { ?> <td> <?php echo floor(wppa_get_thumbx($photo['id'])) . ' x ' . floor(wppa_get_thumby($photo['id'])) . ' px.'; ?> </td> <td> <?php echo wppa_get_filesize($tp); ?> </td> <?php } else { ?> <td> <span style="color:red;"><?php _e('Unavailable', 'wp-photo-album-plus'); ?> </span> </td> <td> </td> <?php } ?> <td> <a style="cursor:pointer; font-weight:bold;" title="<?php _e('Remake thumbnail file', 'wp-photo-album-plus'); ?> " onclick="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'remakethumb', this )"><?php _e('Remake', 'wp-photo-album-plus'); ?> </a> </td> </tr> </table> </td> </tr> <!-- Stereo --> <?php if (wppa_switch('enable_stereo')) { ?> <tr> <th> <label><?php _e('Stereophoto:', 'wp-photo-album-plus'); ?> </label> </th> <td> <select id="stereo-<?php echo $photo['id']; ?> " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'stereo', this )" > <option value="0" <?php if ($photo['stereo'] == '0') { echo 'selected="selected" '; } ?> ><?php _e('no stereo image or ready anaglyph', 'wp-photo-album-plus'); ?> </option> <option value="1" <?php if ($photo['stereo'] == '1') { echo 'selected="selected" '; } ?> ><?php _e('Left - right stereo image', 'wp-photo-album-plus'); ?> </option> <option value="-1" <?php if ($photo['stereo'] == '-1') { echo 'selected="selected" '; } ?> ><?php _e('Right - left stereo image', 'wp-photo-album-plus'); ?> </option> <select> <td> </tr> <tr> <th> <label><?php _e('Images:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $files = glob(WPPA_UPLOAD_PATH . '/stereo/' . $photo['id'] . '-*.*'); if (!empty($files)) { sort($files); $c = 0; echo '<table><tbody>'; foreach ($files as $file) { if (!$c) { echo '<tr>'; } if (is_file($file)) { echo '<td style="padding:0;" ><a href="' . str_replace(WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $file) . '" target="_blank" >' . basename($file) . '</a></td>'; } if (strpos(basename($file), '_flat')) { $c++; } $c = ($c + 1) % 2; if (!$c) { echo '</tr>'; } } if ($c) { echo '<td style="padding:0;" ></td></tr>'; } echo '</tbody></table>'; } ?> </td> </tr> <?php } ?> <!-- Location --> <?php if ($photo['location'] || wppa_switch('geo_edit')) { ?> <tr> <th> <label><?php _e('Location:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $loc = $photo['location'] ? $photo['location'] : '///'; $geo = explode('/', $loc); echo $geo['0'] . ' ' . $geo['1'] . ' '; if (wppa_switch('geo_edit')) { ?> <?php _e('Lat:', 'wp-photo-album-plus'); ?> <input type="text" style="width:100px;" id="lat-<?php echo $photo['id']; ?> " onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'lat', this );" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'lat', this );" value="<?php echo $geo['2']; ?> " /> <?php _e('Lon:', 'wp-photo-album-plus'); ?> <input type="text" style="width:100px;" id="lon-<?php echo $photo['id']; ?> " onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'lon', this );" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'lon', this );" value="<?php echo $geo['3']; ?> " /> <?php if (!wppa('front_edit')) { ?> <span class="description"><br /><?php _e('Refresh the page after changing to see the degrees being updated', 'wp-photo-album-plus'); ?> </span> <?php } ?> <?php } ?> </td> </tr> <?php } ?> <!-- Name --> <tr > <th > <label><?php _e('Photoname:', 'wp-photo-album-plus'); ?> </label> </th> <?php if (wppa_switch('use_wp_editor')) { ?> <td> <input type="text" style="width:100%;" id="pname-<?php echo $photo['id']; ?> " value="<?php echo esc_attr(stripslashes($photo['name'])); ?> " /> <input type="button" class="button-secundary" value="<?php _e('Update Photo name', 'wp-photo-album-plus'); ?> " onclick="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'name', document.getElementById( 'pname-<?php echo $photo['id']; ?> ' ) );" /> </td> <?php } else { ?> <td> <input type="text" style="width:100%;" id="pname-<?php echo $photo['id']; ?> " onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'name', this );" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'name', this );" value="<?php echo esc_attr(stripslashes($photo['name'])); ?> " /> </td> <?php } ?> </tr> <!-- Description --> <?php if (!wppa_switch('desc_is_restricted') || wppa_user_is('administrator')) { ?> <tr> <th> <label><?php _e('Description:', 'wp-photo-album-plus'); ?> </label> </th> <?php if (wppa_switch('use_wp_editor')) { ?> <td> <?php $alfaid = wppa_alfa_id($photo['id']); // $quicktags_settings = array( 'buttons' => 'strong,em,link,block,ins,ul,ol,li,code,close' ); wp_editor(stripslashes($photo['description']), 'wppaphotodesc' . $alfaid, array('wpautop' => true, 'media_buttons' => false, 'textarea_rows' => '6', 'tinymce' => true)); //, 'quicktags' => $quicktags_settings ) ); ?> <input type="button" class="button-secundary" value="<?php _e('Update Photo description', 'wp-photo-album-plus'); ?> " onclick="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'description', document.getElementById( 'wppaphotodesc'+'<?php echo $alfaid; ?> ' ), false, '<?php echo $alfaid; ?> ' )" /> <img id="wppa-photo-spin-<?php echo $photo['id']; ?> " src="<?php echo wppa_get_imgdir() . 'wpspin.gif'; ?> " style="visibility:hidden" /> </td> <?php } else { ?> <td> <textarea style="width: 100%; height:120px;" onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'description', this )" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'description', this )" ><?php echo stripslashes($photo['description']); ?> </textarea> </td> <?php } ?> </tr> <?php } else { ?> <tr> <th> <label><?php _e('Description:', 'wp-photo-album-plus'); ?> </label> </th> <td> <div style="width: 100%; height:120px; overflow:auto;" ><?php echo stripslashes($photo['description']); ?> </div> </td> </tr> <?php } ?> <!-- Custom --> <?php if (wppa_switch('custom_fields')) { $custom = wppa_get_photo_item($photo['id'], 'custom'); if ($custom) { $custom_data = unserialize($custom); } else { $custom_data = array('', '', '', '', '', '', '', '', '', ''); } foreach (array_keys($custom_data) as $key) { if (wppa_opt('custom_caption_' . $key)) { ?> <tr> <th> <label><?php echo wppa_opt('custom_caption_' . $key) . ':<br /><small>(w#cc' . $key . ')</small>'; ?> </label> </th> <td> <?php echo '<small>(w#cd' . $key . ')</small>'; ?> <input type="text" style="width:85%; float:right;" id="pname-<?php echo $photo['id']; ?> " onkeyup="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'custom_<?php echo $key; ?> ', this );" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'custom_<?php echo $key; ?> ', this );" value="<?php echo esc_attr(stripslashes($custom_data[$key])); ?> " /> </td> </tr> <?php } } } ?> <!-- Tags --> <tr style="vertical-align:middle;" > <th > <label ><?php _e('Tags:', 'wp-photo-album-plus'); ?> </label> <span class="description" > <br /> </span> </th> <td > <input id="tags-<?php echo $photo['id']; ?> " type="text" style="width:100%;" onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'tags', this )" value="<?php echo stripslashes(trim($photo['tags'], ',')); ?> " /> <span class="description" > <?php _e('Separate tags with commas.', 'wp-photo-album-plus'); ?> <?php _e('Examples:', 'wp-photo-album-plus'); ?> <select onchange="wppaAddTag( this.value, 'tags-<?php echo $photo['id']; ?> ' ); wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'tags', document.getElementById( 'tags-<?php echo $photo['id']; ?> ' ) )" > <?php $taglist = wppa_get_taglist(); if (is_array($taglist)) { echo '<option value="" >' . __('- select -', 'wp-photo-album-plus') . '</option>'; foreach ($taglist as $tag) { echo '<option value="' . $tag['tag'] . '" >' . $tag['tag'] . '</option>'; } } else { echo '<option value="0" >' . __('No tags yet', 'wp-photo-album-plus') . '</option>'; } ?> </select> <?php _e('Select to add', 'wp-photo-album-plus'); ?> </span> </td> </tr> <!-- Status --> <tr style="vertical-align:middle;" > <th> <label ><?php _e('Status:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php if ((current_user_can('wppa_admin') || current_user_can('wppa_moderate')) && !isset($_REQUEST['quick'])) { ?> <table> <tr> <td> <select id="status-<?php echo $photo['id']; ?> " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'status', this ); wppaPhotoStatusChange( <?php echo $photo['id']; ?> ); "> <option value="pending" <?php if ($photo['status'] == 'pending') { echo 'selected="selected"'; } ?> ><?php _e('Pending', 'wp-photo-album-plus'); ?> </option> <option value="publish" <?php if ($photo['status'] == 'publish') { echo 'selected="selected"'; } ?> ><?php _e('Publish', 'wp-photo-album-plus'); ?> </option> <?php if (wppa_switch('ext_status_restricted') && !wppa_user_is('administrator')) { $dis = ' disabled'; } else { $dis = ''; } ?> <option value="featured" <?php if ($photo['status'] == 'featured') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Featured', 'wp-photo-album-plus'); ?> </option> <option value="gold" <?php if ($photo['status'] == 'gold') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Gold', 'wp-photo-album-plus'); ?> </option> <option value="silver" <?php if ($photo['status'] == 'silver') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Silver', 'wp-photo-album-plus'); ?> </option> <option value="bronze" <?php if ($photo['status'] == 'bronze') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Bronze', 'wp-photo-album-plus'); ?> </option> <option value="scheduled" <?php if ($photo['status'] == 'scheduled') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Scheduled', 'wp-photo-album-plus'); ?> </option> <option value="private" <?php if ($photo['status'] == 'private') { echo 'selected="selected"'; } echo $dis; ?> ><?php _e('Private', 'wp-photo-album-plus'); ?> </option> </select> </td> <td class="wppa-datetime-<?php echo $photo['id']; ?> " > <?php echo wppa_get_date_time_select_html('photo', $photo['id'], true); ?> </td> </tr> </table> <?php } else { ?> <input type="hidden" id="status-<?php echo $photo['id']; ?> " value="<?php echo $photo['status']; ?> " /> <table> <tr> <td> <?php if ($photo['status'] == 'pending') { _e('Pending', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'publish') { _e('Publish', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'featured') { _e('Featured', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'gold') { _e('Gold', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'silver') { _e('Silver', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'bronze') { _e('Bronze', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'scheduled') { _e('Scheduled', 'wp-photo-album-plus'); } elseif ($photo['status'] == 'private') { _e('Private', 'wp-photo-album-plus'); } ?> </td> <td class="wppa-datetime-<?php echo $photo['id']; ?> " > <?php echo wppa_get_date_time_select_html('photo', $photo['id'], false); ?> </td> </tr> </table> <?php } ?> <span id="psdesc-<?php echo $photo['id']; ?> " class="description" style="display:none;" ><?php _e('Note: Featured photos should have a descriptive name; a name a search engine will look for!', 'wp-photo-album-plus'); ?> </span> </td> </tr> <!-- Watermark --> <?php if (!$is_video || is_file(wppa_fix_poster_ext(wppa_get_photo_path($photo['id']), $photo['id']))) { ?> <tr style="vertical-align:middle;" > <th > <label><?php _e('Watermark:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $user = wppa_get_user(); if (wppa_switch('watermark_on')) { if (wppa_switch('watermark_user') || current_user_can('wppa_settings')) { echo __('File:', 'wppa', 'wp-photo-album-plus') . ' '; ?> <select id="wmfsel_<?php echo $photo['id']; ?> " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'wppa_watermark_file_<?php echo $user; ?> ', this );" > <?php echo wppa_watermark_file_select(); ?> </select> <?php echo '<br />' . __('Pos:', 'wp-photo-album-plus') . ' '; ?> <select id="wmpsel_<?php echo $photo['id']; ?> " onchange="wppaAjaxUpdatePhoto( <?php echo $photo['id']; ?> , 'wppa_watermark_pos_<?php echo $user; ?> ', this );" > <?php echo wppa_watermark_pos_select(); ?> </select> <input type="button" class="button-secundary" value="<?php _e('Apply watermark', 'wp-photo-album-plus'); ?> " onclick="if ( confirm( '<?php echo esc_js(__('Are you sure? Once applied it can not be removed!', 'wp-photo-album-plus')) . '\\n\\n' . esc_js(__('And I do not know if there is already a watermark on this photo', 'wp-photo-album-plus')); ?> ' ) ) wppaAjaxApplyWatermark( <?php echo $photo['id']; ?> , document.getElementById( 'wmfsel_<?php echo $photo['id']; ?> ' ).value, document.getElementById( 'wmpsel_<?php echo $photo['id']; ?> ' ).value )" /> <?php } else { echo __('File:', 'wppa', 'wp-photo-album-plus') . ' ' . __($wmfile, 'wp-photo-album-plus'); if ($wmfile != '--- none ---') { echo ' ' . __('Pos:', 'wp-photo-album-plus') . ' ' . $wmpos; } } ?> <img id="wppa-water-spin-<?php echo $photo['id']; ?> " src="<?php echo wppa_get_imgdir() . 'wpspin.gif'; ?> " style="visibility:hidden" /><?php } else { _e('Not configured', 'wp-photo-album-plus'); } ?> </td> </tr> <?php } ?> <!-- Remark --> <tr style="vertical-align: middle;" > <th > <label style="color:#070"><?php _e('Remark:', 'wp-photo-album-plus'); ?> </label> </th> <td id="photostatus-<?php echo $photo['id']; ?> " style="padding-left:10px; width: 400px;"> <?php if (wppa_is_video($photo['id'])) { echo sprintf(__('Video %s is not modified yet', 'wp-photo-album-plus'), $photo['id']); } else { echo sprintf(__('Photo %s is not modified yet', 'wp-photo-album-plus'), $photo['id']); } ?> </td> </tr> </tbody> </table> <script type="text/javascript">wppaPhotoStatusChange( <?php echo $photo['id']; ?> )</script> </div> <div style="clear:both;"></div> <?php if (!isset($_REQUEST['quick'])) { ?> <div class="wppa-links" > <table style="width:100%" > <tbody> <?php if (current_user_can('edit_posts') || current_user_can('edit_pages')) { ?> <tr> <td><?php _e('Single image shortcode', 'wp-photo-album-plus'); ?> :</td> <td><?php echo esc_js('[wppa type="photo" photo="' . $photo['id'] . '" size="' . wppa_opt('fullsize') . '"][/wppa]'); ?> </td> </tr> <?php } ?> <?php if (is_file(wppa_get_source_path($photo['id']))) { ?> <tr> <td><?php _e('Permalink', 'wp-photo-album-plus'); ?> :</td> <td><?php echo wppa_get_source_pl($photo['id']); ?> </td> </tr> <?php } ?> <tr> <td><?php _e('Hi resolution url', 'wp-photo-album-plus'); ?> :</td> <td><?php echo wppa_get_hires_url($photo['id']); ?> </td> </tr> <?php if (is_file(wppa_get_photo_path($photo['id']))) { ?> <tr> <td><?php _e('Display file url', 'wp-photo-album-plus'); ?> :</td> <td><?php echo wppa_get_lores_url($photo['id']); ?> </td> </tr> <?php } ?> <?php if (is_file(wppa_get_thumb_path($photo['id']))) { ?> <tr> <td><?php _e('Thumbnail file url', 'wp-photo-album-plus'); ?> :</td> <td><?php echo wppa_get_tnres_url($photo['id']); ?> </td> </tr> <?php } ?> </tbody> </table> </div> <?php } ?> </div> <!-- Comments --> <?php $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s ORDER BY `timestamp` DESC", $photo['id']), ARRAY_A); if ($comments) { ?> <div class="widefat" style="width:99%; font-size:11px;" > <table class="wppa-table widefat wppa-setting-table" > <thead> <tr style="font-weight:bold;" > <td style="padding:0 4px;" >#</td> <td style="padding:0 4px;" >User</td> <td style="padding:0 4px;" >Time since</td> <td style="padding:0 4px;" >Status</td> <td style="padding:0 4px;" >Comment</td> </tr> </thead> <tbody> <?php foreach ($comments as $comment) { echo ' <tr> <td style="padding:0 4px;" >' . $comment['id'] . '</td> <td style="padding:0 4px;" >' . $comment['user'] . '</td> <td style="padding:0 4px;" >' . wppa_get_time_since($comment['timestamp']) . '</td>'; if (current_user_can('wppa_comments') || current_user_can('wppa_moderate') || wppa_get_user() == $photo['owner'] && wppa_switch('owner_moderate_comment')) { $p = $comment['status'] == 'pending' ? 'selected="selected" ' : ''; $a = $comment['status'] == 'approved' ? 'selected="selected" ' : ''; $s = $comment['status'] == 'spam' ? 'selected="selected" ' : ''; $t = $comment['status'] == 'trash' ? 'selected="selected" ' : ''; echo ' <td style="padding:0 4px;" > <select style="height: 20px; font-size: 11px; padding:0;" onchange="wppaAjaxUpdateCommentStatus( ' . $photo['id'] . ', ' . $comment['id'] . ', this.value )" > <option value="pending" ' . $p . '>' . __('Pending', 'wp-photo-album-plus') . '</option> <option value="approved" ' . $a . '>' . __('Approved', 'wp-photo-album-plus') . '</option> <option value="spam" ' . $s . '>' . __('Spam', 'wp-photo-album-plus') . '</option> <option value="trash" ' . $t . '>' . __('Trash', 'wp-photo-album-plus') . '</option> </select > </td> '; } else { echo '<td style="padding:0 4px;" >'; if ($comment['status'] == 'pending') { _e('Pending', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'approved') { _e('Approved', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'spam') { _e('Spam', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'trash') { _e('Trash', 'wp-photo-album-plus'); } echo '</td>'; } echo '<td style="padding:0 4px;" >' . $comment['comment'] . '</td> </tr> '; } ?> </tbody> </table> </div> <?php } ?> <!-- </div> --> <div style="clear:both;margin-top:7px;"></div> <?php } /* foreach photo */ wppa_admin_page_links($page, $pagesize, $count, $link); } /* photos not empty */ }
function wppa_do_albumlist($parent, $nestinglevel, $albums, $seq) { global $wpdb; $alt = true; foreach (array_keys($seq) as $s) { // Obey the global sequence $album = $albums[$s]; if ($album['a_parent'] == $parent) { if (wppa_have_access($album)) { $counts = wppa_treecount_a($album['id']); $pendcount = $counts['pendphotos']; $schedulecount = $counts['scheduledphotos']; $haschildren = wppa_have_accessable_children($album); $class = ''; if ($parent != '0' && $parent != '-1') { $class .= 'wppa-alb-on-' . $parent . ' '; $par = $parent; while ($par != '0' && $par != '-1') { $class .= 'wppa-alb-off-' . $par . ' '; $par = wppa_get_parentalbumid($par); } } if ($alt) { $class .= ' alternate'; } $style = ''; if ($pendcount) { $style .= 'background-color:#ffdddd; '; } // if ( $haschildren ) $style .= 'font-weight:bold; '; if ($parent != '0' && $parent != '-1') { $style .= 'display:none; '; } $onclickon = 'jQuery(\'.wppa-alb-on-' . $album['id'] . '\').css(\'display\',\'\'); jQuery(\'#alb-arrow-on-' . $album['id'] . '\').css(\'display\',\'none\'); jQuery(\'#alb-arrow-off-' . $album['id'] . '\').css(\'display\',\'\');'; $onclickoff = 'jQuery(\'.wppa-alb-off-' . $album['id'] . '\').css(\'display\',\'none\'); jQuery(\'#alb-arrow-on-' . $album['id'] . '\').css(\'display\',\'\'); jQuery(\'#alb-arrow-off-' . $album['id'] . '\').css(\'display\',\'none\'); checkArrows();'; $indent = $nestinglevel; if ($indent > '5') { $indent = 5; } ?> <tr class="<?php echo $class; ?> " style="<?php echo $style; ?> " > <?php $i = 0; while ($i < $indent) { echo '<td style="padding:2px;" ></td>'; $i++; } ?> <td style="padding:2px; text-align:center;" ><?php if ($haschildren) { ?> <img id="alb-arrow-off-<?php echo $album['id']; ?> " class="alb-arrow-off" style="height:16px; display:none;" src="<?php echo wppa_get_imgdir() . 'backarrow.gif'; ?> " onclick="<?php echo $onclickoff; ?> " title="<?php _e('Collapse subalbums', 'wp-photo-album-plus'); ?> " /> <img id="alb-arrow-on-<?php echo $album['id']; ?> " class="alb-arrow-on" style="height:16px;" src="<?php echo wppa_get_imgdir() . 'arrow.gif'; ?> " onclick="<?php echo $onclickon; ?> " title="<?php _e('Expand subalbums', 'wp-photo-album-plus'); ?> " /> <?php } ?> </td> <td style="padding:2px;" ><?php echo $album['id']; ?> </td> <?php $i = $indent; while ($i < 5) { echo '<td style="padding:2px;" ></td>'; $i++; } ?> <td><?php echo esc_attr(__(stripslashes($album['name']))); ?> </td> <td><small><?php echo esc_attr(__(stripslashes($album['description']))); ?> </small></td> <?php if (current_user_can('administrator')) { ?> <td><?php echo $album['owner']; ?> </td> <?php } ?> <td><?php echo $album['a_order']; ?> </td> <td><?php echo wppa_get_album_name($album['a_parent'], 'extended'); ?> </td> <?php $url = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=edit&edit_id=' . $album['id']); ?> <?php $na = $counts['selfalbums']; ?> <?php $np = $counts['selfphotos']; ?> <?php $nm = $counts['pendphotos']; ?> <?php $ns = $counts['scheduledphotos']; ?> <td><?php echo $na . '/' . $np . '/' . $nm . '/' . $ns; ?> </td> <?php if ($album['owner'] != '--- public ---' || wppa_user_is('administrator')) { ?> <?php $url = wppa_ea_url($album['id']); ?> <td><a href="<?php echo $url; ?> " class="wppaedit"><?php _e('Edit', 'wp-photo-album-plus'); ?> </a></td> <td><a href="<?php echo $url . '&quick'; ?> " class="wppaedit"><?php _e('Quick', 'wp-photo-album-plus'); ?> </a></td> <td><a href="<?php echo $url . '&bulk#manage-photos'; ?> " class="wppaedit"><?php _e('Bulk', 'wp-photo-album-plus'); ?> </a></td> <td><a href="<?php echo $url . '&seq'; ?> " class="wppaedit"><?php _e('Seq', 'wp-photo-album-plus'); ?> </a></td> <?php $url = wppa_ea_url($album['id'], 'del'); ?> <td><a href="<?php echo $url; ?> " class="wppadelete"><?php _e('Delete', 'wp-photo-album-plus'); ?> </a></td> <?php if (wppa_can_create_album()) { $url = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=edit&edit_id=new&parent_id=' . $album['id']); if (wppa_switch('confirm_create')) { $onc = 'if (confirm(\'' . __('Are you sure you want to create a subalbum?', 'wp-photo-album-plus') . '\')) document.location=\'' . $url . '\';'; echo '<td><a onclick="' . $onc . '" class="wppacreate">' . __('Create', 'wp-photo-album-plus') . '</a></td>'; } else { echo '<td><a href="' . $url . '" class="wppacreate">' . __('Create', 'wp-photo-album-plus') . '</a></td>'; } } } else { ?> <td></td><td></td><?php if (wppa_can_create_album()) { echo '<td></td'; } ?> <?php } ?> </tr> <?php if ($alt == '') { $alt = ' class="alternate" '; } else { $alt = ''; } if ($haschildren) { wppa_do_albumlist($album['id'], $nestinglevel + '1', $albums, $seq); } } } } }
function wppa_album_sequence($parent) { global $wpdb; // Get the albums $albumorder = wppa_get_album_order($parent); $is_descending = strpos($albumorder, 'DESC') !== false; $albums = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_ALBUMS . '` WHERE `a_parent` = %s ' . $albumorder, $parent), ARRAY_A); // Anything to do here ? if (empty($albums)) { return; } // Check my access rights foreach ($albums as $album) { if (!wppa_have_access($album['id'])) { return; } } // Check album order if (!strpos($albumorder, 'a_order')) { if ($parent == '0') { echo '<br />'; _e('You can edit top-level album sequence order here when you set the album order to "Order #" or "Order # desc" in Table IV-D1.'); } else { _e('You can edit sub-album sequence order here when you set the album order to "Order #" or "Order # desc" in the "Sub album sort order:" selection box above.'); } return; } echo '<h2>' . __('Manage album order', 'wp-photo-album-plus') . ' - ' . '<small>' . '<i>' . __('Change sequence order by drag and drop, or use the up/down arrows.', 'wp-photo-album-plus') . '</i>' . ' ' . __('Do not leave this page unless the bar is entirely green.', 'wp-photo-album-plus') . '</small>' . '</h2>'; echo '<table>' . '<thead>' . '<tr>' . '<th>' . __('Color', 'wp-photo-album-plus') . '</th>' . '<th>' . __('Meaning', 'wp-photo-album-plus') . '</th>' . '</tr>' . '</thead>' . '<tbody>' . '<tr>' . '<td>' . '<div style="background-color:green;height:12px;" ></div>' . '</td>' . '<td>' . __('Up to date', 'wp-photo-album-plus') . '</td>' . '</tr>' . '<tr>' . '<td>' . '<div style="background-color:yellow;height:12px;" ></div>' . '</td>' . '<td>' . __('Updating', 'wp-photo-album-plus') . '</td>' . '</tr>' . '<tr>' . '<td>' . '<div style="background-color:orange;height:12px;" ></div>' . '</td>' . '<td>' . __('Needs update', 'wp-photo-album-plus') . '</td>' . '</tr>' . '<tr>' . '<td>' . '<div style="background-color:red;height:12px;" ></div>' . '</td>' . '<td>' . __('Error', 'wp-photo-album-plus') . '</td>' . '</tr>' . '</tbody>' . '</table>'; ?> <style> .sortable-placeholder-albums { width: 100%; height: 60px; margin: 5px; border: 1px dotted #cccccc; border-radius:3px; float: left; } .ui-state-default-albums { position: relative; width: 100%; height: 60px; margin: 5px; border: 1px solid #cccccc; border-radius:3px; float: left; } .ui-state-default-albums td { padding:0; line-height:12px; text-align:center; } </style> <script> jQuery( function() { jQuery( "#sortable-albums" ).sortable( { cursor: "move", placeholder: "sortable-placeholder-albums", stop: function( event, ui ) { wppaDoRenumber(); } } ); } ); var wppaRenumberPending = false; var wppaAjaxInProgress = 0; function wppaDoRenumber() { // Busy? if ( wppaAjaxInProgress > 0 ) { wppaRenumberPending = true; } // Not busy else { _wppaDoRenumber(); } } function _wppaDoRenumber() { // Init var ids = jQuery( ".wppa-sort-item-albums" ); var seq = jQuery( ".wppa-sort-seqn-albums" ); var descend = <?php if ($is_descending) { echo 'true'; } else { echo 'false'; } ?> ; // Mark needs update var idx = 0; while ( idx < ids.length ) { var newvalue; if ( descend ) newvalue = ids.length - idx; else newvalue = idx + 1; var oldvalue = seq[idx].value; var album = ids[idx].value; if ( newvalue != oldvalue ) { jQuery( '#wppa-pb-'+idx ).css({backgroundColor:'orange'}); } idx++; } // Process var idx = 0; while ( idx < ids.length ) { var newvalue; if ( descend ) newvalue = ids.length - idx; else newvalue = idx + 1; var oldvalue = seq[idx].value; var album = ids[idx].value; if ( newvalue != oldvalue ) { wppaDoSeqUpdateAlbum( album, newvalue ); jQuery( '#wppa-pb-'+idx ).css({backgroundColor:'yellow'}); wppaLastAlbum = album; } idx++; } } function wppaDoSeqUpdateAlbum( album, seqno ) { var data = 'action=wppa' + '&wppa-action=update-album' + '&album-id=' + album + '&item=a_order' + '&wppa-nonce=' + document.getElementById( 'album-nonce-' + album ).value + '&value=' + seqno; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if ( xmlhttp.readyState == 4 && xmlhttp.status != 404 ) { var ArrValues = xmlhttp.responseText.split( "||" ); if ( ArrValues[0] != '' ) { alert( 'The server returned unexpected output:\n' + ArrValues[0] ); } switch ( ArrValues[1] ) { case '0': // No error var i = seqno - 1; var descend = <?php if ($is_descending) { echo 'true'; } else { echo 'false'; } ?> ; if ( descend ) { i = <?php echo count($albums); ?> - seqno; } jQuery( '#wppa-album-seqno-' + album ).html( seqno ); if ( wppaRenumberPending ) { jQuery( '#wppa-pb-'+i ).css({backgroundColor:'orange'}); } else { jQuery( '#wppa-pb-'+i ).css({backgroundColor:'green'}); } if ( wppaLastAlbum = album ) { wppaRenumberBusy = false; } break; default: // Any error jQuery( '#wppa-album-seqno-' + album ).html( '<span style="color"red" >Err:' + ArrValues[1] + '</span>' ); break; } wppaAjaxInProgress--; // No longer busy? if ( wppaAjaxInProgress == 0 ) { if ( wppaRenumberPending ) { // Redo wppaRenumberPending = false; wppaDoRenumber(); } } } } xmlhttp.open( 'POST',wppaAjaxUrl,true ); xmlhttp.setRequestHeader( "Content-type","application/x-www-form-urlencoded" ); xmlhttp.send( data ); wppaAjaxInProgress++; jQuery( "#wppa-sort-seqn-albums-" + album ).attr( 'value', seqno ); // set hidden value to new value to prevent duplicate action var spinnerhtml = '<img src="' + wppaImageDirectory + 'spinner.gif' + '" />'; jQuery( '#wppa-album-seqno-' + album ).html( spinnerhtml ); } </script> <br /> <div id="wppa-progbar" style="width:100%;height:12px;" > <?php $c = count($albums); $l = 100 / $c; $i = 0; while ($i < $c) { echo '<div' . ' id="wppa-pb-' . $i . '"' . ' style="display:inline;float:left;background-color:green;height:12px;width:' . $l . '%;"' . ' >' . '</div>'; $i++; } ?> </div> <br /> <div class="widefat" style="max-width:600px;" > <div id="sortable-albums"> <?php foreach ($albums as $album) { $cover_photo_id = wppa_get_coverphoto_id($album['id']); echo ' <div' . ' id="albumitem-' . $album['id'] . '"' . ' class="ui-state-default-albums"' . ' style="background-color:#eeeeee;cursor:move;"' . ' >' . '<div' . ' style="height:100%;width:25%;float:left;text-align:center;overflow:hidden;" >'; if (wppa_is_video($cover_photo_id)) { echo wppa_get_video_html(array('id' => $cover_photo_id, 'height' => '50', 'margin_top' => '5', 'margin_bottom' => '5', 'controls' => false)); } else { echo '<img' . ' class="wppa-cover-image"' . ' src="' . wppa_fix_poster_ext(wppa_get_thumb_url(wppa_get_coverphoto_id($album['id'])), $cover_photo_id) . '"' . ' style="max-height:50px; margin: 5px;"' . ' />'; } echo '</div>' . '<div style="height:100%;width:40%;float:left;font-size:12px;overflow:hidden;" >' . '<b>' . wppa_get_album_name($album['id']) . '</b>' . '<br />' . wppa_get_album_desc($album['id']) . '</div>' . '<div style="float:right;width:10%;" >' . '<table>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('up.png') . '"' . ' title="' . esc_attr(__('To top', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).parent().prepend(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('up.png') . '"' . ' title="' . esc_attr(__('One up', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;width:24px;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).prev().before(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('down.png') . '"' . ' title="' . esc_attr(__('One down', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;width:24px;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).next().after(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '<tr><td>' . '<img' . ' src="' . wppa_get_imgdir('down.png') . '"' . ' title="' . esc_attr(__('To bottom', 'wp-photo-album-plus')) . '"' . ' style="cursor:pointer;"' . ' onclick="' . 'jQuery( \'#albumitem-' . $album['id'] . '\' ).parent().append(jQuery( \'#albumitem-' . $album['id'] . '\' ));' . 'wppaDoRenumber();' . '"' . ' />' . '</td></tr>' . '</table>' . '</div>' . '<div style="float:right; width:25%;" >' . '<span style=""> ' . __('Id:', 'wp-photo-album-plus') . ' ' . $album['id'] . '</span>' . '<span style=""> - ' . __('Ord:', 'wp-photo-album-plus') . '</span>' . '<span id="wppa-album-seqno-' . $album['id'] . '" > ' . $album['a_order'] . '</span>' . '<br />' . '<a href="' . wppa_ea_url($album['id']) . '" style="position:absolute;bottom:0;" >' . __('Edit', 'wp-photo-album-plus') . '</a>' . '</div>' . '<input type="hidden" id="album-nonce-' . $album['id'] . '" value="' . wp_create_nonce('wppa_nonce_' . $album['id']) . '" />' . '<input type="hidden" class="wppa-sort-item-albums" value="' . $album['id'] . '" />' . '<input type="hidden" class="wppa-sort-seqn-albums" id="wppa-sort-seqn-albums-' . $album['id'] . '" value="' . $album['a_order'] . '" />' . '</div>'; } ?> </div> <div style="clear:both;"></div> </div> <?php }
function wppa_slide_rating_range($opt) { global $wppa; global $wppa_opt; if ($opt == 'optional' && !wppa_switch('wppa_rating_on')) { return; } if ($wppa['is_slideonly'] == '1') { return; } /* Not when slideonly */ if (is_feed()) { wppa_dummy_bar(__a('- - - Rating enabled - - -', 'wppa_theme')); return; } $fs = $wppa_opt['wppa_fontsize_nav']; if ($fs != '') { $fs += 3; } else { $fs = '15'; } // iconsize = fontsize+3, Default to 15 $dh = $fs + '6'; $size = 'font-size:' . $fs . 'px;'; // Open the rating box $wppa['out'] .= ' <!-- wppa-rating-' . $wppa['mocc'] . ' --> <div id="wppa-rating-' . $wppa['mocc'] . '" class="wppa-box wppa-nav wppa-nav-text" style="' . __wcs('wppa-box') . __wcs('wppa-nav') . __wcs('wppa-nav-text') . $size . ' text-align:center;">'; // Graphic display ? if ($wppa_opt['wppa_rating_display_type'] == 'graphic') { if ($wppa_opt['wppa_rating_max'] == '5') { $r['1'] = __a('very low', 'wppa_theme'); $r['2'] = __a('low', 'wppa_theme'); $r['3'] = __a('average', 'wppa_theme'); $r['4'] = __a('high', 'wppa_theme'); $r['5'] = __a('very high', 'wppa_theme'); } else { for ($i = '1'; $i <= '10'; $i++) { $r[$i] = $i; } } $style = 'style="height:' . $fs . 'px; margin:0 0 -3px 0; padding:0; box-shadow:none; display:inline;"'; $icon = 'star.png'; // Display avg rating if (wppa_switch('wppa_show_avg_rating')) { $wppa['out'] .= '<span id="wppa-avg-rat-' . $wppa['mocc'] . '">' . __a('Average rating', 'wppa_theme') . '</span> '; $i = '1'; while ($i <= $wppa_opt['wppa_rating_max']) { $wppa['out'] .= wppa_nltab() . '<img id="wppa-avg-' . $wppa['mocc'] . '-' . $i . '" class="wppa-avg-' . $wppa['mocc'] . ' no-shadow" ' . $style . ' src="' . wppa_get_imgdir() . $icon . '" alt="' . $i . '" title="' . __a('Average rating', 'wppa_theme') . ': ' . $r[$i] . '" />'; $i++; } } $wppa['out'] .= '<img id="wppa-filler-' . $wppa['mocc'] . '" src="' . wppa_get_imgdir() . 'transp.png" alt="f" style="width:' . $wppa_opt['wppa_ratspacing'] . 'px; height:15px; box-shadow:none; padding:0; margin:0; border:none;" />'; // Display my rating if (!wppa_switch('wppa_rating_login') || is_user_logged_in()) { // Logged in or do'nt care // Show dislike icon? $pad = round(($wppa_opt['wppa_ratspacing'] - $fs) / 2); if ($pad < 5) { $pad = '5'; } $tdstyle = 'style="height:' . $fs . 'px; margin:0 0 -3px 0; padding:0 ' . $pad . 'px; box-shadow:none; display:inline;"'; if ($wppa_opt['wppa_dislike_mail_every']) { $evnts = 'onmouseover="jQuery(this).stop().fadeTo(100, 1.0)" onmouseout="jQuery(this).stop().fadeTo(100, wppaStarOpacity)" onclick="if (confirm(\'' . __a('Are you sure you want to mark this image as inappropriate?') . '\')) wppaRateIt(' . $wppa['mocc'] . ', -1)"'; $title = 'title="' . __a('Click this if you do NOT like this image!', 'wppa_theme') . '"'; $wppa['out'] .= '<img id="wppa-dislike-' . $wppa['mocc'] . '" ' . $title . ' src="' . wppa_get_imgdir() . 'thumbdown.png" alt="d" ' . $tdstyle . ' class="no-shadow" ' . $evnts . ' />'; if (wppa_switch('wppa_dislike_show_count')) { $wppa['out'] .= '<span id="wppa-discount-' . $wppa['mocc'] . '" style="cursor:default" title="' . __a('Number of people who marked this photo as inapprpriate') . '"></span>'; } } // Text left if no avg rating if (!wppa_switch('wppa_show_avg_rating')) { $wppa['out'] .= __a('My rating', 'wppa_theme') . ': '; } // Display the my rating stars $i = '1'; while ($i <= $wppa_opt['wppa_rating_max']) { $wppa['out'] .= wppa_nltab() . '<img id="wppa-rate-' . $wppa['mocc'] . '-' . $i . '" class="wppa-rate-' . $wppa['mocc'] . ' no-shadow" ' . $style . ' src="' . wppa_get_imgdir() . $icon . '" alt="' . $i . '" title="' . __a('My rating', 'wppa_theme') . ': ' . $r[$i] . '" onmouseover="wppaFollowMe(' . $wppa['mocc'] . ', ' . $i . ')" onmouseout="wppaLeaveMe(' . $wppa['mocc'] . ', ' . $i . ')" onclick="wppaRateIt(' . $wppa['mocc'] . ', ' . $i . ')" />'; $i++; } // Text right if avg rating diaplayed if (wppa_switch('wppa_show_avg_rating')) { $wppa['out'] .= ' ' . '<span id="wppa-my-rat-' . $wppa['mocc'] . '">' . __a('My rating', 'wppa_theme') . '</span>'; } } else { if (wppa_switch('wppa_login_links')) { $wppa['out'] .= sprintf(__a('You must <a href="%s">login</a> to vote'), site_url('wp-login.php', 'login')); } else { $wppa['out'] .= __a('You must login to vote'); } } } elseif ($wppa_opt['wppa_rating_display_type'] == 'numeric') { // Display avg rating if (wppa_switch('wppa_show_avg_rating')) { $wppa['out'] .= __a('Average rating', 'wppa_theme') . ': '; $wppa['out'] .= '<span id="wppa-numrate-avg-' . $wppa['mocc'] . '"></span>'; $wppa['out'] .= ' •'; } // Display my rating if (!wppa_switch('wppa_rating_login') || is_user_logged_in()) { // Logged in or do'nt care // Show dislike icon? $pad = round(($wppa_opt['wppa_ratspacing'] - $fs) / 2); if ($pad < 5) { $pad = '5'; } $tdstyle = 'style="height:' . $fs . 'px; margin:0 0 -3px 0; padding:0 ' . $pad . 'px; box-shadow:none; display:inline;"'; if ($wppa_opt['wppa_dislike_mail_every']) { $evnts = 'onmouseover="jQuery(this).stop().fadeTo(100, 1.0)" onmouseout="jQuery(this).stop().fadeTo(100, wppaStarOpacity)" onclick="if (confirm(\'' . __a('Are you sure you want to mark this image as inappropriate?') . '\')) wppaRateIt(' . $wppa['mocc'] . ', -1)"'; $title = 'title="' . __a('Click this if you do NOT like this image!', 'wppa_theme') . '"'; $wppa['out'] .= '<div id="wppa-dislike-imgdiv-' . $wppa['mocc'] . '" style="display:inline" ><img id="wppa-dislike-' . $wppa['mocc'] . '" ' . $title . ' src="' . wppa_get_imgdir() . 'thumbdown.png" alt="d" ' . $tdstyle . ' class="no-shadow" ' . $evnts . ' /> </div>'; if (wppa_switch('wppa_dislike_show_count')) { $wppa['out'] .= '<span id="wppa-discount-' . $wppa['mocc'] . '" style="cursor:default" title="' . __a('Number of people who marked this photo as inapprpriate') . '"></span>'; } } // Filler // $wppa['out'] .= '<span id="wppa-filler-'.$wppa['mocc'].'" > -</span>'; // $wppa['out'] .= ' ' . __a('My rating:', 'wppa_theme'); $wppa['out'] .= '<span id="wppa-numrate-mine-' . $wppa['mocc'] . '"></span>'; } else { if (wppa_switch('wppa_login_links')) { $wppa['out'] .= sprintf(__a('You must <a href="%s">login</a> to vote'), site_url('wp-login.php', 'login')); } else { $wppa['out'] .= __a('You must login to vote'); } } } // Close rating box $wppa['out'] .= ' </div><!-- wppa-rating-' . $wppa['mocc'] . ' -->'; }
function wppa_album_photos($album = '', $photo = '', $owner = '', $moderate = false) { global $wpdb; // Check input wppa_vfy_arg('wppa-page'); $pagesize = wppa_opt('photo_admin_pagesize'); $page = isset($_GET['wppa-page']) ? $_GET['wppa-page'] : '1'; $skip = ($page - '1') * $pagesize; $limit = $pagesize < '1' ? '' : ' LIMIT ' . $skip . ',' . $pagesize; // Edit the photos in a specific album if ($album) { // Special album case: search (see last album line in album table) if ($album == 'search') { $count = wppa_get_edit_search_photos('', 'count_only'); $photos = wppa_get_edit_search_photos($limit); $link = wppa_dbg_url(get_admin_url() . 'admin.php' . '?page=wppa_admin_menu' . '&tab=edit' . '&edit_id=' . $album . '&wppa-searchstring=' . wppa_sanitize_searchstring($_REQUEST['wppa-searchstring'])); } else { $counts = wppa_treecount_a($album); $count = $counts['selfphotos'] + $counts['pendphotos']; $photos = $wpdb->get_results($wpdb->prepare("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `album` = %s " . wppa_get_photo_order($album, 'norandom') . $limit, $album), ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php' . '?page=wppa_admin_menu' . '&tab=edit' . '&edit_id=' . $album); } } elseif ($photo && !$moderate) { $count = '1'; $photos = $wpdb->get_results($wpdb->prepare("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `id` = %s", $photo), ARRAY_A); $link = ''; } elseif ($owner) { $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `owner` = %s", $owner)); $photos = $wpdb->get_results($wpdb->prepare("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `owner` = %s " . "ORDER BY `timestamp` DESC " . $limit, $owner), ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php' . '?page=wppa_edit_photo'); } elseif ($moderate) { // Can i moderate? if (!current_user_can('wppa_moderate')) { wp_die(__('You do not have the rights to do this', 'wp-photo-album-plus')); } // Moderate a single photo if ($photo) { $count = '1'; $photos = $wpdb->get_results($wpdb->prepare("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `id` = %s", $photo), ARRAY_A); $link = ''; } else { $cmt = $wpdb->get_results("SELECT `photo` " . "FROM `" . WPPA_COMMENTS . "` " . "WHERE `status` = 'pending' " . "OR `status` = 'spam'", ARRAY_A); if ($cmt) { $orphotois = ''; foreach ($cmt as $c) { $orphotois .= "OR `id` = " . $c['photo'] . " "; } } else { $orphotois = ''; } $count = $wpdb->get_var("SELECT COUNT(*) " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `status` = 'pending' " . $orphotois); $photos = $wpdb->get_results("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `status` = 'pending' " . $orphotois . " " . "ORDER BY `timestamp` DESC " . $limit, ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php' . '?page=wppa_moderate_photos'); } // No photos to moderate if (empty($photos)) { // Single photo moderate requested if ($photo) { echo '<p>' . __('This photo is no longer awaiting moderation.', 'wp-photo-album-plus') . '</p>'; } else { echo '<p>' . __('There are no photos awaiting moderation at this time.', 'wp-photo-album-plus') . '</p>'; } // If i am admin, i can edit all photos here, sorted by timestamp desc if (wppa_user_is('administrator')) { echo '<h3>' . __('Manage all photos by timestamp', 'wp-photo-album-plus') . '</h3>'; $count = $wpdb->get_var("SELECT COUNT(*) " . "FROM `" . WPPA_PHOTOS . "`"); $photos = $wpdb->get_results("SELECT * " . "FROM `" . WPPA_PHOTOS . "` " . "ORDER BY `timestamp` DESC" . $limit, ARRAY_A); $link = wppa_dbg_url(get_admin_url() . 'admin.php' . '?page=wppa_moderate_photos'); } else { return; } } } else { wppa_dbg_msg('Missing required argument in wppa_album_photos() 1', 'red', 'force'); return; } // Quick edit skips a few time consuming settings like copy and move to other album $quick = isset($_REQUEST['quick']); if ($link && $quick) { $link .= '&quick'; } // In case it is a seaerch and edit, show the search statistics wppa_show_search_statistics(); // If no photos selected produce apprpriate message and quit if (empty($photos)) { // A specific photo requested if ($photo) { echo '<div id="photoitem-' . $photo . '" class="photoitem" style="width:100%; background-color: rgb( 255, 255, 224 ); border-color: rgb( 230, 219, 85 );">' . '<span style="color:red">' . sprintf(__('Photo %s has been removed.', 'wp-photo-album-plus'), $photo) . '</span>' . '</div>'; } else { // Search if (isset($_REQUEST['wppa-searchstring'])) { echo '<h3>' . __('No photos matching your search criteria.', 'wp-photo-album-plus') . '</h3>'; } else { echo '<h3>' . __('No photos yet in this album.', 'wp-photo-album-plus') . '</h3>'; } } return; } else { // Local js functions placed here as long as there is not yet a possibility to translate texts in js files ?> <script> function wppaTryMove( id, video ) { var query; if ( ! jQuery( '#target-' + id ).val() ) { alert( '<?php echo esc_js(__('Please select an album to move to first.', 'wp-photo-album-plus')); ?> ' ); return false; } if ( video ) { query = '<?php echo esc_js(__('Are you sure you want to move this video?', 'wp-photo-album-plus')); ?> '; } else { query = '<?php echo esc_js(__('Are you sure you want to move this photo?', 'wp-photo-album-plus')); ?> '; } if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'moveto', document.getElementById( 'target-' + id ) ); } } function wppaTryCopy( id, video ) { var query; if ( ! jQuery( '#target-' + id ).val() ) { alert( '<?php echo esc_js(__('Please select an album to copy to first.', 'wp-photo-album-plus')); ?> ' ); return false; } if ( video ) { query = '<?php echo esc_js(__('Are you sure you want to copy this video?', 'wp-photo-album-plus')); ?> '; } else { query = '<?php echo esc_js(__('Are you sure you want to copy this photo?', 'wp-photo-album-plus')); ?> '; } if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'copyto', document.getElementById( 'target-' + id ) ); } } function wppaTryDelete( id, video ) { var query; if ( video ) { query = '<?php echo esc_js(__('Are you sure you want to delete this video?', 'wp-photo-album-plus')); ?> '; } else { query = '<?php echo esc_js(__('Are you sure you want to delete this photo?', 'wp-photo-album-plus')); ?> '; } if ( confirm( query ) ) { wppaAjaxDeletePhoto( id ) } } function wppaTryRotLeft( id ) { var query = '<?php echo esc_js(__('Are you sure you want to rotate this photo left?', 'wp-photo-album-plus')); ?> '; if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'rotleft', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); } } function wppaTryRot180( id ) { var query = '<?php echo esc_js(__('Are you sure you want to rotate this photo 180°?', 'wp-photo-album-plus')); ?> '; if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'rot180', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); } } function wppaTryRotRight( id ) { var query = '<?php echo esc_js(__('Are you sure you want to rotate this photo right?', 'wp-photo-album-plus')); ?> '; if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'rotright', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); } } function wppaTryFlip( id ) { var query = '<?php echo esc_js(__('Are you sure you want to flip this photo?', 'wp-photo-album-plus')); ?> '; if ( confirm( query ) ) { wppaAjaxUpdatePhoto( id, 'flip', 0, <?php echo wppa('front_edit') ? 'false' : 'true'; ?> ); } } function wppaTryWatermark( id ) { var wmFile = jQuery( '#wmfsel_' + id ).val(); if ( wmFile == '--- none ---' ) { alert( '<?php echo esc_js(__('No watermark selected', 'wp-photo-album-plus')); ?> ' ); return; } var query = '<?php echo esc_js(__('Are you sure? Once applied it can not be removed!', 'wp-photo-album-plus')); ?> '; query += '\n'; query += '<?php echo esc_js(__('And I do not know if there is already a watermark on this photo', 'wp-photo-album-plus')); ?> '; if ( confirm( query ) ) { wppaAjaxApplyWatermark( id, document.getElementById( 'wmfsel_' + id ).value, document.getElementById( 'wmpsel_' + id ).value ); } } </script> <?php // Get the current watermark file settings $wms = array('toplft' => __('top - left', 'wp-photo-album-plus'), 'topcen' => __('top - center', 'wp-photo-album-plus'), 'toprht' => __('top - right', 'wp-photo-album-plus'), 'cenlft' => __('center - left', 'wp-photo-album-plus'), 'cencen' => __('center - center', 'wp-photo-album-plus'), 'cenrht' => __('center - right', 'wp-photo-album-plus'), 'botlft' => __('bottom - left', 'wp-photo-album-plus'), 'botcen' => __('bottom - center', 'wp-photo-album-plus'), 'botrht' => __('bottom - right', 'wp-photo-album-plus')); $temp = wppa_get_water_file_and_pos('0'); $wmfile = isset($temp['select']) ? $temp['select'] : ''; $wmpos = isset($temp['pos']) && isset($wms[$temp['pos']]) ? $wms[$temp['pos']] : ''; $mvt = esc_attr(__('Move video', 'wp-photo-album-plus')); $mpt = esc_attr(__('Move photo', 'wp-photo-album-plus')); $cvt = esc_attr(__('Copy video', 'wp-photo-album-plus')); $cpt = esc_attr(__('Copy photo', 'wp-photo-album-plus')); // Display the pagelinks wppa_admin_page_links($page, $pagesize, $count, $link); // Display all photos foreach ($photos as $photo) { // We may not use extract(), so we do something like it here manually, hence controlled. $id = $photo['id']; $timestamp = $photo['timestamp']; $modified = $photo['modified']; $owner = $photo['owner']; $crypt = $photo['crypt']; $album = $photo['album']; $name = stripslashes($photo['name']); $description = stripslashes($photo['description']); $exifdtm = $photo['exifdtm']; $views = $photo['views']; $clicks = $photo['clicks']; $p_order = $photo['p_order']; $linktarget = $photo['linktarget']; $linkurl = $photo['linkurl']; $linktitle = stripslashes($photo['linktitle']); $alt = stripslashes($photo['alt']); $filename = $photo['filename']; $videox = $photo['videox']; $videoy = $photo['videoy']; $location = $photo['location']; $status = $photo['status']; $tags = trim(stripslashes($photo['tags']), ','); $stereo = $photo['stereo']; // See if item is a multimedia item $is_multi = wppa_is_multi($id); $is_video = wppa_is_video($id); // returns array of extensions $b_is_video = empty($is_video) ? 0 : 1; // boolean $has_audio = wppa_has_audio($id); // returns array of extensions $b_has_audio = empty($has_audio) ? 0 : 1; // boolean // Various usefull vars $owner_editable = wppa_switch('photo_owner_change') && wppa_user_is('administrator'); $sortby_orderno = wppa_get_album_item($album, 'p_order_by') == '1' || wppa_get_album_item($album, 'p_order_by') == '-1'; echo "\n" . '<a id="photo_' . $id . '" ></a>'; echo '<div' . ' id="photoitem-' . $id . '"' . ' class="wppa-table-wrap"' . ' style="width:100%;position:relative;"' . ' >'; echo '<input' . ' type="hidden"' . ' id="photo-nonce-' . $id . '"' . ' value="' . wp_create_nonce('wppa_nonce_' . $id) . '"' . ' />'; echo "\n" . '<!-- Section 1 -->' . '<table' . ' class="wppa-table wppa-photo-table"' . ' style="width:100%;"' . ' >' . '<tbody>'; // -- Preview thumbnail --- echo '<tr>' . '<td>'; $src = wppa_get_thumb_url($id); $big = wppa_get_photo_url($id); if ($is_video) { reset($is_video); $big = str_replace('xxx', current($is_video), $big); echo '<a' . ' href="' . $big . '"' . ' target="_blank"' . ' title="' . esc_attr(__('Preview fullsize video', 'wp-photo-album-plus')) . '"' . ' >' . wppa_get_video_html(array('id' => $id, 'tagid' => 'video-' . $id, 'width' => '160', 'height' => '160' * wppa_get_videoy($id) / wppa_get_videox($id), 'controls' => false, 'use_thumb' => true)) . '</a>'; } else { if ($has_audio) { $big = wppa_fix_poster_ext($big, $id); $src = wppa_fix_poster_ext($src, $id); } echo '<a' . ' href="' . $big . '"' . ' target="_blank"' . ' title="' . esc_attr(__('Preview fullsize photo', 'wp-photo-album-plus')) . '"' . ' >' . '<img' . ' src="' . $src . '"' . ' alt="' . esc_attr($name) . '"' . ' style="max-width: 160px; vertical-align:middle;"' . ' />' . '</a>'; if ($has_audio) { $audio = wppa_get_audio_html(array('id' => $id, 'tagid' => 'audio-' . $id, 'width' => '160', 'controls' => true)); echo '<br />' . ($audio ? $audio : '<span style="color:red;">' . __('Audio disabled', 'wp-photo-album-plus') . '</span>'); } } echo '</td>'; echo '<td>' . 'ID = ' . $id . '. ' . __('Crypt:', 'wp-photo-album-plus') . ' ' . $crypt . '. ' . __('Filename:', 'wp-photo-album-plus') . ' ' . $filename . '. ' . __('Upload:', 'wp-photo-album-plus') . ' ' . wppa_local_date('', $timestamp) . ' ' . __('local time', 'wp-photo-album-plus') . '. ' . ($owner_editable ? '' : __('By:', 'wp-photo-album-plus') . ' ' . $owner); if ($owner_editable) { echo __('Owned by:', 'wp-photo-album-plus') . '<input' . ' type="text"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'owner\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'owner\', this )"' . ' value="' . $owner . '"' . ' />'; } echo ' ' . sprintf(__('Album: %d (%s).', 'wp-photo-album-plus'), $album, wppa_get_album_name($album)); // Modified if ($modified > $timestamp) { echo ' ' . __('Modified:', 'wp-photo-album-plus') . ' ' . wppa_local_date('', $modified) . ' ' . __('local time', 'wp-photo-album-plus'); } else { echo ' ' . __('Not modified', 'wp-photo-album-plus'); } echo '. ' . __('EXIF Date:', 'wp-photo-album-plus'); if (wppa_user_is('administrator')) { // Admin may edit exif date echo '<input' . ' type="text"' . ' style="width:125px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'exifdtm\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'exifdtm\', this )"' . ' value="' . $exifdtm . '"' . ' />'; } else { echo $exifdtm . '.'; } echo ' '; // Location if ($photo['location'] || wppa_switch('geo_edit')) { echo __('Location:', 'wp-photo-album-plus') . ' '; $loc = $location ? $location : '///'; $geo = explode('/', $loc); echo $geo['0'] . ' ' . $geo['1'] . '. '; if (wppa_switch('geo_edit')) { echo __('Lat:', 'wp-photo-album-plus') . '<input' . ' type="text"' . ' style="width:100px;"' . ' id="lat-' . $id . '"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'lat\', this );"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'lat\', this );"' . ' value="' . $geo['2'] . '"' . ' />' . __('Lon:', 'wp-photo-album-plus') . '<input type="text"' . ' style="width:100px;"' . ' id="lon-' . $id . '"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'lon\', this );"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'lon\', this );"' . ' value="' . $geo['3'] . '"' . ' />'; } } // Changeable p_order echo __('Photo sort order #:', 'wp-photo-album-plus'); if ($sortby_orderno && (!wppa_switch('porder_restricted') || wppa_user_is('administrator'))) { echo '<input' . ' type="text"' . ' id="porder-' . $id . '"' . ' value="' . $p_order . '"' . ' style="width:30px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'p_order\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'p_order\', this )"' . ' />' . ' '; } else { echo $p_order . '. '; } // Rating $entries = wppa_get_rating_count_by_id($id); if ($entries) { if (wppa_opt('rating_display_type') == 'likes') { echo __('Likes:', 'wp-photo-album-plus') . ' ' . $entries . '. '; } else { echo __('Rating:', 'wp-photo-album-plus') . ' ' . __('Entries:', 'wp-photo-album-plus') . ' ' . $entries . ', ' . __('Mean value:', 'wp-photo-album-plus') . ' ' . wppa_get_rating_by_id($id, 'nolabel') . '. '; } } else { echo __('No ratings for this photo.', 'wp-photo-album-plus') . ' '; } $dislikes = wppa_dislike_get($id); if ($dislikes) { echo '<span style="color:red" >' . sprintf(__('Disliked by %d visitors', 'wp-photo-album-plus'), $dislikes) . '. ' . '</span>'; } $pending = wppa_pendrat_get($id); if ($pending) { echo '<span style="color:orange" >' . sprintf(__('%d pending votes.', 'wp-photo-album-plus'), $pending) . ' ' . '</span>'; } // Views if (wppa_switch('track_viewcounts')) { echo __('Views', 'wp-photo-album-plus') . ': ' . $views . '. '; } // Clicks if (wppa_switch('track_clickcounts')) { echo __('Clicks', 'wp-photo-album-plus') . ': ' . $clicks . '. '; } // Status echo '<br />' . __('Status:', 'wp-photo-album-plus') . ' '; if (current_user_can('wppa_admin') || current_user_can('wppa_moderate')) { if (wppa_switch('ext_status_restricted') && !wppa_user_is('administrator')) { $dis = ' disabled="disabled"'; } else { $dis = ''; } $sel = ' selected="selected"'; echo '<select' . ' id="status-' . $id . '"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'status\', this ); wppaPhotoStatusChange( ' . $id . ' );"' . ' >' . '<option value="pending"' . ($status == 'pending' ? $sel : '') . ' >' . __('Pending', 'wp-photo-album-plus') . '</option>' . '<option value="publish"' . ($status == 'publish' ? $sel : '') . ' >' . __('Publish', 'wp-photo-album-plus') . '</option>' . '<option value="featured"' . ($status == 'featured' ? $sel : '') . $dis . ' >' . __('Featured', 'wp-photo-album-plus') . '</option>' . '<option value="gold"' . ($status == 'gold' ? $sel : '') . $dis . ' >' . __('Gold', 'wp-photo-album-plus') . '</option>' . '<option value="silver"' . ($status == 'silver' ? $sel : '') . $dis . ' >' . __('Silver', 'wp-photo-album-plus') . '</option>' . '<option value="bronze"' . ($status == 'bronze' ? $sel : '') . $dis . ' >' . __('Bronze', 'wp-photo-album-plus') . '</option>' . '<option value="scheduled"' . ($status == 'scheduled' ? $sel : '') . $dis . ' >' . __('Scheduled', 'wp-photo-album-plus') . '</option>' . '<option value="private"' . ($status == 'private' ? $sel : '') . $dis . ' >' . __('Private', 'wp-photo-album-plus') . '</option>' . '</select>' . wppa_get_date_time_select_html('photo', $id, true); } else { echo '<input' . ' type="hidden"' . ' id="status-' . $id . '"' . ' value="' . $status . '"' . ' />'; if ($status == 'pending') { _e('Pending', 'wp-photo-album-plus'); } elseif ($status == 'publish') { _e('Publish', 'wp-photo-album-plus'); } elseif ($status == 'featured') { _e('Featured', 'wp-photo-album-plus'); } elseif ($status == 'gold') { _e('Gold', 'wp-photo-album-plus'); } elseif ($status == 'silver') { _e('Silver', 'wp-photo-album-plus'); } elseif ($status == 'bronze') { _e('Bronze', 'wp-photo-album-plus'); } elseif ($status == 'scheduled') { _e('Scheduled', 'wp-photo-album-plus'); } elseif ($status == 'private') { _e('Private', 'wp-photo-album-plus'); } echo wppa_get_date_time_select_html('photo', $id, false) . '<span id="psdesc-' . $id . '" class="description" style="display:none;" >' . __('Note: Featured photos should have a descriptive name; a name a search engine will look for!', 'wp-photo-album-plus') . '</span>'; } echo ' '; // Update status field echo __('Remark:', 'wp-photo-album-plus') . ' ' . '<span' . ' id="photostatus-' . $id . '"' . ' style="font-weight:bold;color:#00AA00;"' . ' >' . ($is_video ? sprintf(__('Video %s is not modified yet', 'wp-photo-album-plus'), $id) : sprintf(__('Photo %s is not modified yet', 'wp-photo-album-plus'), $id)) . '</span>'; // New Line echo '<br />'; // --- Available files --- echo __('Available files:', 'wp-photo-album-plus') . ' '; // Source echo __('Source file:', 'wp-photo-album-plus') . ' '; $sp = wppa_get_source_path($id); if (is_file($sp)) { $ima = getimagesize($sp); echo $ima['0'] . ' x ' . $ima['1'] . ' px, ' . wppa_get_filesize($sp) . '. '; } else { echo __('Unavailable', 'wp-photo-album-plus') . '. '; } // Display echo ($is_video || $has_audio ? __('Poster file:', 'wp-photo-album-plus') : __('Display file:', 'wp-photo-album-plus')) . ' '; $dp = wppa_fix_poster_ext(wppa_get_photo_path($id), $id); if (is_file($dp)) { echo floor(wppa_get_photox($id)) . ' x ' . floor(wppa_get_photoy($id)) . ' px, ' . wppa_get_filesize($dp) . '. '; } else { echo '<span style="color:red;" >' . __('Unavailable', 'wp-photo-album-plus') . '. ' . '</span>'; } // Thumbnail if (!$is_video) { echo __('Thumbnail file:', 'wp-photo-album-plus') . ' '; $tp = wppa_fix_poster_ext(wppa_get_thumb_path($id), $id); if (is_file($tp)) { echo floor(wppa_get_thumbx($id)) . ' x ' . floor(wppa_get_thumby($id)) . ' px, ' . wppa_get_filesize($tp) . '. '; } else { echo '<span style="color:red;" >' . __('Unavailable', 'wp-photo-album-plus') . '. ' . '</span>'; } } // New line echo '<br />'; // Video if ($b_is_video) { echo __('Video size:', 'wp-photo-album-plus') . ' ' . __('Width:', 'wp-photo-album-plus') . '<input' . ' style="width:50px;margin:0 4px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'videox\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'videox\', this )"' . ' value="' . $videox . '"' . ' />' . sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_width')) . __('Height:', 'wp-photo-album-plus') . '<input' . ' style="width:50px;margin:0 4px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'videoy\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'videoy\', this )"' . ' value="' . $videoy . '"' . ' />' . sprintf(__('pix, (0=default:%s)', 'wp-photo-album-plus'), wppa_opt('video_height')) . ' ' . __('Formats:', 'wp-photo-album-plus') . ' '; $c = 0; foreach ($is_video as $fmt) { echo $fmt . ' ' . __('Filesize:', 'wp-photo-album-plus') . ' ' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($id))); $c++; if ($c == count($is_video)) { echo '. '; } else { echo ', '; } } } // Audio if ($b_has_audio) { echo __('Formats:', 'wp-photo-album-plus') . ' '; $c = 0; foreach ($has_audio as $fmt) { echo $fmt . ' ' . __('Filesize:', 'wp-photo-album-plus') . ' ' . wppa_get_filesize(str_replace('xxx', $fmt, wppa_get_photo_path($id))); $c++; if ($c == count($is_video)) { echo '. '; } else { echo ', '; } } } echo '</td>' . '</tr>' . '</tbody>' . '</table>'; echo "\n" . '<!-- Section 2 -->'; if (wppa_switch('enable_stereo') && !$is_multi || (!$is_multi || is_file(wppa_fix_poster_ext(wppa_get_photo_path($id), $id)))) { echo '<table' . ' class="wppa-table wppa-photo-table"' . ' style="width:100%;"' . ' >' . '<tbody>' . '<tr>' . '<td>'; // Stereo if (wppa_switch('enable_stereo') && !$is_multi) { echo __('Stereophoto:', 'wp-photo-album-plus') . ' ' . '<select' . ' id="stereo-' . $id . '"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'stereo\', this )"' . ' >' . '<option value="0"' . ($stereo == '0' ? ' selected="selected"' : '') . ' >' . __('no stereo image or ready anaglyph', 'wp-photo-album-plus') . '</option>' . '<option value="1"' . ($stereo == '1' ? ' selected="selected"' : '') . ' >' . __('Left - right stereo image', 'wp-photo-album-plus') . '</option>' . '<option value="-1"' . ($stereo == '-1' ? ' selected="selected"' : '') . ' >' . __('Right - left stereo image', 'wp-photo-album-plus') . '</option>' . '</select>' . ' '; __('Images:', 'wp-photo-album-plus') . ' '; $files = glob(WPPA_UPLOAD_PATH . '/stereo/' . $id . '-*.*'); $c = 0; if (!empty($files)) { sort($files); foreach ($files as $file) { echo '<a href="' . str_replace(WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $file) . '" target="_blank" >' . basename($file) . '</a>'; $c++; if ($c == count($files)) { echo '. '; } else { echo ', '; } } } } // Watermark if (!$is_multi || is_file(wppa_fix_poster_ext(wppa_get_photo_path($id), $id))) { echo __('Watermark:', 'wp-photo-album-plus') . ' '; if (wppa_switch('watermark_on')) { $user = wppa_get_user(); if (wppa_switch('watermark_user') || current_user_can('wppa_settings')) { echo '<select' . ' id="wmfsel_' . $id . '"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'wppa_watermark_file_' . $user . '\', this );"' . ' >' . wppa_watermark_file_select() . '</select>' . __('Pos:', 'wp-photo-album-plus') . ' ' . '<select' . ' id="wmpsel_' . $id . '"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'wppa_watermark_pos_' . $user . '\', this );"' . ' >' . wppa_watermark_pos_select() . '</select>' . '<input' . ' type="button"' . ' class="button-secundary"' . ' value="' . esc_attr(__('Apply watermark', 'wp-photo-album-plus')) . '"' . ' onclick="wppaTryWatermark( ' . $id . ' )"' . ' />'; } else { echo __('File:', 'wp-photo-album-plus') . ' ' . __($wmfile, 'wp-photo-album-plus') . ' '; if ($wmfile != '--- none ---') { echo __('Pos:', 'wp-photo-album-plus') . ' ' . $wmpos; } } echo '<img' . ' id="wppa-water-spin-' . $id . '"' . ' src="' . wppa_get_imgdir() . 'spinner.gif' . '"' . ' alt="Spin"' . ' style="visibility:hidden"' . ' />'; } else { echo __('Not configured', 'wp-photo-album-plus'); } echo ' '; } echo '</td>' . '</tr>' . '</tbody>' . '</table>'; } echo "\n" . '<!-- Section 3 -->' . '<table' . ' class="wppa-table wppa-photo-table"' . ' style="width:100%;"' . ' >' . '<tbody>' . '<tr>' . '<td>'; // --- Actions --- // Rotate if (!$b_is_video) { echo '<input' . ' type="button"' . ' onclick="wppaTryRotLeft( ' . $id . ' )"' . ' value="' . esc_attr(__('Rotate left', 'wp-photo-album-plus')) . '"' . ' />' . ' ' . '<input' . ' type="button"' . ' onclick="wppaTryRot180( ' . $id . ' )"' . ' value="' . esc_attr(__('Rotate 180°', 'wp-photo-album-plus')) . '"' . ' />' . ' ' . '<input' . ' type="button"' . ' onclick="wppaTryRotRight( ' . $id . ' )"' . ' value="' . esc_attr(__('Rotate right', 'wp-photo-album-plus')) . '"' . ' />' . ' ' . '<input' . ' type="button"' . ' onclick="wppaTryFlip( ' . $id . ' )"' . ' value="' . esc_attr(__('Flip', 'wp-photo-album-plus')) . '"' . ' />' . ' '; } // Remake displayfiles if (!$is_video) { echo '<input' . ' type="button"' . ' title="' . esc_attr(__('Remake display file and thumbnail file', 'wp-photo-album-plus')) . '"' . ' onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remake\', this, ' . (wppa('front_edit') ? 'false' : 'true') . ' )"' . ' value="' . esc_attr(__('Remake files', 'wp-photo-album-plus')) . '"' . ' />' . ' '; } // Remake thumbnail if (!$is_video) { echo '<input' . ' type="button"' . ' title=' . esc_attr(__('Remake thumbnail file', 'wp-photo-album-plus')) . '"' . ' onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remakethumb\', this, ' . (wppa('front_edit') ? 'false' : 'true') . ' )"' . ' value="' . esc_attr(__('Remake thumbnail file', 'wp-photo-album-plus')) . '"' . ' />' . ' '; } // Move/copy if (!$quick) { $max = wppa_opt('photo_admin_max_albums'); if (!$max || wppa_get_total_album_count() < $max) { // If not done yet, get the album options html with the current album excluded if (!isset($album_select[$album])) { $album_select[$album] = wppa_album_select_a(array('checkaccess' => true, 'path' => wppa_switch('hier_albsel'), 'exclude' => $album, 'selected' => '0', 'addpleaseselect' => true)); } echo __('Target album for copy/move:', 'wp-photo-album-plus') . '<select' . ' id="target-' . $id . '"' . ' >' . $album_select[$album] . '</select>'; } else { echo __('Target album for copy/move:', 'wp-photo-album-plus') . '<input' . ' id="target-' . $id . '"' . ' type="number"' . ' style="height:20px;"' . ' placeholder="' . __('Album id', 'wp-photo-album-plus') . '"' . ' />'; } echo ' '; echo '<input' . ' type="button"' . ' onclick="wppaTryMove( ' . $id . ', ' . $b_is_video . ' )"' . ' value="' . ($b_is_video ? $mvt : $mpt) . '"' . ' />' . ' ' . '<input' . ' type="button"' . ' onclick="wppaTryCopy( ' . $id . ', ' . $b_is_video . ' )"' . ' value="' . ($b_is_video ? $cvt : $cpt) . '"' . ' />' . ' '; } // Delete if (!wppa('front_edit')) { echo '<input' . ' type="button"' . ' style="color:red;"' . ' onclick="wppaTryDelete( ' . $id . ', ' . $b_is_video . ' )"' . ' value="' . ($b_is_video ? esc_attr(__('Delete video', 'wp-photo-album-plus')) : esc_attr(__('Delete photo', 'wp-photo-album-plus'))) . '"' . ' />' . ' '; } // Re-upload if (wppa_user_is('administrator') || !wppa_switch('reup_is_restricted')) { echo '<input' . ' type="button"' . ' onclick="jQuery( \'#re-up-' . $id . '\' ).css( \'display\', \'inline-block\' )"' . ' value="' . esc_attr(__('Re-upload file', 'wp-photo-album-plus')) . '"' . ' />' . '<div id="re-up-' . $id . '" style="display:none" >' . '<form' . ' id="wppa-re-up-form-' . $id . '"' . ' onsubmit="wppaReUpload( event, ' . $id . ', \'' . $filename . '\' )"' . ' >' . '<input' . ' type="file"' . ' id="wppa-re-up-file-' . $id . '"' . ' />' . '<input' . ' type="submit"' . ' id="wppa-re-up-butn-' . $id . '"' . ' value="' . esc_attr(__('Upload', 'wp-photo-album-plus')) . '"' . ' />' . '</form>' . '</div>'; } // Refresh /* if ( ! wppa( 'front_edit' ) ) { echo '<input' . ' type="button"' . ' onclick="wppaReload( \'#photo_' . $id . '\')"' . ' value="' . esc_attr( __( 'Refresh page', 'wp-photo-album-plus' ) ) . '"' . ' />'; } */ echo '</td>' . '</tr>' . '</tbody>' . '</table>'; echo "\n" . '<!-- Section 4 -->' . '<table' . ' class="wppa-table wppa-photo-table"' . ' style="width:100%;"' . ' >' . '<tbody>'; // Name echo '<tr>' . '<td>' . __('Photoname:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<input' . ' type="text"' . ' style="width:100%;"' . ' id="pname-' . $id . '"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'name\', this );"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'name\', this );"' . ' value="' . esc_attr(stripslashes($name)) . '"' . ' />' . '</td>' . '<td>' . '</td>' . '</tr>'; // Description if (!wppa_switch('desc_is_restricted') || wppa_user_is('administrator')) { echo '<tr>' . '<td>' . __('Description:', 'wp-photo-album-plus') . '</td>'; if (wppa_switch('use_wp_editor')) { $alfaid = wppa_alfa_id($id); echo '<td>'; wp_editor($description, 'wppaphotodesc' . $alfaid, array('wpautop' => true, 'media_buttons' => false, 'textarea_rows' => '6', 'tinymce' => true)); echo '</td>' . '<td>' . '<input' . ' type="button"' . ' class="button-secundary"' . ' value="' . esc_attr(__('Update Photo description', 'wp-photo-album-plus')) . '"' . ' onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'description\', document.getElementById( \'wppaphotodesc' . $alfaid . '\' ), false, \'' . $alfaid . '\' )"' . ' />' . '<img' . ' id="wppa-photo-spin-' . $id . '"' . ' src="' . wppa_get_imgdir() . 'spinner.gif"' . ' style="visibility:hidden"' . ' />' . '</td>'; } else { echo '<td>' . '<textarea' . ' style="width:100%;height:60px;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'description\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'description\', this )"' . ' >' . $description . '</textarea>' . '</td>' . '<td>' . '</td>'; } echo '</tr>'; } else { echo '<tr>' . '<td>' . __('Description:', 'wp-photo-album-plus') . '</td>' . '<td>' . $description . '</td>' . '<td>' . '</td>' . '</tr>'; } // Tags echo '<tr>' . '<td>' . __('Tags:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<input' . ' id="tags-' . $id . '"' . ' type="text"' . ' style="width:100%;"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'tags\', this )"' . ' value="' . $tags . '"' . ' />' . '<br />' . '<span class="description" >' . __('Separate tags with commas.', 'wp-photo-album-plus') . '</span>' . '</td>' . '<td>' . '<select' . ' onchange="wppaAddTag( this.value, \'tags-' . $id . '\' ); wppaAjaxUpdatePhoto( ' . $id . ', \'tags\', document.getElementById( \'tags-' . $id . '\' ) )"' . ' >'; $taglist = wppa_get_taglist(); if (is_array($taglist)) { echo '<option value="" >' . __('- select -', 'wp-photo-album-plus') . '</option>'; foreach ($taglist as $tag) { echo '<option value="' . $tag['tag'] . '" >' . $tag['tag'] . '</option>'; } } else { echo '<option value="0" >' . __('No tags yet', 'wp-photo-album-plus') . '</option>'; } echo '</select>' . '<br />' . '<span class="description" >' . __('Select to add', 'wp-photo-album-plus') . '</span>' . '</td>' . '</tr>'; // Custom if (wppa_switch('custom_fields')) { $custom = wppa_get_photo_item($photo['id'], 'custom'); if ($custom) { $custom_data = unserialize($custom); } else { $custom_data = array('', '', '', '', '', '', '', '', '', ''); } foreach (array_keys($custom_data) as $key) { if (wppa_opt('custom_caption_' . $key)) { echo '<tr>' . '<td>' . apply_filters('translate_text', wppa_opt('custom_caption_' . $key)) . '<small style="float:right" >' . '(w#cc' . $key . ')' . '</small>:' . '</td>' . '<td>' . '<input' . ' type="text"' . ' style="width:100%;"' . ' id="custom_' . $key . '-' . $id . '"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'custom_' . $key . '\', this );"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'custom_' . $key . '\', this );"' . ' value="' . esc_attr(stripslashes($custom_data[$key])) . '"' . '/>' . '</td>' . '<td>' . '<small>(w#cd' . $key . ')</small>' . '</td> ' . '</tr>'; } } } // -- Auto Page -- if (wppa_switch('auto_page') && (current_user_can('edit_posts') || current_user_can('edit_pages'))) { $appl = get_permalink(wppa_get_the_auto_page($id)); echo '<tr>' . '<td>' . __('Autopage Permalink:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<a href="' . $appl . '" target="_blank" >' . $appl . '</a>' . '</td>' . '<td>' . '</td>' . '</tr>'; } // -- Link url -- if (!wppa_switch('link_is_restricted') || wppa_user_is('administrator')) { echo '<tr>' . '<td>' . __('Photo specific link url:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<input' . ' type="text"' . ' id="pislink-' . $id . '"' . ' style="width:100%;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'linkurl\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linkurl\', this )"' . ' value="' . esc_attr($linkurl) . '"' . ' />' . '</td>' . '<td>' . '<select' . ' id="pistarget-' . $id . '"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linktarget\', this )"' . ' >' . '<option' . ' value="_self"' . ($linktarget == '_self' ? ' selected="selected"' : '') . ' >' . __('Same tab', 'wp-photo-album-plus') . '</option>' . '<option' . ' value="_blank"' . ($linktarget == '_blank' ? ' selected="selected"' : '') . ' >' . __('New tab', 'wp-photo-album-plus') . '</option>' . '</select>' . '<input' . ' type="button"' . ' onclick="window.open( jQuery( \'#pislink-' . $id . '\' ).val(), jQuery( \'#pistarget-' . $id . '\' ).val() );"' . ' value="' . __('Tryit!', 'wp-photo-album-plus') . '"' . ' />' . '</td>' . '</tr>'; // -- Link title -- echo '<tr>' . '<td>' . __('Photo specific link title:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<input' . ' type="text"' . ' style="width:100%;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'linktitle\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linktitle\', this )"' . ' value="' . esc_attr($linktitle) . '"' . ' />'; if (current_user_can('wppa_settings')) { echo '<br />' . '<span class="description" >' . __('If you want this link to be used, check \'PS Overrule\' checkbox in table VI.', 'wp-photo-album-plus') . '</span>'; } echo '</td>' . '<td>' . '</td>' . '</tr>'; } // -- Custom ALT field -- if (wppa_opt('alt_type') == 'custom') { echo '<tr>' . '<td>' . __('HTML Alt attribute:', 'wp-photo-album-plus') . '</td>' . '<td>' . '<input' . ' type="text"' . ' style="width:100%;"' . ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'alt\', this )"' . ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'alt\', this )"' . ' value="' . esc_attr($alt) . '"' . ' />' . '</td>' . '<td>' . '</td>' . '</tr>'; } // If Quick, skip the following items for speed and space if (!$quick) { // Shortcode if (current_user_can('edit_posts') || current_user_can('edit_pages')) { echo '<tr>' . '<td>' . __('Single image shortcode', 'wp-photo-album-plus') . ':' . '</td>' . '<td>' . '[wppa type="photo" photo="' . $id . '"][/wppa]' . '</td>' . '<td>' . '<small>' . sprintf(__('See %s The documentation %s for more shortcode options.', 'wp-photo-album-plus'), '<a href="http://wppa.nl/shortcode-reference/" target="_blank" >', '</a>') . '</small>' . '</td>' . '</tr>'; } // Source permalink if (is_file(wppa_get_source_path($id))) { $spl = wppa_get_source_pl($id); echo '<tr>' . '<td>' . __('Permalink', 'wp-photo-album-plus') . ':' . '</td>' . '<td>' . '<a href="' . $spl . '" target="_blank" >' . $spl . '</a>' . '</td>' . '<td>' . '</td>' . '</tr>'; } // High resolution url $hru = wppa_get_hires_url($id); echo '<tr>' . '<td>' . __('Hi resolution url', 'wp-photo-album-plus') . ':' . '</td>' . '<td>' . '<a href="' . $hru . '" target="_blank" >' . $hru . '</a>' . '</td>' . '<td>' . '</td>' . '</tr>'; // Display file if (is_file(wppa_fix_poster_ext(wppa_get_photo_path($id), $id))) { $lru = wppa_fix_poster_ext(wppa_get_lores_url($id), $id); echo '<tr>' . '<td>' . __('Display file url', 'wp-photo-album-plus') . ':' . '</td>' . '<td>' . '<a href="' . $lru . '" target="_blank" >' . $lru . '</a>' . '</td>' . '<td>' . '</td>' . '</tr>'; } // Thumbnail if (is_file(wppa_fix_poster_ext(wppa_get_thumb_path($id), $id))) { $tnu = wppa_fix_poster_ext(wppa_get_tnres_url($id), $id); echo '<tr>' . '<td>' . __('Thumbnail file url', 'wp-photo-album-plus') . ':' . '</td>' . '<td>' . '<a href="' . $tnu . '" target="_blank" >' . $tnu . '</a>' . '</td>' . '<td>' . '</td>' . '</tr>'; } } echo '</tbody>' . '</table>'; echo "\n" . '<!-- Section 5 -->'; // Comments $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s ORDER BY `timestamp` DESC", $id), ARRAY_A); if ($comments && !$quick) { echo '<table' . ' class="wppa-table wppa-photo-table"' . ' style="width:100%;"' . ' >' . '<thead>' . '<tr style="font-weight:bold;" >' . '<td style="padding:0 4px;" >#</td>' . '<td style="padding:0 4px;" >User</td>' . '<td style="padding:0 4px;" >Time since</td>' . '<td style="padding:0 4px;" >Status</td>' . '<td style="padding:0 4px;" >Comment</td>' . '</tr>' . '</thead>' . '<tbody>'; foreach ($comments as $comment) { echo ' <tr id="com-tr-' . $comment['id'] . '" > <td style="padding:0 4px;" >' . $comment['id'] . '</td> <td style="padding:0 4px;" >' . $comment['user'] . '</td> <td style="padding:0 4px;" >' . wppa_get_time_since($comment['timestamp']) . '</td>'; if (current_user_can('wppa_comments') || current_user_can('wppa_moderate') || wppa_get_user() == $photo['owner'] && wppa_switch('owner_moderate_comment')) { $p = $comment['status'] == 'pending' ? 'selected="selected" ' : ''; $a = $comment['status'] == 'approved' ? 'selected="selected" ' : ''; $s = $comment['status'] == 'spam' ? 'selected="selected" ' : ''; $t = $comment['status'] == 'trash' ? 'selected="selected" ' : ''; echo '<td style="padding:0 4px;" >' . '<select' . ' id="com-stat-' . $comment['id'] . '"' . ' style=""' . ' onchange="wppaAjaxUpdateCommentStatus( ' . $id . ', ' . $comment['id'] . ', this.value );wppaSetComBgCol(' . $comment['id'] . ');"' . ' >' . '<option value="pending" ' . $p . '>' . __('Pending', 'wp-photo-album-plus') . '</option>' . '<option value="approved" ' . $a . '>' . __('Approved', 'wp-photo-album-plus') . '</option>' . '<option value="spam" ' . $s . '>' . __('Spam', 'wp-photo-album-plus') . '</option>' . '<option value="trash" ' . $t . '>' . __('Trash', 'wp-photo-album-plus') . '</option>' . '</select >' . '</td>'; } else { echo '<td style="padding:0 4px;" >'; if ($comment['status'] == 'pending') { _e('Pending', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'approved') { _e('Approved', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'spam') { _e('Spam', 'wp-photo-album-plus'); } elseif ($comment['status'] == 'trash') { _e('Trash', 'wp-photo-album-plus'); } echo '</td>'; } echo '<td style="padding:0 4px;" >' . $comment['comment'] . '</td> </tr>' . '<script>wppaSetComBgCol(' . $comment['id'] . ')</script>'; } echo '</tbody>' . '</table>'; } echo '<script>wppaPhotoStatusChange( ' . $id . ' )</script>' . '<div style="clear:both;"></div>' . '</div>' . '<div style="clear:both;margin-top:7px;"></div>'; } /* foreach photo */ wppa_admin_page_links($page, $pagesize, $count, $link); } /* photos not empty */ }
function wppa_container($action) { global $wppa_version; // The theme version ( wppa_theme.php ) global $wppa_microtime; global $wppa_microtime_cum; global $wppa_err_displayed; global $wppa_loadtime; global $wppa_initruntimetime; static $wppa_numqueries; static $auto; global $blog_id; if (is_feed()) { return; } // Need no container in RSS feeds if ($action == 'open') { $wppa_numqueries = get_num_queries(); // Open the container if (!wppa('ajax')) { // A modal container wppa_out('<div' . ' id="wppa-modal-container-' . wppa('mocc') . '"' . ' style="position:relative;z-index:100000;"' . ' >' . '</div>'); // If static maximum in responsive theme, add wrapper wppa_container_wrapper('open'); wppa_out('<div' . ' id="wppa-container-' . wppa('mocc') . '"' . ' style="' . wppa_get_container_style() . '"' . ' class="' . 'wppa-container' . ' ' . 'wppa-container-' . wppa('mocc') . ' ' . 'wppa-rev-' . wppa('revno') . ' ' . 'wppa-prevrev-' . wppa_opt('prevrev') . ' ' . 'wppa-theme-' . $wppa_version . ' ' . 'wppa-api-' . wppa('api_version') . '"' . ' >'); } // Spinner for Ajax if (wppa_switch('allow_ajax')) { if (!wppa_in_widget()) { wppa_out('<img' . ' id="wppa-ajax-spin-' . wppa('mocc') . '"' . ' src="' . wppa_get_imgdir() . 'loader.gif"' . ' alt="spinner"' . ' style="' . 'box-shadow:none;' . 'z-index:1010;' . 'position:fixed;' . 'top:50%;' . 'margin-top:-32px;' . 'left:50%;' . 'margin-left:-32px;' . 'display:none;' . '"' . ' />'); } } // Start timer if in debug mode if (wppa('debug')) { $wppa_microtime = -microtime(true); } if (wppa('mocc') == '1') { wppa_dbg_msg('Plugin load time :' . substr($wppa_loadtime, 0, 5) . 's.'); wppa_dbg_msg('Init runtime time :' . substr($wppa_initruntimetime, 0, 5) . 's.'); wppa_dbg_msg('Num queries before wppa :' . get_num_queries()); } /* Check if wppa.js and jQuery are present */ if (!$wppa_err_displayed && (WPPA_DEBUG || wppa_get_get('debug') || WP_DEBUG) && !wppa_switch('defer_javascript')) { wppa_out('<script type="text/javascript">/* <![CDATA[ */'); wppa_out("if ( typeof( _wppaSlides ) == 'undefined' ) " . "alert( 'There is a problem with your theme. The file wppa.js is not loaded when it is expected ( Errloc = wppa_container ).' );"); wppa_out("if ( typeof( jQuery ) == 'undefined' ) " . "alert( 'There is a problem with your theme. The jQuery library is not loaded when it is expected ( Errloc = wppa_container ).' );"); wppa_out("/* ]]> */</script>"); $wppa_err_displayed = true; } /* Check if init is properly done */ if (!wppa_opt('fullsize')) { wppa_out('<script type="text/javascript">/* <![CDATA[ */'); wppa_out("alert( 'The initialisation of wppa+ is not complete yet. " . "You will probably see division by zero errors. " . "Please run Photo Albums -> Settings admin page Table VIII-A1. ( Errloc = wppa_container ).' );"); wppa_out("/* ]]> */</script>"); } // Nonce field check for rating security if (wppa('mocc') == '1') { if (wppa_get_get('rating')) { $nonce = wppa_get_get('nonce'); $ok = wp_verify_nonce($nonce, 'wppa-check'); if ($ok) { wppa_dbg_msg('Rating nonce ok'); if (!is_user_logged_in()) { sleep(2); } } else { die('<b>' . __('ERROR: Illegal attempt to enter a rating.', 'wp-photo-album-plus') . '</b>'); } } } // Nonce field check for comment security if (wppa('mocc') == '1') { if (wppa_get_post('comment')) { $nonce = wppa_get_post('nonce'); $ok = wp_verify_nonce($nonce, 'wppa-check'); if ($ok) { wppa_dbg_msg('Comment nonce ok'); if (!is_user_logged_in()) { sleep(2); } } else { die('<b>' . __('ERROR: Illegal attempt to enter a comment.', 'wp-photo-album-plus') . '</b>'); } } } wppa_out(wppa_nonce_field('wppa-check', 'wppa-nonce', false, false)); if (wppa_page('oneofone')) { wppa('portrait_only', true); } wppa('alt', 'alt'); // Javascript occurrence dependant stuff wppa_add_js_page_data("\n" . '<script type="text/javascript">'); // wppa( 'auto_colwidth' ) is set by the filter or by wppa_albums in case called directly // wppa_opt( 'colwidth' ) is the option setting // script or call has precedence over option setting // so: if set by script or call: auto, else if set by option: auto $auto = false; $contw = wppa_get_container_width(); if (wppa('auto_colwidth')) { $auto = true; } elseif (wppa_opt('colwidth') == 'auto') { $auto = true; } elseif ($contw > 0 && $contw <= 1.0) { $auto = true; } // If size explitely given and not a fraction, it is static size if (wppa_is_int(wppa('fullsize')) && wppa('fullsize') > '1') { $auto = false; } // If an ajax request, the (start)size is given. To prevent loosing responsiveness, look at resp arg if (wppa('ajax') && isset($_REQUEST['resp'])) { $auto = true; } if ($auto) { wppa_add_js_page_data("\n" . 'wppaAutoColumnWidth[' . wppa('mocc') . '] = true;'); if ($contw > 0 && $contw <= 1.0) { wppa_add_js_page_data("\n" . 'wppaAutoColumnFrac[' . wppa('mocc') . '] = ' . $contw . ';'); } else { wppa_add_js_page_data("\n" . 'wppaAutoColumnFrac[' . wppa('mocc') . '] = 1.0;'); } wppa_add_js_page_data("\n" . 'wppaColWidth[' . wppa('mocc') . '] = 0;'); } else { wppa_add_js_page_data("\n" . 'wppaAutoColumnWidth[' . wppa('mocc') . '] = false;'); wppa_add_js_page_data("\n" . 'wppaColWidth[' . wppa('mocc') . '] = ' . wppa_get_container_width() . ';'); } wppa_add_js_page_data("\n" . 'wppaTopMoc = ' . wppa('mocc') . ';'); if (wppa_opt('thumbtype') == 'masonry-v') { wppa_add_js_page_data("\n" . 'wppaMasonryCols[' . wppa('mocc') . '] = ' . ceil(wppa_get_container_width() / wppa_opt('thumbsize')) . ';'); } else { wppa_add_js_page_data("\n" . 'wppaMasonryCols[' . wppa('mocc') . '] = 0;'); } if (wppa('src_script')) { wppa_add_js_page_data("\n" . wppa('src_script')); } // Aspect ratio and fullsize if (wppa_in_widget() == 'ss' && is_numeric(wppa('in_widget_frame_width')) && wppa('in_widget_frame_width') > '0') { $asp = wppa('in_widget_frame_height') / wppa('in_widget_frame_width'); $fls = wppa('in_widget_frame_width'); } else { $asp = wppa_opt('maxheight') / wppa_opt('fullsize'); $fls = wppa_opt('fullsize'); } $asp = str_replace(',', '.', $asp); // Fix decimal comma to point wppa_add_js_page_data("\n" . 'wppaAspectRatio[' . wppa('mocc') . '] = ' . $asp . ';'); wppa_add_js_page_data("\n" . 'wppaFullSize[' . wppa('mocc') . '] = ' . $fls . ';'); // last minute change: fullvalign with border needs a height correction in slideframe if (wppa_opt('fullimage_border_width') != '' && !wppa_in_widget()) { $delta = (1 + wppa_opt('fullimage_border_width')) * 2; } else { $delta = 0; } wppa_add_js_page_data("\n" . 'wppaFullFrameDelta[' . wppa('mocc') . '] = ' . $delta . ';'); // last minute change: script %%size != default colwidth $temp = wppa_get_container_width() - (2 * 6 + 2 * 36 + 2 * wppa_opt('bwidth')); if (wppa_in_widget()) { $temp = wppa_get_container_width() - (2 * 6 + 2 * 18 + 2 * wppa_opt('bwidth')); } wppa_add_js_page_data("\n" . 'wppaFilmStripLength[' . wppa('mocc') . '] = ' . $temp . ';'); // last minute change: filmstrip sizes and related stuff. In widget: half size. $temp = wppa_opt('film_thumbsize') + wppa_opt('tn_margin'); if (wppa_in_widget()) { $temp /= 2; } wppa_add_js_page_data("\n" . 'wppaThumbnailPitch[' . wppa('mocc') . '] = ' . $temp . ';'); $temp = wppa_opt('tn_margin') / 2; if (wppa_in_widget()) { $temp /= 2; } wppa_add_js_page_data("\n" . 'wppaFilmStripMargin[' . wppa('mocc') . '] = ' . $temp . ';'); $temp = 2 * 6 + 2 * 42 + 2 * wppa_opt('bwidth'); if (wppa_in_widget()) { $temp = 2 * 6 + 2 * 21 + 2 * wppa_opt('bwidth'); } wppa_add_js_page_data("\n" . 'wppaFilmStripAreaDelta[' . wppa('mocc') . '] = ' . $temp . ';'); if (wppa_in_widget()) { wppa_add_js_page_data("\n" . 'wppaIsMini[' . wppa('mocc') . '] = true;'); } else { wppa_add_js_page_data("\n" . 'wppaIsMini[' . wppa('mocc') . '] = false;'); } $target = false; if (wppa_in_widget() == 'ss' && wppa_switch('sswidget_blank')) { $target = true; } if (!wppa_in_widget() && wppa_switch('slideshow_blank')) { $target = true; } if ($target) { wppa_add_js_page_data("\n" . 'wppaSlideBlank[' . wppa('mocc') . '] = true;'); } else { wppa_add_js_page_data("\n" . 'wppaSlideBlank[' . wppa('mocc') . '] = false;'); } wppa_add_js_page_data("\n" . 'wppaLightBox[' . wppa('mocc') . '] = "xxx";'); // If this occur is a slideshow, determine if its link is to lightbox. This may differ between normal slideshow or ss widget $is_slphoto = wppa('is_slide') && wppa('start_photo') && wppa('is_single'); if ('ss' == wppa_in_widget() || wppa_page('slide') || $is_slphoto) { $ss_linktype = 'ss' == wppa_in_widget() ? wppa_opt('slideonly_widget_linktype') : wppa_opt('slideshow_linktype'); switch ($ss_linktype) { case 'file': $lbkey = 'file'; // gives anchor tag with rel="file" break; case 'lightbox': case 'lightboxsingle': $lbkey = wppa_opt('lightbox_name'); // gives anchor tag with rel="lightbox" or the like break; default: $lbkey = ''; // results in omitting the anchor tag break; } wppa_add_js_page_data("\n" . 'wppaLightBox[' . wppa('mocc') . '] = "' . $lbkey . '";' . "\n" . 'wppaConsoleLog("mocc:' . wppa('mocc') . ' lbkey:"+wppaLightBox[' . wppa('mocc') . '] );'); wppa_add_js_page_data("\n" . 'wppaLightboxSingle[' . wppa('mocc') . '] = ' . (wppa_opt('slideshow_linktype') == 'lightboxsingle' ? 'true' : 'false') . ';'); } wppa_add_js_page_data("\n" . '</script>'); } elseif ($action == 'close') { if (wppa_page('oneofone')) { wppa('portrait_only', false); } if (!wppa_in_widget()) { wppa_out('<div style="clear:both;"></div>'); } // Add diagnostic <p> if debug is 1 if (wppa('debug') == '1' && wppa('mocc') == '1') { wppa_out('<p id="wppa-debug-' . wppa('mocc') . '" style="font-size:9px; color:#070; line-size:12px;" ></p>'); } // Init lightbox intermediate to facillitate premature clicks to lightbox when not yet document.complete wppa_out("\n" . '<script type="text/javascript" >if ( typeof(wppaInitOverlay) != "undefined" ) { wppaInitOverlay(); }</script>'); if (!wppa('ajax')) { wppa_out('<div id="wppa-container-' . wppa('mocc') . '-end" ></div>'); wppa_out('</div>'); // Static max in responsive? close wrapper wppa_container_wrapper('close'); } if (wppa('debug')) { $laptim = $wppa_microtime + microtime(true); $wppa_numqueries = get_num_queries() - $wppa_numqueries; if (!is_numeric($wppa_microtime_cum)) { $wppa_mcrotime_cum = '0'; } $wppa_microtime_cum += $laptim; wppa_dbg_msg('Time elapsed occ ' . wppa('mocc') . ':' . substr($laptim, 0, 5) . 's. Tot:' . substr($wppa_microtime_cum, 0, 5) . 's.'); wppa_dbg_msg('Number of queries occ ' . wppa('mocc') . ':' . $wppa_numqueries, 'green'); } } else { wppa_out("\n" . '<span style="color:red;">Error, wppa_container() called with wrong argument: ' . $action . '. Possible values: \'open\' or \'close\'</span>'); } }
function wppa_breadcrumb($opt = '') { global $wpdb; global $wppa_session; // See if they need us // Check Table II-A1 a and b if ($opt == 'optional') { $pid = wppa_get_the_page_id(); $type = $wpdb->get_var($wpdb->prepare("SELECT `post_type` FROM `" . $wpdb->posts . "` WHERE `ID` = %s", $pid)); wppa_dbg_q('Q-bc1'); if ($type == 'post' && !wppa_switch('show_bread_posts')) { return; // Nothing to do here } if ($type != 'post' && !wppa_switch('show_bread_pages')) { return; // Nothing to do here } } // Check special cases if (wppa('is_single')) { return; } // A single image slideshow needs no navigation if (wppa_page('oneofone')) { return; } // Never at a single image page if (wppa('is_slideonly')) { return; } // Not when slideonly if (wppa_in_widget()) { return; } // Not in a widget if (is_feed()) { return; } // Not in a feed $thumbhref = ''; // Any special selection has its own switch if (wppa('is_topten') && !wppa_switch('bc_on_topten')) { return; } if (wppa('is_lasten') && !wppa_switch('bc_on_lasten')) { return; } if (wppa('is_comten') && !wppa_switch('bc_on_comten')) { return; } if (wppa('is_featen') && !wppa_switch('bc_on_featen')) { return; } if (wppa('is_related') && !wppa_switch('bc_on_related')) { return; } if (wppa('is_tag') && !wppa_switch('bc_on_tag')) { return; } if (wppa('src') && !wppa_switch('bc_on_search')) { return; } // Get the album number $alb = wppa_is_int(wppa('start_album')) ? wppa('start_album') : '0'; // A single album or all ( all = 0 here ) $is_albenum = strlen(wppa('start_album')) > '0' && !wppa_is_int(wppa('start_album')); wppa_dbg_msg('alb=' . $alb . ', albenum=' . $is_albenum, 'green'); $virtual = wppa_is_virtual() || wppa('last_albums'); if (wppa('last_albums')) { $alb = wppa('last_albums_parent'); } wppa_dbg_msg('alb=' . $alb . ', albenum=' . $is_albenum . ', l_a=' . wppa('last_albums') . ', l_a_p=' . wppa('last_albums_parent'), 'green'); // See if the album is a 'stand alone' album $separate = wppa_is_separate($alb); // See if the album links to slides in stead of thumbnails $slide = wppa_get_album_title_linktype($alb) == 'slide' ? '&wppa-slide' : ''; // See if we link to covers or to contents $to_cover = wppa_opt('thumbtype') == 'none' ? '1' : '0'; // Photo number? $photo = wppa('start_photo'); wppa_dbg_msg('pid=' . $pid . ', type=' . $type . ', alb=' . $alb . ', sep=' . $separate . ', slide=' . $slide . ', t_c=0, ph=' . $photo, 'green'); // Open the breadcrumb box wppa_out('<div' . ' id="wppa-bc-' . wppa('mocc') . '"' . ' class="wppa-nav wppa-box wppa-nav-text" ' . 'style="' . __wcs('wppa-nav') . __wcs('wppa-box') . __wcs('wppa-nav-text') . '" >'); // Do we need Home? if (wppa_switch('show_home')) { $value = __(wppa_opt('home_text')); $href = wppa_dbg_url(get_bloginfo('url')); $title = get_bloginfo('title'); wppa_bcitem($value, $href, $title, 'b1'); } // Page ( grand )parents ? if ($type == 'page' && wppa_switch('show_page')) { wppa_crumb_page_ancestors($pid); } // Do the post/page if (wppa_switch('show_page')) { $value = __(stripslashes($wpdb->get_var($wpdb->prepare("SELECT `post_title` FROM `" . $wpdb->posts . "` WHERE `post_status` = 'publish' AND `ID` = %s LIMIT 0,1", $pid)))); wppa_dbg_q('Q-bc2'); $href = $alb || $virtual || $is_albenum ? wppa_get_permalink($pid, true) : ''; $title = $type == 'post' ? __('Post:', 'wp-photo-album-plus') . ' ' . $value : __('Page:', 'wp-photo-album-plus') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b3'); } // The album ( grand ) parents if not separate // if ( ! $separate ) { wppa_crumb_ancestors($alb, $to_cover); // } // The album and optional placeholder for photo // Supersearch ? if (wppa('supersearch')) { $value = ' '; $ss_data = explode(',', wppa('supersearch')); switch ($ss_data['0']) { case 'a': $value .= ' ' . __('Albums', 'wp-photo-album-plus'); switch ($ss_data['1']) { case 'c': $value .= ' ' . __('with category:', 'wp-photo-album-plus'); break; case 'n': $value .= ' ' . __('with name:', 'wp-photo-album-plus'); break; case 't': $value .= ' ' . __('with words:', 'wp-photo-album-plus'); break; } $value .= ' <b>' . str_replace('.', '</b> ' . __('and', 'wp-photo-album-plus') . ' <b>', $ss_data['3']) . '</b>'; break; case 'p': $value .= ' ' . __('Photos', 'wp-photo-album-plus'); switch ($ss_data['1']) { case 'g': $value .= ' ' . __('with tag:', 'wp-photo-album-plus') . ' <b>' . str_replace('.', '</b> ' . __('and', 'wp-photo-album-plus') . ' <b>', $ss_data['3']) . '</b>'; break; case 'n': $value .= ' ' . __('with name:', 'wp-photo-album-plus') . ' <b>' . $ss_data['3'] . '</b>'; break; case 't': $ss_data['3'] = str_replace('...', '***', $ss_data['3']); $value .= ' ' . __('with words:', 'wp-photo-album-plus') . ' <b>' . str_replace('.', '</b> ' . __('and', 'wp-photo-album-plus') . ' <b>', $ss_data['3']) . '</b>'; $value = str_replace('***', '...', $value); break; case 'o': $value .= ' ' . __('of owner:', 'wp-photo-album-plus') . ' <b>' . $ss_data['3'] . '</b>'; break; case 'i': $label = $wpdb->get_var($wpdb->prepare("SELECT `description` FROM `" . WPPA_IPTC . "` WHERE `tag` = %s AND `photo` = '0'", str_replace('H', '#', $ss_data['2']))); $label = trim($label, ':'); $value .= ' ' . __('with iptc tag:', 'wp-photo-album-plus') . ' <b>' . __($label, 'wp-photo-album-plus') . '</b> ' . __('with content:', 'wp-photo-album-plus') . ' <b>' . $ss_data['3'] . '</b>'; break; case 'e': $label = $wpdb->get_var($wpdb->prepare("SELECT `description` FROM `" . WPPA_EXIF . "` WHERE `tag` = %s AND `photo` = '0'", str_replace('H', '#', $ss_data['2']))); $label = trim($label, ':'); $value .= ' ' . __('with exif tag:', 'wp-photo-album-plus') . ' <b>' . __($label, 'wp-photo-album-plus') . '</b> ' . __('with content:', 'wp-photo-album-plus') . ' <b>' . $ss_data['3'] . '</b>'; break; } break; } if (wppa('is_slide')) { $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-supersearch=' . stripslashes(wppa('supersearch')); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-supersearch=' . stripslashes(wppa('supersearch')); $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax); } $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('src') && !wppa('is_related')) { $searchroot = $wppa_session['search_root']; if (!$searchroot) { $searchroot = '-2'; // To get 'All albums' } $albtxt = wppa('is_rootsearch') ? ' <span style="cursor:pointer;" title="' . esc_attr(sprintf(__('Searchresults from album %s and its subalbums', 'wp-photo-album-plus'), wppa_display_root($searchroot))) . '">*</span> ' : ''; if (wppa('is_slide')) { $value = __('Searchstring:', 'wp-photo-album-plus') . ' ' . (isset($wppa_session['display_searchstring']) ? $wppa_session['display_searchstring'] : stripslashes(wppa('searchstring'))) . $albtxt; $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-searchstring=' . stripslashes(str_replace(' ', '+', $wppa_session['use_searchstring'])); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-searchstring=' . stripslashes(str_replace(' ', '+', $wppa_session['use_searchstring'])); $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax); } $value = __('Searchstring:', 'wp-photo-album-plus') . ' ' . (isset($wppa_session['display_searchstring']) ? $wppa_session['display_searchstring'] : stripslashes(wppa('searchstring'))) . $albtxt; $href = ''; $title = isset($wppa_session['display_searchstring']) ? wppa_dss_to_title($wppa_session['display_searchstring']) : ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('calendar')) { if (wppa('is_slide')) { switch (wppa('calendar')) { case 'exifdtm': $value = __('Photos by EXIF date', 'wp-photo-album-plus') . ': ' . wppa('caldate'); break; case 'timestamp': $value = __('Photos by date of upload', 'wp-photo-album-plus') . ': ' . date('M d D Y', wppa('caldate') * 24 * 60 * 60); break; case 'modified': $value = __('Photos by date last modified', 'wp-photo-album-plus') . ': ' . date('M d D Y', wppa('caldate') * 24 * 60 * 60); break; } $thumbhref = '#'; $title = 'T8'; wppa_bcitem($value, $thumbhref, $title, 'b8'); } switch (wppa('calendar')) { case 'exifdtm': $value = __('Photos by EXIF date', 'wp-photo-album-plus') . ': ' . wppa('caldate'); break; case 'timestamp': $value = __('Photos by date of upload', 'wp-photo-album-plus') . ': ' . date('M d D Y', wppa('caldate') * 24 * 60 * 60); break; case 'modified': $value = __('Photos by date last modified', 'wp-photo-album-plus') . ': ' . date('M d D Y', wppa('caldate') * 24 * 60 * 60); break; } $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('is_upldr')) { $usr = get_user_by('login', wppa('is_upldr')); if ($usr) { $user = $usr->display_name; } else { $user = wppa('is_upldr'); } if (wppa('is_slide')) { $value = sprintf(__('Photos by %s', 'wp-photo-album-plus'), $user); if (wppa('start_album')) { $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-upldr=' . wppa('is_upldr') . '&wppa-album=' . wppa('start_album'); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-upldr=' . wppa('is_upldr') . '&wppa-album=' . wppa('start_album'); } else { $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-upldr=' . wppa('is_upldr'); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-upldr=' . wppa('is_upldr'); } $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax); } $value = sprintf(__('Photos by %s', 'wp-photo-album-plus'), $user); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('is_topten')) { // TopTen if (wppa('start_album')) { $value = $is_albenum ? __('Various albums', 'wp-photo-album-plus') : wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $title = $is_albenum ? __('Albums:', 'wp-photo-album-plus') . ' ' . wppa('start_album') : __('Album:', 'wp-photo-album-plus') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7', $ajax); } if (wppa('is_slide')) { $value = __('Top rated photos', 'wp-photo-album-plus'); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-topten=' . wppa('topten_count') . '&wppa-album=' . wppa('start_album'); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-topten=' . wppa('topten_count') . '&wppa-album=' . wppa('start_album'); $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax); } $value = __('Top rated photos', 'wp-photo-album-plus'); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('is_lasten')) { // Lasten if (wppa('start_album')) { $value = $is_albenum ? __('Various albums', 'wp-photo-album-plus') : wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $title = $is_albenum ? __('Albums:', 'wp-photo-album-plus') . ' ' . wppa('start_album') : __('Album:', 'wp-photo-album-plus') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7', $ajax); } if (wppa('is_slide')) { if (wppa_switch('lasten_use_modified')) { $value = __('Recently modified photos', 'wp-photo-album-plus'); } else { $value = __('Recently uploaded photos', 'wp-photo-album-plus'); } $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-lasten=' . wppa('lasten_count') . '&wppa-album=' . wppa('start_album'); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-lasten=' . wppa('lasten_count') . '&wppa-album=' . wppa('start_album'); $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax); } if (wppa_switch('lasten_use_modified')) { $value = __('Recently modified photos', 'wp-photo-album-plus'); } else { $value = __('Recently uploaded photos', 'wp-photo-album-plus'); } $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('is_comten')) { // Comten if (wppa('start_album')) { $value = $is_albenum ? __('Various albums', 'wp-photo-album-plus') : wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $title = $is_albenum ? __('Albums:', 'wp-photo-album-plus') . ' ' . wppa('start_album') : __('Album:', 'wp-photo-album-plus') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7', $ajax); } if (wppa('is_slide')) { $value = __('Recently commented photos', 'wp-photo-album-plus'); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-comten=' . wppa('comten_count') . '&wppa-album=' . wppa('start_album'); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-comten=' . wppa('comten_count') . '&wppa-album=' . wppa('start_album'); $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax); } $value = __('Recently commented photos', 'wp-photo-album-plus'); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('is_featen')) { // Featen if (wppa('start_album')) { $value = $is_albenum ? __('Various albums', 'wp-photo-album-plus') : wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $title = $is_albenum ? __('Albums:', 'wp-photo-album-plus') . ' ' . wppa('start_album') : __('Album:', 'wp-photo-album-plus') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7', $ajax); } if (wppa('is_slide')) { $value = __('Featured photos', 'wp-photo-album-plus'); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-featen=' . wppa('featen_count') . '&wppa-album=' . wppa('start_album'); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-featen=' . wppa('featen_count') . '&wppa-album=' . wppa('start_album'); $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax); } $value = __('Featured photos', 'wp-photo-album-plus'); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('is_related')) { // Related photos if (wppa('is_slide')) { $value = __('Related photos', 'wp-photo-album-plus'); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-tag=' . wppa('is_tag') . '&wppa-album=' . wppa('start_album'); $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-tag=' . wppa('is_tag') . '&wppa-album=' . wppa('start_album'); $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $href, $title, 'b8', $ajax); } $value = __('Related photos', 'wp-photo-album-plus'); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('is_tag')) { // Tagged photos if (wppa('is_slide')) { $value = __('Tagged photos:', 'wp-photo-album-plus') . ' ' . str_replace(';', ' ' . __('or', 'wp-photo-album-plus') . ' ', str_replace(',', ' ' . __('and', 'wp-photo-album-plus') . ' ', trim(wppa('is_tag'), ',;'))); if (wppa_get_get('inv')) { $value .= ' (' . __('Inverted', 'wp-photo-album-plus') . ')'; } $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-tag=' . wppa('is_tag') . '&wppa-album=' . wppa('start_album'); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-tag=' . wppa('is_tag') . '&wppa-album=' . wppa('start_album'); if (wppa('is_inverse')) { $thumbhref .= '&wppa-inv=1'; $thumbajax .= '&wppa-inv=1'; } $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax); } $value = __('Tagged photos:', 'wp-photo-album-plus') . ' ' . str_replace(';', ' ' . __('or', 'wp-photo-album-plus') . ' ', str_replace(',', ' ' . __('and', 'wp-photo-album-plus') . ' ', trim(wppa('is_tag'), ',;'))); if (wppa_get_get('inv')) { $value .= ' (' . __('Inverted', 'wp-photo-album-plus') . ')'; } $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('is_cat')) { // Categorized albums if (wppa('is_slide')) { $value = __('Category:', 'wp-photo-album-plus') . ' ' . wppa('is_cat'); //str_replace( ';', ' '.__( 'or' ).' ', str_replace( ',', ' '.__( 'and' ).' ', trim( wppa( 'is_tag' ), ',;' ) ) ); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-cat=' . wppa('is_cat') . '&wppa-album=' . wppa('start_album'); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-cat=' . wppa('is_cat') . '&wppa-album=' . wppa('start_album'); $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax); } $value = __('Category:', 'wp-photo-album-plus') . ' ' . wppa('is_cat'); //str_replace( ';', ' '.__( 'or' ).' ', str_replace( ',', ' '.__( 'and' ).' ', trim( wppa( 'is_tag' ), ',;' ) ) ); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } elseif (wppa('last_albums')) { // Recently modified albums( s ) if (wppa('last_albums_parent')) { $value = wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $title = __('Album:', 'wp-photo-album-plus') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7', $ajax); } if (wppa('is_slide')) { $value = __('Recently updated albums', 'wp-photo-album-plus'); $thumbhref = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $thumbajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $title = __('View the thumbnails', 'wp-photo-album-plus'); wppa_bcitem($value, $thumbhref, $title, 'b8', $thumbajax); } $value = __('Recently updated albums', 'wp-photo-album-plus'); $href = ''; $title = ''; wppa_bcitem($value, $href, $title, 'b9'); } else { // Maybe a simple normal standard album??? if (wppa('is_owner')) { $usr = get_user_by('login', wppa('is_owner')); if ($usr) { $dispname = $usr->display_name; } else { $dispname = wppa('is_owner'); } // User deleted $various = sprintf(__('Various albums by %s', 'wp-photo-album-plus'), $dispname); } else { $various = __('Various albums', 'wp-photo-album-plus'); } if (wppa('is_slide')) { $value = $is_albenum ? $various : wppa_get_album_name($alb); $href = wppa_get_permalink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $ajax = wppa_get_ajaxlink() . 'wppa-cover=0&wppa-occur=' . wppa('occur') . '&wppa-album=' . wppa('start_album'); $title = $is_albenum ? __('Albums:', 'wp-photo-album-plus') . ' ' . wppa('start_album') : __('Album:', 'wp-photo-album-plus') . ' ' . $value; wppa_bcitem($value, $href, $title, 'b7', $ajax); } $value = $is_albenum ? $various : wppa_get_album_name($alb); $href = ''; $title = ''; $class = 'b10'; wppa_bcitem($value, $href, $title, $class); } // 'Go to thumbnail display' - icon if (wppa('is_slide') && !wppa('calendar')) { if (wppa_switch('bc_slide_thumblink')) { // $pg = ( ( wppa_opt('thumb_page_size' ) == wppa_opt( 'slideshow_pagesize' ) ) && wppa_get_curpage() != '1' ) ? '&wppa-page='.wppa_get_curpage() : ''; // $thumbhref .= $pg; if ($virtual) { if ($thumbhref) { $thumbhref = wppa_trim_wppa_($thumbhref); $fs = wppa_opt('fontsize_nav'); if ($fs != '') { $fs += 3; } else { $fs = '15'; } // iconsize = fontsize+3, Default to 15 $imgs = 'height: ' . $fs . 'px; margin:0 0 -3px 0; padding:0; box-shadow:none;'; wppa_out('<a href="' . $thumbhref . '" title="' . __('Thumbnail view', 'wp-photo-album-plus') . '" class="wppa-nav-text" style="' . __wcs('wppa-nav-text') . 'float:right; cursor:pointer;" ' . 'onmouseover="jQuery(\'#wppa-tnv-' . wppa('mocc') . '\').css(\'display\', \'none\'); jQuery(\'#wppa-tnvh-' . wppa('mocc') . '\').css(\'display\', \'\')" ' . 'onmouseout="jQuery(\'#wppa-tnv-' . wppa('mocc') . '\').css(\'display\', \'\'); jQuery(\'#wppa-tnvh-' . wppa('mocc') . '\').css(\'display\', \'none\')" >' . '<img id="wppa-tnv-' . wppa('mocc') . '" class="wppa-tnv" src="' . wppa_get_imgdir() . 'application_view_icons.png" alt="' . __('Thumbs', 'wp-photo-album-plus') . '" style="' . $imgs . '" />' . '<img id="wppa-tnvh-' . wppa('mocc') . '" class="wppa-tnv" src="' . wppa_get_imgdir() . 'application_view_icons_hover.png" alt="' . __('Thumbs', 'wp-photo-album-plus') . '" style="display:none;' . $imgs . '" />' . '</a>'); } } else { $s = wppa('src') ? '&wppa-searchstring=' . urlencode(wppa('searchstring')) : ''; $onclick = "wppaDoAjaxRender( " . wppa('mocc') . ", '" . wppa_get_album_url_ajax(wppa('start_album'), '0') . "&wppa-photos-only=1" . $s . "', '" . wppa_convert_to_pretty(wppa_get_album_url(wppa('start_album'), '0') . '&wppa-photos-only=1' . $s) . "' )"; $fs = wppa_opt('fontsize_nav'); if ($fs != '') { $fs += 3; } else { $fs = '15'; } // iconsize = fontsize+3, Default to 15 $imgs = 'height: ' . $fs . 'px; margin:0 0 -3px 0; padding:0; box-shadow:none;'; wppa_out('<a title="' . __('Thumbnail view', 'wp-photo-album-plus') . '" class="wppa-nav-text" style="' . __wcs('wppa-nav-text') . 'float:right; cursor:pointer;" ' . 'onclick="' . $onclick . '" ' . 'onmouseover="jQuery(\'#wppa-tnv-' . wppa('mocc') . '\').css(\'display\', \'none\'); jQuery(\'#wppa-tnvh-' . wppa('mocc') . '\').css(\'display\', \'\')" ' . 'onmouseout="jQuery(\'#wppa-tnv-' . wppa('mocc') . '\').css(\'display\', \'\'); jQuery(\'#wppa-tnvh-' . wppa('mocc') . '\').css(\'display\', \'none\')" >' . '<img id="wppa-tnv-' . wppa('mocc') . '" class="wppa-tnv" src="' . wppa_get_imgdir() . 'application_view_icons.png" alt="' . __('Thumbs', 'wp-photo-album-plus') . '" style="' . $imgs . '" />' . '<img id="wppa-tnvh-' . wppa('mocc') . '" class="wppa-tnv" src="' . wppa_get_imgdir() . 'application_view_icons_hover.png" alt="' . __('Thumbs', 'wp-photo-album-plus') . '" style="display:none;' . $imgs . '" />' . '</a>'); } } } // Close the breadcrumb box wppa_out('<div style="clear:both;" ></div>'); wppa_out('</div>'); }
function wppa_htmlerr($slug) { switch ($slug) { case 'popup-lightbox': $title = __('You can not have popup and lightbox on thumbnails at the same time. Uncheck either Table IV-C8 or choose a different linktype in Table VI-2.', 'wp-photo-album-plus'); break; default: $title = __('It is important that you select a page that contains at least [wppa][/wppa].', 'wp-photo-album-plus'); $title .= " " . __('If you ommit this, the link will not work at all or simply refresh the (home)page.', 'wp-photo-album-plus'); break; } $result = '<img id="' . $slug . '-err" ' . 'src="' . wppa_get_imgdir() . 'error.png" ' . 'class="' . $slug . '-err" ' . 'style="height:16px; width:16px; float:left; display:none;" ' . 'title="' . $title . '" ' . 'onmouseover="jQuery(this).animate({width: 32, height:32}, 100)" ' . 'onmouseout="jQuery(this).animate({width: 16, height:16}, 200)" />'; return $result; }
function wppa_get_svghtml($name, $height = false, $lightbox = false, $border = false, $none = '0', $light = '10', $medium = '20', $heavy = '50') { // Find the colors if ($lightbox) { $fillcolor = wppa_opt('ovl_svg_color'); $bgcolor = wppa_opt('ovl_svg_bg_color'); } else { $fillcolor = wppa_opt('svg_color'); $bgcolor = wppa_opt('svg_bg_color'); } // Find the border radius switch (wppa_opt('icon_corner_style')) { case 'none': $bradius = $none; break; case 'light': $bradius = $light; break; case 'medium': $bradius = $medium; break; case 'heavy': $bradius = $heavy; break; } $is_ie = wppa_is_ie(); $src = $is_ie ? $name . '.png' : $name . '.svg'; // Compose the html $result = '<img' . ' src="' . wppa_get_imgdir($src) . '"' . ($is_ie ? '' : ' class="wppa-svg"') . ' style="' . ($height ? 'height:' . $height . ';' : '') . 'fill:' . $fillcolor . ';' . 'background-color:' . $bgcolor . ';' . ($is_ie ? '' : 'display:none;') . 'text-decoration:none !important;' . 'vertical-align:middle;' . ($bradius ? 'border-radius:' . $bradius . '%;' : '') . ($border ? 'border:2px solid ' . $bgcolor . ';box-sizing:border-box;' : '') . '"' . ' alt="' . $name . '"' . ' onload="wppaReplaceSvg()"' . ' />'; return $result; }
function _wppa_sidebar_page_options() { global $wpdb; $options_error = false; if (isset($_GET['walbum'])) { $walbum = wppa_walbum_sanitize($_GET['walbum']); wppa_update_option('wppa_widget_album', $walbum); } if (isset($_POST['wppa-set-submit'])) { check_admin_referer('$wppa_nonce', WPPA_NONCE); if (isset($_POST['wppa-widgettitle'])) { wppa_update_option('wppa_widgettitle', $_POST['wppa-widgettitle']); } if (isset($_POST['wppa-potd-align'])) { wppa_update_option('wppa_potd_align', $_POST['wppa-potd-align']); } if (isset($_POST['wppa-widget-albums'])) { wppa_update_option('wppa_widget_album', wppa_walbum_sanitize($_POST['wppa-widget-albums'])); } if (isset($_POST['wppa-widget-photo'])) { wppa_update_option('wppa_widget_photo', $_POST['wppa-widget-photo']); } if (isset($_POST['wppa-widget-method'])) { wppa_update_option('wppa_widget_method', $_POST['wppa-widget-method']); } if (isset($_POST['wppa-widget-period'])) { wppa_update_option('wppa_widget_period', $_POST['wppa-widget-period']); } if (isset($_POST['wppa-widget-subtitle'])) { wppa_update_option('wppa_widget_subtitle', $_POST['wppa-widget-subtitle']); } if (isset($_POST['wppa-widget-linkpage'])) { wppa_update_option('wppa_widget_linkpage', $_POST['wppa-widget-linkpage']); } if (isset($_POST['wppa-widget-linkurl'])) { wppa_update_option('wppa_widget_linkurl', $_POST['wppa-widget-linkurl']); } if (isset($_POST['wppa-widget-linktitle'])) { wppa_update_option('wppa_widget_linktitle', $_POST['wppa-widget-linktitle']); } if (isset($_POST['wppa-widget-linktype'])) { wppa_update_option('wppa_widget_linktype', $_POST['wppa-widget-linktype']); } if (wppa_check_numeric($_POST['wppa-potd-widget-width'], '100', __('Widget Photo Width.'))) { wppa_update_option('wppa_potd_widget_width', $_POST['wppa-potd-widget-width']); } else { $options_error = true; } if (!$options_error) { wppa_update_message(__('Changes Saved. Don\'t forget to activate the widget!', 'wppa')); } } wppa_initialize_runtime('force'); ?> <div class="wrap"> <?php $iconurl = WPPA_URL . '/images/settings32.png'; ?> <div id="icon-album" class="icon32" style="background: transparent url(<?php echo $iconurl; ?> ) no-repeat"> <br /> </div> <h2><?php _e('Photo of the Day Widget Settings', 'wppa'); ?> </h2> <form action="<?php echo wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_photo_of_the_day'); ?> " method="post"> <?php wp_nonce_field('$wppa_nonce', WPPA_NONCE); ?> <table class="form-table wppa-table wppa-photo-table"> <tbody> <tr valign="top"> <th scope="row"> <label ><?php _e('Widget Title:', 'wppa'); ?> </label> </th> <td> <input type="text" name="wppa-widgettitle" id="wppa-widgettitle" value="<?php echo wppa_opt('widgettitle'); ?> " /> <span class="description"><br/><?php _e('Enter/modify the title for the widget. This is a default and can be overriden at widget activation.', 'wppa'); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"> <label ><?php _e('Widget Photo Width:', 'wppa'); ?> </label> </th> <td> <input type="text" name="wppa-potd-widget-width" id="wppa-potd-widget-width" value="<?php echo wppa_opt('potd_widget_width'); ?> " style="width: 50px;" /> <?php _e('pixels.', 'wppa'); echo ' '; _e('Horizontal alignment:', 'wppa'); ?> <select name="wppa-potd-align" id="wppa-potd-align"> <?php $ali = wppa_opt('potd_align'); ?> <?php $sel = 'selected="selected"'; ?> <option value="none" <?php if ($ali == 'none') { echo $sel; } ?> ><?php _e('--- none ---', 'wppa'); ?> </option> <option value="left" <?php if ($ali == 'left') { echo $sel; } ?> ><?php _e('left', 'wppa'); ?> </option> <option value="center" <?php if ($ali == 'center') { echo $sel; } ?> ><?php _e('center', 'wppa'); ?> </option> <option value="right" <?php if ($ali == 'right') { echo $sel; } ?> ><?php _e('right', 'wppa'); ?> </option> </select> <span class="description"><br/><?php _e('Enter the desired display width and alignment of the photo in the sidebar.', 'wppa'); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"> <label ><?php _e('Use album(s):', 'wppa'); ?> </label> </th> <td> <script type="text/javascript"> /* <![CDATA[ */ function wppaCheckWa() { document.getElementById('wppa-spin').style.visibility = 'visible'; document.getElementById('wppa-upd').style.visibility = 'hidden'; var album = document.getElementById('wppa-wa').value; if ( album != 'all' && album != 'sep' && album != 'all-sep' && album != 'topten' && album != 'clr' ) album = document.getElementById('wppa-was').value + ',' + album; var url = "<?php echo wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_photo_of_the_day'); ?> &walbum=" + album; document.location.href = url; } /* ]]> */ </script> <?php _e('Select:', 'wppa'); ?> <select name="wppa-widget-album" id="wppa-wa" onchange="wppaCheckWa()" ><?php echo wppa_walbum_select(wppa_opt('widget_album')); ?> </select> <img id="wppa-spin" src="<?php echo wppa_get_imgdir(); ?> wpspin.gif" style="visibility:hidden;"/> <?php _e('Or Edit:', 'wppa'); ?> <input type="text" name="wppa-widget-albums" id="wppa-was" value="<?php echo wppa_opt('widget_album'); ?> " /> <input class="button-primary" name="wppa-upd" id="wppa-upd" value="<?php _e('Update thumbnails', 'wppa'); ?> " onclick="wppaCheckWa()" /> <span class="description"><br/> <?php _e('Select or edit the album(s) you want to use the photos of for the widget.', 'wppa'); ?> <br /> <?php _e('If you want a <b>- special -</b> selection or get rid of it, you may need to use <b>- start over -</b> first.', 'wppa'); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"> <label ><?php _e('Display method:', 'wppa'); ?> </label> </th> <td> <?php $sel = 'selected="selected"'; ?> <?php $method = wppa_opt('widget_method'); ?> <select name="wppa-widget-method" id="wppa-wm" onchange="wppaCheckWidgetMethod()" > <option value="1" <?php if ($method == '1') { echo $sel; } ?> ><?php _e('Fixed photo', 'wppa'); ?> </option> <option value="2" <?php if ($method == '2') { echo $sel; } ?> ><?php _e('Random', 'wppa'); ?> </option> <option value="3" <?php if ($method == '3') { echo $sel; } ?> ><?php _e('Last upload', 'wppa'); ?> </option> <option value="4" <?php if ($method == '4') { echo $sel; } ?> ><?php _e('Change every', 'wppa'); ?> </option> </select> <?php $period = wppa_opt('widget_period'); ?> <select name="wppa-widget-period" id="wppa-wp" > <option value="0" <?php if ($period == '0') { echo $sel; } ?> ><?php _e('pageview.', 'wppa'); ?> </option> <option value="1" <?php if ($period == '1') { echo $sel; } ?> ><?php _e('hour.', 'wppa'); ?> </option> <option value="24" <?php if ($period == '24') { echo $sel; } ?> ><?php _e('day.', 'wppa'); ?> </option> <option value="168" <?php if ($period == '168') { echo $sel; } ?> ><?php _e('week.', 'wppa'); ?> </option> <option value="736" <?php if ($period == '736') { echo $sel; } ?> ><?php _e('month.', 'wppa'); ?> </option> <option value="day-of-week" <?php if ($period == 'day-of-week') { echo $sel; } ?> ><?php _e('day of week is order#', 'wppa'); ?> </option> <option value="day-of-month" <?php if ($period == 'day-of-month') { echo $sel; } ?> ><?php _e('day of month is order#', 'wppa'); ?> </option> </select> <span class="description"><br/><?php _e('Select how the widget should display.', 'wppa'); ?> </span> </td> </tr> <?php $linktype = wppa_opt('widget_linktype'); if ($linktype != 'custom') { ?> <tr> <th scope="row"> <label ><?php _e('Link to:', 'wppa'); ?> </label> </th> <td> <?php _e('Links are set on the <b>Photo Albums -> Settings</b> screen.', 'wppa'); ?> </td> </tr> <?php } else { ?> <tr class="wppa-wlu" > <th scope="row"> <label ><?php _e('Link to:', 'wppa'); ?> </label> </th> <td> <?php _e('Title:', 'wppa'); ?> <input type="text" name="wppa-widget-linktitle" id="wppa-widget-linktitle" value="<?php echo wppa_opt('widget_linktitle'); ?> "style="width:20%" /> <?php _e('Url:', 'wppa'); ?> <input type="text" name="wppa-widget-linkurl" id="wppa-widget-linkurl" value="<?php echo wppa_opt('widget_linkurl'); ?> " style="width:50%" /> <span class="description"><br/><?php _e('Enter the title and the url. Do\'nt forget the HTTP://', 'wppa'); ?> </span> </td> </tr> <?php } ?> <!--<script type="text/javascript">wppaCheckWidgetLink()</script>--> <tr> <th scope="row"> <label ><?php _e('Subtitle:', 'wppa'); ?> </label> </th> <td> <?php $subtit = wppa_opt('widget_subtitle'); ?> <select name="wppa-widget-subtitle" id="wppa-st" onchange="wppaCheckWidgetSubtitle()" > <option value="none" <?php if ($subtit == 'none') { echo $sel; } ?> ><?php _e('--- none ---', 'wppa'); ?> </option> <option value="name" <?php if ($subtit == 'name') { echo $sel; } ?> ><?php _e('Photo Name', 'wppa'); ?> </option> <option value="desc" <?php if ($subtit == 'desc') { echo $sel; } ?> ><?php _e('Description', 'wppa'); ?> </option> <option value="owner" <?php if ($subtit == 'owner') { echo $sel; } ?> ><?php _e('Owner', 'wppa'); ?> </option> </select> <span class="description"><br/><?php _e('Select the content of the subtitle.', 'wppa'); ?> </span> </td> </tr> </tbody> </table> <p> <input type="submit" class="button-primary" name="wppa-set-submit" value="<?php _e('Save Changes', 'wppa'); ?> " /> </p> <?php $alb = wppa_opt('widget_album'); $photos = wppa_get_widgetphotos($alb); if (empty($photos)) { echo '<p>' . __('No photos yet in this album.', 'wppa') . '</p>'; } else { $curid = wppa_opt('widget_photo'); $wi = wppa_get_minisize() + 24; $hi = $wi + 48; // Process photos foreach ($photos as $photo) { $id = $photo['id']; // Open container div echo '<div' . ' class="photoselect"' . ' style="' . 'width:' . wppa_opt('widget_width') . 'px;' . 'height:' . $hi . 'px;' . 'overflow:hidden;' . '" >'; // The image if a video if (wppa_is_video($id)) { echo wppa_get_video_html(array('id' => $id, 'style' => 'width:' . wppa_opt('widget_width') . 'px;')); } else { echo '<img' . ' src=" ' . wppa_fix_poster_ext(wppa_get_thumb_url($id), $id) . '"' . ' style="' . 'width:' . wppa_opt('widget_width') . 'px;' . '"' . ' alt="' . $photo['name'] . '" />'; // Audio ? if (wppa_has_audio($id)) { echo wppa_get_audio_html(array('id' => $id, 'style' => 'width:' . wppa_opt('widget_width') . 'px;' . 'position:relative;' . 'bottom:' . (wppa_get_audio_control_height() + 4) . 'px;')); } } ?> <input type="radio" name="wppa-widget-photo" id="wppa-widget-photo<?php echo $id; ?> " value="<?php echo $id; ?> " <?php if ($id == $curid) { echo 'checked="checked"'; } ?> /> <div class="clear"></div> <h4 style="position: absolute; top:<?php echo $wi - 12; ?> px; font-size:11px; overflow:hidden;"><?php echo wppa_qtrans(stripslashes($photo['name'])); ?> </h4> <h6 style="position: absolute; top:<?php echo $wi + 6; ?> px; font-size:9px; line-height:10px;"><?php echo wppa_qtrans(stripslashes($photo['description'])); ?> </h6> <h5 style="position: absolute; top:<?php echo $wi + 24; ?> px; font-size:9px; line-height:10px;"><?php echo '(#' . $photo['p_order'] . ')'; ?> </h5> </div><?php } echo '<div class="clear"></div>'; } ?> <script type="text/javascript">wppaCheckWidgetMethod();</script> <script type="text/javascript">wppaCheckWidgetSubtitle();</script> <br /> <p> <input type="submit" class="button-primary" name="wppa-set-submit" value="<?php _e('Save Changes', 'wppa'); ?> " /> </p> </form> </div> <?php }
function wppa_album_download_link($albumid) { if (!wppa_switch('allow_download_album')) { return; } // Not enabled wppa_out('<div style="clear:both;" ></div>'); wppa_out('<a onclick="wppaAjaxDownloadAlbum(' . wppa('mocc') . ', ' . $albumid . ' );" style="cursor:pointer;" title="' . __('Download', 'wp-photo-album-plus') . '">' . __('Download album', 'wp-photo-album-plus') . '</a>'); wppa_out('<img id="dwnspin-' . wppa('mocc') . '-' . $albumid . '" src="' . wppa_get_imgdir() . 'wpspin.gif" style="margin-left:6px; display:none;" alt="spin" />'); }
function wppa_comment_html($id, $comment_allowed) { global $wpdb; global $current_user; global $wppa_first_comment_html; $result = ''; if (wppa_in_widget()) { return $result; } // NOT in a widget // Find out who we are either logged in or not $vis = is_user_logged_in() ? 'display:none; ' : ''; if (!$wppa_first_comment_html) { $wppa_first_comment_html = true; // Find user if (wppa_get_post('comname')) { wppa('comment_user', wppa_get_post('comname')); } if (wppa_get_post('comemail')) { wppa('comment_email', wppa_get_post('comemail')); } elseif (is_user_logged_in()) { get_currentuserinfo(); wppa('comment_user', $current_user->display_name); //user_login; wppa('comment_email', $current_user->user_email); } } // Loop the comments already there $n_comments = 0; if (wppa_switch('comments_desc')) { $ord = 'DESC'; } else { $ord = ''; } $comments = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . WPPA_COMMENTS . ' WHERE photo = %s ORDER BY id ' . $ord, $id), ARRAY_A); wppa_dbg_q('Q-Comm'); $com_count = count($comments); $color = 'darkgrey'; if (wppa_opt('fontcolor_box')) { $color = wppa_opt('fontcolor_box'); } if ($comments && (is_user_logged_in() || !wppa_switch('comment_view_login'))) { $result .= ' <div' . ' id="wppa-comtable-wrap-' . wppa('mocc') . '"' . ' style="display:none;"' . '>' . '<table' . ' id="wppacommentstable-' . wppa('mocc') . '"' . ' class="wppa-comment-form"' . ' style="margin:0; "' . '>' . '<tbody>'; foreach ($comments as $comment) { // Show a comment either when it is approved, or it is pending and mine or i am a moderator if ($comment['status'] == 'approved' || current_user_can('wppa_moderate') || current_user_can('wppa_comments') || ($comment['status'] == 'pending' || $comment['status'] == 'spam') && $comment['user'] == wppa('comment_user')) { $n_comments++; $result .= ' <tr' . ' class="wppa-comment-' . $comment['id'] . '"' . ' valign="top"' . ' style="border-bottom:0 none; border-top:0 none; border-left: 0 none; border-right: 0 none; "' . ' >' . '<td' . ' valign="top"' . ' class="wppa-box-text wppa-td"' . ' style="vertical-align:top; width:30%; border-width: 0 0 0 0; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . $comment['user'] . ' ' . __('wrote:', 'wp-photo-album-plus') . '<br />' . '<span style="font-size:9px; ">' . wppa_get_time_since($comment['timestamp']) . '</span>'; // Avatar ? if (wppa_opt('comment_gravatar') != 'none') { // Find the default if (wppa_opt('comment_gravatar') != 'url') { $default = wppa_opt('comment_gravatar'); } else { $default = wppa_opt('comment_gravatar_url'); } // Find the avatar, init $avt = false; $usr = false; // First try to find the user by email address ( works only if email required on comments ) if ($comment['email']) { $usr = get_user_by('email', $comment['email']); } // If not found, try to find the user by login name ( works only if login name is equal to display name ) if (!$usr) { $usr = get_user_by('login', $comment['user']); } // Still no user, try to find him by display name if (!$usr) { $usr = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE `display_name` = %s", $comment['user'])); // Accept this user if he is the only one with this display name if (count($usr) != 1) { $usr = false; } } // If a user is found, see for local Avatar ? if ($usr) { $avt = str_replace("'", "\"", get_avatar($usr->ID, wppa_opt('gravatar_size'), $default)); } // Global avatars off ? try myself if (!$avt) { $avt = ' <img' . ' class="wppa-box-text wppa-td"' . ' src="http://www.gravatar.com/avatar/' . md5(strtolower(trim($comment['email']))) . '.jpg?d=' . urlencode($default) . '&s=' . wppa_opt('gravatar_size') . '"' . ' alt="' . __('Avatar', 'wp-photo-album-plus') . '"' . ' />'; } // Compose the html $result .= ' <div class="com_avatar">' . $avt . '</div>'; } $result .= '</td>'; $txtwidth = floor(wppa_get_container_width() * 0.7) . 'px'; $result .= '<td' . ' class="wppa-box-text wppa-td"' . ' style="width:70%; word-wrap:break-word; border-width: 0 0 0 0;' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . '<p' . ' class="wppa-comment-textarea wppa-comment-textarea-' . wppa('mocc') . '"' . ' style="' . 'margin:0;' . 'background-color:transparent;' . 'width:' . $txtwidth . ';' . 'max-height:90px;' . 'overflow:auto;' . 'word-wrap:break-word;' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' >' . html_entity_decode(esc_js(stripslashes(wppa_convert_smilies($comment['comment'])))); if ($comment['status'] != 'approved' && (current_user_can('wppa_moderate') || current_user_can('wppa_comments'))) { if (wppa('no_esc')) { $result .= wppa_moderate_links('comment', $id, $comment['id']); } else { $result .= wppa_html(esc_js(wppa_moderate_links('comment', $id, $comment['id']))); } } elseif ($comment['status'] == 'pending' && $comment['user'] == wppa('comment_user')) { $result .= '<br /><span style="color:red; font-size:9px;" >' . __('Awaiting moderation', 'wp-photo-album-plus') . '</span>'; } elseif ($comment['status'] == 'spam' && $comment['user'] == wppa('comment_user')) { $result .= '<br /><span style="color:red; font-size:9px;" >' . __('Marked as spam', 'wp-photo-album-plus') . '</span>'; } $result .= '</p>' . '</td>' . '</tr>' . '<tr class="wppa-comment-' . $comment['id'] . '">' . '<td colspan="2" style="padding:0">' . '<hr style="background-color:' . $color . '; margin:0;" />' . '</td>' . '</tr>'; } } $result .= '</tbody>' . '</table>' . '</div>'; } // See if we are currently in the process of adding/editing this comment $is_current = $id == wppa('comment_photo') && wppa('comment_id'); if ($is_current) { $txt = wppa('comment_text'); $btn = __('Edit!', 'wp-photo-album-plus'); } else { $txt = ''; $btn = __('Send!', 'wp-photo-album-plus'); } // Prepare the callback url $returnurl = wppa_get_permalink(); $album = wppa_get_get('album'); if ($album !== false) { $returnurl .= 'wppa-album=' . $album . '&'; } $cover = wppa_get_get('cover'); if ($cover) { $returnurl .= 'wppa-cover=' . $cover . '&'; } $slide = wppa_get_get('slide'); if ($slide !== false) { $returnurl .= 'wppa-slide&'; } $occur = wppa_get_get('occur'); if ($occur) { $returnurl .= 'wppa-occur=' . $occur . '&'; } $lasten = wppa_get_get('lasten'); if ($lasten) { $returnurl .= 'wppa-lasten=' . $lasten . '&'; } $topten = wppa_get_get('topten'); if ($topten) { $returnurl .= 'wppa-topten=' . $topten . '&'; } $comten = wppa_get_get('comten'); if ($comten) { $returnurl .= 'wppa-comten=' . $comten . '&'; } $tag = wppa_get_get('tag'); if ($tag) { $returnurl .= 'wppa-tag=' . $tag . '&'; } $returnurl .= 'wppa-photo=' . $id; // The comment form if ($comment_allowed) { $result .= '<div' . ' id="wppa-comform-wrap-' . wppa('mocc') . '"' . ' style="display:none;"' . ' >' . '<form' . ' id="wppa-commentform-' . wppa('mocc') . '"' . ' class="wppa-comment-form"' . ' action="' . $returnurl . '"' . ' method="post"' . ' onsubmit="return wppaValidateComment( ' . wppa('mocc') . ' )"' . ' >' . wp_nonce_field('wppa-nonce-' . wppa('mocc'), 'wppa-nonce-' . wppa('mocc'), false, false) . ($album ? '<input type="hidden" name="wppa-album" value="' . $album . '" />' : '') . ($cover ? '<input type="hidden" name="wppa-cover" value="' . $cover . '" />' : '') . ($slide ? '<input type="hidden" name="wppa-slide" value="' . $slide . '" />' : '') . '<input' . ' type="hidden"' . ' name="wppa-returnurl"' . ' id="wppa-returnurl-' . wppa('mocc') . '"' . ' value="' . $returnurl . '"' . ' />' . ($is_current ? '<input' . ' type="hidden"' . ' id="wppa-comment-edit-' . wppa('mocc') . '"' . ' name="wppa-comment-edit"' . ' value="' . wppa('comment_id') . '"' . ' />' : '') . '<input type="hidden" name="wppa-occur" value="' . wppa('occur') . '" />' . '<table id="wppacommenttable-' . wppa('mocc') . '" style="margin:0;">' . '<tbody>' . '<tr valign="top" style="' . $vis . '">' . '<td class="wppa-box-text wppa-td" style="width:30%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . __('Your name:', 'wp-photo-album-plus') . '</td>' . '<td class="wppa-box-text wppa-td" style="width:70%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . '<input' . ' type="text"' . ' name="wppa-comname"' . ' id="wppa-comname-' . wppa('mocc') . '"' . ' style="width:100%; " value="' . wppa('comment_user') . '"' . ' />' . '</td>' . '</tr>'; if (wppa_switch('comment_email_required')) { $result .= '<tr valign="top" style="' . $vis . '">' . '<td class="wppa-box-text wppa-td" style="width:30%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . __('Your email:', 'wp-photo-album-plus') . '</td>' . '<td class="wppa-box-text wppa-td" style="width:70%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . '<input' . ' type="text"' . ' name="wppa-comemail"' . ' id="wppa-comemail-' . wppa('mocc') . '"' . ' style="width:100%;"' . ' value="' . wppa('comment_email') . '"' . ' />' . '</td>' . '</tr>'; } $result .= '<tr valign="top" style="vertical-align:top;">' . '<td valign="top" class="wppa-box-text wppa-td" style="vertical-align:top; width:30%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >' . __('Your comment:', 'wp-photo-album-plus') . '<br />' . wppa('comment_user') . '<br />'; if (is_user_logged_in() && wppa_opt('comment_captcha') == 'all' || !is_user_logged_in() && wppa_opt('comment_captcha') != 'none') { $wid = '20%'; if (wppa_opt('fontsize_box')) { $wid = wppa_opt('fontsize_box') * 1.5 . 'px'; } $captkey = $id; if ($is_current) { $captkey = $wpdb->get_var($wpdb->prepare('SELECT `timestamp` FROM `' . WPPA_COMMENTS . '` WHERE `id` = %s', wppa('comment_id'))); } wppa_dbg_q('Q-Com-ts'); $result .= wppa_make_captcha($captkey) . '<input' . ' type="text"' . ' id="wppa-captcha-' . wppa('mocc') . '"' . ' name="wppa-captcha"' . ' style="width:' . $wid . ';' . __wcs('wppa-box-text') . __wcs('wppa-td') . '"' . ' /> '; } $result .= '<input type="button" name="commentbtn" onclick="wppaAjaxComment( ' . wppa('mocc') . ', ' . $id . ' )" value="' . $btn . '" style="margin:0 4px 0 0;" />' . '<img id="wppa-comment-spin-' . wppa('mocc') . '" src="' . wppa_get_imgdir() . 'wpspin.gif" style="display:none;" />' . '</td>' . '<td valign="top" class="wppa-box-text wppa-td" style="vertical-align:top; width:70%; ' . __wcs('wppa-box-text') . __wcs('wppa-td') . '" >'; if (wppa_switch('comment_smiley_picker')) { $result .= wppa_get_smiley_picker_html('wppa-comment-' . wppa('mocc')); } $result .= '<textarea' . ' name="wppa-comment"' . ' id="wppa-comment-' . wppa('mocc') . '"' . ' style="height:60px; width:100%; "' . '>' . esc_textarea(stripslashes($txt)) . '</textarea>' . '</td>' . '</tr>' . '</tbody>' . '</table>' . '</form>' . '</div>'; } else { if (wppa_switch('login_links')) { $result .= sprintf(__('You must <a href="%s">login</a> to enter a comment', 'wp-photo-album-plus'), site_url('wp-login.php', 'login')); } else { $result .= __('You must login to enter a comment', 'wp-photo-album-plus'); } } $result .= '<div id="wppa-comfooter-wrap-' . wppa('mocc') . '" style="display:block;" >' . '<table id="wppacommentfooter-' . wppa('mocc') . '" class="wppa-comment-form" style="margin:0;">' . '<tbody>' . '<tr style="text-align:center;">' . '<td style="text-align:center; cursor:pointer;' . __wcs('wppa-box-text') . '" >' . '<a onclick="wppaOpenComments( ' . wppa('mocc') . ', -1 ); return false;" >'; if ($n_comments) { $result .= sprintf(_n('%d comment', '%d comments', $n_comments, 'wp-photo-album-plus'), $n_comments); } else { if ($comment_allowed) { $result .= __('Leave a comment', 'wp-photo-album-plus'); } } $result .= '</a>' . '</td>' . '</tr>' . '</tbody>' . '</table>' . '</div>' . '<div style="clear:both"></div>'; return $result; }
function _wppa_sidebar_page_options() { global $wpdb; $options_error = false; if (isset($_GET['walbum'])) { $walbum = wppa_walbum_sanitize($_GET['walbum']); wppa_update_option('wppa_widget_album', $walbum); } if (isset($_REQUEST['wppa-set-submit'])) { if (!wp_verify_nonce($_REQUEST['wppa-update-check'], 'wppa-update-check')) { echo 'Trying:' . $_REQUEST['wppa-update-check']; } if (isset($_POST['wppa-widgettitle'])) { wppa_update_option('wppa_widgettitle', $_POST['wppa-widgettitle']); } if (isset($_POST['wppa-potd-align'])) { wppa_update_option('wppa_potd_align', $_POST['wppa-potd-align']); } if (isset($_POST['wppa-widget-albums'])) { wppa_update_option('wppa_widget_album', wppa_walbum_sanitize($_POST['wppa-widget-albums'])); } if (isset($_POST['wppa-widget-photo'])) { wppa_update_option('wppa_widget_photo', $_POST['wppa-widget-photo']); } if (isset($_POST['wppa-widget-method'])) { wppa_update_option('wppa_widget_method', $_POST['wppa-widget-method']); } if (isset($_REQUEST['wppa-widget-period'])) { wppa_update_option('wppa_widget_period', $_REQUEST['wppa-widget-period']); } if (isset($_POST['wppa-widget-subtitle'])) { wppa_update_option('wppa_widget_subtitle', $_POST['wppa-widget-subtitle']); } if (isset($_POST['wppa-widget-linkpage'])) { wppa_update_option('wppa_widget_linkpage', $_POST['wppa-widget-linkpage']); } if (isset($_POST['wppa-widget-linkurl'])) { wppa_update_option('wppa_widget_linkurl', $_POST['wppa-widget-linkurl']); } if (isset($_POST['wppa-widget-linktitle'])) { wppa_update_option('wppa_widget_linktitle', $_POST['wppa-widget-linktitle']); } if (isset($_POST['wppa-widget-linktype'])) { wppa_update_option('wppa_widget_linktype', $_POST['wppa-widget-linktype']); } if (isset($_POST['wppa-widget-status-filter'])) { wppa_update_option('wppa_widget_status_filter', $_POST['wppa-widget-status-filter']); } if (isset($_POST['wppa-potd-offset'])) { wppa_update_option('wppa_potd_offset', $_POST['wppa-potd-offset']); } if (isset($_POST['wppa-potd-widget-width'])) { if (wppa_check_numeric($_POST['wppa-potd-widget-width'], '100', __('Widget Photo Width.', 'wp-photo-album-plus'))) { wppa_update_option('wppa_potd_widget_width', $_POST['wppa-potd-widget-width']); } else { $options_error = true; } } if (!$options_error && isset($_POST['wppa-set-submit'])) { wppa_update_message(__('Changes Saved. Don\'t forget to activate the widget!', 'wp-photo-album-plus')); } } wppa_initialize_runtime('force'); ?> <div class="wrap"> <?php $iconurl = WPPA_URL . '/images/settings32.png'; ?> <div id="icon-album" class="icon32" style="background: transparent url(<?php echo $iconurl; ?> ) no-repeat"> <br /> </div> <h2><?php _e('Photo of the Day Widget Settings', 'wp-photo-album-plus'); ?> </h2> <?php $action_url = wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_photo_of_the_day'); ?> <form action="<?php echo $action_url; ?> " method="post"> <?php echo wp_nonce_field('wppa-update-check', 'wppa-update-check'); ?> <table class="form-table wppa-table wppa-photo-table"> <tbody> <tr valign="top"> <th scope="row"> <label ><?php _e('Widget Title:', 'wp-photo-album-plus'); ?> </label> </th> <td> <input type="text" name="wppa-widgettitle" id="wppa-widgettitle" value="<?php echo wppa_opt('widgettitle'); ?> " /> <span class="description"><br/><?php _e('Enter/modify the title for the widget. This is a default and can be overriden at widget activation.', 'wp-photo-album-plus'); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"> <label ><?php _e('Widget Photo Width:', 'wp-photo-album-plus'); ?> </label> </th> <td> <input type="text" name="wppa-potd-widget-width" id="wppa-potd-widget-width" value="<?php echo wppa_opt('potd_widget_width'); ?> " style="width: 50px;" /> <?php _e('pixels.', 'wp-photo-album-plus'); echo ' '; _e('Horizontal alignment:', 'wp-photo-album-plus'); ?> <select name="wppa-potd-align" id="wppa-potd-align"> <?php $ali = wppa_opt('potd_align'); ?> <?php $sel = 'selected="selected"'; ?> <option value="none" <?php if ($ali == 'none') { echo $sel; } ?> ><?php _e('--- none ---', 'wp-photo-album-plus'); ?> </option> <option value="left" <?php if ($ali == 'left') { echo $sel; } ?> ><?php _e('left', 'wp-photo-album-plus'); ?> </option> <option value="center" <?php if ($ali == 'center') { echo $sel; } ?> ><?php _e('center', 'wp-photo-album-plus'); ?> </option> <option value="right" <?php if ($ali == 'right') { echo $sel; } ?> ><?php _e('right', 'wp-photo-album-plus'); ?> </option> </select> <span class="description"><br/><?php _e('Enter the desired display width and alignment of the photo in the sidebar.', 'wp-photo-album-plus'); ?> </span> </td> </tr> <tr valign="top"> <th scope="row"> <label ><?php _e('Use album(s):', 'wp-photo-album-plus'); ?> </label> </th> <td> <script type="text/javascript"> /* <![CDATA[ */ function wppaCheckWa() { document.getElementById('wppa-spin').style.visibility = 'visible'; document.getElementById('wppa-upd').style.visibility = 'hidden'; var album = document.getElementById('wppa-wa').value; if ( album != 'all' && album != 'sep' && album != 'all-sep' && album != 'topten' && album != 'clr' ) album = document.getElementById('wppa-was').value + ',' + album; var url = "<?php echo wppa_dbg_url(get_admin_url() . 'admin.php?page=wppa_photo_of_the_day'); ?> &walbum=" + album; document.location.href = url; } /* ]]> */ </script> <?php _e('Select:', 'wp-photo-album-plus'); ?> <select name="wppa-widget-album" id="wppa-wa" onchange="wppaCheckWa()" ><?php echo wppa_walbum_select(wppa_opt('widget_album')); ?> </select> <img id="wppa-spin" src="<?php echo wppa_get_imgdir(); ?> wpspin.gif" style="visibility:hidden;"/> <?php _e('Or Edit:', 'wp-photo-album-plus'); ?> <input type="text" name="wppa-widget-albums" id="wppa-was" value="<?php echo wppa_opt('widget_album'); ?> " /> <input class="button-primary" name="wppa-upd" id="wppa-upd" value="<?php _e('Update thumbnails', 'wp-photo-album-plus'); ?> " onclick="wppaCheckWa()" /> <span class="description"><br/> <?php _e('Select or edit the album(s) you want to use the photos of for the widget.', 'wp-photo-album-plus'); ?> <br /> <?php _e('If you want a <b>- special -</b> selection or get rid of it, you may need to use <b>- start over -</b> first.', 'wp-photo-album-plus'); ?> </span> </td> </tr> <!-- Status filter --> <tr valign="top" > <th scope="row" > <label ><?php _e('Status filter:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $sel = 'selected="selected"'; ?> <?php $filter = wppa_opt('widget_status_filter'); ?> <select name="wppa-widget-status-filter" > <option value="" <?php if ($filter == 'none') { echo $sel; } ?> ><?php _e('- none -', 'wp-photo-album-plus'); ?> </option> <option value="publish" <?php if ($filter == 'publish') { echo $sel; } ?> ><?php _e('Publish', 'wp-photo-album-plus'); ?> </option> <option value="featured" <?php if ($filter == 'featured') { echo $sel; } ?> ><?php _e('Featured', 'wp-photo-album-plus'); ?> </option> <option value="gold" <?php if ($filter == 'gold') { echo $sel; } ?> ><?php _e('Gold', 'wp-photo-album-plus'); ?> </option> <option value="silver" <?php if ($filter == 'silver') { echo $sel; } ?> ><?php _e('Silver', 'wp-photo-album-plus'); ?> </option> <option value="bronze" <?php if ($filter == 'bronze') { echo $sel; } ?> ><?php _e('Bronze', 'wp-photo-album-plus'); ?> </option> <option value="anymedal" <?php if ($filter == 'anymedal') { echo $sel; } ?> ><?php _e('Any medal', 'wp-photo-album-plus'); ?> </option> </select> </td> </tr> <tr valign="top" > <th scope="row"> <label ><?php _e('Display method:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $sel = 'selected="selected"'; ?> <?php $method = wppa_opt('widget_method'); ?> <select name="wppa-widget-method" id="wppa-wm" onchange="wppaCheckWidgetMethod()" > <option value="1" <?php if ($method == '1') { echo $sel; } ?> ><?php _e('Fixed photo', 'wp-photo-album-plus'); ?> </option> <option value="2" <?php if ($method == '2') { echo $sel; } ?> ><?php _e('Random', 'wp-photo-album-plus'); ?> </option> <option value="3" <?php if ($method == '3') { echo $sel; } ?> ><?php _e('Last upload', 'wp-photo-album-plus'); ?> </option> <option value="4" <?php if ($method == '4') { echo $sel; } ?> ><?php _e('Change every', 'wp-photo-album-plus'); ?> </option> </select> <?php $period = wppa_opt('widget_period'); $text = esc_attr(__('The page will now be reloaded', 'wp-photo-album-plus')); $onchange = esc_attr('alert(\'' . $text . '\');wppaPotdChangePeriod()'); ?> <script type="text/javascript" > function wppaPotdChangePeriod() { var url = '<?php echo $action_url; ?> '; url += '&wppa-set-submit=1'; url += '&wppa-update-check='+jQuery('#wppa-update-check').val(); url += '&wppa-widget-period='+jQuery('#wppa-wp').val(); document.location.href = url; } </script> <select name="wppa-widget-period" id="wppa-wp" onchange="<?php echo $onchange; ?> " > <option value="0" <?php if ($period == '0') { echo $sel; } ?> ><?php _e('pageview.', 'wp-photo-album-plus'); ?> </option> <option value="1" <?php if ($period == '1') { echo $sel; } ?> ><?php _e('hour.', 'wp-photo-album-plus'); ?> </option> <option value="24" <?php if ($period == '24') { echo $sel; } ?> ><?php _e('day.', 'wp-photo-album-plus'); ?> </option> <option value="168" <?php if ($period == '168') { echo $sel; } ?> ><?php _e('week.', 'wp-photo-album-plus'); ?> </option> <option value="736" <?php if ($period == '736') { echo $sel; } ?> ><?php _e('month.', 'wp-photo-album-plus'); ?> </option> <option value="day-of-week" <?php if ($period == 'day-of-week') { echo $sel; } ?> ><?php _e('day of week is order#', 'wp-photo-album-plus'); ?> </option> <option value="day-of-month" <?php if ($period == 'day-of-month') { echo $sel; } ?> ><?php _e('day of month is order#', 'wp-photo-album-plus'); ?> </option> <option value="day-of-year" <?php if ($period == 'day-of-year') { echo $sel; } ?> ><?php _e('day of year is order#', 'wp-photo-album-plus'); ?> </option> </select> <span class="description"><br/><?php _e('Select how the widget should display.', 'wp-photo-album-plus'); ?> </span> <div class="wppa-order" > <?php if (substr(wppa_opt('widget_period'), 0, 7) == 'day-of-') { switch (substr(wppa_opt('widget_period'), 7)) { case 'week': $n_days = '7'; $date_key = 'w'; break; case 'month': $n_days = '31'; $date_key = 'd'; break; case 'year': $n_days = '366'; $date_key = 'z'; break; } while (get_option('wppa_potd_offset', '0') > $n_days) { update_option('wppa_potd_offset', get_option('wppa_potd_offset') - $n_days); } echo sprintf(__('Current day# = %s, offset =', 'wp-photo-album-plus'), date_i18n($date_key)) . ' '; echo '<select name="wppa-potd-offset" >'; $day = '0'; while ($day < $n_days) { echo '<option value="' . $day . '" ' . (get_option('wppa_potd_offset', '0') == $day ? 'selected="selected"' : '') . ' >' . $day . '</option>'; $day++; } echo '</select>'; $photo_order = date_i18n($date_key) - get_option('wppa_potd_offset', '0'); while ($photo_order < '1') { $photo_order += $n_days; } echo '. ' . sprintf(__('Todays photo order# = %s.', 'wp-photo-album-plus'), $photo_order); $photo = wppa_get_potd(); if ($photo) { echo ' <img src="' . wppa_fix_poster_ext(wppa_get_thumb_url($photo['id']), $photo['id']) . '" style="width:100px;" />'; } else { echo ' ' . __('Not found.', 'wp-photo-album-plus'); } } ?> </div> </td> </tr> <?php $linktype = wppa_opt('widget_linktype'); if ($linktype != 'custom') { ?> <tr> <th scope="row"> <label ><?php _e('Link to:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php _e('Links are set on the <b>Photo Albums -> Settings</b> screen.', 'wp-photo-album-plus'); ?> </td> </tr> <?php } else { ?> <tr class="wppa-wlu" > <th scope="row"> <label ><?php _e('Link to:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php _e('Title:', 'wp-photo-album-plus'); ?> <input type="text" name="wppa-widget-linktitle" id="wppa-widget-linktitle" value="<?php echo wppa_opt('widget_linktitle'); ?> "style="width:20%" /> <?php _e('Url:', 'wp-photo-album-plus'); ?> <input type="text" name="wppa-widget-linkurl" id="wppa-widget-linkurl" value="<?php echo wppa_opt('widget_linkurl'); ?> " style="width:50%" /> <span class="description"><br/><?php _e('Enter the title and the url. Do\'nt forget the HTTP://', 'wp-photo-album-plus'); ?> </span> </td> </tr> <?php } ?> <!--<script type="text/javascript">wppaCheckWidgetLink()</script>--> <tr> <th scope="row"> <label ><?php _e('Subtitle:', 'wp-photo-album-plus'); ?> </label> </th> <td> <?php $subtit = wppa_opt('widget_subtitle'); ?> <select name="wppa-widget-subtitle" id="wppa-st" > <option value="none" <?php if ($subtit == 'none') { echo $sel; } ?> ><?php _e('--- none ---', 'wp-photo-album-plus'); ?> </option> <option value="name" <?php if ($subtit == 'name') { echo $sel; } ?> ><?php _e('Photo Name', 'wp-photo-album-plus'); ?> </option> <option value="desc" <?php if ($subtit == 'desc') { echo $sel; } ?> ><?php _e('Description', 'wp-photo-album-plus'); ?> </option> <option value="owner" <?php if ($subtit == 'owner') { echo $sel; } ?> ><?php _e('Owner', 'wp-photo-album-plus'); ?> </option> </select> <span class="description"><br/><?php _e('Select the content of the subtitle.', 'wp-photo-album-plus'); ?> </span> </td> </tr> </tbody> </table> <p> <input type="submit" class="button-primary" name="wppa-set-submit" value="<?php _e('Save Changes', 'wp-photo-album-plus'); ?> " /> </p> <?php $alb = wppa_opt('widget_album'); $opt = wppa_is_int($alb) ? ' ' . wppa_get_photo_order($alb) . ' ' : ''; $photos = wppa_get_widgetphotos($alb, $opt); if (empty($photos)) { echo '<p>' . __('No photos yet in this album.', 'wp-photo-album-plus') . '</p>'; } else { $curid = wppa_opt('widget_photo'); // Process photos foreach ($photos as $photo) { $id = $photo['id']; // Open container div echo '<div' . ' class="photoselect"' . ' style="' . 'width:180px;' . 'height:300px;' . '" >'; // Open image container div echo '<div' . ' style="' . 'width:180px;' . 'height:135px;' . 'overflow:hidden;' . 'text-align:center;' . '" >'; // The image if a video if (wppa_is_video($id)) { echo wppa_get_video_html(array('id' => $id, 'style' => 'width:180px;')); } else { echo '<img' . ' src=" ' . wppa_fix_poster_ext(wppa_get_thumb_url($id), $id) . '"' . ' style="' . 'max-width:180px;' . 'max-height:135px;' . 'margin:auto;' . '"' . ' alt="' . esc_attr(wppa_get_photo_name($photo['id'])) . '" />'; // Audio ? if (wppa_has_audio($id)) { echo wppa_get_audio_html(array('id' => $id, 'style' => 'width:180px;' . 'position:relative;' . 'bottom:' . (wppa_get_audio_control_height() + 4) . 'px;')); } } // Close image container div echo '</div>'; ?> <div style="clear:both;width:100%;margin:3px 0;" > <div style="font-size:9px; line-height:10px;float:left;"><?php echo '(#' . $photo['p_order'] . ')'; ?> </div> <input style="float:right;" type="radio" name="wppa-widget-photo" id="wppa-widget-photo<?php echo $id; ?> " value="<?php echo $id; ?> " <?php if ($id == $curid) { echo 'checked="checked"'; } ?> /> </div> <div style="clear:both;overflow:auto;height:150px" > <div style="font-size:11px; overflow:hidden;"><?php echo wppa_get_photo_name($photo['id']); ?> </div> <div style="font-size:9px; line-height:10px;"><?php echo wppa_get_photo_desc($photo['id']); ?> </div> </div> </div> <?php } echo '<div class="clear"></div>'; } ?> <script type="text/javascript">wppaCheckWidgetMethod();</script> <br /> <p> <input type="submit" class="button-primary" name="wppa-set-submit" value="<?php _e('Save Changes', 'wp-photo-album-plus'); ?> " /> </p> </form> </div> <?php }
/** @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 $widget_content .= "\n\t" . '<a href="' . $link['url'] . '" title="' . $title . '" target="' . $link['target'] . '" >'; if (wppa_is_video($image['id'])) { $widget_content .= wppa_get_video_html(array('id' => $image['id'], 'width' => $width, 'height' => $height, 'controls' => false, 'margin_top' => $imgstyle_a['margin-top'], 'margin_bottom' => $imgstyle_a['margin-bottom'], 'cursor' => 'pointer', 'events' => $imgevents, 'tagid' => 'i-' . $image['id'] . '-' . $wppa['mocc'], 'title' => $title)); } else { $widget_content .= "\n\t\t" . '<img id="i-' . $image['id'] . '-' . $wppa['mocc'] . '" title="' . $title . '" src="' . $imgurl . '" width="' . $width . '" height="' . $height . '" style="' . $imgstyle . ' cursor:pointer;" ' . $imgevents . ' ' . wppa_get_imgalt($image['id']) . ' >'; } $widget_content .= "\n\t" . '</a>'; } elseif ($link['is_lightbox']) { $thumbs = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `album` = %s " . wppa_get_photo_order($album['id']), $album['id']), 'ARRAY_A'); if ($thumbs) { foreach ($thumbs as $thumb) { $title = wppa_get_lbtitle('alw', $thumb['id']); if (wppa_is_video($thumb['id'])) { $siz['0'] = wppa_get_videox($thumb['id']); $siz['1'] = wppa_get_videoy($thumb['id']); } else { // $siz = getimagesize( wppa_get_photo_path( $thumb['id'] ) ); $siz['0'] = wppa_get_photox($thumb['id']); $siz['1'] = wppa_get_photoy($thumb['id']); } $link = wppa_fix_poster_ext(wppa_get_photo_url($thumb['id'], '', $siz['0'], $siz['1']), $thumb['id']); $is_video = wppa_is_video($thumb['id']); $has_audio = wppa_has_audio($thumb['id']); $widget_content .= "\n\t" . '<a href="' . $link . '"' . ($is_video ? ' data-videohtml="' . esc_attr(wppa_get_video_body($thumb['id'])) . '"' . ' data-videonatwidth="' . wppa_get_videox($thumb['id']) . '"' . ' data-videonatheight="' . wppa_get_videoy($thumb['id']) . '"' : '') . ($has_audio ? ' data-audiohtml="' . esc_attr(wppa_get_audio_body($thumb['id'])) . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('wppa_lightbox_name') . '[alw-' . $wppa['mocc'] . '-' . $album['id'] . ']"' . ' ' . wppa('lbtitle') . '="' . $title . '" >'; if ($thumb['id'] == $image['id']) { // the cover image if (wppa_is_video($image['id'])) { $widget_content .= wppa_get_video_html(array('id' => $image['id'], 'width' => $width, 'height' => $height, 'controls' => false, 'margin_top' => $imgstyle_a['margin-top'], 'margin_bottom' => $imgstyle_a['margin-bottom'], 'cursor' => $cursor, 'events' => $imgevents, 'tagid' => 'i-' . $image['id'] . '-' . $wppa['mocc'], 'title' => wppa_zoom_in($image['id']))); } else { $widget_content .= "\n\t\t" . '<img id="i-' . $image['id'] . '-' . $wppa['mocc'] . '" title="' . wppa_zoom_in($image['id']) . '" src="' . $imgurl . '" width="' . $width . '" height="' . $height . '" style="' . $imgstyle . $cursor . '" ' . $imgevents . ' ' . wppa_get_imgalt($image['id']) . ' >'; } } $widget_content .= "\n\t" . '</a>'; } } } else { // Is an onclick unit if (wppa_is_video($image['id'])) { $widget_content .= wppa_get_video_html(array('id' => $image['id'], 'width' => $width, 'height' => $height, 'controls' => false, 'margin_top' => $imgstyle_a['margin-top'], 'margin_bottom' => $imgstyle_a['margin-bottom'], 'cursor' => 'pointer', 'events' => $imgevents . ' onclick="' . $link['url'] . '"', 'tagid' => 'i-' . $image['id'] . '-' . $wppa['mocc'], 'title' => $title)); } else { $widget_content .= "\n\t" . '<img id="i-' . $image['id'] . '-' . $wppa['mocc'] . '" title="' . $title . '" src="' . $imgurl . '" width="' . $width . '" height="' . $height . '" style="' . $imgstyle . ' cursor:pointer;" ' . $imgevents . ' onclick="' . $link['url'] . '" ' . wppa_get_imgalt($image['id']) . ' >'; } } } else { if (wppa_is_video($image['id'])) { $widget_content .= wppa_get_video_html(array('id' => $image['id'], 'width' => $width, 'height' => $height, 'controls' => false, 'margin_top' => $imgstyle_a['margin-top'], 'margin_bottom' => $imgstyle_a['margin-bottom'], 'cursor' => 'pointer', 'events' => $imgevents, 'tagid' => 'i-' . $image['id'] . '-' . $wppa['mocc'], 'title' => $title)); } else { $widget_content .= "\n\t" . '<img id="i-' . $image['id'] . '-' . $wppa['mocc'] . '" title="' . $title . '" src="' . $imgurl . '" width="' . $width . '" height="' . $height . '" style="' . $imgstyle . '" ' . $imgevents . ' ' . wppa_get_imgalt($image['id']) . ' >'; } } if ($name == 'yes') { $widget_content .= "\n\t" . '<span style="font-size:' . wppa_opt('wppa_fontsize_widget_thumb') . 'px; min-height:100%;">' . __(stripslashes($album['name'])) . '</span>'; } $widget_content .= "\n" . '</div>'; $count++; } } } } else { $widget_content .= 'There are no albums (yet).'; } $widget_content .= '<div style="clear:both"></div>'; $widget_content .= "\n" . '<!-- WPPA+ thumbnail 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; }
function wppa_the_thumbascoverphoto($id, $src, $photo_left, $link, $imgattr_a, $events) { $result = ''; $href = $link['url']; $title = $link['title']; $imgattr = $imgattr_a['style']; $imgwidth = $imgattr_a['width']; $imgheight = $imgattr_a['height']; $frmwidth = $imgwidth + '10'; // + 2 * 1 border + 2 * 4 padding if (!$src) { return ''; } if (wppa_in_widget()) { $photoframestyle = 'style="text-align:center;"'; } else { $photoframestyle = $photo_left ? 'style="float:left; margin-right:5px;width:' . $frmwidth . 'px;"' : 'style="float:right; margin-left:5px;width:' . $frmwidth . 'px;"'; } $result .= '<div' . ' id="thumbphoto_frame_' . $id . '_' . wppa('mocc') . '"' . ' class="thumbphoto-frame"' . ' ' . $photoframestyle . '>'; if ($link['is_lightbox']) { $href = wppa_get_hires_url($id); $cursor = ' cursor:url( ' . wppa_get_imgdir() . wppa_opt('magnifier') . ' ),pointer;'; $result .= '<a' . ' href="' . $href . '"' . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '[occ' . wppa('mocc') . ']"' . ($title ? ' ' . wppa('lbtitle') . '="' . $title . '"' : '') . ' >'; if (wppa_is_video($id)) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => false, 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'lb' => false, 'class' => 'image wppa-img', 'style' => __wcs('wppa-img') . $imgattr . $cursor)); } else { $result .= '<img' . ' src="' . $src . '"' . ' ' . wppa_get_imgalt($id) . ' class="image wppa-img"' . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . __wcs('wppa-img') . $imgattr . $cursor . '"' . ' ' . $events . ' />'; } $result .= '</a>'; } elseif ($link['is_url']) { $result .= '<a' . ' href="' . $href . '"' . ($title ? ' title="' . $title . '"' : '') . ' >'; if (wppa_is_video($id)) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => false, 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'lb' => false, 'class' => 'image wppa-img', 'style' => __wcs('wppa-img') . $imgattr)); } else { $result .= '<img' . ' src="' . $src . '"' . ' ' . wppa_get_imgalt($id) . ' class="image wppa-img"' . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . __wcs('wppa-img') . $imgattr . '"' . ' ' . $events . ' />'; } $result .= '</a>'; } else { if (wppa_is_video($id)) { $result .= wppa_get_video_html(array('id' => $id, 'width' => $imgwidth, 'height' => $imgheight, 'controls' => false, 'tagid' => 'i-' . $id . '-' . wppa('mocc'), 'events' => $events, 'title' => $title, 'preload' => 'metadata', 'onclick' => $href, 'lb' => false, 'class' => 'image wppa-img', 'style' => __wcs('wppa-img') . $imgattr)); } else { $result .= '<img' . ' src="' . $src . '"' . ' ' . wppa_get_imgalt($id) . ' class="image wppa-img"' . ' width="' . $imgwidth . '"' . ' height="' . $imgheight . '"' . ' style="' . __wcs('wppa-img') . $imgattr . '"' . ' ' . $events . ' onclick="' . $href . '"' . ' />'; } } $result .= '</div>'; return $result; }
function wppa_lightbox_global($content) { if (wppa_switch('lightbox_global')) { if (wppa_opt('lightbox_name') == 'wppa') { // Our lightbox if (wppa_switch('lightbox_global_set')) { // A set $pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i"; $replacement = '<a$1href=$2$3.$4$5 data-rel="wppa[single]" style="' . ' cursor:url(' . wppa_get_imgdir() . wppa_opt('magnifier') . '),pointer;' . '"$6>'; $content = preg_replace($pattern, $replacement, $content); } else { // Not a set $pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i"; $replacement = '<a$1href=$2$3.$4$5 data-rel="wppa" style="' . ' cursor:url(' . wppa_get_imgdir() . wppa_opt('magnifier') . '),pointer;' . '"$6>'; $content = preg_replace($pattern, $replacement, $content); } } } return $content; }
function wppa_startstop_icons() { // Do they need us? if (!wppa_switch('show_start_stop_icons')) { return; } /* $type = wppa_opt( 'start_stop_icons_type' ); // Set type dependant dimensions switch ( $type ) { case 'r.png': $size = '72'; $curv = '36'; break; default: */ $size = wppa_opt('start_pause_symbol_size'); $curv = wppa_opt('start_pause_symbol_bradius'); /* } // Scale down for widgets if ( wppa_in_widget() ) { $size /= '2'; $curv /= '2'; } */ // Create and output the html wppa_out('<img' . ' id="wppa-startstop-icon-' . wppa('mocc') . '"' . ' src="' . (wppa_opt('wppa_start_symbol_url') ? wppa_opt('wppa_start_symbol_url') : wppa_get_imgdir('start.png')) . '"' . ' alt="start stop"' . ' style="' . 'position:absolute;' . 'left:50%;' . 'margin-left:' . -$size / '2' . 'px;' . 'top:50%;' . 'margin-top:' . -$size / '2' . 'px;' . 'z-index:90;' . 'width:' . $size . 'px;' . 'border-radius:' . $curv . 'px;' . 'opacity:0.8;' . 'cursor:pointer;' . 'box-shadow:none;' . '"' . ' onclick="wppaStartStop( ' . wppa('mocc') . ', -1 );"' . ' onmouseover="jQuery(this).fadeTo(200,0.8);"' . ' onmouseout="jQuery(this).fadeTo(200,0);"' . ' ontouchstart="jQuery(this).fadeTo(200,0.8);"' . ' ontouchend="wppaStartStop( ' . wppa('mocc') . ', -1 );"' . ' onload="jQuery(this).fadeTo(1000,0);"' . ' />'); }
function wppa_get_rating_range_html($id = 0, $is_lightbox = false, $class = '') { global $wpdb; // Not on a feed if (is_feed()) { return ''; } // On lightbox: only if in visibility settings set. if ($is_lightbox) { if (!wppa_switch('ovl_rating')) { return ''; } } if ($id) { $wait_text = wppa_get_rating_wait_text($id, wppa_get_user()); if ($wait_text) { return '<span class="' . $class . '" style="color:red" >' . $wait_text . '</span>'; } if (wppa_get_photo_item($id, 'owner') == wppa_get_user() && !wppa_switch('allow_owner_votes')) { return '<span class="' . $class . '" >' . __('Sorry, you can not rate your own photos', 'wp-photo-album-plus') . '</span>'; } $mylast = $wpdb->get_row($wpdb->prepare('SELECT * FROM `' . WPPA_RATING . '` WHERE `photo` = %s AND `user` = %s ORDER BY `id` DESC LIMIT 1', $id, wppa_get_user()), ARRAY_A); if ($mylast && !wppa_switch('rating_change') && !wppa_switch('rating_multi')) { return '<span class="' . $class . '" >' . __('Sorry, you can rate a photo only once', 'wp-photo-album-plus') . '</span>'; } } // Mphoto, xphoto and lightbox use a different js function than slideshow. // In slideshow the id is not known and retrieved from _wppaCurIdx[mocc]. // There is also a difference in css. $idorlb = $id || $is_lightbox; // If on xphoto, reload after $reload = wppa('is_xphoto') ? 'true' : 'false'; $result = ''; $fs = wppa_opt('fontsize_nav'); if ($fs) { $fs += 3; } else { $fs = '15'; } // iconsize = fontsize+3, Default to 15 $dh = $fs + '6'; $size = 'font-size:' . $fs . 'px;'; // Open the rating box $result .= '<div' . ' id="wppa-rating-' . wppa('mocc') . '"' . ' class="' . ($idorlb ? $class : 'wppa-box wppa-nav wppa-nav-text') . '"' . ' style="' . ($idorlb ? 'padding:4px;' : __wcs('wppa-box') . __wcs('wppa-nav') . __wcs('wppa-nav-text')) . $size . ' text-align:center;"' . '> '; // Graphic display ? if (wppa_opt('rating_display_type') == 'graphic') { if (wppa_opt('rating_max') == '5') { $r['1'] = __('very low', 'wp-photo-album-plus'); $r['2'] = __('low', 'wp-photo-album-plus'); $r['3'] = __('average', 'wp-photo-album-plus'); $r['4'] = __('high', 'wp-photo-album-plus'); $r['5'] = __('very high', 'wp-photo-album-plus'); } else { for ($i = '1'; $i <= '10'; $i++) { $r[$i] = $i; } } $style = 'height:' . $fs . 'px; margin:0 0 -3px 0; padding:0; box-shadow:none; display:inline;background-color:transparent;'; $icon = 'star.ico'; // Display avg rating if (wppa_switch('show_avg_rating')) { if ($id) { $avgrat = wppa_get_rating_by_id($id, 'nolabel'); $opac = array(); $i = '1'; while ($i <= wppa_opt('rating_max')) { if ($avgrat >= $i) { $opac[$i] = 'opacity:1;'; } else { if ($avgrat <= $i - '1') { $opac[$i] = 'opacity:0.2;'; } else { $opac[$i] = 'opacity:' . (0.2 + 0.8 * ($avgrat - $i + '1')); } } $i++; } } $result .= '<span' . ' id="wppa-avg-rat-' . wppa('mocc') . '"' . ' class="wppa-rating-label"' . ' >' . __('Average rating', 'wp-photo-album-plus') . '</span> '; $i = '1'; while ($i <= wppa_opt('rating_max')) { $result .= '<img' . ' id="wppa-avg-' . wppa('mocc') . '-' . $i . '"' . ' class="wppa-avg-' . wppa('mocc') . '-' . $i . ' wppa-avg-' . wppa('mocc') . ' no-shadow"' . ' style="' . $style . ($id ? $opac[$i] : '') . '"' . ' src="' . wppa_get_imgdir() . $icon . '"' . ' alt=" ' . $i . '"' . ' title="' . __('Average rating', 'wp-photo-album-plus') . ': ' . $r[$i] . '"' . ' />'; $i++; } } $result .= '<img' . ' id="wppa-filler-' . wppa('mocc') . '"' . ' src="' . wppa_get_imgdir() . 'transp.png"' . ' alt="f"' . ' style="width:' . wppa_opt('ratspacing') . 'px; height:15px; box-shadow:none; padding:0; margin:0; border:none;"' . ' />'; // Display my rating // Logged in or don't care if (!wppa_switch('rating_login') || is_user_logged_in()) { // Show dislike icon? $pad = round((wppa_opt('ratspacing') - $fs) / 2); if ($pad < 5) { $pad = '5'; } if (wppa_opt('dislike_mail_every')) { $confirm = esc_attr(str_replace('"', "'", __('Are you sure you want to mark this image as inappropriate?', 'wp-photo-album-plus'))); $result .= '<img' . ' id="wppa-dislike-' . wppa('mocc') . '"' . ' title="' . __('Click this if you do NOT like this image!', 'wp-photo-album-plus') . '"' . ' src="' . wppa_get_imgdir() . 'thumbdown.png"' . ' alt="d"' . ' style="height:' . $fs . 'px; margin:0 0 -3px 0; padding:0 ' . $pad . 'px; box-shadow:none; display:inline;"' . ' class="no-shadow"' . ' onmouseover="jQuery(this).stop().fadeTo(100, 1.0)"' . ' onmouseout="jQuery(this).stop().fadeTo(100, wppaStarOpacity)"' . ' onclick="'; if ($idorlb) { $result .= 'if (confirm(\'' . $confirm . '\')) { wppaOvlRateIt( \'' . wppa_encrypt_photo($id) . '\', -1, ' . ($id ? wppa('mocc') : '0') . ' ); }'; } else { $result .= 'if (confirm(\'' . $confirm . '\')) { wppaRateIt( ' . wppa('mocc') . ', -1); }'; } $result .= '"' . ' />'; if ($idorlb) { $mylast = wppa_get_my_last_vote($id); if ($mylast == '-1') { $result .= '<script type="text/javascript" >jQuery(\'#wppa-dislike-' . wppa('mocc') . '\').css(\'display\'. \'none\');</script>'; } else { $result .= '<script type="text/javascript" >jQuery(\'#wppa-dislike-' . wppa('mocc') . '\').fadeTo(100,' . wppa_opt('star_opacity') / 100 . ');</script>'; } } if (wppa_switch('dislike_show_count')) { $result .= '<span' . ' id="wppa-discount-' . wppa('mocc') . '"' . ' style="cursor:default"' . ' title="' . __('Number of people who marked this photo as inappropriate', 'wp-photo-album-plus') . '"' . ' >' . '</span>'; } } // Text left if no avg rating if (!wppa_switch('show_avg_rating')) { $result .= __('My rating', 'wp-photo-album-plus') . ': '; } // Display the my rating stars if ($id) { $myavgrat = wppa_get_my_rating_by_id($id, 'nolabel'); $opac = array(); $i = '1'; while ($i <= wppa_opt('rating_max')) { if ($myavgrat >= $i) { $opac[$i] = 'opacity:1;'; } else { if ($myavgrat <= $i - '1') { $opac[$i] = 'opacity:0.2;'; } else { $opac[$i] = 'opacity:' . (0.2 + 0.8 * ($myavgrat - $i + '1')); } } $i++; } } $i = '1'; while ($i <= wppa_opt('rating_max')) { $result .= '<img' . ' id="wppa-rate-' . wppa('mocc') . '-' . $i . '"' . ' class="wppa-rate-' . wppa('mocc') . '-' . $i . ' wppa-rate-' . wppa('mocc') . ' no-shadow"' . ' style="' . $style . ($id ? $opac[$i] : '') . '"' . ' src="' . wppa_get_imgdir() . $icon . '"' . ' alt="' . $i . '"' . ' title="' . __('My rating', 'wp-photo-album-plus') . ': ' . $r[$i] . '"' . ($id ? ' onmouseover="wppaOvlFollowMe(' . wppa('mocc') . ', ' . $i . ', ' . $myavgrat . ' )"' . ' onmouseout="wppaOvlLeaveMe(' . wppa('mocc') . ', ' . $i . ', ' . $myavgrat . ' )"' : ' onmouseover="wppaFollowMe(' . wppa('mocc') . ', ' . $i . ')"' . ' onmouseout="wppaLeaveMe(' . wppa('mocc') . ', ' . $i . ')"') . ($idorlb ? ' onclick="wppaOvlRateIt(\'' . wppa_encrypt_photo($id) . '\', ' . $i . ', ' . ($id ? wppa('mocc') : '0') . ', ' . $reload . ' )"' : ' onclick="wppaRateIt(' . wppa('mocc') . ', ' . $i . ')"') . ' />'; $i++; } // Text right if avg rating diaplayed if (wppa_switch('show_avg_rating')) { $result .= ' ' . '<span' . ' id="wppa-my-rat-' . wppa('mocc') . '" ' . ' class="wppa-rating-label"' . '>' . __('My rating', 'wp-photo-album-plus') . '</span>'; } } else { if (wppa_switch('login_links')) { $result .= sprintf(__('You must <a href="%s">login</a> to vote', 'wp-photo-album-plus'), site_url('wp-login.php', 'login')); } else { $result .= __('You must login to vote', 'wp-photo-album-plus'); } } } elseif (wppa_opt('rating_display_type') == 'numeric') { // Display avg rating if (wppa_switch('show_avg_rating')) { $result .= __('Average rating', 'wp-photo-album-plus') . ': ' . '<span id="wppa-numrate-avg-' . wppa('mocc') . '"></span>' . ' •'; } // Display my rating // Logged in or don't care if (!wppa_switch('rating_login') || is_user_logged_in()) { // Show dislike icon? $pad = round((wppa_opt('ratspacing') - $fs) / 2); if ($pad < 5) { $pad = '5'; } if (wppa_opt('dislike_mail_every')) { $result .= '<div' . ' id="wppa-dislike-imgdiv-' . wppa('mocc') . '"' . ' style="display:inline"' . ' >'; $confirm = esc_attr(str_replace('"', "'", __('Are you sure you want to mark this image as inappropriate?', 'wp-photo-album-plus'))); $result .= '<img' . ' id="wppa-dislike-' . wppa('mocc') . '"' . ' title="' . __('Click this if you do NOT like this image!', 'wp-photo-album-plus') . '"' . ' src="' . wppa_get_imgdir() . 'thumbdown.png"' . ' alt="d"' . ' style="height:' . $fs . 'px; margin:0 0 -3px 0; padding:0 ' . $pad . 'px; box-shadow:none; display:inline;"' . ' class="no-shadow"' . ' onmouseover="jQuery(this).stop().fadeTo(100, 1.0)"' . ' onmouseout="jQuery(this).stop().fadeTo(100, wppaStarOpacity)"' . ' onclick="'; if ($idorlb) { $result .= 'if (confirm(\'' . $confirm . '\')) { wppaOvlRateIt( \'' . wppa_encrypt_photo($id) . '\', -1, ' . ($id ? wppa('mocc') : '0') . ' ); }'; } else { $result .= 'if (confirm(\'' . $confirm . '\')) { wppaRateIt( ' . wppa('mocc') . ', -1); }'; } $result .= '"' . ' />'; $result .= '</div>'; if (wppa_switch('dislike_show_count')) { $result .= '<span' . ' id="wppa-discount-' . wppa('mocc') . '"' . ' style="cursor:default"' . ' title="' . __('Number of people who marked this photo as inappropriate', 'wp-photo-album-plus') . '"' . ' >' . '</span>'; } } $result .= ' ' . __('My rating:', 'wp-photo-album-plus'); $result .= '<span id="wppa-numrate-mine-' . wppa('mocc') . '" ></span>'; } else { if (wppa_switch('login_links')) { $result .= sprintf(__('You must <a href="%s">login</a> to vote', 'wp-photo-album-plus'), site_url('wp-login.php', 'login')); } else { $result .= __('You must login to vote', 'wp-photo-album-plus'); } } } // Close rating box $result .= '</div>'; return $result; }
function wppa_add_page_specific_urls() { $result = ' <!-- WPPA+ BEGIN Page specific urls --> <script type="text/javascript"> wppaImageDirectory = "' . wppa_get_imgdir() . '"; wppaWppaUrl = "' . wppa_get_wppa_url() . '"; wppaIncludeUrl = "' . trim(includes_url(), '/') . '"; wppaAjaxUrl = "' . (wppa_switch('wppa_ajax_non_admin') ? wppa_url('wppa-ajax-front.php') : admin_url('admin-ajax.php')) . '"; wppaUploadUrl = "' . WPPA_UPLOAD_URL . '"; </script> <!-- WPPA+ END Page specific urls -->'; // Relative urls? if (wppa_switch('relative_urls')) { $result = str_replace(site_url(), '', $result); } echo $result; }
function wppa_select($xslug, $options, $values, $onchange = '', $class = '', $first_disable = false, $postaction = '', $max_width = '220') { global $wppa_opt; $slug = substr($xslug, 5); $tit = __('Slug =', 'wp-photo-album-plus') . ' ' . $xslug . "\n" . __('Values = ', 'wp-photo-album-plus'); foreach ($values as $val) { $tit .= $val . ', '; } $tit = trim($tit, ', '); $title = wppa_switch('enable_shortcode_wppa_set') ? ' title="' . esc_attr($tit) . '"' : ''; $html = '<select style="float:left; font-size: 11px; height: 20px; margin: 0px; padding: 0px; max-width:' . $max_width . 'px;" id="' . $slug . '"' . $title; $html .= ' onchange="' . $onchange . ';wppaAjaxUpdateOptionValue(\'' . $slug . '\', this);' . $postaction . '"'; if ($class != '') { $html .= ' class="' . $class . '"'; } $html .= '>'; $val = get_option($xslug); // value can be yes or no in Table 0 !! so do not use wppa_opt() $idx = 0; $cnt = count($options); while ($idx < $cnt) { $html .= "\n"; $html .= '<option value="' . $values[$idx] . '" '; $dis = false; if ($idx == 0 && $first_disable) { $dis = true; } $opt = trim($options[$idx], '|'); if ($opt != $options[$idx]) { $dis = true; } if ($val == $values[$idx]) { $html .= ' selected="selected"'; } if ($dis) { $html .= ' disabled="disabled"'; } $html .= '>' . $opt . '</option>'; $idx++; } $html .= '</select>'; $html .= '<img id="img_' . $slug . '" class="' . $class . '" src="' . wppa_get_imgdir() . 'star.ico" title="' . __('Setting unmodified', 'wp-photo-album-plus') . '" style="padding:0 4px; float:left; height:16px; width:16px;" />'; return $html; }