Changeset 1369945
- Timestamp:
- 03/12/2016 09:50:27 PM (10 years ago)
- Location:
- wtg-portal-manager/trunk
- Files:
-
- 8 edited
-
classes/class-adminui.php (modified) (1 diff)
-
classes/class-configuration.php (modified) (4 diffs)
-
classes/class-install.php (modified) (2 diffs)
-
classes/class-requests.php (modified) (3 diffs)
-
classes/class-wtgportalmanager.php (modified) (16 diffs)
-
readme.txt (modified) (1 diff)
-
views/main.php (modified) (1 diff)
-
wtg-portal-manager.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wtg-portal-manager/trunk/classes/class-adminui.php
r1365903 r1369945 34 34 * 35 35 * @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 37 55 * @version 1.0 38 56 */ 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 } 89 84 90 85 /** -
wtg-portal-manager/trunk/classes/class-configuration.php
r1369147 r1369945 17 17 const PROJECT_TYPE = 'Portals'; 18 18 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 20 33 /** 21 34 * Plugins main actions. … … 47 60 array( 'init', 'plugin_shortcodes', 'publicpages' ), 48 61 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' ), 50 63 array( 'init', 'debugmode', 'administrator' ), 51 64 ); … … 58 71 * @package WebTechGlobal WordPress Plugins 59 72 * @version 1.0 73 * 74 * @todo requires the ability to pass a class name then use the class object during. 60 75 */ 61 76 public function filters() { 62 77 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' ), 70 79 ); 71 80 } … … 343 352 } 344 353 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 } 345 378 } 346 379 ?> -
wtg-portal-manager/trunk/classes/class-install.php
r1359834 r1369945 83 83 * 84 84 * @author Ryan R. Bayne 85 * @package Training Tools85 * @package WebTechGlobal WordPress Plugins 86 86 * @since 0.0.1 87 87 * @version 1.3 … … 208 208 * 209 209 * @author Ryan R. Bayne 210 * @package Training Tools210 * @package WebTechGlobal WordPress Plugins 211 211 * @since 0.0.3 212 212 * @version 1.0 -
wtg-portal-manager/trunk/classes/class-requests.php
r1369147 r1369945 33 33 public function __construct() { 34 34 global $wtgportalmanager_settings; 35 35 36 /* Commented March 2016 as moving away from __construct use. 36 37 // create class objects 37 38 $this->WTGPORTALMANAGER = WTGPORTALMANAGER::load_class( 'WTGPORTALMANAGER', 'class-wtgportalmanager.php', 'classes' ); # plugin specific functions … … 43 44 $this->Forms = $this->CONFIG->load_class( 'WTGPORTALMANAGER_Formbuilder', 'class-forms.php', 'classes' ); 44 45 $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 } 48 61 /** 49 62 * Processes security for $_POST and $_GET requests, … … 57 70 */ 58 71 public function process_admin_request( $method, $function ) { 59 72 60 73 $this->PHP->var_dump( $_POST, '<h1>$_POST</h1>' ); 61 74 $this->PHP->var_dump( $_GET, '<h1>$_GET</h1>' ); -
wtg-portal-manager/trunk/classes/class-wtgportalmanager.php
r1369147 r1369945 40 40 ); 41 41 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 42 63 public function __construct() { 43 64 global $wtgportalmanager_settings; … … 48 69 $this->Install = self::load_class( 'WTGPORTALMANAGER_Install', 'class-install.php', 'classes' ); 49 70 $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 52 73 // global settings are initialized in the main file 53 74 // however if the installations settings are missing this will install them … … 58 79 $this->add_filters(self::filters()); 59 80 81 add_action('wp_footer', array( $this->GLOBALUI, 'displaytrace' ) ); 82 60 83 if( is_admin() ){ 61 84 … … 144 167 // include the class that processes form submissions and nonce links 145 168 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(); 147 171 $WTGPORTALMANAGER_REQ->process_admin_request( $method, $function ); 148 172 } … … 162 186 } 163 187 } 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. 167 192 * 168 193 * The plan is to compile a tidy list of updates from multiple sources... … … 185 210 */ 186 211 public function portal_updates_shortcode( $atts ) { 187 212 188 213 // if we do not have a portal ID - we will assume we are on a view that does not 189 214 // yet support it i.e. category with a list of posts. … … 201 226 global $wtgportalmanager_settings; 202 227 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 } 209 256 210 257 // get the current portals meta value for "updatepagesources" - it should return an array of applied data sources … … 229 276 $newversions_status = false; 230 277 $pricedrop_status = false; 231 $newtasks_status = false; global $wtgportalmanager_settings;232 278 $newtasks_status = false; 279 233 280 // load twitter status 234 281 if( isset( $wtgportalmanager_settings['api']['twitter']['active'] ) && $wtgportalmanager_settings['api']['twitter']['active'] == 'enabled' ) { … … 309 356 else { 310 357 $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 ); 311 364 } 312 365 … … 314 367 if( $problem_found !== false ) { 315 368 369 self::addtrace( 370 __FUNCTION__, 371 __LINE__, 372 $problem_found, 373 'Problem was found so stepping into load default Twitter API credentials.' 374 ); 375 316 376 $default_api_credentials = $this->TWITTER->get_default_credentials(); 317 377 … … 357 417 ); 358 418 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 ) ) { 360 428 361 429 foreach( $result as $key => $item ) { … … 499 567 // there is potential for the Updates page to be very demanding 500 568 set_transient( 'wtgportalmanager_updatepage' . WTGPORTALMANAGER_PUBLIC_PROJECTID, $output, 60 ); 501 569 502 570 return $output; 503 571 } … … 722 790 function admin_toolbars() { 723 791 if( user_can( get_current_user_id(), 'activate_plugins' ) ) { 724 $this-> UI->developer_toolbar();792 $this->GLOBALUI->developer_toolbar(); 725 793 } 726 794 } … … 1008 1076 1009 1077 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 1010 1089 return false; 1011 1090 … … 3345 3424 # # 3346 3425 ############################################################### 3347 $pf_array = $this->CONFIG->postformats(); 3426 //$pf_array = $this->CONFIG->postformats(); 3427 $pf_array = self::postformats(); 3348 3428 3349 3429 $post_array = array( … … 3495 3575 return $capabilities_array; 3496 3576 } 3497 3577 3498 3578 }// end WTGPORTALMANAGER class 3499 3579 -
wtg-portal-manager/trunk/readme.txt
r1369147 r1369945 101 101 102 102 == 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 103 110 = 1.0.6 = 104 111 * Feature Changes -
wtg-portal-manager/trunk/views/main.php
r1359302 r1369945 1209 1209 * 1210 1210 * @author Ryan Bayne 1211 * @package Training Tools1211 * @package WebTechGlobal WordPress Plugins 1212 1212 * @since 0.0.3 1213 1213 * @version 1.0 -
wtg-portal-manager/trunk/wtg-portal-manager.php
r1369147 r1369945 2 2 /* 3 3 Plugin Name: WTG Portal Manager Beta 4 Version: 1.0. 64 Version: 1.0.7 5 5 Plugin URI: http://www.webtechglobal.co.uk/ 6 6 Description: Every service and product can have a portal on your WordPress site. … … 42 42 43 43 // define constants, feel free to add some of your own... 44 if(!defined( "WTGPORTALMANAGER_VERSION") ){define( "WTGPORTALMANAGER_VERSION", '1.0. 6' );}44 if(!defined( "WTGPORTALMANAGER_VERSION") ){define( "WTGPORTALMANAGER_VERSION", '1.0.7' );} 45 45 if(!defined( "WTGPORTALMANAGER_NAME") ){define( "WTGPORTALMANAGER_NAME", 'WTG Portal Manager' );} 46 46 if(!defined( "WTGPORTALMANAGER__FILE__") ){define( "WTGPORTALMANAGER__FILE__", __FILE__);} … … 78 78 79 79 // call the Daddy methods here or remove some lines as a quick configuration approach... 80 //add_action( 'init', array( 'WTGPORTALMANAGER', 'init' ) ); 80 81 $WTGPORTALMANAGER = new WTGPORTALMANAGER(); 81 82 //$WTGPORTALMANAGER->custom_post_types();
Note: See TracChangeset
for help on using the changeset viewer.