Plugin Directory

Changeset 1369945


Ignore:
Timestamp:
03/12/2016 09:50:27 PM (10 years ago)
Author:
WebTechGlobal
Message:

Testing and debugging features added.

Location:
wtg-portal-manager/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • wtg-portal-manager/trunk/classes/class-adminui.php

    r1365903 r1369945  
    3434    *
    3535    * @author Ryan R. Bayne
    36     * @package Training Tools
     36    * @package WebTechGlobal WordPress Plugins
     37    * @version 1.2
     38    *
     39    * @todo this is still to be complete by adding arguments for each situation then changing the main action to "all" from "pluginpages", do not change "pluginpages" until arguments secure for each scenario.
     40    */
     41    function developer_toolbar() {
     42       
     43        self::developer_toolbar_webtechglobaladmin();
     44        self::developer_toolbar_front();
     45        self::developer_toolbar_coreviews();
     46        self::developer_toolbar_other();
     47       
     48    }
     49
     50    /**
     51    * The developer toolbar items for front/public side only.
     52    *
     53    * @author Ryan R. Bayne
     54    * @package WebTechGlobal WordPress Plugins
    3755    * @version 1.0
    3856    */
    39     function developer_toolbar() {
    40 
    41         global $wp_admin_bar;
    42        
    43         $args = array(
    44             'id'     => 'webtechglobal-toolbarmenu-developers',
    45             'title'  => __( 'Developers', 'text_domain' ),         
    46         );
    47         $wp_admin_bar->add_menu( $args );
    48        
    49         // error display switch       
    50         $href = wp_nonce_url( admin_url() . 'admin.php?page=' . $_GET['page'] . '&wtgportalmanageraction=' . 'debugmodeswitch'  . '', 'debugmodeswitch' );
    51         $debug_status = get_option( 'webtechglobal_displayerrors' );
    52         if($debug_status){
    53             $error_display_title = __( 'Hide Errors', 'wtgportalmanager' );
    54         } else {
    55             $error_display_title = __( 'Display Errors', 'wtgportalmanager' );
    56         }
    57         $args = array(
    58             'id'     => 'webtechglobal-toolbarmenu-errordisplay',
    59             'parent' => 'webtechglobal-toolbarmenu-developers',
    60             'title'  => $error_display_title,
    61             'href'   => $href,           
    62         );
    63        
    64         $wp_admin_bar->add_menu( $args );
    65        
    66         // reinstall plugin settings array     
    67         $href = wp_nonce_url( admin_url() . 'admin.php?page=' . $_GET['page'] . '&wtgportalmanageraction=' . 'wtgportalmanageractionreinstallsettings'  . '', 'wtgportalmanageractionreinstallsettings' );
    68         $args = array(
    69             'id'     => 'webtechglobal-toolbarmenu-reinstallsettings',
    70             'parent' => 'webtechglobal-toolbarmenu-developers',
    71             'title'  => __( 'Re-Install Settings', 'trainingtools' ),
    72             'href'   => $href,           
    73         );
    74        
    75         $wp_admin_bar->add_menu( $args );
    76        
    77         // reinstall all database tables
    78         $thisaction = 'wtgportalmanagerreinstalltables';
    79         $href = wp_nonce_url( admin_url() . 'admin.php?page=' . $_GET['page'] . '&wtgportalmanageraction=' . $thisaction, $thisaction );
    80         $args = array(
    81             'id'     => 'webtechglobal-toolbarmenu-reinstallalldatabasetables',
    82             'parent' => 'webtechglobal-toolbarmenu-developers',
    83             'title'  => __( 'Re-Install Tables', 'multitool' ),
    84             'href'   => $href,           
    85         );
    86 
    87         $wp_admin_bar->add_menu( $args );
    88     }
     57    function developer_toolbar_front() {
     58       
     59    }   
     60       
     61    /**
     62    * The developer toolbar items for all other views excluding WP core
     63    * views, WTG plugins and the front-end.
     64    *
     65    * @author Ryan R. Bayne
     66    * @package WebTechGlobal WordPress Plugins
     67    * @version 1.0
     68    */
     69    function developer_toolbar_coreviews() {
     70       
     71    }   
     72           
     73    /**
     74    * The developer toolbar items for all other views excluding WP core
     75    * views, WTG plugins and the front-end.
     76    *
     77    * @author Ryan R. Bayne
     78    * @package WebTechGlobal WordPress Plugins
     79    * @version 1.0
     80    */
     81    function developer_toolbar_other() {
     82       
     83    }   
    8984                           
    9085    /**
  • wtg-portal-manager/trunk/classes/class-configuration.php

    r1369147 r1369945  
    1717    const PROJECT_TYPE = 'Portals';
    1818    const PROJECTSYSTEM_SINGULAR = 'Portal';   
    19    
     19    public $wtgportalmanager_displaytrace = array();
     20   
     21    public function __construct() {
     22        global $wtgportalmanager_displaytrace;
     23       
     24        // load class used at all times
     25        $this->DB = self::load_class( 'WTGPORTALMANAGER_DB', 'class-wpdb.php', 'classes' );
     26        $this->PHP = self::load_class( 'WTGPORTALMANAGER_PHP', 'class-phplibrary.php', 'classes' );
     27        $this->Install = self::load_class( 'WTGPORTALMANAGER_Install', 'class-install.php', 'classes' );
     28        $this->Files = self::load_class( 'WTGPORTALMANAGER_Files', 'class-files.php', 'classes' );
     29        $this->GLOBALUI = self::load_class( 'WTGPORTALMANAGER_GLOBALUI', 'class-globalui.php', 'classes' );
     30       
     31    }
     32       
    2033    /**
    2134    * Plugins main actions.
     
    4760            array( 'init',                           'plugin_shortcodes',                                      'publicpages' ),           
    4861            array( 'widgets_init',                   'register_sidebars',                                      'all' ),
    49             array( 'wp_before_admin_bar_render',     array('admin_toolbars',999),                              'pluginscreens' ),
     62            array( 'wp_before_admin_bar_render',     array('admin_toolbars',999),                              'pluginscreensorfront' ),
    5063            array( 'init',                           'debugmode',                                              'administrator' ),                       
    5164        );   
     
    5871    * @package WebTechGlobal WordPress Plugins
    5972    * @version 1.0
     73    *
     74    * @todo requires the ability to pass a class name then use the class object during.
    6075    */
    6176    public function filters() {
    6277        return array(
    63             /*
    64                 Examples - last value are the sections the filter apply to
    65                     array( 'plugin_row_meta',                     array( 'examplefunction1', 10, 2),         'all' ),
    66                     array( 'page_link',                             array( 'examplefunction2', 10, 2),             'downloads' ),
    67                     array( 'admin_footer_text',                     'examplefunction3',                         'monetization' ),
    68                    
    69             */
     78            //array( 'wp_footer',                     array( 'examplefunction1', 10, 2),         'all' ),
    7079        );   
    7180    } 
     
    343352    }   
    344353
     354    /**
     355    * Add values to global tracking array which is used to output a list of
     356    * values and argument results. The output can be requested through the
     357    * Developer menu in the Admin Bar.
     358    *
     359    * @author Ryan R. Bayne
     360    * @package Multitool
     361    * @version 1.0
     362    */
     363    public function addtrace( $function, $line, $variable = null, $comment = null ) {
     364        global $wtgportalmanager_displaytrace;
     365        if( !is_array( $wtgportalmanager_displaytrace ) ) {
     366            $wtgportalmanager_displaytrace = array();
     367        }   
     368       
     369        $wtgportalmanager_displaytrace[] = array(
     370            'function' => $function,
     371            'line' => $line,
     372            'variable' => $variable,
     373            'comment' => $comment
     374        );
     375       
     376        return $wtgportalmanager_displaytrace;
     377    }   
    345378}
    346379?>
  • wtg-portal-manager/trunk/classes/class-install.php

    r1359834 r1369945  
    8383    *
    8484    * @author Ryan R. Bayne
    85     * @package Training Tools
     85    * @package WebTechGlobal WordPress Plugins
    8686    * @since 0.0.1
    8787    * @version 1.3
     
    208208    *
    209209    * @author Ryan R. Bayne
    210     * @package Training Tools
     210    * @package WebTechGlobal WordPress Plugins
    211211    * @since 0.0.3
    212212    * @version 1.0
  • wtg-portal-manager/trunk/classes/class-requests.php

    r1369147 r1369945  
    3333    public function __construct() {
    3434        global $wtgportalmanager_settings;
    35    
     35       
     36        /*   Commented March 2016 as moving away from __construct use.
    3637        // create class objects
    3738        $this->WTGPORTALMANAGER = WTGPORTALMANAGER::load_class( 'WTGPORTALMANAGER', 'class-wtgportalmanager.php', 'classes' ); # plugin specific functions
     
    4344        $this->Forms = $this->CONFIG->load_class( 'WTGPORTALMANAGER_Formbuilder', 'class-forms.php', 'classes' );
    4445        $this->WPCore = $this->CONFIG->load_class( 'WTGPORTALMANAGER_WPCore', 'class-wpcore.php', 'classes' );
    45         $this->PHPBB = $this->CONFIG->load_class( "WTGPORTALMANAGER_PHPBB", "class-phpbb.php", 'classes','pluginmenu' );                 
    46     }
    47    
     46        $this->PHPBB = $this->CONFIG->load_class( "WTGPORTALMANAGER_PHPBB", "class-phpbb.php", 'classes','pluginmenu' );   */               
     47    }
     48   
     49    public function init() {
     50
     51        $this->CONFIG = new WTGPORTALMANAGER_Configuration();
     52        $this->UI = $this->CONFIG->load_class( 'WTGPORTALMANAGER_ADMINUI', 'class-adminui.php', 'classes' ); # interface, mainly notices
     53        $this->DB = $this->CONFIG->load_class( 'WTGPORTALMANAGER_DB', 'class-wpdb.php', 'classes' ); # database interaction
     54        $this->PHP = $this->CONFIG->load_class( 'WTGPORTALMANAGER_PHP', 'class-phplibrary.php', 'classes' ); # php library by Ryan R. Bayne
     55        $this->Files = $this->CONFIG->load_class( 'WTGPORTALMANAGER_Files', 'class-files.php', 'classes' );
     56        $this->Forms = $this->CONFIG->load_class( 'WTGPORTALMANAGER_Formbuilder', 'class-forms.php', 'classes' );
     57        $this->WPCore = $this->CONFIG->load_class( 'WTGPORTALMANAGER_WPCore', 'class-wpcore.php', 'classes' );
     58        $this->PHPBB = $this->CONFIG->load_class( "WTGPORTALMANAGER_PHPBB", "class-phpbb.php", 'classes','pluginmenu' );
     59             
     60    }
    4861    /**
    4962    * Processes security for $_POST and $_GET requests,
     
    5770    */
    5871    public function process_admin_request( $method, $function ) {
    59  
     72         
    6073        $this->PHP->var_dump( $_POST, '<h1>$_POST</h1>' );           
    6174        $this->PHP->var_dump( $_GET, '<h1>$_GET</h1>' );   
  • wtg-portal-manager/trunk/classes/class-wtgportalmanager.php

    r1369147 r1369945  
    4040        );
    4141
     42       
     43    /**
     44     * Holds the singleton instance of this class as used in Jetpack.
     45     *
     46     * @since 1.0.0
     47     * @var WTGPORTALMANAGER
     48     */
     49    static $instance = false;
     50
     51    /**
     52     * Singleton approach as used in Jetpack
     53     * @static
     54     */
     55    public static function init() {
     56        if ( ! self::$instance ) {
     57            self::$instance = new WTGPORTALMANAGER;
     58        }
     59
     60        return self::$instance;
     61    }
     62   
    4263    public function __construct() {
    4364        global $wtgportalmanager_settings;
     
    4869        $this->Install = self::load_class( 'WTGPORTALMANAGER_Install', 'class-install.php', 'classes' );
    4970        $this->Files = self::load_class( 'WTGPORTALMANAGER_Files', 'class-files.php', 'classes' );
    50         $this->CONFIG = self::load_class( 'WTGPORTALMANAGER_Configuration', 'class-configuration.php', 'classes' );
    51        
     71        $this->GLOBALUI = self::load_class( 'WTGPORTALMANAGER_GLOBALUI', 'class-globalui.php', 'classes' );
     72               
    5273        // global settings are initialized in the main file
    5374        // however if the installations settings are missing this will install them
     
    5879        $this->add_filters(self::filters());
    5980
     81        add_action('wp_footer', array( $this->GLOBALUI, 'displaytrace' ) );
     82       
    6083        if( is_admin() ){
    6184       
     
    144167        // include the class that processes form submissions and nonce links
    145168        if( $method !== 'unknown' ) {   
    146             $WTGPORTALMANAGER_REQ = self::load_class( 'WTGPORTALMANAGER_Requests', 'class-requests.php', 'classes' );
     169            $WTGPORTALMANAGER_REQ = self::load_class( 'WTGPORTALMANAGER_Requests', 'class-requests.php', 'classes' );   
     170            $WTGPORTALMANAGER_REQ->init();
    147171            $WTGPORTALMANAGER_REQ->process_admin_request( $method, $function );
    148172        }
     
    162186        }   
    163187    }
    164    
    165     /**
    166     * Outputs latest updates.
     188   
     189    /**
     190    * Outputs latest updates from multiple sources. All sources are brought into
     191    * the same styling and layout.
    167192    *
    168193    * The plan is to compile a tidy list of updates from multiple sources...
     
    185210    */
    186211    public function portal_updates_shortcode( $atts ) {
    187                         
     212               
    188213        // if we do not have a portal ID - we will assume we are on a view that does not
    189214        // yet support it i.e. category with a list of posts.
     
    201226        global $wtgportalmanager_settings;
    202227
    203         // check for a cached list of items
    204         //delete_transient( 'wtgportalmanager_updatepage' . WTGPORTALMANAGER_PUBLIC_PROJECTID ); var_dump( 'Transient cache deleted during testing on line ' . __LINE__ );
    205         $cached_query = get_transient( 'wtgportalmanager_updatepage' . WTGPORTALMANAGER_PUBLIC_PROJECTID );
    206         if( $cached_query !== false ) {   
    207             return $cached_query;
    208         }
     228        // Handle Cache
     229        $cached_query = false;
     230        if( $this->GLOBALUI->is_view_control_requested( 'deletecaches' ) ) {   
     231            // Request using Developer toolbar to delete cache.
     232            delete_transient( 'wtgportalmanager_updatepage' . WTGPORTALMANAGER_PUBLIC_PROJECTID );
     233        } 
     234        else {
     235            $cached_query = get_transient( 'wtgportalmanager_updatepage' . WTGPORTALMANAGER_PUBLIC_PROJECTID );
     236            if( $cached_query !== false ) {   
     237               
     238                self::addtrace(
     239                    __FUNCTION__,
     240                    __LINE__,
     241                    '',
     242                    'Cache of updates exists and was returned.'
     243                );
     244               
     245                return $cached_query;
     246            }
     247            else {
     248                self::addtrace(
     249                    __FUNCTION__,
     250                    __LINE__,
     251                    $cached_query,
     252                    'No cache was found for the list of updates. Procedure will built a list..'
     253                );
     254            }
     255        }
    209256               
    210257        // get the current portals meta value for "updatepagesources" - it should return an array of applied data sources             
     
    229276        $newversions_status = false;
    230277        $pricedrop_status = false;
    231         $newtasks_status = false;  global $wtgportalmanager_settings;     
    232                  
     278        $newtasks_status = false; 
     279       
    233280        // load twitter status
    234281        if( isset( $wtgportalmanager_settings['api']['twitter']['active'] ) && $wtgportalmanager_settings['api']['twitter']['active'] == 'enabled' ) {
     
    309356            else {
    310357                $problem_found = 'The current portal does not have any Twitter credentials.';
     358                self::addtrace(
     359                    __FUNCTION__,
     360                    __LINE__,
     361                    $portals_api_credentials,
     362                    $problem_found
     363                );     
    311364            }
    312365
     
    314367            if( $problem_found !== false ) {
    315368
     369                self::addtrace(
     370                    __FUNCTION__,
     371                    __LINE__,
     372                    $problem_found,
     373                    'Problem was found so stepping into load default Twitter API credentials.'
     374                );
     375               
    316376                $default_api_credentials = $this->TWITTER->get_default_credentials();
    317377               
     
    357417            );
    358418       
    359             if( !isset( $result['error'] ) && is_array( $result ) ) {     
     419            if( isset( $result['error'] ) ) {
     420                self::addtrace(
     421                    __FUNCTION__,
     422                    __LINE__,
     423                    $result['error'],
     424                    'The startTwitter() call returned an error.'
     425                );             
     426            }
     427            elseif( !isset( $result['error'] ) && is_array( $result ) ) {     
    360428                       
    361429                foreach( $result as $key => $item ) {
     
    499567        // there is potential for the Updates page to be very demanding         
    500568        set_transient( 'wtgportalmanager_updatepage' . WTGPORTALMANAGER_PUBLIC_PROJECTID, $output, 60 );
    501                
     569 
    502570        return $output;
    503571    }
     
    722790    function admin_toolbars() {   
    723791        if( user_can( get_current_user_id(), 'activate_plugins' ) ) {
    724             $this->UI->developer_toolbar();
     792            $this->GLOBALUI->developer_toolbar();
    725793        }       
    726794    }
     
    10081076           
    10091077                if( isset( $_GET['page'] ) && strstr( $_GET['page'], 'wtgportalmanager' ) ){return true;}
     1078                return false;   
     1079               
     1080            break;           
     1081            case 'pluginscreensorfront':// load when on a WTG Portal Manager admin screen
     1082           
     1083                // Return true and allow the action to be registered if on a plugins own admin page.
     1084                if( isset( $_GET['page'] ) && strstr( $_GET['page'], 'wtgportalmanager' ) ){return true;}
     1085               
     1086                // Return true and allow the action to be registered if viewing the front end.
     1087                if( !is_admin() ) { return true; }
     1088               
    10101089                return false;   
    10111090               
     
    33453424        #                                                             #
    33463425        ###############################################################
    3347         $pf_array = $this->CONFIG->postformats();
     3426        //$pf_array = $this->CONFIG->postformats();
     3427        $pf_array = self::postformats();
    33483428       
    33493429        $post_array = array(
     
    34953575        return $capabilities_array;
    34963576    }
    3497                      
     3577         
    34983578}// end WTGPORTALMANAGER class
    34993579
  • wtg-portal-manager/trunk/readme.txt

    r1369147 r1369945  
    101101
    102102== Changelog ==
     103= 1.0.7 = 
     104* Feature Changes   
     105    * Developer menu for Admin Bar is now displayed on the frontside/public.
     106    * Ability to delete caches on a current view from the Developer menu.
     107* Technical Changes
     108    * class-globalui.php added and the class contains the developer menu which was moved from class-adminui.php.
     109 
    103110= 1.0.6  = 
    104111* Feature Changes   
  • wtg-portal-manager/trunk/views/main.php

    r1359302 r1369945  
    12091209    *
    12101210    * @author Ryan Bayne
    1211     * @package Training Tools
     1211    * @package WebTechGlobal WordPress Plugins
    12121212    * @since 0.0.3
    12131213    * @version 1.0
  • wtg-portal-manager/trunk/wtg-portal-manager.php

    r1369147 r1369945  
    22/*
    33Plugin Name: WTG Portal Manager Beta
    4 Version: 1.0.6
     4Version: 1.0.7
    55Plugin URI: http://www.webtechglobal.co.uk/
    66Description: Every service and product can have a portal on your WordPress site.
     
    4242
    4343// define constants, feel free to add some of your own...                             
    44 if(!defined( "WTGPORTALMANAGER_VERSION") ){define( "WTGPORTALMANAGER_VERSION", '1.0.6' );}
     44if(!defined( "WTGPORTALMANAGER_VERSION") ){define( "WTGPORTALMANAGER_VERSION", '1.0.7' );}
    4545if(!defined( "WTGPORTALMANAGER_NAME") ){define( "WTGPORTALMANAGER_NAME", 'WTG Portal Manager' );}
    4646if(!defined( "WTGPORTALMANAGER__FILE__") ){define( "WTGPORTALMANAGER__FILE__", __FILE__);}
     
    7878
    7979// call the Daddy methods here or remove some lines as a quick configuration approach...
     80//add_action( 'init', array( 'WTGPORTALMANAGER', 'init' ) );
    8081$WTGPORTALMANAGER = new WTGPORTALMANAGER();
    8182//$WTGPORTALMANAGER->custom_post_types();
Note: See TracChangeset for help on using the changeset viewer.