Yui3 config as requested by {@link ezjscServerFunctionsJs::yui3()}

@param array $args First value is base bath if set
@return string YUI 3.0 JavaScript config string
334261
public static function yui3conf( $args )
    {
        $options = eZINI::instance( 'ezjscore.ini' )->variable( 'YUI3', 'LoaderOptions' );

        if ( isset( $args[0] ) )
        {
            $options['base'] = self::getDesignFile( $args[0] );
            if ( !isset( $options['combine'] ) )
            {
                $options['combine'] = false;
            }
        }
        if ( !isset( $options['modules'] ) )
        {
            $options['modules'] = new stdClass;
        }

        return 'var YUI3_config = ' . json_encode( $options ) . ';';
    }
1126795
public function selectOptions(array $args = []): string
    {
        // Establish args.

        $default_args = [
            // Unique.
            'allow_empty'      => true,
            'allow_arbitrary'  => true,
            'option_formatter' => null,
            'current_caps'     => null,

            // Used by {@link all()}.
            'max'         => 1000,
            'fail_on_max' => true,

            // Used by {@link total()}.
            // Used by {@link all()}.
            'include'                   => [],
            'exclude'                   => [],
            'exclude_deprecated_levels' => true,
            'no_cache'                  => false,
        ];
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);

        // Unique.
        $args['allow_empty']      = (bool) $args['allow_empty'];
        $args['allow_arbitrary']  = (bool) $args['allow_arbitrary'];
        $args['option_formatter'] = is_callable($args['option_formatter']) ? $args['option_formatter'] : null;
        $args['current_caps']     = isset($args['current_caps']) ? (array) $args['current_caps'] : null;
        $args['current_caps']     = $this->c::removeEmptys(array_map('strval', $args['current_caps']));

        // Used by {@link all()}.
        $args['max']         = max(1, (int) $args['max']);
        $args['fail_on_max'] = (bool) $args['fail_on_max'];

        // Used by {@link total()}.
        // Used by {@link all()}.
        $args['include']                   = (array) $args['include'];
        $args['exclude']                   = (array) $args['exclude'];
        $args['exclude_deprecated_levels'] = (bool) $args['exclude_deprecated_levels'];
        $args['no_cache']                  = (bool) $args['no_cache'];

        // Check for nothing being available (or too many).

        if (!($caps = $this->all($args))) {
            return ''; // None available.
        }
        // Initialize several working variables.

        $options        = ''; // Initialize.
        $available_caps = []; // Initialize.
        $selected_caps  = []; // Initialize.

        // Build & return all `<option>` tags.

        if ($args['allow_empty']) { // Allow ``?
            $options = '<option value=""></option>';
        }
        foreach ($caps as $_cap) { // Key/value the same at this time.
            $available_caps[] = $_cap; // Record all available.

            if (isset($args['current_caps']) && in_array($_cap, $args['current_caps'], true)) {
                $selected_caps[$_cap] = $_cap; // Flag selected cap.
            }
            $_cap_selected_attr = isset($selected_caps[$_cap]) ? ' selected' : '';

            // Format `<option>` tag w/ a custom formatter?

            if ($args['option_formatter']) {
                $options .= $args['option_formatter']($_cap, [
                        'cap_selected_attr' => $_cap_selected_attr,
                    ], $args); // ↑ This allows for a custom option formatter.
                    // The formatter must always return an `<option></option>` tag.

            // Else format the `<option>` tag using a default behavior.
            } else { // Both front & back-end displays are the same for caps.
                $options .= '<option value="'.esc_attr($_cap).'"'.$_cap_selected_attr.'>'.
                                esc_html($_cap).
                            '</option>';
            }
        } // unset($_cap, $_cap_selected_attr); // Housekeeping.

        if ($args['allow_arbitrary'] && $args['current_caps']) { // Allow arbitrary select `<option>`s?
            foreach (array_diff($args['current_caps'], $available_caps) as $_arbitrary_cap) {
                $options .= '<option value="'.esc_attr($_arbitrary_cap).'" selected>'.
                                esc_html($_arbitrary_cap).
                            '</option>';
            } // unset($_arbitrary_cap); // Housekeeping.
        }
        return $options; // HTML markup.
    }
1091000
public static function serialize(array $args)
    {
        return array_reduce(
            $args,
            function ($msg, $arg) {
                return $msg.'$'.strlen($arg)."\r\n".$arg."\r\n";
            },
            '*'.count($args)."\r\n"
        );
    }
