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


PHP isAjax函数代码示例

本文整理汇总了PHP中isAjax函数的典型用法代码示例。如果您正苦于以下问题:PHP isAjax函数的具体用法?PHP isAjax怎么用?PHP isAjax使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

 /**
  * The construct of Base_controller
  *
  * Definitions of what is done in this constructor:
  * Set the default timezone configured in the codeigniter
  *
  * Initializate the variable $jsfile and $css_files for use in the views
  *
  * Load the language file
  *
  */
 function __construct()
 {
     parent::__construct();
     $this->data['data'] = array();
     //Set the default timezone configured in the codeigniter
     date_default_timezone_set($this->config->item('default_timezone'));
     //set default for ctrlr_name and class_name
     $class_name = get_class($this);
     $this->ctrlr_name = strtolower($class_name);
     $this->class_name = $class_name;
     //Set default for header and ctrl
     //$this->_set_title($class_name);
     $this->data['ctrlr_name'] = $this->ctrlr_name;
     //Verifica se a função que chamou esta função é 'show', se não for chama a view com o nome dela
     //$this->router = & load_class('Router');
     $class = $this->router->fetch_class();
     $action = $this->router->fetch_method();
     $this->action = $action;
     $this->data['data']['action'] = $this->action;
     $this->uriaction = $this->uri->segment(1);
     $this->data['data']['uriaction'] = $this->uriaction;
     $this->data['data']['site_name'] = "Corre D'água";
     $this->data['content'] = $this->ctrlr_name . '/' . $this->action . '_view';
     $this->data['data']['pagination'] = !empty($this->data['data']['pagination']) ? $this->data['data']['pagination'] : '';
     $this->data['data']['site_name'] = !empty($this->data['data']['site_name']) ? $this->data['data']['site_name'] : '';
     $this->data['data']['site_title'] = !empty($this->data['data']['site_title']) ? $this->data['data']['site_title'] : '';
     if (!isAjax()) {
         //$this->output->enable_profiler(true);
     } else {
         $this->output->set_content_type('application/json');
     }
 }
开发者ID:jeanmalves,项目名称:Corre_Dagua,代码行数:43,代码来源:Base.php

示例2: url

function url($skip_ajax = false)
{
    if ($skip_ajax == false) {
        $is_ajax = isAjax();
        if ($is_ajax == false) {
        } else {
            if ($_SERVER['HTTP_REFERER'] != false) {
                return $_SERVER['HTTP_REFERER'];
            } else {
            }
        }
    }
    $pageURL = 'http';
    if (isset($_SERVER["HTTPS"])) {
        if ($_SERVER["HTTPS"] == "on") {
            $pageURL .= "s";
        }
    }
    $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
    } else {
        $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
    }
    return $pageURL;
}
开发者ID:Gninety,项目名称:Microweber,代码行数:26,代码来源:mw_functions.php

示例3: users

 /**
  * List all the users.
  * 
  * It receives 2 post parameters with ajax call for user filteration
  * 
  * @return settings/user view
  */
 public function users()
 {
     $data['current_role'] = $currentRoleID = $this->role_id;
     $data['is_ajax'] = FALSE;
     $roles = $this->roles->get_roles_list($currentRoleID)->result();
     $params = null;
     if (isAjax()) {
         $data['is_ajax'] = TRUE;
         $params = array('station_id' => $this->input->post('station_id'), 'role_id' => $this->input->post('role_id'));
     }
     $data['users'] = $this->users->get_users($currentRoleID, $params)->result();
     $data['roles'][''] = 'Select';
     $data['stations'][''] = 'Select';
     foreach ($roles as $value) {
         $data['roles'][$value->id] = $value->name;
     }
     $stations = $this->station_model->get_all();
     foreach ($stations as $value) {
         $data['stations'][$value->id] = $value->station_name;
     }
     if (isAjax()) {
         echo $this->load->view('settings/user', $data, TRUE);
         exit_function();
     }
     $this->load->view('settings/user', $data);
 }
开发者ID:TheHexa1,项目名称:AMS,代码行数:33,代码来源:settings.php

示例4: actionLogin

 public function actionLogin()
 {
     $model = $this->createModel('LoginForm');
     if (isPostOrAjaxRequest()) {
         if (isset($_POST['LoginForm'])) {
             $model->attributes = $_POST['LoginForm'];
             if ($model->validate()) {
                 $model->login();
             }
             if (isAjax()) {
                 if ($model->hasErrors()) {
                     // was validation errors
                     $this->validationErrorsAjaxResponse($model, FALSE);
                 } else {
                     // success
                     if (Yii::app()->user->returnUrl) {
                         $response['redirect'] = Yii::app()->user->returnUrl;
                     } else {
                         $response['redirect'] = $this->createUrl('index');
                     }
                     $this->successfulAjaxResponse($response);
                 }
             } else {
                 $this->setModel($model);
             }
         }
     }
     $this->setLayout('login-backend');
     $this->render('login', array('model' => $this->getModel()));
 }
