• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_ajax函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: process

 public function process($slug = NULL)
 {
     if (!$slug) {
         show_404();
     }
     $form = $this->fuel->forms->get($slug);
     $return_url = $this->input->get_post('return_url') ? $this->input->get_post('return_url') : $form->get_return_url();
     $form_url = $this->input->get_post('form_url');
     if ($form and $form->process()) {
         if (is_ajax()) {
             // Set a 200 (okay) response code.
             set_status_header('200');
             echo $form->after_submit_text;
             exit;
         } else {
             $this->session->set_flashdata('success', TRUE);
             redirect($return_url);
         }
     } else {
         $this->session->set_flashdata('posted', $this->input->post());
         if (is_ajax()) {
             // Set a 500 (bad) response code.
             set_status_header('500');
             echo display_errors(NULL, '');
             exit;
         } else {
             if (!empty($form_url) && $form_url != $return_url) {
                 $return_url = $form_url;
                 // update to post back to the correct page when there's an error
             }
             $this->session->set_flashdata('error', $form->errors());
             redirect($return_url);
         }
     }
 }
开发者ID:daylightstudio,项目名称:FUEL-CMS-Forms-Module,代码行数:35,代码来源:Forms.php


示例2: get

 /**
  * @return string
  */
 function get()
 {
     logger('admin_content', LOGGER_DEBUG);
     if (!is_site_admin()) {
         return login(false);
     }
     /*
      * Page content
      */
     $o = '';
     if (argc() > 1) {
         $o = $this->sm->call('get');
         if ($o === false) {
             notice(t('Item not found.'));
         }
     } else {
         $o = $this->admin_page_summary();
     }
     if (is_ajax()) {
         echo $o;
         killme();
         return '';
     } else {
         return $o;
     }
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:29,代码来源:Admin.php


示例3: eventon_prevent_admin_access

function eventon_prevent_admin_access()
{
    if (get_option('eventon_lock_down_admin') == 'yes' && !is_ajax() && !(current_user_can('edit_posts') || current_user_can('manage_eventon'))) {
        //wp_safe_redirect(get_permalink(woocommerce_get_page_id('myaccount')));
        exit;
    }
}
开发者ID:bpea,项目名称:amtrak-careers,代码行数:7,代码来源:eventon-admin-functions.php


示例4: display

 public function display($view = null, $vars = null, $return = false)
 {
     $_INS =& get_instance();
     foreach (get_object_vars($_INS) as $_key => $_var) {
         if (!isset($this->{$_key})) {
             $this->{$_key} =& $_INS->{$_key};
         }
     }
     if (is_null($view)) {
         $view = $_INS->get_controller() . '/' . $_INS->get_action();
     }
     $file_exists = false;
     foreach ($this->_view_paths as $path) {
         $view_file = $path . $view . $this->_ext;
         if (file_exists($view_file)) {
             $file_exists = true;
             break;
         }
     }
     $buffer = $this->pick($view_file, $vars);
     if ($return) {
         return $buffer;
     } else {
         $_INS->output->append_output($buffer);
         if (is_ajax()) {
             exit(json_encode($this->_cached_vars));
         }
     }
     return $this;
 }
开发者ID:yang7hua,项目名称:mall,代码行数:30,代码来源:View.php


示例5: vendor_product_restriction

 function vendor_product_restriction()
 {
     global $WCMp;
     if (is_ajax()) {
         return;
     }
     $current_user_id = get_current_user_id();
     if (is_user_wcmp_vendor($current_user_id)) {
         if (isset($_GET['post'])) {
             $current_post_id = $_GET['post'];
             if (get_post_type($current_post_id) == 'product') {
                 if (in_array(get_post_status($current_post_id), array('draft', 'publish', 'pending'))) {
                     $product_vendor_obj = get_wcmp_product_vendors($current_post_id);
                     if ($product_vendor_obj->id != $current_user_id) {
                         wp_redirect(admin_url() . 'edit.php?post_type=product');
                         exit;
                     }
                 }
             } else {
                 if (get_post_type($current_post_id) == 'shop_coupon') {
                     $coupon_obj = get_post($current_post_id);
                     if ($coupon_obj->post_author != $current_user_id) {
                         wp_redirect(admin_url() . 'edit.php?post_type=shop_coupon');
                         exit;
                     }
                 }
             }
         }
     }
 }
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:30,代码来源:class-wcmp-product.php


示例6: run

 public function run()
 {
     if (is_ajax()) {
         $this->add_action('init', array($this, 'runAjax'));
     }
     $this->actionHandler->run();
 }
开发者ID:oscaru,项目名称:WP-PluginFactory,代码行数:7,代码来源:BasePlugin.php


示例7: viewsrc_content

function viewsrc_content(&$a)
{
    $o = '';
    $item_id = argc() > 1 ? intval(argv(1)) : 0;
    $json = argc() > 2 && argv(2) === 'json' ? true : false;
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
    }
    if (!$item_id) {
        $a->error = 404;
        notice(t('Item not found.') . EOL);
    }
    if (local_user() && $item_id) {
        $r = q("select item_flags, body from item where item_restrict = 0 and uid = %d and id = %d limit 1", intval(local_user()), intval($item_id));
        if ($r) {
            if ($r[0]['item_flags'] & ITEM_OBSCURED) {
                $r[0]['body'] = crypto_unencapsulate(json_decode($r[0]['body'], true), get_config('system', 'prvkey'));
            }
            $o = $json ? json_encode($r[0]['body']) : str_replace("\n", '<br />', $r[0]['body']);
        }
    }
    if (is_ajax()) {
        echo $o;
        killme();
    }
    return $o;
}
开发者ID:Mauru,项目名称:red,代码行数:27,代码来源:viewsrc.php


