Skip to content

Commit c8bc5fb

Browse files
committed
version 1.9.6 released
1 parent d1e60eb commit c8bc5fb

5 files changed

Lines changed: 96 additions & 50 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 66 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,18 @@ jobs:
2323
- name: Find Readme File
2424
id: find_readme
2525
run: |
26-
readme_file=$(find . -type f -iname "readme.*" | head -n 1)
27-
if [ -n "$readme_file" ]; then
28-
echo "Readme file found: $readme_file"
29-
echo "readme_file=$readme_file" >> $GITHUB_ENV
30-
else
26+
for file in readme.txt Readme.txt README.txt README.md Readme.md readme.md; do
27+
if [ -f "$file" ]; then
28+
echo "Readme file found: $file"
29+
echo "readme_file=$file" >> $GITHUB_ENV
30+
break
31+
fi
32+
done
33+
34+
# Ensure the variable is available within the current step
35+
source $GITHUB_ENV
36+
37+
if [ -z "$readme_file" ]; then
3138
echo "::error::Readme file not found."
3239
exit 1
3340
fi
@@ -36,56 +43,78 @@ jobs:
3643
id: release_notes
3744
run: |
3845
changelog_section_start="== Changelog =="
39-
current_tag="${{ github.ref_name }}"
40-
readme_file="${{ env.readme_file }}"
46+
readme_file="$readme_file"
4147
42-
# Extract the version (strip 'refs/tags/' if it exists)
43-
version=${current_tag#refs/tags/}
48+
# Extract the tag name from GITHUB_REF (plugin_version)
49+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
50+
plugin_version="${GITHUB_REF#refs/tags/}"
51+
echo "DEBUG: Plugin latest version found: $plugin_version."
52+
else
53+
echo "::error::This workflow must be triggered by a tag push."
54+
exit 1
55+
fi
4456
45-
# Read lines from the changelog section
4657
in_changelog=0
58+
found_version=0
4759
release_notes=""
48-
capturing_version=0
60+
61+
echo "DEBUG: Starting to extract release notes from $readme_file for version $plugin_version."
62+
4963
while IFS= read -r line; do
50-
# Start capturing after finding the changelog section
64+
echo "DEBUG: Processing line: $line"
65+
66+
# Start processing after the changelog header
5167
if [[ "$line" == "$changelog_section_start" ]]; then
5268
in_changelog=1
69+
echo "DEBUG: Found changelog section header."
5370
continue
5471
fi
5572
56-
# Stop capturing if we encounter a new version or the end of the file
57-
if [[ $in_changelog -eq 1 && "$line" =~ ^= ]]; then
58-
# Check if this is the current version
59-
if [[ "$line" == "= $version =" ]]; then
60-
capturing_version=1
61-
elif [[ $capturing_version -eq 1 ]]; then
62-
# Stop if we see the next version
63-
break
64-
fi
73+
# Skip if not in changelog section
74+
if [[ $in_changelog -eq 0 ]]; then
75+
echo "DEBUG: Skipping line (not in changelog section)."
76+
continue
6577
fi
6678
67-
# Capture lines only for the current version
68-
if [[ $capturing_version -eq 1 && -n "$line" ]]; then
69-
release_notes+="$line\n"
79+
# Check for the current version header
80+
if [[ "$line" == "= ${plugin_version} =" ]]; then
81+
found_version=1
82+
echo "DEBUG: Found version header for $plugin_version."
83+
continue
84+
fi
85+
86+
# Break if a new version header is found after the current version
87+
if [[ $found_version -eq 1 ]] && echo "$line" | grep -qE '^= [0-9]+\.[0-9]+\.[0-9]+ =$'; then
88+
echo "DEBUG: Found a new version header. Stopping collection."
89+
break
90+
fi
91+
92+
# Collect lines starting with '*' if we are in the current version section
93+
if [[ $found_version -eq 1 ]] && echo "$line" | grep -qE '^\*'; then
94+
echo "DEBUG: Found changelog entry: $line"
95+
release_notes+="${line}\n"
96+
continue
97+
fi
98+
99+
# Log skipped lines in the current version section
100+
if [[ $found_version -eq 1 ]]; then
101+
echo "DEBUG: Skipping line (not a changelog entry): $line"
70102
fi
71103
done < "$readme_file"
72104
73105
if [[ -z "$release_notes" ]]; then
74-
echo "::error::Failed to extract release notes for version $version."
106+
echo "::error::Failed to extract release notes for version ${plugin_version}."
75107
exit 1
76108
fi
77109
78-
# Debug: Print extracted release notes
79-
echo "Extracted release notes for version $version:"
80-
printf "%b" "$release_notes"
110+
echo "DEBUG: Successfully extracted release notes."
111+
echo "DEBUG: Release notes content:"
112+
echo -e "$release_notes"
81113
82-
# Set output
83-
echo "::set-output name=notes::$(printf "%b" "$release_notes")"
84-
85-
- name: Debug Release Notes
86-
run: |
87-
echo "Debugging Release Notes:"
88-
echo "${{ steps.release_notes.outputs.notes }}"
114+
# Write the release notes with actual line breaks
115+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
116+
echo -e "$release_notes" >> $GITHUB_ENV
117+
echo "EOF" >> $GITHUB_ENV
89118
90119
- name: WordPress Plugin Deploy
91120
id: deploy
@@ -97,10 +126,10 @@ jobs:
97126
uses: softprops/action-gh-release@v2
98127
with:
99128
tag_name: ${{ github.ref_name }}
100-
body: ${{ steps.release_notes.outputs.notes }}
129+
body: ${{ env.RELEASE_NOTES }}
101130
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip
102131

103132
env:
104133
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
105134
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
106-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

cbxwpbookmark.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Plugin Name: CBX Bookmark & Favorite
1616
* Plugin URI: https://codeboxr.com/product/cbx-wordpress-bookmark
1717
* Description: List/category based bookmark for WordPress, create your own private or public list of favorite posts, page, custom object
18-
* Version: 1.9.5
18+
* Version: 1.9.6
1919
* Author: Codeboxr Team
2020
* Author URI: https://codeboxr.com
2121
* License: GPL-2.0+
@@ -31,7 +31,7 @@
3131

3232

3333
defined( 'CBXWPBOOKMARK_PLUGIN_NAME' ) or define( 'CBXWPBOOKMARK_PLUGIN_NAME', 'cbxwpbookmark' );
34-
defined( 'CBXWPBOOKMARK_PLUGIN_VERSION' ) or define( 'CBXWPBOOKMARK_PLUGIN_VERSION', '1.9.5' );
34+
defined( 'CBXWPBOOKMARK_PLUGIN_VERSION' ) or define( 'CBXWPBOOKMARK_PLUGIN_VERSION', '1.9.6' );
3535
defined( 'CBXWPBOOKMARK_BASE_NAME' ) or define( 'CBXWPBOOKMARK_BASE_NAME', plugin_basename( __FILE__ ) );
3636
defined( 'CBXWPBOOKMARK_ROOT_PATH' ) or define( 'CBXWPBOOKMARK_ROOT_PATH', plugin_dir_path( __FILE__ ) );
3737
defined( 'CBXWPBOOKMARK_ROOT_URL' ) or define( 'CBXWPBOOKMARK_ROOT_URL', plugin_dir_url( __FILE__ ) );

public/class-cbxwpbookmark-public.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class CBXWPBookmark_Public {
3838
/**
3939
* Initialize the class and set its properties.
4040
*
41-
* @param string $plugin_name The name of the plugin.
42-
* @param string $version The version of this plugin.
41+
* @param string $plugin_name The name of the plugin.
42+
* @param string $version The version of this plugin.
4343
*
4444
* @since 1.0.0
4545
*
@@ -91,7 +91,7 @@ public function find_category() {
9191

9292
global $wpdb;
9393

94-
$settings = $this->settings;
94+
$settings = $this->settings;
9595
$bookmark_mode = $settings->get_field( 'bookmark_mode', 'cbxwpbookmark_basics', 'user_cat' );
9696

9797

@@ -102,12 +102,18 @@ public function find_category() {
102102
$object_id = isset( $_POST['object_id'] ) ? absint( $_POST['object_id'] ) : 0;
103103
$object_type = isset( $_POST['object_type'] ) ? sanitize_text_field( wp_unslash( $_POST['object_type'] ) ) : 'post'; //post, page, user, product, any thing custom
104104

105+
$cats_by_user_orderby = 'id';
106+
$cats_by_user_order = 'DESC';
107+
108+
$cats_by_user_orderby = apply_filters( 'cbxwpbookmark_cats_by_user_orderby', $cats_by_user_orderby );
109+
$cats_by_user_order = apply_filters( 'cbxwpbookmark_cats_by_user_order', $cats_by_user_order );
110+
105111
if ( $bookmark_mode == 'user_cat' ) {
106112
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
107-
$cats_by_user = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $category_table WHERE user_id = %d", $user_id ), ARRAY_A );
113+
$cats_by_user = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $category_table WHERE user_id = %d ORDER BY $cats_by_user_orderby $cats_by_user_order", $user_id ), ARRAY_A );
108114
} else {
109115
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
110-
$cats_by_user = $wpdb->get_results( "SELECT * FROM $category_table WHERE 1", ARRAY_A );
116+
$cats_by_user = $wpdb->get_results( "SELECT * FROM $category_table WHERE 1 ORDER BY $cats_by_user_orderby $cats_by_user_order", ARRAY_A );
111117
}
112118

113119
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
@@ -443,7 +449,7 @@ public function add_category_std() {
443449
$message = [];
444450

445451

446-
$settings = $this->settings;
452+
$settings = $this->settings;
447453
$bookmark_mode = $settings->get_field( 'bookmark_mode', 'cbxwpbookmark_basics', 'user_cat' );
448454

449455
if ( $bookmark_mode != 'user_cat' ) {
@@ -832,7 +838,7 @@ public function delete_bookmark_category() {
832838
global $wpdb;
833839

834840

835-
$settings = $this->settings;
841+
$settings = $this->settings;
836842
$bookmark_mode = $settings->get_field( 'bookmark_mode', 'cbxwpbookmark_basics', 'user_cat' );
837843

838844
if ( isset( $_POST ) && $bookmark_mode == 'user_cat' ) {
@@ -935,7 +941,7 @@ public function add_bookmark() {
935941
$alert_msg = '';
936942

937943
//$settings = new CBXWPBookmark_Settings_API();
938-
$settings = $this->settings;
944+
$settings = $this->settings;
939945
$bookmark_mode = $settings->get_field( 'bookmark_mode', 'cbxwpbookmark_basics', 'user_cat' );
940946

941947
$user_id = get_current_user_id();
@@ -1271,7 +1277,7 @@ public function load_bookmarks_sublist() {
12711277
global $wpdb;
12721278

12731279

1274-
$settings = $this->settings;
1280+
$settings = $this->settings;
12751281
$bookmark_mode = $settings->get_field( 'bookmark_mode', 'cbxwpbookmark_basics', 'user_cat' );
12761282

12771283

@@ -1509,7 +1515,7 @@ public function admin_init_ajax_lang() {
15091515
* @return array
15101516
*/
15111517
public function add_theme_class( $classes ) {
1512-
$settings = $this->settings;
1518+
$settings = $this->settings;
15131519
$bookmark_theme_class = $settings->get_field( 'display_theme', 'cbxwpbookmark_basics', 'cbxwpbookmark-blue' );
15141520

15151521
return array_merge( $classes, [ $bookmark_theme_class ] );

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: codeboxr, manchumahara
33
Tags: bookmark,favorite,collection,user collection,user bookmark
44
Requires at least: 5.3
55
Tested up to: 6.7.2
6-
Stable tag: 1.9.5
6+
Stable tag: 1.9.6
77
License: GPLv2 or later
88
License URI: http://www.gnu.org/licenses/gpl-2.0.html
99

@@ -169,6 +169,9 @@ How to install the plugin and get it working.
169169
== Screenshots ==
170170

171171
== Changelog ==
172+
= 1.9.6 =
173+
* [updated] Category order and order by display changed for bookmark modal screen, new hooks
174+
172175
= 1.9.5 =
173176
* [updated] Misc changes
174177
* [updated] Pro addon plugin 1.5.1 released

templates/admin/dashboard.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@
165165
</div>
166166
</div>
167167
<div class="content">
168+
<div class="cbx-backend-settings-row">
169+
<p>
170+
Version - 1.9.6
171+
</p>
172+
<ul>
173+
<li>[updated] Category order and order by display changed for bookmark modal screen, new hooks</li>
174+
</ul>
175+
</div>
168176
<div class="cbx-backend-settings-row">
169177
<p>
170178
Version - 1.9.5

0 commit comments

Comments
 (0)