开发者ID:andrelinoge,项目名称:rezydent,代码行数:30,代码来源:SiteController.php

示例5: qqq

/**
 * Dump function
 *
 * @param mixed $var
 * @param int $dump
 * @param int $trace
 */
function qqq($var, $dump = 0, $trace = 0)
{
    ob_start();
    if ($dump == 2) {
        var_export($var);
    } elseif ($dump == 1) {
        var_dump($var);
    } else {
        print_r($var);
    }
    if ($trace == 1) {
        echo PHP_EOL;
        $e = new Exception();
        echo $e->getTraceAsString();
    } elseif ($trace == 2) {
        echo PHP_EOL;
        debug_print_backtrace();
    }
    $res = ob_get_contents();
    ob_end_clean();
    if (!isAjax() && !extension_loaded('xdebug') && $dump == 1) {
        $res = htmlspecialchars($res);
    }
    if (!isset($_SERVER['argv']) || !$_SERVER['argv']) {
        echo PHP_EOL . (!isAjax() ? '<pre>' : '/*'), $res, !isAjax() ? '</pre>' : '*/';
    } else {
        echo PHP_EOL, '  ', $res;
    }
}
开发者ID:virtual97,项目名称:quick-debug,代码行数:36,代码来源:func.php

示例6: redirect

 public function redirect($param = null)
 {
     if (is_null($param)) {
         $param = '/';
     }
     if (!is_array($param)) {
         $param = ['location' => $param];
     }
     if (isAjax()) {
         // если идет вызов редиректа при ajax-запросе,
         // то значит сессия устарела
         // но работе это мешать не должно
         return;
     }
     $location = get_param($param, 'location', '/');
     if (get_param($param, 'back') === 1) {
         $location = get_param($_SERVER, 'HTTP_REFERER', $location);
     }
     if (get_param($param, 'soft') === 1) {
         $delay = get_param($param, 'delay', 3);
         printf('<meta http-equiv="refresh" content="%d; url=%s">', $delay, $location);
     } else {
         header("Location: {$location}");
         die;
     }
 }
开发者ID:matyukhin-maxim,项目名称:openid,代码行数:26,代码来源:CController.php

示例7: actionLoginHandler

 public function actionLoginHandler()
 {
     $model = new LoginForm();
     if (isPostOrAjaxRequest()) {
         if (isset($_POST['LoginForm'])) {
             $model->attributes = $_POST['LoginForm'];
             if ($model->validate()) {
                 if (!$model->isUserBanned()) {
                     $model->login();
                 } else {
                     $response['redirect'] = $this->createUrl('banned');
                     $this->successfulAjaxResponse($response);
                 }
             }
             if (isAjax()) {
                 if ($model->hasErrors()) {
                     $this->validationErrorsAjaxResponse($model, FALSE);
                 } else {
                     $response['redirect'] = Yii::app()->getRequest()->getUrlReferrer();
                     $this->successfulAjaxResponse($response);
                 }
             }
         }
     }
 }
开发者ID:andrelinoge,项目名称:rezydent,代码行数:25,代码来源:TouristDatingController.php

示例8: endAjax

 /**
  * Ends an ajax-age
  *
  * @return string returns the end of an ajax-div
  */
 public static function endAjax()
 {
     if (isAjax()) {
         exit;
     } else {
         return '</div>';
     }
 }
开发者ID:wijnandmet,项目名称:Foundation,代码行数:13,代码来源:html.php

示例9: pajax

function pajax()
{
    if (isAjax() && isset($_POST['pajax'])) {
        echo "<!-- Loaded via Pajax -->";
        echo get_page_content();
        // Please let me know if you know of a better way to do this than die().
        die;
    }
}
开发者ID:Vin985,项目名称:clqweb,代码行数:9,代码来源:pajax.php

