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


PHP get_input函数代码示例

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


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

示例1: deleteRequest

 /**
  * Listen to the delete of a membership request
  *
  * @param stirng            $event        the name of the event
  * @param stirng            $type         the type of the event
  * @param \ElggRelationship $relationship the relationship
  *
  * @return void
  */
 public static function deleteRequest($event, $type, $relationship)
 {
     if (!$relationship instanceof \ElggRelationship) {
         return;
     }
     if ($relationship->relationship !== 'membership_request') {
         // not a membership request
         return;
     }
     $action_pattern = '/action\\/groups\\/killrequest/i';
     if (!preg_match($action_pattern, current_page_url())) {
         // not in the action, so do nothing
         return;
     }
     $group = get_entity($relationship->guid_two);
     $user = get_user($relationship->guid_one);
     if (empty($user) || !$group instanceof \ElggGroup) {
         return;
     }
     if ($user->getGUID() === elgg_get_logged_in_user_guid()) {
         // user kills own request
         return;
     }
     $reason = get_input('reason');
     if (empty($reason)) {
         $body = elgg_echo('group_tools:notify:membership:declined:message', array($user->name, $group->name, $group->getURL()));
     } else {
         $body = elgg_echo('group_tools:notify:membership:declined:message:reason', array($user->name, $group->name, $reason, $group->getURL()));
     }
     $subject = elgg_echo('group_tools:notify:membership:declined:subject', array($group->name));
     $params = array('object' => $group, 'action' => 'delete');
     notify_user($user->getGUID(), $group->getGUID(), $subject, $body, $params);
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:42,代码来源:Membership.php

示例2: spam_login_filter_verify_action_hook

function spam_login_filter_verify_action_hook($hook, $entity_type, $returnvalue, $params)
{
    //Check against stopforumspam and domain blacklist
    $email = get_input('email');
    $ip = spam_login_filter_get_ip();
    if (spam_login_filter_check_spammer($email, $ip)) {
        return true;
    } else {
        //Check if the ip exists
        $options = array("type" => "object", "subtype" => "spam_login_filter_ip", "metadata_name_value_pairs" => array("name" => "ip_address", "value" => $ip), "count" => TRUE);
        $ia = elgg_set_ignore_access(true);
        $spam_login_filter_ip_list = elgg_get_entities_from_metadata($options);
        if ($spam_login_filter_ip_list == 0) {
            //Create the banned ip
            $ip_obj = new ElggObject();
            $ip_obj->subtype = 'spam_login_filter_ip';
            $ip_obj->access_id = ACCESS_PRIVATE;
            $ip_obj->ip_address = $ip;
            $ip_obj->owner_guid = elgg_get_site_entity()->guid;
            $ip_obj->container_guid = elgg_get_site_entity()->guid;
            $ip_obj->save();
        }
        elgg_set_ignore_access($ia);
        //return false;
        forward();
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:27,代码来源:start.php

示例3: embed_page_handler

/**
 * Serves pages for upload and embed.
 *
 * @param $page
 */
function embed_page_handler($page)
{
    if (!isset($page[0])) {
        $page[0] = 'embed';
    }
    switch ($page[0]) {
        case 'upload':
            echo elgg_view('embed/upload');
            break;
        case 'embed':
        default:
            // trigger hook to get section tabs
            // use views for embed/section/
            //	listing
            //	item
            // default to embed/listing | item if not found.
            // @todo trigger for all right now. If we categorize these later we can trigger
            // for certain categories.
            $sections = elgg_trigger_plugin_hook('embed_get_sections', 'all', NULL, array());
            $upload_sections = elgg_trigger_plugin_hook('embed_get_upload_sections', 'all', NULL, array());
            elgg_sort_3d_array_by_value($sections, 'name');
            elgg_sort_3d_array_by_value($upload_sections, 'name');
            $active_section = get_input('active_section', NULL);
            $internal_name = get_input('internal_name', NULL);
            echo elgg_view('embed/embed', array('sections' => $sections, 'active_section' => $active_section, 'upload_sections' => $upload_sections, 'internal_name' => $internal_name));
            break;
    }
    // exit because this is in a modal display.
    exit;
}
开发者ID:rasul,项目名称:Elgg,代码行数:35,代码来源:start.php

示例4: uservalidationbyemail_page_handler

/**
 * Get security token, forward to action.
 *
 * @param unknown_type $page
 * @return unknown_type
 */
function uservalidationbyemail_page_handler($page)
{
    global $CONFIG;
    if (isset($page[0]) && $page[0] == 'confirm') {
        $code = sanitise_string(get_input('c', FALSE));
        $user_guid = get_input('u', FALSE);
        // new users are not enabled by default.
        $access_status = access_get_show_hidden_status();
        access_show_hidden_entities(true);
        $user = get_entity($user_guid);
        if ($code && $user) {
            if (uservalidationbyemail_validate_email($user_guid, $code)) {
                system_message(elgg_echo('email:confirm:success'));
                $user = get_entity($user_guid);
                $user->enable();
                notify_user($user_guid, $CONFIG->site->guid, sprintf(elgg_echo('email:validate:success:subject'), $user->username), sprintf(elgg_echo('email:validate:success:body'), $user->name), NULL, 'email');
            } else {
                register_error(elgg_echo('email:confirm:fail'));
            }
        } else {
            register_error(elgg_echo('email:confirm:fail'));
        }
        access_show_hidden_entities($access_status);
    } else {
        register_error(elgg_echo('email:confirm:fail'));
    }
    forward();
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:34,代码来源:start.php

示例5: handlePages

 /**
  * Handles embedded URLs
  *
  * @param array $page URL segments
  * @return boolean
  */
 function handlePages($page)
 {
     $url = get_input('url');
     $handle = get_input('handle');
     $iframe = get_input('iframe', false);
     $site = elgg_get_site_entity();
     if (!$handle) {
         $handle = $site->guid;
     }
     if (!$url || !$handle) {
         return false;
     }
     $parse = elgg_is_logged_in();
     switch ($page[0]) {
         default:
             $data = $this->model->get($url, $handle, $parse);
             $layout = elgg_view('output/card', array('href' => $url, 'handle' => $handle));
             $shell = $iframe ? 'iframe' : 'default';
             echo elgg_view_page($data['title'], $layout, $shell);
             break;
         case 'json':
             $data = $this->model->get($url, $handle, $parse);
             header('Content-Type: application/json');
             echo json_encode($data);
             exit;
     }
     return true;
 }
开发者ID:n8b,项目名称:VMN,代码行数:34,代码来源:Router.php

示例6: menu_builder_init

/**
 * Init function for Menu Builder
 *
 * @return void
 */
function menu_builder_init()
{
    elgg_extend_view("navigation/menu/site", "menu_builder/site_menu_extend");
    elgg_extend_view("css/elgg", "menu_builder/css/site");
    // register pagehandler for nice URL's
    elgg_register_page_handler("menu_builder", "menu_builder_page_handler");
    // switch mode
    if (elgg_is_admin_logged_in()) {
        elgg_register_plugin_hook_handler("access:collections:write", "user", "menu_builder_write_access_hook");
        if (get_input("menu_builder_edit_mode") == "on") {
            $_SESSION["menu_builder_edit_mode"] = true;
        } elseif (get_input("menu_builder_edit_mode") == "off") {
            unset($_SESSION["menu_builder_edit_mode"]);
            unset($_SESSION["menu_builder_logged_out"]);
        }
        if (get_input("menu_builder_logged_out") == "on") {
            $_SESSION["menu_builder_logged_out"] = true;
        } elseif (get_input("menu_builder_logged_out") == "off") {
            unset($_SESSION["menu_builder_logged_out"]);
        }
    } else {
        unset($_SESSION["menu_builder_edit_mode"]);
        unset($_SESSION["menu_builder_logged_out"]);
    }
    // register url handler for menu_builder objects
    elgg_register_entity_url_handler("object", MENU_BUILDER_SUBTYPE, "menu_builder_menu_item_url_handler");
    // take control of menu setup
    elgg_unregister_plugin_hook_handler('prepare', 'menu:site', 'elgg_site_menu_setup');
    elgg_register_plugin_hook_handler('prepare', 'menu:site', 'menu_builder_site_menu_prepare');
    elgg_register_plugin_hook_handler('register', 'menu:site', 'menu_builder_site_menu_register');
}
开发者ID:n8b,项目名称:VMN,代码行数:36,代码来源:start.php

示例7: saveUserNotificationsSettings

 /**
  * Save the wire_tools preferences for the user
  *
  * @param string $hook         the name of the hook
  * @param stirng $type         the type of the hook
  * @param array  $return_value the current return value
  * @param array  $params       supplied values
  *
  * @return void
  */
 public static function saveUserNotificationsSettings($hook, $type, $return_value, $params)
 {
     $NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethods();
     if (empty($NOTIFICATION_HANDLERS) || !is_array($NOTIFICATION_HANDLERS)) {
         return;
     }
     $user_guid = (int) get_input('guid');
     if (empty($user_guid)) {
         return;
     }
     $user = get_user($user_guid);
     if (empty($user) || !$user->canEdit()) {
         return;
     }
     $methods = [];
     foreach ($NOTIFICATION_HANDLERS as $method) {
         $setting = get_input("thewire_tools_{$method}");
         if (!empty($setting)) {
             $methods[] = $method;
         }
     }
     if (!empty($methods)) {
         elgg_set_plugin_user_setting('notification_settings', implode(',', $methods), $user->getGUID(), 'thewire_tools');
     } else {
         elgg_unset_plugin_user_setting('notification_settings', $user->getGUID(), 'thewire_tools');
     }
     // set flag for correct fallback behaviour
     elgg_set_plugin_user_setting('notification_settings_saved', '1', $user->getGUID(), 'thewire_tools');
 }
开发者ID:coldtrick,项目名称:thewire_tools,代码行数:39,代码来源:Notifications.php

示例8: avatar_service_page_handler

/**
 * Page handler for the avatar_service url
 *
 * @param array $page url parts
 *
 * @return true
 */
function avatar_service_page_handler($page)
{
    $md5_parts = elgg_extract(0, $page);
    $md5 = '';
    // strip optional extension
    if (!empty($md5_parts)) {
        list($md5) = explode('.', $md5_parts);
    }
    $size = (int) get_input('s', get_input('size', 80));
    // size (in pixels) min 1px and max 2048px
    if ($size < 1 || $size > 2048) {
        $size = 80;
    }
    $params = ['size' => $size, 'user' => avatar_service_get_user_by_md5($md5)];
    $image_data = avatar_service_get_image($params);
    $content_length = strlen($image_data);
    // If is the same ETag, content didn't changed.
    $etag = md5($image_data);
    if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == "\"{$etag}\"") {
        header("HTTP/1.1 304 Not Modified");
        return true;
    }
    header('Content-type: image/jpeg');
    header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime('+6 months')), true);
    header('Pragma: public');
    header('Cache-Control: public');
    header("Content-Length: {$content_length}");
    header("ETag: \"{$etag}\"");
    echo $image_data;
    return true;
}
开发者ID:coldtrick,项目名称:avatar_service,代码行数:38,代码来源:start.php

示例9: proposals_init

/**
 * Init proposals plugin.
 */
function proposals_init()
{
    if (!elgg_is_active_plugin('crud')) {
        return;
    }
    // register proposals library
    elgg_register_library('elgg:proposals', elgg_get_plugins_path() . 'proposals/lib/proposals.php');
    // add to the main css
    elgg_extend_view('css/elgg', 'proposals/css');
    // Add group option
    add_group_tool_option('proposals', elgg_echo('proposals:enableproposals'), false);
    elgg_extend_view('groups/tool_latest', 'proposals/group_module');
    //
    $action_path = elgg_get_plugins_path() . 'proposals/actions/proposals';
    elgg_register_action("proposals/vote", "{$action_path}/vote.php");
    elgg_register_plugin_hook_handler('permissions_check:annotate', 'object', 'proposals_user_can_vote');
    // data types
    $variables = array('title' => 'text', 'description' => 'longtext', 'access_id' => 'access');
    $crud = crud_register_type('decision', $variables);
    $crud->children_type = 'proposal';
    // the following is to not overwrite module if assemblies set it
    // before, since we don't need explicit module.
    if ($crud->module == 'decision') {
        $crud->module = 'proposals';
    }
    //$crud->module = 'proposals';
    $crud->owner_menu = 'group';
    $variables = array('title' => 'text', 'description' => 'longtext', 'tags' => 'tags', 'access_id' => 'access', 'improves_guid' => array('type' => 'url', 'input_view' => 'hidden', 'output_view' => 'proposal', 'default_value' => get_input('improves')));
    $crud = crud_register_type('proposal', $variables);
    #$crud->children_type = 'agenda_point';
    $crud->module = 'proposals';
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:35,代码来源:start.php

示例10: widget_manager_create_object_handler

/**
 * Performs action when a widget is created
 *
 * @param string $event       name of the system event
 * @param string $object_type type of the event
 * @param mixed  $object      object related to the event
 *
 * @return void
 */
function widget_manager_create_object_handler($event, $object_type, $object)
{
    if (elgg_instanceof($object, "object", "widget", "ElggWidget")) {
        $owner = $object->getOwnerEntity();
        // Updates access for privately created widgets in a group or on site
        if ((int) $object->access_id === ACCESS_PRIVATE) {
            $old_ia = elgg_set_ignore_access();
            if ($owner instanceof ElggGroup) {
                $object->access_id = $owner->group_acl;
                $object->save();
            } elseif ($owner instanceof ElggSite) {
                $object->access_id = ACCESS_PUBLIC;
                $object->save();
            }
            elgg_set_ignore_access($old_ia);
        }
        // Adds a relation between a widget and a multidashboard object
        $dashboard_guid = get_input("multi_dashboard_guid");
        if ($dashboard_guid && widget_manager_multi_dashboard_enabled()) {
            $dashboard = get_entity($dashboard_guid);
            if (elgg_instanceof($dashboard, "object", MultiDashboard::SUBTYPE, "MultiDashboard")) {
                add_entity_relationship($object->getGUID(), MultiDashboard::WIDGET_RELATIONSHIP, $dashboard->getGUID());
            }
        }
    }
}
开发者ID:n8b,项目名称:VMN,代码行数:35,代码来源:events.php

示例11: fileTools

 /**
  * Handle /file_tools URLs
  *
  * @param array $page URL segments
  *
  * @return bool
  */
 public static function fileTools($page)
 {
     switch (elgg_extract(0, $page)) {
         case 'list':
             elgg_ajax_gatekeeper();
             $params = [];
             elgg_set_page_owner_guid(elgg_extract(1, $page));
             $folder_guid = get_input('folder_guid', false);
             if ($folder_guid !== false) {
                 $params['folder_guid'] = (int) $folder_guid;
                 $params['draw_page'] = false;
             }
             if (isset($page[2])) {
                 $params['folder_guid'] = (int) $page[2];
             }
             echo elgg_view_resource('file_tools/file/list', $params);
             return true;
             break;
         case 'folder':
             switch (elgg_extract(1, $page)) {
                 case 'new':
                     elgg_set_page_owner_guid(elgg_extract(2, $page));
                     echo elgg_view_resource('file_tools/folder/new');
                     return true;
                     break;
                 case 'edit':
                     $params = ['folder_guid' => (int) elgg_extract(2, $page)];
                     echo elgg_view_resource('file_tools/folder/edit', $params);
                     return true;
                     break;
             }
             break;
     }
     return false;
 }
开发者ID:coldtrick,项目名称:file_tools,代码行数:42,代码来源:PageHandler.php

示例12: readMultipleValues

function readMultipleValues($fieldID, $mainFieldName = "", $dependantFields = array())
{
    if ($mainFieldName == "") {
        $mainFieldName = $fieldID;
    }
    $nrOfFields = get_input($mainFieldName . "_nr");
    $values = array();
    $values[$fieldID] = array();
    for ($j = 0; $j < count($dependantFields); $j++) {
        $values[$dependantFields[$j]] = array();
    }
    for ($i = 0; $i <= $nrOfFields; $i++) {
        $val = get_input($fieldID . '_' . $i);
        if ($val != "") {
            $values[$fieldID][] = $val;
            for ($j = 0; $j < count($dependantFields); $j++) {
                $values[$dependantFields[$j]][] = get_input($dependantFields[$j] . '_' . $i);
            }
        }
    }
    //reverse the array
    array_reverse($values, true);
    if (count($dependantFields) == 0) {
        return join(",", $values[$fieldID]);
    } else {
        return $values;
    }
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:28,代码来源:edit.php

示例13: 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);
    }
}
开发者ID:elainenaomi,项目名称:labxp2014,代码行数:33,代码来源:list_users.php

