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


PHP object类代码示例

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


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

示例1: smarty_block_list_community_feeds

/**
 * Newscoop list_community_feeds block plugin
 *
 * Type:     block
 * Name:     community_feeds
 *
 * @param array $params
 * @param mixed $content
 * @param object $smarty
 * @param bool $repeat
 * @return string
 */
function smarty_block_list_community_feeds($params, $content, &$smarty, &$repeat)
{
    $context = $smarty->getTemplateVars('gimme');
    if (!isset($content)) {
        // init
        $start = $context->next_list_start('CommunityFeed');
        $list = new CommunityFeedsList($start, $params);
        if ($list->isEmpty()) {
            $context->setCurrentList($list, array());
            $context->resetCurrentList();
            $repeat = false;
            return;
        }
        $context->setCurrentList($list, array('community_feeds'));
        $context->community_feed = $context->current_community_feeds_list->current;
        $repeat = true;
    } else {
        // next
        $context->current_community_feeds_list->defaultIterator()->next();
        if (!is_null($context->current_community_feeds_list->current)) {
            $context->community_feed = $context->current_community_feeds_list->current;
            $repeat = true;
        } else {
            $context->resetCurrentList();
            $repeat = false;
        }
    }
    return $content;
}
开发者ID:nidzix,项目名称:Newscoop,代码行数:41,代码来源:block.list_community_feeds.php

示例2: smarty_function_url

/**
 * Campsite url function plugin
 *
 * Type:     function
 * Name:     url
 * Purpose:
 *
 * @param array $p_params
 * @param object $p_smarty
 *      The Smarty object
 *
 * @return string $urlString
 *      The full URL string
 */
function smarty_function_url($p_params, &$p_smarty)
{
    $context = $p_smarty->getTemplateVars('gimme');
    $validValues = array('true', 'false', 'http', 'https');
    if (isset($p_params['useprotocol']) && in_array($p_params['useprotocol'], $validValues)) {
        $useprotocol = $p_params['useprotocol'];
    } else {
        $useprotocol = $p_smarty->useprotocol;
    }
    switch ($useprotocol) {
        case 'true':
            $urlString = $context->url->base;
            break;
        case 'false':
            $urlString = $context->url->base_relative;
            break;
        case 'http':
            $urlString = 'http:' . $context->url->base_relative;
            break;
        case 'https':
            $urlString = 'https:' . $context->url->base_relative;
            break;
    }
    // appends the URI path and query values to the base
    $urlString .= smarty_function_uri($p_params, $p_smarty);
    return $urlString;
}
开发者ID:sourcefabric,项目名称:newscoop,代码行数:41,代码来源:function.url.php

示例3: env

 /**
  * Получить окружение ядака
  * @return  object 
  */
 public static final function env()
 {
     if (empty(self::$g4)) {
         self::start();
     }
     return self::$g4->decode(self::$g4);
 }
开发者ID:cheevauva,项目名称:trash,代码行数:11,代码来源:g4.class.php

示例4: dispatchCommand

 /**
  * @param object $command Pheanstalk_Command
  * @return object Pheanstalk_Response
  * @throws Pheanstalk_Exception_ClientException
  */
 public function dispatchCommand($command)
 {
     $socket = $this->_getSocket();
     $to_send = $command->getCommandLine() . self::CRLF;
     if ($command->hasData()) {
         $to_send .= $command->getData() . self::CRLF;
     }
     $socket->write($to_send);
     $responseLine = $socket->getLine();
     $responseName = preg_replace('#^(\\S+).*$#s', '$1', $responseLine);
     if (isset(self::$_errorResponses[$responseName])) {
         $exception = sprintf('Pheanstalk_Exception_Server%sException', self::$_errorResponses[$responseName]);
         throw new $exception(sprintf("%s in response to '%s'", $responseName, $command));
     }
     if (in_array($responseName, self::$_dataResponses)) {
         $dataLength = preg_replace('#^.*\\b(\\d+)$#', '$1', $responseLine);
         $data = $socket->read($dataLength);
         $crlf = $socket->read(self::CRLF_LENGTH);
         if ($crlf !== self::CRLF) {
             throw new Pheanstalk_Exception_ClientException(sprintf('Expected %u bytes of CRLF after %u bytes of data', self::CRLF_LENGTH, $dataLength));
         }
     } else {
         $data = null;
     }
     return $command->getResponseParser()->parseResponse($responseLine, $data);
 }
