first commit

This commit is contained in:
Roman Pyrih
2023-07-24 08:30:51 +02:00
commit c2e100a763
7128 changed files with 1622619 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die();
}
if ( ( defined( 'FW' ) ) && ! ( class_exists( 'Solarify_Widget_About' ) ) ) :
class Solarify_Widget_About extends WP_Widget {
/**
* Widget constructor.
*/
private $options;
private $prefix;
function __construct() {
$widget_ops = array(
'classname' => 'widget_about',
'description' => esc_html__( 'Add company logo with description and social icons', 'solarify' ),
);
parent::__construct( false, esc_html__( 'Theme - About', 'solarify' ), $widget_ops );
//Create our options by using Unyson option types
$this->options = array(
'title' => array(
'type' => 'text',
'label' => esc_html__( 'Widget Title', 'solarify' ),
),
'about' => array(
'type' => 'wp-editor',
'value' => '',
'label' => esc_html__('Description', 'solarify'),
),
);
$this->prefix = 'widget_about';
}
function widget( $args, $instance ) {
extract( wp_parse_args( $args ) );
$title = esc_attr( $instance['title'] );
$title = $before_title . $title . $after_title;
$params = array();
foreach ( $instance as $key => $value ) {
$params[ $key ] = $value;
}
$instance = $params;
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/about/views/widget.php';
if ( file_exists( $filepath ) ) {
include( $filepath );
} else {
esc_html_e( 'View not found', 'solarify' );
}
}
function update( $new_instance, $old_instance ) {
return fw_get_options_values_from_input(
$this->options,
FW_Request::POST( fw_html_attr_name_to_array_multi_key( $this->get_field_name( $this->prefix ) ), array() )
);
}
function form( $values ) {
$prefix = $this->get_field_id( $this->prefix ); // Get unique prefix, preventing duplicated key
$id = 'fw-widget-options-' . $prefix;
// Print our options
echo '<div class="fw-force-xs fw-theme-admin-widget-wrap fw-framework-widget-options-widget" data-fw-widget-id="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '">';
echo fw()->backend->render_options( $this->options, $values, array(
'id_prefix' => $prefix . '-',
'name_prefix' => $this->get_field_name( $this->prefix ),
) );
echo '</div>';
return $values;
}
}
endif;

View File

@@ -0,0 +1,47 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die();
}
if ( ! defined( 'FW' ) ) {
return;
}
/**
* @var string $before_widget
* @var string $after_widget
* @var array $params
*/
$footer_variant = fw_get_db_customizer_option( 'footer' );
$logo_image_variant = ( $footer_variant === '2' ) ? 'logo_image_light' : 'logo_image';
$unique_id = uniqid();
$logo_image = ( function_exists( 'fw_get_db_settings_option' ) ) ? fw_get_db_customizer_option( $logo_image_variant ) : '';
$logo_text = ( function_exists( 'fw_get_db_settings_option' ) ) ? fw_get_db_customizer_option( 'logo_text' ) : get_option( 'blogname' );
echo wp_kses_post( $before_widget );
if ( $logo_image ) : ?>
<div class="footer_logo">
<img src="<?php echo esc_attr( $logo_image['url'] ); ?>"
alt="<?php echo esc_attr( $logo_text ); ?>">
</div>
<?php else: ?>
<div class="logo">
<span class="logo_text">
<?php echo esc_html( $logo_text ); ?>
</span class="logo_text">
</div>
<?php endif;
if ( !empty( $params['title'] ) ) {
echo wp_kses_post( $title );
}
if ( $params['about'] ) { ?>
<div class="divider_20">
<?php echo wp_kses_post( $params['about'] ); ?>
</div>
<?php }
echo wp_kses_post( $after_widget );

View File

