G.2 Create the URL for the dropdown-item

@param array $args
@return string
506071
private function createDropDownItemSubUrl(array $args): string
    {
        list($url, $text, $place, $id, $class) = $this->getLinkInformation($args);
        $output = '<a class="dropdown-item dropdown-toggle';
        $output = !empty($class) ? $output . ' ' . $class . '"' : $output . '"';
        if (!empty($id)) $output .= ' id="' . $id . '"';
        $output .= ' href="' . BASE_URL . $url . '">' . $text . '</a>';
        return $output;
    }
156123
public function url( array $args = []) {
		$url = get_term_link( $this->term );
		if ( $args ) {
			$url = add_query_arg( $args, $url );
		}

		return $url;
	}
101310
protected function url($args) {
		$target = $args['target'];
		$options = isset($args['options'])? $args['options'] : array();
		if (($volume = $this->volume($target)) != false) {
			$url = $volume->getContentUrl($target, $options);
			return $url ? array('url' => $url) : array();
		}
		return array();
	}
1308429
public function selectOptions(array $args = []): string
    {
        // Establish args.

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

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

            // Used by {@link total()}.
            // Used by {@link all()}.
            'filters' => !$this->Wp->is_admin
                ? ['public' => true, 'exclude_from_search' => false]
                : ['exclude_from_search' => false],
            '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_post_types'] = isset($args['current_post_types']) ? (array) $args['current_post_types'] : null;
        $args['current_post_types'] = $this->c::removeEmptys(array_map('strval', $args['current_post_types']));

        // 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['filters']  = (array) $args['filters'];
        $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 (!($post_types = $this->all($args))) {
            return ''; // None available.
        }
        // Initialize several working variables needed below.

        $options                 = ''; // Initialize.
        $available_post_types    = []; // Initialize.
        $selected_post_types     = []; // Initialize.
        $default_post_type_label = __('Posts', 'wp-sharks-core');

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

        if ($args['allow_empty']) { // Allow ``?
            $options = '<option value=""></option>';
        }
        foreach ($post_types as $_post_type => $_post_type_object) { // \StdClass objects.
            $available_post_types[] = $_post_type; // Record all available.

            if (isset($args['current_post_types']) && in_array($_post_type, $args['current_post_types'], true)) {
                $selected_post_types[$_post_type] = $_post_type; // Flag selected post type.
            }
            $_post_type_label         = !empty($_post_type_object->labels->name) ? $_post_type_object->labels->name : $default_post_type_label;
            $_post_type_selected_attr = isset($selected_post_types[$_post_type]) ? ' selected' : '';

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

            if ($args['option_formatter']) {
                $options .= $args['option_formatter']($_post_type, $_post_type_object, [
                        'post_type_label'         => $_post_type_label,
                        'post_type_selected_attr' => $_post_type_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 post types.
                $options .= '<option value="'.esc_attr($_post_type).'"'.$_post_type_selected_attr.'>'.
                                esc_html($_post_type_label).
                            '</option>';
            }
        } // unset($_post_type, $_post_type_object, $_post_type_label, $_post_selected_attr); // Housekeeping.

        if ($args['allow_arbitrary'] && $args['current_post_types']) { // Allow arbitrary select `<option>`s?
            foreach (array_diff($args['current_post_types'], $available_post_types) as $_arbitrary_post_type) {
                $options .= '<option value="'.esc_attr($_arbitrary_post_type).'" selected>'.
                                esc_html($default_post_type_label).
                            '</option>';
            } // unset($_arbitrary_post_type); // Housekeeping.
        }
        return $options; // HTML markup.
    }
650901
private function parseArgs(array $args)
    {
        if (! count($args)) {
            return $this->createHelpArgument();
        }

        $arg1 = array_shift($args);

        if (in_array($arg1, ['-h', '--help', 'help'], true)) {
            return $this->createHelpArgument();
        }

        if (! count($args)) {
            return $this->createErrorArgument('Missing class name');
        }

        $configFile = $arg1;
        switch (file_exists($configFile)) {
            case true:
                $config = require $configFile;

                if (! is_array($config)) {
                    return $this->createErrorArgument(sprintf(
                        'Configuration at path "%s" does not return an array.',
                        $configFile
                    ));
                }

                break;
            case false:
                // fall-through
            default:
                if (! is_writable(dirname($configFile))) {
                    return $this->createErrorArgument(sprintf(
                        'Cannot create configuration at path "%s"; not writable.',
                        $configFile
                    ));
                }

                $config = [];
                break;
        }

        $class = array_shift($args);

        if (! class_exists($class)) {
            return $this->createErrorArgument(sprintf(
                'Class "%s" does not exist or could not be autoloaded.',
                $class
            ));
        }

        return $this->createArguments(self::COMMAND_DUMP, $configFile, $config, $class);
    }
317638
private function parseArgs(array $args) : string
    {
        if (!is_array($args)) return false;
        $components = array();
        if (count($args) == 1 && is_string($args[0])) {
            $components['src'] = $args[0];
            return $this->makeLink($components);
        } elseif (count($args) == 1 && is_array($args)) {
            $components = $args[0];
            return $this->makeLink($components);
        } elseif (count($args) == 2 && is_string($args[0]) && is_array($args[1])) {
            $args[1]['src'] = $args[0];
            $components = $args[1];
            return $this->makeLink($components);
        } elseif (count($args) == 2 && is_string($args[0]) && is_string($args[1])) {
            return '<script type="'.$args[1].'">'."\n".$args[0]."\n</script>\n";
        }
        Core::i()->log->warning('Unable to interpret script. Not added.');
        return false;
    }
730516
public function brandParentArg(string $arg = ''): string
    {
        return $this->App->Parent ? $this->App->Parent->Utils->§BrandUrl->brandArg($arg) : $this->brandArg($arg);
    }
817044
static function renderCustomSelect( $args ) {
		$defaults = [
			'id' => null,
			'name' => null,
			'value' => '',
			'choices' => [],
			'multiple' => false,
			'disabled' => false,
		];

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

		$is_custom = false;
		if ( ! array_key_exists( $args['value'], $args['choices'] ) ) {
			$is_custom = true;
		}
		$options = '';
		foreach ( $args['choices'] as $key => $label ) {
			$options .= sprintf(
				'<option value="%s" %s>%s</option>',
				$key,
				( empty( $key ) && $is_custom ) ? ' selected' : selected( $key, $args['value'], false ),
				$label
			);
		}
		printf(
			'<select name="%s" id="%s" %s%s>%s</select><br />',
			$args['name'],
			$args['id'],
			( $args['multiple'] ) ? ' multiple' : '',
			( ! empty( $args['disabled'] ) ) ? ' disabled' : '',
			$options
		);
	}
347279
final protected function createUrl($controller, array $args = array(), $index = 0)
    {
        if (ArrayUtils::isAssoc($args)) {
            return $this->urlBuilder->createQueryUrl($controller, $args, $index);
        } else {
            return $this->urlBuilder->createUrl($controller, $args, $index);
        }
    }
1256358
private function createLeftMenu(): string
    {
        $argsCount = 0;
        $arrayKey = $this->getArrayKey($this->menuData);
        $output = '<ul class="navbar navbar-nav mr-auto">';
        foreach ($arrayKey as $menuItem) {
            list($url, $text, $place, $id, $class) = $this->getLinkInformation([$menuItem]);
            if ($place == 'left') {
                $arguments[$argsCount] = $menuItem;
                $arraySubKey = $this->getArrayKey($this->menuData[$menuItem]);
                if (count($arraySubKey) === 0) {
                    $output .= '<li class="nav-item">';
                    $output .= $this->createNavLinkUrl($arguments);
                    $output .= '</li>';
                } else {
                    $output .= '<li class="nav-item dropdown">';
                    $output .= $this->createSubmenu($arguments, $this->menuData[$menuItem]);
                    $output .= '</li>';
                }
            }
        }
        $output .= '</ul>';
        return $output;
    }
1020404
public function exportUrl($scope = 1, $args = null)
    {
        $input = array_merge(Input::all(), Exporter::formatExportQuery($scope, $args));

        return $this->resource().'?'.http_build_query($input);
    }
1354126
public function bootstrapButtonLinkFunction(array $args = []) {
        return $this->bootstrapButton(ButtonFactory::parseLinkButton($args), ArrayHelper::get($args, "icon"));
    }
77111
public function getExportUrl($scope = 1, $args = null)
    {
        $input = array_merge(Input::all(), Exporter::formatExportQuery($scope, $args));

        if ($constraints = $this->model()->getConstraints()) {
            $input = array_merge($input, $constraints);
        }

        return $this->resource().'?'.http_build_query($input);
    }
825708
public function addMenu(array $args = [])
    {
        $default_args = [
            'auto_prefix'   => true,
            'page_title'    => '',
            'menu_title'    => '',
            'capability'    => '',
            'page'          => '',
            'class'         => '',
            'template_file' => '',
            'template_dir'  => '',
            'icon'          => '',
            'position'      => null,
            'meta_links'    => [],
            'tabs'          => [],
            'callback'      => null,
        ];
        $cfg = (object) array_merge($default_args, $args);

        $cfg->auto_prefix   = (bool) $cfg->auto_prefix;
        $cfg->page_title    = (string) $cfg->page_title;
        $cfg->menu_title    = (string) $cfg->menu_title;
        $cfg->capability    = (string) $cfg->capability;
        $cfg->page          = (string) $cfg->page;
        $cfg->class         = (string) $cfg->class;
        $cfg->template_file = (string) $cfg->template_file;
        $cfg->template_dir  = (string) $cfg->template_dir;
        $cfg->icon          = (string) $cfg->icon;
        $cfg->position      = (string) $cfg->position;
        $cfg->meta_links    = (array) $cfg->meta_links;
        $cfg->tabs          = (array) $cfg->tabs;

        if ($cfg->page_title && $cfg->auto_prefix // Smart auto-prefixing.
                && $cfg->page_title !== $this->App->Config->©brand['©name']) {
            $cfg->page_title = $cfg->page_title.' | '.$this->App->Config->©brand['©name'];
        } elseif (!$cfg->page_title) {
            $cfg->page_title = $this->App->Config->©brand['©name'];
        }
        if (!$cfg->menu_title) {
            $cfg->menu_title = $this->App->Config->©brand['©name'];
        }
        if (!$cfg->capability) {
            $cfg->capability = $this->App->Config->§caps['§manage'];
        }
        if ($cfg->page && $cfg->auto_prefix // Smart auto-prefixing.
                && $cfg->page[0] !== '/' && mb_stripos($cfg->page, '.php') === false) {
            $cfg->page = $this->App->Config->©brand['©slug'].'-'.$cfg->page;
        } elseif (!$cfg->page) {
            $cfg->page = $this->App->Config->©brand['©slug'];
        }
        $cfg->class .= ($cfg->class ? ' ' : '').'wrap';
        $cfg->class .= ' '.$this->App::CORE_CONTAINER_SLUG.'-menu-page-area';
        $cfg->class .= ' '.$this->App::CORE_CONTAINER_SLUG.'-menu-page-wrapper';
        $cfg->class .= ' '.$this->App->Config->©brand['©slug'].'-menu-page-wrapper';
        $cfg->class .= $cfg->page !== $this->App->Config->©brand['©slug'] ? ' '.$cfg->page.'-menu-page-wrapper' : '';

        if (!$cfg->icon) {
            $cfg->icon = 'dashicons-admin-generic';
        }
        if (!isset($cfg->position[0])) {
            $cfg->position = null; // No preference.
        }
        $cfg = $this->s::applyFilters('menu_page', $cfg, $args, $default_args);

        if (!$cfg->template_file) {
            throw $this->c::issue('Missing template file.');
        }
        $cfg->nav_tabs = $this->is($cfg->page) ? $this->buildNavTabs($cfg) : '';
        $cfg->callback = $cfg->callback ?: function () use ($cfg) {
            echo $this->c::getTemplate('s-core/admin/menu-pages/template.php')->parse(compact('cfg'));
        };
        $this->hook_names[$cfg->page] = // By slug. See: <https://developer.wordpress.org/reference/functions/add_menu_page/>
            add_menu_page($cfg->page_title, $cfg->menu_title, $cfg->capability, $cfg->page, $cfg->callback, $cfg->icon, $cfg->position);
    }
1219151
public function parse(array $args = []) : string
    {
        $strAux = $this->str;
        $params = $this->getParameters();

        foreach ($args as $argKey => $argValue) {
            if (in_array($argKey, $params)) {
                $strAux = str_replace("{{$argKey}}", $argValue, $strAux);
            }
        }

        return $strAux;
    }
1075450
public function url($path, $args = [])
    {
        if (is_array($path)) {
            $path = array_merge($path, $args);
        } elseif ($args !== []) {
            $path = array_merge([$path], $args);
        }

        return Url::to($path, true);
    }
461147
protected function createFlysystemAdapter(array $args = [])
    {
        $root = isset($args['root']) ? $args['root'] : '/';

        if ($this->app->bound('file-db.flysystem')) {
            return $this->app->make('file-db.flysystem');
        }

        return new LocalFSAdapter($root);
    }