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


PHP Walker类代码示例

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


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

示例1: expand

function expand(Environment $env, $code)
{
    $walker = new Walker();
    $forms = buildForms($code);
    return array_map(function ($form) use($walker, $env) {
        return $walker->expand($env, $form);
    }, $forms);
}
开发者ID:igorw,项目名称:ilias,代码行数:8,代码来源:macro-expand.php

示例2: expand

 /**
  * @test
  * @dataProvider provideExpand
  */
 public function expand($expected, $sexpr, array $macros = [])
 {
     $walker = new Walker();
     $env = Environment::standard();
     foreach ($macros as $name => $pair) {
         list($argsSexpr, $bodySexpr) = $pair;
         $macroArgs = $this->parseSexpr($argsSexpr);
         $macroBody = $this->parseSexpr($bodySexpr);
         $env[$name] = new SpecialOp\MacroOp($macroArgs, $macroBody);
     }
     $form = $this->parseSexpr($sexpr);
     $expanded = $walker->expand($env, $form);
     $this->assertEquals($expected, $expanded->getAst());
 }
开发者ID:igorw,项目名称:ilias,代码行数:18,代码来源:WalkerTest.php

示例3: forgot_password

 public function forgot_password()
 {
     $type = Input::get('type');
     $email = Input::get('email');
     if ($type == 1) {
         // Walker
         $walker_data = Walker::where('email', $email)->first();
         if ($walker_data) {
             $walker = Walker::find($walker_data->id);
             $new_password = time();
             $new_password .= rand();
             $new_password = sha1($new_password);
             $new_password = substr($new_password, 0, 8);
             $walker->password = Hash::make($new_password);
             $walker->save();
             // send email
             $settings = Settings::where('key', 'email_forgot_password')->first();
             $pattern = $settings->value;
             $pattern = str_replace('%password%', $new_password, $pattern);
             $subject = "Your New Password";
             email_notification($walker->id, 'walker', $pattern, $subject);
             $response_array = array();
             $response_array['success'] = true;
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         } else {
             $response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     } else {
         $owner_data = Owner::where('email', $email)->first();
         if ($owner_data) {
             $owner = Owner::find($owner_data->id);
             $new_password = time();
             $new_password .= rand();
             $new_password = sha1($new_password);
             $new_password = substr($new_password, 0, 8);
             $owner->password = Hash::make($new_password);
             $owner->save();
             $settings = Settings::where('key', 'email_forgot_password')->first();
             $pattern = $settings->value;
             $pattern = str_replace('%password%', $new_password, $pattern);
             $subject = "Your New Password";
             email_notification($owner->id, 'owner', $pattern, $subject);
             $response_array = array();
             $response_array['success'] = true;
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         } else {
             $response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     }
 }
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:60,代码来源:ApplicationController.php

示例4: walk

 public function walk()
 {
     $walked = [];
     //walk know pathes
     foreach ($this->map->paths(['where' => ['path', $this->curPath]]) as $path) {
         if (isset($this->data[$path->item])) {
             if ($path->type == 'container') {
                 //create walker for container
                 $walker = new Walker();
                 $walker->migration = $this->migration;
                 $walker->map = $this->map;
                 $walker->data =& $this->data[$path->item];
                 $walker->curPath = $this->curPath . $path->item . '/';
                 $walker->mapPath = $path;
                 $walker->mapPathParent = $this->mapPath;
                 $walker->migtarionLog = $this->migtarionLog;
                 $walker->walk();
             } elseif ($path->type == 'object') {
                 //start parse path data
                 $this->startObjectParse($path->object_id, $this->data[$path->item]);
             }
         }
         $walked[$path->item] = true;
     }
     //check unparsed paths
     foreach ($this->data as $key => &$data) {
         //skip parsed and attribtes
         if ($key == '@attributes' || !empty($walked[$key])) {
             continue;
         }
         //search object for parse
         $object = Migration\Object::get([['code', $key], ['migration_id', $this->migration->id]]);
         if ($object) {
             //parse as object
             $this->startObjectParse($object, $data);
         } else {
             //create new map path for configure unknown path
             $this->mapPath = new Migration\Map\Path();
             $this->mapPath->parent_id = $this->mapPathParent ? $this->mapPathParent->id : 0;
             $this->mapPath->path = $this->curPath;
             $this->mapPath->item = $key;
             $this->mapPath->migration_map_id = $this->map->id;
             $this->mapPath->save();
         }
     }
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:46,代码来源:Walker.php

示例5: display_element

 /**
  * Taken from WordPress's Walker_Comment::display_element()
  *
  * This function is designed to enhance Walker::display_element() to
  * display children of higher nesting levels than selected inline on
  * the highest depth level displayed. This prevents them being orphaned
  * at the end of the comment list.
  *
  * Example: max_depth = 2, with 5 levels of nested content.
  * 1
  *  1.1
  *    1.1.1
  *    1.1.1.1
  *    1.1.1.1.1
  *    1.1.2
  *    1.1.2.1
  * 2
  *  2.2
  *
  * @see Walker_Comment::display_element()
  * @see Walker::display_element()
  * @see wp_list_comments()
  */
 public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
 {
     if (!$element) {
         return;
     }
     $id_field = $this->db_fields['id'];
     $id = $element->{$id_field};
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
     // If we're at the max depth, and the current element still has children, loop over those and display them at this level
     // This is to prevent them being orphaned to the end of the list.
     if ($max_depth <= $depth + 1 && isset($children_elements[$id])) {
         foreach ($children_elements[$id] as $child) {
             $this->display_element($child, $children_elements, $max_depth, $depth, $args, $output);
         }
         unset($children_elements[$id]);
     }
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:40,代码来源:class.wpcom-json-api-list-comments-endpoint.php

示例6: foreach

 /**
  * This modifies the default display_element() function to "flatten" any replies that exceed the max_depth.
  *
  * This function is taken from the Walker_Comment class in WordPress core.
  *
  * @see Walker::display_element()
  *
  * @param object $element           Data object.
  * @param array  $children_elements List of elements to continue traversing.
  * @param int    $max_depth         Max depth to traverse.
  * @param int    $depth             Depth of current element.
  * @param array  $args              An array of arguments. @see wp_list_comments()
  * @param string $output            Passed by reference. Used to append additional content.
  * @return null Null on failure with no changes to parameters.
  */
 function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
 {
     // Do nothing if $element is false...
     if (!$element) {
         return;
     }
     $id_field = $this->db_fields['id'];
     $id = $element->{$id_field};
     // Run the standard display_element() function now...
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
     // If we're at the max depth, and the current element still has children, loop over those and display them at
     // this level. This is to prevent them being orphaned to the end of the comment list.
     if ($max_depth <= $depth + 1 && isset($children_elements[$id])) {
         foreach ($children_elements[$id] as $child) {
             $this->display_element($child, $children_elements, $max_depth, $depth, $args, $output);
         }
         unset($children_elements[$id]);
     }
 }
开发者ID:mistergjh,项目名称:nouveau,代码行数:34,代码来源:WalkerComments.php

示例7: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $this->info('Working');
     $date1 = date('Y-m-d h:i:s');
     $this->info($date1);
     $date = date_create($date1);
     $msgtime = $date->add(new DateInterval('P0Y0M0DT0H30M0S'))->format('Y-m-d H:i:s');
     $requests = Requests::where('later', 1)->where('is_started', 0)->where('request_start_time', '<=', $msgtime)->get();
     if ($requests->count() > 0) {
         $this->info('hola');
         foreach ($requests as $request) {
             $provider = Walker::where('id', $request->confirmed_walker)->first();
             $owner = Owner::where('id', $request->owner_id)->first();
             $message = "You have a ride scheduled in 30 mins from now. Client name is {$owner->first_name} {$owner->last_name} and phone no. is {$owner->phone}";
             $this->info($request->id);
             $this->info($message);
             send_notifications($provider->id, 'provider', 'Ride in 30 min', $message);
             $request->later = 0;
             $request->save();
         }
     }
 }
开发者ID:felipemarques8,项目名称:goentregas,代码行数:27,代码来源:SchedulePush.php

示例8: userTripDetail

 public function userTripDetail()
 {
     $id = Request::segment(3);
     $owner_id = Session::get('user_id');
     $request = Requests::find($id);
     if ($request->owner_id == $owner_id) {
         $locations = WalkLocation::where('request_id', $id)->orderBy('id')->get();
         $start = WalkLocation::where('request_id', $id)->orderBy('id')->first();
         $end = WalkLocation::where('request_id', $id)->orderBy('id', 'desc')->first();
         $map = "https://maps-api-ssl.google.com/maps/api/staticmap?size=249x249&style=feature:landscape|visibility:off&style=feature:poi|visibility:off&style=feature:transit|visibility:off&style=feature:road.highway|element:geometry|lightness:39&style=feature:road.local|element:geometry|gamma:1.45&style=feature:road|element:labels|gamma:1.22&style=feature:administrative|visibility:off&style=feature:administrative.locality|visibility:on&style=feature:landscape.natural|visibility:on&scale=2&markers=shadow:false|scale:2|icon:http://d1a3f4spazzrp4.cloudfront.net/receipt-new/marker-start@2x.png|{$start->latitude},{$start->longitude}&markers=shadow:false|scale:2|icon:http://d1a3f4spazzrp4.cloudfront.net/receipt-new/marker-finish@2x.png|{$end->latitude},{$end->longitude}&path=color:0x2dbae4ff|weight:4";
         foreach ($locations as $location) {
             $map .= "|{$location->latitude},{$location->longitude}";
         }
         $start_location = json_decode(file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?latlng={$start->latitude},{$start->longitude}"), TRUE);
         $start_address = $start_location['results'][0]['formatted_address'];
         $end_location = json_decode(file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?latlng={$end->latitude},{$end->longitude}"), TRUE);
         $end_address = $end_location['results'][0]['formatted_address'];
         $walker = Walker::find($request->confirmed_walker);
         $walker_review = WalkerReview::where('request_id', $id)->first();
         if ($walker_review) {
             $rating = round($walker_review->rating);
         } else {
             $rating = 0;
         }
         return View::make('web.userTripDetail')->with('title', 'My Trips')->with('request', $request)->with('start_address', $start_address)->with('end_address', $end_address)->with('start', $start)->with('end', $end)->with('map_url', $map)->with('walker', $walker)->with('rating', $rating);
     } else {
         echo "false";
     }
 }
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:29,代码来源:WebUserController.php

示例9: display_element

 /**
  * Traverse elements to create list from elements.
  *
  * Calls parent function in wp-includes/class-wp-walker.php
  */
 function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     if (!$element) {
         return;
     }
     //Add indicators for top level menu items with submenus
     $id_field = $this->db_fields['id'];
     if ($depth == 0 && !empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'mega-with-sub';
     }
     if (!empty($children_elements[$element->{$id_field}])) {
         $element->classes[] = 'item-parent';
     }
     Walker::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:FameThemes,项目名称:st-mega-menu,代码行数:20,代码来源:class-megamenu.php

示例10: schedule_request

 public function schedule_request()
 {
     $time = date("Y-m-d H:i:s");
     $query = "SELECT id,owner_id,current_walker,TIMESTAMPDIFF(SECOND,request_start_time, '{$time}') as diff from request where status = 0 and is_cancelled = 0";
     $results = DB::select(DB::raw($query));
     foreach ($results as $result) {
         $settings = Settings::where('key', 'provider_timeout')->first();
         $timeout = $settings->value;
         if ($result->diff >= $timeout) {
             // Archiving Old Walker
             RequestMeta::where('request_id', '=', $result->id)->where('walker_id', '=', $result->current_walker)->update(array('status' => 2));
             $request_meta = RequestMeta::where('request_id', '=', $result->id)->where('status', '=', 0)->orderBy('created_at')->first();
             // update request
             if (isset($request_meta->walker_id)) {
                 // assign new walker
                 Requests::where('id', '=', $result->id)->update(array('current_walker' => $request_meta->walker_id, 'request_start_time' => date("Y-m-d H:i:s")));
                 // Send Notification
                 $walker = Walker::find($request_meta->walker_id);
                 $owner_data = Owner::find($result->owner_id);
                 $msg_array = array();
                 $msg_array['request_id'] = $result->id;
                 $msg_array['id'] = $request_meta->walker_id;
                 if ($walker) {
                     $msg_array['token'] = $walker->token;
                 }
                 $msg_array['client_profile'] = array();
                 $msg_array['client_profile']['name'] = $owner_data->first_name . " " . $owner_data->last_name;
                 $msg_array['client_profile']['picture'] = $owner_data->picture;
                 $msg_array['client_profile']['bio'] = $owner_data->bio;
                 $msg_array['client_profile']['address'] = $owner_data->address;
                 $msg_array['client_profile']['phone'] = $owner_data->phone;
                 $title = "New Request";
                 $message = $msg_array;
                 send_notifications($request_meta->walker_id, "walker", $title, $message);
             } else {
                 // request ended
                 Requests::where('id', '=', $result->id)->update(array('current_walker' => 0, 'status' => 1));
                 $settings = Settings::where('key', 'sms_request_unanswered')->first();
                 $pattern = $settings->value;
                 $pattern = str_replace('%id%', $result->id, $pattern);
                 sms_notification(1, 'admin', $pattern);
                 // send email
                 $settings = Settings::where('key', 'email_request_unanswered')->first();
                 $pattern = $settings->value;
                 $pattern = str_replace('%id%', $result->id, $pattern);
                 $pattern = str_replace('%url%', web_url() . "/admin/request/map/" . $result->id, $pattern);
                 $subject = "New Request Unansweres";
                 email_notification(1, 'admin', $pattern, $subject);
             }
         }
     }
 }
开发者ID:netGALAXYStudios,项目名称:ourmovingapp,代码行数:52,代码来源:DogController.php

示例11: create_manual_request

 public function create_manual_request()
 {
     $latitude = Input::get('latitude');
     $longitude = Input::get('longitude');
     $d_latitude = Input::get('d_latitude');
     $d_longitude = Input::get('d_longitude');
     $type = Input::get('type');
     $provider = Input::get('provider');
     $user_id = Session::get('user_id');
     $time = date("Y-m-d H:i:s");
     $provider_details = Walker::where('id', '=', $provider)->first();
     $user = Owner::where('id', '=', $user_id)->first();
     $request = new Requests();
     $request->owner_id = $user_id;
     $request->request_start_time = $time;
     $request->confirmed_walker = $provider;
     if ($d_longitude != '' && $d_latitude != '') {
         $request->D_latitude = $d_latitude;
         $request->D_longitude = $d_longitude;
     }
     $request->current_walker = $provider;
     $request->status = 1;
     $request->save();
     $reqid = $request->id;
     $request_service = new RequestServices();
     $request_service->type = $type;
     $request_service->request_id = $request->id;
     $request_service->save();
     $owner = Owner::find($user_id);
     $owner->latitude = $latitude;
     $owner->longitude = $longitude;
     $owner->save();
     $walkerlocation = new WalkLocation();
     $walkerlocation->request_id = $request->id;
     $walkerlocation->distance = 0.0;
     $walkerlocation->latitude = $latitude;
     $walkerlocation->longitude = $longitude;
     $walkerlocation->save();
     if ($request->save()) {
         $current_request = Requests::where('id', '=', $reqid)->first();
         return Redirect::to('/user/request-trip');
     }
 }
开发者ID:felipemarques8,项目名称:goentregas,代码行数:43,代码来源:WebProviderController.php

示例12: check_banking

 public function check_banking()
 {
     $token = Input::get('token');
     $walker_id = Input::get('id');
     $is_admin = $this->isAdmin($token);
     if ($walker_data = $this->getWalkerData($walker_id, $token, $is_admin)) {
         // check for token validity
         if (is_token_active($walker_data->token_expiry) || $is_admin) {
             // do
             $default_banking = Config::get('app.default_payment');
             $resp = array();
             $resp['default_banking'] = $default_banking;
             $walker = Walker::where('id', $walker_id)->first();
             if ($walker->merchant_id != NULL) {
                 $resp['walker']['merchant_id'] = $walker->merchant_id;
             }
             $response_array = array('success' => true, 'details' => $resp);
             $response_code = 200;
         }
     }
     $response = Response::json($response_array, $response_code);
     return $response;
 }
开发者ID:felipemarques8,项目名称:goentregas,代码行数:23,代码来源:WalkerController.php

示例13: forgot_password

 public function forgot_password()
 {
     $type = Input::get('type');
     $email = Input::get('email');
     if ($type == 1) {
         // Walker
         $walker_data = Walker::where('email', $email)->first();
         if ($walker_data) {
             $walker = Walker::find($walker_data->id);
             $new_password = time();
             $new_password .= rand();
             $new_password = sha1($new_password);
             $new_password = substr($new_password, 0, 8);
             $walker->password = Hash::make($new_password);
             $walker->save();
             /* $subject = "Your New Password";
                $email_data = array();
                $email_data['password'] = $new_password;
                send_email($walker->id, 'walker', $email_data, $subject, 'forgotpassword'); */
             $settings = Settings::where('key', 'admin_email_address')->first();
             $admin_email = $settings->value;
             $login_url = web_url() . "/provider/signin";
             $pattern = array('name' => $walker->first_name . " " . $walker->last_name, 'admin_eamil' => $admin_email, 'new_password' => $new_password, 'login_url' => $login_url);
             $subject = "Your New Password";
             email_notification($walker->id, 'walker', $pattern, $subject, 'forgot_password', "imp");
             $response_array = array();
             $response_array['success'] = true;
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         } else {
             $response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     } else {
         $owner_data = Owner::where('email', $email)->first();
         if ($owner_data) {
             $owner = Owner::find($owner_data->id);
             $new_password = time();
             $new_password .= rand();
             $new_password = sha1($new_password);
             $new_password = substr($new_password, 0, 8);
             $owner->password = Hash::make($new_password);
             $owner->save();
             /* $subject = "Your New Password";
                $email_data = array();
                $email_data['password'] = $new_password;
                send_email($owner->id, 'owner', $email_data, $subject, 'forgotpassword'); */
             $settings = Settings::where('key', 'admin_email_address')->first();
             $admin_email = $settings->value;
             $login_url = web_url() . "/user/signin";
             $pattern = array('name' => $owner->first_name . " " . $owner->last_name, 'admin_eamil' => $admin_email, 'new_password' => $new_password, 'login_url' => $login_url);
             $subject = "Your New Password";
             email_notification($owner->id, 'owner', $pattern, $subject, 'forgot_password', "imp");
             $response_array = array();
             $response_array['success'] = true;
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         } else {
             $response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
             $response_code = 200;
             $response = Response::json($response_array, $response_code);
             return $response;
         }
     }
 }
开发者ID:felipemarques8,项目名称:goentregas,代码行数:69,代码来源:ApplicationController.php

示例14: display_element

 /**
  * Traverse elements to create list from elements.
  *
  * Display one element if the element doesn't have any children otherwise,
  * display the element and its children. Will only traverse up to the max.
  * depth and no ignore elements under that depth. It is possible to set the.
  * max depth to include all depths, see walk() method.
  *
  * This method shouldn't be called directly, use the walk() method instead.
  *
  * @since 2.5.0
  *
  * @param object $element Data object
  * @param array $children_elements List of elements to continue traversing.
  * @param int $max_depth Max depth to traverse.
  * @param int $depth Depth of current element.
  * @param array $args
  * @param string $output Passed by reference. Used to append additional content.
  * @return null Null on failure with no changes to parameters.
  */
 public function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
 {
     if (!$element || 0 === $element->count && !empty($args[0]['hide_empty'])) {
         return;
     }
     parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
 }
开发者ID:pelmered,项目名称:woocommerce,代码行数:27,代码来源:class-product-cat-dropdown-walker.php

示例15: walk

 function walk($elements, $args = array())
 {
     $output = '';
     $args = wp_parse_args($args, array('value' => 'slug', 'name' => 'lang_choice'));
     if (!empty($args['flag'])) {
         $current = wp_list_filter($elements, array($args['value'] => $args['selected']));
         $lang = reset($current);
         $output = sprintf('<span class="pll-select-flag">%s</span>', empty($lang->flag) ? esc_html($lang->slug) : $lang->flag);
     }
     $output .= sprintf('<select name="%1$s" %2$s%3$s%4$s>' . "\n" . '%5$s' . "\n" . '</select>' . "\n", $name = esc_attr($args['name']), isset($args['id']) && !$args['id'] ? '' : ' id="' . (empty($args['id']) ? $name : esc_attr($args['id'])) . '"', empty($args['class']) ? '' : ' class="' . esc_attr($args['class']) . '"', empty($args['disabled']) ? '' : ' disabled="disabled"', parent::walk($elements, -1, $args));
     return $output;
 }
开发者ID:WordPressArt,项目名称:conisia,代码行数:12,代码来源:walker-dropdown.php


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