Skip to content

Commit 9a4256a

Browse files
committed
Merge branch 'dev'
2 parents 8319242 + 777ef26 commit 9a4256a

File tree

413 files changed

+30966
-4451
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

413 files changed

+30966
-4451
lines changed

.distignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.wordpress-org
2+
/.git
3+
/.github
4+
/node_modules
5+
6+
.distignore
7+
.gitignore
8+
.gitattributes

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Directories
2+
/.wordpress-org export-ignore
3+
/.github export-ignore
4+
5+
# Files
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore

.github/workflows/deploy.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*' # Match semantic versioning tags
7+
# Removed branches trigger to ensure it only runs on tags
8+
# branches:
9+
# - master
10+
11+
jobs:
12+
create_release:
13+
# No need to check against branches, workflow only triggers on tags
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Find Readme File
21+
id: find_readme
22+
run: |
23+
for file in readme.txt Readme.txt README.txt README.md Readme.md readme.md; do
24+
if [ -f "$file" ]; then
25+
echo "Readme file found: $file"
26+
echo "readme_file=$file" >> $GITHUB_ENV
27+
break
28+
fi
29+
done
30+
31+
# Ensure the variable is available within the current step
32+
source $GITHUB_ENV
33+
34+
if [ -z "$readme_file" ]; then
35+
echo "::error::Readme file not found."
36+
exit 1
37+
fi
38+
39+
- name: Extract Release Notes
40+
id: release_notes
41+
run: |
42+
changelog_section_start="== Changelog =="
43+
readme_file="$readme_file"
44+
45+
# Extract the tag name from GITHUB_REF (plugin_version)
46+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
47+
plugin_version="${GITHUB_REF#refs/tags/}"
48+
echo "DEBUG: Plugin latest version found: $plugin_version."
49+
else
50+
echo "::error::This workflow must be triggered by a tag push."
51+
exit 1
52+
fi
53+
54+
in_changelog=0
55+
found_version=0
56+
release_notes=""
57+
58+
echo "DEBUG: Starting to extract release notes from $readme_file for version $plugin_version."
59+
60+
while IFS= read -r line; do
61+
echo "DEBUG: Processing line: $line"
62+
63+
# Start processing after the changelog header
64+
if [[ "$line" == "$changelog_section_start" ]]; then
65+
in_changelog=1
66+
echo "DEBUG: Found changelog section header."
67+
continue
68+
fi
69+
70+
# Skip if not in changelog section
71+
if [[ $in_changelog -eq 0 ]]; then
72+
echo "DEBUG: Skipping line (not in changelog section)."
73+
continue
74+
fi
75+
76+
# Check for the current version header
77+
if [[ "$line" == "= ${plugin_version} =" ]]; then
78+
found_version=1
79+
echo "DEBUG: Found version header for $plugin_version."
80+
continue
81+
fi
82+
83+
# Break if a new version header is found after the current version
84+
if [[ $found_version -eq 1 ]] && echo "$line" | grep -qE '^= [0-9]+\.[0-9]+\.[0-9]+ =$'; then
85+
echo "DEBUG: Found a new version header. Stopping collection."
86+
break
87+
fi
88+
89+
# Collect lines starting with '*' if we are in the current version section
90+
if [[ $found_version -eq 1 ]] && echo "$line" | grep -qE '^\*'; then
91+
echo "DEBUG: Found changelog entry: $line"
92+
release_notes+="${line}\n"
93+
continue
94+
fi
95+
96+
# Log skipped lines in the current version section
97+
if [[ $found_version -eq 1 ]]; then
98+
echo "DEBUG: Skipping line (not a changelog entry): $line"
99+
fi
100+
done < "$readme_file"
101+
102+
if [[ -z "$release_notes" ]]; then
103+
echo "::error::Failed to extract release notes for version ${plugin_version}."
104+
exit 1
105+
fi
106+
107+
echo "DEBUG: Successfully extracted release notes."
108+
echo "DEBUG: Release notes content:"
109+
echo -e "$release_notes"
110+
111+
# Write the release notes with actual line breaks
112+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
113+
echo -e "$release_notes" >> $GITHUB_ENV
114+
echo "EOF" >> $GITHUB_ENV
115+
116+
- name: Create zip file
117+
run: |
118+
REPO_NAME=$(basename `git rev-parse --show-toplevel`)
119+
zip -r ${REPO_NAME}.zip . -x '*.git*' -x '.github/*' -x '*.distignore*' -x 'CHANGELOG.txt'
120+
echo "repo_name=${REPO_NAME}" >> $GITHUB_ENV
121+
122+
# Source to make repo_name available in subsequent steps
123+
source $GITHUB_ENV
124+
125+
- name: Create Release
126+
id: create_release
127+
uses: actions/create-release@v1
128+
env:
129+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
with:
131+
tag_name: ${{ github.ref_name }}
132+
release_name: "${{ github.ref_name }}"
133+
body: ${{ env.RELEASE_NOTES }}
134+
draft: false
135+
prerelease: false
136+
137+
- name: Upload Release Asset
138+
uses: actions/upload-release-asset@v1
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141+
with:
142+
upload_url: ${{ steps.create_release.outputs.upload_url }}
143+
asset_path: ./${{ env.repo_name }}.zip
144+
asset_name: ${{ env.repo_name }}.zip
145+
asset_content_type: application/zip

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
script.sh

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Open source Taxonomy plugin
1+
WordPress helper plugin for creating custom taxonomy (category, tag) inside WordPress
22

