function installed_zend() { if (version_compare(PHP_VERSION, '5.5', '>=')) { $zend_install_tips = __('Sorry, you cannot use this paid plugin, ZEND is not support for php 5.5.x or above.', 'wechat'); } else { $zend_loader_enabled = function_exists('zend_loader_enabled'); if ($zend_loader_enabled) { $zend_loader_version = function_exists('zend_loader_version') ? zend_loader_version() : ''; if (version_compare($zend_loader_version, '3.3', '>=')) { return; } else { $zend_install_tips = __('Sorry, you cannot use this paid plugin, ZEND version is not up to date, please update to at least 3.3.0<a href="http://www.zend.com/en/products/guard/downloads" target="_blank">View</a>', 'wechat'); } } else { if (version_compare(PHP_VERSION, '5.3', '>=')) { $zend_install_tips = __('Sorry, you cannot use this paid plugin, please contact your server company <a href="http://www.zend.com/en/products/guard/downloads" target="_blank">Zend Guard Loader</a>.', 'wechat'); } else { $zend_install_tips = __('Sorry, you cannot use this paid plugin, please contact your server company <a href="http://www.zend.com/en/products/guard/downloads-prev" target="_blank">Zend Optimizer</a>.', 'wechat'); } } } return array('error' => $zend_install_tips); }
function function_support(&$func_items) { $func_str = ""; foreach ($func_items as $item) { $status = function_exists($item); $func_str .= "<tr>\n"; if ($item == "close_curl") { $func_str .= "<td>CURL"; if ($curl = close_curl()) { $status = ''; $func_str .= $curl; } $func_str .= "</td>\n"; } else { if ($item == "close_fopen") { $func_str .= "<td>fopen"; if ($fopen = close_fopen()) { $status = ''; $func_str .= $fopen; } $func_str .= "</td>\n"; } else { if ($item == "close_http") { $func_str .= "<td>HTTP"; if (close_http()) { $status = ''; } $func_str .= " <span style=\"color:green\">上面的 CURL 或者 fopen 必须支持一个!</span>"; $func_str .= "</td>\n"; } else { if (preg_match("/openssl/", $item)) { $func_str .= "<td>{$item}()"; if (!$status) { $func_str .= " <span style=\"color:blue\">请在php.ini中打开扩展extension=php_openssl.dll</span>"; } $func_str .= "</td>\n"; } else { if ($item == "zend_loader_enabled") { $version = function_exists('zend_loader_version') ? zend_loader_version() : ''; $func_str .= "<td>Zend Optimizer " . $version; if (!$status) { $func_str .= " <span style=\"color:green\">不支持Zend,意味着不能使用 “捐赠版”。 php5.2.x请安装Zend Optimizer , php5.3.x请安装Zend Guard Loader</span>"; } else { $func_str .= version_compare($version, '3.3', '<') ? " <span style=\"color:red\">版本太低,php5.2.x请升级到3.3.0或以上版本,否则不能使用 “捐赠版”</span>" : ''; } $func_str .= "</td>\n"; } else { if ($item == "gzinflate") { $func_str .= "<td>{$item}()"; if (!$status) { $func_str .= " <span style=\"color:green\">不支持该函数,意味着不能使用 “IM机器人”。</span>"; } $func_str .= "</td>\n"; } else { $func_str .= "<td>{$item}()</td>\n"; } } } } } } if ($status) { $func_str .= "<td>支持</td>\n"; $func_str .= "<td><img src=\"images/0.gif\" class=\"yes\"/></td>\n"; } else { $func_str .= "<td>不支持</td>\n"; $func_str .= "<td><img src=\"images/0.gif\" class=\"no\"/></td>\n"; } $func_str .= "</tr>"; } return $func_str; }
<td width="30%"> <?php $PHP_VERSION = PHP_VERSION; $PHP_VERSION = substr($PHP_VERSION, 0, 1); if ($PHP_VERSION > 2) { echo "Zend Guard Loader"; } else { echo "Zend Optimizer"; } ?> </td> <td width="20%"><?php if ($PHP_VERSION > 2) { if (function_exists("zend_loader_version")) { echo '<font color=green>√</font> Ver '; echo zend_loader_version(); } else { echo '<font color=red>×</font>'; } } else { if (function_exists('zend_optimizer_version')) { echo '<font color=green>√</font> Ver '; echo zend_optimizer_version(); } else { echo get_cfg_var("zend_optimizer.optimization_level") || get_cfg_var("zend_extension_manager.optimizer_ts") || get_cfg_var("zend.ze1_compatibility_mode") || get_cfg_var("zend_extension_ts") ? '<font color=green>√</font>' : '<font color=red>×</font>'; } } ?> </td> </tr>
function function_support(&$func_items) { $func_str = ""; foreach ($func_items as $item) { $status = function_exists($item); $func_str .= "<tr>\n"; if ($item == "close_curl") { $func_str .= "<td>CURL"; if ($curl = close_curl()) { $status = ''; $func_str .= $curl; } $func_str .= "</td>\n"; } else { if ($item == "close_fopen") { $func_str .= "<td>fopen"; if ($fopen = close_fopen()) { $status = ''; $func_str .= $fopen; } $func_str .= "</td>\n"; } else { if ($item == "close_http") { $func_str .= "<td>HTTP"; if (close_http()) { $status = ''; } $func_str .= " <span style=\"color:green\">上面的 CURL 或者 fopen 必须支持一个!</span>"; $func_str .= "</td>\n"; } else { if (preg_match("/openssl/", $item)) { $func_str .= "<td>{$item}()"; if (!$status) { $func_str .= " <span style=\"color:blue\">请在php.ini中打开扩展extension=php_openssl.dll</span>"; } $func_str .= "</td>\n"; } else { if ($item == "zend_loader_enabled") { $version = function_exists('zend_loader_version') ? zend_loader_version() : ''; $func_str .= version_compare(PHP_VERSION, '5.3', '<') ? "<td>Zend Optimizer " : "<td>Zend Guard Loader "; $func_str .= $version; if (!$status) { $func_str .= " <span style=\"color:green\">不支持Zend,意味着不能使用付费插件。 php5.2.x请安装Zend Optimizer , php5.3.x及以上版本请安装Zend Guard Loader</span>"; } elseif (version_compare(PHP_VERSION, '5.5', '>=')) { $func_str .= '<span style=\\"color:red\\">很遗憾,暂时不能在php5.5.x上使用付费插件。请降到PHP5.4.x或者PHP5.3.x或者PHP5.2.x版本</span>'; } else { $func_str .= version_compare($version, '3.3', '<') ? " <span style=\"color:red\">版本太低,php5.2.x请升级到3.3.0或以上版本,否则不能使用 付费插件</span>" : ''; } $func_str .= "</td>\n"; } else { $func_str .= "<td>{$item}()</td>\n"; } } } } } if ($status) { $func_str .= "<td>支持</td>\n"; $func_str .= "<td>√</td>\n"; } else { $func_str .= "<td>不支持</td>\n"; $func_str .= "<td>X</td>\n"; } $func_str .= "</tr>"; } return $func_str; }
/* Plugin Name: qa Connect Plugin URI: http://www.smyx.net/qa-connect.html Plugin Description: Allows users to log in via sina, qq, qqweibo etc. Plugin Version: 1.0 Plugin Date: 2012-12-12 Plugin Author: 水脉烟香 Plugin Author URI: http://www.smyx.net/ Plugin License: GPLv2 Plugin Minimum Question2Answer Version: 1.5 Plugin Minimum PHP Version: 5.2 Plugin Update Check URI: */ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../../'); exit; } $zend_loader_enabled = function_exists('zend_loader_enabled'); if ($zend_loader_enabled) { $zend_loader_version = function_exists('zend_loader_version') ? zend_loader_version() : ''; if (version_compare($zend_loader_version, '3.3', '>=')) { $php_version = version_compare(PHP_VERSION, '5.3', '>=') ? 'zend/' : ''; if (!QA_FINAL_EXTERNAL_USERS) { // login modules don't work with external user integration qa_register_plugin_module('login', $php_version . 'qa-connect.php', 'qa_connect', 'qa Connect'); } // 将所有链接的相对地址设置为绝对地址,使用社交网络头像等 qa_register_plugin_overrides('override-function.php'); } }