58847
protected function normalizeArgs(array $args)
    {
        $error = $this->app->make('helper/validation/error');
        $normalized = [
            'askNewTeamCID' => null,
            'askNewTeamLink' => '',
        ];

        switch (isset($args['askNewTeamLinkType']) ? $args['askNewTeamLinkType'] : '') {
            case 'cid':
                if (isset($args['askNewTeamCID']) && ((is_string($args['askNewTeamCID']) && is_numeric($args['askNewTeamCID'])) || is_int($args['askNewTeamCID']))) {
                    $i = (int) $args['askNewTeamCID'];
                    if ($i > 0) {
                        $normalized['askNewTeamCID'] = $i;
                    }
                }
                break;
            case 'link':
                if (isset($args['askNewTeamLink']) && is_string($args['askNewTeamLink'])) {
                    $normalized['askNewTeamLink'] = trim($args['askNewTeamLink']);
                }
                break;
            }

        return $error->has() ? $error : $normalized;
    }
1091719
function parseExtensionArgs($args)
    {
        // preferred_auth_policies is a space-separated list of policy
        // URIs
        $this->preferred_auth_policies = array();

        $policies_str = Auth_OpenID::arrayGet($args, 'preferred_auth_policies');
        if ($policies_str) {
            foreach (explode(' ', $policies_str) as $uri) {
                if (!in_array($uri, $this->preferred_auth_policies)) {
                    $this->preferred_auth_policies[] = $uri;
                }
            }
        }

        // max_auth_age is base-10 integer number of seconds
        $max_auth_age_str = Auth_OpenID::arrayGet($args, 'max_auth_age');
        if ($max_auth_age_str) {
            $this->max_auth_age = Auth_OpenID::intval($max_auth_age_str);
        } else {
            $this->max_auth_age = null;
        }
    }
20296
public function url( array $args = [] ) {
		$url = get_author_posts_url( $this->ID );
		if ( $args ) {
			$url = add_query_arg( $args, $url );
		}

		return $url;
	}
257897
public function loginStyleAccessManagement($args)
    {
        if (!$args) {
            return;
        }

        // Define defaults
        $configs = array_merge([
            'scripts'   => [],
            'styles'    => [],
        ], $args);

        // Render assets

        add_action('login_enqueue_scripts', function () use ($configs) {
            if (!empty($configs['scripts'])) {
                return;
            }

            foreach ($configs['scripts'] as $script) {
                if (3 !== count($script)) {
                    continue;
                }

                wp_enqueue_script($script[0], $script[1], $script[2]);
            }
        }, 10);

        add_action('login_enqueue_scripts', function () use ($configs) {
            if (!empty($configs['styles'])) {
                return;
            }

            foreach ($configs['styles'] as $style) {
                if (3 !== count($style)) {
                    continue;
                }

                wp_enqueue_style($style[0], $style[1], $style[2]);
            }
        }, 9);
    }
28492
public function encode(array $args)
    {
        if (!$args) {
            return $args;
        }

        $serializable = [];

        foreach ($args as $arg) {
            $serializable[] = $this->serialize($arg);
        }

        return $serializable;
    }
1327604
public function materialDesignColorPaletteTextFunction(array $args = []) {
        return $this->materialDesignColorPalette("text", ArrayHelper::get($args, "name"), ArrayHelper::get($args, "value"));
    }
351886
protected function getEnvironmentArgument(array $args)
	{
		foreach ($args as $k => $v)
		{
			if (substr($v, 0, strlen('--env')) == '--env')
			{
				return $v;
			}
		}

		return null;
	}
