Get the "View <element>" link.

@since 0.1.0

@param string             $permalink Permalink to the current post.
@param ArgumentCollection $args      Collection of arguments.
@return string HTML link to view the post.
12092
protected function getViewLink( $permalink, $args ) {
		if ( ! $permalink ) {
			return '';
		}

		return sprintf(
			' <a href="%s">%s</a>',
			esc_url( $permalink ),
			$args[ Argument::LINKS ][ Link::VIEW_LINK ]
		);
	}
253584
public function breadcrumbs(array $args = [])
    {
        global $post;

        $defaults = [
            'containerEl'    => 'div',
            'containerId'    => 'breadcrumbs-container',
            'containerClass' => 'breadcrumbs-container container',
            'listEl'         => 'ol',
            'listId'         => 'breadcrumb',
            'listClass'      => 'breadcrumb',
            'crumbEl'        => 'li',
            'activeEl'       => null,
            'activeClass'    => 'active'
        ];

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

        if ($activeEl) {
            $openActive = sprintf('<%s><%s class="%s">', $crumbEl, $activeEl, $activeClass);
            $closeActive = sprintf('</%s></%s>', $activeEl, $crumbEl);
        } else {
            $openActive = sprintf('<%s class="%s">', $crumbEl, $activeClass);
            $closeActive = sprintf('</%s>', $crumbEl);
        }

        $output = [];
        $output[] = sprintf('<%s id="%s" class="%s">', $containerEl, $containerId, $containerClass);
        $output[] = PHP_EOL.str_repeat('    ', 2);
        $output[] = sprintf('<%s id="%s" class="%s">', $listEl, $listId, $listClass);
        $output[] = sprintf(
            '<%s><a href="%s">%s</a></%s>',
            $crumbEl,
            esc_url(home_url('/')),
            __('Home', 'novusopress'),
            $crumbEl
        );

        if (is_home() && get_option('page_for_posts')) {
            $blogPageId = get_option('page_for_posts');
            $blogPage = get_page($blogPageId);
            $output[] = $openActive;
            $output[] = $blogPage->post_title;
            $output[] = $closeActive;
        } elseif (is_category()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $cat = get_category(get_query_var('cat'), false);

            if ($cat->parent != 0) {
                $parents = get_category_parents($cat->parent, true, sprintf('</%s><%s>', $crumbEl, $crumbEl));
                $parents = preg_replace('# title=".*"#', '', $parents);
                $output[] = mb_substr(sprintf('<%s>%s', $crumbEl, $parents), 0, -4);
            }

            $output[] = $openActive;
            $output[] = single_cat_title('', false);
            $output[] = $closeActive;
        } elseif (is_search()) {
            $output[] = $openActive;
            $output[] = get_search_query();
            $output[] = $closeActive;
        } elseif (is_day()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $output[] = sprintf(
                '<%s><a href="%s">%s</a></%s>',
                $crumbEl,
                get_year_link(get_the_time('Y')),
                get_the_time('Y'),
                $crumbEl
            );

            $output[] = sprintf(
                '<%s><a href="%s">%s</a></%s>',
                $crumbEl,
                get_month_link(get_the_time('Y'), get_the_time('m')),
                get_the_time('F'),
                $crumbEl
            );

            $output[] = $openActive;
            $output[] = get_the_time('d');
            $output[] = $closeActive;
        } elseif (is_month()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $output[] = sprintf(
                '<%s><a href="%s">%s</a></%s>',
                $crumbEl,
                get_year_link(get_the_time('Y')),
                get_the_time('Y'),
                $crumbEl
            );

            $output[] = $openActive;
            $output[] = get_the_time('F');
            $output[] = $closeActive;
        } elseif (is_year()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $output[] = $openActive;
            $output[] = get_the_time('Y');
            $output[] = $closeActive;
        } elseif (is_single() && !is_attachment()) {
            if ('post' !== get_post_type()) {
                $postType = get_post_type_object(get_post_type());
                $typeSlug = $postType->rewrite;
                $typeLink = trailingslashit(esc_url(home_url('/')).$typeSlug['slug']);
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    $typeLink,
                    $postType->labels->singular_name,
                    $crumbEl
                );
            } else {
                if (get_option('page_for_posts')) {
                    $blogPageId = get_option('page_for_posts');
                    $output[] = sprintf(
                        '<%s><a href="%s">%s</a></%s>',
                        $crumbEl,
                        get_permalink($blogPageId),
                        get_the_title($blogPageId),
                        $crumbEl
                    );
                }

                $cat = get_the_category();

                if (isset($cat[0])) {
                    $cat = $cat[0];
                    $parents = get_category_parents($cat, true, sprintf('</%s><%s>', $crumbEl, $crumbEl));
                    $parents = preg_replace('# title=".*"#', '', $parents);
                    $output[] = mb_substr(sprintf('<%s>%s', $crumbEl, $parents), 0, -4);
                }
            }

            $output[] = $openActive;
            $output[] = get_the_title();
            $output[] = $closeActive;
        } elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) {
            $postType = get_post_type_object(get_post_type());
            $output[] = $openActive;
            $output[] = $postType->labels->singular_name;
            $output[] = $closeActive;
        } elseif (is_attachment()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $parent = get_post($post->post_parent);
            $cat = get_the_category($parent->ID);

            if (isset($cat[0])) {
                $cat = $cat[0];
                $parents = get_category_parents($cat, true, sprintf('</%s><%s>', $crumbEl, $crumbEl));
                $parents = preg_replace('# title=".*"#', '', $parents);
                $output[] = mb_substr(sprintf('<%s>%s', $crumbEl, $parents), 0, -4);
            }

            $output[] = sprintf(
                '<%s><a href="%s">%s</a></%s>',
                $crumbEl,
                get_permalink($parent),
                $parent->post_title,
                $crumbEl
            );

            $output[] = $openActive;
            $output[] = get_the_title();
            $output[] = $closeActive;
        } elseif (is_page() && !$post->post_parent) {
            $output[] = $openActive;
            $output[] = get_the_title();
            $output[] = $closeActive;
        } elseif (is_page() && $post->post_parent) {
            $parentId = $post->post_parent;
            $frontId = get_option('page_on_front');

            if ($parentId != $frontId) {
                $breadcrumbs = [];

                while ($parentId) {
                    $page = get_page($parentId);

                    if ($parentId != $frontId) {
                        $breadcrumbs[] = sprintf(
                            '<%s><a href="%s">%s</a></%s>',
                            $crumbEl,
                            get_permalink($page->ID),
                            get_the_title($page->ID),
                            $crumbEl
                        );
                    }

                    $parentId = $page->post_parent;
                }

                for ($i = count($breadcrumbs) - 1; $i >= 0; $i--) {
                    $output[] = $breadcrumbs[$i];
                }
            }

            $output[] = $openActive;
            $output[] = get_the_title();
            $output[] = $closeActive;
        } elseif (is_tag()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $output[] = $openActive;
            $output[] = single_tag_title('', false);
            $output[] = $closeActive;
        } elseif (is_author()) {
            global $author;

            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $userdata = get_userdata($author);
            $output[] = $openActive;
            $output[] = $userdata->display_name;
            $output[] = $closeActive;
        } elseif (is_404()) {
            $output[] = $openActive;
            $output[] = __('Error 404', 'novusopress');
            $output[] = $closeActive;
        } elseif (has_post_format() && !is_singular()) {
            $output[] = $openActive;
            $output[] = get_post_format_string(get_post_format());
            $output[] = $closeActive;
        }

        $output[] = sprintf('</%s>', $listEl);
        $output[] = PHP_EOL.'    ';
        $output[] = sprintf('</%s><!-- #%s -->', $containerEl, $containerId);

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

        return apply_filters('novusopress_view_breadcrumbs_output', $output);
    }
