function index($params = array()) { if (!empty($this->data['Field'])) { $location = $this->data['Field']['location']; $groupid = $this->data['Field']['groupid']; $type = isset($this->data['FieldFilter']) ? Sanitize::getString($this->data['FieldFilter'], 'type') : null; } else { $location = 'content'; $groupid = 0; $type = null; } $groupchange = Sanitize::getInt($this->data, 'groupchange'); $this->action = 'index'; // Required for paginator helper $limit = $this->limit; $limitstart = $groupchange == 1 ? 0 : $this->offset; $groupchange == 1 and $this->page = 1; // First check if there are any field groups created $query = "SELECT count(*) FROM #__jreviews_groups"; $this->_db->setQuery($query); if (!$this->_db->loadResult()) { return __a("You need to create at least one field group using the Field Groups Manager before you can create custom fields.", true); } $lists = array(); $total = 0; $rows = $this->Field->getList($location, $groupid, $limitstart, $limit, $total, $type); $this->set(array('location' => $location, 'groups' => $this->Group->getSelectList($location), 'rows' => $rows, 'groupid' => $groupid, 'type' => $type, 'pagination' => array('total' => $total))); return $this->render('fields', 'index'); }
function _save() { $response = array(); if ($this->Claim->store($this->data)) { if ($this->data['Claim']['approved'] == 0) { $response[] = "\n jQuery('#jr_moderateForm" . $this->data['Claim']['claim_id'] . "').slideUp('slow',function()\n {\n jQuery(this).addClass('jr_form').html('" . __a("Claim will remain in moderation pending further action.", true, true) . "').slideDown('normal',function()\n {\n jQuery(this).effect('highlight',{},4000);\n setTimeout(function(){jQuery('#jr_moderateForm" . $this->data['Claim']['claim_id'] . "').fadeOut(1500)},3000);\n });\n });\n "; } else { $response[] = "jQuery('#jr_moderateForm" . $this->data['Claim']['claim_id'] . "').slideUp('slow',function(){jQuery(this).html('');});"; $response[] = "jreviews_admin.menu.moderation_counter('claim_count');"; } } clearCache('', 'views'); clearCache('', '__data'); return $this->ajaxResponse($response); }
/** @see WP_Widget::widget */ function widget($args, $instance) { global $wpdb; global $widget_content; global $wppa_opt; require_once dirname(__FILE__) . '/wppa-links.php'; require_once dirname(__FILE__) . '/wppa-styles.php'; require_once dirname(__FILE__) . '/wppa-functions.php'; require_once dirname(__FILE__) . '/wppa-thumbnails.php'; require_once dirname(__FILE__) . '/wppa-boxes-html.php'; require_once dirname(__FILE__) . '/wppa-slideshow.php'; wppa_initialize_runtime(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __a('QR Widget') : $instance['title']); $qrsrc = 'http://api.qrserver.com/v1/create-qr-code/' . '?data=' . site_url() . '&size=' . $wppa_opt['wppa_qr_size'] . 'x' . $wppa_opt['wppa_qr_size'] . '&color=' . trim($wppa_opt['wppa_qr_color'], '#') . '&bgcolor=' . trim($wppa_opt['wppa_qr_bgcolor']); $widget_content = ' <div style="text-align:center;" ><img id="wppa-qr-img" src="' . $qrsrc . '" title="" alt="' . __a('QR code') . '" /></div> <div style="clear:both" ></div>'; $widget_content .= ' <script type="text/javascript"> /*[CDATA[*/ var wppaQRData = document.location.href; var wppaQRDataOld = ""; var wppaQRSrc = ""; var workData = ""; wppaConsoleLog("doc.loc.href = "+wppaQRData); function wppaQRUpdate(arg) { if ( arg ) wppaQRData = arg; if ( wppaQRData != wppaQRDataOld ) { wppaQRDataOld = wppaQRData; workData = wppaQRData; wppaQRSrc = "http://api.qrserver.com/v1/create-qr-code/?data="+encodeURIComponent(workData)+"&size=' . $wppa_opt['wppa_qr_size'] . 'x' . $wppa_opt['wppa_qr_size'] . '&color=' . trim($wppa_opt['wppa_qr_color'], '#') . '&bgcolor=' . trim($wppa_opt['wppa_qr_bgcolor'], '#') . '"; document.getElementById("wppa-qr-img").src = wppaQRSrc; document.getElementById("wppa-qr-img").title = workData; } return; } jQuery(document).ready(function(){ wppaQRUpdate(); }); /*]]*/ </script>'; echo $before_widget . $before_title . $title . $after_title . $widget_content . $after_widget; }
function wppa_get_statistics() { $count = wppa_get_total_album_count(); $y_id = wppa_get_youngest_album_id(); $y_name = __(wppa_get_album_name($y_id)); $p_id = wppa_get_parentalbumid($y_id); $p_name = __(wppa_get_album_name($p_id)); $result = '<div class="wppa-box wppa-nav" style="text-align: center; ' . __wcs('wppa-box') . __wcs('wppa-nav') . '">'; $result .= __a('There are') . ' ' . $count . ' ' . __a('photo albums. The last album added is') . ' '; $result .= '<a href="' . wppa_get_permalink() . 'wppa-album=' . $y_id . '&wppa-cover=0&wppa-occur=1">' . $y_name . '</a>'; if ($p_id > '0') { $result .= __a(', a subalbum of') . ' '; $result .= '<a href="' . wppa_get_permalink() . 'wppa-album=' . $p_id . '&wppa-cover=0&wppa-occur=1">' . $p_name . '</a>'; } $result .= '.</div>'; return $result; }
function _save() { if ($this->data['Report']['approved'] == -2) { $this->Report->delete('report_id', $this->data['Report']['report_id']); $this->response[] = "jQuery('#jr_moderateForm" . $this->data['Report']['report_id'] . "').slideUp('slow',function(){jQuery(this).html('');});"; $this->response[] = "jreviews_admin.menu.moderation_counter('report_count');"; return $this->ajaxResponse($this->response); } if ($this->Report->store($this->data)) { if ($this->data['Report']['approved'] == 0) { $this->response[] = "\n jQuery('#jr_moderateForm" . $this->data['Report']['report_id'] . "').slideUp('slow',function()\n {\n jQuery(this).addClass('jr_form').html('" . __a("Report will remain in moderation pending further action.", true, true) . "').slideDown('normal',function()\n {\n jQuery(this).effect('highlight',{},4000);\n setTimeout(function(){jQuery('#jr_moderateForm" . $this->data['Report']['report_id'] . "').fadeOut(1500)},3000);\n });\n });\n "; } else { $this->response[] = "jreviews_admin.menu.moderation_counter('report_count');"; $this->response[] = "jQuery('#jr_moderateForm" . $this->data['Report']['report_id'] . "').slideUp('slow',function(){jQuery(this).html('');});"; } } if ($this->action == '_save') { return $this->ajaxResponse($this->response); } }
/** @see WP_Widget::widget */ function widget($args, $instance) { global $wpdb; global $wppa; global $widget_content; global $thumb; require_once dirname(__FILE__) . '/wppa-links.php'; require_once dirname(__FILE__) . '/wppa-styles.php'; require_once dirname(__FILE__) . '/wppa-functions.php'; require_once dirname(__FILE__) . '/wppa-thumbnails.php'; require_once dirname(__FILE__) . '/wppa-boxes-html.php'; require_once dirname(__FILE__) . '/wppa-slideshow.php'; wppa_initialize_runtime(); $wppa['in_widget'] = 'bestof'; $wppa['mocc']++; extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'count' => '1', 'sortby' => 'maxratingcount', 'display' => 'photo', 'period' => 'thisweek', 'maxratings' => 'yes', 'meanrat' => 'yes', 'ratcount' => 'yes', 'linktype' => 'none')); $widget_title = apply_filters('widget_title', $instance['title']); $page = in_array($instance['linktype'], $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_bestof_widget_linkpage', __a('Best Of Photos')); $count = $instance['count']; $sortby = $instance['sortby']; $display = $instance['display']; $period = $instance['period']; $maxratings = $instance['maxratings']; $meanrat = $instance['meanrat']; $ratcount = $instance['ratcount']; $linktype = $instance['linktype']; $size = wppa_opt('wppa_widget_width'); // $data = wppa_get_the_bestof( $count, $period, $sortby, $display ); $lineheight = wppa_opt('wppa_fontsize_widget_thumb') * 1.5; $widget_content = "\n" . '<!-- WPPA+ BestOf Widget start -->'; $widget_content .= wppa_bestof_html(array('page' => $page, 'count' => $count, 'sortby' => $sortby, 'display' => $display, 'period' => $period, 'maxratings' => $maxratings, 'meanrat' => $meanrat, 'ratcount' => $ratcount, 'linktype' => $linktype, 'size' => $size, 'lineheight' => $lineheight)); $widget_content .= '<div style="clear:both"></div>'; $widget_content .= "\n" . '<!-- WPPA+ BestOf Widget end -->'; echo "\n" . $before_widget; if (!empty($widget_title)) { echo $before_title . $widget_title . $after_title; } echo $widget_content . $after_widget; }
/** @see WP_Widget::widget */ function widget($args, $instance) { // global $widget_content; 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'] = 'albnav'; $wppa['mocc']++; extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'parent' => '0', 'skip' => 'yes')); $widget_title = apply_filters('widget_title', $instance['title']); $page = wppa_get_the_landing_page('wppa_album_navigator_widget_linkpage', __a('Photo Albums')); $parent = $instance['parent']; $skip = $instance['skip']; $widget_content = "\n" . '<!-- WPPA+ Album Navigator Widget start -->'; $widget_content .= '<div style="width:100%; overflow:hidden; position:relative; left: -12px;" >'; if ($parent == 'all') { $widget_content .= $this->do_album_navigator('0', $page, $skip, ''); $widget_content .= $this->do_album_navigator('-1', $page, $skip, ''); } else { $widget_content .= $this->do_album_navigator($parent, $page, $skip, ''); } $widget_content .= '</div>'; $widget_content .= '<div style="clear:both"></div>'; $widget_content .= "\n" . '<!-- WPPA+ Album Navigator Widget end -->'; echo "\n" . $before_widget; if (!empty($widget_title)) { echo $before_title . $widget_title . $after_title; } echo $widget_content . $after_widget; $wppa['in_widget'] = false; }
function wppa_backend_upload_mail($id, $alb, $name) { $owner = wppa_get_user(); if ($owner == 'admin') { return; } // Admin does not send mails to himself if (wppa_switch('wppa_upload_backend_notify')) { $to = get_bloginfo('admin_email'); $subj = sprintf(__a('New photo uploaded: %s'), wppa_sanitize_file_name($name)); $cont['0'] = sprintf(__a('User %s uploaded photo %s into album %s'), $owner, $id, wppa_get_album_name($alb)); if (wppa_switch('wppa_upload_moderate') && !current_user_can('wppa_admin')) { $cont['1'] = __a('This upload requires moderation'); $cont['2'] = '<a href="' . get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=pmod&photo=' . $id . '" >' . __a('Moderate manage photo') . '</a>'; } else { $cont['1'] = __a('Details:'); $cont['1'] .= ' <a href="' . get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=pmod&photo=' . $id . '" >' . __a('Manage photo') . '</a>'; } wppa_send_mail($to, $subj, $cont, $id); } }
function wppa_get_audio_body($id, $for_lb = false, $w = '0', $h = '0') { // Audio enabled? if (!wppa_switch('enable_audio')) { return ''; } $is_audio = wppa_has_audio($id, true); // Not a audio? no go if (!$is_audio) { return ''; } // See what file types are present extract(wp_parse_args($is_audio, array('mp3' => false, 'wav' => false, 'ogg' => false))); // Collect other data $width = $w ? $w : wppa_get_photox($id); $height = $h ? $h : wppa_get_photoy($id); $source = wppa_get_photo_url($id); $source = substr($source, 0, strrpos($source, '.')); $class = $for_lb ? ' class="wppa-overlay-img"' : ''; $is_opera = strpos($_SERVER["HTTP_USER_AGENT"], 'OPR'); $is_ie = strpos($_SERVER["HTTP_USER_AGENT"], 'Trident'); $is_safari = strpos($_SERVER["HTTP_USER_AGENT"], 'Safari'); wppa_dbg_msg('Mp3:' . $mp3 . ', Opera:' . $is_opera . ', Ie:' . $is_ie . ', Saf:' . $is_safari); // Assume the browser supports html5 $ext = ''; if ($is_ie) { if ($mp3) { $ext = 'mp3'; } } elseif ($is_safari) { if ($mp3) { $ext = 'mp3'; } elseif ($wav) { $ext = 'wav'; } } else { if ($mp3) { $ext = 'mp3'; } elseif ($wav) { $ext = 'wav'; } elseif ($ogg) { $ext = 'ogg'; } } if ($ext) { $mime = str_replace('mp3', 'mpeg', 'audio/' . $ext); $result = '<source src="' . $source . '.' . $ext . '" type="' . $mime . '">'; } $result .= __a('There is no filetype available for your browser, or your browser does not support html5 audio', 'wppa'); return $result; }
function wppa_crumb_page_ancestors($page = '0') { global $wpdb; global $wppa; $query = "SELECT post_parent FROM " . $wpdb->posts . " WHERE post_type = 'page' AND post_status = 'publish' AND id = %s LIMIT 0,1"; $parent = $wpdb->get_var($wpdb->prepare($query, $page)); wppa_dbg_q('Q-bc4'); if (!is_numeric($parent) || $parent == '0') { return; } wppa_crumb_page_ancestors($parent); $query = "SELECT post_title FROM " . $wpdb->posts . " WHERE post_type = 'page' AND post_status = 'publish' AND id = %s LIMIT 0,1"; $title = $wpdb->get_var($wpdb->prepare($query, $parent)); wppa_dbg_q('Q-bc5'); $title = __(stripslashes($title)); if (!$title) { $title = '****'; // Page exists but is not publish wppa_bcitem($title, '#', __a('Unpublished'), $class = 'b2'); } else { wppa_bcitem($title, get_page_link($parent), __('Page:') . ' ' . $title, 'b2'); } }
function wppa_add_to_cart($atts) { global $post; global $thumb; global $wppa; extract(shortcode_atts(array('name' => wppa_get_photo_name($thumb['id']), 'price' => 0.01, 'qty_field' => '', 'b_title' => __a('Buy now'), 'options' => '', 'options_name' => '', 'qty_field' => '', 'fshipping' => '', 'weight' => ''), $atts)); $cart =& $_SESSION['wfcart']; // load the cart from the session $scabn_options = get_option('scabn_options'); $currency = apply_filters('scabn_display_currency_symbol', NULL); // Slideshow? if ($wppa['is_slide']) { $action_url = wppa_get_slide_callback_url($thumb['id']); $item_url = $action_url . '&wppa-single=1'; $action_url = wppa_convert_to_pretty($action_url); $item_url = wppa_convert_to_pretty($item_url); } else { $action_url = wppa_get_thumb_callback_url(); if (!strpos($action_url, '&')) { $action_url = str_replace('&', '&', $action_url); } $item_url = wppa_get_slide_callback_url($thumb['id']) . '&wppa-single=1'; $action_url = wppa_convert_to_pretty($action_url); $item_url = wppa_convert_to_pretty($item_url); } $output = ' <div class="wppa-addtocart"> <form method="post" class="wppa-cartform ' . $name . '" action="' . $action_url . '"> ' . wp_nonce_field('add_to_cart', 'scabn-add', false, false) . ' <input type="hidden" value="add_item" name="action" /> <input type="hidden" class="item_url" value="' . $item_url . '" name="item_url" /> <input type="hidden" value="' . $cart->random() . '" name="randomid" /> <input type="hidden" value="' . $name . '" name="item_id" /> <input type="hidden" class="item_name" value="' . $name . '" name="item_name" /> <input type="hidden" class="item_price" value="' . $price . '" name="item_price" />'; if ($fshipping) { $output .= ' <input type="hidden" class="item_shipping" value="' . $fshipping . '" name="item_shipping" />'; } if ($weight) { $output .= ' <input type="hidden" class="item_weight" value="' . $weight . '" name="item_weight" />'; } if ($options) { if ($options_name) { $output .= $options_name . ': '; } $output .= ' <input type="hidden" value="' . $options_name . '" name="item_options_name" class="item_options_name" />'; $item_options = explode(',', $options); $output .= ' <select style="max-width:200px; margin:0" name="item_options" class="item_options" >'; foreach ($item_options as $option) { $info = explode(':', $option); if (count($info) == 1) { $output .= ' <option value="' . $info[0] . '">' . $info[0] . ' (' . $currency . number_format($price, 2) . ')</option>'; } else { $output .= ' <option value="' . $info[0] . ':' . $info[1] . '">' . $info[0] . ' (' . $currency . number_format($info[1], 2) . ')</option>'; } } $output .= ' </select>'; } else { $output .= sprintf(__a('Unit Price: %s each'), $currency . number_format($price, 2)) . ' '; } if ($qty_field) { $output .= __a('Qty:') . ' <input type="text" style="max-width:50px; margin:0;" class="item_qty" value="1" size="2" name="item_qty" />'; } else { $output .= '<input type="hidden" class="item_qty" value="1" size="2" name="item_qty" />'; } $output .= ' <input type="submit" id="' . $name . '" class="add" name="add" value="' . $b_title . '"/> </form> </div>'; return $output; }
/** @see WP_Widget::widget */ function widget($args, $instance) { global $wpdb; global $wppa_opt; global $wppa; require_once dirname(__FILE__) . '/wppa-links.php'; require_once dirname(__FILE__) . '/wppa-styles.php'; require_once dirname(__FILE__) . '/wppa-functions.php'; require_once dirname(__FILE__) . '/wppa-thumbnails.php'; require_once dirname(__FILE__) . '/wppa-boxes-html.php'; require_once dirname(__FILE__) . '/wppa-slideshow.php'; wppa_initialize_runtime(); $wppa['in_widget'] = 'upldr'; $wppa['mocc']++; extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'sortby' => 'name', 'ignore' => 'admin', 'parent' => '')); $widget_title = apply_filters('widget_title', $instance['title']); $page = in_array('album', $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_upldr_widget_linkpage', __a('User uploaded photos')); $ignorelist = explode(',', $instance['ignore']); $upldrcache = wppa_get_upldr_cache(); $needupdate = false; $users = wppa_get_users(); $workarr = array(); $selalbs = str_replace('.', ',', wppa_expand_enum(wppa_alb_to_enum_children(wppa_expand_enum($instance['parent'])))); // Make the data we need if ($users) { foreach ($users as $user) { if (!in_array($user['user_login'], $ignorelist)) { $me = wppa_get_user(); if ($user['user_login'] != $me && isset($upldrcache[$this->get_widget_id()][$user['user_login']]['c'])) { $photo_count = $upldrcache[$this->get_widget_id()][$user['user_login']]['c']; } else { if ($instance['parent']) { $query = $wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `owner` = %s AND `album` IN (" . $selalbs . ") AND ( ( `status` <> 'pending' AND `status` <> 'scheduled' ) OR `owner` = %s )", $user['user_login'], $me); //); } else { $query = $wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `owner` = %s AND ( ( `status` <> 'pending' AND `status` <> 'scheduled' ) OR `owner` = %s )", $user['user_login'], $me); //); } $photo_count = $wpdb->get_var($query); if ($user['user_login'] != $me) { $upldrcache[$this->get_widget_id()][$user['user_login']]['c'] = $photo_count; $needupdate = true; } } if ($photo_count) { if ($user['user_login'] != $me && isset($upldrcache[$this->get_widget_id()][$user['user_login']]['d'])) { $last_dtm = $upldrcache[$this->get_widget_id()][$user['user_login']]['d']; } else { if ($instance['parent']) { $last_dtm = $wpdb->get_var($wpdb->prepare("SELECT `timestamp` FROM `" . WPPA_PHOTOS . "` WHERE `owner` = %s AND `album` IN (" . $selalbs . ") AND ( ( `status` <> 'pending' AND `status` <> 'scheduled' ) OR `owner` = %s ) ORDER BY `timestamp` DESC LIMIT 1", $user['user_login'], $me)); } else { $last_dtm = $wpdb->get_var($wpdb->prepare("SELECT `timestamp` FROM `" . WPPA_PHOTOS . "` WHERE `owner` = %s AND ( ( `status` <> 'pending' AND `status` <> 'scheduled' ) OR `owner` = %s ) ORDER BY `timestamp` DESC LIMIT 1", $user['user_login'], $me)); } } if ($user['user_login'] != $me) { $upldrcache[$this->get_widget_id()][$user['user_login']]['d'] = $last_dtm; $needupdate = true; } $workarr[] = array('login' => $user['user_login'], 'name' => $user['display_name'], 'count' => $photo_count, 'date' => $last_dtm); } } } } else { $widget_content = __a('There are too many registered users in the system for this widget'); echo "\n" . $before_widget; if (!empty($widget_title)) { echo $before_title . $widget_title . $after_title; } echo $widget_content . $after_widget; return; } if ($needupdate) { update_option('wppa_upldr_cache', $upldrcache); } // Bring me to top $myline = false; if (is_user_logged_in()) { $me = wppa_get_user(); foreach (array_keys($workarr) as $key) { $user = $workarr[$key]; if ($user['login'] == $me) { $myline = $workarr[$key]; unset($workarr[$key]); } } } // Sort workarray $ord = $instance['sortby'] == 'name' ? SORT_ASC : SORT_DESC; $workarr = wppa_array_sort($workarr, $instance['sortby'], $ord); // Create widget content $widget_content = "\n" . '<!-- WPPA+ Upldr Widget start -->'; $widget_content .= '<div class="wppa-upldr" style="max-height:180px; overflow:auto"><table><tbody>'; $albs = $instance['parent'] ? wppa_alb_to_enum_children(wppa_expand_enum($instance['parent'])) : ''; $a = $albs ? wppa_trim_wppa_('&wppa-album=' . $albs) : ''; if ($myline) { $user = $myline; $widget_content .= '<tr class="wppa-user" > <td style="padding: 0 3px;" ><a href="' . wppa_get_upldr_link($user['login']) . $a . '" title="' . __a('Photos uploaded by') . ' ' . $user['name'] . '" ><b>' . $user['name'] . '</b></a></td> <td style="padding: 0 3px;" ><b>' . $user['count'] . '</b></td> <td style="padding: 0 3px;" ><b>' . wppa_get_time_since($user['date']) . '</b></td> </tr>'; } foreach ($workarr as $user) { $widget_content .= '<tr class="wppa-user" > <td style="padding: 0 3px;" ><a href="' . wppa_get_upldr_link($user['login']) . $a . '" title="' . __a('Photos uploaded by') . ' ' . $user['name'] . '" >' . $user['name'] . '</a></td> <td style="padding: 0 3px;" >' . $user['count'] . '</td> <td style="padding: 0 3px;" >' . wppa_get_time_since($user['date']) . '</td> </tr>'; } $widget_content .= '</tbody></table></div>'; $widget_content .= '<div style="clear:both"></div>'; $widget_content .= "\n" . '<!-- WPPA+ Upldr Widget end -->'; // Output echo "\n" . $before_widget; if (!empty($widget_title)) { echo $before_title . $widget_title . $after_title; } echo $widget_content . $after_widget; }
function wppa_format_exif($tag, $data) { $result = $data; switch ($tag) { /* E#0132 Date Time Already formatted correctly E#013B Photographer Already formatted correctly E#8298 Copyright Already formatted correctly Location Formatted into one line according to the 3 tags below: 2#092, 2#090, 2#095, 2#101 2#092 Sub location 2#090 City 2#095 State 2#101 Country E#0110 Camera Already formatted correctly Example: Canon EOS 50D aux:Lens Lens Already formatted correctly - See line 66 in sample photo exifdata.jpg attached Example aux:Lens="EF300mm f/4L IS USM +1.4x" */ // E#920A Focal length Must be formatted: 420/1 = 420 mm case 'E#920A': $temp = explode('/', $data); if (isset($temp[1])) { if (is_numeric($temp[1])) { if ($temp[1] != 0) { $result = round($temp[0] / $temp[1]) . ' mm.'; } } } break; // E#9206 Subject distance Must be formatted: 765/100 = 7,65 m. // E#9206 Subject distance Must be formatted: 765/100 = 7,65 m. case 'E#9206': $temp = explode('/', $data); if (isset($temp[1])) { if (is_numeric($temp[1])) { if ($temp[1] != 0) { $result = round(100 * $temp[0] / $temp[1]) / "100" . ' m.'; } } } break; // E#829A Shutter Speed Must be formatted: 1/125 = 1/125 s. // E#829A Shutter Speed Must be formatted: 1/125 = 1/125 s. case 'E#829A': if ($result) { $result .= ' s.'; } break; // E#829D F-Stop Must be formatted: 56/10 = f/5,6 // E#829D F-Stop Must be formatted: 56/10 = f/5,6 case 'E#829D': $temp = explode('/', $data); if (isset($temp[1])) { if (is_numeric($temp[1])) { if ($temp[1] != 0) { $result = 'f/' . round(10 * $temp[0] / $temp[1]) / 10; } } } break; /* E#8827 ISO Speed Rating Already formatted correctly E#9204 Exposure bias Already formatted correctly E#8822 Exposure program Must be formatted according to table 0 = Not Defined 1 = Manual 2 = Program AE 3 = Aperture-priority AE 4 = Shutter speed priority AE 5 = Creative (Slow speed) 6 = Action (High speed) 7 = Portrait 8 = Landscape 9 = Bulb */ /* E#8827 ISO Speed Rating Already formatted correctly E#9204 Exposure bias Already formatted correctly E#8822 Exposure program Must be formatted according to table 0 = Not Defined 1 = Manual 2 = Program AE 3 = Aperture-priority AE 4 = Shutter speed priority AE 5 = Creative (Slow speed) 6 = Action (High speed) 7 = Portrait 8 = Landscape 9 = Bulb */ case 'E#8822': switch ($data) { case '0': $result = __a('Not Defined'); break; case '1': $result = __a('Manual'); break; case '2': $result = __a('Program AE'); break; case '3': $result = __a('Aperture-priority AE'); break; case '4': $result = __a('Shutter speed priority AE'); break; case '5': $result = __a('Creative (Slow speed)'); break; case '6': $result = __a('Action (High speed)'); break; case '7': $result = __a('Portrait'); break; case '8': $result = __a('Landscape'); break; case '9': $result = __a('Bulb'); break; } break; /* E#9204 Exposure bias value */ /* E#9204 Exposure bias value */ case 'E#9204': if ($data) { $result = $data . ' EV'; } else { $result = ''; } break; /* E#9207 Metering mode Must be formatted according to table 1 = Average 2 = Center-weighted average 3 = Spot 4 = Multi-spot 5 = Multi-segment 6 = Partial 255 = Other */ /* E#9207 Metering mode Must be formatted according to table 1 = Average 2 = Center-weighted average 3 = Spot 4 = Multi-spot 5 = Multi-segment 6 = Partial 255 = Other */ case 'E#9207': switch ($data) { case '1': $result = __a('Average'); break; case '2': $result = __a('Center-weighted average'); break; case '3': $result = __a('Spot'); break; case '4': $result = __a('Multi-spot'); break; case '5': $result = __a('Multi-segment'); break; case '6': $result = __a('Partial'); break; case '255': $result = __a('Other'); break; } break; /* E#9209 Flash Must be formatted according to table 0x0 = No Flash 0x1 = Fired 0x5 = Fired, Return not detected 0x7 = Fired, Return detected 0x8 = On, Did not fire 0x9 = On, Fired 0xd = On, Return not detected 0xf = On, Return detected 0x10 = Off, Did not fire 0x14 = Off, Did not fire, Return not detected 0x18 = Auto, Did not fire 0x19 = Auto, Fired 0x1d = Auto, Fired, Return not detected 0x1f = Auto, Fired, Return detected 0x20 = No flash function 0x30 = Off, No flash function 0x41 = Fired, Red-eye reduction 0x45 = Fired, Red-eye reduction, Return not detected 0x47 = Fired, Red-eye reduction, Return detected 0x49 = On, Red-eye reduction 0x4d = On, Red-eye reduction, Return not detected 0x4f = On, Red-eye reduction, Return detected 0x50 = Off, Red-eye reduction 0x58 = Auto, Did not fire, Red-eye reduction 0x59 = Auto, Fired, Red-eye reduction 0x5d = Auto, Fired, Red-eye reduction, Return not detected 0x5f = Auto, Fired, Red-eye reduction, Return detected */ /* E#9209 Flash Must be formatted according to table 0x0 = No Flash 0x1 = Fired 0x5 = Fired, Return not detected 0x7 = Fired, Return detected 0x8 = On, Did not fire 0x9 = On, Fired 0xd = On, Return not detected 0xf = On, Return detected 0x10 = Off, Did not fire 0x14 = Off, Did not fire, Return not detected 0x18 = Auto, Did not fire 0x19 = Auto, Fired 0x1d = Auto, Fired, Return not detected 0x1f = Auto, Fired, Return detected 0x20 = No flash function 0x30 = Off, No flash function 0x41 = Fired, Red-eye reduction 0x45 = Fired, Red-eye reduction, Return not detected 0x47 = Fired, Red-eye reduction, Return detected 0x49 = On, Red-eye reduction 0x4d = On, Red-eye reduction, Return not detected 0x4f = On, Red-eye reduction, Return detected 0x50 = Off, Red-eye reduction 0x58 = Auto, Did not fire, Red-eye reduction 0x59 = Auto, Fired, Red-eye reduction 0x5d = Auto, Fired, Red-eye reduction, Return not detected 0x5f = Auto, Fired, Red-eye reduction, Return detected */ case 'E#9209': switch ($data) { case '0x0': case '0': $result = __a('No Flash'); break; case '0x1': case '1': $result = __a('Fired'); break; case '0x5': case '5': $result = __a('Fired, Return not detected'); break; case '0x7': case '7': $result = __a('Fired, Return detected'); break; case '0x8': case '8': $result = __a('On, Did not fire'); break; case '0x9': case '9': $result = __a('On, Fired'); break; case '0xd': case '13': $result = __a('On, Return not detected'); break; case '0xf': case '15': $result = __a('On, Return detected'); break; case '0x10': case '16': $result = __a('Off, Did not fire'); break; case '0x14': case '20': $result = __a('Off, Did not fire, Return not detected'); break; case '0x18': case '24': $result = __a('Auto, Did not fire'); break; case '0x19': case '25': $result = __a('Auto, Fired'); break; case '0x1d': case '29': $result = __a('Auto, Fired, Return not detected'); break; case '0x1f': case '31': $result = __a('Auto, Fired, Return detected'); break; case '0x20': case '32': $result = __a('No flash function'); break; case '0x30': case '48': $result = __a('Off, No flash function'); break; case '0x41': case '65': $result = __a('Fired, Red-eye reduction'); break; case '0x45': case '69': $result = __a('Fired, Red-eye reduction, Return not detected'); break; case '0x47': case '71': $result = __a('Fired, Red-eye reduction, Return detected'); break; case '0x49': case '73': $result = __a('On, Red-eye reduction'); break; case '0x4d': case '77': $result = __a('Red-eye reduction, Return not detected'); break; case '0x4f': case '79': $result = __a('On, Red-eye reduction, Return detected'); break; case '0x50': case '80': $result = __a('Off, Red-eye reduction'); break; case '0x58': case '88': $result = __a('Auto, Did not fire, Red-eye reduction'); break; case '0x59': case '89': $result = __a('Auto, Fired, Red-eye reduction'); break; case '0x5d': case '93': $result = __a('Auto, Fired, Red-eye reduction, Return not detected'); break; case '0x5f': case '95': $result = __a('Auto, Fired, Red-eye reduction, Return detected'); break; } break; default: $result = $data; } return $result; }
function wppa_zoom_in($id) { if ($id === false) { return ''; } if (wppa_switch('show_zoomin')) { if (wppa_opt('magnifier')) { return __a('Zoom in'); } else { return esc_attr(stripslashes(wppa_get_photo_name($id))); } } else { return ''; } }
function wppa_theme() { global $wppa_version; $wppa_version = '4-0-0'; // The version number of this file, please change if you modify this file global $wppa; global $wppa_opt; global $wppa_show_statistics; // Can be set to true by a custom page template $curpage = wppa_get_curpage(); // Get the page # we are on when pagination is on, or 1 $didsome = false; // Required initializations for pagination $n_album_pages = '0'; // " $n_thumb_pages = '0'; // " wppa_container('open'); // Open container if ($wppa_show_statistics) { wppa_statistics(); } // Show statistics if set so by the page template wppa_breadcrumb('optional'); // Display breadcrumb navigation only if it is set in the settings page if (wppa_page('albums')) { // Page 'Albums' requested $albums = wppa_get_albums(); // Get the albums if ($albums) { $counter_albums = '0'; $n_album_pages = wppa_get_npages('albums', $albums); wppa_album_list('open'); // Open Albums sub-container foreach ($albums as $ta) { global $album; $album = $ta; // Loop the albums $counter_albums++; if (wppa_onpage('albums', $counter_albums, $curpage)) { $didsome = true; wppa_album_cover(); // Show the cover } // End if on page } wppa_album_list('close'); // Close Albums sub-container } // If albums if ($wppa_opt['wppa_thumbtype'] != 'none') { $thumbs = wppa_get_thumbs(); // Get the Thumbs } else { $thumbs = false; } $n_thumb_pages = wppa_get_npages('thumbs', $thumbs); // How many pages of thumbs will there be? if ($n_thumb_pages == '0') { $thumbs = false; } // No pages: no thumbs. Maybe want covers only if ($didsome && wppa_is_pagination()) { $thumbs = false; } // Pag on and didsome: pagebreak if (count($thumbs) <= wppa_get_mincount()) { $thumbs = false; } // Less than treshold value if ($thumbs) { $counter_thumbs = '0'; if (get_option('wppa_thumbtype', 'default') == 'ascovers') { // Do the thumbs As covers wppa_thumb_list('open'); // Open Thumblist sub-container foreach ($thumbs as $tt) { global $thumb; $thumb = $tt; // Loop the Thumbs $counter_thumbs++; if (wppa_onpage('thumbs', $counter_thumbs, $curpage - $n_album_pages)) { $didsome = true; wppa_thumb_ascover(); // Show Thumb as cover } // End if on page } wppa_thumb_list('close'); // Close Thumblist sub-container } else { // Do the thumbs As default wppa_thumb_area('open'); // Open Thumbarea sub-container foreach ($thumbs as $tt) { global $thumb; $thumb = $tt; // Loop the Thumbs $counter_thumbs++; if (wppa_onpage('thumbs', $counter_thumbs, $curpage - $n_album_pages)) { $didsome = true; wppa_thumb_default(); // Show Thumb as default } // End if on page } wppa_popup(); // Prepare Popup box wppa_thumb_area('close'); // Close Thumbarea sub-container } // As default } // If thumbs if (!wppa_is_pagination()) { $totpag = '1'; } else { $totpag = $n_album_pages + $n_thumb_pages; } wppa_page_links($totpag, $curpage); // Show pages navigaion bar if needed if (!$didsome && $wppa['src']) { $wppa['out'] .= '<div class="center">' . __a('No albums or photos found matching your search criteria.', 'wppa_theme') . '</div>'; } } elseif (wppa_page('oneofone')) { // Page 'Single image' requested wppa_slide_frame(); // Setup slideframe wppa_run_slidecontainer('single'); // Fill in the photo and display it } elseif (wppa_page('slide') || wppa_page('single')) { // Page 'Slideshow' or 'Single' in browsemode requested wppa_the_slideshow(); // Producs all the html required for the slideshow wppa_run_slidecontainer('slideshow'); // Fill in the photo array and display it. } // wppa_page('slide') wppa_container('close'); }
function wppa_album_select_a($args) { global $wpdb; $args = wp_parse_args($args, array('exclude' => '', 'selected' => '', 'disabled' => '', 'addpleaseselect' => false, 'addnone' => false, 'addall' => false, 'addgeneric' => false, 'addblank' => false, 'addselected' => false, 'addseparate' => false, 'addselbox' => false, 'disableancestors' => false, 'checkaccess' => false, 'checkowner' => false, 'checkupload' => false, 'addmultiple' => false, 'addnumbers' => false, 'path' => false, 'root' => false, 'content' => false, 'sort' => true)); // Provide default selection if no selected given if ($args['selected'] === '') { $args['selected'] = wppa_get_last_album(); } // See if selection is valid if ($args['selected'] == $args['exclude'] || $args['checkupload'] && !wppa_allow_uploads($args['selected']) || $args['disableancestors'] && wppa_is_ancestor($args['exclude'], $args['selected'])) { $args['selected'] = '0'; } $albums = $wpdb->get_results("SELECT * FROM `" . WPPA_ALBUMS . "` " . wppa_get_album_order($args['root']), ARRAY_A); // Add to secondary cache if ($albums) { wppa_cache_album('add', $albums); } if ($albums) { // Filter for root if ($args['root']) { $root = $args['root']; switch ($root) { // case '0': all, will be skipped as it returns false in 'if ( $args['root'] )' case '-2': // Generic only foreach (array_keys($albums) as $albidx) { if (wppa_is_separate($albums[$albidx]['id'])) { unset($albums[$albidx]); } } break; case '-1': // Separate only foreach (array_keys($albums) as $albidx) { if (!wppa_is_separate($albums[$albidx]['id'])) { unset($albums[$albidx]); } } break; default: foreach (array_keys($albums) as $albidx) { if (!wppa_is_ancestor($root, $albums[$albidx]['id'])) { unset($albums[$albidx]); } } break; } } // Filter for must have content if ($args['content']) { foreach (array_keys($albums) as $albidx) { if (wppa_get_photo_count($albums[$albidx]['id']) <= wppa_get_mincount()) { unset($albums[$albidx]); } } } // Add paths if ($args['path']) { $albums = wppa_add_paths($albums); } else { foreach (array_keys($albums) as $index) { $albums[$index]['name'] = __(stripslashes($albums[$index]['name'])); } } // Sort if ($args['sort']) { $albums = wppa_array_sort($albums, 'name'); } } // Output $result = ''; $selected = $args['selected'] == '0' ? ' selected="selected"' : ''; if ($args['addpleaseselect']) { $result .= '<option value="0" disabled="disabled" ' . $selected . ' >' . (is_admin() ? __('- select an album -', 'wppa') : __a('- select an album -')) . '</option>'; } $selected = $args['selected'] == '0' ? ' selected="selected"' : ''; if ($args['addnone']) { $result .= '<option value="0"' . $selected . ' >' . (is_admin() ? __('--- none ---', 'wppa') : __a('--- none ---')) . '</option>'; } $selected = $args['selected'] == '0' ? ' selected="selected"' : ''; if ($args['addall']) { $result .= '<option value="0"' . $selected . ' >' . (is_admin() ? __('--- all ---', 'wppa') : __a('--- all ---')) . '</option>'; } $selected = $args['selected'] == '-2' ? ' selected="selected"' : ''; if ($args['addall']) { $result .= '<option value="-2"' . $selected . ' >' . (is_admin() ? __('--- generic ---', 'wppa') : __a('--- generic ---')) . '</option>'; } $selected = $args['selected'] == '0' ? ' selected="selected"' : ''; if ($args['addblank']) { $result .= '<option value="0"' . $selected . ' >' . '</option>'; } $selected = $args['selected'] == '-99' ? ' selected="selected"' : ''; if ($args['addmultiple']) { $result .= '<option value="-99"' . $selected . ' >' . (is_admin() ? __('--- multiple see below ---', 'wppa') : __a('--- multiple see below ---')) . '</option>'; } $selected = $args['selected'] == '0' ? ' selected="selected"' : ''; if ($args['addselbox']) { $result .= '<option value="0"' . $selected . ' >' . (is_admin() ? __('--- a selection box ---', 'wppa') : __a('--- a selection box ---')) . '</option>'; } if ($albums) { foreach ($albums as $album) { if ($args['disabled'] == $album['id'] || $args['exclude'] == $album['id'] || $args['checkupload'] && !wppa_allow_uploads($album['id']) || $args['disableancestors'] && wppa_is_ancestor($args['exclude'], $album['id'])) { $disabled = ' disabled="disabled"'; } else { $disabled = ''; } if ($args['selected'] == $album['id'] && !$disabled) { $selected = ' selected="selected"'; } else { $selected = ''; } $ok = true; // Assume this will be in the list if ($args['checkaccess'] && !wppa_have_access($album['id'])) { $ok = false; } if ($args['checkowner'] && wppa_switch('upload_owner_only')) { // Need to check if ($album['owner'] != wppa_get_user() && $album['owner'] != '--- public ---') { // Not 'mine' if (!wppa_user_is('administrator')) { // No admin $ok = false; } } } if ($selected && $args['addselected']) { $ok = true; } if ($ok) { if ($args['addnumbers']) { $number = ' ( ' . $album['id'] . ' )'; } else { $number = ''; } $result .= '<option value="' . $album['id'] . '" ' . $selected . $disabled . '>' . $album['name'] . $number . '</option>'; } } } $selected = $args['selected'] == '-1' ? ' selected="selected"' : ''; if ($args['addseparate']) { $result .= '<option value="-1"' . $selected . '>' . (is_admin() ? __('--- separate ---', 'wppa') : __a('--- separate ---')) . '</option>'; } return $result; }
function wppa_theme() { global $wppa_version; $wppa_version = '6-1-15-000'; // The version number of this file global $wppa; global $wppa_show_statistics; // Can be set to true by a custom page template $curpage = wppa_get_curpage(); // Get the page # we are on when pagination is on, or 1 $didsome = false; // Required initializations for pagination $n_album_pages = '0'; // " $n_thumb_pages = '0'; // " // Open container wppa_container('open'); // Show statistics if set so by the page template if ($wppa_show_statistics) { wppa_statistics(); } // Display breadcrumb navigation only if it is set in the settings page wppa_breadcrumb('optional'); if (wppa_page('albums')) { // Page 'Albums' requested // Get the albums and the thumbs and the number of pages for each set $albums = wppa_get_albums(); // Get the albums $n_album_pages = wppa_get_npages('albums', $albums); // Get the number of album pages if (wppa_opt('thumbtype') != 'none') { $thumbs = wppa_get_thumbs(); // Get the Thumbs } else { $thumbs = false; } $wanted_empty = wppa_is_wanted_empty($thumbs); // See if we need to display an empty thumbnail area $n_thumb_pages = wppa_get_npages('thumbs', $thumbs); // Get the number of thumb pages if ($n_thumb_pages == '0' && !$wanted_empty) { $thumbs = false; } // No pages: no thumbs. Maybe want covers only if ($wanted_empty) { $n_thumb_pages = '1'; } // Get total number of pages if (!wppa_is_pagination()) { $totpag = '1'; } else { $totpag = $n_album_pages + $n_thumb_pages; } // Make pagelinkbar if requested on top if (wppa_opt('pagelink_pos') == 'top' || wppa_opt('pagelink_pos') == 'both') { wppa_page_links($totpag, $curpage); } // Process the albums if (!wppa_switch('wppa_thumbs_first')) { if ($albums) { $counter_albums = '0'; wppa_album_list('open'); // Open Albums sub-container foreach ($albums as $album) { // Loop the albums $counter_albums++; if (wppa_onpage('albums', $counter_albums, $curpage)) { wppa_album_cover($album['id']); // Show the cover $didsome = true; } // End if on page } wppa_album_list('close'); // Close Albums sub-container } // If albums } if ($didsome && wppa_is_pagination()) { $thumbs = false; } // Pag on and didsome: force a pagebreak by faking no thumbs if (count($thumbs) <= wppa_get_mincount() && !$wanted_empty) { $thumbs = false; } // Less than treshold value if (wppa_switch('wppa_thumbs_first') && $curpage > $n_thumb_pages) { $thumbs = false; } // If thumbs done, do not display an empty thumbarea // Process the thumbs if ($thumbs || $wanted_empty) { if (!$wanted_empty || !wppa_switch('thumbs_first') || wppa_get_curpage() == '1') { if (!$wanted_empty || wppa_switch('thumbs_first') || wppa_get_curpage() == $totpag) { // Init $counter_thumbs = '0'; // As covers if (wppa_opt('wppa_thumbtype') == 'ascovers' || wppa_opt('wppa_thumbtype') == 'ascovers-mcr') { // Do the thumbs As covers wppa_thumb_list('open'); // Open Thumblist sub-container $relpage = wppa_switch('wppa_thumbs_first') ? $curpage : $curpage - $n_album_pages; foreach ($thumbs as $tt) { global $thumb; $thumb = $tt; // Loop the Thumbs $counter_thumbs++; if (wppa_onpage('thumbs', $counter_thumbs, $relpage)) { $didsome = true; wppa_thumb_ascover($thumb['id']); // Show Thumb as cover } // End if on page } wppa_thumb_list('close'); // Close Thumblist sub-container } elseif (wppa_opt('wppa_thumbtype') == 'masonry-v') { // Masonry // The header wppa_thumb_area('open'); // Open Thumbarea sub-container wppa_popup(); // Prepare Popup box wppa_album_name('top'); // Optionally display album name wppa_album_desc('top'); // Optionally display album description // Init $relpage = wppa_switch('wppa_thumbs_first') ? $curpage : $curpage - $n_album_pages; $cont_width = wppa_get_container_width(); $count_cols = ceil($cont_width / (wppa_opt('wppa_thumbsize') + wppa_opt('wppa_tn_margin'))); $correction = wppa_opt('wppa_tn_margin') * ($cont_width / $count_cols) / 100; // Init the table wppa_out('<table class="wppa-masonry" style="margin-top:3px;" ><tbody class="wppa-masonry" ><tr class="wppa-masonry" >'); // Init the columns $col_headers = array(); $col_contents = array(); $col_heights = array(); $col_widths = array(); for ($col = 0; $col < $count_cols; $col++) { $col_headers[$col] = ''; $col_contents[$col] = ''; $col_heights[$col] = 0; $col_widths[$col] = 100; } // Process the thumbnails $col = '0'; if ($thumbs) { foreach ($thumbs as $tt) { $id = $tt['id']; $counter_thumbs++; if (wppa_onpage('thumbs', $counter_thumbs, $relpage)) { $col_contents[$col] .= wppa_get_thumb_masonry($id); $col_heights[$col] += ($correction + wppa_get_thumby($id)) / ($correction + wppa_get_thumbx($id)) * $col_widths[$col]; $col += '1'; if ($col == $count_cols) { $col = '0'; } $didsome = true; } } } // Find longest column $long = 0; for ($col = 0; $col < $count_cols; $col++) { if ($col_heights[$col] > $long) { $long = $col_heights[$col]; } } // Adjust column widths to resize lengths to equal lengths for ($col = 0; $col < $count_cols; $col++) { if ($col_heights[$col]) { $col_widths[$col] = $long / $col_heights[$col] * $col_widths[$col]; } } // Adjust column widths to total 100 $wide = 0; for ($col = 0; $col < $count_cols; $col++) { $wide += $col_widths[$col]; } for ($col = 0; $col < $count_cols; $col++) { $col_widths[$col] = $col_widths[$col] * 100 / $wide; } // Make column headers for ($col = 0; $col < $count_cols; $col++) { $col_headers[$col] = '<td style="width: ' . $col_widths[$col] . '%; vertical-align:top;" class="wppa-masonry" >'; } // Add the columns to the output stream for ($col = 0; $col < $count_cols; $col++) { wppa_out($col_headers[$col]); wppa_out($col_contents[$col]); wppa_out('</td>'); } // Close the table wppa_out('</tr></tbody></table>'); // The footer wppa_album_name('bottom'); // Optionally display album name wppa_album_desc('bottom'); // Optionally display album description wppa_thumb_area('close'); // Close Thumbarea sub-container } elseif (wppa_opt('wppa_thumbtype') == 'masonry-h') { // Masonry // The header wppa_thumb_area('open'); // Open Thumbarea sub-container wppa_popup(); // Prepare Popup box wppa_album_name('top'); // Optionally display album name wppa_album_desc('top'); // Optionally display album description // Init $relpage = wppa_switch('wppa_thumbs_first') ? $curpage : $curpage - $n_album_pages; $cont_width = wppa_get_container_width('netto'); $correction = wppa_opt('wppa_tn_margin'); // Init the table wppa_out('<table class="wppa-masonry" style="margin-top:3px;" ><tbody class="wppa-masonry" >'); // Process the thumbnails $row_content = ''; $row_width = 0; $target_row_height = wppa_opt('wppa_thumbsize') * 0.75 + $correction; $rw_count = 0; $tr_count = '1'; $done_count = 0; $last = false; $max_row_height = $target_row_height * 0.8; // Init keep track for last if ($thumbs) { foreach ($thumbs as $tt) { $id = $tt['id']; $counter_thumbs++; if (wppa_onpage('thumbs', $counter_thumbs, $relpage)) { $row_content .= wppa_get_thumb_masonry($tt['id']); $rw_count += 1; $row_width += wppa_get_thumbratioxy($id) * ($target_row_height - $correction); $didsome = true; } $done_count += 1; $last = $done_count == count($thumbs); if ($row_width > $cont_width || $last) { $tot_marg = $rw_count * $correction; $row_height = $row_width ? ($target_row_height - $correction) * ($cont_width - '3' - $tot_marg) / $row_width + $correction : '0'; if (!$last) { $max_row_height = max($max_row_height, $row_height); } if ($last && $row_height > wppa_get_thumby($id)) { $row_height = $max_row_height; } $row_height_p = $row_height / $cont_width * 100; wppa_out('<tr class="wppa-masonry" >' . '<td style="border:none;padding:0;margin:0" >' . '<div' . ' id="wppa-mas-h-' . $tr_count . '-' . wppa('mocc') . '"' . ' style="height:' . $row_height . 'px;"' . ' class="wppa-masonry"' . ' data-height-perc="' . $row_height_p . '"' . ' >'); wppa_out($row_content); wppa_out('</div></td></tr>'); $row_content = ''; $row_width = 0; $row_height = wppa_opt('wppa_thumbsize'); $rw_count = 0; $tr_count += '1'; } } } wppa_out('</tbody></table>'); // The footer wppa_album_name('bottom'); // Optionally display album name wppa_album_desc('bottom'); // Optionally display album description wppa_thumb_area('close'); // Close Thumbarea sub-container } elseif (wppa_opt('wppa_thumbtype') == 'default') { // Do the thumbs As default // The header wppa_thumb_area('open'); // Open Thumbarea sub-container wppa_popup(); // Prepare Popup box wppa_album_name('top'); // Optionally display album name wppa_album_desc('top'); // Optionally display album description // Init $relpage = wppa_switch('wppa_thumbs_first') ? $curpage : $curpage - $n_album_pages; // Process the thumbnails if ($thumbs) { foreach ($thumbs as $tt) { $counter_thumbs++; if (wppa_onpage('thumbs', $counter_thumbs, $relpage)) { $didsome = true; wppa_thumb_default($tt['id']); // Show Thumb as default } // End if on page } } // The footer wppa_album_name('bottom'); // Optionally display album name wppa_album_desc('bottom'); // Optionally display album description wppa_thumb_area('close'); // Close Thumbarea sub-container } else { wppa_out('Unimplemented thumbnail type'); } } } } // If thumbs if ($didsome && wppa_is_pagination()) { $albums = false; } // Pag on and didsome: force a pagebreak by faking no albums if (!wppa_is_pagination()) { $n_thumb_pages = '0'; } // Still on page one // Process the albums if (wppa_switch('wppa_thumbs_first')) { if ($albums) { $counter_albums = '0'; wppa_album_list('open'); // Open Albums sub-container foreach ($albums as $album) { // Loop the albums $counter_albums++; if (wppa_onpage('albums', $counter_albums, $curpage - $n_thumb_pages)) { wppa_album_cover($album['id']); // Show the cover $didsome = true; } // End if on page } wppa_album_list('close'); // Close Albums sub-container } // If albums } // Make pagelinkbar if requested on bottom if (wppa_opt('pagelink_pos') == 'bottom' || wppa_opt('pagelink_pos') == 'both') { wppa_page_links($totpag, $curpage); } // Empty results? if (!$didsome && !$wanted_empty) { if (wppa('photos_only')) { wppa_out(wppa_errorbox(__a('No photos found matching your search criteria.', 'wppa_theme'))); } elseif (wppa('albums_only')) { wppa_out(wppa_errorbox(__a('No albums found matching your search criteria.', 'wppa_theme'))); } else { wppa_out(wppa_errorbox(__a('No albums or photos found matching your search criteria.', 'wppa_theme'))); } } } elseif (wppa_page('slide') || wppa_page('single')) { // Page 'Slideshow' or 'Single' in browsemode requested $thumbs = wppa_get_thumbs(); wppa_dbg_msg('From theme: #thumbs=' . ($thumbs ? count($thumbs) : '0')); if ($thumbs) { wppa_the_slideshow(); // Producs all the html required for the slideshow wppa_run_slidecontainer('slideshow'); // Fill in the photo array and display it. } else { wppa_out(wppa_errorbox(__a('No photos found matching your search criteria.', 'wppa_theme'))); } } // wppa_page( 'slide' ) // Close container wppa_container('close'); }
/** @see WP_Widget::widget */ function widget($args, $instance) { global $wpdb; global $wppa; global $wppa_opt; require_once dirname(__FILE__) . '/wppa-links.php'; require_once dirname(__FILE__) . '/wppa-styles.php'; require_once dirname(__FILE__) . '/wppa-functions.php'; require_once dirname(__FILE__) . '/wppa-thumbnails.php'; require_once dirname(__FILE__) . '/wppa-boxes-html.php'; require_once dirname(__FILE__) . '/wppa-slideshow.php'; wppa_initialize_runtime(); extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'album' => '', 'width' => $wppa_opt['wppa_widget_width'], 'height' => round($wppa_opt['wppa_widget_width'] * $wppa_opt['wppa_maxheight'] / $wppa_opt['wppa_fullsize']), 'ponly' => 'no', 'linkurl' => '', 'linktitle' => '', 'subtext' => '', 'supertext' => '', 'valign' => 'center', 'timeout' => '4', 'film' => 'no', 'browse' => 'no', 'name' => 'no', 'numbar' => 'no', 'desc' => 'no')); $title = apply_filters('widget_title', $instance['title']); $album = $instance['album']; $width = $instance['width']; $height = $instance['height']; if ($height == '0') { $height = round($width * $wppa_opt['wppa_maxheight'] / $wppa_opt['wppa_fullsize']); } $ponly = $instance['ponly']; $linkurl = $instance['linkurl']; $linktitle = $instance['linktitle']; $supertext = wppa_qtrans($instance['supertext']); $subtext = wppa_qtrans($instance['subtext']); $valign = $instance['valign']; $timeout = $instance['timeout'] * 1000; $film = $instance['film']; $browse = $instance['browse']; $name = $instance['name']; $numbar = $instance['numbar']; $desc = $instance['desc']; $page = in_array($wppa_opt['wppa_slideonly_widget_linktype'], $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_slideonly_widget_linkpage', __a('Widget landing page')); if (is_numeric($album)) { echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } if ($linkurl != '' && $wppa_opt['wppa_slideonly_widget_linktype'] == 'widget') { $wppa['in_widget_linkurl'] = $linkurl; $wppa['in_widget_linktitle'] = wppa_qtrans($linktitle); } if ($supertext != '') { echo '<div style="padding-top:2px; padding-bottom:4px; text-align:center">' . $supertext . '</div>'; } echo '<div style="padding-top:2px; padding-bottom:4px;" >'; $wppa['auto_colwidth'] = false; $wppa['in_widget'] = 'ss'; $wppa['in_widget_frame_height'] = $height; $wppa['in_widget_frame_width'] = $width; $wppa['in_widget_timeout'] = $timeout; $wppa['portrait_only'] = $ponly == 'yes'; $wppa['ss_widget_valign'] = $valign; $wppa['film_on'] = $film == 'yes'; $wppa['browse_on'] = $browse == 'yes'; $wppa['name_on'] = $name == 'yes'; $wppa['numbar_on'] = $numbar == 'yes'; $wppa['desc_on'] = $desc == 'yes'; echo wppa_albums($album, 'slideonly', $width, 'center'); $wppa['desc_on'] = false; $wppa['numbar_on'] = false; $wppa['name_on'] = false; $wppa['browse_on'] = false; $wppa['film_on'] = false; $wppa['ss_widget_valign'] = ''; $wppa['portrait_only'] = false; $wppa['in_widget_timeout'] = '0'; $wppa['in_widget_frame_height'] = ''; $wppa['in_widget_frame_width'] = ''; $wppa['in_widget'] = false; $wppa['fullsize'] = ''; // Reset to prevent inheritage of wrong size in case widget is rendered before main column echo '</div>'; if ($linkurl != '') { $wppa['in_widget_linkurl'] = ''; $wppa['in_widget_linktitle'] = ''; } if ($subtext != '') { echo '<div style="padding-top:2px; padding-bottom:0px; text-align:center">' . $subtext . '</div>'; } echo $after_widget; } else { echo "\n" . $before_widget; if (!empty($widget_title)) { echo $before_title . $widget_title . $after_title; } echo __a('No album defined yet.', 'wppa_theme'); echo $after_widget; } }
function wppa_get_medal_html_a($args) { // Completize args $args = wp_parse_args((array) $args, array('id' => '0', 'size' => 'M', 'where' => '')); // Validate args if ($args['id'] == '0') { return ''; } // Missing required id if (!in_array($args['size'], array('S', 'M', 'L', 'XL'))) { return ''; } // Missing or not implemented size spec if (!in_array($args['where'], array('top', 'bot'))) { return ''; } // Missing or not implemented where // Do it here? if (strpos(wppa_opt('medal_position'), $args['where']) === false) { return ''; } // No // Get rquired photo and config data $id = $args['id']; $new = wppa_is_photo_new($id); $status = wppa_get_photo_item($id, 'status'); $medal = in_array($status, array('gold', 'silver', 'bronze')) ? $status : ''; // Have a medal to show? if (!$new && !$medal) { return ''; // No } // Init local vars $result = ''; $color = wppa_opt('medal_color'); $left = strpos(wppa_opt('medal_position'), 'left') !== false; $ctop = strpos(wppa_opt('medal_position'), 'top') === false ? '-32' : '0'; $sizes = array('S' => '16', 'M' => '20', 'L' => '24', 'XL' => '32'); $nsizes = array('S' => '14', 'M' => '16', 'L' => '20', 'XL' => '24'); $smargs = array('S' => '4', 'M' => '5', 'L' => '6', 'XL' => '8'); $lmargs = array('S' => '22', 'M' => '28', 'L' => '36', 'XL' => '48'); $tops = array('S' => '8', 'M' => '8', 'L' => '6', 'XL' => '0'); $ntops = array('S' => '10', 'M' => '10', 'L' => '8', 'XL' => '0'); $titles = array('gold' => __a('Gold medal'), 'silver' => __a('Silver medal'), 'bronze' => __a('Bronze medal')); $size = $sizes[$args['size']]; $nsize = $nsizes[$args['size']]; $smarg = $smargs[$args['size']]; $lmarg = $lmargs[$args['size']]; $top = $tops[$args['size']]; $ntop = $ntops[$args['size']]; $title = $medal ? esc_attr($titles[$medal]) : ''; $sstyle = $left ? 'left:' . $smarg . 'px;' : 'right:' . $smarg . 'px;'; $lstyle = $left ? 'left:' . $lmarg . 'px;' : 'right:' . $lmarg . 'px;'; // The medal container $result .= '<div style="position:relative;top:' . $ctop . 'px;z-index:10;">'; // The medal if ($medal) { $result .= '<img' . ' src="' . WPPA_URL . '/images/medal_' . $medal . '_' . $color . '.png"' . ' title="' . $title . '"' . ' alt="' . $title . '"' . ' style="' . $sstyle . 'top:4px;' . 'position:absolute;' . 'border:none;' . 'margin:0;' . 'padding:0;' . 'box-shadow:none;' . 'height:' . $size . 'px;' . 'top:' . $top . 'px;' . '"' . ' />'; } // The new indicator if (!$medal) { $lstyle = $sstyle; } if ($new) { $result .= '<img' . ' src="' . WPPA_URL . '/images/new.png"' . ' title="' . esc_attr(__a('New')) . '"' . ' alt="' . esc_attr(__a('New')) . '"' . ' class="wppa-thumbnew"' . ' style="' . $lstyle . 'top:' . $ntop . 'px;' . 'position:absolute;' . 'border:none;' . 'margin:0;' . 'padding:0;' . 'box-shadow:none;' . 'height:' . $nsize . 'px;' . '"' . ' />'; } // Close container $result .= '</div>'; return $result; }
/** @see WP_Widget::widget */ function widget($args, $instance) { global $wpdb; global $wppa_opt; global $wppa; require_once dirname(__FILE__) . '/wppa-links.php'; require_once dirname(__FILE__) . '/wppa-styles.php'; require_once dirname(__FILE__) . '/wppa-functions.php'; require_once dirname(__FILE__) . '/wppa-thumbnails.php'; require_once dirname(__FILE__) . '/wppa-boxes-html.php'; require_once dirname(__FILE__) . '/wppa-slideshow.php'; wppa_initialize_runtime(); $wppa['in_widget'] = 'topten'; $wppa['mocc']++; extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'sortby' => 'mean_rating', 'title' => '', 'album' => '', 'display' => 'thumbs', 'meanrat' => 'yes', 'ratcount' => 'yes', 'viewcount' => 'yes', 'includesubs' => 'yes', 'showowner' => 'no', 'showalbum' => 'no')); $widget_title = apply_filters('widget_title', $instance['title']); $page = in_array($wppa_opt['wppa_topten_widget_linktype'], $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_topten_widget_linkpage', __a('Top Ten Photos')); $albumlinkpage = wppa_get_the_landing_page('wppa_topten_widget_album_linkpage', __a('Top Ten Photo album')); $max = $wppa_opt['wppa_topten_count']; $album = $instance['album']; switch ($instance['sortby']) { case 'mean_rating': $sortby = '`mean_rating` DESC, `rating_count` DESC, `views` DESC'; break; case 'rating_count': $sortby = '`rating_count` DESC, `mean_rating` DESC, `views` DESC'; break; case 'views': $sortby = '`views` DESC, `mean_rating` DESC, `rating_count` DESC'; break; } $display = $instance['display']; $meanrat = $instance['meanrat'] == 'yes'; $ratcount = $instance['ratcount'] == 'yes'; $viewcount = $instance['viewcount'] == 'yes'; $includesubs = $instance['includesubs'] == 'yes'; $albenum = ''; $showowner = $instance['showowner'] == 'yes'; $showalbum = $instance['showalbum'] == 'yes'; if ($album) { if ($album == '-2') { $album = '0'; } if ($includesubs) { $albenum = wppa_alb_to_enum_children($album); $albenum = wppa_expand_enum($albenum); $album = str_replace('.', ',', $albenum); } $thumbs = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `album` IN (" . $album . ") ORDER BY " . $sortby . " LIMIT " . $max, ARRAY_A); //wppa_log('dbg', "SELECT * FROM `".WPPA_PHOTOS."` WHERE `album` IN (".$album.") ORDER BY " . $sortby . " LIMIT " . $max); } else { $thumbs = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` ORDER BY " . $sortby . " LIMIT " . $max, ARRAY_A); } $widget_content = "\n" . '<!-- WPPA+ TopTen Widget start -->'; $maxw = $wppa_opt['wppa_topten_size']; $maxh = $maxw; $lineheight = $wppa_opt['wppa_fontsize_widget_thumb'] * 1.5; $maxh += $lineheight; if ($meanrat) { $maxh += $lineheight; } if ($ratcount) { $maxh += $lineheight; } if ($viewcount) { $maxh += $lineheight; } if ($showowner) { $maxh += $lineheight; } if ($showalbum) { $maxh += $lineheight; } if ($thumbs) { foreach ($thumbs as $image) { global $thumb; $thumb = $image; // Make the HTML for current picture if ($display == 'thumbs') { $widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">'; } else { $widget_content .= "\n" . '<div class="wppa-widget" >'; } if ($image) { $no_album = !$album; if ($no_album) { $tit = __a('View the top rated photos', 'wppa_theme'); } else { $tit = esc_attr(wppa_qtrans(stripslashes($image['description']))); } $compressed_albumenum = wppa_compress_enum($albenum); $link = wppa_get_imglnk_a('topten', $image['id'], '', $tit, '', $no_album, $compressed_albumenum); $file = wppa_get_thumb_path($image['id']); $imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'ttthumb'); $imgurl = wppa_get_thumb_url($image['id'], '', $imgstyle_a['width'], $imgstyle_a['height']); $imgevents = wppa_get_imgevents('thumb', $image['id'], true); $title = $link ? esc_attr(stripslashes($link['title'])) : ''; $widget_content .= wppa_get_the_widget_thumb('topten', $image, $album, $display, $link, $title, $imgurl, $imgstyle_a, $imgevents); $widget_content .= "\n\t" . '<div style="font-size:' . $wppa_opt['wppa_fontsize_widget_thumb'] . 'px; line-height:' . $lineheight . 'px;">'; // Display (owner) ? if ($showowner) { $widget_content .= '<div>(' . $image['owner'] . ')</div>'; } // Display (album) ? if ($showalbum) { $href = wppa_convert_to_pretty(wppa_get_album_url($image['album'], $albumlinkpage, 'content', '1')); $widget_content .= '<div>(<a href="' . $href . '" >' . wppa_get_album_name($image['album']) . '</a>)</div>'; } $rating = wppa_get_rating_by_id($image['id']); switch ($instance['sortby']) { case 'mean_rating': if ($meanrat == 'yes') { $widget_content .= '<div>' . wppa_get_rating_by_id($image['id']) . '</div>'; } if ($ratcount == 'yes') { $widget_content .= '<div>' . sprintf(__a('%s Votes'), wppa_get_rating_count_by_id($image['id'])) . '</div>'; } if ($viewcount == 'yes' && $image['views']) { $widget_content .= '<div>' . sprintf(__a('Views: %s times', 'wppa_theme'), $image['views']) . '</div>'; } break; case 'rating_count': if ($ratcount == 'yes') { $widget_content .= '<div>' . sprintf(__a('%s Votes'), wppa_get_rating_count_by_id($image['id'])) . '</div>'; } if ($meanrat == 'yes') { $widget_content .= '<div>' . wppa_get_rating_by_id($image['id']) . '</div>'; } if ($viewcount == 'yes' && $image['views']) { $widget_content .= '<div>' . sprintf(__a('Views: %s times', 'wppa_theme'), $image['views']) . '</div>'; } break; case 'views': if ($viewcount == 'yes' && $image['views']) { $widget_content .= '<div>' . sprintf(__a('Views: %s times', 'wppa_theme'), $image['views']) . '</div>'; } if ($meanrat == 'yes') { $widget_content .= '<div>' . wppa_get_rating_by_id($image['id']) . '</div>'; } if ($ratcount == 'yes') { $widget_content .= '<div>' . sprintf(__a('%s Votes'), wppa_get_rating_count_by_id($image['id'])) . '</div>'; } break; } $widget_content .= '</div>'; } else { // No image $widget_content .= __a('Photo not found.', 'wppa_theme'); } $widget_content .= "\n" . '</div>'; } } else { $widget_content .= 'There are no rated photos (yet).'; } $widget_content .= '<div style="clear:both"></div>'; $widget_content .= "\n" . '<!-- WPPA+ TopTen Widget end -->'; echo "\n" . $before_widget; if (!empty($widget_title)) { echo $before_title . $widget_title . $after_title; } echo $widget_content . $after_widget; }
function wppa_get_keywords($id) { static $wppa_void_keywords; if (!$id) { return ''; } if (empty($wppa_void_keywords)) { $wppa_void_keywords = array(__a('Not Defined'), __a('Manual'), __a('Program AE'), __a('Aperture-priority AE'), __a('Shutter speed priority AE'), __a('Creative (Slow speed)'), __a('Action (High speed)'), __a('Portrait'), __a('Landscape'), __a('Bulb'), __a('Average'), __a('Center-weighted average'), __a('Spot'), __a('Multi-spot'), __a('Multi-segment'), __a('Partial'), __a('Other'), __a('No Flash'), __a('Fired'), __a('Fired, Return not detected'), __a('Fired, Return detected'), __a('On, Did not fire'), __a('On, Fired'), __a('On, Return not detected'), __a('On, Return detected'), __a('Off, Did not fire'), __a('Off, Did not fire, Return not detected'), __a('Auto, Did not fire'), __a('Auto, Fired'), __a('Auto, Fired, Return not detected'), __a('Auto, Fired, Return detected'), __a('No flash function'), __a('Off, No flash function'), __a('Fired, Red-eye reduction'), __a('Fired, Red-eye reduction, Return not detected'), __a('Fired, Red-eye reduction, Return detected'), __a('On, Red-eye reduction'), __a('Red-eye reduction, Return not detected'), __a('On, Red-eye reduction, Return detected'), __a('Off, Red-eye reduction'), __a('Auto, Did not fire, Red-eye reduction'), __a('Auto, Fired, Red-eye reduction'), __a('Auto, Fired, Red-eye reduction, Return not detected'), __a('Auto, Fired, Red-eye reduction, Return detected'), 'album', 'albums', 'content', 'http', 'source', 'wp', 'uploads', 'thumbs', 'wp-content', 'wppa', 'wppa-source', 'border', 'important', 'label', 'padding', 'segment', 'shutter', 'style', 'table', 'times', 'value', 'views', 'wppa-label', 'wppa-value', 'weighted', 'wppa-pl', str_replace('/', '', site_url())); // make a string $temp = implode(',', $wppa_void_keywords); // Downcase $temp = strtolower($temp); // Remove spaces and funny chars $temp = str_replace(array(' ', '-', '"', "'", '\\', '>', '<', ',', ':', ';', '!', '?', '=', '_', '[', ']', '(', ')', '{', '}'), ',', $temp); $temp = str_replace(',,', ',', $temp); //wppa_log('dbg', $temp); // Make array $wppa_void_keywords = explode(',', $temp); // Sort array sort($wppa_void_keywords); // Remove dups $start = 0; foreach (array_keys($wppa_void_keywords) as $key) { if ($key > 0) { if ($wppa_void_keywords[$key] == $wppa_void_keywords[$start]) { unset($wppa_void_keywords[$key]); } else { $start = $key; } } } } $text = wppa_get_photo_name($id) . ' ' . wppa_get_photo_desc($id); $text = str_replace(array('/', '-'), ' ', $text); $words = wppa_index_raw_to_words($text); foreach (array_keys($words) as $key) { if (wppa_is_int($words[$key]) || in_array($words[$key], $wppa_void_keywords) || strlen($words[$key]) < 5) { unset($words[$key]); } } $result = implode(', ', $words); return $result; }
function wppa_get_imglnk_a($wich, $id, $lnk = '', $tit = '', $onc = '', $noalb = false, $album = '') { global $wppa; global $wpdb; // make sure the photo data ia available $thumb = wppa_cache_thumb($id); if (!$thumb) { return false; } // Is it a video? $is_video = wppa_is_video($id, true); // Photo Specific Overrule? if ($wich == 'sphoto' && wppa_switch('wppa_sphoto_overrule') || $wich == 'mphoto' && wppa_switch('wppa_mphoto_overrule') || $wich == 'thumb' && wppa_switch('wppa_thumb_overrule') || $wich == 'topten' && wppa_switch('wppa_topten_overrule') || $wich == 'featen' && wppa_switch('wppa_featen_overrule') || $wich == 'lasten' && wppa_switch('wppa_lasten_overrule') || $wich == 'sswidget' && wppa_switch('wppa_sswidget_overrule') || $wich == 'potdwidget' && wppa_switch('wppa_potdwidget_overrule') || $wich == 'coverimg' && wppa_switch('wppa_coverimg_overrule') || $wich == 'comten' && wppa_switch('wppa_comment_overrule') || $wich == 'slideshow' && wppa_switch('wppa_slideshow_overrule') || $wich == 'tnwidget' && wppa_switch('wppa_thumbnail_widget_overrule')) { // Look for a photo specific link if ($thumb) { // If it is there... if ($thumb['linkurl']) { // Use it. It superceeds other settings $result['url'] = esc_attr($thumb['linkurl']); $result['title'] = esc_attr(wppa_qtrans(stripslashes($thumb['linktitle']))); $result['is_url'] = true; $result['is_lightbox'] = false; $result['onclick'] = ''; $result['target'] = $thumb['linktarget']; return $result; } } } $result['target'] = '_self'; $result['title'] = ''; $result['onclick'] = ''; switch ($wich) { case 'sphoto': $type = wppa_opt('wppa_sphoto_linktype'); $page = wppa_opt('wppa_sphoto_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_sphoto_blank')) { $result['target'] = '_blank'; } break; case 'mphoto': $type = wppa_opt('wppa_mphoto_linktype'); $page = wppa_opt('wppa_mphoto_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_mphoto_blank')) { $result['target'] = '_blank'; } break; case 'thumb': $type = wppa_opt('wppa_thumb_linktype'); $page = wppa_opt('wppa_thumb_linkpage'); if (wppa_switch('wppa_thumb_blank')) { $result['target'] = '_blank'; } break; case 'topten': $type = wppa_opt('wppa_topten_widget_linktype'); $page = wppa_opt('wppa_topten_widget_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_topten_blank')) { $result['target'] = '_blank'; } break; case 'featen': $type = wppa_opt('wppa_featen_widget_linktype'); $page = wppa_opt('wppa_featen_widget_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_featen_blank')) { $result['target'] = '_blank'; } break; case 'lasten': $type = wppa_opt('wppa_lasten_widget_linktype'); $page = wppa_opt('wppa_lasten_widget_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_lasten_blank')) { $result['target'] = '_blank'; } break; case 'comten': $type = wppa_opt('wppa_comment_widget_linktype'); $page = wppa_opt('wppa_comment_widget_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_comment_blank')) { $result['target'] = '_blank'; } break; case 'sswidget': $type = wppa_opt('wppa_slideonly_widget_linktype'); $page = wppa_opt('wppa_slideonly_widget_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_sswidget_blank')) { $result['target'] = '_blank'; } $result['url'] = ''; if ($type == 'lightbox' || $type == 'lightboxsingle' || $type == 'file') { $result['title'] = wppa_zoom_in($id); $result['target'] = ''; return $result; } break; case 'potdwidget': $type = wppa_opt('wppa_widget_linktype'); $page = wppa_opt('wppa_widget_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_potd_blank')) { $result['target'] = '_blank'; } break; case 'coverimg': $type = wppa_opt('wppa_coverimg_linktype'); $page = wppa_opt('wppa_coverimg_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_coverimg_blank')) { $result['target'] = '_blank'; } if ($type == 'slideshowstartatimage') { $result['url'] = wppa_get_slideshow_url($album, $page, $id); $result['is_url'] = true; $result['is_lightbox'] = false; return $result; } break; case 'tnwidget': $type = wppa_opt('wppa_thumbnail_widget_linktype'); $page = wppa_opt('wppa_thumbnail_widget_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_thumbnail_widget_blank')) { $result['target'] = '_blank'; } break; case 'slideshow': $type = wppa_opt('wppa_slideshow_linktype'); //''; $page = wppa_opt('wppa_slideshow_linkpage'); $result['url'] = ''; if ($type == 'lightbox' || $type == 'lightboxsingle' || $type == 'file') { $result['title'] = wppa_zoom_in($id); $result['target'] = ''; return $result; } if ($type == 'thumbs') { $result['url'] = wppa_get_ss_to_tn_link($page, $id); $result['title'] = __a('View thumbnails'); $result['is_url'] = true; $result['is_lightbox'] = false; if (wppa_switch('wppa_slideshow_blank')) { $result['target'] = '_blank'; } return $result; } if ($type == 'none') { return; } // Continue for 'single' break; case 'albwidget': $type = wppa_opt('wppa_album_widget_linktype'); $page = wppa_opt('wppa_album_widget_linkpage'); if ($page == '0') { $page = '-1'; } if (wppa_switch('wppa_album_widget_blank')) { $result['target'] = '_blank'; } break; default: return false; break; } if (!$album) { $album = wppa('start_album'); } if ($album == '' && !wppa('is_upldr')) { /**/ $album = wppa_get_album_id_by_photo_id($id); } if (is_numeric($album)) { $album_name = wppa_get_album_name($album); } else { $album_name = ''; } if (!$album) { $album = '0'; } if ($wich == 'comten') { $album = '0'; } if (wppa('is_tag')) { $album = '0'; } if (wppa('supersearch')) { $album = '0'; } // if ( wppa( 'is_upldr' ) ) $album = '0'; // probeersel upldr parent if ($id) { $photo_name = wppa_get_photo_name($id); } else { $photo_name = ''; } $photo_name_js = esc_js($photo_name); $photo_name = esc_attr($photo_name); if ($id) { $photo_desc = esc_attr(wppa_get_photo_desc($id)); } else { $photo_desc = ''; } $title = __($photo_name); $result['onclick'] = ''; // Init switch ($type) { case 'none': // No link at all return false; break; case 'file': // The plain file if ($is_video) { $siz = array(wppa_get_videox($id), wppa_get_videoy($id)); $result['url'] = wppa_get_photo_url($id, '', $siz['0'], $siz['1']); reset($is_video); $result['url'] = str_replace('xxx', current($is_video), $result['url']); } else { $siz = array(wppa_get_photox($id), wppa_get_photoy($id)); $result['url'] = wppa_get_photo_url($id, '', $siz['0'], $siz['1']); } $result['title'] = $title; $result['is_url'] = true; $result['is_lightbox'] = false; return $result; break; case 'lightbox': case 'lightboxsingle': if ($is_video) { $siz = array(wppa_get_videox($id), wppa_get_videoy($id)); $result['url'] = wppa_get_photo_url($id, '', $siz['0'], $siz['1']); //$result['url'] = str_replace( 'xxx', $is_video['0'], $result['url'] ); } else { if (wppa_switch('wppa_lb_hres')) { $result['url'] = wppa_get_hires_url($id); } else { $siz = array(wppa_get_photox($id), wppa_get_photoy($id)); $result['url'] = wppa_get_photo_url($id, '', $siz['0'], $siz['1']); } } $result['title'] = $title; $result['is_url'] = false; $result['is_lightbox'] = true; $result['url'] = wppa_fix_poster_ext($result['url'], $id); return $result; case 'widget': // Defined at widget activation $result['url'] = wppa('in_widget_linkurl'); $result['title'] = esc_attr(wppa('in_widget_linktitle')); $result['is_url'] = true; $result['is_lightbox'] = false; return $result; break; case 'album': // The albums thumbnails // The albums thumbnails case 'content': // For album widget switch ($page) { case '-1': return false; break; case '0': if ($noalb) { $result['url'] = wppa_get_permalink() . 'wppa-album=0&wppa-cover=0'; $result['title'] = ''; // $album_name; $result['is_url'] = true; $result['is_lightbox'] = false; } else { $result['url'] = wppa_get_permalink() . 'wppa-album=' . $album . '&wppa-cover=0'; $result['title'] = $album_name; $result['is_url'] = true; $result['is_lightbox'] = false; } break; default: if ($noalb) { $result['url'] = wppa_get_permalink($page) . 'wppa-album=0&wppa-cover=0'; $result['title'] = ''; //$album_name;//'a++'; $result['is_url'] = true; $result['is_lightbox'] = false; } else { $result['url'] = wppa_get_permalink($page) . 'wppa-album=' . $album . '&wppa-cover=0'; $result['title'] = $album_name; //'a++'; $result['is_url'] = true; $result['is_lightbox'] = false; } break; } break; case 'thumbalbum': $album = $thumb['album']; $album_name = wppa_get_album_name($album); switch ($page) { case '-1': return false; break; case '0': $result['url'] = wppa_get_permalink() . 'wppa-album=' . $album . '&wppa-cover=0'; $result['title'] = $album_name; $result['is_url'] = true; $result['is_lightbox'] = false; break; default: $result['url'] = wppa_get_permalink($page) . 'wppa-album=' . $album . '&wppa-cover=0'; $result['title'] = $album_name; //'a++'; $result['is_url'] = true; $result['is_lightbox'] = false; break; } break; case 'photo': // This means: The fullsize photo in a slideshow // This means: The fullsize photo in a slideshow case 'slphoto': // This means: The single photo in the style of a slideshow if ($type == 'slphoto') { $si = '&wppa-single=1'; } else { $si = ''; } switch ($page) { case '-1': return false; break; case '0': if ($noalb) { $result['url'] = wppa_get_permalink() . 'wppa-album=0&wppa-photo=' . $id . $si; $result['title'] = $title; $result['is_url'] = true; $result['is_lightbox'] = false; } else { $result['url'] = wppa_get_permalink() . 'wppa-album=' . $album . '&wppa-photo=' . $id . $si; $result['title'] = $title; $result['is_url'] = true; $result['is_lightbox'] = false; } break; default: if ($noalb) { $result['url'] = wppa_get_permalink($page) . 'wppa-album=0&wppa-photo=' . $id . $si; $result['title'] = $title; $result['is_url'] = true; $result['is_lightbox'] = false; } else { $result['url'] = wppa_get_permalink($page) . 'wppa-album=' . $album . '&wppa-photo=' . $id . $si; $result['title'] = $title; $result['is_url'] = true; $result['is_lightbox'] = false; } break; } break; case 'single': switch ($page) { case '-1': return false; break; case '0': $result['url'] = wppa_get_permalink() . 'wppa-photo=' . $id; $result['title'] = $title; $result['is_url'] = true; $result['is_lightbox'] = false; break; default: $result['url'] = wppa_get_permalink($page) . 'wppa-photo=' . $id; $result['title'] = $title; $result['is_url'] = true; $result['is_lightbox'] = false; break; } break; case 'same': $result['url'] = $lnk; $result['title'] = $tit; $result['is_url'] = true; $result['is_lightbox'] = false; $result['onclick'] = $onc; return $result; break; case 'fullpopup': if ($is_video) { // A video can not be printed or downloaded $result['url'] = esc_attr('alert( "' . esc_js(__a('A video can not be printed or downloaded')) . '" )'); } else { $wid = wppa_get_photox($id); $hig = wppa_get_photoy($id); /* $imgsize = getimagesize( wppa_get_photo_path( $id ) ); if ( $imgsize ) { $wid = $imgsize['0']; $hig = $imgsize['1']; } else { $wid = '0'; $hig = '0'; } */ $url = wppa_fix_poster_ext(wppa_get_photo_url($id, '', $wid, $hig), $id); $result['url'] = esc_attr('wppaFullPopUp( ' . wppa('mocc') . ', ' . $id . ', "' . $url . '", ' . $wid . ', ' . $hig . ' )'); } $result['title'] = $title; $result['is_url'] = false; $result['is_lightbox'] = false; return $result; break; case 'custom': if ($wich == 'potdwidget') { $result['url'] = wppa_opt('wppa_widget_linkurl'); $result['title'] = wppa_opt('wppa_widget_linktitle'); $result['is_url'] = true; $result['is_lightbox'] = false; return $result; } break; case 'slide': // for album widget $result['url'] = wppa_get_permalink(wppa_opt('wppa_album_widget_linkpage')) . 'wppa-album=' . $album . '&slide'; $result['title'] = ''; $result['is_url'] = true; $result['is_lightbox'] = false; break; case 'autopage': if (!wppa_switch('wppa_auto_page')) { wppa_dbg_msg('Auto page has been switched off, but there are still links to it (' . $wich . ')', 'red', 'force'); $result['url'] = ''; } else { $result['url'] = wppa_get_permalink(wppa_get_the_auto_page($id)); } $result['title'] = ''; $result['is_url'] = true; $result['is_lightbox'] = false; break; case 'plainpage': $result['url'] = get_permalink($page); $result['title'] = $wpdb->get_var($wpdb->prepare("SELECT `post_title` FROM `" . $wpdb->prefix . "posts` WHERE `ID` = %s", $page)); $result['is_url'] = true; $result['is_lightbox'] = false; return $result; break; default: wppa_dbg_msg('Error, wrong type: ' . $type . ' in wppa_get_imglink_a', 'red'); return false; break; } if ($type != 'thumbalbum') { if (wppa('supersearch')) { $result['url'] .= '&wppa-supersearch=' . urlencode(wppa('supersearch')); } if (wppa('src') && !wppa('is_related') && !wppa('in_widget')) { $result['url'] .= '&wppa-searchstring=' . urlencode(wppa('searchstring')); } if ($wich == 'topten') { $result['url'] .= '&wppa-topten=' . wppa_opt('wppa_topten_count'); } elseif (wppa('is_topten')) { $result['url'] .= '&wppa-topten=' . wppa('topten_count'); } if ($wich == 'lasten') { $result['url'] .= '&wppa-lasten=' . wppa_opt('wppa_lasten_count'); } elseif (wppa('is_lasten')) { $result['url'] .= '&wppa-lasten=' . wppa('lasten_count'); } if ($wich == 'comten') { $result['url'] .= '&wppa-comten=' . wppa_opt('wppa_comten_count'); } elseif (wppa('is_comten')) { $result['url'] .= '&wppa-comten=' . wppa('comten_count'); } if ($wich == 'featen') { $result['url'] .= '&wppa-featen=' . wppa_opt('wppa_featen_count'); } elseif (wppa('is_featen')) { $result['url'] .= '&wppa-featen=' . wppa('featen_count'); } if (wppa('is_related')) { $result['url'] .= '&wppa-rel=' . wppa('is_related') . '&wppa-relcount=' . wppa('related_count'); } elseif (wppa('is_tag')) { $result['url'] .= '&wppa-tag=' . wppa('is_tag'); } if (wppa('is_upldr')) { $result['url'] .= '&wppa-upldr=' . wppa('is_upldr'); } } if ($page != '0') { // on a different page $occur = '1'; $w = ''; } else { // on the same page, post or widget $occur = wppa('in_widget') ? wppa('widget_occur') : wppa('occur'); $w = wppa('in_widget') ? 'w' : ''; } $result['url'] .= '&wppa-' . $w . 'occur=' . $occur; $result['url'] = wppa_convert_to_pretty($result['url']); if ($result['title'] == '') { $result['title'] = $tit; } // If still nothing, try arg return $result; }
function plgAfterSave(&$model) { if (!isset($model->data['Email']) || !Sanitize::getInt($model->data['Email'], 'send')) { return false; } # Read cms mail config settings $configSendmailPath = cmsFramework::getConfig('sendmail'); $configSmtpAuth = cmsFramework::getConfig('smtpauth'); $configSmtpUser = cmsFramework::getConfig('smtpuser'); $configSmtpPass = cmsFramework::getConfig('smtppass'); $configSmtpHost = cmsFramework::getConfig('smtphost'); $configSmtpSecure = cmsFramework::getConfig('smtpsecure'); $configSmtpPort = cmsFramework::getConfig('smtpport'); $configMailFrom = cmsFramework::getConfig('mailfrom'); $configFromName = cmsFramework::getConfig('fromname'); $configMailer = cmsFramework::getConfig('mailer'); if (!class_exists('PHPMailer')) { App::import('Vendor', 'phpmailer' . DS . 'class.phpmailer'); } $mail = new PHPMailer(); $mail->CharSet = cmsFramework::getCharset(); $mail->SetLanguage('en', S2_VENDORS . 'PHPMailer' . DS . 'language' . DS); $mail->Mailer = $configMailer; // Mailer used mail,sendmail,smtp switch ($configMailer) { case 'smtp': $mail->Host = $configSmtpHost; $mail->SMTPAuth = $configSmtpAuth; $mail->Username = $configSmtpUser; $mail->Password = $configSmtpPass; $mail->SMTPSecure = $configSmtpSecure != '' ? $configSmtpSecure : ''; $mail->Port = $configSmtpPort; break; case 'sendmail': $mail->Sendmail = $configSendmailPath; break; default: break; } $mail->isHTML(true); $mail->From = $configMailFrom; $mail->FromName = $configFromName; $mail->AddReplyTo($configMailFrom, $configFromName); // $model->data[$this->notifyModel->name]['key'] = $value; $model->data['Email']['body'] = urldecode($model->data['__raw']['Email']['body']); // Send html email # In this observer model we just use the existing data to send the email notification switch ($this->notifyModel->name) { // Notification for claims moderation case 'Claim': if ($model->data['Email']['subject'] != '') { $subject = $model->data['Email']['subject']; $subject = str_ireplace('{name}', $model->data['Email']['name'], $subject); $subject = str_ireplace('{listing_title}', $model->data['Email']['listing_title'], $subject); } else { switch ($model->data['Claim']['approved']) { case 1: $subject = __a("Your claim has been approved", true); break; case -1: $subject = __a("Your claim has been rejected", true); break; case 0: $subject = __a("Your claim has been reviewed, but still pending moderation", true); break; } } // Get permalink $listing_id = $model->data['Listing']['id']; $listing = $this->controller->Listing->findRow(array('conditions' => 'Listing.id = ' . $listing_id), array('afterFind')); $permalink = cmsFramework::makeAbsUrl($listing['Listing']['url'], array('sef' => true)); $message = $model->data['Email']['body']; $message = str_ireplace('{name}', $model->data['Email']['name'], $message); $message = str_ireplace('{listing_title}', $model->data['Email']['listing_title'], $message); $message = str_ireplace(array('{link}', '{url}'), $permalink, $message); if ($message != '') { $mail->Subject = $subject; // Convert line breaks to br tags if html code not found on the message body $mail->Body = nl2br($message); $mail->AddAddress($model->data['Email']['email']); if (!$mail->Send()) { appLogMessage(array("Admin claim moderation message was not sent.", "Mailer error: " . $mail->ErrorInfo), 'notifications'); } } break; # Notification for discussion post moderation # Notification for discussion post moderation case 'Discussion': if ($model->data['Email']['subject'] != '') { $subject = $model->data['Email']['subject']; $subject = str_ireplace('{name}', $model->data['Email']['name'], $subject); $subject = str_ireplace('{review_title}', $model->data['Email']['review_title'], $subject); } else { switch ($model->data['Discussion']['approved']) { case 1: $subject = __a("Your comment has been approved", true); break; case -1: $subject = __a("Your comment has been rejected", true); break; } } // Get permalink $this->controller->EverywhereAfterFind = true; $this->controller->Review->runProcessRatings = false; $review = $this->controller->Review->findRow(array('conditions' => array('Review.id = ' . $model->data['Discussion']['review_id']))); $this->controller->viewVars['review'] = $review; // Make it available to other plugins App::import('helper', 'routes', 'jreviews'); $Routes = ClassRegistry::getClass('RoutesHelper'); $permalink = $Routes->reviewDiscuss('', $review, array('listing' => $review, 'return_url' => true)); $permalink = cmsFramework::makeAbsUrl($permalink); $message = $model->data['Email']['body']; $message = str_ireplace('{name}', $model->data['Email']['name'], $message); $message = str_ireplace(array('{link}', '{url}'), $permalink, $message); $message = str_ireplace('{review_title}', $model->data['Email']['review_title'], $message); if ($message != '') { $mail->Subject = $subject; // Convert line breaks to br tags if html code not found on the message body $mail->Body = nl2br($message); $mail->AddAddress($model->data['Email']['email']); if (!$mail->Send()) { appLogMessage(array("Admin post discussion moderation message was not sent.", "Mailer error: " . $mail->ErrorInfo), 'notifications'); } } break; // Notification for listing moderation // Notification for listing moderation case 'Listing': if (Sanitize::getInt($model->data, 'moderation')) { if ($model->data['Email']['subject'] != '') { $subject = $model->data['Email']['subject']; $subject = str_ireplace('{name}', $model->data['Email']['name'], $subject); $subject = str_ireplace('{listing_title}', $model->data['Email']['listing_title'], $subject); } else { switch ($model->data['Listing']['state']) { case 1: $subject = __a("Your listing has been approved", true); break; case -2: $subject = __a("Your listing has been rejected", true); break; case 0: $subject = __a("Your listing has been reviewed, but it is still pending moderation", true); break; } } // Get permalink $listing_id = $model->data['Listing']['id']; $listing = $this->controller->Listing->findRow(array('conditions' => 'Listing.id = ' . $listing_id), array('afterFind')); $permalink = cmsFramework::makeAbsUrl($listing['Listing']['url'], array('sef' => true)); $message = $model->data['Email']['body']; $message = str_ireplace('{name}', $model->data['Email']['name'], $message); $message = str_ireplace(array('{link}', '{url}'), $permalink, $message); $message = str_ireplace('{listing_title}', $model->data['Email']['listing_title'], $message); if ($message != '') { $mail->Subject = $subject; // Convert line breaks to br tags if html code not found on the message body $mail->Body = nl2br($message); $mail->AddAddress($model->data['Email']['email']); if (!$mail->Send()) { appLogMessage(array("Admin listing moderation message was not sent.", "Mailer error: " . $mail->ErrorInfo), 'notifications'); } } } break; // Notification for reviews moderation // Notification for reviews moderation case 'Review': if (Sanitize::getInt($model->data, 'moderation')) { if ($model->data['Email']['subject'] != '') { $subject = $model->data['Email']['subject']; $subject = str_ireplace('{name}', $model->data['Email']['name'], $subject); $subject = str_ireplace('{listing_title}', $model->data['Email']['listing_title'], $subject); $subject = str_ireplace('{review_title}', $model->data['Email']['review_title'], $subject); } else { switch ($model->data['Review']['published']) { case 1: $subject = __a("Your review has been approved", true); break; case -1: $subject = __a("Your review has been rejected", true); break; case 0: $subject = __a("Your review has been reviewed, but still pending moderation", true); break; } } // Get permalink $this->controller->EverywhereAfterFind = true; $this->controller->Review->runProcessRatings = false; $review_id = $model->data['Review']['id']; $review = $this->controller->Review->findRow(array('conditions' => array('Review.id = ' . $review_id))); $this->controller->viewVars['review'] = $review; // Make it available to other plugins App::import('helper', 'routes', 'jreviews'); $Routes = ClassRegistry::getClass('RoutesHelper'); $permalink = $Routes->reviewDiscuss('', $review, array('listing' => $review, 'return_url' => true)); $permalink = cmsFramework::makeAbsUrl($permalink); $message = $model->data['Email']['body']; $message = str_ireplace('{name}', $model->data['Email']['name'], $message); $message = str_ireplace(array('{link}', '{url}'), $permalink, $message); $message = str_ireplace('{listing_title}', $model->data['Email']['listing_title'], $message); $message = str_ireplace('{review_title}', $model->data['Email']['review_title'], $message); if ($message != '') { $mail->Subject = $subject; // Convert line breaks to br tags if html code not found on the message body $mail->Body = nl2br($message); $mail->AddAddress($model->data['Email']['email']); if (!$mail->Send()) { appLogMessage(array("Admin review moderation message was not sent.", "Mailer error: " . $mail->ErrorInfo), 'notifications'); } } } break; // Notification for owner reply to reviews moderation // Notification for owner reply to reviews moderation case 'OwnerReply': if ($model->data['Email']['subject'] != '') { $subject = $model->data['Email']['subject']; $subject = str_ireplace('{name}', $model->data['Email']['name'], $subject); $subject = str_ireplace('{listing_title}', $model->data['Email']['listing_title'], $subject); $subject = str_ireplace('{review_title}', $model->data['Email']['review_title'], $subject); } else { switch ($model->data['OwnerReply']['owner_reply_approved']) { case 1: $subject = __a("Your reply has been approved", true); break; case -1: $subject = __a("Your reply has been rejected", true); break; case 0: $subject = __a("Your reply has been reviewed, but still pending moderation", true); break; } } // Get permalink $this->controller->EverywhereAfterFind = true; $this->controller->Review->runProcessRatings = false; $review_id = $model->data['OwnerReply']['id']; $review = $this->controller->Review->findRow(array('conditions' => array('Review.id = ' . $review_id))); $this->controller->viewVars['review'] = $review; // Make it available to other plugins App::import('helper', 'routes', 'jreviews'); $Routes = ClassRegistry::getClass('RoutesHelper'); $permalink = $Routes->reviewDiscuss('', $review, array('listing' => $review, 'return_url' => true)); $permalink = cmsFramework::makeAbsUrl($permalink); $message = $model->data['Email']['body']; $message = str_ireplace('{name}', $model->data['Email']['name'], $message); $message = str_ireplace(array('{link}', '{url}'), $permalink, $message); $message = str_ireplace('{listing_title}', $model->data['Email']['listing_title'], $message); $message = str_ireplace('{review_title}', $model->data['Email']['review_title'], $message); if ($message != '') { $mail->Subject = $subject; // Convert line breaks to br tags if html code not found on the message body $mail->Body = nl2br($message); $mail->AddAddress($model->data['Email']['email']); if (!$mail->Send()) { appLogMessage(array("Admin owner reply moderation message was not sent.", "Mailer error: " . $mail->ErrorInfo), 'notifications'); } } break; } unset($mail); return true; }
/** @see WP_Widget::widget */ function widget($args, $instance) { global $wpdb; global $wppa_opt; global $wppa; require_once dirname(__FILE__) . '/wppa-links.php'; require_once dirname(__FILE__) . '/wppa-styles.php'; require_once dirname(__FILE__) . '/wppa-functions.php'; require_once dirname(__FILE__) . '/wppa-thumbnails.php'; require_once dirname(__FILE__) . '/wppa-boxes-html.php'; require_once dirname(__FILE__) . '/wppa-slideshow.php'; wppa_initialize_runtime(); $wppa['in_widget'] = 'tn'; $wppa['mocc']++; extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'album' => 'no', 'link' => '', 'linktitle' => '', 'name' => 'no', 'display' => 'thumbs', 'sortby' => wppa_get_photo_order('0'), 'limit' => $wppa_opt['wppa_thumbnail_widget_count'])); // $widget_title = apply_filters('widget_title', $instance['title']); $widget_title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $widget_link = $instance['link']; $page = in_array($wppa_opt['wppa_thumbnail_widget_linktype'], $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_thumbnail_widget_linkpage', __a('Thumbnail photos')); $max = $instance['limit']; // $wppa_opt['wppa_thumbnail_widget_count']; $sortby = $instance['sortby']; $album = $instance['album']; $name = $instance['name']; $display = $instance['display']; $linktitle = $instance['linktitle']; $generic = $album == '-2'; if ($generic) { $album = '0'; $max += '1000'; } $separate = $album == '-1'; if ($separate) { $album = '0'; $max += '1000'; } if ($album) { $thumbs = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status` <> 'pending' AND `status` <> 'scheduled' AND `album` = %s " . $sortby . " LIMIT %d", $album, $max), 'ARRAY_A'); } else { $thumbs = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status` <> 'pending' AND `status` <> 'scheduled'" . $sortby . " LIMIT %d", $max), 'ARRAY_A'); } global $widget_content; $widget_content = "\n" . '<!-- WPPA+ thumbnail Widget start -->'; $maxw = $wppa_opt['wppa_thumbnail_widget_size']; $maxh = $maxw; $lineheight = $wppa_opt['wppa_fontsize_widget_thumb'] * 1.5; $maxh += $lineheight; if ($name == 'yes') { $maxh += $lineheight; } $count = '0'; if ($thumbs) { foreach ($thumbs as $image) { global $thumb; $thumb = $image; if ($generic && wppa_is_separate($thumb['album'])) { continue; } if ($separate && !wppa_is_separate($thumb['album'])) { continue; } // Make the HTML for current picture if ($display == 'thumbs') { $widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">'; } else { $widget_content .= "\n" . '<div class="wppa-widget" >'; } if ($image) { $link = wppa_get_imglnk_a('tnwidget', $image['id']); $file = wppa_get_thumb_path($image['id']); $imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'twthumb'); $imgurl = wppa_get_thumb_url($image['id'], '', $imgstyle_a['width'], $imgstyle_a['height']); $imgevents = wppa_get_imgevents('thumb', $image['id'], true); $title = $link ? esc_attr(stripslashes($link['title'])) : ''; wppa_do_the_widget_thumb('thumbnail', $image, $album, $display, $link, $title, $imgurl, $imgstyle_a, $imgevents); $widget_content .= "\n\t" . '<div style="font-size:' . $wppa_opt['wppa_fontsize_widget_thumb'] . 'px; line-height:' . $lineheight . 'px;">'; if ($name == 'yes' && $display == 'thumbs') { $widget_content .= "\n\t" . '<div>' . __(stripslashes($image['name'])) . '</div>'; } $widget_content .= "\n\t" . '</div>'; } else { // No image $widget_content .= __a('Photo not found.', 'wppa_theme'); } $widget_content .= "\n" . '</div>'; $count++; if ($count == $instance['limit']) { break; } } } else { $widget_content .= 'There are no photos (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; if (!empty($widget_link)) { echo "\n" . '<a href="' . $widget_link . '" title="' . $linktitle . '" >' . $widget_title . '</a>'; } else { echo $widget_title; } echo $after_title; } echo $widget_content . $after_widget; $wppa['in_widget'] = false; }
function wppa_admin_bar_menu() { global $wp_admin_bar; global $wpdb; $wppaplus = 'wppa-admin-bar'; $menu_items = false; // Pending comments $com_pend = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_COMMENTS . "` WHERE `status` = 'pending'"); if ($com_pend) { $com_pending = ' <span id="ab-awaiting-mod" class="pending-count">' . $com_pend . '</span>'; } else { $com_pending = ''; } // Pending uploads $upl_pend = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `status` = 'pending'"); if ($upl_pend) { $upl_pending = ' <span id="ab-awaiting-mod" class="pending-count">' . $upl_pend . '</span>'; } else { $upl_pending = ''; } // Tot $tot_pend = '0'; if (current_user_can('administrator')) { $tot_pend += $com_pend; } if (current_user_can('wppa_admin')) { $tot_pend += $upl_pend; } if ($tot_pend) { $tot_pending = ' <span id="ab-awaiting-mod" class="pending-count">' . $tot_pend . '</span>'; } else { $tot_pending = ''; } if (current_user_can('wppa_admin')) { $menu_items['admin'] = array('parent' => $wppaplus, 'title' => __a('Album Admin', 'wppa_theme') . $upl_pending, 'href' => admin_url('admin.php?page=wppa_admin_menu')); } if (current_user_can('wppa_upload')) { $menu_items['upload'] = array('parent' => $wppaplus, 'title' => __a('Upload Photos', 'wppa_theme'), 'href' => admin_url('admin.php?page=wppa_upload_photos')); if (!current_user_can('wppa_admin')) { $menu_items['edit'] = array('parent' => $wppaplus, 'title' => __a('Edit Photos'), 'href' => admin_url('admin.php?page=wppa_edit_photo')); } } if (current_user_can('wppa_import')) { $menu_items['import'] = array('parent' => $wppaplus, 'title' => __a('Import Photos', 'wppa_theme'), 'href' => admin_url('admin.php?page=wppa_import_photos')); } if (current_user_can('wppa_moderate')) { $menu_items['moderate'] = array('parent' => $wppaplus, 'title' => __a('Moderate Photos', 'wppa_theme') . $tot_pending, 'href' => admin_url('admin.php?page=wppa_moderate_photos')); } if (current_user_can('wppa_export')) { $menu_items['export'] = array('parent' => $wppaplus, 'title' => __a('Export Photos', 'wppa_theme'), 'href' => admin_url('admin.php?page=wppa_export_photos')); } if (current_user_can('wppa_settings')) { $menu_items['settings'] = array('parent' => $wppaplus, 'title' => __a('Settings', 'wppa_theme'), 'href' => admin_url('admin.php?page=wppa_options')); } if (current_user_can('wppa_potd')) { $menu_items['sidebar'] = array('parent' => $wppaplus, 'title' => __a('Photo of the day', 'wppa_theme'), 'href' => admin_url('admin.php?page=wppa_photo_of_the_day')); } if (current_user_can('wppa_comments')) { $menu_items['comments'] = array('parent' => $wppaplus, 'title' => __a('Comments', 'wppa_theme') . $com_pending, 'href' => admin_url('admin.php?page=wppa_manage_comments')); } if (current_user_can('wppa_help')) { $menu_items['help'] = array('parent' => $wppaplus, 'title' => __a('Help & Info', 'wppa_theme'), 'href' => admin_url('admin.php?page=wppa_help')); } if (current_user_can('wppa_help')) { $menu_items['opajaap'] = array('parent' => $wppaplus, 'title' => __a('Docs & Demos', 'wppa_theme'), 'href' => 'http://wppa.opajaap.nl'); } // Add top-level item $wp_admin_bar->add_menu(array('id' => $wppaplus, 'title' => __a('Photo Albums', 'wppa_theme') . $tot_pending, 'href' => '')); // Loop through menu items if ($menu_items) { foreach ($menu_items as $id => $menu_item) { // Add in item ID $menu_item['id'] = 'wppa-' . $id; // Add meta target to each item where it's not already set, so links open in new tab if (!isset($menu_item['meta']['target'])) { $menu_item['meta']['target'] = '_self'; } // Add class to links that open up in a new tab if ('_blank' === $menu_item['meta']['target']) { if (!isset($menu_item['meta']['class'])) { $menu_item['meta']['class'] = ''; } $menu_item['meta']['class'] .= 'wppa-' . 'new-tab'; } // Add item $wp_admin_bar->add_menu($menu_item); } } }
/** @see WP_Widget::widget */ function widget($args, $instance) { global $wpdb; global $wppa_opt; global $wppa; require_once dirname(__FILE__) . '/wppa-links.php'; require_once dirname(__FILE__) . '/wppa-styles.php'; require_once dirname(__FILE__) . '/wppa-functions.php'; require_once dirname(__FILE__) . '/wppa-thumbnails.php'; require_once dirname(__FILE__) . '/wppa-boxes-html.php'; require_once dirname(__FILE__) . '/wppa-slideshow.php'; wppa_initialize_runtime(); extract($args); $instance = wp_parse_args((array) $instance, array('title' => '', 'album' => '')); $widget_title = apply_filters('widget_title', $instance['title']); $page = in_array($wppa_opt['wppa_featen_widget_linktype'], $wppa['links_no_page']) ? '' : wppa_get_the_landing_page('wppa_featen_widget_linkpage', __a('Featured photos')); $max = $wppa_opt['wppa_featen_count']; $album = $instance['album']; $generic = $album == '-2'; if ($generic) { $album = '0'; $max += '1000'; } if ($album) { $thumbs = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status`= 'featured' AND `album` = %s ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, $album), ARRAY_A); } else { $thumbs = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status` = 'featured' ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, ARRAY_A); } $widget_content = "\n" . '<!-- WPPA+ FeaTen Widget start -->'; $maxw = $wppa_opt['wppa_featen_size']; $maxh = $maxw; $lineheight = $wppa_opt['wppa_fontsize_widget_thumb'] * 1.5; $maxh += $lineheight; if (false) { $maxh += $lineheight; } $count = '0'; if ($thumbs) { foreach ($thumbs as $image) { global $thumb; $thumb = $image; if ($generic && wppa_is_separate($thumb['album'])) { continue; } // Make the HTML for current picture $widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">'; if ($image) { $no_album = !$album; if ($no_album) { $tit = __a('View the featured photos', 'wppa_theme'); } else { $tit = esc_attr(wppa_qtrans(stripslashes($image['description']))); } $link = wppa_get_imglnk_a('featen', $image['id'], '', $tit, '', $no_album); $file = wppa_get_thumb_path($image['id']); $imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'ttthumb'); $imgstyle = $imgstyle_a['style']; $width = $imgstyle_a['width']; $height = $imgstyle_a['height']; $cursor = $imgstyle_a['cursor']; $imgurl = wppa_get_thumb_url($image['id'], '', $width, $height); $imgevents = wppa_get_imgevents('thumb', $image['id'], true); if ($link) { $title = esc_attr(stripslashes($link['title'])); } else { $title = ''; } $album = '0'; $display = 'thumbs'; $widget_content .= wppa_get_the_widget_thumb('featen', $image, $album, $display, $link, $title, $imgurl, $imgstyle_a, $imgevents); } else { // No image $widget_content .= __a('Photo not found.', 'wppa_theme'); } $widget_content .= "\n" . '</div>'; $count++; if ($count == $wppa_opt['wppa_featen_count']) { break; } } } else { $widget_content .= 'There are no featured photos (yet).'; } $widget_content .= '<div style="clear:both"></div>'; $widget_content .= "\n" . '<!-- WPPA+ FeaTen Widget end -->'; echo "\n" . $before_widget; if (!empty($widget_title)) { echo $before_title . $widget_title . $after_title; } echo $widget_content . $after_widget; }
function wppa_get_album_desc($id) { if (!is_numeric($id) || $id < '1') { wppa_dbg_msg('Invalid arg wppa_get_album_desc( ' . $id . ' )', 'red'); } $album = wppa_cache_album($id); $desc = $album['description']; // Raw data if (!$desc) { return ''; } // No content, need no filtering $desc = stripslashes($desc); // Unescape $desc = __($desc); // qTranslate $desc = wppa_html($desc); // Enable html $desc = balanceTags($desc, true); // Balance tags if (strpos($desc, 'w#') !== false) { // Is there any 'w#' ? // Keywords $keywords = array('name', 'owner', 'id', 'views'); foreach ($keywords as $keyword) { $replacement = __(trim(stripslashes($album[$keyword]))); if ($replacement == '') { $replacement = '‹' . __a('none', 'wppa') . '›'; } $desc = str_replace('w#' . $keyword, $replacement, $desc); } // Timestamps $timestamps = array('timestamp', 'modified'); // Identical, there is only timestamp, but it acts as modified foreach ($timestamps as $timestamp) { if ($album['timestamp']) { $desc = str_replace('w#' . $timestamp, wppa_local_date(get_option('date_format', "F j, Y,") . ' ' . get_option('time_format', "g:i a"), $album['timestamp']), $desc); } else { $desc = str_replace('w#' . $timestamp, '‹' . __a('unknown') . '›', $desc); } } } // To prevent recursive rendering of scripts or shortcodes: $desc = str_replace(array('%%wppa%%', '[wppa', '[/wppa]'), array('%-wppa-%', '{wppa', '{/wppa}'), $desc); if (wppa_switch('wppa_allow_foreign_shortcodes_general')) { $desc = do_shortcode($desc); } else { $desc = strip_shortcodes($desc); } // Convert links and mailto: $desc = make_clickable($desc); // CMTooltipGlossary on board? $desc = wppa_filter_glossary($desc); return $desc; }
/** @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_create_wppa_init_js() { global $wppa_api_version; global $wppa_lang; global $wppa; global $wppa_init_js_data; // Init if (is_numeric(wppa_opt('wppa_fullimage_border_width'))) { $fbw = wppa_opt('wppa_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('wppa_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 */ /* If you add something that uses an element from $wppa_opt[], */ /* or a function that uses an element from $wppa_opt[], */ /* add the optionslug to $init_js_critical[] in wppa_update_option in wppa-utils.php !!!!! */ $content .= ' wppaVersion = "' . $wppa_api_version . '"; wppaBackgroundColorImage = "' . wppa_opt('wppa_bgcolor_img') . '"; wppaPopupLinkType = "' . wppa_opt('wppa_thumb_linktype') . '"; wppaAnimationType = "' . wppa_opt('wppa_animation_type') . '"; wppaAnimationSpeed = ' . wppa_opt('wppa_animation_speed') . '; wppaThumbnailAreaDelta = ' . wppa_get_thumbnail_area_delta() . '; wppaTextFrameDelta = ' . wppa_get_textframe_delta() . '; wppaBoxDelta = ' . wppa_get_box_delta() . '; wppaSlideShowTimeOut = ' . wppa_opt('wppa_slideshow_timeout') . '; wppaPreambule = ' . wppa_get_preambule() . '; wppaFilmShowGlue = ' . (wppa_switch('wppa_film_show_glue') ? 'true' : 'false') . '; wppaSlideShow = "' . __a('Slideshow') . '"; wppaStart = "' . __a('Start') . '"; wppaStop = "' . __a('Stop') . '"; wppaSlower = "' . __a('Slower') . '"; wppaFaster = "' . __a('Faster') . '"; wppaPhoto = "' . __a('Photo') . '"; wppaOf = "' . __a('of') . '"; wppaPreviousPhoto = "' . __a('Previous photo') . '"; wppaNextPhoto = "' . __a('Next photo') . '"; wppaPrevP = "' . __a('Prev.') . '"; wppaNextP = "' . __a('Next') . '"; wppaAvgRating = "' . __a('Average rating') . '"; wppaMyRating = "' . __a('My rating') . '"; wppaAvgRat = "' . __a('Avg.') . '"; wppaMyRat = "' . __a('Mine') . '"; wppaDislikeMsg = "' . __a('You marked this image as inappropriate.') . '"; wppaShowDislikeCount = ' . (wppa_switch('wppa_dislike_show_count') ? 'true' : 'false') . '; wppaNoDislikes = "' . __a('No dislikes') . '"; wppa1Dislike = "' . __a('1 dislike') . '"; wppaDislikes = "' . __a('dislikes') . '"; wppaIncludingMine = "' . __a('including mine') . '"; wppaMiniTreshold = ' . (wppa_opt('wppa_mini_treshold') ? wppa_opt('wppa_mini_treshold') : '0') . '; wppaRatingOnce = ' . (wppa_switch('wppa_rating_change') || wppa_switch('wppa_rating_multi') ? 'false' : 'true') . '; wppaPleaseName = "' . __a('Please enter your name') . '"; wppaPleaseEmail = "' . __a('Please enter a valid email address') . '"; wppaPleaseComment = "' . __a('Please enter a comment') . '"; wppaHideWhenEmpty = ' . (wppa_switch('wppa_hide_when_empty') ? 'true' : 'false') . '; wppaBGcolorNumbar = "' . wppa_opt('wppa_bgcolor_numbar') . '"; wppaBcolorNumbar = "' . wppa_opt('wppa_bcolor_numbar') . '"; wppaBGcolorNumbarActive = "' . wppa_opt('wppa_bgcolor_numbar_active') . '"; wppaBcolorNumbarActive = "' . wppa_opt('wppa_bcolor_numbar_active') . '"; wppaFontFamilyNumbar = "' . wppa_opt('wppa_fontfamily_numbar') . '"; wppaFontSizeNumbar = "' . wppa_opt('wppa_fontsize_numbar') . 'px"; wppaFontColorNumbar = "' . wppa_opt('wppa_fontcolor_numbar') . '"; wppaFontWeightNumbar = "' . wppa_opt('wppa_fontweight_numbar') . '"; wppaFontFamilyNumbarActive = "' . wppa_opt('wppa_fontfamily_numbar_active') . '"; wppaFontSizeNumbarActive = "' . wppa_opt('wppa_fontsize_numbar_active') . 'px"; wppaFontColorNumbarActive = "' . wppa_opt('wppa_fontcolor_numbar_active') . '"; wppaFontWeightNumbarActive = "' . wppa_opt('wppa_fontweight_numbar_active') . '"; wppaNumbarMax = "' . wppa_opt('wppa_numbar_max') . '"; wppaLang = "' . $wppa_lang . '"; wppaNextOnCallback = ' . (wppa_switch('wppa_next_on_callback') ? 'true' : 'false') . '; wppaStarOpacity = ' . wppa_opt('wppa_star_opacity') / '100' . '; wppaSlideWrap = ' . (wppa_switch('wppa_slide_wrap') ? 'true' : 'false') . '; wppaEmailRequired = ' . (wppa_switch('wppa_comment_email_required') ? 'true' : 'false') . '; wppaSlideBorderWidth = ' . $fbw . '; wppaAllowAjax = ' . (wppa_switch('wppa_allow_ajax') ? 'true' : 'false') . '; wppaUsePhotoNamesInUrls = ' . (wppa_switch('wppa_use_photo_names_in_urls') ? 'true' : 'false') . '; wppaThumbTargetBlank = ' . (wppa_switch('wppa_thumb_blank') ? 'true' : 'false') . '; wppaRatingMax = ' . wppa_opt('wppa_rating_max') . '; wppaRatingDisplayType = "' . wppa_opt('wppa_rating_display_type') . '"; wppaRatingPrec = ' . wppa_opt('wppa_rating_prec') . '; wppaStretch = ' . (wppa_switch('wppa_enlarge') ? 'true' : 'false') . '; wppaMinThumbSpace = ' . wppa_opt('wppa_tn_margin') . '; wppaThumbSpaceAuto = ' . (wppa_switch('wppa_thumb_auto') ? 'true' : 'false') . '; wppaMagnifierCursor = "' . wppa_opt('wppa_magnifier') . '"; wppaArtMonkyLink = "' . wppa_opt('wppa_art_monkey_link') . '"; wppaAutoOpenComments = ' . (wppa_switch('wppa_auto_open_comments') ? 'true' : 'false') . '; wppaUpdateAddressLine = ' . (wppa_switch('wppa_update_addressline') ? 'true' : 'false') . '; wppaFilmThumbTitle = "' . (wppa_opt('wppa_film_linktype') == 'lightbox' ? wppa_zoom_in(false) : __a('Double click to start/stop slideshow running')) . '"; wppaVoteForMe = "' . __(wppa_opt('wppa_vote_button_text')) . '"; wppaVotedForMe = "' . __(wppa_opt('wppa_voted_button_text')) . '"; wppaSlideSwipe = ' . (wppa_switch('wppa_slide_swipe') ? 'true' : 'false') . '; wppaMaxCoverWidth = ' . wppa_opt('wppa_max_cover_width') . '; wppaDownLoad = "' . __a('Download') . '"; wppaSlideToFullpopup = ' . (wppa_opt('wppa_slideshow_linktype') == 'fullpopup' ? 'true' : 'false') . '; wppaComAltSize = ' . wppa_opt('wppa_comten_alt_thumbsize') . '; wppaBumpViewCount = ' . (wppa_switch('wppa_track_viewcounts') ? 'true' : 'false') . '; wppaShareHideWhenRunning = ' . (wppa_switch('wppa_share_hide_when_running') ? 'true' : 'false') . '; wppaFotomoto = ' . (wppa_switch('wppa_fotomoto_on') ? 'true' : 'false') . '; wppaArtMonkeyButton = ' . (wppa_opt('wppa_art_monkey_display') == 'button' ? 'true' : 'false') . '; wppaFotomotoHideWhenRunning = ' . (wppa_switch('wppa_fotomoto_hide_when_running') ? 'true' : 'false') . '; wppaCommentRequiredAfterVote = ' . (wppa_switch('wppa_vote_needs_comment') ? 'true' : 'false') . '; wppaFotomotoMinWidth = ' . wppa_opt('wppa_fotomoto_min_width') . '; wppaShortQargs = ' . (wppa_switch('wppa_use_short_qargs') ? 'true' : 'false') . '; wppaOvlHires = ' . (wppa_switch('wppa_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') . '"; '; // 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 _saveOrder($params) { $response = array(); $cid = $this->data['cid']; // array() $total = count($cid); $order = $this->data['order']; // array() $limit = Sanitize::getInt($this->data, 'limit'); $limitstart = Sanitize::getInt($this->data, 'limitstart'); $type = Sanitize::getString($this->data['Group'], 'type', 'content'); $conditions = array(); // update ordering values for ($i = 0; $i < $total; $i++) { $row = $this->Group->findRow(array('conditions' => array('groupid = ' . $cid[$i]))); if ($row['Group']['ordering'] != $order[$i]) { $row['Group']['ordering'] = $order[$i]; $row['Group']['groupid'] = $row['Group']['group_id']; unset($row['Group']['group_id']); if (!($error = $this->Group->store($row))) { $response[] = "s2Alert('{$error}');"; return $this->ajaxResponse($response); } // remember to updateOrder this group $condition = "type='{$row['Group']['type']}'"; $found = false; foreach ($conditions as $cond) { if ($cond[1] == $condition) { $found = true; break; } } // if if (!$found) { $conditions[] = array($row['Group']['type'], $condition); } } // if } // for // execute updateOrder for each group foreach ($conditions as $cond) { // $row = $this->Group->findRow(array('conditions'=>array('groupid = ' . $cond[0]))); $this->Group->reorder($cond[1]); } // foreach $page = $this->index(); $this->data['Group']['type'] = $row['Group']['type']; $text = __a("New ordering saved.", true); return $this->ajaxResponse(compact('text', 'page'), false); }