@@ -0,0 +1,90 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die();
}
if ( ( defined( 'FW' ) ) && ! ( class_exists( 'Solarify_Widget_Banner' ) ) ) :
class Solarify_Widget_Banner extends WP_Widget {
/**
* Widget constructor.
*/
private $options;
private $prefix;
function __construct() {
$widget_ops = array(
'classname' => 'widget_banner',
'description' => esc_html__( 'Add linked image with text', 'solarify' ),
);
parent::__construct( false, esc_html__( 'Theme - Ad Banner', 'solarify' ), $widget_ops );
//Create our options by using Unyson option types
$this->options = array(
'title' => array(
'type' => 'text',
'label' => esc_html__( 'Widget Title', 'solarify' ),
),
'image' => array(
'type' => 'upload',
'value' => '',
'label' => esc_html__( 'Banner Image', 'solarify' ),
'images_only' => true,
),
'url' => array(
'type' => 'text',
'value' => '',
'label' => esc_html__( 'Banner URL', 'solarify' ),
),
);
$this->prefix = 'widget_banner';
}
function widget( $args, $instance ) {
extract( wp_parse_args( $args ) );
$params = array();
foreach ( $instance as $key => $value ) {
$params[ $key ] = $value;
}
$instance = $params;
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/banner/views/widget.php';
if ( file_exists( $filepath ) ) {
include( $filepath );
} else {
esc_html_e( 'View not found', 'solarify' );
}
}
function update( $new_instance, $old_instance ) {
return fw_get_options_values_from_input(
$this->options,
FW_Request::POST( fw_html_attr_name_to_array_multi_key( $this->get_field_name( $this->prefix ) ), array() )
);
}
function form( $values ) {
$prefix = $this->get_field_id( $this->prefix ); // Get unique prefix, preventing duplicated key
$id = 'fw-widget-options-' . $prefix;
// Print our options
echo '<div class="fw-force-xs fw-theme-admin-widget-wrap fw-framework-widget-options-widget" data-fw-widget-id="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '">';
echo fw()->backend->render_options( $this->options, $values, array(
'id_prefix' => $prefix . '-',
'name_prefix' => $this->get_field_name( $this->prefix ),
) );
echo '</div>';
return $values;
}
}
endif;

View File

@@ -0,0 +1,26 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die();
}
if ( ! defined( 'FW' ) ) {
return;
}
/**
* @var string $before_widget
* @var string $after_widget
* @var array $params
*/
$unique_id = uniqid();
echo wp_kses_post( $before_widget );
if ( !empty ( $params['title'] ) ) {
echo wp_kses_post( $before_title . $params['title'] . $after_title );
}
if ( !empty ( $params['url'] ) ) : ?>
<a href="<?php echo esc_url( $params['url'] ); ?>" target="_blank">
<?php endif; //url
if ( !empty( $params['image'] ) ) : ?>
<img src="<?php echo esc_url( $params['image']['url'] ); ?>" alt="">
<?php endif; //image
if ( !empty( $params['url'] ) ) : ?>
</a>
<?php endif; //url ?>
<?php echo wp_kses_post( $after_widget );

View File

@@ -0,0 +1,109 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die();
}
if ( ( defined( 'FW' ) ) && ! ( class_exists( 'Solarify_Widget_Contacts' ) ) ) :
class Solarify_Widget_Contacts extends WP_Widget {
/**
* Widget constructor.
*/
private $options;
private $prefix;
function __construct() {
$widget_ops = array(
'classname' => 'widget_contacts',
'description' => esc_html__( 'Add company logo with contacts', 'solarify' ),
);
parent::__construct( false, esc_html__( 'Theme - Contacts', 'solarify' ), $widget_ops );
//Create our options by using Unyson option types
$this->options = array(
'title' => array(
'type' => 'text',
'label' => esc_html__( 'Widget Title', 'solarify' ),
),
'contacts' => array(
'type' => 'addable-box',
'value' => array(
array(
'contact_info' => 'contact info',
),
),
'label' => esc_html__('Contact item', 'solarify'),
'desc' => esc_html__('Media element with contact info and related icon', 'solarify'),
'help' => esc_html__('Enter contact info and choose icon', 'solarify'),
'box-options' => array(
'contact_info' => array( 'type' => 'textarea' ),
'link' => array(
'type' => 'text',
'value' => '',
'label' => esc_html__('Link address', 'solarify'),
'desc' => esc_html__('Fill this field only if you want it to be a link', 'solarify'),
),
'icon' => array(
'type' => 'icon-v2',
'label' => esc_html__( 'Choose an Icon', 'solarify' )
),
),
'template' => esc_html__( 'Contact Item', 'solarify' ), // box title
'add-button-text' => esc_html__('Add', 'solarify'),
'sortable' => true,
)
);
$this->prefix = 'widget_contacts';
}
function widget( $args, $instance ) {
extract( wp_parse_args( $args ) );
$title = esc_attr( $instance['title'] );
$title = $before_title . $title . $after_title;
$params = array();
foreach ( $instance as $key => $value ) {
$params[ $key ] = $value;
}
$instance = $params;
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/contacts/views/widget.php';
if ( file_exists( $filepath ) ) {
include( $filepath );
} else {
esc_html_e( 'View not found', 'solarify' );
}
}
function update( $new_instance, $old_instance ) {
return fw_get_options_values_from_input(
$this->options,
FW_Request::POST( fw_html_attr_name_to_array_multi_key( $this->get_field_name( $this->prefix ) ), array() )
);
}
function form( $values ) {
$prefix = $this->get_field_id( $this->prefix ); // Get unique prefix, preventing duplicated key
$id = 'fw-widget-options-' . $prefix;
// Print our options
echo '<div class="fw-force-xs fw-theme-admin-widget-wrap fw-framework-widget-options-widget" data-fw-widget-id="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '">';
echo fw()->backend->render_options( $this->options, $values, array(
'id_prefix' => $prefix . '-',
'name_prefix' => $this->get_field_name( $this->prefix ),
) );
echo '</div>';
return $values;
}
}
endif;