33
## Description
44
Open source plugin for creating category and tag. In this plugin we have used custom table for creating the categories and tags so that it uses less resource.
@@ -7,7 +7,7 @@ Software requirements
77

88
The following software is required to develop using CBXTaxonomy:
99

10-
* PHP version 7.4 or newer
10+
* PHP version 8.2 or newer
1111

1212

1313
## Installation

README.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
=== CBX Taxonomy Library ===
1+
=== CBX Taxonomy ===
22
Contributors: codeboxr, manchumahara
3-
Requires at least: 3.5
4-
Tested up to: 6.4.3
5-
Stable tag: 1.0.5
3+
Requires at least: 5.3
4+
Tested up to: 6.7.2
5+
Stable tag: 1.0.1
66
License: MIT
77
License URI: https://github.com/codeboxrcodehub/cbxwptaxonomy/blob/master/LICENSE.txt
88

9-
Open source Taxonomy plugin
9+
WordPress helper plugin for creating custom taxonomy (category, tag) inside WordPress
1010

1111
== Description ==
1212

@@ -16,7 +16,7 @@ Software requirements
1616

1717
The following software is required to develop using CBXTaxonomy:
1818

19-
* PHP version 7.4 or newer
19+
* PHP version 8.2 or newer
2020

2121

2222

cbxtaxonomy.php

Lines changed: 60 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,63 +15,92 @@
1515
* @wordpress-plugin
1616
* Plugin Name: CBX Taxonomy
1717
* Plugin URI: https://wordpress.org/plugins/cbxtaxonomy
18-
* Description: Custom taxonomy system for custom table/custom object types. This feature plugin is required for CBXResume, CBXJob and others codeboxr's plugins.
19-
* Version: 1.0.0
20-
* Requires at least: 3.5
21-
* Requires PHP: 7.4
18+
* Description: Custom taxonomy system for custom table/custom object types. This feature plugin is required for ComfortResume, ComfortJob and others plugins.
19+
* Version: 1.0.1
20+
* Requires at least: 5.3
21+
* Requires PHP: 8.2
2222
* Author: Codeboxr
2323
* Author URI: https://codeboxr.com
2424
* License: GPL-2.0+
2525
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
26-
* Text Domain: cbxtaxonomy
26+
* Text Domain: cbxwptaxonomy
2727
* Domain Path: /languages
2828
*/
2929

