Completed
Push — master ( bc1ad9...b87221 )
by Askupa
01:45
created

functions.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * WordPress Settings
4
 *
5
 * Add setting pages with Amarkal UI components to your WordPress theme or 
6
 * plugin.
7
 *
8
 * @package   amarkal-settings
9
 * @depends   amarkal-ui
10
 * @author    Askupa Software <[email protected]>
11
 * @link      https://github.com/askupasoftware/amarkal-settings
12
 * @copyright 2017 Askupa Software
13
 */
14
15
// Prevent direct file access
16
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
17
18
/**
19
 * Prevent loading the library more than once
20
 */
21
if( defined( 'AMARKAL_SETTINGS' ) ) return false;
22
define( 'AMARKAL_SETTINGS', true );
23
24
if(!function_exists('amarkal_add_settings_page'))
25
{
26
    /**
27
     * Add a new top-level settings page
28
     *
29
     * @param [array] $args
30
     * @return void
31
     */
32
    function amarkal_add_settings_page( $args )
33
    {
34
        $manager = Amarkal\Settings\Manager::get_instance();
35
        $manager->add_page($args);
36
    }
37
}
38
39
if(!function_exists('amarkal_add_settings_child_page'))
40
{
41
    /**
42
     * Add a child page to an existing top-level settings page
43
     *
44
     * @param [array] $args
0 ignored issues
show
The doc-type [array] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
45
     * @return void
46
     */
47
    function amarkal_add_settings_child_page( $args )
48
    {
49
        $manager = Amarkal\Settings\Manager::get_instance();
50
        $manager->add_child_page($args);
51
    }
52
}
53
54
if(!function_exists('amarkal_get_settings_value'))
55
{
56
    /**
57
     * Get the value of the given settings
58
     *
59
     * @param [array] $args
60
     * @return void
61
     */
62
    function amarkal_get_settings_value( $field_name )
63
    {
64
        $manager = Amarkal\Settings\Manager::get_instance();
65
        return $manager->get_field_value($field_name);
66
    }
67
}