<?php

class Intense_Permalink extends Intense_Shortcode {

	function __construct() {
        parent::__construct();

		global $intense_visions_options;

		$this->title = __( 'Permalink', 'intense' );
		$this->description = __( 'The permalink shortcode allows you to add links to pages or posts on your WordPress site. Permalinks, also known as permanent links, point to specific pages or posts and remain unchanged.
			<br><br>
			One benefit to using the permalink shortcode is that if you change your permalink structure down the road the permalinks throughout your site will be changed. If you included the links manually, you would have to manually update them throughout your site.
			<br><br>
			The default WordPress setting for permalinks is ?p=<postid>. However, a preferred format is to show the post name or category and post name. The format can be changed in WordPress by going to Settings -> Permalinks. This can be done by setting the option to Post Name or by entering /%category%/%postname%/ or /%postname%/ into the Custom Structure option. Making this change will create more SEO friendly and human readable links.
			<br><br>
			More information can be found at <a href="http://codex.wordpress.org/Using_Permalinks">http://codex.wordpress.org/Using_Permalinks</a>.', 'intense' );
		$this->category = __( 'Elements', 'intense' );
		$this->show_preview = true;
		$this->preview_content = __( "Link", 'intense' );		
	}

	function shortcode( $atts, $content = null ) {
		global $intense_visions_options;
		extract( shortcode_atts( $this->get_shortcode_defaults( null, $atts ), $atts ) );

		if ( !empty( $class ) ) {
			$class = ' class="' . $class . '"';
		}

		if ( !empty( $rel ) ) $rel = ' rel="' . $rel . '"';

		return '<a href="' . get_permalink( $id ) . '"' . $rel . ' target="' . $target . '"' . $class . '>' . do_shortcode( $content ) . '</a>';
	}
}
