本文整理汇总了PHP中stdClass类的典型用法代码示例。如果您正苦于以下问题:PHP stdClass类的具体用法?PHP stdClass怎么用?PHP stdClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了stdClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Displays the 'tagcloud' display type
*
* @param stdClass|C_Displayed_Gallery|C_DataMapper_Model $displayed_gallery
*/
function index_action($displayed_gallery, $return = FALSE)
{
$display_settings = $displayed_gallery->display_settings;
$application = $this->object->get_registry()->get_utility('I_Router')->get_routed_app();
$tag = $this->param('gallerytag');
// we're looking at a tag, so show images w/that tag as a thumbnail gallery
if (!is_home() && !empty($tag)) {
return $this->object->get_registry()->get_utility('I_Displayed_Gallery_Renderer')->display_images(array('source' => 'tags', 'container_ids' => array(esc_attr($tag)), 'display_type' => $display_settings['display_type'], 'original_display_type' => $displayed_gallery->display_type, 'original_settings' => $display_settings));
}
$defaults = array('exclude' => '', 'format' => 'list', 'include' => $displayed_gallery->get_term_ids_for_tags(), 'largest' => 22, 'link' => 'view', 'number' => $display_settings['number'], 'order' => 'ASC', 'orderby' => 'name', 'smallest' => 8, 'taxonomy' => 'ngg_tag', 'unit' => 'pt');
$args = wp_parse_args('', $defaults);
// Always query top tags
$tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
foreach ($tags as $key => $tag) {
$tags[$key]->link = $this->object->set_param_for($application->get_routed_url(TRUE), 'gallerytag', $tag->slug);
$tags[$key]->id = $tag->term_id;
}
$params = $display_settings;
$params['inner_content'] = $displayed_gallery->inner_content;
$params['storage'] =& $storage;
$params['tagcloud'] = wp_generate_tag_cloud($tags, $args);
$params['displayed_gallery_id'] = $displayed_gallery->id();
$params = $this->object->prepare_display_parameters($displayed_gallery, $params);
return $this->object->render_partial('photocrati-nextgen_basic_tagcloud#nextgen_basic_tagcloud', $params, $return);
}
示例2: searchByName
public function searchByName($company_name)
{
$params = new stdClass();
$params->externalNameSearch($company_name);
$params->authenticationGuid = $this->guid;
return $this->ABRSearchByName($params);
}
示例3: user_loggedin
/**
* Triggered via the user_loggedin event, when a user logs in.
*
* @param stdClass $event
*/
public static function user_loggedin($event)
{
global $DB;
$eventdata = $event->get_data();
if (!enrol_is_enabled('auto')) {
return;
}
if (is_siteadmin($eventdata['userid'])) {
// Don't enrol site admins
return;
}
// Get all courses that have an auto enrol plugin, set to auto enrol on login, where the user isn't enrolled yet
$sql = "SELECT e.courseid\n FROM {enrol} e\n LEFT JOIN {user_enrolments} ue ON e.id = ue.enrolid AND ue.userid = ?\n WHERE e.enrol = 'auto'\n AND e.status = ?\n AND e.customint3 = ?\n AND ue.id IS NULL";
if (!($courses = $DB->get_records_sql($sql, array($eventdata['userid'], ENROL_INSTANCE_ENABLED, ENROL_AUTO_LOGIN)))) {
return;
}
$autoplugin = enrol_get_plugin('auto');
foreach ($courses as $course) {
if (!($instance = $autoplugin->get_instance_for_course($course->courseid))) {
continue;
}
$autoplugin->enrol_user($instance, $eventdata['userid'], $instance->roleid);
// Send welcome message.
if ($instance->customint2) {
$autoplugin = enrol_get_plugin('auto');
$autoplugin->email_welcome_message($instance, $DB->get_record('user', array('id' => $eventdata['userid'])));
}
}
}
示例4: setup
/**
* Prepares component
*
* @param stdClass $database
*/
public static function setup($database)
{
if (!isset($database->adapter)) {
throw new \Phalcon\Exception('Unspecified database Adapter in your configuration!');
}
$adapter = '\\Phalcon\\Db\\Adapter\\Pdo\\' . $database->adapter;
if (!class_exists($adapter)) {
throw new \Phalcon\Exception('Invalid database Adapter!');
}
$configArray = $database->toArray();
unset($configArray['adapter']);
self::$_connection = new $adapter($configArray);
self::$_databaseConfig = $database;
$profiler = new Profiler();
$eventsManager = new EventsManager();
$eventsManager->attach('db', function ($event, $connection) use($profiler) {
if ($event->getType() == 'beforeQuery') {
$profiler->startProfile($connection->getSQLStatement());
}
if ($event->getType() == 'afterQuery') {
$profiler->stopProfile();
}
});
self::$_connection->setEventsManager($eventsManager);
}
示例5: rand
/**
* Displays the ngglegacy thumbnail gallery.
* This method deprecates the use of the nggShowGallery() function.
* @param stdClass|C_Displayed_Gallery|C_DataMapper_Model $displayed_gallery
*/
function index_action($displayed_gallery, $return = FALSE)
{
// Get the images to be displayed
$current_page = (int) $this->param('nggpage', 1);
if ($images = $displayed_gallery->get_included_entities()) {
// Get the gallery storage component
$storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
// Create parameter list for the view
$params = $displayed_gallery->display_settings;
$params['storage'] =& $storage;
$params['images'] =& $images;
$params['displayed_gallery_id'] = $displayed_gallery->id();
$params['current_page'] = $current_page;
$params['effect_code'] = $this->object->get_effect_code($displayed_gallery);
$params['anchor'] = 'ngg-slideshow-' . $displayed_gallery->id() . '-' . rand(1, getrandmax()) . $current_page;
$gallery_width = $displayed_gallery->display_settings['gallery_width'];
$gallery_height = $displayed_gallery->display_settings['gallery_height'];
$params['aspect_ratio'] = $gallery_width / $gallery_height;
$params['placeholder'] = $this->object->get_static_url('photocrati-nextgen_basic_gallery#slideshow/placeholder.gif');
// Are we to generate a thumbnail link?
if ($displayed_gallery->display_settings['show_thumbnail_link']) {
$params['thumbnail_link'] = $this->object->get_url_for_alternate_display_type($displayed_gallery, NGG_BASIC_THUMBNAILS);
}
$params = $this->object->prepare_display_parameters($displayed_gallery, $params);
$retval = $this->object->render_partial('photocrati-nextgen_basic_gallery#slideshow/index', $params, $return);
} else {
$retval = $this->object->render_partial('photocrati-nextgen_gallery_display#no_images_found', array(), $return);
}
return $retval;
}
示例6: exact
/**
* @param \stdClass $object
*/
function it_wraps_non_token_arguments_into_ExactValueToken($object)
{
$this->beConstructedWith(array(42, 'zet', $object));
$class = get_class($object->getWrappedObject());
$hash = spl_object_hash($object->getWrappedObject());
$this->__toString()->shouldReturn("exact(42), exact(\"zet\"), exact({$class}:{$hash} Object (\n 'objectProphecy' => Prophecy\\Prophecy\\ObjectProphecy Object (*Prophecy*)\n))");
}
示例7: getStorageId
/**
* @internal
* @param IQuery|stdClass $query
* @return string
* @internal
*/
public function getStorageId($query)
{
if ($query instanceof IVoidQuery) {
return $query->getStorageType() . '|' . $query->getDatabaseName();
}
// else is aggregation, stdClass
return $query->storageType . '|' . $query->databaseName;
}
示例8: profile
/**
* Generate a link to an user profile of a social platform.
*
* <code>
* $avatar = JHtml::_("userideas.profile", $socialProfiles, $userId, "javascript: void(0);");
* </code>
*
* @param stdClass $socialProfiles Social profiles object.
* @param integer $userId User ID
* @param string $default A link to default profile.
*
* @return string
*/
public static function profile($socialProfiles, $userId, $default = null)
{
$link = !$socialProfiles ? null : $socialProfiles->getLink($userId);
// Set the link to default picture
if (!$link and $default !== null) {
$link = $default;
}
return $link;
}
示例9: storeParams
/**
* Stores Plugin params to the DB. Used after setting new param values.
* @param stdClass $params the Joomla params object.
* Typically you would send $this->params from the plugin class to this method,
* after setting new values with $this->params->set('param_name', $value);
* @param string $element The plugin element in small caps without
* plgSystem, for example the plugin plgSystemAutofbook would be autofbook.
* Check the db for correct name
*/
public static function storeParams($params, $element)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->update('#__extensions');
$query->set('params = ' . $db->quote($params->toString()));
$query->where('element = ' . $db->quote($element));
$db->setQuery($query);
$db->query();
}
示例10: block_informationspot_pluginfile
/**
* Form for editing Information Spot block instances.
*
* @copyright 2014 Roberto Pinna
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package block_informationspot
* @category files
* @param stdClass $course course object
* @param stdClass $birecord_or_cm block instance record
* @param stdClass $context context object
* @param string $filearea file area
* @param array $args extra arguments
* @param bool $forcedownload whether or not force download
* @param array $options additional options affecting the file serving
* @return bool
*/
function block_informationspot_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
global $DB, $CFG, $USER;
if ($context->contextlevel != CONTEXT_BLOCK) {
send_file_not_found();
}
// If block is in course context, then check if user has capability to access course.
if ($context->get_course_context(false)) {
require_course_login($course);
} else {
if ($CFG->forcelogin) {
require_login();
} else {
// Get parent context and see if user have proper permission.
$parentcontext = $context->get_parent_context();
if ($parentcontext->contextlevel === CONTEXT_COURSECAT) {
// Check if category is visible and user can view this category.
$category = $DB->get_record('course_categories', array('id' => $parentcontext->instanceid), '*', MUST_EXIST);
if (!$category->visible) {
require_capability('moodle/category:viewhiddencategories', $parentcontext);
}
} else {
if ($parentcontext->contextlevel === CONTEXT_USER && $parentcontext->instanceid != $USER->id) {
// The block is in the context of a user, it is only visible to the user who it belongs to.
send_file_not_found();
}
}
// At this point there is no way to check SYSTEM context, so ignoring it.
}
}
if ($filearea != 'image') {
send_file_not_found();
}
$fs = get_file_storage();
$imageid = array_shift($args);
$filename = array_pop($args);
$filepath = $args ? '/' . implode('/', $args) . '/' : '/';
if (!($file = $fs->get_file($context->id, 'block_informationspot', $filearea, $imageid, $filepath, $filename)) or $file->is_directory()) {
send_file_not_found();
}
if ($parentcontext = context::instance_by_id($birecord_or_cm->parentcontextid, IGNORE_MISSING)) {
if ($parentcontext->contextlevel == CONTEXT_USER) {
// force download on all personal pages including /my/
//because we do not have reliable way to find out from where this is used
$forcedownload = true;
}
} else {
// weird, there should be parent context, better force dowload then
$forcedownload = true;
}
// NOTE: it woudl be nice to have file revisions here, for now rely on standard file lifetime,
// do not lower it because the files are dispalyed very often.
\core\session\manager::write_close();
send_stored_file($file, null, 0, $forcedownload, $options);
}
示例11: add_course_navigation
/**
* Sets up navigation entries.
*
* @param stdClass $instancesnode
* @param stdClass $instance
* @return void
*/
public function add_course_navigation($instancesnode, stdClass $instance)
{
if ($instance->enrol !== 'auto') {
throw new coding_exception('Invalid enrol instance type!');
}
$context = context_course::instance($instance->courseid);
if (has_capability('enrol/auto:config', $context)) {
$managelink = new moodle_url('/enrol/auto/edit.php', array('courseid' => $instance->courseid, 'id' => $instance->id));
$instancesnode->add($this->get_instance_name($instance), $managelink, navigation_node::TYPE_SETTING);
}
}
示例12: hasQueueTables
/**
* Checks for existence of message queue tables
*
* Should probably examine the contents as well, but this
* will do for now
* @param stdClass $db
* @return boolean
*/
private function hasQueueTables($db)
{
try {
$db->describeTable('message');
} catch (Exception $e) {
return false;
}
try {
$db->describeTable('queue');
} catch (Exception $e) {
return false;
}
return true;
}
示例13: playerTotal
/**
* Returns playerTotal if player has a playerTotal
* else returns a stdClass with id set to 0
*
* @return stdClass or PlayerTotal
*/
public function playerTotal()
{
$pt = $this->alias->playerTotal();
if ($pt->first() == null) {
$pt = new \stdClass();
$pt->id = 0;
$pt->name = "Unknown";
$pt->rank = new \stdClass();
$pt->rank->id = 1;
$pt->rank->shortname = 'NON';
$pt->rank->name = "None";
return $pt;
}
return $pt->first();
}
示例14: getServices
/**
* Get the services
*
* @return \SeBuDesign\Buckaroo\Soap\Types\Responses\TransactionRequestSpecification\Services
*/
public function getServices()
{
$mServiceDescriptions = $this->Services->ServiceDescription;
$this->Services = new Services();
$this->Services->setServiceDescriptions($mServiceDescriptions);
return $this->Services;
}
示例15: render
/**
* Render the templates
*
* @param \Nette\Forms\Form $form
* @param string $mode
*
* @return void
*/
public function render(Nette\Forms\Form $form, $mode = NULL)
{
if ($this->form !== $form) {
$this->form = $form;
// translators
if ($translator = $this->form->getTranslator()) {
$this->template->setTranslator($translator);
}
// controls placeholders & classes
foreach ($this->form->getControls() as $control) {
$this->prepareControl($control);
}
$formEl = $form->getElementPrototype();
if (!$formEl->class || stripos('form-', (string) $formEl->class) === FALSE) {
$formEl->addClass('form-horizontal');
}
}
$this->template->form = $this->form;
$this->template->_form = $this->form;
$this->template->renderer = $this;
if ($mode === NULL) {
$this->template->render();
} elseif ($mode === 'begin') {
FormMacros::renderFormBegin($this->form, array());
} elseif ($mode === 'end') {
FormMacros::renderFormEnd($this->form);
} else {
$this->template->setFile(__DIR__ . '/@parts.latte');
$this->template->mode = $mode;
$this->template->render();
$this->template->setFile(__DIR__ . '/@form.latte');
}
}