View File

@@ -0,0 +1,44 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die();
}
if ( ! defined( 'FW' ) ) {
return;
}
/**
* @var string $before_widget
* @var string $after_widget
* @var array $params
* @var $title
*/
$unique_id = uniqid();
echo wp_kses_post( $before_widget );
echo wp_kses_post( $title );
?>
<ul class="list-unstyled greylinks">
<?php foreach ( $params['contacts'] as $contact ) : ?>
<li>
<div class="media small-media">
<?php if ( !empty( $contact['icon'] ) ) : ?>
<div class="media-left media-middle">
<?php if ( $contact['icon']['type'] === 'icon-font') : ?>
<i class="<?php echo esc_attr( $contact['icon']['icon-class'] ); ?> highlight fontsize_24 cons-width"></i>
<?php else:
echo wp_get_attachment_image( $contact['icon']['attachment-id'] );
endif; ?>
</div>
<?php endif; ?>
<div class="media-body media-middle greylinks">
<?php if ( !empty( $contact['link'] ) ) : ?>
<a href="<?php echo esc_attr( $contact['link'] ); ?>">
<?php endif;
echo nl2br( esc_html( $contact['contact_info'] ) );
if ( !empty( $contact['link'] ) ) : ?>
</a>
<?php endif; ?>
</div>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php echo wp_kses_post( $after_widget );

View File

@@ -0,0 +1,94 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
if ( class_exists( 'Solarify_Widget_Facebook_Page_Stream' ) ) {
return;
}
if ( defined( 'FW' ) ) {
$fw_social_facebook = fw()->extensions->get( 'social-facebook' );
if ( ! empty( $fw_social_facebook ) ) {
class Solarify_Widget_Facebook_Page_Stream extends WP_Widget {
/**
* @internal
*/
function __construct() {
//widget_recent_entries
//widget_facebook_page_stream
$widget_ops = array(
'classname' => 'widget_recent_entries widget_facebook_page_stream',
'description' => esc_html__( 'FaceBook Page Steam', 'solarify' )
);
parent::__construct( false, esc_html__( 'Theme - Facebook', 'solarify' ), $widget_ops );
}
/**
* @param array $args
* @param array $instance
*/
function widget( $args, $instance ) {
extract( $args );
$title = esc_attr( $instance['title'] );
$page_id = esc_attr( $instance['page_id'] );
$number = ( (int) ( esc_attr( $instance['number'] ) ) > 0 ) ? esc_attr( $instance['number'] ) : 5;
$title = $before_title . $title . $after_title;
$result = fw_ext_social_facebook_graph_api_explorer( 'GET', $page_id, array( 'fields' => 'posts.limit(' . $number . '){message}' ) );
$result = json_decode( $result );
if ( ! empty( $result->posts->data ) ) {
$posts = $result->posts->data;
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/facebook-page-stream/views/widget.php';
if ( file_exists( $filepath ) ) {
include( $filepath );
} else {
esc_html_e( 'View not found', 'solarify' );
}
} else {
esc_html_e( 'Facebook in Social Extension not configured', 'solarify' );
}
}
function update( $new_instance, $old_instance ) {
return $new_instance;
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'page_id' => '', 'number' => '' ) );
?>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'solarify' ); ?> </label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat"
id="<?php $this->get_field_id( 'title' ); ?>"/>
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'page_id' ) ); ?>"><?php esc_html_e( 'Page ID:', 'solarify' ); ?> </label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'page_id' ) ); ?>"
value="<?php echo esc_attr( $instance['page_id'] ); ?>" class="widefat"
id="<?php $this->get_field_id( 'page_id' ); ?>"/>
</p>
<p>
<label
for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of posts:', 'solarify' ); ?>
:</label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>"
value="<?php echo esc_attr( $instance['number'] ); ?>" class="widefat"
id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
</p>
<?php
}
}
}
}

