-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from jesseeproductions/Release/22.01
Release/22.01
- Loading branch information
Showing
58 changed files
with
10,048 additions
and
10,012 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,112 @@ | ||
<?php | ||
// Don't load directly | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
die( '-1' ); | ||
} | ||
|
||
if ( class_exists( 'Pngx__Add_Capabilities' ) ) { | ||
return; | ||
} | ||
|
||
|
||
/** | ||
* Class Pngx__Add_Capabilities | ||
* | ||
* Adds Capabilities for a CPT | ||
*/ | ||
class Pngx__Add_Capabilities { | ||
|
||
/** | ||
* constructor | ||
* | ||
* @param $post_type | ||
* @param $cap_plural | ||
*/ | ||
public function __construct( $capability_type ) { | ||
|
||
//Administrator | ||
$caps['administrator'] = array( | ||
"read_{$capability_type}", | ||
"read_private_{$capability_type}s", | ||
"edit_{$capability_type}", | ||
"edit_{$capability_type}s", | ||
"edit_private_{$capability_type}s", | ||
"edit_published_{$capability_type}s", | ||
"edit_others_{$capability_type}s", | ||
"publish_{$capability_type}s", | ||
"delete_{$capability_type}", | ||
"delete_{$capability_type}s", | ||
"delete_private_{$capability_type}s", | ||
"delete_published_{$capability_type}s", | ||
"delete_others_{$capability_type}s", | ||
); | ||
//Editor | ||
$caps['editor'] = array( | ||
"read_{$capability_type}", | ||
"read_private_{$capability_type}s", | ||
"edit_{$capability_type}", | ||
"edit_{$capability_type}s", | ||
"edit_private_{$capability_type}s", | ||
"edit_published_{$capability_type}s", | ||
"edit_others_{$capability_type}s", | ||
"publish_{$capability_type}s", | ||
"delete_{$capability_type}", | ||
"delete_{$capability_type}s", | ||
"delete_private_{$capability_type}s", | ||
"delete_published_{$capability_type}s", | ||
"delete_others_{$capability_type}s", | ||
); | ||
//Author | ||
$caps['author'] = array( | ||
"edit_{$capability_type}", | ||
"read_{$capability_type}", | ||
"delete_{$capability_type}", | ||
"delete_{$capability_type}s", | ||
"edit_{$capability_type}s", | ||
"publish_{$capability_type}s", | ||
"edit_published_{$capability_type}s", | ||
"delete_published_{$capability_type}s", | ||
); | ||
//Contributor | ||
$caps['contributor'] = array( | ||
"edit_{$capability_type}", | ||
"read_{$capability_type}", | ||
"delete_{$capability_type}", | ||
"delete_{$capability_type}s", | ||
"edit_{$capability_type}s", | ||
|
||
); | ||
//Subscriber | ||
$caps['subscriber'] = array( | ||
"read_{$capability_type}", | ||
); | ||
|
||
$roles = array( | ||
get_role( 'administrator' ), | ||
get_role( 'editor' ), | ||
get_role( 'author' ), | ||
get_role( 'contributor' ), | ||
get_role( 'subscriber' ), | ||
); | ||
|
||
//Add Capabilities to Role if Role Exists | ||
foreach ( $roles as $role ) { | ||
|
||
$role_check = ''; | ||
if ( is_object( $role ) ) { | ||
$role_check = get_role( $role->name ); | ||
} | ||
|
||
if ( ! empty( $role_check ) ) { | ||
foreach ( $caps[ $role->name ] as $cap ) { | ||
$role->add_cap( $cap ); | ||
} | ||
} | ||
} | ||
|
||
//Set Option to Prevent this from Running Again | ||
update_option( $capability_type . '_capabilities_register', date( 'l jS \of F Y h:i:s A' ) ); | ||
|
||
} | ||
|
||
<?php | ||
// Don't load directly | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
die( '-1' ); | ||
} | ||
|
||
if ( class_exists( 'Pngx__Add_Capabilities' ) ) { | ||
return; | ||
} | ||
|
||
|
||
/** | ||
* Class Pngx__Add_Capabilities | ||
* | ||
* Adds Capabilities for a CPT | ||
*/ | ||
class Pngx__Add_Capabilities { | ||
|
||
/** | ||
* constructor | ||
* | ||
* @param $post_type | ||
* @param $cap_plural | ||
*/ | ||
public function __construct( $capability_type ) { | ||
|
||
//Administrator | ||
$caps['administrator'] = array( | ||
"read_{$capability_type}", | ||
"read_private_{$capability_type}s", | ||
"edit_{$capability_type}", | ||
"edit_{$capability_type}s", | ||
"edit_private_{$capability_type}s", | ||
"edit_published_{$capability_type}s", | ||
"edit_others_{$capability_type}s", | ||
"publish_{$capability_type}s", | ||
"delete_{$capability_type}", | ||
"delete_{$capability_type}s", | ||
"delete_private_{$capability_type}s", | ||
"delete_published_{$capability_type}s", | ||
"delete_others_{$capability_type}s", | ||
); | ||
//Editor | ||
$caps['editor'] = array( | ||
"read_{$capability_type}", | ||
"read_private_{$capability_type}s", | ||
"edit_{$capability_type}", | ||
"edit_{$capability_type}s", | ||
"edit_private_{$capability_type}s", | ||
"edit_published_{$capability_type}s", | ||
"edit_others_{$capability_type}s", | ||
"publish_{$capability_type}s", | ||
"delete_{$capability_type}", | ||
"delete_{$capability_type}s", | ||
"delete_private_{$capability_type}s", | ||
"delete_published_{$capability_type}s", | ||
"delete_others_{$capability_type}s", | ||
); | ||
//Author | ||
$caps['author'] = array( | ||
"edit_{$capability_type}", | ||
"read_{$capability_type}", | ||
"delete_{$capability_type}", | ||
"delete_{$capability_type}s", | ||
"edit_{$capability_type}s", | ||
"publish_{$capability_type}s", | ||
"edit_published_{$capability_type}s", | ||
"delete_published_{$capability_type}s", | ||
); | ||
//Contributor | ||
$caps['contributor'] = array( | ||
"edit_{$capability_type}", | ||
"read_{$capability_type}", | ||
"delete_{$capability_type}", | ||
"delete_{$capability_type}s", | ||
"edit_{$capability_type}s", | ||
|
||
); | ||
//Subscriber | ||
$caps['subscriber'] = array( | ||
"read_{$capability_type}", | ||
); | ||
|
||
$roles = array( | ||
get_role( 'administrator' ), | ||
get_role( 'editor' ), | ||
get_role( 'author' ), | ||
get_role( 'contributor' ), | ||
get_role( 'subscriber' ), | ||
); | ||
|
||
//Add Capabilities to Role if Role Exists | ||
foreach ( $roles as $role ) { | ||
|
||
$role_check = ''; | ||
if ( is_object( $role ) ) { | ||
$role_check = get_role( $role->name ); | ||
} | ||
|
||
if ( ! empty( $role_check ) ) { | ||
foreach ( $caps[ $role->name ] as $cap ) { | ||
$role->add_cap( $cap ); | ||
} | ||
} | ||
} | ||
|
||
//Set Option to Prevent this from Running Again | ||
update_option( $capability_type . '_capabilities_register', date( 'l jS \of F Y h:i:s A' ) ); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.