From a13fe04219f9a22ad2e574a37a12326c822e8b18 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Mon, 11 Dec 2017 14:29:26 -0500 Subject: [PATCH] Clearing out all old unused code from other custom fields add-on when it was duplicated to create this one. --- activate.php | 78 ---- config/plugin.ini | 5 - misc/documentation/AddAnAdminTab.txt | 15 - misc/documentation/CreateNewAddOn.txt | 49 --- models/admin/OLD-entity/fields.php | 192 ---------- models/admin/OLD-import/fields.php | 411 --------------------- models/admin/OLD-management/fields.php | 228 ------------ setup/rolesAndCapabilities.php | 19 - views/admin/OLD-entity/fields.html | 38 -- views/admin/OLD-import/fields.html | 48 --- views/admin/OLD-import/fieldsProcess.html | 16 - views/admin/OLD-import/fieldsValidate.html | 40 -- views/admin/OLD-management/fields.html | 277 -------------- views/front/fields/OLDdetail.html | 19 - views/front/fields/OLDlist.html | 20 - 15 files changed, 1455 deletions(-) delete mode 100644 misc/documentation/AddAnAdminTab.txt delete mode 100644 misc/documentation/CreateNewAddOn.txt delete mode 100644 models/admin/OLD-entity/fields.php delete mode 100644 models/admin/OLD-import/fields.php delete mode 100644 models/admin/OLD-management/fields.php delete mode 100644 setup/rolesAndCapabilities.php delete mode 100644 views/admin/OLD-entity/fields.html delete mode 100644 views/admin/OLD-import/fields.html delete mode 100644 views/admin/OLD-import/fieldsProcess.html delete mode 100644 views/admin/OLD-import/fieldsValidate.html delete mode 100644 views/admin/OLD-management/fields.html delete mode 100644 views/front/fields/OLDdetail.html delete mode 100644 views/front/fields/OLDlist.html diff --git a/activate.php b/activate.php index 257ff9e..04d9676 100644 --- a/activate.php +++ b/activate.php @@ -70,84 +70,6 @@ class glmMembersCustomFieldsPluginActivate // Set current plugin version update_option('glmMembersCustomFieldsPluginVersion', GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_VERSION); - // Set Roles and Capabilities for this plugin - require_once GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_SETUP_PATH.'/rolesAndCapabilities.php'; } - /* - * Add a capability to all current roles - * - * @param string $capability Name of capability to add - * @param array $default Whether capability should be on by default - * array( - * 'author' => false, - * 'contributor' => false, - * 'editor' => false, - * 'subscriber' => false - * ) - * - * @return void - * @access private - */ - private function addRoleCapability($capability, $default) - { - // Get list of role objects - $roleObjects = $GLOBALS['wp_roles']->role_objects; - - // Get list of roles we can edit - $roles = get_editable_roles(); - - // For each role object - foreach ($roleObjects as $key => $role) { - - // Check if the role exists in list of editable roles and - // the capability does not exist - if (isset($roles[$key]) && ! isset($role->capabilities[$capability])) { - - // Check if a default value has been specified in the $default array - $enabled = false; - if (isset($default[$role->name])) { - - // It has, so use that - $enabled = $default[$role->name]; - - } - - // Add the role - $role->add_cap($capability, $enabled); - - } - } - } - - - /* - * Delete a capability from all current roles - * - * @param string $capability Name of capability to add - * - * @return void - * @access private - */ - private function deleteRoleCapability($capability) - { - // Get list of role objects - $roleObjects = $GLOBALS['wp_roles']->role_objects; - - // Get list of roles we can edit - $roles = get_editable_roles(); - - // For each role object - foreach ($roleObjects as $key => $role) { - - if ( isset($role->capabilities[$capability])) { - $role->remove_cap($capability); - } - - } - - } - - - } diff --git a/config/plugin.ini b/config/plugin.ini index e6f76cb..77b9ef0 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -4,8 +4,3 @@ ; ; Place any static configuration parameters here. ; - -[custom_field_types] -text = 'text' -textarea = 'textarea' -checkbox = 'checkbox' diff --git a/misc/documentation/AddAnAdminTab.txt b/misc/documentation/AddAnAdminTab.txt deleted file mode 100644 index c697b47..0000000 --- a/misc/documentation/AddAnAdminTab.txt +++ /dev/null @@ -1,15 +0,0 @@ -Add an admin tab - -* Add a new section in setup/adminTabs.php - -* Add a model file - models/admin/{menu}/{action}.php - -* Add a view file - views/admin/{menu}/{action}.html - -* Add action to setup/validActions.php - -* If needed add a database table to the create_database_V...sql file - and update name to current database version, add an - update_database_V....sql file, and/or update dbVersions.php - -* If required add a data definition for any new tables diff --git a/misc/documentation/CreateNewAddOn.txt b/misc/documentation/CreateNewAddOn.txt deleted file mode 100644 index b93235f..0000000 --- a/misc/documentation/CreateNewAddOn.txt +++ /dev/null @@ -1,49 +0,0 @@ -Procedure to create a new GLM Members add-on plugin ----------------------------------------------------- - -* Checkout glm-member-db-sample and rename directory to glm-member-db-{add-on name} - -* From a bash prompt, run "SETUP_SCRIPT" - -* Create new repository named WP-Plugins/glm-member-db-{name of add-on}.git - -* If there are any databases associated with this add-on, setup the database scripts and - data under the "setup/databaseScripts" directory. If there are no database tables - with this add-on, remove all but the "readme.txt" file from that directory. - NOTE: No "update_database..." files should be there for a new add-on with new tables. - NOTE: There should be only one entry in the "dbVersions.php" file. - -* Carefully review "defines.php" file and update as needed. - -* Do a quick review of the readme.txt file and update as desired. - -* TEST - At this point the add-on should install and activate but not do anything. - - If there are any database tables, make sure they were created and are correct. - - Go to "Members" -> "Management" -> "Add-Ons" and make sure the add-on was - properly registered with the main plugin and that any database data is shown. - -* Adding menus - - Update "setup/adminMenus.php" and add menu section as described there. - - Add an entry in the validActions.php file. Pay attention to how slug name is - constructed ("glm-members-admin-{page}-{action}"). - - If needed add a database table to the create_database_V...sql file - Also add a "classes/data/data{Table}.php file - - Add a model file as "models/admin/{page}/{action}.php - - Add any desired view file as "views/admin/{page}/{action}.html - Note that additional possible view files should be named as... - "views/admin/{page}/{action}{Name}.html - - Test that when add-on is activated that the menu shows and is functional. - -* Adding tabs - - Update "setup/admin/Tabs.php" and add new tab filter as described there. - - Add an entry in the validActions.php file. Pay attention to how slug name is - constructed ("glm-members-admin-{page}-{action}"). - - If needed add a database table to the create_database_V...sql file - Also add a "classes/data/data{Table}.php file - - Add a model file as "models/admin/{page}/{action}.php - - Add any desired view file as "views/admin/{page}/{action}.html - Note that additional possible view files should be named as... - "views/admin/{page}/{action}{Name}.html - - Test that when add-on is activated that the tab shows and is functional. - - * \ No newline at end of file diff --git a/models/admin/OLD-entity/fields.php b/models/admin/OLD-entity/fields.php deleted file mode 100644 index 6049837..0000000 --- a/models/admin/OLD-entity/fields.php +++ /dev/null @@ -1,192 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @release fields.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ - * @link http://dev.gaslightmedia.com/ - */ - -// Load Management Fields data abstract -require_once GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_CLASS_PATH.'/data/dataCustomFields.php'; - -/** - * GlmMembersAdmin_management_fields - * - * PHP version 5 - * - * @category Model - * @package GLM Member DB - * @author Chuck Scott - * @license http://www.gaslightmedia.com Gaslightmedia - * @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott - * Exp $ - */ -class GlmMembersAdmin_entity_fields extends GlmDataFieldsCustomFields -{ - - /** - * WordPress Database Object - * - * @var $wpdb - * @access public - */ - public $wpdb; - /** - * dbh Postgres database connection - * - * @var mixed - * @access public - */ - public $dbh; - /** - * settings used for the schema and tablenames - * - * @var mixed - * @access public - */ - public $settings = array(); - /** - * categories - * - * @var bool - * @access public - */ - public $categories = array(); - public $oldCatMap = array(); - /** - * fields - * - * @var bool - * @access public - */ - public $fields = array(); - public $image_owner; - - /** - * Constructor - * - * This contructor performs the work for this model. This model returns - * an array containing the following. - * - * 'status' - * - * True if successfull and false if there was a fatal failure. - * - * 'view' - * - * A suggested view name that the contoller should use instead of the - * default view for this model or false to indicate that the default view - * should be used. - * - * 'data' - * - * Data that the model is returning for use in merging with the view to - * produce output. - * - * @wpdb object WordPress database object - * - * @return array Array containing status, suggested view, and any data - */ - public function __construct ($wpdb, $config) - { - // Save WordPress Database object - $this->wpdb = $wpdb; - - // Save plugin configuration object - $this->config = $config; - - // Run constructor for members data class - parent::__construct(false, false); - - } - - /** - * modelAction - * - * @param bool $actionData - * @access public - * @return void - */ - public function modelAction($actionData = false) - { - $option = false; - $customFields = false; - $haveCustomFields = false; - $customFieldData = false; - $where = 'true'; - $uid = ''; - - if (isset($_REQUEST['option'])) { - $option = $_REQUEST['option']; - } - - // Check if a field ID is supplied - $id = 0; - if (isset($_REQUEST['id'])) { - $id = $_REQUEST['id']-0; - } - $entityID = 0; - if (isset($actionData)) { - $entityID = $actionData['entityID']; - $uid = $actionData['uid']; - $fieldFail = $actionData['cfData']; -// print_r($fieldFail); - } - - switch ($option) { - - default: - // Make sure option is set if default - $option = 'list'; - - break; - - } - // $where .= " AND field_id in (select id from " . GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_DB_PREFIX ."custom_fields where uid = 'glm-member-db')"; - $where .= " AND uid = '$uid'"; - // Get list of Custom Fields - $customFields = $this->getList( $where, 'field_order,id' ); - if ( isset($customFields) && $customFields && count( $customFields ) > 0 ) { - $haveCustomFields = true; - } - - require_once GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_CLASS_PATH . '/customFieldPluginSupport.php'; - // is array ensures that the data passed BAD - if(is_array($fieldFail)){ - $customFieldsData = $fieldFail; - }else { - $customFieldsData = customFieldsGetFieldData( $entityID ); - } - - - // Compile template data - $template_data = array( - 'prefix' => 'glm_custom_field', - 'customFields' => $customFields, - 'customFieldsData' => $customFieldsData, - 'fieldFail' => $fieldFail, - 'fieldTypes' => $this->config['custom_field_types'], - 'haveCustomFields' => $haveCustomFields, - 'uid' => $uid - ); - - // Return status, suggested view, and data to controller - return array( - 'status' => true, - 'menuItemRedirect' => false, - 'modelRedirect' => false, - 'view' => 'admin/entity/fields.html', - 'data' => $template_data - ); - - - } - -} diff --git a/models/admin/OLD-import/fields.php b/models/admin/OLD-import/fields.php deleted file mode 100644 index 6736069..0000000 --- a/models/admin/OLD-import/fields.php +++ /dev/null @@ -1,411 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @version 0.1 - */ -require_once GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_CLASS_PATH.'/data/dataCustomFieldsData.php'; -require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php'; -/* - * This class performs the work for the default action of the "Import" menu - * option. - * - */ -class GlmMembersAdmin_import_fields extends GlmDataFieldsCustomFieldsData -{ - - const CSV_CHARS_PER_LINE = 6000; - /** - * WordPress Database Object - * - * @var $wpdb - * @access public - */ - public $wpdb; - /** - * Plugin Configuration Data - * - * @var $config - * @access public - */ - public $config; - - /** - * errors - * - * @var $errors - * @access public - */ - public $errors = array(); - - /** - * numberProcessed - * - * @var float - * @access public - */ - public $numberProcessed = 0; - - /** - * totalFields - * - * @var float - * @access public - */ - public $totalFields = 0; - - /** - * processingComplete - * - * @var bool - * @access public - */ - public $processingComplete = false; - - /** - * Constructor - * - * This contractor sets up this model. At this time that only includes - * storing away the WordPress data object. - * - * @return object Class object - * - */ - public function __construct ($wpdb, $config) - { - - // Save WordPress Database object - $this->wpdb = $wpdb; - - // Save plugin configuration object - $this->config = $config; - - // Run constructor for members data class - parent::__construct(false, false); - - } - - /** - * Perform Model Action - * - * This method does the work for this model and returns any resulting data - * - * @return array Status and data array - * - * 'status' - * - * True if successful and false if there was a fatal failure. - * - * 'menuItemRedirect' - * - * If not false, provides a menu item the controller should - * execute after this one. Normally if this is used, there would also be a - * modelRedirect value supplied as well. - * - * 'modelRedirect' - * - * If not false, provides an action the controller should execute after - * this one. - * - * 'view' - * - * A suggested view name that the controller should use instead of the - * default view for this model or false to indicate that the default view - * should be used. - * - * 'data' - * - * Data that the model is returning for use in merging with the view to - * produce output. - * - */ - public function modelAction ($actionData = false) - { - // Set the view file - $view = 'fields.html'; - $failure = false; - $option = 'fields'; - $clearData = false; - $importRet = false; - $haveMembers = false; - $fileExists = false; - $isValid = false; - // Check to see if they have members - $haveMembers = $this->wpdb->get_var( - "SELECT count(id) - FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members" - ); - // $fileData - The main files needed for the member import - // - field: input field name - // - name: file name - // - exists: Does file exists. Set to false at first. - // - validate: Validation array. Header line must match this. - // - type: Type of file. Used in the processing function. - $fileData = array( - 'Fields' => array( - 'field' => 'fields_file', - 'name' => 'fieldsData.csv', - 'exists' => false, - 'validate' => array( 'member_id', 'field_name', 'field_value' ), - 'type' => 'fields', - ), - ); - // Setting readyToProcess to false (initialize) - $readyToProcess = false; - - // Set the $option if found in $_REQUEST array - if (isset($_REQUEST['option']) && $_REQUEST['option'] != '') { - $option = $_REQUEST['option']; - } - - // Set the $option2 if found in $_REQUEST array - if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') { - $option2 = $_REQUEST['option2']; - } - - // Set variable for the upload directory - $wpUploadDir = wp_get_upload_dir(); - - // Set the $uploadPath for import files - $uploadPath = $wpUploadDir['basedir'] . '/' . 'glm-member-import'; - - // If the folder for the upload import files doesn't exists create one. - if ( !is_dir( $uploadPath ) ) { - // Get old umask - $oldMask = umask(0); - // Set folder permission - mkdir( $uploadPath, 0770 ); - // reset old umask - umask( $oldMask ); - } - - switch( $option ) { - - case 'fieldsValidate'; - $validFiles = 0; - // Set the view file - $view = 'fieldsValidate.html'; - $fileCount = count( $fileData ); - // Move any files uploaded - if ( isset( $_FILES ) ) { - foreach ( $fileData as $fileHeader => $file ) { - if ( !$_FILES[$file['field']]['error'] ) { - move_uploaded_file( $_FILES[$file['field']]['tmp_name'], $uploadPath . '/'. $file['name'] ); - } - } - } - // Check that each file exists - foreach ( $fileData as $fileHeader => $file ) { - if ( is_file( $uploadPath . '/' . $file['name'] ) ) { - $fileData[$fileHeader]['exists'] = true; - $fData = $this->readCSVFileHeaders( $uploadPath . '/' . $file['name'] ); - $isValid = ( $file['validate'] == $fData ); - if ( $isValid ) { - $validFiles++; - } - $fileData[$fileHeader]['data'] = $fData; - $fileData[$fileHeader]['isValid'] = $isValid; - } - } - $readyToProcess = ( $validFiles == $fileCount ); - break; - - case 'fieldsProcess': - $memberInfoData = new GlmDataMemberInfo( $this->wpdb, $this->config ); - foreach ( $fileData as $fileHeader => $file ) { - if ( is_file( $uploadPath . '/' . $file['name'] ) ) { - $fields = $this->readCSVFields( $uploadPath . '/'. $file['name'] ); - //echo '
$fields: ' . print_r( $fields, true ) . '
'; - $this->totalFields = count( $fields ); - // Clear the custom field data table - $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_DB_PREFIX . "custom_field_data" ); - foreach ( $fields as $customRow ) { - // Need to first get the member id from the database - // It will match from the old_member_id field - $memberId = $this->wpdb->get_var( - $this->wpdb->prepare( - "SELECT id - FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members - WHERE old_member_id = %d", - $customRow[0] - ) - ); - // get the active member info id - $memberInfoId = - $memberInfoData->getActiveInfoIdForMember( $memberId ); - $customFieldId = $this->wpdb->get_var( - $this->wpdb->prepare( - "SELECT id - FROM " . GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_DB_PREFIX . "custom_fields - WHERE field_name = %s", - $customRow[1] - ) - ); - if ( $customFieldId ) { - $newId = $this->wpdb->insert( - GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_DB_PREFIX . 'custom_field_data', - array( - 'ref_dest' => $memberInfoId, - 'field_id' => $customFieldId, - 'field_data' => $customRow[2], - ), - array( - '%d', - '%d', - '%s' - ) - ); - $this->numberProcessed++; - } - } - $importRet = array(); - } - } - if ( count( $this->errors ) == 0 ) { - $readyToProcess = true; - } - // Here we need to check to see if we processed all members. - // Also the counter has to increment the total processed so far. - if ( $this->numberProcessed == $this->totalFields ) { - $this->processingComplete = true; - } - // Set the view file:< - $view = 'fieldsProcess.html'; - break; - - case 'fields': - default: - // Set the view file - $view = 'fields.html'; - // check upload dir to see if they have any files in yet - foreach ( $fileData as $fileHeader => $file ) { - if ( is_file( $uploadPath . '/' . $file['name'] ) ) { - $fileData[$fileHeader]['exists'] = true; - $fileData[$fileHeader]['mtime'] = filemtime( $uploadPath . '/' . $file['name'] ); - } - } - - break; - - } - - // Setup the template data array - $templateData = array( - 'fileExists' => $fileExists, - 'option' => $option, - 'errors' => $this->errors, - 'numberProcessed' => $this->numberProcessed, - 'totalFields' => $this->totalFields, - 'completed' => $this->processingComplete, - 'data' => false, - 'fileData' => $fileData, - 'clearData' => $clearData, - 'importRet' => $importRet, - 'csvData' => '
$fileData: ' . print_r( $fileData, true ) . '
', - 'readyToProcess' => $readyToProcess, - 'haveMembers' => $haveMembers, - 'isValid' => $isValid, - 'sampleFileUrl' => GLM_MEMBERS_PLUGIN_BASE_URL . '/sample-files/', - ); - - // Return status, suggested view, and data to controller - return array( - 'status' => true, - 'menuItemRedirect' => false, - 'modelRedirect' => false, - 'view' => 'admin/import/' . $view, - 'data' => $templateData, - ); - - } - - /** - * Read in fields from a csv file - * - * Header line as follows. Data follows immediately below this line. this - * line and all above it are ignored. - * - * 'member_id','member_name','member_login','member_passwd','contact_email' - * - * @param string $csv Temporary file name of csv file upload - * - * @return array Array of data from CSV file or an error message - * - */ - public function readCSVFields($csv) - { - - $fields = array(); - $startImport = false; - - // Try to open file - if (($handle = fopen($csv, "r")) !== false) { - - // For each line in the file - while (($c = fgetcsv($handle, 1000, ",")) !== false) { - - // If we're past the header, the first item is numeric, and we have at least 5 fields - if($startImport && ($c[0]-0) > 0 && count($c) >= 3) { - - // Add this line of data to Contacts - $fields[] = $c; - - } - - // If we find the header, assume all data is below that - if ($c[0] == 'member_id') { - $startImport = true; - } - - } - - fclose($handle); - - } else { - return "No file submitted."; - } - - // If we never found the header - if (!$startImport) { - return "Required header not found in file."; - } - - // If we found no data below the header - if (count($fields) == 0) { - return "Header found but no data followed"; - } - - return $fields; - - } - - /** - * readCSVFileHeaders - * - * Read the cvs file. Just the first line is read. - * - * @param mixed $fileName Name of the file (path) - - * @access public - * @return void - */ - public function readCSVFileHeaders( $fileName ) - { - $fileHeaders = array(); - if ( ( $fp = fopen( $fileName, 'r' ) ) !== false ) { - // get first line to use as headers - $fileHeaders = fgetcsv( $fp, SELF::CSV_CHARS_PER_LINE, ',' ); - fclose( $fp ); - } - - return $fileHeaders; - } -} diff --git a/models/admin/OLD-management/fields.php b/models/admin/OLD-management/fields.php deleted file mode 100644 index cc22962..0000000 --- a/models/admin/OLD-management/fields.php +++ /dev/null @@ -1,228 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @release fields.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ - * @link http://dev.gaslightmedia.com/ - */ - -// Load Management Fields data abstract -require_once GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_CLASS_PATH.'/data/dataCustomFields.php'; - -/** - * GlmMembersAdmin_management_fields - * - * PHP version 5 - * - * @category Model - * @package GLM Member DB - * @author Chuck Scott - * @license http://www.gaslightmedia.com Gaslightmedia - * @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott - * Exp $ - */ -class GlmMembersAdmin_management_fields extends GlmDataFieldsCustomFields -{ - - /** - * WordPress Database Object - * - * @var $wpdb - * @access public - */ - public $wpdb; - /** - * dbh Postgres database connection - * - * @var mixed - * @access public - */ - public $dbh; - /** - * settings used for the schema and tablenames - * - * @var mixed - * @access public - */ - public $settings = array(); - /** - * categories - * - * @var bool - * @access public - */ - public $categories = array(); - public $oldCatMap = array(); - /** - * fields - * - * @var bool - * @access public - */ - public $fields = array(); - public $image_owner; - - /** - * Constructor - * - * This contructor performs the work for this model. This model returns - * an array containing the following. - * - * 'status' - * - * True if successfull and false if there was a fatal failure. - * - * 'view' - * - * A suggested view name that the contoller should use instead of the - * default view for this model or false to indicate that the default view - * should be used. - * - * 'data' - * - * Data that the model is returning for use in merging with the view to - * produce output. - * - * @wpdb object WordPress database object - * - * @return array Array containing status, suggested view, and any data - */ - public function __construct ($wpdb, $config) - { - - // Save WordPress Database object - $this->wpdb = $wpdb; - - // Save plugin configuration object - $this->config = $config; - - // Run constructor for members data class - parent::__construct(false, false); - - } - - /** - * modelAction - * - * @param bool $actionData - * @access public - * @return void - */ - public function modelAction($actionData = false) - { - $glm_action = ''; - $option = false; - $settings_updated = false; - $settings_update_error = false; - $custom_fields = false; - $haveCustomFields = false; - $where = ' TRUE '; - - if (isset($_REQUEST['option2'])) { - $option = $_REQUEST['option2']; - } - - if (isset($_GET['glm_action'])) { - $glm_action = $_GET['glm_action']; - } - - // Check if a field ID is supplied - $id = 0; - if (isset($_REQUEST['id'])) { - $id = $_REQUEST['id']-0; - } - - $uid = 0; - - if (isset($actionData['uid'])) { - $uid = $actionData['uid']; - } - - switch ($option) { - - case 'addNew': - $this->insertEntry(); - break; - - case 'update': - if ($id > 0) { - $this->updateEntry($id); - } - break; - - case 'delete': - if ($id > 0) { - $this->deleteEntry($id, true); - - // Also delete any data entries - $this->wpdb->delete( - GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_DB_PREFIX . 'custom_field_data', - array( 'field_id' => $id ) - ); - } - break; - - default: - // Make sure option is set if default - $option = 'list'; - - // Determine if current user can edit configurations - if (!current_user_can('glm_members_management')) { - return array( - 'status' => false, - 'menuItemRedirect' => 'error', - 'modelRedirect' => 'index', - 'view' => 'admin/error/index.html', - 'data' => array( - 'reason' => 'User does not have rights to make configuration changes.' - ) - ); - } - - break; - - } - - $where .= " AND uid = '$uid' "; - - // Get list of Custom Fields - $custom_fields = $this->getList( $where ); - // echo "
REQUEST " . print_r($_REQUEST, true) . "
"; - // echo "
GET " . print_r($_GET, true) . "
"; - if ( isset($custom_fields) && $custom_fields && count( $custom_fields ) > 0 ) { - $haveCustomFields = true; - } - - // Compile template data - $template_data = array( - 'option2' => $option, - 'settingsUpdated' => $settings_updated, - 'settingsUpdateError' => $settings_update_error, - 'custom_fields' => $custom_fields, - 'field_types' => $this->config['custom_field_types'], - 'haveCustomFields' => $haveCustomFields, - 'uid' => $uid, - 'glm_action' => $glm_action - ); - // echo "
Template data:" . print_r($template_data, true) . "
"; - - // Return status, suggested view, and data to controller - return array( - 'status' => true, - 'menuItemRedirect' => false, - 'modelRedirect' => false, - 'view' => 'admin/management/fields.html', - 'data' => $template_data - ); - - - } - -} diff --git a/setup/rolesAndCapabilities.php b/setup/rolesAndCapabilities.php deleted file mode 100644 index 0929d55..0000000 --- a/setup/rolesAndCapabilities.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @release rolesAndPermissions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ - * @link http://dev.gaslightmedia.com/ - */ - -/** - * NOTE: This file is only included in the activate.php process. - * It is not regularly used during operation. - */ diff --git a/views/admin/OLD-entity/fields.html b/views/admin/OLD-entity/fields.html deleted file mode 100644 index 2c69862..0000000 --- a/views/admin/OLD-entity/fields.html +++ /dev/null @@ -1,38 +0,0 @@ -
- {foreach $customFields as $field} -
{$field.field_name}
-
- - - {$fail = ''} - {if is_array($customFieldsData)} - {if array_key_exists('fieldFail', $customFieldsData)} - {if array_key_exists($field.id,$customFieldsData['fieldFail'])} - {$fail = 'glm-form-bad-input'} - {/if} - {/if} - {/if} -
- {if $field.field_type.name == 'text'} - - - {elseif $field.field_type.name == 'textarea'} - {php} - wp_editor('{if isset($customFieldsData[$field.id])}{$customFieldsData[$field.id]|escape:quotes}{/if}', 'custom-field-{$field.id}', array( - 'media_buttons' => false, - // 'quicktags' => false, - // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. - 'textarea_name' => '{$prefix}[{$field.id}]', - 'editor_height' => 200, // Height in px, overrides editor_rows - // 'textarea_rows' => 8, - {if $field.required.value == 1}'editor_class' => 'glm-required' {/if} - )); - {/php} - {elseif $field.field_type.name == 'checkbox'} - - - {/if} -
-
- {/foreach} -
diff --git a/views/admin/OLD-import/fields.html b/views/admin/OLD-import/fields.html deleted file mode 100644 index 0b17672..0000000 --- a/views/admin/OLD-import/fields.html +++ /dev/null @@ -1,48 +0,0 @@ -{include file='admin/import/header.html'} - -

Social Data Import Step 1: Upload file

- -
- - - - - - - - - - - - {$count = 0} - {foreach $fileData as $fileHeader => $file} - - - - - - - - {$count = $count + 1} - {/foreach} -
File TypeNew FileSample FileCurrent FileUpdated
- {$fileHeader} - - - - Sample {$fileHeader} File - - {if $file.exists} - {$fileHeader} File - {/if} - - {if $file.exists} - {$file.mtime|date_format:"%D %I:%M %p"} - {/if} -
- - - -
- -{include file='admin/footer.html'} diff --git a/views/admin/OLD-import/fieldsProcess.html b/views/admin/OLD-import/fieldsProcess.html deleted file mode 100644 index dab58af..0000000 --- a/views/admin/OLD-import/fieldsProcess.html +++ /dev/null @@ -1,16 +0,0 @@ -{include file='admin/import/header.html'} - -

Data Import Step 3: Process Fields File

- - - - - - - - - - -
Total Records{$totalFields}
Processed Records{$numberProcessed}
- -{include file='admin/footer.html'} diff --git a/views/admin/OLD-import/fieldsValidate.html b/views/admin/OLD-import/fieldsValidate.html deleted file mode 100644 index 9ff514d..0000000 --- a/views/admin/OLD-import/fieldsValidate.html +++ /dev/null @@ -1,40 +0,0 @@ -{include file='admin/import/header.html'} - -

Secial Import Step 2: Validate Fields file

- - - {foreach $fileData as $fileHeader => $file} - - - - - {/foreach} - - {if $readyToProcess} - - - - {else} - - - - {/if} - -
- {if $file.exists} - {$fileHeader} File - {/if} - - {if $file.isValid} - Is Valid - {else} - Not Valid - {/if} -
- Process Files -
-

One or more of your files are not the correct csv format. Please go back and try again.

- Go Back -
- -{include file='admin/footer.html'} diff --git a/views/admin/OLD-management/fields.html b/views/admin/OLD-management/fields.html deleted file mode 100644 index 8834912..0000000 --- a/views/admin/OLD-management/fields.html +++ /dev/null @@ -1,277 +0,0 @@ - -
Add a Custom Field
- -{* New field form *} -
- - - - - - - - - - - - - - -
Field Name: - -
Field Type: - -
Required? - -
-

* Required

-
Cancel
-
Add new Custom Field
-
- -{* Delete field button confirmation dialog box *} -
-
-

Are you sure you want to delete this field?

-

Yes, delete this field

-

Cancel

-
-
- -{* Edit field dialog box *} -
-
- - - - - - - - - - - - - - - {if $uid == 'glm-member-db'} - - - - - {/if} - - - - - -
Field Name: - -
Field Type: - -
Admin Searchable - - - (text or checkbox only) -
Required? - - -
-

* Required

- Cancel - -
-
- -{* Update and error messages *} - - - - -
- {if $settingsUpdated}

Settings Updated

{/if} - {if $settingsUpdateError}Settings Update Error{/if} -

Custom Fields

-
- -{* Fields Table *} - - - - - - - - - - {if $uid == 'glm-member-db'}{/if} - - - - - {if $haveCustomFields} - {assign var="i" value="0"} - {foreach $custom_fields as $t} - {if $i++ is odd by 1} - - {else} - - {/if} - - - - - - - - - {/foreach} - {else} - - {/if} - -
IDFieldTypeUID/EntityRequiredAdmin Searchable 
{$t.id} - - - {$t.field_type.name} - - {$t.uid} - - {$t.required.name} - - {$t.admin_search.name} - -
Delete
-
(no custom fields listed)
- - - diff --git a/views/front/fields/OLDdetail.html b/views/front/fields/OLDdetail.html deleted file mode 100644 index 25b417d..0000000 --- a/views/front/fields/OLDdetail.html +++ /dev/null @@ -1,19 +0,0 @@ -
Specifications
-{foreach $field_values as $key=>$value} - {if $value.slash === true } -
-
{$value.nice}
-
{$value.data}
-
- {elseif $value.data !== 'Yes' && $value.data !== 'No'} -
-
{$value.nice}
-
{$value.data}
-
- {/if} -{/foreach} -{$stock = $field_values.stock.data} -{$msrp = $field_values.msrp.data} -{$sale = $field_values['sale-price'].data} -{$prod = $member_name} - Contact Sales \ No newline at end of file diff --git a/views/front/fields/OLDlist.html b/views/front/fields/OLDlist.html deleted file mode 100644 index 1851b53..0000000 --- a/views/front/fields/OLDlist.html +++ /dev/null @@ -1,20 +0,0 @@ -{foreach $field_values as $key=>$value} - {if $value.slash === true} -
- {else} -
- {/if} - {if $value.type == 'Home'} -
{$value.nice}
-
{$value.data}
- {else} -
{$value.nice}
-
{$value.data}
- {/if} - {if $key === 'red-hot-deal' && $value.data === 'Yes'} -
- -
- {/if} -
-{/foreach} -- 2.17.1