View File

@@ -0,0 +1,24 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
/**
* @var $number
* @var $before_widget
* @var $after_widget
* @var $title
* @var $posts
*/
echo wp_kses_post( $before_widget );
echo wp_kses_post( $title );
?>
<ul class="darklinks">
<?php
foreach ( $posts as $post ) {
if ( isset( $post->message ) ) {
echo '<li><a href="' . esc_url( 'https://facebook.com/' . $post->id . '/') . '">' . wp_kses_post( wp_trim_words( $post->message, 24 ) ) . '</a></li>';
}
}
?>
</ul>
<?php echo wp_kses_post( $after_widget ); ?>

View File

@@ -0,0 +1,81 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
if ( class_exists( 'Solarify_Widget_Flickr' ) ) {
return;
}
class Solarify_Widget_Flickr extends WP_Widget {
/**
* @internal
*/
function __construct() {
$widget_ops = array(
'classname' => 'widget_flickr',
'description' => esc_html__( 'Add linked image with text', 'solarify' ),
);
parent::__construct( false, esc_html__( 'Theme - Flickr', 'solarify' ), $widget_ops );
}
/**
* @param array $args
* @param array $instance
*/
function widget( $args, $instance ) {
extract( $args );
$flickr_id = esc_attr( $instance['flickr_id'] );
$title = esc_attr( $instance['title'] );
$number = ( (int) ( esc_attr( $instance['number'] ) ) > 0 ) ? esc_attr( $instance['number'] ) : 8;
$title = $before_title . $title . $after_title;
wp_enqueue_script(
'solarify-flickr-widget',
SOLARIFY_THEME_URI . '/inc/widgets/flickr/static/js/jflickrfeed.min.js',
array( 'jquery' ),
'1.0'
);
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/flickr/views/widget.php';
if ( file_exists( $filepath ) ) {
include( $filepath );
} else {
esc_html_e( 'View not found', 'solarify' );
}
}
function update( $new_instance, $old_instance ) {
return $new_instance;
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'flickr_id' => '', 'number' => '', 'title' => '' ) );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'solarify' ); ?> </label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat"
id="<?php $this->get_field_id( 'title' ); ?>"/>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'flickr_id' ) ); ?>"><?php esc_html_e( 'Flickr ID', 'solarify' ); ?> (<a
href="http://www.idgettr.com" target="_blank">idGettr</a>):</label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'flickr_id' ) ); ?>"
value="<?php echo esc_attr( $instance['flickr_id'] ); ?>" class="widefat"
id="<?php $this->get_field_id( 'flickr_id' ); ?>"/>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of photos', 'solarify' ); ?>
:</label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>"
value="<?php echo esc_attr( $instance['number'] ); ?>" class="widefat"
id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
</p>
<?php
}
}

View File

