' .
__( 'Affiliate requires the Multibyte String mbstring PHP extension.', AFFILIATE_PLUGIN_DOMAIN ) .
' ' .
__( 'Please ask your website administrator to enable this extension.', AFFILIATE_PLUGIN_DOMAIN ) .
'';
}
}
/**
* Renders accumulated admin notices.
*/
public static function admin_notices() {
if ( !empty( self::$admin_messages ) ) {
foreach ( self::$admin_messages as $msg ) {
echo $msg;
}
}
}
/**
* Returns the post types that we should handle.
*
* @access private
*/
public static function get_post_types() {
$post_types = get_option( 'affiliate-post-types', null );
if ( $post_types === null ) {
add_option( 'affiliate-post-types', array( 'post' => true, 'page' => true ), '', 'no' );
$post_types = get_option( 'affiliate-post-types', array( 'post' => true, 'page' => true ) );
}
return $post_types;
}
/**
* Determines the post types we should handle.
*
* @access private
*
* @param array $post_types maps string (post type) => boolean
*/
public static function set_post_types( $post_types ) {
update_option( 'affiliate-post-types', $post_types );
}
/**
* Whether keyword substitution for the post type is enabled.
*
* @access private
*
* @param string $post_type
* @return boolean
*/
public static function post_type_enabled( $post_type ) {
$post_types = self::get_post_types();
return isset( $post_types[$post_type] ) && $post_types[$post_type];
}
}
Affiliate::boot();