开发者ID:risyasin,项目名称:webpagetest,代码行数:31,代码来源:Connection.php

示例5: smarty_function_admincategorymenu

/**
 * Smarty function to display the category menu for admin links. This also adds the
 * navtabs.css to the page vars array for stylesheets.
 *
 * Admin
 * {admincategorymenu}
 *
 * @see          function.admincategorymenu.php::smarty_function_admincategoreymenu()
 * @param        array       $params      All attributes passed to this function from the template
 * @param        object      $view        Reference to the Zikula_View object
 * @return       string      the results of the module function
 */
function smarty_function_admincategorymenu($params, $view)
{
    PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Admin'));
    $modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
    $acid = ModUtil::apiFunc('AdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
    return ModUtil::func('AdminModule', 'admin', 'categorymenu', array('acid' => $acid));
}
开发者ID:planetenkiller,项目名称:core,代码行数:19,代码来源:function.admincategorymenu.php

示例6: _process

 /**
  * Helper function
  *
  * @param  object $module
  * @param  object $element
  * @param  integer $level
  */
 protected static function _process($module, $element, $level = 0)
 {
     global $warp;
     if ($level == 0) {
         $element->attr('class', 'uk-subnav');
     } else {
         $element->addClass('level' . ($level + 1));
     }
     foreach ($element->children('li') as $li) {
         // is active ?
         if ($active = $li->attr('data-menu-active')) {
             $active = ' uk-active';
         }
         // is parent ?
         $ul = $li->children('ul');
         $parent = $ul->length ? ' uk-parent' : null;
         // set class in li
         $li->attr('class', sprintf('level%d' . $parent . $active, $level + 1, $li->attr('data-id')));
         // set class in a/span
         foreach ($li->children('a,span') as $child) {
             // set image
             if ($image = $li->attr('data-menu-image')) {
                 $child->prepend('<img src="' . $image . '" alt="' . $child->text() . '" /> ');
             }
             // set icon
             if ($icon = $li->attr('data-menu-icon')) {
                 $child->prepend('<i class="' . $icon . '"></i> ');
             }
         }
         // process submenu
         if ($ul->length) {
             self::_process($module, $ul->item(0), $level + 1);
         }
     }
 }
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:42,代码来源:Subnav.php

示例7: scopeSlug

 /**
  * Get term with given slug(s)
  *
  * @param object       $query The query object
  * @param array|string $slug  The name(s) of the slug(s)
  *
  * @return object The query object
  */
 public function scopeSlug($query, $slug)
 {
     if (!is_array($slug)) {
         return $query->where('slug', $slug);
     }
     return $query->whereIn('slug', $slug);
 }
开发者ID:mohamedsharaf,项目名称:wordpressed,代码行数:15,代码来源:Term.php

示例8: edit

 /**
  * Display an edit icon for the article.
  *
  * This icon will not display in a popup window, nor if the article is trashed.
  * Edit access checks must be performed in the calling code.
  *
  * @param	object	$article	The article in question.
  * @param	object	$params		The article parameters
  * @param	array	$attribs	Not used??
  *
  * @return	string	The HTML for the article edit icon.
  * @since	1.6
  */
 static function edit($article, $params, $attribs = array())
 {
     // Initialise variables.
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $uri = JFactory::getURI();
     // Ignore if in a popup window.
     if ($params && $params->get('popup')) {
         return;
     }
     // Ignore if the state is negative (trashed).
     if ($article->state < 0) {
         return;
     }
     JHtml::_('behavior.tooltip');
     $url = 'index.php?task=article.edit&a_id=' . $article->id . '&return=' . base64_encode($uri);
     $icon = $article->state ? 'edit.png' : 'edit_unpublished.png';
     $text = JHTML::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), NULL, true);
     if ($article->state == 0) {
         $overlib = JText::_('JUNPUBLISHED');
     } else {
         $overlib = JText::_('JPUBLISHED');
     }
     $date = JHTML::_('date', $article->created);
     $author = $article->created_by_alias ? $article->created_by_alias : $article->author;
     $overlib .= '&lt;br /&gt;';
     $overlib .= $date;
     $overlib .= '&lt;br /&gt;';
     $overlib .= JText::sprintf('COM_CONTENT_WRITTEN_BY', htmlspecialchars($author, ENT_COMPAT, 'UTF-8'));
     $button = JHTML::_('link', JRoute::_($url), $text);
     $output = '<span class="hasTip" title="' . JText::_('COM_CONTENT_EDIT_ITEM') . ' :: ' . $overlib . '">' . $button . '</span>';
     return $output;
 }