@@ -0,0 +1,16 @@
/*
* Copyright (C) 2009 Joel Sutherland
* Licenced under the MIT license
* http://www.newmediacampaigns.com/page/jquery-flickr-plugin
*
* Available tags for templates:
* title, link, date_taken, description, published, author, author_id, tags, image*
*/
(function($){$.fn.jflickrfeed=function(settings,callback){settings=$.extend(true,{flickrbase:'http://api.flickr.com/services/feeds/',feedapi:'photos_public.gne',limit:20,qstrings:{lang:'en-us',format:'json',jsoncallback:'?'},cleanDescription:true,useTemplate:true,itemTemplate:'',itemCallback:function(){}},settings);var url=settings.flickrbase+settings.feedapi+'?';var first=true;for(var key in settings.qstrings){if(!first)
url+='&';url+=key+'='+settings.qstrings[key];first=false;}
return $(this).each(function(){var $container=$(this);var container=this;$.getJSON(url,function(data){$.each(data.items,function(i,item){if(i<settings.limit){if(settings.cleanDescription){var regex=/<p>(.*?)<\/p>/g;var input=item.description;if(regex.test(input)){item.description=input.match(regex)[2]
if(item.description!=undefined)
item.description=item.description.replace('<p>','').replace('</p>','');}}
item['image_s']=item.media.m.replace('_m','_s');item['image_t']=item.media.m.replace('_m','_t');item['image_m']=item.media.m.replace('_m','_m');item['image']=item.media.m.replace('_m','');item['image_b']=item.media.m.replace('_m','_b');delete item.media;if(settings.useTemplate){var template=settings.itemTemplate;for(var key in item){var rgx=new RegExp('{{'+key+'}}','g');template=template.replace(rgx,item[key]);}
$container.append(template)}
settings.itemCallback.call(container,item);}});if($.isFunction(callback)){callback.call(container,data);}});});}})(jQuery);

View File

@@ -0,0 +1,17 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die( 'Direct access forbidden.' ); }
/**
* @var $number
* @var $before_widget
* @var $after_widget
* @var $title
* @var $flickr_id
*/
echo wp_kses_post( $before_widget );
echo wp_kses_post( $title );
?>
<div class="wrap-flickr">
<ul class="flickr_ul" data-flickr-number="<?php echo esc_attr( $number ); ?>" data-flickr-id="<?php echo esc_attr( $flickr_id ); ?>"></ul>
</div>
<?php echo wp_kses_post ( $after_widget );

View File

@@ -0,0 +1,110 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
if ( class_exists( 'Solarify_Widget_Popular' ) ) {
return;
}
class Solarify_Widget_Popular extends WP_Widget {
/**
* @internal
*/
public function __construct() {
$widget_ops = array(
'classname' => 'widget_popular_entries',
'description' => esc_html__( 'Most commented Posts', 'solarify' ),
);
parent::__construct( false, esc_html__( 'Theme - Popular Posts', 'solarify' ), $widget_ops );
}
/**
* @param array $args
* @param array $instance
*/
public function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
$number = ( (int) ( $instance['number'] ) > 0 ) ? esc_attr( $instance['number'] ) : 5;
$popular_posts = $this->fw_get_posts_with_info( array(
'sort' => 'comment_count',
'items' => $number,
) );
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/popular/views/widget.php';
if ( file_exists( $filepath ) ) {
include( $filepath );
} else {
esc_html_e( 'View not found', 'solarify' );
}
}
/**
* @param array $args
*
* @return array
*/
public function fw_get_posts_with_info( $args = array() ) {
$defaults = array(
'sort' => 'recent',
'items' => 5,
'image_post' => true,
'date_post' => true,
'date_format' => 'F jS, Y',
'post_type' => 'post',
);
extract( wp_parse_args( $args, $defaults ) );
$query = new WP_Query( array(
'post_type' => $post_type,
'orderby' => $sort,
'order' => 'DESC',
'ignore_sticky_posts' => true,
'posts_per_page' => $items
) );
//wp reset query removed
return $query;
}
/**
* @param array $new_instance
* @param array $old_instance
*
* @return array
*/
public function update( $new_instance, $old_instance ) {
return $new_instance;
}
/**
* @param array $instance
*
* @return string|void
*/
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'number' => '', 'title' => '' ) );
$title = sanitize_text_field( $instance['title'] );
$number = esc_attr( $instance['number'] );
?>
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'solarify' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
value="<?php echo esc_attr( $title ); ?>"/>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of Blog posts', 'solarify' ); ?>
:</label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" value="<?php echo esc_attr( $number ); ?>"
class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
</p>
<?php
}
}

View File

