| // +----------------------------------------------------------------------+ /** * Renders visualizer library page. * * @category Visualizer * @package Render * * @since 1.0.0 */ class Visualizer_Render_Library extends Visualizer_Render { /** * Renders chart's box block. * * @since 1.0.0 * * @access private * @param string $placeholder_id The placeholder's id for the chart. * @param int $chart_id The id of the chart. */ private function _renderChartBox( $placeholder_id, $chart_id ) { $ajax_url = admin_url( 'admin-ajax.php' ); $delete_url = add_query_arg( array( 'action' => Visualizer_Plugin::ACTION_DELETE_CHART, 'nonce' => wp_create_nonce(), 'chart' => $chart_id, ), $ajax_url ); $clone_url = add_query_arg( array( 'action' => Visualizer_Plugin::ACTION_CLONE_CHART, 'nonce' => wp_create_nonce( Visualizer_Plugin::ACTION_CLONE_CHART ), 'chart' => $chart_id, 'type' => $this->type, ), $ajax_url ); echo '
'; echo '
'; echo ''; echo '
'; echo ''; echo '
'; } /** * Renders library content. * * @since 1.0.0 * * @access private */ private function _renderLibrary() { echo '
'; echo ''; echo '
'; if ( !empty( $this->charts ) ) { echo '
'; foreach ( $this->charts as $placeholder_id => $chart ) { $this->_renderChartBox( $placeholder_id, $chart['id'] ); } echo '
'; if ( is_array( $this->pagination ) ) { echo ''; } } else { echo '
'; echo '
'; echo '
'; echo '
', esc_html__( 'No charts found', Visualizer_Plugin::NAME ), '
'; echo '
'; echo ''; echo '
'; echo '
'; } } /** * Renders library page. * * @since 1.0.0 * * @access protected */ protected function _toHTML() { echo '
'; echo '

'; echo '

'; esc_html_e( 'Visualizer Library', Visualizer_Plugin::NAME ); echo ' ', esc_html__( 'Add New', Visualizer_Plugin::NAME ), ''; echo '

'; $this->_renderMessages(); $this->_renderLibrary(); echo '
'; } /** * Renders notification messages if need be. * * @since 1.4.2 * * @access private */ private function _renderMessages() { if ( !filter_var( ini_get( 'allow_url_fopen' ), FILTER_VALIDATE_BOOLEAN ) ) { echo '
'; echo '

'; printf( esc_html__( '%s option is disabled in your php.ini config. Please, enable it by change its value to 1. This option increases the speed of remote CSV uploading.', Visualizer_Plugin::NAME ), 'allow_url_fopen' ); echo '

'; echo '
'; } } }