From 9d39b7c9d671c83d884d3d52a0855af41154372c Mon Sep 17 00:00:00 2001 From: Shane Coll Date: Fri, 8 May 2015 22:25:12 -0400 Subject: [PATCH 1/7] Moved functions around in anticipation of class implementation --- includes/class-pg-functions.php | 72 ++++++++++++++++++++++ includes/class-pg-settings.php | 104 ++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+) diff --git a/includes/class-pg-functions.php b/includes/class-pg-functions.php index e69de29..2cb2e1a 100644 --- a/includes/class-pg-functions.php +++ b/includes/class-pg-functions.php @@ -0,0 +1,72 @@ +get_row( "SELECT * FROM wp_posts WHERE post_title = '" . $title_str . "'", 'ARRAY_A'); +} + +/** + * Generates the body of the table. + * + * @since 0.1 + * @param TODO Set default values for no option recall + * @return string $tableBody the body of the table + */ +function pg_table_body() { + if(get_option('pg_rows_number') == NULL){ + $rows= 4; + } + else { + $rows= get_option('pg_rows_number'); + } + + for( $i = 0; $i < $rows; $i++ ){ + $tableRows[$i]= "" . + pg_table_data() + . ""; + } + $tableBody = implode( $tableRows ); + return $tableBody; +} + +/** + * Generates the columns of the table and insets their data. + * + * @since 0.1 + * @param TODO Set default values for no option recall + * @return string $data the data of each cell + */ +function pg_table_data(){ + if(get_option('pg_columns_number') == NULL){ + $columns = 4; + } + else { + $columns = get_option('pg_columns_number'); + } + + for( $i = 0; $i < $columns; $i++ ){ + $tableColumns[$i]= " + Picture will go here + "; + } + $data = implode( $tableColumns ); + return $data; +} + diff --git a/includes/class-pg-settings.php b/includes/class-pg-settings.php index e69de29..7f568a9 100644 --- a/includes/class-pg-settings.php +++ b/includes/class-pg-settings.php @@ -0,0 +1,104 @@ +Set up your Printable Gallery

