'thk_qr_code', 'description' => __( 'QR Code', 'luxeritas' ) ); parent::__construct( 'thk_qr_code', '#9 ' . __( 'QR Code', 'luxeritas' ) . ' (' . __( 'by Luxeritas', 'luxeritas' ) . ')', $widget_ops ); } public function widget( $args, $instance ) { global $_is; $title = ( !empty( $instance['title'] ) ) ? $instance['title'] : ''; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $width_height = isset( $instance['size'] ) ? (int)$instance['size'] : 250; $margin = isset( $instance['margin'] ) ? (int)$instance['margin'] : 0; $description = isset( $instance['description'] ) ? esc_attr( $instance['description'] ) : __( 'QR Code', 'luxeritas' ); $bgcolor = !empty( $instance['bgcolor'] ) && $instance['bgcolor'] !== '#ffffff' ? '&bgcolor=' . str_replace( '#', '', $instance['bgcolor'] ) : ''; $align = ''; if( $width_height < 40 ) $width_height = 40; if( $margin < 0 ) $margin = 0; if( isset( $instance['align'] ) ) { if( $instance['align'] === 'center' ) { $align = ' class="aligncenter"'; } elseif( $instance['align'] === 'right' ) { $align = ' class="alignright"'; } } //$format = '
QR Code | ' . get_bloginfo('name') . '
'; $format = '
QR Code | ' . get_bloginfo('name') . '
'; echo $args['before_widget']; if( !empty( $title ) ) echo $args['before_title'] . $title . $args['after_title']; $protocol = $_is['ssl'] === true ? 'https' : 'http'; $permalink = $protocol . '://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; //echo sprintf( $format, $width_height, 'L', $margin, rawurlencode( $permalink ) ) echo sprintf( $format, $width_height, $margin, rawurlencode( $permalink ) ) , $args['after_widget']; } public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $new_instance = wp_parse_args( (array)$new_instance, array( 'size' => 150, 'margin' => 0, 'align' => 'left' ) ); $instance['size'] = (int)$new_instance['size']; $instance['margin'] = (int)$new_instance['margin']; $instance['align'] = $new_instance['align']; $instance['bgcolor'] = isset( $new_instance['bgcolor'] ) ? $new_instance['bgcolor'] : "#ffffff"; if( $instance['size'] < 40 ) $instance['size'] = 40; if( $instance['margin'] < 0 ) $instance['margin'] = 0; return $instance; } public function form( $instance ) { $title = isset( $instance['title'] ) ? sanitize_text_field( $instance['title'] ) : ''; $instance = wp_parse_args( (array)$instance, array( 'posturl' => '', 'size' => 150 ) ); $posturl = $instance['posturl'] ? 'checked="checked"' : ''; $size = isset( $instance['size'] ) ? (int)$instance['size'] : 150; $margin = isset( $instance['margin'] ) ? (int)$instance['margin'] : 0; $align = isset( $instance['align'] ) ? $instance['align'] : ''; $description = isset( $instance['description'] ) ? esc_attr( $instance['description'] ) : __( 'QR Code', 'luxeritas' ); $bgcolor = isset( $instance['bgcolor'] ) ? esc_attr( $instance['bgcolor'] ) : '#ffffff'; if( $size < 40 ) $size = 40; if( $margin < 0 ) $margin = 0; ?>






'thk_recent_comments', 'description' => __( 'Recent Comments', 'luxeritas' ) ); parent::__construct( 'thk_recent_comments', '#6 ' . __( 'Recent Comments', 'luxeritas' ) . ' (' . __( 'by Luxeritas', 'luxeritas' ) . ')', $widget_ops ); } public function widget( $args, $instance ) { global $comments, $comment; $title = ( !empty( $instance['title'] ) ) ? $instance['title'] : ''; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $number = ( !empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; if( empty( $number ) ) $number = 5; $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, // 表示件数 'orderby' => 'comment_date', // コメント日付でソート 'order' => 'desc', // 降順ソート 'status' => 'approve', // 承認されたものだけ 'post_status' => 'publish' // 公開済みの記事だけ ) ) ); echo $args['before_widget']; if( !empty( $title ) ) echo $args['before_title'], $title, $args['after_title']; ?>
comment_content = thk_admin_comments( $comment->comment_content, $comment ); $excerpt = $this->com_excerpt( $comment->comment_content ); if( strlen( get_the_title( $comment->comment_post_ID ) ) >= $title_length ) { $post_title = mb_strimwidth( get_the_title( $comment->comment_post_ID ), 0, $title_length ) . "..."; } else { $post_title = get_the_title( $comment->comment_post_ID ); } $comment_author = empty( $comment->comment_author ) ? __( 'Anonymous', 'luxeritas' ) : $comment->comment_author; if( strlen( $comment->comment_author ) >= $auth_length ) { $comment_author = mb_strimwidth( $comment_author, 0, $auth_length ) . "..."; } $suffix = get_locale() === 'ja' ? ' さん' : ''; if( $comment->comment_author_url ) { $author_link = 'comment_author_url, home_url() ) !== false ) { $author_link .= ' class="url" aria-label="' . sprintf( __( '%s' website', 'luxeritas' ), $comment_author ) . '">' . $comment_author . ''; } else { $author_link .= ' target="_blank" rel="external nofollow noopener" class="url external" aria-label="' . sprintf( __( '%s' website', 'luxeritas' ), $comment_author . $suffix ) . '">' . $comment_author . '' . $suffix; } } else { $author_link = $comment_author . $suffix; } ?>
user_id ) ) ? $comment->user_id : $comment->comment_author_email; echo str_replace( array( 'http:', 'https:' ), '', str_replace( "'", '"', get_avatar( $avatar_id, 32, 'mm', $comment_author ) ) ); // コメント位置までまでスクロールしたくない場合は、 // get_comment_link($comment->comment_ID) やめて get_permalink($comment->comment_post_ID) にする ?>
0 && mb_strlen( $excerpt ) >= $length ? ' ...' : ''; return $excerpt; } public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['number'] = absint( $new_instance['number'] ); return $instance; } public function form( $instance ) { $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : __( 'The latest comments to all posts', 'luxeritas' ); $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; ?>

'thk_recent_posts', 'description' => __( 'Recent posts', 'luxeritas' ) ); parent::__construct( 'thk_recent_posts', '#5 ' . __( 'Recent posts', 'luxeritas' ) . ' (' . __( 'by Luxeritas', 'luxeritas' ) . ')', $widget_ops ); } public static function term_style() { // 横長サムネイル使用時の figure (.term) の style。AMP の時は thk_widget_concat で呼び出す return <<< TERM_STYLE float: none; overflow: hidden; margin: 0 0 16px; max-width: 388px; max-height: 218px; TERM_STYLE; } public static function img_style() { // 横長サムネイル使用時の img の style。AMP の時は thk_widget_concat で呼び出す return <<< IMG_STYLE margin: 0; padding: 0; border: 0; min-width: 100%; max-width: none; max-height: none; IMG_STYLE; } public function widget( $args, $instance ) { $title = !empty( $instance['title'] ) ? $instance['title'] : ''; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $cat = !empty( $instance['cat'] ) ? absint( $instance['cat'] ) : 0; $sort = !empty( $instance['sort'] ) && absint( $instance['sort'] ) === 1 ? 'modified' : 'date'; $number = !empty( $instance['number'] ) ? absint( $instance['number'] ) : 5; if( empty( $number ) ) $number = 5; $thumb_type = isset( $instance['thumb_type'] ) ? $instance['thumb_type'] : 'suqare'; $cat_tag = isset( $instance['cat_tag'] ) ? $instance['cat_tag'] : 'cat'; $date = isset( $instance['date'] ) ? $instance['date'] : 0; $excerpt = isset( $instance['excerpt'] ) ? $instance['excerpt'] : 0; $thumbnail = isset( $instance['thumbnail'] ) ? $instance['thumbnail'] : 0; echo $args['before_widget']; if( !empty( $title ) ) echo $args['before_title'], $title, $args['after_title']; if( $thumb_type === 'wide' ) { global $luxe; if( !isset( $luxe['amp'] ) ) { $term_style = '#' . $args['widget_id'] . ' .term {' . thk_recent_posts::term_style() . '}'; $img_style = '#' . $args['widget_id'] . ' .term img {' . thk_recent_posts::img_style() . '}'; ?>
$cat, 'orderby' => $sort, 'posts_per_page' => $number ); $st_query = new WP_Query( $arr ); if( $st_query->have_posts() === true ) { global $luxe, $post; $wp_upload_dir = wp_upload_dir(); while( $st_query->have_posts() === true ) { $st_query->the_post(); ?>
ID, $thumb ) ); $src = get_the_post_thumbnail( $post->ID, $thumb ); } else { if( isset( $luxe['amp'] ) ) { $aria_label = 'aria-hidden="true"'; } else { $aria_label = 'aria-label="No Image"'; } //echo wp_get_attachment_image( $attachment_id ); //$src = preg_replace( '/srcset=.+?sizes/', 'sizes', wp_get_attachment_image( $attachment_id ) ); $src = wp_get_attachment_image( $attachment_id, $thumb ); } $src = preg_replace( array("/( data-srcset| srcset| sizes)=[\"']{1}((?:\\\.|[^\"\\\])*)[\"']{1}/i"), '', $src ); ?>
>
>No Image
>

%2$s', get_the_date( 'c' ), get_the_date() ); } else { printf( '', get_the_modified_date( 'c' ), get_the_modified_date() ); } } if( $cat_tag !== 'none' ) { $cat_array = get_the_category(); $tag_array = get_the_tags(); if( $date === 0 && ( isset( $cat_array[0]->cat_name ) || isset( $tag_array[0]->name ) ) ) { ?> : cat_name ) ) { ?>cat_name; ?>name ) ) { ?>name; ?>name ) ) { ?>name; ?>cat_name ) ) { ?>cat_name; ?>

__( 'All Categories', 'luxeritas' ), 'id' => $this->get_field_id( 'cat' ), 'name' => $this->get_field_name( 'cat' ), 'selected' => $cat ) ) ?>

