/**
  * Returns the extra content
  *
  * @return string
  */
 function getExtraContent($locale = NULL)
 {
     $text = $this->get("extracontent");
     if ($locale == 'all') {
         return zpFunctions::unTagURLs($text);
     } else {
         return applyMacros(zpFunctions::unTagURLs(get_language_string($text, $locale)));
     }
 }
Ejemplo n.º 2
0
 /**
  * Returns the place data of an album
  *
  * @return string
  */
 function getLocation($locale = NULL)
 {
     $text = $this->get('location');
     if ($locale !== 'all') {
         $text = get_language_string($text, $locale);
     }
     $text = zpFunctions::unTagURLs($text);
     return $text;
 }
Ejemplo n.º 3
0
/**
 * Generates an editable list of language strings
 *
 * @param string $dbstring either a serialized languag string array or a single string
 * @param string $name the prefix for the label, id, and name tags
 * @param bool $textbox set to true for a textbox rather than a text field
 * @param string $locale optional locale of the translation desired
 * @param string $edit optional class
 * @param int $wide column size. true or false for the standard or short sizes. Or pass a column size
 * @param string $ulclass set to the class for the UL element
 * @param int $rows set to the number of rows to show.
 */
function print_language_string_list($dbstring, $name, $textbox = false, $locale = NULL, $edit = '', $wide = TEXT_INPUT_SIZE, $ulclass = 'language_string_list', $rows = 6)
{
    global $_zp_active_languages, $_zp_current_locale, $_lsInstance;
    $dbstring = zpFunctions::unTagURLs($dbstring);
    if (!empty($edit)) {
        $edit = ' class="' . $edit . '"';
    }
    if (is_null($locale)) {
        $locale = getUserLocale();
    }
    $strings = getSerializedArray($dbstring);
    if (count($strings) == 1) {
        $keys = array_keys($strings);
        $lang = array_shift($keys);
        if (!is_string($lang)) {
            $strings = array($locale => array_shift($strings));
        }
    }
    $activelang = generateLanguageList();
    $allLang = array_flip(generateLanguageList('all'));
    foreach ($strings as $lang => $v) {
        if (!array_key_exists($lang, $activelang)) {
            $activelang[$allLang[$lang]] = $lang;
        }
    }
    echo '<div id="ls_' . ++$_lsInstance . '">' . "\n";
    if ($multi = getOption('multi_lingual') && !empty($activelang)) {
        if ($textbox) {
            if (strpos($wide, '%') === false) {
                $width = ' cols="' . $wide . '"';
            } else {
                $width = ' style="width:' . ((int) $wide - 1) . '%;"';
            }
        } else {
            if (strpos($wide, '%') === false) {
                $width = ' size="' . $wide . '"';
            } else {
                $width = ' style="width:' . ((int) $wide - 2) . '%;"';
            }
        }
        // put the language list in perferred order
        $preferred = array();
        if ($_zp_current_locale) {
            $preferred[] = $_zp_current_locale;
        }
        foreach (parseHttpAcceptLanguage() as $lang) {
            $preferred[] = str_replace('-', '_', $lang['fullcode']);
        }
        $preferred = array_unique($preferred);
        $emptylang = array();
        foreach ($preferred as $lang) {
            foreach ($activelang as $key => $active) {
                if ($active == $lang) {
                    $emptylang[$active] = $key;
                    unset($activelang[$key]);
                    continue 2;
                }
            }
            if (strlen($lang) == 2) {
                //	"wild card language"
                foreach ($activelang as $key => $active) {
                    if (substr($active, 0, 2) == $lang) {
                        $emptylang[$active] = $key;
                    }
                }
            }
        }
        foreach ($activelang as $key => $active) {
            $emptylang[$active] = $key;
        }
        if ($textbox) {
            $class = 'box';
        } else {
            $class = '';
        }
        echo '<ul id="ul_' . $_lsInstance . '" class="' . $ulclass . $class . '"' . ">\n";
        $empty = true;
        foreach ($emptylang as $key => $lang) {
            if (isset($strings[$key])) {
                $string = $strings[$key];
                if (!empty($string)) {
                    unset($emptylang[$key]);
                    $empty = false;
                    ?>
						<li>
							<label for="<?php 
                    echo $name . '_' . $key;
                    ?>
"><?php 
                    echo $lang;
                    ?>
</label>
							<?php 
                    if ($textbox) {
                        echo "\n" . '<textarea name="' . $name . '_' . $key . '"' . $edit . $width . '	rows="' . $rows . '">' . html_encode($string) . '</textarea>';
                    } else {
                        echo '<br /><input id="' . $name . '_' . $key . '" name="' . $name . '_' . $key . '"' . $edit . ' type="text" value="' . html_encode($string) . '"' . $width . ' />';
                    }
                    ?>
						</li>
						<?php 
                }
            }
        }
        foreach ($emptylang as $key => $lang) {
            ?>
				<li>
					<label for="<?php 
            echo $name . '_' . $key;
            ?>
"><?php 
            echo $lang;
            ?>
</label>
					<?php 
            if ($textbox) {
                echo "\n" . '<textarea name="' . $name . '_' . $key . '"' . $edit . $width . '	rows="' . $rows . '"></textarea>';
            } else {
                echo '<br /><input id="' . $name . '_' . $key . '" name="' . $name . '_' . $key . '"' . $edit . ' type="text" value=""' . $width . ' />';
            }
            ?>
				</li>
				<?php 
        }
        echo "</ul>\n";
    } else {
        if ($textbox) {
            if (strpos($wide, '%') === false) {
                $width = ' cols="' . $wide . '"';
            } else {
                $width = ' style="width:' . $wide . ';"';
            }
        } else {
            if (strpos($wide, '%') === false) {
                $width = ' size="' . $wide . '"';
            } else {
                $width = ' style="width:' . $wide . ';"';
            }
        }
        if (empty($locale)) {
            $locale = 'en_US';
        }
        if (isset($strings[$locale])) {
            $dbstring = $strings[$locale];
            unset($strings[$locale]);
        } else {
            $dbstring = array_shift($strings);
        }
        if ($textbox) {
            echo '<textarea name="' . $name . '_' . $locale . '"' . $edit . $width . '	rows="' . $rows . '">' . html_encode($dbstring) . '</textarea>';
        } else {
            echo '<input name="' . $name . '_' . $locale . '"' . $edit . ' type="text" value="' . html_encode($dbstring) . '"' . $width . ' />';
        }
        foreach ($strings as $key => $dbstring) {
            if (!empty($dbstring)) {
                ?>
					<input type="hidden" name="<?php 
                echo $name . '_' . $key;
                ?>
" value="<?php 
                echo html_encode($dbstring);
                ?>
" />
					<?php 
            }
        }
    }
    echo "</div>\n";
    if ($multi) {
        ?>
			<script type="text/javascript">
				$(function () {
					$('#ls_<?php 
        echo $_lsInstance;
        ?>
').resizable({
						minHeight: 60,
						resize: function (event, ui) {
							$(this).css("width", '');
							$('#ul_<?php 
        echo $_lsInstance;
        ?>
').height($('#ls_<?php 
        echo $_lsInstance;
        ?>
').height());
						}
					});
				});</script>
			<?php 
    }
}
Ejemplo n.º 4
0
 /**
  * Returns the password hint
  *
  * @return string
  */
 function getPasswordHint($locale = NULL)
 {
     $text = $this->get('password_hint');
     if ($locale !== 'all') {
         $text = get_language_string($text, $locale);
     }
     $text = zpFunctions::unTagURLs($text);
     return $text;
 }
