# extendify/0.2.0/app/Frontend.php

Extendify, version 0.2.0. 71 lines.

- Page: https://pluginprobe.com/plugins/extendify/0.2.0/code/app/Frontend.php
- Raw: https://pluginprobe.com/plugins/extendify/0.2.0/raw/app/Frontend.php
- Modified: 2022-01-06T18:08:32+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/extendify/0.2.0/code/app/Frontend.php#L10-L20`.

```php
<?php
/**
 * Manage any frontend related tasks here.
 */

namespace Extendify\Library;

use Extendify\Library\App;

/**
 * This class handles any file loading for the frontend of the site.
 */
class Frontend
{

    /**
     * The instance
     *
     * @var $instance
     */
    public static $instance = null;

    /**
     * Adds various actions to set up the page
     *
     * @return self|void
     */
    public function __construct()
    {
        if (self::$instance) {
            return self::$instance;
        }

        self::$instance = $this;
        $this->loadScripts();
    }

    /**
     * Adds scripts and styles to every page is enabled
     *
     * @return void
     */
    public function loadScripts()
    {
        \add_action(
            'wp_enqueue_scripts',
            function () {
                // TODO: Determine a way to conditionally load assets (https://github.com/extendify/company-product/issues/72).
                $this->addStylesheets();
            }
        );
    }

    /**
     * Adds stylesheets as needed
     *
     * @return void
     */
    public function addStylesheets()
    {
        $version = App::$environment === 'PRODUCTION' ? App::$version : uniqid();
        \wp_enqueue_style(
            App::$slug . '-utilities',
            EXTENDIFY_BASE_URL . 'public/build/extendify-utilities.css',
            [],
            $version,
            'all'
        );
    }
}

```
