3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Implements hook_rules_action_info(). */ function tour_scheduling_rules_action_info() { $actions = array( 'tour_scheduling_action_disable_timeslot' => array( 'label' => t('Disable a Time Slot'), 'group' => t('Tour Scheduling'), 'parameter' => array( 'tourdate' => array( 'type' => 'date', 'label' => t('Tour Date'), 'save' => FALSE, ), ), ), 'tour_scheduling_action_enable_timeslot' => array( 'label' => t('Enable a Time Slot'), 'group' => t('Tour Scheduling'), 'parameter' => array( 'tourdate' => array( 'type' => 'date', 'label' => t('Tour Date'), 'save' => FALSE, ), ), ), ); return $actions; } /** * Action: Disable a Time Slot. */ function tour_scheduling_action_disable_timeslot($tourdate) { if (date('I', $tourdate) == 1) { $tourdate = date('Y-m-d H:i:s', $tourdate + 14400); } elseif (date('I', $tourdate) == 0) { $tourdate = date('Y-m-d H:i:s', $tourdate + 18000); } $slot = db_select('field_data_field_time_slot', 'ts') ->fields('ts', array('entity_id')) ->condition('field_time_slot_value', $tourdate, '=') ->execute(); $timeslot = $slot->fetchField(0); $node = node_load($timeslot); $node->status = 0; $node->changed = date(REQUEST_TIME); node_save($node); } /** * Action: Enable a Time Slot. */ function tour_scheduling_action_enable_timeslot($tourdate) { if (date('I', $tourdate) == 1) { $tourdate = date('Y-m-d H:i:s', $tourdate + 14400); } elseif (date('I', $tourdate) == 0) { $tourdate = date('Y-m-d H:i:s', $tourdate + 18000); } $slot = db_select('field_data_field_time_slot', 'ts') ->fields('ts', array('entity_id')) ->condition('field_time_slot_value', $tourdate, '=') ->execute(); $timeslot = $slot->fetchField(0); $node = node_load($timeslot); $node->status = 1; $node->changed = date(REQUEST_TIME); node_save($node); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/emITZ
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   80     0  E > > RETURN                                                   1

Function tour_scheduling_rules_action_info:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/emITZ
function name:  tour_scheduling_rules_action_info
number of ops:  37
compiled vars:  !0 = $actions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL_BY_NAME                                       't'
          1        SEND_VAL_EX                                              'Disable+a+Time+Slot'
          2        DO_FCALL                                      0  $1      
          3        INIT_ARRAY                                       ~2      $1, 'label'
   10     4        INIT_FCALL_BY_NAME                                       't'
          5        SEND_VAL_EX                                              'Tour+Scheduling'
          6        DO_FCALL                                      0  $3      
          7        ADD_ARRAY_ELEMENT                                ~2      $3, 'group'
   13     8        INIT_ARRAY                                       ~4      'date', 'type'
   14     9        INIT_FCALL_BY_NAME                                       't'
         10        SEND_VAL_EX                                              'Tour+Date'
         11        DO_FCALL                                      0  $5      
         12        ADD_ARRAY_ELEMENT                                ~4      $5, 'label'
    9    13        ADD_ARRAY_ELEMENT                                ~4      <false>, 'save'
         14        INIT_ARRAY                                       ~6      ~4, 'tourdate'
         15        ADD_ARRAY_ELEMENT                                ~2      ~6, 'parameter'
         16        INIT_ARRAY                                       ~7      ~2, 'tour_scheduling_action_disable_timeslot'
   21    17        INIT_FCALL_BY_NAME                                       't'
         18        SEND_VAL_EX                                              'Enable+a+Time+Slot'
         19        DO_FCALL                                      0  $8      
         20        INIT_ARRAY                                       ~9      $8, 'label'
   22    21        INIT_FCALL_BY_NAME                                       't'
         22        SEND_VAL_EX                                              'Tour+Scheduling'
         23        DO_FCALL                                      0  $10     
         24        ADD_ARRAY_ELEMENT                                ~9      $10, 'group'
   25    25        INIT_ARRAY                                       ~11     'date', 'type'
   26    26        INIT_FCALL_BY_NAME                                       't'
         27        SEND_VAL_EX                                              'Tour+Date'
         28        DO_FCALL                                      0  $12     
         29        ADD_ARRAY_ELEMENT                                ~11     $12, 'label'
    9    30        ADD_ARRAY_ELEMENT                                ~11     <false>, 'save'
         31        INIT_ARRAY                                       ~13     ~11, 'tourdate'
         32        ADD_ARRAY_ELEMENT                                ~9      ~13, 'parameter'
         33        ADD_ARRAY_ELEMENT                                ~7      ~9, 'tour_scheduling_action_enable_timeslot'
    7    34        ASSIGN                                                   !0, ~7
   33    35      > RETURN                                                   !0
   34    36*     > RETURN                                                   null

End of function tour_scheduling_rules_action_info

Function tour_scheduling_action_disable_timeslot:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 26
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/emITZ
function name:  tour_scheduling_action_disable_timeslot
number of ops:  62
compiled vars:  !0 = $tourdate, !1 = $slot, !2 = $timeslot, !3 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
   40     1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'I'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        IS_EQUAL                                                 $4, 1
          6      > JMPZ                                                     ~5, ->14
   41     7    >   INIT_FCALL                                               'date'
          8        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          9        ADD                                              ~6      !0, 14400
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !0, $7
         13      > JMP                                                      ->26
   43    14    >   INIT_FCALL                                               'date'
         15        SEND_VAL                                                 'I'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $9      
         18        IS_EQUAL                                                 $9, 0
         19      > JMPZ                                                     ~10, ->26
   44    20    >   INIT_FCALL                                               'date'
         21        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         22        ADD                                              ~11     !0, 18000
         23        SEND_VAL                                                 ~11
         24        DO_ICALL                                         $12     
         25        ASSIGN                                                   !0, $12
   46    26    >   INIT_FCALL_BY_NAME                                       'db_select'
         27        SEND_VAL_EX                                              'field_data_field_time_slot'
         28        SEND_VAL_EX                                              'ts'
         29        DO_FCALL                                      0  $14     
   47    30        INIT_METHOD_CALL                                         $14, 'fields'
         31        SEND_VAL_EX                                              'ts'
         32        SEND_VAL_EX                                              <array>
         33        DO_FCALL                                      0  $15     
   48    34        INIT_METHOD_CALL                                         $15, 'condition'
         35        SEND_VAL_EX                                              'field_time_slot_value'
         36        SEND_VAR_EX                                              !0
         37        SEND_VAL_EX                                              '%3D'
         38        DO_FCALL                                      0  $16     
   49    39        INIT_METHOD_CALL                                         $16, 'execute'
         40        DO_FCALL                                      0  $17     
   46    41        ASSIGN                                                   !1, $17
   51    42        INIT_METHOD_CALL                                         !1, 'fetchField'
         43        SEND_VAL_EX                                              0
         44        DO_FCALL                                      0  $19     
         45        ASSIGN                                                   !2, $19
   53    46        INIT_FCALL_BY_NAME                                       'node_load'
         47        SEND_VAR_EX                                              !2
         48        DO_FCALL                                      0  $21     
         49        ASSIGN                                                   !3, $21
   54    50        ASSIGN_OBJ                                               !3, 'status'
         51        OP_DATA                                                  0
   55    52        INIT_FCALL                                               'date'
         53        FETCH_CONSTANT                                   ~25     'REQUEST_TIME'
         54        SEND_VAL                                                 ~25
         55        DO_ICALL                                         $26     
         56        ASSIGN_OBJ                                               !3, 'changed'
         57        OP_DATA                                                  $26
   56    58        INIT_FCALL_BY_NAME                                       'node_save'
         59        SEND_VAR_EX                                              !3
         60        DO_FCALL                                      0          
   57    61      > RETURN                                                   null

End of function tour_scheduling_action_disable_timeslot

Function tour_scheduling_action_enable_timeslot:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 26
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/emITZ
function name:  tour_scheduling_action_enable_timeslot
number of ops:  62
compiled vars:  !0 = $tourdate, !1 = $slot, !2 = $timeslot, !3 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E >   RECV                                             !0      
   63     1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'I'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        IS_EQUAL                                                 $4, 1
          6      > JMPZ                                                     ~5, ->14
   64     7    >   INIT_FCALL                                               'date'
          8        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          9        ADD                                              ~6      !0, 14400
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !0, $7
         13      > JMP                                                      ->26
   66    14    >   INIT_FCALL                                               'date'
         15        SEND_VAL                                                 'I'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $9      
         18        IS_EQUAL                                                 $9, 0
         19      > JMPZ                                                     ~10, ->26
   67    20    >   INIT_FCALL                                               'date'
         21        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         22        ADD                                              ~11     !0, 18000
         23        SEND_VAL                                                 ~11
         24        DO_ICALL                                         $12     
         25        ASSIGN                                                   !0, $12
   69    26    >   INIT_FCALL_BY_NAME                                       'db_select'
         27        SEND_VAL_EX                                              'field_data_field_time_slot'
         28        SEND_VAL_EX                                              'ts'
         29        DO_FCALL                                      0  $14     
   70    30        INIT_METHOD_CALL                                         $14, 'fields'
         31        SEND_VAL_EX                                              'ts'
         32        SEND_VAL_EX                                              <array>
         33        DO_FCALL                                      0  $15     
   71    34        INIT_METHOD_CALL                                         $15, 'condition'
         35        SEND_VAL_EX                                              'field_time_slot_value'
         36        SEND_VAR_EX                                              !0
         37        SEND_VAL_EX                                              '%3D'
         38        DO_FCALL                                      0  $16     
   72    39        INIT_METHOD_CALL                                         $16, 'execute'
         40        DO_FCALL                                      0  $17     
   69    41        ASSIGN                                                   !1, $17
   74    42        INIT_METHOD_CALL                                         !1, 'fetchField'
         43        SEND_VAL_EX                                              0
         44        DO_FCALL                                      0  $19     
         45        ASSIGN                                                   !2, $19
   76    46        INIT_FCALL_BY_NAME                                       'node_load'
         47        SEND_VAR_EX                                              !2
         48        DO_FCALL                                      0  $21     
         49        ASSIGN                                                   !3, $21
   77    50        ASSIGN_OBJ                                               !3, 'status'
         51        OP_DATA                                                  1
   78    52        INIT_FCALL                                               'date'
         53        FETCH_CONSTANT                                   ~25     'REQUEST_TIME'
         54        SEND_VAL                                                 ~25
         55        DO_ICALL                                         $26     
         56        ASSIGN_OBJ                                               !3, 'changed'
         57        OP_DATA                                                  $26
   79    58        INIT_FCALL_BY_NAME                                       'node_save'
         59        SEND_VAR_EX                                              !3
         60        DO_FCALL                                      0          
   80    61      > RETURN                                                   null

End of function tour_scheduling_action_enable_timeslot

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.67 ms | 1408 KiB | 15 Q