开发者ID:reechalee,项目名称:joomla1.6,代码行数:46,代码来源:icon.php

示例9: getForm

 /**
  * Get form instance
  *
  * @return object
  */
 public function getForm()
 {
     // get form builder
     if (!$this->form) {
         // add extra options for the title
         $this->formElements['title']['description_params'] = [$this->widgetDescription];
         // add extra options for the cache ttl
         if ($this->showCacheSettings) {
             $this->formElements['cache_ttl']['description_params'] = [(int) SettingService::getSetting('application_dynamic_cache_life_time')];
             // add extra validators
             $this->formElements['cache_ttl']['validators'] = [['name' => 'callback', 'options' => ['callback' => [$this, 'validateCacheTtl'], 'message' => 'Enter a correct value']]];
         } else {
             unset($this->formElements['cache_ttl']);
         }
         // add extra options for the visibility settings
         if ($this->showVisibilitySettings) {
             // add visibility settings
             $this->formElements['visibility_settings']['values'] = AclService::getAclRoles(false, true);
         } else {
             unset($this->formElements['visibility_settings']);
         }
         // fill the form with default values
         $this->formElements['layout']['values'] = $this->model->getWidgetLayouts();
         $this->form = new ApplicationCustomFormBuilder($this->formName, $this->formElements, $this->translator, $this->ignoredElements, $this->notValidatedElements, $this->method);
     }
     return $this->form;
 }
开发者ID:spooner77,项目名称:dream-cms,代码行数:32,代码来源:PageWidgetSetting.php

示例10: parse

 /**
  * Parse template.
  *
  * @param string $moduleName    module name
  * @param string $methodName    method name
  * @access public
  * @return string
  */
 public function parse($moduleName, $methodName)
 {
     /* Register app, config, lang objects. */
     global $app, $config, $lang;
     $this->smarty->register_object('control', $this->control);
     $this->smarty->register_object('app', $app);
     $this->smarty->register_object('lang', $lang);
     $this->smarty->register_object('config', $config);
     /* Get view files from control. */
     $viewFile = $this->control->setViewFile($moduleName, $methodName);
     echo $viewFile;
     if (is_array($viewFile)) {
         extract($viewFile);
     }
     /* Assign hook files. */
     if (!isset($hookFiles)) {
         $hookFiles = array();
     }
     $this->smarty->assign('hookFiles', $hookFiles);
     /* Assign view variables. */
     foreach ($this->control->view as $item => $value) {
         $this->smarty->assign($item, $value);
     }
     /* Render the template and return it. */
     $output = $this->smarty->fetch($viewFile);
     echo $output;
     return $output;
 }
开发者ID:eric0614,项目名称:chanzhieps,代码行数:36,代码来源:parser.smarty.class.php