示例8: viewAction

 /**
  * form
  */
 function viewAction()
 {
     if ($this->disable === true) {
         return;
     }
     if ($_GET['id']) {
         $data['data'] = $this->obj->view();
     }
     $data['view'] = true;
     if ($_POST && is_ajax()) {
         $setData = $_POST;
         if ($_GET['id']) {
             $condition = ['_id' => new \MongoId($_GET['id'])];
             $rt = $this->obj->updateValidate($condition, $setData);
         } else {
             $rt = $this->obj->insertValidate($setData);
         }
         $data['status'] = 0;
         $data['label'] = '系统未知错误';
         $data['msg'] = '保存数据失败!!!';
         if (is_array($rt) && $rt['errors']) {
             $data['msg'] = $rt['errors'];
         } elseif (is_object($rt)) {
             $data = ['status' => 1, 'msg' => '添加成功', 'label' => '提示信息'];
         } elseif ($rt) {
             $data = ['status' => 1, 'msg' => '更新成功', 'label' => '提示信息'];
         }
         exit(json_encode($data));
     }
     if ($this->data) {
         $data = $data + $this->data;
     }
     $this->data = $data;
     return $this->view($this->view, $data);
 }
开发者ID:sunkangtaichi,项目名称:PHPAPPLISTION_START,代码行数:38,代码来源:BaseAdminAutoController.php


示例9: test_is_ajax

 /**
  * Test is_ajax()
  *
  * @since 1.0.0
  */
 public function test_is_ajax()
 {
     if (!defined('DOING_AJAX')) {
         define('DOING_AJAX', true);
     }
     $this->assertEquals(true, is_ajax());
 }
开发者ID:axisthemes,项目名称:axiscomposer,代码行数:12,代码来源:conditional-functions.php


示例10: set_status_page

 public function set_status_page()
 {
     if (!is_ajax()) {
         include_once 'class-wc-gzd-admin-status.php';
         add_action('admin_menu', array($this, 'status_menu'), 60);
     }
 }
开发者ID:crazy4chrissi,项目名称:woocommerce-germanized,代码行数:7,代码来源:class-wc-gzd-admin.php


