3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Current Configuration Analyzer * * @since 2.0 * @version 2.0-alpha * @copyright 2009-2014 YOURLS * @license MIT */ namespace YOURLS\Configuration; use YOURLS\Extensions\Filters; class Configuration { /** * Check if an upgrade is needed * */ public function upgrade_is_needed() { // check YOURLS_DB_VERSION exist && match values stored in YOURLS_DB_TABLE_OPTIONS list( $current_ver, $current_sql ) = Environment::current_version(); return $current_sql < YOURLS_DB_VERSION; } /** * * @since 2.0 * @todo Review and PHPDoc */ public static function is( $config ) { if ( defined( 'YOURLS_' . strtoupper( $config ) ) && is_bool( constant( 'YOURLS_' . strtoupper( $config ) ) ) ) { return constant( 'YOURLS_' . strtoupper( $config ) ); } if ( method_exists( $this, 'is_' . $config ) ) { return call_user_func(array( $this, 'is_' . $config ) ); } return false; } /** * Determine if the current page is private * */ public function is_privated() { $private = false; if ( defined( 'YOURLS_PRIVATE' ) && YOURLS_PRIVATE == true ) { // Allow overruling for particular pages: // API if( is_API() ) { if( !defined( 'YOURLS_PRIVATE_API' ) || YOURLS_PRIVATE_API != false ) $private = true; // Infos } elseif( is_infos() ) { if( !defined( 'YOURLS_PRIVATE_INFOS' ) || YOURLS_PRIVATE_INFOS !== false ) $private = true; // Others } else { $private = true; } } return Filters::apply_filter( 'is_private', $private ); } /** * Allow several short URLs for the same long URL ? * */ public function allow_duplicate_longurls() { // special treatment if API to check for WordPress plugin requests if( is_API() ) { if ( isset( $_REQUEST[ 'source' ] ) && $_REQUEST[ 'source' ] == 'plugin' ) return false; } return ( defined( 'UNIQUE_URLS' ) && UNIQUE_URLS == false ); } /** * Check if YOURLS is installed * * @todo Review completely this function with a try catch when connecting database */ public function is_installed() { global $ydb; $is_installed = ( property_exists( $ydb, 'installed' ) && $ydb->installed == true ); return $is_installed; } /** * Check if we'll need interface display function (i.e. not API or redirection) * */ public function has_interface() { return is( 'api' ) || is( 'go' ); } /** * Check if current session is valid and secure as configured * */ public function is_public_or_logged() { if ( !is_privated() ) return true; else return defined( 'YOURLS_USER' ); } /** * Check for maintenance mode. If yes, die. See maintenance_mode(). Stolen from WP. * * @todo Rewrite and fix die */ public function check_maintenance_mode() { $file = YOURLS_ABSPATH . '/.maintenance' ; if ( !file_exists( $file ) || is_upgrading() || is_installing() ) return; global $maintenance_start; include_once( $file ); // If the $maintenance_start timestamp is older than 10 minutes, don't die. if ( ( time() - $maintenance_start ) >= 600 ) return; // Use any /user/maintenance.php file if( file_exists( YOURLS_USERDIR.'/maintenance.php' ) ) { include_once( YOURLS_USERDIR.'/maintenance.php' ); die(); } // https://www.youtube.com/watch?v=Xw-m4jEY-Ns $title = _( 'Service temporarily unavailable' ); $message = _( 'Our service is currently undergoing scheduled maintenance.' ) . "</p><p>" . _( 'Things should not last very long, thank you for your patience and please excuse the inconvenience' ); die( $message/*, $title , 503 */); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/voFaq
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  156     0  E > > RETURN                                                   1

Class YOURLS\Configuration\Configuration:
Function upgrade_is_needed:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/voFaq
function name:  upgrade_is_needed
number of ops:  11
compiled vars:  !0 = $current_ver, !1 = $current_sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_STATIC_METHOD_CALL                                  'YOURLS%5CConfiguration%5CEnvironment', 'current_version'
          1        DO_FCALL                                      0  $2      
          2        FETCH_LIST_R                                     $3      $2, 0
          3        ASSIGN                                                   !0, $3
          4        FETCH_LIST_R                                     $5      $2, 1
          5        ASSIGN                                                   !1, $5
          6        FREE                                                     $2
   26     7        FETCH_CONSTANT                                   ~7      'YOURLS%5CConfiguration%5CYOURLS_DB_VERSION'
          8        IS_SMALLER                                       ~8      !1, ~7
          9      > RETURN                                                   ~8
   27    10*     > RETURN                                                   null

End of function upgrade_is_needed

Function is:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 20
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 44
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/voFaq
function name:  is
number of ops:  46
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
   35     1        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cdefined'
          2        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cstrtoupper'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $1      
          5        CONCAT                                           ~2      'YOURLS_', $1
          6        SEND_VAL_EX                                              ~2
          7        DO_FCALL                                      0  $3      
          8      > JMPZ_EX                                          ~4      $3, ->20
   36     9    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cis_bool'
         10        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cconstant'
         11        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cstrtoupper'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0  $5      
         14        CONCAT                                           ~6      'YOURLS_', $5
         15        SEND_VAL_EX                                              ~6
         16        DO_FCALL                                      0  $7      
         17        SEND_VAR_NO_REF_EX                                       $7
         18        DO_FCALL                                      0  $8      
         19        BOOL                                             ~4      $8
         20    > > JMPZ                                                     ~4, ->29
   38    21    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cconstant'
         22        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cstrtoupper'
         23        SEND_VAR_EX                                              !0
         24        DO_FCALL                                      0  $9      
         25        CONCAT                                           ~10     'YOURLS_', $9
         26        SEND_VAL_EX                                              ~10
         27        DO_FCALL                                      0  $11     
         28      > RETURN                                                   $11
   40    29    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cmethod_exists'
         30        FETCH_THIS                                       $12     
         31        SEND_VAR_EX                                              $12
         32        CONCAT                                           ~13     'is_', !0
         33        SEND_VAL_EX                                              ~13
         34        DO_FCALL                                      0  $14     
         35      > JMPZ                                                     $14, ->44
   42    36    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Ccall_user_func'
         37        FETCH_THIS                                       ~15     
         38        INIT_ARRAY                                       ~16     ~15
         39        CONCAT                                           ~17     'is_', !0
         40        ADD_ARRAY_ELEMENT                                ~16     ~17
         41        SEND_VAL_EX                                              ~16
         42        DO_FCALL                                      0  $18     
         43      > RETURN                                                   $18
   45    44    > > RETURN                                                   <false>
   46    45*     > RETURN                                                   null

End of function is

Function is_privated:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 38
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 47) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 20
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 37
Branch analysis from position: 26
2 jumps found. (Code = 47) Position 1 = 31, Position 2 = 34
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 36
Branch analysis from position: 34
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Branch analysis from position: 8
filename:       /in/voFaq
function name:  is_privated
number of ops:  44
compiled vars:  !0 = $private
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   ASSIGN                                                   !0, <false>
   55     1        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cdefined'
          2        SEND_VAL_EX                                              'YOURLS_PRIVATE'
          3        DO_FCALL                                      0  $2      
          4      > JMPZ_EX                                          ~3      $2, ->8
          5    >   FETCH_CONSTANT                                   ~4      'YOURLS%5CConfiguration%5CYOURLS_PRIVATE'
          6        BOOL                                             ~5      ~4
          7        BOOL                                             ~3      ~5
          8    > > JMPZ                                                     ~3, ->38
   60     9    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cis_API'
         10        DO_FCALL                                      0  $6      
         11      > JMPZ                                                     $6, ->23
   61    12    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cdefined'
         13        SEND_VAL_EX                                              'YOURLS_PRIVATE_API'
         14        DO_FCALL                                      0  $7      
         15        BOOL_NOT                                         ~8      $7
         16      > JMPNZ_EX                                         ~8      ~8, ->20
         17    >   FETCH_CONSTANT                                   ~9      'YOURLS%5CConfiguration%5CYOURLS_PRIVATE_API'
         18        BOOL                                             ~10     ~9
         19        BOOL                                             ~8      ~10
         20    > > JMPZ                                                     ~8, ->22
   62    21    >   ASSIGN                                                   !0, <true>
         22    > > JMP                                                      ->38
   65    23    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cis_infos'
         24        DO_FCALL                                      0  $12     
         25      > JMPZ                                                     $12, ->37
   66    26    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cdefined'
         27        SEND_VAL_EX                                              'YOURLS_PRIVATE_INFOS'
         28        DO_FCALL                                      0  $13     
         29        BOOL_NOT                                         ~14     $13
         30      > JMPNZ_EX                                         ~14     ~14, ->34
         31    >   FETCH_CONSTANT                                   ~15     'YOURLS%5CConfiguration%5CYOURLS_PRIVATE_INFOS'
         32        TYPE_CHECK                                  1018  ~16     ~15
         33        BOOL                                             ~14     ~16
         34    > > JMPZ                                                     ~14, ->36
   67    35    >   ASSIGN                                                   !0, <true>
         36    > > JMP                                                      ->38
   71    37    >   ASSIGN                                                   !0, <true>
   76    38    >   INIT_STATIC_METHOD_CALL                                  'YOURLS%5CExtensions%5CFilters', 'apply_filter'
         39        SEND_VAL_EX                                              'is_private'
         40        SEND_VAR_EX                                              !0
         41        DO_FCALL                                      0  $19     
         42      > RETURN                                                   $19
   77    43*     > RETURN                                                   null

End of function is_privated

Function allow_duplicate_longurls:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 10
Branch analysis from position: 12
filename:       /in/voFaq
function name:  allow_duplicate_longurls
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   85     0  E >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cis_API'
          1        DO_FCALL                                      0  $0      
          2      > JMPZ                                                     $0, ->12
   86     3    >   FETCH_IS                                         ~1      '_REQUEST'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, 'source'
          5      > JMPZ_EX                                          ~2      ~2, ->10
          6    >   FETCH_R                      global              ~3      '_REQUEST'
          7        FETCH_DIM_R                                      ~4      ~3, 'source'
          8        IS_EQUAL                                         ~5      ~4, 'plugin'
          9        BOOL                                             ~2      ~5
         10    > > JMPZ                                                     ~2, ->12
   87    11    > > RETURN                                                   <false>
   90    12    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cdefined'
         13        SEND_VAL_EX                                              'UNIQUE_URLS'
         14        DO_FCALL                                      0  $6      
         15      > JMPZ_EX                                          ~7      $6, ->19
         16    >   FETCH_CONSTANT                                   ~8      'YOURLS%5CConfiguration%5CUNIQUE_URLS'
         17        BOOL_NOT                                         ~9      ~8
         18        BOOL                                             ~7      ~9
         19    > > RETURN                                                   ~7
   91    20*     > RETURN                                                   null

End of function allow_duplicate_longurls

Function is_installed:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/voFaq
function name:  is_installed
number of ops:  12
compiled vars:  !0 = $ydb, !1 = $is_installed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   99     0  E >   BIND_GLOBAL                                              !0, 'ydb'
  100     1        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cproperty_exists'
          2        SEND_VAR_EX                                              !0
          3        SEND_VAL_EX                                              'installed'
          4        DO_FCALL                                      0  $2      
          5      > JMPZ_EX                                          ~3      $2, ->9
          6    >   FETCH_OBJ_R                                      ~4      !0, 'installed'
          7        BOOL                                             ~5      ~4
          8        BOOL                                             ~3      ~5
          9    >   ASSIGN                                                   !1, ~3
  102    10      > RETURN                                                   !1
  103    11*     > RETURN                                                   null

End of function is_installed

Function has_interface:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/voFaq
function name:  has_interface
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  110     0  E >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cis'
          1        SEND_VAL_EX                                              'api'
          2        DO_FCALL                                      0  $0      
          3      > JMPNZ_EX                                         ~1      $0, ->8
          4    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cis'
          5        SEND_VAL_EX                                              'go'
          6        DO_FCALL                                      0  $2      
          7        BOOL                                             ~1      $2
          8    > > RETURN                                                   ~1
  111     9*     > RETURN                                                   null

End of function has_interface

Function is_public_or_logged:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/voFaq
function name:  is_public_or_logged
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  118     0  E >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cis_privated'
          1        DO_FCALL                                      0  $0      
          2        BOOL_NOT                                         ~1      $0
          3      > JMPZ                                                     ~1, ->6
  119     4    > > RETURN                                                   <true>
          5*       JMP                                                      ->10
  121     6    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cdefined'
          7        SEND_VAL_EX                                              'YOURLS_USER'
          8        DO_FCALL                                      0  $2      
          9      > RETURN                                                   $2
  122    10*     > RETURN                                                   null

End of function is_public_or_logged

Function check_maintenance_mode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
2 jumps found. (Code = 47) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 35
Branch analysis from position: 31
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 11
filename:       /in/voFaq
function name:  check_maintenance_mode
number of ops:  50
compiled vars:  !0 = $file, !1 = $maintenance_start, !2 = $title, !3 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  131     0  E >   FETCH_CONSTANT                                   ~4      'YOURLS%5CConfiguration%5CYOURLS_ABSPATH'
          1        CONCAT                                           ~5      ~4, '%2F.maintenance'
          2        ASSIGN                                                   !0, ~5
  132     3        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cfile_exists'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $7      
          6        BOOL_NOT                                         ~8      $7
          7      > JMPNZ_EX                                         ~8      ~8, ->11
          8    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cis_upgrading'
          9        DO_FCALL                                      0  $9      
         10        BOOL                                             ~8      $9
         11    > > JMPNZ_EX                                         ~8      ~8, ->15
         12    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cis_installing'
         13        DO_FCALL                                      0  $10     
         14        BOOL                                             ~8      $10
         15    > > JMPZ                                                     ~8, ->17
  133    16    > > RETURN                                                   null
  135    17    >   BIND_GLOBAL                                              !1, 'maintenance_start'
  137    18        INCLUDE_OR_EVAL                                          !0, INCLUDE_ONCE
  139    19        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Ctime'
         20        DO_FCALL                                      0  $12     
         21        SUB                                              ~13     $12, !1
         22        IS_SMALLER_OR_EQUAL                                      600, ~13
         23      > JMPZ                                                     ~14, ->25
  140    24    > > RETURN                                                   null
  143    25    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5Cfile_exists'
         26        FETCH_CONSTANT                                   ~15     'YOURLS%5CConfiguration%5CYOURLS_USERDIR'
         27        CONCAT                                           ~16     ~15, '%2Fmaintenance.php'
         28        SEND_VAL_EX                                              ~16
         29        DO_FCALL                                      0  $17     
         30      > JMPZ                                                     $17, ->35
  144    31    >   FETCH_CONSTANT                                   ~18     'YOURLS%5CConfiguration%5CYOURLS_USERDIR'
         32        CONCAT                                           ~19     ~18, '%2Fmaintenance.php'
         33        INCLUDE_OR_EVAL                                          ~19, INCLUDE_ONCE
  145    34      > EXIT                                                     
  149    35    >   INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5C_'
         36        SEND_VAL_EX                                              'Service+temporarily+unavailable'
         37        DO_FCALL                                      0  $21     
         38        ASSIGN                                                   !2, $21
  150    39        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5C_'
         40        SEND_VAL_EX                                              'Our+service+is+currently+undergoing+scheduled+maintenance.'
         41        DO_FCALL                                      0  $23     
         42        CONCAT                                           ~24     $23, '%3C%2Fp%3E%3Cp%3E'
  151    43        INIT_NS_FCALL_BY_NAME                                    'YOURLS%5CConfiguration%5C_'
         44        SEND_VAL_EX                                              'Things+should+not+last+very+long%2C+thank+you+for+your+patience+and+please+excuse+the+inconvenience'
         45        DO_FCALL                                      0  $25     
         46        CONCAT                                           ~26     ~24, $25
  150    47        ASSIGN                                                   !3, ~26
  152    48      > EXIT                                                     !3
  154    49*     > RETURN                                                   null

End of function check_maintenance_mode

End of class YOURLS\Configuration\Configuration.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.34 ms | 1423 KiB | 42 Q