本文整理汇总了PHP中_f函数的典型用法代码示例。如果您正苦于以下问题:PHP _f函数的具体用法?PHP _f怎么用?PHP _f使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_f函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* Function: set
* Adds or replaces a configuration setting with the given value.
*
* Parameters:
* $setting - The setting name.
* $value - The value.
* $overwrite - If the setting exists and is the same value, should it be overwritten?
*/
public function set($setting, $value, $overwrite = true)
{
if (isset($this->{$setting}) and $this->{$setting} == $value and !$overwrite) {
return false;
}
if (isset($this->file) and file_exists($this->file)) {
$contents = str_replace("<?php header(\"Status: 403\"); exit(\"Access denied.\"); ?>\n", "", file_get_contents($this->file));
$this->yaml = YAML::load($contents);
}
# Add the setting
$this->yaml[$setting] = $this->{$setting} = $value;
if (class_exists("Trigger")) {
Trigger::current()->call("change_setting", $setting, $value, $overwrite);
}
# Add the PHP protection!
$contents = "<?php header(\"Status: 403\"); exit(\"Access denied.\"); ?>\n";
# Generate the new YAML settings
$contents .= YAML::dump($this->yaml);
if (!@file_put_contents(INCLUDES_DIR . "/config.yaml.php", $contents)) {
Flash::warning(_f("Could not set \"<code>%s</code>\" configuration setting because <code>%s</code> is not writable.", array($setting, "/includes/config.yaml.php")));
return false;
} else {
return true;
}
}
示例2: reward_text
/**
* Return the reward text, ie the reward and the donator
* @access public
* @return string
*/
public function reward_text()
{
if ($this->is_unlocked()) {
return _f('Reward : %s, won by %s, given by %s', array($this->reward, $this->winner->target(), $this->creator->target()));
}
return _f('Reward : %s, given by %s', array($this->reward, $this->creator->target()));
}
示例3: CT_Start_Default
function CT_Start_Default($target)
{
importlib("model.blog.attachment");
$context = Model_Context::getInstance();
$blogURL = $context->getProperty('uri.blog');
$blogid = $context->getProperty('blog.id');
$target .= '<ul>';
$target .= '<li><a href="' . $blogURL . '/owner/entry/post">' . _t('새 글을 씁니다') . '</a></li>' . CRLF;
$latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0);
if ($latestEntryId !== 0) {
$latestEntry = CT_Start_Default_getEntry($blogid, $latestEntryId);
if ($latestEntry != false) {
$target .= '<li><a href="' . $blogURL . '/owner/entry/edit/' . $latestEntry['id'] . '">' . _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10))) . '</a></li>';
}
}
if (Acl::check('group.administrators')) {
$target .= '<li><a href="' . $blogURL . '/owner/skin">' . _t('스킨을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/skin/sidebar">' . _t('사이드바 구성을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/skin/setting">' . _t('블로그에 표시되는 값들을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/entry/category">' . _t('카테고리를 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/plugin">' . _t('플러그인을 켜거나 끕니다') . '</a></li>' . CRLF;
}
if ($context->getProperty('service.reader', false) != false) {
$target .= '<li><a href="' . $blogURL . '/owner/network/reader">' . _t('RSS 리더를 봅니다') . '</a></li>' . CRLF;
}
$target .= '</ul>';
return $target;
}
示例4: test_translatef
public function test_translatef()
{
$this->assertEquals('Le champ IP est requis.',
SI18n::translatef('%s is required.', array('IP')));
$this->assertEquals('Le champ IP est requis.',
_f('%s is required.', array('IP')));
}
示例5: move_to_yaml
function move_to_yaml()
{
$sql = SQL::current();
if (!($attrs = $sql->select("post_attributes", "*", array("name" => array("unclean_tags", "clean_tags"))))) {
return;
}
function parseTags($tags, $clean)
{
$tags = explode(",", preg_replace("/\\{\\{([^\\}]+)\\}\\}/", "\\1", $tags));
$clean = explode(",", preg_replace("/\\{\\{([^\\}]+)\\}\\}/", "\\1", $clean));
return array_combine($tags, $clean);
}
$tags = array();
foreach ($attrs->fetchAll() as $attr) {
if ($attr["name"] == "unclean_tags") {
$tags[$attr["post_id"]]["unclean"] = $attr["value"];
} else {
$tags[$attr["post_id"]]["clean"] = $attr["value"];
}
}
if (empty($tags)) {
return;
}
foreach ($tags as $post_id => $tags) {
$yaml = YAML::dump(parseTags($tags["unclean"], $tags["clean"]));
echo _f("Relocating tags for post #%d...", array($post_id), "tags");
echo test($insert = $sql->replace("post_attributes", array("name" => "tags", "value" => $yaml, "post_id" => $post_id)), _f("Backup written to %s.", array("./_tags.bak.txt")));
if (!$insert) {
return file_put_contents("./_tags.bak.txt", var_export($tags, true));
}
}
echo __("Removing old post attributes...", "tags") . test($sql->delete("post_attributes", array("name" => array("unclean_tags", "clean_tags"))));
}
示例6: CT_Start_Default
function CT_Start_Default($target)
{
requireModel("blog.attachment");
requireComponent("Eolin.PHP.Core");
requireComponent("Textcube.Function.misc");
global $blogid, $blogURL, $database, $service;
$target .= '<ul>';
$target .= '<li><a href="' . $blogURL . '/owner/entry/post">' . _t('새 글을 씁니다') . '</a></li>' . CRLF;
$latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0);
if ($latestEntryId !== 0) {
$latestEntry = CT_Start_Default_getEntry($blogid, $latestEntryId);
if ($latestEntry != false) {
$target .= '<li><a href="' . $blogURL . '/owner/entry/edit/' . $latestEntry['id'] . '">' . _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10))) . '</a></li>';
}
}
if (Acl::check('group.administrators')) {
$target .= '<li><a href="' . $blogURL . '/owner/skin">' . _t('스킨을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/skin/sidebar">' . _t('사이드바 구성을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/skin/setting">' . _t('블로그에 표시되는 값들을 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/entry/category">' . _t('카테고리를 변경합니다') . '</a></li>' . CRLF;
$target .= '<li><a href="' . $blogURL . '/owner/plugin">' . _t('플러그인을 켜거나 끕니다') . '</a></li>' . CRLF;
}
if ($service['reader'] != false) {
$target .= '<li><a href="' . $blogURL . '/owner/network/reader">' . _t('RSS 리더를 봅니다') . '</a></li>' . CRLF;
}
$target .= '</ul>';
return $target;
}
示例7: __install
static function __install()
{
$digest = MAIN_DIR . DIR . "digest.txt.php";
$output = "<?php header(\"Status: 403\"); exit(\"Access denied.\"); ?>\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/digest; boundary=\"---correspondence---\"\r\n" . "\r\n---correspondence---\r\n";
if (!file_exists($digest) and !@file_put_contents($digest, $output)) {
error(__("Error"), _f("The digest file <em>%s</em> could not be created.", fix($digest), "mail_to_file"));
}
}
示例8: new_file
function new_file($name, $type = 'console')
{
$base_exe = EMBEDER_BASE_EXE_PATH . $type . '.exe';
$exe = ".\\{$name}.exe";
check_exe($exe, true);
if (!copy(_f(EMBEDER_BASE_EXE_PATH . $type . '.exe'), $exe)) {
err("Can't create '{$exe}'");
}
echo "'{$exe}' created\n";
}
示例9: clean
protected function clean()
{
try {
if ($this->cleaned_data['password'] !== $this->cleaned_data['password_confirmation']) {
throw new SValidationError(__('Password confirmation must be identical to password'));
}
} catch (SValidationError $e) {
$this->errors['password_confirmation'] = _f($e->get_message(), $e->get_args());
$this->cleaned_data[$name] = $e->get_cleaned_value();
}
}
示例10: load
function load($skinname) {
global $service;
$this->url = "{$service['path']}/skin/$skinname/";
if(!file_exists(ROOT."/skin/$skinname/skin.html")) {
Func::printError(_f('%1 스킨이 존재하지 않습니다.',$skinname),'error','admin');
} else {
$this->output = file_get_contents(ROOT."/skin/$skinname/skin.html");
$this->output = str_replace('./', $this->url , $this->output);
}
}
示例11: __init
public function __init()
{
$this->setField(array("attr" => "title", "type" => "text", "label" => __("Title", "audio"), "optional" => true, "bookmarklet" => "title"));
$this->setField(array("attr" => "audio", "type" => "file", "label" => __("Audio File", "audio"), "note" => _f("<small>(Max. file size: %s)</small>", array(ini_get('upload_max_filesize')))));
if (isset($_GET['action']) and $_GET['action'] == "bookmarklet") {
$this->setField(array("attr" => "from_url", "type" => "text", "label" => __("From URL?", "audio"), "optional" => true, "no_value" => true));
}
$this->setField(array("attr" => "description", "type" => "text_block", "label" => __("Description"), "optional" => true, "preview" => true, "bookmarklet" => "selection"));
$this->setFilter("title", array("markup_title", "markup_post_title"));
$this->setFilter("description", array("markup_text", "markup_post_text"));
$this->respondTo("delete_post", "delete_file");
$this->respondTo("feed_item", "enclose_audio");
$this->respondTo("filter_post", "filter_post");
$this->respondTo("post_options", "add_option");
$this->respondTo("scripts", "add_jplayer_script");
}
示例12: check_update
/**
* Function: check_update
* Checks if the a new version of Chyrp is available.
*/
public static function check_update()
{
if (!Config::current()->check_updates) {
return;
}
$xml = self::xml();
$curver = CHYRP_VERSION;
foreach ($xml->channel->item as $item) {
$newver = $item->version;
if (version_compare($curver, $newver, ">=")) {
$return = false;
} else {
$return = _f("<p class='message'>Chyrp v%s is available, you have v%s. <a href='?action=update'>Learn More</a></p>", array($newver, $curver));
break;
}
}
return $return;
}
示例13: TextcubeBirthday_TextcubeBirthday
function TextcubeBirthday_TextcubeBirthday($target)
{
global $configVal;
requireComponent('Textcube.Function.misc');
$data = Setting::fetchConfigVal($configVal);
$month = 3;
$day = 13;
if (!is_null($data)) {
$month = $data['month'];
$day = $data['day'];
}
$dDay = intval((gmmktime(0, 0, 0, $month, $day) - time()) / 86400);
if ($dDay < 0) {
$dDay = intval((gmmktime(0, 0, 0, $month, $day, gmdate('Y') + 1) - time()) / 86400);
}
if ($dDay == 0) {
$message = '<span class="congratu">' . _t("탄생을 축하합니다!") . '</span>';
} else {
$message = "<span>" . _f("앞으로 %1일 남음", $dDay_) . "</span>";
}
ob_start();
?>
<div class="listbox">
<h3><?php
echo _t("텍스트큐브 생일");
?>
</h3>
<div style="text-align:center"><?php
echo $month;
?>
월 <?php
echo $day;
?>
일: <?php
echo $message;
?>
</div>
</div>
<?php
$target = ob_get_contents();
ob_end_clean();
return $target;
}
示例14: TextcubeBirthday_TextcubeBirthday
function TextcubeBirthday_TextcubeBirthday($target)
{
$context = Model_Context::getInstance();
$data = $context->getProperty('plugin.config');
$month = 3;
$day = 13;
if (!is_null($data)) {
$month = $data['month'];
$day = $data['day'];
}
$dDay = intval((gmmktime(0, 0, 0, $month, $day) - time()) / 86400);
if ($dDay < 0) {
$dDay = intval((gmmktime(0, 0, 0, $month, $day, gmdate('Y') + 1) - time()) / 86400);
}
if ($dDay == 0) {
$message = '<span class="congratu">' . _t("탄생을 축하합니다!") . '</span>';
} else {
$message = "<span>" . _f("앞으로 %1일 남음", $dDay_) . "</span>";
}
ob_start();
?>
<div class="listbox">
<h3><?php
echo _t("텍스트큐브 생일");
?>
</h3>
<div style="text-align:center"><?php
echo $month;
?>
월 <?php
echo $day;
?>
일: <?php
echo $message;
?>
</div>
</div>
<?php
$target = ob_get_contents();
ob_end_clean();
return $target;
}
示例15: app
/**
* Show detail information about an app
* and offer download of it.
*
* @param string $package
* The package name of the app to show information for.
*
* @throws Exception
* If package does not exists.
*/
public function app($package = NULL)
{
$sql = <<<EOF
SELECT package, title, author, description
FROM Apps
WHERE package LIKE :package
;
EOF;
// Get info from DB and show app details.
$db = DBApps::getInstance()->db;
$sth = $db->prepare($sql);
$sth->bindValue(':package', trim($package), SQLITE3_TEXT);
$res = $sth->execute();
$row = $res->fetchArray(SQLITE3_ASSOC);
$this->_alterRow($row);
if (!empty($row)) {
$this->view->package = $package = $row['package'];
$this->view->title = $row['title'];
$this->view->author = $row['author'];
$play_url = 'https://play.google.com/store/apps/details?id=' . urlencode($package);
$this->view->teaser = $row['teaser'] . _f(' %s[more]%s<br><br><i>This is a short extract from %s<br>%sCopyright notice%s</i>', '<a target="_blank" href="' . q($play_url) . '">', '</a>', '<a target="_blank" href="' . q($play_url) . '">' . q($play_url) . '</a>', '<a href="' . q(url('impressum')) . '#app-teaser">[', ']</a>');
} else {
if (package_exists($package)) {
$this->view->package = $package;
$this->view->title = $package;
$this->view->author = _('Unknown');
$this->view->teaser = '<i>' . _f('App-Download.org has no description for this app, however you can still download the app using the %sdownload link%s.' . ' Please visit the %sPlay Store%s for information about this app.', '<a href="' . q(url('download/direct/' . urlencode($package))) . '">', '</a>', '<a target="_blank" href="https://play.google.com/store/apps/details?id=' . q(urlencode($package)) . '">', '</a>') . '</i>';
} else {
throw new Exception(_f('Could not find app with package name "%s".', $package));
}
}
// Build links.
$this->view->downloadUrl = url('download/direct/') . urlencode($package);
$this->view->playstoreUrl = 'https://play.google.com/store/apps/details?id=' . urlencode($package);
$this->view->display('app');
}