Plugin Directory

Changeset 1437051


Ignore:
Timestamp:
06/15/2016 10:50:32 AM (10 years ago)
Author:
WebTechGlobal
Message:

Removed logging and possibly fixed reported problem with screens being blank/white.

Location:
csv-2-post
Files:
132 added
11 edited

Legend:

Unmodified
Added
Removed
  • csv-2-post/trunk/arrays/tableschema_array.php

    r1252652 r1437051  
    5151$c2p_tables_array =  array();
    5252##################################################################################
    53 #                                 webtechglobal_log                                         #
    54 ##################################################################################       
    55 $c2p_tables_array['tables']['webtechglobal_log']['name'] = $wpdb->prefix . 'webtechglobal_log';
    56 $c2p_tables_array['tables']['webtechglobal_log']['required'] = false;// required for all installations or not (boolean)
    57 $c2p_tables_array['tables']['webtechglobal_log']['pluginversion'] = '7.0.0';
    58 $c2p_tables_array['tables']['webtechglobal_log']['usercreated'] = false;// if the table is created as a result of user actions rather than core installation put true
    59 $c2p_tables_array['tables']['webtechglobal_log']['version'] = '0.0.1';// used to force updates based on version alone rather than individual differences
    60 $c2p_tables_array['tables']['webtechglobal_log']['primarykey'] = 'row_id';
    61 $c2p_tables_array['tables']['webtechglobal_log']['uniquekey'] = 'row_id';
    62 // webtechglobal_log - row_id
    63 $c2p_tables_array['tables']['webtechglobal_log']['columns']['row_id']['type'] = 'bigint(20)';
    64 $c2p_tables_array['tables']['webtechglobal_log']['columns']['row_id']['null'] = 'NOT NULL';
    65 $c2p_tables_array['tables']['webtechglobal_log']['columns']['row_id']['key'] = '';
    66 $c2p_tables_array['tables']['webtechglobal_log']['columns']['row_id']['default'] = '';
    67 $c2p_tables_array['tables']['webtechglobal_log']['columns']['row_id']['extra'] = 'AUTO_INCREMENT';
    68 // webtechglobal_log - outcome
    69 $c2p_tables_array['tables']['webtechglobal_log']['columns']['outcome']['type'] = 'tinyint(1)';
    70 $c2p_tables_array['tables']['webtechglobal_log']['columns']['outcome']['null'] = 'NOT NULL';
    71 $c2p_tables_array['tables']['webtechglobal_log']['columns']['outcome']['key'] = '';
    72 $c2p_tables_array['tables']['webtechglobal_log']['columns']['outcome']['default'] = '1';
    73 $c2p_tables_array['tables']['webtechglobal_log']['columns']['outcome']['extra'] = '';
    74 // webtechglobal_log - timestamp
    75 $c2p_tables_array['tables']['webtechglobal_log']['columns']['timestamp']['type'] = 'timestamp';
    76 $c2p_tables_array['tables']['webtechglobal_log']['columns']['timestamp']['null'] = 'NOT NULL';
    77 $c2p_tables_array['tables']['webtechglobal_log']['columns']['timestamp']['key'] = '';
    78 $c2p_tables_array['tables']['webtechglobal_log']['columns']['timestamp']['default'] = 'CURRENT_TIMESTAMP';
    79 $c2p_tables_array['tables']['webtechglobal_log']['columns']['timestamp']['extra'] = '';
    80 // webtechglobal_log - line
    81 $c2p_tables_array['tables']['webtechglobal_log']['columns']['line']['type'] = 'int(11)';
    82 $c2p_tables_array['tables']['webtechglobal_log']['columns']['line']['null'] = '';
    83 $c2p_tables_array['tables']['webtechglobal_log']['columns']['line']['key'] = '';
    84 $c2p_tables_array['tables']['webtechglobal_log']['columns']['line']['default'] = 'NULL';
    85 $c2p_tables_array['tables']['webtechglobal_log']['columns']['line']['extra'] = '';
    86 // webtechglobal_log - file
    87 $c2p_tables_array['tables']['webtechglobal_log']['columns']['file']['type'] = 'varchar(250)';
    88 $c2p_tables_array['tables']['webtechglobal_log']['columns']['file']['null'] = '';
    89 $c2p_tables_array['tables']['webtechglobal_log']['columns']['file']['key'] = '';
    90 $c2p_tables_array['tables']['webtechglobal_log']['columns']['file']['default'] = 'NULL';
    91 $c2p_tables_array['tables']['webtechglobal_log']['columns']['file']['extra'] = '';
    92 // webtechglobal_log - function
    93 $c2p_tables_array['tables']['webtechglobal_log']['columns']['function']['type'] = 'varchar(250)';
    94 $c2p_tables_array['tables']['webtechglobal_log']['columns']['function']['null'] = '';
    95 $c2p_tables_array['tables']['webtechglobal_log']['columns']['function']['key'] = '';
    96 $c2p_tables_array['tables']['webtechglobal_log']['columns']['function']['default'] = 'NULL';
    97 $c2p_tables_array['tables']['webtechglobal_log']['columns']['function']['extra'] = '';
    98 // webtechglobal_log - sqlresult
    99 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlresult']['type'] = 'blob';
    100 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlresult']['null'] = '';
    101 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlresult']['key'] = '';
    102 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlresult']['default'] = 'NULL';
    103 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlresult']['extra'] = '';
    104 // webtechglobal_log - sqlquery
    105 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlquery']['type'] = 'varchar(45)';
    106 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlquery']['null'] = '';
    107 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlquery']['key'] = '';
    108 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlquery']['default'] = 'NULL';
    109 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlquery']['extra'] = '';
    110 // webtechglobal_log - sqlerror
    111 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlerror']['type'] = 'mediumtext';
    112 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlerror']['null'] = '';
    113 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlerror']['key'] = '';
    114 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlerror']['default'] = 'NULL';
    115 $c2p_tables_array['tables']['webtechglobal_log']['columns']['sqlerror']['extra'] = '';
    116 // webtechglobal_log - wordpresserror
    117 $c2p_tables_array['tables']['webtechglobal_log']['columns']['wordpresserror']['type'] = 'mediumtext';
    118 $c2p_tables_array['tables']['webtechglobal_log']['columns']['wordpresserror']['null'] = '';
    119 $c2p_tables_array['tables']['webtechglobal_log']['columns']['wordpresserror']['key'] = '';
    120 $c2p_tables_array['tables']['webtechglobal_log']['columns']['wordpresserror']['default'] = 'NULL';
    121 $c2p_tables_array['tables']['webtechglobal_log']['columns']['wordpresserror']['extra'] = '';
    122 // webtechglobal_log - screenshoturl
    123 $c2p_tables_array['tables']['webtechglobal_log']['columns']['screenshoturl']['type'] = 'varchar(500)';
    124 $c2p_tables_array['tables']['webtechglobal_log']['columns']['screenshoturl']['null'] = '';
    125 $c2p_tables_array['tables']['webtechglobal_log']['columns']['screenshoturl']['key'] = '';
    126 $c2p_tables_array['tables']['webtechglobal_log']['columns']['screenshoturl']['default'] = 'NULL';
    127 $c2p_tables_array['tables']['webtechglobal_log']['columns']['screenshoturl']['extra'] = '';
    128 // webtechglobal_log - userscomment
    129 $c2p_tables_array['tables']['webtechglobal_log']['columns']['userscomment']['type'] = 'mediumtext';
    130 $c2p_tables_array['tables']['webtechglobal_log']['columns']['userscomment']['null'] = '';
    131 $c2p_tables_array['tables']['webtechglobal_log']['columns']['userscomment']['key'] = '';
    132 $c2p_tables_array['tables']['webtechglobal_log']['columns']['userscomment']['default'] = 'NULL';
    133 $c2p_tables_array['tables']['webtechglobal_log']['columns']['userscomment']['extra'] = '';
    134 // webtechglobal_log - page
    135 $c2p_tables_array['tables']['webtechglobal_log']['columns']['page']['type'] = 'varchar(45)';
    136 $c2p_tables_array['tables']['webtechglobal_log']['columns']['page']['null'] = '';
    137 $c2p_tables_array['tables']['webtechglobal_log']['columns']['page']['key'] = '';
    138 $c2p_tables_array['tables']['webtechglobal_log']['columns']['page']['default'] = 'NULL';
    139 $c2p_tables_array['tables']['webtechglobal_log']['columns']['page']['extra'] = '';
    140 // webtechglobal_log - version
    141 $c2p_tables_array['tables']['webtechglobal_log']['columns']['version']['type'] = 'varchar(45)';
    142 $c2p_tables_array['tables']['webtechglobal_log']['columns']['version']['null'] = '';
    143 $c2p_tables_array['tables']['webtechglobal_log']['columns']['version']['key'] = '';
    144 $c2p_tables_array['tables']['webtechglobal_log']['columns']['version']['default'] = 'NULL';
    145 $c2p_tables_array['tables']['webtechglobal_log']['columns']['version']['extra'] = '';
    146 // webtechglobal_log - panelid
    147 $c2p_tables_array['tables']['webtechglobal_log']['columns']['panelid']['type'] = 'varchar(45)';
    148 $c2p_tables_array['tables']['webtechglobal_log']['columns']['panelid']['null'] = '';
    149 $c2p_tables_array['tables']['webtechglobal_log']['columns']['panelid']['key'] = '';
    150 $c2p_tables_array['tables']['webtechglobal_log']['columns']['panelid']['default'] = 'NULL';
    151 $c2p_tables_array['tables']['webtechglobal_log']['columns']['panelid']['extra'] = '';
    152 // webtechglobal_log - panelname
    153 $c2p_tables_array['tables']['webtechglobal_log']['columns']['panelname']['type'] = 'varchar(45)';
    154 $c2p_tables_array['tables']['webtechglobal_log']['columns']['panelname']['null'] = '';
    155 $c2p_tables_array['tables']['webtechglobal_log']['columns']['panelname']['key'] = '';
    156 $c2p_tables_array['tables']['webtechglobal_log']['columns']['panelname']['default'] = 'NULL';
    157 $c2p_tables_array['tables']['webtechglobal_log']['columns']['panelname']['extra'] = '';
    158 // webtechglobal_log - tabscreenid
    159 $c2p_tables_array['tables']['webtechglobal_log']['columns']['tabscreenid']['type'] = 'varchar(45)';
    160 $c2p_tables_array['tables']['webtechglobal_log']['columns']['tabscreenid']['null'] = '';
    161 $c2p_tables_array['tables']['webtechglobal_log']['columns']['tabscreenid']['key'] = '';
    162 $c2p_tables_array['tables']['webtechglobal_log']['columns']['tabscreenid']['default'] = 'NULL';
    163 $c2p_tables_array['tables']['webtechglobal_log']['columns']['tabscreenid']['extra'] = '';
    164 // webtechglobal_log - tabscreenname
    165 $c2p_tables_array['tables']['webtechglobal_log']['columns']['tabscreenname']['type'] = 'varchar(45)';
    166 $c2p_tables_array['tables']['webtechglobal_log']['columns']['tabscreenname']['null'] = '';
    167 $c2p_tables_array['tables']['webtechglobal_log']['columns']['tabscreenname']['key'] = '';
    168 $c2p_tables_array['tables']['webtechglobal_log']['columns']['tabscreenname']['default'] = 'NULL';
    169 $c2p_tables_array['tables']['webtechglobal_log']['columns']['tabscreenname']['extra'] = '';
    170 // webtechglobal_log - dump
    171 $c2p_tables_array['tables']['webtechglobal_log']['columns']['dump']['type'] = 'longblob';
    172 $c2p_tables_array['tables']['webtechglobal_log']['columns']['dump']['null'] = '';
    173 $c2p_tables_array['tables']['webtechglobal_log']['columns']['dump']['key'] = '';
    174 $c2p_tables_array['tables']['webtechglobal_log']['columns']['dump']['default'] = 'NULL';
    175 $c2p_tables_array['tables']['webtechglobal_log']['columns']['dump']['extra'] = '';
    176 // webtechglobal_log - ipaddress
    177 $c2p_tables_array['tables']['webtechglobal_log']['columns']['ipaddress']['type'] = 'varchar(45)';
    178 $c2p_tables_array['tables']['webtechglobal_log']['columns']['ipaddress']['null'] = '';
    179 $c2p_tables_array['tables']['webtechglobal_log']['columns']['ipaddress']['key'] = '';
    180 $c2p_tables_array['tables']['webtechglobal_log']['columns']['ipaddress']['default'] = 'NULL';
    181 $c2p_tables_array['tables']['webtechglobal_log']['columns']['ipaddress']['extra'] = '';
    182 // webtechglobal_log - userid
    183 $c2p_tables_array['tables']['webtechglobal_log']['columns']['userid']['type'] = 'int(11)';
    184 $c2p_tables_array['tables']['webtechglobal_log']['columns']['userid']['null'] = '';
    185 $c2p_tables_array['tables']['webtechglobal_log']['columns']['userid']['key'] = '';
    186 $c2p_tables_array['tables']['webtechglobal_log']['columns']['userid']['default'] = 'NULL';
    187 $c2p_tables_array['tables']['webtechglobal_log']['columns']['userid']['extra'] = '';
    188 // webtechglobal_log - comment
    189 $c2p_tables_array['tables']['webtechglobal_log']['columns']['comment']['type'] = 'mediumtext';
    190 $c2p_tables_array['tables']['webtechglobal_log']['columns']['comment']['null'] = '';
    191 $c2p_tables_array['tables']['webtechglobal_log']['columns']['comment']['key'] = '';
    192 $c2p_tables_array['tables']['webtechglobal_log']['columns']['comment']['default'] = 'NULL';
    193 $c2p_tables_array['tables']['webtechglobal_log']['columns']['comment']['extra'] = '';
    194 // webtechglobal_log - type
    195 $c2p_tables_array['tables']['webtechglobal_log']['columns']['type']['type'] = 'varchar(45)';
    196 $c2p_tables_array['tables']['webtechglobal_log']['columns']['type']['null'] = '';
    197 $c2p_tables_array['tables']['webtechglobal_log']['columns']['type']['key'] = '';
    198 $c2p_tables_array['tables']['webtechglobal_log']['columns']['type']['default'] = 'NULL';
    199 $c2p_tables_array['tables']['webtechglobal_log']['columns']['type']['extra'] = '';
    200 // webtechglobal_log - category
    201 $c2p_tables_array['tables']['webtechglobal_log']['columns']['category']['type'] = 'varchar(45)';
    202 $c2p_tables_array['tables']['webtechglobal_log']['columns']['category']['null'] = '';
    203 $c2p_tables_array['tables']['webtechglobal_log']['columns']['category']['key'] = '';
    204 $c2p_tables_array['tables']['webtechglobal_log']['columns']['category']['default'] = 'NULL';
    205 $c2p_tables_array['tables']['webtechglobal_log']['columns']['category']['extra'] = '';
    206 // webtechglobal_log - action
    207 $c2p_tables_array['tables']['webtechglobal_log']['columns']['action']['type'] = 'varchar(45)';
    208 $c2p_tables_array['tables']['webtechglobal_log']['columns']['action']['null'] = '';
    209 $c2p_tables_array['tables']['webtechglobal_log']['columns']['action']['key'] = '';
    210 $c2p_tables_array['tables']['webtechglobal_log']['columns']['action']['default'] = 'NULL';
    211 $c2p_tables_array['tables']['webtechglobal_log']['columns']['action']['extra'] = '';
    212 // webtechglobal_log - priority
    213 $c2p_tables_array['tables']['webtechglobal_log']['columns']['priority']['type'] = 'varchar(45)';
    214 $c2p_tables_array['tables']['webtechglobal_log']['columns']['priority']['null'] = '';
    215 $c2p_tables_array['tables']['webtechglobal_log']['columns']['priority']['key'] = '';
    216 $c2p_tables_array['tables']['webtechglobal_log']['columns']['priority']['default'] = 'NULL';
    217 $c2p_tables_array['tables']['webtechglobal_log']['columns']['priority']['extra'] = '';
    218 ##################################################################################
    21953#                               c2pprojects                                      #
    22054##################################################################################       
  • csv-2-post/trunk/classes/class-configuration.php

    r1355720 r1437051  
    1212defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
    1313                                               
    14 class CSV2POST_Configuration extends CSV2POST_Log {
     14class CSV2POST_Configuration {
    1515 
    1616    // decrease or increase based on page name, only needs changed once
     
    5858           
    5959            array( 'admin_enqueue_scripts',          'plugin_admin_enqueue_scripts',                           'pluginscreens' ),
    60             array( 'init',                           'plugin_admin_register_styles',                           'pluginscreens' ),
    61             array( 'admin_print_styles',             'plugin_admin_print_styles',                              'pluginscreens' ),
     60            array( 'admin_enqueue_scripts',          'plugin_admin_register_styles',                           'pluginscreens' ),
     61            array( 'admin_print_styles',             'plugin_admin_enqueue_styles',                              'pluginscreens' ),
    6262            array( 'admin_notices',                  'admin_notices',                                          'admin_notices' ),
    6363            array( 'upgrader_process_complete',      'complete_plugin_update',                                 'adminpages' ),
  • csv-2-post/trunk/classes/class-csv2post.php

    r1372216 r1437051  
    120120
    121121    /**
    122     * register admin only .css must be done before printing styles
     122    * Register custom css on admin only.
     123    *
     124    * Must be done before enqueue styles and printing them.
    123125    *
    124126    * @author Ryan R. Bayne
     
    140142    * @version 1.1
    141143    */
    142     public function plugin_admin_print_styles() {
     144    public function plugin_admin_enqueue_styles() {
    143145        wp_enqueue_style( 'csv2post_css_notification' ); 
    144         wp_enqueue_style( 'csv2post_css_admin' );               
     146        wp_enqueue_style( 'csv2post_css_admin' );
     147        wp_enqueue_style( 'wp-pointer' );               
    145148    }   
    146149   
     
    154157    */
    155158    public function plugin_admin_enqueue_scripts() {
    156         wp_enqueue_script( 'wp-pointer' );
    157         wp_enqueue_style( 'wp-pointer' );         
     159        wp_enqueue_script( 'wp-pointer' );         
    158160    }   
    159161
     
    469471            case 'administrator':
    470472
    471                 require_once( ABSPATH . '/wp-load.php');
    472                 if(!function_exists('get_currentuserinfo')){
     473                require_once( ABSPATH . '/wp-load.php' );
     474                if( !function_exists( 'wp_get_current_user' ) ){
    473475                    require_once( ABSPATH . WPINC . '/formatting.php' );
    474476                    require_once( ABSPATH . WPINC . '/capabilities.php' );
     
    10421044        // do not continue if WordPress is DOING_AJAX
    10431045        if( self::request_made() ){return;}
    1044                      
    1045         self::log_schedule( __( 'The schedule is being checked. There should be further log entries explaining the outcome.', 'csv2post' ), __( 'schedule being checked', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    1046        
     1046
    10471047        // now do checks that we will store the return reason for to allow us to quickly determine why it goes no further                     
    10481048        //  get and ensure we have the schedule array
     
    10501050        //  do not use csv2post_event_refused as we do not want to set the array
    10511051        if(!isset( $csv2post_schedule_array ) || !is_array( $csv2post_schedule_array ) ){       
    1052             self::log_schedule( __( 'Scheduled events cannot be peformed due to the schedule array of stored settings not existing.', 'csv2post' ), __( 'schedule settings missing', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    10531052            return false;
    10541053        }// hack
     
    10621061           
    10631062            if( $soonest > time() ){
    1064                 self::log_schedule( __( 'No changed made as it has not been 60 seconds since the last event.', 'csv2post' ), __( 'enforcing schedule event delay', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    10651063                self::event_return( __( 'has not been 60 seconds since last event', 'csv2post' ) );
    10661064                return;
     
    10731071            $csv2post_schedule_array['history']['lastreturnreason'] = __( 'The last even time event was set for the first time, no further processing was done.', 'csv2post' );
    10741072            self::update_option_schedule_array( $csv2post_schedule_array );
    1075             self::log_schedule( __( 'The plugin initialized the timer for enforcing a delay between events. This action is treated as an event itself and no further
    1076             changes are made during this schedule check.', 'csv2post' ), __( 'initialized schedule delay timer', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    1077 
    10781073            self::event_return( __( 'initialised the last event time value', 'csv2post' ) );
    10791074            return;       
     
    10861081            $csv2post_schedule_array['history']['lastreturnreason'] = __( 'The last event type value was set for the first time', 'csv2post' );
    10871082            self::update_option_schedule_array( $csv2post_schedule_array );
    1088 
    1089             self::log_schedule( __( 'The plugin initialized last event type value, this tells the plugin what event was last performed and it is used to
    1090             determine what event comes next.', 'csv2post' ), __( 'initialized schedule last event value', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    1091            
    10921083            self::event_return( __( 'initialised last event type value', 'csv2post' ) );
    10931084            return;
     
    11001091            $csv2post_schedule_array['history']['lastreturnreason'] = __( 'The last daily reset time was set for the first time', 'csv2post' );
    11011092            self::update_option_schedule_array( $csv2post_schedule_array );
    1102            
    1103             self::log_schedule( __( 'Day timer was set in schedule system. This is the 24 hour timer used to track daily events. It was set, no further action was taking
    1104             and should only happen once.', 'csv2post' ), __( '24 hour timer set', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    1105            
    11061093            self::event_return( __( 'initialised last daily reset time', 'csv2post' ) );       
    11071094            return;
     
    11141101            $csv2post_schedule_array['history']['lastreturnreason'] = __( 'The hourly reset time was set for the first time', 'csv2post' );
    11151102            self::update_option_schedule_array( $csv2post_schedule_array );
    1116            
    1117             self::log_schedule( __( 'Hourly timer was set in schedule system. The time has been set for hourly countdown. No further action was
    1118             taking. This should only happen once.', 'csv2post' ), __( 'one hour timer set', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);       
    1119            
    11201103            self::event_return( __( 'initialised hourly reset time', 'csv2post' ) );
    11211104            return;
     
    11281111            $csv2post_schedule_array['history']['lastreturnreason'] = __( 'The hourly events counter was set for the first time', 'csv2post' );
    11291112            self::update_option_schedule_array( $csv2post_schedule_array );
    1130             self::log_schedule( __( 'Number of events per hour has been set for the first time, this change is treated as an event.', 'csv2post' ), __( 'hourly events counter set', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);     
    11311113            self::event_return( __( 'initialised hourly events counter', 'csv2post' ) );   
    11321114            return;
     
    11391121            $csv2post_schedule_array['history']['lastreturnreason'] = __( 'The daily events counter was set for the first time', 'csv2post' );
    11401122            self::update_option_schedule_array( $csv2post_schedule_array );
    1141             self::log_schedule( __( 'The daily events counter was not set. No further action was taking. This measure should only happen once.', 'csv2post' ), __( 'daily events counter set', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);     
    11421123            self::event_return( __( 'initialised daily events counter', 'csv2post' ) );           
    11431124            return;
     
    11541135            $csv2post_schedule_array['history']['lastreturnreason'] = __( 'Hourly counter was reset for another 60 minute period', 'csv2post' );
    11551136            self::update_option_schedule_array( $csv2post_schedule_array );
    1156             self::log_schedule( __( 'Hourly counter has been reset, no further action is taking during this event. This should only happen once every hour.', 'csv2post' ), __( 'hourly counter reset', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    11571137            self::event_return( __( 'hourly counter was reset', 'csv2post' ) );       
    11581138            return;
     
    11691149            $csv2post_schedule_array['history']['lastreturnreason'] = __( 'Daily and hourly events counter reset for a new 24 hours period', 'csv2post' );
    11701150            self::update_option_schedule_array( $csv2post_schedule_array );
    1171             self::log_schedule( __( '24 hours had passed and the daily counter had to be reset. No further action is taking during these events and this should only happen once a day.', 'csv2post' ), __( 'daily counter reset', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);   
    11721151            self::event_return( '24 hour counter was reset' );           
    11731152            return;
     
    11791158        {
    11801159            self::event_return( __( 'Event processing is has not been permitted for today', 'csv2post' ) );
    1181             self::log_schedule( __( 'Event processing is not permitted for today. Please check schedule settings to change this.', 'csv2post' ), __( 'schedule not permitted today', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    11821160            self::event_return( 'schedule not permitting day' );       
    11831161            return;   
     
    11891167        {
    11901168            self::event_return( __( 'Event processing is has not been permitted for the hour', 'csv2post' ) );
    1191             self::log_schedule( __( 'Processsing is not permitted for the current hour. Please check schedule settings to change this.', 'csv2post' ), __( 'hour not permitted', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    11921169            self::event_return( __( 'schedule not permitting hour', 'csv2post' ) );       
    11931170            return;   
     
    12001177            $csv2post_schedule_array['history']['lastreturnreason'] = __( 'Hourly limit was set for the first time', 'csv2post' );
    12011178            self::update_option_schedule_array( $csv2post_schedule_array );
    1202             self::log_schedule( __( 'The hourly limit value had not been set yet. You can change the limit but the default has been set to one. No further action is taking during this event and this should only happen once.', 'csv2post' ), __( 'no hourly limit set', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    12031179            self::event_return( __( 'initialised hourly limit', 'csv2post' ) );       
    12041180            return;
     
    12111187            $csv2post_schedule_array['history']['lastreturnreason'] = __( 'Daily limit was set for the first time', 'csv2post' );
    12121188            self::update_option_schedule_array( $csv2post_schedule_array );
    1213             self::log_schedule( __( 'The daily limit value had not been set yet. It has now been set as one which allows only one post to be created or updated etc. This action should only happen once.', 'csv2post' ), __( 'no daily limit set', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    12141189            self::event_return( __( 'initialised daily limit', 'csv2post' ) );           
    12151190            return;
     
    12201195        {
    12211196            self::event_return( 'The hours event limit/target has been met' );
    1222             self::log_schedule( __( 'The events target for the current hour has been met so no further processing is permitted.', 'csv2post' ), __( 'hourly target met', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    12231197            self::event_return( __( 'hours limit reached', 'csv2post' ) );           
    12241198            return;       
     
    12291203        {
    12301204            self::event_return( __( 'The days event limit/target has been met', 'csv2post' ) );
    1231             self::log_schedule( __( 'The daily events target has been met for the current 24 hour period (see daily timer counter). No events will be processed until the daily timer reaches 24 hours and is reset.', 'csv2post' ), __( 'daily target met', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    12321205            self::event_return( __( 'days limit reached', 'csv2post' ) );       
    12331206            return;       
     
    12361209        // decide which event should be run (based on previous event, all events history and settings)
    12371210        $run_event_type = $this->event_decide();
    1238                  
    1239         self::log_schedule(sprintf( __( 'The schedule system decided that the next event type is %s.', 'csv2post' ), $run_event_type), __( 'next event type determined', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);
    1240            
     1211                             
    12411212        // update $csv2post_schedule_array with decided event type to advance the cycle and increase hourly plus daily counter
    12421213        $csv2post_schedule_array['history']['lasteventtype'] = $run_event_type;
     
    12701241        if( $override_event && is_string( $override_event) )
    12711242        {
    1272             self::log_schedule(sprintf( __( 'The plugins ability to override the next due event type has been applied and then next event forced is %s.', 'csv2post' ), $override_event), __( 'next event type override', 'csv2post' ),1, 'scheduledeventcheck', __LINE__, __FILE__, __FUNCTION__);         
    12731243            return $override_event;
    12741244        }   
     
    15641534        require( CSV2POST_ABSPATH . 'posttypes/posts.php' );
    15651535    }
    1566  
    1567     /**
    1568     * Admin Triggered Automation
    1569     */
    1570     public function admin_triggered_automation() {
    1571         // clear out log table (48 hour log)
    1572         self::log_cleanup();
    1573     }
    15741536
    15751537    /**
     
    18051767                    // update post - start method is the beginning of many nested functions
    18061768                    $updatepost->start();     
    1807 
    1808                     // log
    1809                     $atts = array(
    1810                         'outcome' => 1,
    1811                         'line' => __LINE__,
    1812                         'function' => __FUNCTION__,
    1813                         'file' => __FILE__,         
    1814                         'type' => 'general',
    1815                         'category' => 'usertrace',
    1816                         'action' => __( "Systematic post update applied to post ID " . $thepost->ID . " and belongs to project ID " . $project_id . '.', 'csv2post' ),
    1817                         'priority' => 'normal',                       
    1818                         'triga' => 'systematic'
    1819                     );
    1820                    
    1821                     self::newlog( $atts );
    18221769                           
    18231770                    // if a single post we can refresh - not going to do this if form submitted
     
    21122059       
    21132060        $result = wp_mail( $recipients, $subject, $content );
    2114 
    2115         // log
    2116         $atts = array(
    2117             'outcome' => 1,
    2118             'line' => __LINE__,
    2119             'function' => __FUNCTION__,
    2120             'file' => __FILE__,
    2121             'userid' => get_current_user_id(),         
    2122             'type' => 'communication',
    2123             'category' => 'sendmail',
    2124             'action' => __( 'Send mail attempt.', 'csv2post' ),
    2125             'priority' => 'normal',                       
    2126             'triga' => 'unknown'
    2127         );
    2128                                        
    2129         self::newlog( $atts );
    21302061               
    21312062        if( $content_type == 'html' )
     
    22002131        // get admin settings again, all submissions and processing should update settings
    22012132        // if the interface does not show expected changes, it means there is a problem updating settings before this line
    2202         $csv2post_settings = self::adminsettings();
    2203 
    2204         get_currentuserinfo();?>
     2133        $csv2post_settings = self::adminsettings(); ?>
    22052134                   
    22062135        <div id="csv2post-page" class="wrap">
     
    22262155                $this->UI->display_current_project();
    22272156            }
    2228                  
    2229             // run specific admin triggered automation tasks, this way an output can be created for admin to see
    2230             self::admin_triggered_automation(); 
    22312157
    22322158            // check existing plugins and give advice or warnings
     
    30712997            $autoblog->start();
    30722998        }
    3073        
    3074         // log
    3075         $atts = array(
    3076             'outcome' => 1,
    3077             'line' => __LINE__,
    3078             'function' => __FUNCTION__,
    3079             'file' => __FILE__,
    3080             'userid' => get_current_user_id(),         
    3081             'type' => 'general',
    3082             'category' => 'postsevent',
    3083             'action' => __( "Up to $foreach_done posts may have been created.", 'csv2post' ),
    3084             'priority' => 'normal',                       
    3085             'triga' => 'manualrequest'
    3086         );
    3087 
    3088         self::newlog( $atts );
    30892999    }
    30903000   
     
    31573067            // create a post - start method is the beginning of many nested functions
    31583068            $autoblog->start();
    3159         }
    3160        
    3161         // log
    3162         $atts = array(
    3163             'outcome' => 1,
    3164             'line' => __LINE__,
    3165             'function' => __FUNCTION__,
    3166             'file' => __FILE__,
    3167             'userid' => get_current_user_id(),         
    3168             'type' => 'general',
    3169             'category' => 'postsevent',
    3170             'action' => __( "Up to $foreach_done posts may have been updated.", 'csv2post' ),
    3171             'priority' => 'normal',                       
    3172             'triga' => 'manualrequest'
    3173         );
    3174 
    3175         self::newlog( $atts );                 
     3069        }                 
    31763070    }
    31773071   
     
    33183212            $result_array['error'] = false;// normal operation should lead to a green notice 
    33193213            $result_array['message'] = __( 'Your sources directory does not have a new file since CSV 2 POST last checked.', 'csv2post' ); 
    3320            
    3321             // log
    3322             $atts = array(
    3323                 'outcome' => 1,
    3324                 'line' => __LINE__,
    3325                 'function' => __FUNCTION__,
    3326                 'file' => __FILE__,
    3327                 'userid' => get_current_user_id(),         
    3328                 'type' => 'general',
    3329                 'category' => 'dataevent',
    3330                 'action' => __( "Source directory has been checked for new files but none found for source ID $source_id.", 'csv2post' ),
    3331                 'priority' => 'normal',                       
    3332                 'triga' => 'manualrequest'
    3333             );
    3334 
    3335             self::newlog( $atts );
    3336        
     3214               
    33373215            return $result_array;         
    33383216        }
     
    33483226                $result_array['outcome'] = true; 
    33493227                $result_array['error'] = false;// normal operation should lead to a green notice 
    3350                 $result_array['message'] = __( 'A new .csv file was found in your sources directory. The plugin has switched to the new file', 'csv2post' );                                                   
    3351            
    3352                 // log
    3353                 $atts = array(
    3354                     'outcome' => 1,
    3355                     'line' => __LINE__,
    3356                     'function' => __FUNCTION__,
    3357                     'file' => __FILE__,
    3358                     'userid' => get_current_user_id(),         
    3359                     'type' => 'general',
    3360                     'category' => 'dataevent',
    3361                     'action' => __( "Source directory check discovered a newer .csv file for source ID $source_id. The new file has been made the primary file.", 'csv2post' ),
    3362                     'priority' => 'normal',                       
    3363                     'triga' => 'manualrequest'
    3364                 );
    3365 
    3366                 self::newlog( $atts );           
     3228                $result_array['message'] = __( 'A new .csv file was found in your sources directory. The plugin has switched to the new file', 'csv2post' );                                                               
    33673229            }
    33683230        }   
  • csv-2-post/trunk/classes/class-install.php

    r1355720 r1437051  
    4141        register_deactivation_hook( CSV2POST_ABSPATH . 'csv-2-post.php',  array( $this, 'deactivate_plugin' ) );
    4242       
    43         // register webtechglobal_log table
    44         add_action( 'init', array( $this, 'register_webtechglobal_log_table' ) );
    45         add_action( 'switch_blog', array( $this, 'register_webtechglobal_log_table' ) );
    46         $this->register_webtechglobal_log_table(); // register tables manually as the hook may have been missed 
    47        
    4843        // register c2pprojects table
    4944        add_action( 'init', array( $this, 'register_c2pprojects_table' ) );
     
    5752    }
    5853
    59     function register_webtechglobal_log_table() {
    60         global $wpdb;
    61         $wpdb->webtechglobal_log = "{$wpdb->prefix}webtechglobal_log";
    62     }   
    63    
    6454    function register_c2pprojects_table() {
    6555        global $wpdb;
     
    7969    * @author Ryan R. Bayne
    8070    * @package CSV 2 POST
    81     * @version 1.3
     71    * @version 1.4
    8272    *
    8373    * @todo put all tables into their own function as done with log table
     
    8979        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    9080         
    91         self::webtechglobal_log();
    92        
    9381        // TODO 2 Task: after problems with this query I put it on a single line
    9482        // then the problems stopped. But it should be able to go over multiple
     
    9684       
    9785        // c2pprojects
    98         $sql_create_table = "CREATE TABLE {$wpdb->c2pprojects} (
     86        $sql_create_table = "CREATE TABLE {$wpdb->c2pprojects} ( 
    9987projectid bigint(5) unsigned NOT NULL AUTO_INCREMENT,
    10088projectname varchar(45) DEFAULT NULL,
    10189status int(1) unsigned DEFAULT 1,
    10290timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    103 source1 int(5) unsigned DEFAULT 0,
    104 source2 int(5) unsigned DEFAULT 0,
    105 source3 int(5) unsigned DEFAULT 0,
    106 source4 int(5) unsigned DEFAULT 0,
    107 source5 int(5) unsigned DEFAULT 0,
    108 lockcontent tinyint(1) unsigned DEFAULT 0,
     91source1 int(5) unsigned DEFAULT '0',
     92source2 int(5) unsigned DEFAULT '0',
     93source3 int(5) unsigned DEFAULT '0',
     94source4 int(5) unsigned DEFAULT '0',
     95source5 int(5) unsigned DEFAULT '0',
     96lockcontent tinyint(1) unsigned DEFAULT '0',
    10997lockmeta tinyint(1) unsigned DEFAULT '0',
    11098datatreatment varchar(50) DEFAULT 'single',
    11199projectsettings longtext DEFAULT NULL,
    112100settingschange DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
    113 UNIQUE KEY (projectid)
    114 ) $charset_collate; ";
     101UNIQUE KEY  (projectid)
     102 ) $charset_collate; ";
    115103        dbDelta( $sql_create_table );
    116104        // projectid - users will see this and use it to identify their project
     
    152140        // directory - directory for sources with multiple files at once or new files being added to directory and being switched to
    153141    }
    154 
    155     /**
    156     * Global WebTechGlobal log table as used in all WTG plugins.
    157     * This approach helps to keep the database tidy, while still providing
    158     * an still improving log system and with all log entries in a single table.
    159     * Behaviours relating to integration of these plugins can be spotted easier.
    160     *
    161     * @author Ryan R. Bayne
    162     * @package Training Tools
    163     * @since 0.0.3
    164     * @version 1.0
    165     */
    166     public function webtechglobal_log() {
    167         global $charset_collate,$wpdb;
    168        
    169         // webtechglobal_log - log everything in this table and use the data for multiple purposes
    170         $sql_create_table = "CREATE TABLE {$wpdb->webtechglobal_log} (
    171         row_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    172         service varchar(250) DEFAULT 'trainingtools',
    173         outcome tinyint(1) unsigned NOT NULL DEFAULT 1,
    174         timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    175         line int(11) unsigned DEFAULT NULL,
    176         file varchar(250) DEFAULT NULL,
    177         function varchar(250) DEFAULT NULL,
    178         sqlresult blob,sqlquery varchar(45) DEFAULT NULL,
    179         sqlerror mediumtext,
    180         wordpresserror mediumtext,
    181         screenshoturl varchar(500) DEFAULT NULL,
    182         userscomment mediumtext,
    183         page varchar(45) DEFAULT NULL,
    184         version varchar(45) DEFAULT NULL,
    185         panelid varchar(45) DEFAULT NULL,
    186         panelname varchar(45) DEFAULT NULL,
    187         tabscreenid varchar(45) DEFAULT NULL,
    188         tabscreenname varchar(45) DEFAULT NULL,
    189         dump longblob,ipaddress varchar(45) DEFAULT NULL,
    190         userid int(11) unsigned DEFAULT NULL,
    191         comment mediumtext,type varchar(45) DEFAULT NULL,
    192         category varchar(45) DEFAULT NULL,
    193         action varchar(45) DEFAULT NULL,
    194         priority varchar(45) DEFAULT NULL,
    195         triga varchar(45) DEFAULT NULL,
    196         PRIMARY KEY (row_id) ) $charset_collate; ";
    197        
    198         dbDelta( $sql_create_table );   
    199        
    200         // row_id
    201         // service - the plugin, theme or web service triggering log entry
    202         // outcome - set a positive (1) or negative (0) outcome
    203         // timestamp
    204         // line - __LINE__
    205         // file - __FILE__
    206         // function - __FUNCTION__
    207         // sqlresult - return from the query (dont go mad with this and store large or sensitive data where possible)
    208         // sqlquery - the query as executed
    209         // sqlerror - if failed MySQL error in here
    210         // wordpresserror - if failed store WP error
    211         // screenshoturl - if screenshot taking and uploaded
    212         // userscomment - if user is testing they can submit a comment with error i.e. what they done to cause it
    213         // page - plugin page ID i.e. c2pdownloads
    214         // version - version of the plugin (plugin may store many logs over many versions)
    215         // panelid - (will be changed to formid i.e. savebasicsettings)
    216         // panelname - (will be changed to formname i.e Save Basic Settings)
    217         // tabscreenid - the tab number i.e. 0 or 1 or 5
    218         // tabscreenname - the on screen name of the tab in question, if any i.e. Downloads Overview
    219         // dump - anything the developer thinks will help with debugging or training
    220         // ipaddress - security side of things, record who is using the site
    221         // userid - if user logged into WordPress
    222         // comment - developers comment in-code i.e. recommendation on responding to the log entry
    223         // type - general|error|trace
    224         // category - any term that suits the section or system
    225         // action - what was being attempted, if known
    226         // priority - low|medium|high (low should be default, medium if the log might help improve the plugin or user experience or minor PHP errors, high for critical errors especially security related
    227         // triga - (trigger but that word is taking) not sure we need this       
    228     }
    229                                        
     142                 
    230143    /**
    231144    * reinstall all database tables in one go
  • csv-2-post/trunk/classes/class-requests.php

    r1372216 r1437051  
    3636        // create class objects
    3737        $this->CONFIG = new CSV2POST_Configuration();
    38         // TODO Task: stop using $this->CSV2POST if possible
     38        // TODO Task: stop using $this->CSV2POST there was complication in removing it but it can be done
    3939        $this->CSV2POST = CSV2POST::load_class( 'CSV2POST', 'class-csv2post.php', 'classes' ); # plugin specific functions
    4040        $this->UI = $this->CSV2POST->load_class( 'CSV2POST_UI', 'class-ui.php', 'classes' ); # interface, mainly notices
     
    4747        $this->SCHEDULE = $this->CSV2POST->load_class( "CSV2POST_Schedule", "class-pluginmenu.php", 'classes','pluginmenu' );
    4848        $this->DATA = $this->CSV2POST->load_class( "CSV2POST_Data", "class-data.php", 'classes','pluginmenu' );
    49         $this->LOG = $this->CSV2POST->load_class( "CSV2POST_Log", "class-log.php", 'classes','pluginmenu' );
    50                      
     49             
    5150        // set current project values
    5251        if( isset( $csv2post_settings['currentproject'] ) && $csv2post_settings['currentproject'] !== false ) {   
     
    128127                   
    129128            // if $overall_result includes a single failure then there is no need to call the final function
    130             if( $post_result === false ) {
    131            
    132                 // log
    133                 $atts = array(
    134                     'outcome' => 1,
    135                     'line' => __LINE__,
    136                     'function' => __FUNCTION__,
    137                     'file' => __FILE__,
    138                     'userid' => get_current_user_id(),         
    139                     'type' => 'trace',
    140                     'category' => 'usertrace',
    141                     'action' => __( 'Form submit request rejected after security and validation applied for form ID ' . $_POST['csv2post_form_formid'], 'csv2post' ),
    142                     'priority' => 'normal',                       
    143                     'triga' => 'manualrequest'
    144                 );
    145                
    146                 $this->LOG->newlog( $atts );
    147 
     129            if( $post_result === false ) {                 
    148130                return false;
    149131            }
     
    152134        // handle a situation where the submitted form requests a function that does not exist
    153135        if( !method_exists( $this, $function_name ) ){
    154            
    155             // log
    156             $atts = array(
    157                 'outcome' => 1,
    158                 'line' => __LINE__,
    159                 'function' => __FUNCTION__,
    160                 'file' => __FILE__,
    161                 'userid' => get_current_user_id(),         
    162                 'type' => 'error',// using error is enough to attract attention to the problem
    163                 'category' => 'usertrace',// still use usertrace so that the negative event the user witnessed can be considered when communicating with the user
    164                 'action' => __( 'Requested function/method could not be found. This should be reported to WebTechGlobal.', 'csv2post' ),
    165                 'priority' => 'high',                       
    166                 'triga' => 'manualrequest'
    167             );
    168            
    169             $this->LOG->newlog( $atts );
    170                
    171136            wp_die( sprintf( __( "The method for processing your request was not found. This can usually be resolved quickly. Please report method %s does not exist. <a href='https://www.youtube.com/watch?v=vAImGQJdO_k' target='_blank'>Watch a video</a> explaining this problem.", 'wtgpluginframework' ),
    172137            $function_name) );
     
    181146
    182147    /**
    183     * form processing function
     148    * Processes a request by form submission.
    184149    *
    185150    * @author Ryan Bayne
     
    193158
    194159    /**
    195     * form processing function
     160    * Processes a request by form submission.
    196161    *
    197162    * @author Ryan Bayne
     
    205170
    206171    /**
    207     * form processing function
     172    * Processes a request by form submission.
    208173    *
    209174    * @author Ryan Bayne
     
    429394   
    430395    /**
    431     * form processing function
     396    * Processes a request by form submission.
    432397    *
    433398    * @author Ryan Bayne
     
    441406   
    442407    /**
    443     * form processing function
     408    * Processes a request by form submission.
    444409    *
    445410    * @author Ryan Bayne
     
    476441        // unset current project setting
    477442        unset( $csv2post_settings['currentproject'] );
    478         $this->CSV2POST->update_settings( $csv2post_settings );
    479        
    480         // log
    481         $atts = array(
    482             'outcome' => 1,
    483             'line' => __LINE__,
    484             'function' => __FUNCTION__,
    485             'file' => __FILE__,
    486             'userid' => get_current_user_id(),         
    487             'type' => 'general',
    488             'category' => 'projectchange',
    489             'action' => sprintf( __( 'Project deleted. The projects ID is %d.', 'csv2post' ), $_POST['projectid'] ),
    490             'priority' => 'high',                       
    491             'triga' => 'manualrequest'
    492         );
    493        
    494         $this->LOG->newlog( $atts );
    495                
     443        $this->CSV2POST->update_settings( $csv2post_settings );   
    496444        $this->UI->create_notice( __( 'Your project was deleted.' ), 'success', 'Small', __( 'Success' ) );
    497445    }
     
    567515       
    568516    /**
    569     * form processing function
     517    * Processes a request by form submission.
    570518    *
    571519    * @author Ryan Bayne
     
    600548   
    601549    /**
    602     * form processing function
     550    * Processes a request by form submission.
    603551    *
    604552    * @author Ryan Bayne
     
    633581   
    634582    /**
    635     * form processing function
     583    * Processes a request by form submission.
    636584    *
    637585    * @author Ryan Bayne
     
    666614   
    667615    /**
    668     * form processing function
     616    * Processes a request by form submission.
    669617    *
    670618    * @author Ryan Bayne
     
    699647   
    700648    /**
    701     * form processing function
     649    * Processes a request by form submission.
    702650    *
    703651    * @author Ryan Bayne
     
    732680   
    733681    /**
    734     * form processing function
     682    * Processes a request by form submission.
    735683    *
    736684    * @author Ryan Bayne
     
    773721   
    774722    /**
    775     * form processing function
     723    * Processes a request by form submission.
    776724    *
    777725    * @author Ryan Bayne
     
    830778   
    831779    /**
    832     * form processing function
     780    * Processes a request by form submission.
    833781    *
    834782    * @author Ryan Bayne
     
    843791     
    844792    /**
    845     * form processing function
     793    * Processes a request by form submission.
    846794    *
    847795    * @author Ryan Bayne
     
    856804   
    857805    /**
    858     * form processing function
     806    * Processes a request by form submission.
    859807    *
    860808    * @author Ryan Bayne
     
    869817   
    870818    /**
    871     * form processing function
     819    * Processes a request by form submission.
    872820    *
    873821    * @author Ryan Bayne
     
    882830   
    883831    /**
    884     * form processing function
     832    * Processes a request by form submission.
    885833    *
    886834    * @author Ryan Bayne
     
    908856   
    909857    /**
    910     * form processing function
     858    * Processes a request by form submission.
    911859    *
    912860    * @author Ryan Bayne
     
    926874   
    927875    /**
    928     * form processing function
     876    * Processes a request by form submission.
    929877    *
    930878    * @author Ryan Bayne
     
    980928     
    981929    /**
    982     * form processing function
     930    * Processes a request by form submission.
    983931    *
    984932    * @author Ryan Bayne
     
    1007955   
    1008956    /**
    1009     * form processing function
     957    * Processes a request by form submission.
    1010958    *
    1011959    * @author Ryan Bayne
     
    11521100   
    11531101    /**
    1154     * form processing function
     1102    * Processes a request by form submission.
    11551103    *
    11561104    * @author Ryan Bayne
     
    12021150   
    12031151    /**
    1204     * form processing function
     1152    * Processes a request by form submission.
    12051153    *
    12061154    * @author Ryan Bayne
     
    12311179   
    12321180    /**
    1233     * form processing function
     1181    * Processes a request by form submission.
    12341182    *
    12351183    * @author Ryan Bayne
     
    12601208   
    12611209    /**
    1262     * form processing function
     1210    * Processes a request by form submission.
    12631211    *
    12641212    * @author Ryan Bayne
     
    12851233   
    12861234    /**
    1287     * form processing function
     1235    * Processes a request by form submission.
    12881236    *
    12891237    * @author Ryan Bayne
     
    13261274   
    13271275    /**
    1328     * form processing function
     1276    * Processes a request by form submission.
    13291277    *
    13301278    * @author Ryan Bayne
     
    13551303   
    13561304    /**
    1357     * form processing function
     1305    * Processes a request by form submission.
    13581306    *
    13591307    * @author Ryan Bayne
     
    13841332   
    13851333    /**
    1386     * form processing function
     1334    * Processes a request by form submission.
    13871335    *
    13881336    * @author Ryan Bayne
     
    14161364   
    14171365    /**
    1418     * form processing function
     1366    * Processes a request by form submission.
    14191367    *
    14201368    * @author Ryan Bayne
     
    14331381
    14341382    /**
    1435     * form processing function
     1383    * Processes a request by form submission.
    14361384    *
    14371385    * @author Ryan Bayne
     
    14541402       
    14551403    /**
    1456     * form processing function
     1404    * Processes a request by form submission.
    14571405    *
    14581406    * @author Ryan Bayne
     
    14851433   
    14861434    /**
    1487     * form processing function
     1435    * Processes a request by form submission.
    14881436    *
    14891437    * @author Ryan Bayne
     
    15431491   
    15441492    /**
    1545     * form processing function
     1493    * Processes a request by form submission.
    15461494    *
    15471495    * @author Ryan Bayne
     
    15841532   
    15851533    /**
    1586     * form processing function
     1534    * Processes a request by form submission.
    15871535    *
    15881536    * @author Ryan Bayne
     
    15981546   
    15991547    /**
    1600     * form processing function
     1548    * Processes a request by form submission.
    16011549    *
    16021550    * @author Ryan Bayne
     
    18021750                 
    18031751        $this->CSV2POST->create_posts( $csv2post_settings['currentproject'], $total );
    1804        
    1805         // log
    1806         $atts = array(
    1807             'outcome' => 1,
    1808             'line' => __LINE__,
    1809             'function' => __FUNCTION__,
    1810             'file' => __FILE__,
    1811             'userid' => get_current_user_id(),         
    1812             'type' => 'general',
    1813             'category' => 'projectchange',
    1814             'action' => sprintf( __( 'User requested %s posts to be created.', 'csv2post' ), $total ),
    1815             'priority' => 'normal',                       
    1816             'triga' => 'manualrequest'
    1817         );
    1818        
    1819         $this->LOG->newlog( $atts );
    1820                  
     1752
    18211753        $this->UI->create_notice( __( 'Post creation procedure has finished. This notice marks the end of the procedure whatever the outcome.', 'csv2post' ),  'success', 'Small', __( 'Post Creation Ended', 'csv2post' ) );   
    18221754    }
     
    18361768
    18371769        $total = 50;
    1838        
    1839         // log
    1840         $atts = array(
    1841             'outcome' => 1,
    1842             'line' => __LINE__,
    1843             'function' => __FUNCTION__,
    1844             'file' => __FILE__,
    1845             'userid' => get_current_user_id(),         
    1846             'type' => 'general',
    1847             'category' => 'projectchange',
    1848             'action' => sprintf( __( 'User requested %s posts to be made.', 'csv2post' ), $total ),
    1849             'priority' => 'normal',                       
    1850             'triga' => 'manualrequest'
    1851         );
    1852        
    1853         $this->LOG->newlog( $atts );
    1854                
     1770
    18551771        $this->CSV2POST->create_posts( $csv2post_settings['currentproject'], $total );   
    18561772    }
     
    18731789   
    18741790    /**
    1875     * form processing function
     1791    * Processes a request by form submission.
    18761792    *
    18771793    * @author Ryan Bayne
     
    18981814   
    18991815    /**
    1900     * form processing function
     1816    * Processes a request by form submission.
    19011817    *
    19021818    * @author Ryan Bayne
     
    19241840   
    19251841    /**
    1926     * form processing function
     1842    * Processes a request by form submission.
    19271843    *
    19281844    * @author Ryan Bayne
     
    19601876   
    19611877    /**
    1962     * form processing function
     1878    * Processes a request by form submission.
    19631879    *
    19641880    * @author Ryan Bayne
     
    19931909   
    19941910    /**
    1995     * form processing function
     1911    * Processes a request by form submission.
    19961912    *
    19971913    * @author Ryan Bayne
     
    20071923   
    20081924    /**
    2009     * form processing function
     1925    * Processes a request by form submission.
    20101926    *
    20111927    * @author Ryan Bayne
     
    20321948   
    20331949    /**
    2034     * form processing function
     1950    * Processes a request by form submission.
    20351951    *
    20361952    * @author Ryan Bayne
     
    20521968   
    20531969    /**
    2054     * form processing function
     1970    * Processes a request by form submission.
    20551971    *
    20561972    * @author Ryan Bayne
     
    20852001   
    20862002    /**
    2087     * form processing function
     2003    * Processes a request by form submission.
    20882004    *
    20892005    * @author Ryan Bayne
     
    23672283     
    23682284    /**
    2369     * form processing function
     2285    * Processes a request by form submission.
    23702286    *
    23712287    * @author Ryan Bayne
     
    24082324            post ID have been removed from the projects database table so that you can re-create the posts."), 'success', 'Small', __( 'Posts Deleted' ) );
    24092325        }
    2410        
    2411         // log
    2412         $atts = array(
    2413             'outcome' => 1,
    2414             'line' => __LINE__,
    2415             'function' => __FUNCTION__,
    2416             'file' => __FILE__,
    2417             'userid' => get_current_user_id(),         
    2418             'type' => 'general',
    2419             'category' => 'projectchange',
    2420             'action' => sprintf( __( 'User requested %s posts to be deleted.', 'csv2post' ), $limit ),
    2421             'priority' => 'normal',                       
    2422             'triga' => 'manualrequest'
    2423         );
    2424        
    2425         $this->LOG->newlog( $atts );
    24262326    }   
    24272327   
    24282328    /**
    2429     * form processing function
     2329    * Processes a request by form submission.
    24302330    *
    24312331    * @author Ryan Bayne
     
    24372337        global $wpdb, $csv2post_settings;
    24382338        $result = $wpdb->query( 'UPDATE `'.$this->DB->get_project_main_table( $csv2post_settings['currentproject'] ).'` SET `c2p_postid` = 0' );       
    2439        
    2440         // log
    2441         $atts = array(
    2442             'outcome' => 1,
    2443             'line' => __LINE__,
    2444             'function' => __FUNCTION__,
    2445             'file' => __FILE__,
    2446             'userid' => get_current_user_id(),         
    2447             'type' => 'general',
    2448             'category' => 'dataevent',
    2449             'action' => sprintf( __( 'Imported data reset for project ID %s and ready to use again.', 'csv2post' ), $csv2post_settings['currentproject'] ),
    2450             'priority' => 'normal',                       
    2451             'triga' => 'manualrequest',
    2452             'dump' => $result,
    2453         );
    2454        
    2455         $this->LOG->newlog( $atts );
    2456                
    24572339        $this->UI->create_notice( "The plugin removed all post ID's from a total
    24582340        of $result rows in your imported data for the current project. The rows
     
    24652347   
    24662348    /**
    2467     * form processing function
     2349    * Processes a request by form submission.
    24682350    *
    24692351    * @author Ryan Bayne
     
    25262408        $this->CSV2POST->update_sources_withprojects( $projectid, $sourceid_array );
    25272409           
    2528         $this->UI->create_notice( 'Your project has been created and the ID is ' . $projectid . '. The default project name is ' . $project_name . ' which you can change using project settings.', 'success', 'Small', __( 'Project Created' ) );                   
    2529 
    2530         // log
    2531         $atts = array(
    2532             'outcome' => 1,
    2533             'line' => __LINE__,
    2534             'function' => __FUNCTION__,
    2535             'file' => __FILE__,
    2536             'userid' => get_current_user_id(),         
    2537             'type' => 'general',
    2538             'category' => 'projectchange',
    2539             'action' => sprintf( __( 'New project created with ID %s.', 'csv2post' ), $projectid ),
    2540             'priority' => 'normal',                       
    2541             'triga' => 'manualrequest'
    2542         );
    2543        
    2544         $this->LOG->newlog( $atts );   
     2410        $this->UI->create_notice( 'Your project has been created and the ID is ' . $projectid . '. The default project name is ' . $project_name . ' which you can change using project settings.', 'success', 'Small', __( 'Project Created' ) );                                     
    25452411    } 
    25462412
     
    25502416             
    25512417    /**
    2552     * form processing function
     2418    * Processes a request by form submission.
    25532419    *
    25542420    * @author Ryan Bayne
     
    30392905        $this->CSV2POST->create_project_table( $files_array[1]['tablename'], $sqlheaders_array );
    30402906        self::a_table_was_created( $files_array[1]['tablename'] );                                                             
    3041 
    3042         // log
    3043         $atts = array(
    3044             'outcome' => 1,
    3045             'line' => __LINE__,
    3046             'function' => __FUNCTION__,
    3047             'file' => __FILE__,
    3048             'userid' => get_current_user_id(),         
    3049             'type' => 'general',
    3050             'category' => 'dataevent',
    3051             'action' => __( 'Created URL .csv data source.', 'csv2post' ),
    3052             'priority' => 'normal',                       
    3053             'triga' => 'manualrequest'
    3054         );
    3055        
    3056         $this->LOG->newlog( $atts );
    3057                        
     2907           
    30582908        $this->UI->create_notice( sprintf( __( 'Your new source of data has been
    30592909        setup. You can now create a project using this source. The source ID
     
    31913041        $this->CSV2POST->create_project_table( $files_array[1]['tablename'], $sqlheaders_array );
    31923042        self::a_table_was_created( $files_array[1]['tablename'] );                                                             
    3193 
    3194         // log
    3195         $atts = array(
    3196             'outcome' => 1,
    3197             'line' => __LINE__,
    3198             'function' => __FUNCTION__,
    3199             'file' => __FILE__,
    3200             'userid' => get_current_user_id(),         
    3201             'type' => 'general',
    3202             'category' => 'dataevent',
    3203             'action' => __( 'Created data source using uploaded .csv file.', 'csv2post' ),
    3204             'priority' => 'normal',                       
    3205             'triga' => 'manualrequest'
    3206         );
    3207        
    3208         $this->LOG->newlog( $atts );
    3209                            
     3043                         
    32103044        $this->UI->create_notice( __( 'Your new source of data has been setup.
    32113045        You can now create a project using this source. The source ID
     
    33383172        $this->CSV2POST->create_project_table( $files_array[1]['tablename'], $sqlheaders_array );
    33393173        self::a_table_was_created( $files_array[1]['tablename'] );                                                             
    3340          
    3341         // log
    3342         $atts = array(
    3343             'outcome' => 1,
    3344             'line' => __LINE__,
    3345             'function' => __FUNCTION__,
    3346             'file' => __FILE__,
    3347             'userid' => get_current_user_id(),         
    3348             'type' => 'general',
    3349             'category' => 'dataevent',
    3350             'action' => __( 'Created data-source using local file that was already on the server.', 'csv2post' ),
    3351             'priority' => 'normal',                       
    3352             'triga' => 'manualrequest'
    3353         );
    3354        
    3355         $this->LOG->newlog( $atts );
    3356                    
     3174                     
    33573175        $this->UI->create_notice( __( 'Your new source of data has been setup.
    33583176        You can now create a project using this source. The source
     
    35503368        $csv2post_settings['directorysources'][$path]['name'] = $_POST['newsourcename4'];   
    35513369        $this->CSV2POST->update_settings( $csv2post_settings );
    3552 
    3553         // make log entry under dataevent category
    3554         $atts = array(
    3555             'outcome' => 1,
    3556             'line' => __LINE__,
    3557             'function' => __FUNCTION__,
    3558             'file' => __FILE__,
    3559             'userid' => get_current_user_id(),         
    3560             'general' => 'general',
    3561             'category' => 'dataevent',
    3562             'action' => __( 'Directory data source created.', 'csv2post' ),
    3563             'priority' => 'normal',                       
    3564             'triga' => 'manualrequest'
    3565         );
    3566        
    3567         $this->LOG->newlog( $atts );       
    3568        
     3370         
    35693371        // finishing notice           
    35703372        $this->UI->create_notice( __( 'All done! A total of ' . $total_new_datasources . '
  • csv-2-post/trunk/classes/class-schedule.php

    r1355720 r1437051  
    2727        $this->DB = $this->CONFIG->load_class( 'CSV2POST_DB', 'class-wpdb.php', 'classes' );
    2828        $this->DATA = $this->CONFIG->load_class( 'CSV2POST_Data', 'class-data.php', 'classes' );
    29         $this->LOG = $this->CONFIG->load_class( 'CSV2POST_Log', 'class-log.php', 'classes' );
    3029        $this->UI = $this->CONFIG->load_class( 'CSV2POST_UI', 'class-ui.php', 'classes' );
    3130
     
    131130            return false;
    132131        }
    133        
    134         // log
    135         $atts = array(
    136             'outcome' => 1,
    137             'line' => __LINE__,
    138             'function' => __FUNCTION__,
    139             'file' => __FILE__,           
    140             'type' => 'general',
    141             'category' => 'dataevent',
    142            
    143             'action' => __( "Automatic data import is using source $source_id
    144             for project $project_id and will attempt data import.", 'csv2post' ),
    145            
    146             'priority' => 'normal',                       
    147             'triga' => 'automatic'
    148         );
    149        
    150         $this->CONFIG->newlog( $atts );
    151132               
    152133        // import data
     
    193174           
    194175            break;
    195         }
    196        
    197         // log
    198         $atts = array(
    199             'outcome' => 1,
    200             'line' => __LINE__,
    201             'function' => __FUNCTION__,
    202             'file' => __FILE__,           
    203             'type' => 'general',
    204             'category' => 'dataevent',
    205             'action' => __( "Automatic data update is using source $source_id
    206             for project $project_id and will attempt data re-import.", 'csv2post' ),       
    207             'priority' => 'normal',                       
    208             'triga' => 'automatic'
    209         );                                                                         
    210        
    211         $this->CONFIG->newlog( $atts );       
     176        }       
    212177               
    213178        // import data
     
    298263            $autoblog->start();
    299264        }
    300        
    301         // log
    302         $atts = array(
    303             'outcome' => 1,
    304             'line' => __LINE__,
    305             'function' => __FUNCTION__,
    306             'file' => __FILE__,           
    307             'type' => 'general',
    308             'category' => 'postsevent',
    309             'action' => __( "Up to $foreach_done posts may have been created.", 'csv2post' ),
    310             'priority' => 'normal',                       
    311             'triga' => 'manualrequest'
    312         );
    313 
    314         $this->LOG->newlog( $atts );
    315        
     265                     
    316266        $this->UI->create_notice( __( "Normally automated functions would not
    317267        generate a user notice but this is to make testing easier. The post
     
    398348            $autoblog->start();
    399349        }
    400        
    401         // log
    402         $atts = array(
    403             'outcome' => 1,
    404             'line' => __LINE__,
    405             'function' => __FUNCTION__,
    406             'file' => __FILE__,
    407             'userid' => get_current_user_id(),         
    408             'type' => 'general',
    409             'category' => 'postsevent',
    410             'action' => __( "Up to $foreach_done posts may have been updated.", 'csv2post' ),
    411             'priority' => 'normal',                       
    412             'triga' => 'manualrequest'
    413         );
    414 
    415         $this->LOG->newlog( $atts );         
    416             $this->UI->create_notice( __( 'Posts may have been updated. This
    417             notice will not be generated for any user during automated events and
    418             is only to help make testing clearer.' ), 'info', 'Small',
    419             __( 'Testing Complete: Posts Updated', 'csv2post' ) );           
    420             return false;
     350         
     351        $this->UI->create_notice( __( 'Posts may have been updated. This
     352        notice will not be generated for any user during automated events and
     353        is only to help make testing clearer.' ), 'info', 'Small',
     354        __( 'Testing Complete: Posts Updated', 'csv2post' ) );           
     355        return false;
    421356    }
    422357       
  • csv-2-post/trunk/classes/class-ui.php

    r1355720 r1437051  
    27332733}
    27342734
    2735 /**
    2736 * Lists tickets post type using standard WordPress list table
    2737 */
    2738 class CSV2POST_Log_Table extends WP_List_Table {
    2739    
    2740     /** ************************************************************************
    2741      * REQUIRED. Set up a constructor that references the parent constructor. We
    2742      * use the parent reference to set some default configs.
    2743      ***************************************************************************/
    2744     function __construct() {
    2745         global $status, $page;
    2746              
    2747         //Set parent defaults
    2748         parent::__construct( array(
    2749             'singular'  => 'movie',     //singular name of the listed records
    2750             'plural'    => 'movies',    //plural name of the listed records
    2751             'ajax'      => false        //does this table support ajax?
    2752         ) );
    2753        
    2754     }
    2755    
    2756     /** ************************************************************************
    2757      * Recommended. This method is called when the parent class can't find a method
    2758      * specifically build for a given column. Generally, it's recommended to include
    2759      * one method for each column you want to render, keeping your package class
    2760      * neat and organized. For example, if the class needs to process a column
    2761      * named 'title', it would first see if a method named $this->column_title()
    2762      * exists - if it does, that method will be used. If it doesn't, this one will
    2763      * be used. Generally, you should try to use custom column methods as much as
    2764      * possible.
    2765      *
    2766      * Since we have defined a column_title() method later on, this method doesn't
    2767      * need to concern itself with any column with a name of 'title'. Instead, it
    2768      * needs to handle everything else.
    2769      *
    2770      * For more detailed insight into how columns are handled, take a look at
    2771      * WP_List_Table::single_row_columns()
    2772      *
    2773      * @param array $item A singular item (one full row's worth of data)
    2774      * @param array $column_name The name/slug of the column to be processed
    2775      * @return string Text or HTML to be placed inside the column <td>
    2776      **************************************************************************/
    2777     function column_default( $item, $column_name){
    2778              
    2779         $attributes = "class=\"$column_name column-$column_name\"";
    2780                
    2781         switch( $column_name){
    2782             case 'row_id':
    2783                 return $item['row_id'];   
    2784                 break;
    2785             case 'timestamp':
    2786                 return $item['timestamp'];   
    2787                 break;               
    2788             case 'outcome':
    2789                 return $item['outcome'];
    2790                 break;
    2791             case 'category':
    2792                 echo $item['category']; 
    2793                 break;
    2794             case 'action':
    2795                 echo $item['action']; 
    2796                 break; 
    2797             case 'line':
    2798                 echo $item['line']; 
    2799                 break;                 
    2800             case 'file':
    2801                 echo $item['file']; 
    2802                 break;                 
    2803             case 'function':
    2804                 echo $item['function']; 
    2805                 break;                 
    2806             case 'sqlresult':
    2807                 echo $item['sqlresult']; 
    2808                 break;       
    2809             case 'sqlquery':
    2810                 echo $item['sqlquery']; 
    2811                 break;
    2812             case 'sqlerror':
    2813                 echo $item['sqlerror']; 
    2814                 break;       
    2815             case 'wordpresserror':
    2816                 echo $item['wordpresserror']; 
    2817                 break;       
    2818             case 'screenshoturl':
    2819                 echo $item['screenshoturl']; 
    2820                 break;       
    2821             case 'userscomment':
    2822                 echo $item['userscomment']; 
    2823                 break; 
    2824             case 'page':
    2825                 echo $item['page']; 
    2826                 break;
    2827             case 'version':
    2828                 echo $item['version']; 
    2829                 break;
    2830             case 'panelname':
    2831                 echo $item['panelname']; 
    2832                 break;
    2833             case 'tabscreenname':
    2834                 echo $item['tabscreenname']; 
    2835                 break;
    2836             case 'dump':
    2837                 echo $item['dump']; 
    2838                 break;
    2839             case 'ipaddress':
    2840                 echo $item['ipaddress']; 
    2841                 break;
    2842             case 'userid':
    2843                 echo $item['userid']; 
    2844                 break;
    2845             case 'comment':
    2846                 echo $item['comment']; 
    2847                 break;
    2848             case 'type':
    2849                 echo $item['type']; 
    2850                 break;
    2851             case 'priority':
    2852                 echo $item['priority']; 
    2853                 break; 
    2854             case 'thetrigger':
    2855                 echo $item['thetrigger']; 
    2856                 break;
    2857                                        
    2858             default:
    2859                 return 'No column function or default setup in switch statement';
    2860         }
    2861     }
    2862                    
    2863     /** ************************************************************************
    2864     * Recommended. This is a custom column method and is responsible for what
    2865     * is rendered in any column with a name/slug of 'title'. Every time the class
    2866     * needs to render a column, it first looks for a method named
    2867     * column_{$column_title} - if it exists, that method is run. If it doesn't
    2868     * exist, column_default() is called instead.
    2869     *
    2870     * This example also illustrates how to implement rollover actions. Actions
    2871     * should be an associative array formatted as 'slug'=>'link html' - and you
    2872     * will need to generate the URLs yourself. You could even ensure the links
    2873     *
    2874     *
    2875     * @see WP_List_Table::::single_row_columns()
    2876     * @param array $item A singular item (one full row's worth of data)
    2877     * @return string Text to be placed inside the column <td> (movie title only )
    2878     **************************************************************************/
    2879     /*
    2880     function column_title( $item){
    2881 
    2882     } */
    2883    
    2884     /** ************************************************************************
    2885      * REQUIRED! This method dictates the table's columns and titles. This should
    2886      * return an array where the key is the column slug (and class) and the value
    2887      * is the column's title text. If you need a checkbox for bulk actions, refer
    2888      * to the $columns array below.
    2889      *
    2890      * The 'cb' column is treated differently than the rest. If including a checkbox
    2891      * column in your table you must create a column_cb() method. If you don't need
    2892      * bulk actions or checkboxes, simply leave the 'cb' entry out of your array.
    2893      *
    2894      * @see WP_List_Table::::single_row_columns()
    2895      * @return array An associative array containing column information: 'slugs'=>'Visible Titles'
    2896      **************************************************************************/
    2897     function get_columns() {
    2898         $columns = array(
    2899             'row_id' => 'Row ID',
    2900             'timestamp' => 'Timestamp',
    2901             'category'     => 'Category'
    2902         );
    2903        
    2904         if( isset( $this->action ) ){
    2905             $columns['action'] = 'Action';
    2906         }                                       
    2907            
    2908         if( isset( $this->line ) ){
    2909             $columns['line'] = 'Line';
    2910         }
    2911                      
    2912         if( isset( $this->file ) ){
    2913             $columns['file'] = 'File';
    2914         }
    2915                
    2916         if( isset( $this->function ) ){
    2917             $columns['function'] = 'Function';
    2918         }       
    2919  
    2920         if( isset( $this->sqlresult ) ){
    2921             $columns['sqlresult'] = 'SQL Result';
    2922         }
    2923 
    2924         if( isset( $this->sqlquery ) ){
    2925             $columns['sqlquery'] = 'SQL Query';
    2926         }
    2927  
    2928         if( isset( $this->sqlerror ) ){
    2929             $columns['sqlerror'] = 'SQL Error';
    2930         }
    2931          
    2932         if( isset( $this->wordpresserror ) ){
    2933             $columns['wordpresserror'] = 'WP Error';
    2934         }
    2935 
    2936         if( isset( $this->screenshoturl ) ){
    2937             $columns['screenshoturl'] = 'Screenshot';
    2938         }
    2939        
    2940         if( isset( $this->userscomment ) ){
    2941             $columns['userscomment'] = 'Users Comment';
    2942         }
    2943  
    2944         if( isset( $this->columns_array->page ) ){
    2945             $columns['page'] = 'Page';
    2946         }
    2947 
    2948         if( isset( $this->version ) ){
    2949             $columns['version'] = 'Version';
    2950         }
    2951  
    2952         if( isset( $this->panelname ) ){
    2953             $columns['panelname'] = 'Panel Name';
    2954         }
    2955  
    2956         if( isset( $this->tabscreenid ) ){
    2957             $columns['tabscreenid'] = 'Screen ID';
    2958         }
    2959 
    2960         if( isset( $this->tabscreenname ) ){
    2961             $columns['tabscreenname'] = 'Screen Name';
    2962         }
    2963 
    2964         if( isset( $this->dump ) ){
    2965             $columns['dump'] = 'Dump';
    2966         }
    2967 
    2968         if( isset( $this->ipaddress) ){
    2969             $columns['ipaddress'] = 'IP Address';
    2970         }
    2971 
    2972         if( isset( $this->userid ) ){
    2973             $columns['userid'] = 'User ID';
    2974         }
    2975 
    2976         if( isset( $this->comment ) ){
    2977             $columns['comment'] = 'Comment';
    2978         }
    2979 
    2980         if( isset( $this->type ) ){
    2981             $columns['type'] = 'Type';
    2982         }
    2983                                    
    2984         if( isset( $this->priority ) ){
    2985             $columns['priority'] = 'Priority';
    2986         }
    2987        
    2988         if( isset( $this->thetrigger ) ){
    2989             $columns['thetrigger'] = 'Trigger';
    2990         }
    2991 
    2992         return $columns;
    2993     }
    2994    
    2995     /** ************************************************************************
    2996      * Optional. If you want one or more columns to be sortable (ASC/DESC toggle),
    2997      * you will need to register it here. This should return an array where the
    2998      * key is the column that needs to be sortable, and the value is db column to
    2999      * sort by. Often, the key and value will be the same, but this is not always
    3000      * the case (as the value is a column name from the database, not the list table).
    3001      *
    3002      * This method merely defines which columns should be sortable and makes them
    3003      * clickable - it does not handle the actual sorting. You still need to detect
    3004      * the ORDERBY and ORDER querystring variables within prepare_items_further() and sort
    3005      * your data accordingly (usually by modifying your query ).
    3006      *
    3007      * @return array An associative array containing all the columns that should be sortable: 'slugs'=>array( 'data_values',bool)
    3008      **************************************************************************/
    3009     function get_sortable_columns() {
    3010         $sortable_columns = array(
    3011             //'post_title'     => array( 'post_title', false ),     //true means it's already sorted
    3012         );
    3013         return $sortable_columns;
    3014     }
    3015    
    3016     /** ************************************************************************
    3017      * Optional. If you need to include bulk actions in your list table, this is
    3018      * the place to define them. Bulk actions are an associative array in the format
    3019      * 'slug'=>'Visible Title'
    3020      *
    3021      * If this method returns an empty value, no bulk action will be rendered. If
    3022      * you specify any bulk actions, the bulk actions box will be rendered with
    3023      * the table automatically on display().
    3024      *
    3025      * Also note that list tables are not automatically wrapped in <form> elements,
    3026      * so you will need to create those manually in order for bulk actions to function.
    3027      *
    3028      * @return array An associative array containing all the bulk actions: 'slugs'=>'Visible Titles'
    3029      **************************************************************************/
    3030     function get_bulk_actions() {
    3031         $actions = array(
    3032 
    3033         );
    3034         return $actions;
    3035     }
    3036    
    3037     /** ************************************************************************
    3038      * Optional. You can handle your bulk actions anywhere or anyhow you prefer.
    3039      * For this example package, we will handle it in the class to keep things
    3040      * clean and organized.
    3041      *
    3042      * @see $this->prepare_items_further()
    3043      **************************************************************************/
    3044     function process_bulk_action() {
    3045        
    3046         //Detect when a bulk action is being triggered...
    3047         if( 'delete'===$this->current_action() ) {
    3048             wp_die( 'Items deleted (or they would be if we had items to delete)!' );
    3049         }
    3050        
    3051     }
    3052    
    3053     /** ************************************************************************
    3054      * REQUIRED! This is where you prepare your data for display. This method will
    3055      * usually be used to query the database, sort and filter the data, and generally
    3056      * get it ready to be displayed. At a minimum, we should set $this->items and
    3057      * $this->set_pagination_args(), although the following properties and methods
    3058      * are frequently interacted with here...
    3059      *
    3060      * @global WPDB $wpdb
    3061      * @uses $this->_column_headers
    3062      * @uses $this->items
    3063      * @uses $this->get_columns()
    3064      * @uses $this->get_sortable_columns()
    3065      * @uses $this->get_pagenum()
    3066      * @uses $this->set_pagination_args()
    3067      **************************************************************************/
    3068     function prepare_items_further( $data, $per_page = 5) {
    3069         global $wpdb; //This is used only if making any database queries       
    3070        
    3071         /**
    3072          * REQUIRED. Now we need to define our column headers. This includes a complete
    3073          * array of columns to be displayed (slugs & titles), a list of columns
    3074          * to keep hidden, and a list of columns that are sortable. Each of these
    3075          * can be defined in another method (as we've done here) before being
    3076          * used to build the value for our _column_headers property.
    3077          */
    3078         $columns = $this->get_columns();
    3079         $hidden = array();
    3080         $sortable = $this->get_sortable_columns();
    3081        
    3082         /**
    3083          * REQUIRED. Finally, we build an array to be used by the class for column
    3084          * headers. The $this->_column_headers property takes an array which contains
    3085          * 3 other arrays. One for all columns, one for hidden columns, and one
    3086          * for sortable columns.
    3087          */
    3088         $this->_column_headers = array( $columns, $hidden, $sortable);
    3089        
    3090         /**
    3091          * Optional. You can handle your bulk actions however you see fit. In this
    3092          * case, we'll handle them within our package just to keep things clean.
    3093          */
    3094         $this->process_bulk_action();
    3095      
    3096         /**
    3097          * REQUIRED for pagination. Let's figure out what page the user is currently
    3098          * looking at. We'll need this later, so you should always include it in
    3099          * your own package classes.
    3100          */
    3101         $current_page = $this->get_pagenum();
    3102        
    3103         /**
    3104          * REQUIRED for pagination. Let's check how many items are in our data array.
    3105          * In real-world use, this would be the total number of items in your database,
    3106          * without filtering. We'll need this later, so you should always include it
    3107          * in your own package classes.
    3108          */
    3109         $total_items = count( $data);
    3110 
    3111         /**
    3112          * The WP_List_Table class does not handle pagination for us, so we need
    3113          * to ensure that the data is trimmed to only the current page. We can use
    3114          * array_slice() to
    3115          */
    3116         $data = array_slice( $data,(( $current_page-1)*$per_page), $per_page);
    3117  
    3118         /**
    3119          * REQUIRED. Now we can add our *sorted* data to the items property, where
    3120          * it can be used by the rest of the class.
    3121          */
    3122         $this->items = $data;
    3123  
    3124         /**
    3125          * REQUIRED. We also have to register our pagination options & calculations.
    3126          */
    3127         $this->set_pagination_args( array(
    3128             'total_items' => $total_items,                  //WE have to calculate the total number of items
    3129             'per_page'    => $per_page,                     //WE have to determine how many items to show on a page
    3130             'total_pages' => ceil( $total_items/$per_page)   //WE have to calculate the total number of pages
    3131         ) );
    3132     }
    3133 }
    3134 
    3135 class CSV2POST_Projects_Table extends WP_List_Table {
    3136 
    3137     function __construct() {
    3138         global $status, $page;
    3139              
    3140         //Set parent defaults
    3141         parent::__construct( array(
    3142             'singular'  => 'movie',     //singular name of the listed records
    3143             'plural'    => 'movies',    //plural name of the listed records
    3144             'ajax'      => false        //does this table support ajax?
    3145         ) );
    3146        
    3147     }
    3148 
    3149     function column_default( $item, $column_name){
    3150              
    3151         $attributes = "class=\"$column_name column-$column_name\"";
    3152                
    3153         switch( $column_name){
    3154             case 'projectid':
    3155                 return $item['projectid'];   
    3156                 break;
    3157             case 'projectname':
    3158                 return $item['projectname'];   
    3159                 break;
    3160             case 'timestamp':
    3161                 return $item['timestamp'];   
    3162                 break;                                                       
    3163             case 'source1':
    3164                 return $item['source1'];   
    3165                 break;                                                       
    3166             case 'source2':
    3167                 return $item['source2'];   
    3168                 break;                                                       
    3169             case 'source3':
    3170                 return $item['source3'];   
    3171                 break;                                                       
    3172             default:
    3173                 return 'No column function or default setup in switch statement';
    3174         }
    3175     }
    3176 
    3177     /*
    3178     function column_title( $item){
    3179 
    3180     } */
    3181 
    3182     function get_columns() {
    3183         $columns = array(
    3184             'projectid' => 'Project ID',
    3185             'projectname' => 'Project Name',
    3186             'timestamp' => 'Timestamp',
    3187             'source1' => 'Source 1',
    3188             'source2' => 'Source 2',
    3189             'source3' => 'Source 3'
    3190         );
    3191 
    3192         return $columns;
    3193     }
    3194 
    3195     function get_sortable_columns() {
    3196         $sortable_columns = array(
    3197             //'post_title'     => array( 'post_title', false ),     //true means it's already sorted
    3198         );
    3199         return $sortable_columns;
    3200     }
    3201 
    3202     function get_bulk_actions() {
    3203         $actions = array(
    3204 
    3205         );
    3206         return $actions;
    3207     }
    3208 
    3209     function process_bulk_action() {
    3210        
    3211         //Detect when a bulk action is being triggered...
    3212         if( 'delete'===$this->current_action() ) {
    3213             wp_die( 'Items deleted (or they would be if we had items to delete)!' );
    3214         }
    3215        
    3216     }
    3217 
    3218     function prepare_items_further( $data, $per_page = 5) {
    3219         global $wpdb; //This is used only if making any database queries       
    3220 
    3221         $columns = $this->get_columns();
    3222         $hidden = array();
    3223         $sortable = $this->get_sortable_columns();
    3224 
    3225         $this->_column_headers = array( $columns, $hidden, $sortable);
    3226 
    3227         $this->process_bulk_action();
    3228 
    3229         $current_page = $this->get_pagenum();
    3230 
    3231         $total_items = count( $data);
    3232 
    3233         $data = array_slice( $data,(( $current_page-1)*$per_page), $per_page);
    3234 
    3235         $this->items = $data;
    3236 
    3237         $this->set_pagination_args( array(
    3238             'total_items' => $total_items,                  //WE have to calculate the total number of items
    3239             'per_page'    => $per_page,                     //WE have to determine how many items to show on a page
    3240             'total_pages' => ceil( $total_items/$per_page)   //WE have to calculate the total number of pages
    3241         ) );
    3242     }
    3243 }
    3244 
    32452735class CSV2POST_ProjectDataSources_Table extends WP_List_Table {
    32462736
  • csv-2-post/trunk/classes/class-view.php

    r1372216 r1437051  
    127127        $this->PHP = $this->CSV2POST->load_class( 'CSV2POST_PHP', 'class-phplibary.php', 'classes' );
    128128        $this->UI = $this->CSV2POST->load_class( 'CSV2POST_UI', 'class-ui.php', 'classes' );
    129         $this->LOG = $this->CSV2POST->load_class( 'CSV2POST_Log', 'class-log.php', 'classes' );
    130129        $this->DB = CSV2POST::load_class( 'CSV2POST_DB', 'class-wpdb.php', 'classes' );
    131130        $this->FORMS = CSV2POST::load_class( 'CSV2POST_FORMS', 'class-forms.php', 'classes' );
     
    515514        }   
    516515       
    517         $current_user = get_currentuserinfo();
    518        
    519         // log users visit to page
    520         $atts = array(
    521             'outcome' => 1,
    522             'line' => __LINE__,
    523             'function' => __FUNCTION__,
    524             'file' => __FILE__,
    525             'userid' => get_current_user_id(),         
    526             'type' => 'trace',// using trace allows these log entries to be hidden easier
    527             'category' => 'usertrace',
    528             'action' => sprintf( __( "User named %s visited admin page named %s", 'csv2post' ), $current_user, $this->menu_array[ $admin_page ]['title'] ),
    529             'priority' => 'low',                       
    530             'triga' => 'manualrequest'
    531         );
    532        
    533         $this->LOG->newlog( $atts );
    534          
     516        $current_user = wp_get_current_user();
     517       
    535518        // view header - includes notices output and some admin side automation such as conflict prevention
    536519        $this->CSV2POST->pageheader( $this->menu_array[ $admin_page ]['title'], 0);
  • csv-2-post/trunk/classes/class-wpdb.php

    r1252652 r1437051  
    8686    * @package CSV 2 POST
    8787    * @since 7.0.0
    88     * @version 1.0.1
     88    * @version 1.4
    8989    *
    9090    * @param string $tablename
     
    9494        global $wpdb;
    9595        $fieldss = '';
    96         $valuess = '';
     96        $values = '';
    9797        $first = true;
     98       
    9899        foreach( $fields as $field=>$value )
    99100        {
     
    103104             {
    104105                $fieldss .= ' , ';
    105                 $valuess .= ' , ';
     106                $values .= ' , ';
    106107             }
    107108             $fieldss .= " `$field` ";
    108              $valuess .= " '" . $value  ."' ";
    109         }
    110 
    111         $query = " INSERT INTO $tablename ( $fieldss ) VALUES ( $valuess )";
     109             $values .= " '" . $wpdb->escape( $value )  ."' ";
     110        }
     111
     112        $query = $wpdb->prepare( "
     113            INSERT INTO $tablename ( $fieldss )
     114            VALUES ( $values )",
     115            $tablename, $fieldss, $values
     116        );
    112117
    113118        $wpdb->query( $query );
     
    121126    * @package CSV 2 POST
    122127    * @since 8.1.3
    123     * @version 1.2
     128    * @version 1.4
    124129    */
    125130    public function update( $tablename, $condition, $fields ){
     
    130135        {
    131136            if( $first) $first = false; else $query .= ' , ';
    132             $query .= " `$field` = '" .  $value ."' ";
     137            $query .= " `$field` = '" .  $wpdb->escape( $value ) ."' ";
    133138        }
    134139
     
    550555        , ARRAY_A );
    551556        return $results;
    552     }
    553    
    554     /**
    555     * function not complete
    556     *
    557     * @author Ryan R. Bayne
    558     * @package CSV 2 POST
    559     * @since 7.0.0
    560     * @version 1.1
    561     */
    562     public function log_queryactions() {
    563         global $wpdb;   
    564         return $wpdb->get_results( 'SELECT DISTINCT action FROM '.$wpdb->prefix.'webtechglobal_log',ARRAY_A );   
    565557    }
    566558
  • csv-2-post/trunk/csv-2-post.php

    r1372216 r1437051  
    22/*
    33Plugin Name: CSV 2 POST
    4 Version: 8.2.11
     4Version: 8.2.13
    55Plugin URI: http://www.webtechglobal.co.uk/csv-2-post
    66Description: CSV 2 POST data importer for WordPress by Ryan R. Bayne.
    77Author: WebTechGlobal
    88Author URI: http://www.webtechglobal.co.uk/
    9 Last Updated: February 2016
     9Last Updated: June 2016
    1010Text Domain: csv2post
    1111Domain Path: /languages
     
    3939             
    4040// define constants                             
    41 if(!defined( "CSV2POST_VERSION") ){define( "CSV2POST_VERSION", '8.2.11' );}
     41if(!defined( "CSV2POST_VERSION") ){define( "CSV2POST_VERSION", '8.2.13' );}
    4242if(!defined( "CSV2POST_TITLE") ){define( "CSV2POST_TITLE", 'CSV 2 POST' );}
    4343if(!defined( "CSV2POST__FILE__") ){define( "CSV2POST__FILE__", __FILE__);}
     
    6363// require very common classes and finally the main class for loading the plugin                                                   
    6464require_once( CSV2POST_ABSPATH . 'classes/class-wpdb.php' );
    65 require_once( CSV2POST_ABSPATH . 'classes/class-log.php' );
    6665require_once( CSV2POST_ABSPATH . 'classes/class-configuration.php' );
    6766require_once( CSV2POST_ABSPATH . 'classes/class-csv2post.php' );
  • csv-2-post/trunk/readme.txt

    r1372216 r1437051  
    11=== Plugin Name ===
    22Contributors: WebTechGlobal
    3 Donate link: http://www.webtechglobal.co.uk
     3Donate link: https://www.patreon.com/ryanbayne
    44License: GPLv2 or later
    55License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    125125
    126126== Changelog ==
     127= 8.2.13 NOT RELEASED =
     128* Feature Changes
     129    * None
     130* Technical Changes     
     131    * class-log.php removed and the approach to logging will be a lighter solution.
     132    * uninstall.php file added.
     133    * Replaced depreciated get_currentuserinfo() with wp_get_current_user().
     134   
     135= 8.2.12 =
     136* Feature Changes
     137    * None
     138* Technical Changes     
     139    * Changed lockmeta tinyint(1) unsigned DEFAULT '0',
     140    * to
     141    * lockmeta tinyint(1) unsigned DEFAULT 0,
     142    * in attempt to fix issue with dbDelta() which causes dbDelta() to
     143    * attempt to change the datatreatment column.
     144
    127145= 8.2.11 =
    128146* Feature Changes
Note: See TracChangeset for help on using the changeset viewer.