'; +} + +/** + * Generates the rows field + * + * If there is no option value, the it displays "4" as the default value + * + * @since 0.1 + */ +function pg_settings_rows_num_callback(){ + if(get_option('pg_rows_number') == NULL){ + echo ''; + } + else { + echo ''; + } +} + +/** + * Generates the columns field + * + * If there is no option value, the it displays "4" as the default value + * + * @since 0.1 + */ +function pg_settings_columns_num_callback(){ + if(get_option('pg_columns_number') == NULL){ + echo ''; + } + else { + echo ''; + } +} + +/** + * Generates the gallery name field + * + * If there is no option value, the it displays "Gallery Name" as the default value + * + * @since 0.1 + */ +function pg_settings_gallery_name_callback(){ + if(get_option('pg_gallery_name') == NULL){ + echo ''; + } + else { + echo ''; + } +} From 57fd3cc2dc0be573a7c9d2c1376e1657fb0348c5 Mon Sep 17 00:00:00 2001 From: Shane Coll Date: Fri, 8 May 2015 22:28:23 -0400 Subject: [PATCH 2/7] Code Format --- printable-gallery.php | 108 +++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/printable-gallery.php b/printable-gallery.php index 42b47cb..254a830 100644 --- a/printable-gallery.php +++ b/printable-gallery.php @@ -6,7 +6,7 @@ Version: 0.2 Author: Shane W. Coll Author URI: http://shanecoll.com -*/ + */ //TODO IMPLEMENT OBJECT ORIENTATION @@ -18,15 +18,15 @@ */ function pg_generateTable( ) { if(pg_exist_post_by_title('Table Page' ) == NULL ){ - //Creating the $post array - $post = array( - 'post_title' => 'Table Page', - 'post_content'=> " - " . - pg_table_body() - . " -
" - ); wp_insert_post( $post ); + //Creating the $post array + $post = array( + 'post_title' => 'Table Page', + 'post_content'=> " + " . + pg_table_body() + . " +
" + ); wp_insert_post( $post ); } } /** @@ -39,8 +39,8 @@ function pg_generateTable( ) { * @return void */ function pg_exist_post_by_title( $title_str ) { - global $wpdb; - return $wpdb->get_row( "SELECT * FROM wp_posts WHERE post_title = '" . $title_str . "'", 'ARRAY_A'); + global $wpdb; + return $wpdb->get_row( "SELECT * FROM wp_posts WHERE post_title = '" . $title_str . "'", 'ARRAY_A'); } /** @@ -58,13 +58,13 @@ function pg_table_body() { $rows= get_option('pg_rows_number'); } - for( $i = 0; $i < $rows; $i++ ){ - $tableRows[$i]= "" . - pg_table_data() - . ""; - } - $tableBody = implode( $tableRows ); - return $tableBody; + for( $i = 0; $i < $rows; $i++ ){ + $tableRows[$i]= "" . + pg_table_data() + . ""; + } + $tableBody = implode( $tableRows ); + return $tableBody; } /** @@ -81,14 +81,14 @@ function pg_table_data(){ else { $columns = get_option('pg_columns_number'); } - - for( $i = 0; $i < $columns; $i++ ){ - $tableColumns[$i]= " - Picture will go here - "; - } - $data = implode( $tableColumns ); - return $data; + + for( $i = 0; $i < $columns; $i++ ){ + $tableColumns[$i]= " + Picture will go here + "; + } + $data = implode( $tableColumns ); + return $data; } /** @@ -98,33 +98,33 @@ function pg_table_data(){ */ function pg_settings_api() { -add_settings_section('pg_settings_section', - 'Printable Gallery Settings', - 'pg_settings_section_callback_function', - 'media'); - -add_settings_field('pg_gallery_name', - 'Gallery Name:', - 'pg_settings_gallery_name_callback', - 'media', - 'pg_settings_section'); - -add_settings_field('pg_rows_number', - 'Rows of images:', - 'pg_settings_rows_num_callback', - 'media', - 'pg_settings_section'); - -add_settings_field('pg_columns_number', - 'Columns of images:', - 'pg_settings_columns_num_callback', - 'media', - 'pg_settings_section'); - -register_setting('media', 'pg_columns_number'); -register_setting('media', 'pg_gallery_name'); -register_setting('media', 'pg_rows_number'); -pg_generateTable(); + add_settings_section('pg_settings_section', + 'Printable Gallery Settings', + 'pg_settings_section_callback_function', + 'media'); + + add_settings_field('pg_gallery_name', + 'Gallery Name:', + 'pg_settings_gallery_name_callback', + 'media', + 'pg_settings_section'); + + add_settings_field('pg_rows_number', + 'Rows of images:', + 'pg_settings_rows_num_callback', + 'media', + 'pg_settings_section'); + + add_settings_field('pg_columns_number', + 'Columns of images:', + 'pg_settings_columns_num_callback', + 'media', + 'pg_settings_section'); + + register_setting('media', 'pg_columns_number'); + register_setting('media', 'pg_gallery_name'); + register_setting('media', 'pg_rows_number'); + pg_generateTable(); } add_action('admin_init', 'pg_settings_api'); From 95112599a3c2a17dfc913d3e619e79cc7ee6914f Mon Sep 17 00:00:00 2001 From: Shane Coll Date: Sat, 9 May 2015 21:40:40 -0400 Subject: [PATCH 3/7] rudimentary object orientation implemented --- includes/class-pg-functions.php | 112 +++++++++++--------- includes/settings.php | 101 ++++++++++++++++++ printable-gallery.php | 174 +++----------------------------- 3 files changed, 183 insertions(+), 204 deletions(-) create mode 100644 includes/settings.php diff --git a/includes/class-pg-functions.php b/includes/class-pg-functions.php index 2cb2e1a..1a19c53 100644 --- a/includes/class-pg-functions.php +++ b/includes/class-pg-functions.php @@ -17,56 +17,78 @@ * @param string $title_str the title of the page being checked * @return void */ -function pg_exist_post_by_title( $title_str ) { - global $wpdb; - return $wpdb->get_row( "SELECT * FROM wp_posts WHERE post_title = '" . $title_str . "'", 'ARRAY_A'); -} - -/** - * Generates the body of the table. - * - * @since 0.1 - * @param TODO Set default values for no option recall - * @return string $tableBody the body of the table - */ -function pg_table_body() { - if(get_option('pg_rows_number') == NULL){ - $rows= 4; - } - else { - $rows= get_option('pg_rows_number'); +class PG_FUNCTIONS{ + public static function pg_exist_post_by_title( $title_str ) { + global $wpdb; + return $wpdb->get_row( "SELECT * FROM wp_posts WHERE post_title = '" . $title_str . "'", 'ARRAY_A'); } - for( $i = 0; $i < $rows; $i++ ){ - $tableRows[$i]= "" . - pg_table_data() - . ""; + /** + * Generates a table according to user specs and inserts it into a new post. + * + * @since 0.1 + * @return void + */ + public static function pg_generateTable( ) { + if(PG_FUNCTIONS::pg_exist_post_by_title('Table Page' ) == NULL ){ + //Creating the $post array + $post = array( + 'post_title' => 'Table Page', + 'post_content'=> " + " . + PG_FUNCTIONS::pg_table_body() + . " +
" + ); wp_insert_post( $post ); + } } - $tableBody = implode( $tableRows ); - return $tableBody; -} -/** - * Generates the columns of the table and insets their data. - * - * @since 0.1 - * @param TODO Set default values for no option recall - * @return string $data the data of each cell - */ -function pg_table_data(){ - if(get_option('pg_columns_number') == NULL){ - $columns = 4; - } - else { - $columns = get_option('pg_columns_number'); + /** + * Generates the body of the table. + * + * @since 0.1 + * @param TODO Set default values for no option recall + * @return string $tableBody the body of the table + */ + public static function pg_table_body() { + if(get_option('pg_rows_number') == NULL){ + $rows= 4; + } + else { + $rows= get_option('pg_rows_number'); + } + + for( $i = 0; $i < $rows; $i++ ){ + $tableRows[$i]= "" . + PG_FUNCTIONS::pg_table_data() + . ""; + } + $tableBody = implode( $tableRows ); + return $tableBody; } - for( $i = 0; $i < $columns; $i++ ){ - $tableColumns[$i]= " - Picture will go here - "; + /** + * Generates the columns of the table and insets their data. + * + * @since 0.1 + * @param TODO Set default values for no option recall + * @return string $data the data of each cell + */ + public static function pg_table_data(){ + if(get_option('pg_columns_number') == NULL){ + $columns = 4; + } + else { + $columns = get_option('pg_columns_number'); + } + + for( $i = 0; $i < $columns; $i++ ){ + $tableColumns[$i]= " + Picture will go here + "; + } + $data = implode( $tableColumns ); + return $data; } - $data = implode( $tableColumns ); - return $data; -} +} diff --git a/includes/settings.php b/includes/settings.php new file mode 100644 index 0000000..ad9e386 --- /dev/null +++ b/includes/settings.php @@ -0,0 +1,101 @@ +Set up your Printable Gallery

