Your IP : 216.73.216.162


Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/
Upload File :
Current File : /home/x/b/o/xbodynamge/namtation/wp-content/post-grid.tar

editor.scss000066600000004445151142177270006751 0ustar00.wp-block-themeisle-blocks-posts-grid {
	display: flex;
	flex-wrap: wrap;

	&.is-grid {
		.grid-post {
			.grid-post-row {

				.grid-image-area {
					flex: 0 0 100%;
					max-width: 100%;
				}
		
				.grid-content-area {
					flex: 0 0 100%;
					max-width: 100%;

					.grid-content-category {
						margin: 10px 0;
					}
				}
			}

			&.grid-2 {
				flex: 0 0 50%;
				max-width: 50%;
				padding: 0 15px;
			}

			&.grid-3 {
				flex: 0 0 33%;
				max-width: 33%;
				padding: 0 15px;
			}

			&.grid-4 {
				flex: 0 0 25%;
				max-width: 25%;
				padding: 0 15px;
			}

			&.grid-5 {
				flex: 0 0 20%;
				max-width: 20%;
				padding: 0 15px;
			}
		}
	}

	.grid-post {
		margin: 20px 0;
		background: transparent;
		box-shadow: none;
		border: 0;
		border-radius: 6px;
		color: rgba(0,0,0,.87);
		width: 100%;

		.grid-post-row {
			display: flex;
			flex-wrap: wrap;
			margin-right: -15px;
			margin-left: -15px;

			.grid-image-area {
				flex: 0 0 33.333333%;
				max-width: 33.333333%;
				position: relative;
				width: 100%;
				min-height: 1px;
				padding-right: 15px;
				padding-left: 15px;

				.post-thumbnail {
					position: relative;
					padding: 0;
					z-index: 1;
					border-radius: 6px;

					img {
						width: 100%;
						border-radius: 6px;
						box-shadow: 0 5px 15px 5px rgba(0,0,0,.24),0 8px 10px -5px rgba(0,0,0,.2);
					}
				}
			}

			.grid-content-area {
				flex: 0 0 66.666667%;
				max-width: 66.666667%;
				position: relative;
				width: 100%;
				min-height: 1px;
				padding-right: 15px;
				padding-left: 15px;

				&.full {
					flex: 0 0 100%;
					max-width: 100%;
				}

				.grid-content-category {
					font-size: 11px;
					font-weight: bold;
					margin: 0;

					a {
						color: #000000;
						text-decoration: none;
					}
				}

				.grid-content-title {
					font-size: 16px;
					font-weight: bold;
					margin: 0;

					a {
						text-decoration: none;
					}
				}

				.grid-content-meta {
					margin: 0;
					font-size: 14px;

					a {
						color: #000000;
					}
				}

				.grid-content-excerpt {
					line-height: 1.5;
					margin: 1em 0;
				}
			}
		}
	}
}

@media ( max-width:600px ) {
	.wp-block-themeisle-blocks-posts-grid {

		&.is-grid {
			.grid-post {
				flex: 0 0 100% !important;
				max-width: 100% !important;
				padding: 0 !important;
			}
		}
	}
}index.js000066600000020051151142177270006222 0ustar00/**
 * External dependencies
 */
import classnames from 'classnames';

import Thumbnail from './Thumbnail.js';

/**
 * WordPress dependencies...
 */

const { isUndefined, pickBy } = lodash;

const { __ } = wp.i18n;

const { registerBlockType } = wp.blocks;

const {
	Button,
	Dashicon,
	PanelBody,
	QueryControls,
	RangeControl,
	Spinner,
	TextControl,
	ToggleControl,
	Toolbar,
	Tooltip
} = wp.components;

const { withSelect } = wp.data;

const {
	BlockControls,
	InspectorControls
} = wp.editor;

const unescapeHTML = value => {
	const htmlNode = document.createElement( 'div' );
	htmlNode.innerHTML = value;
	if ( htmlNode.innerText !== undefined ) {
		return htmlNode.innerText;
	}
	return htmlNode.textContent;
};

const formatDate = date => {
	const monthNames = [
		__( 'January' ), __( 'February' ), __( 'March' ),
		__( 'April' ), __( 'May' ), __( 'June' ), __( 'July' ),
		__( 'August' ), __( 'September' ), __( 'October' ),
		__( 'November' ), __( 'December' )
	];
	const weekNames = [
		__( 'Sunday' ), __( 'Monday' ), __( 'Tuesday' ), __( 'Wednesday' ),
		__( 'Thursday' ), __( 'Friday' ), __( 'Saturday' )
	];
	date = new Date( date );
	const day = date.getDate();
	const monthIndex = date.getMonth();
	const year = date.getFullYear();
	return day + ' ' + monthNames[monthIndex] + ', ' + year;
};


import './style.scss';
import './editor.scss';

