: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
Plugin Name: Portfolio by BestWebSoft
Plugin URI: https://bestwebsoft.com/products/wordpress/plugins/portfolio/
Description: Create your personal portfolio WordPress website. Manage and showcase past projects to get more clients.
Author URI: https://bestwebsoft.com/
@ Copyright 2021 BestWebSoft ( https://support.bestwebsoft.com )
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
if ( ! function_exists( 'add_prtfl_admin_menu' ) ) {
* Add 'BWS Plugins' menu at the left side in administer panel
function add_prtfl_admin_menu() {
global $submenu, $prtfl_options, $prtfl_plugin_info, $wp_version;
if ( empty( $prtfl_options ) ) {
register_prtfl_settings();
$settings = add_submenu_page( 'edit.php?post_type=' . $prtfl_options['post_type_name'], __( 'Portfolio Settings', 'portfolio' ), __( 'Settings', 'portfolio' ), 'manage_options', 'portfolio.php', 'prtfl_settings_page' );
add_submenu_page( 'edit.php?post_type=' . $prtfl_options['post_type_name'], 'BWS Panel', 'BWS Panel', 'manage_options', 'prtfl-bws-panel', 'bws_add_menu_render' );
if ( isset( $submenu[ 'edit.php?post_type=' . $prtfl_options['post_type_name'] ] ) ) {
$submenu[ 'edit.php?post_type=' . $prtfl_options['post_type_name'] ][] = array(
'<span style="color:#d86463"> ' . __( 'Upgrade to Pro', 'portfolio' ) . '</span>',
'https://bestwebsoft.com/products/wordpress/plugins/portfolio/?k=f047e20c92c972c398187a4f70240285&pn=74&v=' . $prtfl_plugin_info['Version'] . '&wp_v=' . $wp_version,
add_action( 'load-' . $settings, 'prtfl_add_tabs' );
add_action( 'load-post-new.php', 'prtfl_add_tabs' );
add_action( 'load-post.php', 'prtfl_add_tabs' );
add_action( 'load-edit.php', 'prtfl_add_tabs' );
if ( ! function_exists( 'prtfl_init' ) ) {
global $prtfl_boxes, $prtfl_plugin_info;
require_once dirname( __FILE__ ) . '/bws_menu/bws_include.php';
bws_include_init( plugin_basename( __FILE__ ) );
if ( ! $prtfl_plugin_info ) {
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
$prtfl_plugin_info = get_plugin_data( __FILE__ );
/* Function check if plugin is compatible with current WP version */
bws_wp_min_version_check( plugin_basename( __FILE__ ), $prtfl_plugin_info, '4.5' );
$prtfl_boxes['Portfolio-Info'] = array(
'name' => '_prtfl_short_descr',
'title' => __( 'Short description', 'portfolio' ),
'name' => '_prtfl_date_compl',
'title' => __( 'Date of completion', 'portfolio' ),
'title' => __( 'Project, URL', 'portfolio' ),
'title' => __( 'Source Files, URL', 'portfolio' ),
/* Call register settings function */
register_prtfl_settings();
/* Register post type and taxonomy for portfolio */
prtfl_post_type_portfolio();
/* add template for gallery pages */
add_action( 'template_include', 'prtfl_template_include' );
$demo_options = get_option( 'prtfl_demo_options' );
if ( ! empty( $demo_options ) || ( isset( $_GET['page'] ) && 'portfolio.php' === $_GET['page'] ) ) {
prtfl_include_demo_data();
if ( ! function_exists( 'prtfl_admin_init' ) ) {
function prtfl_admin_init() {
global $bws_plugin_info, $prtfl_plugin_info, $bws_shortcode_list, $wpdb, $pagenow, $prtfl_options;
if ( empty( $bws_plugin_info ) ) {
$bws_plugin_info = array(
'version' => $prtfl_plugin_info['Version'],
/* add Portfolio to global $bws_shortcode_list */
$bws_shortcode_list['prtfl'] = array(
'js_function' => 'prtfl_shortcode_init',
if ( 'plugins.php' === $pagenow ) {
/* Install the option defaults */
if ( function_exists( 'bws_plugin_banner_go_pro' ) ) {
register_prtfl_settings();
bws_plugin_banner_go_pro( $prtfl_options, $prtfl_plugin_info, 'prtfl', 'portfolio', '56e6c97d1bca3199fb16cb817793a8f6', '74', 'portfolio' );
if ( ! function_exists( 'prtfl_plugins_loaded' ) ) {
function prtfl_plugins_loaded() {
load_plugin_textdomain( 'portfolio', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
if ( ! function_exists( 'prtfl_plugin_activate' ) ) {
* Creating a default options for showing ads. Starts on plugin activation
function prtfl_plugin_activate() {
register_uninstall_hook( __FILE__, 'prtfl_plugin_uninstall' );
register_uninstall_hook( __FILE__, 'prtfl_plugin_uninstall' );
if ( ! function_exists( 'register_prtfl_settings' ) ) {
* Register settings function
function register_prtfl_settings() {
global $prtfl_options, $prtfl_plugin_info, $wpdb;
/* Install the option defaults */
if ( ! get_option( 'prtfl_options' ) ) {
$option_defaults = prtfl_get_options_default();
add_option( 'prtfl_options', $option_defaults );
/* Get options from the database */
$prtfl_options = get_option( 'prtfl_options' );
/* Array merge incase this version has added new options */
if ( ! isset( $prtfl_options['plugin_option_version'] ) || $prtfl_options['plugin_option_version'] !== $prtfl_plugin_info['Version'] ) {
$wpdb->query( "UPDATE {$wpdb->prefix}posts SET post_type = 'bws-portfolio' WHERE post_type = 'portfolio'" );
$option_defaults = prtfl_get_options_default();
if ( ! isset( $prtfl_options['plugin_option_version'] ) || $prtfl_options['plugin_option_version'] < '2.29' ) {
$option_defaults['widget_updated'] = 0;
/* Add options 'post_type_name' */
if ( ! isset( $prtfl_options['post_type_name'] ) ) {
$option_defaults['post_type_name'] = 'bws-portfolio';
$prtfl_options = array_merge( $option_defaults, $prtfl_options );
$prtfl_options['plugin_option_version'] = $option_defaults['plugin_option_version'];
$prtfl_options['hide_premium_options'] = array();
update_option( 'prtfl_options', $prtfl_options );
if ( function_exists( 'add_image_size' ) ) {
if ( 'portfolio-thumb' === $prtfl_options['image_size_album'] ) {
add_image_size( 'portfolio-thumb', $prtfl_options['custom_size_px']['portfolio-thumb'][0], $prtfl_options['custom_size_px']['portfolio-thumb'][1], true );
if ( 'portfolio-photo-thumb' === $prtfl_options['image_size_photo'] ) {
add_image_size( 'portfolio-photo-thumb', $prtfl_options['custom_size_px']['portfolio-photo-thumb'][0], $prtfl_options['custom_size_px']['portfolio-photo-thumb'][1], true );
if ( ! function_exists( 'prtfl_get_options_default' ) ) {
* Get Plugin default options
function prtfl_get_options_default() {
global $prtfl_plugin_info;
$option_defaults = array(
'plugin_option_version' => $prtfl_plugin_info['Version'],
'first_install' => strtotime( 'now' ),
'suggest_feature_banner' => 1,
'display_settings_notice' => 1,
'display_demo_notice' => 1,
'image_size_album' => 'medium',
'image_size_photo' => 'thumbnail',
'custom_size_px' => array(
'portfolio-thumb' => array( 280, 300 ),
'portfolio-photo-thumb' => array( 240, 260 ),
'page_id_portfolio_template' => '',
'custom_image_row_count' => 3,
'custom_portfolio_row_count' => 1,
'date_additional_field' => 1,
'link_additional_field' => 1,
'shrdescription_additional_field' => 1,
'description_additional_field' => 1,
'svn_additional_field' => 1,
'svn_additional_field_for_non_logged' => 1,
'executor_additional_field' => 1,
'technologies_additional_field' => 1,
'link_additional_field_for_non_registered' => 1,
'date_text_field' => __( 'Date of completion:', 'portfolio' ),
'link_text_field' => __( 'Project, URL:', 'portfolio' ),
'shrdescription_text_field' => __( 'Short description:', 'portfolio' ),
'description_text_field' => __( 'Description:', 'portfolio' ),
'svn_text_field' => __( 'Source Files, URL:', 'portfolio' ),
'executor_text_field' => __( 'Executor:', 'portfolio' ),
'screenshot_text_field' => __( 'More screenshots:', 'portfolio' ),
'technologies_text_field' => __( 'Technologies:', 'portfolio' ),
'post_type_name' => 'bws-portfolio',
'widget_updated' => 1, /* this option is for updating plugin was added in v2.29 */
'flush_rewrite_rules' => 1,
if ( ! function_exists( 'prtfl_post_type_portfolio' ) ) {
* Create post type for portfolio
function prtfl_post_type_portfolio() {
global $wpdb, $prtfl_options;
$prtfl_options['post_type_name'],
'name' => __( 'Portfolio', 'portfolio' ),
'all_items' => __( 'Projects', 'portfolio' ),
'singular_name' => __( 'Project', 'portfolio' ),
'add_new' => __( 'Add New', 'portfolio' ),
'add_new_item' => __( 'Add New Project', 'portfolio' ),
'edit' => __( 'Edit', 'portfolio' ),
'edit_item' => __( 'Edit Project', 'portfolio' ),
'new_item' => __( 'New Project', 'portfolio' ),
'view' => __( 'View Project', 'portfolio' ),
'view_item' => __( 'View Project', 'portfolio' ),
'search_items' => __( 'Search Projects', 'portfolio' ),
'not_found' => __( 'No project found', 'portfolio' ),
'not_found_in_trash' => __( 'No project found in Trash', 'portfolio' ),
'parent' => __( 'Parent Project', 'portfolio' ),
'filter_items_list' => __( 'Filter projects list', 'portfolio' ),
'items_list_navigation' => __( 'Projects list navigation', 'portfolio' ),
'items_list' => __( 'Projects list', 'portfolio' ),
'description' => __( 'Create a project item', 'portfolio' ),
'publicly_queryable' => true,
'exclude_from_search' => true,
'register_meta_box_cb' => 'prtfl_init_metaboxes',
'rewrite' => array( 'slug' => $prtfl_options['slug'] ),
'menu_icon' => 'dashicons-id-alt',
'title', /* Text input field to create a post title. */
'comments', /* Ability to turn on/off comments. */
'thumbnail', /* Displays a box for featured image. */
'portfolio_executor_profile',
$prtfl_options['post_type_name'],
'update_count_callback' => '_update_post_term_count',
'name' => __( 'Executors', 'portfolio' ),
'singular_name' => __( 'Executor', 'portfolio' ),
'search_items' => __( 'Search Executors', 'portfolio' ),
'popular_items' => __( 'Popular Executors', 'portfolio' ),
'all_items' => __( 'All Executors', 'portfolio' ),
'parent_item' => __( 'Parent Executor', 'portfolio' ),
'parent_item_colon' => __( 'Parent Executor:', 'portfolio' ),
'edit_item' => __( 'Edit Executor', 'portfolio' ),
'update_item' => __( 'Update Executor', 'portfolio' ),
'add_new_item' => __( 'Add New Executor', 'portfolio' ),
'new_item_name' => __( 'New Executor Name', 'portfolio' ),
'separate_items_with_commas' => __( 'Separate executors with commas', 'portfolio' ),
'add_or_remove_items' => __( 'Add or remove Executor', 'portfolio' ),
'choose_from_most_used' => __( 'Choose from the most used Executors', 'portfolio' ),
'menu_name' => __( 'Executors', 'portfolio' ),
'items_list_navigation' => __( 'Executors list navigation', 'portfolio' ),
'items_list' => __( 'Executors list', 'portfolio' ),
'args' => array( 'orderby' => 'term_order' ),
'rewrite' => array( 'slug' => 'executor_profile' ),
'show_tagcloud' => false,
'portfolio_technologies',
$prtfl_options['post_type_name'],
'update_count_callback' => '_update_post_term_count',
'name' => __( 'Technologies', 'portfolio' ),
'singular_name' => __( 'Technology', 'portfolio' ),
'search_items' => __( 'Search Technologies', 'portfolio' ),
'popular_items' => __( 'Popular Technologies', 'portfolio' ),
'all_items' => __( 'All Technologies', 'portfolio' ),
'parent_item' => __( 'Parent Technology', 'portfolio' ),
'parent_item_colon' => __( 'Parent Technology:', 'portfolio' ),
'edit_item' => __( 'Edit Technology', 'portfolio' ),
'update_item' => __( 'Update Technology', 'portfolio' ),
'add_new_item' => __( 'Add New Technology', 'portfolio' ),
'new_item_name' => __( 'New Technology Name', 'portfolio' ),
'separate_items_with_commas' => __( 'Separate technologies with commas', 'portfolio' ),
'add_or_remove_items' => __( 'Add or remove Technology', 'portfolio' ),
'choose_from_most_used' => __( 'Choose from the most used technologies', 'portfolio' ),
'menu_name' => __( 'Technologies', 'portfolio' ),
'items_list_navigation' => __( 'Technologies list navigation', 'portfolio' ),
'items_list' => __( 'Technologies list', 'portfolio' ),
'query_var' => 'technologies',
'rewrite' => array( 'slug' => 'technologies' ),
'show_tagcloud' => false,
if ( isset( $prtfl_options['flush_rewrite_rules'] ) && 1 === absint( $prtfl_options['flush_rewrite_rules'] ) ) {
$prtfl_options['flush_rewrite_rules'] = 0;
update_option( 'prtfl_options', $prtfl_options );
if ( ! function_exists( 'prtfl_include_demo_data' ) ) {
function prtfl_include_demo_data() {
global $prtfl_bws_demo_data;
require_once plugin_dir_path( __FILE__ ) . 'includes/demo-data/class-bws-demo-data.php';
'plugin_basename' => plugin_basename( __FILE__ ),
'plugin_prefix' => 'prtfl_',
'plugin_name' => 'Portfolio',
'plugin_page' => 'portfolio.php&bws_active_tab=import-export',
'demo_folder' => plugin_dir_path( __FILE__ ) . 'includes/demo-data/',
$prtfl_bws_demo_data = new Bws_Demo_Data( $args );
/* filter for image url from demo data */
add_filter( 'wp_get_attachment_url', array( $prtfl_bws_demo_data, 'bws_wp_get_attachment_url' ), 10, 2 );
add_filter( 'wp_get_attachment_image_attributes', array( $prtfl_bws_demo_data, 'bws_wp_get_attachment_image_attributes' ), 10, 3 );
add_filter( 'wp_update_attachment_metadata', array( $prtfl_bws_demo_data, 'bws_wp_update_attachment_metadata' ), 10, 2 );
if ( ! function_exists( 'prtfl_settings_page' ) ) {
function prtfl_settings_page() {
if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
require_once dirname( __FILE__ ) . '/bws_menu/class-bws-settings.php';
require_once dirname( __FILE__ ) . '/includes/class-prtfl-settings.php';
$page = new Prtfl_Settings_Tabs( plugin_basename( __FILE__ ) );
if ( method_exists( $page, 'add_request_feature' ) ) {
$page->add_request_feature();
<h1><?php esc_html_e( 'Portfolio Settings', 'portfolio' ); ?></h1>
<?php $page->display_content(); ?>
if ( ! function_exists( 'prtfl_request_filter' ) ) {
* Add query_var "post_type" in case we have another custom post type with query_var 'portfolio' (example: jetpack portfolio)
* @param array $query_vars Query vars array.
* @return array $query_vars Query vars array.
function prtfl_request_filter( $query_vars ) {
if ( isset( $query_vars['post_type'] ) && 'jetpack-portfolio' === $query_vars['post_type'] ) {
if ( ! get_posts( $query_vars ) ) {
$query_vars['post_type'] = $prtfl_options['post_type_name'];
if ( ! function_exists( 'prtfl_technologies_get_posts' ) ) {
* Change post type for portfolio
* @param object $query WP Query object.
* @return object $query Changed WP Query object.
function prtfl_technologies_get_posts( $query ) {
if ( ( isset( $query->query_vars['technologies'] ) || isset( $query->query_vars['portfolio_executor_profile'] ) ) && ( ! is_admin() ) ) {
$query->set( 'post_type', array( $prtfl_options['post_type_name'] ) );
if ( ! function_exists( 'prtfl_register_widget' ) ) {
function prtfl_register_widget() {
if ( ! class_exists( 'Portfolio_Technologies_Widget' ) ) {
require_once dirname( __FILE__ ) . '/includes/class-portfolio-technologies-widget.php';
register_widget( 'Portfolio_Technologies_Widget' );
if ( ! class_exists( 'Prtfl_Widget' ) ) {
require_once dirname( __FILE__ ) . '/includes/class-prtfl-widget.php';
register_widget( 'Prtfl_Widget' );
if ( ! function_exists( 'prtfl_custom_permalinks' ) ) {
* Create custom permalinks for portfolio post type