212538
public function mainMenu(array $args = [])
    {
        $defaults = [
            'searchForm'     => false,
            'btnColor'       => 'default',
            'containerEl'    => 'div',
            'containerId'    => 'navbar-collapse-main-menu',
            'containerClass' => 'navbar-collapse-main-menu navbar-collapse collapse',
            'menuEl'         => 'ul',
            'menuId'         => 'navbar-main-menu',
            'menuClass'      => 'navbar-main-menu navbar-nav nav',
            'depth'          => 2,
            'indent'         => 2
        ];

        $args = wp_parse_args($args, $defaults);
        extract($args, EXTR_SKIP);

        $tab = '    ';
        $indent = (integer) $indent;

        $wrap = [];
        $wrap[] = PHP_EOL;
        $wrap[] = str_repeat($tab, $indent + 1);
        $wrap[] = sprintf('<%s id="%%1$s" class="%%2$s">', $menuEl);
        $wrap[] = PHP_EOL;
        $wrap[] = '%3$s';
        $wrap[] = str_repeat($tab, $indent + 1);
        $wrap[] = sprintf('</%s><!-- #%s -->', $menuEl, $menuId);

        if ($searchForm) {
            $wrap[] = $this->getNavbarSearchForm($btnColor);
        }

        $wrap[] = PHP_EOL;
        $wrap[] = str_repeat($tab, $indent);

        $output = [];
        $output[] = wp_nav_menu([
            'theme_location'  => 'main-menu',
            'container'       => $containerEl,
            'container_id'    => $containerId,
            'container_class' => $containerClass,
            'menu_id'         => $menuId,
            'menu_class'      => $menuClass,
            'items_wrap'      => implode('', $wrap),
            'depth'           => $depth,
            'echo'            => false,
            'walker'          => new NavbarWalker($indent + 2)
        ]);
        $output[] = sprintf('<!-- #%s -->', $containerId);

        return apply_filters('novusopress_view_main_menu_output', implode('', $output));
    }
863877
public static function buildArgs($args)
    {
        if (!is_array($args)) {
            return '';
        }
        $ret = '';
        foreach ($args as $k => $v) {
            if (!is_int($v) && ($v !== null)) {
                $v = escapeshellarg($v);
            }
            if (is_int($k)) {
                $ret .= ' ' . $v;
            } else {
                if ($k{0} !== '-') {
                    $ret .= ' --' . $k . ($v !== null ? '=' . $v : '');
                } else {
                    $ret .= ' ' . $k . ($v !== null ? '=' . $v : '');
                }
            }
        }
        return $ret;
    }
40623
public function selectOptions(array $args = []): string
    {
        // Establish args.

        $default_args = [
            // Unique.
            'allow_empty'      => true,
            'allow_arbitrary'  => true,
            'option_formatter' => null,
            'current_roles'    => null,

            // Used by {@link all()}.
            'max'         => 1000,
            'fail_on_max' => true,

            // Used by {@link total()}.
            // Used by {@link all()}.
            'include'  => [],
            'exclude'  => [],
            'no_cache' => false,
        ];
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);

        // Unique.
        $args['allow_empty']      = (bool) $args['allow_empty'];
        $args['allow_arbitrary']  = (bool) $args['allow_arbitrary'];
        $args['option_formatter'] = is_callable($args['option_formatter']) ? $args['option_formatter'] : null;
        $args['current_roles']    = isset($args['current_roles']) ? (array) $args['current_roles'] : null;
        $args['current_roles']    = $this->c::removeEmptys(array_map('strval', $args['current_roles']));

        // Used by {@link all()}.
        $args['max']         = max(1, (int) $args['max']);
        $args['fail_on_max'] = (bool) $args['fail_on_max'];

        // Used by {@link total()}.
        // Used by {@link all()}.
        $args['include']  = (array) $args['include'];
        $args['exclude']  = (array) $args['exclude'];
        $args['no_cache'] = (bool) $args['no_cache'];

        // Check for nothing being available (or too many).

        if (!($roles = $this->all($args))) {
            return ''; // None available.
        }
        // Initialize several working variables.

        $options         = ''; // Initialize.
        $available_roles = []; // Initialize.
        $selected_roles  = []; // Initialize.

        // Build & return all `<option>` tags.

        if ($args['allow_empty']) { // Allow ``?
            $options = '<option value=""></option>';
        }
        foreach ($roles as $_role_id => $_role) { // Array of data.
            $available_roles[] = $_role_id; // Record all available.

            if (isset($args['current_roles']) && in_array($_role_id, $args['current_roles'], true)) {
                $selected_roles[$_role_id] = $_role_id; // Flag selected role.
            }
            $_role_label         = !empty($_role['name']) ? $_role['name'] : $_role_id;
            $_role_selected_attr = isset($selected_roles[$_role_id]) ? ' selected' : '';

            // Format `<option>` tag w/ a custom formatter?

            if ($args['option_formatter']) {
                $options .= $args['option_formatter']($_role_id, [
                        'role_label'         => $_role_label,
                        'role_selected_attr' => $_role_selected_attr,
                    ], $args); // ↑ This allows for a custom option formatter.
                    // The formatter must always return an `<option></option>` tag.

            // Else format the `<option>` tag using a default behavior.
            } else { // Both front & back-end displays are the same for roles.
                $options .= '<option value="'.esc_attr($_role_id).'"'.$_role_selected_attr.'>'.
                                esc_html($_role_label).
                            '</option>';
            }
        } // unset($_role_id, $_role, $_role_label, $_role_selected_attr); // Housekeeping.

        if ($args['allow_arbitrary'] && $args['current_roles']) { // Allow arbitrary select `<option>`s?
            foreach (array_diff($args['current_roles'], $available_roles) as $_arbitrary_role_id) {
                $options .= '<option value="'.esc_attr($_arbitrary_role_id).'" selected>'.
                                esc_html($_arbitrary_role_id).
                            '</option>';
            } // unset($_arbitrary_role_id); // Housekeeping.
        }
        return $options; // HTML markup.
    }
