本文整理汇总了PHP中WYSIJA::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP WYSIJA::redirect方法的具体用法?PHP WYSIJA::redirect怎么用?PHP WYSIJA::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WYSIJA
的用法示例。
在下文中一共展示了WYSIJA::redirect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirectProcess
function redirectProcess()
{
global $wysi_location;
if (!$wysi_location) {
$wysi_location = $this->getDefaultUrl();
}
WYSIJA::redirect($wysi_location);
}
示例2: form_edit
function form_edit()
{
// define whether the form can be edited
$this->data['can_edit'] = true;
// wysija form editor javascript files
$this->js[] = 'wysija-form-editor';
$this->js[] = 'wysija-admin-ajax-proto';
// $this->js[]='wysija-admin-ajax';
$this->js[] = 'wysija-base-script-64';
$this->js[] = 'mailpoet-select2';
// make sure the editor content is not cached
//header('Cache-Control: no-cache, max-age=0, must-revalidate, no-store'); // HTTP/1.1
//header('Expires: Fri, 9 Mar 1984 00:00:00 GMT');
// get form id
$form_id = isset($_REQUEST['id']) && (int) $_REQUEST['id'] > 0 ? (int) $_REQUEST['id'] : null;
$form = array('name' => __('New form', WYSIJA));
// if no form id was specified, then it's a new form
if ($form_id !== null) {
// try to get form data based on form id
$model_forms = WYSIJA::get('forms', 'model');
$form = $model_forms->getOne($form_id);
// if the form does not exist
if (empty($form)) {
// redirect to forms list
$this->error(__('This form does not exist.', WYSIJA), true);
WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
} else {
// pass form id to the view
$this->data['form_id'] = (int) $form['form_id'];
}
}
// pass form to the view
$this->data['form'] = $form;
$helper_form_engine = WYSIJA::get('form_engine', 'helper');
$lists = $helper_form_engine->get_lists();
$this->data['lists'] = $lists;
// disable editing capability when there is no list
if (empty($lists)) {
$this->data['can_edit'] = false;
}
// get custom fields
$this->data['custom_fields'] = $helper_form_engine->get_custom_fields();
// translations
$this->jsTrans = array_merge($this->jsTrans, $helper_form_engine->get_translations());
}
示例3: check
function check()
{
$config =& WYSIJA::get('config', 'model');
if (!$config->getValue('wysija_db_version') || version_compare($config->getValue('wysija_db_version'), WYSIJA::get_version()) < 0) {
$this->update(WYSIJA::get_version());
}
$noredirect = false;
$timeInstalled = $config->getValue('installed_time') + 3600;
if (current_user_can('switch_themes')) {
if ((!$config->getValue('wysija_whats_new') || version_compare($config->getValue('wysija_whats_new'), WYSIJA::get_version()) < 0) && isset($_REQUEST['page']) && in_array($_REQUEST['page'], array('wysija_config', 'wysija_campaigns', 'wysija_subscribers'))) {
if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('whats_new', 'welcome_new', 'activate-plugin'))) {
$noredirect = true;
}
if (!$noredirect) {
if (time() > $timeInstalled) {
WYSIJA::redirect('admin.php?page=wysija_campaigns&action=whats_new');
} else {
WYSIJA::redirect('admin.php?page=wysija_campaigns&action=welcome_new');
}
$mConfig =& WYSIJA::get('config', 'model');
$mConfig->save(array('wysija_whats_new' => WYSIJA::get_version()));
}
}
}
}
示例4: check
/**
*
* @return type
*/
function check(){
//we can go there if this is not a new installation and it's an admin
if(WYSIJA::current_user_can('switch_themes') ){
// check that the redirection is only processed from wysija's interfaces
if(isset($_REQUEST['page']) && in_array($_REQUEST['page'], array('wysija_config','wysija_campaigns','wysija_subscribers'))){
// we are earlier than 1.1 or earlier than the current file version so we can run what's needed to reach the right version number
$config=WYSIJA::get('config','model');
if(!$config->getValue('wysija_db_version') || version_compare($config->getValue('wysija_db_version'),WYSIJA::get_version()) < 0){
$this->update(WYSIJA::get_version());
}
// once the update procedure is done we can redirect to the what's new/fixed page
$noredirect=false;
//get the right option name based on the type of site we're in
$whats_new_option='wysija_whats_new';
$is_multisite=is_multisite();
$is_network_admin=WYSIJA::current_user_can('manage_network');
// check that in case of a multisite configuration only the network admin sees that update page
if($is_multisite){
if($is_network_admin){
$whats_new_option='ms_wysija_whats_new';
}else {
return;
}
}
// a whats_new option is set and it is less than the current version so that means we need to display it
if((!$config->getValue($whats_new_option) || version_compare($config->getValue($whats_new_option),WYSIJA::get_version()) < 0)){
//if there is an action set and it's one of those then we just don't redirect
if(isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('whats_new','welcome_new','activate-plugin'))) $noredirect=true;
if(!$noredirect) {
$timeInstalled=$config->getValue('installed_time')+3600;
//if it is a fresh install then it redirects to the welcome screen otherwise to the update one
if(time()>$timeInstalled){
WYSIJA::redirect('admin.php?page=wysija_campaigns&action=whats_new');
}else{
WYSIJA::redirect('admin.php?page=wysija_campaigns&action=welcome_new');
}
}
}
}
}
}
示例5: check
function check()
{
$config =& WYSIJA::get('config', 'model');
if (!$config->getValue('wysija_db_version') || version_compare($config->getValue('wysija_db_version'), WYSIJA::get_version()) < 0) {
$this->update(WYSIJA::get_version());
}
$noredirect = false;
if (WYSIJA::current_user_can('switch_themes')) {
if (isset($_REQUEST['page']) && in_array($_REQUEST['page'], array('wysija_config', 'wysija_campaigns', 'wysija_subscribers'))) {
$whats_new_option = 'wysija_whats_new';
$is_multisite = is_multisite();
$is_network_admin = WYSIJA::current_user_can('manage_network');
if ($is_multisite) {
if ($is_network_admin) {
$whats_new_option = 'ms_wysija_whats_new';
} else {
return;
}
}
if (!$config->getValue($whats_new_option) || version_compare($config->getValue($whats_new_option), WYSIJA::get_version()) < 0) {
if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('whats_new', 'welcome_new', 'activate-plugin'))) {
$noredirect = true;
}
if (!$noredirect) {
$timeInstalled = $config->getValue('installed_time') + 3600;
if (time() > $timeInstalled) {
WYSIJA::redirect('admin.php?page=wysija_campaigns&action=whats_new');
} else {
WYSIJA::redirect('admin.php?page=wysija_campaigns&action=welcome_new');
}
}
}
}
}
}
示例6: form_edit
function form_edit()
{
// wysija form editor javascript files
$this->js[] = 'wysija-form-editor';
$this->js[] = 'wysija-admin-ajax-proto';
$this->js[] = 'wysija-admin-ajax';
$this->js[] = 'wysija-base-script-64';
// make sure the editor content is not cached
//header('Cache-Control: no-cache, max-age=0, must-revalidate, no-store'); // HTTP/1.1
//header('Expires: Fri, 9 Mar 1984 00:00:00 GMT');
// get form id
$form_id = isset($_REQUEST['id']) && (int) $_REQUEST['id'] > 0 ? (int) $_REQUEST['id'] : null;
$form = array('name' => __('New form', WYSIJA));
// if no form id was specified, then it's a new form
if ($form_id !== null) {
// try to get form data based on form id
$model_forms = WYSIJA::get('forms', 'model');
$form = $model_forms->getOne($form_id);
// if the form does not exist
if (empty($form)) {
// redirect to forms list
$this->error(__('This form does not exist.', WYSIJA), true);
WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
} else {
// pass form id to the view
$this->data['form_id'] = (int) $form['form_id'];
}
}
// pass form to the view
$this->data['form'] = $form;
$helper_form_engine = WYSIJA::get('form_engine', 'helper');
$lists = $helper_form_engine->get_lists();
// select default list
$default_list = array();
if (!empty($lists)) {
$default_list[] = array('list_id' => $lists[0]['list_id'], 'is_checked' => 0);
}
$this->data['lists'] = $lists;
// get available custom fields
$model_user_field = WYSIJA::get('user_field', 'model');
$model_user_field->orderBy('field_id');
$custom_fields = $model_user_field->getRows(false);
// extra widgets that can be added more than once
$extra_fields = array(array('name' => __('List selection', WYSIJA), 'column_name' => 'list', 'column_type' => 'list', 'params' => array('label' => __('Select list(s):', WYSIJA), 'values' => $default_list)), array('name' => __('Random text or HTML', WYSIJA), 'column_name' => 'html', 'column_type' => 'html', 'params' => array('text' => __('Random text or HTML', WYSIJA))), array('name' => __('Divider', WYSIJA), 'column_name' => 'divider', 'column_type' => 'divider'));
// set data to be passed to the view
$this->data['custom_fields'] = array_merge($custom_fields, $extra_fields);
// translations
$this->jsTrans = array_merge($this->jsTrans, $helper_form_engine->get_translations());
// This should be the title of the page but I don't know how to make it happen...
// __('Edit', WYSIJA).' '.$this->data['form']['name'];
}