505616
public function getModuleMarkup($module, $args)
    {
        $templatePath = $module->template();

        // Get template for legacy modules
        if (!$templatePath) {
            $templatePath = \Modularity\Helper\Wp::getTemplate($module->post_type, 'module', false);
        }

        if (!$templatePath) {
            return false;
        }

        $moduleMarkup = '';
        if (preg_match('/.blade.php$/i', $templatePath)) {
            $moduleMarkup = $this->loadBladeTemplate($templatePath, $module, $args);
        } else {
            $moduleMarkup = $this->loadTemplate($templatePath, $module, $args);
        }

        if (empty($moduleMarkup)) {
            return;
        }

        $classes = array(
            'modularity-' . $module->post_type,
            'modularity-' . $module->post_type . '-' . $module->ID
        );

        //Hide module if preview
        if (is_preview() && $module->hidden) {
            $classes[] = 'modularity-preview-hidden';
        }

        //Add selected scope class
        if (isset($module->data['meta']) && isset($module->data['meta']['module_css_scope']) && is_array($module->data['meta']['module_css_scope'])) {
            if (!empty($module->data['meta']['module_css_scope'][0])) {
                $classes[] = $module->data['meta']['module_css_scope'][0];
            }
        }

        $beforeModule = '';
        $moduleEdit = '';
        if (!(isset($args['edit_module']) && $args['edit_module'] === false) && current_user_can('edit_module', $module->ID)) {
            $moduleEdit = '<div class="modularity-edit-module"><a href="' . admin_url('post.php?post=' . $module->ID . '&action=edit&is_thickbox=true&is_inline=true') . '">' . __('Edit module', 'modularity') . ': ' . $module->data['post_type_name'] .  '</a></div>';
        }

        if (isset($module->columnWidth) && !empty($module->columnWidth)) {
            $beforeWidget = $module->columnWidth;

            $classes[] = $beforeWidget;

            $beforeModule = apply_filters('Modularity/Display/BeforeModule', '<div class="' . implode(' ', $classes) . '">', $args, $module->post_type, $module->ID);
        } elseif (isset($args['before_widget'])) {
            $beforeWidget = str_replace('%1$s', $module->post_type . '-' . $module->ID, $args['before_widget']);
            $beforeWidget = str_replace('%2$s', implode(' ', $classes), $beforeWidget);
            $beforeModule = apply_filters('Modularity/Display/BeforeModule', $beforeWidget, $args, $module->post_type, $module->ID);
        }

        $moduleMarkup = $beforeModule . $moduleEdit . $moduleMarkup;
        return $moduleMarkup;
    }