registerBlockType( 'themeisle-blocks/posts-grid', {
	title: __( 'Posts Grid' ),
	description: __( 'Display a list of your most recent posts in a beautiful grid.' ),
	icon: 'screenoptions',
	category: 'themeisle-blocks',
	keywords: [
		'posts',
		'grid',
		'orbitfox'
	],
	attributes: {
		grid: {
			type: 'boolean',
			default: false
		},
		columns: {
			type: 'number',
			default: 3
		},
		categories: {
			type: 'string'
		},
		postsToShow: {
			type: 'number',
			default: 5
		},
		order: {
			type: 'string',
			default: 'desc'
		},
		orderBy: {
			type: 'string',
			default: 'date'
		},
		displayFeaturedImage: {
			type: 'boolean',
			default: true
		},
		displayCategory: {
			type: 'boolean',
			default: true
		},
		displayDate: {
			type: 'boolean',
			default: true
		},
		displayAuthor: {
			type: 'boolean',
			default: true
		},
		excerptLength: {
			type: 'number',
			default: 200
		}
	},

	edit: withSelect( ( select, props ) => {
		const { categories, order, orderBy, postsToShow } = props.attributes;
		const latestPostsQuery = pickBy({
			categories,
			order,
			orderby: orderBy,
			per_page: postsToShow // eslint-disable-line camelcase
		}, ( value ) => ! isUndefined( value ) );
		return {
			posts: select( 'core' ).getEntityRecords( 'postType', 'post', latestPostsQuery ),
			// eslint-disable-next-line camelcase
			categoriesList: select( 'core' ).getEntityRecords( 'taxonomy', 'category', { per_page: 100 }),
			authors: select( 'core' ).getAuthors(),
			props
		};
	})( ({ posts, categoriesList, authors, className, setAttributes, props }) => {
		if ( ! posts ) {
			return (
				<p className={ className } >
					<Spinner />
					{ __( 'Loading Posts' ) }
				</p>
			);
		}
		if ( 0 === posts.length ) {
			return <p>{ __( 'No Posts' ) }</p>;
		}

		const {
			grid,
			columns,
			order,
			orderBy,
			categories,
			postsToShow,
			displayFeaturedImage,
			displayCategory,
			displayDate,
			displayAuthor,
			excerptLength
		} = props.attributes;

		const toggleLayout = () => {
			props.setAttributes({ grid: ! grid });
		};

		const changeColumns = value => {
			props.setAttributes({ columns: value});
		};

		const toggleFeaturedImage = () => {
			props.setAttributes({ displayFeaturedImage: ! displayFeaturedImage });
		};

		const toggleDisplayCategory = () => {
			props.setAttributes({ displayCategory: ! displayCategory });
		};

		const toggleDisplayDate = () => {
			props.setAttributes({ displayDate: ! displayDate });
		};

		const toggleDisplayAuthor = () => {
			props.setAttributes({ displayAuthor: ! displayAuthor });
		};

		const onExcerptLength = value => {
			props.setAttributes({ excerptLength: value });
		};

		return [
			<BlockControls key="toolbar-controls">
				<Toolbar
					className='components-toolbar'
				>
					<Tooltip text={ __( 'List Layout' )	}>
						<Button
							className={ classnames(
								'components-icon-button',
								'components-toolbar__control',
								{ 'is-active': ! grid },
							) }
							onClick={ toggleLayout }
						>
							<Dashicon icon="list-view" />
						</Button>
					</Tooltip>
					<Tooltip text={ __( 'Grid Layout' )	}>
						<Button
							className={ classnames(
								'components-icon-button',
								'components-toolbar__control',
								{ 'is-active': grid },
							) }
							onClick={ toggleLayout }
						>
							<Dashicon icon="grid-view" />
						</Button>
					</Tooltip>
				</Toolbar>
			</BlockControls>,

			<InspectorControls>
				<PanelBody
					title={ __( 'Posts Grid Settings' ) }
				>
					{ ( grid ) && (
						<RangeControl
							label={ __( 'Columns' ) }
							value={ columns }
							onChange={ changeColumns}
							min={ 1 }
							max={ 5 }
						>
						</RangeControl>
					) }
					<QueryControls
						{ ...{ order, orderBy } }
						numberOfItems={ postsToShow }
						categoriesList={ categoriesList }
						selectedCategoryId={ categories }
						onOrderChange={ ( value ) => setAttributes({ order: value }) }
						onOrderByChange={ ( value ) => setAttributes({ orderBy: value }) }
						onCategoryChange={ ( value ) => setAttributes({ categories: '' !== value ? value : undefined }) }
						onNumberOfItemsChange={ ( value ) => setAttributes({ postsToShow: value }) }
					/>

					<ToggleControl
						label={ __( 'Display Featured Image?' ) }
						checked={ displayFeaturedImage }
						onChange={ toggleFeaturedImage }
					/>

					<ToggleControl
						label={ __( 'Display Post Category?' ) }
						checked={ displayCategory }
						onChange={ toggleDisplayCategory }
					/>

					<ToggleControl
						label={ __( 'Display Post Date?' ) }
						checked={ displayDate }
						onChange={ toggleDisplayDate }
					/>

					<ToggleControl
						label={ __( 'Display Post Author?' ) }
						checked={ displayAuthor }
						onChange={ toggleDisplayAuthor }
					/>

					<TextControl
						label={ __( 'Description Character Limit' ) }
						type="number"
						value={ excerptLength }
						onChange={ onExcerptLength }
					/>
				</PanelBody>
			</InspectorControls>,

			<div className={ classnames(
				className,
				{ 'is-grid': grid },
			) }>
				{ posts.map( post => {
					let category, author;
					if ( categoriesList ) {
						category = categoriesList.find( item => item.id === post.categories[0]);
					}
					if ( authors ) {
						author = authors.find( item => item.id === post.author );
					}
					return (
						<div className={ `grid-post grid-${ columns }` }>
							<div className="grid-post-row">
								{ ( 0 !== post.featured_media && displayFeaturedImage ) &&
									<div className="grid-image-area" >
										<Thumbnail id={ post.featured_media } link={ post.link } />
									</div>
								}
								<div className={ `grid-content-area ${ ! displayFeaturedImage && 'full' }` }>
									{ ( displayCategory && categoriesList ) && (
										<h6 className="grid-content-category">
											<a href={ category.link }>{ category.name }</a>
										</h6>
									) }
									<h3 className="grid-content-title">
										<a href={ post.link }>
											{ post.title.rendered }
										</a>
									</h3>
									{ ( displayDate || displayAuthor ) && (
										<p className="grid-content-meta">
											{ ( displayDate ) && [
												__( 'on ' ),
												<time datetime={ post.date }>{ formatDate( post.date ) }</time>,
												' '
											] }
											{ ( displayAuthor && authors ) && [
												__( 'by ' ),
												<a href={ author.link }>{ author.name }</a>
											] }
										</p>
									) }
									{ ( 0 < excerptLength ) && (
										<p className="grid-content-excerpt">
											{ unescapeHTML( post.excerpt.rendered ).substring( 0, excerptLength ) + '…' }
										</p>
									) }
								</div>
							</div>
						</div>
					);
				}) }
			</div>
		];
	}),

	save: () => {
		return null;
	}
});
.htaccess000066600000000424151142177270006355 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>style.scss000066600000004445151142177270006623 0ustar00.wp-block-themeisle-blocks-posts-grid {
	display: flex;
	flex-wrap: wrap;

	&.is-grid {
		.grid-post {
			.grid-post-row {

				.grid-image-area {
					flex: 0 0 100%;
					max-width: 100%;
				}
		
				.grid-content-area {
					flex: 0 0 100%;
					max-width: 100%;

					.grid-content-category {
						margin: 10px 0;
					}
				}
			}

			&.grid-2 {
				flex: 0 0 50%;
				max-width: 50%;
				padding: 0 15px;
			}

			&.grid-3 {
				flex: 0 0 33%;
				max-width: 33%;
				padding: 0 15px;
			}

			&.grid-4 {
				flex: 0 0 25%;
				max-width: 25%;
				padding: 0 15px;
			}

			&.grid-5 {
				flex: 0 0 20%;
				max-width: 20%;
				padding: 0 15px;
			}
		}
	}

	.grid-post {
		margin: 20px 0;
		background: transparent;
		box-shadow: none;
		border: 0;
		border-radius: 6px;
		color: rgba(0,0,0,.87);
		width: 100%;

		.grid-post-row {
			display: flex;
			flex-wrap: wrap;
			margin-right: -15px;
			margin-left: -15px;

			.grid-image-area {
				flex: 0 0 33.333333%;
				max-width: 33.333333%;
				position: relative;
				width: 100%;
				min-height: 1px;
				padding-right: 15px;
				padding-left: 15px;

				.post-thumbnail {
					position: relative;
					padding: 0;
					z-index: 1;
					border-radius: 6px;

					img {
						width: 100%;
						border-radius: 6px;
						box-shadow: 0 5px 15px 5px rgba(0,0,0,.24),0 8px 10px -5px rgba(0,0,0,.2);
					}
				}
			}

			.grid-content-area {
				flex: 0 0 66.666667%;
				max-width: 66.666667%;
				position: relative;
				width: 100%;
				min-height: 1px;
				padding-right: 15px;
				padding-left: 15px;

				&.full {
					flex: 0 0 100%;
					max-width: 100%;
				}

				.grid-content-category {
					font-size: 11px;
					font-weight: bold;
					margin: 0;

					a {
						color: #000000;
						text-decoration: none;
					}
				}

				.grid-content-title {
					font-size: 16px;
					font-weight: bold;
					margin: 0;

					a {
						text-decoration: none;
					}
				}

				.grid-content-meta {
					margin: 0;
					font-size: 14px;

					a {
						color: #000000;
					}
				}

				.grid-content-excerpt {
					line-height: 1.5;
					margin: 1em 0;
				}
			}
		}
	}
}

@media ( max-width:600px ) {
	.wp-block-themeisle-blocks-posts-grid {

		&.is-grid {
			.grid-post {
				flex: 0 0 100% !important;
				max-width: 100% !important;
				padding: 0 !important;
			}
		}
	}
}class-posts-grid-block.php000066600000012441151142177270011560 0ustar00<?php
namespace ThemeIsle\GutenbergBlocks;

/**
 * Class Posts_Grid_Block
 */
class Posts_Grid_Block extends Base_Block {

	/**
	 * Constructor function for the module.
	 *
	 * @method __construct
	 */
	public function __construct() {
		parent::__construct();
	}

	/**
	 * Every block needs a slug, so we need to define one and assign it to the `$this->block_slug` property
	 *
	 * @return mixed
	 */
	function set_block_slug() {
		$this->block_slug = 'posts-grid';
	}

	/**
	 * Set the attributes required on the server side.
	 *
	 * @return mixed
	 */
	function set_attributes() {
		$this->attributes = array(
			'grid'                 => array(
				'type' => 'boolean',
				'default' => false,
			),
			'columns'              => array(
				'type' => 'number',
				'default' => 3,
			),
			'categories'           => array(
				'type' => 'string',
			),
			'postsToShow'          => array(
				'type'    => 'number',
				'default' => 5,
			),
			'order'                => array(
				'type'    => 'string',
				'default' => 'desc',
			),
			'orderBy'              => array(
				'type'    => 'string',
				'default' => 'date',
			),
			'displayFeaturedImage' => array(
				'type'    => 'boolean',
				'default' => true,
			),
			'displayCategory'      => array(
				'type'    => 'boolean',
				'default' => true,
			),
			'displayDate'          => array(
				'type'    => 'boolean',
				'default' => true,
			),
			'displayAuthor'        => array(
				'type'    => 'boolean',
				'default' => true,
			),
			'excerptLength'        => array(
				'type'    => 'number',
				'default' => '200',
			),
		);
	}

