waAppConfig

Access to app configuration

Contents...

To obtain an instance of this class, call method wa->getConfig(); e.g.:

wa->getConfig()->getName();

Methods

public function getAppConfigPath ($name)

Returns path to specified configuration file of an app, located in lib/config/ directory.

Parameters

Example

$app_config = wa()->getConfig()->getAppConfig('blog');
$app_config->getAppConfigPath('routing');

Result

/var/www/wa-apps/blog/lib/config/routing.php

public function getApplication()

Returns app's id.

Example

$app_config = wa()->getConfig()->getAppConfig('blog');
$app_config->getApplication();

Result

blog

public function getAppPath ($path = null)

Returns path to app's source files.

Parameters

Example

$app_config = wa()->getConfig()->getAppConfig('blog');
$app_config->getAppPath('templates/');

Result

/var/www/wa-apps/blog/templates/

public function getConfigPath ($name, $user_config = true, $app = null)

Returns path to app's configuration file.

Parameters

Example

$app_config = wa()->getConfig()->getAppConfig('blog');
$app_config->getConfigPath('routing.php', false);

Result

/var/www/wa-apps/blog/lib/config/routing.php

public function getInfo ($name = null)

Returns information from app's file lib/config/app.php.

Parameters

Example

$app_config = wa()->getConfig()->getAppConfig('blog');
$app_config->getInfo('name');

Result

Blog

public function getName()

Returns app's name from its configuration file lib/config/app.php.

Example

$app_config = wa()->getConfig()->getAppConfig('blog');
$app_config->getName();

Result

Blog

public function getOption ($name = null)

Returns app configuration parameter values.

Parameters

Example

$app_config = wa()->getConfig()->getAppConfig('blog');
$app_config->getOption('posts_per_page');

Result

10

public function getPluginInfo ($plugin_id)

Returns information about an installed plugin of an app.

Parameters

Example

$app_config = wa()->getConfig()->getAppConfig('shop');
$app_config->getPluginInfo('migrate');

Result

Array
(
    [name] => Migrate to Shop-Script
    [description] => Transfer data from other ecommerce platforms to Shop-Script
    [img] => wa-apps/shop/plugins/migrate/img/migrate.png
    [vendor] => webasyst
    [version] => 1.0.0
    [importexport] => 1
    [handlers] => Array
        (
        )

    [id] => migrate
)

public function getPluginPath ($plugin_id)

Returns path to the source files of an installed app plugin.

Parameters

Example

$app_config = wa()->getConfig()->getAppConfig('shop');
$app_config->getPluginPath('migrate');

Result

/var/www/wa-apps/shop/plugins/migrate

public function getPlugins()

Returns information about all installed plugins of an app.

Example

$app_config = wa()->getConfig()->getAppConfig('blog');
$app_config->getPlugins();

Result

Array
(
    [watermark] => Array
        (
            [name] => Watermark
            [description] => Applies watermark text or image on uploaded photos
            [img] => wa-apps/shop/plugins/yandexmarket/img/watermark.png
            [vendor] => webasyst
            [version] => 1.0.0
            [rights] => false
            [handlers] => Array
                (
                    [image_upload] => imageUpload
                )

            [id] => watermark
        )

    [migrate] => Array
        (
            [name] => Migrate to Shop-Script
            [description] => Transfer data from other ecommerce platforms to Shop-Script
            [img] => wa-apps/shop/plugins/migrate/img/migrate.png
            [vendor] => webasyst
            [version] => 1.0.0
            [importexport] => 1
            [handlers] => Array
                (
                )

            [id] => migrate
        )

)

public function setCount ($n = null)

Sets or clears the value of an app's indicator displayed next to its icon in the main backend menu.

Parameters

Example

$app_config = wa()->getConfig()->getAppConfig('shop');
$app_config->setCount(100);