当前位置: 首页>>代码示例>>PHP>>正文


PHP PerchLang类代码示例

本文整理汇总了PHP中PerchLang的典型用法代码示例。如果您正苦于以下问题:PHP PerchLang类的具体用法?PHP PerchLang怎么用?PHP PerchLang使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PerchLang类的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;
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:35,代码来源:PerchCategories_Sets.class.php

示例2: get_lang_options

 public static function get_lang_options()
 {
     $Lang = PerchLang::fetch();
     $out = array();
     // Addons folder
     if (is_dir(PerchUtil::file_path(PERCH_PATH . '/addons/lang'))) {
         $lang_dir = PerchUtil::file_path(PERCH_PATH . '/addons/lang');
         $files = PerchUtil::get_dir_contents($lang_dir, false);
         if (is_array($files)) {
             foreach ($files as $file) {
                 $out[] = PerchUtil::strip_file_extension($file);
             }
         }
     }
     // Core folder
     $lang_dir = PerchUtil::file_path(PERCH_CORE . '/lang');
     if (is_dir($lang_dir)) {
         $files = PerchUtil::get_dir_contents($lang_dir, false);
         if (is_array($files)) {
             foreach ($files as $file) {
                 $f = PerchUtil::strip_file_extension($file);
                 if (!in_array($f, $out)) {
                     $out[] = $f;
                 }
             }
         }
     }
     if (PerchUtil::count($out)) {
         sort($out);
         return $out;
     }
     return false;
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:33,代码来源:PerchLang.class.php

示例3: 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;
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:26,代码来源:PerchContent_PageTemplates.class.php

示例4: __construct

 function __construct($version = 1.0, $app_id)
 {
     $this->app_id = $app_id;
     $this->version = $version;
     if (!defined('PERCH_APPS_EDITOR_PLUGIN')) {
         define('PERCH_APPS_EDITOR_PLUGIN', 'markitup');
     }
     if (!defined('PERCH_APPS_EDITOR_MARKUP_LANGUAGE')) {
         define('PERCH_APPS_EDITOR_MARKUP_LANGUAGE', 'textile');
     }
     if (strpos($app_id, '_') === false) {
         $this->Lang = PerchLang::fetch();
     }
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:14,代码来源:PerchAPI.class.php

示例5: 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;
 }
开发者ID:scottbrabazon,项目名称:scottbrabazon.com,代码行数:51,代码来源:PerchForms_Forms.class.php

示例6:

            </form>
<?php 
}
// token_expired
if ($mode == 'password_set') {
    ?>
            <form action="<?php 
    echo PerchUtil::html(PERCH_LOGINPATH);
    ?>
/" method="post" class="reset">
                <p class="instructions"><?php 
    echo PerchLang::get('Thank you. Your new password has been set and you can now log in using it.');
    ?>
</p>
                <p class="instructions"><?php 
    echo PerchLang::get('%sLog in%s', '<a href="' . PerchUtil::html(PERCH_LOGINPATH) . '" class="button">', '</a>');
    ?>
</p>
            </form>
<?php 
}
// password_set
?>

        </div>

    </div>


<?php 
include PERCH_CORE . '/inc/btm.php';
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:31,代码来源:index.php

示例7: foreach

	<h2>
		<?php 
echo PerchLang::get('Pages');
if ($CurrentUser->has_priv('content.pages.create')) {
    echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/core/apps/content/page/add/') . '" class="add button">' . PerchLang::get('Add Page') . '</a>';
}
?>
	</h2>
	<div class="bd">
		<?php 
if (PerchUtil::count($pages)) {
    echo '<ul>';
    if (PerchUtil::count($shared)) {
        echo '<li>';
        echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH) . '/core/apps/content/page/?id=-1">';
        echo PerchUtil::html(PerchLang::get('Shared'));
        echo '</a>';
        echo '</li>';
    }
    foreach ($pages as $Page) {
        echo '<li>';
        echo '<a href="' . PerchUtil::html(PERCH_LOGINPATH . '/core/apps/content/page/?id=' . $Page->id()) . '">';
        echo PerchUtil::html($Page->pageNavText());
        echo '</a>';
        echo '</li>';
    }
    echo '</ul>';
}
?>
	</div>
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:30,代码来源:dashboard.php

示例8: 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();
}
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:31,代码来源:edit.pre.php

示例9: 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');
    ?>
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:31,代码来源:page.add.post.php

示例10: 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();
}
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:30,代码来源:add.pre.php

示例11:

">
                <?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';
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:31,代码来源:edit.post.php

示例12: foreach

 include '_app_settings.pre.php';
 $data = $Form->receive($postvars);
 foreach ($checkboxes as $checkbox) {
     if (!isset($data[$checkbox])) {
         $data[$checkbox] = '0';
     }
 }
 if (isset($_POST['logo_remove']) && $_POST['logo_remove'] == '1') {
     $data['logoPath'] = '';
 }
 foreach ($data as $key => $value) {
     $Settings->set($key, $value);
 }
 $Lang = PerchLang::fetch();
 $Lang->reload();
 $Alert->set('success', PerchLang::get("Your settings have been updated."));
 // image upload
 if (isset($_FILES['customlogo']) && (int) $_FILES['customlogo']['size'] > 0) {
     if (is_array(getimagesize($_FILES['customlogo']['tmp_name']))) {
         $filename = $_FILES['customlogo']['name'];
         if (strpos($filename, '.php') !== false) {
             $filename .= '.txt';
         }
         // diffuse PHP files
         $target = PERCH_RESFILEPATH . '/' . $filename;
         if (file_exists($target)) {
             $filename = time() . '_' . $_FILES['customlogo']['name'];
             $target = PERCH_RESFILEPATH . '/' . $filename;
         }
         PerchUtil::move_uploaded_file($_FILES['customlogo']['tmp_name'], $target);
         $Settings->set('logoPath', PERCH_RESPATH . '/' . $filename);
开发者ID:TodayIShould,项目名称:todayishould_website,代码行数:31,代码来源:basic.pre.php

示例13:

?>
            </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';
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:31,代码来源:roles.actions.post.php

示例14: 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)) {
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:30,代码来源:sets.edit.post.php

示例15: next

        }
        $c = '';
        $next_item = next($settings_copy);
        if ($next_item) {
            if ($next_item['app_id'] != $setting['app_id']) {
                $c = ' last';
            }
        }
        ?>
        <div class="field <?php 
        echo $Form->error($id, false);
        echo $c;
        ?>
">
            <?php 
        echo $Form->label($id, $app['id'] == 'content' ? PerchLang::get($setting['label']) : $Lang->get($setting['label']), false, false, false);
        ?>
            <?php 
        switch ($setting['type']) {
            case 'text':
                echo $Form->text($id, $Form->get($details, $id, $setting['default']));
                break;
            case 'checkbox':
                echo $Form->checkbox($id, true, $Form->get($details, $id));
                break;
            case 'textarea':
                echo $Form->textarea($id, $Form->get($details, $id, $setting['default']));
                break;
            case 'select':
                if (PerchUtil::count($setting['opts'])) {
                    foreach ($setting['opts'] as &$opt) {
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:31,代码来源:_app_settings.post.php


注:本文中的PerchLang类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。