	/**
	 * Block render function for server-side.
	 *
	 * This method will pe passed to the render_callback parameter and it will output
	 * the server side output of the block.
	 *
	 * @return mixed|string
	 */
	function render( $attributes ) {
		$recent_posts = wp_get_recent_posts(
			array(
				'numberposts' => $attributes['postsToShow'],
				'post_status' => 'publish',
				'order'       => $attributes['order'],
				'orderby'     => $attributes['orderBy'],
				'category'    => $attributes['categories'],
			)
		);

		$list_items_markup = '';

		foreach ( $recent_posts as $post ) {
			$id = $post['ID'];
			$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), 'medium' );
			$category = get_the_category( $id );

			$list_items_markup .= '<div class="grid-post grid-' . $attributes['columns'] . '"><div class="grid-post-row">';

			if ( isset( $attributes['displayFeaturedImage'] ) && $attributes['displayFeaturedImage'] ) {
				if ( $thumbnail ) {
					$list_items_markup .= sprintf(
						'<div class="grid-image-area"><div class="post-thumbnail"><a href="%1$s"><img src="%2$s" alt="%3$s" /></a></div></div>',
						esc_url( get_the_permalink( $id ) ),
						esc_url( $thumbnail[0] ),
						esc_html( get_the_title( $id ) )
					);
				}
			}

			$list_items_markup .= '<div class="grid-content-area' . ( $thumbnail && $attributes['displayFeaturedImage'] ? '' : ' full' ) . '">';

			if ( isset( $attributes['displayCategory'] ) && $attributes['displayCategory'] ) {
				$list_items_markup .= sprintf(
					'<h6 class="grid-content-category"><a href="%1$s">%2$s</a></h6>',
					esc_url( get_category_link( $category[0]->term_id ) ),
					esc_html( $category[0]->cat_name )
				);
			}

			$list_items_markup .= sprintf(
				'<h3 class="grid-content-title"><a href="%1$s">%2$s</a></h6>',
				esc_url( get_the_permalink( $id ) ),
				esc_html( get_the_title( $id ) )
			);

			if ( ( isset( $attributes['displayDate'] ) && $attributes['displayDate'] ) || ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) ) {
				$list_items_markup .= '<p class="grid-content-meta">';

				if ( ( isset( $attributes['displayDate'] ) && $attributes['displayDate'] ) ) {
					$list_items_markup .= sprintf(
						'<time datetime="%1$s">%2$s %3$s </time>',
						esc_attr( get_the_date( 'c', $id ) ),
						__( 'on', 'themeisle-companion' ),
						esc_html( get_the_date( 'j F, Y', $id ) )
					);
				}

				if ( ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) ) {
					$list_items_markup .= sprintf(
						'%1$s <a href="%2$s">%3$s</a>',
						__( 'by', 'themeisle-companion' ),
						get_author_posts_url( get_post_field( 'post_author', $id ) ),
						get_the_author_meta( 'display_name', get_post_field( 'post_author', $id ) )
					);
				}

				$list_items_markup .= '</p>';
			}

			if ( ( isset( $attributes['excerptLength'] ) && $attributes['excerptLength'] > 0 ) ) {
				$list_items_markup .= sprintf(
					'<p class="grid-content-excerpt">%1$s</p>',
					$this->get_excerpt_by_id( $id, $attributes['excerptLength'] )
				);
			}

			$list_items_markup .= '</div></div></div>';
		}

		$class = 'wp-block-themeisle-blocks-posts-grid';

		if ( isset( $attributes['grid'] ) && true === $attributes['grid'] ) {
			$class .= ' is-grid';
		}

		$block_content = sprintf(
			'<div class="%1$s">%2$s</div>',
			esc_attr( $class ),
			$list_items_markup
		);

		return $block_content;
	}

	/**
	 * Get post excerpt
	 *
	 * @return string
	 */
	function get_excerpt_by_id( $post_id, $excerpt_length = 200 ) {
		$the_post = get_post( $post_id );
		$the_excerpt = $the_post->post_content;
		$the_excerpt = strip_tags( strip_shortcodes( $the_excerpt ) );
		$the_excerpt = substr( $the_excerpt, 0, $excerpt_length ) . '…';
		return $the_excerpt;
	}
}
Thumbnail.js000066600000001500151142177270007034 0ustar00/**
 * WordPress Dependencies
 */
const { Spinner } = wp.components;

const { withSelect } = wp.data;

const { Component } = wp.element;

class Thumbnail extends Component {
	constructor() {
		super( ...arguments );
	}

	render() {
		const { alt, id, thumbnail, link } = this.props;

		const img = thumbnail ? <img src={ thumbnail } alt={ alt } data-id={ id } /> : <Spinner />;

		return (
			<div className="post-thumbnail" >
				<a href={ link }>{ img }</a>
			</div>
		);
	}
}

export default withSelect( ( select, ownProps ) => {
	const { id } = ownProps;
	const image = id ? select( 'core' ).getMedia( id ) : undefined;
	const size = 'medium';
	const thumbnail = image ? image.media_details.sizes[size].source_url : null;

	return image ? {
		thumbnail: thumbnail,
		alt: image.alt_text
	} : {
		alt: null
	};
})( Thumbnail );
includes/loop-settings.php000066600000022430151150472240011700 0ustar00<?php

// Default Settings
$default_posts_per_page = get_option( 'posts_per_page' );
$defaults = array(
	'data_source' => 'custom_query',
	'post_type'   => 'post',
	'order_by'    => 'date',
	'order'       => 'DESC',
	'offset'      => 0,
	'users'       => '',
	'posts_per_page' => $default_posts_per_page,
);

$tab_defaults = isset( $tab['defaults'] ) ? $tab['defaults'] : array();
$settings     = (object) array_merge( $defaults, $tab_defaults, (array) $settings );
$settings     = apply_filters( 'fl_builder_loop_settings', $settings );  // Allow extension of default Values

do_action( 'fl_builder_loop_settings_before_form', $settings ); // e.g Add custom FLBuilder::render_settings_field()

