Overview

Namespaces

  • None
  • swag

Classes

  • H5pSwagifact
  • H5pUtil
  • SettingsPageController
  • ShortcodeUtil
  • swag\ArrayUtil
  • swag\Singleton
  • swag\WpUtil
  • SwagMapController
  • SwagPageController
  • Swagpath
  • SwagpathController
  • SwagpathSyncer
  • SwagPlugin
  • SwagPostItem
  • SwagTgmpaController
  • SwagTrack
  • SwagTrackController
  • SwagUser
  • Template
  • Xapi
  • Overview
  • Namespace
  • Class
 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 
<?php

require __DIR__."/../utils/Xapi.php";

/**
 * Common base functions.
 */
class SwagPlugin {

    private static $instance;

    /**
     * Constructor.
     */
    private function __construct() {
    }

    /**
     * Get xapi endpoint, if configured.
     */
    public function getXapi() {
        static $xapi;

        if (!$xapi) {
            if (is_plugin_active("wp-xapi-lrs/wp-xapi-lrs.php")) {
                $endpoint=site_url()."/wp-content/plugins/wp-xapi-lrs/endpoint.php";
                $username=get_option("xapilrs_username");
                $password=get_option("xapilrs_password");

                $xapi=new Xapi($endpoint,$username,$password);
            }

            else {
                $endpoint=get_option("ti_xapi_endpoint_url");
                $username=get_option("ti_xapi_username");
                $password=get_option("ti_xapi_password");

                if ($endpoint)
                    $xapi=new Xapi($endpoint,$username,$password);

                else
                    $xapi=NULL;
            }
        }

        return $xapi;
    }

    /**
     * Get sinleton instance.
     */
    public static function instance() {
        if (!SwagPlugin::$instance)
            SwagPlugin::$instance=new SwagPlugin();

        return SwagPlugin::$instance;
    }
}
Swag API documentation generated by ApiGen