GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

functions.php ➔ wp_dynamic_css_set_callback()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @package   WordPress Dynamic CSS
4
 * @version   1.0.5
5
 * @author    Askupa Software <[email protected]>
6
 * @link      https://github.com/askupasoftware/wp-dynamic-css
7
 * @copyright 2016 Askupa Software
8
 */
9
10
if( !function_exists('wp_dynamic_css_enqueue') )
11
{
12
    /**
13
     * Enqueue a dynamic stylesheet
14
     * 
15
     * This will either print the compiled version of the stylesheet to the 
16
     * document's <head> section, or load it as an external stylesheet if $print 
17
     * is set to false
18
     * 
19
     * @param string $handle The stylesheet's name/id
20
     * @param string $path The absolute path to the dynamic CSS file
21
     * @paran boolean $print Whether to print the compiled CSS to the document 
22
     * head, or include it as an external CSS file
23
     * @param boolean $minify Whether to minify the CSS output
24
     * @param boolean $cache Whether to store the compiled version of this 
25
     * stylesheet in cache to avoid compilation on every page load.
26
     */
27
    function wp_dynamic_css_enqueue( $handle, $path, $print = true, $minify = false, $cache = false )
28
    {
29
        $dcss = DynamicCSSCompiler::get_instance();
30
        $dcss->register_style( $handle, $path, $print, $minify, $cache );
31
    }
32
}
33
34
if( !function_exists('wp_dynamic_css_set_callback') )
35
{
36
    /**
37
     * Set the value retrieval callback function
38
     * 
39
     * Set a callback function that will be used to get the values of the 
40
     * variables when the dynamic CSS file is compiled. The function accepts 1 
41
     * parameter which is the name of the variable, without the $ sign
42
     * 
43
     * @param string $handle The name of the stylesheet to be associated with this
44
     * callback function
45
     * @param string|array $callback A callback (or "callable" as of PHP 5.4) 
46
     * can either be a reference to a function name or method within an 
47
     * class/object.
48
     */
49
    function wp_dynamic_css_set_callback( $handle, $callback )
50
    {
51
        $dcss = DynamicCSSCompiler::get_instance();
52
        $dcss->register_callback( $handle, $callback );
53
    }
54
}
55
56
if( !function_exists('wp_dynamic_css_clear_cache') )
57
{
58
    /**
59
     * Clear the cached compiled CSS for the given handle.
60
     * 
61
     * Registered dynamic stylesheets that have the $cache flag set to true are
62
     * compiled only once and then stored in cache. Subsequesnt requests are 
63
     * served statically from cache until wp_dynamic_css_clear_cache() is called 
64
     * and clears it, forcing the compiler to recompile the CSS.
65
     * 
66
     * @param string $handle The name of the stylesheet to be cleared from cache
67
     */
68
    function wp_dynamic_css_clear_cache( $handle )
69
    {
70
        $cache = DynamicCSSCache::get_instance();
71
        $cache->clear( $handle );
72
    }
73
}
74
75
if( !function_exists('wp_dynamic_css_register_filter') )
76
{
77
    /**
78
     * Register a filter function for a given stylesheet handle.
79
     * 
80
     * For example, a registered filter named 'myFilter' can be used in a dynamic
81
     * CSS file like so:
82
     * 
83
     * <pre>
84
     * body {
85
     *     $myVar|myFilter
86
     * }
87
     * </pre>
88
     * 
89
     * Filters can also accept arguments:
90
     * 
91
     * <pre>
92
     * body {
93
     *     $myVar|myFilter('1',2,3.4)
94
     * }
95
     * </pre>
96
     * 
97
     * And can be stacked together:
98
     * 
99
     * <pre>
100
     * body {
101
     *     $myVar|myFilter1|filter2|filter3
102
     * }
103
     * </pre>
104
     * 
105
     * @param string $handle The handle of the stylesheet in which this filter 
106
     * is to be used.
107
     * @param string $filter_name The name of the filter to be used in the 
108
     * dynamic CSS file.
109
     * @param Callable $callback The actual filter function. Accepts the $value
110
     * as an argument. Should return the filtered value.
111
     */
112
    function wp_dynamic_css_register_filter( $handle, $filter_name, $callback )
113
    {
114
        $dcss = DynamicCSSCompiler::get_instance();
115
        $dcss->register_filter( $handle, $filter_name, $callback );
116
    }
117
}
118