@@ -0,0 +1,54 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
/**
* @var string $before_widget
* @var string $after_widget
* @var array $popular_posts
*/
$unique_id = uniqid();
echo wp_kses_post( $before_widget );
if ( $title ) {
echo wp_kses_post( $before_title . $title . $after_title );
}
?>
<ul id="popular_posts_<?php echo esc_attr( $unique_id ); ?>" class="media-list darklinks">
<?php while ( $popular_posts->have_posts() ) : $popular_posts->the_post(); ?>
<li <?php post_class( 'media' ); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" class="media-left">
<?php echo get_the_post_thumbnail( get_the_ID(), 'thumbnail' ); ?>
</a>
<?php endif; //has_post_thumbnail ?>
<div class="media-body">
<p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
<div class="item-meta">
<?php
// Set up and print post meta information.
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
<!-- comments number and link
<span class="comments-link">
<i class="rt-icon2-bubble highlight"></i>
<?php comments_popup_link( esc_html__( 'No comments', 'solarify' ), esc_html__( '1 comment', 'solarify' ), esc_html__( '% comments', 'solarify' ) ); ?>
</span>
-->
<?php
endif; //post_password_required
?>
<span>
<i class="rt-icon2-heart-outline highlight"></i>
<?php
solarify_post_like_count( get_the_ID() );
?>
</span>
</div>
</div>
</li>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
</ul>
<?php echo wp_kses_post( $after_widget ); ?>

View File

@@ -0,0 +1,110 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
if ( class_exists( 'Solarify_Widget_Post_Tabs' ) ) {
return;
}
class Solarify_Widget_Post_Tabs extends WP_Widget {
/**
* @internal
*/
public function __construct() {
$widget_ops = array(
'classname' => 'widget_tabs',
'description' => esc_html__( 'Recent and Popular posts in tabs', 'solarify' ),
);
parent::__construct( false, esc_html__( 'Theme - Blog Tabs', 'solarify' ), $widget_ops );
}
/**
* @param array $args
* @param array $instance
*/
public function widget( $args, $instance ) {
extract( $args );
$number = ( (int) ( $instance['number'] ) > 0 ) ? esc_attr( $instance['number'] ) : 5;
$recent_posts = $this->fw_get_posts_with_info( array(
'sort' => 'post_date',
'items' => $number,
) );
$popular_posts = $this->fw_get_posts_with_info( array(
'sort' => 'comment_count',
'items' => $number,
) );
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/post-tabs/views/widget.php';
if ( file_exists( $filepath ) ) {
include( $filepath );
} else {
esc_html_e( 'View not found', 'solarify' );
}
}
/**
* @param array $args
*
* @return array
*/
public function fw_get_posts_with_info( $args = array() ) {
$defaults = array(
'sort' => 'recent',
'items' => 5,
'image_post' => true,
'date_post' => true,
'date_format' => 'F jS, Y',
'post_type' => 'post',
);
extract( wp_parse_args( $args, $defaults ) );
$query = new WP_Query( array(
'post_type' => $post_type,
'orderby' => $sort,
'order' => 'DESC',
'ignore_sticky_posts' => true,
'posts_per_page' => $items
) );
//wp reset query removed
return $query;
}
/**
* @param array $new_instance
* @param array $old_instance
*
* @return array
*/
public function update( $new_instance, $old_instance ) {
return $new_instance;
}
/**
* @param array $instance
*
* @return string|void
*/
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'number' => '', 'title' => '' ) );
$number = esc_attr( $instance['number'] );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of Blog posts', 'solarify' ); ?>
:</label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" value="<?php echo esc_attr( $number ); ?>"
class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
</p>
<?php
}
}

View File

