Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/custom-t.../inc/Admin
File: CTF_Support.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* The Settings Page
[3] Fix | Delete
*
[4] Fix | Delete
* @since 2.0
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
namespace TwitterFeed\Admin;
[8] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
[9] Fix | Delete
[10] Fix | Delete
use TwitterFeed\Admin\CTF_View;
[11] Fix | Delete
use TwitterFeed\Admin\CTF_Response;
[12] Fix | Delete
use TwitterFeed\Builder\CTF_Db;
[13] Fix | Delete
//use TwitterFeed\CTF_Feed_Locator;
[14] Fix | Delete
use TwitterFeed\Builder\CTF_Feed_Builder;
[15] Fix | Delete
//use TwitterFeed\CTF_GDPR_Integrations;
[16] Fix | Delete
use TwitterFeed\Builder\CTF_Feed_Saver_Manager;
[17] Fix | Delete
[18] Fix | Delete
class CTF_Support {
[19] Fix | Delete
/**
[20] Fix | Delete
* Admin menu page slug.
[21] Fix | Delete
*
[22] Fix | Delete
* @since 2.0
[23] Fix | Delete
*
[24] Fix | Delete
* @var string
[25] Fix | Delete
*/
[26] Fix | Delete
const SLUG = 'ctf-support';
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Initializing the class
[30] Fix | Delete
*
[31] Fix | Delete
* @since 2.0
[32] Fix | Delete
*/
[33] Fix | Delete
function __construct(){
[34] Fix | Delete
$this->init();
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
/**
[38] Fix | Delete
* Determining if the user is viewing the our page, if so, party on.
[39] Fix | Delete
*
[40] Fix | Delete
* @since 2.0
[41] Fix | Delete
*/
[42] Fix | Delete
public function init() {
[43] Fix | Delete
if ( ! is_admin() ) {
[44] Fix | Delete
return;
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
add_action( 'admin_menu', [ $this, 'register_menu' ] );
[48] Fix | Delete
add_action( 'wp_ajax_ctf_export_settings_json', [$this, 'ctf_export_settings_json'] );
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
/**
[52] Fix | Delete
* Register Menu.
[53] Fix | Delete
*
[54] Fix | Delete
* @since 2.0
[55] Fix | Delete
*/
[56] Fix | Delete
function register_menu() {
[57] Fix | Delete
$cap = ctf_get_manage_options_cap();
[58] Fix | Delete
[59] Fix | Delete
$support_page = add_submenu_page(
[60] Fix | Delete
'custom-twitter-feeds',
[61] Fix | Delete
__( 'Support', 'custom-twitter-feeds' ),
[62] Fix | Delete
__( 'Support', 'custom-twitter-feeds' ),
[63] Fix | Delete
$cap,
[64] Fix | Delete
self::SLUG,
[65] Fix | Delete
[$this, 'support_page'],
[66] Fix | Delete
3
[67] Fix | Delete
);
[68] Fix | Delete
add_action( 'load-' . $support_page, [$this,'support_page_enqueue_assets']);
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* Enqueue Extension CSS & Script.
[73] Fix | Delete
*
[74] Fix | Delete
* Loads only for Extension page
[75] Fix | Delete
*
[76] Fix | Delete
* @since 2.0
[77] Fix | Delete
*/
[78] Fix | Delete
public function support_page_enqueue_assets(){
[79] Fix | Delete
if( ! get_current_screen() ) {
[80] Fix | Delete
return;
[81] Fix | Delete
}
[82] Fix | Delete
$screen = get_current_screen();
[83] Fix | Delete
[84] Fix | Delete
if ( ! 'twitter-feed_page_ctf-support' === $screen->id ) {
[85] Fix | Delete
return;
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
wp_enqueue_style(
[89] Fix | Delete
'ctf-fira-code-font',
[90] Fix | Delete
'https://fonts.googleapis.com/css2?family=Fira+Code&display=swap',
[91] Fix | Delete
false,
[92] Fix | Delete
CTF_VERSION
[93] Fix | Delete
);
[94] Fix | Delete
[95] Fix | Delete
wp_enqueue_style(
[96] Fix | Delete
'support-style',
[97] Fix | Delete
CTF_PLUGIN_URL . 'admin/assets/css/support.css',
[98] Fix | Delete
false,
[99] Fix | Delete
CTF_VERSION
[100] Fix | Delete
);
[101] Fix | Delete
[102] Fix | Delete
wp_enqueue_script(
[103] Fix | Delete
'vue-main',
[104] Fix | Delete
'https://cdn.jsdelivr.net/npm/vue@2.6.12',
[105] Fix | Delete
null,
[106] Fix | Delete
'2.6.12',
[107] Fix | Delete
true
[108] Fix | Delete
);
[109] Fix | Delete
[110] Fix | Delete
wp_enqueue_script(
[111] Fix | Delete
'support-app',
[112] Fix | Delete
CTF_PLUGIN_URL.'admin/assets/js/support.js',
[113] Fix | Delete
null,
[114] Fix | Delete
CTF_VERSION,
[115] Fix | Delete
true
[116] Fix | Delete
);
[117] Fix | Delete
[118] Fix | Delete
$ctf_support = $this->page_data();
[119] Fix | Delete
[120] Fix | Delete
wp_localize_script(
[121] Fix | Delete
'support-app',
[122] Fix | Delete
'ctf_support',
[123] Fix | Delete
$ctf_support
[124] Fix | Delete
);
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
/**
[128] Fix | Delete
* Page Data to use in front end
[129] Fix | Delete
*
[130] Fix | Delete
* @since 2.0
[131] Fix | Delete
*
[132] Fix | Delete
* @return array
[133] Fix | Delete
*/
[134] Fix | Delete
public function page_data() {
[135] Fix | Delete
$exported_feeds = CTF_Db::feeds_query();
[136] Fix | Delete
$feeds = array();
[137] Fix | Delete
foreach( $exported_feeds as $feed_id => $feed ) {
[138] Fix | Delete
$feeds[] = array(
[139] Fix | Delete
'id' => $feed['id'],
[140] Fix | Delete
'name' => $feed['feed_name']
[141] Fix | Delete
);
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
$return = array(
[145] Fix | Delete
'admin_url' => admin_url(),
[146] Fix | Delete
'ajax_handler' => admin_url( 'admin-ajax.php' ),
[147] Fix | Delete
'nonce' => wp_create_nonce( 'ctf-admin' ),
[148] Fix | Delete
'links' => \TwitterFeed\Builder\CTF_Feed_Builder::get_links_with_utm(),
[149] Fix | Delete
'supportPageUrl' => admin_url( 'admin.php?page=ctf-support' ),
[150] Fix | Delete
'siteSearchUrl' => 'https://smashballoon.com/search/',
[151] Fix | Delete
'system_info' => $this->get_system_info(),
[152] Fix | Delete
'system_info_n' => str_replace("</br>", "\n", $this->get_system_info()),
[153] Fix | Delete
'feeds' => $feeds,
[154] Fix | Delete
'supportUrl' => $this->get_support_url(),
[155] Fix | Delete
'svgIcons' => CTF_Feed_Builder::builder_svg_icons(),
[156] Fix | Delete
'socialWallLinks' => \TwitterFeed\Builder\CTF_Feed_Builder::get_social_wall_links(),
[157] Fix | Delete
'socialWallActivated' => is_plugin_active( 'social-wall/social-wall.php' ),
[158] Fix | Delete
'genericText' => array(
[159] Fix | Delete
'help' => __( 'Help', 'custom-twitter-feeds' ),
[160] Fix | Delete
'title' => __( 'Support', 'custom-twitter-feeds' ),
[161] Fix | Delete
'gettingStarted' => __( 'Getting Started', 'custom-twitter-feeds' ),
[162] Fix | Delete
'someHelpful' => __( 'Some helpful resources to get you started', 'custom-twitter-feeds' ),
[163] Fix | Delete
'docsN' => __( 'Docs & Troubleshooting', 'custom-twitter-feeds' ),
[164] Fix | Delete
'runInto' => __( 'Run into an issue? Check out our help docs.', 'custom-twitter-feeds' ),
[165] Fix | Delete
'additionalR' => __( 'Additional Resources', 'custom-twitter-feeds' ),
[166] Fix | Delete
'toHelp' => __( 'To help you get the most out of the plugin', 'custom-twitter-feeds' ),
[167] Fix | Delete
'needMore' => __( 'Need more support? We’re here to help.', 'custom-twitter-feeds' ),
[168] Fix | Delete
'ourFast' => __( 'Our fast and friendly support team is always happy to help!', 'custom-twitter-feeds' ),
[169] Fix | Delete
'systemInfo' => __( 'System Info', 'custom-twitter-feeds' ),
[170] Fix | Delete
'exportSettings' => __( 'Export Settings', 'custom-twitter-feeds' ),
[171] Fix | Delete
'shareYour' => __( 'Share your plugin settings easily with Support', 'custom-twitter-feeds' ),
[172] Fix | Delete
'copiedToClipboard' => __( 'Copied to clipboard', 'custom-twitter-feeds' ),
[173] Fix | Delete
),
[174] Fix | Delete
'buttons' => array(
[175] Fix | Delete
'searchDoc' => __( 'Search Documentation', 'custom-twitter-feeds' ),
[176] Fix | Delete
'moreHelp' => __( 'More help on Getting started', 'custom-twitter-feeds' ),
[177] Fix | Delete
'viewDoc' => __( 'View Documentation', 'custom-twitter-feeds' ),
[178] Fix | Delete
'viewBlog' => __( 'View Blog', 'custom-twitter-feeds' ),
[179] Fix | Delete
'submitTicket' => __( 'Submit a Support Ticket', 'custom-twitter-feeds' ),
[180] Fix | Delete
'copy' => __( 'Copy', 'custom-twitter-feeds' ),
[181] Fix | Delete
'copied' => __( 'Copied', 'custom-twitter-feeds' ),
[182] Fix | Delete
'copy' => __( 'Copy', 'custom-twitter-feeds' ),
[183] Fix | Delete
'export' => __( 'Export', 'custom-twitter-feeds' ),
[184] Fix | Delete
'expand' => __( 'Expand', 'custom-twitter-feeds' ),
[185] Fix | Delete
'collapse' => __( 'Collapse', 'custom-twitter-feeds' ),
[186] Fix | Delete
),
[187] Fix | Delete
'icons' => array(
[188] Fix | Delete
'rocket' => CTF_PLUGIN_URL . 'admin/assets/img/rocket-icon.png',
[189] Fix | Delete
'book' => CTF_PLUGIN_URL . 'admin/assets/img/book-icon.png',
[190] Fix | Delete
'save' => CTF_PLUGIN_URL . 'admin/assets/img/save-plus-icon.png',
[191] Fix | Delete
'magnify' => '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.91667 0.5C7.35326 0.5 8.73101 1.07068 9.74683 2.08651C10.7627 3.10233 11.3333 4.48008 11.3333 5.91667C11.3333 7.25833 10.8417 8.49167 10.0333 9.44167L10.2583 9.66667H10.9167L15.0833 13.8333L13.8333 15.0833L9.66667 10.9167V10.2583L9.44167 10.0333C8.45879 10.8723 7.20892 11.3333 5.91667 11.3333C4.48008 11.3333 3.10233 10.7627 2.08651 9.74683C1.07068 8.73101 0.5 7.35326 0.5 5.91667C0.5 4.48008 1.07068 3.10233 2.08651 2.08651C3.10233 1.07068 4.48008 0.5 5.91667 0.5ZM5.91667 2.16667C3.83333 2.16667 2.16667 3.83333 2.16667 5.91667C2.16667 8 3.83333 9.66667 5.91667 9.66667C8 9.66667 9.66667 8 9.66667 5.91667C9.66667 3.83333 8 2.16667 5.91667 2.16667Z" fill="#141B38"/></svg>',
[192] Fix | Delete
'rightAngle' => '<svg width="7" height="11" viewBox="0 0 5 8" fill="#000" xmlns="http://www.w3.org/2000/svg"><path d="M1.00006 0L0.0600586 0.94L3.11339 4L0.0600586 7.06L1.00006 8L5.00006 4L1.00006 0Z" fill="#000"/></svg>',
[193] Fix | Delete
'linkIcon' => '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.166626 10.6583L8.99163 1.83329H3.49996V0.166626H11.8333V8.49996H10.1666V3.00829L1.34163 11.8333L0.166626 10.6583Z" fill="#141B38"/></svg>',
[194] Fix | Delete
'plusIcon' => '<svg width="13" height="12" viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.0832 6.83317H7.08317V11.8332H5.4165V6.83317H0.416504V5.1665H5.4165V0.166504H7.08317V5.1665H12.0832V6.83317Z" fill="white"/></>',
[195] Fix | Delete
'loaderSVG' => '<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" height="20px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"><path fill="#fff" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/></path></svg>',
[196] Fix | Delete
'checkmarkSVG' => '<svg width="13" height="10" viewBox="0 0 13 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.13112 6.88917L11.4951 0.525204L12.9093 1.93942L5.13112 9.71759L0.888482 5.47495L2.3027 4.06074L5.13112 6.88917Z" fill="#8C8F9A"/></svg>',
[197] Fix | Delete
'forum' => '<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19.8335 14V3.50004C19.8335 3.19062 19.7106 2.89388 19.4918 2.67508C19.273 2.45629 18.9762 2.33337 18.6668 2.33337H3.50016C3.19074 2.33337 2.894 2.45629 2.6752 2.67508C2.45641 2.89388 2.3335 3.19062 2.3335 3.50004V19.8334L7.00016 15.1667H18.6668C18.9762 15.1667 19.273 15.0438 19.4918 14.825C19.7106 14.6062 19.8335 14.3095 19.8335 14ZM24.5002 7.00004H22.1668V17.5H7.00016V19.8334C7.00016 20.1428 7.12308 20.4395 7.34187 20.6583C7.56066 20.8771 7.85741 21 8.16683 21H21.0002L25.6668 25.6667V8.16671C25.6668 7.85729 25.5439 7.56054 25.3251 7.34175C25.1063 7.12296 24.8096 7.00004 24.5002 7.00004Z" fill="#141B38"/></svg>',
[198] Fix | Delete
'copy' => '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.33334H6C5.26667 1.33334 4.66667 1.93334 4.66667 2.66667V10.6667C4.66667 11.4 5.26667 12 6 12H12C12.7333 12 13.3333 11.4 13.3333 10.6667V2.66667C13.3333 1.93334 12.7333 1.33334 12 1.33334ZM12 10.6667H6V2.66667H12V10.6667ZM2 10V8.66667H3.33333V10H2ZM2 6.33334H3.33333V7.66667H2V6.33334ZM6.66667 13.3333H8V14.6667H6.66667V13.3333ZM2 12.3333V11H3.33333V12.3333H2ZM3.33333 14.6667C2.6 14.6667 2 14.0667 2 13.3333H3.33333V14.6667ZM5.66667 14.6667H4.33333V13.3333H5.66667V14.6667ZM9 14.6667V13.3333H10.3333C10.3333 14.0667 9.73333 14.6667 9 14.6667ZM3.33333 4V5.33334H2C2 4.6 2.6 4 3.33333 4Z" fill="#141B38"/></svg>',
[199] Fix | Delete
'downAngle' => '<svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.94 0.226685L4 3.28002L7.06 0.226685L8 1.16668L4 5.16668L0 1.16668L0.94 0.226685Z" fill="#141B38"/></svg>',
[200] Fix | Delete
'exportSVG' => '<svg class="btn-icon" width="12" height="15" viewBox="0 0 12 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.166748 14.6667H11.8334V13H0.166748V14.6667ZM11.8334 5.5H8.50008V0.5H3.50008V5.5H0.166748L6.00008 11.3333L11.8334 5.5Z" fill="#141B38"/></svg>',
[201] Fix | Delete
),
[202] Fix | Delete
'images' => array(
[203] Fix | Delete
'supportMembers' => CTF_PLUGIN_URL . 'admin/assets/img/support-members.png'
[204] Fix | Delete
),
[205] Fix | Delete
'articles' => array(
[206] Fix | Delete
'gettingStarted' => array(
[207] Fix | Delete
array(
[208] Fix | Delete
'title' => __( 'Creating Your First Twitter Feed', 'custom-twitter-feeds' ),
[209] Fix | Delete
'link' => 'https://smashballoon.com/doc/setting-up-the-free-custom-twitter-feeds-wordpress-plugin/?twitter&utm_campaign=twitter-free&utm_source=support&utm_medium=docs&utm_content=Creating your first Twitter feed'
[210] Fix | Delete
),
[211] Fix | Delete
array(
[212] Fix | Delete
'title' => __( 'What are the Differences Between the Free and Pro Versions', 'custom-twitter-feeds' ),
[213] Fix | Delete
'link' => 'https://smashballoon.com/doc/differences-between-the-free-version-and-pro-version-of-the-custom-twitter-feeds-plugin/?twitter&utm_campaign=twitter-free&utm_source=support&utm_medium=docs&utm_content=What are the Differences Between the Free and Pro Versions'
[214] Fix | Delete
),
[215] Fix | Delete
array(
[216] Fix | Delete
'title' => __( 'I Just Upgraded to Pro but Can\'t Use the New Features', 'custom-twitter-feeds' ),
[217] Fix | Delete
'link' => 'https://smashballoon.com/doc/just-upgraded-pro-cant-use-new-features/?twitter&utm_campaign=twitter-free&utm_source=support&utm_medium=docs&utm_content=I Just Upgraded to Pro but Cant Use the New Features'
[218] Fix | Delete
),
[219] Fix | Delete
),
[220] Fix | Delete
'docs' => array(
[221] Fix | Delete
array(
[222] Fix | Delete
'title' => __( 'Guide to GDPR Compliance', 'custom-twitter-feeds' ),
[223] Fix | Delete
'link' => 'https://smashballoon.com/doc/custom-twitter-feeds-gdpr-compliance/?twitter&utm_campaign=twitter-free&utm_source=support&utm_medium=docs&utm_content=Guide to GDPR Compliance'
[224] Fix | Delete
),
[225] Fix | Delete
array(
[226] Fix | Delete
'title' => __( 'How to Resolve Error Messages', 'custom-twitter-feeds' ),
[227] Fix | Delete
'link' => 'https://smashballoon.com/custom-twitter-feeds/docs/errors/?twitter&utm_campaign=twitter-free&utm_source=support&utm_medium=docs&utm_content=How to Resolve Error Messages'
[228] Fix | Delete
),
[229] Fix | Delete
array(
[230] Fix | Delete
'title' => __( 'My Feed Stopped Updating', 'custom-twitter-feeds' ),
[231] Fix | Delete
'link' => 'https://smashballoon.com/my-feed-wont-show-the-latest-tweets/?twitter&utm_campaign=twitter-free&utm_source=support&utm_medium=docs&utm_content=My Feed Stopped Updating'
[232] Fix | Delete
),
[233] Fix | Delete
),
[234] Fix | Delete
'resources' => array(
[235] Fix | Delete
array(
[236] Fix | Delete
'title' => __( 'How to Create a Twitter Developer App', 'custom-twitter-feeds' ),
[237] Fix | Delete
'link' => 'https://smashballoon.com/custom-twitter-feeds/docs/create-twitter-app/?twitter&utm_campaign=twitter-free&utm_source=support&utm_medium=docs&utm_content=How to Create a Twitter Developer App'
[238] Fix | Delete
),
[239] Fix | Delete
array(
[240] Fix | Delete
'title' => __( 'Is the Content of My Feed Crawlable by Search Engines?', 'custom-twitter-feeds' ),
[241] Fix | Delete
'link' => 'https://smashballoon.com/doc/is-the-content-of-my-feed-crawlable-by-search-engines-and-how-does-it-help-improve-my-seo-2/?twitter&utm_campaign=twitter-free&utm_source=support&utm_medium=docs&utm_content=Is the Content of My Feed Crawlable by Search Engines'
[242] Fix | Delete
),
[243] Fix | Delete
array(
[244] Fix | Delete
'title' => __( 'How do I Embed My Feed Directly in a Template?', 'custom-twitter-feeds' ),
[245] Fix | Delete
'link' => 'https://smashballoon.com/doc/how-do-i-embed-the-twitter-feed-directly-into-a-theme-template/?twitter&utm_campaign=twitter-free&utm_source=support&utm_medium=docs&utm_content=How do I Embed My Feed Directly in a Template'
[246] Fix | Delete
),
[247] Fix | Delete
),
[248] Fix | Delete
)
[249] Fix | Delete
);
[250] Fix | Delete
[251] Fix | Delete
return $return;
[252] Fix | Delete
}
[253] Fix | Delete
[254] Fix | Delete
/**
[255] Fix | Delete
* Get System Info
[256] Fix | Delete
*
[257] Fix | Delete
* @since 2.0
[258] Fix | Delete
*/
[259] Fix | Delete
public function get_system_info() {
[260] Fix | Delete
$output = '';
[261] Fix | Delete
[262] Fix | Delete
// Build the output strings
[263] Fix | Delete
$output .= self::get_site_n_server_info();
[264] Fix | Delete
$output .= self::get_active_plugins_info();
[265] Fix | Delete
$output .= self::get_global_settings_info();
[266] Fix | Delete
$output .= self::get_feeds_settings_info();
[267] Fix | Delete
$output .= self::get_api_info();
[268] Fix | Delete
$output .= self::get_cron_report();
[269] Fix | Delete
$output .= self::get_image_resizing_info();
[270] Fix | Delete
$output .= self::get_posts_table_info();
[271] Fix | Delete
$output .= self::get_errors_info();
[272] Fix | Delete
[273] Fix | Delete
return $output;
[274] Fix | Delete
}
[275] Fix | Delete
[276] Fix | Delete
/**
[277] Fix | Delete
* Get Site and Server Info
[278] Fix | Delete
*
[279] Fix | Delete
* @since 2.0
[280] Fix | Delete
*
[281] Fix | Delete
* @return string
[282] Fix | Delete
*/
[283] Fix | Delete
public static function get_site_n_server_info() {
[284] Fix | Delete
$allow_url_fopen = ini_get( 'allow_url_fopen' ) ? "Yes" : "No";
[285] Fix | Delete
$php_curl = is_callable('curl_init') ? "Yes" : "No";
[286] Fix | Delete
$php_json_decode = function_exists("json_decode") ? "Yes" : "No";
[287] Fix | Delete
$php_ssl = in_array('https', stream_get_wrappers()) ? "Yes" : "No";
[288] Fix | Delete
[289] Fix | Delete
$output = '## SITE/SERVER INFO: ##' . "</br>";
[290] Fix | Delete
$output .= 'Plugin Version:' . self::get_whitespace( 11 ) . CTF_PLUGIN_NAME . "</br>";
[291] Fix | Delete
$output .= 'Site URL:' . self::get_whitespace( 17 ) . site_url() . "</br>";
[292] Fix | Delete
$output .= 'Home URL:' . self::get_whitespace( 17 ) . home_url() . "</br>";
[293] Fix | Delete
$output .= 'WordPress Version:' . self::get_whitespace( 8 ) . get_bloginfo( 'version' ) . "</br>";
[294] Fix | Delete
$output .= 'PHP Version:' . self::get_whitespace( 14 ) . PHP_VERSION . "</br>";
[295] Fix | Delete
$output .= 'Web Server Info:' . self::get_whitespace( 10 ) . $_SERVER['SERVER_SOFTWARE'] . "</br>";
[296] Fix | Delete
$output .= 'PHP allow_url_fopen:' . self::get_whitespace( 6 ) . $allow_url_fopen . "</br>";
[297] Fix | Delete
$output .= 'PHP cURL:' . self::get_whitespace( 17 ) . $php_curl . "</br>";
[298] Fix | Delete
$output .= 'JSON:' . self::get_whitespace( 21 ) . $php_json_decode . "</br>";
[299] Fix | Delete
$output .= 'SSL Stream:' . self::get_whitespace( 15 ) . $php_ssl . "</br>";
[300] Fix | Delete
$output .= "</br>";
[301] Fix | Delete
[302] Fix | Delete
return $output;
[303] Fix | Delete
}
[304] Fix | Delete
[305] Fix | Delete
/**
[306] Fix | Delete
* Get Active Plugins
[307] Fix | Delete
*
[308] Fix | Delete
* @since 2.0
[309] Fix | Delete
*
[310] Fix | Delete
* @return string
[311] Fix | Delete
*/
[312] Fix | Delete
public static function get_active_plugins_info() {
[313] Fix | Delete
$plugins = get_plugins();
[314] Fix | Delete
$active_plugins = get_option('active_plugins');
[315] Fix | Delete
$output = "## ACTIVE PLUGINS: ## </br>";
[316] Fix | Delete
[317] Fix | Delete
foreach ( $plugins as $plugin_path => $plugin ) {
[318] Fix | Delete
if ( in_array( $plugin_path, $active_plugins ) ) {
[319] Fix | Delete
$output .= $plugin['Name'] . ': ' . $plugin['Version'] ."</br>";
[320] Fix | Delete
}
[321] Fix | Delete
}
[322] Fix | Delete
[323] Fix | Delete
$output .= "</br>";
[324] Fix | Delete
[325] Fix | Delete
return $output;
[326] Fix | Delete
}
[327] Fix | Delete
[328] Fix | Delete
/**
[329] Fix | Delete
* Get Global Settings
[330] Fix | Delete
*
[331] Fix | Delete
* @since 2.0
[332] Fix | Delete
*
[333] Fix | Delete
* @return string
[334] Fix | Delete
*/
[335] Fix | Delete
public static function get_global_settings_info() {
[336] Fix | Delete
$output = "## GLOBAL SETTINGS: ## </br>";
[337] Fix | Delete
$ctf_settings = get_option( 'ctf_options', array() );
[338] Fix | Delete
$usage_tracking = get_option( 'ctf_usage_tracking', array( 'last_send' => 0, 'enabled' => \ctf_is_pro_version() ) );
[339] Fix | Delete
[340] Fix | Delete
//$output .= "</br>";
[341] Fix | Delete
//$output .= 'Caching: ';
[342] Fix | Delete
if ( wp_next_scheduled( 'ctf_feed_update' ) ) {
[343] Fix | Delete
$time_format = get_option( 'time_format' );
[344] Fix | Delete
if ( ! $time_format ) {
[345] Fix | Delete
$time_format = 'g:i a';
[346] Fix | Delete
}
[347] Fix | Delete
//
[348] Fix | Delete
$schedule = wp_get_schedule( 'ctf_feed_update' );
[349] Fix | Delete
if ( $schedule == '30mins' ) $schedule = __( 'every 30 minutes', 'custom-twitter-feeds' );
[350] Fix | Delete
if ( $schedule == 'twicedaily' ) $schedule = __( 'every 12 hours', 'custom-twitter-feeds' );
[351] Fix | Delete
$ctf_next_cron_event = wp_next_scheduled( 'ctf_feed_update' );
[352] Fix | Delete
//$output = __( 'Next check', 'custom-twitter-feeds' ) . ': ' . date( $time_format, $ctf_next_cron_event + ctf_get_utc_offset() ) . ' (' . $schedule . ')';
[353] Fix | Delete
[354] Fix | Delete
} else {
[355] Fix | Delete
//$output .= 'Nothing currently scheduled';
[356] Fix | Delete
}
[357] Fix | Delete
$output .= "</br>";
[358] Fix | Delete
$output .= 'Site Key: ';
[359] Fix | Delete
$output .= isset( $ctf_settings[ CTF_SITE_ACCESS_TOKEN_KEY ] ) ? $ctf_settings[ CTF_SITE_ACCESS_TOKEN_KEY ] : 'NO KEY!';
[360] Fix | Delete
$output .= "</br>";
[361] Fix | Delete
$output .= 'GDPR: ';
[362] Fix | Delete
$output .= isset( $ctf_settings[ 'gdpr' ] ) ? $ctf_settings[ 'gdpr' ] : ' Not setup';
[363] Fix | Delete
$output .= "</br>";
[364] Fix | Delete
$output .= 'Custom CSS: ';
[365] Fix | Delete
$output .= isset( $ctf_settings['sb_instagram_custom_css'] ) && ! empty( $ctf_settings['sb_instagram_custom_css'] ) ? $ctf_settings['sb_instagram_custom_css'] : 'Empty';
[366] Fix | Delete
$output .= "</br>";
[367] Fix | Delete
$output .= 'Custom JS: ';
[368] Fix | Delete
$output .= isset( $ctf_settings['sb_instagram_custom_js'] ) && ! empty( $ctf_settings['sb_instagram_custom_js'] ) ? $ctf_settings['sb_instagram_custom_js'] : 'Empty';
[369] Fix | Delete
$output .= "</br>";
[370] Fix | Delete
$output .= 'Optimize Images: ';
[371] Fix | Delete
$output .= isset( $ctf_settings[ 'sb_instagram_disable_resize' ] ) && $ctf_settings[ 'sb_instagram_disable_resize' ] == 'on' ? 'Enabled' : 'Disabled';
[372] Fix | Delete
$output .= "</br>";
[373] Fix | Delete
$output .= 'Usage Tracking: ';
[374] Fix | Delete
$output .= isset( $usage_tracking['enabled'] ) && $usage_tracking['enabled'] == true ? 'Enabled' : 'Disabled';
[375] Fix | Delete
$output .= "</br>";
[376] Fix | Delete
$output .= 'AJAX theme loading fix: ';
[377] Fix | Delete
$output .= isset( $ctf_settings[ 'ctf_ajax' ] ) && $ctf_settings[ 'ctf_ajax' ] == true ? 'Enabled' : 'Disabled';
[378] Fix | Delete
$output .= "</br>";
[379] Fix | Delete
$output .= 'AJAX Initial: ';
[380] Fix | Delete
$output .= isset( $ctf_settings['ctf_ajax_initial'] ) && $ctf_settings['ctf_ajax_initial'] == true ? 'Enabled' : 'Disabled';
[381] Fix | Delete
$output .= "</br>";
[382] Fix | Delete
$output .= 'Enqueue in Head: ';
[383] Fix | Delete
$output .= isset( $ctf_settings['ctf_enqueue_js_in_head'] ) && $ctf_settings['ctf_enqueue_js_in_head'] == true ? 'Enabled' : 'Disabled';
[384] Fix | Delete
$output .= "</br>";
[385] Fix | Delete
$output .= 'Enqueue in Shortcode: ';
[386] Fix | Delete
$output .= isset( $ctf_settings['ctf_enqueue_css_in_shortcode'] ) && $ctf_settings['ctf_enqueue_css_in_shortcode'] == true ? 'Enabled' : 'Disabled';
[387] Fix | Delete
$output .= "</br>";
[388] Fix | Delete
$output .= 'Enable JS Image: ';
[389] Fix | Delete
$output .= isset( $ctf_settings['ctf_enable_js_image_loading'] ) && $ctf_settings['ctf_enable_js_image_loading'] == true ? 'Enabled' : 'Disabled';
[390] Fix | Delete
$output .= "</br>";
[391] Fix | Delete
$output .= 'Admin Error Notice: ';
[392] Fix | Delete
$output .= isset( $ctf_settings['disable_admin_notice'] ) && $ctf_settings['disable_admin_notice'] == true ? 'Enabled' : 'Disabled';
[393] Fix | Delete
$output .= "</br>";
[394] Fix | Delete
$output .= 'Feed Issue Email Reports: ';
[395] Fix | Delete
$output .= isset( $ctf_settings['enable_email_report'] ) && $ctf_settings['enable_email_report'] == true ? 'Enabled' : 'Disabled';
[396] Fix | Delete
$output .= "</br>";
[397] Fix | Delete
$output .= 'Email notification: ';
[398] Fix | Delete
$output .= isset( $ctf_settings['email_notification'] ) && $ctf_settings['email_notification'] !== null ? ucfirst($ctf_settings['email_notification']) : 'Off';
[399] Fix | Delete
$output .= "</br>";
[400] Fix | Delete
$output .= 'Email notification addresses: ';
[401] Fix | Delete
$output .= isset( $ctf_settings['email_notification_addresses'] ) && !empty( $ctf_settings['email_notification_addresses'] ) ? $ctf_settings['email_notification_addresses'] : 'Not available';
[402] Fix | Delete
$output .= "</br>";
[403] Fix | Delete
$output .= "</br>";
[404] Fix | Delete
return $output;
[405] Fix | Delete
}
[406] Fix | Delete
[407] Fix | Delete
/**
[408] Fix | Delete
* Get Feeds Settings
[409] Fix | Delete
*
[410] Fix | Delete
* @since 2.0
[411] Fix | Delete
*
[412] Fix | Delete
* @return string
[413] Fix | Delete
*/
[414] Fix | Delete
public static function get_feeds_settings_info() {
[415] Fix | Delete
$output = "## FEEDS: ## </br>";
[416] Fix | Delete
[417] Fix | Delete
$feeds_list = CTF_Feed_Builder::get_feed_list();
[418] Fix | Delete
$i = 0;
[419] Fix | Delete
foreach( $feeds_list as $feed ) {
[420] Fix | Delete
[421] Fix | Delete
$type = ! empty( $feed['settings']->type ) ? $feed['settings']->type : 'user';
[422] Fix | Delete
if ( $i >= 25 ) {
[423] Fix | Delete
break;
[424] Fix | Delete
}
[425] Fix | Delete
$output .= $feed['feed_name'];
[426] Fix | Delete
if ( isset( $feed['settings'] ) ) {
[427] Fix | Delete
$source = array();
[428] Fix | Delete
$output .= ' - ' . ucfirst( $type );
[429] Fix | Delete
$output .= '</br>';
[430] Fix | Delete
[431] Fix | Delete
}
[432] Fix | Delete
$output .= "</br>";
[433] Fix | Delete
if ( isset( $feed['location_summary'] ) && count( $feed['location_summary'] ) > 0 ) {
[434] Fix | Delete
$first_feed = $feed['location_summary'][0];
[435] Fix | Delete
$output .= $first_feed['link'] . '?sb_debug';
[436] Fix | Delete
}
[437] Fix | Delete
$output .= "</br>";
[438] Fix | Delete
[439] Fix | Delete
$i++;
[440] Fix | Delete
}
[441] Fix | Delete
$output .= "</br>";
[442] Fix | Delete
[443] Fix | Delete
return $output;
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
/**
[447] Fix | Delete
* Get API Response Info
[448] Fix | Delete
*
[449] Fix | Delete
* @since 2.0
[450] Fix | Delete
*
[451] Fix | Delete
* @return string
[452] Fix | Delete
*/
[453] Fix | Delete
public static function get_api_info() {
[454] Fix | Delete
$options = get_option( 'ctf_options' );
[455] Fix | Delete
$consumer_key = ! empty( $options['consumer_key'] ) && ! empty( $options['have_own_tokens'] ) ? $options['consumer_key'] : 'FPYSYWIdyUIQ76Yz5hdYo5r7y';
[456] Fix | Delete
$consumer_secret = ! empty( $options['consumer_secret'] ) && ! empty( $options['have_own_tokens'] ) ? $options['consumer_secret'] : 'GqPj9BPgJXjRKIGXCULJljocGPC62wN2eeMSnmZpVelWreFk9z';
[457] Fix | Delete
$request_settings = array(
[458] Fix | Delete
'consumer_key' => $consumer_key,
[459] Fix | Delete
'consumer_secret' => $consumer_secret,
[460] Fix | Delete
'access_token' => $options['access_token'],
[461] Fix | Delete
'access_token_secret' => $options['access_token_secret']
[462] Fix | Delete
);
[463] Fix | Delete
$output = '';
[464] Fix | Delete
if ( isset( $options['request_method'] ) ) {
[465] Fix | Delete
$request_method = isset( $options['request_method'] ) ? $options['request_method'] : 'auto';
[466] Fix | Delete
[467] Fix | Delete
$twitter_api = new \TwitterFeed\V2\CtfOauthConnect( $request_settings, 'usertimeline' );
[468] Fix | Delete
$twitter_api->setUrlBase();
[469] Fix | Delete
$get_fields = array( 'count' => '1' );
[470] Fix | Delete
$twitter_api->setGetFields( $get_fields );
[471] Fix | Delete
$twitter_api->setRequestMethod( $request_method );
[472] Fix | Delete
[473] Fix | Delete
$twitter_api->performRequest();
[474] Fix | Delete
$response = json_decode( $twitter_api->json, $assoc = true );
[475] Fix | Delete
$screen_name = isset( $response[0] ) ? $response[0]['user']['screen_name'] : 'error';
[476] Fix | Delete
if ( $screen_name === 'error' ) {
[477] Fix | Delete
if ( isset( $response['errors'][0] ) ) {
[478] Fix | Delete
$twitter_api->api_error_no = $response['errors'][0]['code'];
[479] Fix | Delete
$twitter_api->api_error_message = $response['errors'][0]['message'];
[480] Fix | Delete
}
[481] Fix | Delete
}
[482] Fix | Delete
[483] Fix | Delete
$output .= '## Twitter API RESPONSE: ## <br>';
[484] Fix | Delete
if ( ! empty( $twitter_api->api_error_no ) ) {
[485] Fix | Delete
$output .= 'Error No: ' . esc_html( $twitter_api->api_error_no ) . '<br>';
[486] Fix | Delete
$output .= 'Error Message: ' . esc_html( $twitter_api->api_error_message ) . '<br>';
[487] Fix | Delete
} else {
[488] Fix | Delete
$output .= 'Connection was successful! <br>';
[489] Fix | Delete
$output .= 'Account Screen Name: ' . esc_html( $screen_name ) . '<br>';
[490] Fix | Delete
}
[491] Fix | Delete
[492] Fix | Delete
} //End isset check
[493] Fix | Delete
[494] Fix | Delete
$api_call_log = get_option( 'ctf_api_call_log', array() );
[495] Fix | Delete
$output .= '## API CALL LOG: ## </br>';
[496] Fix | Delete
$api_call_log = array_slice( $api_call_log, 0, 10 );
[497] Fix | Delete
foreach ( $api_call_log as $api_call ) {
[498] Fix | Delete
foreach ( $api_call as $key => $value ) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function