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


PHP is_a函数代码示例

本文整理汇总了PHP中is_a函数的典型用法代码示例。如果您正苦于以下问题:PHP is_a函数的具体用法?PHP is_a怎么用?PHP is_a使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: openfire_authenticate

function openfire_authenticate($user, $username, $password)
{
    global $openfire;
    $openfire->of_logInfo("openfire_authenticate 1 " . $username . " " . $password);
    if (!openfire_wants_to_login()) {
        return new WP_Error('user_logged_out', sprintf(__('You are now logged out of Azure AD.', AADSSO), $username));
    }
    // Don't re-authenticate if already authenticated
    if (strrpos($username, "@") == false || is_a($user, 'WP_User')) {
        return $user;
    }
    $openfire->of_logInfo("openfire_authenticate 2 ");
    // Try to find an existing user in WP where the UPN of the current AAD user is
    // (depending on config) the 'login' or 'email' field
    if ($username && $password && $openfire->of_authenticate_365($username, $password)) {
        $user = get_user_by("email", $username);
        if (!is_a($user, 'WP_User')) {
            $openfire->of_logInfo("openfire_authenticate 3");
            // Since the user was authenticated with AAD, but not found in WordPress,
            // need to decide whether to create a new user in WP on-the-fly, or to stop here.
            $openfire->of_logInfo("openfire_authenticate 4");
            $paras = explode("@", $username);
            $userid = $paras[0] . "." . $paras[1];
            $new_user_id = wp_create_user($userid, $password, $username);
            $user = new WP_User($new_user_id);
            $user->set_role('subscriber');
            $first_name = $openfire->of_get_given_name();
            $last_name = $openfire->get_family_name();
            $display_name = $first_name . " " . $last_name;
            wp_update_user(array('ID' => $new_user_id, 'display_name' => $display_name, 'first_name' => $first_name, 'last_name' => $last_name));
        }
    }
    return $user;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:34,代码来源:ofsocial.php

示例2: listCommands

 private static function listCommands()
 {
     $commands = array();
     $dir = __DIR__;
     if ($handle = opendir($dir)) {
         while (false !== ($entry = readdir($handle))) {
             if ($entry != "." && $entry != ".." && $entry != "base.php") {
                 $s1 = explode("cli_", $entry);
                 $s2 = explode(".php", $s1[1]);
                 if (sizeof($s2) == 2) {
                     require_once "{$dir}/{$entry}";
                     $command = $s2[0];
                     $className = "cli_{$command}";
                     $class = new $className();
                     if (is_a($class, "cliCommand")) {
                         $commands[] = $command;
                     }
                 }
             }
         }
         closedir($handle);
     }
     sort($commands);
     return implode(" ", $commands);
 }
开发者ID:Covert-Inferno,项目名称:zKillboard,代码行数:25,代码来源:cli_help.php

示例3: dataObjectEffect

 /**
  * @see DataObjectRequiredPolicy::dataObjectEffect()
  */
 function dataObjectEffect()
 {
     $reviewId = (int) $this->getDataObjectId();
     if (!$reviewId) {
         return AUTHORIZATION_DENY;
     }
     $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
     /* @var $reviewAssignmentDao ReviewAssignmentDAO */
     $reviewAssignment = $reviewAssignmentDao->getById($reviewId);
     if (!is_a($reviewAssignment, 'ReviewAssignment')) {
         return AUTHORIZATION_DENY;
     }
     // Ensure that the review assignment actually belongs to the
     // authorized submission.
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     assert(is_a($submission, 'Submission'));
     if ($reviewAssignment->getSubmissionId() != $submission->getId()) {
         AUTHORIZATION_DENY;
     }
     // Ensure that the review assignment is for this workflow stage
     $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
     if ($reviewAssignment->getStageId() != $stageId) {
         return AUTHORIZATION_DENY;
     }
     // Save the review Assignment to the authorization context.
     $this->addAuthorizedContextObject(ASSOC_TYPE_REVIEW_ASSIGNMENT, $reviewAssignment);
     return AUTHORIZATION_PERMIT;
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:31,代码来源:ReviewAssignmentRequiredPolicy.inc.php

示例4: encode

 function encode($src = null, $dest = null)
 {
     if (is_string($src)) {
         if (is_null($dest)) {
             if (!($src = fopen($src, 'r'))) {
                 return false;
             }
             while (!feof($src)) {
                 echo base64_encode(fread($src, 3 * 1024));
             }
             fclose($src);
             return true;
         } else {
             if (is_a($dest, 'Utils_OutputWriter')) {
                 if (!($src = fopen($src, 'r'))) {
                     return false;
                 }
                 while (!feof($src)) {
                     $dest->write(base64_encode(fread($src, 3 * 1024)));
                 }
                 fclose($src);
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:Avantians,项目名称:Textcube,代码行数:27,代码来源:Base64Stream.php

示例5: OrderBy

 /** Set the order of the comments. */
 public function OrderBy($Value = NULL)
 {
     if ($Value === NULL) {
         return $this->_OrderBy;
     }
     if (is_string($Value)) {
         $Value = array($Value);
     }
     if (is_array($Value)) {
         // Set the order of this object.
         $OrderBy = array();
         foreach ($Value as $Part) {
             if (StringEndsWith($Part, ' desc', TRUE)) {
                 $OrderBy[] = array(substr($Part, 0, -5), 'desc');
             } elseif (StringEndsWith($Part, ' asc', TRUE)) {
                 $OrderBy[] = array(substr($Part, 0, -4), 'asc');
             } else {
                 $OrderBy[] = array($Part, 'asc');
             }
         }
         $this->_OrderBy = $OrderBy;
     } elseif (is_a($Value, 'Gdn_SQLDriver')) {
         // Set the order of the given sql.
         foreach ($this->_OrderBy as $Parts) {
             $Value->OrderBy($Parts[0], $Parts[1]);
         }
     }
 }
开发者ID:TiGR,项目名称:Garden,代码行数:29,代码来源:class.commentmodel.php

示例6: testDOIAndURN

 /**
  * SCENARIO OUTLINE: Export article in DC format over OAI
  *   GIVEN a DOI and a URN have been assigned for a given {publishing object}
  *    WHEN I export the corresponding article in DC format over OAI
  *    THEN DOI and URN specific {DC fields} will be present in the OAI-message.
  *
  * EXAMPLES:
  *   publishing object | DC fields
  *   ==================|================================================
  *   issue             | <dc:source>10.4321/t.v1i1</dc:source>
  *   issue             | <dc:source>urn:nbn:de:0000-t.v1i19</dc:source>
  *   article           | <dc:identifier>10.4321/t.v1i1.1</dc:identifier>
  *   article           | <dc:identifier>urn:nbn:de:0000-t.v1i1.18</dc:identifier>
  *   galley            | <dc:relation>10.4321/t.v1i1.g1</dc:relation>
  *   galley            | <dc:relation>urn:nbn:de:0000-t.v1i1.1.g17</dc:relation>
  *   supp-file         | <dc:relation>10.4321/t.v1i1.s1</dc:relation>
  *   supp-file         | <dc:relation>urn:nbn:de:0000-t.v1i1.1.s19</dc:relation>
  */
 public function testDOIAndURN()
 {
     // Configure the web service request
     $params = array('verb' => 'GetRecord', 'metadataPrefix' => 'oai_dc', 'identifier' => 'oai:' . Config::getVar('oai', 'repository_id') . ':article/1');
     $this->webServiceRequest->setParams($params);
     // Check DOI node with XPath.
     $namespaces = array('oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/', 'dc' => 'http://purl.org/dc/elements/1.1/');
     $domXPath = $this->getXPath($namespaces);
     $testCases = array('/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:source' => array('urn:nbn:de:0000-t.v1i19', '10.1234/t.v1i1'), '/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:identifier' => array('urn:nbn:de:0000-t.v1i1.18', '10.1234/t.v1i1.1'), '/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:relation' => array('urn:nbn:de:0000-t.v1i1.1.g17', 'urn:nbn:de:0000-t.v1i1.1.s19', '10.1234/t.v1i1.1.g1', '10.1234/t.v1i1.1.s1'));
     foreach ($testCases as $xPath => $expectedDoiList) {
         $nodeList = $domXPath->query($xPath);
         self::assertGreaterThan(1, $nodeList->length, "Error while checking {$xPath}: No nodes found.");
         foreach ($expectedDoiList as $expectedDoi) {
             for ($index = 1; $index <= $nodeList->length; $index++) {
                 $node = $nodeList->item($index - 1);
                 // self::assertType() has been removed from PHPUnit 3.6
                 // but self::assertInstanceOf() is not present in PHPUnit 3.4
                 // which is our current test server version.
                 // FIXME: change this to assertInstanceOf() after upgrading the
                 // test server.
                 self::assertTrue(is_a($node, 'DOMNode'));
                 if ($node->textContent == $expectedDoi) {
                     break;
                 }
             }
             if ($index > $nodeList->length) {
                 self::fail("Error while checking {$xPath}: Node with {$expectedDoi} not found.");
             }
         }
     }
 }
开发者ID:utlib,项目名称:ojs,代码行数:49,代码来源:FunctionalOaiDcTestCase.php

示例7:

 function &setFrontendClass($uiclass)
 {
     if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) && is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], $uiclass)) {
         return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
     }
     if (!class_exists($uiclass)) {
         $file = str_replace('_', '/', $uiclass) . '.php';
         if (PEAR_Frontend::isIncludeable($file)) {
             include_once $file;
         }
     }
     if (class_exists($uiclass)) {
         $obj =& new $uiclass();
         // quick test to see if this class implements a few of the most
         // important frontend methods
         if (method_exists($obj, 'userConfirm')) {
             $GLOBALS['_PEAR_FRONTEND_SINGLETON'] =& $obj;
             $GLOBALS['_PEAR_FRONTEND_CLASS'] = $uiclass;
             return $obj;
         } else {
             $err = PEAR::raiseError("not a frontend class: {$uiclass}");
             return $err;
         }
     }
     $err = PEAR::raiseError("no such class: {$uiclass}");
     return $err;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:27,代码来源:Frontend.php

示例8: instance

 /**
  * Singleton implementation
  *
  * @return object
  */
 public static function instance()
 {
     if (!is_a(self::$__instance, 'Jetpack_Protect_Module')) {
         self::$__instance = new Jetpack_Protect_Module();
     }
     return self::$__instance;
 }
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:12,代码来源:protect.php

示例9: normalizeResponse

 private function normalizeResponse($response = null)
 {
     if ($response === null) {
         return new Response();
     }
     switch (gettype($response)) {
         case 'array':
         case 'boolean':
         case 'int':
         case 'double':
             return new Response(json_encode($response));
         case 'object':
             if (is_a($response, 'Response')) {
                 return $response;
             } else {
                 if (is_a($response, 'HTTPException')) {
                     return new Response(array('message' => $response->getMessage(), 'code' => $response->getCode()), $response->getCode());
                 } else {
                     return new Response(json_encode($response));
                 }
             }
         default:
             return new Response(json_encode($response));
     }
 }
开发者ID:NJIT-CS490-project,项目名称:CS490-backend-api,代码行数:25,代码来源:Router.php

示例10: civicrm_api3_membership_status_create

/**
 * Create a Membership Status
 *
 * This API is used for creating a Membership Status
 *
 * @param   array  $params  an associative array of name/value property values of civicrm_membership_status
 *
 * @return array of newly created membership status property values.
 * {@getfields MembershipStatus_create}
 * @access public
 */
function civicrm_api3_membership_status_create($params)
{
    civicrm_api3_verify_one_mandatory($params, 'CRM_Member_DAO_MembershipStatus', array('name', 'label'));
    //move before verifiy? DAO check requires?
    if (empty($params['name'])) {
        $params['name'] = CRM_Utils_Array::value('label', $params);
    }
    //don't allow duplicate names.
    require_once 'CRM/Member/DAO/MembershipStatus.php';
    $status = new CRM_Member_DAO_MembershipStatus();
    $status->name = $params['name'];
    if ($status->find(TRUE)) {
        return civicrm_api3_create_error(ts('A membership status with this name already exists.'));
    }
    require_once 'CRM/Member/BAO/MembershipStatus.php';
    $ids = array();
    $membershipStatusBAO = CRM_Member_BAO_MembershipStatus::add($params, $ids);
    if (is_a($membershipStatusBAO, 'CRM_Core_Error')) {
        return civicrm_api3_create_error("Membership is not created");
    } else {
        $values = array();
        $values['id'] = $membershipStatusBAO->id;
        $values['is_error'] = 0;
        return civicrm_api3_create_success($values, $params);
    }
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:37,代码来源:MembershipStatus.php

示例11: initialize

 /**
  * @copydoc GridRow::initialize()
  */
 function initialize($request, $template = null)
 {
     parent::initialize($request, $template);
     // Is this a new row or an existing row?
     $plugin =& $this->getData();
     /* @var $plugin Plugin */
     assert(is_a($plugin, 'Plugin'));
     $rowId = $this->getId();
     // Only add row actions if this is an existing row
     if (!is_null($rowId)) {
         $router = $request->getRouter();
         /* @var $router PKPRouter */
         $actionArgs = array_merge(array('plugin' => $plugin->getName()), $this->getRequestArgs());
         if ($this->_canEdit($plugin)) {
             foreach ($plugin->getActions($request, $actionArgs) as $action) {
                 $this->addAction($action);
             }
         }
         // Administrative functions.
         if (in_array(ROLE_ID_SITE_ADMIN, $this->_userRoles)) {
             import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
             $this->addAction(new LinkAction('delete', new RemoteActionConfirmationModal(__('manager.plugins.deleteConfirm'), __('common.delete'), $router->url($request, null, null, 'deletePlugin', null, $actionArgs), 'modal_delete'), __('common.delete'), 'delete'));
             $this->addAction(new LinkAction('upgrade', new AjaxModal($router->url($request, null, null, 'upgradePlugin', null, $actionArgs), __('manager.plugins.upgrade'), 'modal_upgrade'), __('grid.action.upgrade'), 'upgrade'));
         }
     }
 }
开发者ID:selwyntcy,项目名称:pkp-lib,代码行数:29,代码来源:PKPPluginGridRow.inc.php

示例12: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app['parameters'] = $this->app->share(function ($app) {
         return new Parameters();
     });
     // Find the default Controller class of the current Laravel application
     $controllerClass = $this->app['config']->get('authority-controller.controllerClass', 'Illuminate\\Routing\\Controller');
     $this->app->resolving(function ($object) use($controllerClass) {
         // Check if the current $object class is a Controller class and if it responds to paramsBeforeFilter method
         if (is_a($object, $controllerClass) && respond_to($object, 'paramsBeforeFilter')) {
             // Fill $params properties of the current controller
             $this->app['parameters']->fillController($object);
         }
     });
     $this->app['authority'] = $this->app->share(function ($app) {
         $user = $app['auth']->user();
         $authority = new Authority($user);
         $fn = $app['config']->get('authority-controller.initialize');
         $serializer = new Serializer();
         if (is_string($fn)) {
             $fn = $serializer->unserialize($fn);
         }
         if ($fn) {
             $fn($authority);
         }
         return $authority;
     });
     $this->app->bind('Efficiently\\AuthorityController\\ControllerResource', function ($app, $parameters) {
         list($controller, $resourceName, $resourceOptions) = $parameters;
         return new ControllerResource($controller, $resourceName, $resourceOptions);
     });
 }
开发者ID:abada,项目名称:authority-controller,代码行数:37,代码来源:AuthorityControllerServiceProvider.php

示例13: setForm

 /**
  * Set the form
  * @param $form object
  */
 function setForm($form)
 {
     if ($form) {
         assert(is_a($form, 'Form'));
     }
     $this->_form = $form;
 }
开发者ID:jack-cade-inc,项目名称:pkp-lib,代码行数:11,代码来源:FormBuilderVocabulary.inc.php

示例14: getSubmission

 /**
  * Get the authorized submission.
  * @return Submission
  */
 function getSubmission()
 {
     // We assume proper authentication by the data provider.
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     assert(is_a($submission, 'Submission'));
     return $submission;
 }
开发者ID:pkp,项目名称:pkp-lib,代码行数:11,代码来源:SelectableSubmissionFileListCategoryGridHandler.inc.php

示例15: Excluir

 /**
  * Excluí registro da tabela
  * @param int|ValueObject $VO_or_ID
  * @return boolean
  */
 public function Excluir($VO_or_ID = null)
 {
     try {
         $Value = $VO_or_ID;
         # Value Object
         if (is_a($Value, 'ValueObject')) {
             if ($Value->getTable() != $this->Table) {
                 throw new Exception('Inválido: ' . $Value->getTable() . ' != ' . $this->Table);
             } else {
                 if (!$Value->getId()) {
                     throw new Exception('Registro não se encontra na base de dados.');
                 }
             }
             $id = $Value->getId();
         } else {
             if (is_int($Value) or is_string($Value)) {
                 $id = $Value;
             } else {
                 throw new Exception('Precisa ser passado um ValueObject ou um Int para excluir um registro.');
             }
         }
         # Excluíndo
         $this->_Delete($this->Table, 'WHERE `id` = :id LIMIT 1', ['id' => $id]);
         # Excluí todas as imagens da ValueObject
         if (is_object($Value)) {
             $Value->imgDeleteAll();
         }
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage());
     }
 }
开发者ID:jhonlennon,项目名称:estrutura-mvc,代码行数:36,代码来源:Model.class.php


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