function wppa_make_tinymce_dialog() { global $wpdb; // Prepare albuminfo $albums = $wpdb->get_results("SELECT `id`, `name` FROM `" . WPPA_ALBUMS . "` ORDER BY `timestamp` DESC", ARRAY_A); if (wppa_switch('hier_albsel')) { $albums = wppa_add_paths($albums); $albums = wppa_array_sort($albums, 'name'); } // Prepare photoinfo $photos = $wpdb->get_results("SELECT `id`, `name`, `album`, `ext` FROM `" . WPPA_PHOTOS . "` ORDER BY `timestamp` DESC LIMIT 100", ARRAY_A); // Get Tags/cats $tags = wppa_get_taglist(); $cats = wppa_get_catlist(); // Make the html $result = '<div id="wppagallery-form">' . '<style type="text/css">' . '#wppagallery-table tr, #wppagallery-table th, #wppagallery-table td {' . 'padding: 2px; 0;' . '}' . '</style>' . '<table id="wppagallery-table" class="form-table">' . '<tr >' . '<th><label for="wppagallery-top-type">' . __('Type of WPPA display:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-top-type" name="type" onchange="wppaGalleryEvaluate()">' . '<option value="" selected="selected" disabled="disabled" style="color:#700" >-- ' . __('Please select a display type', 'wp-photo-album-plus') . ' --</option>' . '<option value="galerytype" style="color:#070" >' . __('A gallery with covers and/or thumbnails', 'wp-photo-album-plus') . '</option>' . '<option value="slidestype" style="color:#070" >' . __('A slideshow', 'wp-photo-album-plus') . '</option>' . '<option value="singletype" style="color:#070" >' . __('A single image', 'wp-photo-album-plus') . '</option>' . '<option value="searchtype" style="color:#070" >' . __('A search/selection box', 'wp-photo-album-plus') . '</option>' . '<option value="misceltype" style="color:#070" >' . __('An other box type', 'wp-photo-album-plus') . '</option>' . '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-galery-type-tr" style="display:none;" >' . '<th><label for="wppagallery-galery-type">' . __('Type of gallery display:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-galery-type" name="type" onchange="wppaGalleryEvaluate()">' . '<option value="" selected="selected" disabled="disabled" style="color:#700" >-- ' . __('Please select a gallery type', 'wp-photo-album-plus') . ' --</option>' . '<option value="cover" style="color:#070" >' . __('The cover(s) of specific album(s)', 'wp-photo-album-plus') . '</option>' . '<option value="content" style="color:#070" >' . __('The content of specific album(s)', 'wp-photo-album-plus') . '</option>' . '<option value="covers" style="color:#070" >' . __('The covers of the subalbums of specific album(s)', 'wp-photo-album-plus') . '</option>' . '<option value="thumbs" style="color:#070" >' . __('The thumbnails of specific album(s)', 'wp-photo-album-plus') . '</option>' . '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-slides-type-tr" style="display:none;" >' . '<th><label for="wppagallery-slides-type">' . __('Type of slideshow:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-slides-type" name="type" onchange="wppaGalleryEvaluate()">' . '<option value="" selected="selected" disabled="disabled" style="color:#700" >-- ' . __('Please select a slideshow type', 'wp-photo-album-plus') . ' --</option>' . '<option value="slide" style="color:#070" >' . __('A fully featured slideshow', 'wp-photo-album-plus') . '</option>' . '<option value="slideonly" style="color:#070" >' . __('A slideshow without supporting boxes', 'wp-photo-album-plus') . '</option>' . '<option value="slideonlyf" style="color:#070" >' . __('A slideshow with a filmstrip only', 'wp-photo-album-plus') . '</option>' . '<option value="filmonly" style="color:#070" >' . __('A filmstrip only', 'wp-photo-album-plus') . '</option>' . '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-single-type-tr" style="display:none;" >' . '<th><label for="wppagallery-single-type">' . __('Type of single image:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-single-type" name="type" onchange="wppaGalleryEvaluate()">' . '<option value="" selected="selected" disabled="disabled" style="color:#700" >-- ' . __('Please select a single image type', 'wp-photo-album-plus') . ' --</option>' . '<option value="photo" style="color:#070" >' . __('A plain single photo', 'wp-photo-album-plus') . '</option>' . '<option value="mphoto" style="color:#070" >' . __('A single photo with caption', 'wp-photo-album-plus') . '</option>' . '<option value="slphoto" style="color:#070" >' . __('A single photo in the style of a slideshow', 'wp-photo-album-plus') . '</option>' . '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-search-type-tr" style="display:none;" >' . '<th><label for="wppagallery-search-type">' . __('Type of search:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-search-type" name="type" onchange="wppaGalleryEvaluate()">' . '<option value="" selected="selected" disabled="disabled" style="color:#700" >-- ' . __('Please select a search type', 'wp-photo-album-plus') . ' --</option>' . '<option value="search" style="color:#070" >' . __('A search box', 'wp-photo-album-plus') . '</option>' . '<option value="supersearch" style="color:#070" >' . __('A supersearch box', 'wp-photo-album-plus') . '</option>' . '<option value="tagcloud" style="color:#070" >' . __('A tagcloud box', 'wp-photo-album-plus') . '</option>' . '<option value="multitag" style="color:#070" >' . __('A multitag box', 'wp-photo-album-plus') . '</option>' . '<option value="superview" style="color:#070" >' . __('A superview box', 'wp-photo-album-plus') . '</option>' . '<option value="calendar" style="color:#070" >' . __('A calendar box', 'wp-photo-album-plus') . '</option>' . '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-miscel-type-tr" style="display:none;" >' . '<th><label for="wppagallery-miscel-type">' . __('Type miscellaneous:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-miscel-type" name="type" onchange="wppaGalleryEvaluate()">' . '<option value="" selected="selected" disabled="disabled" style="color:#700" >-- ' . __('Please select a miscellaneous display', 'wp-photo-album-plus') . ' --</option>' . '<option value="generic">' . __('A generic albums display', 'wp-photo-album-plus') . '</option>' . '<option value="upload">' . __('An upload box', 'wp-photo-album-plus') . '</option>' . '<option value="landing">' . __('A landing page shortcode', 'wp-photo-album-plus') . '</option>' . '<option value="stereo">' . __('A 3D stereo settings box', 'wp-photo-album-plus') . '</option>' . '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-album-type-tr" style="display:none;" >' . '<th><label for="wppagallery-album-type">' . __('Kind of selection:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-album-type" name="type" onchange="wppaGalleryEvaluate()">' . '<option value="" selected="selected" disabled="disabled" style="color:#700" >-- ' . __('Please select a type of selection to be used', 'wp-photo-album-plus') . ' --</option>' . '<option value="real">' . __('One or more wppa+ albums', 'wp-photo-album-plus') . '</option>' . '<option value="virtual">' . __('A special selection', 'wp-photo-album-plus') . '</option>' . '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-album-virt-tr" style="display:none;" >' . '<th><label for="wppagallery-album-virt">' . __('The selection to be used:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-album-virt" name="album" class="wppagallery-album" onchange="wppaGalleryEvaluate()">' . '<option value="" disabled="disabled" selected="selected" style="color:#700" >-- ' . __('Please select a virtual album', 'wp-photo-album-plus') . ' --</option>' . '<option value="#last" >' . __('The most recently modified album', 'wp-photo-album-plus') . '</option>' . '<option value="#topten" >' . __('The top rated photos', 'wp-photo-album-plus') . '</option>' . '<option value="#lasten" >' . __('The most recently uploaded photos', 'wp-photo-album-plus') . '</option>' . '<option value="#featen" >' . __('A random selection of featured photos', 'wp-photo-album-plus') . '</option>' . '<option value="#comten" >' . __('The most recently commented photos', 'wp-photo-album-plus') . '</option>' . '<option value="#tags" >' . __('Photos that have certain tags', 'wp-photo-album-plus') . '</option>' . '<option value="#cat" >' . __('Albums tagged with a certain category', 'wp-photo-album-plus') . '</option>' . '<option value="#owner" >' . __('Photos in albums owned by a certain user', 'wp-photo-album-plus') . '</option>' . '<option value="#upldr" >' . __('Photos uploaded by a certain user', 'wp-photo-album-plus') . '</option>' . '<option value="#all" >' . __('All photos in the system', 'wp-photo-album-plus') . '</option>' . '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-album-virt-cover-tr" style="display:none;" >' . '<th><label for="wppagallery-album-virt-cover">' . __('The selection to be used:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-album-virt-cover" name="album" class="wppagallery-album" onchange="wppaGalleryEvaluate()">' . '<option value="" disabled="disabled" selected="selected" style="color:#700" >-- ' . __('Please select a virtual album', 'wp-photo-album-plus') . ' --</option>' . '<option value="#last" >' . __('The most recently modified album', 'wp-photo-album-plus') . '</option>' . '<option value="#owner" >' . __('Albums owned by a certain user', 'wp-photo-album-plus') . '</option>' . '<option value="#cat" >' . __('Albums tagged with a certain category', 'wp-photo-album-plus') . '</option>' . '<option value="#all" >' . __('All albums in the system', 'wp-photo-album-plus') . '</option>' . '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-album-real-tr" style="display:none;" >' . '<th><label for="wppagallery-album-real">' . __('The Album(s) to be used:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-album-real" style="max-width:400px;" name="album" multiple="multiple" onchange="wppaGalleryEvaluate()">'; if ($albums) { // Please select $result .= '<option id="wppagallery-album-0" value="0" disabled="disabled" selected="selected" style="color:#700" >-- ' . __('Please select one or more albums', 'wp-photo-album-plus') . ' --</option>'; // All standard albums foreach ($albums as $album) { $id = $album['id']; $result .= '<option class="wppagallery-album-r" value="' . $id . '" >' . stripslashes(__($album['name'], 'wp-photo-album-plus')) . ' (' . $id . ')</option>'; } } else { $result .= '<option value="0" >' . __('There are no albums yet', 'wp-photo-album-plus') . '</option>'; } $result .= '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-album-realopt-tr" style="display:none;" >' . '<th><label for="wppagallery-album-realopt">' . __('The Album(s) to be used:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-album-realopt" style="max-width:400px;" name="album" multiple="multiple" onchange="wppaGalleryEvaluate()">'; if ($albums) { // Please select $result .= '<option id="wppagallery-album-0" class="wppagallery-album-ropt" value="0" selected="selected" style="color:#070" >-- ' . __('All albums', 'wp-photo-album-plus') . ' --</option>'; // All standard albums foreach ($albums as $album) { $id = $album['id']; $result .= '<option class="wppagallery-album-ropt" style="color:#070" value="' . $id . '" >' . stripslashes(__($album['name'], 'wp-photo-album-plus')) . ' (' . $id . ')</option>'; } } else { $result .= '<option value="0" >' . __('There are no albums yet', 'wp-photo-album-plus') . '</option>'; } $result .= '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-owner-tr" style="display:none" >' . '<th><label for="wppagallery-owner">' . __('The album owner:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-owner" name="owner" class="wppagallery-owner" onchange="wppaGalleryEvaluate()">' . '<option value="" disabled="disabled" selected="selected" style="color:#700" >-- ' . __('Please select a user', 'wp-photo-album-plus') . ' --</option>' . '<option value="#me" >-- ' . __('The logged in visitor', 'wp-photo-album-plus') . ' --</option>'; $users = wppa_get_users(); if ($users) { foreach ($users as $user) { $result .= '<option value="' . $user['user_login'] . '" >' . $user['display_name'] . '</option>'; } } else { // Too many $result .= '<option value="xxx" >-- ' . __('Too many users, edit manually', 'wp-photo-album-plus') . ' --</option>'; } $result .= '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-owner-parent-tr" style="display:none;" >' . '<th><label for="wppagallery-owner-parent">' . __('Parent album:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-owner-parent" style="color:#070;max-width:400px;" name="parentalbum" multiple="multiple" onchange="wppaGalleryEvaluate()">'; if ($albums) { // Please select $result .= '<option value="" selected="selected" >-- ' . __('No parent specification', 'wp-photo-album-plus') . ' --</option>'; // Generic $result .= '<option value="0" >-- ' . __('The generic parent', 'wp-photo-album-plus') . ' --</option>'; // All standard albums foreach ($albums as $album) { $id = $album['id']; $result .= '<option class="wppagallery-album-p" value="' . $id . '" >' . stripslashes(__($album['name'], 'wp-photo-album-plus')) . ' (' . $id . ')</option>'; } } else { $result .= '<option value="0" >' . __('There are no albums yet', 'wp-photo-album-plus') . '</option>'; } $result .= '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-album-parent-tr" style="display:none;" >' . '<th><label for="wppagallery-album-parent">' . __('Parent album:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-album-parent-parent" style="color:#070;max-width:400px;" name="parentalbum" onchange="wppaGalleryEvaluate()">'; if ($albums) { // Please select $result .= '<option id="wppagallery-album-0" value="0" selected="selected" style="color:#700" >-- ' . __('The generic parent', 'wp-photo-album-plus') . ' --</option>'; // All standard albums foreach ($albums as $album) { $id = $album['id']; $result .= '<option class="wppagallery-album" value="' . $id . '" >' . stripslashes(__($album['name'], 'wp-photo-album-plus')) . ' (' . $id . ')</option>'; } } else { $result .= '<option value="0" >' . __('There are no albums yet', 'wp-photo-album-plus') . '</option>'; } $result .= '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-album-count-tr" style="display:none;" >' . '<th><label for="wppagallery-album-count">' . __('Max Albums:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<input id="wppagallery-album-count" type="text" style="color:#070;" value="1" onchange="wppaGalleryEvaluate()" />' . '</td>' . '</tr>' . '<tr id="wppagallery-photo-count-tr" style="display:none;" >' . '<th><label for="wppagallery-photo-count">' . __('Max Photos:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<input id="wppagallery-photo-count" type="text" style="color:#070;" value="1" onchange="wppaGalleryEvaluate()" />' . '</td>' . '</tr>' . '<tr id="wppagallery-albumcat-tr" style="display:none;" >' . '<th><label for="wppagallery-albumcat">' . __('The cat the albums should have:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-albumcat" style="color:#700;" onchange="wppaGalleryEvaluate()">' . '<option value="" disabled="disabled" selected="selected" style="color:#700" >' . __('--- please select category ---', 'wp-photo-album-plus') . '</option>'; if ($cats) { foreach (array_keys($cats) as $cat) { $result .= '<option value="' . $cat . '" >' . $cat . '</option>'; } } $result .= '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-photo-tr" style="display:none;" >' . '<th><label for="wppagallery-photo" class="wppagallery-photo" >' . __('The Photo to be used:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-photo" name="photo" class="wppagallery-photo" onchange="wppaGalleryEvaluate()" >'; if ($photos) { // Please select $result .= '<option value="" disabled="disabled" selected="selected" style="color:#700" >-- ' . __('Please select a photo', 'wp-photo-album-plus') . ' --</option>'; // Most recent 100 photos foreach ($photos as $photo) { $name = stripslashes(__($photo['name'], 'wp-photo-album-plus')); if (strlen($name) > '50') { $name = substr($name, '0', '50') . '...'; } if (get_option('wppa_file_system') == 'flat') { $result .= '<option value="' . wppa_fix_poster_ext($photo['id'] . '.' . $photo['ext'], $photo['id']) . '" >' . $name . ' (' . wppa_get_album_name($photo['album']) . ')' . '</option>'; } else { $result .= '<option value="' . wppa_fix_poster_ext(wppa_expand_id($photo['id']) . '.' . $photo['ext'], $photo['id']) . '" >' . $name . ' (' . wppa_get_album_name($photo['album']) . ')' . '</option>'; } } $result .= '<option value="#last" >-- ' . __('The most recently uploaded photo', 'wp-photo-album-plus') . ' --</option>' . '<option value="#potd" >-- ' . __('The photo of the day', 'wp-photo-album-plus') . ' --</option>'; } else { $result .= '<option value="0" >' . __('There are no photos yet', 'wp-photo-album-plus') . '</option>'; } $result .= '</select>' . '<br />' . '<small style="display:none;" class="wppagallery-photo" >' . __('Specify the photo to be used', 'wp-photo-album-plus') . '<br />' . __('You can select from a maximum of 100 most recently added photos', 'wp-photo-album-plus') . '<br />' . '</small>' . '</td>' . '</tr>' . '<tr id="wppagallery-photo-preview-tr" style="display:none;" >' . '<th><label for="wppagallery-photo-preview" >' . __('Preview image:', 'wp-photo-album-plus') . '</label></th>' . '<td id="wppagallery-photo-preview" style="text-align:center;" >' . '</td >' . '</tr>' . '<tr id="wppagallery-phototags-tr" style="display:none;" >' . '<th><label for="wppagallery-phototags">' . __('The tags the photos should have:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-phototags" style="color:#700;" multiple="multiple" onchange="wppaGalleryEvaluate()">' . '<option value="" disabled="disabled" selected="selected" style="color:#700" >' . __('--- please select tag(s) ---', 'wp-photo-album-plus') . '</option>'; if ($tags) { foreach (array_keys($tags) as $tag) { $result .= '<option class="wppagallery-phototags" value="' . $tag . '" >' . $tag . '</option>'; } } $result .= '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-search-tr" style="display:none;" >' . '<th><label>' . __('Additional features:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<input id="wppagallery-sub" type="checkbox" name="sub" onchange="wppaGalleryEvaluate()"/>' . __('Enable Subsearch', 'wp-photo-album-plus') . ' ' . '<input id="wppagallery-root" type="checkbox" name="root" onchange="wppaGalleryEvaluate()"/>' . __('Enable Rootsearch', 'wp-photo-album-plus') . '</td>' . '</tr>' . '<tr id="wppagallery-taglist-tr" style="display:none;" >' . '<th><label>' . __('Additional features:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<input id="wppagallery-alltags" type="checkbox" checked="checked" name="alltags" onchange="wppaGalleryEvaluate()"/>' . __('Enable all tags', 'wp-photo-album-plus') . ' ' . '<select id="wppagallery-seltags" style="color:#070; display:none;" name="seltags" multiple="multiple" onchange="wppaGalleryEvaluate()">'; if ($tags) { '<option value="" disabled="disabled" selected="selected" style="color:#700" >-- ' . __('Please select the tags to show', 'wp-photo-album-plus') . ' --</option>'; foreach (array_keys($tags) as $tag) { $result .= '<option class="wppagallery-taglist-tags" value="' . $tag . '"style="color:#700" >' . $tag . '</option>'; } } else { '<option value="" disabled="disabled" selected="selected" style="color:#700" >-- ' . __('There are no tags', 'wp-photo-album-plus') . ' --</option>'; } $result .= '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-album-super-tr" style="display:none;" >' . '<th><label for="wppagallery-album-super">' . __('Parent album:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-album-super-parent" style="color:#070;max-width:400px;" name="parentalbum" onchange="wppaGalleryEvaluate()">'; if ($albums) { // Please select $result .= '<option value="" selected="selected" style="color:#700" >-- ' . __('The generic parent', 'wp-photo-album-plus') . ' --</option>'; // All standard albums foreach ($albums as $album) { $id = $album['id']; $result .= '<option class="wppagallery-album" value="' . $id . '" >' . stripslashes(__($album['name'], 'wp-photo-album-plus')) . ' (' . $id . ')</option>'; } } else { $result .= '<option value="0" >' . __('There are no albums yet', 'wp-photo-album-plus') . '</option>'; } $result .= '</select>' . '</td>' . '</tr>' . '<tr id="wppagallery-calendar-tr" style="display:none;" >' . '<th><label for="wppagallery-calendar">' . __('Calendar type:', 'wp-photo-album-plus') . '</lable></th>' . '<td>' . '<select id="wppagallery-calendar-type" style="color:#070;max-width:400px;" onchange="wppaGalleryEvaluate()" >' . '<option value="exifdtm" >' . __('By EXIF date', 'wp-photo-album-plus') . '</option>' . '<option value="timestamp" >' . __('By date of upload', 'wp-photo-album-plus') . '</option>' . '<option value="modified" >' . __('By date last modified', 'wp-photo-album-plus') . '</option>' . '</select>' . '<br />' . '<input type="checkbox" id="wppagallery-calendar-reverse" onchange="wppaGalleryEvaluate()" >' . __('Last date first', 'wp-photo-album-plus') . ' ' . '<input type="checkbox" id="wppagallery-calendar-allopen" onchange="wppaGalleryEvaluate()" >' . __('Initially display all', 'wppw', 'wp-photo-album-plus') . '</td>' . '</tr>' . '<tr>' . '<th><label for="wppagallery-size">' . __('The size of the display:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<input type="text" id="wppagallery-size" value="" style="color:#070;" onchange="wppaGalleryEvaluate();"/>' . '<br />' . '<small>' . __('Specify the horizontal size in pixels or <span style="color:blue" >auto</span>.', 'wp-photo-album-plus') . ' ' . __('A value less than <span style="color:blue" >100</span> will automaticly be interpreted as a <span style="color:blue" >percentage</span> of the available space.', 'wp-photo-album-plus') . '<br />' . __('Leave this blank for default size', 'wp-photo-album-plus') . '</small>' . '</td>' . '</tr>' . '<tr>' . '<th><label for="wppagallery-align">' . __('Horizontal alignment:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-align" name="align" style="color:#070;" onchange="wppaGalleryEvaluate();">' . '<option value="none" >' . __('--- none ---', 'wp-photo-album-plus') . '</option>' . '<option value="left" >' . __('left', 'wp-photo-album-plus') . '</option>' . '<option value="center" >' . __('center', 'wp-photo-album-plus') . '</option>' . '<option value="right" >' . __('right', 'wp-photo-album-plus') . '</option>' . '</select>' . '<br />' . '<small>' . __('Specify the alignment to be used or --- none ---', 'wp-photo-album-plus') . '</small>' . '</td>' . '</tr>' . '</table>' . '<div id="wppagallery-shortcode-preview-container" >' . '<input type="text" id="wppagallery-shortcode-preview" style="background-color:#ddd; width:100%; height:26px;" value="[wppa]Any comment[/wppa]" />' . '</div>' . '<div><small>' . __('This is a preview of the shortcode that is being generated. You may edit the comment', 'wp-photo-album-plus') . '</small></div>' . '<p class="submit">' . '<input type="button" id="wppagallery-submit" class="button-primary" value="' . __('Insert Gallery', 'wp-photo-album-plus') . '" name="submit" /> ' . '<input type="button" id="wppagallery-submit-notok" class="button-secundary" value="' . __('insert Gallery', 'wp-photo-album-plus') . '" onclick="alert(\'' . esc_js(__('Please complete the shortcode specs', 'wp-photo-album-plus')) . '\')" /> ' . '</p>' . '</div>' . '<script type="text/javascript" >wppaGalleryEvaluate();</script>'; return $result; }
function wppa_get_photo_path($id, $system = 'flat') { $thumb = wppa_cache_thumb($id); if (get_option('wppa_file_system') == 'flat') { $system = 'flat'; } // Have been converted, ignore argument if (get_option('wppa_file_system') == 'tree') { $system = 'tree'; } // Have been converted, ignore argument if (!is_numeric($id) || $id < '1') { wppa_dbg_msg('Invalid arg wppa_get_photo_path(' . $id . ')', 'red'); } if ($system == 'tree') { return WPPA_UPLOAD_PATH . '/' . wppa_expand_id($thumb['id'], true) . '.' . $thumb['ext']; } else { return WPPA_UPLOAD_PATH . '/' . $thumb['id'] . '.' . $thumb['ext']; } }
function wppa_make_tinymce_dialog() { global $wpdb; $result = '<div id="wppagallery-form">' . '<div style="height:158px; background-color:#eee; overflow:auto; margin-top:10px;" >' . '<div id="wppagallery-album-preview" style="text-align:center;font-size:48px; line-height:21px; color:#fff;" class="wppagallery-album" ><br /><br /><br />' . __('Album Preview', 'wp-photo-album-plus') . '<br /><span style="font-size:12px; color:#777" ><br/>' . __('A maximum of 100 photos can be previewd', 'wp-photo-album-plus') . '</span></div>' . '<div id="wppagallery-photo-preview" style="text-align:center;font-size:48px; line-height:21px; color:#fff; display:none;" class="wppagallery-photo" ><br /><br /><br />' . __('Photo Preview', 'wp-photo-album-plus') . '</div>' . '</div>' . '<table id="wppagallery-table" class="form-table">' . '<tr>' . '<th><label for="wppagallery-type">' . __('Type of Gallery display:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-type" name="type" onchange="wppaGalleryTypeChange(this.value)">' . '<option value="cover">' . __('The cover of an album', 'wp-photo-album-plus') . '</option>' . '<option value="album">' . __('The sub-albums and/or thumbnails in an album', 'wp-photo-album-plus') . '</option>' . '<option value="slide">' . __('A slideshow of the photos in an album', 'wp-photo-album-plus') . '</option>' . '<option value="slideonly">' . __('A slideshow without supporting boxes', 'wp-photo-album-plus') . '</option>' . '<option value="slideonlyf">' . __('A slideshow with a filmstrip only', 'wp-photo-album-plus') . '</option>' . '<option value="photo">' . __('A single photo', 'wp-photo-album-plus') . '</option>' . '<option value="mphoto">' . __('A single photo with caption', 'wp-photo-album-plus') . '</option>' . '<option value="slphoto">' . __('A single photo in the style of a slideshow', 'wp-photo-album-plus') . '</option>' . '<option value="generic">' . __('A generic albums display', 'wp-photo-album-plus') . '</option>' . '</select>' . '<br />' . '<small>' . __('Specify the type of gallery', 'wp-photo-album-plus') . '</small>' . '</td>' . '</tr>' . '<tr class="wppagallery-help" style="display:none;" >' . '<th><label for="wppagallery-album" class="wppagallery-help" >' . __('Explanation:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . __('Use this gallerytype to display all the top-level album covers.', 'wp-photo-album-plus') . '</td>' . '</tr>' . '<tr class="wppagallery-album" >' . '<th><label for="wppagallery-album" class="wppagallery-album" >' . __('The Album to be used:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-album" name="album" style=width:270px;" class="wppagallery-album" onchange="wppaGalleryAlbumChange(this.value); wppaTinyMceAlbumPreview(this.value)">'; $albums = $wpdb->get_results("SELECT `id`, `name` FROM `" . WPPA_ALBUMS . "` ORDER BY `timestamp` DESC", ARRAY_A); if ($albums) { if (wppa_switch('wppa_hier_albsel')) { $albums = wppa_add_paths($albums); } else { foreach (array_keys($albums) as $index) { $albums[$index]['name'] = __(stripslashes($albums[$index]['name']), 'wp-photo-album-plus'); } } // Sort $albums = wppa_array_sort($albums, 'name'); $result .= '<option value="0" disabled="disabled" selected="selected" >' . __('Please select an album', 'wp-photo-album-plus') . '</option>'; // All standard albums foreach ($albums as $album) { $value = $album['id']; $alb = $album['id']; $photos = $wpdb->get_results($wpdb->prepare("SELECT `id`, `name`, `album`, `ext` FROM `" . WPPA_PHOTOS . "` WHERE `album` = %s " . wppa_get_photo_order($alb) . " LIMIT 100", $alb), ARRAY_A); if ($photos) { foreach ($photos as $photo) { $photo_id = wppa_opt('file_system') == 'tree' ? wppa_expand_id($photo['id']) : $photo['id']; $value .= '|' . $photo_id . '.' . $photo['ext']; } } else { $value .= '|'; } $note = ' (' . $album['id'] . ')'; if (count($photos) <= wppa_opt('min_thumbs')) { $note .= ' *'; } $result .= '<option value="' . $value . '" >' . stripslashes(__($album['name'], 'wp-photo-album-plus')) . $note . '</option>'; } // #last $value = '#last'; $alb = $albums[0]['id']; $photos = $wpdb->get_results($wpdb->prepare("SELECT `id`, `name`, `album`, `ext` FROM `" . WPPA_PHOTOS . "` WHERE `album` = %s " . wppa_get_photo_order($alb) . " LIMIT 100", $alb), ARRAY_A); if ($photos) { foreach ($photos as $photo) { $photo_id = wppa_opt('file_system') == 'tree' ? wppa_expand_id($photo['id']) : $photo['id']; $value .= '|' . $photo_id . '.' . $photo['ext']; } } else { $value .= '|'; } $result .= '<option value="' . $value . '" >' . __('- The latest created album -', 'wp-photo-album-plus') . '</option>'; // #topten $value = '#topten'; $photos = $wpdb->get_results("SELECT `id`, `name`, `album`, `ext` FROM `" . WPPA_PHOTOS . "` ORDER BY `mean_rating` DESC LIMIT " . wppa_opt('topten_count'), ARRAY_A); if ($photos) { foreach ($photos as $photo) { $photo_id = wppa_opt('file_system') == 'tree' ? wppa_expand_id($photo['id']) : $photo['id']; $value .= '|' . $photo_id . '.' . $photo['ext']; } } else { $value .= '|'; } $result .= '<option value = "' . $value . '" >' . __('--- The top rated photos ---', 'wp-photo-album-plus') . '</option>'; // #lasten $value = '#lasten'; $photos = $wpdb->get_results("SELECT `id`, `name`, `album`, `ext` FROM `" . WPPA_PHOTOS . "` ORDER BY `timestamp` DESC LIMIT " . wppa_opt('lasten_count'), ARRAY_A); if ($photos) { foreach ($photos as $photo) { $photo_id = wppa_opt('file_system') == 'tree' ? wppa_expand_id($photo['id']) : $photo['id']; $value .= '|' . $photo_id . '.' . $photo['ext']; } } else { $value .= '|'; } $result .= '<option value = "' . $value . '" >' . __('--- The most recently uploaded photos ---', 'wp-photo-album-plus') . '</option>'; // #featen $value = '#featen'; $photos = $wpdb->get_results("SELECT `id`, `name`, `album`, `ext` FROM `" . WPPA_PHOTOS . "` WHERE `status` = 'featured' ORDER BY RAND() DESC LIMIT " . wppa_opt('featen_count'), ARRAY_A); if ($photos) { foreach ($photos as $photo) { $photo_id = wppa_opt('file_system') == 'tree' ? wppa_expand_id($photo['id']) : $photo['id']; $value .= '|' . $photo_id . '.' . $photo['ext']; } } else { $value .= '|'; } $result .= '<option value = "' . $value . '" >' . __('--- A random selection of featured photos ---', 'wp-photo-album-plus') . '</option>'; // #comten $value = '#comten'; $comments = $wpdb->get_results("SELECT `id`, `photo` FROM `" . WPPA_COMMENTS . "` ORDER BY `timestamp` DESC", ARRAY_A); $photos = false; $done = array(); if ($comments) { foreach ($comments as $comment) { if (count($done) < wppa_opt('comten_count') && !in_array($comment['photo'], $done)) { $done[] = $comment['photo']; $photos[] = $wpdb->get_row("SELECT `id`, `name`, `album`, `ext` FROM `" . WPPA_PHOTOS . "` WHERE `id` = " . $comment['photo'], ARRAY_A); } } } if ($photos) { foreach ($photos as $photo) { $photo_id = wppa_opt('file_system') == 'tree' ? wppa_expand_id($photo['id']) : $photo['id']; $value .= '|' . $photo_id . '.' . $photo['ext']; } } else { $value .= '|'; } $result .= '<option value = "' . $value . '" >' . __('--- The most recently commented photos ---', 'wp-photo-album-plus') . '</option>'; // #tags $value = '#tags'; $result .= '<option value = "' . $value . '" >' . __('--- Photos that have certain tags ---', 'wp-photo-album-plus') . '</option>'; // #all $value = '#all'; $photos = $wpdb->get_results("SELECT `id`, `name`, `album`, `ext` FROM `" . WPPA_PHOTOS . "` " . wppa_get_photo_order('0') . " LIMIT 100", ARRAY_A); if ($photos) { foreach ($photos as $photo) { $photo_id = wppa_opt('file_system') == 'tree' ? wppa_expand_id($photo['id']) : $photo['id']; $value .= '|' . $photo_id . '.' . $photo['ext']; } } else { $value .= '|'; } $result .= '<option value = "' . $value . '" >' . __('--- All photos in the system ---', 'wp-photo-album-plus') . '</option>'; } else { $result .= '<option value="0" >' . __('There are no albums yet', 'wp-photo-album-plus') . '</option>'; } $result .= '</select>' . '<input type="text" id="wppagallery-alb" name="alb" value="" style="width:50px; display:none; background-color:#ddd;" class="wppagallery-extra" title="Enter albumnumber if not systemwide" />' . '<input type="text" id="wppagallery-cnt" name="cnt" value="" style="width:50px; display:none; background-color:#ddd;" class="wppagallery-extra" title="Enter count if not default" />' . '<br />' . '<small class="wppagallery-album" >' . __('Specify the album to be used or --- A special selection of photos ---', 'wp-photo-album-plus') . '<br />' . __('In an upload box, the album is optional. When no album is specified: a selection box will be displayed of the albums the user has the right to upload.', 'wp-photo-album-plus') . '<br />' . __('* Album contains less than the minimun number of photos', 'wp-photo-album-plus') . '</small>' . '</td>' . '</tr>' . '<tr class="wppagallery-photo" style="display:none;" >' . '<th><label for="wppagallery-photo" style="display:none;" class="wppagallery-photo" >' . __('The Photo to be used:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-photo" name="photo" style="display:none;" class="wppagallery-photo" onchange="wppaTinyMcePhotoPreview(this.value)" >'; $photos = $wpdb->get_results("SELECT `id`, `name`, `album`, `ext` FROM `" . WPPA_PHOTOS . "` ORDER BY `timestamp` DESC LIMIT 100", ARRAY_A); if ($photos) { $result .= '<option value="0" disabled="disabled" selected="selected" >' . __('Please select a photo', 'wp-photo-album-plus') . '</option>'; foreach ($photos as $photo) { $name = stripslashes(__($photo['name'], 'wp-photo-album-plus')); if (strlen($name) > '50') { $name = substr($name, '0', '50') . '...'; } if (get_option('wppa_file_system') == 'flat') { $result .= '<option value="' . $photo['id'] . '.' . $photo['ext'] . '" >' . $name . ' (' . wppa_get_album_name($photo['album']) . ')' . '</option>'; } else { $result .= '<option value="' . wppa_expand_id($photo['id']) . '.' . $photo['ext'] . '" >' . $name . ' (' . wppa_get_album_name($photo['album']) . ')' . '</option>'; } } $result .= '<option value="#last" >' . __('--- The most recently uploaded photo ---', 'wp-photo-album-plus') . '</option>' . '<option value="#potd" >' . __('--- The photo of the day ---', 'wp-photo-album-plus') . '</option>'; } else { $result .= '<option value="0" >' . __('There are no photos yet', 'wp-photo-album-plus') . '</option>'; } $result .= '</select>' . '<br />' . '<small style="display:none;" class="wppagallery-photo" >' . __('Specify the photo to be used', 'wp-photo-album-plus') . '<br />' . __('You can select from a maximum of 100 most recently added photos', 'wp-photo-album-plus') . '<br />' . '</small>' . '</td>' . '</tr>' . '<tr class="wppagallery-tags" style="display:none;" >' . '<th><label for="wppagallery-tags">' . __('The tags the photos should have:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-tags" multiple="multiple">' . '<option value="" >' . __('--- please select tag(s) ---', 'wp-photo-album-plus') . '</option>'; $tags = wppa_get_taglist(); if ($tags) { foreach (array_keys($tags) as $tag) { $result .= '<option value="' . $tag . '" >' . $tag . '</option>'; } } $result .= '</select>' . '<div><input type="checkbox" id="wppagallery-andor" /> <small>' . __('If you want that the photos have all the selected tags, check this box. Leave it unchecked if the photo must have atleast only one of the selected tags', 'wp-photo-album-plus') . '</small></div>' . '</td>' . '</tr>' . '<tr>' . '<th><label for="wppagallery-size">' . __('The size of the display:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<input type="text" id="wppagallery-size" value="" />' . '<br />' . '<small>' . __('Specify the horizontal size in pixels or <span style="color:blue" >auto</span>.', 'wp-photo-album-plus') . ' ' . __('A value less than <span style="color:blue" >100</span> will automaticly be interpreted as a <span style="color:blue" >percentage</span> of the available space.', 'wp-photo-album-plus') . '<br />' . __('Leave this blank for default size', 'wp-photo-album-plus') . '</small>' . '</td>' . '</tr>' . '<tr>' . '<th><label for="wppagallery-align">' . __('Horizontal alignment:', 'wp-photo-album-plus') . '</label></th>' . '<td>' . '<select id="wppagallery-align" name="align" >' . '<option value="none" >' . __('--- none ---', 'wp-photo-album-plus') . '</option>' . '<option value="left" >' . __('left', 'wp-photo-album-plus') . '</option>' . '<option value="center" >' . __('center', 'wp-photo-album-plus') . '</option>' . '<option value="right" >' . __('right', 'wp-photo-album-plus') . '</option>' . '</select>' . '<br />' . '<small>' . __('Specify the alignment to be used or --- none ---', 'wp-photo-album-plus') . '</small>' . '</td>' . '</tr>' . '</table>' . '<p class="submit">' . '<input type="button" id="wppagallery-submit" class="button-primary" value="' . __('Insert Gallery', 'wp-photo-album-plus') . '" name="submit" /> ' . '</p>' . '</div>'; return $result; }
function wppa_expand_tree_path($path) { $result = $path; $temp = explode('/wppa/', $path); if (count($temp) == '2') { $temp[1] = wppa_expand_id(wppa_strip_ext($temp[1])) . '.' . wppa_get_ext($temp[1]); $result = implode('/wppa/', $temp); } return $result; }