"xxx" , // 'plugins_includes_dir' => "xxx" , // 'plugins_app_defs_dir' => "xxx" , // 'dataset_manager_includes_dir' => "xxx" , // (1) // 'apps_dot_app_dir' => "xxx" , // (2) // 'apps_plugin_stuff_dir' => "xxx" // (3) // 'custom_pages_dir' => "xxx" // (4) // ) // // (1) This is where most of the "Dataset Manager" includes files // are stored. // // (2) If $app_handle === NULL, the returned 'apps_dot_app_dir' // is NULL too. // // (3) If $app_handle === NULL, the returned 'apps_plugin_stuff_dir' // is NULL too. // // (4) If $app_handle === NULL, the returned 'custom_pages_dir' // is NULL too. // // --- // // $path_in_plugin should be a file, directory or link path in the // plugin (or "app") from which this function is called. Typically, // one uses __FILE__ for this purpose. Eg:- // // \greatKiwi_byFernTec_adSwapper_local_v0x1x210_appsAPI\get_single_app_defs_root_dir( __FILE__ ) ; // // --- // // $app_handle should be either:- // // o A single "app slug" - eg; "research-assistant" - as a // STRING. For which the returned dirspec might be (eg):- // // /home/joe/.../plugins/some-plugin/app-defs/research-assistant.app // // Or:- // // o An array of (nested) app slugs. Eg:- // // array( // 'some-app' , // 'child-app' , // 'grandchild-app' // [...] // ) // // For which the returned dirspec might be (eg):- // // /home/joe/.../plugins/some-plugin/app-defs/some-app.app/child-app.app/grandchild-app.app // // Exits with an error message if the directory can't be returned (eg; // doesn't exist). // // NOTE! // ----- // These "apps" and "datasets" (etc) are typically defined in a directory // tree structure like (eg):- // // /plugins/this-plugin/ // +-- app-defs/ // | +-- some-app.app/ // | | +-- child-app.app/ // | | +-- grandchild-app.app // | | +-- etc... // | +-- another-app.app/ // | +-- ... // +-- includes/ // +-- js/ // +-- admin/ // +-- remote/ // +-- ...etc... // +-- this-plugin.php // +-- ...etc... // // ------------------------------------------------------------------------- $path_in_plugin = __FILE__ ; // --------------------------------------------------------------------- if ( array_key_exists( 'application' , $_GET ) && trim( $_GET['application'] ) !== '' ) { $app_handle = $_GET['application'] ; } else { return << ] // // RETURNS:- // On SUCCESS // NULL means there are NO mysql array storage key field overrides // --OR-- // $key_field_details = array( // 'slug' => "xxx" , // 'format' => "yyy" , // 'value' => "zzz" , // 'fail_link_creation_silently' => TRUE/FALSE , // 'url_encode_function_name' => "" | "aaa" , // 'url_decode_function_name' => "" | "bbb" // ) // // Where:- // // o $key_field_details['format'] is one of:- // -- OLD VERSION // # "sequential-id" (default) // # "ctype-digit" // # "great-kiwi-password" // -- NEW VERSION // # "mysql-bigint-id" (default) // # "sequential-id" // # "great-kiwi-password" // # "url" // # "custom-function" // // o $key_field_details['value'] is the (validated and ok) // value from the specified dataset record. // // o $key_field_details['fail_link_creation_silently'] means // that the key field contained NO value - but instead of // issuing an error, the caller should just NOT create // the "edit"/"delete" record link. // // o $key_field_details['url_encode_function_name']:- // -- Can be the empty string (if NO key field url encode // function is to be used). // -- If other than the empty string, then the specified // function exists. // // o $key_field_details['url_decode_function_name']:- // -- Can be the empty string (if NO key field url decode // function is to be used). // -- If other than the empty string, then the specified // function exists. // // On FAILURE // $error_message STRING // ------------------------------------------------------------------------- $key_field_details = \greatKiwi_byFernTec_adSwapper_local_v0x1x210_standardDatasetManager\get_check_mysql_array_storage_key_field_overrides( $core_plugapp_dirs['plugins_includes_dir'] , $selected_datasets_dmdd , $dataset_title , $key_field_get_var_name ) ; // --------------------------------------------------------------------- if ( is_string( $key_field_details ) ) { return $key_field_details ; } // --------------------------------------------------------------------- if ( $key_field_details === NULL || $key_field_details['value'] === '' ) { return << 0 ; // ----------------------------------------------------------------- } elseif ( $key_field_format === 'sequential-id' ) { // ----------------------------------------------------------------- require_once( $core_plugapp_dirs['plugins_includes_dir'] . '/sequential-ids-support.php' ) ; // ------------------------------------------------------------------------- // \greatKiwi_byFernTec_adSwapper_local_v0x1x210_sequentialIdsSupport\ // question_sequential_id( // $candidate_sid // ) // - - - - - - - - - - - - // Determines whether or not $candidate_sid looks like a sequential ID // as generated by (eg):- // get_new_sequential_id() // get_new_sequential_id_thats_unique_in_dataset() // // or not. And returns TRUE or FALSE accordingly. // // In other words, $candidate_sid must be something like (eg):- // "dczv-mwhk" // "9npd-xd2h" // "pxx4-4942-9vwm" // "2n43-3dny-dykm" // etc... // ------------------------------------------------------------------------- $key_field_ok = \greatKiwi_byFernTec_adSwapper_local_v0x1x210_sequentialIdsSupport\question_sequential_id( $key_field_value ) ; // ----------------------------------------------------------------- } elseif ( $key_field_format === 'great-kiwi-password' ) { // ----------------------------------------------------------------- $key_field_format_args = array() ; // ----------------------------------------------------------------- if ( array_key_exists( 'key_field_format_args' , $selected_datasets_dmdd['mysql_overrides'] ) ) { $key_field_format_args = $selected_datasets_dmdd['mysql_overrides']['key_field_format_args'] ; } // ----------------------------------------------------------------- if ( ! is_array( $key_field_format_args ) ) { return << 4 , // 'chars_per_group' => 4 , // 'group_separator' => '-' , // 'lowercase_only' => TRUE , // 'question_punctuation' => FALSE // ) // // --- // // NOTE! // ----- // With some combinations, it depends very much on the FONT used (as to // how similar two different characters look). Thus the above rules are // a worst-case set. Stuff is in there if in any common (web) font, // the chance of confusion exists. // // RETURNS // On SUCCESS // TRUE or FALSE // // On FAILURE // $error_message STRING // ----------------------------------------------------------------------- $key_field_ok = \greatKiwi_byFernTec_adSwapper_local_v0x1x210_passwords\question_grouped_random_password( $key_field_value , $key_field_format_args ) ; // ----------------------------------------------------------------- } elseif ( $key_field_format === 'url' ) { // ----------------------------------------------------------------- require_once( $core_plugapp_dirs['plugins_includes_dir'] . '/validata/url-validators.php' ) ; // ------------------------------------------------------------------------- // \greatKiwi_byFernTec_adSwapper_local_v0x1x210_validationFunctions\ // absolute_url_string__minLen_maxLen_questionEmptyOK( // $value , // $minlen = 'default' , // $maxlen = 'default' , // $question_empty_ok = TRUE // ) // - - - - - - - - - - - - - - - - - - - - - // NOTES! // ------ // 1. $question_empty_ok gives you the flexibility to specify (eg):- // o $minlen = 32 // o $maxlen = 64 // o $question_empty_ok = TRUE // // So as to permit either:- // o The empty string, or; // o A 32 to 64 character URL string. // // 2. Default $minlen = 10 = strlen( "http://x.y" ) // (= shortest possible absolute URL). // // 3. Default $maxlen = 2000 // See (eg): // http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers // // RETURNS // On SUCCESS! // TRUE // // On FAILURE // $error_message STRING // ------------------------------------------------------------------------- $minlen = 'default' ; $maxlen = 255 ; // Max. MySQL field length $question_empty_ok = FALSE ; // ------------------------------------------------------------- $key_field_ok = \greatKiwi_byFernTec_adSwapper_local_v0x1x210_validationFunctions\absolute_url_string__minLen_maxLen_questionEmptyOK( $key_field_value , $minlen , $maxlen , $question_empty_ok ) ; // ----------------------------------------------------------------- } else { return <<prefix variable. (If // you're developing for a version of WordPress older than 2.0, you'll // need to use the $table_prefix global variable, which is deprecated in // version 2.1)." // // ------------------------------------------------------------------------- $mysql_table_name = \greatKiwi_byFernTec_adSwapper_local_v0x1x210_basepressMysql\prepend_wordpress_table_name_prefix( $dataset_slug ) ; // ===================================================================== // Get the KEY FIELD SLUG... // ===================================================================== // if ( array_key_exists( 'mysql_overrides' , $selected_datasets_dmdd ) // && // is_array( $selected_datasets_dmdd['mysql_overrides'] ) // && // array_key_exists( 'array_storage_key_field_slug' , $selected_datasets_dmdd['mysql_overrides'] ) // && // is_string( $selected_datasets_dmdd['mysql_overrides']['array_storage_key_field_slug'] ) // && // trim( $selected_datasets_dmdd['mysql_overrides']['array_storage_key_field_slug'] ) !== '' // ) { // // $key_field_slug = // $selected_datasets_dmdd['mysql_overrides']['array_storage_key_field_slug'] // ; // // } else { // // return << array( // 'field_name_1' => , // 'field_name_2' => , // ... ... // 'field_name_N' => // ) // ... // ) // // On FAILURE // - - - - - // An error message STRING. // ------------------------------------------------------------------------- $sql = << 1 ) { return <<\ // get_existing_caller_specific_record( // $selected_datasets_dmdd , // $dataset_records , // $record_indices_by_key , // $dataset_title // ) // - - - - - - - - - - - - - - - - - // Returns the EXISTING caller specific record in the dataset. Unless // the caller has NO record in the dataset yet. In which case, it returns // FALSE. // // RETURNS // o On SUCCESS // ARRAY( // $caller_specific_record_key STRING // $caller_specific_record_index INT // $caller_specific_record_data ARRAY // ) // // o On FAILURE // ## FALSE if there's NO caller-specific record in the // dataset yet // --OR-- // ## $error_message STRING on error // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // \greatKiwi_byFernTec_adSwapper_local_v0x1x210_datasetDef_\ // get_or_create_caller_specific_record( // $selected_datasets_dmdd , // $dataset_records , // $record_indices_by_key , // $dataset_title , // $question_create // ) // - - - - - - - - - - - - - - - - - // Returns the caller specific record from the dataset. Unless there's // NO caller specific record in the database yet, in which case it returns // a NEW record for the caller. // // Where that new record is created by calling the dataset's:- // get_default_record_data() // routine. // // NOTE! // ===== // The new record ISN'T added to the (array stored) dataset. The routine // that calls this routine should do that (if it wantsw/needs to). // // RETURNS // o On SUCCESS // ARRAY( // $caller_specific_record_key STRING // $caller_specific_record_index INT / NULL // $caller_specific_record_data ARRAY // ) // // Where if:- // $caller_specific_record_index = NULL // // it means that this record should be added as a NEW record // to the dataset (because, for example, this is a NEW caller, // who doesn't have a record in the dataset yet). // // In this case, we should also have:- // $caller_specific_record_key = '' (empty string) // // (and a new unique record key should also be generated). // // o On FAILURE // $error_message STRING // ------------------------------------------------------------------------- if ( $question_create === TRUE ) { $get_caller_specific_record_function_name = '\\' . $selected_datasets_dmdd['caller_specific_record_functions_namespace_name'] . '\\get_or_create_caller_specific_record' ; } else { $get_caller_specific_record_function_name = '\\' . $selected_datasets_dmdd['caller_specific_record_functions_namespace_name'] . '\\get_existing_caller_specific_record' ; } // ------------------------------------------------------------------------- if ( ! function_exists( $get_caller_specific_record_function_name ) ) { return <<