示例14: validate

 protected function validate($name, $rule)
 {
     $input = get_input($name);
     switch ($rule) {
         case "required":
             if ($input == "" || is_null($input)) {
                 $this->setMessage($name, "{$name} field is required");
                 return false;
             }
             return true;
             break;
         case "email":
             if (!filter_var($input, FILTER_VALIDATE_EMAIL)) {
                 $this->setMessage($name, "{$name} field is not a valid email");
                 return false;
             }
             return true;
             break;
         case "numeric":
             if (!filter_var($input, FILTER_VALIDATE_INT | FILTER_VALIDATE_FLOAT)) {
                 $this->setMessage($name, "{$name} field is not numeric");
                 return false;
             }
             return true;
             break;
     }
 }
开发者ID:amriterry,项目名称:HelpNepal,代码行数:27,代码来源:Validator.php

示例15: registerUserHover

 /**
  * Adds menu items to the user hover menu
  *
  * @param string $hook        hook name
  * @param string $entity_type hook type
  * @param array  $returnvalue current return value
  * @param array  $params      parameters
  *
  * @return array
  */
 public static function registerUserHover($hook, $entity_type, $returnvalue, $params)
 {
     $guid = get_input('guid');
     $user = elgg_extract('entity', $params);
     if (empty($guid) || empty($user)) {
         return;
     }
     $event = get_entity($guid);
     if (!$event instanceof \Event) {
         return;
     }
     if (!$event->canEdit()) {
         return;
     }
     $result = $returnvalue;
     // kick from event (assumes users listed on the view page of an event)
     $href = 'action/event_manager/event/rsvp?guid=' . $event->getGUID() . '&user=' . $user->getGUID() . '&type=' . EVENT_MANAGER_RELATION_UNDO;
     $item = \ElggMenuItem::factory(['name' => 'event_manager_kick', 'text' => elgg_echo('event_manager:event:relationship:kick'), 'href' => $href, 'is_action' => true, 'section' => 'action']);
     $result[] = $item;
     $user_relationship = $event->getRelationshipByUser($user->getGUID());
     if ($user_relationship == EVENT_MANAGER_RELATION_ATTENDING_PENDING) {
         // resend confirmation
         $href = 'action/event_manager/event/resend_confirmation?guid=' . $event->getGUID() . '&user=' . $user->getGUID();
         $item = \ElggMenuItem::factory(['name' => 'event_manager_resend_confirmation', 'text' => elgg_echo("event_manager:event:menu:user_hover:resend_confirmation"), 'href' => $href, 'is_action' => true, 'section' => 'action']);
         $result[] = $item;
     }
     if (in_array($user_relationship, [EVENT_MANAGER_RELATION_ATTENDING_PENDING, EVENT_MANAGER_RELATION_ATTENDING_WAITINGLIST])) {
         // move to attendees
         $href = 'action/event_manager/attendees/move_to_attendees?guid=' . $event->getGUID() . '&user=' . $user->getGUID();
         $item = \ElggMenuItem::factory(['name' => 'event_manager_move_to_attendees', 'text' => elgg_echo('event_manager:event:menu:user_hover:move_to_attendees'), 'href' => $href, 'is_action' => true, 'section' => 'action']);
         $result[] = $item;
     }
     return $result;
 }
开发者ID:coldtrick,项目名称:event_manager,代码行数:44,代码来源:Menus.php


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