Displays a Bootstrap alert "Link".

@param array $args The arguments.
@return string Returns the Bootstrap alert "Link".
359290
public function bootstrapAlertLinkFunction(array $args = []) {

        $attributes = [];

        $attributes["href"] = ArrayHelper::get($args, "href", NavigationInterface::NAVIGATION_HREF_DEFAULT);

        $innerHTML = ArrayHelper::get($args, "content");

        return static::coreHTMLElement("a", $innerHTML, $attributes);
    }
845965
public function pagination(array $args = [])
    {
        $defaults = [
            'range'          => 2,
            'pages'          => null,
            'containerEl'    => 'div',
            'containerId'    => 'pagination-container',
            'containerClass' => 'pagination-container',
            'listEl'         => 'ul',
            'listClass'      => 'pagination',
            'itemEl'         => 'li',
            'innerEl'        => 'span',
            'activeClass'    => 'active',
            'disabledClass'  => 'disabled',
            'overview'       => false
        ];

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

        $output = [];

        if (is_singular()) {
            global $page, $numpages;

            if ($overview) {
                $before = sprintf(
                    '<%s class="%s"><%s class="%s"><%s>%s</%s></%s><%s>',
                    $listEl,
                    $listClass,
                    $itemEl,
                    $disabledClass,
                    $innerEl,
                    sprintf(__('Page %d of %d', 'novusopress'), $page, $numpages),
                    $innerEl,
                    $itemEl,
                    $itemEl
                );
            } else {
                $before = sprintf('<%s class="%s"><%s>', $listEl, $listClass, $itemEl);
            }

            add_filter('wp_link_pages_link', function ($link, $i) use ($activeClass, $innerEl) {
                global $page;

                if ($i === $page) {
                    return sprintf('<%s class="%s">%s</%s>', $innerEl, $activeClass, $link, $innerEl);
                }

                return $link;
            }, 10, 2);

            $links = wp_link_pages([
                'before'         => $before,
                'after'          => sprintf('</%s></%s>', $itemEl, $listEl),
                'next_or_number' => 'number',
                'separator'      => sprintf('</%s><%s>', $itemEl, $itemEl),
                'echo'           => false
            ]);

            $output[] = preg_replace(
                sprintf('#<%s>[\s]*<%s class="%s">#', $itemEl, $innerEl, $activeClass),
                sprintf('<%s class="%s"><%s>', $itemEl, $activeClass, $innerEl),
                $links
            );
        } else {
            global $paged;

            $range = (integer) $range;
            $show = ($range * 2) + 1;

            if (empty($paged)) $paged = 1;

            if (null === $pages) {
                global $wp_query;

                $pages = $wp_query->max_num_pages;

                if (!$pages) {
                    $pages = 1;
                }
            }

            $paged = (integer) $paged;
            $pages = (integer) $pages;

            if (1 !== $pages) {
                $output[] = sprintf('<%s class="%s">', $listEl, $listClass);

                if ($overview) {
                    $output[] = sprintf(
                        '<%s class="%s"><%s>%s</%s></%s>',
                        $itemEl,
                        $disabledClass,
                        $innerEl,
                        sprintf(__('Page %d of %d', 'novusopress'), $paged, $pages),
                        $innerEl,
                        $itemEl
                    );
                }

                if ($paged > 2 && $paged > $range + 1 && $show < $pages) {
                    $output[] = sprintf(
                        '<%s><a href="%s">%s %s</a></%s>',
                        $itemEl,
                        get_pagenum_link(1),
                        '&laquo;',
                        __('First', 'novusopress'),
                        $itemEl
                    );
                }

                if ($paged > 1 && $show < $pages) {
                    $output[] = sprintf(
                        '<%s><a href="%s">%s %s</a></%s>',
                        $itemEl,
                        get_pagenum_link($paged - 1),
                        '&lsaquo;',
                        __('Previous', 'novusopress'),
                        $itemEl
                    );
                }

                for ($i = 1; $i <= $pages; $i++) {
                    if (1 !== $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $show)) {
                        if ($paged === $i) {
                            $output[] = sprintf(
                                '<%s class="%s"><%s>%s</%s></%s>',
                                $itemEl,
                                $activeClass,
                                $innerEl,
                                $i,
                                $innerEl,
                                $itemEl
                            );
                        } else {
                            $output[] = sprintf(
                                '<%s><a href="%s">%s</a></%s>',
                                $itemEl,
                                get_pagenum_link($i),
                                $i,
                                $itemEl
                            );
                        }
                    }
                }

                if ($paged < $pages && $show < $pages) {
                    $output[] = sprintf(
                        '<%s><a href="%s">%s %s</a></%s>',
                        $itemEl,
                        get_pagenum_link($paged + 1),
                        __('Next', 'novusopress'),
                        '&rsaquo;',
                        $itemEl
                    );
                }

                if ($paged < $pages - 1 && $paged + $range - 1 < $pages && $show < $pages) {
                    $output[] = sprintf(
                        '<%s><a href="%s">%s %s</a></%s>',
                        $itemEl,
                        get_pagenum_link($pages),
                        __('Last', 'novusopress'),
                        '&raquo;',
                        $itemEl
                    );
                }

                $output[] = sprintf('</%s>', $listEl);
            }
        }

        $output = implode('', $output);

        if (!empty($output)) {
            $output = sprintf(
                '<%s id="%s" class="%s">%s</%s>',
                $containerEl,
                $containerId,
                $containerClass,
                $output,
                $containerEl
            );
        }

        return apply_filters('novusopress_view_pagination_output', $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;
    }