614028
public static function dumpVars(...$args): string
    {
        \ob_start();
        \var_dump(...$args);
        $string = \ob_get_clean();

        return \preg_replace("/=>\n\s+/", '=> ', $string);
    }
467797
public function smartOutput(...$args) {
        if (count($args) === 1 && is_array($args[0])) {
            $code = $args[0]['code'] ?? 0;
            $message = $args[0]['message'] ?? null;
            $data = $args[0]['data'] ?? null;
            $goto = $args[0]['goto'] ?? null;
            $tpl = $args[0]['tpl'] ?? null;
        } else {
            $code = $args[0] ?? 0;
            $message = $args[1] ?? null;
            $data = $args[2] ?? null;
            $goto = $args[3] ?? null;
            $tpl = $args[4] ?? null;
        }
        if ($this->is_ajax || $this->json_expected) {
            X::logger()->trace('Output JSON');
            $this->jsonError($code, $message, $data, $goto);
        } else {
            if (!empty($goto)) {
                X::logger()->trace("Redirect to $goto");
                $this->redirect($goto);
            } else {
                if (null !== $message && !isset($data['message'])) {
                    $data['message'] = $message;
                }
                if ($tpl) {
                    X::logger()->trace("Display with tpl $tpl");
                    $this->display($tpl, $data);
                } else {
                    X::logger()->trace('Display');
                    $this->display($data);
                }
            }
        }
        return $this;
    }
1209439
public function minifyJs(array $args = array()) {
        $ini = Zend_Registry::get('config');
        if (empty($ini->assets->js)) {
            Garp_Cli::errorOut(
                "You do not have a valid asset configuration specified in application.ini.\n" .
                "Configure like this:\n" .
                'assets.js.main_js.filename = "main.min.js"' . "\n" .
                'assets.js.main_js.sourcefiles[] = "libs/myplugin.js"' . "\n" .
                'assets.js.main_js.sourcefiles[] = "main.js"' . "\n" .
                "This will combine libs/myplugin.js and main.js into main.min.js."
            );
            return false;
        }

        $jsRoot = ltrim($ini->assets->js->basePath ?: 'js', '/');
        $assets = $ini->assets->js->toArray();
        unset($assets['basePath']);

        $selectedKey = null;
        if (!empty($args)) {
            $selectedKey = $args[0];
        }

        foreach ($assets as $key => $assetSettings) {
            if (!is_null($selectedKey) && $key != $selectedKey) {
                continue;
            }
            if (empty($assetSettings['sourcefiles'])
                || empty($assetSettings['filename'])
            ) {
                Garp_Cli::errorOut(
                    $key .
                    ' is not configured correctly. "sourcefiles" and "filename" are required keys.'
                );
                return false;
            }
            $minifier = new Garp_Assets_Minifier(APPLICATION_PATH . '/../public/' . $jsRoot);
            $minifier->minifyJs($assetSettings['sourcefiles'], $assetSettings['filename']);
        }
        Garp_Cli::lineOut('Done.');
        return true;
    }
333652
function get($args)
    {
        $cache = $this->get_cache();
        $data  = $cache->read($args['id']);

        if ($data !== null && $data !== false) {
            $args['data'] = base64_decode($data);
            $args['status'] = true;
        }
        else {
            $args['status'] = false;
        }

        return $args;
    }