Skip to content

Commit 2811d39

Browse files
committed
version 3.1.8 released
1 parent 5cf85cc commit 2811d39

27 files changed

+898
-780
lines changed

.github/workflows/deploy.yml

Lines changed: 93 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,125 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14+
15+
- name: Debug File List
16+
run: ls -R
17+
1418
- name: Install SVN (Subversion)
1519
run: |
1620
sudo apt-get update
1721
sudo apt-get install subversion
1822
19-
- name: WordPress Plugin Deploy
20-
id: deploy
21-
uses: 10up/action-wordpress-plugin-deploy@stable
22-
with:
23-
generate-zip: true
24-
2523
- name: Find Readme File
2624
id: find_readme
2725
run: |
28-
for file in README.txt README.md Readme.txt Readme.md readme.txt readme.md; do
26+
for file in readme.txt Readme.txt README.txt README.md Readme.md readme.md; do
2927
if [ -f "$file" ]; then
30-
echo "::set-output name=readme_file::$file"
28+
echo "Readme file found: $file"
29+
echo "readme_file=$file" >> $GITHUB_ENV
3130
break
3231
fi
3332
done
3433
34+
# Ensure the variable is available within the current step
35+
source $GITHUB_ENV
36+
37+
if [ -z "$readme_file" ]; then
38+
echo "::error::Readme file not found."
39+
exit 1
40+
fi
41+
3542
- name: Extract Release Notes
3643
id: release_notes
3744
run: |
38-
if [[ -z "${{ steps.find_readme.outputs.readme_file }}" ]]; then
39-
echo "::error::Readme file not found."
45+
changelog_section_start="== Changelog =="
46+
readme_file="$readme_file"
47+
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."
4054
exit 1
4155
fi
4256
43-
release_notes=$(grep '== Changelog ==' "${{ steps.find_readme.outputs.readme_file }}" | head -n -1 | tail -n +2)
44-
echo "::set-output name=notes::$release_notes"
57+
in_changelog=0
58+
found_version=0
59+
release_notes=""
60+
61+
echo "DEBUG: Starting to extract release notes from $readme_file for version $plugin_version."
62+
63+
while IFS= read -r line; do
64+
echo "DEBUG: Processing line: $line"
65+
66+
# Start processing after the changelog header
67+
if [[ "$line" == "$changelog_section_start" ]]; then
68+
in_changelog=1
69+
echo "DEBUG: Found changelog section header."
70+
continue
71+
fi
72+
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
77+
fi
78+
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"
102+
fi
103+
done < "$readme_file"
104+
105+
if [[ -z "$release_notes" ]]; then
106+
echo "::error::Failed to extract release notes for version ${plugin_version}."
107+
exit 1
108+
fi
109+
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: WordPress Plugin Deploy
120+
id: deploy
121+
uses: 10up/action-wordpress-plugin-deploy@stable
122+
with:
123+
generate-zip: true
45124

46125
- name: Create GitHub Release
47126
uses: softprops/action-gh-release@v2
48127
with:
49128
tag_name: ${{ github.ref_name }}
50-
body: ${{ steps.release_notes.outputs.notes }}
129+
body: ${{ env.RELEASE_NOTES }}
51130
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip
52131

53132
env:
54133
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
55134
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
56-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Contributors: codeboxr, manchumahara
33
Tags: currency converter,currency conversion,currency exchange,currency calculator,bitcoin
44
Requires at least: 5.3
5-
Tested up to: 6.7.1
6-
Stable tag: 3.1.7
5+
Tested up to: 6.8
6+
Stable tag: 3.1.8
77
PHP:7.4.*
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -95,6 +95,10 @@ How to install the plugin and get it working.
9595
== Screenshots ==
9696

9797
== Changelog ==
98+
= 3.1.8 =
99+
* [updated] WordPress Core 6.8 compatible
100+
* [updated] Minor improvements and code structure refactor
101+
98102
= 3.1.7 =
99103
* [fixed] Fixed miss spelled function name
100104

admin/index.php

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/css/cbcurrencyconverter-admin.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/cbcurrencyconverter-public.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/cbcurrencyconverter-setting.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cbcurrencyconverter.php

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Plugin Name: CBX Currency Converter
99
* Plugin URI: https://codeboxr.com/product/cbx-currency-converter-for-wordpress/
1010
* Description: Currency Converter and rate display
11-
* Version: 3.1.7
11+
* Version: 3.1.8
1212
* Author: codeboxr
1313
* Author URI: https://codeboxr.com
1414
* License: GPL-2.0+
@@ -24,19 +24,24 @@
2424
}
2525

