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
$uploads = wp_upload_dir();
[1500] Fix | Delete
$path = $uploads['basedir'] . '/' . $metadata['file'];
[1501] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/image.php';
[1502] Fix | Delete
$metadata_new = prtfl_wp_generate_attachment_metadata( $id, $path, $metadata );
[1503] Fix | Delete
wp_update_attachment_metadata( $id, array_merge( $metadata, $metadata_new ) );
[1504] Fix | Delete
break;
[1505] Fix | Delete
case 'update_options':
[1506] Fix | Delete
unset( $prtfl_options['need_image_update'] );
[1507] Fix | Delete
update_option( 'prtfl_options', $prtfl_options );
[1508] Fix | Delete
break;
[1509] Fix | Delete
}
[1510] Fix | Delete
die();
[1511] Fix | Delete
}
[1512] Fix | Delete
}
[1513] Fix | Delete
[1514] Fix | Delete
if ( ! function_exists( 'prtfl_wp_generate_attachment_metadata' ) ) {
[1515] Fix | Delete
/**
[1516] Fix | Delete
* Add attachment metadata for portfolio images
[1517] Fix | Delete
*
[1518] Fix | Delete
* @param int $attachment_id Attachment ID.
[1519] Fix | Delete
* @param string $file File string.
[1520] Fix | Delete
* @param array $metadata Array with metadata.
[1521] Fix | Delete
*/
[1522] Fix | Delete
function prtfl_wp_generate_attachment_metadata( $attachment_id, $file, $metadata ) {
[1523] Fix | Delete
global $prtfl_options;
[1524] Fix | Delete
$attachment = get_post( $attachment_id );
[1525] Fix | Delete
$image_size = array( 'thumbnail' );
[1526] Fix | Delete
[1527] Fix | Delete
if ( 'portfolio-thumb' === $prtfl_options['image_size_album'] ) {
[1528] Fix | Delete
add_image_size( 'portfolio-thumb', $prtfl_options['custom_size_px']['portfolio-thumb'][0], $prtfl_options['custom_size_px']['portfolio-thumb'][1], true );
[1529] Fix | Delete
$image_size[] = 'portfolio-thumb';
[1530] Fix | Delete
}
[1531] Fix | Delete
if ( 'portfolio-photo-thumb' === $prtfl_options['image_size_photo'] ) {
[1532] Fix | Delete
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 );
[1533] Fix | Delete
$image_size[] = 'portfolio-photo-thumb';
[1534] Fix | Delete
}
[1535] Fix | Delete
[1536] Fix | Delete
$metadata = array();
[1537] Fix | Delete
if ( preg_match( '!^image/!', get_post_mime_type( $attachment ) ) && file_is_displayable_image( $file ) ) {
[1538] Fix | Delete
$imagesize = getimagesize( $file );
[1539] Fix | Delete
$metadata['width'] = $imagesize[0];
[1540] Fix | Delete
$metadata['height'] = $imagesize[1];
[1541] Fix | Delete
list( $uwidth, $uheight ) = wp_constrain_dimensions( $metadata['width'], $metadata['height'], 128, 96 );
[1542] Fix | Delete
$metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
[1543] Fix | Delete
[1544] Fix | Delete
/* Make the file path relative to the upload dir */
[1545] Fix | Delete
$metadata['file'] = _wp_relative_upload_path( $file );
[1546] Fix | Delete
[1547] Fix | Delete
/* Make thumbnails and other intermediate sizes */
[1548] Fix | Delete
global $_wp_additional_image_sizes;
[1549] Fix | Delete
[1550] Fix | Delete
foreach ( $image_size as $s ) {
[1551] Fix | Delete
$sizes[ $s ] = array(
[1552] Fix | Delete
'width' => '',
[1553] Fix | Delete
'height' => '',
[1554] Fix | Delete
'crop' => false,
[1555] Fix | Delete
);
[1556] Fix | Delete
if ( isset( $_wp_additional_image_sizes[ $s ]['width'] ) ) {
[1557] Fix | Delete
$sizes[ $s ]['width'] = intval( $_wp_additional_image_sizes[ $s ]['width'] ); /* For theme-added sizes */
[1558] Fix | Delete
} else {
[1559] Fix | Delete
$sizes[ $s ]['width'] = get_option( "{$s}_size_w" ); /* For default sizes set in options */
[1560] Fix | Delete
}
[1561] Fix | Delete
if ( isset( $_wp_additional_image_sizes[ $s ]['height'] ) ) {
[1562] Fix | Delete
$sizes[ $s ]['height'] = intval( $_wp_additional_image_sizes[ $s ]['height'] ); /* For theme-added sizes */
[1563] Fix | Delete
} else {
[1564] Fix | Delete
$sizes[ $s ]['height'] = get_option( "{$s}_size_h" ); /* For default sizes set in options */
[1565] Fix | Delete
}
[1566] Fix | Delete
if ( isset( $_wp_additional_image_sizes[ $s ]['crop'] ) ) {
[1567] Fix | Delete
$sizes[ $s ]['crop'] = intval( $_wp_additional_image_sizes[ $s ]['crop'] ); /* For theme-added sizes */
[1568] Fix | Delete
} else {
[1569] Fix | Delete
$sizes[ $s ]['crop'] = get_option( "{$s}_crop" ); /* For default sizes set in options */
[1570] Fix | Delete
}
[1571] Fix | Delete
}
[1572] Fix | Delete
[1573] Fix | Delete
$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );
[1574] Fix | Delete
foreach ( $sizes as $size => $size_data ) {
[1575] Fix | Delete
$resized = prtfl_image_make_intermediate_size( $file, $size_data['width'], $size_data['height'], $size_data['crop'] );
[1576] Fix | Delete
if ( $resized ) {
[1577] Fix | Delete
$metadata['sizes'][ $size ] = $resized;
[1578] Fix | Delete
}
[1579] Fix | Delete
}
[1580] Fix | Delete
[1581] Fix | Delete
/* Fetch additional metadata from exif/iptc */
[1582] Fix | Delete
$image_meta = wp_read_image_metadata( $file );
[1583] Fix | Delete
if ( $image_meta ) {
[1584] Fix | Delete
$metadata['image_meta'] = $image_meta;
[1585] Fix | Delete
}
[1586] Fix | Delete
}
[1587] Fix | Delete
return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id );
[1588] Fix | Delete
}
[1589] Fix | Delete
}
[1590] Fix | Delete
[1591] Fix | Delete
if ( ! function_exists( 'prtfl_image_make_intermediate_size' ) ) {
[1592] Fix | Delete
/**
[1593] Fix | Delete
* Change size for attachment
[1594] Fix | Delete
*
[1595] Fix | Delete
* @param string $file File string.
[1596] Fix | Delete
* @param int $width Width for attachment.
[1597] Fix | Delete
* @param int $height Height for attachment.
[1598] Fix | Delete
* @param bool $crop Flag for crop.
[1599] Fix | Delete
*/
[1600] Fix | Delete
function prtfl_image_make_intermediate_size( $file, $width, $height, $crop = false ) {
[1601] Fix | Delete
if ( $width || $height ) {
[1602] Fix | Delete
$resized_file = prtfl_image_resize( $file, $width, $height, $crop );
[1603] Fix | Delete
if ( ! is_wp_error( $resized_file ) && $resized_file ) {
[1604] Fix | Delete
$info = getimagesize( $resized_file );
[1605] Fix | Delete
if ( ! empty( $info ) ) {
[1606] Fix | Delete
$resized_file = apply_filters( 'image_make_intermediate_size', $resized_file );
[1607] Fix | Delete
return array(
[1608] Fix | Delete
'file' => wp_basename( $resized_file ),
[1609] Fix | Delete
'width' => $info[0],
[1610] Fix | Delete
'height' => $info[1],
[1611] Fix | Delete
);
[1612] Fix | Delete
}
[1613] Fix | Delete
}
[1614] Fix | Delete
}
[1615] Fix | Delete
return false;
[1616] Fix | Delete
}
[1617] Fix | Delete
}
[1618] Fix | Delete
[1619] Fix | Delete
if ( ! function_exists( 'prtfl_image_resize' ) ) {
[1620] Fix | Delete
/**
[1621] Fix | Delete
* Resize for attachment
[1622] Fix | Delete
*
[1623] Fix | Delete
* @param string $file File string.
[1624] Fix | Delete
* @param int $max_w Max width for attachment.
[1625] Fix | Delete
* @param int $max_h Max height for attachment.
[1626] Fix | Delete
* @param bool $crop Flag for crop.
[1627] Fix | Delete
* @param string $suffix Suffix for file name.
[1628] Fix | Delete
* @param string $dest_path Destination path.
[1629] Fix | Delete
* @param int $jpeg_quality Quality for attachment.
[1630] Fix | Delete
*/
[1631] Fix | Delete
function prtfl_image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
[1632] Fix | Delete
$size = @getimagesize( $file );
[1633] Fix | Delete
if ( ! $size ) {
[1634] Fix | Delete
return new WP_Error( 'invalid_image', __( 'Image size not defined', 'portfolio' ), $file );
[1635] Fix | Delete
}
[1636] Fix | Delete
$type = $size[2];
[1637] Fix | Delete
[1638] Fix | Delete
if ( 3 === $type ) {
[1639] Fix | Delete
$image = imagecreatefrompng( $file );
[1640] Fix | Delete
} elseif ( 2 === $type ) {
[1641] Fix | Delete
$image = imagecreatefromjpeg( $file );
[1642] Fix | Delete
} elseif ( 1 === $type ) {
[1643] Fix | Delete
$image = imagecreatefromgif( $file );
[1644] Fix | Delete
} elseif ( 15 === $type ) {
[1645] Fix | Delete
$image = imagecreatefromwbmp( $file );
[1646] Fix | Delete
} elseif ( 16 === $type ) {
[1647] Fix | Delete
$image = imagecreatefromxbm( $file );
[1648] Fix | Delete
} else {
[1649] Fix | Delete
return new WP_Error( 'invalid_image', __( 'We can update only PNG, JPEG, GIF, WPMP or XBM filetype. For other image formats, please manually reload image.', 'portfolio' ), $file );
[1650] Fix | Delete
}
[1651] Fix | Delete
if ( ! is_resource( $image ) ) {
[1652] Fix | Delete
return new WP_Error( 'error_loading_image', $image, $file );
[1653] Fix | Delete
}
[1654] Fix | Delete
/* $size = @getimagesize( $file ); */
[1655] Fix | Delete
list( $orig_w, $orig_h, $orig_type ) = $size;
[1656] Fix | Delete
$dims = prtfl_image_resize_dimensions( $orig_w, $orig_h, $max_w, $max_h, $crop );
[1657] Fix | Delete
[1658] Fix | Delete
if ( ! $dims ) {
[1659] Fix | Delete
return new WP_Error( 'error_getting_dimensions', __( 'Image size changes not defined', 'portfolio' ) );
[1660] Fix | Delete
}
[1661] Fix | Delete
list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims;
[1662] Fix | Delete
$newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );
[1663] Fix | Delete
imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
[1664] Fix | Delete
/* Convert from full colors to index colors, like original PNG. */
[1665] Fix | Delete
if ( IMAGETYPE_PNG === $orig_type && function_exists( 'imageistruecolor' ) && ! imageistruecolor( $image ) ) {
[1666] Fix | Delete
imagetruecolortopalette( $newimage, false, imagecolorstotal( $image ) );
[1667] Fix | Delete
}
[1668] Fix | Delete
/* We don't need the original in memory anymore */
[1669] Fix | Delete
imagedestroy( $image );
[1670] Fix | Delete
[1671] Fix | Delete
/* $suffix will be appended to the destination filename, just before the extension */
[1672] Fix | Delete
if ( ! $suffix ) {
[1673] Fix | Delete
$suffix = "{$dst_w}x{$dst_h}";
[1674] Fix | Delete
}
[1675] Fix | Delete
$info = pathinfo( $file );
[1676] Fix | Delete
$dir = $info['dirname'];
[1677] Fix | Delete
$ext = $info['extension'];
[1678] Fix | Delete
$name = wp_basename( $file, ".$ext" );
[1679] Fix | Delete
[1680] Fix | Delete
if ( ! is_null( $dest_path ) ) {
[1681] Fix | Delete
$_dest_path = realpath( $dest_path );
[1682] Fix | Delete
if ( $_dest_path ) {
[1683] Fix | Delete
$dir = $_dest_path;
[1684] Fix | Delete
}
[1685] Fix | Delete
}
[1686] Fix | Delete
$destfilename = "{$dir}/{$name}-{$suffix}.{$ext}";
[1687] Fix | Delete
[1688] Fix | Delete
if ( IMAGETYPE_GIF === $orig_type ) {
[1689] Fix | Delete
if ( ! imagegif( $newimage, $destfilename ) ) {
[1690] Fix | Delete
return new WP_Error( 'resize_path_invalid', __( 'Invalid path', 'portfolio' ) );
[1691] Fix | Delete
}
[1692] Fix | Delete
} elseif ( IMAGETYPE_PNG === $orig_type ) {
[1693] Fix | Delete
if ( ! imagepng( $newimage, $destfilename ) ) {
[1694] Fix | Delete
return new WP_Error( 'resize_path_invalid', __( 'Invalid path', 'portfolio' ) );
[1695] Fix | Delete
}
[1696] Fix | Delete
} else {
[1697] Fix | Delete
/* All other formats are converted to jpg */
[1698] Fix | Delete
$destfilename = "{$dir}/{$name}-{$suffix}.jpg";
[1699] Fix | Delete
if ( ! imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) ) {
[1700] Fix | Delete
return new WP_Error( 'resize_path_invalid', __( 'Invalid path', 'portfolio' ) );
[1701] Fix | Delete
}
[1702] Fix | Delete
}
[1703] Fix | Delete
[1704] Fix | Delete
imagedestroy( $newimage );
[1705] Fix | Delete
/* Set correct file permissions */
[1706] Fix | Delete
$stat = stat( dirname( $destfilename ) );
[1707] Fix | Delete
$perms = $stat['mode'] & 0000666; /* Same permissions as parent folder, strip off the executable bits */
[1708] Fix | Delete
@chmod( $destfilename, $perms );
[1709] Fix | Delete
return $destfilename;
[1710] Fix | Delete
}
[1711] Fix | Delete
}
[1712] Fix | Delete
[1713] Fix | Delete
if ( ! function_exists( 'prtfl_image_resize_dimensions' ) ) {
[1714] Fix | Delete
/**
[1715] Fix | Delete
* Resize dimensions for attachment
[1716] Fix | Delete
*
[1717] Fix | Delete
* @param int $orig_w Original width for attachment.
[1718] Fix | Delete
* @param int $orig_h Original height for attachment.
[1719] Fix | Delete
* @param int $dest_w New width for attachment.
[1720] Fix | Delete
* @param int $dest_h New height for attachment.
[1721] Fix | Delete
* @param bool $crop Flag for crop.
[1722] Fix | Delete
*/
[1723] Fix | Delete
function prtfl_image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) {
[1724] Fix | Delete
[1725] Fix | Delete
if ( 0 >= $orig_w || 0 >= $orig_h ) {
[1726] Fix | Delete
return false;
[1727] Fix | Delete
}
[1728] Fix | Delete
/* At least one of dest_w or dest_h must be specific */
[1729] Fix | Delete
if ( 0 >= $dest_w && 0 >= $dest_h ) {
[1730] Fix | Delete
return false;
[1731] Fix | Delete
}
[1732] Fix | Delete
[1733] Fix | Delete
if ( $crop ) {
[1734] Fix | Delete
/* Crop the largest possible portion of the original image that we can size to $dest_w x $dest_h */
[1735] Fix | Delete
$aspect_ratio = $orig_w / $orig_h;
[1736] Fix | Delete
$new_w = min( $dest_w, $orig_w );
[1737] Fix | Delete
$new_h = min( $dest_h, $orig_h );
[1738] Fix | Delete
[1739] Fix | Delete
if ( ! $new_w ) {
[1740] Fix | Delete
$new_w = intval( $new_h * $aspect_ratio );
[1741] Fix | Delete
}
[1742] Fix | Delete
[1743] Fix | Delete
if ( ! $new_h ) {
[1744] Fix | Delete
$new_h = intval( $new_w / $aspect_ratio );
[1745] Fix | Delete
}
[1746] Fix | Delete
[1747] Fix | Delete
$size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
[1748] Fix | Delete
$crop_w = round( $new_w / $size_ratio );
[1749] Fix | Delete
$crop_h = round( $new_h / $size_ratio );
[1750] Fix | Delete
$s_x = floor( ( $orig_w - $crop_w ) / 2 );
[1751] Fix | Delete
$s_y = 0;
[1752] Fix | Delete
} else {
[1753] Fix | Delete
/* Don't crop, just resize using $dest_w x $dest_h as a maximum bounding box */
[1754] Fix | Delete
$crop_w = $orig_w;
[1755] Fix | Delete
$crop_h = $orig_h;
[1756] Fix | Delete
$s_x = 0;
[1757] Fix | Delete
$s_y = 0;
[1758] Fix | Delete
list( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h );
[1759] Fix | Delete
}
[1760] Fix | Delete
[1761] Fix | Delete
/* If the resulting image would be the same size or larger we don't want to resize it */
[1762] Fix | Delete
if ( $new_w >= $orig_w && $new_h >= $orig_h ) {
[1763] Fix | Delete
return false;
[1764] Fix | Delete
}
[1765] Fix | Delete
/**
[1766] Fix | Delete
* The return array matches the parameters to imagecopyresampled()
[1767] Fix | Delete
* Int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h
[1768] Fix | Delete
*/
[1769] Fix | Delete
return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
[1770] Fix | Delete
}
[1771] Fix | Delete
}
[1772] Fix | Delete
[1773] Fix | Delete
if ( ! function_exists( 'prtfl_theme_body_classes' ) ) {
[1774] Fix | Delete
/**
[1775] Fix | Delete
* Add class for body
[1776] Fix | Delete
*
[1777] Fix | Delete
* @param array $classes Classes array.
[1778] Fix | Delete
*/
[1779] Fix | Delete
function prtfl_theme_body_classes( $classes ) {
[1780] Fix | Delete
global $prtfl_options;
[1781] Fix | Delete
if ( function_exists( 'wp_get_theme' ) ) {
[1782] Fix | Delete
$current_theme = wp_get_theme();
[1783] Fix | Delete
$classes[] = 'prtfl_' . basename( $current_theme->get( 'ThemeURI' ) );
[1784] Fix | Delete
}
[1785] Fix | Delete
if ( in_array( 'page-id-' . $prtfl_options['page_id_portfolio_template'], $classes ) ) {
[1786] Fix | Delete
$classes[] = 'prtfl-page-template';
[1787] Fix | Delete
$classes[] = 'has-sidebar';
[1788] Fix | Delete
}
[1789] Fix | Delete
return $classes;
[1790] Fix | Delete
}
[1791] Fix | Delete
}
[1792] Fix | Delete
[1793] Fix | Delete
if ( ! function_exists( 'prtfl_register_plugin_links' ) ) {
[1794] Fix | Delete
/**
[1795] Fix | Delete
* Add Settings and Support links
[1796] Fix | Delete
*
[1797] Fix | Delete
* @param array $links Action link array.
[1798] Fix | Delete
* @param file $file Plugin file.
[1799] Fix | Delete
* @return array $links Returned link array.
[1800] Fix | Delete
*/
[1801] Fix | Delete
function prtfl_register_plugin_links( $links, $file ) {
[1802] Fix | Delete
global $prtfl_options;
[1803] Fix | Delete
$base = plugin_basename( __FILE__ );
[1804] Fix | Delete
if ( $file === $base ) {
[1805] Fix | Delete
if ( ! is_network_admin() ) {
[1806] Fix | Delete
$links[] = '<a href="edit.php?post_type=' . $prtfl_options['post_type_name'] . '&page=portfolio.php">' . __( 'Settings', 'portfolio' ) . '</a>';
[1807] Fix | Delete
}
[1808] Fix | Delete
$links[] = '<a href="https://support.bestwebsoft.com/hc/en-us/sections/200538929" target="_blank">' . __( 'FAQ', 'portfolio' ) . '</a>';
[1809] Fix | Delete
$links[] = '<a href="https://support.bestwebsoft.com">' . __( 'Support', 'portfolio' ) . '</a>';
[1810] Fix | Delete
}
[1811] Fix | Delete
return $links;
[1812] Fix | Delete
}
[1813] Fix | Delete
}
[1814] Fix | Delete
[1815] Fix | Delete
if ( ! function_exists( 'prtfl_plugin_action_links' ) ) {
[1816] Fix | Delete
/**
[1817] Fix | Delete
* Add action links
[1818] Fix | Delete
*
[1819] Fix | Delete
* @param array $links Action link array.
[1820] Fix | Delete
* @param file $file Plugin file.
[1821] Fix | Delete
* @return array $links Returned link array.
[1822] Fix | Delete
*/
[1823] Fix | Delete
function prtfl_plugin_action_links( $links, $file ) {
[1824] Fix | Delete
if ( ! is_network_admin() ) {
[1825] Fix | Delete
/* Static so we don't call plugin_basename on every plugin row. */
[1826] Fix | Delete
static $this_plugin;
[1827] Fix | Delete
if ( ! $this_plugin ) {
[1828] Fix | Delete
$this_plugin = plugin_basename( __FILE__ );
[1829] Fix | Delete
}
[1830] Fix | Delete
[1831] Fix | Delete
if ( $file === $this_plugin ) {
[1832] Fix | Delete
global $prtfl_options;
[1833] Fix | Delete
$settings_link = '<a href="edit.php?post_type=' . $prtfl_options['post_type_name'] . '&page=portfolio.php">' . __( 'Settings', 'portfolio' ) . '</a>';
[1834] Fix | Delete
array_unshift( $links, $settings_link );
[1835] Fix | Delete
}
[1836] Fix | Delete
}
[1837] Fix | Delete
return $links;
[1838] Fix | Delete
}
[1839] Fix | Delete
}
[1840] Fix | Delete
[1841] Fix | Delete
if ( ! function_exists( 'prtfl_admin_notices' ) ) {
[1842] Fix | Delete
/**
[1843] Fix | Delete
* Display notice in the main dashboard page / plugins page
[1844] Fix | Delete
*/
[1845] Fix | Delete
function prtfl_admin_notices() {
[1846] Fix | Delete
global $hook_suffix, $prtfl_plugin_info, $prtfl_options, $prtfl_bws_demo_data;
[1847] Fix | Delete
[1848] Fix | Delete
if ( 'plugins.php' === $hook_suffix || ( isset( $_GET['page'] ) && 'portfolio.php' === $_GET['page'] ) ) {
[1849] Fix | Delete
[1850] Fix | Delete
if ( ! $prtfl_bws_demo_data ) {
[1851] Fix | Delete
prtfl_include_demo_data();
[1852] Fix | Delete
}
[1853] Fix | Delete
[1854] Fix | Delete
if ( isset( $_GET['page'] ) && 'portfolio.php' === $_GET['page'] ) {
[1855] Fix | Delete
$prtfl_bws_demo_data->bws_handle_demo_notice( $prtfl_options['display_demo_notice'] );
[1856] Fix | Delete
}
[1857] Fix | Delete
[1858] Fix | Delete
if ( 'plugins.php' === $hook_suffix ) {
[1859] Fix | Delete
if ( ! is_network_admin() ) {
[1860] Fix | Delete
bws_plugin_banner_to_settings( $prtfl_plugin_info, 'prtfl_options', 'portfolio', 'edit.php?post_type=portfolio&page=portfolio.php', 'Portfolio' );
[1861] Fix | Delete
}
[1862] Fix | Delete
if ( 0 === absint( $prtfl_options['widget_updated'] ) ) {
[1863] Fix | Delete
/* Save data for settings page */
[1864] Fix | Delete
if ( isset( $_REQUEST['prtfl_form_submit'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'prtfl_nonce_name' ) ) {
[1865] Fix | Delete
$prtfl_options['widget_updated'] = 1;
[1866] Fix | Delete
update_option( 'prtfl_options', $prtfl_options );
[1867] Fix | Delete
} else {
[1868] Fix | Delete
?>
[1869] Fix | Delete
<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
[1870] Fix | Delete
<div class="prtfl_admin_notices bws_banner_on_plugin_page">
[1871] Fix | Delete
<form method="post" action="<?php echo esc_attr( $hook_suffix ); ?>">
[1872] Fix | Delete
<div class="text">
[1873] Fix | Delete
<p>
[1874] Fix | Delete
<strong><?php esc_html_e( 'ATTENTION!', 'portfolio' ); ?></strong>
[1875] Fix | Delete
<?php esc_html_e( 'In the current version of Portfolio plugin we updated the Technologies widget. If it was added to the sidebar, it will disappear and you will have to add it again.', 'portfolio' ); ?>
[1876] Fix | Delete
</p>
[1877] Fix | Delete
<input type="hidden" name="prtfl_form_submit" value="submit" />
[1878] Fix | Delete
<p class="submit">
[1879] Fix | Delete
<input type="submit" class="button-primary" value="<?php esc_html_e( 'Read and Understood', 'portfolio' ); ?>" />
[1880] Fix | Delete
</p>
[1881] Fix | Delete
<?php wp_nonce_field( plugin_basename( __FILE__ ), 'prtfl_nonce_name' ); ?>
[1882] Fix | Delete
</div>
[1883] Fix | Delete
</form>
[1884] Fix | Delete
</div>
[1885] Fix | Delete
</div>
[1886] Fix | Delete
<?php
[1887] Fix | Delete
}
[1888] Fix | Delete
}
[1889] Fix | Delete
} else {
[1890] Fix | Delete
bws_plugin_suggest_feature_banner( $prtfl_plugin_info, 'prtfl_options', 'portfolio' );
[1891] Fix | Delete
}
[1892] Fix | Delete
}
[1893] Fix | Delete
}
[1894] Fix | Delete
}
[1895] Fix | Delete
[1896] Fix | Delete
if ( ! function_exists( 'prtfl_template_title' ) ) {
[1897] Fix | Delete
/**
[1898] Fix | Delete
* This function will display title for portfolio type template
[1899] Fix | Delete
*/
[1900] Fix | Delete
function prtfl_template_title() {
[1901] Fix | Delete
global $wp_query, $prtfl_options;
[1902] Fix | Delete
[1903] Fix | Delete
if ( isset( $wp_query->query_vars['technologies'] ) ) {
[1904] Fix | Delete
$term = get_term_by( 'slug', $wp_query->query_vars['technologies'], 'portfolio_technologies' );
[1905] Fix | Delete
echo esc_html( $prtfl_options['technologies_text_field'] . ' ' . $term->name );
[1906] Fix | Delete
} elseif ( isset( $wp_query->query_vars['portfolio_executor_profile'] ) ) {
[1907] Fix | Delete
$term = get_term_by( 'slug', $wp_query->query_vars['portfolio_executor_profile'], 'portfolio_executor_profile' );
[1908] Fix | Delete
echo esc_html( $prtfl_options['executor_text_field'] ) . ' <h1>' . esc_html( $term->name ) . '</h1>';
[1909] Fix | Delete
$_SESSION['prtfl_page_name'] = $prtfl_options['executor_text_field'] . ' ' . $term->name;
[1910] Fix | Delete
$_SESSION['prtfl_page_url'] = get_pagenum_link( $wp_query->query_vars['paged'] );
[1911] Fix | Delete
} else {
[1912] Fix | Delete
the_title( '<h1>', '</h1>' );
[1913] Fix | Delete
}
[1914] Fix | Delete
}
[1915] Fix | Delete
}
[1916] Fix | Delete
[1917] Fix | Delete
if ( ! function_exists( 'prtfl_post_template_title' ) ) {
[1918] Fix | Delete
/**
[1919] Fix | Delete
* This function will display title for portfolio post type template
[1920] Fix | Delete
*/
[1921] Fix | Delete
function prtfl_post_template_title() {
[1922] Fix | Delete
$title = get_the_title();
[1923] Fix | Delete
echo empty( $title ) ? '(' . esc_html__( 'No title', 'portfolio' ) . ')' : '<h1>' . esc_html( $title ) . '</h1>';
[1924] Fix | Delete
}
[1925] Fix | Delete
}
[1926] Fix | Delete
[1927] Fix | Delete
if ( ! function_exists( 'prtfl_get_query_args' ) ) {
[1928] Fix | Delete
/**
[1929] Fix | Delete
* Prepare arguments for post query
[1930] Fix | Delete
*
[1931] Fix | Delete
* @return array|false
[1932] Fix | Delete
*/
[1933] Fix | Delete
function prtfl_get_query_args() {
[1934] Fix | Delete
global $prtfl_options, $wp_query;
[1935] Fix | Delete
$count = 0;
[1936] Fix | Delete
if ( get_query_var( 'paged' ) ) {
[1937] Fix | Delete
$paged = get_query_var( 'paged' );
[1938] Fix | Delete
} elseif ( get_query_var( 'page' ) ) {
[1939] Fix | Delete
$paged = get_query_var( 'page' );
[1940] Fix | Delete
} else {
[1941] Fix | Delete
$paged = 1;
[1942] Fix | Delete
}
[1943] Fix | Delete
$per_page = get_option( 'posts_per_page' );
[1944] Fix | Delete
$showitems = $per_page;
[1945] Fix | Delete
[1946] Fix | Delete
if ( ! empty( $wp_query->query_vars['technologies'] ) ) {
[1947] Fix | Delete
$args = array(
[1948] Fix | Delete
'post_type' => $prtfl_options['post_type_name'],
[1949] Fix | Delete
'post_status' => 'publish',
[1950] Fix | Delete
'orderby' => $prtfl_options['order_by'],
[1951] Fix | Delete
'order' => $prtfl_options['order'],
[1952] Fix | Delete
'posts_per_page' => $per_page,
[1953] Fix | Delete
'paged' => $paged,
[1954] Fix | Delete
'tax_query' => array(
[1955] Fix | Delete
array(
[1956] Fix | Delete
'taxonomy' => 'portfolio_technologies',
[1957] Fix | Delete
'field' => 'slug',
[1958] Fix | Delete
'terms' => $wp_query->query_vars['technologies'],
[1959] Fix | Delete
),
[1960] Fix | Delete
),
[1961] Fix | Delete
);
[1962] Fix | Delete
} elseif ( ! empty( $wp_query->query_vars['portfolio_executor_profile'] ) ) {
[1963] Fix | Delete
$args = array(
[1964] Fix | Delete
'post_type' => $prtfl_options['post_type_name'],
[1965] Fix | Delete
'post_status' => 'publish',
[1966] Fix | Delete
'orderby' => $prtfl_options['order_by'],
[1967] Fix | Delete
'order' => $prtfl_options['order'],
[1968] Fix | Delete
'posts_per_page' => $per_page,
[1969] Fix | Delete
'paged' => $paged,
[1970] Fix | Delete
'tax_query' => array(
[1971] Fix | Delete
array(
[1972] Fix | Delete
'taxonomy' => 'portfolio_executor_profile',
[1973] Fix | Delete
'field' => 'slug',
[1974] Fix | Delete
'terms' => $wp_query->query_vars['portfolio_executor_profile'],
[1975] Fix | Delete
),
[1976] Fix | Delete
),
[1977] Fix | Delete
);
[1978] Fix | Delete
} else {
[1979] Fix | Delete
$args = array(
[1980] Fix | Delete
'post_type' => $prtfl_options['post_type_name'],
[1981] Fix | Delete
'post_status' => 'publish',
[1982] Fix | Delete
'orderby' => $prtfl_options['order_by'],
[1983] Fix | Delete
'order' => $prtfl_options['order'],
[1984] Fix | Delete
'posts_per_page' => $per_page,
[1985] Fix | Delete
'paged' => $paged,
[1986] Fix | Delete
);
[1987] Fix | Delete
}
[1988] Fix | Delete
[1989] Fix | Delete
if ( isset( $args ) ) {
[1990] Fix | Delete
return $args;
[1991] Fix | Delete
} else {
[1992] Fix | Delete
return false;
[1993] Fix | Delete
}
[1994] Fix | Delete
}
[1995] Fix | Delete
}
[1996] Fix | Delete
[1997] Fix | Delete
if ( ! function_exists( 'prtfl_get_content' ) ) {
[1998] Fix | Delete
/**
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function