本文整理汇总了PHP中ee函数的典型用法代码示例。如果您正苦于以下问题:PHP ee函数的具体用法?PHP ee怎么用?PHP ee使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ee函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
/**
* Module Uninstaller
*
* @access public
* @return bool
*/
function uninstall()
{
$mod_id = ee()->db->select('module_id')->get_where('modules', array('module_name' => 'Filepicker'))->row('module_id');
ee()->db->where('module_id', $mod_id)->delete('module_member_groups');
ee()->db->where('module_name', 'Filepicker')->delete('modules');
return TRUE;
}
示例2: __construct
/**
* Countcommentreviews
*
* This function returns a list of members
*
* @access public
* @return string
*/
public function __construct()
{
$type_review = '+';
$entryid = '1';
$type_review = ee()->TMPL->fetch_param('type_review');
$entryid = ee()->TMPL->fetch_param('entryid');
$query = ee()->db->select('COUNT(field_id_1) AS countr')->where(array('entry_id' => $entryid, 'field_id_1' => $type_review))->limit(1)->get('comment_data');
if ($query->num_rows() > 0) {
foreach ($query->result_array() as $row) {
$this->return_data .= $row['countr'];
}
}
/*
$group_id = "6";
$group_id = ee()->TMPL->fetch_param('group_id');
$query = ee()->db->select('email')
->where('group_id =', $group_id)
->get('members', 1000);
$count=1;
foreach($query->result_array() as $row)
{
$this->return_data .= $row['email'];
if ( $count < $query->num_rows() ){
$this->return_data .= ",";
}
$count++;
}
*/
}
示例3: do_update
function do_update()
{
$query = ee()->db->query("SHOW tables LIKE 'exp_mailing_list'");
if ($query->num_rows() > 0) {
$Q[] = "ALTER TABLE `exp_mailing_list` ADD `ip_address` VARCHAR(16) NOT NULL AFTER `list_id`";
}
// Change default weblog preferences for trackbacks
$Q[] = "ALTER TABLE `exp_weblogs` CHANGE `enable_trackbacks` `enable_trackbacks` CHAR(1) NOT NULL DEFAULT 'n'";
$Q[] = "ALTER TABLE `exp_weblogs` CHANGE `trackback_system_enabled` `trackback_system_enabled` CHAR(1) NOT NULL DEFAULT 'n'";
// fix version number for Member module, which may be out of sync for old installations
$Q[] = "UPDATE `exp_modules` SET `module_version` = '1.3' WHERE `module_name` = 'Member'";
// Text formatting for emails from the Communicate page
$Q[] = "ALTER TABLE `exp_email_cache` ADD `text_fmt` VARCHAR(40) NOT NULL AFTER `mailtype`";
// Member Group setting for showing in Author List
$Q[] = "ALTER TABLE `exp_member_groups` ADD `include_in_authorlist` CHAR(1) NOT NULL DEFAULT 'n' AFTER `can_send_bulletins`";
// Show All Tab in the Publish Area
$Q[] = "ALTER TABLE `exp_weblogs` ADD `show_show_all_cluster` CHAR( 1 ) NOT NULL DEFAULT 'y' AFTER `show_pages_cluster`;";
// "live" preview modifications
$Q[] = "ALTER TABLE `exp_weblogs` ADD `live_look_template` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `url_title_prefix`";
/** ---------------------------------------
/** Run Queries
/** ---------------------------------------*/
foreach ($Q as $sql) {
ee()->db->query($sql);
}
/** ---------------------------------------
/** Update the Config File
/** ---------------------------------------*/
return TRUE;
}
示例4: fire
/**
* {@inheritdoc}
*/
protected function fire()
{
ee()->load->add_package_path(PATH_THIRD . 'sync_snippets/');
ee()->load->library('sync_snippets');
ee()->sync_snippets->sync_snippets();
$this->info('Snippets synced.');
}
示例5: _update_member_field_schema
/**
* Sets three columns to allow NULL and to default to NULL. This matches
* the schema we install.
*/
private function _update_member_field_schema()
{
ee()->smartforge->modify_column('member_fields', array('m_field_maxl' => array('type' => 'smallint(3)', 'null' => TRUE), 'm_field_width' => array('type' => 'varchar(6)', 'null' => TRUE), 'm_field_order' => array('type' => 'int(3)', 'null' => TRUE)));
foreach (array('m_field_maxl', 'm_field_width', 'm_field_order') as $col) {
ee()->db->query("ALTER TABLE exp_member_fields ALTER COLUMN " . $col . " SET DEFAULT NULL");
}
}
示例6: replace
/**
* Replace all of the default date fields.
*
* @param String The tagdata to be parsed
* @param Object The channel parser object
* @param Mixed The results from the preparse method
*
* @return String The processed tagdata
*/
public function replace($tagdata, EE_Channel_data_parser $obj, $date_vars)
{
$prefix = $obj->prefix();
$tag = $obj->tag();
$data = $obj->row();
$dates = array($prefix . 'entry_date' => $data['entry_date'], $prefix . 'edit_date' => $data['edit_date'], $prefix . 'recent_comment_date' => $data['recent_comment_date'] != 0 ? $data['recent_comment_date'] : '', $prefix . 'expiration_date' => $data['expiration_date'] != 0 ? $data['expiration_date'] : '', $prefix . 'comment_expiration_date' => $data['comment_expiration_date'] != 0 ? $data['comment_expiration_date'] : '');
// "week_date"
// Subtract the number of days the entry is "into" the week to get zero (Sunday)
// If the entry date is for Sunday, and Monday is being used as the week's start day,
// then we must back things up by six days
$offset = 0;
if (strtolower(ee()->TMPL->fetch_param('start_day')) == 'monday') {
$day_of_week = ee()->localize->format_date('%w', $data['entry_date']);
if ($day_of_week == '0') {
$offset = -518400;
// back six days
} else {
$offset = 86400;
// plus one day
}
}
$dates['week_date'] = $data['entry_date'] - ee()->localize->format_date('%w', $data['entry_date'], TRUE) * 60 * 60 * 24 + $offset;
$tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates);
$dates = array($prefix . 'gmt_date' => $data['entry_date'], $prefix . 'gmt_entry_date' => $data['entry_date'], $prefix . 'gmt_edit_date' => $data['edit_date']);
$tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates, FALSE);
return $tagdata;
}
示例7: form_open
function form_open($action = '', $attributes = array(), $hidden = array())
{
$CI =& get_instance();
if (strpos($action, '://') === FALSE && strpos($action, BASE) !== 0) {
$action = BASE . AMP . $action;
}
$action = ee()->uri->reformat($action);
$form = '<form action="' . $action . '"';
if (is_array($attributes)) {
if (!isset($attributes['method'])) {
$form .= ' method="post"';
}
foreach ($attributes as $key => $val) {
$form .= ' ' . $key . '="' . $val . '"';
}
} else {
$form .= ' method="post" ' . $attributes;
}
$form .= ">\n";
if (!bool_config_item('disable_csrf_protection')) {
if (!is_array($hidden)) {
$hidden = array();
}
$hidden['csrf_token'] = CSRF_TOKEN;
}
if (is_array($hidden) and count($hidden > 0)) {
$form .= form_hidden($hidden) . "\n";
}
return $form;
}
示例8: fire
/**
* {@inheritdoc}
*/
protected function fire()
{
$templates = $this->argument('template');
$this->getApplication()->newControllerInstance('\\eecli\\CodeIgniter\\Controller\\DesignController');
ee()->load->model('template_model');
ee()->template = ee()->TMPL;
if (!$this->option('force') && !$this->confirm('Are you sure you want to delete? [Yn]', true)) {
$this->error('Did not delete template(s): ' . implode(' ', $templates));
return;
}
foreach ($templates as $template) {
if (!preg_match('#^[a-zA-Z0-9_\\-]+/[a-zA-Z0-9_\\-]+$#', $template)) {
$this->error('Template ' . $template . ' must be in <template_group>/<template_name> format.');
continue;
}
list($groupName, $templateName) = explode('/', $template);
$query = ee()->db->select('template_id')->join('template_groups', 'template_groups.group_id = templates.group_id')->where('group_name', $groupName)->where('template_name', $templateName)->get('templates');
if ($query->num_rows() === 0) {
$this->error('Template ' . $template . ' not found.');
} else {
$_POST = array('template_id' => $query->row('template_id'));
ee()->template_delete();
$this->info('Template ' . $template . ' deleted.');
}
$query->free_result();
}
}
示例9: fire
/**
* {@inheritdoc}
*/
protected function fire()
{
if (ee()->config->item('save_tmpl_files') !== 'y' || !ee()->config->item('tmpl_file_basepath')) {
$this->error('The "Save Templates as Files" system configuration must be turned on to use this command.');
return;
}
$this->getApplication()->newControllerInstance('\\eecli\\CodeIgniter\\Controller\\DesignController');
ee()->sync_templates();
$vars = ee()->cp->getVariables();
$toggle = array();
foreach ($vars['templates'] as $groupName => $templates) {
foreach ($templates as $templateName => $templateData) {
if (isset($templateData['toggle']) && preg_match('#name="toggle\\[\\]" value="(.*?)"#', $templateData['toggle'], $match)) {
$toggle[] = $match[1];
}
}
}
if (empty($toggle)) {
$this->error('There are no templates to sync.');
return;
}
$_POST = array('confirm' => 'confirm', 'toggle' => $toggle);
ee()->sync_run();
if (ee()->functions->getErrorMessage()) {
$this->error(ee()->functions->getErrorMessage());
return;
}
if (ee()->functions->getSuccessMessage()) {
$this->info(ee()->functions->getSuccessMessage());
}
}
示例10: index
public function index()
{
$vars['sections'] = array(array(array('title' => 'cp_session_type', 'desc' => '', 'fields' => array('cp_session_type' => array('type' => 'select', 'choices' => array('cs' => lang('cs_session'), 'c' => lang('c_session'), 's' => lang('s_session'))))), array('title' => 'website_session_type', 'desc' => '', 'fields' => array('website_session_type' => array('type' => 'select', 'choices' => array('cs' => lang('cs_session'), 'c' => lang('c_session'), 's' => lang('s_session')))))), 'cookie_settings' => array(array('title' => 'cookie_domain', 'desc' => 'cookie_domain_desc', 'fields' => array('cookie_domain' => array('type' => 'text'))), array('title' => 'cookie_path', 'desc' => sprintf(lang('cookie_path_desc'), ee()->cp->masked_url('https://ellislab.com/expressionengine/user-guide/cp/admin/cookie_settings.html#cookie-path')), 'fields' => array('cookie_path' => array('type' => 'text'))), array('title' => 'cookie_prefix', 'desc' => lang('cookie_prefix_desc'), 'fields' => array('cookie_prefix' => array('type' => 'text'))), array('title' => 'cookie_httponly', 'desc' => 'cookie_httponly_desc', 'security' => TRUE, 'fields' => array('cookie_httponly' => array('type' => 'yes_no'))), array('title' => 'cookie_secure', 'desc' => 'cookie_secure_desc', 'security' => TRUE, 'fields' => array('cookie_secure' => array('type' => 'yes_no')))), 'member_security_settings' => array(array('title' => 'allow_username_change', 'desc' => 'allow_username_change_desc', 'fields' => array('allow_username_change' => array('type' => 'yes_no'))), array('title' => 'un_min_len', 'desc' => lang('un_min_len_desc'), 'fields' => array('un_min_len' => array('type' => 'text'))), array('title' => 'allow_multi_logins', 'desc' => 'allow_multi_logins_desc', 'fields' => array('allow_multi_logins' => array('type' => 'yes_no'))), array('title' => 'require_ip_for_login', 'desc' => 'require_ip_for_login_desc', 'fields' => array('require_ip_for_login' => array('type' => 'yes_no'))), array('title' => 'password_lockout', 'desc' => 'password_lockout_desc', 'fields' => array('password_lockout' => array('type' => 'inline_radio', 'choices' => array('y' => lang('enable'), 'n' => lang('disable'))))), array('title' => 'password_lockout_interval', 'desc' => lang('password_lockout_interval_desc'), 'fields' => array('password_lockout_interval' => array('type' => 'text'))), array('title' => 'require_secure_passwords', 'desc' => 'require_secure_passwords_desc', 'fields' => array('require_secure_passwords' => array('type' => 'yes_no'))), array('title' => 'pw_min_len', 'desc' => 'pw_min_len_desc', 'fields' => array('pw_min_len' => array('type' => 'text'))), array('title' => 'allow_dictionary_pw', 'desc' => 'allow_dictionary_pw_desc', 'fields' => array('allow_dictionary_pw' => array('type' => 'yes_no'))), array('title' => 'name_of_dictionary_file', 'desc' => 'name_of_dictionary_file_desc', 'fields' => array('name_of_dictionary_file' => array('type' => 'text')))), 'form_security_settings' => array(array('title' => 'deny_duplicate_data', 'desc' => 'deny_duplicate_data_desc', 'fields' => array('deny_duplicate_data' => array('type' => 'yes_no'))), array('title' => 'require_ip_for_posting', 'desc' => 'require_ip_for_posting_desc', 'fields' => array('require_ip_for_posting' => array('type' => 'yes_no'))), array('title' => 'xss_clean_uploads', 'desc' => 'xss_clean_uploads_desc', 'fields' => array('xss_clean_uploads' => array('type' => 'yes_no')))));
ee()->form_validation->set_rules(array(array('field' => 'un_min_len', 'label' => 'lang:un_min_len', 'rules' => 'integer'), array('field' => 'password_lockout_interval', 'label' => 'lang:password_lockout_interval', 'rules' => 'integer'), array('field' => 'pw_min_len', 'label' => 'lang:pw_min_len', 'rules' => 'integer')));
ee()->form_validation->validateNonTextInputs($vars['sections']);
$base_url = ee('CP/URL')->make('settings/security-privacy');
ee('CP/Alert')->makeInline('security-tip')->asWarning()->cannotClose()->addToBody(lang('security_tip'))->addToBody(lang('security_tip_desc'), 'enhance')->now();
ee()->view->extra_alerts = array('security-tip');
if (AJAX_REQUEST) {
ee()->form_validation->run_ajax();
exit;
} elseif (ee()->form_validation->run() !== FALSE) {
if ($this->saveSettings($vars['sections'])) {
ee()->view->set_message('success', lang('preferences_updated'), lang('preferences_updated_desc'), TRUE);
}
ee()->functions->redirect($base_url);
} elseif (ee()->form_validation->errors_exist()) {
ee()->view->set_message('issue', lang('settings_save_error'), lang('settings_save_error_desc'));
}
ee()->view->ajax_validate = TRUE;
ee()->view->base_url = $base_url;
ee()->view->cp_page_title = lang('security_privacy');
ee()->view->save_btn_text = 'btn_save_settings';
ee()->view->save_btn_text_working = 'btn_saving';
ee()->cp->render('settings/form', $vars);
}
示例11: index
public function index()
{
$vars['sections'] = array(array(array('title' => 'require_captcha', 'desc' => 'require_captcha_desc', 'fields' => array('require_captcha' => array('type' => 'yes_no'))), array('title' => 'captcha_font', 'desc' => 'captcha_font_desc', 'fields' => array('captcha_font' => array('type' => 'yes_no'))), array('title' => 'captcha_rand', 'desc' => 'captcha_rand_desc', 'fields' => array('captcha_rand' => array('type' => 'yes_no'))), array('title' => 'captcha_require_members', 'desc' => 'captcha_require_members_desc', 'fields' => array('captcha_require_members' => array('type' => 'yes_no')))), 'url_path_settings_title' => array(array('title' => 'captcha_url', 'desc' => 'captcha_url_desc', 'fields' => array('captcha_url' => array('type' => 'text'))), array('title' => 'captcha_path', 'desc' => 'captcha_path_desc', 'fields' => array('captcha_path' => array('type' => 'text')))));
ee()->form_validation->set_rules(array(array('field' => 'captcha_url', 'label' => 'lang:captcha_url', 'rules' => 'strip_tags|valid_xss_check'), array('field' => 'captcha_path', 'label' => 'lang:captcha_path', 'rules' => 'strip_tags|valid_xss_check|file_exists|writable')));
ee()->form_validation->validateNonTextInputs($vars['sections']);
$base_url = ee('CP/URL')->make('settings/captcha');
if (AJAX_REQUEST) {
ee()->form_validation->run_ajax();
exit;
} elseif (ee()->form_validation->run() !== FALSE) {
if ($this->saveSettings($vars['sections'])) {
ee()->view->set_message('success', lang('preferences_updated'), lang('preferences_updated_desc'), TRUE);
}
ee()->functions->redirect($base_url);
} elseif (ee()->form_validation->errors_exist()) {
ee()->view->set_message('issue', lang('settings_save_error'), lang('settings_save_error_desc'));
}
ee()->view->ajax_validate = TRUE;
ee()->view->base_url = $base_url;
ee()->view->cp_page_title = lang('captcha_settings');
ee()->view->cp_page_title_alt = lang('captcha_settings_title');
ee()->view->save_btn_text = 'btn_save_settings';
ee()->view->save_btn_text_working = 'btn_saving';
ee()->cp->render('settings/form', $vars);
}
示例12: fire
/**
* {@inheritdoc}
*/
protected function fire()
{
if ($this->argument('action_id')) {
ee()->db->where('action_id', $this->argument('action_id'));
}
$classes = $this->option('class') ?: [];
if ($modules = $this->option('module')) {
foreach ($modules as $module) {
$classes[] = ucfirst($module);
$classes[] = ucfirst($module) . '_mcp';
}
}
if ($classes) {
ee()->db->where_in('class', $classes);
}
if ($methods = $this->option('method')) {
ee()->db->where_in('method', $methods);
}
$query = ee()->db->order_by('action_id')->get('actions');
if ($query->num_rows() === 0) {
if ($actionId) {
$this->warning('There was no action found with the specified action_id.');
} else {
$this->warning('There were no actions found.');
}
} else {
$results = $query->result_array();
$headers = array('ID', 'Class', 'Method');
if (array_key_exists('csrf_exempt', $results[0])) {
$headers[] = 'CSRF Exempt';
}
$this->table($headers, $results);
}
$query->free_result();
}
示例13: index
/**
* General Settings
*/
public function index()
{
$vars['sections'] = array(array(array('title' => 'site_index', 'desc' => 'site_index_desc', 'fields' => array('site_index' => array('type' => 'text'))), array('title' => 'site_url', 'desc' => 'site_url_desc', 'fields' => array('site_url' => array('type' => 'text', 'required' => TRUE))), array('title' => 'cp_url', 'desc' => 'cp_url_desc', 'fields' => array('cp_url' => array('type' => 'text', 'required' => TRUE))), array('title' => 'themes_url', 'desc' => 'themes_url_desc', 'fields' => array('theme_folder_url' => array('type' => 'text', 'required' => TRUE))), array('title' => 'themes_path', 'desc' => 'themes_path_desc', 'fields' => array('theme_folder_path' => array('type' => 'text', 'required' => TRUE))), array('title' => 'docs_url', 'desc' => 'docs_url_desc', 'fields' => array('doc_url' => array('type' => 'text'))), array('title' => 'member_segment_trigger', 'desc' => 'member_segment_trigger_desc', 'fields' => array('profile_trigger' => array('type' => 'text'))), array('title' => 'category_segment_trigger', 'desc' => 'category_segment_trigger_desc', 'fields' => array('reserved_category_word' => array('type' => 'text'))), array('title' => 'category_url', 'desc' => 'category_url_desc', 'fields' => array('use_category_name' => array('type' => 'inline_radio', 'choices' => array('y' => lang('category_url_opt_titles'), 'n' => lang('category_url_opt_ids'))))), array('title' => 'url_title_separator', 'desc' => 'url_title_separator_desc', 'fields' => array('word_separator' => array('type' => 'select', 'choices' => array('dash' => lang('url_title_separator_opt_hyphen'), 'underscore' => lang('url_title_separator_opt_under')))))));
ee()->form_validation->set_rules(array(array('field' => 'site_index', 'label' => 'lang:site_index', 'rules' => 'strip_tags|valid_xss_check'), array('field' => 'site_url', 'label' => 'lang:site_url', 'rules' => 'required|strip_tags|valid_xss_check'), array('field' => 'cp_url', 'label' => 'lang:cp_url', 'rules' => 'required|strip_tags|valid_xss_check'), array('field' => 'theme_folder_url', 'label' => 'lang:themes_url', 'rules' => 'required|strip_tags|valid_xss_check'), array('field' => 'theme_folder_path', 'label' => 'lang:themes_path', 'rules' => 'required|strip_tags|valid_xss_check|file_exists'), array('field' => 'profile_trigger', 'label' => 'lang:member_segment_trigger', 'rules' => 'alpha_dash'), array('field' => 'doc_url', 'label' => 'lang:docs_url', 'rules' => 'strip_tags|valid_xss_check')));
ee()->form_validation->validateNonTextInputs($vars['sections']);
$base_url = ee('CP/URL')->make('settings/urls');
if (AJAX_REQUEST) {
ee()->form_validation->run_ajax();
exit;
} elseif (ee()->form_validation->run() !== FALSE) {
if ($this->saveSettings($vars['sections'])) {
ee()->view->set_message('success', lang('preferences_updated'), lang('preferences_updated_desc'), TRUE);
}
ee()->functions->redirect($base_url);
} elseif (ee()->form_validation->errors_exist()) {
ee()->view->set_message('issue', lang('settings_save_error'), lang('settings_save_error_desc'));
}
ee()->view->base_url = $base_url;
ee()->view->ajax_validate = TRUE;
ee()->view->cp_page_title = lang('url_path_settings');
ee()->view->cp_page_title_alt = lang('url_path_settings_title');
ee()->view->save_btn_text = 'btn_save_settings';
ee()->view->save_btn_text_working = 'btn_saving';
ee()->cp->render('settings/form', $vars);
}
示例14: report_run
function report_run()
{
// Get the report data
$report = ee()->db->query("SELECT * FROM exp_reports WHERE report_id=" . ee()->input->get('report_id') . " LIMIT 1");
$report = $report->row_array();
if (empty($report['query'])) {
show_error(lang('error_no_query'));
}
// Run the query
$query = ee()->db->query($report['query']);
if ($query->num_rows() > 0) {
// do any post processing which is required
if (!empty($report['post_processing'])) {
$report['data'] = eval($report['post_processing']);
if (!$report['data']) {
show_error(lang('error_post_processing'));
exit;
}
} else {
$report['data'] = $query->result_array();
}
$this->export($report);
} else {
show_error(lang('error_no_results'));
}
}
示例15: force_download
function force_download($filename = '', $data = '')
{
if ($filename == '' or $data == '') {
return FALSE;
}
ee()->load->library('mime_type');
$mime = ee()->mime_type->ofBuffer($data);
$len = function_exists('mb_strlen') ? mb_strlen($data, '8bit') : strlen($data);
// Generate the server headers
if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") !== FALSE) {
header('Content-Type: "' . $mime . '"');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header("Content-Transfer-Encoding: binary");
header('Pragma: public');
header("Content-Length: " . $len);
} else {
header('Content-Type: "' . $mime . '"');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Pragma: no-cache');
header("Content-Length: " . $len);
}
exit($data);
}