本文整理汇总了PHP中dir::addon方法的典型用法代码示例。如果您正苦于以下问题:PHP dir::addon方法的具体用法?PHP dir::addon怎么用?PHP dir::addon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dir
的用法示例。
在下文中一共展示了dir::addon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveFile
public static function saveFile($file, $form)
{
if (!is_uploaded_file($file['tmp_name'])) {
return $form;
}
$fileName = mediaUtils::fixFileName($file['name']);
$fileDir = dir::media($fileName);
$extension = substr(strrchr($fileName, '.'), 1);
// z.B. jpg
$media = json_decode(file_get_contents(dir::addon('mediamanager', 'config.json')), true);
// Wenn die Datei eine "verbotene" Datei ist
if (in_array($extension, $media['badExtensions'])) {
$form->setSave(false);
$form->setErrorMessage(sprintf(lang::get('media_error_bad_extension'), $file['name']));
return $form;
}
if ($form->isEditMode()) {
$media = new media(type::super('id', 'int', 0));
}
// Wenn Datei nicht Existiert
// Oder man möchte sie überspeichern
if ($form->isEditMode() && $media->get('filename') != $fileName || !$form->isEditMode() && file_exists($fileDir)) {
$form->setSave(false);
$form->setErrorMessage(sprintf(lang::get('media_error_already_exist'), $file['name']));
return $form;
}
if (!move_uploaded_file($file['tmp_name'], $fileDir)) {
$form->setSave(false);
$form->setErrorMessage(sprintf(lang::get('media_error_move'), $file['name']));
return $form;
}
$form->addPost('filename', $fileName);
$form->addPost('size', filesize($fileDir));
return $form;
}
示例2: getConfig
public static function getConfig($name)
{
$configFile = dir::addon($name, 'config.json');
if (file_exists($configFile)) {
return json_decode(file_get_contents($configFile), true);
}
return false;
}
示例3: saveConfig
public static function saveConfig($from, $fromName, $confirmReading, $bbc)
{
$config = dyn::get('addons')['phpmailer'];
$config['settings']['from'] = $from;
$config['settings']['fromName'] = $fromName;
$config['settings']['confirmReading'] = $confirmReading;
$config['settings']['bbc'] = $bbc;
return file_put_contents(dir::addon('phpmailer', 'config.json'), json_encode($config, JSON_PRETTY_PRINT));
}
示例4: sendLostPasswordMail
public static function sendLostPasswordMail($email)
{
$sql = sql::factory();
$sql->query('SELECT id FROM ' . sql::table('community_user') . ' WHERE `email` = ' . $sql->escape($email));
if (!$sql->num()) {
return 'Keinen User mit der E-Mail-Adresse vorhanden';
}
$content = file_get_contents(dir::addon('community', 'lostpasswordemail.txt'));
$key = self::generateString(16);
$url = dyn::get('hp_url') . 'index.php?lostpassword=' . $key;
$content = str_replace('{{url}}', $url, $content);
// Mailsend
$sql->setTable('community_user');
$sql->setWhere('id=' . $sql->get('id'));
$sql->addPost('lostpw_key', $key);
$sql->update();
}
示例5: generatePathlist
public static function generatePathlist()
{
$return = [];
$sql = sql::factory();
$sql->query('SELECT name, id, seo_costum_url, parent_id FROM ' . sql::table('structure'))->result();
while ($sql->isNext()) {
if ($sql->get('seo_costum_url')) {
$name = $sql->get('seo_costum_url');
} else {
$name = self::makeSEOName($sql->get('name'));
}
if ($sql->get('parent_id')) {
$name = self::getParentsName($sql->get('parent_id')) . '/' . $name;
}
$return[$name] = $sql->get('id');
$sql->next();
}
return file_put_contents(dir::addon('seo', 'pathlist.json'), json_encode($return, JSON_PRETTY_PRINT));
}
示例6: generatePathlist
public static function generatePathlist()
{
$return = [];
$sql = sql::factory();
$sql->query('SELECT name, id, seo_costum_url, parent_id FROM ' . sql::table('structure'))->result();
while ($sql->isNext()) {
if ($sql->get('seo_costum_url')) {
$name = $sql->get('seo_costum_url');
} else {
$name = self::makeSEOName($sql->get('name'));
}
if ($sql->get('parent_id')) {
$name = self::getParentsName($sql->get('parent_id')) . '/' . $name;
}
if ($sql->get('id') == dyn::get('start_page') && dyn::get('addons')['seo']['start_url'] == 0) {
$name = '';
}
$return[$name] = (int) $sql->get('id');
$sql->next();
}
$return = extension::get('SEO_GENERATE_PATHLIST', $return);
return file_put_contents(dir::addon('seo', 'pathlist.json'), json_encode($return, JSON_PRETTY_PRINT));
}
示例7: seo_robots
if ($seoFunc == 'robots') {
$robots = new seo_robots();
$robots->send();
die;
}
if ($seoFunc == 'sitemap') {
$sitemap = new seo_sitemap();
$sitemap->setArticles(dyn::get('addons')['seo']['sitemap']['offlines']);
$sitemap->send();
die;
}
} else {
userPerm::add('admin[seo]', 'SEO Administrator');
seo_control::addToPathlist('default', seo_control::getUrlsFromTable('addons', ['id', 'name']));
backend::addAddonNavi(lang::get('seo'), url::backend('seo'), 'flag', -1, function () {
return dir::addon('seo', 'page' . DIRECTORY_SEPARATOR . 'seo.php');
});
seo::setPageId(dyn::get('start_page'));
$page = type::super('page', 'string');
$subpage = type::super('subpage', 'string');
$action = type::super('action', 'string');
$structure_id = type::super('structure_id', 'int', 0);
$id = type::super('id', 'int', 0);
// Falls was an der Page geändert worden ist
if ($page == 'structure' && $subpage == 'pages' && in_array($action, ['add', 'edit', 'seo']) && !$structure_id) {
extension::add('FORM_AFTER_SAVE', function ($sql) {
seo_rewrite::generatePathlist();
return $sql;
});
}
// Wenn SEO Button geklickt worden ist
示例8: function
<?php
backend::addAddonNavi(lang::get('imexport'), url::backend('import'), 'circle', -1, function () {
return dir::addon('imexport', 'page' . DIRECTORY_SEPARATOR . 'import.php');
});
示例9:
<?php
}
?>
<a href="<?php
echo url::backend('addons', ['subpage' => 'overview']);
?>
" class="btn btn-sm btn-default"><?php
echo lang::get('back');
?>
</a>
</div>
<div class="clearfix"></div>
</div>
<div class="panel-body">
<?php
$file = dir::addon($addon, 'README.md');
if (file_exists($file)) {
echo markdown::parse(file_get_contents($file));
} else {
echo lang::get('addon_no_readme');
}
?>
</div>
</div>
</div>
</div>
<?php
} else {
$table = table::factory();
$table->addCollsLayout('20,*,215');
$table->addRow()->addCell('')->addCell(lang::get('name'))->addCell(lang::get('actions'));
示例10: copy
<?php
$sql = sql::factory();
$sql->query('ALTER TABLE ' . sql::table('structure') . '
ADD `seo_title` VARCHAR(255) NOT NULL,
ADD `seo_keywords` VARCHAR(255) NOT NULL,
ADD `seo_description` VARCHAR(255) NOT NULL,
ADD `seo_costum_url` VARCHAR(255) NOT NULL,
ADD `seo_robots` int(1) NOT NULL DEFAULT "1"
');
copy(dir::addon('seo', '_htaccess'), dir::base('.htaccess'));
include_once dir::addon('seo', 'lib' . DIRECTORY_SEPARATOR . 'seo_rewrite.php');
seo_rewrite::generatePathlist();
示例11: trim
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><?php
echo lang::get('htacces_install');
?>
</h3>
</div>
<div class="panel-body">
<?php
$form = form::factory('user', 'id=' . dyn::get('user')->get('id'), 'index.php');
$form->setSave(false);
$form->delButton('back');
$form->delButton('save');
$htaccessRoot = dir::base('.htaccess');
$htaccessOrg = dir::addon('seo', '_htaccess');
$field = $form->addRadioField('redirect', 'www');
$field->fieldName(lang::get('seo_redirect_to'));
$field->add('www', 'www.');
$field->add('no_www', lang::get('seo_no_www'));
$urlPath = parse_url(dyn::get('hp_url'));
$subdir = '/';
if (isset($urlPath['path'])) {
$subdir = trim($urlPath['path'], '/');
}
if ($subdir == '') {
$subdir = '/';
}
$field = $form->addTextField('rewrite_base', $subdir);
$field->addAttribute('readonly', 'readonly');
$field->fieldName('Rewrite Base');
示例12: delete
public function delete()
{
$this->uninstall();
$sql = sql::factory();
$sql->setTable('addons')->setWhere('`name` = "' . $this->name . '"')->delete();
unlink(dir::addon($this->name));
return message::success(sprintf(lang::get('addon_deleted'), $this->name));
}
示例13: getSubnaviInclude
public static function getSubnaviInclude($addon = false)
{
self::setCurrents();
$page = self::$getVars[0];
$subpage = self::$getVars[1];
$current = self::$subnavi[self::getSubpageName()];
// isset gibts bei null false aus
if (isset($current['callback']) && is_callable($current['callback'])) {
return $current['callback']();
}
if (!$addon) {
return dir::page($page . '.' . $subpage . '.php');
} else {
return dir::addon($addon, 'page/' . $page . '.' . $subpage . '.php');
}
}
示例14: isImage
public function isImage()
{
$media = json_decode(file_get_contents(dir::addon('mediamanager', 'config.json')), true);
return in_array($this->getExtension(), $media['extensions']['image']);
}
示例15: function
userPerm::add('media[category][delete]', lang::get('media[category][delete]'));
if (dyn::get('user')->hasPerm('media[edit]') || dyn::get('user')->hasPerm('media[delete]') || dyn::get('user')->hasPerm('media[category][edit]') || dyn::get('user')->hasPerm('media[category][delete]')) {
backend::addNavi(lang::get('media'), url::backend('media'), 'picture-o', 2, function () {
return dir::addon('mediamanager', 'page' . DIRECTORY_SEPARATOR . 'media.php');
});
}
form::addClassMethod('addMediaField', function ($name, $value) {
return $this->addField($name, $value, 'formMedia');
});
form::addClassMethod('addMediaListField', function ($name, $value) {
return $this->addField($name, $value, 'formMediaList');
});
$page = type::super('page', 'string');
$subpage = type::super('subpage', 'string');
$action = type::super('action', 'string');
pageArea::addType('varsMedia');
pageArea::addType('varsMedialist');
if (addonConfig::isActive('metainfos')) {
metainfosPage::addType('DYN_MEDIA');
metainfosPage::addType('DYN_MEDIA_LIST');
if ($page == 'meta') {
backend::addSubNavi(lang::get('media'), url::backend('meta', ['subpage' => 'media']), 'circle', -1, function () {
return dir::addon('mediamanager', 'page' . DIRECTORY_SEPARATOR . 'meta.media.php');
});
}
if ($page == 'media' && $subpage == 'files' && in_array($action, ['add', 'edit'])) {
extension::add('FORM_BEFORE_ACTION', function ($form) {
$form = metainfos::getMetaInfos($form, 'media');
});
}
}