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


PHP Application::config方法代码示例

本文整理汇总了PHP中Pagekit\Application::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::config方法的具体用法?PHP Application::config怎么用?PHP Application::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pagekit\Application的用法示例。


在下文中一共展示了Application::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveAction

 /**
  * @Request({"config": "array"}, csrf=true)
  * @Access(admin=true)
  */
 public function saveAction($config = [])
 {
     if (count($config)) {
         App::config('tipbutton')->set("stripe_settings", $config["stripe_settings"]);
     }
     return ['message' => 'success'];
 }
开发者ID:philoest,项目名称:tipbutton,代码行数:11,代码来源:TipController.php

示例2: getUrl

 /**
  * @param int        $category_id
  * @param bool|false $base
  * @return string|bool
  */
 public function getUrl($category_id = 0, $base = false)
 {
     $category_id = $category_id ?: $this->get('primary_category', 0);
     if (!$category_id || App::config('bixie/download')->get('routing') == 'item') {
         return App::url('@download/id', ['id' => $this->id ?: 0], $base);
     } else {
         return App::url('@download/category/file/' . $category_id, ['id' => $this->id ?: 0], $base);
     }
 }
开发者ID:Bixie,项目名称:pagekit-download,代码行数:14,代码来源:File.php

示例3: loginAction

 /**
  * @Route(defaults={"_maintenance"=true})
  * @Request({"redirect"})
  */
 public function loginAction($redirect = '')
 {
     if (!$redirect) {
         $redirect = App::url(App::config('system/user')['login_redirect']);
     }
     if (App::user()->isAuthenticated()) {
         return App::redirect($redirect);
     }
     return ['$view' => ['title' => __('Login'), 'name' => 'system/user/login.php'], 'last_username' => App::session()->get(Auth::LAST_USERNAME), 'redirect' => $redirect];
 }
开发者ID:pagekit,项目名称:pagekit,代码行数:14,代码来源:AuthController.php

示例4: migrateAction

 /**
  * @Request({"redirect": "string"}, csrf=true)
  */
 public function migrateAction($redirect = null)
 {
     if ($updates = $this->scripts->hasUpdates()) {
         $this->scripts->update();
         $message = __('Your Pagekit database has been updated successfully.');
     } else {
         $message = __('Your database is up to date.');
     }
     App::config('system')->set('version', App::version());
     if ($redirect) {
         App::message()->success($message);
         return App::redirect($redirect);
     }
     return App::response()->json(compact('status', 'message'));
 }
开发者ID:LibraryOfLawrence,项目名称:pagekit,代码行数:18,代码来源:MigrationController.php

示例5: migrateAction

 /**
  * @Request({"redirect": "string"}, csrf=true)
  */
 public function migrateAction($redirect = null)
 {
     $config = App::config('system');
     $manager = new PackageManager();
     $scripts = $manager->loadScripts(null, __DIR__ . '/../../scripts.php');
     if (isset($scripts['updates'])) {
         $updates = $manager->filterUpdates($scripts['updates'], $config->get('version'));
         $manager->execute($updates);
     }
     $config->set('version', App::version());
     $message = __('Your Pagekit database has been updated successfully.');
     if ($redirect) {
         App::message()->success($message);
         return App::redirect($redirect);
     }
     return App::response()->json(compact('status', 'message'));
 }
开发者ID:4nxiety,项目名称:pagekit,代码行数:20,代码来源:MigrationController.php