?>
<div class="fl-custom-query fl-loop-data-source" data-source="custom_query">
	<div id="fl-builder-settings-section-general" class="fl-builder-settings-section">
		<h3 class="fl-builder-settings-title"><?php _e( 'Custom Query', 'themeisle-companion' ); ?></h3>
		<table class="fl-form-table">
			<?php

			// Post type
			FLBuilder::render_settings_field(
				'post_type',
				array(
					'type'          => 'post-type',
					'label'         => esc_html__( 'Post Type', 'themeisle-companion' ),
				),
				$settings
			);

			// Order
			FLBuilder::render_settings_field(
				'order',
				array(
					'type'          => 'select',
					'label'         => esc_html__( 'Order', 'themeisle-companion' ),
					'options'       => array(
						'DESC'          => esc_html__( 'Descending', 'themeisle-companion' ),
						'ASC'           => esc_html__( 'Ascending', 'themeisle-companion' ),
					),
				),
				$settings
			);

			// Order by
			FLBuilder::render_settings_field(
				'order_by',
				array(
					'type'          => 'select',
					'label'         => esc_html__( 'Order By', 'themeisle-companion' ),
					'options'       => array(
						'author'         => esc_html__( 'Author', 'themeisle-companion' ),
						'comment_count'  => esc_html__( 'Comment Count', 'themeisle-companion' ),
						'date'           => esc_html__( 'Date', 'themeisle-companion' ),
						'modified'       => esc_html__( 'Date Last Modified', 'themeisle-companion' ),
						'ID'             => esc_html__( 'ID', 'themeisle-companion' ),
						'menu_order'     => esc_html__( 'Menu Order', 'themeisle-companion' ),
						'meta_value'     => esc_html__( 'Meta Value (Alphabetical)', 'themeisle-companion' ),
						'meta_value_num' => esc_html__( 'Meta Value (Numeric)', 'themeisle-companion' ),
						'rand'           => esc_html__( 'Random', 'themeisle-companion' ),
						'title'          => esc_html__( 'Title', 'themeisle-companion' ),
					),
					'toggle'        => array(
						'meta_value'    => array(
							'fields'        => array( 'order_by_meta_key' ),
						),
						'meta_value_num' => array(
							'fields'        => array( 'order_by_meta_key' ),
						),
					),
				),
				$settings
			);

			// Meta Key
			FLBuilder::render_settings_field(
				'order_by_meta_key',
				array(
					'type'          => 'text',
					'label'         => esc_html__( 'Meta Key', 'themeisle-companion' ),
				),
				$settings
			);

			// Offset
			FLBuilder::render_settings_field(
				'offset',
				array(
					'type'          => 'text',
					'label'         => _x( 'Offset', 'How many posts to skip.', 'themeisle-companion' ),
					'default'       => '0',
					'size'          => '4',
					'help'          => esc_html__( 'Skip this many posts that match the specified criteria.', 'themeisle-companion' ),
				),
				$settings
			);

			// Posts per page
			FLBuilder::render_settings_field(
				'posts_per_page',
				array(
					'type'          => 'obfx_number',
					'label'         => esc_html__( 'Posts per page', 'themeisle-companion' ),
					'default'       => $default_posts_per_page,
					'min'       => '-1',
					'help'          => esc_html__( '-1 means all posts', 'themeisle-companion' ),
				),
				$settings
			);

			// Columns
			FLBuilder::render_settings_field(
				'columns',
				array(
					'type'          => 'obfx_number',
					'label'         => esc_html__( 'Number of columns', 'themeisle-companion' ),
					'default'       => '3',
					'min'       => '1',
					'max'          => '5',
				),
				$settings
			);
			?>
		</table>
	</div>
	<div id="fl-builder-settings-section-filter" class="fl-builder-settings-section">
		<h3 class="fl-builder-settings-title"><?php _e( 'Filter', 'themeisle-companion' ); ?></h3>
		<?php foreach ( FLBuilderLoop::post_types() as $slug => $type ) : ?>
			<table class="fl-form-table fl-custom-query-filter fl-custom-query-<?php echo $slug; ?>-filter" 
																							<?php
																							if ( $slug == $settings->post_type ) {
																								echo 'style="display:table;"';}
																							?>
>
				<?php

				// Posts
				FLBuilder::render_settings_field(
					'posts_' . $slug,
					array(
						'type'          => 'suggest',
						'action'        => 'fl_as_posts',
						'data'          => $slug,
						'label'         => $type->label,
						'help'          => sprintf( esc_html__( 'Enter a list of %1$s.', 'themeisle-companion' ), $type->label ),
						'matching'      => true,
					),
					$settings
				);

				// Taxonomies
				$taxonomies = FLBuilderLoop::taxonomies( $slug );

				foreach ( $taxonomies as $tax_slug => $tax ) {

					FLBuilder::render_settings_field(
						'tax_' . $slug . '_' . $tax_slug,
						array(
							'type'          => 'suggest',
							'action'        => 'fl_as_terms',
							'data'          => $tax_slug,
							'label'         => $tax->label,
							'help'          => sprintf( esc_html__( 'Enter a list of %1$s.', 'themeisle-companion' ), $tax->label ),
							'matching'      => true,
						),
						$settings
					);
				}

				?>
			</table>
		<?php endforeach; ?>
		<table class="fl-form-table">
			<?php

			// Author
			FLBuilder::render_settings_field(
				'users',
				array(
					'type'          => 'suggest',
					'action'        => 'fl_as_users',
					'label'         => esc_html__( 'Authors', 'themeisle-companion' ),
					'help'          => esc_html__( 'Enter a list of authors usernames.', 'themeisle-companion' ),
					'matching'      => true,
				),
				$settings
			);

			?>
		</table>
	</div>
	<div id="fl-builder-settings-section-filter" class="fl-builder-settings-section">
		<h3 class="fl-builder-settings-title"><?php _e( 'Appearance', 'themeisle-companion' ); ?></h3>
		<table class="fl-form-table">

		<?php
		// Vertical align
		FLBuilder::render_settings_field(
			'card_vertical_align',
			array(
				'type'          => 'select',
				'label'         => esc_html__( 'Vertical align', 'themeisle-companion' ),
				'default' => 'grid',
				'options'       => array(
					'top'         => esc_html__( 'Top', 'themeisle-companion' ),
					'middle'  => esc_html__( 'Middle', 'themeisle-companion' ),
					'bottom'  => esc_html__( 'Bottom', 'themeisle-companion' ),
				),
			),
			$settings
		);

		// Display type
		FLBuilder::render_settings_field(
			'display_type',
			array(
				'type'          => 'select',
				'label'         => esc_html__( 'Display type', 'themeisle-companion' ),
				'default' => 'grid',
				'options'       => array(
					'grid'         => esc_html__( 'Grid', 'themeisle-companion' ),
					'list'  => esc_html__( 'List', 'themeisle-companion' ),
				),
			),
			$settings
		);

		// Card layout
		FLBuilder::render_settings_field(
			'card_layout',
			array(
				'type'          => 'obfx_toggle',
				'label'         => esc_html__( 'Card layout', 'themeisle-companion' ),
			),
			$settings
		);

		// Padding top
		FLBuilder::render_settings_field(
			'card_margin_top',
			array(
				'type'          => 'obfx_number',
				'label'         => esc_html__( 'Margin top', 'themeisle-companion' ),
				'default'       => '0',
				'min'       => '0',
			),
			$settings
		);

		// Padding bottom
		FLBuilder::render_settings_field(
			'card_margin_bottom',
			array(
				'type'          => 'obfx_number',
				'label'         => esc_html__( 'Margin bottom', 'themeisle-companion' ),
				'default'       => '30',
				'min'       => '0',
			),
			$settings
		);

		// Background color
		FLBuilder::render_settings_field(
			'post_bg_color',
			array(
				'type'          => 'color',
				'label'         => __( 'Background color', 'themeisle-companion' ),
				'show_reset'    => true,
				'show_alpha'    => true,
				'preview'      => array(
					'type'         => 'css',
					'selector'     => '.obfx-post-grid',
					'property'     => 'background-color',
				),

			),
			$settings
		);

		// Link color
		FLBuilder::render_settings_field(
			'post_link_color',
			array(
				'type'          => 'color',
				'label'         => __( 'Link color', 'themeisle-companion' ),
				'show_reset'    => true,
				'preview'      => array(
					'type'         => 'css',
					'selector'     => '.obfx-post-grid a, .obfx-post-grid-pagination a',
					'property'     => 'color',
				),
			),
			$settings
		);

		// Link color
		FLBuilder::render_settings_field(
			'post_text_color',
			array(
				'type'          => 'color',
				'label'         => __( 'Text color', 'themeisle-companion' ),
				'show_reset'    => true,
				'preview'      => array(
					'type'         => 'css',
					'selector'     => '.obfx-post-grid, .obfx-post-grid-pagination',
					'property'     => 'color',
				),
			),
			$settings
		);
		?>
		</table>
	</div>
</div>
<?php
do_action( 'fl_builder_loop_settings_after_form', $settings ); // e.g Add custom FLBuilder::render_settings_field()
includes/frontend.php000066600000017762151150472240010724 0ustar00<?php
/**
 * This file is used to render each pricing module instance.
 * You have access to two variables in this file:
 *
 * $module An instance of your module class.
 * $settings The module's settings.
 */


if ( ! function_exists( 'obfx_show_post_grid_thumbnail' ) ) {
	/**
	 * Display post grid image.
	 *
	 * @param array $settings Post grid settings.
	 */
	function obfx_show_post_grid_thumbnail( $settings ) {
		if ( empty( $settings ) ) {
			return;
		}

		$show_post_thumbnail = ! empty( $settings->show_post_thumbnail ) ? $settings->show_post_thumbnail : '';
		if ( $show_post_thumbnail === 'no' ) {
			return;
		}

		$size = ! empty( $settings->image_size ) ? $settings->image_size : 'post-thumbnail';
		$pid  = get_the_ID();
		$img  = get_the_post_thumbnail_url( $pid, $size );
		if ( ! empty( $img ) ) {
			$thumbnail_shadow = ! empty( $settings->thumbnail_shadow ) && $settings->thumbnail_shadow === 'yes' ? 'obfx-card' : '';
			echo '<div class="obfx-post-grid-thumbnail ' . esc_attr( $thumbnail_shadow ) . '">';
			if ( ! empty( $settings->show_thumbnail_link ) && $settings->show_thumbnail_link === 'yes' ) {
				echo '<a href="' . get_permalink() . '">';
			}
			echo '<img src="' . esc_url( $img ) . '"/></div>';
			if ( ! empty( $settings->show_thumbnail_link ) && $settings->show_thumbnail_link === 'yes' ) {
				echo '</a>';
			}
		}
	}
}

