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
}
[1000] Fix | Delete
}
[1001] Fix | Delete
}
[1002] Fix | Delete
} elseif ( 'portfolio.php' === basename( get_page_template() ) || ( ! empty( $prtfl_options['page_id_portfolio_template'] ) && $post->ID === $prtfl_options['page_id_portfolio_template'] ) ) {
[1003] Fix | Delete
global $wp_query, $request, $pdfprnt_options_array, $pdfprnt_options;
[1004] Fix | Delete
[1005] Fix | Delete
$count = 0;
[1006] Fix | Delete
if ( get_query_var( 'paged' ) ) {
[1007] Fix | Delete
$paged = get_query_var( 'paged' );
[1008] Fix | Delete
} elseif ( get_query_var( 'page' ) ) {
[1009] Fix | Delete
$paged = get_query_var( 'page' );
[1010] Fix | Delete
} else {
[1011] Fix | Delete
$paged = 1;
[1012] Fix | Delete
}
[1013] Fix | Delete
$per_page = get_option( 'posts_per_page' );
[1014] Fix | Delete
$showitems = $per_page;
[1015] Fix | Delete
$technologies = isset( $wp_query->query_vars['technologies'] ) ? $wp_query->query_vars['technologies'] : '';
[1016] Fix | Delete
$executor_profile = isset( $wp_query->query_vars['portfolio_executor_profile'] ) ? $wp_query->query_vars['portfolio_executor_profile'] : '';
[1017] Fix | Delete
if ( '' !== $technologies ) {
[1018] Fix | Delete
$args = array(
[1019] Fix | Delete
'post_type' => $prtfl_options['post_type_name'],
[1020] Fix | Delete
'post_status' => 'publish',
[1021] Fix | Delete
'orderby' => $prtfl_options['order_by'],
[1022] Fix | Delete
'order' => $prtfl_options['order'],
[1023] Fix | Delete
'posts_per_page' => $per_page,
[1024] Fix | Delete
'paged' => $paged,
[1025] Fix | Delete
'tax_query' => array(
[1026] Fix | Delete
array(
[1027] Fix | Delete
'taxonomy' => 'portfolio_technologies',
[1028] Fix | Delete
'field' => 'slug',
[1029] Fix | Delete
'terms' => $technologies,
[1030] Fix | Delete
),
[1031] Fix | Delete
),
[1032] Fix | Delete
);
[1033] Fix | Delete
} elseif ( '' !== $executor_profile ) {
[1034] Fix | Delete
$args = array(
[1035] Fix | Delete
'post_type' => $prtfl_options['post_type_name'],
[1036] Fix | Delete
'post_status' => 'publish',
[1037] Fix | Delete
'orderby' => $prtfl_options['order_by'],
[1038] Fix | Delete
'order' => $prtfl_options['order'],
[1039] Fix | Delete
'posts_per_page' => $per_page,
[1040] Fix | Delete
'paged' => $paged,
[1041] Fix | Delete
'tax_query' => array(
[1042] Fix | Delete
array(
[1043] Fix | Delete
'taxonomy' => 'portfolio_executor_profile',
[1044] Fix | Delete
'field' => 'slug',
[1045] Fix | Delete
'terms' => $executor_profile,
[1046] Fix | Delete
),
[1047] Fix | Delete
),
[1048] Fix | Delete
);
[1049] Fix | Delete
} else {
[1050] Fix | Delete
$args = array(
[1051] Fix | Delete
'post_type' => $prtfl_options['post_type_name'],
[1052] Fix | Delete
'post_status' => 'publish',
[1053] Fix | Delete
'orderby' => $prtfl_options['order_by'],
[1054] Fix | Delete
'order' => $prtfl_options['order'],
[1055] Fix | Delete
'posts_per_page' => $per_page,
[1056] Fix | Delete
'paged' => $paged,
[1057] Fix | Delete
);
[1058] Fix | Delete
}
[1059] Fix | Delete
[1060] Fix | Delete
$second_query = new WP_Query( $args );
[1061] Fix | Delete
$request = $second_query->request;
[1062] Fix | Delete
[1063] Fix | Delete
if ( $second_query->have_posts() ) {
[1064] Fix | Delete
while ( $second_query->have_posts() ) {
[1065] Fix | Delete
$second_query->the_post();
[1066] Fix | Delete
$custom_content .= '<div class="portfolio_content entry-content">
[1067] Fix | Delete
<div class="entry">';
[1068] Fix | Delete
[1069] Fix | Delete
$post_meta = get_post_meta( $post->ID, 'prtfl_information', true );
[1070] Fix | Delete
$user_id = get_current_user_id();
[1071] Fix | Delete
[1072] Fix | Delete
$short_descr = isset( $post_meta['_prtfl_short_descr'] ) ? $post_meta['_prtfl_short_descr'] : '';
[1073] Fix | Delete
if ( empty( $short_descr ) ) {
[1074] Fix | Delete
$short_descr = get_the_excerpt();
[1075] Fix | Delete
}
[1076] Fix | Delete
$title = get_the_title();
[1077] Fix | Delete
if ( empty( $title ) ) {
[1078] Fix | Delete
$title = '(' . __( 'No title', 'portfolio' ) . ')';
[1079] Fix | Delete
}
[1080] Fix | Delete
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
[1081] Fix | Delete
if ( empty( $post_thumbnail_id ) ) {
[1082] Fix | Delete
$args = array(
[1083] Fix | Delete
'post_parent' => $post->ID,
[1084] Fix | Delete
'post_type' => 'attachment',
[1085] Fix | Delete
'post_mime_type' => 'image',
[1086] Fix | Delete
'numberposts' => 1,
[1087] Fix | Delete
);
[1088] Fix | Delete
$attachments = get_children( $args );
[1089] Fix | Delete
$post_thumbnail_id = key( $attachments );
[1090] Fix | Delete
}
[1091] Fix | Delete
[1092] Fix | Delete
if ( ( isset( $pdfprnt_options_array['show_featured_image'] ) && 1 === absint( $pdfprnt_options_array['show_featured_image'] ) )
[1093] Fix | Delete
|| ( isset( $pdfprnt_options['show_featured_image'] ) && 1 === absint( $pdfprnt_options['show_featured_image'] ) ) ) {
[1094] Fix | Delete
[1095] Fix | Delete
$image = wp_get_attachment_image_src( $post_thumbnail_id, $prtfl_options['image_size_album'] );
[1096] Fix | Delete
[1097] Fix | Delete
if ( ! empty( $image[0] ) ) {
[1098] Fix | Delete
/* get width and height for image_size_album */
[1099] Fix | Delete
if ( 'portfolio-thumb' !== $prtfl_options['image_size_album'] ) {
[1100] Fix | Delete
$width = absint( get_option( $prtfl_options['image_size_album'] . '_size_w' ) );
[1101] Fix | Delete
$height = absint( get_option( $prtfl_options['image_size_album'] . '_size_h' ) );
[1102] Fix | Delete
} else {
[1103] Fix | Delete
$width = $prtfl_options['custom_size_px']['portfolio-thumb'][0];
[1104] Fix | Delete
$height = $prtfl_options['custom_size_px']['portfolio-thumb'][1];
[1105] Fix | Delete
}
[1106] Fix | Delete
$image_alt = get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true );
[1107] Fix | Delete
[1108] Fix | Delete
$custom_content .= '<div class="portfolio_thumb"><img src="' . $image[0] . '" width="' . $width . '" height="' . $height . '" style="width:' . $width . 'px; height:' . $height . 'px;" alt="' . $image_alt . '" /></div>';
[1109] Fix | Delete
}
[1110] Fix | Delete
}
[1111] Fix | Delete
[1112] Fix | Delete
$custom_content .= '<div class="portfolio_short_content">
[1113] Fix | Delete
<div class="item_title">
[1114] Fix | Delete
<p><a href="' . get_permalink() . '" rel="bookmark">' . $title . '</a></p>
[1115] Fix | Delete
</div>';
[1116] Fix | Delete
if ( 1 === absint( $prtfl_options['date_additional_field'] ) ) {
[1117] Fix | Delete
$date_compl = isset( $post_meta['_prtfl_date_compl'] ) ? $post_meta['_prtfl_date_compl'] : '';
[1118] Fix | Delete
if ( ! empty( $date_compl ) ) {
[1119] Fix | Delete
$custom_content .= '<p><span class="lable">' . $prtfl_options['date_text_field'] . '</span> ' . $date_compl . '</p>';
[1120] Fix | Delete
}
[1121] Fix | Delete
}
[1122] Fix | Delete
[1123] Fix | Delete
if ( 1 === absint( $prtfl_options['link_additional_field'] ) && ! empty( $post_meta['_prtfl_link'] ) ) {
[1124] Fix | Delete
if ( false !== wp_parse_url( $post_meta['_prtfl_link'] ) ) {
[1125] Fix | Delete
if ( ( 0 === $user_id && 0 === absint( $prtfl_options['link_additional_field_for_non_registered'] ) ) || 0 !== $user_id ) {
[1126] 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>';
[1127] Fix | Delete
} else {
[1128] Fix | Delete
$custom_content .= '<p><span class="lable">' . $prtfl_options['link_text_field'] . '</span> ' . $post_meta['_prtfl_link'] . '</p>';
[1129] Fix | Delete
}
[1130] Fix | Delete
} else {
[1131] Fix | Delete
$custom_content .= '<p><span class="lable">' . $prtfl_options['link_text_field'] . '</span> ' . $post_meta['_prtfl_link'] . '</p>';
[1132] Fix | Delete
}
[1133] Fix | Delete
}
[1134] Fix | Delete
if ( 1 === absint( $prtfl_options['shrdescription_additional_field'] ) ) {
[1135] Fix | Delete
$custom_content .= '<p><span class="lable">' . $prtfl_options['shrdescription_text_field'] . '</span> ' . $short_descr . '</p>';
[1136] Fix | Delete
}
[1137] Fix | Delete
$custom_content .= '</div>
[1138] Fix | Delete
</div>
[1139] Fix | Delete
</div>';
[1140] Fix | Delete
}
[1141] Fix | Delete
}
[1142] Fix | Delete
}
[1143] Fix | Delete
return $content . $custom_content;
[1144] Fix | Delete
}
[1145] Fix | Delete
}
[1146] Fix | Delete
[1147] Fix | Delete
if ( ! function_exists( 'prtfl_add_portfolio_ancestor_to_menu' ) ) {
[1148] Fix | Delete
/**
[1149] Fix | Delete
* Adding class to manu items
[1150] Fix | Delete
*
[1151] Fix | Delete
* @param array $classes Array with classes.
[1152] Fix | Delete
* @param object $item Post object.
[1153] Fix | Delete
* @return array $classes Array with classes.
[1154] Fix | Delete
*/
[1155] Fix | Delete
function prtfl_add_portfolio_ancestor_to_menu( $classes, $item ) {
[1156] Fix | Delete
global $prtfl_options;
[1157] Fix | Delete
if ( is_singular( $prtfl_options['post_type_name'] ) ) {
[1158] Fix | Delete
global $wpdb, $post;
[1159] Fix | Delete
$parent = $wpdb->get_var( "SELECT $wpdb->posts.post_name FROM $wpdb->posts, $wpdb->postmeta WHERE meta_key = '_wp_page_template' AND meta_value = 'portfolio.php' AND (post_status = 'publish' OR post_status = 'private') AND $wpdb->posts.ID = $wpdb->postmeta.post_id" );
[1160] Fix | Delete
[1161] Fix | Delete
if ( in_array( 'menu-item-' . $item->ID, $classes ) && strtolower( $item->title ) === $parent ) {
[1162] Fix | Delete
$classes[] = 'current-page-ancestor';
[1163] Fix | Delete
}
[1164] Fix | Delete
}
[1165] Fix | Delete
return $classes;
[1166] Fix | Delete
}
[1167] Fix | Delete
}
[1168] Fix | Delete
[1169] Fix | Delete
if ( ! function_exists( 'prtfl_latest_items' ) ) {
[1170] Fix | Delete
/**
[1171] Fix | Delete
* Forming content for portfolio items
[1172] Fix | Delete
*
[1173] Fix | Delete
* @param array $atts Attributes.
[1174] Fix | Delete
* @param array $count Count or false.
[1175] Fix | Delete
*/
[1176] Fix | Delete
function prtfl_latest_items( $atts, $count = false ) {
[1177] Fix | Delete
global $prtfl_options, $wp_query;
[1178] Fix | Delete
if ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) {
[1179] Fix | Delete
$old_wp_query = $wp_query;
[1180] Fix | Delete
$count_portfolio_row_block = 0;
[1181] Fix | Delete
if ( false === $count || empty( $count ) ) {
[1182] Fix | Delete
$custom_portfolio_row_count = $prtfl_options['custom_portfolio_row_count'];
[1183] Fix | Delete
} else {
[1184] Fix | Delete
$custom_portfolio_row_count = $count;
[1185] Fix | Delete
}
[1186] Fix | Delete
$prtfl_widht = 100 / $custom_portfolio_row_count;
[1187] Fix | Delete
[1188] Fix | Delete
if ( 1 < $custom_portfolio_row_count ) {
[1189] Fix | Delete
$prtfl_img_width = '';
[1190] Fix | Delete
} else {
[1191] Fix | Delete
$prtfl_img_width = 'style="width:165px"';
[1192] Fix | Delete
}
[1193] Fix | Delete
[1194] Fix | Delete
$content = '<div class="prtfl_portfolio_block">';
[1195] Fix | Delete
if ( empty( $atts['count'] ) ) {
[1196] Fix | Delete
$atts['count'] = 3;
[1197] Fix | Delete
}
[1198] Fix | Delete
$args = array(
[1199] Fix | Delete
'post_type' => $prtfl_options['post_type_name'],
[1200] Fix | Delete
'post_status' => 'publish',
[1201] Fix | Delete
'orderby' => 'date',
[1202] Fix | Delete
'order' => $prtfl_options['order'],
[1203] Fix | Delete
'posts_per_page' => $atts['count'],
[1204] Fix | Delete
);
[1205] Fix | Delete
$second_query = new WP_Query( $args );
[1206] Fix | Delete
$request = $second_query->request;
[1207] Fix | Delete
[1208] Fix | Delete
if ( $second_query->have_posts() ) {
[1209] Fix | Delete
while ( $second_query->have_posts() ) {
[1210] Fix | Delete
$second_query->the_post();
[1211] Fix | Delete
if ( 0 === $count_portfolio_row_block % $custom_portfolio_row_count ) {
[1212] Fix | Delete
$content .= '<div class="portfolio_row_count">';
[1213] Fix | Delete
}
[1214] Fix | Delete
$content .= '<div id="portfolio_row_count_block" class="portfolio_row_count_block" style="width: ' . $prtfl_widht . '%">
[1215] Fix | Delete
<div class="portfolio_content">
[1216] Fix | Delete
<div class="entry">';
[1217] Fix | Delete
global $post;
[1218] Fix | Delete
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
[1219] Fix | Delete
if ( empty( $post_thumbnail_id ) ) {
[1220] Fix | Delete
$args = array(
[1221] Fix | Delete
'post_parent' => $post->ID,
[1222] Fix | Delete
'post_type' => 'attachment',
[1223] Fix | Delete
'post_mime_type' => 'image',
[1224] Fix | Delete
'numberposts' => 1,
[1225] Fix | Delete
);
[1226] Fix | Delete
$attachments = get_children( $args );
[1227] Fix | Delete
$post_thumbnail_id = key( $attachments );
[1228] Fix | Delete
}
[1229] Fix | Delete
$image = wp_get_attachment_image_src( $post_thumbnail_id, $prtfl_options['image_size_album'] );
[1230] Fix | Delete
[1231] Fix | Delete
$image_alt = get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true );
[1232] Fix | Delete
$image_desc = get_post( $post_thumbnail_id );
[1233] Fix | Delete
$image_desc = $image_desc->post_content;
[1234] Fix | Delete
$post_meta = get_post_meta( $post->ID, 'prtfl_information', true );
[1235] Fix | Delete
[1236] Fix | Delete
$date_compl = isset( $post_meta['_prtfl_date_compl'] ) ? $post_meta['_prtfl_date_compl'] : '';
[1237] Fix | Delete
$link = isset( $post_meta['_prtfl_link'] ) ? $post_meta['_prtfl_link'] : '';
[1238] Fix | Delete
$short_descr = isset( $post_meta['_prtfl_short_descr'] ) ? $post_meta['_prtfl_short_descr'] : '';
[1239] Fix | Delete
if ( empty( $short_descr ) ) {
[1240] Fix | Delete
$short_descr = get_the_excerpt();
[1241] Fix | Delete
}
[1242] Fix | Delete
$title = get_the_title();
[1243] Fix | Delete
if ( empty( $title ) ) {
[1244] Fix | Delete
$title = '(' . __( 'No title', 'portfolio' ) . ')';
[1245] Fix | Delete
}
[1246] Fix | Delete
$permalink = get_permalink();
[1247] Fix | Delete
[1248] Fix | Delete
$content .= '<div class="portfolio_thumb" ' . $prtfl_img_width . '>
[1249] Fix | Delete
<img src="' . $image[0] . '" width="' . $image[1] . '" alt="' . $image_alt . '" />
[1250] Fix | Delete
</div>
[1251] Fix | Delete
<div class="portfolio_short_content">
[1252] Fix | Delete
<div class="item_title">
[1253] Fix | Delete
<p>
[1254] Fix | Delete
<a href="' . $permalink . '" rel="bookmark">' . $title . '</a>
[1255] Fix | Delete
</p>
[1256] Fix | Delete
</div> <!-- .item_title -->';
[1257] Fix | Delete
if ( 1 === absint( $prtfl_options['shrdescription_additional_field'] ) && ( ! empty( $short_descr ) ) ) {
[1258] Fix | Delete
$content .= '<p>' . $short_descr . '</p>';
[1259] Fix | Delete
}
[1260] Fix | Delete
$content .= '</div> <!-- .portfolio_short_content -->
[1261] Fix | Delete
</div> <!-- .entry -->
[1262] Fix | Delete
<div class="read_more">
[1263] Fix | Delete
<a href="' . $permalink . '" rel="bookmark">' . __( 'Read more', 'portfolio' ) . '</a>
[1264] Fix | Delete
</div> <!-- .read_more -->
[1265] Fix | Delete
<div class="portfolio_terms">';
[1266] Fix | Delete
if ( 1 === absint( $prtfl_options['technologies_additional_field'] ) ) {
[1267] Fix | Delete
$terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' );
[1268] Fix | Delete
if ( is_array( $terms ) && 0 < count( $terms ) ) {
[1269] Fix | Delete
$content .= '<b>' . __( 'Technologies', 'portfolio' ) . ':</b> ';
[1270] Fix | Delete
$count = 0;
[1271] Fix | Delete
foreach ( $terms as $term ) {
[1272] Fix | Delete
if ( $count > 0 ) {
[1273] Fix | Delete
$content .= ', ';
[1274] Fix | Delete
}
[1275] Fix | Delete
$content .= '<a href="' . get_term_link( $term->slug, 'portfolio_technologies' ) . '" title="' . sprintf( __( 'View all projects in %s' ), $term->name ) . '">' . $term->name . '</a>';
[1276] Fix | Delete
$count++;
[1277] Fix | Delete
}
[1278] Fix | Delete
} else {
[1279] Fix | Delete
$content .= '&nbsp;';
[1280] Fix | Delete
}
[1281] Fix | Delete
}
[1282] Fix | Delete
$content .= '</div><!-- .portfolio_terms -->';
[1283] Fix | Delete
$content .= '<div class="prtfl_clear"></div></div> <!-- .portfolio_content --></div><!-- .gllr_image_block -->';
[1284] Fix | Delete
if ( ( $count_portfolio_row_block % $custom_portfolio_row_count ) === ( $custom_portfolio_row_count - 1 ) ) {
[1285] Fix | Delete
$content .= '<div class="clear"></div>
[1286] Fix | Delete
</div><!-- .gllr_image_row -->';
[1287] Fix | Delete
}
[1288] Fix | Delete
$count_portfolio_row_block++;
[1289] Fix | Delete
}
[1290] Fix | Delete
}
[1291] Fix | Delete
$content .= '</div> <!-- .prtfl_portfolio_block --><div class="clear"></div>';
[1292] Fix | Delete
wp_reset_query();
[1293] Fix | Delete
$wp_query = $old_wp_query;
[1294] Fix | Delete
return $content;
[1295] Fix | Delete
}
[1296] Fix | Delete
}
[1297] Fix | Delete
}
[1298] Fix | Delete
[1299] Fix | Delete
if ( ! function_exists( 'prtfl_admin_head' ) ) {
[1300] Fix | Delete
/**
[1301] Fix | Delete
* Register style and script files
[1302] Fix | Delete
*/
[1303] Fix | Delete
function prtfl_admin_head() {
[1304] Fix | Delete
global $prtfl_plugin_info, $hook_suffix, $post_type, $prtfl_options;
[1305] Fix | Delete
[1306] Fix | Delete
if ( ! $prtfl_plugin_info ) {
[1307] Fix | Delete
if ( ! function_exists( 'get_plugin_data' ) ) {
[1308] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[1309] Fix | Delete
}
[1310] Fix | Delete
$prtfl_plugin_info = get_plugin_data( __FILE__ );
[1311] Fix | Delete
}
[1312] Fix | Delete
[1313] Fix | Delete
wp_enqueue_style( 'prtfl_icon', plugins_url( 'css/icon.css', __FILE__ ), array(), $prtfl_plugin_info['Version'] );
[1314] Fix | Delete
[1315] Fix | Delete
if ( ( ( 'post.php' === $hook_suffix || 'post-new.php' === $hook_suffix ) && isset( $post_type ) && $prtfl_options['post_type_name'] === $post_type ) ||
[1316] Fix | Delete
( isset( $_GET['page'] ) && 'portfolio.php' === $_GET['page'] ) ) {
[1317] Fix | Delete
wp_enqueue_style( 'prtfl_stylesheet', plugins_url( 'css/style.css', __FILE__ ), array(), $prtfl_plugin_info['Version'] );
[1318] Fix | Delete
wp_enqueue_style( 'prtfl_jquery-style', plugins_url( 'css/jquery-ui.css', __FILE__ ), array(), $prtfl_plugin_info['Version'] );
[1319] Fix | Delete
wp_enqueue_script( 'jquery-ui-datepicker' );
[1320] Fix | Delete
[1321] Fix | Delete
wp_enqueue_script( 'prtfl_script', plugins_url( 'js/script.js', __FILE__ ), array(), $prtfl_plugin_info['Version'], true );
[1322] Fix | Delete
wp_localize_script(
[1323] Fix | Delete
'prtfl_script',
[1324] Fix | Delete
'prtfl_vars',
[1325] Fix | Delete
array(
[1326] Fix | Delete
'prtfl_nonce' => wp_create_nonce( plugin_basename( __FILE__ ), 'prtfl_ajax_nonce_field' ),
[1327] Fix | Delete
'update_img_message' => __( 'Updating images...', 'portfolio' ) . '<img class="prtfl_loader" src="' . plugins_url( 'images/ajax-loader.gif', __FILE__ ) . '" alt="" />',
[1328] Fix | Delete
'not_found_img_info' => __( 'No image found.', 'portfolio' ),
[1329] Fix | Delete
'img_success' => __( 'All images are updated.', 'portfolio' ),
[1330] Fix | Delete
'img_error' => __(
[1331] Fix | Delete
'Error:',
[1332] Fix | Delete
'portfolio'
[1333] Fix | Delete
),
[1334] Fix | Delete
)
[1335] Fix | Delete
);
[1336] Fix | Delete
[1337] Fix | Delete
bws_enqueue_settings_scripts();
[1338] Fix | Delete
bws_plugins_include_codemirror();
[1339] Fix | Delete
}
[1340] Fix | Delete
}
[1341] Fix | Delete
}
[1342] Fix | Delete
[1343] Fix | Delete
if ( ! function_exists( 'prtfl_wp_enqueue_scripts' ) ) {
[1344] Fix | Delete
/**
[1345] Fix | Delete
* Enqueue fancybox script and style css
[1346] Fix | Delete
*/
[1347] Fix | Delete
function prtfl_wp_enqueue_scripts() {
[1348] Fix | Delete
global $prtfl_plugin_info;
[1349] Fix | Delete
[1350] Fix | Delete
if ( ! $prtfl_plugin_info ) {
[1351] Fix | Delete
if ( ! function_exists( 'get_plugin_data' ) ) {
[1352] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[1353] Fix | Delete
}
[1354] Fix | Delete
$prtfl_plugin_info = get_plugin_data( __FILE__ );
[1355] Fix | Delete
}
[1356] Fix | Delete
wp_enqueue_style( 'prtfl_stylesheet', plugins_url( 'css/style.css', __FILE__ ), array(), $prtfl_plugin_info['Version'] );
[1357] Fix | Delete
wp_enqueue_style( 'prtfl_lightbox_stylesheet', plugins_url( 'fancybox/jquery.fancybox.min.css', __FILE__ ), array(), $prtfl_plugin_info['Version'] );
[1358] Fix | Delete
}
[1359] Fix | Delete
}
[1360] Fix | Delete
[1361] Fix | Delete
if ( ! function_exists( 'prtfl_wp_head' ) ) {
[1362] Fix | Delete
/**
[1363] Fix | Delete
* Styles for IE
[1364] Fix | Delete
*/
[1365] Fix | Delete
function prtfl_wp_head() {
[1366] Fix | Delete
global $prtfl_options;
[1367] Fix | Delete
/* Add style for IE compatibility */
[1368] Fix | Delete
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && strpos( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ), 'Trident/7.0; rv:11.0' ) !== false || strpos( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ), 'MSIE' ) !== false ) {
[1369] Fix | Delete
$post_type = get_post_type();
[1370] Fix | Delete
if ( is_single() && $prtfl_options['post_type_name'] === $post_type ) {
[1371] Fix | Delete
?>
[1372] Fix | Delete
<style type="text/css">
[1373] Fix | Delete
.portfolio_images_gallery {
[1374] Fix | Delete
display: block;
[1375] Fix | Delete
}
[1376] Fix | Delete
.portfolio_thumb {
[1377] Fix | Delete
float: none;
[1378] Fix | Delete
}
[1379] Fix | Delete
</style>
[1380] Fix | Delete
<?php
[1381] Fix | Delete
}
[1382] Fix | Delete
}
[1383] Fix | Delete
}
[1384] Fix | Delete
}
[1385] Fix | Delete
[1386] Fix | Delete
if ( ! function_exists( 'prtfl_wp_footer' ) ) {
[1387] Fix | Delete
/**
[1388] Fix | Delete
* Initializing script of fancybox
[1389] Fix | Delete
*/
[1390] Fix | Delete
function prtfl_wp_footer() {
[1391] Fix | Delete
global $prtfl_options, $post, $wp_query, $prtfl_plugin_info;
[1392] Fix | Delete
[1393] Fix | Delete
if ( ! $prtfl_plugin_info ) {
[1394] Fix | Delete
if ( ! function_exists( 'get_plugin_data' ) ) {
[1395] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[1396] Fix | Delete
}
[1397] Fix | Delete
$prtfl_plugin_info = get_plugin_data( __FILE__ );
[1398] Fix | Delete
}
[1399] Fix | Delete
$post_thumbnail_id = '';
[1400] Fix | Delete
if ( ! empty( $wp_query->post->ID ) ) {
[1401] Fix | Delete
$post_thumbnail_id = get_post_thumbnail_id( $wp_query->post->ID );
[1402] Fix | Delete
}
[1403] Fix | Delete
$image = wp_get_attachment_image_src( $post_thumbnail_id, $prtfl_options['image_size_album'] );
[1404] Fix | Delete
[1405] Fix | Delete
if ( wp_script_is( 'prtfl_front_script', 'registered' ) ) {
[1406] Fix | Delete
wp_enqueue_script( 'prtfl_front_script' );
[1407] Fix | Delete
wp_enqueue_script( 'prtfl_fancyboxJs', plugins_url( 'fancybox/jquery.fancybox.min.js', __FILE__ ), array( 'jquery' ), $prtfl_plugin_info['Version'] );
[1408] Fix | Delete
[1409] Fix | Delete
/* Initialization of fancybox script */
[1410] Fix | Delete
if ( ! empty( $image[0] ) ) {
[1411] Fix | Delete
$script = "( function( $ ){
[1412] Fix | Delete
$( document ).ready( function(){
[1413] Fix | Delete
$( \"a[data-fancybox=portfolio_fancybox]\" ).fancybox({
[1414] Fix | Delete
loop : true,
[1415] Fix | Delete
arrows : false,
[1416] Fix | Delete
infobar : true,
[1417] Fix | Delete
speed : 500,
[1418] Fix | Delete
toolbar: false,
[1419] Fix | Delete
animationEffect : 'zoom',
[1420] Fix | Delete
openEffect : 'elastic',
[1421] Fix | Delete
closeEffect : 'elastic'
[1422] Fix | Delete
} );
[1423] Fix | Delete
} );
[1424] Fix | Delete
} )( jQuery );";
[1425] Fix | Delete
wp_register_script( 'prtfl_fancybox_script', '', array(), $prtfl_plugin_info['Version'] );
[1426] Fix | Delete
wp_enqueue_script( 'prtfl_fancybox_script' );
[1427] Fix | Delete
wp_add_inline_script( 'prtfl_fancybox_script', sprintf( $script ) );
[1428] Fix | Delete
}
[1429] Fix | Delete
}
[1430] Fix | Delete
[1431] Fix | Delete
}
[1432] Fix | Delete
}
[1433] Fix | Delete
[1434] Fix | Delete
if ( ! function_exists( 'prtfl_update_image' ) ) {
[1435] Fix | Delete
/**
[1436] Fix | Delete
* Ajax function for updating images
[1437] Fix | Delete
*/
[1438] Fix | Delete
function prtfl_update_image() {
[1439] Fix | Delete
global $wpdb, $prtfl_options;
[1440] Fix | Delete
check_ajax_referer( plugin_basename( __FILE__ ), 'prtfl_ajax_nonce_field' );
[1441] Fix | Delete
$action = isset( $_REQUEST['action1'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['action1'] ) ) : '';
[1442] Fix | Delete
$id = isset( $_REQUEST['id'] ) ? absint( $_REQUEST['id'] ) : '';
[1443] Fix | Delete
switch ( $action ) {
[1444] Fix | Delete
case 'get_all_attachment':
[1445] Fix | Delete
$array_parent_id = $wpdb->get_col(
[1446] Fix | Delete
$wpdb->prepare(
[1447] Fix | Delete
'SELECT ID
[1448] Fix | Delete
FROM ' . $wpdb->posts . '
[1449] Fix | Delete
WHERE post_type = %s',
[1450] Fix | Delete
$prtfl_options['post_type_name']
[1451] Fix | Delete
)
[1452] Fix | Delete
);
[1453] Fix | Delete
[1454] Fix | Delete
if ( ! empty( $array_parent_id ) ) {
[1455] Fix | Delete
$parent_id_placeholders = implode( ', ', array_fill( 0, count( (array) $array_parent_id ), '%d' ) );
[1456] Fix | Delete
[1457] Fix | Delete
$metas = $wpdb->get_results(
[1458] Fix | Delete
$wpdb->prepare(
[1459] Fix | Delete
'SELECT meta_value
[1460] Fix | Delete
FROM ' . $wpdb->postmeta . '
[1461] Fix | Delete
WHERE meta_key = %s
[1462] Fix | Delete
AND post_id IN (' . $parent_id_placeholders . ')',
[1463] Fix | Delete
'_prtfl_images',
[1464] Fix | Delete
$array_parent_id
[1465] Fix | Delete
),
[1466] Fix | Delete
ARRAY_A
[1467] Fix | Delete
);
[1468] Fix | Delete
[1469] Fix | Delete
$result_attachment_id = '';
[1470] Fix | Delete
foreach ( $metas as $key => $value ) {
[1471] Fix | Delete
if ( ! empty( $value['meta_value'] ) ) {
[1472] Fix | Delete
$result_attachment_id .= $value['meta_value'] . ',';
[1473] Fix | Delete
}
[1474] Fix | Delete
}
[1475] Fix | Delete
$result_attachment_id_array = explode( ',', rtrim( $result_attachment_id, ',' ) );
[1476] Fix | Delete
[1477] Fix | Delete
$attached_id = $wpdb->get_results(
[1478] Fix | Delete
$wpdb->prepare(
[1479] Fix | Delete
'SELECT ID
[1480] Fix | Delete
FROM ' . $wpdb->posts . '
[1481] Fix | Delete
WHERE post_type = %s
[1482] Fix | Delete
AND post_mime_type LIKE %s
[1483] Fix | Delete
AND post_parent IN (' . $parent_id_placeholders . ')',
[1484] Fix | Delete
'attachment',
[1485] Fix | Delete
'image%',
[1486] Fix | Delete
$array_parent_id
[1487] Fix | Delete
),
[1488] Fix | Delete
ARRAY_A
[1489] Fix | Delete
);
[1490] Fix | Delete
[1491] Fix | Delete
foreach ( $attached_id as $key => $value ) {
[1492] Fix | Delete
$result_attachment_id_array[] = $value['ID'];
[1493] Fix | Delete
}
[1494] Fix | Delete
echo wp_json_encode( array_unique( $result_attachment_id_array ) );
[1495] Fix | Delete
}
[1496] Fix | Delete
break;
[1497] Fix | Delete
case 'update_image':
[1498] Fix | Delete
$metadata = wp_get_attachment_metadata( $id );
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function