Skip to content

Commit

Permalink
use Lowercase prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
torounit committed Jul 24, 2020
1 parent 619366e commit 0bd43be
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CPTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ private function load_modules() {
$this->set_module( 'flush_rules', new CPTP_Module_FlushRules() );

do_action( 'CPTP_load_modules', $this );
do_action( 'cptp_load_modules', $this );
}

/**
Expand All @@ -62,6 +63,7 @@ private function init_modules() {
}

do_action( 'CPTP_registered_modules', $this );
do_action( 'cptp_registered_modules', $this );
}

/**
Expand All @@ -74,6 +76,7 @@ private function init_modules() {
*/
public function set_module( $name, CPTP_Module $module ) {
$module = apply_filters( "CPTP_set_{$name}_module", $module );
$module = apply_filters( "cptp_set_{$name}_module", $module );
if ( $module instanceof CPTP_Module ) {
$this->modules[ $name ] = $module;
}
Expand All @@ -89,6 +92,7 @@ public function set_module( $name, CPTP_Module $module ) {
public function init() {
$this->init_modules();
do_action( 'CPTP_init' );
do_action( 'cptp_init' );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion CPTP/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final public function init() {
* Register hook on CPTP_init.
*/
public function register() {
add_action( 'CPTP_init', array( $this, 'add_hook' ) );
add_action( 'cptp_init', array( $this, 'add_hook' ) );
}

/**
Expand Down
12 changes: 9 additions & 3 deletions CPTP/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private static function is_rewrite_supported_by( $post_type ) {
* @param bool $support support CPTP.
*/
$support = apply_filters( "CPTP_is_rewrite_supported_by_${post_type}", $support );
$support = apply_filters( "cptp_is_rewrite_supported_by_${post_type}", $support );

/**
* Filters support CPTP for custom post type.
Expand All @@ -67,7 +68,8 @@ private static function is_rewrite_supported_by( $post_type ) {
* @param bool $support support CPTP.
* @param string $post_type post type name.
*/
return apply_filters( 'CPTP_is_rewrite_supported', $support, $post_type );
$support = apply_filters( 'CPTP_is_rewrite_supported', $support, $post_type );
return apply_filters( 'cptp_is_rewrite_supported', $support, $post_type );
}

/**
Expand Down Expand Up @@ -192,7 +194,8 @@ public static function get_permalink_structure( $post_type ) {
}
$structure = '/' . ltrim( $structure, '/' );

return apply_filters( 'CPTP_' . $post_type->name . '_structure', $structure );
$structure = apply_filters( 'CPTP_' . $post_type->name . '_structure', $structure );
return apply_filters( 'cptp_' . $post_type->name . '_structure', $structure );
}

/**
Expand Down Expand Up @@ -262,7 +265,10 @@ public static function get_date_front( $post_type ) {
$tok_index ++;
}

return apply_filters( 'CPTP_date_front', $front, $post_type, $structure );
$front = apply_filters( 'CPTP_date_front', $front, $post_type, $structure );
$front = apply_filters( 'cptp_date_front', $front, $post_type, $structure );

return $front;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/test-cptp-module-permalink.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public function test_to_private_post_type( $structure ) {
public function test_to_disable_post_type( $structure ) {
update_option( $this->post_type . '_structure', $structure );

add_filter( 'CPTP_is_rewrite_supported_by_' . $this->post_type, '__return_false' );
add_filter( 'cptp_is_rewrite_supported_by_' . $this->post_type, '__return_false' );

register_taxonomy(
$this->taxonomy,
Expand Down

0 comments on commit 0bd43be

Please sign in to comment.