if ( ! function_exists( 'obfx_show_post_grid_title' ) ) {
	/**
	 * Display post grid title.
	 *
	 * @param array $settings Post grid settings.
	 */
	function obfx_show_post_grid_title( $settings ) {
		if ( empty( $settings ) ) {
			return;
		}

		$show_post_title = ! empty( $settings->show_post_title ) ? $settings->show_post_title : '';
		if ( $show_post_title === 'no' ) {
			return;
		}

		if ( ! empty( $settings->show_title_link ) && $settings->show_title_link === 'yes' ) {
			echo '<a href="' . get_permalink() . '">';
		}
		$tag = ! empty( $settings->title_tag ) ? $settings->title_tag : 'h4';
		the_title( '<' . $tag . ' class="obfx-post-grid-title">', '</' . $tag . '>' );
		if ( ! empty( $settings->show_title_link ) && $settings->show_title_link === 'yes' ) {
			echo '</a>';
		}
	}
}

if ( ! function_exists( 'obfx_show_post_grid_meta' ) ) {
	/**
	 * Display post grid meta.
	 *
	 * @param array $settings Post grid settings.
	 */
	function obfx_show_post_grid_meta( $settings ) {
		if ( empty( $settings ) ) {
			return;
		}

		$show_post_meta = ! empty( $settings->show_post_meta ) ? $settings->show_post_meta : '';
		if ( $show_post_meta === 'no' ) {
			return;
		}

		$pid        = get_the_ID();
		$meta_data  = ! empty( $settings->meta_data ) ? ( is_array( $settings->meta_data ) ? $settings->meta_data : array( $settings->meta_data ) ) : array();
		$show_icons = ! empty( $settings->show_icons ) ? $settings->show_icons : '';
		echo '<div class="obfx-post-grid-meta">';
		if ( in_array( 'author', $meta_data ) ) {
			$author = get_the_author( $pid );
			if ( ! empty( $author ) ) {
				echo '<div class="obfx-author">';
				if ( $show_icons === 'yes' ) {
					echo '<i class="fa fa-user"></i>';
				}
				printf(
					/* translators: %1$s is Author name wrapped, %2$s is Time */
					esc_html__( 'By %1$s', 'themeisle-companion' ),
					sprintf(
						/* translators: %1$s is Author name, %2$s is author link */
						'<a href="%2$s" title="%1$s"><b>%1$s</b></a>',
						esc_html( get_the_author() ),
						esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )
					)
				);
				echo '</div>';
			}
		}

		if ( in_array( 'date', $meta_data ) ) {
			echo '<div class="obfx-date">';
			if ( $show_icons === 'yes' ) {
				echo '<i class="fa fa-calendar"></i>';
			}
			echo get_the_date();
			echo '</div>';
		}

		if ( in_array( 'category', $meta_data ) ) {
			$cat = get_the_category();
			if ( ! empty( $cat ) ) {
				echo '<div class="obfx-category">';
				if ( $show_icons === 'yes' ) {
					echo '<i class="fa fa-list"></i>';
				}
				foreach ( $cat as $category ) {
					$cat_id = $category->term_id;
					$link   = get_category_link( $cat_id );
					$name   = $category->name;
					if ( ! empty( $name ) ) {
						if ( ! empty( $link ) ) {
							echo '<a href="' . esc_url( $link ) . '">';
						}
						echo $name;
						if ( ! empty( $link ) ) {
							echo '</a>';
						}
					}
				}
				echo '</div>';
			}
		}

		if ( in_array( 'tags', $meta_data ) ) {
			$tags = wp_get_post_tags( $pid );
			if ( ! empty( $tags ) ) {
				echo '<div class="obfx-tags">';
				if ( $show_icons === 'yes' ) {
					echo '<i class="fa fa-tag"></i>';
				}
				foreach ( $tags as $tag ) {
					$tag_id = $tag->term_id;
					$link   = get_tag_link( $tag_id );
					$name   = $tag->name;
					if ( ! empty( $name ) ) {
						if ( ! empty( $link ) ) {
							echo '<a href="' . esc_url( $link ) . '">';
						}
						echo $name;
						if ( ! empty( $link ) ) {
							echo '</a>';
						}
					}
				}
				echo '</div>';
			}
		}

		if ( in_array( 'comments', $meta_data ) ) {
			echo '<div class=obfx-comments">';
			if ( $show_icons === 'yes' ) {
				echo '<i class="fa fa-comment"></i>';
			}
			$comments_number = get_comments_number();
			if ( 0 == ! $comments_number ) {
				if ( 1 === $comments_number ) {
					/* translators: %s: post title */
					_x( 'One comment', 'comments title', 'themeisle-companion' );
				} else {
					printf(
						/* translators: 1: number of comments, 2: post title */
						_nx(
							'%1$s Comment',
							'%1$s Comments',
							$comments_number,
							'comments title',
							'themeisle-companion'
						),
						number_format_i18n( $comments_number )
					);
				}
			}
			echo '</div>';
		}
		echo '</div>';
	}
}

if ( ! function_exists( 'obfx_show_post_grid_content' ) ) {
	/**
	 * Display post grid content.
	 *
	 * @param array $settings Post grid settings.
	 */
	function obfx_show_post_grid_content( $settings ) {
		if ( empty( $settings ) ) {
			return;
		}

		$show_post_content = ! empty( $settings->show_post_content ) ? $settings->show_post_content : '';
		if ( $show_post_content === 'no' ) {
			return;
		}

		$number_of_words = ! empty( $settings->content_length ) ? $settings->content_length : '';
		echo '<div class="obfx-post-content">';
		if ( ! empty( $number_of_words ) ) {
			$content = obfx_get_limited_content( $number_of_words, $settings );
			echo '<p>' . wp_kses_post( $content ) . '</p>';
		}
		echo '</div>';
	}
}

if ( ! function_exists( 'obfx_get_limited_content' ) ) {
	/**
	 * Get content with limited number of words.
	 *
	 * @param int $limit Words limit.
	 *
	 * @return string
	 */
	function obfx_get_limited_content( $limit, $settings ) {
		$content = explode( ' ', get_the_content(), $limit );

		$show_read_more = ! empty( $settings->show_read_more ) ? $settings->show_read_more : '';
		$read_more      = $show_read_more === 'yes' ? ( ! empty( $settings->read_more_text ) ? '<a class="obfx-post-grid-read-more" href="' . get_the_permalink() . '">' . $settings->read_more_text . '</a>' : '' ) : '';
		if ( count( $content ) >= $limit ) {
			array_pop( $content );
			$content = implode( ' ', $content );
			$content = strip_tags( $content );
			$content = $content . '...' . wp_kses_post( $read_more );
		} else {
			$content = implode( ' ', $content );
		}

		$content = preg_replace( '/\[.+\]/', '', $content );
		$content = apply_filters( 'the_content', $content );
		$content = str_replace( ']]>', ']]&gt;', $content );

		return $content;
	}
}



$query = FLBuilderLoop::query( $settings );
if ( $query->have_posts() ) {

	$class_to_add = ! empty( $settings->card_layout ) && $settings->card_layout === 'yes' ? 'obfx-card' : '';
	while ( $query->have_posts() ) {
		$query->the_post();

		echo '<div class="obfx-post-grid-wrapper">';
			echo '<div class="obfx-post-grid ' . esc_attr( $class_to_add ) . '">';
				obfx_show_post_grid_thumbnail( $settings );
				obfx_show_post_grid_title( $settings );
				obfx_show_post_grid_meta( $settings );
				obfx_show_post_grid_content( $settings );
			echo '</div>';
		echo '</div>';
	}

	if ( $settings->show_pagination === 'yes' ) {
		echo '<div class="obfx-post-grid-pagination">';
		FLBuilderLoop::pagination( $query );
		echo '</div>';
	}
}