/>
/>
/>

/>

/>

/>

'thk_follow_button', 'description' => __( 'SNS Follow Button', 'luxeritas' ) ); parent::__construct( 'thk_follow_button', '#7 ' . __( 'SNS Follow Button', 'luxeritas' ) . ' (' . __( 'by Luxeritas', 'luxeritas' ) . ')', $widget_ops ); } public function widget( $args, $instance ) { global $luxe, $awesome; $title = ( !empty( $instance['title'] ) ) ? $instance['title'] : ''; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); echo $args['before_widget']; if( !empty( $title ) ) echo $args['before_title'], $title, $args['after_title']; if( isset( $instance['twitter'] ) || isset( $instance['facebook'] ) || isset( $instance['instagram'] ) || isset( $instance['pinit'] ) || isset( $instance['hatena'] ) || isset( $instance['youtube'] ) || isset( $instance['line'] ) || isset( $instance['rss'] ) || isset( $instance['feedly'] ) ) { $publisher = 'Person'; if( $luxe['site_name_type'] === 'Organization' ) { $publisher = 'Organization'; } $author = ''; if( isset( $instance['twitter_id'] ) ) { $author = $instance['twitter_id']; } elseif( $luxe['site_name_type'] === 'Organization' ) { $author = get_bloginfo( 'name' ); } else { $auth = get_users(); $author = get_the_author_meta( 'user_nicename', $auth[0]->ID ); } ?>
array( 'Twitter', $twitter_id, 'Twitter ID ( http://twitter.com/XXXXX )' ), 'facebook' => array( 'Facebook', $facebook_id, 'Facebook ID ( http://www.facebook.com/XXXXX )' ), 'instagram' => array( 'Instagram', $instagram_id, 'Instagram ID ( http://www.instagram.com/XXXXX )' ), 'pinit' => array( 'Pinterest', $pinit_id, 'Pinterest ID ( http://www.pinterest.com/XXXXX )' ), 'hatena' => array( __( 'Hatena Bookmark', 'luxeritas' ), $hatena_id, 'Hatena ID ( http://b.hatena.ne.jp/XXXXX )' ), 'youtube' => array( 'YouTube', array( $youtube_c_id, $youtube_id ), array( 'YouTube ID ( http://www.youtube.com/channel/XXXXX )', 'YouTube old ID ( http://www.youtube.com/user/XXXXX )' ) ), 'line' => array( 'LINE', $line_id, 'LINE ID ( http://line.naver.jp/ti/p/XXXXX )' ), ); if( empty( $instance ) ) { $instance['rss'] = 1; $instance['feedly'] = 1; } ?>