882669
public static function url( array $args = [], string $url = null ) {
		if ( is_null( $url ) ) {
			$url = $_SERVER['REQUEST_URI'];
		}

		return add_query_arg( $args, $url );
	}
251952
protected function __linkPage($arguments)
	{
		if(isset($arguments[1]))
		{
			$this->limit($this->calcLimitStart($arguments[0], $arguments[1]),$arguments[1]);
		}
	}
901500
public function widget($args, $instance)
    {
        $this->parent_page_id = View_Utils::get_top_level_parent_id();

        // We are on a 404 or search route.
        if ($this->parent_page_id === null) {
            return;
        }

        $this->args = wp_parse_args(
            $instance,
            /**
             * Edit the default Related_Pages default arguments.
             *
             * @since  1.0.0
             *
             * @param  array $defaults {
             *     The default arguments.
             *
             *     @type string $container_start   Container start HTML. Default '<ul role="navigation">'.
             *     @type string $container_end     Container end HTML. Default '</ul>'.
             *     @type string $li_class          Classes to be applied to all <li> tags. Default ''.
             *     @type string $li_active_class   Classes to be applied to the active <li> tag. Default ''.
             *     @type string $link_class        Classes to be applied to all <a> tags. Default ''.
             *     @type string $link_active_class Classes to be applied to the active <a> tag. Default 'active'.
             *     @type string $before_link       Additional content before each <a> tag. Default ''.
             *     @type string $after_link        Additional content after each <a> tag. Default ''.
             *     @type string $before_text       Additional content before each <a> tag's content. Default ''.
             *     @type string $after_text        Additional content after each <a> tag's content. Default ''.
             *     @type bool   $show_parent       Whether to show the top level page in the output. Default true.
             * }
             * @return array
             */
            apply_filters('snap_related_pages_widget_defaults', $this->get_defaults())
        );

        // Populate $pages array.
        $this->get_pages();

        if (\count($this->pages) > 0) {
            $title = apply_filters('widget_title', $instance['title']);
     
            echo $args['before_widget'];

            if (! empty($title)) {
                echo $args['before_title'] . $title . $args['after_title'];
            }
             
            $this->render();

            echo $args['after_widget'];
        }
    }
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();
	}
1223829
public function update_archive_slug( $args, $post_type ) {
		if ( $post_type !== $this->post_type ) {
			return $args;
		}

		$args['has_archive'] = trim(
			wp_make_link_relative( get_permalink( $this->post_id ) ),
			'/'
		);

		return $args;
	}
