Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/portfoli...
File: portfolio.php
* @param array $rules Array with permalink rules.
[500] Fix | Delete
* @return array $rules Updated array with permalink rules.
[501] Fix | Delete
*/
[502] Fix | Delete
function prtfl_custom_permalinks( $rules ) {
[503] Fix | Delete
global $prtfl_options;
[504] Fix | Delete
$newrules = array();
[505] Fix | Delete
[506] Fix | Delete
if ( empty( $prtfl_options ) ) {
[507] Fix | Delete
$prtfl_options = get_option( 'prtfl_options' );
[508] Fix | Delete
if ( empty( $prtfl_options ) ) {
[509] Fix | Delete
register_prtfl_settings();
[510] Fix | Delete
}
[511] Fix | Delete
}
[512] Fix | Delete
[513] Fix | Delete
if ( ! empty( $prtfl_options['page_id_portfolio_template'] ) ) {
[514] Fix | Delete
$parent = get_post( $prtfl_options['page_id_portfolio_template'] );
[515] Fix | Delete
if ( ! empty( $parent ) ) {
[516] Fix | Delete
if ( ! isset( $rules[ '(.+)/' . $parent->post_name . '/([^/]+)/?$' ] ) || ! isset( $rules[ $parent->post_name . '/([^/]+)/?$' ] ) ) {
[517] Fix | Delete
$newrules[ '(.+)/' . $parent->post_name . '/([^/]+)/?$' ] = 'index.php?post_type=' . $prtfl_options['post_type_name'] . '&name=$matches[2]&posts_per_page=-1';
[518] Fix | Delete
$newrules[ $parent->post_name . '/([^/]+)/?$' ] = 'index.php?post_type=' . $prtfl_options['post_type_name'] . '&name=$matches[1]&posts_per_page=-1';
[519] Fix | Delete
$newrules[ $parent->post_name . '/page/([^/]+)/?$' ] = 'index.php?pagename=' . $parent->post_name . '&paged=$matches[1]';
[520] Fix | Delete
$newrules[ $parent->post_name . '/page/([^/]+)?$' ] = 'index.php?pagename=' . $parent->post_name . '&paged=$matches[1]';
[521] Fix | Delete
}
[522] Fix | Delete
}
[523] Fix | Delete
}
[524] Fix | Delete
[525] Fix | Delete
/* fix feed permalink (<link rel="alternate" type="application/rss+xml" ... >) on the attachment single page (if the attachment is Attached to the portfolio page) */
[526] Fix | Delete
if ( ! empty( $prtfl_options['slug'] ) ) {
[527] Fix | Delete
$newrules[ $prtfl_options['slug'] . '/.+?/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' ] = 'index.php?attachment=$matches[1]&feed=$matches[2]';
[528] Fix | Delete
$newrules[ $prtfl_options['slug'] . '/.+?/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' ] = 'index.php?attachment=$matches[1]&feed=$matches[2]';
[529] Fix | Delete
}
[530] Fix | Delete
if ( $rules ) {
[531] Fix | Delete
return array_merge( $newrules, $rules );
[532] Fix | Delete
}
[533] Fix | Delete
}
[534] Fix | Delete
}
[535] Fix | Delete
[536] Fix | Delete
if ( ! function_exists( 'prtfl_template_include' ) ) {
[537] Fix | Delete
/**
[538] Fix | Delete
* Load a template. Handles template usage so that plugin can use own templates instead of the themes.
[539] Fix | Delete
*
[540] Fix | Delete
* Templates are in the 'templates' folder.
[541] Fix | Delete
* overrides in /{theme}/bws-templates/ by default.
[542] Fix | Delete
*
[543] Fix | Delete
* @param mixed $template Template for this post.
[544] Fix | Delete
* @return string $template New template.
[545] Fix | Delete
*/
[546] Fix | Delete
function prtfl_template_include( $template ) {
[547] Fix | Delete
global $prtfl_options, $wp_query, $prtfl_plugin_info;
[548] Fix | Delete
[549] Fix | Delete
if ( ! $prtfl_plugin_info ) {
[550] Fix | Delete
if ( ! function_exists( 'get_plugin_data' ) ) {
[551] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[552] Fix | Delete
}
[553] Fix | Delete
$prtfl_plugin_info = get_plugin_data( __FILE__ );
[554] Fix | Delete
}
[555] Fix | Delete
[556] Fix | Delete
if ( function_exists( 'is_embed' ) && is_embed() ) {
[557] Fix | Delete
return $template;
[558] Fix | Delete
}
[559] Fix | Delete
[560] Fix | Delete
$post_type = get_post_type();
[561] Fix | Delete
if ( is_single() && $prtfl_options['post_type_name'] === $post_type ) {
[562] Fix | Delete
$file = 'portfolio-post.php';
[563] Fix | Delete
} elseif ( $prtfl_options['post_type_name'] === $post_type && ( isset( $wp_query->query_vars['technologies'] ) || isset( $wp_query->query_vars['portfolio_executor_profile'] ) ) ) {
[564] Fix | Delete
$file = 'portfolio.php';
[565] Fix | Delete
} elseif ( ! empty( $prtfl_options['page_id_portfolio_template'] ) && is_page( $prtfl_options['page_id_portfolio_template'] ) ) {
[566] Fix | Delete
$file = 'portfolio.php';
[567] Fix | Delete
}
[568] Fix | Delete
[569] Fix | Delete
if ( isset( $file ) ) {
[570] Fix | Delete
if ( ! wp_script_is( 'prtfl_front_script', 'registered' ) ) {
[571] Fix | Delete
wp_register_script( 'prtfl_front_script', plugins_url( 'js/front_script.js', __FILE__ ), array( 'jquery' ), $prtfl_plugin_info['Version'], true );
[572] Fix | Delete
}
[573] Fix | Delete
[574] Fix | Delete
$find = array( $file, 'bws-templates/' . $file );
[575] Fix | Delete
$template = locate_template( $find );
[576] Fix | Delete
[577] Fix | Delete
if ( ! $template ) {
[578] Fix | Delete
$template = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' . $file;
[579] Fix | Delete
}
[580] Fix | Delete
}
[581] Fix | Delete
[582] Fix | Delete
return $template;
[583] Fix | Delete
}
[584] Fix | Delete
}
[585] Fix | Delete
[586] Fix | Delete
if ( ! function_exists( 'prtfl_init_metaboxes' ) ) {
[587] Fix | Delete
/**
[588] Fix | Delete
* Initialization of all metaboxes on the 'Add Portfolio' and Edit Portfolio pages
[589] Fix | Delete
*/
[590] Fix | Delete
function prtfl_init_metaboxes() {
[591] Fix | Delete
global $prtfl_options;
[592] Fix | Delete
add_meta_box( 'prtfl_metabox_images', __( 'Images', 'portfolio' ), 'prtfl_metabox_images_block', $prtfl_options['post_type_name'], 'normal', 'high' );
[593] Fix | Delete
add_meta_box( 'Portfolio-Info', __( 'General', 'portfolio' ), 'prtfl_post_custom_box', $prtfl_options['post_type_name'], 'normal', 'high' );
[594] Fix | Delete
[595] Fix | Delete
$bws_hide_premium_options_check = bws_hide_premium_options_check( $prtfl_options );
[596] Fix | Delete
if ( ! $bws_hide_premium_options_check ) {
[597] Fix | Delete
add_meta_box( 'prtfl_categories_meta_box', __( 'Categories', 'portfolio' ), 'prtfl_categories_meta_box', $prtfl_options['post_type_name'], 'side', 'low' );
[598] Fix | Delete
add_meta_box( 'prtfl_sectors_meta_box', __( 'Sectors', 'portfolio' ), 'prtfl_sectors_meta_box', $prtfl_options['post_type_name'], 'side', 'low' );
[599] Fix | Delete
add_meta_box( 'prtfl_services_meta_box', __( 'Services', 'portfolio' ), 'prtfl_services_meta_box', $prtfl_options['post_type_name'], 'side', 'low' );
[600] Fix | Delete
}
[601] Fix | Delete
}
[602] Fix | Delete
}
[603] Fix | Delete
[604] Fix | Delete
if ( ! function_exists( 'prtfl_post_custom_box' ) ) {
[605] Fix | Delete
/**
[606] Fix | Delete
* Create custom meta box for portfolio post type
[607] Fix | Delete
*
[608] Fix | Delete
* @param string $obj Object.
[609] Fix | Delete
* @param array $box Box array.
[610] Fix | Delete
*/
[611] Fix | Delete
function prtfl_post_custom_box( $obj = '', $box = '' ) {
[612] Fix | Delete
global $prtfl_boxes, $prtfl_plugin_info, $wp_version, $prtfl_options;
[613] Fix | Delete
/* Generate box contents */
[614] Fix | Delete
foreach ( $prtfl_boxes[ $box['id'] ] as $box ) {
[615] Fix | Delete
echo wp_kses_post( prtfl_general_field( $box ) );
[616] Fix | Delete
}
[617] Fix | Delete
[618] Fix | Delete
$bws_hide_premium_options_check = bws_hide_premium_options_check( $prtfl_options );
[619] Fix | Delete
if ( ! $bws_hide_premium_options_check ) {
[620] Fix | Delete
?>
[621] Fix | Delete
<div class="bws_pro_version_bloc">
[622] Fix | Delete
<div class="bws_pro_version_table_bloc">
[623] Fix | Delete
<div class="bws_table_bg" style="top: 0px; z-index: 2;"></div>
[624] Fix | Delete
[625] Fix | Delete
[626] Fix | Delete
<div class="portfolio_admin_box">
[627] Fix | Delete
<p><label for="prtfl_client"><strong><?php esc_html_e( 'Client', 'portfolio' ); ?></strong></label></p>
[628] Fix | Delete
<?php
[629] Fix | Delete
/* display visual editor */
[630] Fix | Delete
$settings = array(
[631] Fix | Delete
'media_buttons' => 1,
[632] Fix | Delete
'textarea_name' => 'prtfl_client',
[633] Fix | Delete
'textarea_rows' => 5,
[634] Fix | Delete
'tinymce' => 1,
[635] Fix | Delete
);
[636] Fix | Delete
wp_editor( '', 'prtfl_client', $settings );
[637] Fix | Delete
?>
[638] Fix | Delete
</div>
[639] Fix | Delete
<div class="portfolio_admin_box">
[640] Fix | Delete
<p><label for="prtfl_featured"><strong><?php esc_html_e( 'Featured project', 'portfolio' ); ?></strong></label></p>
[641] Fix | Delete
<p><input id="prtfl_featured" disabled="disabled" type="checkbox" name="prtfl_featured" value="1" />
[642] Fix | Delete
<em><?php esc_html_e( 'Add to slider', 'portfolio' ); ?></em>
[643] Fix | Delete
</p>
[644] Fix | Delete
</div>
[645] Fix | Delete
<div class="bws_pro_version_tooltip">
[646] Fix | Delete
<a class="bws_button" href="https://bestwebsoft.com/products/wordpress/plugins/portfolio/?k=f047e20c92c972c398187a4f70240285&pn=74&v=<?php echo esc_attr( $prtfl_plugin_info['Version'] ); ?>&wp_v=<?php echo esc_attr( $wp_version ); ?>" target="_blank" title="Portfolio Pro Plugin" style="z-index: 3;" ><?php esc_html_e( 'Learn More', 'portfolio' ); ?></a>
[647] Fix | Delete
<div class="clear"></div>
[648] Fix | Delete
</div>
[649] Fix | Delete
</div>
[650] Fix | Delete
</div>
[651] Fix | Delete
<?php
[652] Fix | Delete
}
[653] Fix | Delete
}
[654] Fix | Delete
}
[655] Fix | Delete
[656] Fix | Delete
if ( ! function_exists( 'prtfl_general_field' ) ) {
[657] Fix | Delete
/**
[658] Fix | Delete
* This is the field meta box
[659] Fix | Delete
*
[660] Fix | Delete
* @param array $args Array of data for meta box.
[661] Fix | Delete
*/
[662] Fix | Delete
function prtfl_general_field( $args ) {
[663] Fix | Delete
global $post;
[664] Fix | Delete
[665] Fix | Delete
$post_meta = get_post_meta( $post->ID, 'prtfl_information', true );
[666] Fix | Delete
$value = ! empty( $post_meta ) && is_array( $post_meta ) && ! empty( $post_meta[ $args['name'] ] ) ? $post_meta[ $args['name'] ] : '';
[667] Fix | Delete
?>
[668] Fix | Delete
<div class="portfolio_admin_box">
[669] Fix | Delete
<p><label for="<?php echo esc_attr( $args['name'] ); ?>"><strong><?php echo esc_html( $args['title'] ); ?></strong></label></p>
[670] Fix | Delete
<p><input id="<?php echo esc_attr( $args['name'] ); ?>" type="text" style="width:80%;" name="<?php echo esc_attr( $args['name'] ); ?>" value="<?php echo esc_html( $value ); ?>" /></p>
[671] Fix | Delete
</div>
[672] Fix | Delete
<?php
[673] Fix | Delete
}
[674] Fix | Delete
}
[675] Fix | Delete
[676] Fix | Delete
if ( ! function_exists( 'prtfl_categories_meta_box' ) ) {
[677] Fix | Delete
/**
[678] Fix | Delete
* Banner on Portfolio Edit Page
[679] Fix | Delete
*/
[680] Fix | Delete
function prtfl_categories_meta_box() {
[681] Fix | Delete
global $prtfl_plugin_info, $wp_version;
[682] Fix | Delete
?>
[683] Fix | Delete
<div class="bws_pro_version_bloc">
[684] Fix | Delete
<div class="bws_pro_version_table_bloc">
[685] Fix | Delete
<div class="bws_table_bg" style="top: 0px;"></div>
[686] Fix | Delete
<div class="prtfl_portfolio_categoriesdiv">
[687] Fix | Delete
<div class="inside">
[688] Fix | Delete
<div class="">
[689] Fix | Delete
<ul class="category-tabs">
[690] Fix | Delete
<li class="tabs"><a href="#"><?php esc_html_e( 'All Categories', 'portfolio' ); ?></a></li>
[691] Fix | Delete
<li><a href="#"><?php esc_html_e( 'Most Used', 'portfolio' ); ?></a></li>
[692] Fix | Delete
</ul>
[693] Fix | Delete
<div class="tabs-panel" style="display: none;">
[694] Fix | Delete
<ul class="categorychecklist form-no-clear">
[695] Fix | Delete
<li class="popular-category">
[696] Fix | Delete
<label class="selectit"><input checked="checked" disabled="disabled" value="236" type="checkbox" /><?php esc_html_e( 'Uncatgorized', 'portfolio' ); ?></label>
[697] Fix | Delete
</li>
[698] Fix | Delete
</ul>
[699] Fix | Delete
</div>
[700] Fix | Delete
<div class="tabs-panel">
[701] Fix | Delete
<ul class="categorychecklist form-no-clear">
[702] Fix | Delete
<li class="popular-category"><label class="selectit"><input value="236" name="tax_input[portfolio_categories][]" checked="checked" disabled="disabled" type="checkbox" /> <?php esc_html_e( 'Uncatgorized', 'portfolio' ); ?></label></li>
[703] Fix | Delete
</ul>
[704] Fix | Delete
</div>
[705] Fix | Delete
</div>
[706] Fix | Delete
</div>
[707] Fix | Delete
</div>
[708] Fix | Delete
<div class="bws_pro_version_tooltip">
[709] Fix | Delete
<a class="bws_button" href="https://bestwebsoft.com/products/wordpress/plugins/portfolio/?k=f047e20c92c972c398187a4f70240285&pn=74&v=<?php echo esc_attr( $prtfl_plugin_info['Version'] ); ?>&wp_v=<?php echo esc_attr( $wp_version ); ?>" target="_blank" title="Portfolio Pro Plugin"><?php esc_html_e( 'Learn More', 'portfolio' ); ?></a>
[710] Fix | Delete
<div class="clear"></div>
[711] Fix | Delete
</div>
[712] Fix | Delete
</div>
[713] Fix | Delete
</div>
[714] Fix | Delete
<?php
[715] Fix | Delete
}
[716] Fix | Delete
}
[717] Fix | Delete
[718] Fix | Delete
if ( ! function_exists( 'prtfl_sectors_meta_box' ) ) {
[719] Fix | Delete
/**
[720] Fix | Delete
* Banner on Portfolio Edit Page
[721] Fix | Delete
*/
[722] Fix | Delete
function prtfl_sectors_meta_box() {
[723] Fix | Delete
global $prtfl_plugin_info, $wp_version;
[724] Fix | Delete
?>
[725] Fix | Delete
<div class="bws_pro_version_bloc">
[726] Fix | Delete
<div class="bws_pro_version_table_bloc">
[727] Fix | Delete
<div class="bws_table_bg" style="top: 0px;"></div>
[728] Fix | Delete
<div class="prtfl_portfolio_sectorsdiv">
[729] Fix | Delete
<div class="inside">
[730] Fix | Delete
<div class="">
[731] Fix | Delete
<ul class="category-tabs">
[732] Fix | Delete
<li class="tabs"><a href="#"><?php esc_html_e( 'All Sectors', 'portfolio' ); ?></a></li>
[733] Fix | Delete
<li><a href="#"><?php esc_html_e( 'Most Used', 'portfolio' ); ?></a></li>
[734] Fix | Delete
</ul>
[735] Fix | Delete
<div class="tabs-panel" style="display: none;">
[736] Fix | Delete
<ul class="categorychecklist form-no-clear">
[737] Fix | Delete
<li class="popular-category">
[738] Fix | Delete
<label class="selectit"><input disabled="disabled" value="236" type="checkbox" /><?php esc_html_e( 'Uncatgorized', 'portfolio' ); ?></label>
[739] Fix | Delete
</li>
[740] Fix | Delete
</ul>
[741] Fix | Delete
</div>
[742] Fix | Delete
<div class="tabs-panel">
[743] Fix | Delete
<ul class="categorychecklist form-no-clear">
[744] Fix | Delete
<li class="popular-category"><label class="selectit"><input value="236" name="tax_input[portfolio_sectors][]" disabled="disabled" type="checkbox" /> <?php esc_html_e( 'Sector', 'portfolio' ); ?> 1</label></li>
[745] Fix | Delete
<li class="popular-category"><label class="selectit"><input value="237" name="tax_input[portfolio_sectors][]" disabled="disabled" type="checkbox" /> <?php esc_html_e( 'Sector', 'portfolio' ); ?> 2</label></li>
[746] Fix | Delete
</ul>
[747] Fix | Delete
</div>
[748] Fix | Delete
</div>
[749] Fix | Delete
</div>
[750] Fix | Delete
</div>
[751] Fix | Delete
<div class="bws_pro_version_tooltip">
[752] Fix | Delete
<a class="bws_button" href="https://bestwebsoft.com/products/wordpress/plugins/portfolio/?k=f047e20c92c972c398187a4f70240285&pn=74&v=<?php echo esc_attr( $prtfl_plugin_info['Version'] ); ?>&wp_v=<?php echo esc_attr( $wp_version ); ?>" target="_blank" title="Portfolio Pro Plugin"><?php esc_html_e( 'Learn More', 'portfolio' ); ?></a>
[753] Fix | Delete
<div class="clear"></div>
[754] Fix | Delete
</div>
[755] Fix | Delete
</div>
[756] Fix | Delete
</div>
[757] Fix | Delete
<?php
[758] Fix | Delete
}
[759] Fix | Delete
}
[760] Fix | Delete
[761] Fix | Delete
if ( ! function_exists( 'prtfl_services_meta_box' ) ) {
[762] Fix | Delete
/**
[763] Fix | Delete
* Banner on Portfolio Edit Page
[764] Fix | Delete
*/
[765] Fix | Delete
function prtfl_services_meta_box() {
[766] Fix | Delete
global $prtfl_plugin_info, $wp_version;
[767] Fix | Delete
?>
[768] Fix | Delete
<div class="bws_pro_version_bloc">
[769] Fix | Delete
<div class="bws_pro_version_table_bloc">
[770] Fix | Delete
<div class="bws_table_bg" style="top: 0px;"></div>
[771] Fix | Delete
<div class="prtfl_portfolio_servicesdiv">
[772] Fix | Delete
<div class="inside">
[773] Fix | Delete
<div class="">
[774] Fix | Delete
<ul class="category-tabs">
[775] Fix | Delete
<li class="tabs"><a href="#"><?php esc_html_e( 'All Services', 'portfolio' ); ?></a></li>
[776] Fix | Delete
<li><a href="#"><?php esc_html_e( 'Most Used', 'portfolio' ); ?></a></li>
[777] Fix | Delete
</ul>
[778] Fix | Delete
<div class="tabs-panel" style="display: none;">
[779] Fix | Delete
<ul class="categorychecklist form-no-clear">
[780] Fix | Delete
<li class="popular-category">
[781] Fix | Delete
<label class="selectit"><input disabled="disabled" value="236" type="checkbox" /><?php esc_html_e( 'Uncatgorized', 'portfolio' ); ?></label>
[782] Fix | Delete
</li>
[783] Fix | Delete
</ul>
[784] Fix | Delete
</div>
[785] Fix | Delete
<div class="tabs-panel">
[786] Fix | Delete
<ul class="categorychecklist form-no-clear">
[787] Fix | Delete
<li class="popular-category"><label class="selectit"><input value="236" name="tax_input[portfolio_services][]" disabled="disabled" type="checkbox" /> <?php esc_html_e( 'Service', 'portfolio' ); ?> 1</label></li>
[788] Fix | Delete
<li class="popular-category"><label class="selectit"><input value="237" name="tax_input[portfolio_services][]" disabled="disabled" type="checkbox" /> <?php esc_html_e( 'Service', 'portfolio' ); ?> 2</label></li>
[789] Fix | Delete
</ul>
[790] Fix | Delete
</div>
[791] Fix | Delete
</div>
[792] Fix | Delete
</div>
[793] Fix | Delete
</div>
[794] Fix | Delete
<div class="bws_pro_version_tooltip">
[795] Fix | Delete
<a class="bws_button" href="https://bestwebsoft.com/products/wordpress/plugins/portfolio/?k=f047e20c92c972c398187a4f70240285&pn=74&v=<?php echo esc_attr( $prtfl_plugin_info['Version'] ); ?>&wp_v=<?php echo esc_attr( $wp_version ); ?>" target="_blank" title="Portfolio Pro Plugin"><?php esc_html_e( 'Learn More', 'portfolio' ); ?></a>
[796] Fix | Delete
<div class="clear"></div>
[797] Fix | Delete
</div>
[798] Fix | Delete
</div>
[799] Fix | Delete
</div>
[800] Fix | Delete
<?php
[801] Fix | Delete
}
[802] Fix | Delete
}
[803] Fix | Delete
[804] Fix | Delete
if ( ! function_exists( 'prtfl_metabox_images_block' ) ) {
[805] Fix | Delete
/**
[806] Fix | Delete
* Metabox for image
[807] Fix | Delete
*/
[808] Fix | Delete
function prtfl_metabox_images_block() {
[809] Fix | Delete
global $post;
[810] Fix | Delete
?>
[811] Fix | Delete
<div id="prtfl_images_container">
[812] Fix | Delete
<noscript><div class="error"><p><?php esc_html_e( 'Please enable JavaScript to add or delete images.', 'portfolio' ); ?></p></div></noscript>
[813] Fix | Delete
<ul>
[814] Fix | Delete
<?php
[815] Fix | Delete
if ( metadata_exists( 'post', $post->ID, '_prtfl_images' ) ) {
[816] Fix | Delete
$prtfl_images = get_post_meta( $post->ID, '_prtfl_images', true );
[817] Fix | Delete
} else {
[818] Fix | Delete
/* Compatibility with old version 1.0.3 */
[819] Fix | Delete
$args = array(
[820] Fix | Delete
'post_parent' => $post->ID,
[821] Fix | Delete
'post_type' => 'attachment',
[822] Fix | Delete
'post_mime_type' => 'image',
[823] Fix | Delete
'numberposts' => -1,
[824] Fix | Delete
'orderby' => 'menu_order',
[825] Fix | Delete
'order' => 'ASC',
[826] Fix | Delete
'exclude' => get_post_thumbnail_id(),
[827] Fix | Delete
'fields' => 'ids',
[828] Fix | Delete
);
[829] Fix | Delete
$attachments = get_children( $args );
[830] Fix | Delete
$prtfl_images = implode( ',', $attachments );
[831] Fix | Delete
}
[832] Fix | Delete
[833] Fix | Delete
$attachments = array_filter( explode( ',', $prtfl_images ) );
[834] Fix | Delete
[835] Fix | Delete
$update_meta = false;
[836] Fix | Delete
[837] Fix | Delete
if ( ! empty( $attachments ) ) {
[838] Fix | Delete
foreach ( $attachments as $attachment_id ) {
[839] Fix | Delete
$attachment = wp_get_attachment_image( $attachment_id, 'thumbnail' );
[840] Fix | Delete
[841] Fix | Delete
/* skip if attachment is empty */
[842] Fix | Delete
if ( empty( $attachment ) ) {
[843] Fix | Delete
$update_meta = true;
[844] Fix | Delete
continue;
[845] Fix | Delete
}
[846] Fix | Delete
[847] Fix | Delete
echo '<li class="prtfl_single_image" data-attachment_id="' . esc_attr( $attachment_id ) . '">
[848] Fix | Delete
' . wp_kses_post( $attachment ) . '
[849] Fix | Delete
<span class="prtfl_delete_image"><a href="#" title="' . esc_html__( 'Delete image', 'portfolio' ) . '">' . esc_html__( 'Delete', 'portfolio' ) . '</a></span>
[850] Fix | Delete
</li>';
[851] Fix | Delete
[852] Fix | Delete
$updated_images_ids[] = $attachment_id;
[853] Fix | Delete
}
[854] Fix | Delete
[855] Fix | Delete
/* update product meta to set new portfolio ids */
[856] Fix | Delete
if ( $update_meta ) {
[857] Fix | Delete
update_post_meta( $post->ID, '_prtfl_images', implode( ',', $updated_images_ids ) );
[858] Fix | Delete
}
[859] Fix | Delete
}
[860] Fix | Delete
?>
[861] Fix | Delete
</ul>
[862] Fix | Delete
<input type="hidden" id="prtfl_images" name="prtfl_images" value="<?php echo esc_attr( $prtfl_images ); ?>" />
[863] Fix | Delete
</div>
[864] Fix | Delete
<p class="prtfl_add_portfolio_images hide-if-no-js">
[865] Fix | Delete
<a href="#" data-choose="<?php esc_attr_e( 'Add Images to Portfolio', 'portfolio' ); ?>" data-update="<?php esc_attr_e( 'Add to portfolio', 'portfolio' ); ?>" data-delete="<?php esc_attr_e( 'Delete image', 'portfolio' ); ?>" data-text="<?php esc_attr_e( 'Delete', 'portfolio' ); ?>"><?php esc_html_e( 'Add images', 'portfolio' ); ?></a>
[866] Fix | Delete
</p>
[867] Fix | Delete
<?php
[868] Fix | Delete
}
[869] Fix | Delete
}
[870] Fix | Delete
[871] Fix | Delete
if ( ! function_exists( 'prtfl_save_postdata' ) ) {
[872] Fix | Delete
/**
[873] Fix | Delete
* Saves our custom data when the post is saved
[874] Fix | Delete
*
[875] Fix | Delete
* @param int $post_id Post ID.
[876] Fix | Delete
* @param object $post Post object.
[877] Fix | Delete
*/
[878] Fix | Delete
function prtfl_save_postdata( $post_id, $post ) {
[879] Fix | Delete
global $prtfl_boxes, $prtfl_options;
[880] Fix | Delete
[881] Fix | Delete
if ( $prtfl_options['post_type_name'] === $post->post_type && ! wp_is_post_revision( $post_id ) && ! empty( $_POST ) ) {
[882] Fix | Delete
/**
[883] Fix | Delete
* Don't store custom data twice
[884] Fix | Delete
* Verify this came from the our screen and with proper authorization, because save_post can be triggered at other times
[885] Fix | Delete
*/
[886] Fix | Delete
if ( ! current_user_can( 'edit_page', $post->ID ) ) {
[887] Fix | Delete
return $post->ID;
[888] Fix | Delete
}
[889] Fix | Delete
[890] Fix | Delete
/* We'll put it into an array to make it easier to loop though. The data is already in $prtfl_boxes, but we need to flatten it out. */
[891] Fix | Delete
foreach ( $prtfl_boxes as $prtfl_boxe ) {
[892] Fix | Delete
foreach ( $prtfl_boxe as $prtfl_fields ) {
[893] Fix | Delete
if ( isset( $_POST[ $prtfl_fields['name'] ] ) ) {
[894] Fix | Delete
if ( 'url' === $prtfl_fields['type'] ) {
[895] Fix | Delete
$my_data[ $prtfl_fields['name'] ] = esc_url( wp_unslash( $_POST[ $prtfl_fields['name'] ] ) );
[896] Fix | Delete
} else {
[897] Fix | Delete
$my_data[ $prtfl_fields['name'] ] = sanitize_text_field( wp_unslash( $_POST[ $prtfl_fields['name'] ] ) );
[898] Fix | Delete
}
[899] Fix | Delete
}
[900] Fix | Delete
}
[901] Fix | Delete
}
[902] Fix | Delete
if ( isset( $my_data ) ) {
[903] Fix | Delete
/* Add values of $my_data as custom fields. Let's cycle through the $my_data array! */
[904] Fix | Delete
if ( get_post_meta( $post->ID, 'prtfl_information', false ) ) {
[905] Fix | Delete
/* Custom field has a value and this custom field exists in database */
[906] Fix | Delete
update_post_meta( $post->ID, 'prtfl_information', $my_data );
[907] Fix | Delete
} else {
[908] Fix | Delete
/* Custom field does not have a value, but this custom field exists in database */
[909] Fix | Delete
update_post_meta( $post->ID, 'prtfl_information', $my_data );
[910] Fix | Delete
}
[911] Fix | Delete
}
[912] Fix | Delete
if ( isset( $_POST['prtfl_images'] ) ) {
[913] Fix | Delete
$attachment_ids = ! empty( $_POST['prtfl_images'] ) ? array_filter( explode( ',', sanitize_text_field( wp_unslash( $_POST['prtfl_images'] ) ) ) ) : array();
[914] Fix | Delete
update_post_meta( $post_id, '_prtfl_images', implode( ',', $attachment_ids ) );
[915] Fix | Delete
}
[916] Fix | Delete
}
[917] Fix | Delete
}
[918] Fix | Delete
}
[919] Fix | Delete
[920] Fix | Delete
if ( ! function_exists( 'prtfl_content_save_pre' ) ) {
[921] Fix | Delete
/**
[922] Fix | Delete
* Replace shortcode [latest_portfolio_items] from portfolio content before portfolio saving
[923] Fix | Delete
*
[924] Fix | Delete
* @param string $content Content.
[925] Fix | Delete
* @returnm string $content Content.
[926] Fix | Delete
*/
[927] Fix | Delete
function prtfl_content_save_pre( $content ) {
[928] Fix | Delete
global $post, $prtfl_options;
[929] Fix | Delete
if ( isset( $post ) && $prtfl_options['post_type_name'] === $post->post_type && ! wp_is_post_revision( $post->ID ) && ! empty( $_POST ) ) {
[930] Fix | Delete
/* remove shortcode */
[931] Fix | Delete
$content = preg_replace( '/\[latest_portfolio_items count=[\d]*\]/', '', $content );
[932] Fix | Delete
}
[933] Fix | Delete
return $content;
[934] Fix | Delete
}
[935] Fix | Delete
}
[936] Fix | Delete
[937] Fix | Delete
if ( ! function_exists( 'prtfl_add_pdf_print_content' ) ) {
[938] Fix | Delete
/**
[939] Fix | Delete
* Add custom fields and images for PDF&Print plugin in Portfolio post
[940] Fix | Delete
*
[941] Fix | Delete
* @param string $content Contetn for print.
[942] Fix | Delete
*/
[943] Fix | Delete
function prtfl_add_pdf_print_content( $content ) {
[944] Fix | Delete
global $post, $prtfl_options;
[945] Fix | Delete
$current_post_type = get_post_type();
[946] Fix | Delete
$custom_content = '';
[947] Fix | Delete
[948] Fix | Delete
if ( ! $prtfl_options ) {
[949] Fix | Delete
$prtfl_options = get_option( 'prtfl_options' );
[950] Fix | Delete
}
[951] Fix | Delete
[952] Fix | Delete
if ( $prtfl_options['post_type_name'] === $current_post_type && ! empty( $post ) ) {
[953] Fix | Delete
[954] Fix | Delete
if ( ! $prtfl_options ) {
[955] Fix | Delete
$prtfl_options = get_option( 'prtfl_options' );
[956] Fix | Delete
}
[957] Fix | Delete
[958] Fix | Delete
$post_meta = get_post_meta( $post->ID, 'prtfl_information', true );
[959] Fix | Delete
$user_id = get_current_user_id();
[960] Fix | Delete
[961] Fix | Delete
if ( 1 === absint( $prtfl_options['date_additional_field'] ) ) {
[962] Fix | Delete
$date_compl = isset( $post_meta['_prtfl_date_compl'] ) ? $post_meta['_prtfl_date_compl'] : '';
[963] Fix | Delete
if ( ! empty( $date_compl ) ) {
[964] Fix | Delete
$custom_content .= '<p><span class="lable">' . $prtfl_options['date_text_field'] . ' </span> ' . $date_compl . '</p>';
[965] Fix | Delete
}
[966] Fix | Delete
}
[967] Fix | Delete
[968] Fix | Delete
if ( 1 === absint( $prtfl_options['link_additional_field'] ) && ! empty( $post_meta['_prtfl_link'] ) ) {
[969] Fix | Delete
[970] Fix | Delete
if ( false !== wp_parse_url( $post_meta['_prtfl_link'] ) ) {
[971] Fix | Delete
if ( ( 0 === $user_id && 0 === absint( $prtfl_options['link_additional_field_for_non_registered'] ) ) || 0 !== $user_id ) {
[972] Fix | Delete
$custom_content .= '<p><span class="lable">' . $prtfl_options['link_text_field'] . '</span> <a href="' . $post_meta['_prtfl_link'] . '">' . $post_meta['_prtfl_link'] . '</a></p>';
[973] Fix | Delete
} else {
[974] Fix | Delete
$custom_content .= '<p><span class="lable">' . $prtfl_options['link_text_field'] . '</span> ' . $post_meta['_prtfl_link'] . '</p>';
[975] Fix | Delete
}
[976] Fix | Delete
} else {
[977] Fix | Delete
$custom_content .= '<p><span class="lable">' . $prtfl_options['link_text_field'] . '</span> ' . $post_meta['_prtfl_link'] . '</p>';
[978] Fix | Delete
}
[979] Fix | Delete
}
[980] Fix | Delete
if ( 0 !== $user_id || 0 === absint( $prtfl_options['svn_additional_field_for_non_logged'] ) ) {
[981] Fix | Delete
if ( 1 === absint( $prtfl_options['svn_additional_field'] ) && ! empty( $post_meta['_prtfl_svn'] ) ) {
[982] Fix | Delete
$custom_content .= '<p><span class="lable">' . $prtfl_options['svn_text_field'] . '</span> ' . $post_meta['_prtfl_svn'] . '</p>';
[983] Fix | Delete
}
[984] Fix | Delete
}
[985] Fix | Delete
if ( 0 !== $user_id ) {
[986] Fix | Delete
if ( 1 === absint( $prtfl_options['executor_additional_field'] ) ) {
[987] Fix | Delete
$executors_profile = wp_get_object_terms( $post->ID, 'portfolio_executor_profile' );
[988] Fix | Delete
if ( ! empty( $executors_profile ) ) {
[989] Fix | Delete
$custom_content .= '<p><span class="lable">' . $prtfl_options['executor_text_field'] . '</span>';
[990] Fix | Delete
$count = 0;
[991] Fix | Delete
foreach ( $executors_profile as $profile ) {
[992] Fix | Delete
if ( $count > 0 ) {
[993] Fix | Delete
$custom_content .= ', ';
[994] Fix | Delete
}
[995] Fix | Delete
$custom_content .= '<a href="' . get_term_link( $profile->slug, 'portfolio_executor_profile' ) . '" title="' . $profile->name . ' profile" target="_blank">' . $profile->name . '</a>';
[996] Fix | Delete
$count++;
[997] Fix | Delete
}
[998] Fix | Delete
$custom_content .= '</p>';
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function