本文整理汇总了PHP中get_gallery_home_url函数的典型用法代码示例。如果您正苦于以下问题:PHP get_gallery_home_url函数的具体用法?PHP get_gallery_home_url怎么用?PHP get_gallery_home_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_gallery_home_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: osm_apply_menu
function osm_apply_menu($menu_ref_arr)
{
global $template, $page, $conf;
$menu =& $menu_ref_arr[0];
if (($block = $menu->get_block('mbLinks')) != null) {
include_once dirname(__FILE__) . '/include/functions.php';
include_once dirname(__FILE__) . '/include/functions_map.php';
osm_load_language();
load_language('plugin.lang', OSM_PATH);
// Comment are used only with this condition index.php l294
if ($page['start'] == 0 and !isset($page['chronology_field'])) {
$js_data = osm_get_items($page);
if ($js_data != array()) {
$local_conf = array();
$local_conf['contextmenu'] = 'false';
$local_conf['control'] = true;
$local_conf['img_popup'] = false;
$local_conf['popup'] = 2;
$local_conf['center_lat'] = 0;
$local_conf['center_lng'] = 0;
$local_conf['zoom'] = 2;
$local_conf['autocenter'] = 1;
$local_conf['divname'] = 'mapmenu';
$local_conf['paths'] = osm_get_gps($page);
$height = isset($conf['osm_conf']['main_menu']['height']) ? $conf['osm_conf']['main_menu']['height'] : '200';
$js = osm_get_js($conf, $local_conf, $js_data);
$template->set_template_dir(dirname(__FILE__) . '/template/');
$template->assign(array('OSM_PATH' => embellish_url(get_gallery_home_url() . OSM_PATH), 'OSMJS' => $js, 'HEIGHT' => $height));
$block->template = 'osm-menu.tpl';
}
}
}
}
示例2: osm_render_media
function osm_render_media($content, $picture)
{
global $template, $picture, $conf;
//print_r( $picture['current']);
// do nothing if the current picture is actually an image !
if (array_key_exists('src_image', @$picture['current']) && @$picture['current']['src_image']->is_original()) {
return $content;
}
// If not a GPX file
if (array_key_exists('path', @$picture['current']) && strpos($picture['current']['path'], ".gpx") === false) {
return $content;
}
$filename = embellish_url(get_gallery_home_url() . $picture['current']['element_url']);
$height = isset($conf['osm_conf']['gpx']['height']) ? $conf['osm_conf']['gpx']['height'] : '500';
$width = isset($conf['osm_conf']['gpx']['width']) ? $conf['osm_conf']['gpx']['width'] : '320';
$local_conf = array();
$local_conf['contextmenu'] = 'false';
$local_conf['control'] = true;
$local_conf['img_popup'] = false;
$local_conf['popup'] = 2;
$local_conf['center_lat'] = 0;
$local_conf['center_lng'] = 0;
$local_conf['zoom'] = '12';
$local_conf['divname'] = 'mapgpx';
$js_data = array(array(null, null, null, null, null, null, null, null));
$js = osm_get_js($conf, $local_conf, $js_data);
// Select the template
$template->set_filenames(array('osm_content' => dirname(__FILE__) . "/template/osm-gpx.tpl"));
// Assign the template variables
$template->assign(array('HEIGHT' => $height, 'WIDTH' => $width, 'FILENAME' => $filename, 'OSM_PATH' => embellish_url(get_gallery_home_url() . OSM_PATH), 'OSMGPX' => $js));
// Return the rendered html
$osm_content = $template->parse('osm_content', true);
return $osm_content;
}
示例3: oauth_init
/**
* plugin initialization
*/
function oauth_init()
{
global $conf, $page, $hybridauth_conf, $template;
load_language('plugin.lang', OAUTH_PATH);
$conf['oauth'] = safe_unserialize($conf['oauth']);
// check config
if (defined('IN_ADMIN')) {
if (empty($hybridauth_conf) and strpos(@$_GET['page'], 'plugin-oAuth') === false) {
$page['warnings'][] = '<a href="' . OAUTH_ADMIN . '">' . l10n('Social Connect: You need to configure the credentials') . '</a>';
}
if (!function_exists('curl_init')) {
$page['warnings'][] = l10n('Social Connect: PHP Curl extension is needed');
}
}
// in case of registration aborded
if (script_basename() == 'index' and ($oauth_id = pwg_get_session_var('oauth_new_user')) !== null) {
pwg_unset_session_var('oauth_new_user');
if ($oauth_id[0] == 'Persona') {
oauth_assign_template_vars(get_gallery_home_url());
$template->block_footer_script(null, 'navigator.id.logout();');
} else {
require_once OAUTH_PATH . 'include/hybridauth/Hybrid/Auth.php';
try {
$hybridauth = new Hybrid_Auth($hybridauth_conf);
$adapter = $hybridauth->getAdapter($oauth_id[0]);
$adapter->logout();
} catch (Exception $e) {
}
}
}
}
示例4: gb_section_init
function gb_section_init()
{
global $tokens, $page, $conf;
if ($tokens[0] == 'guestbook') {
$page['section'] = 'guestbook';
$page['body_id'] = 'theGuestBook';
$page['is_external'] = true;
$page['is_homepage'] = false;
$page['title'] = l10n('GuestBook');
$page['section_title'] = '<a href="' . get_gallery_home_url() . '">' . l10n('Home') . '</a>' . $conf['level_separator'] . l10n('GuestBook');
}
}
示例5: osm_render_category
function osm_render_category()
{
global $template, $page, $conf, $filter;
include_once dirname(__FILE__) . '/include/functions.php';
include_once dirname(__FILE__) . '/include/functions_map.php';
osm_load_language();
load_language('plugin.lang', OSM_PATH);
// TF, 20160102: pass config as parameter
$js_data = osm_get_items($conf, $page);
if ($js_data != array()) {
$local_conf = array();
$local_conf['contextmenu'] = 'false';
$local_conf['control'] = true;
$local_conf['img_popup'] = false;
$local_conf['popup'] = 1;
$local_conf['center_lat'] = 0;
$local_conf['center_lng'] = 0;
$local_conf['zoom'] = 2;
$local_conf['auto_center'] = 1;
// TF, 20160102: pass config as parameter
$local_conf['paths'] = osm_get_gps($conf, $page);
$height = isset($conf['osm_conf']['category_description']['height']) ? $conf['osm_conf']['category_description']['height'] : '200';
$width = isset($conf['osm_conf']['category_description']['width']) ? $conf['osm_conf']['category_description']['width'] : 'auto';
$js = osm_get_js($conf, $local_conf, $js_data);
$template->set_filename('map', dirname(__FILE__) . '/template/osm-category.tpl');
$template->assign(array('CONTENT_ENCODING' => get_pwg_charset(), 'OSM_PATH' => embellish_url(get_gallery_home_url() . OSM_PATH), 'HOME' => make_index_url(), 'HOME_PREV' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : get_absolute_root_url(), 'HOME_NAME' => l10n("Home"), 'HOME_PREV_NAME' => l10n("Previous"), 'OSMJS' => $js, 'HEIGHT' => $height, 'WIDTH' => $width));
$osm_content = $template->parse('map', true);
//$osm_content = '<div id="osmmap"><div class="map_title">'.l10n('EDIT_MAP').'</div>' . $osm_content . '</div>';
$index = isset($conf['osm_conf']['category_description']['index']) ? $conf['osm_conf']['category_description']['index'] : 0;
// 0 - PLUGIN_INDEX_CONTENT_BEGIN
// 1 - PLUGIN_INDEX_CONTENT_COMMENT
// 2 - PLUGIN_INDEX_CONTENT_END
if ($index <= 1) {
// From index category comment at L300
if ($page['start'] == 0 and !isset($page['chronology_field'])) {
if (empty($page['comment'])) {
$page['comment'] = $osm_content;
} else {
if ($index == 0) {
$page['comment'] = '<div>' . $osm_content . $page['comment'] . '</div>';
} else {
$page['comment'] = '<div>' . $page['comment'] . $osm_content . '</div>';
}
}
}
} else {
$osm_content = '<div id="osmmap">' . $osm_content . '</div>';
$template->concat('PLUGIN_INDEX_CONTENT_END', "\n" . $osm_content);
}
}
}
示例6: process_password_request
/**
* checks the validity of input parameters, fills $page['errors'] and
* $page['infos'] and send an email with confirmation link
*
* @return bool (true if email was sent, false otherwise)
*/
function process_password_request()
{
global $page, $conf;
if (empty($_POST['username_or_email'])) {
$page['errors'][] = l10n('Invalid username or email');
return false;
}
$user_id = get_userid_by_email($_POST['username_or_email']);
if (!is_numeric($user_id)) {
$user_id = get_userid($_POST['username_or_email']);
}
if (!is_numeric($user_id)) {
$page['errors'][] = l10n('Invalid username or email');
return false;
}
$userdata = getuserdata($user_id, false);
// password request is not possible for guest/generic users
$status = $userdata['status'];
if (is_a_guest($status) or is_generic($status)) {
$page['errors'][] = l10n('Password reset is not allowed for this user');
return false;
}
if (empty($userdata['email'])) {
$page['errors'][] = l10n('User "%s" has no email address, password reset is not possible', $userdata['username']);
return false;
}
$activation_key = generate_key(20);
list($expire) = pwg_db_fetch_row(pwg_query('SELECT ADDDATE(NOW(), INTERVAL 1 HOUR)'));
single_update(USER_INFOS_TABLE, array('activation_key' => pwg_password_hash($activation_key), 'activation_key_expire' => $expire), array('user_id' => $user_id));
$userdata['activation_key'] = $activation_key;
set_make_full_url();
$message = l10n('Someone requested that the password be reset for the following user account:') . "\r\n\r\n";
$message .= l10n('Username "%s" on gallery %s', $userdata['username'], get_gallery_home_url());
$message .= "\r\n\r\n";
$message .= l10n('To reset your password, visit the following address:') . "\r\n";
$message .= get_gallery_home_url() . '/password.php?key=' . $activation_key . '-' . urlencode($userdata['email']);
$message .= "\r\n\r\n";
$message .= l10n('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n";
unset_make_full_url();
$message = trigger_change('render_lost_password_mail_content', $message);
$email_params = array('subject' => '[' . $conf['gallery_title'] . '] ' . l10n('Password Reset'), 'content' => $message, 'email_format' => 'text/plain');
if (pwg_mail($userdata['email'], $email_params)) {
$page['infos'][] = l10n('Check your email for the confirmation link');
return true;
} else {
$page['errors'][] = l10n('Error sending email');
return false;
}
}
示例7: oauth_assign_template_vars
function oauth_assign_template_vars($u_redirect = null)
{
global $template, $conf, $hybridauth_conf, $user;
$conf['oauth']['include_common_template'] = true;
if ($template->get_template_vars('OAUTH') == null) {
if (!empty($user['oauth_id'])) {
list($provider, $identifier) = explode('---', $user['oauth_id'], 2);
if ($provider == 'Persona') {
$persona_email = $identifier;
}
}
$template->assign('OAUTH', array('conf' => $conf['oauth'], 'u_login' => get_root_url() . OAUTH_PATH . 'auth.php?provider=', 'providers' => $hybridauth_conf['providers'], 'persona_email' => @$persona_email, 'key' => get_ephemeral_key(0)));
$template->assign(array('OAUTH_PATH' => OAUTH_PATH, 'OAUTH_ABS_PATH' => realpath(OAUTH_PATH) . '/', 'ABS_ROOT_URL' => rtrim(get_gallery_home_url(), '/') . '/'));
}
if (isset($u_redirect)) {
$template->append('OAUTH', compact('u_redirect'), true);
}
}
示例8: do_subscribe_unsubscribe_notification_by_mail
function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_subscribe = false, $check_key_list = array())
{
global $conf, $page, $env_nbm, $conf;
set_make_full_url();
$check_key_treated = array();
$updated_data_count = 0;
$error_on_updated_data_count = 0;
if ($is_subscribe) {
$msg_info = l10n('User %s [%s] was added to the subscription list.');
$msg_error = l10n('User %s [%s] was not added to the subscription list.');
} else {
$msg_info = l10n('User %s [%s] was removed from the subscription list.');
$msg_error = l10n('User %s [%s] was not removed from the subscription list.');
}
if (count($check_key_list) != 0) {
$updates = array();
$enabled_value = boolean_to_string($is_subscribe);
$data_users = get_user_notifications('subscribe', $check_key_list, !$is_subscribe);
// Prepare message after change language
$msg_break_timeout = l10n('Time to send mail is limited. Others mails are skipped.');
// Begin nbm users environment
begin_users_env_nbm(true);
foreach ($data_users as $nbm_user) {
if (check_sendmail_timeout()) {
// Stop fill list on 'send', if the quota is override
$page['errors'][] = $msg_break_timeout;
break;
}
// Fill return list
$check_key_treated[] = $nbm_user['check_key'];
$do_update = true;
if ($nbm_user['mail_address'] != '') {
// set env nbm user
set_user_on_env_nbm($nbm_user, true);
$subject = '[' . $conf['gallery_title'] . '] ' . ($is_subscribe ? l10n('Subscribe to notification by mail') : l10n('Unsubscribe from notification by mail'));
// Assign current var for nbm mail
assign_vars_nbm_mail_content($nbm_user);
$section_action_by = $is_subscribe ? 'subscribe_by_' : 'unsubscribe_by_';
$section_action_by .= $is_admin_request ? 'admin' : 'himself';
$env_nbm['mail_template']->assign(array($section_action_by => true, 'GOTO_GALLERY_TITLE' => $conf['gallery_title'], 'GOTO_GALLERY_URL' => get_gallery_home_url()));
$ret = pwg_mail(array('name' => stripslashes($nbm_user['username']), 'email' => $nbm_user['mail_address']), array('from' => $env_nbm['send_as_mail_formated'], 'subject' => $subject, 'email_format' => $env_nbm['email_format'], 'content' => $env_nbm['mail_template']->parse('notification_by_mail', true), 'content_format' => $env_nbm['email_format']));
if ($ret) {
inc_mail_sent_success($nbm_user);
} else {
inc_mail_sent_failed($nbm_user);
$do_update = false;
}
// unset env nbm user
unset_user_on_env_nbm();
}
if ($do_update) {
$updates[] = array('check_key' => $nbm_user['check_key'], 'enabled' => $enabled_value);
$updated_data_count += 1;
$page['infos'][] = sprintf($msg_info, stripslashes($nbm_user['username']), $nbm_user['mail_address']);
} else {
$error_on_updated_data_count += 1;
$page['errors'][] = sprintf($msg_error, stripslashes($nbm_user['username']), $nbm_user['mail_address']);
}
}
// Restore nbm environment
end_users_env_nbm();
display_counter_info();
mass_updates(USER_MAIL_NOTIFICATION_TABLE, array('primary' => array('check_key'), 'update' => array('enabled')), $updates);
}
$page['infos'][] = l10n_dec('%d user was updated.', '%d users were updated.', $updated_data_count);
if ($error_on_updated_data_count != 0) {
$page['errors'][] = l10n_dec('%d user was not updated.', '%d users were not updated.', $error_on_updated_data_count);
}
unset_make_full_url();
return $check_key_treated;
}
示例9: unset
}
}
}
}
}
// +-----------------------------------------------------------------------+
// | chronology |
// +-----------------------------------------------------------------------+
if (isset($page['chronology_field'])) {
unset($page['is_homepage']);
include_once PHPWG_ROOT_PATH . 'include/functions_calendar.inc.php';
initialize_calendar();
}
// title update
if (isset($page['title'])) {
$page['section_title'] = '<a href="' . get_gallery_home_url() . '">' . l10n('Home') . '</a>';
if (!empty($page['title'])) {
$page['section_title'] .= $conf['level_separator'] . $page['title'];
} else {
$page['title'] = $page['section_title'];
}
}
// add meta robots noindex, nofollow to avoid unnecesary robot crawls
$page['meta_robots'] = array();
if (isset($page['chronology_field']) or isset($page['flat']) and isset($page['category']) or 'list' == $page['section'] or 'recent_pics' == $page['section']) {
$page['meta_robots'] = array('noindex' => 1, 'nofollow' => 1);
} elseif ('tags' == $page['section']) {
if (count($page['tag_ids']) > 1) {
$page['meta_robots'] = array('noindex' => 1, 'nofollow' => 1);
}
} elseif ('recent_cats' == $page['section']) {
示例10: l10n
if (isset($_GET['page']) and preg_match('/^[a-z_]*$/', $_GET['page']) and is_file(PHPWG_ROOT_PATH . 'admin/' . $_GET['page'] . '.php')) {
$page['page'] = $_GET['page'];
} else {
$page['page'] = 'intro';
}
$link_start = PHPWG_ROOT_PATH . 'admin.php?page=';
$conf_link = $link_start . 'configuration&section=';
// +-----------------------------------------------------------------------+
// | Template init |
// +-----------------------------------------------------------------------+
$title = l10n('Piwigo Administration');
// for include/page_header.php
$page['page_banner'] = '<h1>' . l10n('Piwigo Administration') . '</h1>';
$page['body_id'] = 'theAdminPage';
$template->set_filenames(array('admin' => 'admin.tpl'));
$template->assign(array('USERNAME' => $user['username'], 'ENABLE_SYNCHRONIZATION' => $conf['enable_synchronization'], 'U_SITE_MANAGER' => $link_start . 'site_manager', 'U_HISTORY_STAT' => $link_start . 'stats', 'U_FAQ' => $link_start . 'help', 'U_SITES' => $link_start . 'remote_site', 'U_MAINTENANCE' => $link_start . 'maintenance', 'U_NOTIFICATION_BY_MAIL' => $link_start . 'notification_by_mail', 'U_CONFIG_GENERAL' => $link_start . 'configuration', 'U_CONFIG_DISPLAY' => $conf_link . 'default', 'U_CONFIG_EXTENTS' => $link_start . 'extend_for_templates', 'U_CONFIG_MENUBAR' => $link_start . 'menubar', 'U_CONFIG_LANGUAGES' => $link_start . 'languages', 'U_CONFIG_THEMES' => $link_start . 'themes', 'U_CATEGORIES' => $link_start . 'cat_list', 'U_CAT_OPTIONS' => $link_start . 'cat_options', 'U_CAT_UPDATE' => $link_start . 'site_update&site=1', 'U_RATING' => $link_start . 'rating', 'U_RECENT_SET' => $link_start . 'batch_manager&filter=prefilter-last_import', 'U_BATCH' => $link_start . 'batch_manager', 'U_TAGS' => $link_start . 'tags', 'U_USERS' => $link_start . 'user_list', 'U_GROUPS' => $link_start . 'group_list', 'U_RETURN' => get_gallery_home_url(), 'U_ADMIN' => PHPWG_ROOT_PATH . 'admin.php', 'U_LOGOUT' => PHPWG_ROOT_PATH . 'index.php?act=logout', 'U_PLUGINS' => $link_start . 'plugins', 'U_ADD_PHOTOS' => $link_start . 'photos_add', 'U_CHANGE_THEME' => $change_theme_url, 'U_UPDATES' => $link_start . 'updates'));
if ($conf['activate_comments']) {
$template->assign('U_COMMENTS', $link_start . 'comments');
// pending comments
$query = '
SELECT COUNT(*)
FROM ' . COMMENTS_TABLE . '
WHERE validated=\'false\'
;';
list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
if ($nb_comments > 0) {
$template->assign('NB_PENDING_COMMENTS', $nb_comments);
}
}
// any photo in the caddie?
$query = '
示例11: trigger_notify
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
//
// Start output of page
//
$template->set_filenames(array('header' => 'header.tpl'));
trigger_notify('loc_begin_page_header');
$template->assign(array('GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'], 'PAGE_BANNER' => trigger_change('render_page_banner', str_replace('%gallery_title%', $conf['gallery_title'], isset($page['page_banner']) ? $page['page_banner'] : $conf['page_banner'])), 'BODY_ID' => isset($page['body_id']) ? $page['body_id'] : '', 'CONTENT_ENCODING' => get_pwg_charset(), 'PAGE_TITLE' => strip_tags($title), 'U_HOME' => get_gallery_home_url(), 'LEVEL_SEPARATOR' => $conf['level_separator']));
// Header notes
if (!empty($header_notes)) {
$template->assign('header_notes', $header_notes);
}
// No referencing is required
if (!$conf['meta_ref']) {
$page['meta_robots']['noindex'] = 1;
$page['meta_robots']['nofollow'] = 1;
}
if (!empty($page['meta_robots'])) {
$template->append('head_elements', '<meta name="robots" content="' . implode(',', array_keys($page['meta_robots'])) . '">');
}
if (!isset($page['meta_robots']['noindex'])) {
$template->assign('meta_ref', 1);
}
示例12: set_make_full_url
set_make_full_url();
$rss = new UniversalFeedCreator();
$rss->encoding = get_pwg_charset();
$rss->title = $conf['gallery_title'];
$rss->title .= ' (as ' . stripslashes($user['username']) . ')';
$rss->link = get_gallery_home_url();
// +-----------------------------------------------------------------------+
// | Feed creation |
// +-----------------------------------------------------------------------+
$news = array();
if (!$image_only) {
$news = news($feed_row['last_check'], $dbnow, true, true);
if (count($news) > 0) {
$item = new FeedItem();
$item->title = l10n('New on %s', format_date($dbnow));
$item->link = get_gallery_home_url();
// content creation
$item->description = '<ul>';
foreach ($news as $line) {
$item->description .= '<li>' . $line . '</li>';
}
$item->description .= '</ul>';
$item->descriptionHtmlSyndicated = true;
$item->date = ts_to_iso8601(datetime_to_ts($dbnow));
$item->author = $conf['rss_feed_author'];
$item->guid = sprintf('%s', $dbnow);
$rss->addItem($item);
$query = '
UPDATE ' . USER_FEED_TABLE . '
SET last_check = \'' . $dbnow . '\'
WHERE id = \'' . $feed_id . '\'
示例13: vjs_render_media
function vjs_render_media($content, $picture)
{
global $template, $picture, $page, $conf, $user, $refresh;
//print_r( $picture['current']);
// do nothing if the current picture is actually an image !
if (array_key_exists('src_image', @$picture['current']) && @$picture['current']['src_image']->is_original()) {
return $content;
}
// In case it is not an image but not a supported video file by the plugin
if (vjs_valid_extension(get_extension($picture['current']['path'])) === false) {
return $content;
}
// In case, we handle a large video, we define a MAX_HEIGHT
// variable to limit the display size.
$MAX_HEIGHT = isset($conf['vjs_conf']['max_height']) ? $conf['vjs_conf']['max_height'] : '480';
if (isset($user['maxheight']) and $user['maxheight'] != '') {
$MAX_HEIGHT = $user['maxwidth'];
}
//print "MAX_HEIGHT=" . $MAX_HEIGHT;
//print_r($user);
$extension = vjs_get_mimetype_from_ext(get_extension($picture['current']['path']));
//print "extension\n";
//print_r($extension);
// Video file -- Guess resolution base on height
if (isset($picture['current']['width'])) {
$width = $picture['current']['width'];
}
if (isset($picture['current']['height'])) {
$height = $picture['current']['height'];
}
if (!isset($width) || !isset($height) || $width == 0 || $height == 0) {
// If guess was unsuccessful, fallback to default 16/9 resolution 720x480
// Mostly happend when video metadata was incorrectly sync into PWG
// This is the case for ogv video for example.
$height = 480;
$width = round(16 * 480 / 9, 0);
}
//print "Video height=" . $height . " width=". $width;
// Resize if video is too height
//print $height .">". $MAX_HEIGHT;
if ($height > $MAX_HEIGHT) {
$height = $MAX_HEIGHT;
$width = round(16 * $MAX_HEIGHT / 9, 0);
//print "MAX_HEIGHT height=" . $height . " width=". $width;
}
// Upscale if video is too small
$upscale = isset($conf['vjs_conf']['upscale']) ? strbool($conf['vjs_conf']['upscale']) : false;
if ($upscale and $height < $MAX_HEIGHT) {
$height = $MAX_HEIGHT;
$width = round(16 * $MAX_HEIGHT / 9, 0);
//print "UPSCALE height=" . $height . " width=". $width;
}
// Load parameter, fallback to default if unset
$skin = isset($conf['vjs_conf']['skin']) ? $conf['vjs_conf']['skin'] : 'vjs-default-skin';
$customcss = isset($conf['vjs_customcss']) ? $conf['vjs_customcss'] : '';
$preload = isset($conf['vjs_conf']['preload']) ? $conf['vjs_conf']['preload'] : 'none';
$loop = isset($conf['vjs_conf']['loop']) ? strbool($conf['vjs_conf']['loop']) : false;
$controls = isset($conf['vjs_conf']['controls']) ? strbool($conf['vjs_conf']['controls']) : false;
$volume = isset($conf['vjs_conf']['volume']) ? $conf['vjs_conf']['volume'] : '1';
$language = isset($conf['vjs_conf']['language']) ? $conf['vjs_conf']['language'] : 'en';
// Slideshow : The video needs to be launch automatically in
// slideshow mode. The refresh of the page is set to the
// duration of the video.
$autoplay = isset($conf['vjs_conf']['autoplay']) ? strbool($conf['vjs_conf']['autoplay']) : false;
if ($page['slideshow']) {
$refresh = 20;
// TODO move to separate DB to actualy get this details information
$autoplay = true;
$loop = false;
}
// Assing the CSS file according to the skin
$available_skins = array('vjs-default-skin' => 'video-js.min.css', 'vjs-bluebox-skin' => 'bluebox-skin.css', 'vjs-redtube-skin' => 'redtube-skin.css');
$skincss = $available_skins[$skin];
// Guess the poster extension
$file_wo_ext = pathinfo($picture['current']['path']);
$file_dir = dirname($picture['current']['path']);
$poster = embellish_url($picture['current']['src_image']->get_path());
//print $poster;
// Try to find multiple video source
$vjs_extensions = array('ogg', 'ogv', 'mp4', 'm4v', 'webm', 'webmv');
$files_ext = array_merge(array(), $vjs_extensions, array_map('strtoupper', $vjs_extensions));
// Add the current file in array
$videos[] = array('src' => embellish_url($picture['current']['element_url']), 'ext' => $extension);
// Add any other video source format
foreach ($files_ext as $file_ext) {
$file = $file_dir . "/pwg_representative/" . $file_wo_ext['filename'] . "." . $file_ext;
if (file_exists($file)) {
array_push($videos, array('src' => embellish_url(get_gallery_home_url() . $file_dir . "/pwg_representative/" . $file_wo_ext['filename'] . "." . $file_ext), 'ext' => vjs_get_mimetype_from_ext($file_ext)));
}
}
//print_r($videos);
// Sort array to have MP4 first in the source list for iOS support
foreach ($videos as $key => $row) {
$src[$key] = $row['src'];
$ext[$key] = $row['ext'];
}
array_multisort($src, SORT_ASC, $ext, SORT_ASC, $videos);
//print_r($videos);
/* Try to find WebVTT */
$file = $file_dir . "/pwg_representative/" . $file_wo_ext['filename'] . ".vtt";
//.........这里部分代码省略.........
示例14: forecast_render_element_content
function forecast_render_element_content()
{
global $template, $picture, $page, $conf;
load_language('plugin.lang', FORECAST_PATH);
if (empty($page['image_id']) and !is_numeric($page['image_id'])) {
return;
}
// Load coordinates and date_creation from picture
$query = "SELECT latitude,longitude,date FROM forecast WHERE id='" . $page['image_id'] . "';";
//FIXME LIMIT 1 ?
$result = pwg_query($query);
$row = pwg_db_fetch_assoc($result);
if (!isset($row) or !isset($row['latitude']) or empty($row['latitude']) or !isset($row['longitude']) or empty($row['longitude']) or !isset($row['date']) or empty($row['date'])) {
return;
}
$lat = $row['latitude'];
$lon = $row['longitude'];
$date = $row['date'];
// Load parameter, fallback to default if unset
$fc_height = isset($conf['forecast_conf']['height']) ? $conf['forecast_conf']['height'] : '200';
$fc_header = isset($conf['forecast_conf']['link']) ? $conf['forecast_conf']['link'] : 'Overcast';
$fc_header_css = isset($conf['forecast_conf']['linkcss']) ? $conf['forecast_conf']['linkcss'] : '';
$fc_show_link = isset($conf['forecast_conf']['show']) ? $conf['forecast_conf']['show'] : 'true';
$fc_api_key = isset($conf['forecast_conf']['api_key']) ? $conf['forecast_conf']['api_key'] : '';
if (strlen($fc_header_css) != 0) {
$fc_css = "style='" . $fc_header_css . "'";
}
$fc_link = "http://forecast.io/#/f/" . $lat . "," . $lon;
// Init Forecast.io lib
include 'lib/forecast.io.php';
// Can be set to 'us', 'si', 'ca', 'uk' or 'auto' (see forecast.io API); default is auto
// Can be set to 'en', 'de', 'pl', 'es', 'fr', 'it', 'tet' or 'x-pig-latin' (see forecast.io API); default is 'en'
$fc_unit = isset($conf['forecast_conf']['unit']) ? $conf['forecast_conf']['unit'] : 'auto';
$fc_lang = isset($conf['forecast_conf']['lang']) ? $conf['forecast_conf']['lang'] : 'en';
/* Do we have a Forecast.io API key */
if (strlen($fc_api_key) != 0) {
// Make a request to Forecast.io using the user supply API, proxy set to false
$forecast = new ForecastIO($fc_api_key, $fc_unit, $fc_lang, false);
} else {
/**
* Make a request to https://forecast-xbgmsharp.rhcloud.com
* to non disclose the Forecast.io API key, proxy set to true
* Source code at https://github.com/xbgmsharp/nodejs-forecast
**/
$forecast = new ForecastIO($fc_api_key, $fc_unit, $fc_lang, true);
}
$condition = $forecast->getHistoricalConditions($lat, $lon, $date);
if (!isset($condition) or $condition === 'false') {
return;
}
//print_r($condition);
// Parse weather condition to human readable
$condition = parseCondition($condition);
// Select the template
$template->set_filenames(array('forecast_content' => dirname(__FILE__) . "/template/picture.tpl"));
// Assign the template variables
$template->assign(array('FORECAST_HEIGHT' => $fc_height, 'FORECAST_PATH' => embellish_url(get_gallery_home_url() . FORECAST_PATH), 'FORECAST_NAME' => $fc_header, 'FORECAST_NAME_CSS' => $fc_header_css, 'FORECAST_SHOW_LINK' => $fc_show_link, 'FORECAST_LINK' => $fc_link, 'FORECAST_DATA' => $condition));
// Return the rendered html
$forecast_content = $template->parse('forecast_content', true);
return $forecast_content;
}
示例15: array_push
if (file_exists($file)) {
array_push($videos, array('src' => embellish_url(get_gallery_home_url() . $parts['dirname'] . "/pwg_representative/" . $parts['filename'] . "." . $file_ext), 'ext' => vjs_get_mimetype_from_ext($file_ext)));
}
}
//print_r($videos);
/* Try to find WebVTT */
$file = $parts['dirname'] . "/pwg_representative/" . $parts['filename'] . ".vtt";
file_exists($file) ? $subtitle = embellish_url(get_gallery_home_url() . $file) : ($subtitle = null);
/* Thumbnail videojs plugin */
$filematch = $parts['dirname'] . "/pwg_representative/" . $parts['filename'] . "-th_*";
$matches = glob($filematch);
$thumbnails = array();
$sort = array();
// A list of sort columns and their data to pass to array_multisort
if (is_array($matches) and !empty($matches)) {
foreach ($matches as $filename) {
$ext = explode("-th_", $filename);
$second = explode(".", $ext[1]);
// ./galleries/videos/pwg_representative/trailer_480p-th_0.jpg
//echo "$filename second " . $second[0]. "\n";
$thumbnails[] = array('second' => $second[0], 'source' => embellish_url(get_gallery_home_url() . $filename));
$sort['second'][$second[0]] = $second[0];
}
}
//print_r($thumbnails);
// Sort thumbnails by second
!empty($sort['second']) and array_multisort($sort['second'], SORT_ASC, $thumbnails);
$infos = array_merge(array('Poster' => $poster), array('Videos source' => count($videos)), array('videos' => $videos), array('Thumbnails' => count($thumbnails)), array('thumbnails' => $thumbnails), array('Subtitle' => $subtitle));
//print_r($infos);
$template->assign(array('PWG_TOKEN' => get_pwg_token(), 'F_ACTION' => $self_url, 'SYNC_URL' => $sync_url, 'DELETE_URL' => $delete_url, 'TN_SRC' => DerivativeImage::thumb_url($picture) . '?' . time(), 'TITLE' => render_element_name($picture), 'EXIF' => $exif, 'INFOS' => $infos));
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');