@@ -0,0 +1,71 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
/**
* @var string $before_widget
* @var string $after_widget
* @var array $recent_posts
* @var array $popular_posts
*/
$unique_id = uniqid();
echo wp_kses_post( $before_widget );
?>
<div class="tabs small-tabs">
<ul class="nav nav-tabs" role="tablist">
<li><a href="#popular_posts_<?php echo esc_attr( $unique_id ); ?>" role="tab"
data-toggle="tab"><?php esc_html_e( 'Popular', 'solarify' ); ?></a></li>
<li><a href="#recent_<?php echo esc_attr( $unique_id ); ?>" role="tab"
data-toggle="tab"><?php esc_html_e( 'Recent', 'solarify' ); ?></a></li>
</ul>
</div>
<div class="tab-content top-color-border no-border">
<div id="popular_posts_<?php echo esc_attr( $unique_id ); ?>" class="tab-pane fade">
<?php while ( $popular_posts->have_posts() ) : $popular_posts->the_post(); ?>
<div <?php post_class( 'vertical-item' ); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>">
<?php echo get_the_post_thumbnail( get_the_ID() ); ?>
</a>
<?php endif; //has_post_thumbnail ?>
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<p class="item-meta">
<?php
solarify_posted_on();
?>
<span class="pull-right">
<i class="rt-icon2-heart-outline highlight"></i>
<?php
solarify_post_like_count( get_the_ID() );
?>
</span>
</p>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
</div>
<div id="recent_<?php echo esc_attr( $unique_id ); ?>" class="tab-pane fade">
<?php while ( $recent_posts->have_posts() ) : $recent_posts->the_post(); ?>
<div <?php post_class( 'vertical-item' ); ?> id="widget-post-tabs-post-<?php the_ID(); ?>">
<?php if ( has_post_thumbnail( get_the_ID() ) ) : ?>
<a href="<?php the_permalink(); ?>">
<?php echo get_the_post_thumbnail( get_the_ID() ); ?>
</a>
<?php endif; //has_post_thumbnail ?>
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<p class="item-meta">
<?php solarify_posted_on(); ?>
<span class="pull-right">
<i class="rt-icon2-heart-outline highlight"></i>
<?php
solarify_post_like_count( get_the_ID() );
?>
</span>
</p>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
</div>
</div>
<?php echo wp_kses_post( $after_widget ); ?>

View File

@@ -0,0 +1,109 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
if ( class_exists( 'Solarify_Widget_Recent' ) ) {
return;
}
class Solarify_Widget_Recent extends WP_Widget {
/**
* @internal
*/
public function __construct() {
$widget_ops = array(
'classname' => 'widget_recent_posts',
'description' => esc_html__( 'Most Recent Posts with Images', 'solarify' ),
);
parent::__construct( false, esc_html__( 'Theme - Recent Posts (thumbnail)', 'solarify' ), $widget_ops );
}
/**
* @param array $args
* @param array $instance
*/
public function widget( $args, $instance ) {
extract( $args );
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
$number = ( (int) ( $instance['number'] ) > 0 ) ? esc_attr( $instance['number'] ) : 5;
$popular_posts = $this->fw_get_posts_with_info( array(
'items' => $number,
) );
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/recent/views/widget.php';
if ( file_exists( $filepath ) ) {
include( $filepath );
} else {
esc_html_e( 'View not found', 'solarify' );
}
}
/**
* @param array $args
*
* @return array
*/
public function fw_get_posts_with_info( $args = array() ) {
$defaults = array(
'sort' => 'recent',
'items' => 5,
'image_post' => true,
'date_post' => true,
'date_format' => 'F jS, Y',
'post_type' => 'post',
);
extract( wp_parse_args( $args, $defaults ) );
$query = new WP_Query( array(
'post_type' => $post_type,
'orderby' => $sort,
'order' => 'DESC',
'ignore_sticky_posts' => true,
'posts_per_page' => $items
) );
//wp reset query removed
return $query;
}
/**
* @param array $new_instance
* @param array $old_instance
*
* @return array
*/
public function update( $new_instance, $old_instance ) {
return $new_instance;
}
/**
* @param array $instance
*
* @return string|void
*/
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'number' => '', 'title' => '' ) );
$title = sanitize_text_field( $instance['title'] );
$number = esc_attr( $instance['number'] );
?>
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'solarify' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
value="<?php echo esc_attr( $title ); ?>"/>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of Blog posts', 'solarify' ); ?>
:</label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" value="<?php echo esc_attr( $number ); ?>"
class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
</p>
<?php
}
}

View File