示例11: default_vars

 private function default_vars()
 {
     $curPageFull = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $curPage = explode("?", $curPageFull);
     $cfg = $this->f3->get('cfg');
     unset($cfg['DB']);
     $this->vars['_isLocal'] = isLocal();
     $this->vars['_version'] = $this->f3->get('_version');
     $this->vars['_v'] = $this->f3->get('_v');
     $this->vars['_cfg'] = $cfg;
     $this->vars['_folder'] = $this->vars['folder'];
     $this->vars['_domain'] = $this->f3->get('domain');
     $this->vars['_api_hits'] = $this->f3->get('_api_hits');
     $this->vars['_user'] = $this->f3->get('user');
     $this->vars['_isAjax'] = is_ajax();
     if ($this->vars['_page']) {
         $page = $this->vars['_page'];
     } else {
         $page = $_SERVER['uri'];
         if ($page == null) {
             $page = "/";
         }
     }
     $this->vars['_page'] = $page;
 }
开发者ID:WilliamStam,项目名称:LiN-Basic,代码行数:25,代码来源:template.php


示例12: includes

 /**
  * Include any classes we need within admin.
  */
 public function includes()
 {
     // Functions
     include_once 'scf-admin-functions.php';
     //include_once( 'wc-meta-box-functions.php' );
     // Classes
     //include_once( 'class-wc-admin-post-types.php' );
     //include_once( 'class-wc-admin-taxonomies.php' );
     // Classes we only need during non-ajax requests
     if (!is_ajax()) {
         include_once 'class-scf-admin-menus.php';
         //include_once( 'class-wc-admin-welcome.php' );
         //include_once( 'class-wc-admin-notices.php' );
         //include_once( 'class-wc-admin-assets.php' );
         //include_once( 'class-wc-admin-webhooks.php' );
         // Help
         //if ( apply_filters( 'woocommerce_enable_admin_help_tab', true ) ) {
         //	include_once( 'class-wc-admin-help.php' );
         //}
     }
     // Importers
     //if ( defined( 'WP_LOAD_IMPORTERS' ) ) {
     //	include_once( 'class-wc-admin-importers.php' );
     //}
 }
开发者ID:sabiux,项目名称:condofees,代码行数:28,代码来源:class-scf-admin.php


示例13: viewsrc_content

