wp/wp-content/plugins/portfolio/portfolio.php
changeset 16 a86126ab1dd4
parent 12 d8a8807227e4
child 19 3d72ae0968f4
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     4 Plugin URI: https://bestwebsoft.com/products/wordpress/plugins/portfolio/
     4 Plugin URI: https://bestwebsoft.com/products/wordpress/plugins/portfolio/
     5 Description: Create your personal portfolio WordPress website. Manage and showcase past projects to get more clients.
     5 Description: Create your personal portfolio WordPress website. Manage and showcase past projects to get more clients.
     6 Author: BestWebSoft
     6 Author: BestWebSoft
     7 Text Domain: portfolio
     7 Text Domain: portfolio
     8 Domain Path: /languages
     8 Domain Path: /languages
     9 Version: 2.51
     9 Version: 2.53
    10 Author URI: https://bestwebsoft.com/
    10 Author URI: https://bestwebsoft.com/
    11 License: GPLv2 or later
    11 License: GPLv2 or later
    12 */
    12 */
    13 
    13 
    14 /*
    14 /*
    15 	@ Copyright 2019  BestWebSoft  ( https://support.bestwebsoft.com )
    15 	@ Copyright 2020  BestWebSoft  ( https://support.bestwebsoft.com )
    16 
    16 
    17 	This program is free software; you can redistribute it and/or modify
    17 	This program is free software; you can redistribute it and/or modify
    18 	it under the terms of the GNU General Public License, version 2, as
    18 	it under the terms of the GNU General Public License, version 2, as
    19 	published by the Free Software Foundation.
    19 	published by the Free Software Foundation.
    20 
    20 
    74 				require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    74 				require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    75 			}
    75 			}
    76 			$prtfl_plugin_info = get_plugin_data( __FILE__ );
    76 			$prtfl_plugin_info = get_plugin_data( __FILE__ );
    77 		}
    77 		}
    78 		/* Function check if plugin is compatible with current WP version  */
    78 		/* Function check if plugin is compatible with current WP version  */
    79 		bws_wp_min_version_check( plugin_basename( __FILE__ ), $prtfl_plugin_info, '3.9' );
    79 		bws_wp_min_version_check( plugin_basename( __FILE__ ), $prtfl_plugin_info, '4.5' );
    80 
    80 
    81 		$prtfl_boxes['Portfolio-Info'] = array(
    81 		$prtfl_boxes['Portfolio-Info'] = array(
    82 			array(
    82 			array(
    83 				'name'	=> '_prtfl_short_descr',
    83 				'name'	=> '_prtfl_short_descr',
    84 				'title'	=> __( 'Short description', 'portfolio' ),
    84 				'title'	=> __( 'Short description', 'portfolio' ),
    89 				'title'	=> __( 'Date of completion', 'portfolio' ),
    89 				'title'	=> __( 'Date of completion', 'portfolio' ),
    90 				'type'	=> 'text'
    90 				'type'	=> 'text'
    91 			),
    91 			),
    92 			array(
    92 			array(
    93 				'name'	=> '_prtfl_link',
    93 				'name'	=> '_prtfl_link',
    94 				'title'	=> __( 'Link', 'portfolio' ),
    94 				'title'	=> __( 'Project, URL', 'portfolio' ),
    95 				'type'	=> 'url'
    95 				'type'	=> 'url'
    96 			),
    96 			),
    97 			array(
    97 			array(
    98 				'name'	=> '_prtfl_svn',
    98 				'name'	=> '_prtfl_svn',
    99 				'title'	=> __( 'SVN URL', 'portfolio' ),
    99 				'title'	=> __( 'Source Files, URL', 'portfolio' ),
   100 				'type'	=> 'url'
   100 				'type'	=> 'url'
   101 			)
   101 			)
   102 		);
   102 		);
   103 		/* Call register settings function */
   103 		/* Call register settings function */
   104 		register_prtfl_settings();
   104 		register_prtfl_settings();
   118 	}
   118 	}
   119 }
   119 }
   120 
   120 
   121 if ( ! function_exists( 'prtfl_admin_init' ) ) {
   121 if ( ! function_exists( 'prtfl_admin_init' ) ) {
   122 	function prtfl_admin_init() {
   122 	function prtfl_admin_init() {
   123 		global $bws_plugin_info, $prtfl_plugin_info, $bws_shortcode_list, $wpdb;
   123 		global $bws_plugin_info, $prtfl_plugin_info, $bws_shortcode_list, $wpdb, $pagenow, $prtfl_options;
   124 
   124 
   125 		if ( empty( $bws_plugin_info ) ) {
   125 		if ( empty( $bws_plugin_info ) ) {
   126 			$bws_plugin_info = array( 'id' => '74', 'version' => $prtfl_plugin_info["Version"] );
   126 			$bws_plugin_info = array( 'id' => '74', 'version' => $prtfl_plugin_info["Version"] );
   127 		}
   127 		}
   128 
   128 
   129 		/* add Portfolio to global $bws_shortcode_list  */
   129 		/* add Portfolio to global $bws_shortcode_list  */
   130 		$bws_shortcode_list['prtfl'] = array( 'name' => 'Portfolio', 'js_function' => 'prtfl_shortcode_init' );
   130 		$bws_shortcode_list['prtfl'] = array( 'name' => 'Portfolio', 'js_function' => 'prtfl_shortcode_init' );
   131 
   131 
       
   132 		if ( 'plugins.php' == $pagenow ) {
       
   133 			/* Install the option defaults */
       
   134 			if ( function_exists( 'bws_plugin_banner_go_pro' ) ) {
       
   135 				register_prtfl_settings();
       
   136 				bws_plugin_banner_go_pro( $prtfl_options, $prtfl_plugin_info, 'prtfl', 'portfolio', '56e6c97d1bca3199fb16cb817793a8f6', '74', 'portfolio' );
       
   137 			}
       
   138 		}
   132 	}
   139 	}
   133 }
   140 }
   134 
   141 
   135 /* Function for activation plugin */
   142 /* Function for activation plugin */
   136 if ( ! function_exists( 'prtfl_plugin_activate' ) ) {
   143 if ( ! function_exists( 'prtfl_plugin_activate' ) ) {
   223 			'date_additional_field' 					=>	1,
   230 			'date_additional_field' 					=>	1,
   224 			'link_additional_field' 					=>	1,
   231 			'link_additional_field' 					=>	1,
   225 			'shrdescription_additional_field' 			=>	1,
   232 			'shrdescription_additional_field' 			=>	1,
   226 			'description_additional_field' 				=>	1,
   233 			'description_additional_field' 				=>	1,
   227 			'svn_additional_field' 						=>	1,
   234 			'svn_additional_field' 						=>	1,
       
   235 			'svn_additional_field_for_non_logged'		=>	1,
   228 			'executor_additional_field' 				=>	1,
   236 			'executor_additional_field' 				=>	1,
   229 			'technologies_additional_field'				=>	1,
   237 			'technologies_additional_field'				=>	1,
   230 			'link_additional_field_for_non_registered'	=>	1,
   238 			'link_additional_field_for_non_registered'	=>	1,
   231 			'date_text_field'							=>	__( 'Date of completion:', 'portfolio' ),
   239 			'date_text_field'							=>	__( 'Date of completion:', 'portfolio' ),
   232 			'link_text_field'							=>	__( 'Link:', 'portfolio' ),
   240 			'link_text_field'							=>	__( 'Project, URL:', 'portfolio' ),
   233 			'shrdescription_text_field'					=>	__( 'Short description:', 'portfolio' ),
   241 			'shrdescription_text_field'					=>	__( 'Short description:', 'portfolio' ),
   234 			'description_text_field'					=>	__( 'Description:', 'portfolio' ),
   242 			'description_text_field'					=>	__( 'Description:', 'portfolio' ),
   235 			'svn_text_field'							=>	__( 'SVN:', 'portfolio' ),
   243 			'svn_text_field'							=>	__( 'Source Files, URL:', 'portfolio' ),
   236 			'executor_text_field'						=>	__( 'Executor:', 'portfolio' ),
   244 			'executor_text_field'						=>	__( 'Executor:', 'portfolio' ),
   237 			'screenshot_text_field'						=>	__( 'More screenshots:', 'portfolio' ),
   245 			'screenshot_text_field'						=>	__( 'More screenshots:', 'portfolio' ),
   238 			'technologies_text_field'					=>	__( 'Technologies:', 'portfolio' ),
   246 			'technologies_text_field'					=>	__( 'Technologies:', 'portfolio' ),
   239 			/* misc */
   247 			/* misc */
   240 			'slug' 										=>	'portfolio',
   248 			'slug' 										=>	'portfolio',
   396  * Plugin settings page
   404  * Plugin settings page
   397  * @return void
   405  * @return void
   398  */
   406  */
   399 if ( ! function_exists( 'prtfl_settings_page' ) ) {
   407 if ( ! function_exists( 'prtfl_settings_page' ) ) {
   400 	function prtfl_settings_page() {
   408 	function prtfl_settings_page() {
       
   409 		if ( ! class_exists( 'Bws_Settings_Tabs' ) )
       
   410     		require_once( dirname( __FILE__ ) . '/bws_menu/class-bws-settings.php' );
   401 		require_once( dirname( __FILE__ ) . '/inc/class-prtfl-settings.php' );
   411 		require_once( dirname( __FILE__ ) . '/inc/class-prtfl-settings.php' );
   402 		$page = new Prtfl_Settings_Tabs( plugin_basename( __FILE__ ) ); ?>
   412 		$page = new Prtfl_Settings_Tabs( plugin_basename( __FILE__ ) ); ?>
   403 		<div class="wrap">
   413 		<div class="wrap">
   404 			<h1><?php _e( 'Portfolio Settings', 'portfolio' ); ?></h1>
   414 			<h1><?php _e( 'Portfolio Settings', 'portfolio' ); ?></h1>
   405 			<?php $page->display_content(); ?>
   415 			<?php $page->display_content(); ?>
   901 					}
   911 					}
   902 				} else {
   912 				} else {
   903 					$custom_content .= '<p><span class="lable">' . $prtfl_options['link_text_field'] . '</span> ' . $post_meta['_prtfl_link'] . '</p>';
   913 					$custom_content .= '<p><span class="lable">' . $prtfl_options['link_text_field'] . '</span> ' . $post_meta['_prtfl_link'] . '</p>';
   904 				}
   914 				}
   905 			}
   915 			}
   906 			if ( 0 != $user_id ) {
   916 			if ( 0 != $user_id || 0 == $prtfl_options['svn_additional_field_for_non_logged'] ) {
   907 				if ( 1 == $prtfl_options['svn_additional_field'] && ! empty( $post_meta['_prtfl_svn'] ) ) {
   917 				if ( 1 == $prtfl_options['svn_additional_field'] && ! empty( $post_meta['_prtfl_svn'] ) ) {
   908 					$custom_content .= '<p><span class="lable">' . $prtfl_options['svn_text_field'] . '</span> ' . $post_meta['_prtfl_svn'] . '</p>';
   918 					$custom_content .= '<p><span class="lable">' . $prtfl_options['svn_text_field'] . '</span> ' . $post_meta['_prtfl_svn'] . '</p>';
   909 				}
   919 				}	
   910 
   920 			}
       
   921 			if ( 0 != $user_id ) {
   911 				if ( 1 == $prtfl_options['executor_additional_field'] ) {
   922 				if ( 1 == $prtfl_options['executor_additional_field'] ) {
   912 					$executors_profile = wp_get_object_terms( $post->ID, 'portfolio_executor_profile' );
   923 					$executors_profile = wp_get_object_terms( $post->ID, 'portfolio_executor_profile' );
   913 					if ( ! empty( $executors_profile ) ) {
   924 					if ( ! empty( $executors_profile ) ) {
   914 						$custom_content .= '<p><span class="lable">' . $prtfl_options['executor_text_field'] . '</span>';
   925 						$custom_content .= '<p><span class="lable">' . $prtfl_options['executor_text_field'] . '</span>';
   915 						$count = 0;
   926 						$count = 0;
  1101 		}
  1112 		}
  1102 		$prtfl_widht = 100 / $custom_portfolio_row_count;
  1113 		$prtfl_widht = 100 / $custom_portfolio_row_count;
  1103 
  1114 
  1104 
  1115 
  1105 		if( 1 < $custom_portfolio_row_count  ) {
  1116 		if( 1 < $custom_portfolio_row_count  ) {
  1106 			$prtfl_read_more = 'style="float:left"';
       
  1107 			$prtfl_img_width = '';
  1117 			$prtfl_img_width = '';
  1108 		}else{
  1118 		}else{
  1109 			$prtfl_read_more = "";
       
  1110 			$prtfl_img_width = 'style="width:165px"';
  1119 			$prtfl_img_width = 'style="width:165px"';
  1111 		}
  1120 		}
  1112 		
  1121 		
  1113 		$content	=	'<div class="prtfl_portfolio_block">';
  1122 		$content	=	'<div class="prtfl_portfolio_block">';
  1114 		if ( empty( $atts['count'] ) ) {
  1123 		if ( empty( $atts['count'] ) ) {
  1176 						if ( 1 == $prtfl_options['shrdescription_additional_field'] && ( ! empty( $short_descr ) ) ) {
  1185 						if ( 1 == $prtfl_options['shrdescription_additional_field'] && ( ! empty( $short_descr ) ) ) {
  1177 							$content .= '<p>' . $short_descr . '</p>';
  1186 							$content .= '<p>' . $short_descr . '</p>';
  1178 						}
  1187 						}
  1179 					$content .= '</div> <!-- .portfolio_short_content -->
  1188 					$content .= '</div> <!-- .portfolio_short_content -->
  1180 				</div> <!-- .entry -->
  1189 				</div> <!-- .entry -->
  1181 				<div class="read_more" ' . $prtfl_read_more . '>
  1190 				<div class="read_more">
  1182 					<a href="' . $permalink . '" rel="bookmark">' . __( 'Read more', 'portfolio' ) . '</a>
  1191 					<a href="' . $permalink . '" rel="bookmark">' . __( 'Read more', 'portfolio' ) . '</a>
  1183 				</div> <!-- .read_more -->
  1192 				</div> <!-- .read_more -->
  1184 				<div class="portfolio_terms">';
  1193 				<div class="portfolio_terms">';
  1185 				if ( 1 == $prtfl_options['technologies_additional_field'] ) {
  1194 				if ( 1 == $prtfl_options['technologies_additional_field'] ) {
  1186 					$terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' );
  1195 					$terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' );
  1283 		if ( wp_script_is( 'prtfl_front_script', 'registered' ) ) {
  1292 		if ( wp_script_is( 'prtfl_front_script', 'registered' ) ) {
  1284 			wp_enqueue_script( 'prtfl_front_script' );
  1293 			wp_enqueue_script( 'prtfl_front_script' );
  1285 			wp_enqueue_script( 'prtfl_fancyboxJs', plugins_url( 'fancybox/jquery.fancybox.min.js', __FILE__ ), array( 'jquery' ) );
  1294 			wp_enqueue_script( 'prtfl_fancyboxJs', plugins_url( 'fancybox/jquery.fancybox.min.js', __FILE__ ), array( 'jquery' ) );
  1286 
  1295 
  1287 			/* Initialization of fancybox script */
  1296 			/* Initialization of fancybox script */
  1288 			if ( ! empty( $image[0] ) ) { ?>
  1297 			if ( ! empty( $image[0] ) ) {
  1289 				<script type="text/javascript">
  1298 				$script = "( function( $ ){
  1290 					( function( $ ){
  1299                     $( document ).ready( function(){
  1291 						$( document ).ready( function(){
  1300                         $( \"a[data-fancybox=portfolio_fancybox]\" ).fancybox({
  1292 							$( "a[data-fancybox=portfolio_fancybox]" ).fancybox({
  1301                             loop    : true,
  1293 								loop    : true,
  1302                             arrows  : false,
  1294 								arrows  : false,
  1303                             infobar : true,
  1295 								infobar : true,
  1304                             speed : 500,
  1296 								speed : 500,
  1305                             toolbar: false,
  1297 								toolbar: false,
  1306                             animationEffect : 'zoom',
  1298 								animationEffect : 'zoom',
  1307                             openEffect : 'elastic',
  1299 								openEffect : 'elastic',
  1308                             closeEffect : 'elastic'
  1300 								closeEffect : 'elastic'
  1309                         } );
  1301 							} );
  1310                     } );
  1302 						} );
  1311                 } )( jQuery );";
  1303 					} )( jQuery );
  1312 				wp_register_script( 'prtfl_fancybox_script', '' );
  1304 				</script>
  1313 				wp_enqueue_script( 'prtfl_fancybox_script' );
  1305 			<?php }
  1314 				wp_add_inline_script( 'prtfl_fancybox_script', sprintf( $script ) );
       
  1315 			}
  1306 		}
  1316 		}
  1307 
  1317 
  1308 	}
  1318 	}
  1309 }
  1319 }
  1310 
  1320 
  1648 	function prtfl_admin_notices() {
  1658 	function prtfl_admin_notices() {
  1649 		global $hook_suffix, $prtfl_plugin_info, $prtfl_options, $prtfl_BWS_demo_data;
  1659 		global $hook_suffix, $prtfl_plugin_info, $prtfl_options, $prtfl_BWS_demo_data;
  1650 
  1660 
  1651 		if ( 'plugins.php' == $hook_suffix || ( isset( $_GET['page'] ) && 'portfolio.php' == $_GET['page'] ) ) {
  1661 		if ( 'plugins.php' == $hook_suffix || ( isset( $_GET['page'] ) && 'portfolio.php' == $_GET['page'] ) ) {
  1652 
  1662 
  1653 			/* Get options from the database */
       
  1654 			if ( ! $prtfl_options ) {
       
  1655 				$prtfl_options = get_option( 'prtfl_options' );
       
  1656 			}
       
  1657 
       
  1658 			if ( ! $prtfl_BWS_demo_data ) {
  1663 			if ( ! $prtfl_BWS_demo_data ) {
  1659 				prtfl_include_demo_data();
  1664 				prtfl_include_demo_data();
  1660 			}
  1665 			}
  1661 			$prtfl_BWS_demo_data->bws_handle_demo_notice( $prtfl_options['display_demo_notice'] );
  1666 
       
  1667 			if ( isset( $_GET['page'] ) && 'portfolio.php' == $_GET['page'] ) {
       
  1668 				$prtfl_BWS_demo_data->bws_handle_demo_notice( $prtfl_options['display_demo_notice'] );
       
  1669 			}
  1662 
  1670 
  1663 			if ( 'plugins.php' == $hook_suffix ) {
  1671 			if ( 'plugins.php' == $hook_suffix ) {
  1664 				if ( isset( $prtfl_options['first_install'] ) && strtotime( '-1 week' ) > $prtfl_options['first_install'] ) {
       
  1665 					bws_plugin_banner( $prtfl_plugin_info, 'prtfl', 'portfolio', '56e6c97d1bca3199fb16cb817793a8f6', '74', '//ps.w.org/portfolio/assets/icon-128x128.png' );
       
  1666 				}
       
  1667 				if ( ! is_network_admin() ) {
  1672 				if ( ! is_network_admin() ) {
  1668 					bws_plugin_banner_to_settings( $prtfl_plugin_info, 'prtfl_options', 'portfolio', 'edit.php?post_type=portfolio&page=portfolio.php', 'Portfolio' );
  1673 					bws_plugin_banner_to_settings( $prtfl_plugin_info, 'prtfl_options', 'portfolio', 'edit.php?post_type=portfolio&page=portfolio.php', 'Portfolio' );
  1669 				}
  1674 				}
  1670 				if ( 0 == $prtfl_options['widget_updated'] ) {
  1675 				if ( 0 == $prtfl_options['widget_updated'] ) {
  1671 					/* Save data for settings page */
  1676 					/* Save data for settings page */
  1711 			$term = get_term_by( 'slug', $wp_query->query_vars["portfolio_executor_profile"], 'portfolio_executor_profile' );
  1716 			$term = get_term_by( 'slug', $wp_query->query_vars["portfolio_executor_profile"], 'portfolio_executor_profile' );
  1712 			echo $prtfl_options['executor_text_field'] . " <h1>" . ( $term->name ) . "</h1>";
  1717 			echo $prtfl_options['executor_text_field'] . " <h1>" . ( $term->name ) . "</h1>";
  1713 			$_SESSION['prtfl_page_name'] = $prtfl_options['executor_text_field'] . " " . ( $term->name );
  1718 			$_SESSION['prtfl_page_name'] = $prtfl_options['executor_text_field'] . " " . ( $term->name );
  1714 			$_SESSION['prtfl_page_url'] = get_pagenum_link( $wp_query->query_vars['paged'] );
  1719 			$_SESSION['prtfl_page_url'] = get_pagenum_link( $wp_query->query_vars['paged'] );
  1715 		} else {
  1720 		} else {
  1716 			the_title( '<h2>', '</h2>' );
  1721 			the_title( '<h1>', '</h1>' );
  1717 		}
  1722 		}
  1718 	}
  1723 	}
  1719 }
  1724 }
  1720 
  1725 
  1721 /* This function will display title for portfolio post type template */
  1726 /* This function will display title for portfolio post type template */
  1722 if ( ! function_exists( 'prtfl_post_template_title' ) ) {
  1727 if ( ! function_exists( 'prtfl_post_template_title' ) ) {
  1723 	function prtfl_post_template_title() {
  1728 	function prtfl_post_template_title() {
  1724 		$title = get_the_title();
  1729 		$title = get_the_title();
  1725 		echo empty( $title ) ? '(' . __( 'No title', 'portfolio' ) . ')' : '<h2>'. $title . '</h2>' ;
  1730 		echo empty( $title ) ? '(' . __( 'No title', 'portfolio' ) . ')' : '<h1>'. $title . '</h1>' ;
  1726 	}
  1731 	}
  1727 }
  1732 }
  1728 
  1733 
  1729 /**
  1734 /**
  1730  * Prepare arguments for post query
  1735  * Prepare arguments for post query
  1804 
  1809 
  1805 		$request = $second_query->request;
  1810 		$request = $second_query->request;
  1806 		$count_portfolio_row_block = 0;
  1811 		$count_portfolio_row_block = 0;
  1807 		$prtfl_widht = 99 / $prtfl_options['custom_portfolio_row_count'];
  1812 		$prtfl_widht = 99 / $prtfl_options['custom_portfolio_row_count'];
  1808 
  1813 
  1809 		if( 1 < $prtfl_options['custom_portfolio_row_count']  ){
       
  1810 			$prtfl_read_more = 'style="float:left"';
       
  1811 		}else{
       
  1812 			$prtfl_read_more = "";
       
  1813 		}
       
  1814 
       
  1815 		if ( ! empty( $post ) && ! empty( $post->post_content ) ) {
  1814 		if ( ! empty( $post ) && ! empty( $post->post_content ) ) {
  1816 			$page_content = $post->post_content;
  1815 			$page_content = $post->post_content;
  1817 			if ( function_exists( 'mltlngg_the_content_filter' ) ) $page_content = mltlngg_the_content_filter( $page_content );
  1816 			if ( function_exists( 'mltlngg_the_content_filter' ) ) $page_content = mltlngg_the_content_filter( $page_content );
  1818 			/* dublicate filter 'the_content' - as we couldnt use it */
  1817 			/* dublicate filter 'the_content' - as we couldnt use it */
  1819 			if ( function_exists( 'wptexturize' ) ) {
  1818 			if ( function_exists( 'wptexturize' ) ) {
  1848 				$second_query->the_post();
  1847 				$second_query->the_post();
  1849 				if ( $count_portfolio_row_block % $prtfl_options['custom_portfolio_row_count'] == 0 ) {?>
  1848 				if ( $count_portfolio_row_block % $prtfl_options['custom_portfolio_row_count'] == 0 ) {?>
  1850 					<div class="portfolio_row_count"><?php
  1849 					<div class="portfolio_row_count"><?php
  1851 				}?>
  1850 				}?>
  1852 				<div id="portfolio_row_count_block" class="portfolio_row_count_block" style="width: <?php echo $prtfl_widht ?>%">
  1851 				<div id="portfolio_row_count_block" class="portfolio_row_count_block" style="width: <?php echo $prtfl_widht ?>%">
  1853 				<div class="portfolio_content <?php if ( 'twentyfourteen' == get_stylesheet() || 'twentythirteen' == get_stylesheet() || 'twentytwelve' == get_stylesheet() ) echo 'entry-content'; ?>">
  1852 				<div class="portfolio_content<?php echo in_array( get_stylesheet(), array( 'twentyfourteen', 'twentythirteen', 'twentytwelve', 'twentynineteen', 'twentytwenty' ) ) ?  ' entry-content' : ''; ?>">
  1854 					<div class="entry">
  1853 					<div class="entry">
  1855 						<?php $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
  1854 						<?php $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
  1856 						$image			= wp_get_attachment_image_src( $post_thumbnail_id, $prtfl_options['image_size_album'] );
  1855 						$image			= wp_get_attachment_image_src( $post_thumbnail_id, $prtfl_options['image_size_album'] );
  1857 						$post_meta		= get_post_meta( $post->ID, 'prtfl_information', true );
  1856 						$post_meta		= get_post_meta( $post->ID, 'prtfl_information', true );
  1858 
  1857 
  1912 								<p><span class="lable"><?php echo '<b>' . $prtfl_options['shrdescription_text_field'] . '</b>'; ?></span> <?php echo $short_descr; ?></p>
  1911 								<p><span class="lable"><?php echo '<b>' . $prtfl_options['shrdescription_text_field'] . '</b>'; ?></span> <?php echo $short_descr; ?></p>
  1913 							<?php } ?>
  1912 							<?php } ?>
  1914 						</div><!-- .portfolio_short_content -->
  1913 						</div><!-- .portfolio_short_content -->
  1915 					</div><!-- .entry -->
  1914 					</div><!-- .entry -->
  1916 					<div class="entry_footer">
  1915 					<div class="entry_footer">
  1917 						<div class="read_more" <?php echo $prtfl_read_more ?>>
  1916 						<div class="read_more">
  1918 							<a href="<?php the_permalink(); ?>" rel="bookmark"><?php _e( 'Read more', 'portfolio' ); ?></a>
  1917 							<a href="<?php the_permalink(); ?>" rel="bookmark"><?php _e( 'Read more', 'portfolio' ); ?></a>
  1919 						</div><!-- .read_more -->
  1918 						</div><!-- .read_more -->
  1920 						<?php $terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' );
  1919 						<?php $terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' );
  1921 						if ( 1 == $prtfl_options['technologies_additional_field'] && ! is_wp_error( $terms ) ) {
  1920 						if ( 1 == $prtfl_options['technologies_additional_field'] && ! is_wp_error( $terms ) ) {
  1922 							if ( is_array( $terms ) && 0 < count( $terms ) ) { ?>
  1921 							if ( is_array( $terms ) && 0 < count( $terms ) ) { ?>
  2040 							if ( ! empty( $full_descr ) ) { ?>
  2039 							if ( ! empty( $full_descr ) ) { ?>
  2041 								<div style = "clear: both;"><span class="lable"><?php echo '<b>' . $prtfl_options['description_text_field'] . '</b>'; ?></span> <?php echo $full_descr; ?></div>
  2040 								<div style = "clear: both;"><span class="lable"><?php echo '<b>' . $prtfl_options['description_text_field'] . '</b>'; ?></span> <?php echo $full_descr; ?></div>
  2042 							<?php }
  2041 							<?php }
  2043 						}
  2042 						}
  2044 
  2043 
  2045 						if ( 0 != $user_id && $portfolio_options ) {
  2044 						if ( 0 != $user_id || 0 == $portfolio_options['svn_additional_field_for_non_logged'] ) {
  2046 							$svn = isset( $post_meta['_prtfl_svn'] ) ? $post_meta['_prtfl_svn'] : '';
  2045 							$svn = isset( $post_meta['_prtfl_svn'] ) ? $post_meta['_prtfl_svn'] : '';
  2047 							if ( 1 == $portfolio_options['svn_additional_field'] && ! empty( $svn ) ) { ?>
  2046 							if ( 1 == $portfolio_options['svn_additional_field'] && ! empty( $svn ) ) { ?>
  2048 								<p><span class="lable"><?php echo '<b>' . $portfolio_options['svn_text_field'] . '</b>'; ?></span> <?php echo $svn; ?></p>
  2047 								<p><span class="lable"><?php echo '<b>' . $portfolio_options['svn_text_field'] . '</b>'; ?></span> <?php echo $svn; ?></p>
  2049 							<?php }
  2048 							<?php }
       
  2049 						}
       
  2050 						if ( $user_id ) {
  2050 							$executors_profile = wp_get_object_terms( $post->ID, 'portfolio_executor_profile' );
  2051 							$executors_profile = wp_get_object_terms( $post->ID, 'portfolio_executor_profile' );
  2051 							if ( 1 == $portfolio_options['executor_additional_field'] && ! empty( $executors_profile ) ) { ?>
  2052 							if ( 1 == $portfolio_options['executor_additional_field'] && ! empty( $executors_profile ) ) { ?>
  2052 								<p><span class="lable"><?php echo '<b>' . $portfolio_options['executor_text_field'] . '</b>'; ?></span>
  2053 								<p><span class="lable"><?php echo '<b>' . $portfolio_options['executor_text_field'] . '</b>'; ?></span>
  2053 								<?php $count = 0;
  2054 								<?php $count = 0;
  2054 								foreach ( $executors_profile as $profile ) {
  2055 								foreach ( $executors_profile as $profile ) {
  2058 									<a href="<?php echo get_term_link( $profile->slug, 'portfolio_executor_profile' ); ?>" title="<?php echo $profile->name; ?> profile" target="_blank"><?php echo $profile->name; ?></a>
  2059 									<a href="<?php echo get_term_link( $profile->slug, 'portfolio_executor_profile' ); ?>" title="<?php echo $profile->name; ?> profile" target="_blank"><?php echo $profile->name; ?></a>
  2059 									<?php $count++;
  2060 									<?php $count++;
  2060 								} ?>
  2061 								} ?>
  2061 								</p>
  2062 								</p>
  2062 							<?php }
  2063 							<?php }
  2063 						 } ?>
  2064 						} ?>
  2064 					</div><!-- .portfolio_short_content -->
  2065 					</div><!-- .portfolio_short_content -->
  2065 					<div class="portfolio_images_block" data-columns="<?php echo $portfolio_options['custom_image_row_count'] ?>">
  2066 					<div class="portfolio_images_block" data-columns="<?php echo $portfolio_options['custom_image_row_count'] ?>">
  2066 						<?php if ( metadata_exists( 'post', $post->ID, '_prtfl_images' ) ) {
  2067 						<?php if ( metadata_exists( 'post', $post->ID, '_prtfl_images' ) ) {
  2067 							$array_post_thumbnail_id = array_filter( explode( ',', get_post_meta( $post->ID, '_prtfl_images', true ) ) );
  2068 							$array_post_thumbnail_id = array_filter( explode( ',', get_post_meta( $post->ID, '_prtfl_images', true ) ) );
  2068 						} else {
  2069 						} else {
  2158 			$pages = 1;
  2159 			$pages = 1;
  2159 		}
  2160 		}
  2160 		if ( 1 != $pages ) { ?>
  2161 		if ( 1 != $pages ) { ?>
  2161 			<div class='clear'></div>
  2162 			<div class='clear'></div>
  2162 			<div id="portfolio_pagenation">
  2163 			<div id="portfolio_pagenation">
  2163 				<div class='pagination'>
  2164 				<div class="pagination">
  2164 					<?php if ( 2 < $paged && $paged > $range + 1 && $showitems < $pages ) {
  2165 					<div class="<?php echo 'twentynineteen' == get_stylesheet() ? 'nav-links' : '' ?>">
  2165 						echo "<a href='" . get_pagenum_link( 1 ) . "'>&laquo;</a>";
  2166 						<?php if ( 2 < $paged && $paged > $range + 1 && $showitems < $pages ) {
  2166 					}
  2167 							echo "<a href='" . get_pagenum_link( 1 ) . "'>&laquo;</a>";
  2167 					if ( 1 < $paged && $showitems < $pages ) {
       
  2168 						echo "<a href='" . get_pagenum_link( $paged - 1 ) . "'>&lsaquo;</a>";
       
  2169 					}
       
  2170 					for ( $i = 1; $i <= $pages; $i++ ) {
       
  2171 						if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
       
  2172 							echo ( $paged == $i ) ? "<span class='current'>" . $i . "</span>":"<a href='" . get_pagenum_link( $i ) . "' class='inactive' >" . $i . "</a>";
       
  2173 						}
  2168 						}
  2174 					}
  2169 						if ( 1 < $paged && $showitems < $pages ) {
  2175 					if ( $paged < $pages && $showitems < $pages ) {
  2170 							echo "<a href='" . get_pagenum_link( $paged - 1 ) . "'>&lsaquo;</a>";
  2176 						echo "<a href='" . get_pagenum_link( $paged + 1 ) . "'>&rsaquo;</a>";
  2171 						}
  2177 					}
  2172 						for ( $i = 1; $i <= $pages; $i++ ) {
  2178 					if ( $paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages ) {
  2173 							if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
  2179 						echo "<a href='" . get_pagenum_link( $pages ) . "'>&raquo;</a>";
  2174 								echo ( $paged == $i ) ? "<span class='current'>" . $i . "</span>":"<a href='" . get_pagenum_link( $i ) . "' class='inactive' >" . $i . "</a>";
  2180 					} ?>
  2175 							}
  2181 					<div class='clear'></div>
  2176 						}
       
  2177 						if ( $paged < $pages && $showitems < $pages ) {
       
  2178 							echo "<a href='" . get_pagenum_link( $paged + 1 ) . "'>&rsaquo;</a>";
       
  2179 						}
       
  2180 						if ( $paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages ) {
       
  2181 							echo "<a href='" . get_pagenum_link( $pages ) . "'>&raquo;</a>";
       
  2182 						} ?>
       
  2183                         <div class='clear'></div>
       
  2184                     </div>
  2182 				</div><!-- .pagination -->
  2185 				</div><!-- .pagination -->
  2183 				<?php if ( function_exists( 'pgntn_display_pagination' ) ) pgntn_display_pagination( 'custom', $second_query ); ?>
  2186 				<?php if ( function_exists( 'pgntn_display_pagination' ) ) pgntn_display_pagination( 'custom', $second_query ); ?>
  2184 			</div><!-- #portfolio_pagenation -->
  2187 			</div><!-- #portfolio_pagenation -->
  2185 		<?php }
  2188 		<?php }
  2186 	}
  2189 	}
  2197 						<?php _e( 'The number of portfolio projects to display', 'portfolio' ); ?>
  2200 						<?php _e( 'The number of portfolio projects to display', 'portfolio' ); ?>
  2198 					</span>
  2201 					</span>
  2199 				</label>
  2202 				</label>
  2200 			</fieldset>
  2203 			</fieldset>
  2201 			<input class="bws_default_shortcode" type="hidden" name="default" value="[latest_portfolio_items count=3]" />
  2204 			<input class="bws_default_shortcode" type="hidden" name="default" value="[latest_portfolio_items count=3]" />
  2202 			<script type="text/javascript">
  2205 			<?php $script = "function prtfl_shortcode_init() {
  2203 				function prtfl_shortcode_init() {
  2206                 ( function( $ ) {
  2204 					( function( $ ) {
  2207                     $( '.mce-reset #prtfl_display_count' ).on( 'change', function() {
  2205 						$( '.mce-reset #prtfl_display_count' ).on( 'change', function() {
  2208                         var count = $( '.mce-reset #prtfl_display_count' ).val();
  2206 							var count = $( '.mce-reset #prtfl_display_count' ).val();
  2209                         var shortcode = '[latest_portfolio_items count=' + count + ']';
  2207 							var shortcode = '[latest_portfolio_items count=' + count + ']';
  2210                         $( '.mce-reset #bws_shortcode_display' ).text( shortcode );
  2208 							$( '.mce-reset #bws_shortcode_display' ).text( shortcode );
  2211                     } );
  2209 						} );
  2212                 } )( jQuery );
  2210 					} )( jQuery );
  2213             }";
  2211 				}
  2214 			wp_register_script( 'prtfl_display_script', '' );
  2212 			</script>
  2215 			wp_enqueue_script( 'prtfl_display_script' );
       
  2216 			wp_add_inline_script( 'prtfl_display_script', sprintf( $script ) ); ?>
  2213 			<div class="clear"></div>
  2217 			<div class="clear"></div>
  2214 		</div>
  2218 		</div>
  2215 	<?php }
  2219 	<?php }
  2216 }
  2220 }
  2217 
  2221 
  2389 		}
  2393 		}
  2390 
  2394 
  2391 		public function form( $instance ) {
  2395 		public function form( $instance ) {
  2392 			global $sbscrbr_options;
  2396 			global $sbscrbr_options;
  2393 
  2397 
  2394 			$widget_title          = isset( $instance['widget_title'] ) ? stripslashes( esc_html( $instance['widget_title'] ) ) : null;
  2398 			$widget_title           = isset( $instance['widget_title'] ) ? stripslashes( sanitize_text_field( $instance['widget_title'] ) ) : '';
  2395 			$widget_count_posts          = isset( $instance['widget_count_posts'] ) ? stripslashes( esc_html( $instance['widget_count_posts'] ) ) : null;
  2399 			$widget_count_posts     = isset( $instance['widget_count_posts'] ) ? stripslashes( sanitize_text_field( $instance['widget_count_posts'] ) ) : 5;
  2396 			$widget_count_colums         = isset( $instance['widget_count_colums'] ) ? stripslashes( esc_html( $instance['widget_count_colums'] ) ) : null;
  2400 			$widget_count_colums    = isset( $instance['widget_count_colums'] ) ? stripslashes( sanitize_text_field( $instance['widget_count_colums'] ) ) : 3;
  2397 			?>
  2401 			?>
  2398 			<p>
  2402 			<p>
  2399 				<label for="<?php echo $this->get_field_id( 'widget_title' ); ?>">
  2403 				<label for="<?php echo $this->get_field_id( 'widget_title' ); ?>">
  2400 					<?php _e( 'Title', 'portfolio' ); ?>:
  2404 					<?php _e( 'Title', 'portfolio' ); ?>:
  2401 					<input class="widefat" id="<?php echo $this->get_field_id( 'widget_title' ); ?>" name="<?php echo $this->get_field_name( 'widget_title' ); ?>" type="text" value="<?php echo esc_attr( $widget_title ); ?>"/>
  2405 					<input class="widefat" id="<?php echo $this->get_field_id( 'widget_title' ); ?>" name="<?php echo $this->get_field_name( 'widget_title' ); ?>" type="text" value="<?php echo $widget_title; ?>"/>
  2402 				</label>
  2406 				</label>
  2403 			</p>
  2407 			</p>
  2404 			<p>
  2408 			<p>
  2405 				<label for="<?php echo $this->get_field_id( 'widget_count_posts' ); ?>">
  2409 				<label for="<?php echo $this->get_field_id( 'widget_count_posts' ); ?>">
  2406 					<?php _e( 'Number of projects:', 'portfolio' ); ?>:
  2410 					<?php _e( 'Number of Projects:', 'portfolio' ); ?>:
  2407 					<input class="widefat" id="<?php echo $this->get_field_id( 'widget_count_posts' ); ?>" name="<?php echo $this->get_field_name( 'widget_count_posts' ); ?>" type="number" name="prtfl_portfolio_custom_row_count" min="1" max="10000" value="<?php echo ! empty( ( $widget_count_posts ) ) ? esc_attr( $widget_count_posts ) : 5; ?>"/>
  2411 					<input class="widefat" id="<?php echo $this->get_field_id( 'widget_count_posts' ); ?>" name="<?php echo $this->get_field_name( 'widget_count_posts' ); ?>" type="number" min="1" max="100" value="<?php echo $widget_count_posts; ?>" />
  2408 				</label>
  2412 				</label>
  2409 			</p>
  2413 			</p>
  2410 			<p>
  2414 			<p>
  2411 				<label for="<?php echo $this->get_field_id( 'widget_count_colums' ); ?>">
  2415 				<label for="<?php echo $this->get_field_id( 'widget_count_colums' ); ?>">
  2412 					<?php _e( 'Number of Colums:', 'portfolio' ); ?>:
  2416 					<?php _e( 'Number of Colums:', 'portfolio' ); ?>:
  2413 					<input class="widefat" id="<?php echo $this->get_field_id( 'widget_count_colums' ); ?>" name="<?php echo $this->get_field_name( 'widget_count_colums' ); ?>" type="number" name="prtfl_portfolio_custom_row_count_colums" min="1" max="100" value="<?php echo ! empty( ( $widget_count_colums ) ) ? esc_attr( $widget_count_colums ) : 3; ?>"/>
  2417 					<input class="widefat" id="<?php echo $this->get_field_id( 'widget_count_colums' ); ?>" name="<?php echo $this->get_field_name( 'widget_count_colums' ); ?>" type="number" min="1" max="100" value="<?php echo $widget_count_colums; ?>" />
  2414 				</label>
  2418 				</label>
  2415 			</p>
  2419 			</p>
  2416 		<?php }
  2420 		<?php }
  2417 
  2421 
  2418 		public function update( $new_instance, $old_instance ) {
  2422 		public function update( $new_instance, $old_instance ) {