Esempio n. 1
0
 public function __construct($_path, $_index, Theme $_theme, Controller $_controller)
 {
     # Set Properties
     $this->path = $_path;
     $this->index = $_index;
     $this->theme = $_theme;
     $this->controller = $_controller;
     # Load plugin config
     $this->config();
     # API Init
     $this->api();
     # Setup Plugin
     if (path_contains('ga/')) {
         # Setup theme
         $this->theme->use_theme(plugin_dir() . '/' . self::_NAMESPACE . '/ui');
         # Setup Controller
         $this->controller->use_controller(plugin_dir() . '/' . self::_NAMESPACE . '/controller');
         # Set Request Variables
         set('ga.request', $this->request());
     }
     # Create an authorisation link if
     # the current user is not authorised
     if ($this->active == false) {
         set('ga.auth_link', $this->api->auth->buildAuthUrl());
     }
 }
Esempio n. 2
0
 /**
  * Construct
  */
 public function __construct(array $fields, array $config)
 {
     $this->dir = plugin_dir() . '/cck/fields';
     $this->fields = $fields;
     $this->config = $config;
     #print_r($this->fields);
     #print_r($this->config);
     # Set Twig filesystem directory
     $loader = new \Twig_Loader_Filesystem($this->dir);
     # Set default options
     $options = array('cache' => false, 'debug' => false);
     # Load Twig
     $this->twig = new \Twig_Environment($loader, $options);
 }
Esempio n. 3
0
/**
 * Plugin Is Active
 *
 * @since 1.0.0
 *
 * $plugin: (string) name of the plugin to check
 */
function plugin_is_active($plugin)
{
    return file_exists(plugin_dir() . '/' . $plugin . '/plugin.php');
}
Esempio n. 4
0
/**
 * Get Content Types
 *
 * Returns an array of available content
 * types declared in site/_content-types.yml
 */
function cck_get_content_types()
{
    return Spyc::YAMLLoad(plugin_dir() . '/cck/_content-types.yml');
}