/>
/>

$val ) { ?>

/>

:

:

:

/>

/>

'thk_rss_feedly', 'description' => __( 'RSS / Feedly Button', 'luxeritas' ) ); parent::__construct( 'thk_rss_feedly', '#8 ' . __( 'RSS / Feedly Button', 'luxeritas' ) . ' (' . __( 'by Luxeritas', 'luxeritas' ) . ')', $widget_ops ); } public function widget( $args, $instance ) { global $awesome; $title = ( !empty( $instance['title'] ) ) ? $instance['title'] : ''; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); echo $args['before_widget']; if( !empty( $title ) ) echo $args['before_title'], $title, $args['after_title']; ?>

'thk_adsense_widget', 'description' => __( 'It's mainly for adsense, but you can write whatever you like text, HTML, shortcode etc.', 'luxeritas' ) . __( 'This widget can be switched between "show / hide" on the specified page.', 'luxeritas' ) ); parent::__construct( 'thk_adsense_widget', '#1 ' . __( 'Advertising / Adsense', 'luxeritas' ) . ' (' . __( 'by Luxeritas', 'luxeritas' ) . ')', $widget_ops ); global $_is; if( $_is['admin'] === true ) { $this->_pages = array( 'preview' => __( 'Preview page', 'luxeritas' ), 'customize' => __( 'Customize preview page', 'luxeritas' ), 'is404' => __( '404 Not Found page', 'luxeritas' ), 'search' => __( 'Search result page', 'luxeritas' ), 'archive' => __( 'Archive', 'luxeritas' ), 'category' => __( 'Category', 'luxeritas' ), 'page' => __( 'Static page', 'luxeritas' ), 'single' => __( 'Post page', 'luxeritas' ), 'top' => __( 'Top page', 'luxeritas' ), 'specified' => __( 'Specified page', 'luxeritas' ) . ' ( ' . __( 'Specify post IDs separated by commas or line feeds', 'luxeritas' ) . ' )' ); $this->_adsense = array( 'none' => __( 'Not specified', 'luxeritas' ), 'ad-250-250' => '250x250px ( Square )', 'ad-300-250' => '300x250px ( Rectangle )', 'ad-336-280' => '336x280px ( Rectangle big )', 'ad-120-600' => '120x600px ( Skyscraper )', 'ad-160-600' => '160x600px ( Wide skyscraper )', 'ad-300-600' => '300x600px ( Large skyscraper )', 'ad-468-60' => '468x60px ( Banner )', 'ad-728-90' => '728x90px ( Big banner )', 'ad-970-90' => '970x90px ( Large big banner )', 'ad-970-250' => '970x250px ( Billboard )', 'ad-320-100' => '320x100px ( Mobile banner )', 'ad-336-280-col-2' => '336x280px ( Rectangle big ' . __( 'Dual Ad horizon', 'luxeritas' ) . ' )', 'ad-336-280-row-2' => '336x280px ( Rectangle big ' . __( 'Dual Ad vertical', 'luxeritas' ) . ' )', 'ad-300-250-col-2' => '300x250px ( Rectangle ' . __( 'Dual Ad horizon', 'luxeritas' ) . ' )', 'ad-300-250-row-2' => '300x250px ( Rectangle ' . __( 'Dual Ad vertical', 'luxeritas' ) . ' )', ); $this->_label = array( 'none' => __( 'None', 'luxeritas' ), 'sponsored-links' => __( 'Sponsored Links', 'luxeritas' ), 'advertisement' => __( 'Advertisement', 'luxeritas' ), ); } } public function widget( $args, $instance ) { global $_is; if( ( isset( $instance['preview'] ) && $_is['preview'] === true ) || ( isset( $instance['customize'] ) && $_is['customize_preview'] === true ) || ( isset( $instance['is404'] ) && $_is['404'] === true ) || ( isset( $instance['search'] ) && $_is['search'] === true ) || ( isset( $instance['archive'] ) && $_is['archive'] === true && $_is['category'] === false ) || ( isset( $instance['category'] ) && $_is['category'] === true ) || ( isset( $instance['page'] ) && $_is['page'] === true && $_is['front_page'] === false ) || ( isset( $instance['single'] ) && $_is['single'] === true ) || ( isset( $instance['top'] ) && ( $_is['home'] === true || $_is['front_page'] === true ) ) ) { return; } if( isset( $instance['specified'] ) && !empty( $instance['ids'] ) ) { $specifieds = array(); $arr = explode( ',', $instance['ids'] ); foreach( (array)$arr as $value ) { $specifieds = array_merge( $specifieds, explode( "\n", $value ) ); } foreach( (array)$specifieds as $val ) { if( (int)$val === get_the_ID() ) { return; } } } $title = ( !empty( $instance['title'] ) ) ? $instance['title'] : ''; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); if( !empty( $instance['text'] ) ) { $instance['text'] = shortcode_unautop( $instance['text'] ); $instance['text'] = do_shortcode( $instance['text'] ); } $headline = ''; $about = ''; $label = ''; $args['before_widget'] = str_replace( 'thk_adsense_', 'thk_ps_', $args['before_widget'] ); if( isset( $instance['center'] ) ) { $args['before_widget'] = str_replace( 'class="widget ', 'class="widget al-c ', $args['before_widget'] ); } if( isset( $instance['wpadblock'] ) ) { $args['before_widget'] = str_replace( ''; } if( !empty( $title ) ) echo $args['before_title'], $title, $args['after_title']; $wrap = '
'; if( isset( $instance['center'] ) ) { $wrap = '
'; } if( isset( $instance['label'] ) && $instance['label'] !== 'none' ) { $center = isset( $instance['label-c'] ) ? ' al-c' : ''; if( $instance['label'] === 'advertisement' ) { $label = '' . __( 'Advertisement', 'luxeritas' ) . '

'; } else { $label = '' . __( 'Sponsored Links', 'luxeritas' ) . '

'; } } if( isset( $instance['text'] ) && stripos( $instance['text'], 'data-full-width-responsive' ) !== false ) { if( isset( $instance['fullwidth'] ) && (int)$instance['fullwidth'] === 0 ) { $instance['text'] = str_replace( "'", '"', $instance['text'] ); $instance['text'] = str_replace( 'data-full-width-responsive="true"', 'data-full-width-responsive="false"', $instance['text'] ); } } if( isset( $instance['adsense'] ) ) { if( $instance['adsense'] === 'ad-250-250' ) { $instance['text'] = preg_replace( '/data-ad-format=[\"|\'][a-z]+?[\"|\']/', 'data-ad-format="rectangle"', $instance['text'] ); echo str_replace( 'ps-wrap', 'ps-wrap ps-250-250', $wrap ), $label; ?> class="ps-widget rectangle ps-250-250">
class="ps-widget rectangle ps-300-250">
class="ps-widget rectangle ps-336-280"> class="ps-widget ps-120-600"> class="ps-widget ps-160-600"> class="ps-widget ps-300-600"> class="ps-widget ps-468-60"> class="ps-widget ps-728-90"> class="ps-widget ps-970-90"> class="ps-widget ps-970-250"> class="ps-widget ps-320-100">'; $instance['text'] = preg_replace( '/data-ad-format=[\"|\'][a-z]+?[\"|\']/', 'data-ad-format="rectangle"', $instance['text'] ); echo str_replace( 'ps-wrap', 'ps-wrap ps-col', $wrap ), $label; ?>
'; } elseif( $instance['adsense'] === 'ad-336-280-row-2' ) { $instance['text'] = preg_replace( '/data-ad-format=[\"|\'][a-z]+?[\"|\']/', 'data-ad-format="rectangle"', $instance['text'] ); if( !empty( $about ) ) echo ''; echo str_replace( 'ps-wrap', 'ps-wrap ps-336-280', $wrap ), $label; ?>

'; } elseif( $instance['adsense'] === 'ad-300-250-col-2' ) { if( !empty( $about ) ) echo ''; $instance['text'] = preg_replace( '/data-ad-format=[\"|\'][a-z]+?[\"|\']/', 'data-ad-format="rectangle"', $instance['text'] ); echo str_replace( 'ps-wrap', 'ps-wrap ps-col', $wrap ), $label; ?>
'; } elseif( $instance['adsense'] === 'ad-300-250-row-2' ) { if( !empty( $about ) ) echo ''; $instance['text'] = preg_replace( '/data-ad-format=[\"|\'][a-z]+?[\"|\']/', 'data-ad-format="rectangle"', $instance['text'] ); echo str_replace( 'ps-wrap', 'ps-wrap ps-300-250', $wrap ), $label; ?>

'; } else { echo $wrap, $label; ?> class="ps-widget">'; if( isset( $instance['aside'] ) ) { echo ''; } echo $args['after_widget']; } public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = isset( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : null; $instance['title'] = sanitize_text_field( $new_instance['title'] ); if( current_user_can( 'unfiltered_html' ) ) { $instance['text'] = isset( $new_instance['text'] ) ? $new_instance['text'] : null; } else { $instance['text'] = isset( $new_instance['text'] ) ? esc_attr( $new_instance['text'] ) : null; } $instance['adsense'] = isset( $new_instance['adsense'] ) ? $new_instance['adsense'] : null; $instance['center'] = isset( $new_instance['center'] ) ? $new_instance['center'] : null; $instance['label'] = isset( $new_instance['label'] ) ? $new_instance['label'] : null; $instance['label-c'] = isset( $new_instance['label-c'] ) ? $new_instance['label-c'] : null; $instance['wpadblock'] = isset( $new_instance['wpadblock'] ) ? $new_instance['wpadblock'] : null; $instance['aside'] = isset( $new_instance['aside'] ) ? $new_instance['aside'] : null; $instance['fullwidth'] = isset( $new_instance['fullwidth'] ) ? $new_instance['fullwidth'] : 0; if ( current_user_can( 'unfiltered_html' ) ) { $instance['ids'] = isset( $new_instance['ids'] ) ? $new_instance['ids'] : null; } else { $instance['ids'] = isset( $new_instance['ids'] ) ? esc_attr( $new_instance['ids'] ) : null; } foreach( $this->_pages as $key => $val ) { $instance[$key] = isset( $new_instance[$key] ) ? $new_instance[$key] : null; } return $instance; } public function form( $instance ) { $title = isset( $instance['title'] ) ? sanitize_text_field( $instance['title'] ) : ''; if ( current_user_can( 'unfiltered_html' ) ) { $text = isset( $instance['text'] ) ? $instance['text'] : ''; } else { $text = isset( $instance['text'] ) ? esc_attr( $instance['text'] ) : ''; } $adsense= isset( $instance['adsense'] ) ? $instance['adsense'] : 'none'; $label = isset( $instance['label'] ) ? $instance['label'] : 'none'; $ids = isset( $instance['ids'] ) ? sanitize_text_field( $instance['ids'] ) : ''; $fullwidth = isset( $instance['fullwidth'] ) ? (int)$instance['fullwidth'] : 0; if( empty( $instance ) ) { $instance['preview'] = 1; $instance['customize'] = 1; $instance['is404'] = 1; $instance['specified'] = 1; } ?>


:

_adsense as $key => $val ) { ?>

/>

'; } } ?>

/>


data-full-width-responsive :

/>

/>


:

_label as $key => $val ) { ?>

/>

/>


:

/>

/>


_pages as $key => $val ) { ?>

/>

'thk_swiper_widget', 'description' => __( 'High feature carousel slider. This widget is not displayed in AMP.', 'luxeritas' ), ); parent::__construct( 'thk_swiper_widget', '#4 ' . __( 'Carousel Slider', 'luxeritas') . ' (' . __( 'by Luxeritas', 'luxeritas' ) . ')', $widget_ops ); global $_is; if( $_is['admin'] === true ) { $this->_pages = array( 'top' => __( 'Top page', 'luxeritas' ), 'category' => __( 'Category', 'luxeritas' ), 'archive' => __( 'Archive', 'luxeritas' ), 'single' => __( 'Post page', 'luxeritas' ), 'page' => __( 'Static page', 'luxeritas' ), ); $this->_types = array( 'cat_list' => __( 'Latest list of categories to belong', 'luxeritas' ), 'tag_list' => __( 'Latest list of tags to belong', 'luxeritas' ), 'all_list' => __( 'Latest list of all posts', 'luxeritas' ), 'page_list' => __( 'Latest list of static pages', 'luxeritas' ), 'specified' => __( 'Specified page', 'luxeritas' ) . ' ( ' . __( 'Specify post IDs separated by commas or line feeds', 'luxeritas' ) . ' )' ); $sizes = array(); $image_sizes = get_intermediate_image_sizes(); foreach( $image_sizes as $size ) { if( in_array( $size, array( 'thumbnail', 'medium', 'large' ) ) ) { $sizes[$size] = get_option( $size . '_size_w' ); } } $this->_thumb = array( 'thumbnail' => 'thumbnail ( ' . $sizes['thumbnail'] . 'px )', 'medium' => 'medium ( ' . $sizes['medium'] . 'px )', 'thumb320' => '320x180px ( 320x180px )', 'large' => 'large ( ' . $sizes['large'] . 'px )', 'full' => 'full ( Original resolution )', ); $this->_nav = array( 'none' => __( 'None', 'luxeritas' ), 'bullets' => __( 'Bullets', 'luxeritas' ), 'fraction' => __( 'Fraction', 'luxeritas' ), 'progress' => __( 'Progress bar', 'luxeritas' ), ); $this->_nxt_prv = array( 'none' => __( 'None', 'luxeritas' ), 'always' => __( 'Always display', 'luxeritas' ), 'hover' => __( 'Displayed only when mouse hover', 'luxeritas' ), ); $this->_efect = array( 'none' => __( 'None', 'luxeritas' ), 'coverflow' => __( '3D animation', 'luxeritas' ) . ' ( 3D Cover Flow )', 'flip' => __( 'Rotate on mouse over', 'luxeritas' ), 'highlight' => __( 'Display active slide a little larger', 'luxeritas' ), ); $this->_center = array( 'post' => __( 'Display the displayed post in the center', 'luxeritas' ), 'new' => __( 'Display the latest post in the center', 'luxeritas' ), 'order' => __( 'Display in order of posting date / time', 'luxeritas' ), ); } $this->_defaults = array( 'title' => '', 'item_types' => 'cat_list', 'ids' => '', 'thumbnail' => 'medium', 'item_max' => 10, 'show_max' => 5, 'height' => 'auto', 'height_px' => 300, 'width' => 'auto', 'slide_bg' => '#ffffff', 'navigation' => 'bullets', 'next_prev' => 'hover', 'nav_color' => '#007aff', 'efect' => 'none', 'center_view' => 'post', 'darkness' => '', 'no_lazyload' => '', 'autoplay' => 0, 'bg_color' => '', ); } public function widget( $args, $instance ) { global $luxe, $_is; if( isset( $luxe['amp'] ) ) return; foreach( $this->_defaults as $key => $val ) { if( !isset( $instance[$key] ) ) { $instance[$key] = $val; } } if( ( $_is['home'] === true && $_is['front_page'] === false ) || ( $_is['home'] === false && $_is['front_page'] === false && $_is['archive'] === false && $_is['singular'] === false ) ) { return; } if( ( !isset( $instance['top'] ) && ( $_is['home'] === true || $_is['front_page'] === true ) ) || ( !isset( $instance['category'] ) && $_is['category'] === true ) || ( !isset( $instance['archive'] ) && $_is['archive'] === true && $_is['category'] === false ) || ( !isset( $instance['single'] ) && $_is['single'] === true ) || ( !isset( $instance['page'] ) && $_is['page'] === true && $_is['front_page'] === false ) ) { return; } $title = ( !empty( $instance['title'] ) ) ? $instance['title'] : ''; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); require_once( INC . 'thk-swiper.php' ); $autoplay = (int)$instance['autoplay'] * 1000; thk_swiper( $args, $title, $instance['item_types'], $instance['item_max'], $instance['show_max'], $instance['navigation'], $instance['next_prev'], $instance['nav_color'], $instance['ids'], $instance['thumbnail'], $instance['height'], $instance['height_px'], $instance['width'], $instance['slide_bg'], $instance['titleview'], $instance['efect'], $instance['darkness'], $instance['center_view'], $instance['no_lazyload'], $autoplay ); } public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = isset( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : null; $instance['item_types'] = isset( $new_instance['item_types'] ) ? $new_instance['item_types'] : null; $instance['ids'] = isset( $new_instance['ids'] ) ? wp_kses_post( $new_instance['ids'] ) : null; $instance['thumbnail'] = isset( $new_instance['thumbnail'] ) ? $new_instance['thumbnail'] : null; $instance['item_max'] = (int)$new_instance['item_max'] < 1 ? 1 : (int)$new_instance['item_max']; $instance['show_max'] = (int)$new_instance['show_max'] >= (int)$new_instance['item_max'] ? (int)$instance['item_max'] - 1 : (int)$new_instance['show_max']; $instance['show_max'] = (int)$instance['show_max'] < 1 ? 1 : (int)$instance['show_max']; $instance['height'] = isset( $new_instance['height'] ) ? $new_instance['height'] : null; $instance['height_px'] = isset( $new_instance['height_px'] ) ? (int)$new_instance['height_px'] : null; $instance['width'] = isset( $new_instance['width'] ) ? $new_instance['width'] : null; $instance['slide_bg'] = isset( $new_instance['slide_bg'] ) ? $new_instance['slide_bg'] : null; $instance['navigation'] = isset( $new_instance['navigation'] ) ? $new_instance['navigation'] : null; $instance['next_prev'] = isset( $new_instance['next_prev'] ) ? $new_instance['next_prev'] : null; $instance['nav_color'] = isset( $new_instance['nav_color'] ) ? $new_instance['nav_color'] : null; $instance['efect'] = isset( $new_instance['efect'] ) ? $new_instance['efect'] : null; $instance['center_view'] = isset( $new_instance['center_view'] ) ? $new_instance['center_view'] : null; $instance['titleview'] = isset( $new_instance['titleview'] ) ? $new_instance['titleview'] : null; $instance['darkness'] = isset( $new_instance['darkness'] ) ? $new_instance['darkness'] : null; $instance['no_lazyload'] = isset( $new_instance['no_lazyload'] ) ? $new_instance['no_lazyload'] : null; $instance['autoplay'] = isset( $new_instance['autoplay'] ) ? (int)$new_instance['autoplay'] : null; foreach( $this->_pages as $key => $val ) { $instance[$key] = $new_instance[$key]; } return $instance; } public function form( $instance ) { $title = isset( $instance['title'] ) ? sanitize_text_field( $instance['title'] ) : $this->_defaults['title']; $types = isset( $instance['item_types'] ) ? $instance['item_types'] : $this->_defaults['item_types']; $ids = isset( $instance['ids'] ) ? wp_kses_post( $instance['ids'] ) : $this->_defaults['ids']; $thumb = isset( $instance['thumbnail'] ) ? $instance['thumbnail'] : $this->_defaults['thumbnail']; $itemmax = isset( $instance['item_max'] ) ? (int)$instance['item_max'] : $this->_defaults['item_max']; $showmax = isset( $instance['show_max'] ) ? (int)$instance['show_max'] : $this->_defaults['show_max']; $height = isset( $instance['height'] ) ? $instance['height'] : $this->_defaults['height']; $heightpx= isset( $instance['height_px'] ) ? (int)$instance['height_px'] : $this->_defaults['height_px']; $width = isset( $instance['width'] ) ? $instance['width'] : $this->_defaults['width']; $nav = isset( $instance['navigation'] ) ? $instance['navigation'] : $this->_defaults['navigation']; $net_prv = isset( $instance['next_prev'] ) ? $instance['next_prev'] : $this->_defaults['next_prev']; $efect = isset( $instance['efect'] ) ? $instance['efect'] : $this->_defaults['efect']; $center = isset( $instance['center_view'] ) ? $instance['center_view'] : $this->_defaults['center_view']; $center = isset( $instance['center_view'] ) ? $instance['center_view'] : $this->_defaults['center_view']; $autoplay= isset( $instance['autoplay'] ) ? (int)$instance['autoplay'] : $this->_defaults['autoplay']; if( empty( $instance ) ) { $instance['top'] = 1; $instance['category'] = 1; $instance['archive'] = 1; $instance['single'] = 1; $instance['page'] = 1; $instance['slide_bg'] = $this->_defaults['slide_bg']; $instance['nav_color'] = $this->_defaults['nav_color']; $instance['titleview'] = 1; $instance['darkness'] = 0; $instance['no_lazyload'] = 0; } ?>

:

_pages as $key => $val ) { ?>

/>


:

_types as $key => $val ) { ?>

/>


:

_thumb as $key => $val ) { ?>

/>

/>

/>

/>

/>

/>


:

_nav as $key => $val ) { ?>

/>

Next / Prev:

_nxt_prv as $key => $val ) { ?>

/>

:


_efect as $key => $val ) { ?>

/>

/>


_center as $key => $val ) { ?>

/>

/>

/>

'thk_toc_widget', 'description' => __( 'Insert table of contents.', 'luxeritas' ), ); parent::__construct( 'thk_toc_widget', '#3 ' . __( 'Table of Contents', 'luxeritas') . ' (' . __( 'by Luxeritas', 'luxeritas' ) . ')', $widget_ops ); } public function widget( $args, $instance ) { global $luxe, $_is; if( ( $_is['single'] === true && isset( $luxe['toc_single_enable'] ) ) || ( $_is['page'] === true && isset( $luxe['toc_page_enable'] ) ) ) { global $wp_query; $title = ( !empty( $instance['title'] ) ) ? $instance['title'] : ''; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $post = get_post( $wp_query->post->ID ); $contents = $post->post_content; $toc_array = thk_create_toc( $contents, false ); if( !isset( $instance['no_contents'] ) || ( isset( $instance['no_contents'] ) && !empty( $toc_array[1] ) ) ) { echo $args['before_widget']; if( !empty( $title ) ) echo $args['before_title'], $title, $args['after_title']; } if( !empty( $toc_array[1] ) ) { echo '
', $toc_array[1], '
'; } if( !isset( $instance['no_contents'] ) || ( isset( $instance['no_contents'] ) && !empty( $toc_array[1] ) ) ) { echo $args['after_widget']; } } } public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['no_contents'] = isset( $new_instance['no_contents'] ) ? $new_instance['no_contents'] : null; return $instance; } public function form( $instance ) { $title = isset( $instance['title'] ) ? sanitize_text_field( $instance['title'] ) : __( 'Table of Contents', 'luxeritas' ); if( empty( $instance ) ) { $instance['no_contents'] = 1; } ?>

/>

'thk_reusable_blocks_widget', 'description' => __( 'Display selected reusable block.', 'luxeritas' ), ); parent::__construct( 'thk_reusable_blocks_widget', '#2 ' . __( 'Reusable Blocks', 'luxeritas' ) . ' (' . __( 'by Luxeritas', 'luxeritas' ) . ')', $widget_ops ); } public function widget( $args, $instance ) { global $luxe; if( !empty( $instance['title'] ) ) { $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); $title = $args['before_title'] . $title . $args['after_title']; } else { $title = ''; } $objects = !empty( $instance['block_id'] ) ? get_post( $instance['block_id'], 'ARRAY_A', 'display' ) : ''; // 出力 if( empty( $objects['post_content'] ) ) { $block_contents = __( 'This content cannot be displayed in widgets.', 'luxeritas' ); } else { $block_contents = apply_filters( 'thk_content', $objects['post_content'] ); } echo $args['before_widget'], $title, $block_contents, $args['after_widget']; } public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['block_id'] = absint( $new_instance['block_id'] ); return $instance; } public function form( $instance ) { $title = isset( $instance['title'] ) ? sanitize_text_field( $instance['title'] ) : ''; $block_id = isset( $instance['block_id'] ) ? absint( $instance['block_id'] ) : ''; ?>

!empty( $block_id ) ? (int)$block_id : '', 'select_name' => $this->get_field_name( 'block_id' ), 'echo' => false, 'class' => 'widefat', 'post_type' => 'wp_block', 'show_option_none' => __( 'None', 'luxeritas' ), 'option_none_value' => '', )); } if( !empty( $dropdown_posts ) ) { echo $dropdown_posts; } else { echo ''; } ?>