@@ -0,0 +1,34 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
/**
* @var string $before_widget
* @var string $after_widget
* @var array $popular_posts
*/
$unique_id = uniqid();
echo wp_kses_post( $before_widget );
if ( $title ) {
echo wp_kses_post( $before_title . $title . $after_title );
}
?>
<ul id="recent_posts_<?php echo esc_attr( $unique_id ); ?>" class="media-list">
<?php while ( $popular_posts->have_posts() ) : $popular_posts->the_post(); ?>
<li <?php post_class( 'media' ); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" class="media-left media-middle">
<?php echo get_the_post_thumbnail( get_the_ID(), 'thumbnail' ); ?>
</a>
<?php endif; //has_post_thumbnail ?>
<div class="media-body media-middle text-left">
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
</div>
</li>
<?php endwhile; ?>
<?php wp_reset_postdata(); // reset the query ?>
</ul>
<?php echo wp_kses_post( $after_widget ); ?>

View File

@@ -0,0 +1,92 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
if ( defined( 'FW' ) && function_exists( 'fw_ext_social_twitter_get_connection' ) && function_exists( 'curl_exec' ) ) {
class Solarify_Widget_Twitter extends WP_Widget {
/**
* @internal
*/
function __construct() {
$widget_ops = array( 'description' => 'Twitter Feed' );
parent::__construct( false, esc_html__( 'Theme - Twitter', 'solarify' ), $widget_ops );
}
/**
* @param array $args
* @param array $instance
*/
function widget( $args, $instance ) {
extract( $args );
$user = esc_attr( $instance['user'] );
$title = esc_attr( $instance['title'] );
$number = ( (int) ( esc_attr( $instance['number'] ) ) > 0 ) ? esc_attr( $instance['number'] ) : 5;
$title = $before_title . $title . $after_title;
// $tweets = get_site_transient( 'scratch_tweets_' . $user . '_' . '2' );
$tweets = '';
if ( empty( $tweets ) ) {
/* @var $connection TwitterOAuth */
$connection = fw_ext_social_twitter_get_connection();
$tweets = $connection->get( "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=" . $user . "&count=" . $number );
set_site_transient( 'scratch_tweets_' . $user . '_' . $number, $tweets, 12 * HOUR_IN_SECONDS );
}
$widget_tweets = array();
if ( empty( $tweets->errors ) ) {
foreach ( $tweets as $key => $tweet ) :
$widget_tweets[ $key ][ 'text' ] = make_clickable( $tweet->text );
$widget_tweets[ $key ][ 'created_at' ] = mysql2date( 'F j, Y g:i a', $tweet->created_at );
$widget_tweets[ $key ][ 'profile_image_url' ] = $tweet->user->profile_image_url;
$widget_tweets[ $key ][ 'name' ] = $tweet->user->name;
endforeach;
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/twitter/views/widget.php';
if ( file_exists( $filepath ) ) {
include( $filepath );
} else {
esc_html_e( 'View not found', 'solarify' );
}
} else {
esc_html_e( 'Twitter in Social Extension not configured', 'solarify' );
}
} //widget
function update( $new_instance, $old_instance ) {
return $new_instance;
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'user' => '', 'number' => '', 'title' => '' ) );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'solarify' ); ?> </label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat"
id="<?php $this->get_field_id( 'title' ); ?>"/>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'user' ) ); ?>"><?php esc_html_e( 'User', 'solarify' ); ?> :</label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'user' ) ); ?>"
value="<?php echo esc_attr( $instance['user'] ); ?>" class="widefat"
id="<?php $this->get_field_id( 'user' ); ?>"/>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of tweets', 'solarify' ); ?>
:</label>
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>"
value="<?php echo esc_attr( $instance['number'] ); ?>" class="widefat"
id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"/>
</p>
<?php
}
} //class
}

View File

@@ -0,0 +1,31 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Direct access forbidden.' );
}
/**
* @var $number
* @var $before_widget
* @var $after_widget
* @var $title
* @var $tweets
*/
echo wp_kses_post ( $before_widget );
echo wp_kses_post ( $title );
?>
<ul class="tweet_list highlightlinks">
<?php
foreach ( $widget_tweets as $tweet ) : ?>
<li>
<div class="tweet">
<span class="tweet_text">
<?php echo wp_kses_post ( $tweet['text'] ); ?>
</span>
<span class="tweet_time">
<?php echo wp_kses_post ( $tweet['created_at'] ); ?>
</span>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php echo wp_kses_post ( $after_widget ); ?>