本文整理汇总了PHP中PerchLang::get方法的典型用法代码示例。如果您正苦于以下问题:PHP PerchLang::get方法的具体用法?PHP PerchLang::get怎么用?PHP PerchLang::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerchLang
的用法示例。
在下文中一共展示了PerchLang::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_templates
public function get_templates($path = false, $include_hidden = false, $initial_path = false)
{
$Perch = Perch::fetch();
if ($path === false) {
$path = PERCH_TEMPLATE_PATH . '/categories';
}
if ($initial_path === false) {
$initial_path = $path;
}
$a = array();
if (is_dir($path)) {
if ($dh = opendir($path)) {
while (($file = readdir($dh)) !== false) {
if (substr($file, 0, 1) != '.' && ($include_hidden || substr($file, 0, 1) != '_') && !preg_match($Perch->ignore_pattern, $file)) {
$extension = PerchUtil::file_extension($file);
if ($extension == 'html' || $extension == 'htm') {
$p = str_replace($initial_path, '', $path);
if (!$p) {
$a[PerchLang::get('Categories')][] = array('filename' => $file, 'path' => $file, 'label' => $this->template_display_name($file));
} else {
$a[] = array('filename' => $file, 'path' => ltrim($p, '/') . '/' . $file, 'label' => $this->template_display_name($file));
}
} else {
$a[$this->template_display_name($file)] = $this->get_templates($path . '/' . $file, $include_hidden, $initial_path);
}
}
}
closedir($dh);
}
if (PerchUtil::count($a)) {
$a = PerchUtil::array_sort($a, 'label');
}
}
return $a;
}
示例2: get_templates
public function get_templates($template_ids = false)
{
$a = array();
$templates = $this->get_filtered($template_ids);
if (PerchUtil::count($templates)) {
foreach ($templates as $Template) {
$segments = explode('/', $Template->templatePath());
if (count($segments) == 1) {
$a[PerchLang::get('General')][] = array('id' => $Template->id(), 'label' => $Template->templateTitle());
} else {
$file = array_pop($segments);
$tmp = array('id' => $Template->id(), 'label' => $Template->templateTitle());
$target =& $a;
for ($i = 0; $i < count($segments); $i++) {
$label = $this->template_display_name($segments[$i]);
if (!isset($a[$label])) {
$a[$label] = array();
}
$target =& $a[$label];
}
$target[] = $tmp;
}
}
}
return $a;
}
示例3: get_templates
/**
* Get an array of templates in the content folder.
*
* @param string $path
* @return void
* @author Drew McLellan
*/
public function get_templates($path = false, $include_hidden = false, $initial_path = false)
{
$Perch = Perch::fetch();
if ($path === false) {
$path = PERCH_TEMPLATE_PATH . '/forms/emails';
}
if ($initial_path === false) {
$initial_path = $path;
}
$a = array();
$groups = array();
$p = false;
if (is_dir($path)) {
if ($dh = opendir($path)) {
while (($file = readdir($dh)) !== false) {
if (substr($file, 0, 1) != '.' && ($include_hidden || substr($file, 0, 1) != '_') && !preg_match($Perch->ignore_pattern, $file)) {
$extension = PerchUtil::file_extension($file);
if ($extension == 'html' || $extension == 'htm') {
$p = str_replace($initial_path, '', $path);
if (!$p) {
$a[PerchLang::get('Templates')][] = array('filename' => $file, 'value' => $file, 'path' => $file, 'label' => $this->template_display_name($file));
} else {
$a[] = array('filename' => $file, 'value' => ltrim($p, '/') . '/' . $file, 'path' => ltrim($p, '/') . '/' . $file, 'label' => $this->template_display_name($file));
}
} else {
// Use this one of infinite recursive nesting. Group stuff below normalised for HTML select optgroups that only do one level
//$a[$this->template_display_name($file)] = $this->get_templates($path.'/'.$file, $include_hidden, $initial_path);
if ($p) {
$group_name = $this->template_display_name(trim($p, '/\\') . '/' . $file);
} else {
$group_name = $this->template_display_name($file);
}
$groups[$group_name] = $this->get_templates($path . '/' . $file, $include_hidden, $initial_path);
}
}
}
closedir($dh);
}
if (PerchUtil::count($a)) {
$a = PerchUtil::array_sort($a, 'label');
}
}
return $a + $groups;
}
示例4: submit
public function submit($id, $value, $class = false, $translate = true, $use_button = false)
{
$Perch = PerchAdmin::fetch();
if ($this->display_only) {
if ($this->allow_edits) {
$segments = str_replace('/editform=' . $this->name, '', split('/', $Perch->get_page(true)));
$segments[] = 'editform=' . $this->name;
$url = implode('/', $segments);
$url = str_replace('//', '/', $url);
return '<a href="' . $url . '" class="button" id="' . $this->html($id, true) . '">Edit</a>';
}
return '';
}
if ($translate) {
$value = PerchLang::get($value);
}
if ($use_button) {
$s = '<button type="submit" name="' . $this->html($id, true) . '" id="' . $this->html($id, true) . '" value="' . $this->html($value, true) . '" class="' . $this->html($class, true) . '"><span></span>' . $this->html($value, true) . '</button>';
} else {
$s = '<input type="submit" name="' . $this->html($id, true) . '" id="' . $this->html($id, true) . '" value="' . $this->html($value, true) . '" class="' . $this->html($class, true) . '" />';
}
$s .= '<input type="hidden" name="formaction" value="' . $this->html($this->name, true) . '" />';
$s .= '<input type="hidden" name="token" value="' . $this->html(PerchSession::get('csrf_token'), true) . '" />';
return $s;
}
示例5:
}
echo $Form->text('tags', $Form->get(array('tags' => $edit_str), 'tags'), '', false, 'text', 'data-tags="/core/apps/assets/async/tags.php"');
?>
<?php
echo $Form->hint(PerchLang::get('Complete each tag with a comma.'));
?>
</div>
<div class="field checkboxes">
<?php
echo $Form->label('resourceInLibrary', 'Mark as a library asset');
?>
<?php
echo $Form->checkbox('resourceInLibrary', '1', $Form->get($details, 'resourceInLibrary'));
?>
<?php
echo $Form->hint(PerchLang::get('Library assets are kept, even if unused.'));
?>
</div>
<p class="submit">
<?php
echo $Form->submit('btnsubmit', 'Submit', 'button');
?>
</p>
</form>
<?php
include PERCH_PATH . '/core/inc/main_end.php';
示例6:
">
<?php
echo $Form->label('userPassword', 'New password');
?>
<?php
echo $Form->password('userPassword', '');
?>
</div>
<div class="field <?php
echo $Form->error('userPassword2', false);
?>
">
<?php
echo $Form->label('userPassword2', 'Repeat new password');
?>
<?php
echo $Form->password('userPassword2', '');
?>
</div>
</fieldset>
<p class="submit">
<?php
echo $Form->submit('submit', 'Save changes', 'button');
echo ' ' . PerchLang::get('or') . ' <a href="' . PERCH_LOGINPATH . '">' . PerchLang::get('Cancel') . '</a>';
?>
</p>
</form>
<?php
include PERCH_PATH . '/core/inc/main_end.php';
示例7: PerchResources
$Resources = new PerchResources();
$ids = $Resources->get_logged_ids();
$assetID = array_shift($ids);
$Asset = $Assets->find($assetID);
$created = true;
}
if ($Asset) {
if ($data['resourceInLibrary'] == '1') {
$Asset->mark_as_library();
}
$Asset->update($data);
$Asset->reindex();
// Tags
if (isset($_POST['tags']) && trim($_POST['tags']) != '') {
$tag_string = trim($_POST['tags']);
$Tags->assign_tag_string($Asset->id(), $tag_string, true);
}
if ($created) {
//PerchUtil::redirect(PERCH_LOGINPATH.'/core/apps/assets/edit/?id='.$Asset->id().'&created=1');
}
$Alert->set('success', PerchLang::get('Successfully updated'));
}
}
if (isset($_GET['created'])) {
$Alert->set('success', PerchLang::get('Successfully created'));
}
if ($Asset) {
$details = $Asset->to_array();
} else {
$details = new ArrayObject();
}
示例8:
?>
</div>
<div class="checkbox">
<?php
echo $Form->radio('pages-grant', 'pages', 'grant', false);
?>
<?php
echo $Form->label('pages-grant', 'Grant role permission create new subpages of all current pages');
?>
</div>
<div class="checkbox">
<?php
echo $Form->radio('pages-revoke', 'pages', 'revoke', false);
?>
<?php
echo $Form->label('pages-revoke', 'Revoke role permission to create new subpages');
?>
</div>
</fieldset>
<p class="submit">
<?php
echo $Form->submit('submit', 'Make changes', 'button');
echo ' ' . PerchLang::get('or') . ' <a href="' . PERCH_LOGINPATH . '/core/users/roles/">' . PerchLang::get('Cancel') . '</a>';
?>
</p>
</form>
<?php
include PERCH_PATH . '/core/inc/main_end.php';
示例9: PerchUserRoles
<?php
$Roles = new PerchUserRoles();
$roles = $Roles->all();
/* --------- New User Form ----------- */
$fCreateUser = new PerchForm('createuser', false);
$req = array();
$req['userUsername'] = "Required";
$req['userGivenName'] = "Required";
$req['userFamilyName'] = "Required";
$req['userEmail'] = "Required";
$req['userPassword'] = "Required";
$req['roleID'] = "Required";
$fCreateUser->set_required($req);
$validation = array();
$validation['userUsername'] = array("username", PerchLang::get("Username not available, try another."));
$validation['userEmail'] = array("email", PerchLang::get("Email incomplete or already in use."));
$fCreateUser->set_validation($validation);
if ($fCreateUser->posted() && $fCreateUser->validate()) {
$data = array();
$postvars = array('userUsername', 'userGivenName', 'userFamilyName', 'userEmail', 'userPassword', 'roleID');
$data = $fCreateUser->receive($postvars);
$sendEmail = false;
if (isset($_POST['sendEmail']) && $_POST['sendEmail'] == '1') {
$sendEmail = true;
}
$Users->create($data, $sendEmail);
$Alert->set('success', PerchLang::get('User successfully created.'));
$fCreateUser->clear();
}
示例10: array
include PERCH_PATH . '/core/inc/sidebar_start.php';
echo $HTML->para('Update your category set.');
include PERCH_PATH . '/core/inc/sidebar_end.php';
include PERCH_PATH . '/core/inc/main_start.php';
include '_subnav.php';
if ($Set) {
echo $HTML->heading1('Editing ‘%s’ Category Set', $Set->setTitle());
} else {
echo $HTML->heading1('Adding a New Category Set');
}
// Set up a smartbar
if ($Set) {
echo $HTML->smartbar($HTML->smartbar_breadcrumb(false, array('link' => PERCH_LOGINPATH . '/core/apps/categories/sets/?id=' . $Set->id(), 'label' => $Set->setTitle())), $HTML->smartbar_link(true, array('link' => PERCH_LOGINPATH . '/core/apps/categories/sets/edit?id=' . $Set->id(), 'label' => PerchLang::get('Set Options'))), $HTML->smartbar_link(false, array('link' => PERCH_LOGINPATH . '/core/apps/categories/reorder/?id=' . $Set->id(), 'label' => PerchLang::get('Reorder Categories'), 'class' => 'icon reorder'), true));
} else {
echo $HTML->smartbar($HTML->smartbar_breadcrumb(true, array('link' => PERCH_LOGINPATH . '/core/apps/categories/sets/', 'label' => PerchLang::get('New Set'))));
}
// If a success or failure message has been set, output that here
echo $message;
// Sub head
echo $HTML->heading2('Details');
// Output the edit form
echo $Form->form_start();
$details = array();
if (is_object($Set)) {
$details = $Set->to_array();
}
echo $Form->fields_from_template($Template, $details, array(), false);
$opts = array();
$templates = $Sets->get_templates();
if (PerchUtil::count($templates)) {
示例11: PerchUserRoles
PerchUtil::redirect(PERCH_LOGINPATH . '/users');
}
$Roles = new PerchUserRoles();
$roles = $Roles->all();
/* --------- Edit User Form ----------- */
$Form = new PerchForm('user', false);
$req = array();
$req['userUsername'] = "Required";
$req['userGivenName'] = "Required";
$req['userFamilyName'] = "Required";
$req['userEmail'] = "Required";
if ($User->id() != $CurrentUser->id()) {
$req['roleID'] = "Required";
}
$Form->set_required($req);
$validation = array();
$validation['userUsername'] = array("username", PerchLang::get("Username not available, try another."), array('userID' => $User->id()));
$validation['userEmail'] = array("email", PerchLang::get("Email incomplete or already in use."), array('userID' => $User->id()));
$Form->set_validation($validation);
if ($Form->posted() && $Form->validate()) {
$data = array();
$postvars = array('userUsername', 'userGivenName', 'userFamilyName', 'userEmail', 'roleID');
$data = $Form->receive($postvars);
$User->update($data);
$Alert->set('success', PerchLang::get('User successfully updated.'));
}
if (isset($_POST['resetPwd']) && $_POST['resetPwd'] == '1') {
$User->reset_pwd_and_notify();
$Alert->set('success', PerchLang::get('A new password has been sent by email.'));
}
$details = $User->to_array();
示例12:
"><?php
echo PerchLang::get('Reorder Pages');
?>
</a></li><?php
}
?>
</ul>
<?php
/* ----------------------------------------- /SMART BAR ----------------------------------------- */
?>
<h2><?php
echo PerchLang::get('Details');
?>
</h2>
<form method="post" action="<?php
echo PerchUtil::html($Form->action());
?>
" class="sectioned">
<div class="field">
<?php
echo $Form->label('groupTitle', 'Title');
?>
<?php
echo $Form->text('groupTitle', $Form->get($details, 'groupTitle'));
?>
</div>
示例13: PerchAlert
<?php
include __DIR__ . '/../../../inc/pre_config.php';
include __DIR__ . '/../../../../config/config.php';
include PERCH_CORE . '/inc/loader.php';
$Perch = PerchAdmin::fetch();
include PERCH_CORE . '/inc/auth.php';
if (!$CurrentUser->has_priv('perch.users.manage')) {
PerchUtil::redirect(PERCH_LOGINPATH);
}
$Perch->page_title = PerchLang::get('Manage Roles');
$Alert = new PerchAlert();
include PERCH_CORE . '/users/modes/roles.edit.pre.php';
include PERCH_CORE . '/inc/top.php';
include PERCH_CORE . '/users/modes/roles.edit.post.php';
include PERCH_CORE . '/inc/btm.php';
示例14: array
//$opts[PerchLang::get('General')][] = array('label'=>PerchLang::get('Local file'), 'value'=>'');
echo $Form->grouped_select('templateID', $opts, $Form->get($details, 'templateID'));
} else {
echo '<a href="' . PERCH_LOGINPATH . '/core/apps/content/page/templates/">' . PerchLang::get('Manage templates') . '</a>';
}
} else {
$templates = $Templates->all();
$opts = array();
if (PerchUtil::count($templates)) {
foreach ($templates as $Template) {
$opts[] = array('label' => $Template->templateTitle(), 'value' => $Template->id());
}
$opts[] = array('label' => PerchLang::get('Page already exists, or is a link only'), 'value' => '');
echo $Form->select('templateID', $opts, $Form->get($details, 'templateID'));
} else {
echo '<a href="' . PERCH_LOGINPATH . '/core/apps/content/page/templates/">' . PerchLang::get('Manage templates') . '</a>';
}
}
?>
</div>
<?php
if (!PERCH_RUNWAY) {
?>
<div class="field checkboxes labelless">
<div class="checkbox">
<?php
echo $Form->checkbox('create_folder', '1', $Form->get($details, 'create_folder'));
?>
<?php
echo $Form->label('create_folder', 'This page will have more pages below it');
?>
示例15: PerchAlert
<?php
include __DIR__ . '/../../../../inc/pre_config.php';
include __DIR__ . '/../../../../../config/config.php';
include PERCH_CORE . '/inc/loader.php';
if (!PERCH_RUNWAY) {
PerchUtil::redirect(PERCH_LOGINPATH . '/core/settings/');
}
$Perch = PerchAdmin::fetch();
include PERCH_CORE . '/inc/auth.php';
if (!$CurrentUser->has_priv('perch.settings')) {
PerchUtil::redirect(PERCH_LOGINPATH);
}
$Perch->page_title = PerchLang::get('Restore Backup');
$Alert = new PerchAlert();
$app_path = __DIR__ . '/../../..';
include PERCH_CORE . '/runway/settings/inc/backup.php';
include PERCH_CORE . '/runway/settings/modes/backup.general.restore.pre.php';
include PERCH_CORE . '/inc/top.php';
include PERCH_CORE . '/runway/settings/modes/backup.general.restore.post.php';
include PERCH_CORE . '/inc/btm.php';