当前位置: 首页>>代码示例>>PHP>>正文


PHP Hybrid_Error::getApiError方法代码示例

本文整理汇总了PHP中Hybrid_Error::getApiError方法的典型用法代码示例。如果您正苦于以下问题:PHP Hybrid_Error::getApiError方法的具体用法?PHP Hybrid_Error::getApiError怎么用?PHP Hybrid_Error::getApiError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hybrid_Error的用法示例。


在下文中一共展示了Hybrid_Error::getApiError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wsl_display_dev_mode_debugging_area

/**
* Display a debugging area.
*
* This function is highly inspired by the Query Monitor.
* https://wordpress.org/plugins/query-monitor/
*
* Note: in order for this function to display the sql queries, 'SAVEQUERIES' should be defined as true in 'wp-config.php'
*/
function wsl_display_dev_mode_debugging_area($keyword = 'wsl_')
{
    global $wpdb, $wp_actions, $wp_filter;
    ?>
<style>
	.wsl-dev-nonselectsql {
		color: #a0a !important;
	}
	.wsl-dev-expensivesql {
		color: #f44 !important;
	}
	.wsl-dev-optionfunc {
		color: #4a4 !important;
	}
	.wsl-dev-wslfunc {
		color: #1468fa !important;
	}
	.wsl-dev-nonwslfunc {
		color: #a0a !important;
	}
	.wsl-dev-usedhook, .wsl-dev-usedhook a {
		color: #1468fa;
	}
	.wsl-dev-usedwslhook {
		color: #a0a !important;
	}
	.wsl-dev-unusedhook, .wsl-dev-unusedhook a{
		color: #a3a3a3 !important;
	}
	.wsl-dev-hookcallback, .wsl-dev-hookcallback a {
		color: #4a4 !important;
	}
	.wsl-dev-table {
		width:100%;
		border: 1px solid #e5e5e5;
		box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
		border-spacing: 0;
		clear: both;
		margin: 0;
		width: 100%;
	}
	.wsl-dev-table td, .wsl-dev-table th {
		border: 1px solid #dddddd;
		padding: 8px 10px;
		background-color: #fff;
		text-align: left;
	}
</style>

<?php 
    if (class_exists('Hybrid_Error', false) && Hybrid_Error::getApiError()) {
        ?>
			<h4>Provider API Error</h4>
			<table class="wsl-dev-table">
				<tr>
					<td>
						<?php 
        echo Hybrid_Error::getApiError();
        ?>
					</td>
				</tr>
			</table>
		<?php 
    }
    ?>

	<h4>SQL Queries</h4>
	<table class="wsl-dev-table">
		<tr>
			<td colspan="3">
				1. SAVEQUERIES should be defined and set to TRUE in order for the queries to show up (http://codex.wordpress.org/Editing_wp-config.php#Save_queries_for_analysis)
				<br />
				2. Calls for get_option() don't necessarily result on a query to the database. WP use both cache and wp_load_alloptions() to load all options at once. Hence, it won't be shown here.
			</td>
		</tr>
		<?php 
    $queries = $wpdb->queries;
    $total_wsl_queries = 0;
    $total_wsl_queries_time = 0;
    if ($queries) {
        foreach ($queries as $item) {
            $sql = trim($item[0]);
            $time = $item[1];
            $stack = $item[2];
            $sql = str_ireplace(array(' FROM ', ' WHERE ', ' LIMIT ', ' GROUP BY ', ' ORDER BY ', ' SET '), array("\n" . 'FROM ', "\n" . 'WHERE ', "\n" . 'LIMIT ', "\n" . 'GROUP BY ', "\n" . 'ORDER BY ', "\n" . 'SET '), $sql);
            # https://wordpress.org/plugins/query-monitor/
            $callers = explode(',', $stack);
            $caller = trim(end($callers));
            if (false !== strpos($caller, '(')) {
                $caller_name = substr($caller, 0, strpos($caller, '(')) . '()';
            } else {
                $caller_name = $caller;
//.........这里部分代码省略.........
开发者ID:designwall,项目名称:dw-social-login,代码行数:101,代码来源:wsl.utilities.php

示例2: wsl_process_login_render_error_page

/**
* Display an error message in case user authentication fails
*/
function wsl_process_login_render_error_page($e, $config = null, $provider = null, $adapter = null)
{
    // HOOKABLE:
    do_action("wsl_process_login_render_error_page", $e, $config, $provider, $adapter);
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/';
    $message = _wsl__("Unspecified error!", 'wordpress-social-login');
    $notes = "";
    $apierror = substr($e->getMessage(), 0, 145);
    switch ($e->getCode()) {
        case 0:
            $message = _wsl__("Unspecified error.", 'wordpress-social-login');
            break;
        case 1:
            $message = _wsl__("WordPress Social Login is not properly configured.", 'wordpress-social-login');
            break;
        case 2:
            $message = sprintf(__wsl__("WordPress Social Login is not properly configured.<br /> <b>%s</b> need to be properly configured.", 'wordpress-social-login'), $provider);
            break;
        case 3:
            $message = _wsl__("Unknown or disabled provider.", 'wordpress-social-login');
            break;
        case 4:
            $message = sprintf(_wsl__("WordPress Social Login is not properly configured.<br /> <b>%s</b> requires your application credentials.", 'wordpress-social-login'), $provider);
            $notes = sprintf(_wsl__("<b>What does this error mean ?</b><br />Most likely, you didn't setup the correct application credentials for this provider. These credentials are required in order for <b>%s</b> users to access your website and for WordPress Social Login to work.", 'wordpress-social-login'), $provider) . _wsl__('<br />Instructions for use can be found in the <a href="http://miled.github.io/wordpress-social-login/networks.html" target="_blank">User Manual</a>.', 'wordpress-social-login');
            break;
        case 5:
            $message = sprintf(_wsl__("Authentication failed. Either you have cancelled the authentication or <b>%s</b> refused the connection.", 'wordpress-social-login'), $provider);
            break;
        case 6:
            $message = sprintf(_wsl__("Request failed. Either you have cancelled the authentication or <b>%s</b> refused the connection.", 'wordpress-social-login'), $provider);
            break;
        case 7:
            $message = _wsl__("You're not connected to the provider.", 'wordpress-social-login');
            break;
        case 8:
            $message = _wsl__("Provider does not support this feature.", 'wordpress-social-login');
            break;
    }
    if (is_object($adapter)) {
        $adapter->logout();
    }
    // provider api response
    if (class_exists('Hybrid_Error', false) && Hybrid_Error::getApiError()) {
        $tmp = Hybrid_Error::getApiError();
        $apierror = $apierror . "\n" . '<br />' . $tmp;
        // network issue
        if (trim($tmp) == '0.') {
            $apierror = "Could not establish connection to provider API";
        }
    }
    return wsl_render_error_page($message, $notes, $provider, $apierror, $e);
}
开发者ID:NickIvanter,项目名称:wordpress-social-login,代码行数:55,代码来源:wsl.authentication.php

示例3: wsl_component_authtest


//.........这里部分代码省略.........
								<?php 
        }
        ?>
							</table>
						</div>
					</div>

					<?php 
        $console = false;
        if (!isset($adapter->openidIdentifier)) {
            ?>
						<div class="stuffbox">
							<h3>
								<label><?php 
            _wsl_e("Connected adapter console", 'wordpress-social-login');
            ?>
</label>
							</h3>
							<div class="inside">
								<?php 
            $path = isset($adapter->api->api_base_url) ? $adapter->api->api_base_url : '';
            $path = isset($_REQUEST['console-path']) ? $_REQUEST['console-path'] : $path;
            $method = isset($_REQUEST['console-method']) ? $_REQUEST['console-method'] : '';
            $query = isset($_REQUEST['console-query']) ? $_REQUEST['console-query'] : '';
            $response = '';
            if ($path && in_array($method, array('GET', 'POST'))) {
                $console = true;
                try {
                    if ($method == 'GET') {
                        $response = $adapter->api->get($path . ($query ? '?' . $query : ''));
                    } else {
                        $response = $adapter->api->get($path, $query);
                    }
                    $response = $response ? $response : Hybrid_Error::getApiError();
                } catch (Exception $e) {
                    $response = "ERROR: " . $e->getMessage();
                }
            }
            ?>
								<form action="" method="post"/>
									<table class="wp-list-table widefat">
										<tr>
											<th width="200"><label><?php 
            _wsl_e("Path", 'wordpress-social-login');
            ?>
</label></th>
											<td><input type="text" style="width:96%" name="console-path" value="<?php 
            echo htmlentities($path);
            ?>
"><a href="https://apigee.com/providers" target="_blank"><img src="<?php 
            echo $assets_base_url . 'question.png';
            ?>
" style="vertical-align: text-top;" /></a></td>
										</tr>
										<tr>
											<th width="200"><label><?php 
            _wsl_e("Method", 'wordpress-social-login');
            ?>
</label></th>
											<td><select style="width:100px" name="console-method"><option value="GET" <?php 
            if ($method == 'GET') {
                echo 'selected';
            }
            ?>
>GET</option><!-- <option value="POST" <?php 
            if ($method == 'POST') {
开发者ID:kingafrojoe,项目名称:wordpress-social-login,代码行数:67,代码来源:index.php


注:本文中的Hybrid_Error::getApiError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。