= 0) {
// ---------------------------------
// Set this Wordquest Helper version
// ---------------------------------
// 1.6.0: wqv to wqhv for new variable functions
// 1.6.6: move wordquestversion to top for easy changing
$wqhv = str_replace('.', '', $wordquestversion);
// --------------------
// Set Global Site URLs
// --------------------
// 1.6.5: added for clearer/cleaner usage
global $wqurls;
$wqurls = array(
'wp' => 'https://wordpress.org',
'wq' => 'http://wordquest.org',
'wpm' => 'http://wpmedic.tech',
'prn' => 'http://pluginreview.net',
'bio' => 'http://bioship.space'
);
// ------------------------
// Set Debug Switch Default
// ------------------------
// 1.6.6: set debug switch to off to recheck later
global $wqdebug; $wqdebug = false;
// -----------------------------------------
// === Version Handling Loader Functions ===
// -----------------------------------------
// ...future proofing helper update library...
// ----------------------------------
// Add Helper version to global array
// ----------------------------------
// 1.6.0: change globals to use new variable functions (as not backcompatible!)
global $wordquesthelpers, $wqfunctions;
if (!is_array($wordquesthelpers)) {$wordquesthelpers = array($wqhv);}
elseif (!in_array($wqhv, $wordquesthelpers)) {$wordquesthelpers[] = $wqhv;}
// ------------------------------------------
// Set Latest Wordquest Version on Admin Load
// ------------------------------------------
// 1.5.0: use admin_init not plugins_loaded so as to be usable by themes
if (!has_action('admin_init', 'wqhelper_admin_loader', 1)) {
add_action('admin_init', 'wqhelper_admin_loader', 1);
}
if (!function_exists('wqhelper_admin_loader')) {
function wqhelper_admin_loader() {
global $wqdebug;
// --- maybe set debug mode ---
// 1.6.6: check debug switch here so we can check permissions
if (current_user_can('manage_options')) {
if (isset($_REQUEST['wqdebug']) && ($_REQUEST['wqdebug'] == 'yes')) {$wqdebug = true;}
}
// --- maybe remove old action ---
// 1.6.0: maybe remove the pre 1.6.0 loader action
if (has_action('admin_init', 'wordquest_admin_load')) {
remove_action('admin_init', 'wordquest_admin_load');
}
// --- set helper version to use ---
// 1.6.0: new globals used for new method
global $wordquesthelper, $wordquesthelpers;
$wordquesthelper = max($wordquesthelpers);
if ($wqdebug) {echo "";}
// --- load callable functions ---
// 1.6.0: set the function caller helper
global $wqcaller, $wqfunctions;
$functionname = 'wqhelper_caller_';
$func = $functionname.$wordquesthelper;
// --- set callable functions ---
if (is_callable($wqfunctions[$func])) {
$wqfunctions[$func]($functionname); // $wqcaller = $wqfunctions[$functionname];
} elseif (function_exists($func)) {call_user_func($func, $functionname);}
if ($wqdebug) {echo "";}
// --- load admin notices ---
// 1.5.0: set up any admin notices via helper version
// 1.6.0: ...use caller function directly for this
$adminnotices = 'wqhelper_admin_notices';
if (is_callable($wqcaller)) {$wqcaller($adminnotices);}
elseif (function_exists($adminnotices)) {call_user_func($adminnotices);}
}
}
// ----------------------------------
// Function to Define Function Caller
// ----------------------------------
// 1.6.0: some lovely double abstraction here!
$funcname = 'wqhelper_caller_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function($func) {
global $wqfunctions, $wqcaller;
if (!is_callable($wqcaller)) {
$wqcaller = function($function, $args = null) {
global $wordquesthelper, $wqfunctions;
$func = $function.'_'.$wordquesthelper;
if (is_callable($wqfunctions[$func])) {return $wqfunctions[$func]($args);}
elseif (function_exists($func)) {return call_user_func($func, $args);}
};
}
};
}
// -------------------------------------
// Versioned Admin Page Caller Functions
// -------------------------------------
// 1.7.2: use direct superglobal to shorten functions
// wqhelper_admin_page
// wqhelper_admin_notice_boxer
// wqhelper_get_plugin_info
// wqhelper_admin_plugins_column
// wqhelper_admin_feeds_column
// wqhelper_install_plugin
// wqhelper_reminder_notice
// wqhelper_translate
// --- admin page ---
if (!function_exists('wqhelper_admin_page')) {
function wqhelper_admin_page($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- admin notice boxer ---
if (!function_exists('wqhelper_admin_notice_boxer')) {
function wqhelper_admin_notice_boxer($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- get plugins info ---
if (!function_exists('wqhelper_get_plugin_info')) {
function wqhelper_get_plugin_info($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- admin page plugins column ---
if (!function_exists('wqhelper_admin_plugins_column')) {
function wqhelper_admin_plugins_column($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- admin page feeds column ---
if (!function_exists('wqhelper_admin_feeds_column')) {
function wqhelper_admin_feeds_column($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// 1.6.5: install WordQuest plugin
if (!function_exists('wqhelper_install_plugin')) {
function wqhelper_install_plugin($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// 1.6.5: reminder notice message
if (!function_exists('wqhelper_reminder_notice')) {
function wqhelper_reminder_notice($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// 1.6.9: translation wrapper
if (!function_exists('wqhelper_translate')) {
function wqhelper_translate($string) {
return $GLOBALS['wqcaller'](__FUNCTION__, $string);
}
}
// ---------------------------------
// Sidebar Floatbox Caller Functions
// ---------------------------------
// 1.7.2: use direct superglobal to shorten functions
// - wqhelper_sidebar_floatbox
// - wqhelper_sidebar_paypal_donations
// - wqhelper_sidebar_testimonial_box
// - wqhelper_sidebar_floatmenuscript
// - wqhelper_sidebar_stickykitscript
// --- sidebar floatbox ---
if (!function_exists('wqhelper_sidebar_floatbox')) {
function wqhelper_sidebar_floatbox($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- donations box ---
if (!function_exists('wqhelper_sidebar_paypal_donations')) {
function wqhelper_sidebar_paypal_donations($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- testimonials box ---
if (!function_exists('wqhelper_sidebar_testimonial_box')) {
function wqhelper_sidebar_testimonial_box($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- floating menu script ---
if (!function_exists('wqhelper_sidebar_floatmenuscript')) {
function wqhelper_sidebar_floatmenuscript($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- sticky kit script ---
if (!function_exists('wqhelper_sidebar_stickykitscript')) {
function wqhelper_sidebar_stickykitscript($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// Dashboard Feed Caller Functions
// -------------------------------
// 1.7.2: use direct superglobal to shorten functions
// - wqhelper_add_dashboard_feed_widget
// - wqhelper_dashboard_feed_javascript
// - wqhelper_dashboard_feed_widget
// - wqhelper_pluginreview_feed_widget
// - wqhelper_process_rss_feed
// - wqhelper_load_category_feed
// --- add dashboard feed widget ---
if (!function_exists('wqhelper_add_dashboard_feed_widget')) {
function wqhelper_add_dashboard_feed_widget($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- dashboard feed javascript ---
if (!function_exists('wqhelper_dashboard_feed_javascript')) {
function wqhelper_dashboard_feed_javascript($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- dashboard feed widget ---
if (!function_exists('wqhelper_dashboard_feed_widget')) {
function wqhelper_dashboard_feed_widget($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- plugin review feed widget ---
if (!function_exists('wqhelper_pluginreview_feed_widget')) {
function wqhelper_pluginreview_feed_widget($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- process RSS feed ---
if (!function_exists('wqhelper_process_rss_feed')) {
function wqhelper_process_rss_feed($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// --- load category feed ---
if (!function_exists('wqhelper_load_category_feed')) {
function wqhelper_load_category_feed($args=null) {
if (!is_admin()) {return;} else {return $GLOBALS['wqcaller'](__FUNCTION__, $args);}
}
}
// --------------------------
// === Styles and Scripts ===
// --------------------------
// ---------------------------------
// Add Helper Styles to Admin Footer
// ---------------------------------
if (!has_action('admin_footer', 'wqhelper_admin_styles')) {
add_action('admin_footer', 'wqhelper_admin_styles');
}
if (!function_exists('wqhelper_admin_styles')) {
function wqhelper_admin_styles($args=null) {
remove_action('admin_footer', 'wordquest_admin_styles');
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// ----------------------------------
// Add Helper Scripts to Admin Footer
// ----------------------------------
if (!has_action('admin_footer', 'wqhelper_admin_scripts')) {
add_action('admin_footer', 'wqhelper_admin_scripts');
}
if (!function_exists('wqhelper_admin_scripts')) {
function wqhelper_admin_scripts($args=null) {
remove_action('admin_footer', 'wordquest_admin_scripts');
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// ----------------------
// === AJAX Functions ===
// ----------------------
// AJAX for reminder dismissal
// ---------------------------
// 1.6.5: added this AJAX function
if (!has_action('wp_ajax_wqhelper_reminder_dismiss', 'wqhelper_reminder_dismiss')) {
add_action('wp_ajax_wqhelper_reminder_dismiss', 'wqhelper_reminder_dismiss');
}
if (!function_exists('wqhelper_reminder_dismiss')) {
function wqhelper_reminder_dismiss($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// -----------------------
// AJAX Load Category Feed
// -----------------------
if (!has_action('wp_ajax_wqhelper_load_feed_cat', 'wqhelper_load_feed_category')) {
add_action('wp_ajax_wqhelper_load_feed_cat', 'wqhelper_load_feed_category');
}
if (!function_exists('wqhelper_load_feed_category')) {
function wqhelper_load_feed_category($args=null) {
return $GLOBALS['wqcaller'](__FUNCTION__, $args);
}
}
// ----------------------
// Update Sidebar Options
// ----------------------
// 1.6.0: ! NOTE ! caller exception ! use matching form version function here just in case...
if (!has_action('wp_ajax_wqhelper_update_sidebar_boxes', 'wqhelper_update_sidebar_boxes')) {
add_action('wp_ajax_wqhelper_update_sidebar_boxes', 'wqhelper_update_sidebar_boxes');
}
if (!function_exists('wqhelper_update_sidebar_boxes')) {
function wqhelper_update_sidebar_boxes() {
// --- get helper version ---
if (!isset($_POST['wqhv'])) {return;} else {$wqhv = $_POST['wqhv'];}
// 1.6.6: added sanitization of version value
if (!is_numeric($wqhv) || (strlen($wqhv) !== 3)) {return;}
// --- set matching function version ---
$func = 'wqhelper_update_sidebar_options_'.$wqhv;
// --- call function ---
// 1.6.5: fix to function call method
global $wqfunctions;
if (is_callable($wqfunctions[$func])) {$wqfunctions[$func]();}
elseif (function_exists($func)) {call_user_func($func);}
}
}
// ----------------------------------
// === Version Specific Functions ===
// ----------------------------------
// (functions below this point must be suffixed with _{VERSION} to work
// and update with each plugin helper version regardless of change state)
// -------------------
// Translation Wrapper
// -------------------
// 1.6.9: check translated labels global
$funcname = 'wqhelper_translate_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function($string) {
global $wqlabels;
if (isset($wqlabels[$string])) {return $wqlabels[$string];}
// 1.6.9: added fallback translation for bioship theme
if (function_exists('bioship_translate')) {return bioship_translate($string);}
if (function_exists('translate')) {return translate($string, 'default');}
return $string;
};
}
// ------------------
// Admin Notice Boxer
// ------------------
// (for settings pages)
$funcname = 'wqhelper_admin_notice_boxer_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function() {
// --- count admin notices ---
// global $wp_filter; $notices = 0; // print_r($wp_filter);
// if (isset($wp_filter['admin_notices'])) {$adminnotices = $notices = count($wp_filter['admin_notices']);}
// if (is_network_admin()) {if (isset($wp_filter['network_admin_notices'])) {$networknotices = count($wp_filter['network_admin_notices']); $notices = $notices + $networknotices;} }
// if (is_user_admin()) {if (isset($wp_filter['user_admin_notices'])) {$usernotices = count($wp_filter['user_admin_notices']); $notices = $notices + $usernotices;} }
// if (isset($wp_filter['all_admin_notices'])) {$alladminnotices = count($wp_filter['all_admin_notices']); $notices = $notices + $alladminnotices;}
// if ($notices == 0) {return;}
// print_r($wp_filter['admin_notices']); print_r($wp_filter['all_admin_notices']);
// echo "";
// --- toggle notice box script ---
echo "";
// --- output notice box ---
$adminnotices = ''; // $adminnotices = '('.$notices.')';
echo '
';
echo '
';
echo '▾ ';
echo wqhelper_translate('Admin Notices');
echo $adminnotices.' ';
echo '
';
// echo '';
// echo '
▼ ';
// echo wqhelper_translate('Admin Notices');
// echo ' ('.$adminnotices.') ';
// echo '
';
};
}
// ---------------------------
// Usage Reminder Notice Check
// ---------------------------
// 1.5.0: added reminder prototype that does nothing yet
// 1.6.5: completed usage reminder notices
$funcname = 'wqhelper_admin_notices_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function() {
global $wordquestplugins;
foreach ($wordquestplugins as $pluginslug => $wqplugin) {
// --- check current user capabilities ---
// 1.7.3: only show reminder notice to users with capabilities
$shownotice = false;
if ( current_user_can('manage_options')
|| ( ($pluginslug == 'bioship') && current_user_can('install_themes') )
|| ( ($pluginslug != 'bioship') && current_user_can('install_plugins') ) ) {
$shownotice = true;
}
if ($shownotice) {
// 1.6.8: move here to fix undefined index warning
$prefix = $wqplugin['settings'];
// 1.7.0: moved up here to fix install version check
$sidebaroptions = get_option($prefix.'_sidebar_options');
// 1.6.7: maybe set first install version for plugin
if (!isset($sidebaroptions['installversion'])) {
$sidebaroptions['installversion'] = $wqplugin['version'];
update_option($prefix.'_sidebar_options', $sidebaroptions);
}
// 1.6.5: no reminders needed if pro version
if ($wqplugin['plan'] == 'premium') {return;}
// 1.6.5: no reminders if donation box has been turned off
// 1.6.7: revert that as so many other ways to still contribute
// if ( (isset($sidebaroptions['donationboxoff']))
// && ($sidebaroptions['donationboxoff'] == 'checked') ) {return;}
if (isset($sidebaroptions['installdate'])) {
// --- check usage length ---
$reminder = false;
$installtime = @strtotime($sidebaroptions['installdate']);
$timesince = time() - $installtime;
$dayssince = floor($timesince / (24*60*60));
// --- 30 days, 90 days and 1 year notices ---
if ($dayssince > 365) {
if (!isset($sidebaroptions['365days'])) {$reminder = '365';}
} elseif ($dayssince > 90) { // 90 day notice
if (!isset($sidebaroptions['90days'])) {$reminder = '90';}
} elseif ($dayssince > 30) { // 30 day notice
if (!isset($sidebaroptions['30days'])) {$reminder = '30';}
}
if ($reminder) {
// --- add an admin reminder notice ---
global $wqreminder; $wqreminder[$pluginslug] = $wqplugin;
$wqreminder[$pluginslug]['days'] = $dayssince;
$wqreminder[$pluginslug]['notice'] = $reminder;
add_action('admin_notices', 'wqhelper_reminder_notice');
}
} else {
$sidebaroptions['installdate'] = date('Y-m-d');
update_option($prefix.'_sidebar_options', $sidebaroptions);
}
}
}
};
}
// ---------------------
// Usage Reminder Notice
// ---------------------
// 1.6.5: added reminder notice text
$funcname = 'wqhelper_reminder_notice_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function() {
global $wqreminder, $wqurls;
// --- loop reminders ---
foreach ($wqreminder as $pluginslug => $reminder) {
// --- reminder wrapper ---
echo "";
echo wqhelper_translate("You've been enjoying")." ";
echo $wqreminder[$pluginslug]['title']." ".wqhelper_translate("for")." ";
echo $wqreminder[$pluginslug]['days']." ".wqhelper_translate("days").". ";
echo wqhelper_translate("If you like it, here's some ways you can help make it better").":
";
// Action Links Table
// ------------------
// 1.6.7: extended link anchor text for clarity
echo "
";
echo " ";
// --- dismiss notice X link ---
$dismisslink = admin_url('admin-ajax.php').'?action=wqhelper_reminder_dismiss&slug='.$pluginslug.'¬ice='.$wqreminder[$pluginslug]['notice'];
echo "";
echo "
";
echo "
";
}
echo "";
};
}
// -----------------------
// AJAX Reminder Dismisser
// -----------------------
$funcname = 'wqhelper_reminder_dismiss_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function() {
// --- check conditions ---
$pluginslug = $_REQUEST['slug']; $notice = $_REQUEST['notice'];
if ( ($notice != '30') && ($notice != '90') && ($notice != '365') ) {return;}
// --- check capabilities ---
$dismiss = false;
if ( current_user_can('manage_options')
|| ( ($pluginslug == 'bioship') && current_user_can('install_themes') )
|| ( ($pluginslug != 'bioship') && current_user_can('install_plugins') ) ) {
$dismiss = true;
}
if ($dismiss) {
// --- dismiss the reminder notice ---
global $wordquestplugins;
$prefix = $wordquestplugins[$pluginslug]['settings'];
$sidebaroptions = get_option($prefix.'_sidebar_options');
if (isset($sidebaroptions[$notice.'days']) && ($sidebaroptions[$notice.'days'] == 'dismissed')) {
$sidebaroptions[$notice.'days'] = '';
} else {$sidebaroptions[$notice.'days'] = 'dismissed';}
update_option($prefix.'_sidebar_options', $sidebaroptions);
// --- hide the notice in the parent window ---
echo "";
}
exit;
};
}
// --------------------------
// Get WordQuest Plugins Info
// --------------------------
$funcname = 'wqhelper_get_plugin_info_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function() {
global $wqurls, $wqdebug;
// --- maybe get cached plugin info ---
// 1.5.0: get plugin info (maximum twice daily)
$plugininfo = get_transient('wordquest_plugin_info');
if ($wqdebug) {$plugininfo = '';} // clear transient for debugging
// --- maybe get plugin info now ---
if (!$plugininfo || ($plugininfo == '') || !is_array($plugininfo)) {
$pluginsurl = $wqurls['wq'].'/?get_plugins_info=yes';
$args = array('timeout' => 15);
$plugininfo = wp_remote_get($pluginsurl, $args);
if (!is_wp_error($plugininfo)) {
$plugininfo = $plugininfo['body'];
$dataend = "*****END DATA*****";
if (strstr($plugininfo, $dataend)) {
$pos = strpos($plugininfo, $dataend);
$plugininfo = substr($plugininfo, 0, $pos);
$plugininfo = json_decode($plugininfo, true);
set_transient('wordquest_plugin_info', $plugininfo, (12*60*60));
} else {$plugininfo = '';}
} else {$plugininfo = '';}
}
if ($wqdebug) {echo "";}
return $plugininfo;
};
}
// ---------------------------
// Version Specific Admin Page
// ---------------------------
$funcname = 'wqhelper_admin_page_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function() {
global $wordquesthelper, $wordquestplugins, $wqurls;
echo '';
// --- admin notice boxer ---
wqhelper_admin_notice_boxer();
// --- toggle metabox script ---
echo "";
// --- admin page styles ---
echo '';
// --- Floating Sidebar ---
// set dummy "plugin" values for admin page sidebar
global $wordquestplugins, $wordquesthelper;
$wordquestplugins['wordquest'] = array(
'version' => $wordquesthelper,
'title' => 'WordQuest Alliance',
'namespace' => 'wordquest',
'settings' => 'wq',
'plan' => 'free',
'wporg' => false,
'wporgslug' => false,
);
$args = array('wordquest', 'special');
wqhelper_sidebar_floatbox($args);
// --- load sticky kit on sidebar ---
// 1.6.5: replace floatmenu with stickykit
echo wqhelper_sidebar_stickykitscript();
echo '';
echo '';
unset($wordquestplugins['wordquest']);
// echo wqhelper_sidebar_floatmenuscript();
// echo '
// --- Admin Page Title ---
$wordquesticon = plugins_url('images/wordquest.png', __FILE__);
echo '';
echo '
';
echo ' ';
echo ' ';
echo ' / ';
echo ' ';
echo ' ';
echo '
';
// --- Output Plugins Column ---
wqhelper_admin_plugins_column(null);
// --- Output Feeds Column ---
wqhelper_admin_feeds_column(null);
// --- Wordquest Sidebar 'plugin' box ---
function wq_sidebar_plugin_footer() {
global $wqurls;
$iconurl = plugins_url('images/wordquest.png', __FILE__);
echo '';
}
echo '
';
// --- hidden iframe for plugin actions ---
echo '';
echo '';
};
}
// -------------------------------
// Version Specific Plugins Column
// -------------------------------
$funcname = 'wqhelper_admin_plugins_column_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function($args) {
global $wordquesthelper, $wordquestplugins, $wqurls, $wqdebug;
// --- check if WordPress.Org plugins only ---
// 1.6.6: check if current WQ plugins are all installed via WordPress.Org
// (if so, only provide option to install other WQ plugins in repository)
global $wordpressorgonly; $wordpressorgonly = true;
foreach ($wordquestplugins as $pluginslug => $plugin) {
// if this is false, it was from wordquest not wordpress
if (!$plugin['wporg']) {$wordpressorgonly = false;}
}
// --- Plugin Action Select Javascript ---
// 1.7.2: updated star rating link
// TODO: test all options here more thoroughly..?
echo "";
// --- link styles ---
echo "";
// --- Get Installed and Active Plugin Slugs ---
$i = 0; foreach ($wordquestplugins as $pluginslug => $values) {$pluginslugs[$i] = $pluginslug; $i++;}
// if ($wqdebug) {echo "";}
// --- Get All Installed Plugins Info ---
$i = 0; $installedplugins = get_plugins();
foreach ($installedplugins as $pluginfile => $values) {$installedslugs[$i] = sanitize_title($values['Name']); $i++;}
// if ($wqdebug) {echo "";}
// if ($wqdebug) {echo "";}
// Get Plugin Update Info
// ----------------------
// 1.6.6: define empty pluginupdates array
$i = 0; $updateplugins = get_site_transient('update_plugins'); $pluginupdates = array();
// 1.7.3: adde property exists check
if (property_exists($updateplugins, 'response')) {
foreach ($updateplugins->response as $pluginfile => $values) {$pluginupdates[$i] = $values->slug; $i++;}
}
// if ($wqdebug) {echo "";}
// if ($wqdebug) {echo "";}
// --- Get Available Plugins from WordQuest.org ---
$plugininfo = wqhelper_get_plugin_info();
// process plugin info
$i = 0; $wqplugins = $wqpluginslugs = array();
if (is_array($plugininfo)) {
foreach ($plugininfo as $plugin) {
// print_r($plugin); // debug point
if (isset($plugin['slug'])) {
$wqpluginslugs[$i] = $pluginslug = $plugin['slug']; $i++;
if (isset($plugin['title'])) {$wqplugins[$pluginslug]['title'] = $plugin['title'];}
if (isset($plugin['home'])) {$wqplugins[$pluginslug]['home'] = $plugin['home'];}
if (isset($plugin['description'])) {$wqplugins[$pluginslug]['description'] = $plugin['description'];}
if (isset($plugin['icon'])) {$wqplugins[$pluginslug]['icon'] = $plugin['icon'];}
if (isset($plugin['paidplans'])) {$wqplugins[$pluginslug]['paidplans'] = $plugin['paidplans'];}
if (isset($plugin['package'])) {$wqplugins[$pluginslug]['package'] = $plugin['package'];}
if (isset($plugin['tags'])) {$wqplugins[$pluginslug]['tags'] = $plugin['tags'];}
if (isset($plugin['cats'])) {$wqplugins[$pluginslug]['cats'] = $plugin['cats'];}
// 1.6.5: check release date and status
if (isset($plugin['releasedate'])) {$wqplugins[$pluginslug]['releasedate'] = $plugin['releasedate'];}
if (isset($plugin['releasestatus'])) {$wqplugins[$pluginslug]['releasestatus'] = $plugin['releasestatus'];}
else {$wqplugins[$pluginslug]['releasestatus'] = 'Upcoming';}
// 1.6.6: check for wordpress.org slug
if (isset($plugin['wporgslug'])) {$wqplugins[$pluginslug]['wporgslug'] = $plugin['wporgslug'];}
else {$wpplugins[$pluginslug]['wporgslug'] = false;}
if (in_array($pluginslug, $installedslugs)) {$wqplugins[$pluginslug]['installed'] = 'yes';}
else {$wqplugins[$pluginslug]['installed'] = 'no';}
// --- get latest plugin release ---
if (isset($plugin['latestrelease']) && ($plugin['latestrelease'] == 'yes')) {
$wqplugins[$pluginslug]['latestrelease'] = 'yes';
$latestrelease = $wqplugins[$pluginslug];
$latestrelease['slug'] = $pluginslug;
}
// --- get next plugin release ---
// 1.6.5: check for next plugin release also
if (isset($plugin['nextrelease']) && ($plugin['nextrelease'] == 'yes')) {
$wqplugins[$pluginslug]['nextrelease'] = 'yes';
$nextrelease = $wqplugins[$pluginslug];
$nextrelease['slug'] = $pluginslug;
}
}
}
}
// if ($wqdebug) {echo "";}
if ($wqdebug) {echo "";}
// --- maybe set Plugin Release Info ---
global $wqreleases;
if (isset($latestrelease)) {$wqreleases['latest'] = $latestrelease;}
if (isset($nextrelease)) {$wqreleases['next'] = $nextrelease;}
// --- get Installed Wordquest Plugin Data ---
$plugins = array(); $inactiveplugins = array();
$i = $j = 0;
foreach ($installedplugins as $pluginfile => $values) {
$pluginslug = sanitize_title($values['Name']);
$pluginfiles[$pluginslug] = $pluginfile;
// echo '***'.$pluginslug.'***'; // debug point
if (in_array($pluginslug, $wqpluginslugs) || in_array($pluginslug, $pluginslugs)) {
// --- set plugin data ---
$plugins[$i]['slug'] = $pluginslug;
$plugins[$i]['name'] = $values['Name'];
$plugins[$i]['filename'] = $pluginfile;
$plugins[$i]['version'] = $values['Version'];
$plugins[$i]['description'] = $values['Description'];
// --- check for matching plugin update ---
if (in_array($pluginslug, $pluginupdates)) {$plugins[$i]['update'] = 'yes';}
else {$plugins[$i]['update'] = 'no';}
// --- filter out to get inactive plugins ---
if (!in_array($pluginslug, $pluginslugs)) {
$inactiveplugins[$j] = $pluginslug; $j++;
$inactiveversions[$pluginslug] = $values['Version'];
}
$i++;
}
}
// if ($wqdebug) {echo "";}
// if ($wqdebug) {echo "";}
// --- check if BioShip Theme installed ---
$themes = wp_get_themes(); $bioshipinstalled = false;
foreach ($themes as $theme) {if ($theme->stylesheet == 'bioship') {$bioshipinstalled = true;} }
// --- open plugin column ---
echo '';
// Active Plugin Panel
// -------------------
$boxid = 'wordquestactive'; $boxtitle = wqhelper_translate('Active WordQuest Plugins');
echo '
';
echo '
'.$boxtitle.' ';
echo '
';
// Inactive Plugin Panel
// ---------------------
if (count($inactiveplugins) > 0) {
$boxid = 'wordquestinactive'; $boxtitle = wqhelper_translate('Inactive WordQuest Plugins');
echo '
';
echo '
'.$boxtitle.' ';
echo '
';
}
$releasedplugins = $unreleasedplugins = array();
if ( count($wqplugins) > count($wordquestplugins) ) {
foreach ($wqplugins as $pluginslug => $wqplugin) {
if (!in_array($pluginslug, $installedslugs) && !in_array($pluginslug, $inactiveplugins)) {
if ($wqplugin['releasestatus'] == 'Released') {$releasedplugins[$pluginslug] = $wqplugin;}
else {
$releasetime = strtotime($wqplugin['releasedate']);
$wqplugin['slug'] = $pluginslug;
$unreleasedplugins[$releasetime] = $wqplugin;
}
}
}
}
// Available Plugin Panel
// ----------------------
if (count($releasedplugins) > 0) {
if ($wqdebug) {echo "";}
$boxid = 'wordquestavailable'; $boxtitle = wqhelper_translate('Available WordQuest Plugins');
echo '
';
echo '
'.$boxtitle.' ';
echo '
";
}
// Upcoming Plugin Panel
// ---------------------
if (count($unreleasedplugins) > 0) {
ksort($unreleasedplugins);
if ($wqdebug) {echo "";}
$boxid = 'wordquestupcoming'; $boxtitle = wqhelper_translate('Upcoming WordQuest Plugins');
echo '
';
echo '
'.$boxtitle.' ';
echo '
';
foreach ($unreleasedplugins as $releasetime => $wqplugin) {
// $pluginslug = $wqplugin['slug'];
echo "";
echo $wqplugin['title']." ";
echo "";
echo wqhelper_translate('Expected').': '.date('jS F Y', $releasetime);
echo " ";
}
echo "
";
}
// BioShip Theme Panel
// -------------------
$boxid = 'bioship'; $boxtitle = wqhelper_translate('BioShip Theme Framework');
echo '
';
echo '
'.$boxtitle.' ';
echo '
';
if ($bioshipinstalled) {
// --- check if BioShip Theme is active ---
$theme = wp_get_theme();
if ($theme->stylesheet == 'bioship') {
echo wqhelper_translate('Sweet! You are using').' ';
echo wqhelper_translate('BioShip Theme Framework').' . ';
echo wqhelper_translate('Great choice!').' ';
// 1.6.7: added BioShip Theme Options link here
if (THEMETITAN) {$optionsurl = admin_url('admin.php').'?page=bioship-options';}
elseif (THEMEOPT) {$optionsurl = admin_url('admin.php').'?page=options-framework';}
else {$optionsurl = admin_url('customize.php');}
echo ''.wqhelper_translate('Theme Options').' ';
} elseif (is_child_theme() && ($theme->template == 'bioship')) {
echo wqhelper_translate('Groovy. You are using').' ';
echo wqhelper_translate('BioShip Framework').' ! ';
echo wqhelper_translate('Your Child Theme is').' '.$theme->Name.' ';
// 1.6.7: add Child Theme Options link here
if (THEMETITAN) {$optionsurl = admin_url('admin.php').'?page=bioship-options';}
elseif (THEMEOPT) {$optionsurl = admin_url('admin.php').'?page=options-framework';}
else {$optionsurl = admin_url('customize.php');}
echo ''.wqhelper_translate('Theme Options').' ';
} else {
echo wqhelper_translate('Looks like you have BioShip installed!').' ';
echo '...'.wqhelper_translate('but it is not yet your active theme.').' ';
// --- BioShip Theme activation link ---
$activatelink = admin_url('themes.php').'?action=activate&stylesheet=bioship';
$activatelink = wp_nonce_url($activatelink, 'switch-theme_bioship');
echo ''.wqhelper_translate('Click here to activate it now').' . ';
// Check for Theme Test Drive
echo "";
if (function_exists('themedrive_determine_theme')) {
// TODO: a better check here? this actually makes no sense
if (class_exists('TitanFramework')) {
$testdrivelink = admin_url('admin.php').'?page=bioship-options&theme=bioship';
} elseif (function_exists('OptionsFramework_Init')) {
$testdrivelink = admin_url('themes.php').'?page=options-framework&theme=bioship';
} else {$testdrivelink = admin_url('customize.php').'?theme=bioship';}
echo wqhelper_translate('or').',
';
echo wqhelper_translate('take it for a Theme Test Drive').' .';
} elseif (in_array('theme-test-drive', $installedplugins)) {
// --- Theme Test Drive plugin activation link ---
$activatelink = admin_url('plugins.php').'?action=activate&plugin='.urlencode('theme-test-drive/themedrive.php');
$activatelink = wp_nonce_url($activatelink,'activate-plugin_theme-test-drive/themedrive.php');
echo wqhelper_translate('or').',
';
echo wqhelper_translate('activate Theme Test Drive plugin').' ';
echo wqhelper_translate('to test BioShip without affecting your current site.');
} else {
// --- Theme Test Drive plugin installation link ---
$installlink = admin_url('update.php').'?action=install-plugin&plugin=theme-test-drive';
$installlink = wp_nonce_url($installlink, 'install-plugin');
echo wqhelper_translate('or').',
';
echo wqhelper_translate('install Theme Test Drive plugin').' ';
echo wqhelper_translate('to test BioShip without affecting your current site.');
}
echo "
";
}
} else {
echo wqhelper_translate('Also from').' WordQuest Alliance , '.wqhelper_translate('check out the').' ';
echo "BioShip Theme Framework ";
echo wqhelper_translate('A highly flexible and responsive starter theme').' '.wqhelper_translate('for users, designers and developers.');
}
if ( ($theme->template == 'bioship') || ($theme->stylesheet == 'bioship') ) {
// 1.7.3: addded missing function prefix
if (function_exists('bioship_admin_theme_updates_available')) {
$themeupdates = bioship_admin_theme_updates_available();
if ($themeupdates != '') {
echo ''.$themeupdates.'
';
}
}
// TODO: future link for rating BioShip on wordpress.org theme repository ?
// $ratelink = 'https://wordpress.org/support/theme/bioship/reviews/#new-post';
// echo ''.wqhelper_translate('Rate BioShip on WordPress.Org').' ';
}
// BioShip Feed
// ------------
// (only displays if Bioship theme is active)
// 1.7.3: added missing bioship function prefix
if (function_exists('bioship_muscle_bioship_dashboard_feed_widget')) {
// $boxid = 'bioshipfeed'; $boxtitle = wphelper_translate('BioShip News');
// echo '';
// echo '
'.$boxtitle.' ';
// echo '
';
bioship_muscle_bioship_dashboard_feed_widget(false);
// echo '
';
}
echo '
';
echo '
';
// end column
echo '
';
};
}
// ----------------------------
// Version Specific Feed Column
// ----------------------------
$funcname = 'wqhelper_admin_feeds_column_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function($args) {
// --- open feeds column ---
echo '';
// Latest / Next Release
// ---------------------
global $wqreleases; $latestrelease = $nextrelease = '';
if (isset($wqreleases['latest'])) {$latestrelease = $wqreleases['latest'];}
if (isset($wqreleases['next'])) {$nextrelease = $wqreleases['next'];}
if (isset($latestrelease) && is_array($latestrelease)) {
if ($latestrelease['installed'] == 'no') {
$release = $latestrelease; $boxid = 'wordquestlatest'; $boxtitle = wqhelper_translate('Latest Release');
} else {$release = $nextrelease; $boxid = 'wordquestupcoming'; $boxtitle = wqhelper_translate('Upcoming Release');}
} elseif (isset($nextrelease) && is_array($nextrelease)) {
$release = $nextrelease; $boxid = 'wordquestupcoming'; $boxtitle = wqhelper_translate('Upcoming Release');
}
if (isset($release) && is_array($release)) {
echo '
';
echo '
'.$boxtitle.' ';
echo '
';
echo " ";
echo "".$release['title']." ";
echo "".$release['description']." ";
if (isset($release['package']) && is_array($release['package'])) {
// 1.6.6: check for wordpress.org only installs
global $wordpressorgonly; $installlink = false;
if ($wordpressorgonly && $release['wporgslug']) {
$installlink = self_admin_url('update.php')."?action=install-plugin&plugin=".$release['wporgslug'];
$installlink = wp_nonce_url($installlink, 'install-plugin_'.$release['wporgslug']);
} else {
$installlink = admin_url('update.php')."?action=wordquest_plugin_install&plugin=".$release['slug'];
$installlink = wp_nonce_url($installlink, 'plugin-upload');
}
if ($installlink) {
echo " ";
echo "".wqhelper_translate('Install Now')." ";
} else {
$pluginlink = $wqurls['wq'].'/plugins/'.$release['slug'];
echo "→ ".wqhelper_translate('Plugin Home')." ";
}
} else {echo "".wqhelper_translate('Expected').": ".date('jS F Y',strtotime($release['releasedate']));}
echo "
";
echo '
';
}
// WordQuest Feed
// --------------
$boxid = 'wordquestfeed'; $boxtitle = wqhelper_translate('WordQuest News');
if (function_exists('wqhelper_dashboard_feed_widget')) {
echo '
';
echo '
'.$boxtitle.' ';
echo '
';
wqhelper_dashboard_feed_widget();
echo '
';
}
// Editors Picks
// -------------
$boxid = 'recommendations'; $boxtitle = wqhelper_translate('Editor Picks');
// TODO: Recommended Plugins via Plugin Review?
// echo '
';
// echo '
'.$boxtitle.' ';
// echo '
';
// echo "Recommended Plugins...";
// print_r($recommended);
// echo '
';
// PluginReview Feed
// -----------------
$boxid = 'pluginreviewfeed'; $boxtitle = wqhelper_translate('Plugin Reviews');
if (function_exists('wqhelper_pluginreview_feed_widget')) {
echo '
';
echo '
'.$boxtitle.' ';
echo '
';
wqhelper_pluginreview_feed_widget();
echo '
';
}
// --- close column ---
echo "
";
// --- enqueue feed javascript ---
if (!has_action('admin_footer', 'wqhelper_dashboard_feed_javascript')) {
add_action('admin_footer', 'wqhelper_dashboard_feed_javascript');
}
};
}
// -----------------------------
// Version Specific Admin Styles
// -----------------------------
$funcname = 'wqhelper_admin_styles_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function() {
// --- hide Wordquest plugin freemius submenu items if top level admin menu not open ---
echo "";
};
}
// -----------------------------
// Version Specific Admin Script
// -----------------------------
$funcname = 'wqhelper_admin_scripts_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function() {
// --- wordquest admin submenu icon and styling fixes ---
echo "";
};
}
// --------------------------
// Install a WordQuest Plugin
// --------------------------
// 1.6.5: hook to update.php update-custom_{ACTION} where ACTION = 'wordquest_plugin_install'
add_action('update-custom_wordquest_plugin_install', 'wqhelper_install_plugin');
$funcname = 'wqhelper_install_plugin_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function() {
global $wqurls;
// --- check permissions and nonce ---
if (!current_user_can('upload_plugins')) {
wp_die( wqhelper_translate('Sorry, you are not allowed to install plugins on this site.') );
}
check_admin_referer('plugin-upload');
// --- get the package info from download server ---
if (!isset($_REQUEST['plugin'])) {wp_die( wqhelper_translate('Error: No Plugin specified.') );}
$pluginslug = $_REQUEST['plugin'];
// 1.5.9: sanitize plugin slug
$pluginslug = sanitize_title($pluginslug);
if ($pluginslug == '') {wp_dir( wqhelper_translate('Error: Invalid Plugin slug specified.') );}
// --- get the plugin package data ---
$url = $wqurls['wq'].'/downloads/?action=get_metadata&slug='.$pluginslug;
$response = wp_remote_get($url, array('timeout' => 30));
if (!is_wp_error($response)) {
if ($response['response']['code'] == '404') {
// --- on failure try to get package info from stored transient data ---
$plugininfo = get_transient('wordquest_plugin_info');
if (is_array($pluginfo)) {
foreach ($plugininfo as $plugin) {
if ($plugin['slug'] == $pluginslug) {$pluginpackage = $plugin['package'];}
}
}
} else {$pluginpackage = json_decode($response['body'], true);}
}
if (!isset($pluginpackage)) {
if (is_ssl()) {$tryagainurl = 'https://';} else {$tryagainurl = 'http://';}
$tryagainurl .= $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
$message = wqhelper_translate('Failed to retrieve download package information.');
$message .= ' '.wqhelper_translate('Click here to try again.').' ';
wp_die($message);
}
// 1.6.5: pass the package download URL to Wordpress to do the rest
// --- set the Plugin_Installer_Skin arguments ---
$url = $pluginpackage['download_url'];
$title = sprintf( wqhelper_translate('Installing Plugin from URL: %s'), esc_html($url) );
$nonce = 'plugin-upload';
$type = 'web';
$args = compact('type', 'title', 'nonce', 'url');
// --- custom Plugin_Upgrader (via /wp-admin/upgrade.php) ---
$title = wqhelper_translage('Upload Plugin');
$parent_file = 'plugins.php'; $submenu_file = 'plugin-install.php';
require_once(ABSPATH . 'wp-admin/admin-header.php');
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( $args ) );
$result = $upgrader->install($url);
include(ABSPATH . 'wp-admin/admin-footer.php');
};
}
// ------------------------
// === Sidebar FloatBox ===
// ------------------------
// ----------------------
// Main Floatbox Function
// ----------------------
$funcname = 'wqhelper_sidebar_floatbox_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function($args) {
global $wqdebug, $wqurls;
if ($wqdebug) {echo "";}
if (count($args) == 7) {
// --- the old way, sending all args individually ---
$prefix = $args[0]; $pluginslug = $args[1]; $freepremium = $args[2];
$wporgslug = $args[3]; $savebutton = $args[4];
$plugintitle = $args[5]; $pluginversion = $args[6];
} else {
// --- the new way, just sending two args ---
$pluginslug = $slug = $args[0];
$savebutton = $args[1];
// --- get the other args using the slug and global array ---
global $wordquestplugins;
$pluginversion = $wordquestplugins[$slug]['version'];
$plugintitle = $wordquestplugins[$slug]['title'];
$prefix = $wordquestplugins[$slug]['settings'];
$freepremium = $wordquestplugins[$slug]['plan'];
$wporg = $wordquestplugins[$slug]['wporg'];
if (isset($wordquestplugins[$slug]['wporgslug'])) {
$wporgslug = $wordquestplugins[$slug]['wporgslug'];
} else {$wporgslug = '';}
if ($wqdebug) {echo "";}
}
// 1.5.0: get/convert to single array of plugin sidebar options
// 1.6.0: fix to sidebar options variable
$sidebaroptions = get_option($prefix.'_sidebar_options');
if ( ($sidebaroptions == '') || !is_array($sidebaroptions) ) {
$sidebaroptions['installdate'] = date('Y-m-d');
$sidebaroptions['adsboxoff'] = get_option($prefix.'_ads_box_off');
$sidebaroptions['donationboxoff'] = get_option($prefix.'_donation_box_off');
$sidebaroptions['reportboxoff'] = get_option($prefix.'_report_box_off');
delete_option($prefix.'_ads_box_off'); delete_option($prefix.'_donation_box_off'); delete_option($prefix.'_report_box_off');
add_option($prefix.'_sidebar_options', $sidebaroptions);
}
// 1.6.9: fix to possible undefined keys
if (!isset($sidebaroptions['installdate'])) {$sidebaroptions['installdate'] = date('Y-m-d');}
if (!isset($sidebaroptions['adsboxoff'])) {$sidebaroptions['adsboxoff'] = '';}
if (!isset($sidebaroptions['donationboxoff'])) {$sidebaroptions['donationboxoff'] = '';}
if (!isset($sidebaroptions['reportboxoff'])) {$sidebaroptions['reportboxoff'] = '';}
// --- sidebar scripts ---
echo "";
// --- Sidebar Floatbox Styles ---
echo '';
// --- open sidebar div --
echo '';
if ($wqdebug) {echo '';}
// --- call (optional) Plugin Sidebar Header ---
$funcname = $prefix.'_sidebar_plugin_header';
if (function_exists($funcname)) {call_user_func($funcname);}
// Save Settings Button
// --------------------
if ($savebutton != 'replace') {
echo '
';
echo '
'.wqhelper_translate('Update Settings').' ';
if ($savebutton == 'yes') {
$buttonoutput = "";
$buttonoutput .= "";
$buttonoutput .= " ";
$buttonoutput .= " ";
$buttonoutput .= " ";
$buttonoutput .= "
";
$buttonoutput = apply_filters('wordquest_sidebar_save_button', $buttonoutput);
echo $buttonoutput;
} elseif ($savebutton == 'no') {echo "";}
else {echo "";}
// --- sidebar settings box ---
echo " ";
echo '
';
}
// Donation Box
// ------------
// for Free Version? Or Upgrade Link?
$args = array($prefix, $pluginslug);
if ($sidebaroptions['donationboxoff'] == 'checked') {$hide = " style='display:none;'>";} else {echo $hide = '';}
echo '
';
if ($freepremium == 'free') {
echo '
';
echo '
'.wqhelper_translate('Gifts of Appreciation').' ';
} elseif ($freepremium == 'premium') {
// 1.7.3: remove other testimonial box also
// echo '
';
// echo '
'.wqhelper_translate('Testimonials').' ';
// wqhelper_sidebar_testimonial_box($args);
// echo '
';
}
echo '
';
// Bonus Subscription Form
// -----------------------
// 1.7.2: allow for bonus offer box override
$funcname = $prefix.'_sidebar_bonus_offer';
if (function_exists($funcname)) {call_user_func($funcname);}
else {
// --- populated form for current user ---
global $current_user; $current_user = wp_get_current_user();
$useremail = $current_user->user_email;
if (strstr($useremail, '@localhost')) {$useremail = '';}
$userid = $current_user->ID; $userdata = get_userdata($userid);
$username = $userdata->first_name; $lastname = $userdata->last_name;
if ($lastname != '') {$username .= ' '.$lastname;}
// --- set report image URL ---
if ($pluginslug == 'bioship') {$reportimage = get_template_directory_uri()."/images/rv-report.jpg";}
else {$reportimage = plugins_url('images/rv-report.jpg', __FILE__);}
echo '
";} else {echo ">";}
echo '
';
echo '
'.wqhelper_translate('Bonus Offer').' ';
}
// PluginReview.Net Plugin Recommendations
// ---------------------------------------
if ($sidebaroptions['adsboxoff'] != 'checked') {
// 1.7.2: allow for recommendation box override
$funcname = $prefix.'_sidebar_plugin_recommendation';
if (function_exists($funcname)) {call_user_func($funcname);}
else {
echo '
';
echo '
';
echo '
'.wqhelper_translate('Recommended').' ';
echo "";
echo '
';
}
}
// Call Plugin Footer Function
// ---------------------------
$funcname = $prefix.'_sidebar_plugin_footer';
if (function_exists($funcname)) {call_user_func($funcname);}
else {
// Default Sidebar Plugin Footer
// -----------------------------
// --- set values for theme or plugin ---
if ($pluginslug == 'bioship') {
$iconurl = get_template_directory_uri().'/images/wordquest.png';
$pluginurl = $wqurls['bio'];
$pluginfootertitle = wqhelper_translate('Theme Info');
} else {
$iconurl = plugins_url("images/wordquest.png", __FILE__);
$pluginurl = $wqurls['wq']."/plugins/".$pluginslug."/";
$pluginfootertitle = wqhelper_translate('Plugin Info');
}
echo '';
}
// --- close sidebar float div ---
echo '
';
};
}
// ----------------
// Paypal Donations
// ----------------
$funcname = 'wqhelper_sidebar_paypal_donations_'.$wqhv;
if (!isset($wqfunctions[$funcname]) || !is_callable($wqfunctions[$funcname])) {
$wqfunctions[$funcname] = function($args) {
global $wqurls;
$prefix = $args[0]; $pluginslug = $args[1];
// --- maybe call special top ---
if (function_exists($prefix.'_donations_special_top')) {
$funcname = $prefix.'_donations_special_top';
call_user_func($funcname);
}
// --- make display name from the plugin slug ---
if (strstr($pluginslug, '-')) {
$parts = explode('-', $pluginslug);
$i = 0;
foreach ($parts as $part) {
if ($part == 'wp') {$parts[$i] = 'WP';}
else {$parts[$i] = strtoupper(substr($part, 0, 1)).substr($part, 1, (strlen($part)-1));}
$i++;
}
$pluginname = implode(' ', $parts);
} else {
$pluginname = strtoupper(substr($pluginslug, 0, 1)).substr($pluginslug, 1, (strlen($pluginslug)-1));
}
// --- donations scripts ---
echo "";
// --- set Paypal notification URL ---
$notifyurl = $wqurls['wq'].'/?estore_pp_ipn=process';
$sandbox = ''; // $sandbox = 'sandbox.';
// --- recurring / one-time switcher ---
echo " ";
// --- set weekly amount options ---
// 1.5.0: added weekly amounts
echo '
'.wqhelper_translate('Copper').': $1
'.wqhelper_translate('Bronze').': $2
'.wqhelper_translate('Silver').': $4
'.wqhelper_translate('Gold').': $5
'.wqhelper_translate('Platinum').': $7.50
'.wqhelper_translate('Titanium').': $10
'.wqhelper_translate('Star Ruby').': $12.50
'.wqhelper_translate('Star Topaz').': $15
'.wqhelper_translate('Star Emerald').': $17.50
'.wqhelper_translate('Star Sapphire').': $20
'.wqhelper_translate('Star Diamond').': $25
';
// --- set monthly amount options ---
// 1.5.0: added monthly amounts
echo '
'.wqhelper_translate('Copper').': $5
'.wqhelper_translate('Bronze').': $10
'.wqhelper_translate('Silver').': $15
'.wqhelper_translate('Gold').': $20
'.wqhelper_translate('Platinum').': $30
'.wqhelper_translate('Titanium').': $40
'.wqhelper_translate('Star Ruby').': $50
'.wqhelper_translate('Star Topaz').': $60
'.wqhelper_translate('Star Emerald').': $70
'.wqhelper_translate('Star Sapphire').': $80
'.wqhelper_translate('Star Diamond').': $100
';
// note: eStore recurring subscription form
// $wqurls['wq'].'/?wp_eStore_subscribe=LEVEL&c_input='.$pluginslug;
// --- set donate image URL ---
if ($pluginslug == 'bioship') {$donateimage = get_template_directory_uri()."/images/pp-donate.jpg";}
else {$donateimage = plugins_url("/images/pp-donate.jpg", __FILE__);}
// --- recurring donation form ---
echo '