idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
900 | private function wrapEqualityCriteria ( ) { if ( $ this -> currentField && ! isset ( $ this -> query [ $ this -> currentField ] ) && ! array_key_exists ( $ this -> currentField , $ this -> query ) ) { return ; } if ( $ this -> currentField ) { $ query = & $ this -> query [ $ this -> currentField ] ; } else { $ query = ... | Wraps equality criteria with an operator . |
901 | protected function sentRegistrationMail ( ) { $ emailConfig = $ this -> getConfig ( 'email' ) ; foreach ( [ 'bodyTemplate' , 'from' , 'to' , 'subject' , 'smtpOptions' ] as $ option ) { if ( ! isset ( $ emailConfig [ $ option ] ) ) { throw new InvalidArgumentException ( "Invalid '{$option}' option for email config" ) ; ... | Send email to approve registration |
902 | public function setProtectedProperty ( $ object , string $ property , $ value ) { if ( ! is_object ( $ object ) ) { $ msg = $ this -> getErrorMessage ( 1 , __METHOD__ , $ object ) ; throw new InvalidArgumentException ( $ msg ) ; } $ class = new ReflectionClass ( $ object ) ; $ property = $ class -> getProperty ( $ prop... | Sets a protected or private property . |
903 | public function run ( ) { $ states = $ state_names = $ counties = [ ] ; $ id_states = $ id_counties = 0 ; foreach ( $ this -> data [ 'states' ] as $ state ) { $ states [ ] = sprintf ( "(%s, %s, '%s', '%s')" , ++ $ id_states , $ this -> data [ 'country' ] , $ state [ 'code' ] , str_replace ( "'" , "\\'" , $ state [ 'nam... | Generates SQL to populate the Address table |
904 | protected function generateChunks ( string $ stmt , array $ entries ) { $ result = '' ; foreach ( array_chunk ( $ entries , self :: CHUNK_SIZE ) as $ chunk ) { $ result .= $ stmt . "\n" . implode ( "\n" , Utils :: arrayAppendLast ( $ chunk , ";\n\n" , ',' ) ) ; } return $ result ; } | Generates chunks of entries with the same statement |
905 | public function created ( CategoryTranslation $ categoryTranslation ) { DB :: table ( 'netcore_category__category_translations' ) -> where ( 'id' , $ categoryTranslation -> id ) -> update ( [ 'full_slug' => $ categoryTranslation -> getFullSlug ( ) ] ) ; } | Listen to the CategoryTranslation created event . |
906 | public function updated ( CategoryTranslation $ categoryTranslation ) { DB :: table ( 'netcore_category__category_translations' ) -> where ( 'id' , $ categoryTranslation -> id ) -> update ( [ 'full_slug' => $ categoryTranslation -> getFullSlug ( ) ] ) ; dispatch ( new RegenerateCategoryFullSlugs ( $ categoryTranslation... | Listen to the CategoryTranslation updated event . |
907 | public function hydrate ( Entity & $ model ) { foreach ( $ model -> getAsserts ( ) as $ field => $ asserts ) { if ( $ this -> app [ 'request' ] -> files -> has ( $ field ) ) { $ file = $ this -> app [ 'request' ] -> files -> get ( $ field ) ; if ( $ file instanceof UploadedFile ) { $ model -> dispatch ( 'upload' , [ $ ... | Hydrates a model from a request |
908 | protected function verifyMainEntries ( $ priorities , WebRequest $ request ) { foreach ( $ priorities as $ priority => $ entries ) { $ priorities [ $ priority ] = $ this -> verifyEntries ( $ entries , $ request ) ; } return $ priorities ; } | Verifies the main access levels for the given entries . |
909 | protected function verifyEntries ( $ entries , WebRequest $ request ) { foreach ( $ entries as $ key => $ entry ) { if ( $ entry instanceof \ Zepi \ Web \ General \ Entity \ ProtectedMenuEntry ) { $ result = $ this -> verifyProtectedEntry ( $ entry , $ request ) ; if ( ! $ result ) { unset ( $ entries [ $ key ] ) ; } }... | Verifies the access levels for the given entries . |
910 | protected function verifyProtectedEntry ( ProtectedMenuEntry $ protectedEntry , WebRequest $ request ) { if ( ! $ request -> hasSession ( ) ) { return false ; } if ( $ request -> hasSession ( ) && $ protectedEntry -> getAccessLevelKey ( ) === '' ) { return true ; } if ( $ request -> getSession ( ) -> hasAccess ( $ prot... | Verifies a protected menu entry . |
911 | public static function make ( $ apiKey = null , $ registerDefaultCallback = true ) { $ config = new Config ( $ apiKey ? : getenv ( 'AFTERBUG_API_KEY' ) ) ; $ client = new static ( $ config , static :: makeGuzzle ( $ config ) ) ; if ( $ registerDefaultCallback ) { $ client -> registerDefaultCallbacks ( ) ; } return $ cl... | Create new AfterBug instance . |
912 | public function registerCallback ( callable $ callback ) { $ this -> pipeline -> pipe ( $ callback ) -> process ( $ this -> config ) ; return $ this ; } | Register custom callback . |
913 | public function registerDefaultCallbacks ( ) { $ this -> registerCallback ( new Http ( $ this -> request ) ) -> registerCallback ( new RequestUser ( $ this -> request ) ) -> registerCallback ( new HostName ( ) ) ; return $ this ; } | Register default callbacks . |
914 | private function send ( $ data ) { if ( version_compare ( ClientInterface :: VERSION , '5' ) === 1 ) { return $ this -> guzzle -> post ( '/' , [ 'headers' => [ 'AfterBug-Token' => $ this -> config -> getApiKey ( ) , ] , 'json' => $ data , ] ) ; } return $ this -> guzzle -> request ( 'POST' , '/' , [ RequestOptions :: J... | Send exception data to AfterBug . |
915 | public function catchException ( $ exception ) { if ( in_array ( get_class ( $ exception ) , $ this -> config -> getExcludeExceptions ( ) ) ) { return ; } try { $ this -> send ( Formatter :: make ( $ exception , $ this -> config ) -> toArray ( ) ) ; } catch ( Exception $ exception ) { error_log ( 'AfterBug Error: Could... | Notify AfterBug of an exception . |
916 | private function validateType ( array $ types ) : bool { $ value = $ this -> value ; $ length = \ strlen ( $ value ) ; $ foundPrefix = false ; $ foundLength = false ; foreach ( $ types as $ type ) { foreach ( $ this -> validationData [ $ type ] [ 'prefixes' ] as $ prefix ) { if ( \ substr ( $ value , 0 , \ strlen ( $ p... | Validates credit card type |
917 | private function validateNumber ( ) : bool { $ value = $ this -> value ; $ length = \ strlen ( $ value ) ; $ sum = 0 ; $ weight = 2 ; if ( $ length < 2 ) { $ this -> setError ( self :: VALIDATOR_ERROR_CREDIT_CARD_NUMBER_NOT_VALID ) ; return false ; } for ( $ i = $ length - 2 ; $ i >= 0 ; $ i -- ) { $ digit = $ weight *... | Validates credit card number |
918 | public function predictException ( callable $ capture , string $ exceptionClass ) { try { call_user_func ( $ capture ) ; throw new PredictExceptionFailure ( "Capture was expected to throw '$exceptionClass' but did not." ) ; } catch ( \ Throwable $ ex ) { $ actualExceptionClass = get_class ( $ ex ) ; if ( $ actualExcept... | Method to assure that a piece of code executed inside of a capture throws an exception and compare the type of it with a given class name |
919 | public function execute ( string $ uri = null ) : ApplicationInterface { $ route = App :: resolve ( 'Router' ) -> getRoute ( $ uri ) ; $ middleware = App :: resolve ( 'Middleware' , [ $ route -> getMiddlewares ( ) ] ) ; $ this -> results = $ middleware -> dispatch ( function ( ) use ( $ route , $ uri ) { return App :: ... | Executes instructions from route |
920 | private function buildQuery ( $ limit = null , $ username = null ) { if ( $ username !== null ) { $ this -> base -> where ( 'username' , $ username ) ; } if ( $ limit !== null ) { $ this -> base -> limit ( $ limit ) ; } return $ this -> base ; } | build database query |
921 | protected function _containerListHas ( $ key , $ list ) { $ list = $ this -> _normalizeIterable ( $ list ) ; foreach ( $ list as $ _container ) { if ( $ this -> _containerHas ( $ _container , $ key ) ) { return true ; } } return false ; } | Checks if a list of containers has the specified key . |
922 | public function createTable ( $ nbColonnes = 4 , $ styleTableau = 'border:1px;' , $ classTableau = '' , $ cellProperty = '' , $ tableauProperties = '' ) { return $ this -> createHtmlTableFromArray ( $ nbColonnes , $ styleTableau , $ classTableau , $ cellProperty , $ tableauProperties ) ; } | alias de la fonction suivante |
923 | public function displayArrayFromMysqlRes ( $ res ) { $ nbColonnes = 0 ; $ i = 0 ; while ( $ fetch = mysql_fetch_assoc ( $ res ) ) { if ( $ i == 0 ) { foreach ( $ fetch as $ nomField => $ value ) { $ this -> addValue ( $ nomField , "style='font-weight:bold;'" ) ; $ nbColonnes ++ ; } } foreach ( $ fetch as $ nomField => ... | affiche un tableau a partir d un resultat de requete mysql |
924 | private function generateRule ( $ ruleset ) { $ regex = '' ; $ content = 'index.php' ; $ count = 0 ; $ total = count ( $ ruleset ) ; foreach ( $ ruleset as $ ruleChunk ) { $ count ++ ; if ( $ count === 1 ) { $ content .= '?post_type=' . $ this -> postType -> postType ; } if ( preg_match ( '/\{\w+\}/' , $ ruleChunk ) ) ... | Generate a rule for an array that Wordpress can understand . |
925 | public static function S2pv ( $ theta , $ phi , $ r , $ td , $ pd , $ rd , array & $ pv ) { $ st ; $ ct ; $ sp ; $ cp ; $ rcp ; $ x ; $ y ; $ rpd ; $ w ; $ st = sin ( $ theta ) ; $ ct = cos ( $ theta ) ; $ sp = sin ( $ phi ) ; $ cp = cos ( $ phi ) ; $ rcp = $ r * $ cp ; $ x = $ rcp * $ ct ; $ y = $ rcp * $ st ; $ rpd =... | - - - - - - - - i a u S 2 p v - - - - - - - - |
926 | public function add ( $ func ) { ValidationException :: assert ( function ( ) use ( $ func ) { return ! is_callable ( $ func ) ; } , 'function is not callable' ) ; $ this -> func [ ] = $ func ; return $ this ; } | Add a validator |
927 | public static function createSub ( $ name = '' , $ content = null ) { $ class = get_called_class ( ) ; $ element = new $ class ( $ name , $ content ) ; $ element -> sub = true ; return $ element ; } | Creates a subtree . |
928 | public function getParent ( $ n = null ) { return ( $ n > 1 ) ? $ this -> parent -> getParent ( -- $ n ) : $ this -> parent ; } | Returns the parent element . |
929 | public function setOptions ( $ options ) { if ( ! isset ( $ options [ self :: OPTION_LINE_BREAK ] ) && ! isset ( $ options [ self :: OPTION_INDENTATION ] ) && ! isset ( $ options [ self :: OPTION_TEXT_MODE ] ) ) return $ this ; if ( ! $ this -> isAncestor ( ) ) { $ prevAncestor = $ this -> getAncestor ( ) ; $ this -> s... | Sets options for the current element and its childs . |
930 | public function append ( $ name , $ content = null ) { if ( is_array ( $ content ) ) { $ first = $ this -> append ( $ name , $ content [ 0 ] ) ; for ( $ i = 1 ; $ i < count ( $ content ) ; $ i ++ ) { $ this -> append ( $ name , $ content [ $ i ] ) ; } return $ first ; } return $ this -> appendChild ( $ this -> newChild... | Adds a child element . |
931 | public function inject ( Xml $ element ) { $ element -> setAncestor ( $ this -> getAncestor ( ) ) ; $ element -> setRoot ( $ this -> getRoot ( ) ) ; $ element -> parent = $ this ; return $ this -> appendChild ( $ element ) ; } | Appends a previously created subtree . |
932 | public function getMarkup ( $ indentation = '' ) { $ line = $ this -> getOption ( self :: OPTION_LINE_BREAK ) ; $ tab = $ this -> getOption ( self :: OPTION_INDENTATION ) ; $ xmlString = '' ; if ( empty ( $ this -> name ) ) { $ last = count ( $ this -> children ) - 1 ; foreach ( $ this -> children as $ i => $ child ) {... | Generates the desired markup . |
933 | public static function headerfields ( $ filename = null , $ addExtension = true ) { if ( ! empty ( $ filename ) ) { header ( self :: getContentDispositionHeaderfield ( $ filename , $ addExtension ) ) ; } header ( self :: getContentTypeHeaderfield ( ) ) ; } | Sets the header fields Content - Type and Content - Disposition . |
934 | protected function newChild ( $ name , $ content = null ) { $ class = get_class ( $ this ) ; return new $ class ( $ name , $ content , $ this -> getRoot ( ) , $ this -> getAncestor ( ) , $ this ) ; } | Creates a child element . |
935 | protected function mapAttributToProperty ( $ xmlEntry , $ attributName , $ stackEntity ) { switch ( $ xmlEntry -> getName ( ) ) { case 'date' : switch ( $ attributName ) { case 'start' : return 'startDate' ; break ; case 'end' : return 'endDate' ; break ; default : return $ attributName ; break ; } break ; default : sw... | map attributName to property |
936 | public function init ( ) { $ this -> setup -> load_options ( 'AxelSpringer\WP\Bootstrap\__OPTION__' ) ; $ this -> settings = new Settings ( __ ( __TRANSLATE__ :: SETTINGS_PAGE_TITLE ) , __ ( __TRANSLATE__ :: SETTINGS_MENU_TITLE ) , __PLUGIN__ :: SETTINGS_PAGE , __PLUGIN__ :: SETTINGS_PERMISSION , $ this -> setup -> ver... | Initializes the plugin |
937 | public function enqueue_admin_scripts ( ) { wp_register_style ( 'bootstrap-admin-style' , $ this -> plugin_url ( 'admin/admin.css' ) , false , $ this -> setup -> version ) ; wp_register_script ( 'bootstrap-admin-script' , $ this -> plugin_url ( 'admin/admin.js' ) , array ( 'jquery' , 'wp-util' ) , $ this -> setup -> ve... | Enqueue shared styles and scripts |
938 | public function hasAnyTags ( $ tags , string $ group = null , string $ locale = null ) : bool { $ tags = $ this -> parseTags ( $ tags , $ group , $ locale ) ; return ! $ this -> tags -> pluck ( 'id' ) -> intersect ( $ tags ) -> isEmpty ( ) ; } | Determine if the model has any of the given tags . |
939 | public static function parseDelimitedTags ( $ tags ) : array { if ( is_string ( $ tags ) && mb_strpos ( $ tags , static :: $ tagsDelimiter ) !== false ) { $ delimiter = preg_quote ( static :: $ tagsDelimiter , '#' ) ; $ tags = array_map ( 'trim' , preg_split ( "#[{$delimiter}]#" , $ tags , - 1 , PREG_SPLIT_NO_EMPTY ) )... | Parse delimited tags . |
940 | public function attachTags ( $ tags ) { $ this -> tags ( ) -> sync ( $ this -> parseTags ( $ tags ) , false ) ; return $ this ; } | Attach model tags . |
941 | public function syncTags ( $ tags , bool $ detaching = true ) { $ this -> tags ( ) -> sync ( $ this -> parseTags ( $ tags , null , null , true ) , $ detaching ) ; return $ this ; } | Sync model tags . |
942 | public function detachTags ( $ tags = null ) { ! $ tags || $ tags = $ this -> parseTags ( $ tags ) ; $ this -> tags ( ) -> detach ( $ tags ) ; return $ this ; } | Detach model tags . |
943 | protected function parseTags ( $ rawTags , string $ group = null , string $ locale = null , $ create = false ) : array { ( is_iterable ( $ rawTags ) || is_null ( $ rawTags ) ) || $ rawTags = [ $ rawTags ] ; [ $ strings , $ tags ] = collect ( $ rawTags ) -> map ( function ( $ tag ) { ! is_numeric ( $ tag ) || $ tag = ( ... | Parse tags . |
944 | protected function normalizeHeaderName ( $ name ) { return preg_replace_callback ( '/\-(.)/' , function ( $ match ) { return '-' . strtoupper ( $ match [ 1 ] ) ; } , strtr ( ucfirst ( strtolower ( $ name ) ) , '_' , '-' ) ) ; } | Retrieves a normalized Header . |
945 | public function set ( $ key , $ value ) { if ( ! $ value instanceof AdapterInterface ) { throw new InvalidArgumentException ( 'Adding an object that does not implement AdapterInterface ' . 'to AdaptersMap.' ) ; } return parent :: set ( $ key , $ value ) ; } | Puts a new adapter in the map . |
946 | protected function _containerSet ( & $ container , $ key , $ value ) { $ key = $ this -> _normalizeKey ( $ key ) ; try { if ( is_array ( $ container ) ) { $ container [ $ key ] = $ value ; return ; } if ( $ container instanceof ArrayAccess ) { $ container -> offsetSet ( $ key , $ value ) ; return ; } if ( $ container i... | Sets data on the container . |
947 | public function run ( ) { if ( ! $ this -> overrideFile ( ) ) { $ this -> output -> writeln ( "<info>File was skipped. The controller was not created.</info>" ) ; return true ; } $ data = $ this -> getControllerMetaData ( ) -> getData ( ) ; $ data = array_merge ( $ data , [ 'controllerName' => $ this -> controllerName ... | Runs this task |
948 | public function getControllerMetaData ( ) { if ( null == $ this -> controllerMetaData ) { $ controller = new Controller ( ) ; $ this -> configureController ( $ controller ) ; $ this -> setControllerMetaData ( $ controller ) ; } return $ this -> controllerMetaData ; } | Gets controllerMetaData property |
949 | public function getTemplateEngine ( ) { if ( null == $ this -> templateEngine ) { Template :: addPath ( dirname ( dirname ( __DIR__ ) ) . '/templates' ) ; $ template = ( new Template ( ) ) -> initialize ( ) ; $ this -> setTemplateEngine ( $ template ) ; } return $ this -> templateEngine ; } | Gets templateEngine property |
950 | public function getBasePath ( ) { if ( null == $ this -> basePath ) { $ this -> basePath = strtolower ( $ this -> controllerName ) ; } return $ this -> basePath ; } | Gets basePath property |
951 | public function getQuestionHelper ( ) { if ( null == $ this -> questionHelper ) { $ this -> setQuestionHelper ( $ this -> getCommand ( ) -> getHelper ( 'question' ) ) ; } return $ this -> questionHelper ; } | Gets questionHelper property |
952 | protected function overrideFile ( ) { if ( ! is_file ( $ this -> getControllerFile ( ) ) ) { return true ; } $ question = new ConfirmationQuestion ( "\nThe file <comment>{$this->controllerFile}</comment> already " . "exists. Override it (y,N)? " , false , '/^(y|yes)/i' ) ; return ( boolean ) $ this -> getQuestionHelper... | Check controller file existence and ask if can be overridden |
953 | protected function checkPause ( ) { parent :: checkPause ( ) ; foreach ( $ this -> slaves as $ slave ) { $ this -> checkSlave ( $ slave ) ; } } | Check whether necessary to pause for slave lag |
954 | protected function checkSlave ( Connection $ connection ) { $ paused = 0 ; while ( ( $ lag = $ this -> getLag ( $ connection ) ) > $ this -> options [ 'max_lag' ] ) { $ this -> paused = true ; $ for = $ this -> options [ 'pause_lag' ] ; $ this -> logger -> notice ( 'Chunk detected lag of {lag} on {database}, pausing fo... | Checks the given slave connection for lag |
955 | public function printException ( DefinitionInterface $ definition , $ exception ) { $ traceAsString = $ this -> getTraceAsString ( $ definition , $ exception ) ; $ this -> printError ( "\nError %s #%s during test %s \n%s \nin %s\n\n%s" , get_class ( $ exception ) , $ exception -> getCode ( ) , $ this -> getTestDescript... | Prints the exception for the given test definition |
956 | private function fromCamelCase ( $ input ) { $ a = preg_split ( '/(^[^A-Z]+|[A-Z][^A-Z]+)/' , $ input , - 1 , PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ) ; return strtolower ( join ( $ a , "-" ) ) ; } | Converts camelCase string to have spaces between each . |
957 | public static function exists ( $ currency ) { if ( $ currency instanceof CurrencyInterface ) { $ currency = $ currency -> getIsoCode ( ) ; } self :: loadSpecifications ( ) ; return array_key_exists ( strtolower ( $ currency ) , self :: $ specifications ) ; } | Checks whether a currency is allowed in the current context |
958 | private static function loadSpecifications ( ) { if ( ! self :: $ specifications ) { $ content = file_get_contents ( __DIR__ . '/../data/currencies.json' ) ; self :: $ specifications = Json :: decode ( $ content , Json :: TYPE_ARRAY ) ; } } | Loads currencies specs |
959 | public function render ( Renderable $ renderable , $ render = null ) { $ render = $ this -> renderProvider -> get ( $ render ) ; return $ render -> render ( $ renderable ) ; } | Renders a form |
960 | public function actionUpdate ( ) { $ activeTheme = ThemeManager :: getActiveTheme ( ) ; $ model = new DynamicModel ( [ 'activeIndex' => $ activeTheme === false ? false : key ( $ activeTheme ) ] ) ; $ model -> addRule ( 'activeIndex' , 'safe' ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { ThemeMana... | Updates an active theme index . |
961 | final static function parseWith ( $ optionsResource , array $ _ = null ) { if ( ! static :: isConfigurableWith ( $ optionsResource ) ) throw new \ InvalidArgumentException ( sprintf ( 'Resource must be an array or string, given: (%s).' , \ Poirot \ Std \ flatten ( $ optionsResource ) ) ) ; $ self = new static ; ( empty... | Build Path From Given Resources |
962 | public function cloneQueryBuilder ( ) { $ paramContent = $ this -> newParamName ( ) ; $ subQuery = clone $ this -> queryBuilder ; $ subQuery -> resetDQLParts ( ) ; $ subQuery -> setParameters ( [ ] ) ; $ subQuery -> select ( $ paramContent ) -> from ( 'OpiferCmsBundle:Content' , $ paramContent ) ; return $ subQuery ; } | Clone the query builder |
963 | public function getQueryResults ( $ limit = null ) { if ( isset ( $ limit ) ) { $ this -> queryBuilder -> setMaxResults ( $ limit ) ; } if ( ! $ this -> queryBuilder -> getDQLPart ( 'orderBy' ) ) { $ this -> queryBuilder -> orderBy ( 'a.createdAt' , 'ASC' ) ; } return $ this -> queryBuilder -> getQuery ( ) -> getResult... | Get the query result |
964 | protected function retrieveHandler ( array & $ data ) { $ controller = array_shift ( $ data ) ; $ action = array_shift ( $ data ) ; return [ $ controller , $ action ] ; } | Retrieve controller action pair |
965 | protected function retrieveParams ( array $ data ) { $ params = [ ] ; foreach ( $ data as $ i => $ val ) { if ( 0 === $ i % 2 ) { $ params [ $ val ] = $ data [ $ i + 1 ] ; } } return $ params ; } | Retrieve pair of params |
966 | public function isForPackage ( PackageInterface $ package ) { if ( $ this -> getForPackage ( ) !== $ package -> getName ( ) ) { return false ; } $ fpv = $ this -> getForPackageVersion ( ) ; if ( $ fpv !== null ) { $ pv = new Constraint ( '=' , $ package -> getVersion ( ) ) ; if ( ! $ fpv -> matches ( $ pv ) ) { return ... | Check if this patch is for a package . |
967 | public function getHash ( ) { if ( $ this -> hash === null ) { $ this -> hash = sha1_file ( $ this -> getLocalPath ( ) ) ; } return $ this -> hash ; } | Get the hash of this patch . |
968 | public function addNewContent ( $ text , $ renderer ) { $ sortorder = $ this -> getContents ( ) -> count ( ) ; $ newContent = new Content ; $ newContent -> setContent ( $ text ) ; $ newContent -> setRenderer ( $ renderer ) ; $ newContent -> generatePermid ( ) ; $ newContent -> setSortorder ( ++ $ sortorder ) ; $ newCon... | Add new content by text and renderer |
969 | public function write ( string $ id , array $ data ) : bool { static $ create , $ update , $ delete ; $ values = $ data + compact ( 'id' ) ; unset ( $ values [ 'dateactive' ] ) ; if ( ! isset ( $ create , $ update ) ) { $ fields = [ ] ; $ placeholders = [ ] ; $ updates = [ ] ; foreach ( $ values as $ key => & $ value )... | Write back data . |
970 | public function gc ( int $ maxlifetime ) : bool { static $ stmt ; if ( ! isset ( $ stmt ) ) { $ stmt = $ this -> pdo -> prepare ( "DELETE FROM cesession_session WHERE dateactive < ?" ) ; } $ stmt -> execute ( [ date ( 'Y-m-d H:i:s' , strtotime ( "-$maxlifetime second" ) ) ] ) ; return ( $ affectedRows = $ stmt -> rowCo... | Run garbase collection . |
971 | public function delete ( ) { if ( empty ( static :: $ table ) ) $ table = strtolower ( substr ( static :: class , strpos ( static :: class , '\\' ) + 1 ) ) ; else $ table = static :: $ table ; if ( $ table != '' ) { if ( $ this -> _id != '' || ( is_array ( $ this -> _id ) && count ( $ this -> _id ) > 0 ) ) { $ before =... | delete Fungsi untuk menghapus record |
972 | protected static function _run ( $ name , $ type ) { $ version = \ Cli :: option ( 'v' , \ Cli :: option ( 'version' , '' ) ) ; if ( $ version === true ) { \ Cli :: write ( 'Currently installed migrations for ' . $ type . ':' . $ name . ':' , 'green' ) ; foreach ( \ Config :: get ( 'migrations.version.' . $ type . '.' ... | migrates to the latest version unless - version is specified |
973 | protected static function _current ( $ name , $ type ) { if ( \ Cli :: option ( 'v' , \ Cli :: option ( 'version' , '' ) ) !== '' ) { \ Cli :: write ( 'You can not define a version when using the "current" command.' , 'red' ) ; } $ migrations = \ Migrate :: current ( $ name , $ type ) ; if ( $ migrations ) { \ Cli :: w... | migrates item to current config version |
974 | protected static function _up ( $ name , $ type ) { $ version = \ Cli :: option ( 'v' , \ Cli :: option ( 'version' , null ) ) ; if ( $ version and ( static :: $ default + static :: $ module_count + static :: $ package_count > 1 ) ) { \ Cli :: write ( 'Migration: version only accepts 1 item.' ) ; return ; } $ migration... | migrates item up to the given version |
975 | protected static function _down ( $ name , $ type ) { $ version = \ Cli :: option ( 'v' , \ Cli :: option ( 'version' , null ) ) ; if ( $ version and ( static :: $ default + static :: $ module_count + static :: $ package_count > 1 ) ) { \ Cli :: write ( 'Migration: version only accepts 1 item.' ) ; return ; } $ migrati... | migrates item down to the given version |
976 | public function loadDictionary ( ) { if ( self :: $ dictionary_loaded ) { return true ; } $ xmldoc = new \ DOMDocument ( ) ; if ( ! $ xmldoc -> load ( $ this -> localization_path . "texts.xml" ) ) { throw new \ Exception ( "Translation file '" . $ this -> localization_path . "texts.xml" . "' cannot be loaded!" ) ; } $ ... | This is internal auxiliary function for loading the translations from the source XML file . |
977 | public function detectLanguage ( $ context = "default" ) { self :: $ context = $ context ; $ language = "en" ; foreach ( self :: $ supported_languages as $ lng ) { $ language = $ lng ; break ; } if ( isset ( $ _SERVER [ "HTTP_ACCEPT_LANGUAGE" ] ) && trim ( $ _SERVER [ "HTTP_ACCEPT_LANGUAGE" ] ) != "" ) { $ accepted = e... | This function should detect the current language based on cookies browser languages etc . |
978 | public function setCurrentLanguage ( $ language ) { if ( empty ( self :: $ supported_languages [ $ language ] ) ) { return false ; } self :: $ current_language = $ language ; session ( ) -> vars ( ) [ self :: $ context . "_language" ] = $ language ; setcookie ( self :: $ context . "_language" , $ language , time ( ) + ... | Sets the current language . |
979 | public function text ( $ text_id , $ lng = "" , $ warn_missing = true , $ default_text = "" ) { if ( empty ( $ lng ) ) { $ lng = $ this -> getCurrentLanguage ( ) ; } if ( empty ( self :: $ texts [ $ lng ] [ $ text_id ] ) ) { if ( $ warn_missing ) { trigger_error ( "No translation for the text '$text_id' in the language... | Provides the text translation for the text ID for the given langauge . |
980 | public function hasTranslation ( $ text_id , $ lng = "" ) { if ( empty ( $ lng ) ) { $ lng = $ this -> getCurrentLanguage ( ) ; } return ! empty ( self :: $ texts [ $ lng ] [ $ text_id ] ) ; } | Checks whether the text translation for the text ID for the given langauge exists . |
981 | public function getLanguageName ( $ code , $ lng = "" , $ warn_missing = true ) { if ( empty ( $ lng ) ) { $ lng = $ this -> getCurrentLanguage ( ) ; } if ( empty ( self :: $ languages [ $ lng ] [ $ code ] ) ) { if ( $ warn_missing ) { trigger_error ( "No translation for the language name [$code] in the language [$lng]... | Provides the text translation for the language name by the code for the given langauge . |
982 | public function getLanguageCode ( $ lang_name ) { foreach ( self :: $ supported_languages as $ lng ) { if ( empty ( self :: $ languages [ $ lng ] ) ) { continue ; } foreach ( self :: $ languages [ $ lng ] as $ code => $ translation ) { if ( strcasecmp ( $ lang_name , $ translation ) == 0 ) { return $ code ; } } } retur... | Tries to find the language code by the given name . |
983 | public function getLanguageList ( & $ language_list , $ lng = "" ) { if ( empty ( $ lng ) ) { $ lng = $ this -> getCurrentLanguage ( ) ; } if ( empty ( self :: $ languages [ $ lng ] ) ) { return false ; } $ language_list += self :: $ languages [ $ lng ] ; asort ( $ language_list , SORT_LOCALE_STRING ) ; return true ; } | Provides the list of languages for the given language in the form code = > translation . |
984 | public function getCountryName ( $ code , $ lng = "" , $ warn_missing = true ) { if ( empty ( $ lng ) ) { $ lng = $ this -> getCurrentLanguage ( ) ; } if ( empty ( self :: $ countries [ $ lng ] [ $ code ] ) ) { if ( $ warn_missing ) { trigger_error ( "No translation for the country name [$code] in the language [$lng]!"... | Provides the text translation for the country name by the code for the given langauge . |
985 | public function getCountryCode ( $ country_name ) { foreach ( self :: $ supported_languages as $ lng ) { if ( empty ( self :: $ countries [ $ lng ] ) ) { continue ; } foreach ( self :: $ countries [ $ lng ] as $ code => $ translation ) { if ( strcasecmp ( $ country_name , $ translation ) == 0 ) { return $ code ; } } } ... | Tries to find the country code by the given name . |
986 | public function getCountryList ( & $ country_list , $ lng = "" ) { if ( empty ( $ lng ) ) { $ lng = $ this -> getCurrentLanguage ( ) ; } if ( empty ( self :: $ countries [ $ lng ] ) ) { return false ; } $ country_list += self :: $ countries [ $ lng ] ; asort ( $ country_list , SORT_LOCALE_STRING ) ; return true ; } | Provides the list of countries for the given language in the form code = > translation . |
987 | private function add_slugify_helper ( ) { $ this -> engine -> addHelper ( 'slugify' , function ( $ template , $ context , $ args ) { $ arg = $ context -> get ( $ args ) ; return slugify ( $ arg ) ; } ) ; } | Slugify Helper - lets you slugify any string |
988 | private function add_strip_tags ( ) { $ this -> engine -> addHelper ( 'strip_tags' , function ( $ template , $ context , $ args ) { $ arg = $ context -> get ( $ args ) ; return strip_tags ( $ arg ) ; } ) ; } | No Tags Formatter |
989 | private function add_html_special_chars_handler ( ) { $ this -> engine -> addHelper ( 'html_special_chars' , function ( $ template , $ context , $ args ) { $ that = $ context -> get ( 'this' ) ; if ( array_key_exists ( $ args , $ that ) ) { return htmlspecialchars ( $ that [ $ args ] ) ; } } ) ; } | Helper function html_special_chars |
990 | private function add_conditional_operators ( ) { $ this -> engine -> addHelper ( 'if_cond' , function ( $ template , $ context , $ args ) { $ that = $ context -> get ( 'this' ) ; $ handlebars_arguments = new Arguments ( $ args ) ; $ arguments = $ handlebars_arguments -> getPositionalArguments ( ) ; $ value_a = $ argume... | Helper function if_cond |
991 | public function handler ( $ name , Args $ args ) { if ( ! $ this -> checkLevel ( $ args -> get ( 'level' ) ) || ! $ this -> checkSource ( $ args -> get ( 'source' ) ) ) { return ; } switch ( $ name ) { case ':onAddHandler:' : $ args -> set ( 'message' , sprintf ( "Adding handler %s, %s" , $ this -> handlerToString ( $ ... | Logging handler . |
992 | public function onUpdateRegistry ( $ name , Args $ args ) { $ conditions = $ args -> get ( 'conditions' ) ; foreach ( $ conditions as $ key => $ expected ) { $ actual = $ this -> registry -> get ( $ key , null , false ) ; if ( "/" !== substr ( $ expected , 0 , 1 ) ? $ expected !== $ actual : ! preg_match ( $ expected ,... | Updating method registry handler . |
993 | protected function init ( Manager $ evtManager ) { $ this -> evtManager = $ evtManager ; $ events = $ this -> evtManager -> getDebugEvents ( ) ; foreach ( $ events as $ event ) { $ this -> evtManager -> addHandler ( $ event , [ $ this , 'handler' ] ) ; } $ this -> evtManager -> addHandler ( ':updateLogRegistry:' , [ $ ... | Adds event handlers . |
994 | protected function checkSource ( $ source ) { $ sources = $ this -> registry -> get ( 'source' , [ ] ) ; $ result = in_array ( $ source , $ sources ) || in_array ( '*' , $ sources ) ; return $ result ; } | Returns true if passed source published in config file . |
995 | protected function checkLevel ( $ level ) { $ cfgLevel = $ this -> registry -> get ( 'level' , self :: DEFAULT_LEVEL ) ; if ( is_numeric ( $ cfgLevel ) ) { $ cfgLevel = ( int ) $ cfgLevel ; } else if ( is_string ( $ cfgLevel ) && preg_match ( '/^[A-Z_&|^ ]+$/' , $ cfgLevel ) ) { $ cfgLevel = eval ( sprintf ( "return %s... | Returns true if passed level published in config file . |
996 | protected function handlerToString ( $ handler , $ name = '' ) { if ( is_array ( $ handler ) ) { if ( is_object ( $ handler [ 0 ] ) ) { $ class = get_class ( $ handler [ 0 ] ) ; $ call = '->' ; } else { $ class = $ handler [ 0 ] ; $ call = '::' ; } $ result = "{$class}{$call}{$handler[1]}" ; } else { $ result = 'functi... | Returns stringified event handler . |
997 | protected function render ( Args $ args ) { $ format = $ this -> registry -> get ( sprintf ( 'format/%s/%s' , $ this -> registry -> get ( 'env' ) , self :: $ reverseLevel [ $ args -> get ( 'level' ) ] ) , self :: DEFAULT_FORMAT ) ; $ backtrace = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 5 ) ; $ message = str_repl... | Renders message according ro format . |
998 | public function isRemoteCheckRequired ( ) { if ( $ this -> uid && $ this -> sessionToken && $ this -> recheck ) { if ( $ this -> recheck > ( new DateTime ( 'NOW' ) ) ) { return false ; } } return true ; } | Check whether we need to remotely check the session or not |
999 | public function getSessionCheckUrl ( ) { $ url = Maestrano :: with ( $ this -> _preset ) -> sso ( ) -> getSessionCheckUrl ( $ this -> uid , $ this -> sessionToken ) ; return $ url ; } | Return the full url from which session check should be performed |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.