Ejemplo n.º 5
0
 /**
  * Returns the codeblocks as an serialized array
  *
  * @return array
  */
 function getCodeblock()
 {
     return zpFunctions::unTagURLs($this->codeblocks);
 }
Ejemplo n.º 6
0
 /**
  * Returns the codeblocks as an serialized array
  *
  * @return array
  */
 function getCodeblock()
 {
     return zpFunctions::unTagURLs($this->get("codeblock"));
 }
Ejemplo n.º 7
0
/**
 * @deprecated
 * @since 1.4.5
 */
function printField($context, $field, $convertBR = NULL, $override = false, $label = '')
{
    deprecated_functions::notify(gettext('Front end editing is not supported. Use the property specific methods.'));
    if (is_null($convertBR)) {
        $convertBR = !extensionEnabled('tiny_mce');
    }
    switch ($context) {
        case 'image':
            global $_zp_current_image;
            $object = $_zp_current_image;
            break;
        case 'album':
            global $_zp_current_album;
            $object = $_zp_current_album;
            break;
        case 'pages':
            global $_zp_current_zenpage_page;
            $object = $_zp_current_zenpage_page;
            break;
        case 'news':
            global $_zp_current_zenpage_news;
            $object = $_zp_current_zenpage_news;
            break;
        default:
            trigger_error(sprintf(gettext('printField() invalid function call, context %X.'), $context), E_USER_NOTICE);
            return false;
    }
    if (!$field) {
        trigger_error(sprintf(gettext('printField() invalid function call, field:%s.'), $field), E_USER_NOTICE);
        return false;
    }
    if (!is_object($object)) {
        trigger_error(gettext('printField() invalid function call, not an object.'), E_USER_NOTICE);
        return false;
    }
    if ($override) {
        $text = trim($override);
    } else {
        $text = trim(get_language_string($object->get($field)));
    }
    $text = zpFunctions::unTagURLs($text);
    $text = html_encodeTagged($text);
    if ($convertBR) {
        $text = str_replace("\r\n", "\n", $text);
        $text = str_replace("\n", "<br />", $text);
    }
    if (!empty($text)) {
        echo $label;
    }
    echo $text;
}
Ejemplo n.º 8
0
/**
 * Generates an editable list of language strings
 *
 * @param string $dbstring either a serialized languag string array or a single string
 * @param string $name the prefix for the label, id, and name tags
 * @param bool $textbox set to true for a textbox rather than a text field
 * @param string $locale optional locale of the translation desired
 * @param string $edit optional class
 * @param int $wide column size. true or false for the standard or short sizes. Or pass a column size
 * @param string $ulclass set to the class for the UL element
 * @param int $rows set to the number of rows to show.
 */
