_test_text = $page_number; // //$getDB = new Connection; //$getDB->getConnection($getDB->ywpBlog); //$results = $getDB->makeQuery('SELECT * FROM `contractorList`'); // ======================================== // Getting Blog page details Starts Here // ======================================== class blog { public $contractor_id = ''; public $directory = ''; public $pageurl = ''; public $section = ''; public $page_number = ''; public $og_meta_title = ''; public $og_meta_description = ''; public $og_meta_image = ''; public $uri = ''; public function get_blog_content(){ $exuri = explode('/',ltrim($this->uri,'/')); // Check for .htm $posturlext = substr($exuri[1], -4); if ($posturlext==='.htm') { $posturl = $exuri[1]; } else { if(!empty($exuri[1])){ $posturl = $exuri[1].'.htm'; }else{ $posturl = ''; } } $this->directory = $exuri[0]; $this->pageurl = $posturl; $this->section = $exuri[2]; if ($exuri[3]==='page') { $this->page = $exuri[4]; }else{ $this->page = $exuri[3]; } //echo $this->contractor_id.' | '.$this->pageurl.' | '.$this->section; if (empty($this->pageurl) || ($this->pageurl === 'page.htm') || ($this->pageurl === 'admin.htm')) { $this->page = $exuri[2]; $this->start_blog('','',$this->contractor_id,$this->page,'',''); if (empty($this->pageurl) || ($this->pageurl === 'page.htm')){ echo $this->blog_home(); }else{ $this->_action = $exuri[2]; $this->_action_two = $exuri[3]; echo $this->blog_admin(); } } else if (isset($this->pageurl) && !isset($this->section)) { $getDB = new Connection; $getDB->getConnection($getDB->ywpBlog); $blog_query = $getDB->makeQuery("SELECT `".ID."`,`".CONTRACTOR_ID."`,`".PAGE_NAME."`,`".PAGE_CONTENT."`,`".MINI_PAGE_CONTENT."`,`".COVER_IMAGE."`,`".PAGE_URL."`,`".META_TITLE."`,`".META_DESCRIPTION."`,`".META_KEYWORDS."`,`".CUSTOM_META."`,`".DATE_CREATED."`,`".CATEGORY."`,`".USER."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".PAGE_URL."` = '".$this->pageurl."' AND `".CONTRACTOR_ID."` = '".$this->contractor_id."'")->fetch_array(); $this->start_blog($blog_query[ID],'',$this->contractor_id,'','',''); echo $this->blog_post(); } else if (isset($this->section)) { $getDB = new Connection; $getDB->getConnection($getDB->ywpBlog); $blog_query = $getDB->makeQuery("SELECT `".ID."` FROM `".BLOG_DB."`.`".BLOG_CATEGORIES."` WHERE `".CATEGORY."` = '".str_replace("-", " ", $this->section)."' AND `".CONTRACTOR_ID."` = '".$this->contractor_id."'")->fetch_array(); $this->start_blog('',$blog_query[ID],$this->contractor_id,$this->page,'',''); echo $this->blog_category(); } } public function start_blog($page_id,$category_id,$contractor_id,$page_number,$action,$action_two) { $getDB = new Connection; $getDB->getConnection($getDB->ywpBlog); // ============================== // Query Page Content // ============================== if ($page_id){ $blog_content_query = $getDB->makeQuery("SELECT `".ID."`,`".CONTRACTOR_ID."`,`".PAGE_NAME."`,`".PAGE_CONTENT."`,`".MINI_PAGE_CONTENT."`,`".COVER_IMAGE."`,`".PAGE_URL."`,`".META_TITLE."`,`".META_DESCRIPTION."`,`".META_KEYWORDS."`,`".CUSTOM_META."`,`".DATE_CREATED."`,`".CATEGORY."`,`".USER."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".ID."` = '".$page_id."'"); $blog_gallery_query = $getDB->makeQuery("SELECT `".IMAGE."` FROM `".BLOG_DB."`.`".GALLERY_IMAGES."` WHERE `".PAGE_ID."` = '".$page_id."' ORDER BY `".SORT_POSITION."`"); $blog_content = $blog_content_query->fetch_array(); $blog_gallery = $blog_gallery_query->fetch_array(); $blog_user_query = $getDB->makeQuery("SELECT `".NAME."` FROM `".BLOG_DB."`.`".USERS."` WHERE `".ID."` = '".$blog_content[USER]."'"); $blog_user = $blog_user_query->fetch_array(); $contractor_id = $blog_content[CONTRACTOR_ID]; } if ($category_id){ $blog_category_query = $getDB->makeQuery("SELECT `".CONTRACTOR_ID."`,`".CATEGORY."` FROM `".BLOG_DB."`.`".BLOG_CATEGORIES."` WHERE `".ID."` = '".$category_id."'"); $blog_category = $blog_category_query->fetch_array(); $contractor_id = $blog_category[CONTRACTOR_ID]; $this->_category_title = $blog_category[CATEGORY]; } // ============================== // Query Configuration Settings // ============================== $blog_config_query = $getDB->makeQuery("SELECT `".TYPE."`,`".VALUE."` FROM `".BLOG_DB."`.`".BLOG_CONFIGURATION."` WHERE `".CONTRACTOR_ID."` = '".$contractor_id."'"); while($blog_config = $blog_config_query->fetch_array()){ $config[$blog_config[TYPE]] = $blog_config[VALUE]; } // =================================== // Query Sitewide Configurations // =================================== $q = $getDB->makeQuery("SELECT * FROM `".CLIENT_CONTENT_CONFIG_DB."`.`".CONFIGURATION."`"); while ($r = $q->fetch_array()){ $this->_b_config[$r['name']] = $r['value']; } // ============================== // Query Qualified Admin Users // ============================== $blog_qualified_users_query = $getDB->makeQuery("SELECT `".ID."` FROM `".BLOG_DB."`.`".USERS."` WHERE `".CONTRACTOR_ID."` = '".$contractor_id."'"); while($blog_qualified_users = $blog_qualified_users_query->fetch_array()){ $this->_blog_qualified_users[] = $blog_qualified_users[ID]; } // ============================== // Query Social Media Share Options // ============================== $blog_social_media_share_options_query = $getDB->makeQuery("SELECT `".FACEBOOK."`,`".GOOGLEPLUS."`,`".PINTREST."` FROM `".BLOG_DB."`.`".BLOG_SOCIAL_MEDIA."` WHERE `".CONTRACTOR_ID."` = '".$contractor_id."'"); $blog_social_media_share_options = $blog_social_media_share_options_query->fetch_array(); $this->_facebook_share_option = $blog_social_media_share_options[FACEBOOK]; $this->_googleplus_share_option = $blog_social_media_share_options[GOOGLEPLUS]; $this->_pintrest_share_option = $blog_social_media_share_options[PINTREST]; // ============================== // Configuration and Settings // ============================== // Configuration if ($category_id) { $blog_count_posts_query = $getDB->makeQuery("SELECT `".PAGE_NAME."`,`".MINI_PAGE_CONTENT."`,`".COVER_IMAGE."`,`".PAGE_URL."`,`".DATE_CREATED."`,`".USER."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".CATEGORY."` = '".$category_id."' ORDER BY `".DATE_CREATED."`"); $this->_num_count_posts = mysqli_num_rows($blog_count_posts_query); }else{ $blog_count_posts_query = $getDB->makeQuery("SELECT `".PAGE_NAME."`,`".MINI_PAGE_CONTENT."`,`".COVER_IMAGE."`,`".PAGE_URL."`,`".DATE_CREATED."`,`".USER."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".CONTRACTOR_ID."` = '".$contractor_id."' ORDER BY `".DATE_CREATED."`"); $this->_num_count_posts = mysqli_num_rows($blog_count_posts_query); } if (!$page_number) { $page_number = 0; } $this->_action = $action; $this->_action_two = $action_two; $this->_page_number = $page_number; $this->_border_color = $config[border_color]; $this->_button_color = $config[button_color]; $this->_button_font_color = $config[button_font_color]; $this->_recent_post_limit = $config[recent_post_limit]; $this->_date_created_layout = $config[date_created]; $this->_layout = $config[layout]; $this->_show_page_count = $config[show_page_count]; $this->_posts_count = $config[posts_count]; $this->_contractor_id = $contractor_id; switch ($config[date_created]){ case '1': $this->_date_created = date_format(date_create($blog_content[DATE_CREATED]),"F j, Y"); break; case '2': $this->_date_created = date_format(date_create($blog_content[DATE_CREATED]),"M j, Y"); break; case '3': $this->_date_created = date_format(date_create($blog_content[DATE_CREATED]),"n/j/y"); break; } // Page Content $this->_page_id = $blog_content[ID]; $this->_title = stripslashes($blog_content[PAGE_NAME]); $this->_content = stripslashes($blog_content[PAGE_CONTENT]); $this->_mini_content = stripslashes($blog_content[MINI_PAGE_CONTENT]); $this->_cover_image = $blog_content[COVER_IMAGE]; $this->_category = $blog_content[CATEGORY]; $this->_meta_description = stripslashes($blog_content[META_DESCRIPTION]); $this->_created_by = $blog_user[NAME]; // Social Media Share Icons if ($this->_facebook_share_option==='1') { $this->_facebook = ''; } if ($this->_googleplus_share_option==='1') { $this->_googleplus = ''; } if ($this->_pintrest_share_option==='1') { $this->_pintrest = ''; } // ============================== // ============================== // ============================== // ============================== // Query recent posts // ============================== $blog_recent_posts_query = $getDB->makeQuery("SELECT `".PAGE_NAME."`,`".COVER_IMAGE."`,`".PAGE_URL."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".CONTRACTOR_ID."` = '".$contractor_id."' AND `".ID."` != '".$page_id."' AND `".DISPLAY."` = '1' ORDER BY `".DATE_CREATED."` DESC LIMIT ".$this->_recent_post_limit); while($blog_recent_posts = $blog_recent_posts_query->fetch_array()){ $this->_recent_posts .= '
'.$blog_recent_posts[PAGE_NAME].'
'; } // ============================== // Query Category Links // ============================== $blog_categories_query = $getDB->makeQuery("SELECT `".ID."`,`".CATEGORY."` FROM `".BLOG_DB."`.`".BLOG_CATEGORIES."` WHERE `".CONTRACTOR_ID."` = '".$contractor_id."' ORDER BY `".CATEGORY."`"); $cnt=0; $num_categories = mysqli_num_rows($blog_categories_query); while($blog_categories = $blog_categories_query->fetch_array()){ $blog_categories_count_query = $getDB->makeQuery("SELECT `".ID."`,`".CATEGORY."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".CATEGORY."` = '".$blog_categories[ID]."' AND `".DISPLAY."` = '1'"); $blog_category_count = mysqli_num_rows($blog_categories_count_query); $cnt++; if ($cnt<$num_categories) { $styling = 'style="border-color:'.$this->_border_color.';"'; }else{ $styling = ''; } if ($this->_show_page_count==='1') { $cat_page_count = '
'.$blog_category_count.'
'; }else{ $cat_page_count = ''; } if ($blog_category_count>='1') { $this->_categories .= ''.$blog_categories[CATEGORY].'
'.$blog_category_count.'
'; } } // ============================== // Query next and previous posts // ============================== $blog_next_post_query = $getDB->makeQuery("SELECT `".PAGE_URL."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".ID."` < '".$page_id."' AND `".CATEGORY."` = '".$this->_category."' AND `".DISPLAY."` = '1' ORDER BY `".DATE_CREATED."` DESC LIMIT 1"); $blog_next_post = $blog_next_post_query->fetch_array(); $next_post = substr($blog_next_post[PAGE_URL],0,-4); if ($next_post) { $this->_next_post = '
Next
'; } $blog_prev_post_query = $getDB->makeQuery("SELECT `".PAGE_URL."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".ID."` > '".$page_id."' AND `".CATEGORY."` = '".$this->_category."' AND `".DISPLAY."` = '1' ORDER BY `".DATE_CREATED."` LIMIT 1"); $blog_prev_post = $blog_prev_post_query->fetch_array(); $prev_post = substr($blog_prev_post[PAGE_URL],0,-4); if ($prev_post) { $this->_prev_post = '
Previous
'; } // ============================== // Query next and previous pages // ============================== $next_page_number = $page_number+1; $prev_page_number = $page_number-1; if ($category_id) { $cat = 'category/' . str_replace(' ', '-', $this->_category_title) . '/'; }else{ $cat = ''; } if ($page_number<(ceil($this->_num_count_posts/$this->_posts_count)-1)) { $this->_next_page = '
Next Page
'; } if ($page_number>=1) { $this->_prev_page = '
Previous Page
'; } // ============================== // Query Posts for Selected Category // ============================== $blog_posts_to_category_query = $getDB->makeQuery("SELECT `".ID."`,`".PAGE_NAME."`,`".MINI_PAGE_CONTENT."`,`".COVER_IMAGE."`,`".PAGE_URL."`,`".DATE_CREATED."`,`".USER."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".CATEGORY."` = '".$category_id."' AND `".DISPLAY."` = '1' ORDER BY `".DATE_CREATED."` DESC LIMIT ".($this->_posts_count*$page_number).", ".$this->_posts_count); $num_posts_to_category = mysqli_num_rows($blog_posts_to_category_query); if ($num_posts_to_category<=0) { $this->_posts_in_category .= '
This category is empty
'; }else{ while($blog_posts_to_category = $blog_posts_to_category_query->fetch_array()){ $blog_user_query = $getDB->makeQuery("SELECT `".NAME."` FROM `".BLOG_DB."`.`".USERS."` WHERE `".ID."` = '".$blog_posts_to_category[USER]."'"); $blog_user = $blog_user_query->fetch_array(); if ($this->_layout==='1') { $this->_posts_in_category .= '
'.$blog_posts_to_category[PAGE_NAME].'
'.$blog_posts_to_category[MINI_PAGE_CONTENT].'
'; } if ($this->_layout==='2') { $shorttitle = strlen($blog_posts_to_category[PAGE_NAME]) > 45 ? substr($blog_posts_to_category[PAGE_NAME],0,42)."..." : $blog_posts_to_category[PAGE_NAME]; $shortdescription = strlen($blog_posts_to_category[MINI_PAGE_CONTENT]) > 220 ? substr($blog_posts_to_category[MINI_PAGE_CONTENT],0,217).'... Click for more' : $blog_posts_to_category[MINI_PAGE_CONTENT]; $this->_posts_in_category .= '
'.$shorttitle.'
'.$shortdescription.'
'; } } } // ============================== // Query Posts for Blog Home // ============================== $blog_posts_for_home_query = $getDB->makeQuery("SELECT `".PAGE_NAME."`,`".MINI_PAGE_CONTENT."`,`".COVER_IMAGE."`,`".PAGE_URL."`,`".DATE_CREATED."`,`".USER."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".CONTRACTOR_ID."` = '".$contractor_id."' AND `".DISPLAY."` = '1' ORDER BY `".DATE_CREATED."` DESC LIMIT ".($this->_posts_count*$page_number).", ".$this->_posts_count); $num_posts_for_home = mysqli_num_rows($blog_posts_for_home_query); $this->_content_cnt = $num_posts_for_home; if ($num_posts_for_home<=0) { $this->_home_content = '
No posts have been added yet.
'; }else{ while($blog_posts_for_home = $blog_posts_for_home_query->fetch_array()){ $blog_user_query = $getDB->makeQuery("SELECT `".NAME."` FROM `".BLOG_DB."`.`".USERS."` WHERE `".ID."` = '".$blog_posts_for_home[USER]."'"); $blog_user = $blog_user_query->fetch_array(); if ($this->_layout==='1') { $this->_home_content .= '
'.$blog_posts_for_home[PAGE_NAME].'
'.$blog_posts_for_home[MINI_PAGE_CONTENT].'
'; } if ($this->_layout==='2') { $shorttitle = strlen($blog_posts_for_home[PAGE_NAME]) > 45 ? substr($blog_posts_for_home[PAGE_NAME],0,42)."..." : $blog_posts_for_home[PAGE_NAME]; $shortdescription = strlen($blog_posts_for_home[MINI_PAGE_CONTENT]) > 220 ? substr($blog_posts_for_home[MINI_PAGE_CONTENT],0,217).'... Click for more' : $blog_posts_for_home[MINI_PAGE_CONTENT]; $this->_home_content .= '
'.$shorttitle.'
'.$shortdescription.'
'; } } } // ============================== // Query Gallery Images for Post // ============================== $blog_gallery_query = $getDB->makeQuery("SELECT `".IMAGE."`,`".SORT_POSITION."` FROM `".BLOG_DB."`.`".GALLERY_IMAGES."` WHERE `".PAGE_ID."` = '".$this->_page_id."' ORDER BY `".SORT_POSITION."`"); $cnt=0; $num_gallery = mysqli_num_rows($blog_gallery_query); if ($num_gallery>=1) { while($blog_gallery = $blog_gallery_query->fetch_array()){ if (substr($blog_gallery[IMAGE],0,14)==='/thumbnail.php') { $exImg = explode('&',$blog_gallery[IMAGE]); $linkedImg = substr($exImg[0],20); }else{ $linkedImg = $blog_gallery[IMAGE]; } $this->_gallery .= ''; } }else{ $this->_gallery = ''; } } // ================================================================ // ================================================================ // Begain user structure settings // ================================================================ // ================================================================ // Right Container Construction function public function right_container_construction(){ $result = '
CATEGORIES
RECENT POST
'.$this->_recent_posts.'
'; return $result; } // Blog Construction function public function blog_post($content) { $result = '
Share this post
'.$this->_title.'
'.$this->remove_qeustion_marks($this->_content).'
'.$this->_gallery.'
Posted by: '.$this->_created_by.'
'.$this->_date_created.'
'.$this->_prev_post.' '.$this->_next_post.'
'.$this->right_container_construction().'
'; return $result; } // Blog Category Construction function public function blog_category() { $result = '
'.$this->_category_title.'
'.$this->_posts_in_category.'
'.$this->right_container_construction().'
'.$this->blog_pagination(); return $result; } // Blog Home Construction function public function blog_home() { if ($this->_content_cnt>=1) { $result = '
'.$this->_home_content.'
'.$this->right_container_construction().'
'.$this->blog_pagination(); }else{ $result = '
'.$this->_home_content.'
'; } return $result; } // Pagination Construction function public function blog_pagination() { $result = '
'.$this->_prev_page.' '.$this->_next_page.'
'; if (ceil($this->_num_count_posts/$this->_posts_count)>=1) { $result .= '
Page '.($this->_page_number+1).' of '.ceil($this->_num_count_posts/$this->_posts_count).'
'; } return $result; } // Social Media Construction function public function blog_social_media() { $result = '
'.$this->_facebook.' '.$this->_googleplus.' '.$this->_pintrest.'
'; return $result; } // ================================================================ // ================================================================ // Admin structure settings // ================================================================ // ================================================================ // Check if admin is logged in public function check_login() { if ($this->_action==='logout') { unset($_SESSION['blog_admin_logged_in']); unset($_SESSION['blog_admin_user']); } if ($_SESSION['blog_admin_logged_in']=='true' && in_array($_SESSION['blog_admin_user'],$this->_blog_qualified_users) && $this->_action!='logout') { return true; }else{ return false; } } // Blog AdminLogin Construction function public function blog_admin_login() { $result = '
'; return $result; } // Blog Admin Construction function public function blog_admin() { if (!$this->check_login()) { $result = $this->blog_admin_login(); }else{ $result = '
'.$this->admin_home_content().'
'.$this->right_admin_container_construction().'
'; } return $result; } // Blog Admin Home Construction function public function admin_home_content() { if ($this->_action==='' || !$this->_action) { $result = '
BLOG ADMINISTRATION
'.$this->admin_home_container_construction().'
'; } elseif ($this->_action==='users') { $result .= '
BLOG ADMINISTRATION - USERS
'.$this->_users_container().'
'; } elseif ($this->_action==='settings') { $result = '
BLOG ADMINISTRATION - SETTINGS
'.$this->_settings_container().'
'; } elseif ($this->_action==='categories') { $result = '
BLOG ADMINISTRATION - CATEGORIES
'.$this->_manage_categories_container().'
'; } elseif ($this->_action==='newpost') { $result = '
BLOG ADMINISTRATION - NEW POST
'.$this->_new_post_container().'
'; } elseif ($this->_action==='posted') { $result = '
BLOG ADMINISTRATION - NEW POST ADDED!
'.$this->_b_config['blog_post_added'].'

