Skip to content

Commit 30a9379

Browse files
committed
version 2.7.5 released
1 parent c54d6ab commit 30a9379

21 files changed

+1907
-1932
lines changed

.github/workflows/deploy.yml

+65-40
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ on:
77

88
jobs:
99
tag:
10-
name: Deploy Plugin Tag
10+
name: New tag
1111
runs-on: ubuntu-latest
12-
1312
steps:
1413
- uses: actions/checkout@v3
1514

@@ -24,79 +23,105 @@ jobs:
2423
- name: Find Readme File
2524
id: find_readme
2625
run: |
27-
readme_file=$(find . -type f -iname "readme.*" | head -n 1)
28-
if [ -n "$readme_file" ]; then
29-
echo "Readme file found: $readme_file"
30-
echo "readme_file=$readme_file" >> $GITHUB_ENV
31-
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
3238
echo "::error::Readme file not found."
3339
exit 1
3440
fi
3541
3642
- name: Extract Release Notes
3743
id: release_notes
3844
run: |
39-
# Define variables
4045
changelog_section_start="== Changelog =="
41-
current_tag="${{ github.ref_name }}"
42-
readme_file="${{ env.readme_file }}"
46+
readme_file="$readme_file"
4347
44-
# Extract version from tag (strip 'refs/tags/' if it exists)
45-
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
4656
47-
# Initialize variables
4857
in_changelog=0
49-
capturing_version=0
58+
found_version=0
5059
release_notes=""
5160
61+
echo "DEBUG: Starting to extract release notes from $readme_file for version $plugin_version."
62+
5263
while IFS= read -r line; do
53-
# Start capturing after finding the changelog section
64+
echo "DEBUG: Processing line: $line"
65+
66+
# Start processing after the changelog header
5467
if [[ "$line" == "$changelog_section_start" ]]; then
5568
in_changelog=1
69+
echo "DEBUG: Found changelog section header."
5670
continue
5771
fi
5872
59-
# Skip lines before the changelog section
73+
# Skip if not in changelog section
6074
if [[ $in_changelog -eq 0 ]]; then
75+
echo "DEBUG: Skipping line (not in changelog section)."
6176
continue
6277
fi
6378
64-
# Start capturing if the line matches the current version
65-
if [[ "$line" == "= $version =" ]]; then
66-
capturing_version=1
67-
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."
6883
continue
6984
fi
7085
71-
# Stop capturing when a new version is detected
72-
if [[ $capturing_version -eq 1 && "$line" =~ ^= ]]; then
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."
7389
break
7490
fi
7591
76-
# Add the line to the release notes if we are capturing
77-
if [[ $capturing_version -eq 1 ]]; then
78-
release_notes+="$line\n"
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"
79102
fi
80103
done < "$readme_file"
81104
82-
# Check if release notes were extracted
83105
if [[ -z "$release_notes" ]]; then
84-
echo "::error::Failed to extract release notes for version $version."
106+
echo "::error::Failed to extract release notes for version ${plugin_version}."
85107
exit 1
86108
fi
87109
88-
# Debug: Print extracted release notes
89-
echo "Extracted release notes for version $version:"
90-
printf "%b" "$release_notes"
91-
92-
# Set output for release notes
93-
echo "::set-output name=notes::$(printf "%b" "$release_notes")"
94-
95-
- name: Debug Release Notes
96-
run: |
97-
echo "Debugging Release Notes:"
98-
echo "${{ steps.release_notes.outputs.notes }}"
99-
110+
echo "DEBUG: Successfully extracted release notes."
111+
echo "DEBUG: Release notes content:"
112+
echo -e "$release_notes"
113+
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
118+
119+
#- name: Deploy WordPress.org Assets
120+
# uses: 10up/action-wordpress-plugin-asset-update@stable
121+
# env:
122+
# SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
123+
# SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
124+
100125
- name: WordPress Plugin Deploy
101126
id: deploy
102127
uses: 10up/action-wordpress-plugin-deploy@stable
@@ -107,7 +132,7 @@ jobs:
107132
uses: softprops/action-gh-release@v2
108133
with:
109134
tag_name: ${{ github.ref_name }}
110-
body: ${{ steps.release_notes.outputs.notes }}
135+
body: ${{ env.RELEASE_NOTES }}
111136
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip
112137

113138
env:

assets/css/wpnextpreviouslink-admin.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/wpnextpreviouslink-setting.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/wpnextpreviouslink-setting.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,8 @@
452452
$('.wpnpcustomimg').addClass('hidden');
453453
$('.wpnpaddon_custom_img').addClass('hidden');
454454

455-
$('#wpnp_previousimg').attr('src', wpnp.image_url + 'l_' + imagename + '.png');
456-
$('#wpnp_nextimg').attr('src', wpnp.image_url + 'r_' + imagename + '.png');
455+
$('#wpnp_previousimg').attr('src', wpnextpreviouslink_settings_vars.image_url + 'l_' + imagename + '.png');
456+
$('#wpnp_nextimg').attr('src', wpnextpreviouslink_settings_vars.image_url + 'r_' + imagename + '.png');
457457
}
458458
});
459459

includes/wpnextpreviouslink-tpl-loader.php renamed to includes/Functions/wpnextpreviouslink-tpl-loader.php

+45-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,42 @@ function wpnextpreviouslink_template_path() {
2828
*
2929
* @return string
3030
*/
31+
/*function wpnextpreviouslink_locate_template2( $template_name, $template_path = '', $default_path = '' ) {
32+
if ( ! $template_path ) {
33+
$template_path = wpnextpreviouslink_template_path();
34+
}
35+
36+
if ( ! $default_path ) {
37+
$default_path = WPNEXTPREVIOUSLINK_ROOT_PATH . 'templates/';
38+
}
39+
40+
// Look within passed path within the theme - this is priority.
41+
$template = locate_template( [ wpnextpreviouslink - tpl - loader . phptrailingslashit( $template_path ) . $template_name, $template_name ] );
42+
43+
// Get default template/.
44+
if ( ! $template ) {
45+
$template = $default_path . $template_name;
46+
}
47+
48+
// Return what we found.
49+
return apply_filters( 'wpnextpreviouslink_locate_template', $template, $template_name, $template_path );
50+
}//end function wpnextpreviouslink_locate_template2*/
51+
52+
/**
53+
* Locate a template and return the path for inclusion.
54+
*
55+
* This is the load order:
56+
*
57+
* yourtheme/$template_path/$template_name
58+
* yourtheme/$template_name
59+
* $default_path/$template_name
60+
*
61+
* @param string $template_name Template name.
62+
* @param string $template_path Template path. (default: '').
63+
* @param string $default_path Default path. (default: '').
64+
*
65+
* @return string
66+
*/
3167
function wpnextpreviouslink_locate_template( $template_name, $template_path = '', $default_path = '' ) {
3268
if ( ! $template_path ) {
3369
$template_path = wpnextpreviouslink_template_path();
@@ -38,7 +74,12 @@ function wpnextpreviouslink_locate_template( $template_name, $template_path = ''
3874
}
3975

4076
// Look within passed path within the theme - this is priority.
41-
$template = locate_template( [ trailingslashit( $template_path ) . $template_name, $template_name ] );
77+
$template = locate_template(
78+
[
79+
trailingslashit( $template_path ) . $template_name,
80+
$template_name,
81+
]
82+
);
4283

4384
// Get default template/.
4485
if ( ! $template ) {
@@ -47,7 +88,7 @@ function wpnextpreviouslink_locate_template( $template_name, $template_path = ''
4788

4889
// Return what we found.
4990
return apply_filters( 'wpnextpreviouslink_locate_template', $template, $template_name, $template_path );
50-
}//end function wpnextpreviouslink_locate_template
91+
} //end function wpnextpreviouslink_locate_template
5192

5293
/**
5394
* Get other templates (e.g. product attributes) passing attributes and including the file.
@@ -82,7 +123,7 @@ function wpnextpreviouslink_get_template( $template_name, $args = [], $template_
82123
}//end function wpnextpreviouslink_get_template
83124

84125
/**
85-
* Like wc_get_template, but returns the HTML instead of outputting.
126+
* Likewpnextpreviouslink_get_template, but returns the HTML instead of outputting.
86127
*
87128
* @param string $template_name Template name.
88129
* @param array $args Arguments. (default: array).
@@ -92,7 +133,7 @@ function wpnextpreviouslink_get_template( $template_name, $args = [], $template_
92133
* @return string
93134
* @since 2.5.0
94135
*
95-
* @see wc_get_template
136+
* @see wpnextpreviouslink_get_template
96137
*/
97138
function wpnextpreviouslink_get_template_html( $template_name, $args = [], $template_path = '', $default_path = '' ) {
98139
ob_start();

0 commit comments

Comments
 (0)