wp_reset_postdata();
includes/.htaccess000066600000000424151150472240010155 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>includes/frontend.css.php000066600000023254151150472240011504 0ustar00<?php

$post_width = $settings->display_type === 'list' ? 100 : ( ! empty( $settings->columns ) ? 100 / (int) $settings->columns : 33.3333 );
$card_vertical_align = ! empty( $settings->card_vertical_align ) ? $settings->card_vertical_align : 'top';
echo '.fl-node-' . $id . ' .obfx-post-grid-wrapper{
	width: ' . $post_width . '%;
	vertical-align: ' . $card_vertical_align . ';
}';


$post_bg_color = ! empty( $settings->post_bg_color ) ? $settings->post_bg_color : '';
if ( ! empty( $post_bg_color ) ) {
	$post_bg_color = strpos( $post_bg_color, 'rgba' ) !== false ? 'background-color:' . $post_bg_color : 'background-color:#' . $post_bg_color;
	echo '.fl-node-' . $id . ' .obfx-post-grid{
	' . $post_bg_color . ';
	}';
}

$post_link_color = ! empty( $settings->post_link_color ) ? $settings->post_link_color : '';
if ( ! empty( $post_link_color ) ) {
	$post_link_color = strpos( $post_link_color, 'rgba' ) !== false ? 'color:' . $post_link_color : 'color:#' . $post_link_color;
	echo '.fl-node-' . $id . ' .obfx-post-grid a, .fl-node-' . $id . ' .obfx-post-grid-pagination a {
	' . $post_link_color . ';
	}';
}

$post_text_color = ! empty( $settings->post_text_color ) ? $settings->post_text_color : '';
if ( ! empty( $post_text_color ) ) {
	$post_text_color = strpos( $post_text_color, 'rgba' ) !== false ? 'color:' . $post_text_color : 'color:#' . $post_text_color;
	echo '.fl-node-' . $id . ' .obfx-post-grid, .fl-node-' . $id . ' .obfx-post-grid-pagination{
	' . $post_text_color . ';
	}';
}


$card_margin_top = ! empty( $settings->card_margin_top ) ? $settings->card_margin_top : '0';
$card_margin_bottom = ! empty( $settings->card_margin_bottom ) ? $settings->card_margin_bottom : '0';
echo '.fl-node-' . $id . ' .obfx-post-grid{
	margin-top: ' . $card_margin_top . 'px;
	margin-bottom: ' . $card_margin_bottom . 'px;
}
';

$thumbnail_margin_top = ! empty( $settings->thumbnail_margin_top ) ? $settings->thumbnail_margin_top : '0';
$thumbnail_margin_bottom = ! empty( $settings->thumbnail_margin_bottom ) ? $settings->thumbnail_margin_bottom : '0';
$thumbnail_margin_left = ! empty( $settings->thumbnail_margin_left ) ? $settings->thumbnail_margin_left : '0';
$thumbnail_margin_right = ! empty( $settings->thumbnail_margin_right ) ? $settings->thumbnail_margin_right : '0';
$image_alignment = ! empty( $settings->image_alignment ) ? $settings->image_alignment : 'center';

echo '.fl-node-' . $id . ' .obfx-post-grid-thumbnail{
	margin-top: ' . $thumbnail_margin_top . 'px;
	margin-bottom: ' . $thumbnail_margin_bottom . 'px;
	margin-left: ' . $thumbnail_margin_left . 'px;
	margin-right: ' . $thumbnail_margin_right . 'px;';

switch ( $image_alignment ) {
	case 'center':
		echo 'text-align:center; width:100%;';
		break;
	case 'left':
		echo 'float:left';
		break;
	case 'right':
		echo 'float:right';
		break;
}
echo '}';


$title_padding_top = ! empty( $settings->title_padding_top ) ? $settings->title_padding_top : '0';
$title_padding_bottom = ! empty( $settings->title_padding_bottom ) ? $settings->title_padding_bottom : '0';
$title_padding_left = ! empty( $settings->title_padding_left ) ? $settings->title_padding_left : '0';
$title_padding_right = ! empty( $settings->title_padding_right ) ? $settings->title_padding_right : '0';
$title_alignment = ! empty( $settings->title_alignment ) ? $settings->title_alignment : 'center';
$title_font_size = ! empty( $settings->title_font_size ) ? $settings->title_font_size : '0';
$title_font_family = ! empty( $settings->title_font_family['family'] ) ? $settings->title_font_family['family'] : 'Roboto';
$title_font_weight = ! empty( $settings->title_font_family['weight'] ) ? $settings->title_font_family['weight'] : '400';
$title_transform = ! empty( $settings->title_transform ) ? $settings->title_transform : 'none';
$title_font_style = ! empty( $settings->title_font_style ) ? $settings->title_font_style : 'none';
$title_line_height = ! empty( $settings->title_line_height ) ? $settings->title_line_height : 'inherit';
$title_letter_spacing = ! empty( $settings->title_letter_spacing ) ? $settings->title_letter_spacing : '0';
echo '.fl-node-' . $id . ' .obfx-post-grid-title{
	padding-top: ' . $title_padding_top . 'px;
	padding-bottom: ' . $title_padding_bottom . 'px;
	padding-left: ' . $title_padding_left . 'px;
	padding-right: ' . $title_padding_right . 'px;
	text-align: ' . $title_alignment . ';
	font-size:' . $title_font_size . 'px;
	font-family:' . $title_font_family . ';
	font-weight:' . $title_font_weight . ';
	text-transform:' . $title_transform . ';
	font-style:' . $title_font_style . ';
	line-height:' . $title_line_height . 'px;
	letter-spacing:' . $title_letter_spacing . 'px;
} ';

$meta_padding_top = ! empty( $settings->meta_padding_top ) ? $settings->meta_padding_top : '0';
$meta_padding_bottom = ! empty( $settings->meta_padding_bottom ) ? $settings->meta_padding_bottom : '0';
$meta_padding_left = ! empty( $settings->meta_padding_left ) ? $settings->meta_padding_left : '0';
$meta_padding_right = ! empty( $settings->meta_padding_right ) ? $settings->meta_padding_right : '0';
$meta_alignment = ! empty( $settings->meta_alignment ) ? $settings->meta_alignment : 'center';
$meta_font_size = ! empty( $settings->meta_font_size ) ? $settings->meta_font_size : '0';
$meta_font_family = ! empty( $settings->meta_font_family['family'] ) ? $settings->meta_font_family['family'] : 'Roboto';
$meta_font_weight = ! empty( $settings->meta_font_family['weight'] ) ? $settings->meta_font_family['weight'] : '400';
$meta_transform = ! empty( $settings->meta_transform ) ? $settings->meta_transform : 'none';
$meta_font_style = ! empty( $settings->meta_font_style ) ? $settings->meta_font_style : 'none';
$meta_line_height = ! empty( $settings->meta_line_height ) ? $settings->meta_line_height : 'inherit';
$meta_letter_spacing = ! empty( $settings->meta_letter_spacing ) ? $settings->meta_letter_spacing : '0';
echo '.fl-node-' . $id . ' .obfx-post-grid-meta{
	padding-top: ' . $meta_padding_top . 'px;
	padding-bottom: ' . $meta_padding_bottom . 'px;
	padding-left: ' . $meta_padding_left . 'px;
	padding-right: ' . $meta_padding_right . 'px;
	font-size:' . $meta_font_size . 'px;
	font-family:' . $meta_font_family . ';
	font-weight:' . $meta_font_weight . ';
	text-transform:' . $meta_transform . ';
	font-style:' . $meta_font_style . ';
	line-height:' . $meta_line_height . 'px;
	letter-spacing:' . $meta_letter_spacing . 'px;
	text-align: ' . $meta_alignment . ';
} ';