function viewsrc_content(&$a)
{
    $o = '';
    $sys = get_sys_channel();
    $item_id = argc() > 1 ? intval(argv(1)) : 0;
    $json = argc() > 2 && argv(2) === 'json' ? true : false;
    if (!local_channel()) {
        notice(t('Permission denied.') . EOL);
    }
    if (!$item_id) {
        App::$error = 404;
        notice(t('Item not found.') . EOL);
    }
    $item_normal = item_normal();
    if (local_channel() && $item_id) {
        $r = q("select id, item_flags, item_obscured, body from item where uid in (%d , %d) and id = %d {$item_normal} limit 1", intval(local_channel()), intval($sys['channel_id']), intval($item_id));
        if ($r) {
            if (intval($r[0]['item_obscured'])) {
                $r[0]['body'] = crypto_unencapsulate(json_decode($r[0]['body'], true), get_config('system', 'prvkey'));
            }
            $o = $json ? json_encode($r[0]['body']) : str_replace("\n", '<br />', $r[0]['body']);
        }
    }
    if (is_ajax()) {
        print '<div><i class="icon-pencil"> ' . t('Source of Item') . ' ' . $r[0]['id'] . '</i></div>';
        echo $o;
        killme();
    }
    return $o;
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:30,代码来源:viewsrc.php


示例14: active_free_order

 /**
  * @return void
  */
 public function active_free_order()
 {
     try {
         $response = array();
         $fb_id = isset($_POST['post_id']) ? $_POST['post_id'] : 0;
         $redirect_url = isset($_POST['redirect_url']) ? $_POST['redirect_url'] : '';
         if (!$fb_id || !$redirect_url || !is_user_logged_in()) {
             throw new Exception(__('Không thể kích hoạt', NDV_WOO));
             return false;
         }
         $user = wp_get_current_user();
         update_user_meta($user->ID, 'ndv_share', $fb_id);
         $response['status'] = 'success';
         $response['redirect'] = $redirect_url;
         if (is_ajax()) {
             echo '<!--WC_START-->' . json_encode($response) . '<!--WC_END-->';
             exit;
         } else {
             wp_redirect($response['redirect']);
             exit;
         }
     } catch (Exception $e) {
         if (!empty($e)) {
             wc_add_notice($e->getMessage(), 'error');
         }
     }
     if (is_ajax()) {
         ob_start();
         wc_print_notices();
         $messages = ob_get_clean();
         echo '<!--WC_START-->' . json_encode(array('result' => 'failure', 'messages' => isset($messages) ? $messages : '')) . '<!--WC_END-->';
         exit;
     }
 }
开发者ID:ltdat287,项目名称:id.nhomdichvu,代码行数:37,代码来源:class-ndv-share.php


示例15: controller_init

 public function controller_init()
 {
     if (!class_exists('WC_Coupon')) {
         return;
     }
     //Admin hooks
     add_action('admin_init', array(&$this, 'admin_init'));
     //Frontend hooks
     //add_action( 'woocommerce_cart_updated',  array( &$this, 'update_matched_autocoupons' ) ); //experiment 2.1.0-b1
     add_action('woocommerce_check_cart_items', array(&$this, 'update_matched_autocoupons'), 0);
     //Remove coupon before WC does it and shows a message
     add_action('woocommerce_before_cart_totals', array(&$this, 'update_matched_autocoupons'));
     //When cart is updated after changing shipping method
     add_action('woocommerce_review_order_before_cart_contents', array(&$this, 'update_matched_autocoupons'));
     //When cart is updated after changing shipping or payment method
     //Last check for coupons with restricted_emails
     add_action('woocommerce_checkout_update_order_review', array($this, 'fetch_billing_email'), 10);
     // AJAX One page checkout
     add_filter('woocommerce_cart_totals_coupon_label', array(&$this, 'coupon_label'), 10, 2);
     add_filter('woocommerce_cart_totals_coupon_html', array(&$this, 'coupon_html'), 10, 2);
     //Inhibit redirect to cart when apply_coupon supplied
     add_filter('option_woocommerce_cart_redirect_after_add', array(&$this, 'option_woocommerce_cart_redirect_after_add'));
     if (!is_ajax()) {
         add_action('wp_loaded', array(&$this, 'coupon_by_url'), 23);
         //Coupon through url
     }
 }
开发者ID:JaneJieYing,项目名称:kiddoonline_dvlpment,代码行数:27,代码来源:wjecf-autocoupon.php


示例16: init_module

function init_module($module)
{
    $modpath = BASEPATH . 'modules/' . $module . '/';
    if (is_dir($modpath)) {
        $modcfg = array('name' => $module, 'path' => $modpath, 'validate' => 'user', 'redirect' => 'login', 'layout' => 'main');
        if (file_exists($modpath . 'config.php')) {
            $config = (include $modpath . 'config.php');
            foreach ($config as $key => $val) {
                $modcfg[$key] = $val;
            }
        }
        $modcfg = json_decode(json_encode($modcfg));
        add_module($module, $modcfg);
        if ($modcfg->validate) {
            if (!has_session($modcfg->validate)) {
                if (is_ajax()) {
                    echo json_encode(array('success' => false, 'message' => __('Your session has been expired !'), 'redirect' => site_url($modcfg->redirect)));
                    exit;
                } else {
                    redirect($modcfg->redirect);
                }
            }
        }
    } else {
        show_404(sprintf(__('Page %s does not found!'), $module));
    }
    return get_module($module);
}
开发者ID:londomloto,项目名称:immortal,代码行数:28,代码来源:module.php


示例17: save_tree

 function save_tree()
 {
     // Allow only ajax calls
     if (!is_ajax()) {
         return show_404();
     }
     $this->load->model('categories_model');
     $list = $this->input->post('list');
     // Update db with order posted
     $i = 0;
     foreach ($list as $id => $parent_id) {
         $Category = new Categories_model();
         $node_info_array = array();
         $node_info_array['id'] = $id;
         $node_info_array['parent_id'] = $parent_id == 'root' ? 0 : $parent_id;
         $node_info_array['sort'] = $i;
         // Save Node
         $Category->from_array($node_info_array);
         $Category->save();
         $i++;
     }
     // Clear categories cache so updates will show on next page load
     $this->load->library('categories_library');
     $this->categories_library->clear_cache();
 }
开发者ID:mamtasingh87,项目名称:bytecode,代码行数:25,代码来源:categories.php


示例18: woocommerce_prevent_admin_access

/**
 * Prevent non-admin access to backend
 */
function woocommerce_prevent_admin_access()
{
    if (get_option('woocommerce_lock_down_admin') == 'yes' && !is_ajax() && !current_user_can('edit_posts')) {
        wp_safe_redirect(get_permalink(get_option('woocommerce_myaccount_page_id')));
        exit;
    }
}
开发者ID:randyhoyt,项目名称:woocommerce,代码行数:10,代码来源:woocommerce-admin-functions.php


示例19: index

 function index()
 {
     $this->_validate_user('tools/seo/google_keywords');
     $this->js_controller_params['method'] = 'google_keywords';
     $seo_config = $this->config->item('seo');
     $vars = array();
     $vars['domain'] = $this->input->post('domain') ? $this->input->post('domain') : !empty($seo_config['keyword_search_default_domain']) ? $seo_config['keyword_search_default_domain'] : $_SERVER['SERVER_NAME'];
     $vars['keywords'] = !empty($_POST['keywords']) ? $this->input->post('keywords') : $seo_config['keyword_google_default_keywords'];
     if (is_array($vars['keywords'])) {
         $options = array();
         foreach ($vars['keywords'] as $val) {
             $options[$val] = $val;
         }
         $vars['keywords'] = $options;
     }
     $vars['num_results'] = $seo_config['keyword_google_num_results'];
     if (!empty($_POST['keywords'])) {
         $keywords = explode(',', $this->input->post('keywords'));
         $domain = str_replace(array('http://', 'www'), '', $this->input->post('domain'));
         $ch = curl_init();
         $found = array();
         foreach ($keywords as $keyword) {
             $keyword = trim($keyword);
             $uri = 'http://www.google.com/search?q=' . rawurlencode($keyword) . '&num=' . $seo_config['keyword_google_num_results'] . '&' . http_build_query($seo_config['keyword_google_additional_params']);
             // scrape html from page running on localhost
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $uri);
             curl_setopt($ch, CURLOPT_HEADER, 0);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             $google_page = curl_exec($ch);
             preg_match_all('|<h3 class=(["\'])?r\\1?><a.+href="(.+)".+</h3>|Umis', $google_page, $matches);
             // echo "<pre style=\"text-align: left;\">";
             // print_r($matches);
             // echo "</pre>";
             // exit();
             $results = array();
             if (!empty($matches[2])) {
                 $results = $matches[2];
             }
             $num = 1;
             foreach ($results as $uri) {
                 if (strpos($uri, $domain) !== FALSE) {
                     if (!isset($found[$keyword])) {
                         $found[$keyword] = array();
                     }
                     $found[$keyword][] = $num;
                 }
                 $num++;
             }
         }
         curl_close($ch);
         $vars['results'] = $found;
         if (is_ajax()) {
             $this->load->view('google_keywords_result', $vars);
             return false;
         }
     }
     $this->_render('google_keywords', $vars);
 }
开发者ID:kieranklaassen,项目名称:FUEL-CMS,代码行数:59,代码来源:google_keywords.php


示例20: wc_deprecated_argument

/**
 * Wrapper for deprecated arguments so we can apply some extra logic.
 *
 * @since  2.7.0
 * @param  string $argument
 * @param  string $version
 * @param  string $replacement
 */
function wc_deprecated_argument($argument, $version, $message = null)
{
    if (is_ajax()) {
        error_log("The {$argument} argument is deprecated since version {$version}. {$message}");
    } else {
        _deprecated_argument($argument, $version, $message);
    }
}
开发者ID:shivapoudel,项目名称:woocommerce,代码行数:16,代码来源:wc-deprecated-functions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_ajax_request函数代码示例发布时间:2022-05-15
下一篇:
PHP is_administrator_rs函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap