本文整理汇总了PHP中setting函数的典型用法代码示例。如果您正苦于以下问题:PHP setting函数的具体用法?PHP setting怎么用?PHP setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateHomesteadConfig
/**
* Updates the homestead.yaml file to include the new folder.
*
* @param $group
*/
protected function updateHomesteadConfig($group)
{
$config = $this->yaml->parse($this->filesystem->get(setting('userDir') . '/.homestead/Homestead.yaml'));
// Add the group to the folder config
$config['folders'][] = ['map' => $group->starting_path, 'to' => vagrantDirectory($group->starting_path)];
app(Homestead::class)->saveHomesteadConfig($config);
}
示例2: smarty_block_registration_form
/**
* Registration Form Template Plugin
*
* Assists in the creation of registration forms
*
* @param string $return The relative or absolute URL to return to after registering
*/
function smarty_block_registration_form($params, $tagdata, &$smarty, &$repeat)
{
if (!isset($params['var'])) {
show_error('You must specify a "var" parameter for template {registration_form} calls. This parameter specifies the variable name for the returned array.');
} else {
$variables = array();
// get return URL
if (isset($params['return']) and !empty($params['return'])) {
$variables['return'] = query_value_encode($params['return']);
} else {
$variables['return'] = '';
}
// form action
$variables['form_action'] = site_url('users/post_registration');
if (setting('ssl_certificate') == '1') {
$variables['form_action'] = secure($variables['form_action']);
}
// populated values
$variables['first_name'] = $smarty->CI->input->post('firstname');
$variables['last_name'] = $smarty->CI->input->post('last_name');
$variables['email'] = $smarty->CI->input->post('email');
$variables['username'] = $smarty->CI->input->post('username');
$custom_fields = $smarty->CI->user_model->get_custom_fields(array('registration_form' => TRUE, 'not_in_admin' => TRUE));
$variables['custom_fields'] = $custom_fields;
if (is_array($custom_fields)) {
foreach ($custom_fields as $field) {
$variables[$field['name']] = $smarty->CI->input->post($field['name']);
}
}
$smarty->assign($params['var'], $variables);
echo $tagdata;
}
}
示例3: contact
/**
* Send email for contact form
*
* @param array $data
*/
public function contact(array $data)
{
$email = setting('email.support');
$subject = 'Contact: ' . $data['subject'];
$view = 'emails.contact';
$this->send($view, $data, $subject, $email);
}
示例4: unexpire
public function unexpire($register_key)
{
$this->_database->set('timeout', date('Y-m-d H:i:s', strtotime('+' . setting('Register.Email Activation Expire') . ' minutes')));
$this->_database->set('expired', 0);
$this->_database->where('register_key', $register_key);
return $this->_database->update($this->table);
}
示例5: output_admin
/**
* Output Admin
*
* Returns the field with it's <label> in an <li> suitable for the admin forms.
*
* @return string $return The HTML to be included in a form
*/
function output_admin()
{
$attributes = $this->output_shared();
$this->help = 'Maximum filesize for web upload: ' . setting('upload_max') . '. ' . $this->help;
$help = '<div class="help">' . $this->help . '</div>';
// create text that appears after the upload box
$after_box = '<input type="button" class="button" onclick="javascript:$(\'#ftp_notes_' . $this->name . '\').modal(); void(0);" name="" value="Upload via FTP" />';
// show current file
if (!empty($this->value)) {
if (in_array(file_extension($this->value), array('jpg', 'jpeg', 'gif', 'bmp', 'png'))) {
$this->CI->load->helper('image_thumb');
$after_box .= '<br /><a href="' . site_url($this->value) . '"><img style="margin-left: 150px" src="' . image_thumb(FCPATH . $this->value, 100, 100) . '" alt="preview" /></a>';
} else {
$after_box .= ' <a href="' . site_url($this->value) . '">current file</a>';
}
$after_box .= '<br /><input style="margin-left: 150px" type="checkbox" name="delete_file_' . $this->name . '" value="1" /> <span style="font-style: italic; color: #ff6464">Delete current ' . $this->label . '</span>';
}
// build HTML
// we can track an already-uploaded filename with a hidden field so, if we
// don't have a new upload, we stick with the file we already have
$return = '<li>
<label for="' . $this->name . '">' . $this->label . '</label>
<input type="hidden" name="' . $this->name . '_uploaded" value="' . $this->value . '" />
<input type="hidden" name="' . $this->name . '_ftp" value="" />
<input ' . $attributes . ' /> ' . $after_box . '
' . $help . '
<!-- hidden modal window for assigning FTP filenames -->
<div class="modal" style="height:200px" id="ftp_notes_' . $this->name . '">
<script type="text/javascript">
$(document).ready(function() {
$(\'input[name="' . $this->name . '_ftp_input"]\').keyup(function () {
$(\'input[name="' . $this->name . '_ftp"]\').val($(this).val());
});
});
</script>
<h3>Upload File via FTP</h3>
<ul class="form">
<li>
To upload your file via FTP, follow the directions below:
</li>
<li>
<b>1)</b> Connect to your FTP server with your favourite <a class="tooltip" title="An FTP client, such as \'FileZilla\', is an application you download on your computer that connects to FTP server and uploads/downloads files." href="javascript:void(0)">FTP client</a>.
</li>
<li>
<b>2)</b> Upload your file to <span class="code">' . $this->upload_directory . '</span>.
</li>
<li>
<b>3)</b> Enter your uploaded filename here: <input type="text" name="' . $this->name . '_ftp_input" /> (e.g., "myfile.pdf").
</li>
<li>
<b>4)</b> Close this window
</li>
</ul>
</div>
<!-- end hidden modal window -->
</li>';
return $return;
}
示例6: get_variables
public function get_variables($extra = [])
{
ci()->load->model('c_snippet_model');
$variables_set_b = setting('paths');
$variables_set_a = $this->c_snippet_model->catalog('name', 'value');
return array_merge($variables_set_b, $variables_set_a, ['base_url' => trim(base_url(), '/'), 'year' => date('Y')], (array) $extra);
}
示例7: saveNew
/**
* Saves a new image
* @param string $imageName
* @param string $imageData
* @param string $type
* @param int $uploadedTo
* @return Image
* @throws ImageUploadException
*/
private function saveNew($imageName, $imageData, $type, $uploadedTo = 0)
{
$storage = $this->getStorage();
$secureUploads = setting('app-secure-images');
$imageName = str_replace(' ', '-', $imageName);
if ($secureUploads) {
$imageName = str_random(16) . '-' . $imageName;
}
$imagePath = '/uploads/images/' . $type . '/' . Date('Y-m-M') . '/';
if ($this->isLocal()) {
$imagePath = '/public' . $imagePath;
}
while ($storage->exists($imagePath . $imageName)) {
$imageName = str_random(3) . $imageName;
}
$fullPath = $imagePath . $imageName;
try {
$storage->put($fullPath, $imageData);
$storage->setVisibility($fullPath, 'public');
} catch (Exception $e) {
throw new ImageUploadException('Image Path ' . $fullPath . ' is not writable by the server.');
}
if ($this->isLocal()) {
$fullPath = str_replace_first('/public', '', $fullPath);
}
$imageDetails = ['name' => $imageName, 'path' => $fullPath, 'url' => $this->getPublicUrl($fullPath), 'type' => $type, 'uploaded_to' => $uploadedTo];
if (user()->id !== 0) {
$userId = user()->id;
$imageDetails['created_by'] = $userId;
$imageDetails['updated_by'] = $userId;
}
$image = Image::forceCreate($imageDetails);
return $image;
}
示例8: index
function index()
{
require APPPATH . 'modules/twitter/libraries/twitteroauth.php';
/* If the oauth_token is old redirect to the connect page. */
if ($this->input->get('oauth_token') && $this->session->userdata('twitter_oauth_token') !== $this->input->get('oauth_token')) {
return redirect('admincp/twitter');
}
/* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
$connection = new TwitterOAuth(setting('twitter_consumer_key'), setting('twitter_consumer_secret'), $this->session->userdata('twitter_oauth_token'), $this->session->userdata('twitter_oauth_token_secret'));
/* Request access tokens from twitter */
$access_token = $connection->getAccessToken($this->input->get('oauth_verifier'));
/* Save the access tokens. Normally these would be saved in a database for future use. */
$this->settings_model->update_setting('twitter_oauth_token', $access_token['oauth_token']);
$this->settings_model->update_setting('twitter_oauth_token_secret', $access_token['oauth_token_secret']);
/* Remove no longer needed request tokens */
$this->session->unset_userdata('twitter_oauth_token');
$this->session->unset_userdata('twitter_oauth_token_secret');
/* If HTTP response is 200 continue otherwise send to connect page to retry */
if (200 == $connection->http_code) {
$this->notices->SetNotice('OAuthorization retrieved successfully.');
return redirect('admincp/twitter');
} else {
$this->notices->SetError('Error making connection in OAuth callback.');
return redirect('admincp/twitter');
}
}
示例9: getServerId
public function getServerId()
{
if (!setting('cdn_enabled')) {
return 0;
}
return 1;
}
示例10: checkout
public function checkout(Adtype $adtype, AdtypePurchaseRequest $request)
{
$user = $this->user;
$quantity = $request->get('quantity');
$transaction = ['gatewayId' => $request->get('gateway'), 'userId' => $user->id, 'command' => '\\ZEDx\\Jobs\\purchaseAdtype', 'item' => ['id' => $adtype->id, 'amount' => number_format($adtype->price * $quantity, 2, '.', ''), 'name' => 'Annonce ' . $adtype->title, 'description' => 'Annonce ' . $adtype->title, 'currency' => setting('currency'), 'quantity' => $quantity]];
Payment::purchase($transaction);
}
示例11: index
function index()
{
// are we doing a search?
$searching = FALSE;
$query = FALSE;
$pagination = FALSE;
$results = FALSE;
$num_results = FALSE;
$title = 'Search ' . setting('site_name');
if ($this->input->get('q', TRUE) != FALSE) {
// have we waited long enough before searches?
if (setting('search_delay') != 0 and $this->session->userdata('last_search') != FALSE and time() - $this->session->userdata('last_search') < setting('search_delay')) {
die(show_error('You must wait ' . setting('search_delay') . ' seconds between searches. <a href="javascript:location.reload(true)">Refresh and try again</a>.'));
}
$searching = TRUE;
$query = $this->input->get('q', TRUE);
$this->load->library('search/search_results');
$page = $this->input->get('page') ? $this->input->get('page') : 0;
$results = $this->search_results->search($query, $page);
$num_results = $this->search_results->get_total_results();
$pagination = $this->search_results->get_pagination(site_url('search/?q=' . urlencode($query)));
$title = 'Search Results for "' . $query . '"';
// record latest search time
$this->session->set_userdata('last_search', time());
}
// display
$this->smarty->assign('searching', $searching);
$this->smarty->assign('query', $query);
$this->smarty->assign('pagination', $pagination);
$this->smarty->assign('num_results', $num_results);
$this->smarty->assign('results', $results);
$this->smarty->assign('title', $title);
return $this->smarty->display('search.thtml');
}
示例12: sendMailToUser
/**
* Send mail to user.
*
* @param Ad $ad
* @param Request $request
*
* @return bool
*/
protected function sendMailToUser(Ad $ad, BaseRequest $request)
{
$mailer = new AdMail();
$dataSubject = ['ad_title' => $ad->content->title, 'website_title' => setting()->website_title];
$dataMessage = ['message' => $request->message, 'sender_name' => $request->name, 'sender_email' => $request->email, 'sender_phone' => $request->phone, 'ad_title' => $ad->content->title, 'website_title' => setting()->website_title, 'ad_url' => route('ad.show', [$ad->id, str_slug($ad->content->title)])];
return $mailer->user()->contactUser($ad->user, ['data' => $dataMessage], $dataSubject);
}
示例13: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request)
{
$notifications = Notification::visible()->recents();
$notifications = $this->filterNotificationsByDateRange($request, $notifications)->paginate(20);
$currency = setting('currency');
return view_backend('notification.index', compact('notifications', 'currency'));
}
示例14: index
function index()
{
$this->load->library('custom_fields/form_builder');
$shortname = $this->form_builder->add_field('text')->name('disqus_shortname')->label('Disqus Shortname')->validators(array('alpha_numeric', 'trim'))->value(setting('disqus_shortname'))->help('Don\'t have a shortname? Register your site at <a href="http://www.disqus.com">Disqus</a>.')->required(TRUE);
$data = array('form_title' => 'Disqus Configuration', 'form_action' => site_url('admincp/disqus/post_config'), 'form' => $this->form_builder->output_admin(), 'form_button' => 'Save Configuration', 'disqus_shortname' => setting('disqus_shortname'));
$this->load->view('generic', $data);
}
示例15: indexAction
public function indexAction()
{
if (setting('application', 'Refresh Profile in Dashboard')) {
$this->auth->refresh_userdata();
}
$this->page->build();
}