'; +} + +/** + * Generates the rows field + * + * If there is no option value, the it displays "4" as the default value + * + * @since 0.1 + */ +function pg_settings_rows_num_callback(){ + if(get_option('pg_rows_number') == NULL){ + echo ''; + } + else { + echo ''; + } +} + +/** + * Generates the columns field + * + * If there is no option value, the it displays "4" as the default value + * + * @since 0.1 + */ +function pg_settings_columns_num_callback(){ + if(get_option('pg_columns_number') == NULL){ + echo ''; + } + else { + echo ''; + } +} + +/** + * Generates the gallery name field + * + * If there is no option value, the it displays "Gallery Name" as the default value + * + * @since 0.1 + */ +function pg_settings_gallery_name_callback(){ + if(get_option('pg_gallery_name') == NULL){ + echo ''; + } + else { + echo ''; + } +} diff --git a/printable-gallery.php b/printable-gallery.php index 254a830..1809aa7 100644 --- a/printable-gallery.php +++ b/printable-gallery.php @@ -10,178 +10,34 @@ //TODO IMPLEMENT OBJECT ORIENTATION -/** - * Generates a table according to user specs and inserts it into a new post. - * - * @since 0.1 - * @return void - */ -function pg_generateTable( ) { - if(pg_exist_post_by_title('Table Page' ) == NULL ){ - //Creating the $post array - $post = array( - 'post_title' => 'Table Page', - 'post_content'=> " - " . - pg_table_body() - . " -
" - ); wp_insert_post( $post ); - } -} -/** - * Check whether or not the table page already exists. - * - * If the table page does not exist, it creates a new one. - * - * @since 0.1 - * @param string $title_str the title of the page being checked - * @return void - */ -function pg_exist_post_by_title( $title_str ) { - global $wpdb; - return $wpdb->get_row( "SELECT * FROM wp_posts WHERE post_title = '" . $title_str . "'", 'ARRAY_A'); -} - -/** - * Generates the body of the table. - * - * @since 0.1 - * @param TODO Set default values for no option recall - * @return string $tableBody the body of the table - */ -function pg_table_body() { - if(get_option('pg_rows_number') == NULL){ - $rows= 4; - } - else { - $rows= get_option('pg_rows_number'); - } - - for( $i = 0; $i < $rows; $i++ ){ - $tableRows[$i]= "" . - pg_table_data() - . ""; - } - $tableBody = implode( $tableRows ); - return $tableBody; -} - -/** - * Generates the columns of the table and insets their data. - * - * @since 0.1 - * @param TODO Set default values for no option recall - * @return string $data the data of each cell - */ -function pg_table_data(){ - if(get_option('pg_columns_number') == NULL){ - $columns = 4; - } - else { - $columns = get_option('pg_columns_number'); - } - - for( $i = 0; $i < $columns; $i++ ){ - $tableColumns[$i]= " - Picture will go here - "; - } - $data = implode( $tableColumns ); - return $data; -} +//Exit if accessed directly +if ( !defined( 'ABSPATH' ) ) exit; +require_once "includes/class-pg-functions.php"; +require_once "includes/settings.php"; /** - * Generates the settings page and handles user input. + * Main Printable_Gallery Class * - * @since 0.1 + * @since 0.2 */ -function pg_settings_api() { - - add_settings_section('pg_settings_section', - 'Printable Gallery Settings', - 'pg_settings_section_callback_function', - 'media'); - add_settings_field('pg_gallery_name', - 'Gallery Name:', - 'pg_settings_gallery_name_callback', - 'media', - 'pg_settings_section'); +class Printable_Gallery { - add_settings_field('pg_rows_number', - 'Rows of images:', - 'pg_settings_rows_num_callback', - 'media', - 'pg_settings_section'); + private static $instance; - add_settings_field('pg_columns_number', - 'Columns of images:', - 'pg_settings_columns_num_callback', - 'media', - 'pg_settings_section'); + public static function instance() { - register_setting('media', 'pg_columns_number'); - register_setting('media', 'pg_gallery_name'); - register_setting('media', 'pg_rows_number'); - pg_generateTable(); -} + self::$instance = new Printable_Gallery; -add_action('admin_init', 'pg_settings_api'); + add_action('admin_init', 'pg_settings_api'); -/** - * Prints message in the Gallery settings section - * - * @since 0.1 - */ -function pg_settings_section_callback_function(){ - echo '

