Skip to content

Commit 2bcd6a6

Browse files
committed
version 1.0.2 released
1 parent 01a0e25 commit 2bcd6a6

File tree

5 files changed

+232
-225
lines changed

5 files changed

+232
-225
lines changed

includes/CBXTaxonomy.php

Lines changed: 1 addition & 221 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,9 @@ public function __construct() {
3838

3939
$this->include_files();
4040

41-
//$this->unit_testing();//don't delete this
42-
$this->load_orm();
4341

4442

45-
add_action( 'init', [ $this, 'load_plugin_textdomain' ]);
46-
add_filter( 'plugin_row_meta', [ $this, 'plugin_row_meta' ], 10, 4 );
47-
48-
//new Hooks();//we are not using the github update checker
43+
new Hooks();//we are not using the github update checker
4944
}//end of method constructor
5045

5146
/**
@@ -70,219 +65,4 @@ public static function instance() {
7065
private function include_files() {
7166
require_once __DIR__ . '/../lib/autoload.php';
7267
}//end method include_files
73-
74-
/**
75-
* Load textdomain
76-
*
77-
* @since 1.0.0
78-
*/
79-
public function load_plugin_textdomain() {
80-
load_plugin_textdomain( 'cbxtaxonomy', false, CBXTAXONOMY_ROOT_PATH . 'languages/' );
81-
}//end method load_plugin_textdomain
82-
83-
/**
84-
* Load ORM using helper class
85-
*
86-
* @since 1.0.0
87-
*/
88-
public function load_orm() {
89-
$taxonomy_helper = new CBXTaxonomyHelper();
90-
add_action( 'init', [ $taxonomy_helper, 'load_orm' ] );
91-
}// end of load_orm
92-
93-
/**
94-
* Filters the array of row meta for each/specific plugin in the Plugins list table.
95-
* Appends additional links below each/specific plugin on the plugins page.
96-
*
97-
* @access public
98-
*
99-
* @param array $links_array An array of the plugin's metadata
100-
* @param string $plugin_file_name Path to the plugin file
101-
* @param array $plugin_data An array of plugin data
102-
* @param string $status Status of the plugin
103-
*
104-
* @return array $links_array
105-
*/
106-
public function plugin_row_meta( $links_array, $plugin_file_name, $plugin_data, $status ) {
107-
if ( strpos( $plugin_file_name, CBXTAXONOMY_BASE_NAME ) !== false ) {
108-
if ( ! function_exists( 'is_plugin_active' ) ) {
109-
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
110-
}
111-
112-
$links_array[] = '<a target="_blank" style="color:#005ae0 !important; font-weight: bold;" href="https://github.com/codeboxrcodehub/cbxtaxonomy" aria-label="' . esc_attr__( 'Github Repo', 'cbxtaxonomy' ) . '">' . esc_html__( 'Github Repo', 'cbxtaxonomy' ) . '</a>';
113-
$links_array[] = '<a target="_blank" style="color:#005ae0 !important; font-weight: bold;" href="https://github.com/codeboxrcodehub/cbxtaxonomy/releases" aria-label="' . esc_attr__( 'Download', 'cbxtaxonomy' ) . '">' . esc_html__( 'Download Latest', 'cbxtaxonomy' ) . '</a>';
114-
}
115-
116-
return $links_array;
117-
}//end plugin_row_meta
118-
119-
/**
120-
* Run test hooks
121-
*
122-
* @since 1.0.0
123-
*/
124-
public function unit_testing() {
125-
if ( CBXTAXONOMY_DEV_MODE ) {
126-
add_action( 'cbxtaxonomy_taxable_delete_before', [
127-
$this,
128-
'cbxtaxonomy_taxable_delete_before_test'
129-
], 10, 3 );
130-
add_action( 'cbxtaxonomy_taxable_delete_after', [ $this, 'cbxtaxonomy_taxable_delete_after_test' ], 10, 3 );
131-
add_action( 'cbxtaxonomy_taxable_delete_failed', [
132-
$this,
133-
'cbxtaxonomy_taxable_delete_failed_test'
134-
], 10, 3 );
135-
136-
add_action( 'cbxtaxonomy_taxonomy_delete_before', [
137-
$this,
138-
'cbxtaxonomy_taxonomy_delete_before_test'
139-
], 10, 3 );
140-
add_action( 'cbxtaxonomy_taxonomy_delete_after', [
141-
$this,
142-
'cbxtaxonomy_taxonomy_delete_after_test'
143-
], 10, 3 );
144-
add_action( 'cbxtaxonomy_taxonomy_delete_failed', [
145-
$this,
146-
'cbxtaxonomy_taxonomy_delete_failed_test'
147-
], 10, 3 );
148-
149-
add_action( 'cbxtaxonomy_taxonomy_save_before', [ $this, 'cbxtaxonomy_taxonomy_save_before_test' ], 10, 2 );
150-
add_action( 'cbxtaxonomy_taxonomy_save_after', [ $this, 'cbxtaxonomy_taxonomy_save_after_test' ], 10, 2 );
151-
add_action( 'cbxtaxonomy_taxonomy_save_failed', [ $this, 'cbxtaxonomy_taxonomy_save_failed_test' ], 10, 2 );
152-
}
153-
} // end of unit_testing
154-
155-
/**
156-
* run before taxable delete
157-
*
158-
* @param $taxonomy_id
159-
* @param $type
160-
* @param $data
161-
*
162-
* @since 1.0.0
163-
*/
164-
public function cbxtaxonomy_taxable_delete_before_test( $taxonomy_id, $type, $data ) {
165-
if ( function_exists( 'write_log' ) ) {
166-
write_log( 'before taxable delete hook $taxonomy_id=' . $taxonomy_id . ' $type=' . $type );
167-
}
168-
}//end of cbxtaxonomy_taxable_delete_before_test
169-
170-
/**
171-
* run after taxable delete
172-
*
173-
* @param $taxonomy_id
174-
* @param $type
175-
* @param $data
176-
*
177-
* @since 1.0.0
178-
*/
179-
public function cbxtaxonomy_taxable_delete_after_test( $taxonomy_id, $type, $data ) {
180-
if ( function_exists( 'write_log' ) ) {
181-
write_log( 'before taxable delete hook $taxonomy_id=' . $taxonomy_id . ' $type=' . $type );
182-
}
183-
}//end of cbxtaxonomy_taxable_delete_after_test
184-
185-
/**
186-
* run on failed taxable delete
187-
*
188-
* @param $taxonomy_id
189-
* @param $type
190-
* @param $data
191-
*
192-
* @since 1.0.0
193-
*/
194-
public function cbxtaxonomy_taxable_delete_failed_test( $taxonomy_id, $type, $data ) {
195-
if ( function_exists( 'write_log' ) ) {
196-
write_log( 'before taxable delete hook $taxonomy_id=' . $taxonomy_id . ' $type=' . $type );
197-
}
198-
}//end of cbxtaxonomy_taxable_delete_failed_test
199-
200-
/**
201-
* run before taxonomy delete
202-
*
203-
* @param $id
204-
* @param $type
205-
* @param $data
206-
*
207-
* @since 1.0.0
208-
*/
209-
public function cbxtaxonomy_taxonomy_delete_before_test( $id, $type, $data ) {
210-
if ( function_exists( 'write_log' ) ) {
211-
write_log( $id . " here is the id => " . $type );
212-
}
213-
}//end of cbxtaxonomy_taxonomy_delete_before_test
214-
215-
/**
216-
* run after taxonomy delete
217-
*
218-
* @param $id
219-
* @param $type
220-
* @param $data
221-
*
222-
* @since 1.0.0
223-
*/
224-
public function cbxtaxonomy_taxonomy_delete_after_test( $id, $type, $data ) {
225-
if ( function_exists( 'write_log' ) ) {
226-
write_log( $id . " here is the id => " . $type );
227-
}
228-
}//end of cbxtaxonomy_taxonomy_delete_after_test
229-
230-
/**
231-
* run on fail taxonomy delete
232-
*
233-
* @param $id
234-
* @param $type
235-
* @param $data
236-
*
237-
* @since 1.0.0
238-
*/
239-
public function cbxtaxonomy_taxonomy_delete_failed_test( $id, $type, $data ) {
240-
if ( function_exists( 'write_log' ) ) {
241-
write_log( $id . " here is the id => " . $type );
242-
}
243-
}//end of cbxtaxonomy_taxonomy_delete_failed_test
244-
245-
/**
246-
* run before taxonomy save
247-
*
248-
* @param $type
249-
* @param $data
250-
*
251-
* @since 1.0.0
252-
*/
253-
public function cbxtaxonomy_taxonomy_save_before_test( $type, $data ) {
254-
if ( function_exists( 'write_log' ) ) {
255-
write_log( "taxonomy save here is the id => " . $type );
256-
} else {
257-
error_log( "taxonomy save here is the id => " . $type );//phpcs:ignore WARNING WordPress.PHP.DevelopmentFunctions.error_log_error_log
258-
}
259-
}//end of cbxtaxonomy_taxonomy_save_before_test
260-
261-
/**
262-
* run after taxonomy save
263-
*
264-
* @param $type
265-
* @param $data
266-
*
267-
* @since 1.0.0
268-
*/
269-
public function cbxtaxonomy_taxonomy_save_after_test( $type, $data ) {
270-
if ( function_exists( 'write_log' ) ) {
271-
write_log( "taxonomy save here is the id => " . $type );
272-
}
273-
}//end of cbxtaxonomy_taxonomy_save_after_test
274-
275-
/**
276-
* run on fail taxonomy save
277-
*
278-
* @param $type
279-
* @param $data
280-
*
281-
* @since 1.0.0
282-
*/
283-
public function cbxtaxonomy_taxonomy_save_failed_test( $type, $data ) {
284-
if ( function_exists( 'write_log' ) ) {
285-
write_log( "taxonomy save here is the id => " . $type );
286-
}
287-
}//end of cbxtaxonomy_taxonomy_save_failed_test
28868
}//end class CBXTaxonomy

