Skip to content

Commit

Permalink
Merge pull request #309 from katzwebservices/dev/1-5-2
Browse files Browse the repository at this point in the history
Dev/1 5 2
  • Loading branch information
zackkatz committed Dec 12, 2014
2 parents 672c571 + 31b21db commit a2d967f
Show file tree
Hide file tree
Showing 59 changed files with 1,018 additions and 640 deletions.
2 changes: 1 addition & 1 deletion .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ host = https://www.transifex.com
file_filter = languages/gravityview-<lang>.po
source_lang = en
type = PO
lang_map = pt: pt_PT, it: it_IT, bn: bn_BD, sv: sv_SE
lang_map = pt: pt_PT, it: it_IT, bn: bn_BD, sv: sv_SE, nl: nl_NL
8 changes: 5 additions & 3 deletions gravityview.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Plugin Name: GravityView
* Plugin URI: http://gravityview.co
* Description: Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output.
* Version: 1.5.1
* Version: 1.5.2
* Author: Katz Web Services, Inc.
* Author URI: http://www.katzwebservices.com
* Text Domain: gravityview
Expand Down Expand Up @@ -47,9 +47,11 @@
define( 'GV_MIN_GF_VERSION', '1.8' );
}

/** Load connector functions */
/** Load common & connector functions */
require_once( GRAVITYVIEW_DIR . 'includes/class-common.php');
require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php');


/** Register Post Types and Rewrite Rules */
require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php');

Expand All @@ -67,7 +69,7 @@
*/
final class GravityView_Plugin {

const version = '1.5.1';
const version = '1.5.2';

public static $theInstance;

Expand Down
21 changes: 21 additions & 0 deletions includes/class-admin-welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,27 @@ public function changelog_screen() {

<hr />

<h3>Changes in 1.5.2 (full list)</h3>

<ul>
<li>Added: Possibility to show the label of Dropdown field types instead of the value (<a href="https://gravityview.co/support/documentation/202889199/" title="How to display the text label (not the value) of a dropdown field?">learn more</a>)</li>
<li>Fixed: Sorting numeric columns (field type number)</li>
<li>Fixed: View entries filter for Featured Entries extension</li>
<li>Fixed: Field options showing delete entry label</li>
<li>Fixed: PHP date formatting now keeps backslashes from being stripped</li>
<li>Modified: Allow license to be defined in <code>wp-config.php</code> (<a href="https://gravityview.co/support/documentation/202870789/">Read how here</a>)</li>
<li>Modified: Added <code>$post_id</code> parameter as the second argument for the <code>gv_entry_link()</code> function. This is used to define the entry's parent post ID.</li>
<li>Modified: Moved <code>GravityView_API::get_entry_id_from_slug()</code> to <code>GVCommon::get_entry_id_from_slug()</code></li>
<li>Modified: Added second parameter to <code>gravityview_get_entry()</code>, which forces the ability to fetch an entry by ID, even if custom slugs are enabled and <code>gravityview_custom_entry_slug_allow_id</code> is false.</li>
<li>Updated Translations:
<ul>
<li>Bengali translation by <a href="https://www.transifex.com/accounts/profile/tareqhi/">@tareqhi</a></li>
<li>Romanian translation by <a href="https://www.transifex.com/accounts/profile/ArianServ/">@ArianServ</a></li>
<li>Mexican Spanish translation by <a href="https://www.transifex.com/accounts/profile/jorgepelaez/">@jorgepelaez</a></li>
</ul>
</li>
</ul>


<h3>Changes in 1.5.1 (full list)</h3>

Expand Down
55 changes: 19 additions & 36 deletions includes/class-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public static function field_value( $entry, $field_settings, $format = 'html') {
*/
if( !empty( $gravityview_view->field_data['field_settings']['show_as_link'] ) ) {

$href = self::entry_link( $entry, $field );
$href = self::entry_link( $entry );

$link = '<a href="'. $href .'">'. $output . '</a>';

Expand Down Expand Up @@ -397,8 +397,8 @@ private static function get_custom_entry_slug( $id, $entry = array() ) {
* @see gravityview_get_entry()
* @uses GravityView_API::get_custom_entry_slug() If using custom slug, gets the custom slug value
* @since 1.4
* @param [type] $id_or_string [description]
* @param array $entry [description]
* @param int|string $id_or_string ID of the entry, or custom slug string
* @param array $entry Gravity Forms Entry array, optional. Used only to provide data to customize the `gravityview_entry_slug` filter
* @return string Unique slug ID, passed through `sanitize_title()`
*/
public static function get_entry_slug( $id_or_string, $entry = array() ) {
Expand Down Expand Up @@ -441,42 +441,25 @@ public static function get_entry_slug( $id_or_string, $entry = array() ) {
}

/**
* Get the entry ID from the entry slug, which may or may not be the entry ID
*
* @since 1.5.1
* @param string $slug The entry slug, as returned by GravityView_API::get_entry_slug()
* @return int|null The entry ID, if exists; `NULL` if not
* return href for single entry
* @param array|int $entry Entry array or entry ID
* @param int|null $post_id If wanting to define the parent post, pass a post ID
* @return string Link to the entry with the directory parent slug
*/
public static function get_entry_id_from_slug( $slug ) {
global $wpdb;

$search_criteria = array(
'field_filters' => array(
array(
'key' => 'gravityview_unique_id', // Search the meta values
'value' => $slug
)
)
);

// Limit to one for speed
$paging = array(
'page_size' => 1
);

$results = GFAPI::get_entries( 0, $search_criteria, NULL, $paging );

$result = ( !empty( $results ) && !empty( $results[0]['id'] ) ) ? $results[0]['id'] : NULL;
public static function entry_link( $entry, $post_id = NULL ) {
global $gravityview_view;

return $result;
}
if( !is_array( $entry ) ) {
$entry = GVCommon::get_entry( $entry );
}

// return href for single entry
public static function entry_link( $entry ) {
global $gravityview_view;
// Second parameter used to be passed as $field; this makes sure it's not an array
if( !is_numeric( $post_id ) ) {
$post_id = NULL;
}

// Get the permalink to the View
$directory_link = self::directory_link( NULL, false );
$directory_link = self::directory_link( $post_id, false );

// No post ID? Get outta here.
if( empty( $directory_link ) ) {
Expand Down Expand Up @@ -556,8 +539,8 @@ function gv_directory_link( $post = NULL, $add_pagination = true ) {
return GravityView_API::directory_link( $post, $add_pagination );
}

function gv_entry_link( $entry ) {
return GravityView_API::entry_link( $entry );
function gv_entry_link( $entry, $post_id = NULL ) {
return GravityView_API::entry_link( $entry, $post_id );
}

function gv_no_results($wpautop = true) {
Expand Down
2 changes: 1 addition & 1 deletion includes/class-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function add_hooks() {
*/
public function entry_deleted( $lead_id ) {

$entry = GFAPI::get_entry( $lead_id );
$entry = GFAPI::get_entry( $lead_id, true );

do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form '.$entry['form_id'].' to blacklist because entry #'.$lead_id.' was deleted' );

Expand Down
Loading

0 comments on commit a2d967f

Please sign in to comment.