Plugin Directory

Changeset 1437050


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

Installation procedure improved.

Location:
multitool/trunk
Files:
98 added
24 edited

Legend:

Unmodified
Added
Removed
  • multitool/trunk/classes/class-automation.php

    r1428502 r1437050  
    2626
    2727class WEBTECHGLOBAL_Automation {
     28   
     29    use MULTITOOL_DB, MULTITOOL_OptionsTrait;
    2830   
    2931    /**
     
    558560        self::automation_administration();
    559561
    560         // Query table for due cron jobs with limit using $this->auto_tasks_limit;
    561         if( !isset( $this->DB ) ) { $this->DB = new MULTITOOL_DB(); }
    562        
    563         $result = $this->DB->selectorderby(
     562        $result = $this->selectorderby(
    564563            $wpdb->webtechglobal_schedule,
    565564            'active = 1',
     
    600599           
    601600            // Update changes to the scheduled action.
    602             $this->DB->update(
     601            $this->update(
    603602                $wpdb->webtechglobal_schedule,
    604603                'rowid = ' . $action->rowid . ', timesapplied = ' . $action->timesapplied,
     
    641640
    642641        // Query table for due cron jobs with limit using $this->auto_tasks_limit;
    643         if( !isset( $this->DB ) ) { $this->DB = new MULTITOOL_DB(); }
    644        
    645642        $fields = array(
    646643            'plugin' => $plugin,
     
    657654        );
    658655
    659         $this->DB->insert(
     656        $this->insert(
    660657            $wpdb->webtechglobal_schedule,
    661658            $fields
     
    717714    */
    718715    public function disable_action( $class, $method ) {
    719         return $this->DB->update(
     716        return $this->update(
    720717            $wpdb->webtechglobal_schedule,
    721718            'class = ' . $class . ', method = ' . $method,
  • multitool/trunk/classes/class-categories.php

    r1198356 r1437050  
    1818class MULTITOOL_Categories {
    1919
    20     public function __construct() {
    21         $this->DB = MULTITOOL::load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' );   
    22     }
    23    
     20    use MULTITOOL_DB, MULTITOOL_OptionsTrait;
     21
    2422    /**
    2523    * Establishes the code level (zero is level one) of an existing category
     
    6967   
    7068        // query all term names matching $term_string (it may return many, from different levels, with different parents)
    71         $all_terms_array = $this->DB->selectwherearray( $wpdb->terms, "name = '$term_name'", 'term_id', 'term_id' );
     69        $all_terms_array = $this->selectwherearray( $wpdb->terms, "name = '$term_name'", 'term_id', 'term_id' );
    7270       
    7371        // if none then return false, we may then create the category queried for example
  • multitool/trunk/classes/class-configuration.php

    r1436092 r1437050  
    3131
    3232        // load class used at all times
    33         $this->DB = self::load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' );
    3433        $this->PHP = self::load_class( 'MULTITOOL_PHP', 'class-phplibrary.php', 'classes' );
    3534        $this->Install = self::load_class( 'MULTITOOL_Install', 'class-install.php', 'classes' );
  • multitool/trunk/classes/class-forms.php

    r1428502 r1437050  
    8181        $this->WPCore = $this->CONFIG->load_class( 'MULTITOOL_WPCore', 'class-wpcore.php', 'classes' );
    8282        $this->HELP = $this->CONFIG->load_class( 'MULTITOOL_Help', 'class-help.php', 'classes' );
    83         $this->DB = $this->CONFIG->load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' );
    84        
     83
    8584        // get form validation array
    8685        $this->form_val_arr = get_option( 'multitool_formvalidation' );
  • multitool/trunk/classes/class-globalui.php

    r1436092 r1437050  
    1414class MULTITOOL_GLOBALUI {     
    1515   
    16     public function __construct() {
    17     } 
    18    
    1916    /**
    2017    * Part of processing requests from Developer menu in the Admin Bar.
     
    3936        if( isset( $_GET['viewcontrol'] ) && $_GET['viewcontrol'] == $control ) {   
    4037            return true;   
    41         }         
     38        }             
    4239        return false;
    4340    }
  • multitool/trunk/classes/class-help.php

    r1420327 r1437050  
    1010 */ 
    1111class MULTITOOL_Help {
     12   
     13    use MULTITOOL_DB, MULTITOOL_OptionsTrait;
     14   
    1215    public function __construct() {
    1316        global $multitool_settings;
    1417
    1518        $this->UI = MULTITOOL::load_class( 'MULTITOOL_UI', 'class-ui.php', 'classes' ); # interface, mainly notices
    16         $this->DB = MULTITOOL::load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' ); # database interaction
    1719    }
    1820   
     
    250252        // get existing help data && UPDATE else INSERT
    251253        $condition = "md5hash = '$md5_hash'";
    252         $helpid = $this->DB->get_value( 'helpid', $wpdb->webtechglobal_help, $condition );
     254        $helpid = $this->get_value( 'helpid', $wpdb->webtechglobal_help, $condition );
    253255        if( is_numeric( $helpid ) ) {
    254256            self::update_help_text( $helpid, $main_fields['boxintro'], $md5_hash );               
     
    277279        );
    278280 
    279         return $this->DB->insert( $wpdb->webtechglobal_help, $fields );
     281        return $this->insert( $wpdb->webtechglobal_help, $fields );
    280282    }
    281283       
     
    290292    */
    291293    public function update_help_text( $helpid, $helptext, $md5hash ) {
    292         global $wpdb;
     294        global $wpdb;         
    293295       
    294296        // require "helpid" numeric
     
    297299        }       
    298300       
    299         return $this->DB->update(
     301        return $this->update(
    300302            $wpdb->webtechglobal_help,
    301303            "helpid = '$helpid'",
  • multitool/trunk/classes/class-install.php

    r1436092 r1437050  
    1717
    1818class MULTITOOL_Install {
    19          
     19   
     20    use MULTITOOL_DB, MULTITOOL_OptionsTrait;     
    2021    /**
    2122    * Install __construct persistently registers database tables and is the
     
    2324    */
    2425    public function __construct() {     
    25         // load class used at all times
    26         $this->DB = new MULTITOOL_DB();
    2726        $this->PHP = new MULTITOOL_PHP();             
    2827    }
     
    7170    }
    7271   
    73     function install_options() {     
     72    public function options_install() {     
    7473        // installation state values
    7574        update_option( 'multitool_installedversion', MULTITOOL_VERSION );# will only be updated when user prompted to upgrade rather than activation
     
    8079       
    8180        // New options installation process as of May 2016 by Ryan R. Bayne
    82         $all_options = MULTITOOL_Options::install();
     81        $all_options = $this->install_options();
    8382    }
    8483   
    85     function install_plugin() {
     84    function install_plugin() {         
     85        self::minimum_wp_version();
     86        self::minimum_php_version();
    8687        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    8788        self::create_tables();
    8889        self::install_options();
     90        // Flush WP re-write rules for custom post types.
     91        flush_rewrite_rules();       
    8992    }
    90    
     93
     94    /**
     95    * WP version check with strict enforcement.
     96    *
     97    * This is only done on activation. There is another check that is
     98    * performed on every page load and displays a notice. That check
     99    * is to ensure the environment does not change.
     100    *
     101    * @version 1.0
     102    */
     103    function minimum_wp_version() {
     104        global $wp_version;
     105        if ( version_compare( $wp_version, MULTITOOL_WPVERSIONMINIMUM, '<' ) ) {
     106            deactivate_plugins( basename( __FILE__ ) );
     107            wp_die(
     108                '<p>' .
     109                sprintf(
     110                    __( 'This plugin can not be activated because it
     111                    requires a WordPress version greater than %1$s. Please
     112                    go to Dashboard &#9656; Updates to get the latest
     113                    version of WordPress .', 'multitool' ),
     114                    MULTITOOL_WPVERSIONMINIMUM
     115                )
     116                . '</p> <a href="' . admin_url( 'plugins.php' ) . '">' . __( 'go back', 'my_plugin' ) . '</a>'
     117            );
     118        }
     119    }
     120   
     121    /**
     122    * PHP version check with strict enforcement.
     123    *
     124    * This is only done on activation. There is another check that is
     125    * performed on every page load and displays a notice. That check
     126    * is to ensure the environment does not change.
     127    *
     128    * @version 1.0
     129    */
     130    function minimum_php_version() {
     131        if ( version_compare( PHP_VERSION, MULTITOOL_PHPVERSIONMINIMUM, '<' ) ) {
     132            deactivate_plugins( basename( __FILE__ ) );
     133            wp_die(
     134                '<p>' .
     135                sprintf(
     136                    __( 'This plugin cannot be activated because it
     137                    requires a PHP version greater than %1$s. Your
     138                    PHP version can be updated by your hosting
     139                    company.', 'multitool' ),
     140                    MULTITOOL_PHPVERSIONMINIMUM
     141                )
     142                . '</p> <a href="' . admin_url( 'plugins.php' ) . '">' . __( 'go back', 'my_plugin' ) . '</a>'
     143            );
     144        }
     145    } 
     146   
    91147    /**
    92148    * Deactivate plugin - can use it for uninstall but usually not
    93149    * 1. can use to cleanup WP CRON schedule, remove plugins scheduled events
    94150    *
    95     * @version 1.0
     151    * @version 1.2
    96152    */
    97153    function deactivate_plugin() {
    98        
     154        // Flush WP re-write rules for custom post types.
     155        flush_rewrite_rules();
    99156    }
    100157       
     
    155212       
    156213        if( $drop === true ) {
    157             $this->DB->drop_table( $wpdb->webtechglobal_projects );   
     214            $this->drop_table( $wpdb->webtechglobal_projects );   
    158215        }
    159216                                                                                                                                                                                                                                                                                                                                                                                                   
     
    195252       
    196253        if( $drop === true ) {
    197             $this->DB->drop_table( $wpdb->webtechglobal_projectsmeta );   
     254            $this->drop_table( $wpdb->webtechglobal_projectsmeta );   
    198255        }
    199256               
     
    231288                   
    232289        if( $drop === true ) {
    233             $this->DB->drop_table( $wpdb->webtechglobal_postboxes );   
     290            $this->drop_table( $wpdb->webtechglobal_postboxes );   
    234291        }
    235292                                                                                                                                                                                                                                                                                                                                                                                                         
     
    268325       
    269326        if( $drop === true ) {
    270             $this->DB->drop_table( $wpdb->webtechglobal_help );   
     327            $this->drop_table( $wpdb->webtechglobal_help );   
    271328        }
    272329                                                                                                                                                                                                                                                                                                                                                                                                         
     
    303360       
    304361        if( $drop === true ) {
    305             $this->DB->drop_table( $wpdb->webtechglobal_helpmeta );   
     362            $this->drop_table( $wpdb->webtechglobal_helpmeta );   
    306363        }
    307364               
     
    338395       
    339396        if( $drop === true ) {
    340             $this->DB->drop_table( $wpdb->webtechglobal_tweetswaiting );   
     397            $this->drop_table( $wpdb->webtechglobal_tweetswaiting );   
    341398        }
    342399                 
     
    400457                   
    401458        if( $drop === true ) {
    402             $this->DB->drop_table( $wpdb->webtechglobal_socialaccounts );   
     459            $this->drop_table( $wpdb->webtechglobal_socialaccounts );   
    403460        }
    404461                 
     
    439496                   
    440497        if( $drop === true ) {
    441             $this->DB->drop_table( $wpdb->webtechglobal_schedule );   
     498            $this->drop_table( $wpdb->webtechglobal_schedule );   
    442499        }
    443500                 
  • multitool/trunk/classes/class-multitool.php

    r1436092 r1437050  
    77 * @author Ryan Bayne   
    88 * @since 0.0.1
    9  * @version 1.0
     9 * @version 1.2
    1010 */
    1111
     
    1515class MULTITOOL extends MULTITOOL_Configuration{
    1616   
     17    use MULTITOOL_DB, MULTITOOL_OptionsTrait;
     18             
    1719    /**
    1820     * Page hooks (i.e. names) WordPress uses for the MULTITOOL admin screens,
     
    5961    public function __construct() {
    6062        global $multitool_settings;
    61              
    62         $this->DB = self::load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' );
     63   
    6364        $this->PHP = self::load_class( 'MULTITOOL_PHP', 'class-phplibrary.php', 'classes' );
    6465        $this->Install = self::load_class( 'MULTITOOL_Install', 'class-install.php', 'classes' );
     
    255256    * @package Multitool
    256257    * @since 0.0.1
    257     * @version 1.0
     258    * @version 1.2
    258259    *
    259260    * @todo This may need to be improved to load specific scripts for specific
     
    266267        wp_enqueue_script( 'jquery-ui-datepicker' );                           
    267268        wp_enqueue_script( 'jquery-ui-datetimepicker', plugins_url( 'multitool/js/datetimepicker/jquery.datetimepicker.full.min.js' ), __FILE__ ); 
    268        
    269         wp_enqueue_script( 'jquery' );
    270        
    271         // Trello
    272         $trello_key = 'c3edd889433c851194664930e6958e01';
    273         // TODO: only enqueue when Trello service activated.
    274 
    275         wp_deregister_script('trello-client1');
    276         wp_register_script('trello-client1', "https://trello.com/1/client.js?key=$trello_key" );
    277         wp_enqueue_script('trello-client1');   
    278        
    279         wp_deregister_script('trello-userauth');
    280         wp_register_script('trello-userauth', plugins_url( 'multitool/js/trello/trellouserauth.js' ), 'Trello', false );
    281         wp_enqueue_script('trello-userauth');   
    282 
    283269    }   
    284270
     
    14171403        return false;
    14181404    }
    1419          
    1420     /**
    1421     * gets the specific row/s for a giving post ID
    1422     *
    1423     * UPDATE: "c2p_postid != $post_id" was in use but this is wrong. I'm not sure how this has gone
    1424     * undetected considering where the function has been used.
    1425     *
    1426     * @param mixed $project_id
    1427     * @param mixed $total
    1428     *
    1429     * @author Ryan Bayne
    1430     * @package Multitool
    1431     * @since 0.0.1
    1432     * @version 1.0
    1433     */
    1434     public function get_posts_rows( $project_id, $post_id, $idcolumn = false ){
    1435         $this->DB = self::load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' );
    1436         $tables_array = $this->get_dbtable_sources( $project_id );
    1437         return $this->DB->query_multipletables( $tables_array, $idcolumn, 'c2p_postid = '.$post_id );
    1438     }
    1439    
    1440     /**
    1441     * gets one or more rows from imported data for specific post created by specific project
    1442     *
    1443     * @uses get_posts_rows() which does a join query
    1444     *
    1445     * @param mixed $project_id
    1446     * @param mixed $post_id
    1447     * @param mixed $idcolumn
    1448     *
    1449     * @author Ryan Bayne
    1450     * @package Multitool
    1451     * @since 0.0.1
    1452     * @version 1.0
    1453     */
    1454     public function get_posts_record( $project_id, $post_id, $idcolumn = false ){
    1455         return self::get_posts_rows( $project_id, $post_id, $idcolumn );
    1456     }
    1457    
    1458     /**
    1459     * Gets the MySQL version of column
    1460     *
    1461     * @author Ryan R. Bayne
    1462     * @package Multitool
    1463     * @since 0.0.1
    1464     * @version 1.0
    1465     *
    1466     * @returns false if no column set
    1467     */
    1468     public function get_category_column( $project_id, $level ) {
    1469         if( isset( $this->current_project_settings['categories']['data'][$level]['column'] ) ){
    1470             return $this->current_project_settings['categories']['data'][$level]['column'];   
    1471         }           
    1472        
    1473         return false;
    1474     }
    14751405
    14761406    /**
     
    16681598            $this->UI->display_all();             
    16691599         
    1670             // process global security and any other types of checks here such such check systems requirements, also checks installation status
    1671             $c2p_requirements_missing = self::check_requirements(true);
     1600            // Constantly check the environment for missing requirements.
     1601            // There is a seperate process during activation.
     1602            $c2p_requirements_missing = self::check_requirements_after_activation(true);
    16721603    }                         
    16731604   
    16741605    /**
    1675     * Checks if the cores minimum requirements are met and displays notices if not
    1676     * Checks: Internet Connection (required for jQuery ), PHP version, Soap Extension
    1677     */
    1678     public function check_requirements( $display ){
     1606    * Checks if the plugins minimum requirements are met.
     1607    *
     1608    * Performed on every page load to ensure the environment does not
     1609    * change.
     1610    *
     1611    * @version 1.2
     1612    */
     1613    public function check_requirements_after_activation( $display ){
     1614        global $wp_version;
     1615       
    16791616        // variable indicates message being displayed, we will only show 1 message at a time
    16801617        $requirement_missing = false;
    16811618
    1682         // php version
    1683         if(defined(MULTITOOL_PHPVERSIONMINIMUM) ){
    1684             if(MULTITOOL_PHPVERSIONMINIMUM > phpversion() ){
     1619        // PHP
     1620        if( defined( MULTITOOL_PHPVERSIONMINIMUM ) ){
     1621            if( MULTITOOL_PHPVERSIONMINIMUM > PHP_VERSION ){
    16851622                $requirement_missing = true;
    1686                 if( $display == true){
    1687                     self::notice_depreciated(sprintf( __( 'The plugin detected an older PHP version than the minimum requirement which
    1688                     is %s. You can requests an upgrade for free from your hosting, use .htaccess to switch
    1689                     between PHP versions per WP installation or sometimes hosting allows customers to switch using their control panel.', 'multitool' ),MULTITOOL_PHPVERSIONMINIMUM)
    1690                     , 'warning', 'Large', __( 'Multitool Requires PHP ', 'multitool' ) . MULTITOOL_PHPVERSIONMINIMUM);               
     1623                if( $display == true ){
     1624                    $message = sprintf( __( 'Your PHP version is too low. We
     1625                    recommend an upgrade on your hosting. Do this by contacting
     1626                    your hosting service and explaining this notice.', 'multitool' ) );
     1627                    self::notice_depreciated(
     1628                        $message,
     1629                        MULTITOOL_PHPVERSIONMINIMUM,
     1630                        'warning',
     1631                        'Large',
     1632                        __( 'Multitool Requires PHP ', 'multitool' ) . MULTITOOL_PHPVERSIONMINIMUM
     1633                    );               
     1634                }
     1635            }
     1636        }
     1637
     1638        // WP
     1639        if( defined( MULTITOOL_WPVERSIONMINIMUM ) ){
     1640            if( MULTITOOL_WPVERSIONMINIMUM > $wp_version ){
     1641                $requirement_missing = true;
     1642                if( $display == true ){
     1643                    $message = sprintf( __( 'Your WP version is too low for
     1644                    Multitool plugin. It means there are improvements in the
     1645                    more recent versions of WordPress that this plugin requires.
     1646                    It is always in your best interest to keep WP updated and we
     1647                    can help.', 'multitool' ) );
     1648                    self::notice_depreciated(
     1649                        $message,
     1650                        MULTITOOL_WPVERSIONMINIMUM,
     1651                        'warning',
     1652                        'Large',
     1653                        __( 'Multitool Requires WP ', 'multitool' ) . MULTITOOL_WPVERSIONMINIMUM
     1654                    );               
    16911655                }
    16921656            }
     
    17611725    public function datewp( $timeaddition = 0, $time = false, $format = false ){
    17621726        // initialize time string
    1763         if( $time != false && is_numeric( $time) ){$thetime = $time;}else{$thetime = time();}
     1727        if( $time != false && is_numeric( $time) )
     1728        {
     1729            $thetime = $time;}else{$thetime = time();
     1730        }
     1731       
    17641732        // has a format been past
    1765         if( $format == 'gm' ){
     1733        if( $format == 'gm' )
     1734        {
    17661735            return gmdate( 'Y-m-d H:i:s', $thetime + $timeaddition);
    1767         }elseif( $format == 'mysql' ){
     1736        }
     1737        elseif( $format == 'mysql' )
     1738        {
    17681739            // return actual mysql database current time
    17691740            return current_time( 'mysql',0);// example 2005-08-05 10:41:13
     
    17791750   
    17801751    /**
    1781     * Use to start a new result array which is returned at the end of a function. It gives us a common set of values to work with.
    1782 
     1752    * Use to start a new result array which is returned at the end of a function.
     1753    * It gives us a common set of values to work with.
     1754    *
    17831755    * @uses self::arrayinfo_set()
    17841756    * @param mixed $description use to explain what array is used for
     
    19711943    */
    19721944    public function tables_exist( $tables_array ){
    1973         if( $tables_array && is_array( $tables_array ) ){         
     1945        if( $tables_array && is_array( $tables_array ) )
     1946        {         
    19741947            // foreach table in array, if one does not exist return false
    1975             foreach( $tables_array as $key => $table_name){
    1976                 $table_exists = $this->DB->does_table_exist( $table_name); 
    1977                 if(!$table_exists){         
     1948            foreach( $tables_array as $key => $table_name)
     1949            {
     1950                $table_exists = $this->does_table_exist( $table_name); 
     1951                if(!$table_exists)
     1952                {         
    19781953                    return false;
    19791954                }
     
    20562031        $new_filename = basename( $file_url);
    20572032
    2058         if (@fclose(@fopen( $file_url, "r") )) { //make sure the file actually exists
     2033        if (@fclose(@fopen( $file_url, "r") ))
     2034        {
    20592035            copy( $file_url, ABSPATH . $artDir . $new_filename);
    20602036
     
    20952071            //optional make it the featured image of the post it's attached to
    20962072            $rows_affected = $wpdb->insert( $wpdb->prefix.'postmeta', array( 'post_id' => $post_id, 'meta_key' => '_thumbnail_id', 'meta_value' => $attach_id) );
    2097         }else {
     2073        }
     2074        else
     2075        {
    20982076            return false;
    20992077        }
     
    21782156    public function term_exists_in_level( $term_name = 'No Term Giving', $level = 0){                 
    21792157        global $wpdb;
    2180         $all_terms_array = $this->DB->selectwherearray( $wpdb->terms, "name = '$term_name'", 'term_id', 'term_id' );
     2158        $all_terms_array = $this->selectwherearray( $wpdb->terms, "name = '$term_name'", 'term_id', 'term_id' );
    21812159        if(!$all_terms_array ){return false;}
    21822160
  • multitool/trunk/classes/class-options.php

    r1436092 r1437050  
    1010 * @author Ryan Bayne   
    1111 * @since 0.0.1
    12  * @version 1.1
     12 * @version 1.2
    1313 */
    1414class MULTITOOL_Options {
    15 
     15    use MULTITOOL_OptionsTrait;
     16}
     17
     18trait MULTITOOL_OptionsTrait {
    1619    private static $grouped_options = array(
    1720        'compact' => 'multitool_options',
     
    8285    * @todo move installation options to compact.
    8386    */
    84     public static function get_option_information( $type = 'merged', $return = 'keys', $name = array() ) {
     87    public function get_option_information( $type = 'merged', $return = 'keys', $name = array() ) {
    8588       
    8689            /*
     
    172175    * @version 1.1
    173176    */
    174     public function install() {
     177    public function install_options() {
    175178        $single_options = self::get_option_information( 'single', 'all' );
    176179        $merged_options = self::get_option_information( 'merged', 'all' );
     
    195198    * @version 1.0
    196199    */
    197     public function uninstall() {
     200    public function uninstall_options() {
    198201      $single_options = self::get_option_information( 'single', 'all' );
    199202        $merged_options = self::get_option_information( 'merged', 'all' );
     
    296299    * @param mixed $value
    297300    */                               
    298     private static function update_grouped_option( $group, $name, $value ) {
     301    private function update_grouped_option( $group, $name, $value ) {
    299302        $options = get_option( self::$grouped_options[ $group ] );
    300303        if ( ! is_array( $options ) ) {
     
    318321     * Why delete every option prior to update?
    319322     */
    320     public static function update_option( $name, $value, $autoload = null ) {
     323    public function update_option( $name, $value, $autoload = null ) {
    321324        if ( self::is_valid( $name, 'non_compact' ) ) {
    322325            /**             
     
    347350     * @param array $array array( option name => option value, ... )
    348351     */
    349     public static function update_options( $array ) {
     352    public function update_options( $array ) {
    350353        $names = array_keys( $array );
    351354
     
    366369     * @param string|array $names
    367370     */
    368     public static function delete_option( $names ) {
     371    public function delete_option( $names ) {
    369372        $result = true;
    370373        $names  = (array) $names;
     
    416419    * @param mixed $names
    417420    */
    418     private static function delete_grouped_option( $group, $names ) {
     421    private function delete_grouped_option( $group, $names ) {
    419422        $options = get_option( self::$grouped_options[ $group ], array() );
    420423
  • multitool/trunk/classes/class-phplibrary.php

    r1428502 r1437050  
    11<?php
    22/**
    3  * General PHP function library - I welcome any improvements you can suggest
    4  *
    5  * where possible we really want to replace the use of these with WP core functions
     3 * General PHP function library - I welcome any improvements you can suggest.
    64 *
    75 * @package Multitool
     
    1412defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
    1513                                                                   
    16 class MULTITOOL_PHP { 
     14class MULTITOOL_PHP {
     15    use MULTITOOL_PHPTrait;                       
     16}
     17                     
     18trait MULTITOOL_PHPTrait { 
    1719    /**
    1820    * Performs a var_dump if debug_mode active (debug_mode is only active
  • multitool/trunk/classes/class-requests.php

    r1436092 r1437050  
    2424
    2525class MULTITOOL_Requests { 
     26   
     27    use MULTITOOL_DB, MULTITOOL_OptionsTrait;
     28   
    2629    public function __construct() {
    27         global $multitool_settings;
    28    
     30        global $MULTITOOL_Class, $multitool_settings;
     31           
    2932        // create class objects
    30         $this->MULTITOOL = MULTITOOL::load_class( 'MULTITOOL', 'class-multitool.php', 'classes' ); # plugin specific functions
     33        //$this->MULTITOOL = MULTITOOL::load_class( 'MULTITOOL', 'class-multitool.php', 'classes' ); # plugin specific functions
     34        $this->MULTITOOL = $MULTITOOL_Class;
    3135        $this->UI = $this->MULTITOOL->load_class( 'MULTITOOL_UI', 'class-ui.php', 'classes' ); # interface, mainly notices
    32         $this->DB = $this->MULTITOOL->load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' ); # database interaction
    3336        $this->PHP = $this->MULTITOOL->load_class( 'MULTITOOL_PHP', 'class-phplibrary.php', 'classes' ); # php library by Ryan R. Bayne
    3437        $this->Files = $this->MULTITOOL->load_class( 'MULTITOOL_Files', 'class-files.php', 'classes' );
     
    13651368                    && $actionsettings[ $plugin ][ $class ][ $method ]['status'] == true ) {
    13661369                        // We update the schedule table, changing $method 'active' to 0.
    1367                         $this->DB->update(
     1370                        $this->update(
    13681371                            $wpdb->webtechglobal_schedule,
    13691372                            'class = ' . $class . ', method = ' . $method,
     
    14091412    public function executeallactions() {
    14101413        global $wpdb;
    1411         $result = $this->DB->selectwherearray(
     1414        $result = $this->selectwherearray(
    14121415            $wpdb->webtechglobal_schedule,
    14131416            'active = 1',
     
    16921695        if( !$current_value )
    16931696        {
    1694             MULTITOOL_Options::update_option( 'postdump', true );
    1695            
     1697            $this->update_option( 'postdump', true );
     1698       
    16961699            $output_text =  __( "All form submitted data (\$_POST) will be dumped
    16971700            for debugging. This has been activated within the Developer Menu
     
    17091712        else
    17101713        {
    1711             MULTITOOL_Options::update_option( 'postdump', false );
     1714            $this->update_option( 'postdump', false );
    17121715           
    17131716            $output_text =  __( "Form data will not be dumped for
     
    17331736        if( !$current_value )
    17341737        {
    1735             MULTITOOL_Options::update_option( 'getdump', true );
     1738            $this->update_option( 'getdump', true );
    17361739           
    17371740            $output_text =  __( "All action link (\$_GET) will be dumped
     
    17501753        else
    17511754        {
    1752             MULTITOOL_Options::update_option( 'getdump', false );
     1755            $this->update_option( 'getdump', false );
    17531756           
    17541757            $output_text =  __( "All action links data (\$_GET) will
     
    17761779        if( $current === true )
    17771780        {
    1778             MULTITOOL_Options::update_option( 'debugtracedisplay', false );
     1781            $this->update_option( 'debugtracedisplay', false );
    17791782                $this->UI->create_notice(
    17801783                    __( 'Trace display has been switched off and trace information will be hidden.
     
    17881791        elseif( $current === false )
    17891792        {       
    1790             MULTITOOL_Options::update_option( 'debugtracedisplay', true );
     1793            $this->update_option( 'debugtracedisplay', true );
    17911794            $this->UI->create_notice(
    17921795                __( 'Trace display has been switched on and you will see information
  • multitool/trunk/classes/class-schedule.php

    r1422006 r1437050  
    1515
    1616class MULTITOOL_Schedule {
     17
    1718    public function __construct() {
    1819        $CONFIG = new MULTITOOL_Configuration();
    1920        $this->UI = $CONFIG->load_class( 'MULTITOOL_UI', 'class-ui.php', 'classes' ); # interface, mainly notices
    20         $this->DB = $CONFIG->load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' ); # database interaction
    2121        $this->PHP = $CONFIG->load_class( 'MULTITOOL_PHP', 'class-phplibrary.php', 'classes' ); # php library by Ryan R. Bayne
    2222    }   
  • multitool/trunk/classes/class-security.php

    r1436092 r1437050  
    1717        $CONFIG = new MULTITOOL_Configuration();
    1818        $this->UI = $CONFIG->load_class( 'MULTITOOL_UI', 'class-ui.php', 'classes' ); # interface, mainly notices
    19         $this->DB = $CONFIG->load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' ); # database interaction
    2019        $this->WPCORE = $CONFIG->load_class( 'MULTITOOL_WPCore', 'class-wpcore.php', 'classes' ); # database interaction
    2120    }
  • multitool/trunk/classes/class-twitch.php

    r1420327 r1437050  
    2828    public $last_error = false;
    2929
     30    /**
     31    * Constructor
     32    *
     33    * @version 1.2
     34    *
     35    * @param mixed $args
     36    */
    3037    function __construct( $args = array() ) {
    31        
    32         $this->MULTITOOL = MULTITOOL::load_class( 'MULTITOOL', 'class-multitool.php', 'classes' ); # plugin specific functions
    33         $this->DB = $this->MULTITOOL->load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' );
    34        
    3538        // if MULTITOOL_Twitter is loaded without the last parameter it will result in $args == null
    3639        if( $args === null ){ $args = array(); }
  • multitool/trunk/classes/class-ui.php

    r1436092 r1437050  
    1313class MULTITOOL_UI extends MULTITOOL {     
    1414   
     15    use MULTITOOL_DB, MULTITOOL_OptionsTrait;
     16   
    1517    public function __construct() {
    16        
    17         // load class used at all times
    18         $this->DB = self::load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' );
    1918        $this->PHP = self::load_class( 'MULTITOOL_PHP', 'class-phplibrary.php', 'classes' );
    2019    } 
     
    3029    */
    3130    function developer_toolbar() {
    32        
    3331        self::developer_toolbar_webtechglobaladmin();
    3432        self::developer_toolbar_front();
    3533        self::developer_toolbar_coreviews();
    3634        self::developer_toolbar_other();
    37        
    3835    }
    3936   
     
    699696        self::register_input_validation( $title, $name, $id, 'numeric' );// stored data is used to apply correct validation during processing
    700697       
    701         global $wpdb;
    702         $query_results = $this->DB->selectwherearray( $wpdb->c2psources, 'sourceid = sourceid', 'sourceid', '*' );?>
     698        global $wpdb;   
     699        $query_results = $this->selectwherearray( $wpdb->c2psources, 'sourceid = sourceid', 'sourceid', '*' );?>
    703700        <!-- Option Start -->       
    704701        <tr valign="top">
     
    20042001       
    20052002        $condition = "pluginname = '$plugin' && pagename = '$pagename' && postboxid = '$postboxid'";
    2006         return $this->DB->selectrow( $wpdb->webtechglobal_postboxes, $condition, '*', 'OBJECT' );
     2003        return $this->selectrow( $wpdb->webtechglobal_postboxes, $condition, '*', 'OBJECT' );
    20072004    } 
    20082005       
     
    20252022        );
    20262023       
    2027         return $this->DB->insert( $wpdb->webtechglobal_postboxes, $fields );
     2024        return $this->insert( $wpdb->webtechglobal_postboxes, $fields );
    20282025    } 
    20292026   
  • multitool/trunk/classes/class-view.php

    r1420327 r1437050  
    1515abstract class MULTITOOL_View {
    1616
     17    use MULTITOOL_DB, MULTITOOL_OptionsTrait;
     18   
    1719    /**
    1820     * Data for the view
     
    115117        $this->UI = $this->CONFIG->load_class( 'MULTITOOL_UI', 'class-ui.php', 'classes' );
    116118        $this->FORMS = $this->CONFIG->load_class( 'MULTITOOL_Formbuilder', 'class-forms.php', 'classes' );
    117         $this->DB = $this->CONFIG->load_class( 'MULTITOOL_DB', 'class-wpdb.php', 'classes' ); # database interaction
    118119        $this->TABMENU = $this->CONFIG->load_class( "MULTITOOL_TabMenu", "class-pluginmenu.php", 'classes','pluginmenu' );   
    119120         
  • multitool/trunk/classes/class-wpdb.php

    r1436092 r1437050  
    1212defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
    1313
    14 class MULTITOOL_DB {     
     14trait MULTITOOL_DB {     
    1515
    1616    /**
     
    6767    * @param mixed $select
    6868    */
    69     public static function selectwherearray( $tablename, $condition=null, $orderby=null, $select = '*', $object = 'ARRAY_A', $sort = null ){
     69    public function selectwherearray( $tablename, $condition=null, $orderby=null, $select = '*', $object = 'ARRAY_A', $sort = null ){
    7070        global $wpdb;
    7171        $condition = empty ( $condition)? '' : ' WHERE ' . $condition;
  • multitool/trunk/functions/functions.debug.php

    r1436092 r1437050  
    55* @version 1.0
    66*/
    7 function debug_guide() {
     7function debug_guide() {         
    88    $debugging_guide = '
    99    <h2>Error Functions</h2>
  • multitool/trunk/multitool.php

    r1436092 r1437050  
    22/*
    33Plugin Name: Multitool Beta
    4 Version: 1.0.7
     4Version: 1.0.8
    55Plugin URI: http://www.webtechglobal.co.uk/wtg-plugin-framework-wordpress/
    66Description: Multitool does a little bit of everything.
     
    4141
    4242// define package constants...                                           
    43 if(!defined( "MULTITOOL_VERSION") ){define( "MULTITOOL_VERSION", '1.0.7' );}
     43if(!defined( "MULTITOOL_VERSION") ){define( "MULTITOOL_VERSION", '1.0.8' );}
    4444if(!defined( "MULTITOOL_RELEASENAME") ){define( "MULTITOOL_RELEASENAME", 'Beta' );}                         
    4545if(!defined( "MULTITOOL_TITLE") ){define( "MULTITOOL_TITLE", 'Multitool' );}
     
    5050if(!defined( "MULTITOOL_DIR_URL") ){define( "MULTITOOL_DIR_URL", plugin_dir_url( __FILE__) );}
    5151if(!defined( "MULTITOOL_PHPVERSIONMINIMUM") ){define( "MULTITOOL_PHPVERSIONMINIMUM", '5.4.0' );}// The minimum php version that will allow the plugin to work                               
     52if(!defined( "MULTITOOL_WPVERSIONMINIMUM") ){define( "MULTITOOL_WPVERSIONMINIMUM", '4.2.0' );}// The minimum php version that will allow the plugin to work                               
    5253if(!defined( "MULTITOOL_IMAGES_URL") ){define( "MULTITOOL_IMAGES_URL",plugins_url( 'images/' , __FILE__ ) );}
    5354if(!defined( "MULTITOOL_WPORG" ) ){define( "MULTITOOL_WPORG", 'https://wordpress.org/plugins/multitool/' );}
     
    7778// Class required on loading.
    7879require_once( MULTITOOL_DIR_PATH . 'classes/class-wpdb.php' );
     80require_once( MULTITOOL_DIR_PATH . 'classes/class-options.php');
    7981require_once( MULTITOOL_DIR_PATH . 'classes/class-install.php');
    80 require_once( MULTITOOL_DIR_PATH . 'classes/class-options.php');
    8182require_once( MULTITOOL_DIR_PATH . 'classes/class-configuration.php' );
    8283require_once( MULTITOOL_DIR_PATH . 'classes/class-multitool.php' );
  • multitool/trunk/readme.txt

    r1436092 r1437050  
    7575
    7676== Changelog ==
     77= 1.0.8 =
     78* Feature Changes
     79    * User will see new notices regarding PHP and WP minimum version requirements.
     80* Technical Notes
     81    * Now making use of "trait" only in PHP 5.4
     82    * All uses of $this->DB-> removed as "use MULTITOOL_DB" applied.
     83    * Activation now checks PHP and WP version. It prevents full installation if requirements not met.
     84   
    7785= 1.0.7 =
    7886* Feature Changes
  • multitool/trunk/uninstall.php

    r1431029 r1437050  
    1212
    1313// Delete most options (in rare cases some are kept).
    14 MULTITOOL_Options::uninstall();
     14MULTITOOL_Options::uninstall_options();
    1515?>
  • multitool/trunk/views/main.php

    r1428502 r1437050  
    268268                    $current = $multitool_settings['logsettings']['logscreen']['action'];
    269269                }
    270                 $action_results = $this->DB->log_queryactions( $current);
     270                $action_results = $this->log_queryactions( $current);
    271271                if( $action_results){
    272272                    foreach( $action_results as $key => $action){
  • multitool/trunk/views/socialaccounts.php

    r1420327 r1437050  
    9090        $accounts_data = array();
    9191        if( isset( $wpdb->webtechglobal_socialaccounts ) ) {
    92             $accounts_data = $this->DB->get_social_accounts();   
     92            $accounts_data = $this->get_social_accounts();   
    9393        } else {
    9494            // TODO Change this to a notice box with a link to install the service
  • multitool/trunk/views/socialtweets.php

    r1420327 r1437050  
    8787        $accounts_data = array();
    8888        if( isset( $wpdb->webtechglobal_socialaccounts ) ) {
    89             $accounts_data = $this->DB->get_social_tweets();   
     89            $accounts_data = $this->get_social_tweets();   
    9090        } else {
    9191            // TODO Change this to a notice box with a link to install the service
Note: See TracChangeset for help on using the changeset viewer.