function print_language_string_list($dbstring, $name, $textbox = false, $locale = NULL, $edit = '', $wide = TEXT_INPUT_SIZE, $ulclass = 'language_string_list', $rows = 6)
{
    global $_zp_active_languages, $_zp_current_locale;
    $dbstring = zpFunctions::unTagURLs($dbstring);
    if (!empty($edit)) {
        $edit = ' class="' . $edit . '"';
    }
    if (is_null($locale)) {
        $locale = getUserLocale();
    }
    $strings = getSerializedArray($dbstring);
    if (count($strings) == 1) {
        $keys = array_keys($strings);
        $lang = array_shift($keys);
        if (!is_string($lang)) {
            $strings = array($locale => array_shift($strings));
        }
    }
    $activelang = generateLanguageList();
    if (getOption('multi_lingual') && !empty($activelang)) {
        if ($textbox) {
            if (strpos($wide, '%') === false) {
                $width = ' cols="' . $wide . '"';
            } else {
                $width = ' style="width:' . ((int) $wide - 1) . '%;"';
            }
        } else {
            if (strpos($wide, '%') === false) {
                $width = ' size="' . $wide . '"';
            } else {
                $width = ' style="width:' . ((int) $wide - 2) . '%;"';
            }
        }
        // put the language list in perferred order
        $preferred = array($_zp_current_locale);
        foreach (parseHttpAcceptLanguage() as $lang) {
            $preferred[] = str_replace('-', '_', $lang['fullcode']);
        }
        $preferred = array_unique($preferred);
        $emptylang = array();
        foreach ($preferred as $lang) {
            foreach ($activelang as $key => $active) {
                if ($active == $lang) {
                    $emptylang[$active] = $key;
                    unset($activelang[$key]);
                    continue 2;
                }
            }
            if (strlen($lang) == 2) {
                //	"wild card language"
                foreach ($activelang as $key => $active) {
                    if (substr($active, 0, 2) == $lang) {
                        $emptylang[$active] = $key;
                    }
                }
            }
        }
        foreach ($activelang as $key => $active) {
            $emptylang[$active] = $key;
        }
        if ($textbox) {
            $class = 'box';
        } else {
            $class = '';
        }
        echo '<ul class="' . $ulclass . $class . '"' . ">\n";
        $empty = true;
        foreach ($emptylang as $key => $lang) {
            if (isset($strings[$key])) {
                $string = $strings[$key];
                if (!empty($string)) {
                    unset($emptylang[$key]);
                    $empty = false;
                    ?>
						<li>
							<label for="<?php 
                    echo $name . '_' . $key;
                    ?>
"><?php 
                    echo $lang;
                    ?>
</label>
							<?php 
                    if ($textbox) {
                        echo "\n" . '<textarea name="' . $name . '_' . $key . '"' . $edit . $width . '	rows="' . $rows . '">' . html_encode($string) . '</textarea>';
                    } else {
                        echo '<br /><input id="' . $name . '_' . $key . '" name="' . $name . '_' . $key . '"' . $edit . ' type="text" value="' . html_encode($string) . '"' . $width . ' />';
                    }
                    ?>
						</li>
						<?php 
                }
            }
        }
        foreach ($emptylang as $key => $lang) {
            ?>
				<li>
					<label for="<?php 
            echo $name . '_' . $key;
            ?>
"><?php 
            echo $lang;
            ?>
</label>
					<?php 
            if ($textbox) {
                echo "\n" . '<textarea name="' . $name . '_' . $key . '"' . $edit . $width . '	rows="' . $rows . '"></textarea>';
            } else {
                echo '<br /><input id="' . $name . '_' . $key . '" name="' . $name . '_' . $key . '"' . $edit . ' type="text" value=""' . $width . ' />';
            }
            ?>
				</li>
				<?php 
        }
        echo "</ul>\n";
    } else {
        if ($textbox) {
            if (strpos($wide, '%') === false) {
                $width = ' cols="' . $wide . '"';
            } else {
                $width = ' style="width:' . $wide . ';"';
            }
        } else {
            if (strpos($wide, '%') === false) {
                $width = ' size="' . $wide . '"';
            } else {
                $width = ' style="width:' . $wide . ';"';
            }
        }
        if (empty($locale)) {
            $locale = 'en_US';
        }
        if (isset($strings[$locale])) {
            $dbstring = $strings[$locale];
        } else {
            $dbstring = array_shift($strings);
        }
        if ($textbox) {
            echo '<textarea name="' . $name . '_' . $locale . '"' . $edit . $width . '	rows="' . $rows . '">' . html_encode($dbstring) . '</textarea>';
        } else {
            echo '<input name="' . $name . '_' . $locale . '"' . $edit . ' type="text" value="' . html_encode($dbstring) . '"' . $width . ' />';
        }
    }
}