本文整理汇总了PHP中elgg_deprecated_notice函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_deprecated_notice函数的具体用法?PHP elgg_deprecated_notice怎么用?PHP elgg_deprecated_notice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_deprecated_notice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trigger
/**
* Triggers an Elgg event.
*
* @see elgg_trigger_event
* @see elgg_trigger_after_event
* @access private
*/
public function trigger($event, $type, $object = null, array $options = array())
{
$options = array_merge(array(self::OPTION_STOPPABLE => true, self::OPTION_DEPRECATION_MESSAGE => '', self::OPTION_DEPRECATION_VERSION => ''), $options);
$events = $this->hasHandler($event, $type);
if ($events && $options[self::OPTION_DEPRECATION_MESSAGE]) {
elgg_deprecated_notice($options[self::OPTION_DEPRECATION_MESSAGE], $options[self::OPTION_DEPRECATION_VERSION], 2);
}
$events = $this->getOrderedHandlers($event, $type);
$args = array($event, $type, $object);
foreach ($events as $callback) {
if (!is_callable($callback)) {
if ($this->logger) {
$this->logger->warn("handler for event [{$event}, {$type}] is not callable: " . $this->inspector->describeCallable($callback));
}
continue;
}
if ($this->timer && $type === 'system' && $event !== 'shutdown') {
$callback_as_string = $this->inspector->describeCallable($callback) . "()";
$this->timer->begin(["[{$event},{$type}]", $callback_as_string]);
$return = call_user_func_array($callback, $args);
$this->timer->end(["[{$event},{$type}]", $callback_as_string]);
} else {
$return = call_user_func_array($callback, $args);
}
if (!empty($options[self::OPTION_STOPPABLE]) && $return === false) {
return false;
}
}
return true;
}
示例2: __construct
/**
* Construct a new user entity, optionally from a given id value.
*
* @param mixed $guid If an int, load that GUID.
* If a db row then will attempt to load the rest of the data.
* @throws Exception if there was a problem creating the user.
*/
function __construct($guid = null)
{
$this->initialise_attributes();
if (!empty($guid)) {
// Is $guid is a DB row - either a entity row, or a user table row.
if ($guid instanceof stdClass) {
// Load the rest
if (!$this->load($guid->guid)) {
throw new IOException(sprintf(elgg_echo('IOException:FailedToLoadGUID'), get_class(), $guid->guid));
}
} else {
if ($guid instanceof ElggGroup) {
elgg_deprecated_notice('This type of usage of the ElggGroup constructor was deprecated. Please use the clone method.', 1.7);
foreach ($guid->attributes as $key => $value) {
$this->attributes[$key] = $value;
}
} else {
if ($guid instanceof ElggEntity) {
throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggGroup'));
} else {
if (is_numeric($guid)) {
if (!$this->load($guid)) {
throw new IOException(sprintf(elgg_echo('IOException:FailedToLoadGUID'), get_class(), $guid));
}
} else {
throw new InvalidParameterException(elgg_echo('InvalidParameterException:UnrecognisedValue'));
}
}
}
}
}
}
示例3: view_adm_permission
function view_adm_permission($entities, $vars = array(), $offset = 0, $limit = 10, $full_view = true, $listTypeToggle = true, $pagination = true)
{
if (!is_int($offset)) {
$offset = (int) get_input('offset', 0);
}
// list type can be passed as request parameter
$listType = get_input('list_type', 'list');
if (get_input('listtype')) {
elgg_deprecated_notice("'listtype' has been deprecated by 'list_type' for lists", 1.8);
$listType = get_input('listtype');
}
if (is_array($vars)) {
// new function
$defaults = array('items' => $entities, 'list_class' => 'elgg-list-entity', 'full_view' => true, 'pagination' => true, 'list_type' => $list_type, 'list_type_toggle' => false, 'offset' => $offset, 'limit' => null);
$vars = array_merge($defaults, $vars);
} else {
// old function parameters
elgg_deprecated_notice("Please update your use of elgg_view_entity_list()", 1.8);
$vars = array('items' => $entities, 'count' => (int) $vars, 'offset' => $offset, 'limit' => (int) $limit, 'full_view' => $full_view, 'pagination' => $pagination, 'list_type' => $list_type, 'list_type_toggle' => $listTypeToggle, 'list_class' => 'elgg-list-entity');
}
if (!$vars["limit"] && !$vars["offset"]) {
// no need for pagination if listing is unlimited
$vars["pagination"] = false;
}
if ($vars['view_path_list']) {
return elgg_view($vars['view_path_list'], $vars);
}
if ($vars['list_type'] != 'list') {
return elgg_view('page/components/gallery', $vars);
} else {
return elgg_view('page/components/list', $vars);
}
}
示例4: trigger
/**
* Triggers a plugin hook
*
* @see elgg_trigger_plugin_hook
* @access private
*/
public function trigger($hook, $type, $params = null, $returnvalue = null)
{
$hooks = $this->getOrderedHandlers($hook, $type);
foreach ($hooks as $callback) {
if (!is_callable($callback)) {
if ($this->logger) {
$inspector = new Inspector();
$this->logger->warn("handler for plugin hook [{$hook}, {$type}] is not callable: " . $inspector->describeCallable($callback));
}
continue;
}
$exit_warning = function () use($hook, $type, $callback) {
$inspector = new Inspector();
elgg_deprecated_notice("'{$hook}', '{$type}' plugin hook should not be used to serve a response. Instead return an " . "appropriate ResponseBuilder instance from an action or page handler. Do not terminate " . "code execution with exit() or die() in {$inspector->describeCallable($callback)}", '2.3');
};
if (in_array($hook, ['forward', 'action', 'route'])) {
_elgg_services()->events->registerHandler('shutdown', 'system', $exit_warning);
}
$args = array($hook, $type, $returnvalue, $params);
$temp_return_value = call_user_func_array($callback, $args);
if (!is_null($temp_return_value)) {
$returnvalue = $temp_return_value;
}
if (in_array($hook, ['forward', 'action', 'route'])) {
_elgg_services()->events->unregisterHandler('shutdown', 'system', $exit_warning);
}
}
return $returnvalue;
}
示例5: route
/**
* Routes the request to a registered page handler
*
* This function triggers a plugin hook `'route', $identifier` so that plugins can
* modify the routing or handle a request.
*
* @param Elgg_Http_Request $request The request to handle.
* @return boolean Whether the request was routed successfully.
* @access private
*/
public function route(Elgg_Http_Request $request)
{
$segments = $request->getUrlSegments();
if ($segments) {
$identifier = array_shift($segments);
} else {
$identifier = '';
// this plugin hook is deprecated. Use elgg_register_page_handler()
// to register for the '' (empty string) handler.
// allow plugins to override the front page (return true to indicate
// that the front page has been served)
$result = elgg_trigger_plugin_hook('index', 'system', null, false);
if ($result === true) {
elgg_deprecated_notice("The 'index', 'system' plugin has been deprecated. See elgg_front_page_handler()", 1.9);
exit;
}
}
// return false to stop processing the request (because you handled it)
// return a new $result array if you want to route the request differently
$result = array('identifier' => $identifier, 'handler' => $identifier, 'segments' => $segments);
$result = $this->hooks->trigger('route', $identifier, null, $result);
if ($result === false) {
return true;
}
$identifier = $result['identifier'];
$segments = $result['segments'];
$handled = false;
if (isset($this->handlers[$identifier]) && is_callable($this->handlers[$identifier])) {
$function = $this->handlers[$identifier];
$handled = call_user_func($function, $segments, $identifier);
}
return $handled || headers_sent();
}
示例6: __set
/**
* Set an attribute
*
* @param string $name Name
* @param mixed $value Value
* @return void
*/
public function __set($name, $value)
{
if ($name === 'access_id' && $this instanceof ElggMetadata && $value != ACCESS_PUBLIC) {
elgg_deprecated_notice('Setting ->access_id to a value other than ACCESS_PUBLIC is deprecated. ' . 'All metadata will be public in 3.0.', '2.3');
}
$this->attributes[$name] = $value;
if ($name == 'value') {
$this->attributes['value_type'] = detect_extender_valuetype($value);
}
}
示例7: elgg_register_widget_type
/**
* Register a widget type
*
* This should be called by plugins in their init function.
*
* @param string $handler The identifier for the widget handler
* @param string $name The name of the widget type
* @param string $description A description for the widget type
* @param array $context An array of contexts where this
* widget is allowed (default: array('all'))
* @param bool $multiple Whether or not multiple instances of this widget
* are allowed in a single layout (default: false)
*
* @return bool
* @since 1.8.0
*/
function elgg_register_widget_type($handler, $name, $description, $context = array('all'), $multiple = false)
{
if (is_string($context)) {
elgg_deprecated_notice('context parameters for elgg_register_widget_type() should be passed as an array())', 1.9);
$context = explode(",", $context);
} elseif (empty($context)) {
$context = array('all');
}
return _elgg_services()->widgets->registerType($handler, $name, $description, $context, $multiple);
}
示例8: widget_manager_add_widget_title_link
/**
* Register a widget title
*
* @deprecated 1.8. Use elgg_register_plugin_hook_handler("widget_url", "widget_manager")
*
* @param $handler
* @param $link
*/
function widget_manager_add_widget_title_link($handler, $link)
{
global $CONFIG;
elgg_deprecated_notice("widget_manager_add_widget_title_link() was deprecated by elgg_register_plugin_hook_handler('widget_url', 'widget_manager')", "1.8");
if (!empty($handler) && !empty($link)) {
if (isset($CONFIG->widgets) && isset($CONFIG->widgets->handlers) && isset($CONFIG->widgets->handlers[$handler])) {
$CONFIG->widgets->handlers[$handler]->link = $link;
}
}
}
示例9: elgg_delete_river
/**
* Delete river items
*
* @warning Does not fire permission hooks or delete, river events.
*
* @param array $options Parameters:
* ids => INT|ARR River item id(s)
* subject_guids => INT|ARR Subject guid(s)
* object_guids => INT|ARR Object guid(s)
* target_guids => INT|ARR Target guid(s)
* annotation_ids => INT|ARR The identifier of the annotation(s)
* action_types => STR|ARR The river action type(s) identifier
* views => STR|ARR River view(s)
*
* types => STR|ARR Entity type string(s)
* subtypes => STR|ARR Entity subtype string(s)
* type_subtype_pairs => ARR Array of type => subtype pairs where subtype
* can be an array of subtype strings
*
* posted_time_lower => INT The lower bound on the time posted
* posted_time_upper => INT The upper bound on the time posted
*
* @return bool
* @since 1.8.0
* @deprecated 2.3 Use elgg_get_river() and call delete() on the returned item(s)
*/
function elgg_delete_river(array $options = array())
{
global $CONFIG;
// allow core to use this in 2.x w/o warnings
if (empty($options['__bypass_notice'])) {
elgg_deprecated_notice(__FUNCTION__ . ' is deprecated. Use elgg_get_river() and call delete() on the returned item(s)', '2.3');
}
$defaults = array('ids' => ELGG_ENTITIES_ANY_VALUE, 'subject_guids' => ELGG_ENTITIES_ANY_VALUE, 'object_guids' => ELGG_ENTITIES_ANY_VALUE, 'target_guids' => ELGG_ENTITIES_ANY_VALUE, 'annotation_ids' => ELGG_ENTITIES_ANY_VALUE, 'views' => ELGG_ENTITIES_ANY_VALUE, 'action_types' => ELGG_ENTITIES_ANY_VALUE, 'types' => ELGG_ENTITIES_ANY_VALUE, 'subtypes' => ELGG_ENTITIES_ANY_VALUE, 'type_subtype_pairs' => ELGG_ENTITIES_ANY_VALUE, 'posted_time_lower' => ELGG_ENTITIES_ANY_VALUE, 'posted_time_upper' => ELGG_ENTITIES_ANY_VALUE, 'wheres' => array(), 'joins' => array());
$options = array_merge($defaults, $options);
$singulars = array('id', 'subject_guid', 'object_guid', 'target_guid', 'annotation_id', 'action_type', 'view', 'type', 'subtype');
$options = _elgg_normalize_plural_options_array($options, $singulars);
$wheres = $options['wheres'];
$wheres[] = _elgg_get_guid_based_where_sql('rv.id', $options['ids']);
$wheres[] = _elgg_get_guid_based_where_sql('rv.subject_guid', $options['subject_guids']);
$wheres[] = _elgg_get_guid_based_where_sql('rv.object_guid', $options['object_guids']);
$wheres[] = _elgg_get_guid_based_where_sql('rv.target_guid', $options['target_guids']);
$wheres[] = _elgg_get_guid_based_where_sql('rv.annotation_id', $options['annotation_ids']);
$wheres[] = _elgg_river_get_action_where_sql($options['action_types']);
$wheres[] = _elgg_river_get_view_where_sql($options['views']);
$wheres[] = _elgg_get_river_type_subtype_where_sql('rv', $options['types'], $options['subtypes'], $options['type_subtype_pairs']);
if ($options['posted_time_lower'] && is_int($options['posted_time_lower'])) {
$wheres[] = "rv.posted >= {$options['posted_time_lower']}";
}
if ($options['posted_time_upper'] && is_int($options['posted_time_upper'])) {
$wheres[] = "rv.posted <= {$options['posted_time_upper']}";
}
// see if any functions failed
// remove empty strings on successful functions
foreach ($wheres as $i => $where) {
if ($where === false) {
return false;
} elseif (empty($where)) {
unset($wheres[$i]);
}
}
// remove identical where clauses
$wheres = array_unique($wheres);
$query = "DELETE rv.* FROM {$CONFIG->dbprefix}river rv ";
// remove identical join clauses
$joins = array_unique($options['joins']);
// add joins
foreach ($joins as $j) {
$query .= " {$j} ";
}
// add wheres
$query .= ' WHERE ';
foreach ($wheres as $w) {
$query .= " {$w} AND ";
}
$query .= "1=1";
return delete_data($query);
}
示例10: route
/**
* Routes the request to a registered page handler
*
* This function triggers a plugin hook `'route', $identifier` so that plugins can
* modify the routing or handle a request.
*
* @param \Elgg\Http\Request $request The request to handle.
* @return boolean Whether the request was routed successfully.
* @access private
*/
public function route(\Elgg\Http\Request $request)
{
$segments = $request->getUrlSegments();
if ($segments) {
$identifier = array_shift($segments);
} else {
$identifier = '';
// this plugin hook is deprecated. Use elgg_register_page_handler()
// to register for the '' (empty string) handler.
// allow plugins to override the front page (return true to indicate
// that the front page has been served)
$result = _elgg_services()->hooks->trigger('index', 'system', null, false);
if ($result === true) {
elgg_deprecated_notice("The 'index', 'system' plugin has been deprecated. See elgg_front_page_handler()", 1.9);
exit;
}
}
// return false to stop processing the request (because you handled it)
// return a new $result array if you want to route the request differently
$result = array('identifier' => $identifier, 'handler' => $identifier, 'segments' => $segments);
if ($this->timer) {
$this->timer->begin(['build page']);
}
$result = $this->hooks->trigger('route', $identifier, $result, $result);
if ($result === false) {
return true;
}
if ($identifier != $result['identifier']) {
$identifier = $result['identifier'];
} else {
if ($identifier != $result['handler']) {
$identifier = $result['handler'];
}
}
$segments = $result['segments'];
$handled = false;
ob_start();
if (isset($this->handlers[$identifier]) && is_callable($this->handlers[$identifier])) {
$function = $this->handlers[$identifier];
$handled = call_user_func($function, $segments, $identifier);
}
$output = ob_get_clean();
$ajax_api = _elgg_services()->ajax;
if ($ajax_api->isReady()) {
$path = implode('/', $request->getUrlSegments());
$ajax_api->respondFromOutput($output, "path:{$path}");
return true;
}
echo $output;
return $handled || headers_sent();
}
示例11: translate
/**
* Given a message key, returns an appropriately translated full-text string
*
* @param string $message_key The short message code
* @param array $args An array of arguments to pass through vsprintf().
* @param string $language Optionally, the standard language code
* (defaults to site/user default, then English)
*
* @return string Either the translated string, the English string,
* or the original language string.
*/
function translate($message_key, $args = array(), $language = "")
{
static $CURRENT_LANGUAGE;
// old param order is deprecated
if (!is_array($args)) {
elgg_deprecated_notice('As of Elgg 1.8, the 2nd arg to elgg_echo() is an array of string replacements and the 3rd arg is the language.', 1.8);
$language = $args;
$args = array();
}
if (!isset($GLOBALS['_ELGG']->translations)) {
// this means we probably had an exception before translations were initialized
$this->registerTranslations($this->defaultPath);
}
if (!$CURRENT_LANGUAGE) {
$CURRENT_LANGUAGE = $this->getLanguage();
}
if (!$language) {
$language = $CURRENT_LANGUAGE;
}
if (!isset($GLOBALS['_ELGG']->translations[$language])) {
// The language being requested is not the same as the language of the
// logged in user, so we will have to load it separately. (Most likely
// we're sending a notification and the recipient is using a different
// language than the logged in user.)
_elgg_load_translations_for_language($language);
}
if (isset($GLOBALS['_ELGG']->translations[$language][$message_key])) {
$string = $GLOBALS['_ELGG']->translations[$language][$message_key];
} else {
if (isset($GLOBALS['_ELGG']->translations["en"][$message_key])) {
$string = $GLOBALS['_ELGG']->translations["en"][$message_key];
_elgg_services()->logger->notice(sprintf('Missing %s translation for "%s" language key', $language, $message_key));
} else {
$string = $message_key;
_elgg_services()->logger->notice(sprintf('Missing English translation for "%s" language key', $message_key));
}
}
// only pass through if we have arguments to allow backward compatibility
// with manual sprintf() calls.
if ($args) {
$string = vsprintf($string, $args);
}
return $string;
}
示例12: __construct
/**
* Construct a metadata object
*
* Plugin developers will probably never need to use this API. See \ElggEntity
* for its API for setting and getting metadata.
*
* @param \stdClass $row Database row as \stdClass object
*/
public function __construct($row = null)
{
$this->initializeAttributes();
if (!empty($row)) {
// Create from db row
if ($row instanceof \stdClass) {
$metadata = $row;
$objarray = (array) $metadata;
foreach ($objarray as $key => $value) {
$this->attributes[$key] = $value;
}
} else {
// get an \ElggMetadata object and copy its attributes
elgg_deprecated_notice('Passing an ID to constructor is deprecated. Use elgg_get_metadata_from_id()', 1.9);
$metadata = elgg_get_metadata_from_id($row);
$this->attributes = $metadata->attributes;
}
}
}
示例13: elgg_echo
/**
* Given a message key, returns an appropriately translated full-text string
*
* @param string $message_key The short message code
* @param array $args An array of arguments to pass through vsprintf().
* @param string $language Optionally, the standard language code
* (defaults to site/user default, then English)
*
* @return string Either the translated string, the English string,
* or the original language string.
*/
function elgg_echo($message_key, $args = array(), $language = "")
{
global $CONFIG;
static $CURRENT_LANGUAGE;
// old param order is deprecated
if (!is_array($args)) {
elgg_deprecated_notice('As of Elgg 1.8, the 2nd arg to elgg_echo() is an array of string replacements and the 3rd arg is the language.', 1.8);
$language = $args;
$args = array();
}
if (!$CURRENT_LANGUAGE) {
$CURRENT_LANGUAGE = get_language();
}
if (!$language) {
$language = $CURRENT_LANGUAGE;
}
if (!isset($CONFIG->translations[$language])) {
// The language being requested is not the same as the language of the
// logged in user, so we will have to load it separately. (Most likely
// we're sending a notification and the recipient is using a different
// language than the logged in user.)
_elgg_load_translations_for_language($language);
}
if (isset($CONFIG->translations[$language][$message_key])) {
$string = $CONFIG->translations[$language][$message_key];
} else {
if (isset($CONFIG->translations["en"][$message_key])) {
$string = $CONFIG->translations["en"][$message_key];
elgg_log(sprintf('Missing %s translation for "%s" language key', $language, $message_key), 'NOTICE');
} else {
$string = $message_key;
elgg_log(sprintf('Missing English translation for "%s" language key', $message_key), 'NOTICE');
}
}
// only pass through if we have arguments to allow backward compatibility
// with manual sprintf() calls.
if ($args) {
$string = vsprintf($string, $args);
}
return $string;
}
示例14: trigger
/**
* Triggers an Elgg event.
*
* @see elgg_trigger_event
* @see elgg_trigger_after_event
* @access private
*/
public function trigger($event, $type, $object = null, array $options = array())
{
$options = array_merge(array(self::OPTION_STOPPABLE => true, self::OPTION_DEPRECATION_MESSAGE => '', self::OPTION_DEPRECATION_VERSION => ''), $options);
$events = $this->getOrderedHandlers($event, $type);
if ($events && $options[self::OPTION_DEPRECATION_MESSAGE]) {
elgg_deprecated_notice($options[self::OPTION_DEPRECATION_MESSAGE], $options[self::OPTION_DEPRECATION_VERSION], 2);
}
$args = array($event, $type, $object);
foreach ($events as $callback) {
if (!is_callable($callback)) {
if ($this->logger) {
$this->logger->warn("handler for event [{$event}, {$type}] is not callable: " . $this->describeCallable($callback));
}
continue;
}
$return = call_user_func_array($callback, $args);
if (!empty($options[self::OPTION_STOPPABLE]) && $return === false) {
return false;
}
}
return true;
}
示例15: uservalidationbyemail_request_validation
/**
* Request user validation email.
* Send email out to the address and request a confirmation.
*
* @param int $user_guid The user's GUID
* @param bool $admin_requested Was it requested by admin
* @return mixed
*/
function uservalidationbyemail_request_validation($user_guid, $admin_requested = 'deprecated')
{
if ($admin_requested != 'deprecated') {
elgg_deprecated_notice('Second param $admin_requested no more used in uservalidationbyemail_request_validation function', 1.9);
}
$site = elgg_get_site_entity();
$user_guid = (int) $user_guid;
$user = get_entity($user_guid);
if ($user && $user instanceof ElggUser) {
// Work out validate link
$code = uservalidationbyemail_generate_code($user_guid, $user->email);
$link = "{$site->url}uservalidationbyemail/confirm?u={$user_guid}&c={$code}";
// Get email to show in the next page
elgg_get_session()->set('emailsent', $user->email);
$subject = elgg_echo('email:validate:subject', array($user->name, $site->name), $user->language);
$body = elgg_echo('email:validate:body', array($user->name, $site->name, $link, $site->name, $site->url), $user->language);
// Send validation email
$result = notify_user($user->guid, $site->guid, $subject, $body, array(), 'email');
return $result;
}
return FALSE;
}