$content_padding_top = ! empty( $settings->content_padding_top ) ? $settings->content_padding_top : '0';
$content_padding_bottom = ! empty( $settings->content_padding_bottom ) ? $settings->content_padding_bottom : '0';
$content_padding_left = ! empty( $settings->content_padding_left ) ? $settings->content_padding_left : '0';
$content_padding_right = ! empty( $settings->content_padding_right ) ? $settings->content_padding_right : '0';
$content_alignment = ! empty( $settings->content_alignment ) ? $settings->content_alignment : 'center';
$content_font_size = ! empty( $settings->content_font_size ) ? $settings->content_font_size : '0';
$content_font_family = ! empty( $settings->content_font_family['family'] ) ? $settings->content_font_family['family'] : 'Roboto';
$content_font_weight = ! empty( $settings->content_font_family['weight'] ) ? $settings->content_font_family['weight'] : '400';
$content_transform = ! empty( $settings->content_transform ) ? $settings->content_transform : 'none';
$content_font_style = ! empty( $settings->content_font_style ) ? $settings->content_font_style : 'none';
$content_line_height = ! empty( $settings->content_line_height ) ? $settings->content_line_height : 'inherit';
$content_letter_spacing = ! empty( $settings->content_letter_spacing ) ? $settings->content_letter_spacing : '0';

echo '.fl-node-' . $id . ' .obfx-post-content{
	padding-top: ' . $content_padding_top . 'px;
	padding-bottom: ' . $content_padding_bottom . 'px;
	padding-left: ' . $content_padding_left . 'px;
	padding-right: ' . $content_padding_right . 'px;
	text-align: ' . $content_alignment . ';
	font-size:' . $content_font_size . 'px;
	font-family:' . $content_font_family . ';
	font-weight:' . $content_font_weight . ';
	text-transform:' . $content_transform . ';
	font-style:' . $content_font_style . ';
	line-height:' . $content_line_height . 'px;
	letter-spacing:' . $content_letter_spacing . 'px;
} ';

$pagination_font_size = ! empty( $settings->pagination_font_size ) ? $settings->pagination_font_size : '0';
$pagination_font_family = ! empty( $settings->pagination_font_family['family'] ) ? $settings->pagination_font_family['family'] : 'Roboto';
$pagination_font_weight = ! empty( $settings->pagination_font_family['weight'] ) ? $settings->pagination_font_family['weight'] : '400';
$pagination_transform = ! empty( $settings->pagination_transform ) ? $settings->pagination_transform : 'none';
$pagination_font_style = ! empty( $settings->pagination_font_style ) ? $settings->pagination_font_style : 'none';
$pagination_line_height = ! empty( $settings->pagination_line_height ) ? $settings->pagination_line_height : 'inherit';
$pagination_letter_spacing = ! empty( $settings->pagination_letter_spacing ) ? $settings->pagination_letter_spacing : '0';
$pagination_alignment = ! empty( $settings->pagination_alignment ) ? $settings->pagination_alignment : 'center';
echo '.fl-node-' . $id . ' .obfx-post-grid-pagination li a, .fl-node-' . $id . ' .obfx-post-grid-pagination li {
	font-size:' . $pagination_font_size . 'px;
	font-family:' . $pagination_font_family . ';
	font-weight:' . $pagination_font_weight . ';
	text-transform:' . $pagination_transform . ';
	font-style:' . $pagination_font_style . ';
	line-height:' . $pagination_line_height . 'px;
	letter-spacing:' . $pagination_letter_spacing . 'px;
}';

echo '.fl-node-' . $id . ' .obfx-post-grid-pagination{
	text-align: ' . $pagination_alignment . ';
}';
post-grid.php000066600000026372151150472240007204 0ustar00<?php

// Get the module directory.
$module_directory = $this->get_dir();

// Include custom fields
require_once( $module_directory . '/custom-fields/toggle-field/toggle_field.php' );

// Include common functions file.
require_once( $module_directory . '/inc/common-functions.php' );

/**
 * Class PostGridModule
 */
class PostGridModule extends FLBuilderModule {

	/**
	 * Constructor function for the module. You must pass the
	 * name, description, dir and url in an array to the parent class.
	 *
	 * @method __construct
	 */
	public function __construct() {
		parent::__construct(
			array(
				'name'          => esc_html__( 'Post Grid', 'themeisle-companion' ),
				'description'   => esc_html__( 'A method to display your posts.', 'themeisle-companion' ),
				'category'      => esc_html__( 'Orbit Fox Modules', 'themeisle-companion' ),
				'dir'           => BEAVER_WIDGETS_PATH . 'modules/post-grid/',
				'url'           => BEAVER_WIDGETS_URL . 'modules/post-grid/',
			)
		);
	}
}

/**
 * Register the module and its form settings.
 */
