dir = plugin_dir_path( __FILE__ ); $this->url = plugin_dir_url( __FILE__ ); require dirname( __FILE__ ) . "/inc/query-manipulation.php"; $this->query_manipulation = new QueryManipulation( $this ); require dirname( __FILE__ ) . "/inc/meta-box.php"; $this->meta_box = new MetaBox( $this ); require dirname( __FILE__ ) . "/inc/user.php"; $this->user = new User( $this ); require dirname( __FILE__ ) . "/inc/render.php"; $this->render = new Render( $this ); require dirname( __FILE__ ) . "/inc/migrate.php"; $this->migrate = new Migrate( $this ); } /** * get the additions authors user ids * * @param null|int $post_id * * @return array */ public function get_ids( $post_id = null ) { /** * first id is main author */ $post = get_post( $post_id ); $additional_authors_ids = array( $post->post_author, ); /** * than get all additional ids */ if ( ! empty( $post_id ) ) { $additional_authors_ids_as_string = get_post_custom_values( self::META_POST_ADDITIONAL_AUTHORS, $post_id ); } else { $additional_authors_ids_as_string = get_post_custom_values( self::META_POST_ADDITIONAL_AUTHORS ); } if ( ! empty( $additional_authors_ids_as_string ) ) { foreach ( $additional_authors_ids_as_string as $author_id_as_string ) { if ( is_numeric( $author_id_as_string ) ) { $author_id = intval( $author_id_as_string ); if ( $author_id > 0 ) { $additional_authors_ids[] = $author_id; } } } } return array_unique( $additional_authors_ids ); } /** * Add an unguessable string to end * * @return string */ public function generateUnguessableString() { return bin2hex( openssl_random_pseudo_bytes( 20 ) ); } /** * generate a strong password * @return string */ public function generatePassword() { return wp_generate_password( 20, true ); } } /** * init plugin and make it accessible */ Plugin::get_instance(); require_once dirname( __FILE__ ) . "/public-functions.php";