示例6: indexAction

 /**
  * @Route("/", name="index")
  */
 public function indexAction()
 {
     $request = App::request();
     $config = App::module('shoutzor')->config('shoutzor');
     $config = array_merge($config, $_POST);
     $form = new FormGenerator('', 'POST', 'uk-form uk-form-horizontal');
     $form->addField(new DivField("Permission Check", $config['mediaDir'] . (is_writable($config['mediaDir']) ? " is writable" : " is not writable! chown manually to www-data:www-data"), "", is_writable($config['mediaDir']) ? "uk-alert uk-alert-success" : "uk-alert uk-alert-danger"));
     $form->addField(new DivField("Permission Check", App::module('shoutzor')->config('root_path') . $config['imageDir'] . (is_writable(App::module('shoutzor')->config('root_path') . $config['imageDir']) ? " is writable" : " is not writable! chown manually to www-data:www-data"), "", is_writable(App::module('shoutzor')->config('root_path') . $config['imageDir']) ? "uk-alert uk-alert-success" : "uk-alert uk-alert-danger"));
     $form->addField(new DividerField());
     $form->addField(new SelectField("upload", "upload", "Allow Uploads", "text", $config['upload'], array(['value' => 0, 'title' => 'Disabled'], ['value' => 1, 'title' => 'Enabled']), false, "Changing this setting will not delete uploaded content"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new SelectField("request", "request", "Allow Requests", "text", $config['request'], array(['value' => 0, 'title' => 'Disabled'], ['value' => 1, 'title' => 'Enabled']), false, "Changing this setting will allow / deny user requests"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("mediaDir", "mediaDir", "Media Storage Directory", "text", $config['mediaDir'], "The directory where uploads should be stored", "uk-form-width-large"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("imageDir", "imageDir", "Image Storage Directory", "text", $config['imageDir'], "The directory where downloaded images should be stored", "uk-form-width-large"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("parserLastRun", "parserLastRun", "Parser Last Run Timestamp", "text", $config['parserLastRun'], "The timestamp of when the parser last ran - in general you will not have to make any changes to this value"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("parserMaxItems", "parserMaxItems", "Parser Max Items", "text", $config['parserMaxItems'], "The maximum amount of items the parser should parse on each run"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("userRequestDelay", "userRequestDelay", "User Request Delay", "text", $config['userRequestDelay'], "The delay in minutes that a user has to wait to be able to request a media object again"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("mediaRequestDelay", "mediaRequestDelay", "Media Request Delay", "text", $config['mediaRequestDelay'], "The delay in minutes before a media object can be played again"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("artistRequestDelay", "artistRequestDelay", "Artist Request Delay", "text", $config['artistRequestDelay'], "The delay in minutes before a media object from the same artist can be played again"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("uploadDurationLimit", "uploadDurationLimit", "Media Duration Limit (Minutes)", "text", $config['uploadDurationLimit'], "The limit of the duration from uploaded media files in minutes - changing this will have no effect on already uploaded files"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new SelectField("useFilenameIfUntitled", "useFilenameIfUntitled", "Use Filename If Untitled", "text", $config['useFilenameIfUntitled'], array(['value' => 0, 'title' => 'Disabled'], ['value' => 1, 'title' => 'Enabled']), false, "Use the filename as title when no title could be detected and/or found"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("submit", "", "Save Changes", "submit", "Save Changes", "", "uk-button uk-button-primary"));
     $alert = array();
     //Check if a POST request has been made
     if ($request->isMethod('POST')) {
         $form->validate();
         //Make sure no errors have occured during validation
         if ($form->hasErrors() === false) {
             $configValues = array();
             foreach ($form->getFields() as $field) {
                 if (!empty($field->getName())) {
                     $configValues[$field->getName()] = $field->getValue();
                 }
             }
             App::config('shoutzor')->set('shoutzor', $configValues);
             //Do stuff
             $alert = array('type' => 'success', 'msg' => __('Changes saved. Make sure the applicable liquidsoap scripts are restarted for the changes to take effect'));
         } else {
             $alert = array('type' => 'error', 'msg' => __('Not all fields passed validation, correct the problems and try again'));
         }
     }
     $content = $form->render();
     return ['$view' => ['title' => __('Shoutzor Settings'), 'name' => 'shoutzor:views/admin/shoutzor.php'], 'form' => $content, 'alert' => $alert];
 }
开发者ID:xorinzor,项目名称:Shoutzor,代码行数:48,代码来源:ShoutzorController.php

示例7: generate

 /**
  * {@inheritdoc}
  */
 public function generate(array $parameters = [])
 {
     $id = $parameters['id'];
     $category_id = isset($parameters['category_id']) ? $parameters['category_id'] : 0;
     if (!isset($this->cacheEntries[$id . '-' . $category_id])) {
         if (!($file = File::find($id))) {
             throw new RouteNotFoundException('File not found.');
         }
         if ($category_id && !($category = Category::find($category_id))) {
             throw new RouteNotFoundException('Category not found.');
         }
         $this->addCache($file, $category_id, isset($category) ? $category->slug : App::config('bixie/download')->get('root_category', 'root'));
     }
     $meta = $this->cacheEntries[$id . '-' . $category_id];
     $parameters['slug'] = $meta['slug'];
     unset($parameters['id']);
     unset($parameters['category_id']);
     return $parameters;
 }
开发者ID:Bixie,项目名称:pagekit-download,代码行数:22,代码来源:CategoryUrlResolver.php

示例8: main

 /**
  * {@inheritdoc}
  */
 public function main(App $app)
 {
     $app['node'] = function ($app) {
         if ($id = $app['request']->attributes->get('_node') and $node = Node::find($id, true)) {
             return $node;
         }
         return Node::create();
     };
     $app['menu'] = function ($app) {
         $menus = new MenuManager($app->config($app['theme']->name), $this->config('menus'));
         foreach ($app['theme']->get('menus', []) as $name => $label) {
             $menus->register($name, $label);
         }
         return $menus;
     };
     $app->extend('view', function ($view) use($app) {
         return $view->addHelper(new MenuHelper($app['menu']));
     });
 }
开发者ID:LibraryOfLawrence,项目名称:pagekit,代码行数:22,代码来源:SiteModule.php

示例9: indexAction

 /**
  * @Route("/", name="index")
  */
 public function indexAction()
 {
     $request = App::request();
     $config = App::module('shoutzor')->config('lastfm');
     $config = array_merge($config, $_POST);
     //Set the value to the new POST data
     $liquidsoapManager = new LiquidsoapManager();
     $form = new FormGenerator('', 'POST', 'uk-form uk-form-horizontal');
     $form->addField(new DivField("Notice", "Make sure to have provided a working Application API Key before enabling LastFM to prevent any issues", "", "uk-alert uk-alert-info"));
     $form->addField(new CheckboxField("enabled", "enabled", "Enable LastFM", array($config['enabled']), array(['value' => "1", 'title' => 'enabled'], ['value' => "0", 'title' => 'disabled']), false, "Enable the LastFM Integration"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('1', '0')));
     $form->addField(new InputField("apikey", "apikey", "Application API Key", "text", $config['apikey'], "The Application Key for LastFM, if you don't have one, get one at: <a href='hhttp://www.last.fm/api/account/create'>http://www.last.fm/api/account/create</a>"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("secret", "secret", "Application Secret", "text", $config['secret'], "The Application Secret for LastFM, if you don't have one, get one at: <a href='http://www.last.fm/api/account/create'>http://www.last.fm/api/account/create</a>"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("submit", "", "Save Changes", "submit", "Save Changes", "", "uk-button uk-button-primary"));
     $alert = array();
     //Check if a POST request has been made
     if ($request->isMethod('POST')) {
         $form->validate();
         //Make sure no errors have occured during validation
         if ($form->hasErrors() === false) {
             $configValues = array();
             foreach ($form->getFields() as $field) {
                 if (!empty($field->getName())) {
                     $configValues[$field->getName()] = $field->getValue();
                 }
             }
             //Save our config changes
             App::config('shoutzor')->set('lastfm', $configValues);
             //Show success message
             $alert = array('type' => 'success', 'msg' => __('Changes saved'));
         } else {
             $alert = array('type' => 'error', 'msg' => __('Not all fields passed validation, correct the problems and try again'));
         }
     }
     $content = $form->render();
     return ['$view' => ['title' => __('Shoutzor LastFM'), 'name' => 'shoutzor:views/admin/lastfm.php'], 'form' => $content, 'alert' => $alert];
 }
开发者ID:xorinzor,项目名称:Shoutzor,代码行数:40,代码来源:LastfmController.php

示例10: indexAction

 /**
  * @Route("/", name="index")
  */
 public function indexAction()
 {
     $request = App::request();
     $config = App::module('shoutzor')->config('liquidsoap');
     $config = array_merge($config, $_POST);
     //Set the value to the new POST data
     $form = new FormGenerator('', 'POST', 'uk-form uk-form-horizontal');
     $form->addField(new InputField("pidFileDirectory", "pidFileDirectory", "Pid File Directory", "text", $config['pidFileDirectory'], "The directory where liquidsoap stores its script PID files"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("logDirectoryPath", "logDirectoryPath", "Log Directory Path", "text", $config['logDirectoryPath'], "The directory where to store the logs (without ending slash)"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("socketPath", "socketPath", "Socket Path", "text", $config['socketPath'], "The directory where to create the socket files (without ending slash)"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("socketPermissions", "socketPermissions", "Socket Permissions", "text", $config['socketPermissions'], "The permissions to set to the created socket files"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new CheckboxField("wrapperLogStdout", "wrapperLogStdout", "Wrapper Log Stdout", array($config['wrapperLogStdout']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Show stdout output in the logs"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new CheckboxField("wrapperServerTelnet", "wrapperServerTelnet", "Wrapper Enable Telnet", array($config['wrapperServerTelnet']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Enable telnet access to the wrapper"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new CheckboxField("wrapperServerSocket", "wrapperServerSocket", "Wrapper Enable Socket", array($config['wrapperServerSocket']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Enable socket access to the wrapper - REQUIRED FOR CONTROLS TO WORK"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new DividerField());
     $form->addField(new CheckboxField("shoutzorLogStdout", "shoutzorLogStdout", "Shoutzor Log Stdout", array($config['shoutzorLogStdout']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Show stdout output in the logs"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new CheckboxField("shoutzorServerTelnet", "shoutzorServerTelnet", "Shoutzor Enable Telnet", array($config['shoutzorServerTelnet']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Enable telnet access to shoutzor"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new CheckboxField("shoutzorServerSocket", "shoutzorServerSocket", "Shoutzor Enable Socket", array($config['shoutzorServerSocket']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Enable socket access to shoutzor - REQUIRED FOR CONTROLS TO WORK"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new DividerField());
     $form->addField(new InputField("wrapperInputListeningMount", "wrapperInputListeningMount", "Wrapper Input Listening Mount", "text", $config['wrapperInputListeningMount'], "The mount that the wrapper and shoutzor should be using to communicate locally"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("wrapperInputListeningPort", "wrapperInputListeningPort", "Wrapper Input Listening Port", "text", $config['wrapperInputListeningPort'], "The port the wrapper and shoutzor should be using to communicate locally"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("wrapperInputListeningPassword", "wrapperInputListeningPassword", "Wrapper Input Listening Password", "password", $config['wrapperInputListeningPassword'], "The password the wrapper and shoutzor should be using to communicate locally"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("wrapperOutputHost", "wrapperOutputHost", "Wrapper Output Host", "text", $config['wrapperOutputHost'], "The IP of the icecast server to stream to"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("wrapperOutputMount", "wrapperOutputMount", "Wrapper Output Mount", "text", $config['wrapperOutputMount'], "The mount of the icecast server to stream to"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("wrapperOutputPort", "wrapperOutputPort", "Wrapper Output Port", "text", $config['wrapperOutputPort'], "The port of the icecast server to stream to"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("wrapperOutputPassword", "wrapperOutputPassword", "Wrapper Output Password", "password", $config['wrapperOutputPassword'], "The password of the icecast server to stream to"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("shoutzorUrl", "shoutzorUrl", "Shoutzor Website URL", "text", $config['shoutzorUrl'], "The hostname of the url this website is running on, example: 'https://shoutzor.com' NO ENDING SLASH"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("encodingBitrate", "encodingBitrate", "Encoding bitrate", "text", $config['encodingBitrate'], "The bitrate of our audio stream"));
     $form->addField(new InputField("encodingQuality", "encodingQuality", "LAME Encoding Quality", "text", $config['encodingQuality'], "The quality to be used by the LAME encoder, 0 - 9 where 0 is the highest quality"));
     $form->addField(new DividerField());
     $form->addField(new InputField("submit", "", "Save Changes", "submit", "Save Changes", "", "uk-button uk-button-primary"));
     $alert = array();
     //Check if a POST request has been made
     if ($request->isMethod('POST')) {
         $form->validate();
         //Make sure no errors have occured during validation
         if ($form->hasErrors() === false) {
             $replace_values = array();
             $configValues = array();
             foreach ($form->getFields() as $field) {
                 if (!empty($field->getName())) {
                     $configValues[$field->getName()] = $field->getValue();
                     $replace_values['%' . $field->getName() . '%'] = $field->getValue();
                 }
             }
             //Save our config changes
             App::config('shoutzor')->set('liquidsoap', $configValues);
             //Generate our new config file
             $liquidsoapManager = new liquidsoapManager();
             $liquidsoapManager->generateConfigFile($replace_values);
             //Show success message
             $alert = array('type' => 'success', 'msg' => __('Changes saved. Make sure the applicable liquidsoap scripts are restarted for the changes to take effect'));
         } else {
             $alert = array('type' => 'error', 'msg' => __('Not all fields passed validation, correct the problems and try again'));
         }
     }
     $content = $form->render();
     return ['$view' => ['title' => __('Liquidsoap Settings'), 'name' => 'shoutzor:views/admin/liquidsoap.php'], 'form' => $content, 'alert' => $alert];
 }
开发者ID:xorinzor,项目名称:Shoutzor,代码行数:66,代码来源:LiquidsoapController.php

示例11: saveAction

 /**
  * @Request({"entries": "array"}, csrf=true)
  * @Access(admin=true)
  */
 public function saveAction($entries = [])
 {
     App::config('todo')->set('entries', $entries);
     return ['message' => 'success'];
 }
开发者ID:pagekit,项目名称:example-todo,代码行数:9,代码来源:TodoController.php

示例12: frontpageAction

 /**
  * @Route("/frontpage", methods="POST")
  * @Request({"id": "int"}, csrf=true)
  */
 public function frontpageAction($id)
 {
     if (!($node = Node::find($id)) or !($type = App::module('system/site')->getType($node->type))) {
         App::abort(404, __('Node not found.'));
     }
     if (isset($type['frontpage']) and !$type['frontpage']) {
         App::abort(400, __('Invalid node type.'));
     }
     App::config('system/site')->set('frontpage', $id);
     return ['message' => 'success'];
 }
开发者ID:LibraryOfLawrence,项目名称:pagekit,代码行数:15,代码来源:NodeApiController.php

示例13: installAction

 /**
  * @Request({"config": "array", "option": "array", "user": "array"})
  */
 public function installAction($config = [], $option = [], $user = [])
 {
     $status = $this->checkAction($config);
     $message = $status['message'];
     $status = $status['status'];
     try {
         if ('no-connection' == $status) {
             App::abort(400, __('No database connection.'));
         }
         if ('tables-exist' == $status) {
             App::abort(400, $message);
         }
         $scripts = new PackageScripts(App::path() . '/app/system/scripts.php');
         $scripts->install();
         App::db()->insert('@system_user', ['name' => $user['username'], 'username' => $user['username'], 'password' => App::get('auth.password')->hash($user['password']), 'status' => 1, 'email' => $user['email'], 'registered' => date('Y-m-d H:i:s'), 'roles' => '2,3']);
         $option['system']['version'] = App::version();
         $option['system']['extensions'] = ['blog'];
         $option['system']['site']['theme'] = 'theme-one';
         foreach ($option as $name => $values) {
             App::config()->set($name, App::config($name)->merge($values));
         }
         if ($this->packages) {
             $installer = new PackageManager(new NullOutput());
             $installer->install($this->packages);
         }
         if (file_exists(__DIR__ . '/../../install.php')) {
             require_once __DIR__ . '/../../install.php';
         }
         if (!$this->config) {
             $configuration = new Config();
             $configuration->set('application.debug', false);
             foreach ($config as $key => $value) {
                 $configuration->set($key, $value);
             }
             $configuration->set('system.secret', App::get('auth.random')->generateString(64));
             if (!file_put_contents($this->configFile, $configuration->dump())) {
                 $status = 'write-failed';
                 App::abort(400, __('Can\'t write config.'));
             }
         }
         App::module('system/cache')->clearCache();
         $status = 'success';
     } catch (DBALException $e) {
         $status = 'db-sql-failed';
         $message = __('Database error: %error%', ['%error%' => $e->getMessage()]);
     } catch (\Exception $e) {
         $message = $e->getMessage();
     }
     return ['status' => $status, 'message' => $message];
 }
开发者ID:sdaoudi,项目名称:rimbo,代码行数:53,代码来源:InstallerController.php

示例14: doInstall

 /**
  * @param  $package
  * @return string
  */
 protected function doInstall($package)
 {
     $this->getScripts($package)->install();
     $version = $this->getVersion($package);
     App::config('system')->set('packages.' . $package->get('module'), $version);
     return $version;
 }
开发者ID:pagekit,项目名称:pagekit,代码行数:11,代码来源:PackageManager.php

示例15: date

<?php

use Pagekit\Application as App;
App::config()->set('system/site', App::config('system/site')->merge(['frontpage' => 1, 'view' => ['logo' => 'storage/pagekit-logo.svg']]));
App::db()->insert('@system_config', ['name' => 'theme-one', 'value' => '{"logo_contrast":"storage\\/pagekit-logo-contrast.svg","_menus":{"main":"main","offcanvas":"main"},"_positions":{"hero":[1],"footer":[2]},"_widgets":{"1":{"title_hide":true,"title_size":"uk-panel-title","alignment":true,"html_class":"","panel":""},"2":{"title_hide":true,"title_size":"uk-panel-title","alignment":"","html_class":"","panel":""}},"_nodes":{"1":{"title_hide":true,"title_large":false,"alignment":true,"html_class":"","sidebar_first":false,"hero_image":"storage\\/home-hero.jpg","hero_viewport":true,"hero_contrast":true,"navbar_transparent":true}}}']);
App::db()->insert('@system_node', ['priority' => 1, 'status' => 1, 'title' => 'Home', 'slug' => 'home', 'path' => '/home', 'link' => '@page/1', 'type' => 'page', 'menu' => 'main', 'data' => "{\"defaults\":{\"id\":1}}"]);
App::db()->insert('@system_node', ['priority' => 2, 'status' => 1, 'title' => 'Blog', 'slug' => 'blog', 'path' => '/blog', 'link' => '@blog', 'type' => 'blog', 'menu' => 'main']);
App::db()->insert('@system_widget', ['title' => 'Hello, I\'m Pagekit', 'type' => 'system/text', 'status' => 1, 'nodes' => 1, 'data' => '{"content":"<h1 class=\\"uk-heading-large uk-margin-large-bottom\\">Hello, I\'m Pagekit,<br class=\\"uk-hidden-small\\"> your new favorite CMS.<\\/h1>\\n\\n<a class=\\"uk-button uk-button-large\\" href=\\"http:\\/\\/www.pagekit.com\\">Get started<\\/a>"}']);
App::db()->insert('@system_widget', ['title' => 'Socials', 'type' => 'system/text', 'status' => 1, 'data' => '{"content":"<ul class=\\"uk-grid uk-grid-medium uk-flex uk-flex-center\\">\\n    <li><a href=\\"https:\\/\\/github.com\\/pagekit\\" class=\\"uk-icon-hover uk-icon-small uk-icon-github\\"><\\/a><\\/li>\\n    <li><a href=\\"https:\\/\\/twitter.com\\/pagekit\\" class=\\"uk-icon-hover uk-icon-small uk-icon-twitter\\"><\\/a><\\/li>\\n    <li><a href=\\"https:\\/\\/gitter.im\\/pagekit\\/pagekit\\" class=\\"uk-icon-hover uk-icon-small uk-icon-comment-o\\"><\\/a><\\/li>\\n    <li><a href=\\"https:\\/\\/plus.google.com\\/communities\\/104125443335488004107\\" class=\\"uk-icon-hover uk-icon-small uk-icon-google-plus\\"><\\/a><\\/li>\\n<\\/ul>"}']);
App::db()->insert('@system_page', ['title' => 'Home', 'content' => "<div class=\"uk-width-medium-3-4 uk-container-center\">\n    \n<h3 class=\"uk-h1 uk-margin-large-bottom\">Uniting fresh design and clean code<br class=\"uk-hidden-small\"> to create beautiful websites.</h3>\n\n<p class=\"uk-width-medium-4-6 uk-container-center\">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>\n\n</div>", 'data' => '{"title":true}']);
App::db()->insert('@blog_post', ['user_id' => 1, 'slug' => 'hello-pagekit', 'title' => 'Hello Pagekit', 'status' => 2, 'date' => date('Y-m-d H:i:s'), 'modified' => date('Y-m-d H:i:s'), 'content' => "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\nquis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\nconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\ncillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\nproident, sunt in culpa qui officia deserunt mollit anim id est laborum.", 'excerpt' => '', 'comment_status' => 1, 'data' => '{"title":null,"markdown":true}']);
开发者ID:4nxiety,项目名称:pagekit,代码行数:11,代码来源:install.php


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