本文整理汇总了PHP中FD::makeArray方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::makeArray方法的具体用法?PHP FD::makeArray怎么用?PHP FD::makeArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FD
的用法示例。
在下文中一共展示了FD::makeArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
/**
* Does a remote call to the server to fetch contents of a given url.
*
* @since 1.0
* @access public
*/
public function fetch()
{
// Check for request forgeries!
$urls = JRequest::getVar('urls');
// Ensure that the urls are in an array
FD::makeArray($urls);
// Get the current view.
$view = $this->getCurrentView();
// Result placeholder
$result = array();
if (!$urls || empty($urls)) {
$view->setMessage(JText::_('COM_EASYSOCIAL_CRAWLER_INVALID_URL_PROVIDED'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
$crawler = FD::get('Crawler');
foreach ($urls as $url) {
$hash = md5($url);
$link = FD::table('Link');
$exists = $link->load(array('hash' => $hash));
// If it doesn't exist, store it.
if (!$exists) {
$crawler->crawl($url);
$data = $crawler->getData();
$link->hash = $hash;
$link->data = FD::json()->encode($data);
// Store the new link
$link->store();
}
$result[$url] = FD::json()->decode($link->data);
}
return $view->call(__FUNCTION__, $result);
}
示例2: getParticipants
/**
* Retrieves a list of participants from a discussion
*
* @since 1.2
* @access public
* @param int The discussion id.
* @return
*/
public function getParticipants($id, $options = array())
{
$db = FD::db();
$sql = $db->sql();
$sql->column('DISTINCT( a.created_by )');
$sql->select('#__social_discussions', 'a');
if (FD::config()->get('users.blocking.enabled') && !JFactory::getUser()->guest) {
$sql->leftjoin('#__social_block_users', 'bus');
$sql->on('a.created_by', 'bus.user_id');
$sql->on('bus.target_id', JFactory::getUser()->id);
$sql->isnull('bus.id');
}
$sql->where('(');
$sql->where('a.parent_id', $id);
$sql->where('a.id', $id, '=', 'OR');
$sql->where(')');
$sql->where('a.state', SOCIAL_STATE_PUBLISHED);
$exclude = isset($options['exclude']) ? $options['exclude'] : '';
if ($exclude) {
$exclude = FD::makeArray($exclude);
$sql->where('a.created_by', $exclude, 'NOT IN');
}
$db->setQuery($sql);
$rows = $db->loadColumn();
if (!$rows) {
return $rows;
}
$users = FD::user($rows);
return $users;
}
示例3: onBeforeSave
public function onBeforeSave(&$post, &$group)
{
$value = !empty($post['eventcreate']) ? $post['eventcreate'] : '[]';
$params = $group->getParams();
$params->set('eventcreate', FD::makeArray($value));
$group->params = $params->toString();
unset($post['eventcreate']);
}
示例4: __construct
public function __construct($string = '', $args = array())
{
if (!empty($string)) {
$this->string = $string;
}
if (!empty($args)) {
$this->arguments = FD::makeArray($args);
}
}
示例5: togglePublish
public function togglePublish()
{
FD::checkToken();
$action = $this->getTask();
$ids = JRequest::getVar('cid');
$ids = FD::makeArray($ids);
$table = FD::table('Region');
$table->{$action}($ids);
$message = JText::_($action === 'publish' ? 'COM_EASYSOCIAL_REGIONS_PUBLISHED_SUCCESS' : 'COM_EASYSOCIAL_REGIONS_UNPUBLISHED_SUCCESS');
$this->view->setMessage($message, SOCIAL_MSG_SUCCESS);
return $this->view->call(__FUNCTION__);
}
示例6: form
public function form()
{
// Check for request forgeries
FD::checkToken();
$ids = JRequest::getVar('cid');
$ids = FD::makeArray($ids);
if (empty($ids)) {
$this->view->setMessage(JText::_('COM_EASYSOCIAL_MAINTENANCE_NO_SCRIPT_SELECTED'));
return $this->view->call(__FUNCTION__);
}
return $this->view->call(__FUNCTION__, $ids);
}
示例7: addDependency
/**
* Initializes files that are required by the module
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function addDependency($dependencies = array())
{
$dependencies = FD::makeArray($dependencies);
if (!$dependencies) {
return false;
}
// Determine what dependencies are required
foreach ($dependencies as $dependency) {
if (!method_exists($this, $dependency)) {
continue;
}
$this->{$dependency}();
}
}
示例8: allowed
/**
* Determines if the username is allowed
*
* @since 1.0
* @access public
* @param string The username to check against.
* @param JRegistry The field's registry.
* @return bool True if username is allowed, false otherwise.
*/
public static function allowed($username, &$params)
{
$disallowed = trim($params->get('disallowed', ''));
// If nothing is defined as allowed
if (empty($disallowed)) {
return true;
}
$disallowed = FD::makeArray($disallowed, ',');
if (empty($disallowed)) {
return true;
}
if (!in_array($username, $disallowed)) {
return true;
}
return false;
}
示例9: publish
public function publish()
{
FD::checkToken();
$ids = FD::makeArray(JRequest::getVar('cid'));
$view = $this->getCurrentView();
$task = $this->getTask();
if (empty($ids)) {
$view->setMessage(JText::_('COM_EASYSOCIAL_ACCESS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
foreach ($ids as $id) {
$acc = FD::table('accessrules');
$acc->load($id);
$acc->{$task}();
}
$message = $task === 'publish' ? 'COM_EASYSOCIAL_ACCESS_PUBLISHED_SUCCESSFULLY' : 'COM_EASYSOCIAL_ACCESS_UNPUBLISHED_SUCCESSFULLY';
$view->setMessage(JText::_($message), SOCIAL_MSG_SUCCESS);
return $view->call(__FUNCTION__);
}
示例10: delete
/**
* Deletes a label
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function delete()
{
// Check for request forgeries
FD::checkToken();
$ids = JRequest::getVar('cid');
$ids = FD::makeArray($ids);
$view = $this->getCurrentView();
if (empty($ids)) {
$view->setMessage(JText::_('COM_EASYSOCIAL_LABELS_EMPTY_ID_PROVIDED'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
foreach ($ids as $id) {
$label = FD::table('Label');
$label->load($id);
$label->delete();
}
$view->setMessage(JText::_('COM_EASYSOCIAL_LABELS_LABEL_DELETED_SUCCESSFULLY'), SOCIAL_MSG_SUCCESS);
return $view->call(__FUNCTION__);
}
示例11: allowed
/**
* Determines if the username is allowed
*
* @since 1.0
* @access public
* @param string The username to check against.
* @param JRegistry The field's registry.
* @return bool True if username is allowed, false otherwise.
*/
public static function allowed($username, &$params, $current = '')
{
// Exception for current
if (!empty($current) && $username === $current) {
return true;
}
$disallowed = trim($params->get('disallowed', ''));
// If nothing is defined as allowed
if (empty($disallowed)) {
return true;
}
$disallowed = FD::makeArray($disallowed, ',');
if (empty($disallowed)) {
return true;
}
if (!in_array($username, $disallowed)) {
return true;
}
return false;
}
示例12: remove
/**
* Deletes an album from the site
*
* @since 1.0
* @access public
*/
public function remove()
{
// Check for request forgeries
FD::checkToken();
// Get the current view
$view = $this->getCurrentView();
// Get the list of ids
$ids = JRequest::getVar('cid');
// Ensure that the id's are in an array
$ids = FD::makeArray($ids);
foreach ($ids as $id) {
$album = FD::table('Album');
$album->load($id);
$album->delete();
// @points: photos.albums.delete
// Deduct points from creator when his album is deleted.
$album->assignPoints('photos.albums.delete', $album->uid);
}
$view->setMessage(JText::_('COM_EASYSOCIAL_ALBUMS_ALBUM_DELETED_SUCCESSFULLY'), SOCIAL_MSG_SUCCESS);
return $view->call(__FUNCTION__);
}
示例13: getStream
/**
* Retrieves the stream contents.
*
* @since 1.0
* @access public
*/
public function getStream($stream, $type = '', $hashtags = array())
{
$ajax = FD::ajax();
if ($this->hasErrors()) {
return $ajax->reject($this->getMessage());
}
$streamCnt = $stream->getCount();
// Initialize the default ids
$groupId = false;
$eventId = false;
// Retrieve the story lib
$story = FD::get('Story', SOCIAL_TYPE_USER);
// Get the tags
if ($hashtags) {
$hashtags = FD::makeArray($hashtags);
$story->setHashtags($hashtags);
}
if ($type == SOCIAL_TYPE_GROUP) {
$story = FD::get('Story', $type);
$groupId = $this->input->getInt('id', 0);
$story->setCluster($groupId, $type);
$story->showPrivacy(false);
}
if ($type == SOCIAL_TYPE_EVENT) {
$story = FD::get('Story', $type);
$eventId = $this->input->getInt('id', 0);
$story->setCluster($eventId, $type);
$story->showPrivacy(false);
}
$stream->story = $story;
$theme = FD::themes();
$theme->set('eventId', $eventId);
$theme->set('groupId', $groupId);
$theme->set('hashtag', false);
$theme->set('stream', $stream);
$theme->set('story', $story);
$theme->set('streamcount', $streamCnt);
$contents = $theme->output('site/dashboard/feeds');
return $ajax->resolve($contents, $streamCnt);
}
示例14: removeFile
/**
* Removes a file from a group.
*
* @since 1.2
* @access public
* @return mixed True if success, exception if false.
*/
public function removeFile()
{
// Check if the user has access to delete files from this group
if (!$this->group->isMember()) {
return FD::exception(JText::_('COM_EASYSOCIAL_EXPLORER_NO_ACCESS_TO_DELETE'));
}
// Get the file id
$ids = JRequest::getInt('id');
$ids = FD::makeArray($ids);
foreach ($ids as $id) {
$file = FD::table('File');
$file->load($id);
if (!$id || !$file->id) {
return FD::exception(JText::_('COM_EASYSOCIAL_EXPLORER_INVALID_FILE_ID_PROVIDED'));
}
$state = $file->delete();
if (!$state) {
return FD::exception(JText::_($file->getError()));
}
}
return true;
}
示例15: publish
/**
* Publishes a point
*
* @since 1.0
* @access public
*/
public function publish()
{
// Check for request forgeries.
FD::checkToken();
$id = JRequest::getVar('cid');
// Get current view
$view = $this->getCurrentView();
// Get current task
$task = $this->getTask();
// Ensure that it's an array.
$ids = FD::makeArray($id);
if (empty($id)) {
$view->setMessage(JText::_('COM_EASYSOCIAL_POINTS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
foreach ($ids as $id) {
$point = FD::table('Points');
$point->load($id);
$point->{$task}();
}
$message = $task == 'publish' ? 'COM_EASYSOCIAL_POINTS_PUBLISHED_SUCCESSFULLY' : 'COM_EASYSOCIAL_POINTS_UNPUBLISHED_SUCCESSFULLY';
$view->setMessage(JText::_($message), SOCIAL_MSG_SUCCESS);
return $view->call(__FUNCTION__);
}