Changeset 2024613
- Timestamp:
- 02/04/2019 01:11:13 PM (7 years ago)
- Location:
- channel-solution-for-twitch
- Files:
-
- 213 added
- 15 deleted
- 30 edited
-
tags/1.4.1 (deleted)
-
tags/1.4.2 (deleted)
-
tags/1.4.3 (deleted)
-
tags/1.5.1 (deleted)
-
tags/1.5.2 (deleted)
-
tags/1.5.3 (deleted)
-
tags/1.5.4 (deleted)
-
tags/1.5.5 (deleted)
-
tags/1.5.6 (deleted)
-
tags/1.5.7 (deleted)
-
tags/1.6.2 (deleted)
-
tags/1.6.3 (deleted)
-
tags/1.6.4 (deleted)
-
tags/1.6.5 (deleted)
-
tags/2.17.0 (added)
-
tags/2.17.0/assets (added)
-
tags/2.17.0/assets/css (added)
-
tags/2.17.0/assets/css/activation.css (added)
-
tags/2.17.0/assets/css/activation.scss (added)
-
tags/2.17.0/assets/css/admin.css (added)
-
tags/2.17.0/assets/css/admin.scss (added)
-
tags/2.17.0/assets/css/twitchpress-setup.css (added)
-
tags/2.17.0/assets/css/twitchpress-setup.scss (added)
-
tags/2.17.0/assets/images (added)
-
tags/2.17.0/assets/images/twitchpress_logo.png (added)
-
tags/2.17.0/assets/js (added)
-
tags/2.17.0/assets/js/admin (added)
-
tags/2.17.0/assets/js/admin/twitchpress-enhanced-select.js (added)
-
tags/2.17.0/assets/js/admin/twitchpress-enhanced-select.min.js (added)
-
tags/2.17.0/assets/js/admin/twitchpress-faq.js (added)
-
tags/2.17.0/assets/js/admin/twitchpress-faq.min.js (added)
-
tags/2.17.0/assets/js/admin/twitchpress-setup.js (added)
-
tags/2.17.0/assets/js/admin/twitchpress-setup.min.js (added)
-
tags/2.17.0/assets/js/jquery-blockui (added)
-
tags/2.17.0/assets/js/jquery-blockui/jquery.blockUI.js (added)
-
tags/2.17.0/assets/js/jquery-blockui/jquery.blockUI.min.js (added)
-
tags/2.17.0/assets/js/select2 (added)
-
tags/2.17.0/assets/js/select2/select2.js (added)
-
tags/2.17.0/assets/js/select2/select2.min.js (added)
-
tags/2.17.0/deprecated.php (added)
-
tags/2.17.0/extensions.php (added)
-
tags/2.17.0/functions.php (added)
-
tags/2.17.0/i18n (added)
-
tags/2.17.0/i18n/languages (added)
-
tags/2.17.0/i18n/languages/twitchpress-en_US.mo (added)
-
tags/2.17.0/i18n/languages/twitchpress-en_US.po (added)
-
tags/2.17.0/i18n/languages/twitchpress.pot (added)
-
tags/2.17.0/includes (added)
-
tags/2.17.0/includes/admin (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-assets.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-dashboard.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-data-views.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-deactivate.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-help.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-main-views.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-menus.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-notices.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-pointers.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-quicktools.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-settings.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-setup-wizard.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-tools-views.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin-twitchfeed-posts.php (added)
-
tags/2.17.0/includes/admin/class.twitchpress-admin.php (added)
-
tags/2.17.0/includes/admin/functions.twitchpress-admin.php (added)
-
tags/2.17.0/includes/admin/mainviews (added)
-
tags/2.17.0/includes/admin/mainviews/class.twitchpress-animal-advanced.php (added)
-
tags/2.17.0/includes/admin/mainviews/class.twitchpress-animal-items.php (added)
-
tags/2.17.0/includes/admin/mainviews/class.twitchpress-default-advanced.php (added)
-
tags/2.17.0/includes/admin/mainviews/class.twitchpress-default-items.php (added)
-
tags/2.17.0/includes/admin/mainviews/class.twitchpress-food-advanced.php (added)
-
tags/2.17.0/includes/admin/mainviews/class.twitchpress-food-items.php (added)
-
tags/2.17.0/includes/admin/mainviews/class.twitchpress-listtable-demo-advanced.php (added)
-
tags/2.17.0/includes/admin/mainviews/class.twitchpress-listtable-demo.php (added)
-
tags/2.17.0/includes/admin/mainviews/class.twitchpress-team-advanced.php (added)
-
tags/2.17.0/includes/admin/mainviews/class.twitchpress-team-items.php (added)
-
tags/2.17.0/includes/admin/notices (added)
-
tags/2.17.0/includes/admin/notices/custom.php (added)
-
tags/2.17.0/includes/admin/notices/install.php (added)
-
tags/2.17.0/includes/admin/notices/update.php (added)
-
tags/2.17.0/includes/admin/notices/updated.php (added)
-
tags/2.17.0/includes/admin/notices/updating.php (added)
-
tags/2.17.0/includes/admin/settings (added)
-
tags/2.17.0/includes/admin/settings/class.twitchpress-settings-feeds.php (added)
-
tags/2.17.0/includes/admin/settings/class.twitchpress-settings-general.php (added)
-
tags/2.17.0/includes/admin/settings/class.twitchpress-settings-kraken.php (added)
-
tags/2.17.0/includes/admin/settings/class.twitchpress-settings-otherapi.php (added)
-
tags/2.17.0/includes/admin/settings/class.twitchpress-settings-page.php (added)
-
tags/2.17.0/includes/admin/settings/class.twitchpress-settings-readonly.php (added)
-
tags/2.17.0/includes/admin/settings/class.twitchpress-settings-users.php (added)
-
tags/2.17.0/includes/admin/views (added)
-
tags/2.17.0/includes/admin/views/dataviews (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-all-actionhooks.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-all-apierrors.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-all-apiresponses.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-all-dailylogs.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-all-kraken5requests.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-allcachetraces-bugnet.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-last10cachetraces-bugnet.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-lasthourcachetraces-bugnet.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-listtable-actionhooks.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-listtable-apierrors.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-listtable-apiresponses.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-listtable-daily-logs.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-listtable-demo-bugnet.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-listtable-krakencalls.php (added)
-
tags/2.17.0/includes/admin/views/dataviews/class.twitchpress-todayscachetraces-bugnet.php (added)
-
tags/2.17.0/includes/admin/views/html-admin-data.php (added)
-
tags/2.17.0/includes/admin/views/html-admin-page.php (added)
-
tags/2.17.0/includes/admin/views/html-admin-settings.php (added)
-
tags/2.17.0/includes/admin/views/toolsviews (added)
-
tags/2.17.0/includes/admin/views/toolsviews/class.twitchpress-listtable-accounts.php (added)
-
tags/2.17.0/includes/admin/views/toolsviews/class.twitchpress-listtable-tools.php (added)
-
tags/2.17.0/includes/admin/views/toolsviews/class.twitchpress-tools-all.php (added)
-
tags/2.17.0/includes/class.twitchpress-ajax.php (added)
-
tags/2.17.0/includes/class.twitchpress-autoloader.php (added)
-
tags/2.17.0/includes/class.twitchpress-background-updater.php (added)
-
tags/2.17.0/includes/class.twitchpress-curl.php (added)
-
tags/2.17.0/includes/class.twitchpress-extend-wp-http-curl.php (added)
-
tags/2.17.0/includes/class.twitchpress-extension-installer.php (added)
-
tags/2.17.0/includes/class.twitchpress-frontend-scripts.php (added)
-
tags/2.17.0/includes/class.twitchpress-history.php (added)
-
tags/2.17.0/includes/class.twitchpress-listener-main-account-oauth.php (added)
-
tags/2.17.0/includes/class.twitchpress-listener.php (added)
-
tags/2.17.0/includes/class.twitchpress-logger.php (added)
-
tags/2.17.0/includes/class.twitchpress-object-registry.php (added)
-
tags/2.17.0/includes/class.twitchpress-options.php (added)
-
tags/2.17.0/includes/class.twitchpress-post-types.php (added)
-
tags/2.17.0/includes/class.twitchpress-public-preset-notices.php (added)
-
tags/2.17.0/includes/class.twitchpress-set-app.php (added)
-
tags/2.17.0/includes/class.twitchpress-set-main-channel-auth.php (added)
-
tags/2.17.0/includes/class.twitchpress-set-user-auth.php (added)
-
tags/2.17.0/includes/class.twitchpress-sync.php (added)
-
tags/2.17.0/includes/external (added)
-
tags/2.17.0/includes/external/class.twitchpress-wordpressorg.php (added)
-
tags/2.17.0/includes/functions.twitchpress-depreciated.php (added)
-
tags/2.17.0/includes/functions.twitchpress-formatting.php (added)
-
tags/2.17.0/includes/functions.twitchpress-frontend-notices.php (added)
-
tags/2.17.0/includes/functions.twitchpress-frontend.php (added)
-
tags/2.17.0/includes/functions.twitchpress-get.php (added)
-
tags/2.17.0/includes/functions.twitchpress-sanitize.php (added)
-
tags/2.17.0/includes/functions.twitchpress-shortcodes.php (added)
-
tags/2.17.0/includes/functions.twitchpress-validate.php (added)
-
tags/2.17.0/includes/functions.twitchpress-widgets.php (added)
-
tags/2.17.0/includes/libraries (added)
-
tags/2.17.0/includes/libraries/allapi (added)
-
tags/2.17.0/includes/libraries/allapi/class.all-api.php (added)
-
tags/2.17.0/includes/libraries/allapi/loader.php (added)
-
tags/2.17.0/includes/libraries/allapi/streamlabs (added)
-
tags/2.17.0/includes/libraries/allapi/streamlabs/class.api-streamlabs.php (added)
-
tags/2.17.0/includes/libraries/allapi/streamlabs/functions.api-streamlabs-endpoints.php (added)
-
tags/2.17.0/includes/libraries/allapi/streamlabs/functions.api-streamlabs-statuses.php (added)
-
tags/2.17.0/includes/libraries/bugnet (added)
-
tags/2.17.0/includes/libraries/bugnet/assets (added)
-
tags/2.17.0/includes/libraries/bugnet/assets/css (added)
-
tags/2.17.0/includes/libraries/bugnet/assets/css/bugnet.css (added)
-
tags/2.17.0/includes/libraries/bugnet/changes.txt (added)
-
tags/2.17.0/includes/libraries/bugnet/class.bugnet-configuration.php (added)
-
tags/2.17.0/includes/libraries/bugnet/class.bugnet-install.php (added)
-
tags/2.17.0/includes/libraries/bugnet/class.bugnet-rules.php (added)
-
tags/2.17.0/includes/libraries/bugnet/class.bugnet-uninstall.php (added)
-
tags/2.17.0/includes/libraries/bugnet/class.bugnet.php (added)
-
tags/2.17.0/includes/libraries/bugnet/handlers (added)
-
tags/2.17.0/includes/libraries/bugnet/handlers/class.bugnet-handler-api.php (added)
-
tags/2.17.0/includes/libraries/bugnet/handlers/class.bugnet-handler-email.php (added)
-
tags/2.17.0/includes/libraries/bugnet/handlers/class.bugnet-handler-logfiles.php (added)
-
tags/2.17.0/includes/libraries/bugnet/handlers/class.bugnet-handler-tracing.php (added)
-
tags/2.17.0/includes/libraries/bugnet/handlers/class.bugnet-handler-wpdb.php (added)
-
tags/2.17.0/includes/libraries/bugnet/notices (added)
-
tags/2.17.0/includes/libraries/bugnet/notices/class.bugnet-notices-administratorpermanent.php (added)
-
tags/2.17.0/includes/libraries/bugnet/notices/class.bugnet-notices-administrators.php (added)
-
tags/2.17.0/includes/libraries/bugnet/notices/class.bugnet-notices-wpdieadministrators.php (added)
-
tags/2.17.0/includes/libraries/bugnet/notices/class.bugnet-notices-wpdiepublic.php (added)
-
tags/2.17.0/includes/libraries/bugnet/readme.txt (added)
-
tags/2.17.0/includes/libraries/bugnet/reports (added)
-
tags/2.17.0/includes/libraries/bugnet/reports/class.bugnet-reports-dailysummary.php (added)
-
tags/2.17.0/includes/libraries/bugnet/reports/class.bugnet-reports-eventsnapshot.php (added)
-
tags/2.17.0/includes/libraries/bugnet/reports/class.bugnet-reports-tracecomplete.php (added)
-
tags/2.17.0/includes/libraries/bugnet/views (added)
-
tags/2.17.0/includes/libraries/bugnet/views/class.bugnet-views-livelog.php (added)
-
tags/2.17.0/includes/libraries/bugnet/views/class.bugnet-views-logdata.php (added)
-
tags/2.17.0/includes/libraries/bugnet/views/class.bugnet-views-logfiles.php (added)
-
tags/2.17.0/includes/libraries/bugnet/views/class.bugnet-views-rulescreate.php (added)
-
tags/2.17.0/includes/libraries/bugnet/views/class.bugnet-views-rulestable.php (added)
-
tags/2.17.0/includes/libraries/bugnet/views/class.bugnet-views-settings.php (added)
-
tags/2.17.0/includes/libraries/class.async-request.php (added)
-
tags/2.17.0/includes/libraries/class.background-process.php (added)
-
tags/2.17.0/includes/libraries/library.async-request.php (added)
-
tags/2.17.0/includes/libraries/library.background-process.php (added)
-
tags/2.17.0/includes/libraries/library.twitchbot.php (added)
-
tags/2.17.0/includes/libraries/twitch (added)
-
tags/2.17.0/includes/libraries/twitch/helix (added)
-
tags/2.17.0/includes/libraries/twitch/helix/class.twitch-api-sandbox.php (added)
-
tags/2.17.0/includes/libraries/twitch/helix/class.twitch-api.php (added)
-
tags/2.17.0/includes/libraries/twitch/helix/class.twitch-webhooks.php (added)
-
tags/2.17.0/includes/libraries/twitch/helix/function.twitch-webhooks.php (added)
-
tags/2.17.0/includes/libraries/twitch/helix/functions.twitch-api-endpoints.php (added)
-
tags/2.17.0/includes/libraries/twitch/helix/functions.twitch-api-statuses.php (added)
-
tags/2.17.0/includes/libraries/twitch/kraken (added)
-
tags/2.17.0/includes/libraries/twitch/kraken/class.twitch-api-calls.php (added)
-
tags/2.17.0/includes/libraries/twitch/kraken/class.twitch-api.php (added)
-
tags/2.17.0/includes/libraries/twitch/kraken/functions.twitch-api-endpoints.php (added)
-
tags/2.17.0/includes/libraries/twitch/kraken/functions.twitch-api-statuses.php (added)
-
tags/2.17.0/includes/libraries/twitter (added)
-
tags/2.17.0/includes/libraries/twitter/class.twitter-api.php (added)
-
tags/2.17.0/includes/libraries/twitter/class.twitter-calls.php (added)
-
tags/2.17.0/includes/libraries/twitter/class.twitter-endpoints.php (added)
-
tags/2.17.0/includes/shortcodes (added)
-
tags/2.17.0/includes/shortcodes/shortcode-sync-buttons-public.php (added)
-
tags/2.17.0/includes/toolbars (added)
-
tags/2.17.0/includes/toolbars/class.twitchpress-toolbar-developers.php (added)
-
tags/2.17.0/includes/toolbars/class.twitchpress-toolbars.php (added)
-
tags/2.17.0/includes/widgets (added)
-
tags/2.17.0/includes/widgets/functions.twitchpress-widget-example.php (added)
-
tags/2.17.0/install.php (added)
-
tags/2.17.0/integration.php (added)
-
tags/2.17.0/license.txt (added)
-
tags/2.17.0/loader.php (added)
-
tags/2.17.0/meta.php (added)
-
tags/2.17.0/options.php (added)
-
tags/2.17.0/readme.txt (added)
-
tags/2.17.0/requests.php (added)
-
tags/2.17.0/shortcodes.php (added)
-
tags/2.17.0/twitchpress.php (added)
-
tags/2.17.0/uninstall.php (added)
-
trunk (modified) (1 prop)
-
trunk/deprecated.php (added)
-
trunk/depreciated.php (deleted)
-
trunk/functions.php (modified) (13 diffs)
-
trunk/includes/admin/class.twitchpress-admin-help.php (modified) (16 diffs)
-
trunk/includes/admin/class.twitchpress-admin-menus.php (modified) (1 diff)
-
trunk/includes/admin/class.twitchpress-admin-notices.php (modified) (5 diffs)
-
trunk/includes/admin/class.twitchpress-admin-quicktools.php (modified) (4 diffs)
-
trunk/includes/admin/class.twitchpress-admin-setup-wizard.php (modified) (12 diffs)
-
trunk/includes/admin/settings/class.twitchpress-settings-general.php (modified) (7 diffs)
-
trunk/includes/admin/settings/class.twitchpress-settings-kraken.php (modified) (4 diffs)
-
trunk/includes/admin/views/html-admin-data.php (modified) (1 diff)
-
trunk/includes/admin/views/html-admin-page.php (modified) (1 diff)
-
trunk/includes/admin/views/html-admin-settings.php (modified) (1 diff)
-
trunk/includes/class.twitchpress-curl.php (modified) (14 diffs)
-
trunk/includes/class.twitchpress-extend-wp-http-curl.php (added)
-
trunk/includes/class.twitchpress-listener-main-account-oauth.php (modified) (8 diffs)
-
trunk/includes/class.twitchpress-listener.php (modified) (1 diff)
-
trunk/includes/class.twitchpress-post-types.php (modified) (4 diffs)
-
trunk/includes/class.twitchpress-set-app.php (modified) (11 diffs)
-
trunk/includes/class.twitchpress-sync.php (modified) (4 diffs)
-
trunk/includes/functions.twitchpress-frontend-notices.php (modified) (1 diff)
-
trunk/includes/functions.twitchpress-shortcodes.php (modified) (9 diffs)
-
trunk/includes/libraries/bugnet/class.bugnet.php (modified) (6 diffs)
-
trunk/includes/libraries/bugnet/handlers/class.bugnet-handler-tracing.php (modified) (17 diffs)
-
trunk/includes/libraries/bugnet/readme.txt (modified) (1 diff)
-
trunk/includes/libraries/twitch/kraken/class.twitch-api-calls.php (modified) (5 diffs)
-
trunk/includes/libraries/twitch/kraken/class.twitch-api.php (modified) (4 diffs)
-
trunk/loader.php (modified) (7 diffs)
-
trunk/options.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/twitchpress.php (modified) (2 diffs)
-
trunk/uninstall.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
channel-solution-for-twitch/trunk
-
Property
svn:ignore
set to
depreciated.php
-
Property
svn:ignore
set to
-
channel-solution-for-twitch/trunk/functions.php
r1977739 r2024613 2 2 add_filter( 'get_avatar', 'twitchpress_slug_get_avatar', 10, 5 ); 3 3 function twitchpress_slug_get_avatar( $avatar, $id_or_email, $size, $default, $alt = '' ) { 4 5 //If is email, try and find user ID 6 if( ! is_numeric( $id_or_email ) && is_email( $id_or_email ) ){7 $user =get_user_by( 'email', $id_or_email );4 5 //If is email, try and find user ID... 6 if( !is_numeric( $id_or_email ) ){ 7 $user = get_user_by( 'email', $id_or_email ); 8 8 if( $user ){ 9 9 $id_or_email = $user->ID; … … 11 11 } 12 12 13 // if not user ID, return14 if( ! is_numeric( $id_or_email ) ){13 //If still no user ID, return... 14 if( !is_numeric( $id_or_email ) ){ 15 15 return $avatar; 16 16 } 17 17 18 //Find URL of saved avatar in user meta 18 //Find URL of saved avatar in user meta... 19 19 $saved = get_user_meta( $id_or_email, 'twitchpress_avatar_url', true ); 20 20 … … 105 105 'channel_commercial' => array(), 106 106 'channel_editor' => array(), 107 'channel_feed_edit' => array(),108 'channel_feed_read' => array(),109 107 'channel_read' => array(), 110 108 'channel_stream' => array(), 111 109 'channel_subscriptions' => array(), 112 'chat_login' => array(),113 110 'collections_edit' => array(), 114 111 'communities_edit' => array(), … … 148 145 $scope['user_subscriptions']['label'] = __( 'Get Your Subscriptions', 'twitchpress' ); 149 146 $scope['channel_check_subscription']['label'] = __( 'Check Viewers Subscription', 'twitchpress' ); 150 $scope['chat_login']['label'] = __( 'Chat Permission', 'twitchpress' );151 $scope['channel_feed_read']['label'] = __( 'Get Channel Feed', 'twitchpress' );152 $scope['channel_feed_edit']['label'] = __( 'Post To Channels Feed', 'twitchpress' );153 147 $scope['communities_edit']['label'] = __( 'Manage Users Communities', 'twitchpress' ); 154 148 $scope['communities_moderate']['label'] = __( 'Manage Community Moderators', 'twitchpress' ); … … 179 173 $scope['user_subscriptions']['apidesc'] = __( 'Read access to subscriptions of a user.', 'twitchpress' ); 180 174 $scope['channel_check_subscription']['apidesc'] = __( 'Read access to check if a user is subscribed to your channel.', 'twitchpress' ); 181 $scope['chat_login']['apidesc'] = __( 'Ability to log into chat and send messages', 'twitchpress' );182 $scope['channel_feed_read']['apidesc'] = __( 'Ability to view to a channel feed.', 'twitchpress' );183 $scope['channel_feed_edit']['apidesc'] = __( 'Ability to add posts and reactions to a channel feed.', 'twitchpress' );184 175 $scope['communities_edit']['apidesc'] = __( 'Manage a user’s communities.', 'twitchpress' ); 185 176 $scope['communities_moderate']['apidesc'] = __( 'Manage community moderators.', 'twitchpress' ); … … 210 201 $scope['user_subscriptions']['userdesc'] = __( 'Permission to get your subscriptions.', 'twitchpress' ); 211 202 $scope['channel_check_subscription']['userdesc'] = __( 'Read access to check if a user is subscribed to your channel.', 'twitchpress' ); 212 $scope['chat_login']['userdesc'] = __( 'Ability to log into your chat and send messages', 'twitchpress' );213 $scope['channel_feed_read']['userdesc'] = __( 'Ability to import your channel feed.', 'twitchpress' );214 $scope['channel_feed_edit']['userdesc'] = __( 'Ability to add posts and reactions to your channel feed.', 'twitchpress' );215 203 $scope['communities_edit']['userdesc'] = __( 'Manage your user’s communities.', 'twitchpress' ); 216 204 $scope['communities_moderate']['userdesc'] = __( 'Manage your community moderators.', 'twitchpress' ); … … 747 735 748 736 // Build oauth2 URL. 749 $url = 'https:// api.twitch.tv/kraken/oauth2/authorize?' .737 $url = 'https://id.twitch.tv/oauth2/authorize?' . 750 738 'response_type=code' . '&' . 751 739 'client_id=' . twitchpress_get_app_id() . '&' . … … 798 786 * running none urgent tasks during existing operations and demanding requests. 799 787 */ 800 function twitchpress_is_background_process() { 788 function twitchpress_is_background_process() { 801 789 if ( ( 'wp-login.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) ) 802 790 || ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) … … 1036 1024 */ 1037 1025 function twitchpress_was_valid_token_returned( $returned_value ){ 1038 1039 if( !array( $returned_value ) ) { 1026 1027 if( !array( $returned_value ) ) { 1040 1028 return false; 1041 1029 } … … 1051 1039 return true; 1052 1040 } 1041 1042 /** 1043 * A helix function for confirming access 1044 * 1045 * @returns boolean true if the value appears normal. 1046 * 1047 * @version 1.0 1048 */ 1049 function twitchpress_was_valid_token_returned_from_helix( $returned_value ){ 1050 1051 if( !is_object( $returned_value ) ) { 1052 return false; 1053 } 1054 1055 if( !isset( $returned_value->access_token ) ) { 1056 return false; 1057 } 1058 1059 if( !twitchpress_validate_token( $returned_value->access_token ) ) { 1060 return false; 1061 } 1062 1063 return true; 1064 } 1053 1065 1054 1066 /** … … 1235 1247 return; 1236 1248 } 1237 1238 1249 1239 1250 // Tracking adds more values to help trace where redirect was requested. 1240 if( get_option( 'twitch ress_redirect_tracking_switch' ) == 'yes' )1251 if( get_option( 'twitchpress_redirect_tracking_switch' ) == 'yes' ) 1241 1252 { 1242 1253 $url = add_query_arg( array( 'redirected-line' => $line, 'redirected-function' => $function ), esc_url_raw( $url ) ); … … 1303 1314 } 1304 1315 1305 function twitchpress_var_dump( $var ) { 1306 return var_dump_twitchpress( $var ); 1316 function twitchpress_var_dump( $var, $function = null, $line = null, $file = null, $wp_die = false ) { 1317 1318 if( !twitchpress_are_errors_allowed() ){ return false; } 1319 1320 $header = ''; 1321 if( $function ) { 1322 $header .= 'Function: ' . $function . ' '; 1323 } 1324 if( $line ) { 1325 $header .= 'Line: ' . $line . ' '; 1326 } 1327 if( $file ) { 1328 $header .= 'File: ' . $file . ' '; 1329 } 1330 if( $header ) { 1331 echo '<h4>' . $header . '</h4>'; 1332 } 1333 1334 if( !function_exists( 'wp_get_current_user' ) ) { return null; } 1335 1336 echo '<pre>'; var_dump( $var ); echo '</pre>'; 1337 1338 if( $wp_die ) { 1339 wp_die(); 1340 } 1307 1341 } 1308 1342 … … 1321 1355 */ 1322 1356 function twitchpress_are_errors_allowed() { 1323 if( twitchpress_is_background_process() ) { 1357 1358 if( twitchpress_is_background_process() ) { 1324 1359 return false; 1325 } 1326 1360 } 1361 1327 1362 if( !get_option( 'twitchpress_displayerrors' ) || get_option( 'twitchpress_displayerrors' ) !== 'yes' ) { 1328 return false;1363 return false; 1329 1364 } 1330 1365 1331 1366 // We can bypass the protection to display errors for a specified user. 1332 if( 'BYPASS' == get_option( 'bugnet_error_dump_user_id') ) { 1333 return true;1367 if( 'BYPASS' == get_option( 'bugnet_error_dump_user_id') ) { 1368 return true; 1334 1369 } 1335 1370 1336 1371 // A value of ADMIN allows anyone with "activate_plugins" permission to see errors. 1337 if( !current_user_can( 'activate_plugins' ) ) { 1338 return false;1372 if( !current_user_can( 'activate_plugins' ) ) { 1373 return false; 1339 1374 } 1340 elseif( 'ADMIN' == get_option( 'bugnet_error_dump_user_id') ) { 1341 return true;1342 } 1343 1375 elseif( 'ADMIN' == get_option( 'bugnet_error_dump_user_id') ) { 1376 return true; 1377 } 1378 1344 1379 // Match current users ID to the entered ID which restricts error display to a single user. 1345 if( get_current_user_id() != get_option( 'bugnet_error_dump_user_id') ) { 1346 return false;1380 if( get_current_user_id() != get_option( 'bugnet_error_dump_user_id') ) { 1381 return false; 1347 1382 } 1348 1383 -
channel-solution-for-twitch/trunk/includes/admin/class.twitchpress-admin-help.php
r1969461 r2024613 23 23 * Hook in tabs. 24 24 */ 25 public function __construct() { 25 public function __construct() { 26 26 add_action( 'current_screen', array( $this, 'add_tabs' ), 50 ); 27 28 // Get the Twitch applications status... 29 $set_app = new TwitchPress_Set_App(); 30 $this->set_app_status = $set_app->status(); 31 32 // The admin help offers a link for the admin to go through oAuth... 33 $state = array( 'redirectto' => admin_url( 'index.php?page=twitchpress' ), 34 'userrole' => 'administrator', 35 'outputtype' => 'admin', 36 'reason' => 'mainchannelsetup', 37 'function' => __FUNCTION__, 38 'file' => __FILE__ 39 ); 40 $this->oauth_url = twitchpress_generate_authorization_url( twitchpress_get_global_accepted_scopes(), $state ); 27 41 } 28 42 … … 35 49 $screen = get_current_screen(); 36 50 37 if ( ! $screen || ! in_array( $screen->id, twitchpress_get_screen_ids() ) ) { 51 if ( ! $screen || ! in_array( $screen->id, twitchpress_get_screen_ids() ) ) { 38 52 return; 39 } 53 } 40 54 41 55 $page = empty( $_GET['page'] ) ? '' : sanitize_title( $_GET['page'] ); 42 56 $tab = empty( $_GET['tab'] ) ? '' : sanitize_title( $_GET['tab'] ); 43 57 44 58 /** 45 59 * This is the right side sidebar, usually displaying a list of links. … … 57 71 '<p><a href="https://dev.twitch.tv/dashboard/apps" target="_blank">' . __( 'Twitch Apps', 'twitchpress' ) . '</a></p>' . 58 72 '<p><a href="https://github.com/RyanBayne/TwitchPress/wiki/Extensions" target="_blank">' . __( 'Extensions', 'twitchpress' ) . '</a></p>' . 73 '<p><a href="https://dev.twitch.tv/docs/api/reference/" target="_blank">' . __( 'Twitch API Doc', 'twitchpress' ) . '</a></p>' . 59 74 '<p><a href="https://www.patreon.com/zypherevolved" target="_blank">' . __( 'Patron Pledges', 'twitchpress' ) . '</a></p>' . 60 75 '<p><a href="https://www.paypal.me/zypherevolved" target="_blank">' . __( 'PayPal Donations', 'twitchpress' ) . '</a></p>' … … 73 88 '<p><a href="' . TWITCHPRESS_GITHUB . '/issues?state=open' . '" class="button button-primary">' . __( 'Report a bug', 'twitchpress' ) . '</a></p>', 74 89 ) ); 75 90 91 ######################################################################## 92 # # 93 # INSTALLATION TAB # 94 # # 95 ######################################################################## 76 96 $nonce = wp_create_nonce( 'tool_action' ); 77 97 … … 81 101 'content' => 82 102 '<h2>' . __( 'Setup Wizard', 'twitchpress' ) . '</h2>' . 83 '<p>' . __( 'You must complete the Setup Wizard and you can go through it again to correct mistakes in the plugins initial configuration.', 'twitchpress' ) . '</p>' .103 '<p>' . __( 'You can use the Setup Wizard more than once and not just on the first installation.', 'twitchpress' ) . '</p>' . 84 104 '<p><a href="' . admin_url( 'index.php?page=twitchpress-setup' ) . '" class="button button-primary">' . __( 'Setup wizard', 'twitchpress' ) . '</a></p>' . 85 105 '<h2>' . __( 'Re-authorize Main Channel', 'twitchpress' ) . '</h2>' . … … 88 108 'callback' => array( $this, 'installation' ), 89 109 ) ); 90 110 111 ######################################################################## 112 # # 113 # CONTRIBUTION TAB # 114 # # 115 ######################################################################## 91 116 $screen->add_help_tab( array( 92 117 'id' => 'twitchpress_contribute_tab', … … 194 219 * Installation tab in help section. 195 220 * 196 * @version 2.0221 * @version 3.0 197 222 */ 198 public function installation() { 199 200 $output = ''; 201 202 if( TWITCHPRESS_API_NAME == 'kraken' ) 203 { 204 $kraken = new TWITCHPRESS_Twitch_API_Calls(); 205 206 // Test Top Game 207 $channel = $kraken->get_top_games( __FUNCTION__ ); 208 209 // Get main channel as a Twitch user. 210 //$twitch_user = $kraken->get_users( twitchpress_get_main_channels_name() ); 211 212 // Test Get Application Token 213 $token_result = twitchpress_get_app_token(); 214 } 215 else 216 { # untested 217 $helix = new TwitchPress_Twitch_API(); 218 219 $channel = $helix->get_top_games(); 223 public function installation() { 220 224 221 // Test Get Application Token222 $token_result = twitchpress_get_app_token();223 }224 225 if( !isset( $channel['top'][0]['game']['name'] ) ) {226 $output .= __( '<h2>No Application Code</h2>', 'twitchpress' );227 $output .= __( '<p>Could not get the current Top Game from Twitch.tv which indicates application details are missing. Please complete the Setup Wizard.</p>', 'twitchpress' );228 }229 elseif( !twitchpress_get_main_channels_name() ) {230 $output .= __( '<h2>Main Channel Not Setup</h2>', 'twitchpress' );231 $output .= __( '<p>The main Twitch channel is usually owned by the website owner. The owner must go through the Authorize Main Channel procedure and provide a higher level of access to their account than a user would.</p>', 'twitchpress' );232 }233 elseif( !$token_result ){234 $output .= __( '<h2>No Application Token</h2>', 'twitchpress' );235 $output .= __( '<p>All the cool features will not work until we have a token. Please ensure your application was setup properly in the Setup Wizard.</p>', 'twitchpress' );236 }237 238 elseif( !$token_result ){239 $output .= __( '<h2>No Application Token</h2>', 'twitchpress' );240 $output .= __( '<p>All the cool features will not work until we have a token. Please ensure your application was setup properly in the Setup Wizard.</p>', 'twitchpress' );241 }242 elseif( !$token_result ){243 $output .= __( '<h2>No Application Token</h2>', 'twitchpress' );244 $output .= __( '<p>All the cool features will not work until we have a token. Please ensure your application was setup properly in the Setup Wizard.</p>', 'twitchpress' );245 }246 elseif( !$token_result ){247 $output .= __( '<h2>No Application Token</h2>', 'twitchpress' );248 $output .= __( '<p>All the cool features will not work until we have a token. Please ensure your application was setup properly in the Setup Wizard.</p>', 'twitchpress' );249 }250 else {251 $output .= __( '<h2>TwitchPress Is Ready</h2>', 'twitchpress' );252 $output .= __( '<p>Only a small number of tests were carried out but it seems the plugin is setup and ready to add new superpowers your WordPress.</p>', 'twitchpress' );253 }254 255 // Check for existing cache.256 $cache = get_transient( 'twitchpress_help_tab_installation_status' );257 if( $cache )258 {259 $output .= __('<p>You are viewing cached data. Please refresh in 2 minutes.</p>', 'twitchpress' );260 }261 else262 {263 // No existing cache found, so test Kraken, generate output, cache output, output output!264 $output .= __( '<p>You are viewing fresh results. The data will be cached for 120 seconds.</p>', 'twitchpress' );265 }266 267 // Avoid making these requests for every admin page request.268 set_transient( 'twitchpress_help_tab_installation_status', $output, 120 );269 270 print $output;271 225 } 272 226 … … 386 340 * 387 341 * @author Ryan Bayne 388 * @version 2. 3342 * @version 2.4 389 343 */ 390 344 public function user_status() { 391 392 // Check for existing cache. 345 // Ensure the Twitch API application has been setup... 346 if( $this->set_app_status[0] !== 1 ) { 347 echo '<h3>' . __( 'Welcome to TwitchPress', 'twitchpress' ) . '</h3>'; 348 echo $this->set_app_status[1]; 349 echo '<p><a href="' . admin_url( 'index.php?page=twitchpress-setup' ) . '" class="button button-primary">' . __( 'Setup wizard', 'twitchpress' ) . '</a></p>'; 350 return; 351 } 352 353 // Check for existing output cache... 393 354 $cache = get_transient( 'twitchpresshelptabuserstatus' ); 394 355 if( $cache ) … … 414 375 if( TWITCHPRESS_API_NAME == 'helix' ) 415 376 { 416 $helix = new TwitchPress_Twitch_API(); 417 418 // Test Get Users Token 419 $output .= '<h2>' . __( 'Test: Get Your Token', 'twitchpress' ) . '</h2>'; 420 $token_result = $helix->establish_user_token( __FUNCTION__, $current_user_wp_id ); 421 422 if( $token_result ){$output .= __( 'Result: You have a token!' ); } 423 else{ $output .= __( 'Result: You do not have a token!' ); $overall_result = false; } 424 425 // Test Validate Users Token 426 $output .= '<h2>' . __( 'Test: Validating Your Token', 'twitchpress' ) . '</h2>'; 427 $token_result = $helix->check_user_token( $current_user_wp_id ); 428 429 if( isset( $token_result['token'] ) && isset( $token_result['scopes'] ) && isset( $token_result['name'] ) ) { 430 $output .= __( 'Result: Your token is valid. ' ); 431 }else{$output .= __( 'Result: Your token does not appear to be valid. ' ); $overall_result = false; } 432 433 // Test Get Users Channel 434 $output .= '<h2>Test: Get Your Channel</h2>'; 377 // Display current users token... 378 $output = '<h3>Twitch User Status</h3>'; 379 380 // Get users (current admin) authorization token... 435 381 $current_user_token = twitchpress_get_user_token( $current_user_wp_id ); 436 $channel = $helix->get_tokens_channel( $current_user_token ); 437 438 if( !isset( $channel['display_name'] ) || !$channel['display_name'] ) 382 383 if( !$current_user_token ) 439 384 { 440 $output .= __( 'Could not get your channel because: ', 'twitchpress' ); 441 $overall_result = false; 385 $output .= __( 'You have not completed the Twitch Authorization procedure.', 'twitchpress' ); 386 $output .= sprintf( '<p><a href="%s">Click here to complete it</a></p>', $this->oauth_url ); 387 print $output; 388 return; 442 389 } 443 elseif( is_numeric( $channel['status'] ) ) 444 { 445 $output .= '<h3>' . __( 'Result: Error ', 'twitchpress' ) . $channel['status'] . '</h3>'; 446 $output .= twitchpress_kraken_httpstatuses( $channel['status'], 'wiki' ); 447 $overall_result = false; 448 } 449 else 450 { 451 if( isset( $channel['display_name'] ) ) { $channel_display_name = $channel['display_name']; } 452 if( isset( $channel['status'] ) ) { $channel_status = $channel['status']; } 453 if( isset( $channel['game'] ) ) { $channel_game = $channel['game']; } 454 455 $output .= '<ul>'; 456 $output .= '<li><strong>Channel ID: </strong>' . $channel['_id'] . '</li>'; 457 $output .= '<li><strong>Display Name: </strong>' . $channel_display_name . '</li>'; 458 $output .= '<li><strong>Status: </strong>' . $channel_status . '</li>'; 459 $output .= '<li><strong>Game: </strong>' . $channel_game . '</li>'; 460 $output .= '</ul>'; 461 } 462 463 // Check if user is subscribed to the main channel. 464 if( isset( $channel['_id'] ) ) 465 { 466 $output .= '<h2>' . __( 'Test: Subscription Check Method One', 'twitchpress' ) . '</h2>'; 467 $users_subscription = $helix->get_users_subscription_apicall( $channel['_id'], twitchpress_get_main_channels_twitchid(), $current_user_token ); 468 if( !$users_subscription ) 469 { 470 $output .= __( 'Not subscribed to the main channel.', 'twitchpress' ); 471 } 472 else 473 { 474 $output .= __( 'Subscribed to the main channel', 'twitchpress' ); 475 } 476 } 477 478 // Subscription check two. 479 if( isset( $channel['_id'] ) ) 480 { 481 $output .= '<h2>' . __( 'Test: Subscription Check Method Two', 'twitchpress' ) . '</h2>'; 482 $users_sub_2 = $helix->is_user_subscribed_to_main_channel( $current_user_wp_id ); 483 if( !$users_sub_2 ) 484 { 485 $output .= __( 'Not subscribed to the main channel.', 'twitchpress' ); 486 } 487 else 488 { 489 // Get the full subscription object. 490 $sub_object = $helix->getUserSubscription( $channel['_id'], twitchpress_get_main_channels_twitchid(), $current_user_token ); 491 492 $output .= '<ul>'; 493 494 $output .= '<li>Sub Plan: ' . $sub_object['sub_plan'] . '</li>'; 495 $output .= '<li>Plan Name: ' . $sub_object['sub_plan_name'] . '</li>'; 496 $output .= '<li>Channel ID: ' . $sub_object['channel']['_id'] . '</li>'; 497 498 if( $sub_object['channel']['partner'] ) 499 { 500 $output .= '<li>Partner Status: ' . __( 'Partnered', 'twitchpress' ) . '<li>'; 501 } 502 else 503 { 504 $output .= '<li>Partner Status: ' . __( 'Not Partnered', 'twitchpress' ) . '<li>'; 505 } 506 507 $output .= '</ul>'; 508 } 509 } 510 511 // Get Tokens Scopes 512 $output .= '<h2>' . __( 'Your Tokens Current Scopes', 'twitchpress' ) . '</h2>'; 513 if( !$scope = twitchpress_get_users_token_scopes( $current_user_wp_id ) ) 514 { 515 $output .= '<h3>' . __( 'No Scopes Found', 'twitchpress' ) . '</h3>'; 516 } 517 else 518 { 519 $output .= '<ol>'; 520 foreach( $scope as $key => $item ) 521 { 522 $output .= '<li>' . esc_html( $item ) . '</li>'; 523 } 524 $output .= '</ol>'; 525 } 390 391 $output .= '<ul>'; 392 393 // Status: User has a token... 394 $output .= '<li class="dashicons-before dashicons-yes">User Token</li>'; 395 396 // List End 397 $output .= '</ul>'; 398 526 399 } 527 400 elseif( TWITCHPRESS_API_NAME == 'kraken' ) … … 642 515 set_transient( 'twitchpresshelptabuserstatus', $output, 120 ); 643 516 644 print $output; 645 646 print sprintf( __( 'Please check Twitch.tv status %s before creating fault reports.' ), '<a target="_blank" href="https://twitchstatus.com/">here</a>' ); 517 print $output; 647 518 } 648 519 … … 653 524 * 654 525 * @author Ryan Bayne 655 * @version 3. 0526 * @version 3.1 656 527 */ 657 528 public function app_status() { 529 530 // Ensure the Twitch API application has been setup... 531 if( $this->set_app_status[0] !== 1 ) { 532 echo '<h3>' . __( 'Welcome to TwitchPress', 'twitchpress' ) . '</h3>'; 533 echo $this->set_app_status[1]; 534 echo '<p><a href="' . admin_url( 'index.php?page=twitchpress-setup' ) . '" class="button button-primary">' . __( 'Setup wizard', 'twitchpress' ) . '</a></p>'; 535 return; 536 } 537 658 538 // Check for existing cache. 659 539 $cache = get_transient( 'twitchpresshelptabappstatus' ); … … 686 566 $twitch_api = new TWITCHPRESS_Twitch_API(); 687 567 } 688 568 689 569 $output .= '<h2>' . __( 'Application Credentials', 'twitchpress' ) . '</h2>'; 690 570 $output .= '<p>Old App ID Method: ' . twitchpress_get_main_client_id() . '</p>'; … … 730 610 * 731 611 * @author Ryan Bayne 732 * @version 2. 3612 * @version 2.4 733 613 */ 734 614 public function channel_status() { 615 616 // Ensure the Twitch API application has been setup... 617 if( $this->set_app_status[0] !== 1 ) { 618 echo '<h3>' . __( 'Welcome to TwitchPress', 'twitchpress' ) . '</h3>'; 619 echo $this->set_app_status[1]; 620 echo '<p><a href="' . admin_url( 'index.php?page=twitchpress-setup' ) . '" class="button button-primary">' . __( 'Setup wizard', 'twitchpress' ) . '</a></p>'; 621 return; 622 } 623 735 624 // Check for existing cache. 736 625 $cache = get_transient( 'twitchpresshelptabchannelstatus' ); … … 757 646 if( TWITCHPRESS_API_NAME == 'kraken' ) 758 647 { 759 $kraken_or_helix = new TWITCHPRESS_Twitch_API_Calls(); 648 $kraken = new TWITCHPRESS_Twitch_API_Calls(); 649 $twitch_user = $kraken->get_users( twitchpress_get_main_channels_name() ); 760 650 } 761 651 else 762 { # untested 763 $kraken_or_helix = new TWITCHPRESS_Twitch_API(); 652 { 653 $helix = new TWITCHPRESS_Twitch_API(); 654 $twitch_user = $helix->get_user_without_email_by_login_name( twitchpress_get_main_channels_name() ); 764 655 } 765 656 … … 776 667 $output .= '<p>' . twitchpress_get_main_channels_name() . '</p>'; 777 668 778 // Get main channel as a Twitch user.779 $twitch_user = $kraken_or_helix->get_users( twitchpress_get_main_channels_name() );780 781 669 // Main Channel ID 782 670 //$output .= '<h2>' . __( 'Main Channel ID', 'twitchpress' ) . '</h2>'; … … 804 692 public function testing() { 805 693 806 694 if( TWITCHPRESS_API_NAME == 'helix' ){ 695 /* Make a call using Twitch API class */ 696 $twitch_api = new TWITCHPRESS_Twitch_API(); 697 $endpoint = 'https://api.twitch.tv/helix/users?login=ZypheREvolved'; 698 $headers = array( 'Client-ID' => twitchpress_get_app_id() ); 699 $curl = $twitch_api->WP_Http_Curl( 'GET', $endpoint, $headers ); 700 $curl->finish_new_request(); 701 702 //twitchpress_var_dump( $curl->final_output ); 703 } 704 705 706 /* Make a call without using the Twitch API class... 707 // Create new curl object for performing an API call... 708 $new_curl = new TwitchPress_Extend_WP_Http_Curl( 709 twitchpress_get_app_id(), 710 twitchpress_get_app_secret(), 711 twitchpress_get_app_token(), 712 'GET', 713 'https://api.twitch.tv/helix/users?login=ZypheREvolved' 714 ); 715 716 // Add headers if the default does not add them in the current package... 717 $new_curl->option_headers_additional( array( 718 'Client-ID' => twitchpress_get_app_id(), 719 ) ); 720 721 // Add body parameters if the package hasn't been designed to add them automatically... 722 $new_curl->option_body_additional(); 723 724 // Now add miscellanous values that will make up our curl request... 725 $new_curl->option_other_additional(); 726 727 // Finish the request, this makes the call and sets $this->final_output... 728 $new_curl->finish_new_request(); 729 */ 730 731 732 ######################################################################## 733 # # 734 # WEBHOOKS # 735 # # 736 ######################################################################## 737 /* 738 $test1 = 1; 739 $test2 = 0; 740 $test3 = 0; 741 742 $callback = 'http://localhost/twitchpress/branches/beta/wp-admin/admin.php'; 743 $topic = 'https://api.twitch.tv/helix/streams?user_id=120841817'; 744 745 if( $test1 ) 746 { 747 $twitch_webhooks = new TwitchPress_Twitch_Webhooks(); 748 749 $twitch_webhooks->callback = $callback; 750 $twitch_webhooks->mode = 'subscribe'; 751 $twitch_webhooks->topic = $topic; 752 $twitch_webhooks->secret = null; 753 754 $result = $twitch_webhooks->users_follows( 0, 1, '120841817', null ); 755 756 twitchpress_var_dump( $result ); 757 } 758 759 if( $test2 ) 760 { 761 $curl = new WP_Http_Curl(); 762 $curl_version_object = curl_version(); 763 764 $result = $curl->request( 765 'https://api.twitch.tv/helix/webhooks/hub', 766 array( 767 'method' => 'POST', 768 'user-agent' => 'curl/' . $curl_version_object['version'], 769 'stream' => false, 770 'filename' => false, 771 'decompress' => false, 772 'headers' => array( 773 'content-type' => 'application/x-www-form-urlencoded', 774 'client_id' => twitchpress_get_app_id(), 775 ), 776 'body' => array ( 777 'hub.callback' => 'http://localhost/twitchpress/branches/beta/wp-admin/admin.php', 778 'hub.mode' => 'subscribe', 779 'hub.topic' => 'https://api.twitch.tv/helix/users/follows', 780 'hub.lease_seconds' => 0, 781 'hub.secret' => null, 782 'first' => 1, 783 'from_id' => 120841817, 784 'to_id' => null 785 ) 786 ) 787 ); 788 twitchpress_var_dump( $result ); 789 } 790 791 if( $test3 ) 792 { 793 $http = new WP_Http(); 794 $curl_version_object = curl_version(); 795 796 $body = json_encode( array ( 797 'hub.callback' => $callback, 798 'hub.mode' => 'subscribe', 799 'hub.topic' => $topic, 800 'hub.lease_seconds' => 0, 801 'hub.secret' => null, 802 'first' => 1, 803 'from_id' => 120841817, 804 'to_id' => null 805 ) 806 ); 807 808 809 $result = $http->request( 810 'https://api.twitch.tv/helix/webhooks/hub', 811 array( 812 'method' => 'POST', 813 'stream' => false, 814 'filename' => false, 815 'decompress' => false, 816 'headers' => array( 817 'Accept' => 'application/json', 818 'Content-Type' => 'application/json; charset=utf-8', 819 'Client-ID' => twitchpress_get_app_id(), 820 ), 821 'body' => $body 822 ) 823 ); 824 825 twitchpress_var_dump( $result ); 826 } 827 */ 807 828 } 808 829 } -
channel-solution-for-twitch/trunk/includes/admin/class.twitchpress-admin-menus.php
r1856051 r2024613 39 39 function secondary_menu_items() { 40 40 41 add_submenu_page( $this->slug, __(' Feed Posts', $this->slug), __('Feed Posts', $this->slug), 'manage_options', 'edit.php?post_type=twitchfeed', '' );42 add_submenu_page( $this->slug, __('Channels', $this->slug), __('Channels', $this->slug), 'manage_options', 'edit.php?post_type=twitchchannels', '' );43 add_submenu_page( $this->slug, __('Tools', $this->slug), __('Tools', $this->slug), 'manage_options', 'twitchpress_tools', array( $this, 'tools_page' ) );44 add_submenu_page( $this->slug, __('Data', $this->slug), __('Data', $this->slug), 'manage_options', 'twitchpress_data', array( $this, 'data_page' ) );41 add_submenu_page( $this->slug, __('Webhooks', $this->slug), __('Webhooks', $this->slug), 'manage_options', 'edit.php?post_type=webhooks', '' ); 42 add_submenu_page( $this->slug, __('Channels', $this->slug), __('Channels', $this->slug), 'manage_options', 'edit.php?post_type=twitchchannels', '' ); 43 add_submenu_page( $this->slug, __('Tools', $this->slug), __('Tools', $this->slug), 'manage_options', 'twitchpress_tools', array( $this, 'tools_page' ) ); 44 add_submenu_page( $this->slug, __('Data', $this->slug), __('Data', $this->slug), 'manage_options', 'twitchpress_data', array( $this, 'data_page' ) ); 45 45 46 46 // PayPal, Patreon, Streamtip -
channel-solution-for-twitch/trunk/includes/admin/class.twitchpress-admin-notices.php
r1856051 r2024613 369 369 * @param mixed $dismissible 370 370 * 371 * @version 1. 0371 * @version 1.1 372 372 */ 373 373 public static function notice( $type, $title, $description, $dismissible = false ) { … … 382 382 * @param mixed $dismissible 383 383 * 384 * @version 1. 0384 * @version 1.1 385 385 */ 386 386 public static function error( $title, $desc, $dismissible = false ) { 387 387 $d = ''; if( $dismissible ){ $d = ' is-dismissible'; } 388 ?><div class="notice notice-error<?php echo $d; ?>"><p><?php echo '<strong>' . $title . ': </strong>' . $desc; ?> .</p></div><?php388 ?><div class="notice notice-error<?php echo $d; ?>"><p><?php echo '<strong>' . $title . ': </strong>' . $desc; ?></p></div><?php 389 389 } 390 390 … … 396 396 * @param mixed $dismissible 397 397 * 398 * @version 1. 0398 * @version 1.1 399 399 */ 400 400 public static function warning( $title, $desc, $dismissible = false ) { 401 401 $d = ''; if( $dismissible ){ $d = ' is-dismissible'; } 402 ?><div class="notice notice-warning<?php echo $d; ?>"><p><?php echo '<strong>' . $title . ': </strong>' . $desc; ?> .</p></div><?php402 ?><div class="notice notice-warning<?php echo $d; ?>"><p><?php echo '<strong>' . $title . ': </strong>' . $desc; ?></p></div><?php 403 403 } 404 404 … … 410 410 * @param mixed $dismissible 411 411 * 412 * @version 1. 0412 * @version 1.1 413 413 */ 414 414 public static function success( $title, $desc, $dismissible = false ) { 415 415 $d = ''; if( $dismissible ){ $d = ' is-dismissible'; } 416 ?><div class="notice notice-success<?php echo $d; ?>"><p><?php echo '<strong>' . $title . ': </strong>' . $desc; ?> .</p></div><?php416 ?><div class="notice notice-success<?php echo $d; ?>"><p><?php echo '<strong>' . $title . ': </strong>' . $desc; ?></p></div><?php 417 417 } 418 418 … … 424 424 * @param mixed $dismissible 425 425 * 426 * @version 1. 0426 * @version 1.1 427 427 */ 428 428 public static function info( $title, $desc, $dismissible = false ) { 429 429 $d = ''; if( $dismissible ){ $d = ' is-dismissible'; } 430 ?><div class="notice notice-info<?php echo $d; ?>"><p><?php echo '<strong>' . $title . ': </strong>' . $desc; ?> .</p></div><?php430 ?><div class="notice notice-info<?php echo $d; ?>"><p><?php echo '<strong>' . $title . ': </strong>' . $desc; ?></p></div><?php 431 431 } 432 432 } -
channel-solution-for-twitch/trunk/includes/admin/class.twitchpress-admin-quicktools.php
r1966127 r2024613 435 435 436 436 // Get the main channel Twitch ID. 437 $channel_id = twitchpress_get_main_channel _id();437 $channel_id = twitchpress_get_main_channels_twitchid(); 438 438 $output .= sprintf( __( '<p><strong>Main Channel ID: %s</strong></p>', 'twitchpress' ), $channel_id ); 439 439 440 440 // Get main account token. 441 $channel_token = twitchpress_get_main_c lient_token();441 $channel_token = twitchpress_get_main_channels_token(); 442 442 $output .= sprintf( __( '<p><strong>Main Token: %s</strong></p>', 'twitchpress' ), $channel_token ); 443 443 … … 454 454 455 455 // Get possible existing sub plan from a earlier sub sync. 456 $local_sub_plan = get_user_meta( $user_id, 'twitchpress_sub_plan_' . twitchpress_get_main_channel_id(), true );456 $local_sub_plan = get_user_meta( $user_id, 'twitchpress_sub_plan_' . $channel_id, true ); 457 457 $output .= sprintf( __( '<p><strong>Existing Sub Plan Value: %s</strong></p>', 'twitchpress' ), $local_sub_plan ); 458 458 … … 603 603 604 604 // Get the main channel Twitch ID. 605 $channel_id = twitchpress_get_main_channel _id();605 $channel_id = twitchpress_get_main_channels_twitchid(); 606 606 $output .= sprintf( __( '<p><strong>Main Channel ID: %s</strong></p>', 'twitchpress' ), $channel_id ); 607 607 … … 622 622 623 623 // Get possible existing sub plan from a earlier sub sync. 624 $local_sub_plan = get_user_meta( $user_id, 'twitchpress_sub_plan_' . twitchpress_get_main_channel_id(), true );624 $local_sub_plan = get_user_meta( $user_id, 'twitchpress_sub_plan_' . $channel_id, true ); 625 625 $output .= sprintf( __( '<p><strong>Existing Sub Plan Value: %s</strong></p>', 'twitchpress' ), $local_sub_plan ); 626 626 -
channel-solution-for-twitch/trunk/includes/admin/class.twitchpress-admin-setup-wizard.php
r1977739 r2024613 159 159 * Setup Wizard Footer. 160 160 */ 161 public function setup_wizard_footer() { 162 ?> 163 <?php if ( 'next_steps' === $this->step ) : ?> 161 public function setup_wizard_footer() { 162 if ( 'next_steps' === $this->step ) : ?> 164 163 <a class="twitchpress-return-to-dashboard" href="<?php echo esc_url( admin_url() ); ?>"><?php _e( 'Return to the WordPress Dashboard', 'twitchpress' ); ?></a> 165 164 <?php endif; ?> … … 268 267 <th scope="row"><label for="twitchpress_main_channels_name"><?php _e( 'Main Channels Name', 'twitchpress' ); ?></label></th> 269 268 <td> 270 <input type="text" id="twitchpress_main_channels_name" name="twitchpress_main_channels_name" class="input-text" value="<?php echo get_option( 'twitchpress_main_channels_name');?>" />269 <input type="text" id="twitchpress_main_channels_name" name="twitchpress_main_channels_name" class="input-text" value="<?php echo esc_html( get_option( 'twitchpress_main_channels_name' ) );?>" /> 271 270 <label for="twitchpress_main_channels_name"><?php _e( 'example: ZypheREvolved, StarCitizen, nookyyy', 'twitchpress' ); ?></label> 272 271 </td> … … 328 327 </tr> 329 328 <tr> 330 <th scope="row"><label for="twitchpress_scope_channel_read"><?php _e( 'channel_read', 'twitchpress' ); ?></label></th>331 <td>332 <input type="checkbox" id="twitchpress_scope_channel_read" name="twitchpress_scopes[]" class="input-checkbox" value="channel_read" <?php checked( get_option( 'twitchpress_scope_channel_read' ), 'yes', true ); ?> />333 <label for="twitchpress_scope_channel_read"><?php _e( 'Read access to non-public channel information, including email address and stream key.', 'twitchpress' ); ?></label>334 </td>335 </tr>336 <tr>337 329 <th scope="row"><label for="twitchpress_scope_channel_editor"><?php _e( 'channel_editor', 'twitchpress' ); ?></label></th> 338 330 <td> … … 377 369 </tr> 378 370 <tr> 379 <th scope="row"><label for="twitchpress_scope_chat_login"><?php _e( 'chat_login', 'twitchpress' ); ?></label></th>380 <td>381 <input type="checkbox" id="twitchpress_scope_chat_login" name="twitchpress_scopes[]" class="input-checkbox" value="chat_login" <?php checked( get_option( 'twitchpress_scope_chat_login' ), 'yes', true ); ?> />382 <label for="twitchpress_scope_chat_login"><?php _e( 'Ability to log into chat and send messages.', 'twitchpress' ); ?></label>383 </td>384 </tr>385 <tr>386 <th scope="row"><label for="twitchpress_scope_channel_feed_read"><?php _e( 'channel_feed_read', 'twitchpress' ); ?></label></th>387 <td>388 <input type="checkbox" id="twitchpress_scope_channel_feed_read" name="twitchpress_scopes[]" class="input-checkbox" value="channel_feed_read" <?php checked( get_option( 'twitchpress_scope_channel_feed_read' ), 'yes', true ); ?> />389 <label for="twitchpress_scope_channel_feed_read"><?php _e( 'Ability to view to a channel feed.', 'twitchpress' ); ?></label>390 </td>391 </tr>392 <tr>393 <th scope="row"><label for="twitchpress_scope_channel_feed_edit"><?php _e( 'channel_feed_edit', 'twitchpress' ); ?></label></th>394 <td>395 <input type="checkbox" id="twitchpress_scope_channel_feed_edit" name="twitchpress_scopes[]" class="input-checkbox" value="channel_feed_edit" <?php checked( get_option( 'twitchpress_scope_channel_feed_edit' ), 'yes', true ); ?> />396 <label for="twitchpress_scope_channel_feed_edit"><?php _e( 'Ability to add posts and reactions to a channel feed.', 'twitchpress' ); ?></label>397 </td>398 </tr>399 <tr>400 371 <th scope="row"><label for="twitchpress_scope_communities_edit"><?php _e( 'communities_edit', 'twitchpress' ); ?></label></th> 401 372 <td> … … 503 474 </tr> 504 475 505 </table> 506 476 </table> 477 507 478 <h3><?php _e( 'Permissions Scope for Visitors', 'twitchpress' ); ?></h3> 508 479 <p><?php _e( 'Select the scopes that will be needed for public features. Most sites will only need 2-3 scopes unless you are building a Twitch suite for full channel management. Visitors will be shown your selected scopes during an oAuth2 request.', 'twitchpress' ); ?></p> … … 587 558 </tr> 588 559 <tr> 589 <th scope="row"><label for="twitchpress_visitor_scope_chat_login"><?php _e( 'chat_login', 'twitchpress' ); ?></label></th>590 <td>591 <input type="checkbox" id="twitchpress_visitor_scope_chat_login" name="twitchpress_visitor_scopes[]" class="input-checkbox" value="chat_login" <?php checked( get_option( 'twitchpress_visitor_scope_chat_login' ), 'yes', true ); ?> />592 <label for="twitchpress_visitor_scope_chat_login"><?php _e( 'Ability to log into chat and send messages.', 'twitchpress' ); ?></label>593 </td>594 </tr>595 <tr>596 <th scope="row"><label for="twitchpress_visitor_scope_channel_feed_read"><?php _e( 'channel_feed_read', 'twitchpress' ); ?></label></th>597 <td>598 <input type="checkbox" id="twitchpress_visitor_scope_channel_feed_read" name="twitchpress_visitor_scopes[]" class="input-checkbox" value="channel_feed_read" <?php checked( get_option( 'twitchpress_visitor_scope_channel_feed_read' ), 'yes', true ); ?> />599 <label for="twitchpress_visitor_scope_channel_feed_read"><?php _e( 'Ability to view to a channel feed.', 'twitchpress' ); ?></label>600 </td>601 </tr>602 <tr>603 <th scope="row"><label for="twitchpress_visitor_scope_channel_feed_edit"><?php _e( 'channel_feed_edit', 'twitchpress' ); ?></label></th>604 <td>605 <input type="checkbox" id="twitchpress_visitor_scope_channel_feed_edit" name="twitchpress_visitor_scopes[]" class="input-checkbox" value="channel_feed_edit" <?php checked( get_option( 'twitchpress_visitor_scope_channel_feed_edit' ), 'yes', true ); ?> />606 <label for="twitchpress_visitor_scope_channel_feed_edit"><?php _e( 'Ability to add posts and reactions to a channel feed.', 'twitchpress' ); ?></label>607 </td>608 </tr>609 <tr>610 560 <th scope="row"><label for="twitchpress_visitor_scope_communities_edit"><?php _e( 'communities_edit', 'twitchpress' ); ?></label></th> 611 561 <td> … … 713 663 </tr> 714 664 715 </table> 665 </table> 666 716 667 <p class="twitchpress-setup-actions step"> 717 668 <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'twitchpress' ); ?>" name="save_step" /> … … 750 701 // Delete options for scopes that are not in $_POST (not checked) and add those that are. 751 702 $all_scopes = twitchpress_scopes(); 703 $new_app_scopes = array(); 752 704 foreach( $all_scopes as $scope => $scope_info ) { 753 705 if( in_array( str_replace( ':', '_', $scope ), $_POST['twitchpress_scopes'] ) ) { 754 706 update_option( 'twitchpress_scope_' . str_replace( ':', '_', $scope ), 'yes' ); 707 $new_app_scopes[] = $scope; 755 708 } else { 756 709 delete_option( 'twitchpress_scope_' . str_replace( ':', '_', $scope ) ); 757 710 } 758 711 } 712 713 // Store the main scopes as app scopes for the servers own needs... 714 twitchpress_update_app_token_scopes( $new_app_scopes ); 759 715 760 716 foreach( $all_scopes as $scope => $scope_info ) { … … 784 740 ######################################################################## 785 741 # # 786 # ACCESS TOKEN#742 # REQUEST APP ACCESS TOKEN # 787 743 # # 788 744 ######################################################################## … … 791 747 $twitch_api_obj = new TWITCHPRESS_Twitch_API(); 792 748 $call_object = $twitch_api_obj->request_app_access_token( __FUNCTION__ ); 793 749 794 750 // Error on no curl response code being found... 795 751 if( !isset( $call_object->response_code ) ) { … … 822 778 if( TWITCHPRESS_API_NAME == 'kraken' ) 823 779 { 824 $kraken_calls_obj = new TWITCHPRESS_Twitch_API_Calls(); 780 $twitch_api_obj = new TWITCHPRESS_Twitch_API_Calls(); 781 // Confirm channel exists by using the "users?login" endpoint. 782 $user_objects = $twitch_api_obj->get_users( $main_channel ); 783 784 if( !isset( $user_objects['users'][0]['_id'] ) ) { 785 TwitchPress_Admin_Notices::add_custom_notice( 'wizardchanneldoesnotexist', sprintf( __( 'The channel you entered was not found. You entered %s. Please check the spelling and try again.'), esc_html( $main_channel ) ) ); 786 return; 787 } 788 789 $twitch_user_id = $user_objects['users'][0]['_id']; 825 790 } 826 791 else 827 { # untested 828 $helix = new TWITCHPRESS_Twitch_API(); 829 } 830 831 // Confirm channel exists by using the "users?login" endpoint. 832 $user_objects = $kraken_calls_obj->get_users( $main_channel ); 833 834 if( !isset( $user_objects['users'][0]['_id'] ) ) { 835 TwitchPress_Admin_Notices::add_custom_notice( 'wizardchanneldoesnotexist', sprintf( __( 'The channel you entered was not found. You entered %s. Please check the spelling and try again.'), esc_html( $main_channel ) ) ); 836 return; 837 } 838 839 $twitch_user_id = $user_objects['users'][0]['_id']; 840 792 { 793 $twitch_api_obj = new TWITCHPRESS_Twitch_API(); 794 $user_objects = $twitch_api_obj->get_user_without_email_by_login_name( $main_channel ); 795 796 if( !isset( $user_objects->data[0]->id ) ) { 797 TwitchPress_Admin_Notices::add_custom_notice( 'wizardchanneldoesnotexist', sprintf( __( 'The channel you entered was not found. You entered %s. Please check the spelling and try again.'), esc_html( $main_channel ) ) ); 798 return; 799 } 800 801 $twitch_user_id = $user_objects->data[0]->id; 802 } 803 841 804 // The current user has logged into what we will assume is their own personal account, for now. 842 805 // So add the channel/user ID to their user meta. … … 1212 1175 } 1213 1176 1214 //wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); 1215 //exit; 1216 1217 // Send user to authorise their main Twitch channel. 1218 $post_credentials_kraken = new TWITCHPRESS_Twitch_API(); 1219 1177 // Send user to authorise their main Twitch channel. 1220 1178 $state = array( 'redirectto' => admin_url( 'index.php?page=twitchpress-setup&step=next_steps' ), 1221 1179 'userrole' => 'administrator', -
channel-solution-for-twitch/trunk/includes/admin/settings/class.twitchpress-settings-general.php
r1941995 r2024613 63 63 global $current_section; 64 64 $settings = $this->get_settings( $current_section ); 65 echo '<p>' . __( 'Please use logging with care. These features can generate 66 a lot of files in a very short time. They are intended for debugging by 67 someone who is monitoring the site. If you need more automati clean-up for 68 long-term history please make a request.', 'twitchpress' ). '</p>'; 65 69 TwitchPress_Admin_Settings::output_fields( $settings ); 66 70 } … … 146 150 'autoload' => false, 147 151 ), 148 149 array( 150 'desc' => __( 'Delete Feed Posts', 'twitchpress' ), 151 'id' => 'twitchpress_remove_feed_posts', 152 'default' => 'no', 153 'type' => 'checkbox', 154 'checkboxgroup' => '', 155 'show_if_checked' => 'yes', 156 'autoload' => false, 157 ), 158 152 159 153 array( 160 154 'desc' => __( 'Delete Database Tables', 'twitchpress' ), … … 218 212 array( 219 213 'desc' => __( 'Activate Redirect Tracking', 'twitchpress' ), 220 'id' => 'twitch ress_redirect_tracking_switch',214 'id' => 'twitchpress_redirect_tracking_switch', 221 215 'default' => 'no', 222 216 'type' => 'checkbox', … … 231 225 array( 232 226 'desc' => __( 'Activate Sandbox-mode', 'twitchpress' ), 233 'id' => 'twitch ress_sandbox_mode_switch',227 'id' => 'twitchpress_sandbox_mode_switch', 234 228 'default' => 'no', 235 229 'type' => 'checkbox', … … 244 238 array( 245 239 'desc' => __( 'Sandbox-mode Generator', 'twitchpress' ), 246 'id' => 'twitch ress_sandbox_mode_generator_switch',240 'id' => 'twitchpress_sandbox_mode_generator_switch', 247 241 'default' => 'no', 248 242 'type' => 'checkbox', … … 257 251 array( 258 252 'desc' => __( 'Sandbox-mode False/Fail Returns', 'twitchpress' ), 259 'id' => 'twitch ress_sandbox_mode_falsereturns_switch',253 'id' => 'twitchpress_sandbox_mode_falsereturns_switch', 260 254 'default' => 'no', 261 255 'type' => 'checkbox', … … 537 531 'title' => __( 'Report Switches', 'wpseed' ), 538 532 'type' => 'title', 539 'desc' => __( 'Reports generate information and statistics for none developers. Reports can also create documents.', 'twitchpress' ),533 'desc' => __( 'Reports generate snap-shot information and statistics. Reports are intended for long-term monitoring.', 'twitchpress' ), 540 534 'id' => 'twitchpress_bugnet_report_switches', 541 535 ), -
channel-solution-for-twitch/trunk/includes/admin/settings/class.twitchpress-settings-kraken.php
r1966127 r2024613 330 330 'scope' => 'channel_check_subscription', 331 331 ), 332 333 array(334 'desc' => __( 'chat_login: Ability to log into chat and send messages.', 'twitchpress' ),335 'id' => 'twitchpress_scope_chat_login',336 'default' => $default,337 'type' => 'scopecheckbox',338 'checkboxgroup' => '',339 'show_if_checked' => 'yes',340 'autoload' => false,341 'scope' => 'chat_login',342 ),343 332 344 array(345 'desc' => __( 'channel_feed_read: Ability to view to a channel feed.', 'twitchpress' ),346 'id' => 'twitchpress_scope_channel_feed_read',347 'default' => $default,348 'type' => 'scopecheckbox',349 'checkboxgroup' => '',350 'show_if_checked' => 'yes',351 'autoload' => false,352 'scope' => 'channel_feed_read',353 ),354 355 array(356 'desc' => __( 'channel_feed_edit: Ability to add posts and reactions to a channel feed."', 'twitchpress' ),357 'id' => 'twitchpress_scope_channel_feed_edit',358 'default' => $default,359 'type' => 'scopecheckbox',360 'checkboxgroup' => '',361 'show_if_checked' => 'yes',362 'autoload' => false,363 'scope' => 'channel_feed_edit',364 ),365 366 333 array( 367 334 'desc' => __( 'communities_edit: Manage a user’s communities."', 'twitchpress' ), … … 398 365 399 366 array( 400 'desc' => __( 'channel_feed_edit: Turn on Viewer Heartbeat Service ability to record user data."', 'twitchpress' ), 401 'id' => 'twitchpress_scope_viewing_activity_read', 402 'default' => $default, 403 'type' => 'scopecheckbox', 404 'checkboxgroup' => 'end', 405 'show_if_checked' => 'yes', 406 'autoload' => false, 407 'scope' => 'viewing_activity_read', 408 ), 409 367 'desc' => __( 'analytics:read:extensions: View analytics data for your extensions."', 'twitchpress' ), 368 'id' => 'twitchpress_scope_analytics_read_extensions', 369 'default' => $default, 370 'type' => 'scopecheckbox', 371 'checkboxgroup' => '', 372 'show_if_checked' => 'yes', 373 'autoload' => false, 374 'scope' => 'analytics_read_extensions', 375 ), 376 377 array( 378 'desc' => __( 'analytics:read:games: View analytics data for your games."', 'twitchpress' ), 379 'id' => 'twitchpress_scope_analytics_read_games', 380 'default' => $default, 381 'type' => 'scopecheckbox', 382 'checkboxgroup' => '', 383 'show_if_checked' => 'yes', 384 'autoload' => false, 385 'scope' => 'analytics_read_games', 386 ), 387 388 array( 389 'desc' => __( 'bits:read: View Bits information for your channel."', 'twitchpress' ), 390 'id' => 'twitchpress_scope_bits_read', 391 'default' => $default, 392 'type' => 'scopecheckbox', 393 'checkboxgroup' => '', 394 'show_if_checked' => 'yes', 395 'autoload' => false, 396 'scope' => 'bits_read', 397 ), 398 399 array( 400 'desc' => __( 'clips:edit: Manage a clip object."', 'twitchpress' ), 401 'id' => 'twitchpress_scope_clips_edit', 402 'default' => $default, 403 'type' => 'scopecheckbox', 404 'checkboxgroup' => '', 405 'show_if_checked' => 'yes', 406 'autoload' => false, 407 'scope' => 'clips_edit', 408 ), 409 410 array( 411 'desc' => __( 'user:edit: Manage a user object."', 'twitchpress' ), 412 'id' => 'twitchpress_scope_user_edit', 413 'default' => $default, 414 'type' => 'scopecheckbox', 415 'checkboxgroup' => '', 416 'show_if_checked' => 'yes', 417 'autoload' => false, 418 'scope' => 'user_edit', 419 ), 420 421 array( 422 'desc' => __( 'user:edit:broadcast: Edit your channel’s broadcast configuration, including extension configuration."', 'twitchpress' ), 423 'id' => 'twitchpress_scope_user_edit_broadcast', 424 'default' => $default, 425 'type' => 'scopecheckbox', 426 'checkboxgroup' => '', 427 'show_if_checked' => 'yes', 428 'autoload' => false, 429 'scope' => 'user_edit_broadcast', 430 ), 431 432 array( 433 'desc' => __( 'user:read:broadcast: View your broadcasting configuration, including extension configurations."', 'twitchpress' ), 434 'id' => 'twitchpress_scope_user_read_broadcast', 435 'default' => $default, 436 'type' => 'scopecheckbox', 437 'checkboxgroup' => '', 438 'show_if_checked' => 'yes', 439 'autoload' => false, 440 'scope' => 'user_read_broadcast', 441 ), 442 443 array( 444 'desc' => __( 'user:read:email: Read authorized user’s email address."', 'twitchpress' ), 445 'id' => 'twitchpress_scope_user_read_email', 446 'default' => $default, 447 'type' => 'scopecheckbox', 448 'checkboxgroup' => '', 449 'show_if_checked' => 'yes', 450 'autoload' => false, 451 'scope' => 'user_read_email', 452 ), 453 410 454 array( 411 455 'type' => 'sectionend', … … 541 585 'scope' => 'channel_check_subscription', 542 586 ), 543 544 array( 545 'desc' => __( 'chat_login: Ability to log into chat and send messages.', 'twitchpress' ), 546 'id' => 'twitchpress_visitor_scope_chat_login', 547 'default' => $default, 548 'type' => 'scopecheckboxpublic', 549 'checkboxgroup' => '', 550 'show_if_checked' => 'yes', 551 'autoload' => false, 552 'scope' => 'chat_login', 553 ), 554 555 array( 556 'desc' => __( 'channel_feed_read: Ability to view to a channel feed.', 'twitchpress' ), 557 'id' => 'twitchpress_visitor_scope_channel_feed_read', 558 'default' => $default, 559 'type' => 'scopecheckboxpublic', 560 'checkboxgroup' => '', 561 'show_if_checked' => 'yes', 562 'autoload' => false, 563 'scope' => 'channel_feed_read', 564 ), 565 566 array( 567 'desc' => __( 'channel_feed_edit: Ability to add posts and reactions to a channel feed."', 'twitchpress' ), 568 'id' => 'twitchpress_visitor_scope_channel_feed_edit', 569 'default' => $default, 570 'type' => 'scopecheckboxpublic', 571 'checkboxgroup' => '', 572 'show_if_checked' => 'yes', 573 'autoload' => false, 574 'scope' => 'channel_feed_edit', 575 ), 576 587 577 588 array( 578 589 'desc' => __( 'communities_edit: Manage a user’s communities."', 'twitchpress' ), … … 607 618 'scope' => 'collections_edit', 608 619 ), 609 610 array(611 'desc' => __( 'channel_feed_edit: Turn on Viewer Heartbeat Service ability to record user data."', 'twitchpress' ),612 'id' => 'twitchpress_visitor_scope_viewing_activity_read',613 'default' => $default,614 'type' => 'scopecheckboxpublic',615 'checkboxgroup' => 'end',616 'show_if_checked' => 'yes',617 'autoload' => false,618 'scope' => 'viewing_activity_read',619 ),620 620 621 array( 622 'desc' => __( 'analytics:read:extensions: View analytics data for your extensions."', 'twitchpress' ), 623 'id' => 'twitchpress_visitor_scope_analytics_read_extensions', 624 'default' => $default, 625 'type' => 'scopecheckboxpublic', 626 'checkboxgroup' => '', 627 'show_if_checked' => 'yes', 628 'autoload' => false, 629 'scope' => 'analytics_read_extensions', 630 ), 631 632 array( 633 'desc' => __( 'analytics:read:games: View analytics data for your games."', 'twitchpress' ), 634 'id' => 'twitchpress_visitor_scope_analytics_read_games', 635 'default' => $default, 636 'type' => 'scopecheckboxpublic', 637 'checkboxgroup' => '', 638 'show_if_checked' => 'yes', 639 'autoload' => false, 640 'scope' => 'analytics_read_games', 641 ), 642 643 array( 644 'desc' => __( 'bits:read: View Bits information for your channel."', 'twitchpress' ), 645 'id' => 'twitchpress_visitor_scope_bits_read', 646 'default' => $default, 647 'type' => 'scopecheckboxpublic', 648 'checkboxgroup' => '', 649 'show_if_checked' => 'yes', 650 'autoload' => false, 651 'scope' => 'bits_read', 652 ), 653 654 array( 655 'desc' => __( 'clips:edit: Manage a clip object."', 'twitchpress' ), 656 'id' => 'twitchpress_visitor_scope_clips_edit', 657 'default' => $default, 658 'type' => 'scopecheckboxpublic', 659 'checkboxgroup' => '', 660 'show_if_checked' => 'yes', 661 'autoload' => false, 662 'scope' => 'clips_edit', 663 ), 664 665 array( 666 'desc' => __( 'user:edit: Manage a user object."', 'twitchpress' ), 667 'id' => 'twitchpress_visitor_scope_user_edit', 668 'default' => $default, 669 'type' => 'scopecheckboxpublic', 670 'checkboxgroup' => '', 671 'show_if_checked' => 'yes', 672 'autoload' => false, 673 'scope' => 'user_edit', 674 ), 675 676 array( 677 'desc' => __( 'user:edit:broadcast: Edit your channel’s broadcast configuration, including extension configuration."', 'twitchpress' ), 678 'id' => 'twitchpress_visitor_scope_user_edit_broadcast', 679 'default' => $default, 680 'type' => 'scopecheckboxpublic', 681 'checkboxgroup' => '', 682 'show_if_checked' => 'yes', 683 'autoload' => false, 684 'scope' => 'user_edit_broadcast', 685 ), 686 687 array( 688 'desc' => __( 'user:read:broadcast: View your broadcasting configuration, including extension configurations."', 'twitchpress' ), 689 'id' => 'twitchpress_visitor_scope_user_read_broadcast', 690 'default' => $default, 691 'type' => 'scopecheckboxpublic', 692 'checkboxgroup' => '', 693 'show_if_checked' => 'yes', 694 'autoload' => false, 695 'scope' => 'user_read_broadcast', 696 ), 697 698 array( 699 'desc' => __( 'user:read:email: Read authorized user’s email address."', 'twitchpress' ), 700 'id' => 'twitchpress_visitor_scope_user_read_email', 701 'default' => $default, 702 'type' => 'scopecheckboxpublic', 703 'checkboxgroup' => '', 704 'show_if_checked' => 'yes', 705 'autoload' => false, 706 'scope' => 'user_read_email', 707 ), 708 621 709 array( 622 710 'type' => 'sectionend', -
channel-solution-for-twitch/trunk/includes/admin/views/html-admin-data.php
r1856051 r2024613 23 23 echo 'TwitchPress: ' . esc_html( $title ); 24 24 ?> 25 <?php if( get_option( 'twitch ress_sandbox_mode_switch' ) == 'yes' ) { _e( '- Sandbox Mode Active', 'twitchpress' ); }?>25 <?php if( get_option( 'twitchpress_sandbox_mode_switch' ) == 'yes' ) { _e( '- Sandbox Mode Active', 'twitchpress' ); }?> 26 26 </h1> 27 27 -
channel-solution-for-twitch/trunk/includes/admin/views/html-admin-page.php
r1856051 r2024613 23 23 echo 'TwitchPress: ' . esc_html( $title ); 24 24 ?> 25 <?php if( get_option( 'twitch ress_sandbox_mode_switch' ) == 'yes' ) { _e( ' - Sandbox Mode Active', 'twitchpress' ); }?>25 <?php if( get_option( 'twitchpress_sandbox_mode_switch' ) == 'yes' ) { _e( ' - Sandbox Mode Active', 'twitchpress' ); }?> 26 26 </h1> 27 27 -
channel-solution-for-twitch/trunk/includes/admin/views/html-admin-settings.php
r1856051 r2024613 11 11 <h1> 12 12 <?php _e( 'TwitchPress Settings', 'twitchpress' ); ?> 13 <?php if( get_option( 'twitch ress_sandbox_mode_switch' ) == 'yes' ) { _e( ' - Sandbox Mode Active', 'twitchpress' ); }?>13 <?php if( get_option( 'twitchpress_sandbox_mode_switch' ) == 'yes' ) { _e( ' - Sandbox Mode Active', 'twitchpress' ); }?> 14 14 </h1> 15 15 <form method="<?php echo esc_attr( apply_filters( 'twitchpress_settings_form_method_tab_' . $current_tab, 'post' ) ); ?>" id="mainform" action="" enctype="multipart/form-data"> -
channel-solution-for-twitch/trunk/includes/class.twitchpress-curl.php
r1966127 r2024613 11 11 * @category Class 12 12 * @author Ryan Bayne 13 * 14 * See class.twitchpress-extend-wp-http-curl.php for an alternative class that might replace this. 13 15 */ 14 16 … … 43 45 * @var mixed 44 46 */ 45 public $type = ' get';47 public $type = 'unset'; 46 48 47 49 /** … … 132 134 * @var array 133 135 */ 134 p rivate$curl_request_body = array();136 public $curl_request_body = array(); 135 137 136 138 /** … … 171 173 public $response_message = null; 172 174 173 public $originating_file = null;174 175 public $originating_function = null;176 177 public $originating_line = null;175 public $originating_file = 'Unknown'; 176 177 public $originating_function = 'Unknown'; 178 179 public $originating_line = 'Unknown'; 178 180 179 181 public $refresh_token = null; … … 182 184 $this->curl_version = curl_version(); 183 185 $this->current_user = get_current_user_id(); 184 } 185 186 /** 187 * Optional function offering all parameters when making a WP_Http_Curl 188 * call within the TwitchPress system. Use this to learn which values are available 189 * and then pass the returned array to call_start() as the $optional_args value. 190 * 191 * Any arguments not made will initially be populated by this classes defaults 192 * but later we might have options that over-ride in-line defaults. 193 * 194 * @uses WP_Http_Curl() 195 * @uses curl_version() 196 * 197 * @since 2.5.0 198 * @version 3.0 199 */ 200 public function call_params( $can_cache = null, $cache_time = null, $can_queue = null, $giving_user = null, $user_specific = null, $retry = null, $originating_function = null, $originating_line = null ) { 201 202 if( $can_cache ) 203 { 204 $this->can_cache = $can_cache; 205 } 206 else 207 { 208 // Apply the admin setting to override the classes default... 209 } 210 211 if( $cache_time ) 212 { 213 $this->cache_time = $cache_time; 214 } 215 else 216 { 217 // Apply the admin setting to override the classes default... 218 } 219 220 if( $can_queue ) 221 { 222 $this->can_queue = $can_queue; 223 } 224 else 225 { 226 // Apply the admin setting to override the classes default... 227 } 228 229 if( $user_specific ) 230 { 231 $this->user_specific = $user_specific; 232 } 233 else 234 { 235 // Apply the admin setting to override the classes default... 236 } 237 238 if( $retry ) 239 { 240 $this->retry = $retry; 241 } 242 else 243 { 244 // Apply the admin setting to override the classes default... 245 } 246 247 // Values that will not have settings... 248 $this->giving_user = $giving_user; 249 $this->originating_function = $originating_function; 250 $this->originating_line = $originating_line; 251 } 252 186 187 // Load and configure a BugNet object... 188 $this->bugnet = new BugNet(); 189 } 190 253 191 /** 254 192 * Required method when making a WP_Http_Curl call. … … 271 209 // Create the WordPress Http Curl object 272 210 $this->WP_Http_Curl_Object = new WP_Http_Curl(); 273 211 274 212 // Optional arguments submitted will over-ride $this default... 275 213 $this->arguments( $optional_args ); … … 290 228 } 291 229 230 // Handle WP_Error returned by WP_Http_Curl_Object() 231 if( is_wp_error( $this->curl_reply ) ) { 232 return false; 233 } 234 292 235 // Check, set and react to the response code... 293 236 $this->check_response_code(); … … 296 239 $this->decode_body(); 297 240 } 298 241 242 /** 243 * Optional function offering all parameters when making a WP_Http_Curl 244 * call within the TwitchPress system. Use this to learn which values are available 245 * and then pass the returned array to call_start() as the $optional_args value. 246 * 247 * Any arguments not made will initially be populated by this classes defaults 248 * but later we might have options that over-ride in-line defaults. 249 * 250 * @uses WP_Http_Curl() 251 * @uses curl_version() 252 * 253 * @since 2.5.0 254 * @version 3.0 255 */ 256 public function call_params( $can_cache = null, $cache_time = null, $can_queue = null, $giving_user = null, $user_specific = null, $retry = null, $originating_function = null, $originating_line = null ) { 257 258 if( $can_cache ) 259 { 260 $this->can_cache = $can_cache; 261 } 262 else 263 { 264 // Apply the admin setting to override the classes default... 265 } 266 267 if( $cache_time ) 268 { 269 $this->cache_time = $cache_time; 270 } 271 else 272 { 273 // Apply the admin setting to override the classes default... 274 } 275 276 if( $can_queue ) 277 { 278 $this->can_queue = $can_queue; 279 } 280 else 281 { 282 // Apply the admin setting to override the classes default... 283 } 284 285 if( $user_specific ) 286 { 287 $this->user_specific = $user_specific; 288 } 289 else 290 { 291 // Apply the admin setting to override the classes default... 292 } 293 294 if( $retry ) 295 { 296 $this->retry = $retry; 297 } 298 else 299 { 300 // Apply the admin setting to override the classes default... 301 } 302 303 // Values that will not have settings... 304 $this->giving_user = $giving_user; 305 $this->originating_function = $originating_function; 306 $this->originating_line = $originating_line; 307 } 308 299 309 /** 300 310 * Prepare final request values - always use this after the developer has been giving … … 318 328 'user_specific' => $this->user_specific, 319 329 'retry' => $this->retry, 330 'file' => $this->originating_line, 320 331 'function' => $this->originating_function, 321 332 'line' => $this->originating_line, … … 323 334 ); 324 335 325 // Prepare arguments...336 // Build the final request... 326 337 $this->curl_request = array( 327 'headers' => array(),338 'headers' => $this->headers, 328 339 'method' => strtoupper( $this->type ), 329 340 'body' => $this->curl_request_body, … … 333 344 'decompress' => false 334 345 ); 335 336 // Add custom headers... 337 if( $this->headers && is_array( $this->headers ) ) 338 { 339 $this->curl_request['headers'] = array_merge( $this->curl_request['headers'], $this->headers ); 340 } 341 342 } 343 344 /** 345 * Decide if the call can/should be made to Twitch.tv at this time or queue. 346 * 347 * @version 1.0 348 */ 349 public function queue() { 350 if( !$this->can_queue ) { $this->call_execute(); } 351 352 // We will check for a recent request and result that matches 353 $this->get_transient(); 354 } 355 346 } 347 348 public function add_headers( $new_headers = array() ) { 349 if( !$this->headers || !is_array( $this->headers ) ) { 350 $this->headers = array(); 351 } 352 353 $this->headers = array_merge( $new_headers, $this->headers ); 354 } 355 356 356 /** 357 357 * Check if there is a transient cache of the exact same call! … … 382 382 } 383 383 } 384 385 /** 386 * Decide if the call can/should be made to Twitch.tv at this time or queue. 387 * 388 * @version 1.0 389 */ 390 public function queue() { 391 if( !$this->can_queue ) { $this->call_execute(); } 392 393 // We will check for a recent request and result that matches 394 $this->get_transient(); 395 } 384 396 385 397 public function call_execute() { 386 398 387 399 $this->curl_reply = $this->WP_Http_Curl_Object->request( $this->endpoint, $this->curl_request ); 388 400 389 401 // Should this curl request be cached? 390 402 if( $this->can_cache ) … … 402 414 403 415 public function check_response_code() { 416 404 417 if( isset( $this->curl_reply['response']['code'] ) ) { 405 418 $this->response_code = $this->curl_reply['response']['code']; … … 419 432 } 420 433 434 public function get_curl_request() { 435 return $this->curl_request; 436 } 437 438 public function get_curl_request_body() { 439 return $this->curl_request_body; 440 } 441 421 442 public function user_output() { 422 443 -
channel-solution-for-twitch/trunk/includes/class.twitchpress-listener-main-account-oauth.php
r1977739 r2024613 21 21 22 22 if( !class_exists( 'TWITCHPRESS_Listener_Main_Twitchtv_Account_oAuth' ) ) : 23 24 class TWITCHPRESS_Listener_Main_Twitchtv_Account_oAuth {23 24 class TWITCHPRESS_Listener_Main_Twitchtv_Account_oAuth_Kraken { 25 25 public $rejection_reason = 'No incoming request detected.'; 26 26 public $scope = null; … … 36 36 37 37 // Is the request a return from Twitch? 38 if( !$this->detect() ) 39 { 38 if( !$this->detect() ){ 40 39 return; 41 40 } … … 48 47 49 48 // Did we get an access token and refresh token? 50 if( !$this->access_token || !$this->refresh_token ) 51 { 49 if( !$this->access_token || !$this->refresh_token ){ 52 50 return; 53 51 } … … 58 56 // Make a test call and confirm channel details. 59 57 $this->channel(); 60 58 61 59 unset( $this->api_calls ); 62 60 … … 162 160 $this->rejection_reason = __( 'Main Account Listener: Code is invalid.', 'twitchpress' ); 163 161 } 164 162 165 163 if( $return === true ) { 166 164 return false; 167 165 } 168 166 169 167 $this->redirect_to = $transient_state['redirectto']; 170 168 $this->code = sanitize_key( $_GET['code'] ); … … 183 181 $token_array = $this->api_calls->request_user_access_token( $this->code, __FUNCTION__ ); 184 182 unset( $twitch_api_calls ); 185 183 186 184 if( !$token_array ) 187 { 185 { 188 186 $this->rejection_reason = __( 'Twitch.tv rejected a request for a user token.', 'twitchpress' ); 189 187 return false; … … 215 213 twitchpress_update_main_channels_refresh_token( $this->refresh_token ); 216 214 twitchpress_update_main_channels_scopes( $this->returned_scope ); 217 218 // Store main channel scopes as the app scopes which is simply a way of219 // managing the applicable scopes when making requests...220 twitchpress_update_app_token_scopes( $this->returned_scope );221 215 222 216 TwitchPress_Admin_Notices::add_custom_notice( 'mainkrakenapplicationsetup', __( 'Twitch.tv provided a token to allow this site to access your channel based on the permissions (scopes) you selected.') ); … … 260 254 } 261 255 } 262 // changed from plugins_loaded 18th november 2018 263 add_action( 'init', array( new TWITCHPRESS_Listener_Main_Twitchtv_Account_oAuth(), 'listen' ), 50 ); 256 257 class TWITCHPRESS_Listener_Main_Twitchtv_Account_oAuth_Helix { 258 public $rejection_reason = 'No incoming request detected.'; 259 public $scope = null; 260 public $state = null; 261 public $code = null; 262 public $wp_user_id = null; 263 public $access_token = null; 264 public $refresh_token = null; 265 public $returned_scope = null; 266 public $redirect_to = null; 267 268 function listen() { 269 270 // Is the request a return from Twitch? 271 if( !$this->detect() ) 272 { 273 return; 274 } 275 276 // We will need to make a call to Twitch. 277 $this->api_calls = new TwitchPress_Twitch_API(); 278 279 // detect() establishes what we need to request a token. 280 $this->token(); 281 282 // Did we get a refresh token? 283 if( !$this->refresh_token ) 284 { 285 return; 286 } 287 288 // Did we get an access token? 289 if( !$this->access_token ) 290 { 291 return; 292 } 293 294 // Store all credentials now in this class object. 295 $this->store(); 296 297 // Make a test call and confirm channel details. 298 $this->channel(); 299 300 // Storage went well, redirect the user to a suitable page. 301 $this->redirect(); 302 exit; 303 } 304 305 function detect() { 306 307 if ( $_SERVER['REQUEST_METHOD'] !== 'GET' ) { 308 return false; 309 } 310 311 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { 312 return false; 313 } 314 315 if( defined( 'DOING_CRON' ) && DOING_CRON ) { 316 return false; 317 } 318 319 if( defined( 'DOING_AJAX' ) && DOING_AJAX ) { 320 return false; 321 } 322 323 // This listener is for requests started on administration side only. 324 if( !is_user_logged_in() ) { 325 return false; 326 } 327 328 $this->wp_user_id = get_current_user_id(); 329 330 // This is not a listener for processing WordPress logins. 331 // This $_GET is set by TwitchPress_Login_Extension. 332 if( isset( $_GET['twitchpress_sentto_login'] ) ) { 333 return false; 334 } 335 336 // Create a notice for an error. 337 if( isset( $_GET['error'] ) ) { 338 return false; 339 } 340 341 if( !isset( $_GET['scope'] ) ) { 342 return false; 343 } 344 345 $this->scope = sanitize_text_field( $_GET['scope'] ); 346 347 if( !isset( $_GET['state'] ) || !is_string( $_GET['state'] ) ) { 348 return false; 349 } 350 351 $this->state = sanitize_key( $_GET['state'] ); 352 353 // Change to true when $_REQUEST cannot be validated. 354 $return = false; 355 356 if( !isset( $_GET['code'] ) ) { 357 $return = true; 358 $this->rejection_reason = __( 'Main Account Listener: No code returned.', 'twitchpress' ); 359 } 360 361 // We require the local state value stored in transient. 362 elseif( !$transient_state = get_transient( 'twitchpress_oauth_' . $this->state ) ) { 363 $return = true; 364 $this->rejection_reason = __( 'Main Account Listener: No matching transient.', 'twitchpress' ); 365 } 366 367 // Ensure the reason for this request is an attempt to set the main channels credentials 368 elseif( !isset( $transient_state['reason'] ) ) { 369 $return = true; 370 $this->rejection_reason = __( 'Main Account Listener: Reason not provided for this request.', 'twitchpress' ); 371 } 372 373 // Ensure we have the admin view or page the user needs to be sent to. 374 elseif( $transient_state['reason'] !== 'mainchannelsetup' ) { 375 $return = true; 376 $this->rejection_reason = __( 'Main Account Listener: Request reason rejected for this procedure.', 'twitchpress' ); 377 } 378 379 // Ensure we have the admin view or page the user needs to be sent to. 380 elseif( !isset( $transient_state['redirectto'] ) ) { 381 $return = true; 382 $this->rejection_reason = __( 'Main Account Listener: The redirectto value does not exist.', 'twitchpress' ); 383 } 384 385 // For this procedure the userrole MUST be administrator. 386 elseif( !isset( $transient_state['userrole'] ) ) { 387 $return = true; 388 $this->rejection_reason = __( 'Main Account Listener: this request is not an expected operation related to the main account.', 'twitchpress' ); 389 } 390 391 elseif( !isset( $transient_state['userrole'] ) || 'administrator' !== $transient_state['userrole'] ) { 392 $return = true; 393 $this->rejection_reason = __( 'Main Account Listener: User is not an administrator.', 'twitchpress' ); 394 } 395 396 // NEW IF - Validate the code as a measure to prevent URL spamming that gets further than here. 397 elseif( !twitchpress_validate_code( $_GET['code'] ) ) { 398 $return = true; 399 $this->rejection_reason = __( 'Main Account Listener: Code is invalid.', 'twitchpress' ); 400 } 401 402 if( $return === true ) { 403 return false; 404 } 405 406 // No reason to reject the request... 407 $this->rejection_reason = __( 'Not rejected', 'twitchpress' ); 408 409 $this->redirect_to = $transient_state['redirectto']; 410 $this->code = sanitize_key( $_GET['code'] ); 411 412 // This is a genuine Twitch.tv response! 413 return true; 414 } 415 416 /** 417 * Request a token. 418 * 419 * @version 1.0 420 */ 421 function token() { 422 // Request oAuth token for the current user and the main channel. 423 $token_array = $this->api_calls->request_user_access_token( $this->code, __FUNCTION__ ); 424 425 if( !$token_array ) 426 { 427 $this->rejection_reason = __( 'Twitch.tv rejected a request for a user token.', 'twitchpress' ); 428 return false; 429 } 430 431 $this->access_token = $token_array->access_token; 432 $this->refresh_token = $token_array->refresh_token; 433 $this->returned_scope = $token_array->scope; 434 } 435 436 /** 437 * Store credentials. 438 * 439 * @version 1.0 440 */ 441 function store() { 442 443 // Update current user although this is a main channel procedure. 444 // This is to enforce the user as the owner of the logged in Twitch account and the main channel. 445 twitchpress_update_user_code( $this->wp_user_id, $this->code ); 446 twitchpress_update_user_token( $this->wp_user_id, $this->access_token ); 447 twitchpress_update_user_token_refresh( $this->wp_user_id, $this->refresh_token ); 448 449 // Start storing main channel credentials. 450 update_option( 'twitchpress_main_code', $this->code );// old value, being phased out. 451 twitchpress_update_main_channels_code( $this->code ); 452 twitchpress_update_main_channels_wpowner_id( $this->wp_user_id ); 453 twitchpress_update_main_channels_token( $this->access_token ); 454 twitchpress_update_main_channels_refresh_token( $this->refresh_token ); 455 twitchpress_update_main_channels_scopes( $this->returned_scope ); 456 457 // Store main channel scopes as the app scopes which is simply a way of 458 // managing the applicable scopes when making requests... 459 twitchpress_update_app_token_scopes( $this->returned_scope ); 460 461 TwitchPress_Admin_Notices::add_custom_notice( 'mainkrakenapplicationsetup', __( 'Twitch.tv provided a token to allow this site to access your channel based on the permissions (scopes) you selected.') ); 462 } 463 464 /** 465 * Make a test call by getting the current users Twitch channel and take 466 * the opportunity to get any data we do not yet have. 467 * 468 * @version 2.0 469 */ 470 function channel() { 471 // Confirm the giving main (default) channel is valid. 472 $user_objects = $this->api_calls->get_users( twitchpress_get_main_channels_name() ); 473 474 twitchpress_var_dump( $user_objects ); 475 wp_die(); 476 477 if( !isset( $user_objects['users'][0]['_id'] ) ) { 478 TwitchPress_Admin_Notices::add_custom_notice( 'listenerchanneldoesnotexist', __( '<strong>Channel Was Not Confirmed:</strong> TwitchPress wants to avoid errors in future by ensuring what you typed is correct. So far it could not confirm your entered channel is correct. Please check the spelling of your channel and the status of Twitch. If your entered channel name is correct and Twitch is online, please report this message.', 'twitchpress' ) ); 479 return; 480 } 481 482 twitchpress_update_main_channels_id( $user_objects['users'][0]['_id'] ); 483 484 // Assume the channel is owned by the current logged in admin or they just want it paired with the current WP account. 485 // Store all possible details in user meta. 486 twitchpress_update_user_oauth( 487 $this->wp_user_id, 488 $this->code, 489 $this->access_token, 490 $user_objects['users'][0]['_id'] 491 ); 492 } 493 494 /** 495 * Forward user to the custom destinaton i.e. where they were before oAuth2. 496 * 497 * @version 1.0 498 */ 499 function redirect() { 500 twitchpress_redirect_tracking( $this->redirect_to, __LINE__, __FUNCTION__ ); 501 exit; 502 } 503 } 504 505 if( TWITCHPRESS_API_NAME == 'kraken' ) 506 { 507 add_action( 'init', array( new TWITCHPRESS_Listener_Main_Twitchtv_Account_oAuth_Kraken(), 'listen' ), 50 ); 508 } 509 else 510 { 511 add_action( 'init', array( new TWITCHPRESS_Listener_Main_Twitchtv_Account_oAuth_Helix(), 'listen' ), 50 ); 512 } 264 513 265 514 endif; -
channel-solution-for-twitch/trunk/includes/class.twitchpress-listener.php
r1710928 r2024613 117 117 ); 118 118 } 119 } 120 121 /** 122 * Handles request from Developer Toolbar to sync the main channels 123 * feed into WP. 124 * 125 * @version 1.0 126 */ 127 private static function developertoolbar_sync_main_channel_feed_to_wp() { 128 129 // Security is done already but we need safeguards should the method be called elsewhere. 130 if( !user_can( TWITCHPRESS_CURRENTUSERID, 'activate_plugins' ) ) { 131 return; 132 } 133 134 $verify_nonce = wp_verify_nonce( $_REQUEST['_wpnonce'], 'twitchpresssyncmainfeedtowp' ); 135 136 if ( $verify_nonce ) { 137 138 $result = twitchpress_sync_feed_to_wp(); 139 140 $total = 0; 141 if( is_array( $result ) ) { 142 $total = count( $result ); 143 } 144 145 TwitchPress_Admin_Notices::add_wordpress_notice( 146 'devtoolbarnotice-syncmainfeedtowp', 147 'success', 148 true, 149 __( 'Feed Posts Imported', 'twitchpress' ), 150 sprintf( __( 'TwitchPress imported %s channel feed entries.', 'twitchpress' ), $total ) 151 ); 152 } 153 } 119 } 154 120 } 155 121 -
channel-solution-for-twitch/trunk/includes/class.twitchpress-post-types.php
r1941995 r2024613 26 26 add_filter( 'rest_api_allowed_post_types', array( __CLASS__, 'rest_api_allowed_post_types' ) ); 27 27 add_action( 'twitchpress_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) ); 28 //add_action( 'add_meta_boxes', array( __CLASS__, 'add_custom_boxes' ) );28 add_action( 'add_meta_boxes', array( __CLASS__, 'add_custom_boxes' ) ); 29 29 add_action( 'save_post', array( __CLASS__, 'save_twitchpress_post_sharing_options' ) ); 30 30 add_action( 'post_submitbox_misc_actions', array( __CLASS__, 'post_submitbox' ) ); … … 40 40 } 41 41 42 if ( taxonomy_exists( 'twitchfeed_type' ) ) {43 return;42 if ( !taxonomy_exists( 'twitchfeed_type' ) ) { 43 self::register_taxonomy_feed(); 44 44 } 45 45 46 46 do_action( 'twitchpress_register_taxonomy' ); 47 47 48 } 49 50 public static function register_taxonomy_feed() { 48 51 $permalinks = twitchpress_get_permalink_structure(); 49 52 … … 131 134 ); 132 135 133 do_action( 'twitchpress_after_register_taxonomy' ); 136 do_action( 'twitchpress_after_register_taxonomy' ); 134 137 } 135 138 … … 371 374 } 372 375 373 TwitchPress_Post_types::init();376 //TwitchPress_Post_types::init(); -
channel-solution-for-twitch/trunk/includes/class.twitchpress-set-app.php
r1977739 r2024613 3 3 * TwitchPress - Twitch API application credentials are set here ONLY! 4 4 * 5 * In theory this class will be initiated once during any request. So the goal6 * is to establish a working set of application credentials for use during that7 * request.5 * Class is initiated and added to the object registry for use by any plugin within 6 * any request. In theory this class will be initiated once during any page request 7 * but we can use it to check on app status. 8 8 * 9 9 * @author Ryan Bayne … … 26 26 public $app_redirect = null; 27 27 public $app_token = null; 28 29 /** 30 * Scopes to be accepted by visitors for this application. Scopes are not 31 * required by the application itself. 32 * 33 * @var mixed 34 */ 28 35 public $app_scopes = null; 36 public $app_ready = true; 29 37 30 38 public function __construct() { … … 41 49 $this->app_expiry = get_option( 'twitchpress_app_expiry', 0 ); 42 50 43 // Handle a missing token post setup completion... 51 // Consider a first time plugin activation scenario... 52 if( !$this->app_id && $this->app_secret && $this->app_redirect && $this->app_token && $this->app_scopes && $this->app_expiry ) { 53 return $this->bugnet->log( __FUNCTION__, __( 'Twitch application has not been setup yet!', 'twitchpress' ), array(), true, false ); 54 } 55 44 56 if( !$this->app_token && $this->app_id && $this->app_secret && $this->app_redirect ) 45 57 { … … 48 60 else 49 61 { 50 // Ensure token is still valid else request new one... ijk62 // Ensure token is still valid else request new one... 51 63 add_action( 'init', array( $this, 'validate_token' ), 5 ); 52 64 } 65 } 66 67 public function status( $code = false ) { 68 69 if( !$this->app_id && !$this->app_secret && !$this->app_redirect && !$this->app_token && !$this->app_scopes && !$this->app_expiry ) 70 { 71 if( $code ){ return 0; } 72 return array( 0, __( 'Twitch application credentials have not been setup. Please complete the Setup Wizard.', 'twitchpress' ) ); 73 } 74 75 if( !$this->app_id ) 76 { 77 if( $code ){ return 2; } 78 return array( 2, __( 'Twitch application ID has not been stored. Correct this by completing the Setup Wizard.', 'twitchpress' ) ); 79 } 80 81 if( !$this->app_secret ) 82 { 83 if( $code ) { return 3; } 84 return array( 3, __( 'Twitch application secret has not been stored. You can fix this by completing the Setup Wizard or in Settings.', 'twitchpress' ) ); 85 } 86 87 if( !$this->app_redirect ) 88 { 89 if( $code ) { return 4; } 90 return array( 4, __( 'Twitch application needs a redirect value. You can resolve this in Settings under the Twitch API tab.', 'twitchpress' ) ); 91 92 } 93 94 if( !$this->app_scopes ) 95 { 96 if( $code ) { return 5; } 97 return array( 5, __( 'No scope/permissions have been stored for the Twitch application. You can add those in the Setup Wizard and Settings.', 'twitchpress' ) ); 98 99 } 100 101 if( !$this->app_token ) 102 { 103 if( $code ) { return 6; } 104 return array( 6, __( 'No token was found for the Twitch API application. This should be generated automatically and is an issue that needs immediate attention.', 'twitchpress' ) ); 105 } 106 107 // Returning 1 is suitable for a positive result (true)... 108 if( $code ){ return 1; } 109 return array( 1, __( 'Twitch API application is ready!', 'twitchpress' ) ); 53 110 } 54 111 … … 66 123 } 67 124 68 /**69 * Use application credentials to request an access_token which has70 * gone missing from WP options table.71 *72 * This method assumes that all other applications credentials exist.73 *74 * @version 1.075 */76 125 public function missing_token() { 77 126 78 127 // Create our own special Curl object which uses WP_Http_Curl() 79 128 $call_object = new TwitchPress_Curl(); 129 $call_object->originating_file = __FILE__; 80 130 $call_object->originating_function = __FUNCTION__; 81 131 $call_object->originating_line = __LINE__; 82 132 $call_object->type = 'POST'; 83 $call_object->endpoint = 'https://api.twitch.tv/kraken/oauth2/token?client_id=' . twitchpress_get_app_id(); 84 133 134 if( TWITCHPRESS_API_NAME == 'kraken' ) 135 { 136 $call_object->endpoint = 'https://api.twitch.tv/kraken/oauth2/token?client_id=' . twitchpress_get_app_id(); 137 } 138 else 139 { 140 $call_object->endpoint = 'https://id.twitch.tv/oauth2/token'; 141 } 142 85 143 // Set none API related parameters i.e. cache and rate controls... 86 144 $call_object->call_params( … … 90 148 null, 91 149 false, 92 false 150 false, 151 __FUNCTION__, 152 __LINE__ 93 153 ); 94 154 … … 119 179 twitchpress_update_app_token_expiry( $call_object->curl_reply_body->expires_in ); 120 180 121 $this->bugnet->log( __FUNCTION__, __( 'Replacement access_token and expiry stored.', 'twitchpress' ), array(), true, false ); 122 } 123 124 /** 125 * Validates the current application access_token and if not valid 126 * will request a new one. 127 * 128 * @version 1.0 129 */ 181 // Update this objects app_token value... 182 $this->app_token = $call_object->curl_reply_body->access_token; 183 184 $this->bugnet->log( __FUNCTION__, __( 'Replacement access_token and expiry was stored.', 'twitchpress' ), array(), true, false ); 185 } 186 130 187 public function validate_token() { 188 189 // Lets be sure we actually have a token... 190 if( !$this->app_token ) { 191 return $this->bugnet->log( __FUNCTION__, __( 'Token validation could not be performed because the app access token was not set and may not exist!', 'twitchpress' ), array(), true, false ); 192 } 131 193 132 194 // Create our own special Curl object which uses WP_Http_Curl() 133 195 $call_object = new TwitchPress_Curl(); 196 $call_object->originating_file = __FILE__; 134 197 $call_object->originating_function = __FUNCTION__; 135 198 $call_object->originating_line = __LINE__; 136 199 $call_object->type = 'GET'; 137 $call_object->endpoint = 'https://id.twitch.tv/oauth2/validate'; 138 200 201 if( TWITCHPRESS_API_NAME == 'kraken' ) 202 { 203 $call_object->endpoint = 'https://id.twitch.tv/oauth2/validate'; 204 } 205 else 206 { 207 $call_object->endpoint = 'https://id.twitch.tv/oauth2/validate'; 208 } 209 139 210 // Set none API related parameters i.e. cache and rate controls... 140 211 $call_object->call_params( … … 144 215 null, 145 216 false, 146 false 217 false, 218 __FUNCTION__, 219 __LINE__ 147 220 ); 148 149 // Add the access_token as an OAuth header... 150 $call_object->headers = array( 151 'Authorization' => 'OAuth ' . $this->app_token, 152 'Accept' => 'application/vnd.twitchtv.v5+json' 153 ); 154 221 222 if( TWITCHPRESS_API_NAME == 'kraken' ) 223 { 224 // Add the access_token as an OAuth header... 225 $call_object->headers = array( 226 'Authorization' => 'OAuth ' . $this->app_token, 227 'Accept' => 'application/vnd.twitchtv.v5+json' 228 ); 229 } 230 else 231 { 232 // Add the access_token as an OAuth header... 233 $call_object->headers = array( 234 'Authorization' => 'OAuth ' . $this->app_token, 235 //'Accept' => 'application/vnd.twitchtv.v5+json' 236 ); 237 } 238 155 239 // Start + make the request to Twitch.tv API in one line... 156 240 $call_object->do_call( 'twitch' ); … … 171 255 // Request a new access_token (stored as app_token in the TwitchPress system)... 172 256 $this->new_token(); 173 174 } 175 176 /** 177 * Request a new access_token - usually on the expiry of a previous because 178 * the first token is generated during the Setup Wizard. 179 * 180 * @version 1.0 181 */ 257 } 258 182 259 public function new_token() { 183 260 184 261 // Create our own special Curl object which uses WP_Http_Curl() 185 262 $call_object = new TwitchPress_Curl(); 263 $call_object->originating_function = __FILE__; 186 264 $call_object->originating_function = __FUNCTION__; 187 265 $call_object->originating_line = __LINE__; 188 266 $call_object->type = 'POST'; 189 $call_object->endpoint = 'https://api.twitch.tv/kraken/oauth2/token?client_id=' . twitchpress_get_app_id(); 190 267 268 if( TWITCHPRESS_API_NAME == 'kraken' ) 269 { 270 $call_object->endpoint = 'https://api.twitch.tv/kraken/oauth2/token?client_id=' . twitchpress_get_app_id(); 271 } 272 else 273 { 274 $call_object->endpoint = 'https://id.twitch.tv/oauth2/token'; 275 } 276 191 277 // Set none API related parameters i.e. cache and rate controls... 192 278 $call_object->call_params( … … 196 282 null, 197 283 false, 198 false 284 false, 285 __FUNCTION__, 286 __LINE__ 199 287 ); 200 288 … … 224 312 twitchpress_update_app_token_expiry( $call_object->curl_reply_body->expires_in ); 225 313 226 $this->bugnet->log( __FUNCTION__, __( 'New access_token and expiry time stored.', 'twitchpress' ), array(), true, false );314 return $this->bugnet->log( __FUNCTION__, __( 'New access_token and expiry time stored.', 'twitchpress' ), array(), true, false ); 227 315 } 228 316 } -
channel-solution-for-twitch/trunk/includes/class.twitchpress-sync.php
r1971902 r2024613 139 139 } 140 140 141 $id = twitchpress_get_main_channel _id();// Right now everything defaults to the main channel.141 $id = twitchpress_get_main_channels_twitchid();// Right now everything defaults to the main channel. 142 142 143 143 $earliest_time = $option['last_time'] + $option['delay']; … … 705 705 * @returns true if a change is made and false if no change to sub status has been made. 706 706 * 707 * @version 2. 2707 * @version 2.5 708 708 */ 709 709 private function main_channel_sub_sync( $user_id, $output_notice = false ) { … … 732 732 733 733 // Get possible existing sub plan from an earlier sub sync... 734 $local_sub_plan = get_user_meta( $user_id, 'twitchpress_sub_plan_' . twitchpress_get_main_channel_id(), true );734 $local_sub_plan = get_user_meta( $user_id, 'twitchpress_sub_plan_' . $channel_id, true ); 735 735 736 736 // If Twitch user is a subscriber to channel do_action() early here, maybe a simple thank you notice. … … 1159 1159 echo __( 'Ready', 'twitchpress-sync' ); 1160 1160 return; 1161 1162 /* TODO: If scopes allow it, make a call and test the token and code.1163 // Make a call using users token and code, confirming validity.1164 $kraken = new TWITCHPRESS_Twitch_API_Calls();1165 $sub_call_result = $kraken->chat_generateToken( $token, $code );1166 if( !$sub_call_result )1167 {1168 echo __( 'New Token Required - Please logout then login using Twitch', 'twitchpress-sync' );1169 return;1170 }1171 */1172 1161 } 1173 1162 -
channel-solution-for-twitch/trunk/includes/functions.twitchpress-frontend-notices.php
r1966127 r2024613 35 35 * @version 1.0 36 36 */ 37 function twitchpress_display_frontend_notices_the_content( string$post_content ) {37 function twitchpress_display_frontend_notices_the_content( $post_content ) { 38 38 global $GLOBALS; 39 39 -
channel-solution-for-twitch/trunk/includes/functions.twitchpress-shortcodes.php
r1966127 r2024613 16 16 } 17 17 18 function twitchpress_videos_shortcode( $atts ) { 19 $html_output = ''; 20 21 $atts = shortcode_atts( array( 22 'id' => null, 23 'user_id' => null, 24 'game_id' => null, 25 'after' => null, 26 'before' => null, 27 'first' => null, 28 'language' => null, 29 'period' => null, 30 'sort' => null, 31 'type' => null, 32 'links' => false 33 ), $atts, 'twitchpress_video' ); 34 35 $transient_code = $atts['id'] . $atts['user_id'] . $atts['game_id']; 36 37 if( $cache = get_transient( 'twitchpress_video' . $transient_code ) ) { 38 // return $cache; 39 } 40 41 // Get the stream. 42 $helix = new TWITCHPRESS_Twitch_API(); 43 44 $result = $helix->get_videos( $atts['id'], $atts['user_id'], $atts['game_id'] ); 45 46 if( $result ) 47 { 48 if( $atts['links'] ) 49 { 50 $html_output .= '<ol>'; 51 foreach( $result->data as $key => $item ) 52 { 53 $html_output .= '<li>'; 54 $html_output .= '<a href="' . $item->url . '">' . $item->title . '</a>'; 55 $html_output .= '</li>'; 56 } 57 $html_output .= '</ol>'; 58 } 59 else 60 { 61 $html_output .= '<ol>'; 62 foreach( $result->data as $key => $item ) 63 { 64 $html_output .= '<li>'; 65 66 $html_output .= ' 67 <iframe 68 src="https://player.twitch.tv/?video=' . $item->id . '&autoplay=false" 69 height="720" 70 width="1280" 71 frameborder="0" 72 scrolling="no" 73 allowfullscreen="true"> 74 </iframe>'; 75 76 $html_output .= '</li>'; 77 } 78 $html_output .= '</ol>'; 79 } 80 } 81 82 set_transient( 'twitchpress_videos' . $transient_code, $html_output, 86400 ); 83 84 return $html_output; 85 } 86 add_shortcode( 'twitchpress_videos', 'twitchpress_videos_shortcode' ); 87 88 function twitchpress_get_top_games_list_shortcode( $atts ) { 89 $html_output = ''; 90 91 $atts = shortcode_atts( array( 92 'total' => 10, 93 ), $atts, 'twitchpress_get_top_games_list' ); 94 95 if( $cache = get_transient( 'twitchpress_get_top_games_list' . $atts['total'] ) ) { 96 return $cache; 97 } 98 // Get the stream. 99 $helix = new TWITCHPRESS_Twitch_API(); 100 101 $result = $helix->get_top_games( null, null, $atts['total'] ); 102 103 if( $result && isset( $result->data[0] ) ) 104 { 105 $html_output .= '<ol>'; 106 foreach( $result->data as $key => $game ) 107 { 108 $html_output .= '<li>'; 109 $html_output .= $game->name; 110 $html_output .= '</li>'; 111 } 112 $html_output .= '</ol>'; 113 } 114 115 set_transient( 'twitchpress_get_top_games_list' . $atts['total'], $html_output, 86400 ); 116 117 return $html_output; 118 } 119 add_shortcode( 'twitchpress_get_top_games_list', 'twitchpress_get_top_games_list_shortcode' ); 120 18 121 /** 19 122 * Shortcode outputs a basic status for the giving channel. … … 23 126 * @version 1.1 24 127 */ 25 function twitchpress_channel_status_shortcode( $atts ) { 128 function twitchpress_channel_status_line_shortcode( $atts ) { 129 if( TWITCHPRESS_API_NAME == 'kraken' ) 130 { 131 return twitchpress_channel_status_line_kraken( $atts ); 132 } 133 else 134 { 135 return twitchpress_channel_status_line_helix( $atts ); 136 } 137 } 138 function twitchpress_channel_status_line_kraken( $atts ) { 26 139 $html_output = null; 27 140 … … 38 151 39 152 // Check cache. 40 if( $cache = get_transient( 'twitchpress_shortcode_channel_status ' ) )153 if( $cache = get_transient( 'twitchpress_shortcode_channel_status_line' ) ) 41 154 { 42 155 return $cache; 43 156 } 44 45 if( TWITCHPRESS_API_NAME == 'kraken' ) 46 { 47 $twitchpress = new TWITCHPRESS_Twitch_API_Calls(); 48 } 49 else 50 { # untested 51 $helix = new TWITCHPRESS_Twitch_API(); 52 } 157 158 $twitchpress = new TWITCHPRESS_Twitch_API_Calls(); 53 159 54 160 // Get channel ID using the channel/username. … … 84 190 } 85 191 86 set_transient( 'twitchpress_shortcode_channel_status ', $html_output, 120 );192 set_transient( 'twitchpress_shortcode_channel_status_line', $html_output, 120 ); 87 193 88 194 return $html_output; 89 195 } 90 add_shortcode( 'twitchpress_channel_status', 'twitchpress_channel_status_shortcode' ); 196 function twitchpress_channel_status_line_helix( $atts ) { 197 198 $atts = shortcode_atts( array( 199 'channel_id' => null, 200 'channel_name' => null, 201 ), $atts, 'twitchpress_channel_status' ); 202 203 // If no channel ID or name is giving... 204 if( !$atts['channel_id'] && !$atts['channel_name'] ) { 205 return __( 'Channel status-line shortcode has not been setup!', 'twitchpress' ); 206 } 207 208 // Establish an ID if we only have a channel name... 209 if( !$atts['channel_id'] && $atts['channel_name'] ) { 210 $helix = new TWITCHPRESS_Twitch_API(); 211 $result = $helix->get_user_by_login_name_without_email_address( $atts['channel_name'] ); 212 if( isset( $result->data[0]->id ) ) { 213 $channel_id = $result->data[0]->id; 214 } else { 215 $channel_id = null; 216 $html_output = sprintf( __( 'Failed to retrieve channel ID %s', 'twitchpress' ), esc_html( $atts['channel_name'] ) ); 217 } 218 } 219 220 // Use cached HTML if we have a channel ID... 221 if( $channel_id ) { 222 $cache = get_transient( 'twitchpress_channel_status_line_' . $channel_id ); 223 if( $cache ) { 224 return $cache; 225 } 226 } 227 228 // Get the stream. 229 if( !$helix ){ $helix = new TWITCHPRESS_Twitch_API(); } 230 231 $result = $helix->get_stream_by_userid( $channel_id ); 232 233 if( !$result || $result->type !== 'live' ) 234 { 235 $html_output = '<p>' . __( 'Channel Offline', 'twitchpress' ) . '</p>'; 236 } 237 else 238 { 239 $html_output = '<p>' . __( 'Channel Live', 'twitchpress' ) . '</p>'; 240 } 241 242 set_transient( 'twitchpress_channel_status_line' . $channel_id, $html_output, 120 ); 243 244 return $html_output; 245 } 246 add_shortcode( 'twitchpress_channel_status_line', 'twitchpress_channel_status_line_shortcode' ); 247 91 248 92 249 /** 93 250 * Shortcode outputs a status line for the giving channel. 94 251 * 95 * @version 1.0252 * @version 2.0 96 253 */ 97 function twitchpress_channel_status_line_shortcode( $atts ) { 254 function twitchpress_channel_status_shortcode( $atts ) { 255 if( TWITCHPRESS_API_NAME == 'kraken' ) 256 { 257 return twitchpress_channel_status_shortcode_kraken( $atts ); 258 } 259 else 260 { 261 return twitchpress_channel_status_shortcode_helix( $atts ); 262 } 263 } 264 function twitchpress_channel_status_shortcode_kraken( $atts ) { 265 98 266 $atts = shortcode_atts( array( 99 267 'channel_id' => null, … … 113 281 } 114 282 115 if( TWITCHPRESS_API_NAME == 'kraken' ) 116 { 117 $twitchpress = new TWITCHPRESS_Twitch_API_Calls(); 118 } 119 else 120 { # untested 121 $helix = new TWITCHPRESS_Twitch_API(); 122 } 123 283 $twitchpress = new TWITCHPRESS_Twitch_API_Calls(); 284 124 285 // Get channel ID using the channel/username. 125 286 if( $atts['channel_id'] === null && $atts['channel_name'] !== null ) … … 162 323 return $html_output; 163 324 } 164 add_shortcode( 'twitchpress_channel_status_line', 'twitchpress_channel_status_line_shortcode' ); 325 function twitchpress_channel_status_shortcode_helix( $atts ) { 326 $atts = shortcode_atts( array( 327 'channel_id' => null, 328 'channel_name' => null, 329 ), $atts, 'twitchpress_channel_status' ); 330 331 // If no channel ID or name is giving... 332 if( !$atts['channel_id'] && !$atts['channel_name'] ) { 333 return __( 'Channel status shortcode has not been setup!', 'twitchpress' ); 334 } 335 336 // Establish an ID if we only have a channel name... 337 if( !$atts['channel_id'] && $atts['channel_name'] ) { 338 $helix = new TWITCHPRESS_Twitch_API(); 339 $result = $helix->get_user_by_login_name_without_email_address( $atts['channel_name'] ); 340 if( isset( $result->data[0]->id ) ) { 341 $channel_id = $result->data[0]->id; 342 } else { 343 $channel_id = null; 344 $html_output = sprintf( __( 'Failed to retrieve channel ID %s', 'twitchpress' ), esc_html( $atts['channel_name'] ) ); 345 } 346 } 347 348 // Use cached HTML if we have a channel ID... 349 if( $channel_id ) { 350 $cache = get_transient( 'twitchpress_channel_status_line_' . $channel_id ); 351 if( $cache ) { 352 return $cache; 353 } 354 } 355 356 // Get the stream. 357 if( !$helix ){ $helix = new TWITCHPRESS_Twitch_API(); } 358 359 $result = $helix->get_stream_by_userid( $channel_id ); 360 361 if( !$result || $result->type !== 'live' ) 362 { 363 $html_output = '<p>' . __( 'Channel Offline', 'twitchpress' ) . '</p>'; 364 } 365 else 366 { 367 $html_output = '<p>'; 368 $html_output .= ' ' . esc_html( $result->user_name ) . ' '; 369 $html_output .= ' is live with ' . esc_html( $result->viewer_count ) . ' viewers '; 370 $html_output .= '</p>'; 371 } 372 373 set_transient( 'twitchpress_channel_status' . $channel_id, $html_output, 120 ); 374 375 return $html_output; 376 } 377 add_shortcode( 'twitchpress_channel_status', 'twitchpress_channel_status_shortcode' ); 378 165 379 166 380 /** 167 381 * Shortcode outputs a status box with some extra information for the giving channel. 168 382 * 169 * @version 1.0383 * @version 2.0 170 384 */ 171 function twitchpress_channel_status_box_shortcode( $atts ) { 385 function twitchpress_channel_status_box_shortcode( $atts ) { 386 if( TWITCHPRESS_API_NAME == 'kraken' ) 387 { 388 return twitchpress_channel_status_box_shortcode_kraken( $atts ); 389 } 390 else 391 { 392 return twitchpress_channel_status_box_shortcode_helix( $atts ); 393 } 394 } 395 function twitchpress_channel_status_box_shortcode_kraken( $atts ) { 172 396 $atts = shortcode_atts( array( 173 397 'channel_id' => null, … … 178 402 if( $atts['channel_id'] === null && $atts['channel_name'] === null ) 179 403 { 180 return ' ';404 return 'Shortcode has not been setup properly!'; 181 405 } 182 406 … … 186 410 return $cache; 187 411 } 188 189 if( TWITCHPRESS_API_NAME == 'kraken' ) 190 { 191 $twitchpress = new TWITCHPRESS_Twitch_API_Calls(); 192 } 193 else 194 { # untested 195 $helix = new TWITCHPRESS_Twitch_API(); 196 } 412 413 $twitchpress = new TWITCHPRESS_Twitch_API_Calls(); 197 414 198 415 // Get channel ID using the channel/username. … … 232 449 $html_output .= '<br />Followers: ' . $channel_object['channel']['followers'] . ' '; 233 450 $html_output .= '</div>'; 234 235 return $html_output; 236 } 237 238 set_transient( 'twitchpress_shortcode_channel_status_box', $html_output, 120 ); 451 } 452 453 set_transient( 'twitchpress_channel_status_box', $html_output, 120 ); 239 454 240 455 return $html_output; 241 456 } 242 add_shortcode( 'twitchpress_channel_status_box', 'twitchpress_channel_status_box_shortcode' ); 243 457 function twitchpress_channel_status_box_shortcode_helix( $atts ) { 458 $atts = shortcode_atts( array( 459 'channel_id' => null, 460 'channel_name' => null, 461 ), $atts, 'twitchpress_shortcode_channel_status_box' ); 462 463 // Establish channel ID 464 if( $atts['channel_id'] === null && $atts['channel_name'] === null ) 465 { 466 return 'Shortcode has not been setup properly!'; 467 } 468 $helix = new TWITCHPRESS_Twitch_API(); 469 470 // Establish an ID if we only have a channel name... 471 if( !$atts['channel_id'] && $atts['channel_name'] ) { 472 $helix = new TWITCHPRESS_Twitch_API(); 473 $result = $helix->get_user_without_email_by_login_name( $atts['channel_name'] ); 474 if( isset( $result->data[0]->id ) ) { 475 $channel_id = $result->data[0]->id; 476 } else { 477 $channel_id = null; 478 $html_output = sprintf( __( 'Failed to retrieve channel ID %s', 'twitchpress' ), esc_html( $atts['channel_name'] ) ); 479 } 480 } 481 482 // Use cached HTML if we have a channel ID... 483 if( $channel_id ) { 484 $cache = get_transient( 'twitchpress_channel_status_box' . $channel_id ); 485 if( $cache ) { 486 return $cache; 487 } 488 } 489 490 // Get the stream. 491 if( !$helix ){ $helix = new TWITCHPRESS_Twitch_API(); } 492 493 $result = $helix->get_stream_by_userid( $channel_id ); 494 495 if( !$result || $result->type !== 'live' ) 496 { 497 $html_output = '<p>' . __( 'Channel Offline', 'twitchpress' ) . '</p>'; 498 } 499 else 500 { 501 $html_output = '<div>'; 502 $html_output .= 'Channel: ' . $result->user_name . ' '; 503 $html_output .= '<br />Game: ' . $result->game_id . ' '; 504 $html_output .= '<br />Viewers: ' . $result->viewer_count . ' '; 505 $html_output .= '</div>'; 506 } 507 508 set_transient( 'twitchpress_channel_status_box' . $channel_id, $html_output, 120 ); 509 510 return $html_output; 511 } 512 add_shortcode( 'twitchpress_shortcode_channel_status_box', 'twitchpress_channel_status_box_shortcode' ); 513 514 244 515 /** 245 516 * Shortcode outputs an unordered list of channels with status. -
channel-solution-for-twitch/trunk/includes/libraries/bugnet/class.bugnet.php
r1966127 r2024613 67 67 require_once( plugin_basename( '/handlers/class.bugnet-handler-email.php' ) ); 68 68 require_once( plugin_basename( '/handlers/class.bugnet-handler-logfiles.php' ) ); 69 require_once( plugin_basename( '/handlers/class.bugnet-handler- restapi.php' ) );69 require_once( plugin_basename( '/handlers/class.bugnet-handler-api.php' ) ); 70 70 require_once( plugin_basename( '/handlers/class.bugnet-handler-wpdb.php' ) ); 71 71 require_once( plugin_basename( '/handlers/class.bugnet-handler-tracing.php' ) ); … … 81 81 $this->handler_emails = new BugNet_Handler_Email(); 82 82 $this->handler_logfiles = new BugNet_Handler_LogFiles(); 83 $this->handler_restapi = new BugNet_Handler_ RESTAPI();83 $this->handler_restapi = new BugNet_Handler_API(); 84 84 $this->handler_wpdb = new BugNet_Handler_WPDB(); 85 85 $this->handler_tracing = new BugNet_Handler_Tracing(); … … 94 94 95 95 /** 96 * React to an event that is usually unexpected and important. This is 97 * like a more serious log and it does use the log() method itself. 98 * 99 * Place this method where you suspect something is going wrong or where 100 * fault occurence would be a high priority. 96 * React to an event that is usually unexpected and important. 97 * Often a serious event that takes priority over day to day log entries. 101 98 * 102 99 * The entire library becomes available to the log entry i.e. 103 * - It could be writtent otthe end of a daily log file.100 * - It could be writtent to the end of a daily log file. 104 101 * - It could be displayed in an administrator only notice. 105 102 * - It could be displayed in a public wp_die() page. … … 288 285 * methods. 289 286 * 290 * @param string $tag 291 * @param string $line please use __LINE__ 292 * @param string $function please use __FUNCTION__ 293 * @param boolean $end true will trigger output then delete trace. 294 * @param string $note optional note to help identify the step. 287 * @param mixed $tag 288 * @param mixed $line 289 * @param mixed $function 290 * @param mixed $file 291 * @param mixed $end 292 * @param mixed $message 295 293 * @param mixed $atts 296 * 297 * @version 1.0 294 * @param mixed $error 295 * 296 * @version 2.0 298 297 */ 299 298 public function trace( $tag, $line, $function, $file, $end, $message, $atts = array(), $error = false ) { … … 313 312 'tag' => $tag, 314 313 'time' => time(), 315 'eventid' => wp_rand( 111111, 999999 ), // Seperates instances of the same trace.314 'eventid' => TWITCHPRESS_REQUEST_KEY, // Seperates instances of the same trace. 316 315 'automaticonly' => false, // true forces trace to require a controlled ending. 317 316 'maintracefile' => false, // Log to the main trace text file. … … 323 322 $args = wp_parse_args( $atts, $default_args ); 324 323 325 // Build a data array to make it easier to access later.324 // Build an array of common values to make it easier to access later... 326 325 $info = array( 'line' => $line, 327 326 'function' => $function, -
channel-solution-for-twitch/trunk/includes/libraries/bugnet/handlers/class.bugnet-handler-tracing.php
r1856051 r2024613 28 28 * @version 1.0 29 29 */ 30 public function do_trace( $tag, $args, $info, $transient_life_seconds = 86400 ) { 31 // Add $tag to a transient that only stores trace tags.32 // We used this to get traces which are also stored in their own transients.30 public function do_trace( $tag, $args, $info, $transient_life_seconds = 86400 ) { 31 32 // List of traces for managing individual trace transients $tag => time() a 33 33 $this->update_trace_list( $tag, 'add' ); 34 35 // Get possible entries already made as part of a series.34 35 // Get current traces existing entries... 36 36 $trans = $this->get_trace_transient_temporary( $tag ); 37 37 38 38 // Delete existing transient in order to set it again. 39 39 if( !empty( $trans ) ) … … 81 81 82 82 public function delete_temporary_trace( $tag ) { 83 84 83 delete_transient( 'bugnet_' . $tag ); 85 84 … … 89 88 90 89 /** 91 * Called as late as possible to process all traces that do not have 92 * a controlled ending i.e. there is no deliberate call to end a trace 93 * and process it at the moment we want. 90 * Hooked by "shutdown" in class.bugnet.php 94 91 * 95 92 * By default all traces that do not have the "automaticonly" value … … 98 95 * @version 1.0 99 96 */ 100 public function automatically_process_traces() { 97 public function automatically_process_traces() { 98 99 // Avoid every creation of this object running this... 100 if( defined( 'BUGNET_AUTO_PROCESS_TRACES_DONE' ) ) { return; } 101 else { define( 'BUGNET_AUTO_PROCESS_TRACES_DONE', true ); } 102 101 103 $traces = $this->get_trace_list(); 102 104 103 105 if( !is_array( $traces ) ){ return; } 104 106 … … 106 108 107 109 $trace_transient = $this->get_trace_transient_temporary( $tag ); 108 110 109 111 $this->end_trace( $tag ); 110 112 } … … 112 114 113 115 /** 116 * Called by manual tool and uninstallation procedure. 117 * 114 118 * Deletes the two main caches and an infinite number of temporary 115 119 * individual caches. … … 118 122 */ 119 123 public function delete_all_trace_cache_data() { 120 121 124 // Remove individual traces first. 122 125 $traces = $this->get_trace_list(); … … 141 144 * @param mixed $args 142 145 * @param mixed $data 146 * 147 * @version 2.0 143 148 */ 144 149 public function end_trace( $tag, $automatic = true ) { … … 151 156 if( isset( $trace_array['automaticonly'] ) && true == $trace_array['automaticonly'] ){ return; } 152 157 158 if( !$this->does_trace_dir_exist() ) { 159 $result = $this->create_trace_files_directory(); 160 if( !$result ) { return false; } 161 } 162 153 163 // Insert data to permament records, start with main trace file. 154 164 if( true === $trace_array['traceargs']['maintracefile'] ) … … 160 170 if( true === $trace_array['traceargs']['newtracefile'] ) 161 171 { 162 // TODO: write trace to a new file stored in traces folder.172 $this->create_individual_trace_file( $tag, $trace_array ); 163 173 } 164 174 … … 185 195 public function update_trace_list( $tag, $task = 'add' ) { 186 196 $trans = get_transient( 'bugnet_trace_list' ); 187 197 188 198 // If requested to remove a trace entry but none exist at all. 189 if( $task == 'remove' && !$trans ) 190 { 199 if( $task == 'remove' && !$trans ) { 191 200 return false; 192 201 } 193 202 194 203 // If the transient has not been initialized yet. 195 204 if( !is_array( $trans ) ) { 196 205 $trans = array(); 197 206 } 198 199 delete_transient( 'bugnet_trace_list' ); 200 201 if( $task == 'add' && !isset( $trans[ $tag ] ) ) { 202 207 208 if( $task == 'add' && !isset( $trans[ $tag ] ) ) 209 { 203 210 // Tag is a string for sure. 204 211 $trans[ $tag ] = time(); … … 208 215 } 209 216 elseif( $task == 'remove' && isset( $trans[ $tag ] ) ) 210 { 217 { 211 218 unset( $trans[ $tag ] ); 212 219 $this->set_trace_list_transient( $trans ); … … 219 226 * @version 1.0 220 227 */ 221 public function set_trace_list_transient( $value ) { 222 set_transient( 'bugnet_trace_list', $value, 86400 ); 223 } 224 228 public function set_trace_list_transient( $new_transient_value ) { 229 delete_transient( 'bugnet_trace_list' ); 230 set_transient( 'bugnet_trace_list', $new_transient_value, 86400 ); 231 } 232 233 /** 234 * Create and write an entire trace to a file for the current server request. 235 * 236 * @version 1.0 237 */ 238 public function create_individual_trace_file( $tag, $trace_array ) { 239 // Run clean-up on folder number... 240 $this->individual_trace_file_folder_cleanup(); 241 242 // Confirm file-per-trace directory exists... 243 if( !$this->does_file_per_trace_directory_exist() ) { 244 $result = $this->create_file_per_trace_directory(); 245 if( !$result ) { return false; } 246 } 247 248 // Does our planned file name already exist... 249 if( file_exists( $this->get_file_per_trace_directory() . TWITCHPRESS_REQUEST_KEY ) ) { 250 return false; 251 } 252 253 // Open new trace file for a one time write... 254 $pointer = fopen( $this->get_file_per_trace_directory() . TWITCHPRESS_REQUEST_KEY, 'w' ); 255 if( !$pointer ){ return false; } 256 257 $csv_array = $this->build_trace_file_rows_array( $trace_array ); 258 259 foreach( $csv_array as $key => $entry_array ) { 260 fputcsv( $pointer, $entry_array ); 261 } 262 263 @fclose( $pointer ); 264 265 // Delete the transient for this trace... 266 $this->update_trace_list( $tag, 'remove' ); 267 268 return false; 269 } 270 271 /** 272 * Automatic safeguard to prevent too many daily folders existing. An entire 273 * month will be allowed and there will be a limit of 10 trace files per 274 * folder by default. 275 * 276 * @version 1.0 277 */ 278 public function individual_trace_file_folder_cleanup() { 279 // Count number of folders... 280 281 // Delete the oldest folders if there are 30... 282 } 283 225 284 /** 226 285 * Processes a request to update the main trace file with the … … 231 290 * @returns boolean false if nothing written else true 232 291 * 233 * @version 1.0292 * @version 2.0 234 293 */ 235 294 public function update_main_tracefile( $trace_array ) { 236 295 // Confirm directory and main trace file exists, else create them. 237 296 if( !$this->does_main_trace_file_exist() ) { 238 if( !$this->does_trace_dir_exist() ) {239 $result = $this->create_trace_files_directory();240 if( !$result ) { return false; }241 }242 297 $result = $this->create_main_trace_file(); 243 298 if( !$result ){ return false; } … … 317 372 */ 318 373 public function get_traces_directory() { 319 return WP_CONTENT_DIR . '/bugnet/traces/';374 return TWITCHPRESS_LOG_DIR . 'traces/'; 320 375 } 321 376 … … 333 388 public function does_main_trace_file_exist() { 334 389 return file_exists( $this->get_main_trace_file_path() ); 390 } 391 392 public function get_file_per_trace_directory() { 393 return $this->get_traces_directory() . 'file_per_trace/'; 394 } 395 396 public function does_file_per_trace_directory_exist() { 397 return file_exists( $this->get_file_per_trace_directory() ); 398 } 399 400 public function create_file_per_trace_directory() { 401 return mkdir( $this->get_file_per_trace_directory(), 0777, true ); 335 402 } 336 403 … … 383 450 */ 384 451 public function does_daily_trace_file_exist() { 385 return file_exists( WP_CONTENT_DIR . "/ bugnet/traces/daily/" . $this->todays_filename() );452 return file_exists( WP_CONTENT_DIR . "/traces/daily/" . $this->todays_filename() ); 386 453 } 387 454 -
channel-solution-for-twitch/trunk/includes/libraries/bugnet/readme.txt
r1856051 r2024613 1 ======== BugNet for WordPress ========1 ======== About BugNet for WordPress ======== 2 2 3 3 Version: 0.1.1 -
channel-solution-for-twitch/trunk/includes/libraries/twitch/kraken/class.twitch-api-calls.php
r1974437 r2024613 101 101 * @version 5.8 102 102 */ 103 public function getUserObject_Authd( string $token, string$code ){103 public function getUserObject_Authd( $token, $code ){ 104 104 105 105 // Ensure required scope is permitted else we return the WP_Error confirm_scope() generates. … … 174 174 * @version 1.2 175 175 */ 176 public function addBlockedUser( string $chan, string $username, string $token, string$code){176 public function addBlockedUser( $chan, $username, $token, $code){ 177 177 178 178 // Ensure required scope is permitted else we return the WP_Error confirm_scope() generates. … … 212 212 * @version 1.5 213 213 */ 214 public function removeBlockedUser( string $chan, string $username, string $token, string$code){214 public function removeBlockedUser( $chan, $username, $token, $code){ 215 215 216 216 // Ensure required scope is permitted else we return the WP_Error confirm_scope() generates. … … 1545 1545 $return = array(); 1546 1546 1547 if( 'yes' == get_option( 'twitch ress_sandbox_mode_generator_switch' ) )1547 if( 'yes' == get_option( 'twitchpress_sandbox_mode_generator_switch' ) ) 1548 1548 { 1549 1549 /* Not doing anything here yet, but we could generate users based on real Twitch channels. */ … … 1579 1579 1580 1580 // If false returns not on, we only return the affirmative response. 1581 if( 'yes' !== get_option( 'twitch ress_sandbox_mode_falsereturns_switch' ) )1581 if( 'yes' !== get_option( 'twitchpress_sandbox_mode_falsereturns_switch' ) ) 1582 1582 { 1583 1583 return $return[0]; -
channel-solution-for-twitch/trunk/includes/libraries/twitch/kraken/class.twitch-api.php
r1977739 r2024613 61 61 'channel_commercial', 62 62 'channel_editor', 63 'channel_feed_edit',64 'channel_feed_read',65 63 'channel_read', 66 64 'channel_stream', 67 65 'channel_subscriptions', 68 'chat_login',69 66 'collections_edit', 70 67 'communities_edit', … … 130 127 $this->set_all_credentials(); 131 128 132 if( get_option( 'twitch ress_sandbox_mode_switch' ) == 'yes' ) {129 if( get_option( 'twitchpress_sandbox_mode_switch' ) == 'yes' ) { 133 130 $this->twitch_sandbox_mode = true; 134 131 } … … 1120 1117 null, 1121 1118 false, 1122 false 1119 false, 1120 __FUNCTION__, 1121 __LINE__ 1123 1122 ); 1124 1123 … … 1213 1212 if( $requesting_function == null ) { $request_string = __( 'Requesting function is not known!', 'twitchpress' ); } 1214 1213 else{ $request_string = __( 'Requesting function is ', 'twitchpress' ) . $requesting_function; } 1215 $this->bugnet->log( __FUNCTION__, sprintf( __( 'No access token returned: %s()', 'twitchpress' ), $request_string ), array(), true, false );1214 $this->bugnet->log( __FUNCTION__, sprintf( __( 'No user access token returned: %s()', 'twitchpress' ), $request_string ), array(), true, false ); 1216 1215 1217 1216 return false; -
channel-solution-for-twitch/trunk/loader.php
r1977739 r2024613 27 27 * @deprecated use constant TWITCHPRESS_VERSION 28 28 */ 29 public $version = '2.16. 0';29 public $version = '2.16.3'; 30 30 31 31 /** … … 146 146 if ( ! defined( 'TWITCHPRESS_UPLOADS_DIR' ) ) { define( 'TWITCHPRESS_UPLOADS_DIR', $upload_dir['basedir'] . 'twitchpress-uploads/' ); } 147 147 if ( ! defined( 'TWITCHPRESS_LOG_DIR' ) ) { define( 'TWITCHPRESS_LOG_DIR', TWITCHPRESS_PLUGIN_DIR_PATH . 'twitchpress-logs/' ); } 148 if ( ! defined( 'TWITCHPRESS_SESSION_CACHE_GROUP')) { define( 'TWITCHPRESS_SESSION_CACHE_GROUP', 'twitchpress_session_id' ); }149 148 if ( ! defined( 'TWITCHPRESS_DEV_MODE' ) ) { define( 'TWITCHPRESS_DEV_MODE', false ); } 150 149 if ( ! defined( 'TWITCHPRESS_WORDPRESSORG_SLUG' ) ) { define( 'TWITCHPRESS_WORDPRESSORG_SLUG', false ); } 151 150 if ( ! defined( 'TWITCHPRESS_REQUEST_KEY' ) ) { define( 'TWITCHPRESS_REQUEST_KEY', $_SERVER["REQUEST_TIME_FLOAT"] . TWITCHPRESS_CURRENTUSERID ); } 151 152 152 // Support (project) constants. 153 153 if ( ! defined( 'TWITCHPRESS_HOME' ) ) { define( 'TWITCHPRESS_HOME', 'https://wordpress.org/plugins/channel-solution-for-twitch' ); } … … 216 216 require_once( 'includes/libraries/twitch/' . TWITCHPRESS_API_NAME . '/functions.twitch-api-statuses.php' ); 217 217 218 if( get_option( 'twitch ress_sandbox_mode_switch' ) == 'yes' ) {218 if( get_option( 'twitchpress_sandbox_mode_switch' ) == 'yes' ) { 219 219 require_once( 'includes/libraries/twitch/' . TWITCHPRESS_API_NAME . '/class.twitch-api-sandbox.php' ); 220 220 } else { … … 222 222 } 223 223 224 // Helix does not have separate classes...225 224 if( TWITCHPRESS_API_NAME == 'kraken' ) { 226 225 require_once( 'includes/libraries/twitch/' . TWITCHPRESS_API_NAME . '/class.twitch-api-calls.php' ); … … 235 234 include_once( plugin_basename( 'requests.php' ) ); 236 235 require_once( 'includes/class.twitchpress-listener-main-account-oauth.php' ); 236 require_once( 'includes/libraries/twitch/helix/class.twitch-webhooks.php' ); 237 237 238 238 // Load Core Objects … … 295 295 add_action( 'init', array( $this, 'output_errors' ), 2 ); 296 296 add_action( 'init', array( $this, 'output_actions' ), 2 ); 297 add_action( 'init', array( $this, 'output_filters' ), 2 ); 297 add_action( 'init', array( $this, 'output_filters' ), 2 ); 298 299 add_filter( 'views_edit-plugins', array( $this, 'views_edit_plugins' ), 1 ); 300 301 } 302 303 public function views_edit_plugins( $views ) { 304 $screen = get_current_screen(); 298 305 } 299 306 300 307 public function init_system() { 301 308 302 309 // Before init action. 303 310 do_action( 'before_twitchpress_init' ); … … 387 394 } 388 395 389 public static function show_errors() { 396 public static function show_errors() { 390 397 global $wpdb, $bugnet; 391 398 echo '<div id="bugnet-wperror-dump">'; -
channel-solution-for-twitch/trunk/options.php
r1977739 r2024613 21 21 22 22 } 23 23 24 24 function twitchpress_options_misc() { 25 25 $arr = array(); 26 26 27 27 $arr[ 'twitchpress_admin_notices' ] = array(); 28 $arr[ 'twitchpress_admin_notice_missingvaluesofferwizard' ] = array(); 28 29 $arr[ 'twitchpress_displayerrors' ] = array(); 29 30 $arr[ 'twitchpress_db_version' ] = array(); … … 44 45 $arr[ 'twitchpress_feedback_prompt' ] = array(); 45 46 $arr[ 'twitchpress_displayerrors' ] = array(); 46 $arr[ 'twitch ress_redirect_tracking_switch' ] = array();47 $arr[ 'twitchpress_redirect_tracking_switch' ] = array(); 47 48 $arr[ 'twitchpress_new_channeltowp' ] = array(); 48 49 $arr[ 'twitchpress_new_wptochannel' ] = array(); … … 86 87 87 88 // Depreciated 88 $arr[ 'twitchpress_main_client_secret' ] = array();// Deprec iated - use twitchpress_app_secret89 $arr[ 'twitchpress_main_client_id' ] = array();// Deprec iated use twitchpress_main_client_id90 $arr[ 'twitchpress_main_redirect_uri' ] = array();// Deprec iated use twitchpress_app_redirect91 $arr[ 'twitchpress_main_channel_postid' ] = array();// Deprec iated - Generated on behalf of the main user.92 $arr[ 'twitchpress_main_channel_name' ] = array();// Deprec iated - Main channel name (this might be the title of channel and not lowercase, please confirm)93 $arr[ 'twitchpress_main_channel_id' ] = array();// Deprec iated - Main channels Twitch ID (same as user ID)94 $arr[ 'twitchpress_main_code' ] = array();// Deprec iated - Generated on behalf of the main user.95 $arr[ 'twitchpress_main_token' ] = array();// Deprec iated - Generated on behalf of the main user.89 $arr[ 'twitchpress_main_client_secret' ] = array();// Deprecated - use twitchpress_app_secret 90 $arr[ 'twitchpress_main_client_id' ] = array();// Deprecated use twitchpress_main_client_id 91 $arr[ 'twitchpress_main_redirect_uri' ] = array();// Deprecated use twitchpress_app_redirect 92 $arr[ 'twitchpress_main_channel_postid' ] = array();// Deprecated - Generated on behalf of the main user. 93 $arr[ 'twitchpress_main_channel_name' ] = array();// Deprecated - Main channel name (this might be the title of channel and not lowercase, please confirm) 94 $arr[ 'twitchpress_main_channel_id' ] = array();// Deprecated - Main channels Twitch ID (same as user ID) 95 $arr[ 'twitchpress_main_code' ] = array();// Deprecated - Generated on behalf of the main user. 96 $arr[ 'twitchpress_main_token' ] = array();// Deprecated - Generated on behalf of the main user. 96 97 $arr[ 'twitchpress_main_token_scopes' ] = array();// Depreciated - Generated on behalf of the main user. 97 98 … … 192 193 $arr[ 'twitchpress_scope_channel_commercial' ] = array(); 193 194 $arr[ 'twitchpress_scope_channel_editor' ] = array(); 194 $arr[ 'twitchpress_scope_channel_feed_edit' ] = array();195 $arr[ 'twitchpress_scope_channel_feed_read' ] = array();196 195 $arr[ 'twitchpress_scope_channel_read' ] = array(); 197 196 $arr[ 'twitchpress_scope_channel_stream' ] = array(); 198 197 $arr[ 'twitchpress_scope_channel_subscriptions' ] = array(); 199 $arr[ 'twitchpress_scope_chat_login' ] = array();200 198 $arr[ 'twitchpress_scope_collections_edit' ] = array(); 201 199 $arr[ 'twitchpress_scope_communities_edit' ] = array(); … … 220 218 $arr[ 'twitchpress_visitor_scope_channel_commercial' ] = array(); 221 219 $arr[ 'twitchpress_visitor_scope_channel_editor' ] = array(); 222 $arr[ 'twitchpress_visitor_scope_channel_feed_edit' ] = array();223 $arr[ 'twitchpress_visitor_scope_channel_feed_read' ] = array();224 220 $arr[ 'twitchpress_visitor_scope_channel_read' ] = array(); 225 221 $arr[ 'twitchpress_visitor_scope_channel_stream' ] = array(); 226 222 $arr[ 'twitchpress_visitor_scope_channel_subscriptions' ] = array(); 227 $arr[ 'twitchpress_visitor_scope_chat_login' ] = array();228 223 $arr[ 'twitchpress_visitor_scope_collections_edit' ] = array(); 229 224 $arr[ 'twitchpress_visitor_scope_communities_edit' ] = array(); -
channel-solution-for-twitch/trunk/readme.txt
r1977763 r2024613 7 7 Requires at least: 4.9 8 8 Tested up to: 4.9 9 Stable tag: 2.1 6.09 Stable tag: 2.17.0 10 10 Requires PHP: 5.6 11 11 … … 14 14 == Description == 15 15 16 TwitchPress is an adaptable solution for the creation of a Twitch service that can do anything Twitch.tv allows. 17 Marry your WordPress gaming site with your Twitch channel in everyway possible using the plugins extension system 18 or create a site that offersr channel management services to the public. 19 20 = Core Features = 21 The initial purpose of the free plugin is to share WP posts on Twitch channel feeds and collect feed updates 22 from Twitch.tv for publishing as new WordPress posts. All updates to the core will focus on improving this feature 23 and the plugins extension system. Using the extension system we can make TwitchPress and WP do anything possible 24 with the Twitch API. 16 TwitchPress is an adaptable solution for the creation of a Twitch powered 17 WordPress site that offers the gaming community fresh content. 18 This solution for Twitch can easily be made to do anything Twitch.tv allows through the API. 19 The overall design has sponsored streamers in-mind. Something that will show more 20 throughout 2019. 25 21 26 22 = Links = … … 36 32 = Features List = 37 33 34 * Various shortcodes 38 35 * Extension system 39 36 * Custom post for each channel/user … … 46 43 = Features In Extensions = 47 44 45 * More shortcodes 48 46 * Sign-In Via Twitch 49 47 * Registration Via Twitch … … 77 75 == Upgrade Notice == 78 76 79 There are no special instructions for this upgrade. 77 If your Twitch.tv app is old or you have login issues please create new application 78 credentials. Then update TwitchPress by completing the Setup Wizard. 80 79 81 80 == Changelog == 81 82 = 2.17.0: = 83 * Bugfixes 84 - Deprecated function twitchpress_get_main_channel_id() replaced with twitchpress_get_main_channels_twitchid() 85 - function twitchpress_display_frontend_notices_the_content() string instance removed 86 - Options are now removed when the plugin is deleted 87 * Feature Changes 88 - This version does not support the Twitch feed post type or taxonomies 89 - Made it clearer to users that the "chat_login" scope is deprecated 90 - New custom post type "webhooks" as part of an admin controlled system for managing Twitch subscribed updates 91 * Technical Changes 92 - New webhook system started 93 - Removed function get_channel_subscriptions_sandbox() as there is now a separate sandbox file and class 94 - Shortcode for channel status line now has a Helix version: twitchpress_channel_status_line_shortcode_helix() 95 - Updated helix function get_streams() 96 - Removed channel_feed_read scope as the feed service is no longer available 97 - Removed channel_feed_edit scope as the feed service is no longer available 98 - chat_login scope will no longer be available for old apps so apps must be re-created 99 - Corrected option name from twitchpress_sandbox_mode_switch to twitchpress_sandbox_mode_switch 100 - Installation tab of the Help area no longer peforms API calls to determine status 101 - Corrected spelling of twitchress_redirect_tracking_switch to twitchpress_redirect_tracking_switch 102 - New class for extending WP_Http_Curl() within the TwitchPress system for any API 103 - File name change (spelling): depreciated.php to deprecated.php 104 - Unused constant removed: TWITCHPRESS_SESSION_CACHE_GROUP 105 - New constant TWITCHPRESS_REQUEST_KEY which holds the current float time and logged in user ID is appended 106 - BugNet change - the "eventid" value in trace() is now set using TWITCHPRESS_REQUEST_KEY and not wp_rand() 107 * Configuration 108 - No changes 109 * Database 110 - No changes 111 82 112 = 2.16.0: 19th November 2018 = 83 113 * Bugfixes -
channel-solution-for-twitch/trunk/twitchpress.php
r1977739 r2024613 5 5 * Github URI: https://github.com/RyanBayne/TwitchPress 6 6 * Description: Add Twitch stream and channel management services to WordPress. 7 * Version: 2.1 6.07 * Version: 2.17.0 8 8 * Author: Ryan Bayne 9 9 * Author URI: https://ryanbayne.wordpress.com/ 10 10 * Requires at least: 4.9 11 * Tested up to: 4.911 * Tested up to: 5.0 12 12 * License: GPL3 13 13 * License URI: http://www.gnu.org/licenses/gpl-3.0.txt 14 14 * Domain Path: /i18n/languages/ 15 *16 * @package TwitchPress17 * @category Core18 * @author Ryan Bayne (Gaming Handle: ZypheREvolved)19 * @license GNU General Public License, Version 320 * @copyright 2016-2018 Ryan R. Bayne ([email protected])21 15 */ 22 16 23 17 // Exit if accessed directly. 24 18 if ( ! defined( 'ABSPATH' ) ) { exit; } 25 19 26 20 if ( ! class_exists( 'WordPressTwitchPress' ) ) : 27 21 28 if ( ! defined( 'TWITCHPRESS_VERSION' ) ) { define( 'TWITCHPRESS_VERSION', '2.1 6.0' ); }22 if ( ! defined( 'TWITCHPRESS_VERSION' ) ) { define( 'TWITCHPRESS_VERSION', '2.17.0' ); } 29 23 30 24 if ( ! defined( 'TWITCHPRESS_ABSPATH' ) ) { define( 'TWITCHPRESS_ABSPATH', __FILE__ ); } … … 40 34 include_once( TWITCHPRESS_PLUGIN_DIR_PATH . 'install.php' ); 41 35 include_once( TWITCHPRESS_PLUGIN_DIR_PATH . 'functions.php' ); 42 include_once( TWITCHPRESS_PLUGIN_DIR_PATH . 'deprec iated.php' );36 include_once( TWITCHPRESS_PLUGIN_DIR_PATH . 'deprecated.php' ); 43 37 include_once( TWITCHPRESS_PLUGIN_DIR_PATH . 'integration.php' ); 44 38 include_once( TWITCHPRESS_PLUGIN_DIR_PATH . 'extensions.php' ); -
channel-solution-for-twitch/trunk/uninstall.php
r1967050 r2024613 11 11 * @version 2.0 12 12 */ 13 13 14 14 // Ensure plugin uninstall is being run by WordPress. 15 15 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { 16 exit;16 wp_die( __( 'Uninstallation file incorrectly requested for the TwitchPress plugin.', 'twitchpress' ) ); 17 17 } 18 19 if( 'yes' == get_option( 'twitchpress_remove_database_tables' ) ) { twitchpress_remove_database_tables(); } 20 if( 'yes' == get_option( 'twitchpress_remove_extensions' ) ) { twitchpress_remove_extensions(); } 21 if( 'yes' == get_option( 'twitchpress_remove_user_data' ) ) { twitchpress_remove_user_data(); } 22 if( 'yes' == get_option( 'twitchpress_remove_media' ) ) { twitchpress_remove_media(); } 23 if( 'yes' == get_option( 'twitchpress_remove_roles' ) ) { twitchpress_remove_roles(); } 24 25 // The plan is to offer different levels of uninstallation to make testing and re-configuration easier... 26 //if( 'yes' == get_option( 'twitchpress_remove_options' ) ) { twitchpress_remove_options_surgically(); } 27 if( 'yes' == get_option( 'twitchpress_remove_options' ) ) { twitchpress_remove_options(); } 18 28 19 29 /** 20 * Uninstall all of the plugins options without any care. Meant as a developer tool and 21 * a part of 100% uninstallation. 30 * Uninstall all of the plugins options with care! 22 31 * 23 32 * @version 2.0 24 33 */ 25 function twitchpress_remove_options() { 26 // Include the array of known options (extensions might create some we do not know about yet) 27 include_once( 'options.php' ); 28 29 // Some options need to be removed last. 30 $remove_last = array( 31 'twitchpress_remove_options', 32 'twitchpress_remove_feed_posts', 33 'twitchpress_remove_database_tables', 34 'twitchpress_remove_extensions', 35 'twitchpress_remove_user_data', 36 'twitchpress_remove_media' 37 ); 38 39 foreach( twitchpress_options_array() as $option_group_key => $option_group_array ) { 40 foreach( $option_group_array as $option_key => $option_array ) { 41 if( !in_array( $option_key, $remove_last ) ) { 42 delete_option( $option_key ); 43 } 44 } 45 } 46 47 } 48 49 /** 50 * Uninstall options related to the uninstall procedure itself. 51 * 52 * @version 1.0 53 */ 54 function twitchpress_remove_uninstallation_options() { 55 56 // Now remove the uninstallation options. 57 delete_option( 'twitchpress_remove_options' ); 58 delete_option( 'twitchpress_remove_feed_posts' ); 34 function twitchpress_remove_options() { 35 delete_option( 'twitchpress_admin_notices' ); 36 delete_option( 'twitchpress_admin_notice_missingvaluesofferwizard' ); 37 delete_option( 'twitchpress_allapi_id_streamlabs' ); 38 delete_option( 'twitchpress_allapi_redirect_uri_streamlabs' ); 39 delete_option( 'twitchpress_allapi_secret_streamlabs' ); 40 delete_option( 'twitchpress_allapi_streamlabs_default_key' ); 41 delete_option( 'twitchpress_allapi_streamlabs_default_secret' ); 42 delete_option( 'twitchpress_allapi_streamlabs_default_uri' ); 43 delete_option( 'twitchpress_automatic_registration' ); 44 delete_option( 'twitchpress_bugnet_cache_action_hooks' ); 45 delete_option( 'twitchpress_display_actions' ); 46 delete_option( 'twitchpress_display_filters' ); 47 delete_option( 'twitchpress_login_button' ); 48 delete_option( 'twitchpress_login_button_text' ); 49 delete_option( 'twitchpress_login_loggedin_page_id' ); 50 delete_option( 'twitchpress_login_loginpage_position' ); 51 delete_option( 'twitchpress_login_loginpage_type' ); 52 delete_option( 'twitchpress_login_mainform_page_id' ); 53 delete_option( 'twitchpress_login_redirect_to_custom' ); 54 delete_option( 'twitchpress_login_requiretwitch' ); 55 delete_option( 'twitchpress_main_channels_refresh_token' ); 56 delete_option( 'twitchpress_registration_button' ); 57 delete_option( 'twitchpress_registration_requirevalidemail' ); 58 delete_option( 'twitchpress_registration_twitchonly' ); 59 59 delete_option( 'twitchpress_remove_database_tables' ); 60 60 delete_option( 'twitchpress_remove_extensions' ); 61 delete_option( 'twitchpress_remove_media' ); 62 delete_option( 'twitchpress_remove_options' ); 63 delete_option( 'twitchpress_remove_roles' ); 61 64 delete_option( 'twitchpress_remove_user_data' ); 62 delete_option( 'twitchpress_remove_media' ); 63 65 delete_option( 'twitchpress_scope_analytics_read_extensions' ); 66 delete_option( 'twitchpress_scope_analytics_read_games' ); 67 delete_option( 'twitchpress_scope_bits_read' ); 68 delete_option( 'twitchpress_scope_channel_feed_edit' ); 69 delete_option( 'twitchpress_scope_channel_feed_read' ); 70 delete_option( 'twitchpress_scope_chat_edit' ); 71 delete_option( 'twitchpress_scope_chat_read' ); 72 delete_option( 'twitchpress_scope_clips_edit' ); 73 delete_option( 'twitchpress_scope_user_edit' ); 74 delete_option( 'twitchpress_scope_user_edit_broadcast' ); 75 delete_option( 'twitchpress_scope_user_read_broadcast' ); 76 delete_option( 'twitchpress_scope_user_read_email' ); 77 delete_option( 'twitchpress_sync_timing' ); 78 delete_option( 'twitchpress_twitchapi_call_count' ); 79 delete_option( 'twitchpress_twitchpress-embed-everything_settings' ); 80 delete_option( 'twitchpress_twitchpress-login-extension_settings' ); 81 delete_option( 'twitchpress_twitchpress-subscriber-management_settings' ); 82 delete_option( 'twitchpress_twitchpress-sync-extension_settings' ); 83 delete_option( 'twitchpress_twitchpress-um-extension_settings' ); 84 delete_option( 'twitchpress_visitor_scope_analytics_read_extensions' ); 85 delete_option( 'twitchpress_visitor_scope_analytics_read_games' ); 86 delete_option( 'twitchpress_visitor_scope_bits_read' ); 87 delete_option( 'twitchpress_visitor_scope_channel_check_subscription' ); 88 delete_option( 'twitchpress_visitor_scope_channel_commercial' ); 89 delete_option( 'twitchpress_visitor_scope_channel_editor' ); 90 delete_option( 'twitchpress_visitor_scope_channel_feed_edit' ); 91 delete_option( 'twitchpress_visitor_scope_channel_feed_read' ); 92 delete_option( 'twitchpress_visitor_scope_channel_read' ); 93 delete_option( 'twitchpress_visitor_scope_channel_stream' ); 94 delete_option( 'twitchpress_visitor_scope_channel_subscriptions' ); 95 delete_option( 'twitchpress_visitor_scope_chat_edit' ); 96 delete_option( 'twitchpress_visitor_scope_chat_read' ); 97 delete_option( 'twitchpress_visitor_scope_clips_edit' ); 98 delete_option( 'twitchpress_visitor_scope_collections_edit' ); 99 delete_option( 'twitchpress_visitor_scope_communities_edit' ); 100 delete_option( 'twitchpress_visitor_scope_communities_moderate' ); 101 delete_option( 'twitchpress_visitor_scope_openid' ); 102 delete_option( 'twitchpress_visitor_scope_user_blocks_edit' ); 103 delete_option( 'twitchpress_visitor_scope_user_blocks_read' ); 104 delete_option( 'twitchpress_visitor_scope_user_edit' ); 105 delete_option( 'twitchpress_visitor_scope_user_edit_broadcast' ); 106 delete_option( 'twitchpress_visitor_scope_user_follows_edit' ); 107 delete_option( 'twitchpress_visitor_scope_user_read' ); 108 delete_option( 'twitchpress_visitor_scope_user_read_broadcast' ); 109 delete_option( 'twitchpress_visitor_scope_user_read_email' ); 110 delete_option( 'twitchpress_visitor_scope_user_subscriptions' ); 111 delete_option( 'twitchpress_visitor_scope_viewing_activity_read' ); 112 delete_option( 'twitchress_sandbox_mode_falsereturns_switch' ); 113 delete_option( 'twitchress_sandbox_mode_generator_switch' ); 114 delete_option( 'twitchress_sandbox_mode_switch' ); 64 115 } 65 66 /**67 * Remove feed posts (the core plugins custom post type)68 *69 * @version 1.070 */71 function twitchpress_remove_feed_posts() {}72 116 73 117 /** … … 76 120 * @version 1.0 77 121 */ 78 function twitchpress_remove_database_tables() { }122 function twitchpress_remove_database_tables() {/* no tables yet */} 79 123 80 124 /** … … 87 131 foreach( $extensions_group_array as $extension_name => $extension_array ) { 88 132 deactivate_plugins( $extension_name, true ); 89 uninstall_plugin( $extension_name ); 133 uninstall_plugin( $extension_name ); 90 134 } 91 135 } … … 145 189 remove_role( 'twitchpressdeveloper' ); 146 190 } 147 148 if( 'yes' == get_option( 'twitchpress_remove_options' ) ) { twitchpress_remove_options(); }149 if( 'yes' == get_option( 'twitchpress_remove_feed_posts' ) ) { twitchpress_remove_feed_posts(); }150 if( 'yes' == get_option( 'twitchpress_remove_database_tables' ) ) { twitchpress_remove_database_tables(); }151 if( 'yes' == get_option( 'twitchpress_remove_extensions' ) ) { twitchpress_remove_extensions(); }152 if( 'yes' == get_option( 'twitchpress_remove_user_data' ) ) { twitchpress_remove_user_data(); }153 if( 'yes' == get_option( 'twitchpress_remove_media' ) ) { twitchpress_remove_media(); }154 if( 'yes' == get_option( 'twitchpress_remove_roles' ) ) { twitchpress_remove_roles(); }155 156 // Final action is removal of this group of options.157 if( 'yes' == get_option( 'twitchpress_remove_uninstallation_options' ) ) { twitchpress_remove_uninstallation_options(); }
Note: See TracChangeset
for help on using the changeset viewer.