# wp-ultimate-post-grid/2.8.0/helpers/ajax.php

WP Ultimate Post Grid, version 2.8.0. 23 lines.

- Page: https://pluginprobe.com/plugins/wp-ultimate-post-grid/2.8.0/code/helpers/ajax.php
- Raw: https://pluginprobe.com/plugins/wp-ultimate-post-grid/2.8.0/raw/helpers/ajax.php
- Modified: 2018-11-13T13:03:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-ultimate-post-grid/2.8.0/code/helpers/ajax.php#L10-L20`.

```php
<?php

class WPUPG_Ajax {

    public function __construct()
    {
    }

    public function url()
    {
        $scheme = ( !empty( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) !== 'off' || ( isset( $_SERVER['SERVER_PORT'] ) && $_SERVER['SERVER_PORT'] == 443 ) ) ? 'https' : 'http';
        $ajaxurl = admin_url( 'admin-ajax.php', $scheme );
        $ajaxurl .= '?wpupg_ajax=1';

        // WPML AJAX Localization Fix
        global $sitepress;
        if( isset( $sitepress) ) {
            $ajaxurl .= '&lang='.$sitepress->get_current_language();
        }

        return $ajaxurl;
    }
}
```
