= 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: 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; // 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;} } // 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'); } // 1.6.0: new globals used for new method global $wordquesthelper, $wordquesthelpers; $wordquesthelper = max($wordquesthelpers); if ($wqdebug) {echo "";} // 1.6.0: set the function caller helper global $wqcaller, $wqfunctions; $vfunctionname = 'wqhelper_caller_'; $vfunc = $vfunctionname.$wordquesthelper; if (is_callable($wqfunctions[$vfunc])) { $wqfunctions[$vfunc]($vfunctionname); // $wqcaller = $wqfunctions[$vfunctionname]; } elseif (function_exists($vfunc)) {call_user_func($vfunc, $vfunctionname);} if ($wqdebug) {echo "";} // 1.5.0: set up any admin notices via helper version // 1.6.0: ...use caller function directly for this $vadminnotices = 'wqhelper_admin_notices'; if (is_callable($wqcaller)) {$wqcaller($vadminnotices);} elseif (function_exists($vadminnotices)) {call_user_func($vadminnotices);} } } // ---------------------------------- // Function to Define Function Caller // ---------------------------------- // 1.6.0: some lovely double abstraction here! $vfuncname = 'wqhelper_caller_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function($vfunc) { global $wqfunctions, $wqcaller; if (!is_callable($wqcaller)) { $wqcaller = function($vfunction, $vargs = null) { global $wordquesthelper, $wqfunctions; $vfunc = $vfunction.'_'.$wordquesthelper; if (is_callable($wqfunctions[$vfunc])) {return $wqfunctions[$vfunc]($vargs);} elseif (function_exists($vfunc)) {return call_user_func($vfunc, $vargs);} }; } }; } // ------------------------------------- // 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($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- admin notice boxer --- if (!function_exists('wqhelper_admin_notice_boxer')) { function wqhelper_admin_notice_boxer($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- get plugins info --- if (!function_exists('wqhelper_get_plugin_info')) { function wqhelper_get_plugin_info($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- admin page plugins column --- if (!function_exists('wqhelper_admin_plugins_column')) { function wqhelper_admin_plugins_column($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- admin page feeds column --- if (!function_exists('wqhelper_admin_feeds_column')) { function wqhelper_admin_feeds_column($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // 1.6.5: install WordQuest plugin if (!function_exists('wqhelper_install_plugin')) { function wqhelper_install_plugin($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // 1.6.5: reminder notice message if (!function_exists('wqhelper_reminder_notice')) { function wqhelper_reminder_notice($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // 1.6.9: translation wrapper if (!function_exists('wqhelper_translate')) { function wqhelper_translate($vstring) {return $GLOBALS['wqcaller'](__FUNCTION__, $vstring);} } // --------------------------------- // 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($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- donations box --- if (!function_exists('wqhelper_sidebar_paypal_donations')) { function wqhelper_sidebar_paypal_donations($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- testimonials box --- if (!function_exists('wqhelper_sidebar_testimonial_box')) { function wqhelper_sidebar_testimonial_box($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- floating menu script --- if (!function_exists('wqhelper_sidebar_floatmenuscript')) { function wqhelper_sidebar_floatmenuscript($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- sticky kit script --- if (!function_exists('wqhelper_sidebar_stickykitscript')) { function wqhelper_sidebar_stickykitscript($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // Dashboard Feed Caller Functions // ------------------------------- // 1.7.2: use direct superglobal to shorten functions // wqhelper_add_dashboard_feed_widget // wqhelper_dashboard_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($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- dashboard feed javascript --- if (!function_exists('wqhelper_dashboard_feed_javascript')) { function wqhelper_dashboard_feed_javascript($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- dashboard feed widget --- if (!function_exists('wqhelper_dashboard_feed_widget')) { function wqhelper_dashboard_feed_widget($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- plugin review feed widget --- if (!function_exists('wqhelper_pluginreview_feed_widget')) { function wqhelper_pluginreview_feed_widget($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- process RSS feed --- if (!function_exists('wqhelper_process_rss_feed')) { function wqhelper_process_rss_feed($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // --- load category feed --- if (!function_exists('wqhelper_load_category_feed')) { function wqhelper_load_category_feed($vargs = null) { if (!is_admin()) {return;} else {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } } // ========================== // --- 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($vargs = null) { remove_action('admin_footer', 'wordquest_admin_styles'); return $GLOBALS['wqcaller'](__FUNCTION__, $vargs); } } // ---------------------------------- // 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($vargs = null) { remove_action('admin_footer', 'wordquest_admin_scripts'); return $GLOBALS['wqcaller'](__FUNCTION__,$vargs); } } // ====================== // --- 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($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__, $vargs);} } // ----------------------- // 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($vargs = null) {return $GLOBALS['wqcaller'](__FUNCTION__,$vargs);} } // ---------------------- // 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() { if (!isset($_POST['wqhv'])) {return;} else {$wqhv = $_POST['wqhv'];} // 1.6.6: sanitize version value if ( (!is_numeric($wqhv)) || (strlen($wqhv) !== 3) ) {return;} $vfunc = 'wqhelper_update_sidebar_options_'.$wqhv; // 1.6.5: fix to function call method global $wqfunctions; if (is_callable($wqfunctions[$vfunc])) {$wqfunctions[$vfunc]();} elseif (function_exists($vfunc)) {call_user_func($vfunc);} } } // ================================== // --- 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 $vfuncname = 'wqhelper_translate_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function($vstring) { global $wqlabels; if (isset($wqlabels[$vstring])) {return $wqlabels[$vstring];} // 1.6.9: fallback translation for bioship theme if (function_exists('bioship_translate')) {return bioship_translate($vstring);} if (function_exists('translate')) {return translate($vstring, 'default');} return $vstring; }; } // ------------------ // Admin Notice Boxer // ------------------ // (for settings pages) $vfuncname = 'wqhelper_admin_notice_boxer_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { // count admin notices // global $wp_filter; $vnotices = 0; // print_r($wp_filter); // if (isset($wp_filter['admin_notices'])) {$vadminnotices = $vnotices = count($wp_filter['admin_notices']);} // if (is_network_admin()) {if (isset($wp_filter['network_admin_notices'])) {$vnetworknotices = count($wp_filter['network_admin_notices']); $vnotices = $vnotices + $vnetworknotices;} } // if (is_user_admin()) {if (isset($wp_filter['user_admin_notices'])) {$vusernotices = count($wp_filter['user_admin_notices']); $vnotices = $vnotices + $vusernotices;} } // if (isset($wp_filter['all_admin_notices'])) {$valladminnotices = count($wp_filter['all_admin_notices']); $vnotices = $vnotices + $valladminnotices;} // if ($vnotices == 0) {return;} // print_r($wp_filter['admin_notices']); print_r($wp_filter['all_admin_notices']); // echo ""; echo ""; $vadminnotices = ''; // $vadminnotices = '('.$vnotices.')'; echo '
'; echo '

'; echo '   '; echo wqhelper_translate('Admin Notices'); echo $vadminnotices.'

'; echo '
'; // echo '
'; // echo '

