Пример #1
0
            if (is_wp_error($user)) {
                if (strtolower($vars[1]) == 'json') {
                    $output['result'] = 'fail';
                    $output['error'] = $user->get_error_message();
                    echo json_encode($output);
                    exit;
                } else {
                    echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n";
                    echo "   <result>fail</error>\r\n";
                    echo "   <error><![CDATA[" . $user->get_error_message() . "]]></error>\r\n";
                    echo "</xml>";
                    exit;
                }
            } else {
                set_current_user($user->data->ID);
                $token = API_getCurrentUsersKey();
                if (strtolower($vars[1]) == 'json') {
                    $output['result'] = 'success';
                    $output['token'] = $token;
                    echo json_encode($output);
                } else {
                    echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n";
                    echo "   <result>success</error>\r\n";
                    echo "   <error>" . $token . "</error>\r\n";
                    echo "</xml>";
                }
                exit;
            }
        }
    }
}
Пример #2
0
    echo $Media['ID'];
    $CallName = $Media['ID'];
}
?>
            </td>
        </tr>
        
        <?php 
if ($apiAuth != 'open') {
    ?>
        <tr>
            <th scope="row" span="2">Key</th>
            <td>
                <?php 
    if ($apiAuth == 'key') {
        echo '<div>Your token: ' . API_getCurrentUsersKey() . '</div>';
        echo '<span class="description">This is the token for you. You\'ll need to call the Auth Method as indicated below to retrieve the other tokens.</span>';
    } else {
        echo $APIKey;
    }
    ?>
            </td>
        </tr>
        <?php 
}
?>


        <?php 
if ($apiAuth == 'key') {
    ?>