'; } elseif ($this->_action==='updated') { $result = '
BLOG ADMINISTRATION - POST UPDATED!
'.$this->_b_config['blog_post_update'].'

'; } elseif ($this->_action==='manage_posts') { $result = '
BLOG ADMINISTRATION - MANAGE POSTS
'.$this->_manage_posts_container().'
'; } elseif ($this->_action==='update_post') { $result = '
BLOG ADMINISTRATION - UPDATE POST
'.$this->_update_post_container().'
'; } else{ $result = '
BLOG ADMINISTRATION
'; } return $result; } // Right Container Construction function public function admin_home_container_construction(){ $result = '
Manage Users
Categories / Posts
New Post
Blog Settings
Logout
'; return $result; } // Right Container Construction function public function right_admin_container_construction(){ $result = '
CONFIGURATION
'; return $result; } // Blog Admin Settings Construction function public function _settings_container() { $result = '
Border Color
Button Color
Text Color for Buttons
"Recent Post\'s" Limit
'.$this->recent_post_limit().'
Creation Date Format
'.$this->date_created_layout().'
Post\'s Page Layout
'.$this->layout().'
Show post count in navigation?
'.$this->show_page_count().'
Post\'s per page
'.$this->posts_count().'
Sharing Options
'.$this->share_options().'
Save Settings
'; return $result; } // ===================================== // Select Menu's Construction functions // ===================================== public function recent_post_limit(){ $result = ''; return $result; } public function date_created_layout(){ $result = ''; return $result; } public function layout(){ $result = ''; return $result; } public function show_page_count(){ $result = ''; return $result; } public function posts_count(){ $result = ''; return $result; } public function share_options(){ $result .= ''; $result .= ''; $result .= ''; return $result; } // Blog Admin Users Construction function public function _users_container() { $getDB = new Connection; $getDB->getConnection($getDB->ywpBlog); $result = '
Users
'; $q_users = $getDB->makeQuery("SELECT `".ID."`,`".NAME."`,`".DATE_CREATED."` FROM `".BLOG_DB."`.`".USERS."` WHERE `".CONTRACTOR_ID."` = '".$this->_contractor_id."' ORDER BY `".DATE_CREATED."`"); $usrCnt=0; while($r_users = $q_users->fetch_array()){ $result .= '
'.$r_users[NAME].'
'; if ($usrCnt>=1) { $result .= ''; } $result .= '
'; $usrCnt++; } $result .= '
Create a new user
Display Name:
Enter Username:
Enter Password:
Repeat Password:
Add User
Edit User Details
Close [x]
'; return $result; } // Blog Admin Settings Construction function public function _manage_categories_container() { $getDB = new Connection; $getDB->getConnection($getDB->ywpBlog); $result = '
Categories
'; $q_category = $getDB->makeQuery("SELECT `".ID."`,`".CATEGORY."` FROM `".BLOG_DB."`.`".BLOG_CATEGORIES."` WHERE `".CONTRACTOR_ID."` = '".$this->_contractor_id."'"); $usrCnt=0; while($r_category = $q_category->fetch_array()){ $q_post_cnt = $getDB->makeQuery("SELECT `".ID."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".CATEGORY."` = '".$r_category[ID]."' AND `".CONTRACTOR_ID."` = '".$this->_contractor_id."'"); $n_post_cnt = mysqli_num_rows($q_post_cnt); $result .= '
'.$r_category[CATEGORY].'
'; $result .= '
'; $usrCnt++; } $result .= '
Create a new category
Category Name:
Add Category
Edit Category
Close [x]
'; return $result; } // Blog Admin Settings Construction function public function _new_post_container() { $getDB = new Connection; $getDB->getConnection($getDB->ywpBlog); $q_categories = $getDB->makeQuery("SELECT `".ID."`,`".CATEGORY."` FROM `".BLOG_DB."`.`".BLOG_CATEGORIES."` WHERE `".CONTRACTOR_ID."` = '".$this->_contractor_id."' ORDER BY `".CATEGORY."`"); $cats = ''; $result = '
Choose Category(s)
'; $result .= '
'.$cats.' OR
'; $result .= '
Cover Image (Upload a \'Cover Image\' for this post | 3mb Max file size)
'; $result .= '
'; $result .= '
Title
'; $result .= '
'; $result .= '
Post Details
'; $result .= '
'; $result .= '
Gallery Images (Upload up to 8 gallery images)
'; $result .= '
'; for($i=0;$i<8;$i++){ switch ($i) { case 0: $convId = 'Zero'; break; case 1: $convId = 'One'; break; case 2: $convId = 'Two'; break; case 3: $convId = 'Three'; break; case 4: $convId = 'Four'; break; case 5: $convId = 'Five'; break; case 6: $convId = 'Six'; break; case 7: $convId = 'Seven'; break; } $result .= ''; } $result .= '
'; $result .= '
Meta Data (Advanced Options)
'; $result .= '
Meta Title
Meta Description
Meta Keywords
Custom Meta
'; $result .= '
Display this post upon creation?
'; $result .= '
Add Post
'; $result .= '
'; $result .= '
'; $result .= '
Crop Image
X
'; $result .= '
'; $result .= '
Blog post images have size requirments.
Use the tool below to crop your image to the proper size before uploading.
'; $result .= '
'; $result .= '
'; $result .= '
'; $result .= '
Save
'; $result .= '
'; $result .= '
'; $result .= '
'; return $result; } // Blog Admin Settings Construction function public function _update_post_container() { $getDB = new Connection; $getDB->getConnection($getDB->ywpBlog); $q_post_details = $getDB->makeQuery("SELECT `".ID."`,`".PAGE_NAME."`,`".PAGE_CONTENT."`,`".MINI_PAGE_CONTENT."`,`".COVER_IMAGE."`,`".PAGE_URL."`,`".META_TITLE."`,`".META_DESCRIPTION."`,`".META_KEYWORDS."`,`".CUSTOM_META."`,`".CATEGORY."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".ID."` = '".$this->_action_two."' AND `".CONTRACTOR_ID."` = '".$this->_contractor_id."'"); $r_post_details = $q_post_details->fetch_array(); // Query Gallery Images $q_post_images = $getDB->makeQuery("SELECT `".ID."`,`".IMAGE."` FROM `".BLOG_DB."`.`".GALLERY_IMAGES."` WHERE `".PAGE_ID."` = '".$this->_action_two."' AND `".CONTRACTOR_ID."` = '".$this->_contractor_id."'"); $q_categories = $getDB->makeQuery("SELECT `".ID."`,`".CATEGORY."` FROM `".BLOG_DB."`.`".BLOG_CATEGORIES."` WHERE `".CONTRACTOR_ID."` = '".$this->_contractor_id."' ORDER BY `".CATEGORY."`"); $cats = ''; $result = '
Choose Category(s)
'; $result .= '
'.$cats.'
'; $result .= '
Cover Image (Upload a \'Cover Image\' for this post | 3mb Max file size)
'; $result .= '
'; $result .= '
Title
'; $result .= '
'; $result .= '
Post Details
'; $result .= '
'; $result .= '
Gallery Images (Upload up to 8 gallery images)
'; $result .= '
'; $galCnt = 0; $num_gallery_img = mysqli_num_rows($q_post_images); $add_img_wrap_cnt = (8-$num_gallery_img); while($r_post_images = $q_post_images->fetch_array()){ switch ($galCnt) { case 0: $convId = 'Zero'; break; case 1: $convId = 'One'; break; case 2: $convId = 'Two'; break; case 3: $convId = 'Three'; break; case 4: $convId = 'Four'; break; case 5: $convId = 'Five'; break; case 6: $convId = 'Six'; break; case 7: $convId = 'Seven'; break; } $result .= ''; $gallery_item_hidden .= ''; $galCnt++; } for($i=0;$i<$add_img_wrap_cnt;$i++){ switch ($num_gallery_img) { case 0: $convId = 'Zero'; break; case 1: $convId = 'One'; break; case 2: $convId = 'Two'; break; case 3: $convId = 'Three'; break; case 4: $convId = 'Four'; break; case 5: $convId = 'Five'; break; case 6: $convId = 'Six'; break; case 7: $convId = 'Seven'; break; } $result .= ''; $num_gallery_img++; } $result .= '
'; $result .= '
Meta Data (Advanced Options)
'; $result .= '
Meta Title
Meta Description
Meta Keywords
Custom Meta
'; $result .= '
Display this post upon update?
'; $result .= '
Update
'.$gallery_item_hidden.'
'; $result .= '
'; $result .= '
'; $result .= '
Crop Image
X
'; $result .= '
'; $result .= '
Blog post images have size requirments.
Use the tool below to crop your image to the proper size before uploading.
'; $result .= '
'; $result .= '
'; $result .= '
'; $result .= '
Save
'; $result .= '
'; $result .= '
'; $result .= '
'; return $result; } // Blog Admin Settings Construction function public function _manage_posts_container() { $getDB = new Connection; $getDB->getConnection($getDB->ywpBlog); $q_cat = $getDB->makeQuery("SELECT `".CATEGORY."` FROM `".BLOG_DB."`.`".BLOG_CATEGORIES."` WHERE `".ID."` = '".$this->_action_two."' AND `".CONTRACTOR_ID."` = '".$this->_contractor_id."'"); $r_cat = $q_cat->fetch_array(); $result .= '
Manage posts within "'.$r_cat[CATEGORY].'"
'; $result .= '
Title
Actions
'; $q_posts = $getDB->makeQuery("SELECT `".ID."`,`".PAGE_NAME."`,`".PAGE_URL."` FROM `".BLOG_DB."`.`".PAGES."` WHERE `".CATEGORY."` = '".$this->_action_two."' AND `".CONTRACTOR_ID."` = '".$this->_contractor_id."'"); $usrCnt=0; while($r_posts = $q_posts->fetch_array()){ $result .= '
'.$r_posts[PAGE_NAME].'
Edit
Delete
'; $result .= '
'; $usrCnt++; } return $result; } // Configuration Links Construction function public function configuration_links(){ $result = ''; $result .= 'Admin Home'; $result .= 'Manage Users'; $result .= 'Manage Categories / Posts'; $result .= 'New Post'; $result .= 'Blog Settings'; $result .= 'Logout'; return $result; } public function remove_qeustion_marks($content) { //return mb_convert_encoding($content, "UTF-8"); // Uncomment for pushing spanish sites return preg_replace('/\?{2,}/', '', $this->RemoveBS(mb_convert_encoding($content, "UTF-8"))); //return preg_replace('/\?{2,}/', '', $this->RemoveBS($content)); } //mb_convert_encoding($content, "UTF-8") public function RemoveBS($Str) { $StrArr = str_split($Str); $NewStr = ''; $bigBadChars = array(161,163,191,193,201,205,210,211,212,214,225,233,237,243); foreach ($StrArr as $Char) { $CharNo = ord($Char); /*if (in_array($CharNo,$bigBadChars)){ $NewStr .= $Char; continue; }*/ if ($CharNo > 31 && $CharNo < 127) { $NewStr .= $Char; } } return $NewStr; } } ?>