Set up your Printable Gallery

'; -} + self::$instance->functions = new PG_FUNCTIONS(); -/** - * Generates the rows field - * - * If there is no option value, the it displays "4" as the default value - * - * @since 0.1 - */ -function pg_settings_rows_num_callback(){ - if(get_option('pg_rows_number') == NULL){ - echo ''; } - else { - echo ''; - } } -/** - * Generates the columns field - * - * If there is no option value, the it displays "4" as the default value - * - * @since 0.1 - */ -function pg_settings_columns_num_callback(){ - if(get_option('pg_columns_number') == NULL){ - echo ''; - } - else { - echo ''; - } +function PG() { + Printable_Gallery::instance(); } -/** - * Generates the gallery name field - * - * If there is no option value, the it displays "Gallery Name" as the default value - * - * @since 0.1 - */ -function pg_settings_gallery_name_callback(){ - if(get_option('pg_gallery_name') == NULL){ - echo ''; - } - else { - echo ''; - } -} +PG(); From c86fb1ea0b865489da9f5b5eb247d9377eeb11b5 Mon Sep 17 00:00:00 2001 From: Shane Coll Date: Sat, 9 May 2015 21:44:34 -0400 Subject: [PATCH 4/7] decided to not use settings as a class --- includes/class-pg-settings.php | 104 --------------------------------- 1 file changed, 104 deletions(-) delete mode 100644 includes/class-pg-settings.php diff --git a/includes/class-pg-settings.php b/includes/class-pg-settings.php deleted file mode 100644 index 7f568a9..0000000 --- a/includes/class-pg-settings.php +++ /dev/null @@ -1,104 +0,0 @@ -Set up your Printable Gallery

