本文整理汇总了PHP中generateLanguageList函数的典型用法代码示例。如果您正苦于以下问题:PHP generateLanguageList函数的具体用法?PHP generateLanguageList怎么用?PHP generateLanguageList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generateLanguageList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptionsSupported
/**
*
* supported options
*/
function getOptionsSupported()
{
global $_zp_CMS;
$options = array(gettext('Consumer key') => array('key' => 'tweet_news_consumer', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 2, 'desc' => gettext('This <code>tweet_news</code> app for this site needs a <em>consumer key</em>, a <em>consumer key secret</em>, an <em>access token</em>, and an <em>access token secret</em>.') . '<p class="notebox">' . gettext('Get these from <a href="http://dev.twitter.com/">Twitter developers</a>') . '</p>'), gettext('Secret') => array('key' => 'tweet_news_consumer_secret', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 3, 'desc' => gettext('The <em>secret</em> associated with your <em>consumer key</em>.')), gettext('Access token') => array('key' => 'tweet_news_oauth_token', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 4, 'desc' => gettext('The application <em>oauth_token</em> token.')), gettext('Access token secret') => array('key' => 'tweet_news_oauth_token_secret', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 5, 'desc' => gettext('The application <em>oauth_token</em> secret.')), gettext('Protected objects') => array('key' => 'tweet_news_protected', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 7, 'desc' => gettext('If checked, protected items will be tweeted. <strong>Note:</strong> followers will need the password to visit the tweeted link.')));
$list = array('<em>' . gettext('Albums') . '</em>' => 'tweet_news_albums', '<em>' . gettext('Images') . '</em>' => 'tweet_news_images');
if (extensionEnabled('zenpage')) {
$list['<em>' . gettext('News') . '</em>'] = 'tweet_news_news';
$list['<em>' . gettext('Pages') . '</em>'] = 'tweet_news_pages';
} else {
setOption('tweet_news_news', 0);
setOption('tweet_news_pages', 0);
}
$options[gettext('Tweet')] = array('key' => 'tweet_news_items', 'type' => OPTION_TYPE_CHECKBOX_ARRAY, 'order' => 6, 'checkboxes' => $list, 'desc' => gettext('If a <em>type</em> is checked, a Tweet will be made when an object of that <em>type</em> is published.'));
if (getOption('multi_lingual')) {
$options[gettext('Tweet Language')] = array('key' => 'tweet_language', 'type' => OPTION_TYPE_SELECTOR, 'order' => 5.5, 'selections' => generateLanguageList(), 'desc' => gettext('Select the language for the Tweet message.'));
}
if (getOption('tweet_news_news') && is_object($_zp_CMS)) {
$catlist = getSerializedArray(getOption('tweet_news_categories'));
$news_categories = $_zp_CMS->getAllCategories(false);
$catlist = array(gettext('*not categorized*') => 'tweet_news_categories_none');
foreach ($news_categories as $category) {
$option = 'tweet_news_categories_' . $category['titlelink'];
$catlist[$category['title']] = $option;
setOptionDefault($option, NULL);
}
$options[gettext('News categories')] = array('key' => 'tweet_news_categories', 'type' => OPTION_TYPE_CHECKBOX_UL, 'order' => 6.5, 'checkboxes' => $catlist, 'desc' => gettext('Only those <em>news categories</em> checked will be Tweeted. <strong>Note:</strong> <em>*not categorized*</em> means those news articles which have no category assigned.'));
}
return $options;
}
示例2: new_image
static function new_image($image)
{
global $_zp_exifvars;
$entry_locale = getUserLocale();
$languages = generateLanguageList();
$languageTags = $element = array();
$candidates = self::getTaggingItems();
foreach ($candidates as $key) {
if ($meta = $image->get($key)) {
setupCurrentLocale('en_US');
$en_us = $element[] = exifTranslate($meta);
foreach ($languages as $language) {
setupCurrentLocale($language);
$xlated = exifTranslate($meta);
if ($xlated != $en_us) {
// the string has a translation in this language
$element[] = $xlated;
$languageTags[$language] = $xlated;
}
}
}
}
setupCurrentLocale($entry_locale);
$element = array_unique(array_merge($image->getTags(), $element));
$image->setTags($element);
$image->save();
foreach ($languageTags as $language => $tag) {
$sql = 'UPDATE ' . prefix('tags') . ' SET `language`=' . db_quote($language) . ' WHERE `name`=' . db_quote($tag) . ' AND `language`=NULL OR `language` LIKE ""';
query($sql, false);
}
return $image;
}
示例3: getOptionsSupported
function getOptionsSupported()
{
$host = $_SERVER['HTTP_HOST'];
$matches = explode('.', $host);
if (validateLocale($matches[0], 'Dynamic Locale')) {
array_shift($matches);
$host = implode('.', $matches);
}
$localdesc = '<p>' . sprintf(gettext('Select <em>Use subdomains</em> and links will be in the form <code><em>language</em>.%s</code> where <code><em>language</em></code> is the language code, e.g. <code><em>fr</em></code> for French.'), $host) . '</p>';
$locales = generateLanguageList();
$buttons = array(gettext('subdomain') => 2, gettext('URL') => 1, gettext('disabled') => 0);
if (MOD_REWRITE) {
$buttons[gettext('URL')] = 1;
$localdesc .= '<p>' . sprintf(gettext('Select <em>URL</em> and links paths will have the language selector prepended in the form <code>%1$s/<em>language</em>/...</code>'), ltrim(WEBPATH, '/')) . '</p>';
} else {
unset($buttons[gettext('URL')]);
if (getOption('dynamic_locale_subdomain') == 1) {
setOption('dynamic_locale_subdomain', 0);
}
}
$options = array(gettext('Use flags') => array('key' => 'dynamic_locale_visual', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 0, 'desc' => gettext('Checked produces an array of flags. Not checked produces a selector.')), gettext('Language links') => array('key' => 'dynamic_locale_subdomain', 'type' => OPTION_TYPE_RADIO, 'order' => 1, 'buttons' => $buttons, 'desc' => $localdesc), gettext('Site language') => array('key' => 'dynamic_locale_base', 'type' => OPTION_TYPE_RADIO, 'order' => 2, 'buttons' => $locales, 'desc' => gettext('Set the primary language for your site.')));
return $options;
}
示例4: getAllTranslations
/**
* returns a serialized "multilingual array" of translations
* Used for setting default options with multi-lingual strings.
* @param string $text to be translated
*/
function getAllTranslations($text)
{
$entry_locale = getUserLocale();
$result = array('en_US' => $text);
$languages = generateLanguageList();
$key = array_search('en_US', $languages);
unset($languages[$key]);
foreach ($languages as $language) {
setupCurrentLocale($language);
$xlated = gettext($text);
if ($xlated != $text) {
// the string has a translation in this language
$result[$language] = $xlated;
}
}
setupCurrentLocale($entry_locale);
return serialize($result);
}
示例5: getSitemapZenpageNewsCategories
/**
* Gets links to Zenpage news categories incl. pagination
*
* @return string
*/
function getSitemapZenpageNewsCategories()
{
global $_zp_zenpage, $sitemap_number;
//TODO not splitted into several sitemaps yet
if ($sitemap_number == 1) {
$data = '';
$sitemap_locales = generateLanguageList();
$changefreq = getOption('sitemap_changefreq_newscats');
$newscats = $_zp_zenpage->getAllCategories();
if ($newscats) {
$data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>');
$data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
foreach ($newscats as $newscat) {
$catobj = new ZenpageCategory($newscat['titlelink']);
if (!$catobj->isProtected()) {
switch (SITEMAP_LOCALE_TYPE) {
case 1:
foreach ($sitemap_locales as $locale) {
$url = seo_locale::localePath(true, $locale) . '/' . _CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1';
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
}
break;
case 2:
foreach ($sitemap_locales as $locale) {
$url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1', '?p=news&category=' . urlencode($catobj->getTitlelink()) . '&page=1', dynamic_locale::fullHostPath($locale));
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
}
break;
default:
$url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1', '?p=news&category=' . urlencode($catobj->getTitlelink()) . '&page=1', FULLWEBPATH);
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
break;
}
// getting pages for the categories
/*
if(!empty($articlesperpage)) {
$zenpage_articles_per_page = sanitize_numeric($articlesperpage);
} else {
$zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE;
} */
$zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE;
$articlecount = count($catobj->getArticles());
$catpages = ceil($articlecount / $zenpage_articles_per_page);
if ($catpages > 1) {
for ($x = 2; $x <= $catpages; $x++) {
switch (SITEMAP_LOCALE_TYPE) {
case 1:
foreach ($sitemap_locales as $locale) {
$url = seo_locale::localePath(true, $locale) . '/' . _CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x;
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
}
break;
case 2:
foreach ($sitemap_locales as $locale) {
$url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x, '?p=news&category=' . urlencode($catobj->getTitlelink()) . '&page=' . $x, dynamic_locale::fullHostPath($locale));
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
}
break;
default:
$url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x, '?p=news&category=' . urlencode($catobj->getTitlelink()) . '&page=' . $x, FULLWEBPATH);
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
break;
}
}
}
}
}
$data .= sitemap_echonl('</urlset>');
// End off the <urlset> tag
}
return $data;
}
}
示例6: printLanguageSelector
/**
* prints a form for selecting a locale
* The POST handling is by getUserLocale() called in functions.php
*
*/
function printLanguageSelector($flags = NULL)
{
$languages = generateLanguageList();
if (isset($_REQUEST['locale'])) {
$locale = sanitize($_REQUEST['locale']);
if (getOption('locale') != $locale) {
?>
<div class="errorbox">
<h2>
<?php
printf(gettext('<em>%s</em> is not available.'), html_encode($locale));
?>
<?php
printf(gettext('The locale %s is not supported on your server.'), html_encode($locale));
?>
<br />
<?php
echo gettext('See the troubleshooting guide on zenphoto.org for details.');
?>
</h2>
</div>
<?php
}
}
if (is_null($flags)) {
$flags = getOption('dynamic_locale_visual');
}
if ($flags) {
asort($languages);
?>
<ul class="flags">
<?php
$currentValue = getOption('locale');
$request = parse_url(getRequestURI());
$separator = '?';
if (isset($request['query'])) {
$query = explode('&', $request['query']);
$uri['query'] = '';
foreach ($query as $key => $str) {
if (preg_match('/^locale\\s*=/', $str)) {
unset($query[$key]);
}
}
if (empty($query)) {
unset($request['query']);
} else {
$request['query'] = implode('&', $query);
$separator = '&';
}
}
$uri = $request['path'];
if (isset($request['query'])) {
$uri .= '?' . $request['query'];
}
foreach ($languages as $text => $lang) {
?>
<li<?php
if ($lang == $currentValue) {
echo ' class="currentLanguage"';
}
?>
>
<?php
if ($lang != $currentValue) {
switch (LOCALE_TYPE) {
case 2:
?>
<a href="<?php
echo dynamic_locale::fullHostPath($lang) . html_encode($uri);
?>
" >
<?php
break;
case 1:
?>
<a href="<?php
echo str_replace(WEBPATH, seo_locale::localePath(false, $lang), html_encode($uri));
?>
" >
<?php
break;
default:
?>
<a href="<?php
echo $uri . $separator;
?>
locale=<?php
echo $lang;
?>
" >
<?php
break;
}
}
$flag = getLanguageFlag($lang);
//.........这里部分代码省略.........
示例7: getSitemapNewsCategories
/**
* Gets links to Zenpage news categories incl. pagination
*
* @return string
*/
function getSitemapNewsCategories()
{
global $_zp_CMS, $sitemap_number;
//TODO not splitted into several sitemaps yet
if ($sitemap_number == 1) {
$data = '';
$sitemap_locales = generateLanguageList();
$changefreq = getOption('sitemap_changefreq_newscats');
$newscats = $_zp_CMS->getAllCategories();
if ($newscats) {
$data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>');
$data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
foreach ($newscats as $newscat) {
$catobj = newCategory($newscat['titlelink']);
if (!$catobj->isProtected()) {
$base = $catobj->getLink();
switch (SITEMAP_LOCALE_TYPE) {
case 1:
foreach ($sitemap_locales as $locale) {
$url = str_replace(WEBPATH, seo_locale::localePath(true, $locale), $base);
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
}
break;
case 2:
foreach ($sitemap_locales as $locale) {
$url = dynamic_locale::fullHostPath($locale) . $base;
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
}
break;
default:
$url = FULLHOSTPATH . $base;
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
break;
}
// getting pages for the categories
$zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE;
$articlecount = count($catobj->getArticles());
$catpages = ceil($articlecount / $zenpage_articles_per_page);
if ($catpages > 1) {
for ($x = 2; $x <= $catpages; $x++) {
$base = $catobj->getLink($x);
switch (SITEMAP_LOCALE_TYPE) {
case 1:
foreach ($sitemap_locales as $locale) {
$url = str_replace(WEBPATH, seo_locale::localePath(true, $locale), $base);
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
}
break;
case 2:
foreach ($sitemap_locales as $locale) {
$url = dynamic_locale::fullHostPath($locale) . $base;
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
}
break;
default:
$url = FULLHOSTPATH . $base;
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
break;
}
}
}
}
}
$data .= sitemap_echonl('</urlset>');
// End off the <urlset> tag
}
return $data;
}
}
示例8: gettext
</p>
</td>
</tr>
<tr>
<td width="175"><?php
echo gettext("Language:");
?>
</td>
<td width="350">
<?php
$currentValue = SITE_LOCALE;
?>
<br />
<ul class="languagelist">
<?php
$locales = generateLanguageList('all');
$locales[gettext("HTTP_Accept_Language")] = '';
ksort($locales, SORT_LOCALE_STRING);
$vers = explode('-', ZENPHOTO_VERSION);
$vers = explode('.', $vers[0]);
while (count($vers) < 3) {
$vers[] = 0;
}
$zpversion = $vers[0] . '.' . $vers[1] . '.' . $vers[2];
$c = 0;
foreach ($locales as $language => $dirname) {
$languageAlt = $language;
$class = '';
if (!empty($dirname) && $dirname != 'en_US') {
$version = '';
$po = file_get_contents(SERVERPATH . "/" . ZENFOLDER . "/locale/" . $dirname . '/LC_MESSAGES/zenphoto.po');
示例9: gettext
echo gettext('Language:');
?>
</label></p>
<input type="hidden" name="<?php
echo $id;
?>
-admin_language" id="admin_language_<?php
echo $id;
?>
" value="<?php
echo $currentValue;
?>
" />
<ul class="flags" style="margin-left: 0px;">
<?php
$_languages = generateLanguageList();
$c = 0;
foreach ($_languages as $text => $lang) {
?>
<li id="<?php
echo $lang . '_' . $id;
?>
"<?php
if ($lang == $currentValue) {
echo ' class="currentLanguage"';
}
?>
>
<a onclick="javascript:languageChange('<?php
echo $id;
?>
示例10: setupLanguageSelector
function setupLanguageSelector()
{
global $xsrftoken;
$languages = generateLanguageList();
if (isset($_REQUEST['locale'])) {
$locale = sanitize($_REQUEST['locale'], 0);
if (getOption('locale') != $locale) {
?>
<div class="errorbox">
<h2>
<?php
printf(gettext('<em>%s</em> is not available.'), $languages[$locale]);
?>
<?php
printf(gettext('The locale %s is not supported on your server.'), $locale);
?>
<br />
<?php
echo gettext('See the <a href="http://www.zenphoto.org/news/troubleshooting-zenphoto#24">troubleshooting guide</a> on zenphoto.org for details.');
?>
</h2>
</div>
<?php
}
}
?>
<ul class="sflags">
<?php
$_languages = generateLanguageList();
krsort($_languages, SORT_LOCALE_STRING);
$currentValue = getOption('locale');
foreach ($_languages as $text => $lang) {
?>
<li<?php
if ($lang == $currentValue) {
echo ' class="currentLanguage"';
}
?>
>
<?php
if ($lang != $currentValue) {
?>
<a href="javascript:launchScript('',['locale=<?php
echo $lang;
?>
']);" >
<?php
}
if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/locale/' . $lang . '/flag.png')) {
$flag = WEBPATH . '/' . ZENFOLDER . '/locale/' . $lang . '/flag.png';
} else {
$flag = WEBPATH . '/' . ZENFOLDER . '/locale/missing_flag.png';
}
?>
<img src="<?php
echo $flag;
?>
" alt="<?php
echo $text;
?>
" title="<?php
echo $text;
?>
" />
<?php
if ($lang != $currentValue) {
?>
</a>
<?php
}
?>
</li>
<?php
}
?>
</ul>
<?php
}
示例11: setupLanguageSelector
function setupLanguageSelector()
{
$languages = generateLanguageList();
if (isset($_REQUEST['locale'])) {
$locale = sanitize($_REQUEST['locale']);
if (getOption('locale') != $locale || getOption('unsupported_' . $locale)) {
?>
<div class="errorbox">
<h2>
<?php
printf(gettext('<em>%s</em> is not available.'), html_encode($languages[$locale]));
?>
<?php
printf(gettext('The locale %s is not supported on your server.'), html_encode($locale));
?>
<br />
<?php
echo gettext('You can use the <em>debug</em> plugin to see which locales your server supports.');
?>
</h2>
</div>
<?php
}
}
?>
<ul class="sflags">
<?php
$_languages = generateLanguageList();
krsort($_languages, SORT_LOCALE_STRING);
$currentValue = getOption('locale');
foreach ($_languages as $text => $lang) {
if (i18nSetLocale($lang)) {
?>
<li<?php
if ($lang == $currentValue) {
echo ' class="currentLanguage"';
}
?>
>
<?php
if ($lang != $currentValue) {
?>
<a href="javascript:launchScript('',['locale=<?php
echo $lang;
?>
']);" >
<?php
}
if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/locale/' . $lang . '/flag.png')) {
$flag = WEBPATH . '/' . ZENFOLDER . '/locale/' . $lang . '/flag.png';
} else {
$flag = WEBPATH . '/' . ZENFOLDER . '/locale/missing_flag.png';
}
?>
<img src="<?php
echo $flag;
?>
" alt="<?php
echo $text;
?>
" title="<?php
echo $text;
?>
" />
<?php
if ($lang != $currentValue) {
?>
</a>
<?php
}
?>
</li>
<?php
}
}
?>
</ul>
<?php
}
示例12: publishArticle
/**
*
* Creates the news article
* @param object $obj
*/
protected static function publishArticle($obj, $override = NULL)
{
global $_zp_CMS;
$galleryitem_text = array();
$locale = getOption('locale');
switch ($type = $obj->table) {
case 'albums':
$album = $obj->name;
$dbstring = getOption('galleryArticles_album_text');
$localtext = get_language_string($dbstring);
$galleryitem_text[$locale] = sprintf($localtext, $obj->getTitle($locale));
foreach (generateLanguageList() as $key) {
$languagetext = get_language_string($dbstring, $key);
if ($localtext != $languagetext) {
$galleryitem_text[$key] = sprintf($languagetext, $obj->getTitle($key));
}
}
$ref = '"' . $album . '"';
$title = $folder = $album;
$img = $obj->getAlbumThumbImage();
$class = 'galleryarticles-newalbum';
break;
case 'images':
$album = $obj->album->name;
$image = $obj->filename;
$dbstring = unserialize(getOption('galleryArticles_image_text'));
$localtext = get_language_string($dbstring);
$galleryitem_text[$locale] = sprintf($localtext, $obj->getTitle($locale), $obj->album->getTitle($locale));
foreach (generateLanguageList() as $key => $val) {
$languagetext = get_language_string($dbstring, $key);
if ($localtext != $languagetext) {
$galleryitem_text[$key] = sprintf($localtext, $obj->getTitle($key), $obj->album->getTitle($key));
}
}
$ref = '"' . $album . '" "' . $image . '"';
$folder = $obj->imagefolder;
$title = $folder . '-' . $image;
$img = $obj;
$class = 'galleryarticles-newimage';
break;
default:
//not a gallery object
return;
}
$article = newArticle(seoFriendly('galleryArticles-' . $title));
$article->setTitle(serialize($galleryitem_text));
$imglink = $img->getCustomImage(getOption('galleryArticles_size'), NULL, NULL, NULL, NULL, NULL, NULL, -1);
$desc = '<p><a class="' . $class . '" href="' . $obj->getLink() . '"><img src="' . $imglink . '"></a></p><p>[GALLERYARTICLEDESC ' . $ref . ']</p>';
$article->setContent($desc);
$date = $obj->getPublishDate();
if (!$date) {
$date = date('Y-m-d H:i:s');
}
$article->setDateTime($date);
$article->setLastchange(date('Y-m-d H:i:s'));
$article->setAuthor('galleryArticles');
$article->setLastchangeauthor('galleryArticles');
$article->setShow(true);
$article->save();
if ($override) {
$cat = $override;
} else {
$cat = getOption('galleryArticles_category');
if (getOption('galleryArticles_albumCategory')) {
$catlist = $_zp_CMS->getAllCategories();
foreach ($catlist as $category) {
if ($category['titlelink'] == $folder) {
$cat = $category['titlelink'];
break;
}
}
}
}
$article->setCategories(array($cat));
}
示例13: process_language_string_save
/**
* process the post of a language string form
*
* @param string $name the prefix for the label, id, and name tags
* @return string
*/
function process_language_string_save($name, $sanitize_level = 3)
{
global $_zp_active_languages;
if (is_null($_zp_active_languages)) {
$_zp_active_languages = generateLanguageList();
}
$l = strlen($name) + 1;
$strings = array();
foreach ($_POST as $key => $value) {
if (!empty($value) && preg_match('/^' . $name . '_[a-z]{2}_[A-Z]{2}$/', $key)) {
$key = substr($key, $l);
if (in_array($key, $_zp_active_languages)) {
$strings[$key] = sanitize($value, $sanitize_level);
}
}
}
switch (count($strings)) {
case 0:
if (isset($_POST[$name])) {
return sanitize($_POST[$name], $sanitize_level);
} else {
return '';
}
case 1:
return array_shift($strings);
default:
return serialize($strings);
}
}
示例14: printLanguageSelector
/**
* prints a form for selecting a locale
* The POST handling is by getUserLocale() called in functions.php
*
*/
function printLanguageSelector($flags = NULL)
{
$languages = generateLanguageList();
if (isset($_REQUEST['locale'])) {
$locale = sanitize($_REQUEST['locale'], 0);
if (getOption('locale') != $locale) {
?>
<div class="errorbox">
<h2>
<?php
printf(gettext('<em>%s</em> is not available.'), $languages[$locale]);
?>
<?php
printf(gettext('The locale %s is not supported on your server.'), $locale);
?>
<br />
<?php
echo gettext('See the troubleshooting guide on zenphoto.org for details.');
?>
</h2>
</div>
<?php
}
}
if (is_null($flags)) {
$flags = getOption('dynamic_locale_visual');
}
if ($flags) {
?>
<ul class="flags">
<?php
$_languages = generateLanguageList();
$currentValue = getOption('locale');
foreach ($_languages as $text => $lang) {
?>
<li<?php
if ($lang == $currentValue) {
echo ' class="currentLanguage"';
}
?>
>
<?php
if ($lang != $currentValue) {
?>
<a href="javascript:launchScript('',['locale=<?php
echo $lang;
?>
']);" >
<?php
}
if (file_exists(SERVERPATH . '/' . ZENFOLDER . '/locale/' . $lang . '/flag.png')) {
$flag = WEBPATH . '/' . ZENFOLDER . '/locale/' . $lang . '/flag.png';
} else {
$flag = WEBPATH . '/' . ZENFOLDER . '/locale/missing_flag.png';
}
?>
<img src="<?php
echo $flag;
?>
" alt="<?php
echo $text;
?>
" title="<?php
echo $text;
?>
" />
<?php
if ($lang != $currentValue) {
?>
</a>
<?php
}
?>
</li>
<?php
}
unset($_languages);
?>
</ul>
<?php
} else {
?>
<form action="#" method="post">
<input type="hidden" name="oldlocale" value="<?php
echo getOption('locale');
?>
" />
<select id="dynamic-locale" class="languageselect" name="locale" onchange="this.form.submit()">
<?php
$locales = generateLanguageList();
$currentValue = getOption('locale');
foreach ($locales as $key => $item) {
echo '<option class="languageoption" value="' . html_encode($item) . '"';
if ($item == $currentValue) {
echo ' selected="selected"';
//.........这里部分代码省略.........
示例15: process_language_string_save
/**
* process the post of a language string form
*
* @param string $name the prefix for the label, id, and name tags
* @param $sanitize_level the type of sanitization required
* @return string
*/
function process_language_string_save($name, $sanitize_level = 3)
{
$languages = generateLanguageList('all');
$l = strlen($name) + 1;
$strings = array();
foreach ($_POST as $key => $value) {
if (preg_match('/^' . $name . '_[a-z]{2}_[A-Z]{2}$/', $key)) {
$key = substr($key, $l);
if (in_array($key, $languages)) {
$value = sanitize($value, $sanitize_level);
if (!empty($value)) {
$strings[$key] = $value;
}
}
}
}
switch (count($strings)) {
case 0:
if (isset($_POST[$name])) {
return sanitize($_POST[$name], $sanitize_level);
} else {
return '';
}
default:
return serialize($strings);
}
}