251952
protected function __linkPage($arguments)
	{
		if(isset($arguments[1]))
		{
			$this->limit($this->calcLimitStart($arguments[0], $arguments[1]),$arguments[1]);
		}
	}
1022341
public function bootstrapButtonSuccessFunction(array $args = []) {
        return $this->bootstrapButton(ButtonFactory::parseSuccessButton($args), ArrayHelper::get($args, "icon"));
    }
882669
public static function url( array $args = [], string $url = null ) {
		if ( is_null( $url ) ) {
			$url = $_SERVER['REQUEST_URI'];
		}

		return add_query_arg( $args, $url );
	}
470483
public function url( array $args = [] ) {
		$url = get_permalink( $this->ID );
		if ( $args ) {
			$url = add_query_arg( $args, $url );
		}

		return $url;

	}
419766
public function bootstrapHeading4Function(array $args = []) {
        return $this->bootstrapHeading(4, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class"));
    }
492427
private function parse_args($args = [])
    {
        $args['NAMESPACE'] = '';

        $class_name = $this->sanitise_filename($args['CLASSNAME']);

        if ($this->is_nested_directory($class_name)) {
            $parts = \explode('\\', $class_name);
            $class = \array_pop($parts);

            $args['NAMESPACE'] = '\\' . \implode('\\', $parts);
            $args['CLASSNAME'] = $class;
        }

        return $args;
    }
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);
    }
1246839
public static function debug(array $args)
    {
        $str = "\r\n";
        $str .= self::startBlackText() .
            self::startYellowBackground() .
            self::getCallingFileName() . '::' . self::getCallingFileLine() .
            "\033[0m" . "\r\n";

        foreach ($args as $arg) {
            $str .=
                self::startBlackText() .
                self::startYellowBackground() .
                self::getParameter($arg) .
                "\033[0m" . "\r\n";
        }

        return $str . "\r\n";
    }
379800
public function bootstrapGridFunction(array $args = []) {

        $output = [];

        $output[] = $this->bootstrapGridStackedFunction($args);
        $output[] = $this->bootstrapGridOffsetFunction($args);
        $output[] = $this->bootstrapGridPushFunction($args);
        $output[] = $this->bootstrapGridPullFunction($args);

        return trim(implode(" ", $output));
    }
1354126
public function bootstrapButtonLinkFunction(array $args = []) {
        return $this->bootstrapButton(ButtonFactory::parseLinkButton($args), ArrayHelper::get($args, "icon"));
    }
843025
public function alert()
	{
		?>
		<p>The format of the function is:</p>
		<pre class="code php">alert($html, $class = 'info', $icon = '');</pre>
		<?php
		p('Pass text only to output a basic Bootstrap "info" alert box:');
		alert('Just text passed');

		p('Pass a 2nd argument of a Bootstrap <a href="http://getbootstrap.com/components/#alerts" target="_blank">alert</a> message class:');
		alert('Passed with "success"', 'success');
		alert('Passed with "warning"', 'warning');
		alert('Passed with "danger"', 'danger');

		p('Pass a 2nd argument of a boolean state to render tick or cross icons:');
		alert('Passed with true', true);
		alert('Passed with false', false);

		p('Pass a 3rd argument of a string to render a custom <a href="http://fontawesome.io/icons/" target="_blank">Font Awesome</a> icon:');
		alert('Passed with "info" and "info"', 'info', 'info');
		alert('Passed with "warning" and "bolt"', 'warning', 'bolt');
	}
754744
protected function link(string $destination, array $args = []): string
	{
		return $this->linkGenerator->link($destination, $args);
	}
494545
public function notify($arguments)
    {
        $defaults = [
            'type' => 'success',
            'icon' => 'fa fa-check-mark',
            'title' => false,
            'text' => false,
            'form' => false,
            'hide' => false,
            'addclass' => 'ccm-notification-page-alert',
            'buttons' => [],
        ];

        // overwrite all the defaults with the arguments
        $arguments = array_merge($defaults, $arguments);

        $arguments['addclass'] .= ' ccm-ui';

        $text = '';

        if ($arguments['form']) {
            $text .= $arguments['form'];
        }

        $text .= $arguments['text'];

        if (count($arguments['buttons']) > 0) {
            $text .= '<div class="ccm-notification-inner-buttons">';
            if (1 == count($arguments['buttons'])) {
                $singleButton = $arguments['buttons'][0];
                if ($singleButton instanceof Tag) {
                    $singleButton->addClass('btn btn-xs btn-default');
                }
                $text .= '<div>' . $singleButton . '</div>';
            } else {
                $text .= '<div class="btn-group"><button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' . t('Action') . ' <span class="caret"></span></button><ul class="dropdown-menu">';
                foreach ($arguments['buttons'] as $button) {
                    $text .= '<li>' . $button . '</li>';
                }
                $text .= '</ul></div>';
            }
            $text .= '</div>';
        }

        if ($arguments['form']) {
            $text .= '</form>';
        }

        $arguments['text'] = $text;

        unset($arguments['buttons']);
        $string = json_encode($arguments);

        $content = '<script type="text/javascript">$(function() {';
        $content .= 'new PNotify(' . $string . ');';
        $content .= '});</script>';

        return $content;
    }
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;
    }