'; -} - -/** - * Generates the rows field - * - * If there is no option value, the it displays "4" as the default value - * - * @since 0.1 - */ -function pg_settings_rows_num_callback(){ - if(get_option('pg_rows_number') == NULL){ - echo ''; - } - else { - echo ''; - } -} - -/** - * Generates the columns field - * - * If there is no option value, the it displays "4" as the default value - * - * @since 0.1 - */ -function pg_settings_columns_num_callback(){ - if(get_option('pg_columns_number') == NULL){ - echo ''; - } - else { - echo ''; - } -} - -/** - * Generates the gallery name field - * - * If there is no option value, the it displays "Gallery Name" as the default value - * - * @since 0.1 - */ -function pg_settings_gallery_name_callback(){ - if(get_option('pg_gallery_name') == NULL){ - echo ''; - } - else { - echo ''; - } -} From fdbb05c909c4cf52dbadd67a637d9a3483ecd3f5 Mon Sep 17 00:00:00 2001 From: Shane Coll Date: Sat, 9 May 2015 21:48:49 -0400 Subject: [PATCH 5/7] version bump and changelog --- README.md | 4 ++++ printable-gallery.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5142195..e821d6f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # printable-gallery WordPress plugin that creates a table of images where users can select individual images to be printed. +## v0.3 +Implemented some rudimentary object oriented design. + ## v0.2 Setting things up for object oriented conversion. + diff --git a/printable-gallery.php b/printable-gallery.php index 1809aa7..f7b8ad7 100644 --- a/printable-gallery.php +++ b/printable-gallery.php @@ -3,7 +3,7 @@ Plugin Name: Printable Gallery Plugin URI: TODO Description: Generates a table of images where users can select individual images to be printed . -Version: 0.2 +Version: 0.3 Author: Shane W. Coll Author URI: http://shanecoll.com */ From e8db62e7178cb38c413777ddbc38a6144bef8200 Mon Sep 17 00:00:00 2001 From: Shane Coll Date: Sun, 10 May 2015 12:01:18 -0400 Subject: [PATCH 6/7] Added slightly better encapsulation, may need a re-write --- includes/class-pg-table.php | 94 +++++++++++++++++++++++++++++++++++++ includes/settings.php | 2 +- printable-gallery.php | 39 ++++++++++++--- 3 files changed, 128 insertions(+), 7 deletions(-) create mode 100644 includes/class-pg-table.php diff --git a/includes/class-pg-table.php b/includes/class-pg-table.php new file mode 100644 index 0000000..7c361a1 --- /dev/null +++ b/includes/class-pg-table.php @@ -0,0 +1,94 @@ +get_row( "SELECT * FROM wp_posts WHERE post_title = '" . $title_str . "'", 'ARRAY_A'); + } + + /** + * Generates a table according to user specs and inserts it into a new post. + * + * @since 0.1 + * @return void + */ + static function pg_generateTable( ) { + if(PG_TABLE::pg_exist_post_by_title('Table Page' ) == NULL ){ + //Creating the $post array + $post = array( + 'post_title' => 'Table Page', + 'post_content'=> " + " . + PG_TABLE::pg_table_body() + . " +
" + ); wp_insert_post( $post ); + } + } + + /** + * Generates the body of the table. + * + * @since 0.1 + * @param TODO Set default values for no option recall + * @return string $tableBody the body of the table + */ + static function pg_table_body() { + if(get_option('pg_rows_number') == NULL){ + $rows= 4; + } + else { + $rows= get_option('pg_rows_number'); + } + + for( $i = 0; $i < $rows; $i++ ){ + $tableRows[$i]= "" . + PG_TABLE::pg_table_data() + . ""; + } + $tableBody = implode( $tableRows ); + return $tableBody; + } + + /** + * Generates the columns of the table and insets their data. + * + * @since 0.1 + * @param TODO Set default values for no option recall + * @return string $data the data of each cell + */ + static function pg_table_data(){ + if(get_option('pg_columns_number') == NULL){ + $columns = 4; + } + else { + $columns = get_option('pg_columns_number'); + } + + for( $i = 0; $i < $columns; $i++ ){ + $tableColumns[$i]= " + Picture will go here + "; + } + $data = implode( $tableColumns ); + return $data; + } + +} diff --git a/includes/settings.php b/includes/settings.php index ad9e386..649fbea 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -41,7 +41,7 @@ function pg_settings_api() { register_setting('media', 'pg_columns_number'); register_setting('media', 'pg_gallery_name'); register_setting('media', 'pg_rows_number'); - PG_FUNCTIONS::pg_generateTable(); + PG_TABLE::pg_generateTable(); } /** * Prints message in the Gallery settings section diff --git a/printable-gallery.php b/printable-gallery.php index f7b8ad7..cea6557 100644 --- a/printable-gallery.php +++ b/printable-gallery.php @@ -13,8 +13,11 @@ //Exit if accessed directly if ( !defined( 'ABSPATH' ) ) exit; -require_once "includes/class-pg-functions.php"; +if( ! class_exists( 'Printable_Gallery' ) ) : + + require_once "includes/class-pg-table.php"; require_once "includes/settings.php"; + /** * Main Printable_Gallery Class * @@ -25,19 +28,43 @@ class Printable_Gallery { private static $instance; - public static function instance() { + static function instance() { + if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Printable_Gallery ) ) { - self::$instance = new Printable_Gallery; + self::$instance = new Printable_Gallery; + + add_action('admin_init', 'pg_settings_api'); + + self::$instance->table = new PG_TABLE(); + } + return self::$instance; + } + + private function setup_constants() { + //Plugin folder path + if ( ! defined( 'PG_PLUGIN_DIR' ) ) { + define( 'PG_PLUGIN_DIR', plugin_dir_path(__FILE__ ) ); + } + + + + } + + private function includes() { + + require_once PG_PLUGIN_DIR . "includes/class-pg-table.php"; + + require_once PG_PLUGIN_DIR . "includes/settings.php"; - add_action('admin_init', 'pg_settings_api'); - self::$instance->functions = new PG_FUNCTIONS(); } } +endif; + function PG() { - Printable_Gallery::instance(); + Printable_Gallery::instance(); } PG(); From 5421992caf9df260b82777734b17e210e11b7d46 Mon Sep 17 00:00:00 2001 From: Shane Coll Date: Sun, 10 May 2015 12:17:09 -0400 Subject: [PATCH 7/7] removed pointless functions class --- includes/class-pg-functions.php | 94 --------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 includes/class-pg-functions.php diff --git a/includes/class-pg-functions.php b/includes/class-pg-functions.php deleted file mode 100644 index 1a19c53..0000000 --- a/includes/class-pg-functions.php +++ /dev/null @@ -1,94 +0,0 @@ -get_row( "SELECT * FROM wp_posts WHERE post_title = '" . $title_str . "'", 'ARRAY_A'); - } - - /** - * Generates a table according to user specs and inserts it into a new post. - * - * @since 0.1 - * @return void - */ - public static function pg_generateTable( ) { - if(PG_FUNCTIONS::pg_exist_post_by_title('Table Page' ) == NULL ){ - //Creating the $post array - $post = array( - 'post_title' => 'Table Page', - 'post_content'=> " - " . - PG_FUNCTIONS::pg_table_body() - . " -
" - ); wp_insert_post( $post ); - } - } - - /** - * Generates the body of the table. - * - * @since 0.1 - * @param TODO Set default values for no option recall - * @return string $tableBody the body of the table - */ - public static function pg_table_body() { - if(get_option('pg_rows_number') == NULL){ - $rows= 4; - } - else { - $rows= get_option('pg_rows_number'); - } - - for( $i = 0; $i < $rows; $i++ ){ - $tableRows[$i]= "" . - PG_FUNCTIONS::pg_table_data() - . ""; - } - $tableBody = implode( $tableRows ); - return $tableBody; - } - - /** - * Generates the columns of the table and insets their data. - * - * @since 0.1 - * @param TODO Set default values for no option recall - * @return string $data the data of each cell - */ - public static function pg_table_data(){ - if(get_option('pg_columns_number') == NULL){ - $columns = 4; - } - else { - $columns = get_option('pg_columns_number'); - } - - for( $i = 0; $i < $columns; $i++ ){ - $tableColumns[$i]= " - Picture will go here - "; - } - $data = implode( $tableColumns ); - return $data; - } - -}