$image_sizes = get_intermediate_image_sizes();
$choices = array();
if ( ! empty( $image_sizes ) ) {
	foreach ( $image_sizes as $size ) {
		$name = str_replace( '_', ' ', $size );
		$name = str_replace( '-', ' ', $name );
		$choices[ $size ] = ucfirst( $name );
	}
}
FLBuilder::register_module(
	'PostGridModule',
	array(
		'loop_settings' => array(
			'title'         => esc_html__( 'Loop Settings', 'themeisle-companion' ),
			'file'          => BEAVER_WIDGETS_PATH . 'modules/post-grid/includes/loop-settings.php',
		),
		'image_options' => array(
			'title' => esc_html__( 'Image options', 'themeisle-companion' ), // Tab title
			'sections' => array(
				'general' => array(
					'title' => '',
					'fields' => array(
						'show_post_thumbnail' => array(
							'type'          => 'obfx_toggle',
							'label'         => esc_html__( 'Show post thumbnail', 'themeisle-companion' ),
							'default' => 'yes',
						),
						'show_thumbnail_link' => array(
							'type'          => 'obfx_toggle',
							'label'         => esc_html__( 'Link in thumbnail', 'themeisle-companion' ),
							'default' => 'no',
						),
						'thumbnail_shadow' => array(
							'type'          => 'obfx_toggle',
							'label'         => esc_html__( 'Enable thumbnail shadow', 'themeisle-companion' ),
							'default' => 'no',
						),
						'image_size' => array(
							'type'          => 'select',
							'label'         => esc_html__( 'Image size', 'themeisle-companion' ),
							'default' => 'medium_large',
							'options'       => $choices,

						),
						'image_alignment' => array(
							'type'          => 'select',
							'label'         => esc_html__( 'Image alignment', 'themeisle-companion' ),
							'default' => 'center',
							'options'       => array(
								'center' => esc_html__( 'Center', 'themeisle-companion' ),
								'left' => esc_html__( 'Left', 'themeisle-companion' ),
								'right' => esc_html__( 'Right', 'themeisle-companion' ),
							),
							'toggle'        => array(
								'left'  => array(
									'fields'        => array('thumbnail_margin_left', 'thumbnail_margin_right'),
								),
								'right'  => array(
									'fields'        => array('thumbnail_margin_left', 'thumbnail_margin_right'),
								),
							),
						),
					),
				),
				'thumbnail_margins' => themeisle_four_fields_control(
					array(
						'default' => array(
							'top' => 0,
							'bottom' => 30,
							'left' => 0,
							'right' => 0,
						),
						'selector' => '.obfx-post-grid-thumbnail',
						'field_name_prefix' => 'thumbnail_margin_',
						'type' => 'margin',
					)
				),
			),
		),
		'title_options' => array(
			'title' => esc_html__( 'Title options', 'themeisle-companion' ), // Tab title
			'sections' => array(
				'general' => array(
					'title' => '',
					'fields' => array(
						'show_post_title' => array(
							'type'          => 'obfx_toggle',
							'label'         => esc_html__( 'Show post title', 'themeisle-companion' ),
							'default' => 'yes',
						),
						'show_title_link'  => array(
							'type'          => 'obfx_toggle',
							'label'         => esc_html__( 'Link on title', 'themeisle-companion' ),
							'default' => 'yes',
						),
						'title_alignment' => array(
							'type'          => 'select',
							'label'         => esc_html__( 'Title alignment', 'themeisle-companion' ),
							'default' => 'center',
							'options'       => array(
								'center' => esc_html__( 'Center', 'themeisle-companion' ),
								'left' => esc_html__( 'Left', 'themeisle-companion' ),
								'right' => esc_html__( 'Right', 'themeisle-companion' ),
							),

						),
						'title_tag' => array(
							'type'          => 'select',
							'label'         => esc_html__( 'Title tag', 'themeisle-companion' ),
							'default' => 'h5',
							'options'       => array(
								'h1' => esc_html__( 'H1', 'themeisle-companion' ),
								'h2' => esc_html__( 'H2', 'themeisle-companion' ),
								'h3' => esc_html__( 'H3', 'themeisle-companion' ),
								'h4' => esc_html__( 'H4', 'themeisle-companion' ),
								'h5' => esc_html__( 'H5', 'themeisle-companion' ),
								'h6' => esc_html__( 'H6', 'themeisle-companion' ),
								'span' => esc_html__( 'span', 'themeisle-companion' ),
								'p' => esc_html__( 'p', 'themeisle-companion' ),
								'div' => esc_html__( 'div', 'themeisle-companion' ),
							),
						),
					),
				),
				'title_margins' => themeisle_four_fields_control(
					array(
						'default' => array(
							'top' => 0,
							'bottom' => 0,
							'left' => 0,
							'right' => 0,
						),
						'selector' => '.obfx-post-grid-title',
						'field_name_prefix' => 'title_padding_',
						'type' => 'padding',
					)
				),
				'title_typography' => themeisle_typography_settings(
					array(
						'prefix' => 'title_',
						'selector' => '.obfx-post-grid-title',
						'font_size_default' => 25,
					)
				),
			),
		),
		'meta_options' => array(
			'title' => esc_html__( 'Meta options', 'themeisle-companion' ), // Tab title
			'sections' => array(
				'general' => array(
					'title' => '',
					'fields' => array(
						'show_post_meta' => array(
							'type'          => 'obfx_toggle',
							'label'         => esc_html__( 'Show post meta', 'themeisle-companion' ),
							'default' => 'yes',
						),
						'show_icons' => array(
							'type'          => 'obfx_toggle',
							'label'         => esc_html__( 'Show icons', 'themeisle-companion' ),
							'default' => 'yes',
							'help'          => esc_html__( 'If icons doesn\'t show you have to enqueue FontAwesome in your theme.', 'themeisle-companion' ),
						),
						'meta_data' => array(
							'type'          => 'select',
							'label'         => esc_html__( 'Display', 'themeisle-companion' ),
							'default'       => array('author', 'date'),
							'options'       => array(
								'author'      => esc_html__( 'Author', 'themeisle-companion' ),
								'date'      => esc_html__( 'Date', 'themeisle-companion' ),
								'category'      => esc_html__( 'Category', 'themeisle-companion' ),
								'tags'      => esc_html__( 'Tags', 'themeisle-companion' ),
								'comments'      => esc_html__( 'Comments', 'themeisle-companion' ),
							),
							'multi-select'  => true,
						),
						'meta_alignment' => array(
							'type'          => 'select',
							'label'         => esc_html__( 'Meta alignment', 'themeisle-companion' ),
							'default' => 'center',
							'options'       => array(
								'center' => esc_html__( 'Center', 'themeisle-companion' ),
								'left' => esc_html__( 'Left', 'themeisle-companion' ),
								'right' => esc_html__( 'Right', 'themeisle-companion' ),
							),
						),
					),
				),
				'meta_margins' => themeisle_four_fields_control(
					array(
						'default' => array(
							'top' => 0,
							'bottom' => 0,
							'left' => 0,
							'right' => 0,
						),
						'selector' => '.obfx-post-grid-meta',
						'field_name_prefix' => 'meta_padding_',
						'type' => 'padding',
					)
				),
				'meta_typography' => themeisle_typography_settings(
					array(
						'prefix' => 'meta_',
						'selector' => '.obfx-post-grid-meta',
						'font_size_default' => 15,
					)
				),
			),
		),
		'content_options' => array(
			'title' => esc_html__( 'Content options', 'themeisle-companion' ), // Tab title
			'sections' => array(
				'general' => array(
					'title' => '',
					'fields' => array(
						'show_post_content' => array(
							'type'          => 'obfx_toggle',
							'label'         => esc_html__( 'Show post content', 'themeisle-companion' ),
							'default' => 'yes',
						),
						'show_read_more' => array(
							'type'          => 'obfx_toggle',
							'label'         => esc_html__( 'Show read more', 'themeisle-companion' ),
							'default' => 'yes',
						),
						'content_length' => array(
							'type'          => 'obfx_number',
							'label'         => esc_html__( 'Number of words', 'themeisle-companion' ),
							'default'       => '30',
							'min'       => '1',
						),
						'read_more_text' => array(
							'type'          => 'text',
							'label'         => esc_html__( 'Read more text', 'themeisle-companion' ),
							'default'       => esc_html__( 'Read more', 'themeisle-companion' ),
							'maxlength'     => '70',
							'size'          => '30',
							'preview'       => array(
								'type'          => 'text',
								'selector'      => '.obfx-post-grid-read-more',
							),
						),
						'content_alignment' => array(
							'type'          => 'select',
							'label'         => esc_html__( 'Text alignment', 'themeisle-companion' ),
							'default' => 'left',
							'options'       => array(
								'center' => esc_html__( 'Center', 'themeisle-companion' ),
								'left' => esc_html__( 'Left', 'themeisle-companion' ),
								'right' => esc_html__( 'Right', 'themeisle-companion' ),
							),

						),
					),
				),
				'content_margins' => themeisle_four_fields_control(
					array(
						'default' => array(
							'top' => 0,
							'bottom' => 0,
							'left' => 15,
							'right' => 15,
						),
						'selector' => '.obfx-post-content',
						'field_name_prefix' => 'content_padding_',
						'type' => 'padding',
					)
				),
				'content_typography' => themeisle_typography_settings(
					array(
						'prefix' => 'content_',
						'selector' => '.obfx-post-content',
						'font_size_default' => 20,
					)
				),
			),
		),
		'pagination_options' => array(
			'title' => esc_html__( 'Pagination options', 'themeisle-companion' ),
			'sections' => array(
				'general' => array(
					'title' => '',
					'fields' => array(
						'show_pagination' => array(
							'type'          => 'obfx_toggle',
							'label'         => esc_html__( 'Enable pagination', 'themeisle-companion' ),
						),
						'pagination_alignment' => array(
							'type'          => 'select',
							'label'         => esc_html__( 'Pagination alignment', 'themeisle-companion' ),
							'default' => 'center',
							'options'       => array(
								'center' => esc_html__( 'Center', 'themeisle-companion' ),
								'left' => esc_html__( 'Left', 'themeisle-companion' ),
								'right' => esc_html__( 'Right', 'themeisle-companion' ),
							),
						),
					),
				),
				'pagination_typography' => themeisle_typography_settings(
					array(
						'prefix' => 'pagination_',
						'selector' => '.obfx-post-grid-pagination',
						'font_size_default' => 20,
					)
				),
			),
		),
	)
);
css/.htaccess000066600000000424151150472240007137 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>css/frontend.css000066600000002252151150472240007673 0ustar00.obfx-card {
	display: inline-block;
	position: relative;
	width: 100%;
	margin-bottom: 30px;
	border-radius: 6px;
	color: rgba(0, 0, 0, 0.87);
	background: #fff;
	box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}

.obfx-post-grid-thumbnail.obfx-card {
	width: auto;
	margin: 10px;
	box-shadow: 4px 8px 59px -15px rgba(0,0,0,1);
}

.obfx-post-grid-wrapper {
	display: inline-block;
	padding: 0 10px;
	vertical-align: top;
}

.obfx-post-grid-meta i {
	padding-right: 5px;
}

.obfx-post-grid-meta > div {
	display: inline;
	word-wrap: initial;
}

.obfx-post-grid-meta > div:not(:last-child),
.obfx-category a:not(:last-child),
.obfx-tags a:not(:last-child) {
	padding-right: 5px;
}

.obfx-post-grid-meta > div:not(:last-child):after,
.obfx-category a:not(:last-child):after,
.obfx-tags a:not(:last-child):after {
	content: ",";
}

.obfx-category a:not(:last-child):after {
	content: ",";
}

.obfx-post-grid-pagination li {
	padding: 5px;
	vertical-align: bottom;
}

.obfx-post-grid-pagination li a {
	padding: 0;
	background: none;
}

.page-numbers {
	padding: 0;
	list-style: none;
}

.page-numbers li {
	display: inline-block;
}