2626
defined( 'CBCURRENCYCONVERTER_NAME' ) or define( 'CBCURRENCYCONVERTER_NAME', 'cbcurrencyconverter' );
27-
defined( 'CBCURRENCYCONVERTER_VERSION' ) or define( 'CBCURRENCYCONVERTER_VERSION', '3.1.7' );
27+
defined( 'CBCURRENCYCONVERTER_VERSION' ) or define( 'CBCURRENCYCONVERTER_VERSION', '3.1.8' );
2828
defined( 'CBCURRENCYCONVERTER_ROOT_PATH' ) or define( 'CBCURRENCYCONVERTER_ROOT_PATH', plugin_dir_path( __FILE__ ) );
2929
defined( 'CBCURRENCYCONVERTER_ROOT_URL' ) or define( 'CBCURRENCYCONVERTER_ROOT_URL', plugin_dir_url( __FILE__ ) );
3030
defined( 'CBCURRENCYCONVERTER_BASE_NAME' ) or define( 'CBCURRENCYCONVERTER_BASE_NAME', plugin_basename( __FILE__ ) );
3131

3232

33+
// Include the main class
34+
if ( ! class_exists( 'CBCurrencyConverter', false ) ) {
35+
include_once CBCURRENCYCONVERTER_ROOT_PATH . 'includes/CBCurrencyConverter.php';
36+
}
37+
3338
/**
3439
* Checking wp version
3540
*
3641
* @return bool
3742
*/
38-
function cbcurrencyconverter_compatible_wp_version() {
39-
if ( version_compare( $GLOBALS['wp_version'], '3.5', '<' ) ) {
43+
function cbcurrencyconverter_compatible_wp_version($version = '5.3' ) {
44+
if ( version_compare( $GLOBALS['wp_version'], $version, '<' ) ) {
4045
return false;
4146
}
4247

@@ -49,8 +54,8 @@ function cbcurrencyconverter_compatible_wp_version() {
4954
*
5055
* @return bool
5156
*/
52-
function cbcurrencyconverter_compatible_php_version() {
53-
if ( version_compare( PHP_VERSION, '7.4', '<=' ) ) {
57+
function cbcurrencyconverter_compatible_php_version($version = '7.4' ) {
58+
if ( version_compare( PHP_VERSION, $version, '<=' ) ) {
5459
return false;
5560
}
5661

@@ -59,41 +64,39 @@ function cbcurrencyconverter_compatible_php_version() {
5964

6065
/**
6166
* The code that runs during plugin activation.
62-
* This action is documented in includes/class-cbcurrencyconverter-activator.php
67+
* This action is documented in includes/CBCurrencyConverterActivator.php
6368
*/
6469
function activate_cbcurrencyconverter() {
65-
require_once plugin_dir_path( __FILE__ ) . 'includes/class-cbcurrencyconverter-activator.php';
66-
CBCurrencyConverter_Activator::activate();
70+
require_once plugin_dir_path( __FILE__ ) . 'includes/CBCurrencyConverterActivator.php';
71+
CBCurrencyConverterActivator::activate();
6772
}//end method activate_cbcurrencyconverter
6873

6974
/**
7075
* The code that runs during plugin deactivation.
71-
* This action is documented in includes/class-cbcurrencyconverter-deactivator.php
76+
* This action is documented in includes/CBCurrencyConverterDeactivator.php
7277
*/
7378
function deactivate_cbcurrencyconverter() {
74-
require_once plugin_dir_path( __FILE__ ) . 'includes/class-cbcurrencyconverter-deactivator.php';
75-
CBCurrencyConverter_Deactivator::deactivate();
76-
}
77-
78-
/**
79-
* The code that runs during plugin uninstallatiom.
80-
* This action is documented in includes/class-cbcurrencyconverter-.php
81-
*/
82-
/*function uninstall_cbcurrencyconverter() {
83-
require_once plugin_dir_path( __FILE__ ) . 'includes/class-cbcurrencyconverter-uninstall.php';
84-
CBCurrencyConverter_Uninstall::uninstall();
85-
}*/
79+
require_once plugin_dir_path( __FILE__ ) . 'includes/CBCurrencyConverterDeactivator.php';
80+
CBCurrencyConverterDeactivator::deactivate();
81+
}//end method deactivate_cbcurrencyconverter
8682

8783
register_activation_hook( __FILE__, 'activate_cbcurrencyconverter' );
8884
register_deactivation_hook( __FILE__, 'deactivate_cbcurrencyconverter' );
89-
//register_uninstall_hook( __FILE__, 'uninstall_cbcurrencyconverter' );
85+
9086

9187
/**
92-
* The core plugin class that is used to define internationalization,
93-
* admin-specific hooks, and public-facing site hooks.
88+
* Manually init the plugin
89+
*
90+
* @return CBCurrencyConverter|null
9491
*/
95-
require plugin_dir_path( __FILE__ ) . 'includes/class-cbcurrencyconverter.php';
92+
function cbcurrencyconverter_core() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
93+
global $cbcurrencyconverter_core;
94+
if ( ! isset( $cbcurrencyconverter_core ) ) {
95+
$cbcurrencyconverter_core = run_cbcurrencyconverter_pro();
96+
}
9697

98+
return $cbcurrencyconverter_core;
99+
}//end method cbcurrencyconverter_core
97100

98101
/**
99102
* Begins execution of the plugin.
@@ -108,4 +111,4 @@ function run_cbcurrencyconverter() {
108111
return CBCurrencyConverter::instance();
109112
}
110113

111-
$GLOBALS['cbcurrencyconverter'] = run_cbcurrencyconverter();
114+
$GLOBALS['cbcurrencyconverter_core'] = run_cbcurrencyconverter();
Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,24 @@ public static function instance() {
9898
return self::$instance;
9999
}//end method instance
100100

101+
/**
102+
* Cloning is forbidden.
103+
*
104+
* @since 3.1.7
105+
*/
106+
public function __clone() {
107+
cbcurrencyconverter_doing_it_wrong( __FUNCTION__, esc_html__( 'Cloning is forbidden.', 'cbcurrencyconverter' ), '3.1.7' );
108+
}//end method clone
109+
110+
/**
111+
* Unserializing instances of this class is forbidden.
112+
*
113+
* @since 3.1.7
114+
*/
115+
public function __wakeup() {
116+
cbcurrencyconverter_doing_it_wrong( __FUNCTION__, esc_html__( 'Unserializing instances of this class is forbidden.', 'cbcurrencyconverter' ), '3.1.7' );
117+
}//end method wakeup
118+
101119
/**
102120
* Get currency list
103121
*
@@ -116,8 +134,8 @@ public static function getCurrencyList() {
116134
*
117135
* - CBCurrencyConverter_Loader. Orchestrates the hooks of the plugin.
118136
* - CBCurrencyConverter_i18n. Defines internationalization functionality.
119-
* - CBCurrencyConverter_Admin. Defines all hooks for the admin area.
120-
* - CBCurrencyConverter_Public. Defines all hooks for the public side of the site.
137+
* - CBCurrencyConverterAdmin. Defines all hooks for the admin area.
138+
* - CBCurrencyConverterPublic. Defines all hooks for the public side of the site.
121139
*
122140
* Create an instance of the loader which will be used to register the hooks
123141
* with WordPress.
@@ -126,9 +144,9 @@ public static function getCurrencyList() {
126144
* @access private
127145
*/
128146
private function load_dependencies() {
129-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cbcurrencyconverter-tpl-loader.php';
130-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-cbcurrencyconverter-setting.php';
131-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-cbcurrencyconverter-helper.php';
147+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/Functions/cbcurrencyconverter-tpl-loader.php';
148+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/CBCurrencyconverterSetting.php';
149+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/Helpers/CBCurrencyConverterHelper.php';
132150

133151

134152
//exchange api class
@@ -139,13 +157,13 @@ private function load_dependencies() {
139157

140158

141159
//public and admin classes
142-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-cbcurrencyconverter-admin.php';
143-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-cbcurrencyconverter-public.php';
144-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cbcurrencyconverter-functions.php';
160+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/CBCurrencyConverterAdmin.php';
161+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/CBCurrencyConverterPublic.php';
162+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/Functions/cbcurrencyconverter-functions.php';
145163

146164
//widget classes
147-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'widgets/gutenberg/class-cbcurrencyconverter-gutenbergwidget.php';
148-
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'widgets/classic_widgets/class-cbcurrencyconverter-widget.php';
165+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/Widgets/Blocks/CBCurrencyConverterGutenbergWidget.php';
166+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/Widgets/Classic/CBCurrencyConverterWidget.php';
149167
}//end method load_dependencies
150168

151169

@@ -155,7 +173,7 @@ private function load_dependencies() {
155173
* @return void
156174
*/
157175
private function define_common_hooks() {
158-
add_action( 'plugins_loaded', [ $this, 'load_plugin_textdomain' ] );
176+
add_action( 'init', [ $this, 'load_plugin_textdomain' ] );
159177
}//end method define_common_hooks
160178

161179
/**
@@ -168,7 +186,7 @@ private function define_common_hooks() {
168186
private function define_admin_hooks() {
169187
global $wp_version;
170188

171-
$plugin_admin = new CBCurrencyConverter_Admin( $this->get_plugin_name(), $this->get_version() );
189+
$plugin_admin = new CBCurrencyConverterAdmin( $this->get_plugin_name(), $this->get_version() );
172190
$gutenberg_widget = new CBCurrencyConverterGutenbergWidget( $this->get_plugin_name(), $this->get_version() );
173191

174192

@@ -212,7 +230,7 @@ private function define_admin_hooks() {
212230
private function define_public_hooks() {
213231
global $plugin_public;
214232

215-
$plugin_public = new CBCurrencyConverter_Public( $this->get_plugin_name(), $this->get_version() );
233+
$plugin_public = new CBCurrencyConverterPublic( $this->get_plugin_name(), $this->get_version() );
216234

217235
add_action( 'wp_enqueue_scripts', [ $plugin_public, 'enqueue_styles' ] );
218236
add_action( 'wp_enqueue_scripts', [ $plugin_public, 'enqueue_scripts' ] );

0 commit comments

Comments
 (0)