3030
// If this file is called directly, abort.
31-
if (!defined('WPINC')) {
31+
if ( ! defined( 'WPINC' ) ) {
3232
die;
3333
}
3434

35-
defined('CBXTAXONOMY_PLUGIN_NAME') or define('CBXTAXONOMY_PLUGIN_NAME', 'cbxtaxonomy');
36-
defined('CBXTAXONOMY_PLUGIN_VERSION') or define('CBXTAXONOMY_PLUGIN_VERSION', '1.0.0');
37-
defined('CBXTAXONOMY_BASE_NAME') or define('CBXTAXONOMY_BASE_NAME', plugin_basename(__FILE__));
38-
defined('CBXTAXONOMY_ROOT_PATH') or define('CBXTAXONOMY_ROOT_PATH', plugin_dir_path(__FILE__));
39-
defined('CBXTAXONOMY_ROOT_URL') or define('CBXTAXONOMY_ROOT_URL', plugin_dir_url(__FILE__));
40-
defined('CBXTAXONOMY_DEV_MODE') or define('CBXTAXONOMY_DEV_MODE', true);
35+
use Cbx\Taxonomy\CBXTaxonomyHelper;
4136

42-
require_once CBXTAXONOMY_ROOT_PATH . "lib/autoload.php";
37+
defined( 'CBXTAXONOMY_PLUGIN_NAME' ) or define( 'CBXTAXONOMY_PLUGIN_NAME', 'cbxtaxonomy' );
38+
defined( 'CBXTAXONOMY_PLUGIN_VERSION' ) or define( 'CBXTAXONOMY_PLUGIN_VERSION', '1.0.1' );
39+
defined( 'CBXTAXONOMY_BASE_NAME' ) or define( 'CBXTAXONOMY_BASE_NAME', plugin_basename( __FILE__ ) );
40+
defined( 'CBXTAXONOMY_ROOT_PATH' ) or define( 'CBXTAXONOMY_ROOT_PATH', plugin_dir_path( __FILE__ ) );
41+
defined( 'CBXTAXONOMY_ROOT_URL' ) or define( 'CBXTAXONOMY_ROOT_URL', plugin_dir_url( __FILE__ ) );
4342

44-
register_activation_hook(__FILE__, 'activate_cbxtaxonomy');
45-
register_deactivation_hook(__FILE__, 'deactivate_cbxtaxonomy');
43+
//for development purpose only
44+
defined( 'CBXTAXONOMY_DEV_MODE' ) or define( 'CBXTAXONOMY_DEV_MODE', true );
45+
46+
// Include the main CBXTaxonomy class.
47+
if ( ! class_exists( 'CBXTaxonomy', false ) ) {
48+
include_once CBXTAXONOMY_ROOT_PATH . 'includes/CBXTaxonomy.php';
49+
}
50+
51+
52+
register_activation_hook( __FILE__, 'activate_cbxtaxonomy' );
53+
register_deactivation_hook( __FILE__, 'deactivate_cbxtaxonomy' );
4654

4755
/**
4856
* * The code that runs during plugin activation.
4957
* The code that runs during plugin deactivation.
5058
*/
51-
function activate_cbxtaxonomy()
52-
{
53-
\Cbx\Taxonomy\CBXTaxonomyHelper::load_orm();
54-
\Cbx\Taxonomy\CBXTaxonomyHelper::active_plugin();
55-
}
59+
function activate_cbxtaxonomy() {
60+
cbxtaxonomy();
61+
62+
CBXTaxonomyHelper::load_orm();
63+
CBXTaxonomyHelper::active_plugin();
64+
}//end function activate_cbxtaxonomy
5665

5766
/**
5867
* The code that runs during plugin deactivation.
5968
*/
60-
function deactivate_cbxtaxonomy()
61-
{
62-
\Cbx\Taxonomy\CBXTaxonomyHelper::load_orm();
63-
}
69+
function deactivate_cbxtaxonomy() {
70+
//cbxtaxonomy();
71+
//CBXTaxonomyHelper::load_orm();
72+
}//end function deactivate_cbxtaxonomy
6473

6574

6675
/**
67-
* Init cbxtaxonomy plugin
76+
* Returns the main instance of CBXTaxonomy.
77+
*
78+
* @since 1.0
6879
*/
69-
function cbxtaxonomy()
70-
{
71-
if (defined('CBXTAXONOMY_PLUGIN_NAME')) {
72-
\Cbx\Taxonomy\CBXTaxonomy::instance();
80+
function cbxtaxonomy() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
81+
global $cbxtaxonomy;
82+
83+
// If the global variable is not already set, initialize it
84+
if ( ! isset( $cbxtaxonomy ) ) {
85+
$cbxtaxonomy = run_cbxtaxonomy();
7386
}
74-
}//end function cbxtaxonomy
7587

76-
add_action('plugins_loaded', 'cbxtaxonomy');
88+
return $cbxtaxonomy;
89+
}//end function cbxtaxonomy_core
90+
91+
/**
92+
* Initialize ComfortResume pro plugin
93+
* @since 1.0.0
94+
*/
95+
function run_cbxtaxonomy() {
96+
return CBXTaxonomy::instance();
97+
}//end function run_cbxtaxonomy
98+
99+
/**
100+
* Init cbxtaxonomy plugin
101+
*/
102+
function cbxtaxonomy_init() {
103+
$GLOBALS['cbxtaxonomy'] = run_cbxtaxonomy();
104+
}//end function cbxtaxonomy_init
77105

106+
add_action( 'plugins_loaded', 'cbxtaxonomy_init' );

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cbx/taxonomy",
3-
"description": "cbx taxonomy plugin",
3+
"description": "WordPress Custom Taxonomy Plugin",
44
"type": "library",
55
"license": "MIT",
66
"config": {

0 commit comments

Comments
 (0)