本文整理汇总了PHP中Loader::helper方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::helper方法的具体用法?PHP Loader::helper怎么用?PHP Loader::helper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::helper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllowedFileExtensions
public function getAllowedFileExtensions()
{
$u = new User();
$extensions = array();
if ($u->isSuperUser()) {
$extensions = Loader::helper('concrete/file')->getAllowedFileExtensions();
return $extensions;
}
$pae = $this->getPermissionAccessObject();
if (!is_object($pae)) {
return array();
}
$accessEntities = $u->getUserAccessEntityObjects();
$accessEntities = $pae->validateAndFilterAccessEntities($accessEntities);
$list = $this->getAccessListItems(FileSetPermissionKey::ACCESS_TYPE_ALL, $accessEntities);
$list = PermissionDuration::filterByActive($list);
foreach ($list as $l) {
if ($l->getFileTypesAllowedPermission() == 'N') {
$extensions = array();
}
if ($l->getFileTypesAllowedPermission() == 'C') {
$extensions = array_unique(array_merge($extensions, $l->getFileTypesAllowedArray()));
}
if ($l->getFileTypesAllowedPermission() == 'A') {
$extensions = Loader::helper('concrete/file')->getAllowedFileExtensions();
}
}
return $extensions;
}
示例2: update_modern_thumbnail
function update_modern_thumbnail()
{
if ($this->token->validate('update_modern_thumbnail')) {
if (intval($this->post('remove_icon')) == 1) {
Config::save('MODERN_TILE_THUMBNAIL_FID', 0);
$this->redirect('/dashboard/system/basics/icons/', 'modern_icon_removed');
} else {
Loader::library('file/importer');
$fi = new FileImporter();
$resp = $fi->import($_FILES['favicon_file']['tmp_name'], $_FILES['favicon_file']['name'], $fr);
if (!$resp instanceof FileVersion) {
switch ($resp) {
case FileImporter::E_FILE_INVALID_EXTENSION:
$this->error->add(t('Invalid file extension.'));
break;
case FileImporter::E_FILE_INVALID:
$this->error->add(t('Invalid file.'));
break;
}
} else {
Config::save('MODERN_TILE_THUMBNAIL_FID', $resp->getFileID());
Config::save('MODERN_TILE_THUMBNAIL_BGCOLOR', Loader::helper('security')->sanitizeString($this->post('favicon_bgcolor')));
$this->redirect('/dashboard/system/basics/icons/', 'modern_icon_saved');
}
}
} else {
$this->set('error', array($this->token->getErrorMessage()));
}
}
示例3: view
public function view($nodeID = 1, $auxMessage = false)
{
$dh = Loader::helper('concrete/dashboard/sitemap');
if ($dh->canRead()) {
$this->set('nodeID', $nodeID);
$nodes = $dh->getSubNodes($nodeID, 1, false, false);
$instanceID = time();
$this->set('listHTML', $dh->outputRequestHTML($instanceID, 'explore', false, $nodes));
$this->set('instanceID', $instanceID);
}
if (isset($_REQUEST['task']) && isset($_REQUEST['cNodeID'])) {
$nc = Page::getByID($_REQUEST['cNodeID']);
if ($_REQUEST['task'] == 'send_to_top') {
$nc->movePageDisplayOrderToTop();
} else {
if ($_REQUEST['task'] == 'send_to_bottom') {
$nc->movePageDisplayOrderToBottom();
}
}
$this->redirect('/dashboard/sitemap/explore', $nc->getCollectionParentID(), 'order_updated');
}
if ($auxMessage != false) {
switch ($auxMessage) {
case 'order_updated':
$this->set('message', t('Sort order saved'));
break;
}
}
$this->set('dh', $dh);
}
示例4: execute
public function execute($encrypt = false) {
$db = Loader::db();
if (!file_exists(DIR_FILES_BACKUPS)) {
mkdir(DIR_FILES_BACKUPS);
file_put_contents(DIR_FILES_BACKUPS . "/.htaccess","Order Deny,Allow\nDeny from all");
}
$str_bkupfile = "dbu_". time() .".sql";
$arr_tables = $db->getCol("SHOW TABLES FROM `" . DB_DATABASE . "`");
foreach ($arr_tables as $bkuptable) {
$tableobj = new Concrete5_Library_Backup_BackupTable($bkuptable);
$str_backupdata .= "DROP TABLE IF EXISTS $bkuptable;\n\n";
$str_backupdata .= $tableobj->str_createTableSql . "\n\n";
if ($tableobj->str_createTableSql != "" ) {
$str_backupdata .= $tableobj->str_insertionSql . "\n\n";
}
}
$fh_backupfile = @fopen(DIR_FILES_BACKUPS . "/". $str_bkupfile,"w");
if (!$fh_backupfile) {
throw new Exception(t('Unable to create backup file: %s', $str_bkupfile));
}
if ($encrypt == true) {
$crypt = Loader::helper('encryption');
fwrite($fh_backupfile,$crypt->encrypt($str_backupdata));
} else {
fwrite($fh_backupfile,$str_backupdata);
}
fclose($fh_backupfile);
//for security
chmod(DIR_FILES_BACKUPS . "/". $str_bkupfile,000);
}
示例5: view
public function view($page = 0)
{
$this->set('title', t('Logs'));
$pageBase = View::url('/dashboard/reports/logs', 'view');
$paginator = Loader::helper('pagination');
$total = Log::getTotal($_REQUEST['keywords'], $_REQUEST['logType']);
$paginator->init(intval($page), $total, $pageBase . '/%pageNum%/?keywords=' . $_REQUEST['keywords'] . '&logType=' . $_REQUEST['logType'], 10);
$limit = $paginator->getLIMIT();
$types = Log::getTypeList();
$txt = Loader::helper('text');
$logTypes = array();
$logTypes[''] = '** ' . t('All');
foreach ($types as $t) {
if ($t == '') {
$logTypes[''] = '** ' . t('All');
} else {
$logTypes[$t] = $txt->unhandle($t);
}
}
$entries = Log::getList($_REQUEST['keywords'], $_REQUEST['logType'], $limit);
$this->set('keywords', $keywords);
$this->set('pageBase', $pageBase);
$this->set('entries', $entries);
$this->set('paginator', $paginator);
$this->set('logTypes', $logTypes);
}
示例6: __construct
public function __construct()
{
parent::__construct();
$html = Loader::helper('html');
$this->set('av', Loader::helper('concrete/avatar'));
$this->addHeaderItem($html->javascript('swfobject.js'));
}
示例7: update_library
public function update_library()
{
if (Loader::helper("validation/token")->validate('update_library')) {
if ($this->post('activeLibrary')) {
$scl = SystemAntispamLibrary::getByHandle($this->post('activeLibrary'));
if (is_object($scl)) {
$scl->activate();
Config::save('ANTISPAM_NOTIFY_EMAIL', $this->post('ANTISPAM_NOTIFY_EMAIL'));
Config::save('ANTISPAM_LOG_SPAM', $this->post('ANTISPAM_LOG_SPAM'));
if ($scl->hasOptionsForm() && $this->post('ccm-submit-submit')) {
$controller = $scl->getController();
$controller->saveOptions($this->post());
}
$this->redirect('/dashboard/system/permissions/antispam', 'saved');
} else {
$this->error->add(t('Invalid anti-spam library.'));
}
} else {
SystemAntispamLibrary::deactivateAll();
}
} else {
$this->error->add(Loader::helper('validation/token')->getErrorMessage());
}
$this->view();
}
示例8: add_set
public function add_set()
{
$this->category($this->post('categoryID'));
if ($this->token->validate('add_set')) {
if (!trim($this->post('asHandle'))) {
$this->error->add(t("Specify a handle for your attribute set."));
} else {
$as = AttributeSet::getByHandle($this->post('asHandle'));
if (is_object($as)) {
$this->error->add(t('That handle is in use.'));
}
}
if (!trim($this->post('asName'))) {
$this->error->add(t("Specify a name for your attribute set."));
} else {
if (preg_match('/[<>;{}?"`]/', trim($this->post('asName')))) {
$this->error->add(t('Name cannot contain the characters: %s', Loader::helper('text')->entities('<>;{}?`')));
}
}
if (!$this->error->has()) {
if (!$this->category->allowAttributeSets()) {
$this->category->setAllowAttributeSets(AttributeKeyCategory::ASET_ALLOW_SINGLE);
}
$this->category->addSet($this->post('asHandle'), $this->post('asName'), false, 0);
$this->redirect('dashboard/system/attributes/sets', 'category', $this->category->getAttributeKeyCategoryID(), 'set_added');
}
} else {
$this->error->add($this->token->getErrorMessage());
}
}
示例9: view
public function view($userID = 0)
{
if (!ENABLE_USER_PROFILES) {
$this->render("/page_not_found");
}
$html = Loader::helper('html');
$canEdit = false;
$u = new User();
if ($userID > 0) {
$profile = UserInfo::getByID($userID);
if (!is_object($profile)) {
throw new Exception('Invalid User ID.');
}
} else {
if ($u->isRegistered()) {
$profile = UserInfo::getByID($u->getUserID());
$canEdit = true;
} else {
$this->set('intro_msg', t('You must sign in order to access this page!'));
$this->render('/login');
}
}
$this->set('profile', $profile);
$this->set('av', Loader::helper('concrete/avatar'));
$this->set('t', Loader::helper('text'));
$this->set('canEdit', $canEdit);
}
示例10: display
/**
* Display the captcha
*/
public function display()
{
// @TODO: How do we properly print a picture using a helper function?
$ci = Loader::helper('concrete/urls');
echo '<img src="' . $ci->getToolsURL('captcha') . '?nocache=' . time() . '" alt="' . t('Captcha Code') . '" onclick="this.src = \'' . $ci->getToolsURL('captcha') . '?nocache=' . $time . '\'" class="ccm-captcha-image" />';
echo t('Click the image to see another captcha.');
}
示例11: view
public function view()
{
$uh = Loader::helper('concrete/urls');
$bt = BlockType::getByHandle('switch_language');
Loader::model('section', 'multilingual');
$ml = MultilingualSection::getList();
$c = Page::getCurrentPage();
$al = MultilingualSection::getBySectionOfSite($c);
$languages = array();
$locale = ACTIVE_LOCALE;
if (is_object($al)) {
$locale = $al->getLanguage();
}
foreach ($ml as $m) {
$languages[$m->getCollectionID()] = $m->getLanguageText($locale) . ' ' . (strlen($m->msIcon) ? '(' . $m->msIcon . ')' : '');
}
$this->set('languages', $languages);
$this->set('languageSections', $ml);
$this->set('action', $uh->getBlockTypeToolsURL($bt) . '/switch');
if (is_object($al)) {
$this->set('activeLanguage', $al->getCollectionID());
}
$pkg = Package::getByHandle('multilingual');
$mdl = Loader::helper('default_language', 'multilingual');
$this->set('defaultLanguage', $mdl->getSessionDefaultLocale());
$this->set('cID', $c->getCollectionID());
}
示例12: view
public function view($updated = false)
{
Loader::library('database_indexed_search');
if ($this->post('reindex')) {
IndexedSearch::clearSearchIndex();
$this->redirect('/dashboard/system/seo/search_index', 'index_cleared');
} else {
if ($updated) {
$this->set('message', t('Search Index Preferences Updated'));
}
if ($this->isPost()) {
if ($this->token->validate('update_search_index')) {
$areas = $this->post('arHandle');
if (!is_array($areas)) {
$areas = array();
}
Config::save('SEARCH_INDEX_AREA_LIST', serialize($areas));
Config::save('SEARCH_INDEX_AREA_METHOD', Loader::helper('security')->sanitizeString($this->post('SEARCH_INDEX_AREA_METHOD')));
$this->redirect('/dashboard/system/seo/search_index', 'updated');
} else {
$this->set('error', array($this->token->getErrorMessage()));
}
}
$areas = Area::getHandleList();
$selectedAreas = array();
$this->set('areas', $areas);
$this->set('selectedAreas', IndexedSearch::getSavedSearchableAreas());
}
}
示例13: flush
public function flush()
{
$fh = Loader::helper("file");
$fh->removeAll(DIR_FILES_PAGE_CACHE);
/* WEIYM: tune to support cache for mobile */
$fh->removeAll(DIR_FILES_PAGE_CACHE_MOBILE);
}
示例14: getThumbnailRelativePath
public function getThumbnailRelativePath($prefix, $filename, $level)
{
switch ($level) {
case 2:
$rel = REL_DIR_FILES_UPLOADED_THUMBNAILS_LEVEL2;
$base = DIR_FILES_UPLOADED_THUMBNAILS_LEVEL2;
break;
case 3:
$rel = REL_DIR_FILES_UPLOADED_THUMBNAILS_LEVEL3;
$base = DIR_FILES_UPLOADED_THUMBNAILS_LEVEL3;
break;
default:
// level 1
$rel = REL_DIR_FILES_UPLOADED_THUMBNAILS;
$base = DIR_FILES_UPLOADED_THUMBNAILS;
break;
}
$hi = Loader::helper('file');
$fullpath = $this->mapSystemPath($prefix, $filename, $createDirectories, $base);
if (!file_exists($fullpath)) {
$filename = $hi->replaceExtension($filename, 'jpg');
}
$path = $this->mapSystemPath($prefix, $filename, $createDirectories, $rel);
return $path;
}
示例15: init
public function init()
{
Loader::helper('admin:global');
$list = template_list(1);
$big_menu = big_menu('?app=template&controller=style&action=import', 'import', L('import_style'), 500, 250);
include $this->view('style_list');
}