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


PHP is_ajax函数代码示例

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


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


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