示例11: __construct

 /**
  * @param int|null|string $name
  * @param object $data
  */
 public function __construct($name, $data, $options)
 {
     parent::__construct($name);
     $pspList = $options->get('pspList');
     $pspArray = ['' => '-- Choose PSP --'];
     if ($pspList && $pspList->count()) {
         foreach ($pspList as $psp) {
             $pspArray[$psp->getId()] = $psp->getShortName();
         }
     }
     $this->setName($name);
     $name_attr = array('type' => 'text', 'class' => 'form-control', 'id' => 'name', 'maxlength' => 150, 'value' => $data->getName());
     $conciergeEmailAttr = ['type' => 'text', 'class' => 'form-control', 'id' => 'concierge_email', 'maxlength' => 255];
     $this->add(['name' => 'concierge_email', 'attributes' => $conciergeEmailAttr]);
     $this->add(array('name' => 'name', 'attributes' => $name_attr));
     $buttons_save = 'Save Changes';
     $this->add(array('name' => 'save_button', 'options' => array('label' => $buttons_save), 'attributes' => array('type' => 'button', 'class' => 'btn btn-primary state col-sm-2 col-xs-12 margin-left-10 pull-right', 'data-loading-text' => 'Saving...', 'id' => 'save_button', 'value' => 'Save')));
     $this->add(['name' => 'psp_id', 'type' => 'Zend\\Form\\Element\\Select', 'options' => ['label' => 'PSP', 'value_options' => $pspArray], 'attributes' => ['class' => 'form-control', 'id' => 'psp-id']]);
     if (is_object($data)) {
         $objectData = new \ArrayObject();
         $objectData['concierge_email'] = $data->getEmail();
         $objectData['psp_id'] = $data->getPspId();
         $this->bind($objectData);
     }
 }
开发者ID:arbi,项目名称:MyCode,代码行数:29,代码来源:ConciergeForm.php

示例12: __construct

 /**
  * Constructor
  * @param	object    $object   reference to targetobject (@link icms_ipf_Object)
  * @param	string    $key      the form name
  */
 public function __construct($object, $key)
 {
     icms_loadLanguageFile('system', 'blocksadmin', TRUE);
     parent::__construct(_AM_VISIBLEIN, ' ', $key . '_visiblein_tray');
     $visible_label = new icms_form_elements_Label('', '<select name="visiblein[]" id="visiblein[]" multiple="multiple" size="10">' . $this->getPageSelOptions($object->getVar('visiblein')) . '</select>');
     $this->addElement($visible_label);
 }
开发者ID:nao-pon,项目名称:impresscms,代码行数:12,代码来源:Page.php

示例13: salesOrderGridCollectionLoadBefore

 /**
  * Query the existing transaction codes with the id of the request and assembles an array with these codes.
  * @param object $observer - It is an object of Event of observe.
  */
 public function salesOrderGridCollectionLoadBefore($observer)
 {
     $collection = $observer->getOrderGridCollection();
     $select = $collection->getSelect();
     $tableCollection = Mage::getSingleton('core/resource')->getTableName('pagseguro_orders');
     $select->joinLeft(array('payment' => $tableCollection), 'payment.order_id = main_table.entity_id', array('payment_code' => 'transaction_code', 'payment_environment' => 'environment'));
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:11,代码来源:Observer.php

示例14: handle

 /**
  * This method determines what should be done with a given file and adds
  * it via {@link GroupTest::addTestFile()} if necessary.
  *
  * This method should be overriden to provide custom matching criteria,
  * such as pattern matching, recursive matching, etc.  For an example, see
  * {@link SimplePatternCollector::_handle()}.
  *
  * @param object $test      Group test with {@link GroupTest::addTestFile()} method.
  * @param string $filename  A filename as generated by {@link collect()}
  * @see collect()
  * @access protected
  */
 protected function handle(&$test, $file)
 {
     if (is_dir($file)) {
         return;
     }
     $test->addFile($file);
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:20,代码来源:collector.php

示例15: __construct

 /**
  * Create a new sqlite connector
  *
  * @param array
  */
 public function __construct($config)
 {
     extract($config);
     $dns = 'sqlite:' . $database;
     $this->pdo = new PDO($dns);
     $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 }
开发者ID:biggtfish,项目名称:anchor-cms,代码行数:12,代码来源:sqlite.php


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