示例10: load_facet_columns

 /**
  * Load Facet sidebar for both assets tab and instantations tab.
  * 
  * @return view
  */
 function load_facet_columns()
 {
     if (isAjax()) {
         $is_all_facet = $this->input->post('issearch');
         $index = $this->input->post('index');
         $this->load->library('sphnixrt');
         if ($is_all_facet > 0 || $this->is_station_user) {
             $states = $this->sphinx->facet_index('state', $index);
             $data['org_states'] = sortByOneKey($states['records'], 'state');
             unset($states);
             $stations = $this->sphinx->facet_index('organization', $index);
             $data['stations'] = sortByOneKey($stations['records'], 'organization');
             unset($stations);
             $nomination = $this->sphinx->facet_index('status', $index);
             $data['nomination_status'] = sortByOneKey($nomination['records'], 'status');
             unset($nomination);
             $media_type = $this->sphinx->facet_index('media_type', $index);
             $media_type = $this->make_facet($media_type, 'media_type', 'media_type');
             $data['media_types'] = sortByOneKey($media_type, 'media_type', TRUE);
             unset($media_type);
             $p_format = $this->sphinx->facet_index('physical_format_name', $index, 'physical');
             $p_format = $this->make_facet($p_format, 'physical_format_name', 'physical_format');
             $data['physical_formats'] = sortByOneKey($p_format, 'physical_format_name', TRUE);
             unset($p_format);
             $d_format = $this->sphinx->facet_index('digital_format_name', $index, 'digital');
             $d_format = $this->make_facet($d_format, 'digital_format_name', 'digital_format');
             $data['digital_formats'] = sortByOneKey($d_format, 'digital_format_name', TRUE);
             unset($d_format);
             $generation = $this->sphinx->facet_index('facet_generation', $index);
             $generation = $this->make_facet($generation, 'facet_generation', 'generation');
             $data['generations'] = sortByOneKey($generation, 'facet_generation', TRUE);
             unset($generation);
             $digitized = $this->sphinx->facet_index('digitized', $index, 'digitized');
             $data['digitized'] = $digitized['records'];
             $migration = $this->sphinx->facet_index('migration', $index, 'migration');
             $data['migration'] = $migration['records'];
         } else {
             if ($index == 'assets_list') {
                 $key_name = 'asset';
             } else {
                 $key_name = 'ins';
             }
             $data['org_states'] = json_decode($this->memcached_library->get($key_name . '_state'), TRUE);
             $data['stations'] = json_decode($this->memcached_library->get($key_name . '_stations'), TRUE);
             $data['nomination_status'] = json_decode($this->memcached_library->get($key_name . '_status'), TRUE);
             $data['media_types'] = json_decode($this->memcached_library->get($key_name . '_media_type'), TRUE);
             $data['physical_formats'] = json_decode($this->memcached_library->get($key_name . '_physical'), TRUE);
             $data['digital_formats'] = json_decode($this->memcached_library->get($key_name . '_digital'), TRUE);
             $data['generations'] = json_decode($this->memcached_library->get($key_name . '_generations'), TRUE);
             $data['digitized'] = json_decode($this->memcached_library->get($key_name . '_digitized'), TRUE);
             $data['migration'] = json_decode($this->memcached_library->get($key_name . '_migration'), TRUE);
         }
         echo $this->load->view('instantiations/_facet_columns', $data, TRUE);
         exit_function();
     }
     show_404();
 }
开发者ID:TheHexa1,项目名称:AMS,代码行数:62,代码来源:MY_Records_Controller.php

示例11: auto_complete

 public function auto_complete($str_q = NULL)
 {
     $this->load->model('zanox_model');
     $this->load->model('product_model');
     $arr = $this->product_model->get_auto_complete_terms($str_q);
     if (!isAjax()) {
         show_404();
     }
     echo json_encode($arr, true);
 }
开发者ID:jeanmalves,项目名称:Corre_Dagua,代码行数:10,代码来源:Product.php

示例12: outPut

/** 输出调试信息
 *  @param $str string or array 输出内容
 *  @return string
 */
function outPut($str)
{
    if (isAjax()) {
        return false;
    }
    if (is_array($str)) {
        $str = var_export($str, true);
    }
    echo '<div style="border:1px #996600 solid; padding:5px; margin:10px; background:#F1EBEE; font-size:12px"><pre>' . $str . '</pre></div>';
}
开发者ID:sdgdsffdsfff,项目名称:51jhome_customerservice,代码行数:14,代码来源:sys.fun.php

示例13: redirect

 /**
  * Redirect to URL or close dialog.
  *
  * @param string $url
  * @param bool $dialogRedirect If true, this will redirect dialogs as well, otherwise just close the dialog.
  */
 public static function redirect($url, $dialogRedirect = true)
 {
     $url = (string) $url;
     $redirectJs = '<script type="text/javascript">window.location.href = ' . json_encode($url) . ';</script>';
     if (isAjax()) {
         // we're in a dialog, use javascript to redirect
         self::returnPartial($dialogRedirect ? $redirectJs : '');
     } else {
         throw new ResponseException(RedirectResponse::create($url));
     }
 }
开发者ID:bombayworks,项目名称:currycms,代码行数:17,代码来源:AbstractLegacyBackend.php

示例14: wantsJson

/**
 * Return true if client sent an Accept header with application/json or
 * if the request is AJAX (in which case we assume that the client wants to see
 * JSON)
 * @return bool
 */
function wantsJson()
{
    $hdr = false;
    $hdrs = getallheaders();
    foreach ($hdrs as $k => $v) {
        if ($k == "Accept" && strstr($v, "application/json") !== false) {
            $hdr = true;
            break;
        }
    }
    return $hdr || isAjax();
}
开发者ID:grynn,项目名称:php-lib,代码行数:18,代码来源:functions.php

示例15: error_redirect

function error_redirect($extra, $flash = "")
{
    if (isAjax()) {
        if (wantsScript()) {
            die("alert(\"" . addslashes($flash) . "\");");
        } else {
            die("<script>alert(\"" . addslashes($flash) . "\");</script>");
        }
    } else {
        redirect($extra, $flash);
    }
}
开发者ID:andreyvit,项目名称:retester,代码行数:12,代码来源:render.inc.php


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