1085415
public function get_view( $name, $args = [], $echo = false, $error = true, $remove_nl = false ) {
		$name = trim( $name, '/' . DS );
		$name = str_replace( '/', DS, $name );
		$name .= '.php';
		$path = null;
		foreach ( $this->get_check_view_dirs() as $dir ) {
			$dir = rtrim( $dir, DS . '/' );
			if ( is_readable( $dir . DS . $name ) ) {
				$path = $dir . DS . $name;
				break;
			}
		}

		$view = '';
		if ( isset( $path ) ) {
			unset( $name );
			$args = $this->get_presenter_args( $args );
			extract( $args, EXTR_SKIP );

			ob_start();
			/** @noinspection PhpIncludeInspection */
			@include $path;
			$view = ob_get_contents();
			ob_end_clean();
		} elseif ( $error ) {
			$this->app->log( sprintf( 'View file [ %s ] not found.', $name ) );
		}

		if ( $remove_nl ) {
			$view = str_replace( [ "\r\n", "\r", "\n" ], ' ', $view );
		}

		if ( $echo ) {
			echo $view;
		}

		return $view;
	}
121782
public function display($controller, $template, $args = array())
    {
        $view = new View($controller);
        return $view->display($template, $args);
    }
603344
private function makeLink($args)
    {
        if (!isset($args['href'])) {
            Core::i()->log->warning('Unable to add stylesheet, no href attribute.');
            return false;
        }
        if (!isset($args['rel'])) {
            $args['rel'] = 'stylesheet';
        }
        if (!isset($args['type']) && $args['rel'] == 'stylesheet') {
            $args['type'] = 'text/css';
        }

        $link = '<link';
        foreach ($args as $key => $value) {
            $link .= ' ' . $key . '="' . $value . '"';
        }
        $link .= ' />';
        return $link;
    }
596654
public function linkVerified(string $destination, array $args = []): ?string
    {
        $link = $this->link($destination, $args);

        /** @var Presenter $presenter */
        $presenter = $this->getPresenter();

        return $presenter->getVerifier()->isLinkVerified($presenter->getLastCreatedRequest(), $this) ? $link : null;
    }
820459
public static function getValidItems( $args )
    {
        $http = eZHTTPTool::instance();
        $tpl = eZTemplate::factory();

        $result = array();

        $blockID = $http->postVariable('block_id');
        $offset = $http->postVariable('offset');
        $limit = $http->postVariable('limit');

        $validNodes = eZFlowPool::validNodes( $blockID );
        $counter = 0;
        foreach( $validNodes as $validNode )
        {
            if ( !$validNode->attribute( 'can_read' ) )
                continue;
            $counter++;

            if ( $counter <= $offset )
                continue;

            $tpl->setVariable('node', $validNode);
            $tpl->setVariable('view', 'block_item');
            $tpl->setVariable('image_class', 'blockgallery1');
            $content = $tpl->fetch('design:node/view/view.tpl');

            $result[] = $content;

            if ( $counter === $limit )
                break;
        }

        return $result;
    }
41852
public function url( array $args = []) {
        $url = get_comments_link( $this->post_ID );
        if ( $args ) {
            $url = add_query_arg( $args, $url );
        }

        return $url;
    }
713284
public function query($args = [])
    {
        $defaults = [
            'orderby'       => 'id',
            'order'         => 'DESC',
            'paginate'      => Option::get('default_posts_paginate', 20),
            'cat_in'        => [], //ids
            'cat_not_in'    => [], //ids
            'tag_in'        => [], //ids
            'tag_not_in'    => [], //ids
            'parent_in'     => [], //ids
            'parent_not_in' => [],
            'meta_query'    => [], // Array Of Arrays

        ];

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

        $current_page = Request::get('page', 1);
        $cache_key = 'posts_' . md5(http_build_query($args) . '_' . $current_page);
        if (Cache::tags('posts')->has($cache_key)) {
            $posts = Cache::tags('posts')->get($cache_key);
        } else {
            $posts = $this->postRepository->queryPosts($args);

            if ( ! count($posts) > 0) {
                return new EtherError('No Posts were found');
            }

            Cache::tags('posts')->put($cache_key, $posts, \Option::get('posts_cache_expires', 60));

        }

        return $posts;
    }
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);
    }
618855
public function permalink()
    {
        foreach($this->data as $post)
        {
            $post->permalink = get_permalink($post->ID);
        }

        return $this;
    }