return $all_db_setup_status;
}
++ /**
++ * Display Git Branch as an admin warning
++ *
++ * @return void
++ * @access public
++ */
++ function glmMembersGitNotice() {
++
++ echo '<div class="error"><h3 class="glm-error">Plugin Git Branch Warning:</h3><table>';
++ foreach ($this->gitBranch as $b) {
++
++ echo '<tr><th align="left">'.$b['slug'].'</th><td>'.$b['branch'];
++ if (isset($b['feature'])) {
++ echo '/'.$b['feature'];
++ }
++ echo '</td></tr>';
++
++ }
++ echo "</table></div>";
++ }
++
++ /**
++ * Get Git Branch
++ *
++ * @return void
++ * @access public
++ */
++ public function getGitBranch()
++ {
++ $gitBranch = array();
++
++ foreach ($this->config['addOns'] as $a) {
++
++ // Git branch should be stored in .git/HEAD file
++ $gitFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.'/'.$a['slug'].'/.git/HEAD';
++
++ // Check if the file exists
++ if (file_exists($gitFile)) {
++
++ // Read in the file
++ $gitString = file_get_contents($gitFile);
++
++ // Parse the branch string by '/'
++ $gitParts = explode('/', $gitString);
++
++ if (trim($gitParts[2]) != 'master') {
++
++ $gitBranch[$a['slug']]['slug'] = $a['slug'];
++
++ // [2] should be branch name or type
++ if (isset($gitParts[2])) {
++ $gitBranch[$a['slug']]['branch'] = $gitParts[2];
++ }
++
++ // [3] should be name of feature
++ if (isset($gitParts[3])) {
++ $gitBranch[$a['slug']]['feature'] = $gitParts[3];
++ }
++
++ }
++
++ }
++
++ }
++
++ $this->gitBranch = $gitBranch;
++ return;
++
++ }
++
++ /**
++ *
++ * Create new standard pages with shortcodes
++ *
++ */
++
++ /**
++ * get_option(GLM_MEMBERS_PLUGIN_OPTION_MEMBERS_ONLY_ID)
++ *
++ * Create new pages containing the member DB shortcodes
++ *
++ * @return void
++ */
++ public function createPages($requiredPages)
++ {
++ foreach($requiredPages as $requiredPage => $requiredPageInfo) {
++ $trimmedName = GLM_MEMBERS_PLUGIN_OPTION_PREFIX.$requiredPageInfo['underscored_name'];
++ if ($requiredPageInfo['parent'] == 'associate') {
++ $postParent = get_option(GLM_MEMBERS_PLUGIN_OPTION_ASSOCIATE_ID);
++ } else if ($requiredPageInfo['parent'] == 'membersonly') {
++ $postParent = get_option(GLM_MEMBERS_PLUGIN_OPTION_MEMBERS_ONLY_ID);
++ } else if (is_numeric($requiredPageInfo['parent'])) {
++ $postParent = $requiredPageInfo['parent'];
++ } else {
++ $postParent = '0';
++ }
++ $existingPost = get_post(get_option($trimmedName));
++ $testSlug = get_post_field( 'post_name', $existingPost);
++ $newSlug = sanitize_title($requiredPageInfo['name']);
++ $existingSlug = $this->verify_post_slug($newSlug);
++
++
++ // If a post with the ID set in the option does not exist
++ if ( !$existingPost) {
++
++ // If the new slug corresponds to an already existent page, yet the ID option does not exist,
++ // then it's either the first time this plugin is run on an outdated site or somehow the ID was
++ // deleted. Either way, replace the option value with whatever is the ID of the page matching
++ // that slug. The slug is checked by translating the page title.
++ if ($newSlug == $existingSlug) {
++ $existingID = $this->get_post_id_by_slug($newSlug);
++ update_option($trimmedName, $existingID);
++ // Otherwise create a new page
++ } else {
++ // Put together the new page, then update the option with the new ID
++ $templateUsed = isset($requiredPageInfo['template']) ? $requiredPageInfo['template'] : 'index.php';
++ $new_id = $this->insertReqPage(
++ $requiredPageInfo['name'],
++ $requiredPageInfo['content'],
++ 'publish',
++ 'page',
++ '1',
++ $templateUsed,
++ $postParent
++ );
++ update_option($trimmedName, $new_id);
++
++ // Make extra page if members only is created
++ if ($new_id == get_option(GLM_MEMBERS_PLUGIN_OPTION_MEMBERS_ONLY_ID)) {
++ $this->insertReqPage(
++ 'Members Only Sample Subpage',
++ 'This page will automatically be locked to Members Only with the members-only-template',
++ 'publish',
++ 'page',
++ '1',
++ $templateUsed,
++ $new_id
++ );
++
++ }
++ }
++ } else {
++ // No page created
++ }
++ }
++
++ }
++
++ public function insertReqPage($pTitle = '--bad page--', $pContent = '', $pPublish = 'publish', $pType = 'page', $pAuthor = '1', $pTemplate = 'index.php', $pParent = '0')
++ {
++ $new_page = array(
++ 'post_title' => $pTitle,
++ 'post_content' => $pContent,
++ 'post_status' => $pPublish,
++ 'post_type' => $pType,
++ 'post_author' => $pAuthor,
++ 'page_template' => $pTemplate ,
++ 'post_parent' => $pParent
++ );
++ return wp_insert_post($new_page);
++ }
++
++
++ public function get_post_data($needle = 1, $valueField = 'post_name', $needleField = 'ID')
++ {
++ $value = $this->wpdb->get_var("SELECT $valueField FROM ".$this->wpdb->posts." WHERE $needleField = '".$needle."'");
++ return $value;
++ }
++
++ public function verify_post_slug($postName)
++ {
++ $value = $this->wpdb->get_var("SELECT post_name FROM ".$this->wpdb->posts." WHERE post_name = '".$postName."'");
++ return $value;
++ }
++
++ public function get_post_id_by_slug($postName)
++ {
++ $value = $this->wpdb->get_var("SELECT ID FROM ".$this->wpdb->posts." WHERE post_name = '".$postName."'");
++ return $value;
++ }
++
++ /**
++ *
++ * Shortcode Builder Functions
++ *
++ */
++
++ public function glmMembersShortcode(){
++
++ // load shortcodeBuilder.js when the shortcode function has been fired
++ add_action('admin_print_styles-post.php', 'custom_js_css');
++ add_action('admin_print_styles-post-new.php', 'custom_js_css');
++
++ function custom_js_css() {
++
++ wp_enqueue_script('your-meta-box', GLM_MEMBERS_PLUGIN_URL. '/js/shortcodeBuilder.js', array('jquery'), null, true);
++ }
++ reset($this->config['addOns']);
++ foreach ($this->config['addOns'] as $a) {
++ $cssFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.$a['slug'].'/css/admin.css';
++ if (is_file($cssFile)) {
++ $cssName = $a['slug'].'-admin-css';
++ wp_register_style(
++ $cssName,
++ GLM_MEMBERS_WORDPRESS_PLUGIN_URL.'/'.$a['slug'].'/css/admin.css',
++ false,
++ GLM_MEMBERS_PLUGIN_VERSION
++ );
++ wp_enqueue_style($cssName);
++ }
++ }
++
++ add_meta_box("shortcode_builder",
++ "Shortcode Builder",
++ array($this,'shortcode_builder_markup'),
++ "page", 'normal', 'high'
++ );
++
++ }
++
++ // metabox content
++ public function shortcode_builder_markup(){
++
++ require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
++ $listAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-members-list']['attributes'];
++ $detailAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-member-detail']['attributes'];
++
++ $glmcat = new GlmDataCategories($this->wpdb, $this->wpconfig);
++ $list = $glmcat->getList();
++ // get the each addOn slugs to pass to the config array later
++ $addOns = $this->config['addOns'];
++ foreach($addOns as $addOn){
++ if(!is_array($addOn['slug'])){
++ $addOnSlugs[] = $addOn['slug'];
++ }
++ }
++
++ // use the addOn slugs to access each of the shortcodes
++ foreach($addOnSlugs as $addOn){
++ $shortCodeList[] = $this->config['addOns'][$addOn]['shortcodes'];
++ }
++ // loop through the shortcodes to pull out the shortcode names
++ foreach($shortCodeList as $addonInfo) {
++ foreach($addonInfo as $shortCode=>$value){
++ if(!is_array($shortCode)){
++ $shortCodes[] = $shortCode;
++ }
++ }
++ }
++
++ //dropdown for shortcode names
++ echo '<div id="shortcodeBuilder">';
++ echo '<select id="shortcodeDropdown">
++ <option value=""> Select Shortcode </option>';
++ foreach($shortCodes as $code){
++ echo '<option value = "' . $code . '">' . $code . '</option>';
++ }
++ echo '</select>';
++
++ /*
++ * Member DB Shortcode Attributes
++ */
++
++ //dropdown for categories
++ echo '<select id="category-scDropdown">';
++ echo '<option> Select Category </option>';
++ foreach($list as $key=>$value){
++ echo '<option value='. $key . '>' . $value['name'] . '</option>';
++ }
++ echo '</select>';
++
++ // dropdown for blank start
++ echo '<select id="blank-start-scDropdown">';
++ echo '<option> Blank Start </option>
++ <option value="False"> False </option>
++ <option value="True"> True </option>';
++ echo '</select>';
++
++ // dropdown for views
++ echo '<select id="view-scDropdown">';
++ echo '<option selected="selected" value="bars"> Bars </option>';
++ echo '<option value="grid"> Grid </option>';
++ echo '</select>';
++
++ // show list options 'scb' = shortcode builder acronym
++ echo '<div id="showList" title="List Options">';
++ echo '<label><input class="showLists" type="checkbox" name="listBox" value="all">All</label>';
++ echo '<label><input class="showLists" type="checkbox" name="listBox" value="none">None</label>';
++ foreach($listAttr as $key=>$value){
++ if($value != ''){
++ echo '<label class="checkList"><input class="showLists" type="checkbox" name="listBox" value='. $key . '>' . $key .'</label>';
++ }
++ }
++ echo '</div>';
++
++ // show detail options
++ echo '<div id="showDetail" title="Detail Options">';
++ echo '<label><input class="showDetails" type="checkbox" name="detailBox" value="all">All</label>';
++ echo '<label><input class="showDetails" type="checkbox" name="detailBox" value="none">None</label>';
++ foreach($detailAttr as $key=>$value){
++ if($value != ''){
++ echo '<label class="checkDetails"><input class="showDetails" type="checkbox" name="detailBox" value='. $key . '>' . $key .'</label>';
++ }
++ }
++ echo '</div>';
++
++ // packaging addOn mark up
++ if(file_exists(GLM_MEMBERS_PACKAGING_PLUGIN_PATH . "/setup/shortcodeBuilder.php")){
++ include GLM_MEMBERS_PACKAGING_PLUGIN_PATH . "/setup/shortcodeBuilder.php";
++ }
++
++ // list and detail buttons to open dialog for member db 'show' attr options
++ echo '<button id="listBtn" class="glm-button" type="button"> Show List Options </button>';
++ echo '<button id="detailBtn" class="glm-button" type="button"> Show Detail Options </button>';
++
++ echo '<button id="generate" class="glm-button" type="button"> Insert Shortcode </button>';
++
++ }
++
}
/*
echo '<div class="error"><h3 class="glm-error">Plugin Git Branch Warning:</h3><br>'.$installErrors.'</div>';
delete_option('glmMembersInstallErrors');
}
++
++
}
--
-- }
-- /*get_option(GLM_MEMBERS_PLUGIN_OPTION_MEMBERS_ONLY_ID)
-- * Create new pages containing the member DB shortcodes
-- * @return void
-- */
- public function createPages($requiredPages)
- public function createPages($requiredPages)
-- {
-- foreach($requiredPages as $requiredPage => $requiredPageInfo) {
- $trimmedName = GLM_MEMBERS_PLUGIN_OPTION_PREFIX.$requiredPageInfo['optionSuffix'];
- $trimmedName = GLM_MEMBERS_PLUGIN_OPTION_PREFIX.$requiredPageInfo['underscored_name'];
-- if ($requiredPageInfo['parent'] == 'associate') {
-- $postParent = get_option(GLM_MEMBERS_PLUGIN_OPTION_ASSOCIATE_ID);
-- } else if ($requiredPageInfo['parent'] == 'membersonly') {
-- $postParent = get_option(GLM_MEMBERS_PLUGIN_OPTION_MEMBERS_ONLY_ID);
-- } else if (is_numeric($requiredPageInfo['parent'])) {
-- $postParent = $requiredPageInfo['parent'];
-- } else {
-- $postParent = '0';
-- }
- if ( !get_post(get_option($trimmedName))) {
- $duplicatePage = get_page_by_title($requiredPageInfo['name']);
- //echo $duplicatePage;
- echo $duplicatePage->title;
- echo $duplicatePage->title->ID;
- if ($duplicatePage->title == $requiredPageInfo['name']) {
- update_option($trimmedName, $duplicatePage->ID);
- $existingPost = get_post(get_option($trimmedName));
- $testSlug = get_post_field( 'post_name', $existingPost);
- $newSlug = sanitize_title($requiredPageInfo['name']);
- $existingSlug = $this->verify_post_slug($newSlug);
-
-
- // If a post with the ID set in the option does not exist
- if ( !$existingPost) {
-
- // If the new slug corresponds to an already existent page, yet the ID option does not exist,
- // then it's either the first time this plugin is run on an outdated site or somehow the ID was
- // deleted. Either way, replace the option value with whatever is the ID of the page matching
- // that slug. The slug is checked by translating the page title.
- if ($newSlug == $existingSlug) {
- $existingID = $this->get_post_id_by_slug($newSlug);
- update_option($trimmedName, $existingID);
- // Otherwise create a new page
-- } else {
- $new_page = array(
- 'post_title' => $requiredPageInfo['name'],
- 'post_content' => $requiredPageInfo['content'],
- 'post_status' => 'publish',
- 'post_type' => 'page',
- 'post_author' => '1',
- 'page_template' => isset($requiredPageInfo['template']) ? $requiredPageInfo['template'] : 'index.php' ,
- 'post_parent' => $postParent
- );
- $new_id = wp_insert_post($new_page);
- // Put together the new page, then update the option with the new ID
- $templateUsed = isset($requiredPageInfo['template']) ? $requiredPageInfo['template'] : 'index.php';
- $new_id = $this->insertReqPage(
- $requiredPageInfo['name'],
- $requiredPageInfo['content'],
- 'publish',
- 'page',
- '1',
- $templateUsed,
- $postParent
- );
-- update_option($trimmedName, $new_id);
--
-- // Make extra page if members only is created
-- if ($new_id == get_option(GLM_MEMBERS_PLUGIN_OPTION_MEMBERS_ONLY_ID)) {
- $sample_page = array(
- 'post_title' => 'Members Only Sample Subpage',
- 'post_content' => 'This page will automatically be locked to Members Only with the members-only-template',
- 'post_status' => 'publish',
- 'post_type' => 'page',
- 'post_author' => '1',
- 'page_template' => isset($requiredPageInfo['template']) ? $requiredPageInfo['template'] : 'index.php' ,
- 'post_parent' => $new_id
- $this->insertReqPage(
- 'Members Only Sample Subpage',
- 'This page will automatically be locked to Members Only with the members-only-template',
- 'publish',
- 'page',
- '1',
- $templateUsed,
- $new_id
-- );
- wp_insert_post($sample_page);
-
-- }
-- }
- } else {
- // No page created
-- }
-- }
-
-- }
-
-
-
- public function insertReqPage($pTitle = '--bad page--', $pContent = '', $pPublish = 'publish', $pType = 'page', $pAuthor = '1', $pTemplate = 'index.php', $pParent = '0')
- {
- $new_page = array(
- 'post_title' => $pTitle,
- 'post_content' => $pContent,
- 'post_status' => $pPublish,
- 'post_type' => $pType,
- 'post_author' => $pAuthor,
- 'page_template' => $pTemplate ,
- 'post_parent' => $pParent
- );
- return wp_insert_post($new_page);
- }
-
-
- public function get_post_data($needle = 1, $valueField = 'post_name', $needleField = 'ID')
- {
- $value = $this->wpdb->get_var("SELECT $valueField FROM ".$this->wpdb->posts." WHERE $needleField = '".$needle."'");
- return $value;
- }
-
- public function verify_post_slug($postName)
- {
- $value = $this->wpdb->get_var("SELECT post_name FROM ".$this->wpdb->posts." WHERE post_name = '".$postName."'");
- return $value;
- }
-
- public function get_post_id_by_slug($postName)
- {
- $value = $this->wpdb->get_var("SELECT ID FROM ".$this->wpdb->posts." WHERE post_name = '".$postName."'");
- return $value;
- }
-
-- /**
-- * Get Git Branch
-- *
-- * @return void
-- * @access public
-- */
-- public function getGitBranch()
-- {
-- $gitBranch = array();
--
-- foreach ($this->config['addOns'] as $a) {
--
-- // Git branch should be stored in .git/HEAD file
-- $gitFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.'/'.$a['slug'].'/.git/HEAD';
--
-- // Check if the file exists
-- if (file_exists($gitFile)) {
--
-- // Read in the file
-- $gitString = file_get_contents($gitFile);
--
-- // Parse the branch string by '/'
-- $gitParts = explode('/', $gitString);
--
-- if (trim($gitParts[2]) != 'master') {
--
-- $gitBranch[$a['slug']]['slug'] = $a['slug'];
--
-- // [2] should be branch name or type
-- if (isset($gitParts[2])) {
-- $gitBranch[$a['slug']]['branch'] = $gitParts[2];
-- }
--
-- // [3] should be name of feature
-- if (isset($gitParts[3])) {
-- $gitBranch[$a['slug']]['feature'] = $gitParts[3];
-- }
--
-- }
--
-- }
--
-- }
--
-- $this->gitBranch = $gitBranch;
-- return;
--
-- }
--
-- /**
-- * Display Git Branch as an admin warning
-- *
-- * @return void
-- * @access public
-- */
-- function glmMembersGitNotice() {
--
-- echo '<div class="error"><h3 class="glm-error">Plugin Git Branch Warning:</h3><table>';
-- foreach ($this->gitBranch as $b) {
--
-- echo '<tr><th align="left">'.$b['slug'].'</th><td>'.$b['branch'];
-- if (isset($b['feature'])) {
-- echo '/'.$b['feature'];
-- }
-- echo '</td></tr>';
--
-- }
-- echo "</table></div>";
}
/**
$glm_dashboard_widget = $wp_meta_boxes['dashboard']['normal']['core']['glm_members_admin_dashboard_widget'];
unset($wp_meta_boxes['dashboard']['normal']['core']['glm_members_admin_dashboard_widget']);
$wp_meta_boxes['dashboard']['side']['core']['glm_members_admin_dashboard_widget'] = $glm_dashboard_widget;
-
-
- }
- }
- public function glmMembersShortcode(){
-
- // load shortcodeBuilder.js when the shortcode function has been fired
- add_action('admin_print_styles-post.php', 'custom_js_css');
- add_action('admin_print_styles-post-new.php', 'custom_js_css');
-
- // tried calling the adminScripts function here but it throws js errors in the console
- wp_enqueue_script('jquery', false, array(), false, true);
- wp_enqueue_script('jquery-style', false, array(), false, true);
- wp_enqueue_script('jquery-ui-core', false, array(), false, true);
- wp_enqueue_script('jquery-ui-widget', false, array(), false, true);
- wp_enqueue_script('jquery-ui-dialog', false, array(), false, true);
- wp_enqueue_script('jquery-ui-autocomplete', false, array(), false, true);
-
- // Jquery DatePicker
- wp_enqueue_script('jquery-ui-datepicker');
- wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
-
- function custom_js_css() {
-
- wp_enqueue_script('your-meta-box', GLM_MEMBERS_PLUGIN_URL. '/js/shortcodeBuilder.js', array('jquery'), null, true);
- }
- reset($this->config['addOns']);
- foreach ($this->config['addOns'] as $a) {
- $cssFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.$a['slug'].'/css/admin.css';
- if (is_file($cssFile)) {
- $cssName = $a['slug'].'-admin-css';
- wp_register_style(
- $cssName,
- GLM_MEMBERS_WORDPRESS_PLUGIN_URL.'/'.$a['slug'].'/css/admin.css',
- false,
- GLM_MEMBERS_PLUGIN_VERSION
- );
- wp_enqueue_style($cssName);
- }
- }
-
- add_meta_box("shortcode_builder",
- "Shortcode Builder",
- array($this,'shortcode_builder_markup'),
- "page", 'normal', 'high'
- );
-
- }
-// // metabox content
- public function shortcode_builder_markup(){
-
- require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
- $listAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-members-list']['attributes'];
- $detailAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-member-detail']['attributes'];
-
- $glmcat = new GlmDataCategories($this->wpdb, $this->wpconfig);
- $list = $glmcat->getList();
- // get the each addOn slugs to pass to the config array later
- $addOns = $this->config['addOns'];
- foreach($addOns as $addOn){
- if(!is_array($addOn['slug'])){
- $addOnSlugs[] = $addOn['slug'];
- }
- }
- }
- }
- public function glmMembersShortcode(){
-
- // load shortcodeBuilder.js when the shortcode function has been fired
- add_action('admin_print_styles-post.php', 'custom_js_css');
- add_action('admin_print_styles-post-new.php', 'custom_js_css');
- // use the addOn slugs to access each of the shortcodes
- foreach($addOnSlugs as $addOn){
- $shortCodeList[] = $this->config['addOns'][$addOn]['shortcodes'];
- }
- // loop through the shortcodes to pull out the shortcode names
- foreach($shortCodeList as $addonInfo) {
- foreach($addonInfo as $shortCode=>$value){
- if(!is_array($shortCode)){
- $shortCodes[] = $shortCode;
- }
- }
- }
-// /*
-// * HTML Markup for the shortodes
-// */
-// if(file_exists(GLM_MEMBERS_EVENTS_PLUGIN_PATH . "/setup/shortcodeBuilder.php")){
-// include GLM_MEMBERS_EVENTS_PLUGIN_PATH . "/setup/shortcodeBuilder.php";
-// }
-//
-//
- //dropdown for shortcode names
- echo '<div id="shortcodeBuilder">';
- echo '<select id="shortcodeDropdown">
- <option value=""> Select Shortcode </option>';
- foreach($shortCodes as $code){
- echo '<option value = "' . $code . '">' . $code . '</option>';
- }
- echo '</select>';
-
-// /*
-// * Member DB Shortcode Attributes
-// */
-//
- //dropdown for categories
- echo '<select id="category-scDropdown">';
- echo '<option> Select Category </option>';
- foreach($list as $key=>$value){
- echo '<option value='. $key . '>' . $value['name'] . '</option>';
- }
- echo '</select>';
--
- // tried calling the adminScripts function here but it throws js errors in the console
- wp_enqueue_script('jquery', false, array(), false, true);
- wp_enqueue_script('jquery-style', false, array(), false, true);
- wp_enqueue_script('jquery-ui-core', false, array(), false, true);
- wp_enqueue_script('jquery-ui-widget', false, array(), false, true);
- wp_enqueue_script('jquery-ui-dialog', false, array(), false, true);
- wp_enqueue_script('jquery-ui-autocomplete', false, array(), false, true);
-// // dropdown for blank start
- echo '<select id="blank-start-scDropdown">';
- echo '<option> Blank Start </option>
- <option value="False"> False </option>
- <option value="True"> True </option>';
- echo '</select>';
-
-// // dropdown for views
- echo '<select id="view-scDropdown">';
- echo '<option selected="selected" value="bars"> Bars </option>';
- echo '<option value="grid"> Grid </option>';
- echo '</select>';
-
- // show list options 'scb' = shortcode builder acronym
- echo '<div id="showList" title="List Options">';
- echo '<label><input class="showLists" type="checkbox" name="listBox" value="all">All</label>';
- echo '<label><input class="showLists" type="checkbox" name="listBox" value="none">None</label>';
- foreach($listAttr as $key=>$value){
- if($value != ''){
- echo '<label class="checkList"><input class="showLists" type="checkbox" name="listBox" value='. $key . '>' . $key .'</label>';
- }
- }
- echo '</div>';
--
- // Jquery DatePicker
- wp_enqueue_script('jquery-ui-datepicker');
- wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
- // show detail options
- echo '<div id="showDetail" title="Detail Options">';
- echo '<label><input class="showDetails" type="checkbox" name="detailBox" value="all">All</label>';
- echo '<label><input class="showDetails" type="checkbox" name="detailBox" value="none">None</label>';
- foreach($detailAttr as $key=>$value){
- if($value != ''){
- echo '<label class="checkDetails"><input class="showDetails" type="checkbox" name="detailBox" value='. $key . '>' . $key .'</label>';
- }
- }
- echo '</div>';
-
- // packaging addOn mark up
- if(file_exists(GLM_MEMBERS_PACKAGING_PLUGIN_PATH . "/setup/shortcodeBuilder.php")){
- include GLM_MEMBERS_PACKAGING_PLUGIN_PATH . "/setup/shortcodeBuilder.php";
- }
--
- function custom_js_css() {
- // list and detail buttons to open dialog for member db 'show' attr options
- echo '<button id="listBtn" class="glm-button" type="button"> Show List Options </button>';
- echo '<button id="detailBtn" class="glm-button" type="button"> Show Detail Options </button>';
- wp_enqueue_script('your-meta-box', GLM_MEMBERS_PLUGIN_URL. '/js/shortcodeBuilder.js', array('jquery'), null, true);
- echo '<button id="generate" class="glm-button" type="button"> Insert Shortcode </button>';
-
}
-
- add_meta_box("shortcode_builder",
- "Shortcode Builder",
- array($this,'shortcode_builder_markup'),
- "page", 'normal', 'high'
- );
-
+ }
- // // metabox content
- public function shortcode_builder_markup(){
-
- require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
- $listAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-members-list']['attributes'];
- $detailAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-member-detail']['attributes'];
-
- $glmcat = new GlmDataCategories($this->wpdb, $this->wpconfig);
- $list = $glmcat->getList();
- // get the each addOn slugs to pass to the config array later
- $addOns = $this->config['addOns'];
- foreach($addOns as $addOn){
- if(!is_array($addOn['slug'])){
- $addOnSlugs[] = $addOn['slug'];
- }
- }
-
- // use the addOn slugs to access each of the shortcodes
- foreach($addOnSlugs as $addOn){
- $shortCodeList[] = $this->config['addOns'][$addOn]['shortcodes'];
- }
- // loop through the shortcodes to pull out the shortcode names
- foreach($shortCodeList as $addonInfo) {
- foreach($addonInfo as $shortCode=>$value){
- if(!is_array($shortCode)){
- $shortCodes[] = $shortCode;
- }
- }
- }
- // /*
- // * HTML Markup for the shortodes
- // */
- // if(file_exists(GLM_MEMBERS_EVENTS_PLUGIN_PATH . "/setup/shortcodeBuilder.php")){
- // include GLM_MEMBERS_EVENTS_PLUGIN_PATH . "/setup/shortcodeBuilder.php";
- // }
- //
- //
- //dropdown for shortcode names
- echo '<div id="shortcodeBuilder">';
- echo '<select id="shortcodeDropdown">
- <option value=""> Select Shortcode </option>';
- foreach($shortCodes as $code){
- echo '<option value = "' . $code . '">' . $code . '</option>';
- }
- echo '</select>';
-
- // /*
- // * Member DB Shortcode Attributes
- // */
- //
- //dropdown for categories
- echo '<select id="category-scDropdown">';
- echo '<option value=""> Select Category </option>';
- foreach($list as $key=>$value){
- echo '<option value='. $key . '>' . $value['name'] . '</option>';
- }
- echo '</select>';
-
- // // dropdown for blank start
- echo '<select id="blank-start-scDropdown">';
- echo '<option value=""> Blank Start </option>
- <option selected="selected" value="False"> False </option>
- <option value = "True"> True </option>';
- echo '</select>';
-
- // show list options 'scb' = shortcode builder acronym
- echo '<div id="showList" title="List Options">';
- echo '<label><input class="listBox" type="checkbox" name="list-scb" value="all">All</label>';
- echo '<label><input class="listBox" type="checkbox" name="list-scb" value="none">None</label>';
- foreach($listAttr as $key=>$value){
- if($value != ''){
- echo '<label><input class="showLists" type="checkbox" name="listBox" value='. $key . '>' . $key .'</label>';
- }
- }
- echo '</div>';
-
- // show detail options
- echo '<div id="showDetail" title="Detail Options">';
- echo '<label><input class="detailBox" type="checkbox" name="detailBox" value="all">All</label>';
- echo '<label><input class="detailBox" type="checkbox" name="detailBox" value="none">None</label>';
- foreach($detailAttr as $key=>$value){
- if($value != ''){
- echo '<label><input class="showDetails" type="checkbox" name="detailBox" value='. $key . '>' . $key .'</label>';
- }
- }
- echo '</div>';
-
- // packaging addOn mark up
- if(file_exists(GLM_MEMBERS_PACKAGING_PLUGIN_PATH . "/setup/shortcodeBuilder.php")){
- include GLM_MEMBERS_PACKAGING_PLUGIN_PATH . "/setup/shortcodeBuilder.php";
- }
-
- // list and detail buttons to open dialog for member db 'show' attr options
- echo '<button id="listBtn" class="glm-button" type="button"> Show List Options </button>';
- echo '<button id="detailBtn" class="glm-button" type="button"> Show Detail Options </button>';
-
- echo '<button id="generate" class="glm-button" type="button"> Insert Shortcode </button>';
-
- }
/**
* Admin controller
}
}
++ /*
++ *
++ * Check Required Pages
++ *
++ */
foreach ($this->config['addOns'] as $a) {
-- //
if (isset($a['requiredPages'])) {
$this->createPages($a['requiredPages']);
}
// Create hook to add page tabs by add-on plugins
$addOnTabs = array();
--
$addOnTabs = apply_filters(
'glm-member-db-add-tab-for-'.$menuItem,
$addOnTabs