'thk_pwa_install', 'description' => __( 'PWA install button', 'luxeritas' ) ); parent::__construct( 'thk_pwa_install', '#10 ' . __( 'PWA install button', 'luxeritas' ) . ' (' . __( 'by Luxeritas', 'luxeritas' ) . ')', $widget_ops ); } public function widget( $args, $instance ) { global $_is, $luxe, $awesome; $mobile = true; if( $_is['mobile'] === false && isset( $instance['mobile'] ) && (int)$instance['mobile'] === 1 ) { $mobile = false; } if( isset( $luxe['pwa_enable'] ) && isset( $luxe['pwa_offline_enable'] ) && isset( $luxe['pwa_install_widget'] ) && $mobile === true ) { $title = !empty( $instance['title'] ) ? $instance['title'] : ''; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $name = !empty( $instance['name'] ) ? $instance['name'] : ''; $description = !empty( $instance['description'] ) ? $instance['description'] : ''; $color = !empty( $instance['color'] ) ? $instance['color'] : '#333333'; $bg = !empty( $instance['bg'] ) ? $instance['bg'] : '#fef8ee'; $border = !empty( $instance['border'] ) ? $instance['border'] : '#f0b849'; $box_style = ''; if( $color !== '#333333' || $bg !== '#fef8ee' || $border !== '#f0b849' ) { $box_style .= ' style="'; if( $color !== '#333333' ) $box_style .= 'color:' . $color . ';'; if( $bg !== '#fef8ee' ) $box_style .= 'background:' . $bg . ';'; if( $border !== '#f0b849' ) $box_style .= 'border-color:' . $border . ';'; $box_style = rtrim( $box_style, ';' ); $box_style .= '"'; } echo str_replace( '