*/ class Album_Reviewer_Renderer { /** * The model is responsible for business logic and database interaction. * * @since 1.0.0 * @access protected * @var Album_Reviewer_Model $pages */ protected $pages; protected $comments; /** * Initialize the collections used to maintain the actions and filters. * * @since 1.0.0 */ public function __construct( $pages, $comments ) { $this->pages = $pages; $this->comments = $comments; } /** * Logging. * * @since 1.0.0 */ public function log( $logentry ){ if( defined(PPP_ALBUM_REVIEW_DEBUG_RENDERER) ) { $upload_dir = wp_upload_dir(); file_put_contents( $upload_dir['basedir'] . '/pp_album.log' , "[" . current_time( 'mysql' ) . "] " . $logentry ."\n\n", FILE_APPEND | LOCK_EX); } } /** * Renders the custom album review view * * @since 1.0.0 * @access private */ public function render( $album_post ){ // kill any current output buffers if ( ob_get_length() > 0 ) { ob_end_clean(); } // flush previous output buffers if ( ! ( substr_count( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ob_start( "ob_gzhandler" ) ) ) { ob_start(); } // start render print $this->head($album_post); print $this->body($album_post); print $this->footer($album_post); status_header( '200' ); // end render ob_end_flush(); die(); // don't allow anyone else to mess with our view } /** * Generates head for the custom album review view * * @since 1.0.0 * @access private */ private function head( $album_post ) { $public_css =plugins_url('albumreviewer/public/css/album-reviewer-public.css'); $bootstrap_css = plugins_url('albumreviewer/bower_components/bootstrap/dist/css/bootstrap.css'); $head = "\n"; $head .= "
\n"; $head .= "\n"; $head .= "\n"; $head .= "\n"; return $head; } /** * Generates footer for custom album review view * * @since 1.0.0 * @access private */ private function footer( $album_post ) { $jquery_js = includes_url('js/jquery/jquery.js'); $public_js = plugins_url('albumreviewer/public/js/album-reviewer-public.js'); $bootstrap_js = plugins_url('albumreviewer/bower_components/bootstrap/dist/js/bootstrap.js'); $footer = "\n"; $footer .= "\n"; return $footer; } /** * Generates footer for custom album review view * * @since 1.0.0 * @access private */ private function body( $album_post ) { $options = array(); $options = apply_filters('pp_album_review_renderer_options', $options); if ( is_user_logged_in() ) $comment_from = 'designer_comment'; else $comment_from = 'client_comment'; $logo = $album_post['logo']; $logo_scale = $album_post['logo_scale']; $body = "\n"; $body .= "
"; $body .= "