Plugin Directory

Changeset 1664483


Ignore:
Timestamp:
05/25/2017 04:57:37 AM (9 years ago)
Author:
nikitanovikov
Message:

Release 1.42.2

Location:
wp-portfolio
Files:
60 added
2 edited

Legend:

Unmodified
Added
Removed
  • wp-portfolio/trunk/readme.txt

    r1661269 r1664483  
    44Requires at least: 4.3.0
    55Tested up to: 4.7.4
    6 Stable tag: 1.42.1
     6Stable tag: 1.42.2
    77
    88   
     
    9393== Changelog ==
    9494
     95= 1.42.2 =
     96* BUG FIX: SQL error when portfolio shortcode embedded in widget using random sort AND having listings that exist in multiple groups (output only contains these sites once; not repeated)
     97
    9598= 1.42.1 =
    9699* BUG FIX: Needed to show Custom Thumbnail Scaling options regardless of "STW Rendering Type"
     
    98101* BUG FIX: Double slash after "cache" in the path to the file from the cache
    99102* BUG FIX: Incorrect use of the "Custom Thumbnail Scale Method" option value when generating a file name in the cache
     103* New Feature: More support for create/delete custom directory pages for "Directory Support"
     104* NOTE: Change in behavior for new installs ("Directory Support" output of custom directory pages is DISABLED, by default, now)
    100105
    101106= 1.42 =
  • wp-portfolio/trunk/wp-portfolio.php

    r1660775 r1664483  
    44 * Plugin URI: http://wordpress.org/extend/plugins/wp-portfolio/
    55 * Description: A plugin that allows you to show off your portfolio through a single page on your WordPress website with automatically generated thumbnails. To show your portfolio, create a new page and paste [wp-portfolio] into it. The plugin requires you to have a free account with <a href="https://shrinktheweb.com/">Shrink The Web</a> to generate the thumbnails.
    6  * Version: 1.42.1
     6 * Version: 1.42.2
    77 * Text Domain: wp-portfolio
    88 * Domain Path: /languages
     
    3939
    4040/** Constant: The current version of the database needed by this version of the plugin.  */
    41 define('WPP_VERSION',                           '1.42.1');
     41define('WPP_VERSION',                           '1.42.2');
    4242
    4343
     
    10311031        $WHERE_CLAUSE .= 'WHERE (siteactive = 1)';
    10321032
     1033        $GROUPBYCLAUSE = $isWidgetTemplate ? "GROUP BY $websites_table.siteid" : '';
     1034
    10331035        $ORDERBY_ORDERING = '';
    10341036        if ( ! $orderAscending ) {
     
    10551057
    10561058            $WHERE_CLAUSE .= ' ' . (!empty($selectedGroups) ? "AND $groups_websites_table.group_id IN ('" . implode("','", $selectedGroups) . "')"
    1057                 : "AND 0=1");
     1059                    : "AND 0=1");
    10581060        }
    10591061
     
    10641066                        ON $groups_table.groupid = $groups_websites_table.group_id
    10651067                        $WHERE_CLAUSE
     1068                        $GROUPBYCLAUSE
    10661069                        $ORDERBY_CLAUSE
    10671070                        ";
     
    11871190
    11881191        $message = false;
    1189         if ($groups && is_array($selectedGroups)) {
    1190             if (!is_array($not_empty_groups)) {
    1191                 $not_empty_groups = array();
    1192                 foreach ($websites as $website) {
    1193                     if (!empty($website->groupid) && !in_array($website->groupid, $not_empty_groups)) {
    1194                         $not_empty_groups[] = $website->groupid;
     1192        if (!$isWidgetTemplate) {
     1193            if ($groups && is_array($selectedGroups)) {
     1194                if (!is_array($not_empty_groups)) {
     1195                    $not_empty_groups = array();
     1196                    foreach ($websites as $website) {
     1197                        if (!empty($website->groupid) && !in_array($website->groupid, $not_empty_groups)) {
     1198                            $not_empty_groups[] = $website->groupid;
     1199                        }
    11951200                    }
    11961201                }
     1202                $empty_groups = array_diff($selectedGroups, $not_empty_groups);
     1203                if (!empty($empty_groups) && is_array($empty_groups)) {
     1204                    $message = sprintf('<p>' . __('Portfolio websites in groups with such IDs (%s) does not exist.', 'wp-portfolio') . '</p>', implode(',', $empty_groups));
     1205                }
     1206            } elseif (empty($websites)) {
     1207                $message = '<p>' . __('There are no portfolio websites.', 'wp-portfolio') . '</p>';
    11971208            }
    1198             $empty_groups = array_diff($selectedGroups, $not_empty_groups);
    1199             if (!empty($empty_groups) && is_array($empty_groups)) {
    1200                 $message = sprintf('<p>' . __('Portfolio websites in groups with such IDs (%s) does not exist.', 'wp-portfolio') . '</p>', implode(',', $empty_groups));
    1201             }
    1202         }
    1203         elseif (empty($websites)) {
    1204             $message = '<p>' . __('There are no portfolio websites.', 'wp-portfolio') . '</p>';
    12051209        }
    12061210
     
    12951299    $websites_table = $wpdb->prefix . TABLE_WEBSITES;
    12961300    $groups_table   = $wpdb->prefix . TABLE_WEBSITE_GROUPS;
     1301    $groups_websites_table = $wpdb->prefix . TABLE_GROUPS_WEBSITES;
    12971302
    12981303    // Validate the count is a number
    12991304    $count = $count + 0;
    13001305
    1301     // Determine if we only want to get websites from certain groups
    1302     $WHERE_CLAUSE = "";
    1303     if ($groups)
    1304     {
    1305         $selectedGroups = explode(",", $groups);
    1306         foreach ($selectedGroups as $possibleGroup)
    1307         {
    1308             // Some matches might be empty strings
    1309             if ($possibleGroup > 0) {
    1310                 $WHERE_CLAUSE .= "$groups_table.groupid = '$possibleGroup' OR ";
     1306    // Determine if we only want to show certain groups
     1307    $WHERE_CLAUSE = '';
     1308
     1309    // Add initial where if needed
     1310    $WHERE_CLAUSE .= 'WHERE (siteactive = 1)';
     1311
     1312    $selectedGroups = false;
     1313    $not_empty_groups = false;
     1314    if ($groups) {
     1315        $selectedGroups = is_array($selectedGroups = explode(',', $groups)) ? array_unique($selectedGroups) : array();
     1316        foreach ($selectedGroups as $key => $selectedGroupID) {
     1317            if (!is_numeric($selectedGroupID)) {
     1318                unset($selectedGroups[$key]);
    13111319            }
    13121320        }
    1313     } // end of if ($groups)
    1314 
    1315     // Add initial where if needed
    1316     if ($WHERE_CLAUSE)
    1317     {
    1318         // Remove last OR to maintain valid SQL
    1319         if (substr($WHERE_CLAUSE, -4) == ' OR ') {
    1320             $WHERE_CLAUSE = substr($WHERE_CLAUSE, 0, strlen($WHERE_CLAUSE)-4);
    1321         }
    1322 
    1323         $WHERE_CLAUSE = "WHERE siteactive != '0' AND (". $WHERE_CLAUSE . ")";
    1324     }
    1325     // Always hide inactive sites
    1326     else {
    1327         $WHERE_CLAUSE = "WHERE siteactive != '0'";
    1328     }
    1329 
     1321
     1322        $WHERE_CLAUSE .= ' ' . (!empty($selectedGroups) ? "AND $groups_websites_table.group_id IN ('" . implode("','", $selectedGroups) . "')"
     1323                : "AND 0=1");
     1324    }
    13301325
    13311326    // Limit the number of websites if requested
     
    13351330    }
    13361331
     1332    $GROUPBYCLAUSE = $isWidgetTemplate ? "GROUP BY $websites_table.siteid" : '';
    13371333
    13381334    // Get website details, merge with group details
    1339     $SQL = "SELECT * FROM $websites_table
    1340             LEFT JOIN $groups_table ON $websites_table.sitegroup = $groups_table.groupid
    1341             $WHERE_CLAUSE
    1342             ORDER BY RAND()
    1343             $LIMITCLAUSE
    1344             ";
     1335    $SQL = "SELECT $websites_table.*, $groups_table.* FROM $websites_table
     1336                        RIGHT JOIN $groups_websites_table
     1337                        ON $groups_websites_table.website_id=$websites_table.siteid
     1338                        LEFT JOIN $groups_table
     1339                        ON $groups_table.groupid = $groups_websites_table.group_id
     1340                        $WHERE_CLAUSE
     1341                        $GROUPBYCLAUSE
     1342                        ORDER BY RAND()
     1343                        $LIMITCLAUSE
     1344                        ";
    13451345
    13461346    $wpdb->show_errors();
    13471347    $websites = $wpdb->get_results($SQL, OBJECT);
     1348
     1349    $message = false;
     1350    if (!$isWidgetTemplate) {
     1351        if ($groups && is_array($selectedGroups)) {
     1352            if (!is_array($not_empty_groups)) {
     1353                $not_empty_groups = array();
     1354                foreach ($websites as $website) {
     1355                    if (!empty($website->groupid) && !in_array($website->groupid, $not_empty_groups)) {
     1356                        $not_empty_groups[] = $website->groupid;
     1357                    }
     1358                }
     1359            }
     1360            $empty_groups = array_diff($selectedGroups, $not_empty_groups);
     1361            if (!empty($empty_groups) && is_array($empty_groups)) {
     1362                $message = sprintf('<p>' . __('Portfolio websites in groups with such IDs (%s) does not exist.', 'wp-portfolio') . '</p>', implode(',', $empty_groups));
     1363            }
     1364        } elseif (empty($websites)) {
     1365            $message = '<p>' . __('There are no portfolio websites.', 'wp-portfolio') . '</p>';
     1366        }
     1367    }
    13481368
    13491369    // Get the current list of custom data fields
     
    13771397
    13781398    // Render websites into HTML. Use blank group to avoid rendering group details.
    1379         $portfolioHTML = WPPortfolio_renderPortfolio($websites, $template_website, ' ', false, $isWidgetTemplate, $columns, false);
     1399    $portfolioHTML = WPPortfolio_renderPortfolio($websites, $template_website, ' ', false, $isWidgetTemplate, $columns, $message);
    13801400
    13811401    return $portfolioHTML;
Note: See TracChangeset for help on using the changeset viewer.