includes/CBXTaxonomyHelper.php

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,40 @@ public function plugin_info( $res, $action, $args ) {
166166
'changelog' => isset( $remote_data['changelog'] ) ? wp_kses_post( $remote_data['changelog'] ) : '',
167167
],
168168
];
169-
170169
}//end method plugin_info
170+
171+
/**
172+
* Load textdomain
173+
*
174+
* @since 1.0.0
175+
*/
176+
public function load_plugin_textdomain() {
177+
load_plugin_textdomain( 'cbxtaxonomy', false, CBXTAXONOMY_ROOT_PATH . 'languages/' );
178+
}//end method load_plugin_textdomain
179+
180+
/**
181+
* Filters the array of row meta for each/specific plugin in the Plugins list table.
182+
* Appends additional links below each/specific plugin on the plugins page.
183+
*
184+
* @access public
185+
*
186+
* @param array $links_array An array of the plugin's metadata
187+
* @param string $plugin_file_name Path to the plugin file
188+
* @param array $plugin_data An array of plugin data
189+
* @param string $status Status of the plugin
190+
*
191+
* @return array $links_array
192+
*/
193+
public function plugin_row_meta( $links_array, $plugin_file_name, $plugin_data, $status ) {
194+
if ( strpos( $plugin_file_name, CBXTAXONOMY_BASE_NAME ) !== false ) {
195+
if ( ! function_exists( 'is_plugin_active' ) ) {
196+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
197+
}
198+
199+
$links_array[] = '<a target="_blank" style="color:#005ae0 !important; font-weight: bold;" href="https://github.com/codeboxrcodehub/cbxtaxonomy" aria-label="' . esc_attr__( 'Github Repo', 'cbxtaxonomy' ) . '">' . esc_html__( 'Github Repo', 'cbxtaxonomy' ) . '</a>';
200+
$links_array[] = '<a target="_blank" style="color:#005ae0 !important; font-weight: bold;" href="https://github.com/codeboxrcodehub/cbxtaxonomy/releases" aria-label="' . esc_attr__( 'Download', 'cbxtaxonomy' ) . '">' . esc_html__( 'Download Latest', 'cbxtaxonomy' ) . '</a>';
201+
}
202+
203+
return $links_array;
204+
}//end plugin_row_meta
171205
}//end class CBXTaxonomyHelper

0 commit comments

Comments
 (0)