▼ '; // echo wqhelper_translate('Admin Notices'); // echo ' ('.$vadminnotices.')

'; // echo '
'; }; } // --------------------------- // Usage Reminder Notice Check // --------------------------- // 1.5.0: added reminder prototype that does nothing yet // 1.6.5: completed usage reminder notices $vfuncname = 'wqhelper_admin_notices_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { global $wordquestplugins; foreach ($wordquestplugins as $vpluginslug => $wqplugin) { // 1.6.8: move here to fix undefined index warning $vpre = $wqplugin['settings']; // 1.7.0: moved up here to fix install version check $vsidebaroptions = get_option($vpre.'_sidebar_options'); // 1.6.7: maybe set first install version for plugin if (!isset($vsidebaroptions['installversion'])) { $vsidebaroptions['installversion'] = $wqplugin['version']; update_option($vpre.'_sidebar_options', $vsidebaroptions); } // 1.6.5: no reminders needed if pro version if (isset($wqplugin['plan']) && ($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($vsidebaroptions['donationboxoff'])) // && ($vsidebaroptions['donationboxoff'] == 'checked') ) {return;} if (isset($vsidebaroptions['installdate'])) { $vreminder = false; $vinstalltime = @strtotime($vsidebaroptions['installdate']); $vtimesince = time() - $vinstalltime; $vdayssince = floor($vtimesince / (24*60*60)); // 30 days, 90 days and 1 years notices if ($vdayssince > 365) { if (!isset($vsidebaroptions['365days'])) {$vreminder = '365';} } elseif ($vdayssince > 90) { // 90 day notice if (!isset($vsidebaroptions['90days'])) {$vreminder = '90';} } elseif ($vdayssince > 30) { // 30 day notice if (!isset($vsidebaroptions['30days'])) {$vreminder = '30';} } if ($vreminder) { // add an admin reminder notice global $wqreminder; $wqreminder[$vpluginslug] = $wqplugin; $wqreminder[$vpluginslug]['days'] = $vdayssince; $wqreminder[$vpluginslug]['notice'] = $vreminder; add_action('admin_notices', 'wqhelper_reminder_notice'); } } else { $vsidebaroptions['installdate'] = date('Y-m-d'); update_option($vpre.'_sidebar_options', $vsidebaroptions); } } }; } // Usage Reminder Notice // --------------------- // 1.6.5: added reminder notice text $vfuncname = 'wqhelper_reminder_notice_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { global $wqreminder, $wqurls; foreach ($wqreminder as $vpluginslug => $vreminder) { echo "
"; echo wqhelper_translate("You've been enjoying")." "; echo $wqreminder[$vpluginslug]['title']." ".wqhelper_translate("for")." "; echo $wqreminder[$vpluginslug]['days']." ".wqhelper_translate("days").". "; echo wqhelper_translate("If you like it, here's some ways you can help make it better").":
"; // Links: Supporter / Donate / Rate / Testimonial / Feedback / Development / Go Pro // 1.6.7: extended link anchor text for clarity echo "
"; echo ""; // --- dismiss notice link --- $vdismisslink = admin_url('admin-ajax.php').'?action=wqhelper_reminder_dismiss&slug='.$vpluginslug.'¬ice='.$wqreminder[$vpluginslug]['notice']; echo ""; echo "
"; echo "
"; } echo ""; }; } // ----------------------- // AJAX Reminder Dismisser // ----------------------- $vfuncname = 'wqhelper_reminder_dismiss_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { if (!current_user_can('manage_options')) {return;} $vpluginslug = $_REQUEST['slug']; $vnotice = $_REQUEST['notice']; if ( ($vnotice != '30') && ($vnotice != '90') && ($vnotice != '365') ) {return;} global $wordquestplugins; $vpre = $wordquestplugins[$vpluginslug]['settings']; $vsidebaroptions = get_option($vpre.'_sidebar_options'); if ( (isset($vsidebaroptions[$vnotice.'days'])) && ($vsidebaroptions[$vnotice.'days'] == 'dismissed') ) {$vsidebaroptions[$vnotice.'days'] = '';} else {$vsidebaroptions[$vnotice.'days'] = 'dismissed';} update_option($vpre.'_sidebar_options', $vsidebaroptions); echo ""; exit; }; } // -------------------------- // Get WordQuest Plugins Info // -------------------------- $vfuncname = 'wqhelper_get_plugin_info_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { global $wqurls, $wqdebug; // 1.5.0: get plugin info (maximum twice daily) $vplugininfo = get_transient('wordquest_plugin_info'); if ($wqdebug) {$vplugininfo = '';} // clear transient for debugging if ( (!$vplugininfo) || ($vplugininfo == '') || (!is_array($vplugininfo)) ) { $vpluginsurl = $wqurls['wq'].'/?get_plugins_info=yes'; $vargs = array('timeout' => 15); $vplugininfo = wp_remote_get($vpluginsurl, $vargs); if (!is_wp_error($vplugininfo)) { $vplugininfo = $vplugininfo['body']; $vdataend = "*****END DATA*****"; if (strstr($vplugininfo, $vdataend)) { $vpos = strpos($vplugininfo, $vdataend); $vplugininfo = substr($vplugininfo, 0, $vpos); $vplugininfo = json_decode($vplugininfo, true); set_transient('wordquest_plugin_info', $vplugininfo, (12*60*60)); } else {$vplugininfo = '';} } else {$vplugininfo = '';} } if ($wqdebug) {echo "";} return $vplugininfo; }; } // --------------------------- // Version Specific Admin Page // --------------------------- $vfuncname = 'wqhelper_admin_page_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { global $wordquesthelper, $wordquestplugins, $wqurls; echo '
'; // Call Admin Notice Boxer wqhelper_admin_notice_boxer(); echo ""; 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, ); $vargs = array('wordquest', 'special'); wqhelper_sidebar_floatbox($vargs); // 1.6.5: replace floatmenu with stickykit echo wqhelper_sidebar_stickykitscript(); echo ''; echo ''; unset($wordquestplugins['wordquest']); // echo wqhelper_sidebar_floatmenuscript(); // echo ' // Admin Page Title // ---------------- $vwordquesticon = plugins_url('images/wordquest.png', __FILE__); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '

'.wqhelper_translate('Join').'

/

'.wqhelper_translate('Login').'

'.wqhelper_translate('Solutions').'

'.wqhelper_translate('Contribute').'

'; // 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; $viconurl = plugins_url('images/wordquest.png', __FILE__); echo '

Source Info

'; echo "
"; echo ""; echo ""; echo ""; echo "
WordQuest Alliance
"; echo "→ WordQuest Plugins
"; echo "→ Plugin Directory
"; echo '
'; } echo '
'; // hidden iframe for plugin actions echo ''; echo ''; }; } // ------------------------------- // Version Specific Plugins Column // ------------------------------- $vfuncname = 'wqhelper_admin_plugins_column_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function($vargs) { 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 ""; echo ""; // Get Installed and Active Plugin Slugs // ------------------------------------- $vi = 0; foreach ($wordquestplugins as $vpluginslug => $vvalues) {$vpluginslugs[$vi] = $vpluginslug; $vi++;} // if ($wqdebug) {echo "";} // Get All Installed Plugins Info // ------------------------------ $vi = 0; $vinstalledplugins = get_plugins(); foreach ($vinstalledplugins as $vpluginfile => $vvalues) {$vinstalledslugs[$vi] = sanitize_title($vvalues['Name']); $vi++;} // if ($wqdebug) {echo "";} // if ($wqdebug) {echo "";} // Get Plugin Update Info // ---------------------- // 1.6.6: define empty pluginupdates array $vi = 0; $vupdateplugins = get_site_transient('update_plugins'); $vpluginupdates = array(); foreach ($vupdateplugins->response as $vpluginfile => $vvalues) {$vpluginupdates[$vi] = $vvalues->slug; $vi++;} // if ($wqdebug) {echo "";} // if ($wqdebug) {echo "";} // Get Available Plugins from WordQuest.org // ---------------------------------------- $vplugininfo = wqhelper_get_plugin_info(); // process plugin info $vi = 0; $vwqplugins = array(); $vwqpluginslugs = array(); if (is_array($vplugininfo)) { foreach ($vplugininfo as $vplugin) { // print_r($vplugin); // debug point if (isset($vplugin['slug'])) { $vwqpluginslugs[$vi] = $vpluginslug = $vplugin['slug']; $vi++; if (isset($vplugin['title'])) {$vwqplugins[$vpluginslug]['title'] = $vplugin['title'];} if (isset($vplugin['home'])) {$vwqplugins[$vpluginslug]['home'] = $vplugin['home'];} if (isset($vplugin['description'])) {$vwqplugins[$vpluginslug]['description'] = $vplugin['description'];} if (isset($vplugin['icon'])) {$vwqplugins[$vpluginslug]['icon'] = $vplugin['icon'];} if (isset($vplugin['paidplans'])) {$vwqplugins[$vpluginslug]['paidplans'] = $vplugin['paidplans'];} if (isset($vplugin['package'])) {$vwqplugins[$vpluginslug]['package'] = $vplugin['package'];} if (isset($vplugin['tags'])) {$vwqplugins[$vpluginslug]['tags'] = $vplugin['tags'];} if (isset($vplugin['cats'])) {$vwqplugins[$vpluginslug]['cats'] = $vplugin['cats'];} // 1.6.5: check release date and status if (isset($vplugin['releasedate'])) {$vwqplugins[$vpluginslug]['releasedate'] = $vplugin['releasedate'];} if (isset($vplugin['releasestatus'])) {$vwqplugins[$vpluginslug]['releasestatus'] = $vplugin['releasestatus'];} else {$vwqplugins[$vpluginslug]['releasestatus'] = 'Upcoming';} // 1.6.6: check for wordpress.org slug if (isset($vplugin['wporgslug'])) {$vwqplugins[$vpluginslug]['wporgslug'] = $vplugin['wporgslug'];} else {$vwpplugins[$vpluginslug]['wporgslug'] = false;} if (in_array($vpluginslug,$vinstalledslugs)) {$vwqplugins[$vpluginslug]['installed'] = 'yes';} else {$vwqplugins[$vpluginslug]['installed'] = 'no';} // check for latest release plugin if ( (isset($vplugin['latestrelease'])) && ($vplugin['latestrelease'] == 'yes') ) { $vwqplugins[$vpluginslug]['latestrelease'] = 'yes'; $vlatestrelease = $vwqplugins[$vpluginslug]; $vlatestrelease['slug'] = $vpluginslug; } // 1.6.5: check for next plugin release if ( (isset($vplugin['nextrelease'])) && ($vplugin['nextrelease'] == 'yes') ) { $vwqplugins[$vpluginslug]['nextrelease'] = 'yes'; $vnextrelease = $vwqplugins[$vpluginslug]; $vnextrelease['slug'] = $vpluginslug; } } } } // if ($wqdebug) {echo "";} if ($wqdebug) {echo "";} // maybe set Plugin Release Info // ----------------------------- global $wqreleases; if (isset($vlatestrelease)) {$wqreleases['latest'] = $vlatestrelease;} if (isset($vnextrelease)) {$wqreleases['next'] = $vnextrelease;} // get Installed Wordquest Plugin Data // ----------------------------------- $vplugins = array(); $vinactiveplugins = array(); $vi = 0; $vj = 0; foreach ($vinstalledplugins as $vpluginfile => $vvalues) { $vpluginslug = sanitize_title($vvalues['Name']); $vpluginfiles[$vpluginslug] = $vpluginfile; // echo '***'.$vpluginslug.'***'; // debug point if ( (in_array($vpluginslug, $vwqpluginslugs)) || (in_array($vpluginslug, $vpluginslugs)) ) { $vplugins[$vi]['slug'] = $vpluginslug; $vplugins[$vi]['name'] = $vvalues['Name']; $vplugins[$vi]['filename'] = $vpluginfile; $vplugins[$vi]['version'] = $vvalues['Version']; $vplugins[$vi]['description'] = $vvalues['Description']; // check for matching plugin update if (in_array($vpluginslug,$vpluginupdates)) {$vplugins[$vi]['update'] = 'yes';} else {$vplugins[$vi]['update'] = 'no';} // filter out to get inactive plugins if (!in_array($vpluginslug,$vpluginslugs)) { $vinactiveplugins[$vj] = $vpluginslug; $vj++; $vinactiveversions[$vpluginslug] = $vvalues['Version']; } $vi++; } } // if ($wqdebug) {echo "";} // if ($wqdebug) {echo "";} // check if BioShip Theme installed // -------------------------------- $vthemes = wp_get_themes(); $vbioshipinstalled = false; foreach ($vthemes as $vtheme) {if ($vtheme->stylesheet == 'bioship') {$vbioshipinstalled = true;} } echo '
'; // Active Plugin Panel // ------------------- $boxid = 'wordquestactive'; $boxtitle = wqhelper_translate('Active WordQuest Plugins'); echo '
'; echo '

'.$boxtitle.'

'; echo '
'; foreach ($wordquestplugins as $vpluginslug => $vplugin) { if ($vpluginslug != 'bioship') { // filter out theme here if (in_array($vpluginslug, $vpluginupdates)) { $vupdatelink = wp_nonce_url(admin_url('update.php').'?action=upgrade-plugin&plugin='.$vpluginfiles[$vpluginslug],'upgrade-plugin_'.$vpluginfiles[$vpluginslug]); echo ""; } echo ""; echo ""; echo ""; echo ""; } } echo '
"; echo $vplugin['title']."".$vplugin['version'].""; echo "
'; // Inactive Plugin Panel // --------------------- if (count($vinactiveplugins) > 0) { $boxid = 'wordquestinactive'; $boxtitle = wqhelper_translate('Inactive WordQuest Plugins'); echo '
'; echo '

'.$boxtitle.'

'; echo '
'; foreach ($vinactiveplugins as $vinactiveplugin) { $vactivatelink = admin_url('plugins.php').'?action=activate&plugin='.$vpluginfiles[$vinactiveplugin]; $vactivatelink = wp_nonce_url($vactivatelink, 'activate-plugin_'.$vpluginfiles[$vinactiveplugin]); echo ""; if (in_array($vinactiveplugin,$vpluginupdates)) { $vupdatelink = admin_url('update.php').'?action=upgrade-plugin&plugin='.$vpluginfiles[$vinactiveplugin]; $vupdatelink = wp_nonce_url($vupdatelink, 'upgrade-plugin_'.$vpluginfiles[$vinactiveplugins]); echo ""; } echo ""; echo ""; echo ""; echo ""; echo ""; } echo '
"; echo $vwqplugins[$vinactiveplugin]['title']."".$vinactiveversions[$vinactiveplugin].""; echo "
'; } $vreleasedplugins = array(); $vunreleasedplugins = array(); if ( count($vwqplugins) > count($wordquestplugins) ) { foreach ($vwqplugins as $vpluginslug => $vwqplugin) { if ( (!in_array($vpluginslug, $vinstalledslugs)) && (!in_array($vpluginslug, $vinactiveplugins)) ) { if ($vwqplugin['releasestatus'] == 'Released') {$vreleasedplugins[$vpluginslug] = $vwqplugin;} else { $vreleasetime = strtotime($vwqplugin['releasedate']); $vwqplugin['slug'] = $vpluginslug; $vunreleasedplugins[$vreleasetime] = $vwqplugin; } } } } // Available Plugin Panel // ---------------------- if (count($vreleasedplugins) > 0) { if ($wqdebug) {echo "";} $boxid = 'wordquestavailable'; $boxtitle = wqhelper_translate('Available WordQuest Plugins'); echo '
'; echo '

'.$boxtitle.'

'; echo '
'; foreach ($vreleasedplugins as $vpluginslug => $vwqplugin) { // 1.6.5: add separate install link URL for each plugin for nonce checking // 1.6.6: use wordpress.org link if all plugins are from wordpress.org if ( ($wordpressorgonly) && ($vwqplugin['wporgslug']) ) { $vinstalllink = self_admin_url('update.php')."?action=install-plugin&plugin=".$vwqplugin['wporgslug']; $vinstalllink = wp_nonce_url($vinstalllink, 'install-plugin_'.$vwqplugin['wporgslug']); echo ""; } elseif ( (!$wordpressorgonly) && (is_array($vwqplugin['package'])) ) { $vinstalllink = admin_url('update.php')."?action=wordquest_plugin_install&plugin=".$vpluginslug; $vinstalllink = wp_nonce_url($vinstalllink, 'plugin-upload'); echo ""; } echo ""; // echo ""; echo ""; echo ""; } echo "
"; echo $vwqplugin['title']."".$vwqplugin['version'].""; echo "
"; } // Upcoming Plugin Panel // --------------------- if (count($vunreleasedplugins) > 0) { ksort($vunreleasedplugins); if ($wqdebug) {echo "";} $boxid = 'wordquestupcoming'; $boxtitle = wqhelper_translate('Upcoming WordQuest Plugins'); echo '
'; echo '

'.$boxtitle.'

'; echo '
'; foreach ($vunreleasedplugins as $vreleasetime => $vwqplugin) { // $vpluginslug = $vwqplugin['slug']; echo ""; echo ""; } echo "
"; echo $vwqplugin['title'].""; echo wqhelper_translate('Expected').': '.date('jS F Y', $vreleasetime); echo "
"; } // BioShip Theme // ------------- $boxid = 'bioship'; $boxtitle = wqhelper_translate('BioShip Theme Framework'); echo '
'; echo '

'.$boxtitle.'

'; echo '
'; if ($vbioshipinstalled) { // check if BioShip Theme is active... $vtheme = wp_get_theme(); if ($vtheme->stylesheet == 'bioship') { echo wqhelper_translate('Sweet! You are using').' '; echo wqhelper_translate('BioShip Theme Framework').'.
'; echo wqhelper_translate('Great choice!').' '; // 1.6.7: add BioShip Theme Options link here if (THEMETITAN) {$voptionsurl = admin_url('admin.php').'?page=bioship-options';} elseif (THEMEOPT) {$voptionsurl = admin_url('admin.php').'?page=options-framework';} else {$voptionsurl = admin_url('customize.php');} echo ''.wqhelper_translate('Theme Options').''; } elseif ( (is_child_theme()) && ($vtheme->template == 'bioship') ) { echo wqhelper_translate('Groovy. You are using').' '; echo wqhelper_translate('BioShip Framework').'!
'; echo wqhelper_translate('Your Child Theme is').' '.$vtheme->Name.'

'; // 1.6.7: add Child Theme Options link here if (THEMETITAN) {$voptionsurl = admin_url('admin.php').'?page=bioship-options';} elseif (THEMEOPT) {$voptionsurl = admin_url('admin.php').'?page=options-framework';} else {$voptionsurl = 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... $vactivatelink = admin_url('themes.php').'?action=activate&stylesheet=bioship'; $vactivatelink = wp_nonce_url($vactivatelink, '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')) { $vtestdrivelink = admin_url('admin.php').'?page=bioship-options&theme=bioship'; } elseif (function_exists('OptionsFramework_Init')) { $vtestdrivelink = admin_url('themes.php').'?page=options-framework&theme=bioship'; } else {$vtestdrivelink = 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',$vinstalledplugins)) { // Theme Test Drive plugin activation link $vactivatelink = admin_url('plugins.php').'?action=activate&plugin='.urlencode('theme-test-drive/themedrive.php'); $vactivatelink = wp_nonce_url($vactivatelink,'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 $vinstalllink = admin_url('update.php').'?action=install-plugin&plugin=theme-test-drive'; $vinstalllink = wp_nonce_url($vinstalllink, '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 ( ($vtheme->template == 'bioship') || ($vtheme->stylesheet == 'bioship') ) { if (function_exists('admin_theme_updates_available')) { $vthemeupdates = admin_theme_updates_available(); if ($vthemeupdates != '') { echo '
'.$vthemeupdates.'

'; } } // TODO: future link for rating BioShip on wordpress.org theme repository ? // $vratelink = '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) if (function_exists('muscle_bioship_dashboard_feed_widget')) { // $boxid = 'bioshipfeed'; $boxtitle = wphelper_translate('BioShip News'); // echo '
'; // echo '

'.$boxtitle.'

'; // echo '
'; muscle_bioship_dashboard_feed_widget(false); // echo '
'; } echo '
'; echo '
'; // end column echo '
'; }; } // ---------------------------- // Version Specific Feed Column // ---------------------------- $vfuncname = 'wqhelper_admin_feeds_column_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function($vargs) { echo '
'; // Latest / Next Release // --------------------- global $wqreleases; $vlatestrelease = ''; $vnextrelease = ''; if (isset($wqreleases['latest'])) {$vlatestrelease = $wqreleases['latest'];} if (isset($wqreleases['next'])) {$vnextrelease = $wqreleases['next'];} if ( (isset($vlatestrelease)) && (is_array($vlatestrelease)) ) { if ($vlatestrelease['installed'] == 'no') { $vrelease = $vlatestrelease; $boxid = 'wordquestlatest'; $boxtitle = wqhelper_translate('Latest Release'); } else {$vrelease = $vnextrelease; $boxid = 'wordquestupcoming'; $boxtitle = wqhelper_translate('Upcoming Release');} } elseif ( (isset($vnextrelease)) && (is_array($vnextrelease)) ) { $vrelease = $vnextrelease; $boxid = 'wordquestupcoming'; $boxtitle = wqhelper_translate('Upcoming Release'); } if ( (isset($vrelease)) && (is_array($vrelease)) ) { echo '
'; echo '

'.$boxtitle.'

'; echo '
'; echo "
"; echo "

"; echo "".$vrelease['title']."
".$vrelease['description']."

"; if ( (isset($vrelease['package'])) && (is_array($vrelease['package'])) ) { // 1.6.6: check for wordpress.org only installs global $wordpressorgonly; $vinstalllink = false; if ( ($wordpressorgonly) && ($vrelease['wporgslug']) ) { $vinstalllink = self_admin_url('update.php')."?action=install-plugin&plugin=".$vrelease['wporgslug']; $vinstalllink = wp_nonce_url($vinstalllink, 'install-plugin_'.$vrelease['wporgslug']); } else { $vinstalllink = admin_url('update.php')."?action=wordquest_plugin_install&plugin=".$vrelease['slug']; $vinstalllink = wp_nonce_url($vinstalllink, 'plugin-upload'); } if ($vinstalllink) { echo ""; echo "
".wqhelper_translate('Install Now')."
"; } else { $vpluginlink = $wqurls['wq'].'/plugins/'.$vrelease['slug']; echo "
→ ".wqhelper_translate('Plugin Home')."
"; } } else {echo "
".wqhelper_translate('Expected').": ".date('jS F Y',strtotime($vrelease['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($vrecommended); // 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 '
'; } // end column echo "
"; // queue feed javascript if (!has_action('admin_footer', 'wqhelper_dashboard_feed_javascript')) { add_action('admin_footer', 'wqhelper_dashboard_feed_javascript'); } }; } // ----------------------------- // Version Specific Admin Styles // ----------------------------- $vfuncname = 'wqhelper_admin_styles_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { // Hide Wordquest plugin freemius submenu items if top level admin menu not open echo ""; }; } // ----------------------------- // Version Specific Admin Script // ----------------------------- $vfuncname = 'wqhelper_admin_scripts_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = 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'); $vfuncname = 'wqhelper_install_plugin_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = 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.') );} $vpluginslug = $_REQUEST['plugin']; // 1.5.9: sanitize plugin slug $vpluginslug = sanitize_title($vpluginslug); if ($vpluginslug == '') {wp_dir( wqhelper_translate('Error: Invalid Plugin slug specified.') );} $vurl = $wqurls['wq'].'/downloads/?action=get_metadata&slug='.$vpluginslug; $vresponse = wp_remote_get($vurl,array('timeout' => 30)); if (!is_wp_error($vresponse)) { if ($vresponse['response']['code'] == '404') { // try to get package info from stored transient data $vplugininfo = get_transient('wordquest_plugin_info'); if (is_array($vpluginfo)) { foreach ($vplugininfo as $vplugin) { if ($vplugin['slug'] == $vpluginslug) {$vpluginpackage = $vplugin['package'];} } } } else {$vpluginpackage = json_decode($vresponse['body'],true);} } if (!isset($vpluginpackage)) { if (is_ssl()) {$vtryagainurl = 'https://';} else {$vtryagainurl = 'http://';} $vtryagainurl .= $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; wp_die( wqhelper_translate('Failed to retrieve download package information.').' '.wqhelper_translate('Try again?').'' ); } // 1.6.5: pass the package download URL to Wordpress to do the rest // set the Plugin_Installer_Skin arguments // --------------------------------------- $url = $vpluginpackage['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 // ---------------------- $vfuncname = 'wqhelper_sidebar_floatbox_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function($vargs) { global $wqdebug, $wqurls; if ($wqdebug) {echo "";} if (count($vargs) == 7) { // the old way, sending all args individually $vpre = $vargs[0]; $vpluginslug = $vargs[1]; $vfreepremium = $vargs[2]; $vwporgslug = $vargs[3]; $vsavebutton = $vargs[4]; $vplugintitle = $vargs[5]; $vpluginversion = $vargs[6]; } else { // the new way, just sending two args $vpluginslug = $vslug = $vargs[0]; $vsavebutton = $vargs[1]; // get the args using the slug and global array global $wordquestplugins; $vpluginversion = $wordquestplugins[$vslug]['version']; $vplugintitle = $wordquestplugins[$vslug]['title']; $vpre = $wordquestplugins[$vslug]['settings']; $vfreepremium = $wordquestplugins[$vslug]['plan']; $vwporg = $wordquestplugins[$vslug]['wporg']; if (isset($wordquestplugins[$vslug]['wporgslug'])) { $vwporgslug = $wordquestplugins[$vslug]['wporgslug']; } else {$vwporgslug = '';} 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($vpre.'_sidebar_options'); if ( ($sidebaroptions == '') || (!is_array($sidebaroptions)) ) { $sidebaroptions['installdate'] = date('Y-m-d'); $sidebaroptions['adsboxoff'] = get_option($vpre.'_ads_box_off'); $sidebaroptions['donationboxoff'] = get_option($vpre.'_donation_box_off'); $sidebaroptions['reportboxoff'] = get_option($vpre.'_report_box_off'); delete_option($vpre.'_ads_box_off'); delete_option($vpre.'_donation_box_off'); delete_option($vpre.'_report_box_off'); add_option($vpre.'_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'] = '';} echo ""; // Floatbox Styles echo ''; echo '
'; if ($wqdebug) {echo '';} // Call (optional) Plugin Sidebar Header $vfuncname = $vpre.'_sidebar_plugin_header'; if (function_exists($vfuncname)) {call_user_func($vfuncname);} // Save Settings Button // -------------------- if ($vsavebutton != 'replace') { echo '
'; echo '

'.wqhelper_translate('Update Settings').'

'; if ($vsavebutton == 'yes') { $vbuttonoutput = ""; $vbuttonoutput .= ""; $vbuttonoutput .= ""; $vbuttonoutput .= ""; $vbuttonoutput .= ""; $vbuttonoutput .= "
"; $vbuttonoutput = apply_filters('wordquest_sidebar_save_button', $vbuttonoutput); echo $vbuttonoutput; } elseif ($vsavebutton == 'no') {echo "";} else {echo "";} echo "
"; echo '
'; } // Donation Box // ------------ // for Free Version? Or Upgrade Link? $vargs = array($vpre, $vpluginslug); echo ''; // Bonus Subscription Form // ----------------------- // 1.7.2: allow for bonus offer box override $vfuncname = $vpre.'_sidebar_bonus_offer'; if (function_exists($vfuncname)) {call_user_func($vfuncname);} else { // (populated for current user) global $current_user; $current_user = wp_get_current_user(); $vuseremail = $current_user->user_email; if (strstr($vuseremail, '@localhost')) {$vuseremail = '';} $vuserid = $current_user->ID; $vuserdata = get_userdata($vuserid); $vusername = $vuserdata->first_name; $vlastname = $vuserdata->last_name; if ($vlastname != '') {$vusername .= ' '.$vlastname;} if ($vpluginslug == 'bioship') {$vreportimage = get_template_directory_uri()."/images/rv-report.jpg";} else {$vreportimage = plugins_url('images/rv-report.jpg', __FILE__);} echo ''; } // PluginReview.Net Plugin Recommendations // --------------------------------------- if ($sidebaroptions['adsboxoff'] != 'checked') { // 1.7.2: allow for recommendation box override $vfuncname = $vpre.'_sidebar_plugin_recommendation'; if (function_exists($vfuncname)) {call_user_func($vfuncname);} else { echo '
'; echo '
'; echo '

'.wqhelper_translate('Recommended').'

'; echo ""; echo '
'; } } // Call Plugin Footer Function // --------------------------- $vfuncname = $vpre.'_sidebar_plugin_footer'; if (function_exists($vfuncname)) {call_user_func($vfuncname);} else { // Default Sidebar Plugin Footer // ----------------------------- // also allow for theme not plugin... if ($vpluginslug == 'bioship') { $viconurl = get_template_directory_uri().'/images/wordquest.png'; $vpluginurl = $wqurls['bio']; $vpluginfootertitle = wqhelper_translate('Theme Info'); } else { $viconurl = plugins_url("images/wordquest.png", __FILE__); $vpluginurl = $wqurls['wq']."/plugins/".$vpluginslug."/"; $vpluginfootertitle = wqhelper_translate('Plugin Info'); } echo '

'.$vpluginfootertitle.'

'; echo "
"; echo ""; echo ""; echo ""; echo "
".$vplugintitle." v".$vpluginversion."
"; echo "by WordQuest Alliance
"; echo "→ ".wqhelper_translate('More Cool Plugins')."
"; echo "→ ".wqhelper_translate('Plugin Directory')."
"; echo '
'; } echo '
'; // close #floatdiv }; } // ---------------- // Paypal Donations // ---------------- $vfuncname = 'wqhelper_sidebar_paypal_donations_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function($vargs) { global $wqurls; $vpre = $vargs[0]; $vpluginslug = $vargs[1]; if (function_exists($vpre.'_donations_special_top')) { $vfuncname = $vpre.'_donations_special_top'; call_user_func($vfuncname); } // make display name from the plugin slug if (strstr($vpluginslug, '-')) { $vparts = explode('-', $vpluginslug); $vi = 0; foreach ($vparts as $vpart) { if ($vpart == 'wp') {$vparts[$vi] = 'WP';} else {$vparts[$vi] = strtoupper(substr($vpart, 0, 1)).substr($vpart, 1, (strlen($vpart)-1));} $vi++; } $vpluginname = implode(' ', $vparts); } else { $vpluginname = strtoupper(substr($vpluginslug, 0, 1)).substr($vpluginslug, 1, (strlen($vpluginslug)-1)); } echo ""; $vnotifyurl = $wqurls['wq'].'/?estore_pp_ipn=process'; $vsandbox = ''; // $vsandbox = 'sandbox.'; // recurring / one-time switcher echo "
"; echo " ".wqhelper_translate('Supporter')." "; echo ""; echo " ".wqhelper_translate('One Time').""; echo "
"; // 1.5.0: weekly amounts echo '
'; // 1.5.0: monthly amounts echo '
'; // recurring form // $wqurls['wq'].'/?wp_eStore_subscribe=LEVEL&c_input='.$vpluginslug; if ($vpluginslug == 'bioship') {$vdonateimage = get_template_directory_uri()."/images/pp-donate.jpg";} else {$vdonateimage = plugins_url("/images/pp-donate.jpg", __FILE__);} echo '
'; // $wqurls['wq'].'/?wp_eStore_donation=23&var1_price=AMOUNT&c_input='.$vpluginslug; echo '
'; if (function_exists($vpre.'_donations_special_bottom')) { $vfuncname = $vpre.'_donations_special_bottom'; call_user_func($vfuncname); } }; } // --------------- // Testimonial Box // --------------- $vfuncname = 'wqhelper_sidebar_testimonial_box_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function($vargs) { global $wqurls, $current_user; $current_user = wp_get_current_user(); $vuseremail = $current_user->user_email; $vuserid = $current_user->ID; $vuserdata = get_userdata($vuserid); $vusername = $vuserdata->first_name; $vlastname = $vuserdata->last_name; if ($vlastname != '') {$vusername .= ' '.$vlastname;} $vpre = $vargs[0]; $vpluginslug = $vargs[1]; $vpluginslug = str_replace('-', '', $vpluginslug); echo ""; echo "
".wqhelper_translate('Send me a thank you or testimonial.')."
"; echo ""; echo ""; }; } // --------------------- // Save Sidebar Settings // --------------------- // !! caller exception !! uses form matching version function $vfuncname = 'wqhelper_update_sidebar_options_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { $vpre = $_REQUEST['sidebarprefix']; if (current_user_can('manage_options')) { // 1.6.5: check nonce field check_admin_referer($vpre.'_sidebar'); // 1.5.0: convert to single array of plugin sidebar options $vsidebaroptions = get_option($vpre.'_sidebar_options'); if (!$vsidebaroptions) {$vsidebaroptions = array('installdate' => date('Y-m-d'));} $vsidebaroptions['adsboxoff'] = ''; $vsidebaroptions['donationboxoff'] = ''; $vsidebaroptions['reportboxoff'] = ''; if ( (isset($_POST[$vpre.'_ads_box_off'])) && ($_POST[$vpre.'_ads_box_off'] == 'checked') ) {$vsidebaroptions['adsboxoff'] = 'checked';} if ( (isset($_POST[$vpre.'_donation_box_off'])) && ($_POST[$vpre.'_donation_box_off'] == 'checked') ) {$vsidebaroptions['donationboxoff'] = 'checked';} if ( (isset($_POST[$vpre.'_report_box_off'])) && ($_POST[$vpre.'_report_box_off'] == 'checked') ) {$vsidebaroptions['reportboxoff'] = 'checked';} update_option($vpre.'_sidebar_options', $vsidebaroptions); // print_r($vsidebaroptions); // debug point // Javascript Show/Hide Callbacks echo ""; // maybe call Special Update Options $vfuncname = $vpre.'_update_sidebar_options_special'; if (function_exists($vfuncname)) {call_user_func($vfuncname);} } exit; }; } // --------------------- // Sticky Kit Javascript // --------------------- $vfuncname = 'wqhelper_sidebar_stickykitscript_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { return ''; }; } // ' // --------------------- // Float Menu Javascript // --------------------- $vfuncname = 'wqhelper_sidebar_floatmenuscript_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { return " "; }; } // ============================= // --- Dashboard Feed Widget --- // ============================= // ----------------------------- // Add the Dashboard Feed Widget // ----------------------------- $vrequesturi = $_SERVER['REQUEST_URI']; if ( (preg_match('|index.php|i', $vrequesturi)) || (substr($vrequesturi, -(strlen('/wp-admin/'))) == '/wp-admin/') || (substr($vrequesturi, -(strlen('/wp-admin/network'))) == '/wp-admin/network/') ) { if (!has_action('wp_dashboard_setup', 'wqhelper_add_dashboard_feed_widget')) { add_action('wp_dashboard_setup', 'wqhelper_add_dashboard_feed_widget'); } } // ------------------------ // Load the Dashboard Feeds // ------------------------ $vfuncname = 'wqhelper_add_dashboard_feed_widget_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { global $wp_meta_boxes, $current_user; if ( (current_user_can('manage_options')) || (current_user_can('install_plugins')) ) { // 1.6.1: fix to undefined index warning $vwordquestloaded = false; $vpluginreviewloaded = false; foreach (array_keys($wp_meta_boxes['dashboard']['normal']['core']) as $vname) { if ($vname == 'wordquest') {$vwordquestloaded = true;} if ($vname == 'pluginreview') {$vpluginreviewloaded = true;} } if (!$vwordquestloaded) { wp_add_dashboard_widget('wordquest', 'WordQuest Alliance', 'wqhelper_dashboard_feed_widget'); } if (!$vpluginreviewloaded) { wp_add_dashboard_widget('pluginreview', 'Plugin Review Network', 'wqhelper_pluginreview_feed_widget'); } // add the dashboard feed javascript (once only) if (!has_action('admin_footer', 'wqhelper_dashboard_feed_javascript')) { add_action('admin_footer', 'wqhelper_dashboard_feed_javascript'); } } }; } // ----------------------------------- // WordQuest Dashboard Feed Javascript // ----------------------------------- $vfuncname = 'wqhelper_dashboard_feed_javascript_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { echo ""; echo ""; }; } // ------------------------------- // WordQuest Dashboard Feed Widget // ------------------------------- $vfuncname = 'wqhelper_dashboard_feed_widget_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { // maybe Get Latest Release info // ----------------------------- global $wqdebug, $wqreleases, $wqurls; $vlatestrelease = ''; $vnextrelease = ''; if (isset($wqreleases)) { if (isset($wqreleases['latest'])) {$vlatestrelease = $wqreleases['latest'];} if (isset($wqreleases['next'])) {$vnextrelease = $wqreleases['next'];} } else { $vpluginsinfo = wqhelper_get_plugin_info(); if (is_array($vpluginsinfo)) { foreach ($vpluginsinfo as $vplugin) { if (isset($vplugin['slug'])) { if ( ( (isset($vplugin['latestrelease'])) && ($vplugin['latestrelease'] == 'yes') ) || ( (isset($vplugin['nextrelease'])) && ($vplugin['nextrelease'] == 'yes') ) ) { $vplugininfo = $vplugin; $vplugins = get_plugins(); $vplugininfo['installed'] = 'no'; foreach ($vplugins as $vpluginfile => $vvalues) { if ($vplugininfo['slug'] == sanitize_title($vvalues['Name'])) {$vplugininfo['installed'] = 'yes';} } } if ( (isset($vplugin['latestrelease'])) && ($vplugin['latestrelease'] == 'yes') ) {$vlatestrelease = $vplugininfo;} if ( (isset($vplugin['nextrelease'])) && ($vplugin['nextrelease'] == 'yes') ) {$vnextrelease = $vplugininfo;} } } } } // echo ""; // echo ""; // maybe Display Latest Release Info // --------------------------------- if ( (isset($_REQUEST['page'])) && ($_REQUEST['page'] == 'wordquest') ) { // do not duplicate here as already output for wordquest page } elseif ( (isset($vlatestrelease)) && (is_array($vlatestrelease)) && ($vlatestrelease['installed'] == 'no') ) { echo "".wqhelper_translate('Latest Plugin Release')."
"; echo ""; echo "

"; echo "".$vlatestrelease['title']."
".$vlatestrelease['description']."

"; if ( (isset($vlatestrelease['package'])) && (is_array($vlatestrelease['package'])) ) { // 1.6.6: check for wordpress.org only installs global $wordpressorgonly; $vinstalllink = false; if ( ($wordpressorgonly) && ($vwqplugin['wporgslug']) ) { $vinstalllink = self_admin_url('update.php')."?action=install-plugin&plugin=".$vlatestrelease['wporgslug']; $vinstalllink = wp_nonce_url($vinstalllink, 'install-plugin_'.$vlatestrelease['wporgslug']); } else { admin_url('update.php').'?action=wordquest_plugin_install&plugin='.$vlatestrelease['slug']; $vinstalllink = wp_nonce_url($vinstalllink, 'plugin-upload'); } if ($vinstalllink) { echo ""; echo "
".wqhelper_translate('Install Now')."
"; } else { $vpluginlink = $wqurls['wq'].'/plugins/'.$vlatestrelease['slug']; echo "
→ ".wqhelper_translate('Plugin Home')."
"; } } echo "

"; } elseif ( (isset($vnextrelease)) && (is_array($vnextrelease)) ) { echo "".wqhelper_translate('Upcoming Plugin Release')."
"; echo ""; echo "

"; echo "".$vnextrelease['title']."
".$vnextrelease['description']."

"; $vreleasetime = strtotime($vnextrelease['releasedate']); echo "
".wqhelper_translate('Expected').": ".date('jS F Y', $vreleasetime)."
"; echo "

"; } echo ""; // WordQuest Posts Feed // -------------------- $vrssurl = $wqurls['wq']."/category/guides/feed/"; if ($wqdebug) {$vfeed = ''; delete_transient('wordquest_guides_feed');} else {$vfeed = trim(get_transient('wordquest_guides_feed'));} if ( (!$vfeed) || ($vfeed == '') ) { $vrssfeed = fetch_feed($vrssurl); $vfeeditems = 4; $vargs = array($vrssfeed, $vfeeditems); $vfeed = wqhelper_process_rss_feed($vargs); if ($vfeed != '') {set_transient('wordquest_guides_feed', $vfeed, (24*60*60));} } echo "
"; echo "
".wqhelper_translate('More')."...
"; echo "".wqhelper_translate('Latest WordQuest Guides')."
"; if ($vfeed != '') {echo $vfeed;} else {echo wqhelper_translate('Feed Currently Unavailable.'); delete_transient('wordquest_guides_feed');} echo "
"; // WordQuest Solutions Feed // ------------------------ $vrssurl = $wqurls['wq']."/quest/feed/"; if ($wqdebug) {$vfeed = ''; delete_transient('wordquest_quest_feed');} else {$vfeed = trim(get_transient('wordquest_quest_feed'));} if ( (!$vfeed) || ($vfeed == '') ) { $vrssfeed = fetch_feed($vrssurl); $vfeeditems = 4; $vargs = array($vrssfeed, $vfeeditems); $vfeed = wqhelper_process_rss_feed($vargs); if ($vfeed != '') {set_transient('wordquest_quest_feed', $vfeed, (24*60*60));} } echo "
"; echo "
".wqhelper_translate('More')."...
"; echo "".wqhelper_translate('Latest Solution Quests').""; if ($vfeed != '') {echo $vfeed;} else {echo wqhelper_translate('Feed Currently Unavailable.'); delete_transient('wordquest_quest_feed');} echo "
"; return; // -------------------------- // currently not implented... // Category Feed Selection // ----------------------- $vpluginsurl = $wqurls['wq']."/?get_post_categories=yes"; if ($wqdebug) {$vcategorylist = ''; delete_transient('wordquest_feed_cats');} else {$vcategorylist = trim(get_transient('wordquest_feed_cats'));} if ( (!$vcategorylist) || ($vcategorylist == '') ) { $vargs = array('timeout' => 10); $vgetcategorylist = wp_remote_get($vpluginsurl, $vargs); if (!is_wp_error($vgetcategorylist)) { $vcategorylist = $vgetcategorylist['body']; if ($vcategorylist) {set_transient('wordquest_feed_cats', $vcategorylist, (24*60*60));} } } if (strstr($vcategorylist, "::::")) { $vcategories = explode("::::", $vcategorylist); if (count($vcategories) > 0) { $vi = 0; foreach ($vcategories as $vcategory) { $vcatinfo = explode("::", $vcategory); $vcats[$vi]['name'] = $vcatinfo[0]; $vcats[$vi]['slug'] = $vcatinfo[1]; $vcats[$vi]['count'] = $vcatinfo[2]; $vi++; } if (count($vcats) > 0) { echo ""; echo ""; echo "
".wqhelper_translate('Category').":
"; echo "
"; } } } }; } // --------------------------------- // Plugin Review Network Feed Widget // --------------------------------- $vfuncname = 'wqhelper_pluginreview_feed_widget_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { echo ""; // Latest Plugins Feed // ------------------- global $wqdebug, $wqurls; $vrssurl = $wqurls['prn']."/feed/"; if ($wqdebug) {$vfeed = ''; delete_transient('pluginreview_newest_feed');} else {$vfeed = trim(get_transient('pluginreview_newest_feed'));} if ( (!$vfeed) || ($vfeed == '') ) { $vrssfeed = fetch_feed($vrssurl); $vfeeditems = 4; $vargs = array($vrssfeed, $vfeeditems); $vfeed = wqhelper_process_rss_feed($vargs); if ($vfeed != '') {set_transient('pluginreview_newest_feed', $vfeed, (24*60*60));} } echo "
"; echo wqhelper_translate('NEW', 'bioship').' '.wqhelper_translate('Plugin Directory')." - ".wqhelper_translate('by Category')."!

"; echo "
"; echo "
".wqhelper_translate('More')."...
"; if ($vfeed != '') {echo "".wqhelper_translate('Latest Plugin Releases')."
".$vfeed;} else {echo wqhelper_translate('Feed Currently Unavailable'); delete_transient('prn_feed');} echo "
"; // return; // temp // Recently Updated Feed // --------------------- $vrssurl = $wqurls['prn']."/feed/?orderby=modified"; if ($wqdebug) {$vfeed = ''; delete_transient('pluginreview_updated_feed');} else {$vfeed = trim(get_transient('pluginreview_updated_feed'));} if ( (!$vfeed) || ($vfeed == '') ) { $vrssfeed = fetch_feed($vrssurl); $vfeeditems = 4; $vargs = array($vrssfeed, $vfeeditems); $vfeed = wqhelper_process_rss_feed($vargs); if ($vfeed != '') {set_transient('pluginreview_updated_feed', $vfeed, (24*60*60));} } echo "
"; echo "
".wqhelper_translate('More')."...
"; if ($vfeed != '') {echo "".wqhelper_translate('Recently Updated Plugins')."
".$vfeed;} else {echo wqhelper_translate('Feed Currently Unavailable'); delete_transient('prn_feed');} echo "
"; return; // -------------------------- // currently not implented... // Category Feed Selection // ----------------------- $vcategoryurl = $wqurls['prn']."/?get_review_categories=yes"; // refresh once a day only to limit downloads if ($wqdebug) {$vcategorylist = ''; delete_transient('prn_feed_cats');} else {$vcategorylist = trim(get_transient('prn_feed_cats'));} if ( (!$vcategorylist) || ($vcategorylist == '') ) { $vargs = array('timeout' => 10); $vgetcategorylist = wp_remote_get($vcategoryurl, $vargs); if (!is_wp_error($vgetcategorylist)) { $vcategorylist = $vgetcategorylist['body']; if ($vcategorylist) {set_transient('prn_feed_cats', $vcategorylist, (24*60*60));} } } if (strstr($vcategorylist, "::::")) { $vcategories = explode("::::", $vcategorylist); if (count($vcategories) > 0) { $vi = 0; foreach ($vcategories as $vcategory) { $vcatinfo = explode("::", $vcategory); $vcats[$vi]['name'] = $vcatinfo[0]; $vcats[$vi]['slug'] = $vcatinfo[1]; $vcats[$vi]['count'] = $vcatinfo[2]; $vi++; } if (count($vcats) > 0) { echo ""; echo ""; echo "
".wqhelper_translate('Category').":
"; echo "
"; } } } }; } // -------------------- // Load a Category Feed // -------------------- $vfuncname = 'wqhelper_load_feed_category_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function() { $vnamespace = $_GET['namespace']; $vbaseurl = $_GET['siteurl']; $vcatslug = $_GET['category']; $vcategoryurl = $vbaseurl."/category/".$vcatslug."/feed/"; $vmorelink = "
More...
"; $vcategoryrss = @fetch_feed($vcategoryurl); $vfeeditems = 10; // Process the Feed // ---------------- $vargs = array($vcategoryrss, $vfeeditems); $vcategoryfeed = wqhelper_process_rss_feed($vargs); if ($vcategoryfeed != '') {$vcategoryfeed .= $vmorelink;} echo ''; exit; }; } // ---------------- // Process RSS Feed // ---------------- $vfuncname = 'wqhelper_process_rss_feed_'.$wqhv; if ( (!isset($wqfunctions[$vfuncname])) || (!is_callable($wqfunctions[$vfuncname])) ) { $wqfunctions[$vfuncname] = function($vargs) { $vrss = $vargs[0]; $vfeeditems = $vargs[1]; $vprocessed = ''; if (is_wp_error($vrss)) {return '';} $vmaxitems = $vrss->get_item_quantity($vfeeditems); $vrssitems = $vrss->get_items(0, $vmaxitems); if ($vmaxitems == 0) {$vprocessed = "";} else { $vprocessed = ""; } return $vprocessed; }; } // CLOSE VERSION COMPARE WRAPPER FOR PHP 5.3 REQUIRED // -------------------------------------------------- } // debug point // print_r($wqfunctions);