idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
51,700 | public static function register ( ) { $ class = new self ( ) ; Events :: addListener ( array ( $ class , 'screenLogEventListener' ) , 'screenLogEvent' , EventPriority :: NORMAL ) ; $ bar = Debugger :: getBar ( ) ; $ bar -> addPanel ( $ class ) ; } | Register the bar and register the event which will block the screen log |
51,701 | static function cryptoJsAesDecrypt ( $ passphrase , $ jsonString ) { $ jsondata = json_decode ( $ jsonString , true ) ; try { $ salt = hex2bin ( $ jsondata [ "s" ] ) ; $ iv = hex2bin ( $ jsondata [ "iv" ] ) ; } catch ( \ Exception $ e ) { return null ; } $ ct = base64_decode ( $ jsondata [ "ct" ] ) ; $ concatedPassphra... | Decrypt data from a CryptoJS json encoding string |
51,702 | static function cryptoJsAesEncrypt ( $ passphrase , $ value ) { $ salt = openssl_random_pseudo_bytes ( 8 ) ; $ salted = '' ; $ dx = '' ; while ( strlen ( $ salted ) < 48 ) { $ dx = md5 ( $ dx . $ passphrase . $ salt , true ) ; $ salted .= $ dx ; } $ key = substr ( $ salted , 0 , 32 ) ; $ iv = substr ( $ salted , 32 , 1... | Encrypt value to a cryptojs compatiable json encoding string |
51,703 | protected function Init ( ) { $ this -> login = ContentLogin :: Schema ( ) -> ByContent ( $ this -> Content ( ) ) ; $ this -> HandleLoggedIn ( ) ; $ passwordUrl = $ this -> login -> GetPasswordUrl ( ) ; $ this -> passwordUrl = $ passwordUrl ? FrontendRouter :: Url ( $ passwordUrl ) : '' ; $ this -> AddNameField ( ) ; $... | Initializes the login element |
51,704 | public function getIterator ( ) { $ resp = $ this -> query -> execute ( ) ; foreach ( $ resp -> data as $ document ) { yield $ document ; } while ( $ resp -> cursors -> next ) { $ resp = $ this -> query -> execute ( $ resp -> cursors -> next ) ; foreach ( $ resp -> data as $ document ) { yield $ document ; } } } | Required function for any class that implements IteratorAggregate . Will yield documents as they become available . If cursors are returned then subsequent requests will be made yielding more documents . |
51,705 | public function save ( $ doc ) { return $ this -> montage -> request ( 'post' , $ this -> montage -> url ( 'document-save' , $ this -> schema -> name ) , [ 'body' => json_encode ( $ doc ) ] ) ; } | Persist one or more document objects to montage . |
51,706 | public function get ( $ docId ) { return $ this -> montage -> request ( 'get' , $ this -> montage -> url ( 'document-detail' , $ this -> schema -> name , $ docId ) ) ; } | Get a single document by it s ID from montage . |
51,707 | public function delete ( $ docId ) { return $ this -> montage -> request ( 'delete' , $ this -> montage -> url ( 'document-detail' , $ this -> schema -> name , $ docId ) ) ; } | Delete a record with montage . |
51,708 | protected function initializeCallQueues ( ) { $ this -> inputs = new \ Slab \ Sequencer \ CallQueue ( ) ; $ this -> operations = new \ Slab \ Sequencer \ CallQueue ( ) ; $ this -> outputs = new \ Slab \ Sequencer \ CallQueue ( ) ; } | Sequenced constructor . |
51,709 | protected function executeCallQueues ( ) { foreach ( $ this -> inputs -> getEntries ( ) as $ entry ) { $ this -> executeCallQueueEntry ( $ entry ) ; if ( ! $ this -> executeQueues ) return ; } foreach ( $ this -> operations -> getEntries ( ) as $ entry ) { $ this -> executeCallQueueEntry ( $ entry ) ; if ( ! $ this -> ... | Execute call queues |
51,710 | protected function stopCallQueues ( ) { $ this -> executeQueues = false ; $ this -> inputs -> stopExecution ( ) ; $ this -> operations -> stopExecution ( ) ; $ this -> outputs -> stopExecution ( ) ; } | Stop call queues |
51,711 | protected function initSourceImageResource ( ) { $ ext = $ this -> getExtension ( ) ; switch ( $ ext ) { case 'gif' : $ this -> sourceImageResource = ImageCreateFromGif ( $ this -> sourceImagePath ) ; break ; case 'jpg' : $ this -> sourceImageResource = ImageCreateFromJpeg ( $ this -> sourceImagePath ) ; break ; case '... | Init the source image resource |
51,712 | protected function initDestImageResource ( ) { if ( function_exists ( "ImageCreateTrueColor" ) && $ this -> getExtension ( ) != 'gif' ) { $ this -> destImageResource = ImageCreateTrueColor ( $ this -> destImageWidth , $ this -> destImageHeight ) ; } else { $ this -> destImageResource = ImageCreate ( $ this -> destImage... | Init the destination resource image . This is an empty image and use the width and height values of the source image if resize is not called by the user |
51,713 | public function format ( Geo $ geo ) { return '<span class="h-geo">' . '<span class="p-latitude">' . ( string ) $ geo -> getLatitude ( ) . '</span>, ' . '<span class="p-longitude">' . ( string ) $ geo -> getLongitude ( ) . '</span>' . ( $ geo -> getAltitude ( ) === null ? '' : ' (elevation <span class="p-altitude">' . ... | Formats a geo . |
51,714 | function Save ( ) { $ this -> pageRights -> Save ( ) ; if ( ! $ this -> rights ) { $ this -> rights = new BackendSiteRights ( ) ; } $ this -> rights -> SetEdit ( $ this -> Value ( 'Edit' ) ) ; $ this -> rights -> SetRemove ( $ this -> Value ( 'Remove' ) ) ; $ this -> rights -> SetPageRights ( $ this -> pageRights -> Ri... | Saves the site rights |
51,715 | public static function XML2Array ( $ xmlString ) { try { $ xml = simplexml_load_string ( $ xmlString , "SimpleXMLElement" , LIBXML_NOCDATA ) ; $ json = json_encode ( $ xml ) ; $ result = json_decode ( $ json , TRUE ) ; } catch ( \ Exception $ ex ) { $ result = '' ; } return $ result ; } | Convert XML to array |
51,716 | public static function array2XML ( $ haystack , $ rootElementName = '' ) { $ args = func_get_args ( ) ; $ isRoot = ! isset ( $ args [ 2 ] ) ; $ root = isset ( $ args [ 3 ] ) ? $ args [ 3 ] : new \ DOMDocument ( '1.0' , 'utf-8' ) ; $ parent = isset ( $ args [ 2 ] ) ? $ args [ 2 ] : ( $ rootElementName !== '' ? $ root ->... | Convert array to XML object |
51,717 | private function fetchLocal ( ) { $ finfo = finfo_open ( FILEINFO_MIME_TYPE ) ; $ this -> mime = finfo_file ( $ finfo , $ this -> path ) ; finfo_close ( $ finfo ) ; $ this -> data = file_get_contents ( $ this -> path , FILE_USE_INCLUDE_PATH ) ; } | Fetch a local file and grab its mime type and file content |
51,718 | public function create ( $ sMethod = null ) { if ( empty ( $ sMethod ) ) { $ sMethod = self :: $ sDefaultMechanism ; } if ( array_search ( $ sMethod , $ this -> aRegisteredMechanisms ) === false ) { throw new Exception ( 'Unknown caching mechanism' ) ; } if ( ! isset ( $ this -> aCacheInstance [ $ sMethod ] ) ) { requi... | Create and return caching mechanism object according to passed name |
51,719 | public function setModule ( $ value ) { if ( is_object ( $ value ) ) { $ this -> module = get_class ( $ value ) ; } else { $ this -> module = ( string ) $ value ; } } | Set module property |
51,720 | public function compile ( ) { $ this -> doLoad ( ) ; $ data = ( array ) $ this -> data ; $ this -> removeKey ( $ data , 'include' ) ; $ this -> removeKey ( $ data , '__META__' ) ; return var_export ( $ data , true ) ; } | Compiles the current configuration to a valid PHP snippet . |
51,721 | public function load ( ) { if ( empty ( $ this -> data ) ) { $ this -> data = $ this -> doLoad ( ) ; } return $ this -> data ; } | Loads and returns the configuration data . |
51,722 | private static function CalcKey ( Member $ member ) { return sha1 ( $ member -> GetPasswordSalt ( ) . $ member -> GetConfirmed ( ) . $ member -> GetName ( ) ) ; } | Returns the password key |
51,723 | public function assign ( $ value , int $ type = PDO :: PARAM_STR ) { $ key = $ this -> getNextKey ( ) ; $ this -> params [ $ key ] = $ value ; $ this -> param_types [ $ key ] = $ type ; return $ key ; } | Set a value for the next parameters in the query |
51,724 | public function getParameterType ( string $ key ) { if ( ! array_key_exists ( $ key , $ this -> params ) ) throw new OutOfRangeException ( "Invalid key: $key" ) ; return $ this -> param_types [ $ key ] ; } | Get the type of parameter the key is set to |
51,725 | public function set ( string $ key , $ value , int $ type = PDO :: PARAM_STR ) { $ this -> params [ $ key ] = $ value ; $ this -> param_types [ $ key ] = $ type ; return $ this ; } | Set the value for an existing parameters . |
51,726 | public function registerTable ( $ name , $ alias ) { if ( ! empty ( $ alias ) && empty ( $ name ) ) return ; if ( ! empty ( $ alias ) && ! empty ( $ this -> parent_scope ) ) { $ table = $ this -> parent_scope -> resolveAlias ( $ alias ) ; if ( ! empty ( $ table ) ) throw new QueryException ( "Duplicate alias \"$alias\"... | Register a table used in the query |
51,727 | public function resolveAlias ( string $ alias ) { if ( isset ( $ this -> aliases [ $ alias ] ) ) return $ this -> aliases [ $ alias ] ; if ( empty ( $ this -> parent_scope ) ) return null ; return $ this -> parent_scope -> resolveAlias ( $ alias ) ; } | Find a table by its alias |
51,728 | public function resolveTable ( string $ name ) { if ( ! empty ( $ name ) && is_string ( $ name ) ) { if ( isset ( $ this -> aliases [ $ name ] ) ) return array ( $ this -> aliases [ $ name ] , $ name ) ; if ( isset ( $ this -> tables [ $ name ] ) ) { if ( count ( $ this -> tables [ $ name ] ) === 1 ) return array ( $ n... | Find a table by its name |
51,729 | public function bindParameters ( \ PDOStatement $ statement ) { foreach ( array_keys ( $ this -> params ) as $ key ) { $ type = $ this -> param_types [ $ key ] ; $ statement -> bindParam ( $ key , $ this -> params [ $ key ] , $ type ) ; } return $ this ; } | Bind the paramters to a PDOStatement |
51,730 | public function generateAlias ( Clause $ clause ) { if ( $ clause instanceof FieldName ) { $ table = $ clause -> getTable ( ) ; if ( empty ( $ table ) ) { return "" ; } $ prefix = $ table -> getPrefix ( ) ; $ alias = $ prefix . '_' . $ clause -> getField ( ) ; } elseif ( $ clause instanceof SQLFunction ) { $ func = $ c... | Generate an alias for a table |
51,731 | public function getSubScope ( int $ num = null ) { if ( $ num !== null ) { if ( ! isset ( $ this -> scopes [ $ num ] ) ) throw new QueryException ( "Invalid scope number: $num" ) ; return $ this -> scopes [ $ num ] ; } $ scope = new Parameters ( $ this -> driver ) ; $ scope -> params = & $ this -> params ; $ scope -> p... | Create a sub scope for a nester query |
51,732 | private function loadPvForQuote ( $ quoteId ) { if ( ! isset ( $ this -> cachePvQuote [ $ quoteId ] ) ) { $ found = $ this -> daoPvQuote -> getById ( ( int ) $ quoteId ) ; $ this -> cachePvQuote [ $ quoteId ] = $ found ; } return $ this -> cachePvQuote [ $ quoteId ] ; } | Cacheable loader for quote s PV . |
51,733 | private function loadPvForQuoteItem ( $ itemId ) { if ( ! isset ( $ this -> cachePvQuoteItem [ $ itemId ] ) ) { $ found = $ this -> daoPvQuoteItem -> getById ( ( int ) $ itemId ) ; $ this -> cachePvQuoteItem [ $ itemId ] = $ found ; } return $ this -> cachePvQuoteItem [ $ itemId ] ; } | Cacheable loader for quote item s PV . |
51,734 | protected function remove ( $ filterOrName ) { $ name = $ this -> getNameByFilter ( $ filterOrName ) ; if ( $ this -> has ( $ name ) ) { unset ( $ this -> collection [ $ name ] ) ; return true ; } return false ; } | Removes a filter from the collection . |
51,735 | static public function createSplFileInfo ( $ baseDir , $ path ) { $ absPath = realpath ( $ path ) ; $ baseDirLen = strlen ( $ baseDir ) ; if ( $ baseDir === substr ( $ absPath , 0 , $ baseDirLen ) ) { $ subPathName = ltrim ( substr ( $ absPath , $ baseDirLen ) , '\\/' ) ; $ dir = dirname ( $ subPathName ) ; $ subPath =... | Generate SplFileInfo from base dir |
51,736 | protected function loadStorage ( $ resource ) { $ template = $ this -> parser -> parse ( $ resource ) ; $ key = $ template -> getLogicalName ( ) ; if ( isset ( $ this -> cache [ $ key ] ) ) { return $ this -> cache [ $ key ] ; } $ storage = $ this -> template_loader -> load ( $ template ) ; if ( ! $ storage instanceof ... | Loads a resource from the template loader |
51,737 | public function write ( $ text , $ color = null , $ bgColor = null ) { $ this -> adapter -> write ( $ text , $ color , $ bgColor ) ; } | Write a chunk of text to console . |
51,738 | public function writeLine ( $ text = "" , $ color = null , $ bgColor = null ) { $ this -> adapter -> writeLine ( $ text , $ color , $ bgColor ) ; } | Write a single line of text to console and advance cursor to the next line . If the text is longer than console width it will be truncated . |
51,739 | public function writeTextBlock ( $ text , $ width , $ height = null , $ x = 0 , $ y = 0 , $ color = null , $ bgColor = null ) { $ this -> adapter -> writeTextBlock ( $ text , $ width , $ height , $ x , $ y , $ color , $ bgColor ) ; } | Write a block of text at the given coordinates matching the supplied width and height . In case a line of text does not fit desired width it will be wrapped to the next line . In case the whole text does not fit in desired height it will be truncated . |
51,740 | public function colorize ( $ string , $ color = null , $ bgColor = null ) { return $ this -> adapter -> colorize ( $ string , $ color , $ bgColor ) ; } | Prepare a string that will be rendered in color . |
51,741 | public function writeSelectPrompt ( $ message , & $ options ) { $ this -> writeLine ( ) ; foreach ( $ options as $ optionKey => $ optionValue ) { $ options [ $ optionKey ] = $ this -> translator -> translate ( $ optionValue ) ; } $ this -> writeBadge ( 'badge_pick' , Color :: RED ) ; $ prompt = new Select ( $ this -> t... | Write a customizable prompt |
51,742 | public function writeLinePrompt ( $ message ) { $ this -> writeLine ( ) ; $ this -> writeBadge ( 'badge_pick' , Color :: RED ) ; $ prompt = new Line ( $ this -> translator -> translate ( $ message ) , false ) ; $ answer = $ prompt -> show ( ) ; $ this -> writeLine ( ) ; return $ answer ; } | Write a customizable line prompt |
51,743 | public function writeConfirmPrompt ( $ message , $ yes , $ no ) { $ this -> writeLine ( ) ; $ this -> writeBadge ( 'badge_pick' , Color :: RED ) ; $ prompt = new Confirm ( $ this -> translator -> translate ( $ message ) , $ this -> translator -> translate ( $ yes ) , $ this -> translator -> translate ( $ no ) ) ; $ ans... | Write a customizable confirm prompt |
51,744 | public function writeBadge ( $ badgeText , $ badgeColor ) { $ this -> adapter -> write ( $ this -> translator -> translate ( $ badgeText ) , Color :: NORMAL , $ badgeColor ) ; $ this -> adapter -> write ( ' ' ) ; } | Write a customizable badge |
51,745 | public function writeBadgeLine ( $ message , array $ placeholders = [ ] , $ badgeText , $ badgeColor , $ preNewLine = false , $ postNewLine = false ) { if ( $ preNewLine ) { $ this -> adapter -> writeLine ( ) ; } $ this -> adapter -> write ( $ this -> translator -> translate ( $ badgeText ) , Color :: NORMAL , $ badgeC... | Write a line with customizable badge |
51,746 | public function writeListItemLineLevel3 ( $ message , array $ placeholders = [ ] ) { $ this -> adapter -> write ( ' * ' ) ; $ this -> adapter -> writeLine ( vsprintf ( $ this -> translator -> translate ( $ message ) , $ placeholders ) ) ; } | Write a list item line for third level |
51,747 | public function writeGoLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_go' , Color :: YELLOW , false , true ) ; } | Write a line with a yellow GO badge |
51,748 | public function writeTaskLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_task' , Color :: BLUE , false , false ) ; } | Write a line with a Blue Done badge |
51,749 | public function writeOkLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_ok' , Color :: GREEN , true , true ) ; } | Write a line with a green OK badge |
51,750 | public function writeFailLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_fail' , Color :: RED , true , true ) ; } | Write a line with a red Fail badge |
51,751 | public function writeWarnLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_warning' , Color :: RED , true , true ) ; } | Write a line with a red Warn badge |
51,752 | public function writeTodoLine ( $ message , array $ placeholders = [ ] ) { $ this -> writeBadgeLine ( $ message , $ placeholders , 'badge_todo' , Color :: GREEN , false , true ) ; } | Write a line with a yellow to - do badge |
51,753 | public static function katana_filter ( $ param = '' ) { if ( $ param ) { $ param = trim ( $ param , ' _' ) ; return sprintf ( '%s_%s' , Config :: KATANA_FILTER , $ param ) ; } else { return Config :: KATANA_FILTER ; } } | Creates a specific katana filter based on a param like a post_id a page template name or similar . |
51,754 | public function get ( $ option , $ slug ) { if ( $ this -> is_active ( ) ) { $ this -> prepare ( $ slug ) ; $ slug = $ this -> slug ; if ( isset ( $ this -> plugin [ $ slug ] [ $ option ] ) ) { return $ this -> plugin [ $ slug ] [ $ option ] ; } elseif ( '*' == $ option && isset ( $ this -> plugin [ $ slug ] ) ) { retu... | Get plugin options . |
51,755 | protected function is_updated ( ) { if ( $ this -> is_active ( ) && isset ( $ this -> plugin [ $ this -> slug ] [ 'last-update' ] ) ) { $ interval = Plugin :: WP_Plugin_Info ( ) -> getOption ( 'interval' ) ; $ last_update = $ this -> plugin [ $ this -> slug ] [ 'last-update' ] ; if ( ( time ( ) - $ last_update ) < $ in... | Check the last update . |
51,756 | protected function prepare ( $ slug ) { $ this -> slug = $ slug ; $ file = Plugin :: WP_Plugin_Info ( ) -> getOption ( 'file' , 'plugins' ) ; if ( empty ( $ this -> plugin ) ) { $ this -> plugin = $ this -> model -> get_plugins_info ( $ file ) ; } if ( ! $ this -> is_updated ( ) ) { $ this -> plugin [ $ slug ] = $ this... | Get plugin info . |
51,757 | protected function get_plugin_info ( $ slug ) { $ args = ( object ) [ 'slug' => $ slug ] ; $ request = [ 'action' => 'plugin_information' , 'timeout' => 15 , 'request' => serialize ( $ args ) , ] ; $ url = Plugin :: WP_Plugin_Info ( ) -> getOption ( 'url' , 'wp-api' ) ; $ resp = wp_remote_post ( $ url , [ 'body' => $ r... | Get plugin info in WordPress API . |
51,758 | public function hydrate ( $ document , $ data , $ readOnly = false ) { $ metadata = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; if ( ! empty ( $ metadata -> lifecycleCallbacks [ Event :: preLoad ] ) ) { $ args = [ new PreLoadEventArgs ( $ document , $ this -> dm , $ data ) ] ; $ metadata -> invokeLi... | Hydrate array of DynamoDB document data into the given document object . |
51,759 | public function addLabels ( Search $ entity ) { if ( $ entity -> getLabels ( ) -> count ( ) ) { $ this -> add ( function ( QueryBuilder $ query ) use ( $ entity ) { $ ids = [ ] ; foreach ( $ entity -> getLabels ( ) as $ label ) { $ ids [ ] = ( int ) $ label -> getId ( ) ; } $ query -> innerJoin ( 'i.labels' , 'l' ) -> ... | Add labels . |
51,760 | public function listen ( ) { if ( $ _SERVER [ 'REQUEST_METHOD' ] != 'POST' ) { throw new InvalidRequestException ( 'Expected a POST request.' ) ; } $ remoteAddress = $ this -> getRemoteAddress ( ) ; if ( ! $ this -> isValidRemoteAddress ( $ remoteAddress ) ) { throw new InvalidRequestException ( 'Invalid remote address... | Listens for incoming requests . |
51,761 | public function checkSubscription ( ) { if ( ! $ this -> subscriberSocket ) { $ this -> subscriberSocket = $ this -> context -> getSocket ( \ ZMQ :: SOCKET_SUB ) ; $ this -> subscriberSocket -> connect ( $ this -> publisherPmSocketAddress ) ; $ this -> subscriberSocket -> setSockOpt ( \ ZMQ :: SOCKOPT_SUBSCRIBE , "" ) ... | Check if subscription contain pid of process |
51,762 | public function standOnPauseIfMust ( ) { if ( $ this -> mustStandOnPause ) { $ this -> iAmInPause = true ; while ( $ this -> canContinue === false ) { $ this -> logger -> info ( getmypid ( ) . " come to usleep for microseconds: " . $ this -> uSleepTime ) ; usleep ( $ this -> uSleepTime ) ; $ this -> logger -> info ( ge... | Go into infinite loop with periodic checking of the subscription if it allows to continue |
51,763 | public function continueExecution ( ) { $ this -> logger -> info ( "TerminatorPauseStander " . getmypid ( ) . " CONTINUED." ) ; $ this -> iAmInPause = false ; $ this -> mustStandOnPause = false ; $ this -> canContinue = false ; return null ; } | Exit from infinite loop |
51,764 | public static function parseError ( RequestException $ requestException , $ isAssoc = true ) { $ error = $ error = json_decode ( $ requestException -> getResponse ( ) -> getBody ( ) , $ isAssoc ) ; if ( ! is_null ( $ error ) ) { return $ error ; } else { return $ requestException -> getMessage ( ) ; } } | Returns an object or array of the FDC error parsed from the Guzzle Request exception |
51,765 | public function cmdGetAlias ( ) { $ result = $ this -> getListAlias ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableAlias ( $ result ) ; $ this -> output ( ) ; } | Callback for alias - get command |
51,766 | public function cmdAddAlias ( ) { $ params = $ this -> getParam ( ) ; if ( count ( $ params ) != 3 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } list ( $ entity , $ entity_id , $ alias ) = $ params ; if ( empty ( $ entity ) || empty ( $ entity_id ) || empty ( $ alias ) || ! is_numeric ( $ enti... | Callback for alias - add command |
51,767 | public function cmdGenerateAlias ( ) { $ entity = $ this -> getParam ( 0 ) ; $ entity_id = $ this -> getParam ( 1 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( empty ( $ entity ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! isset ( $ entity_id ) && empty ( $ all ) ) { $ this -> error... | Callback for alias - generate command |
51,768 | protected function addAlias ( $ entity , $ entity_id , $ alias ) { $ this -> alias -> delete ( array ( 'entity' => $ entity , 'entity_id' => $ entity_id ) ) ; $ data = array ( 'alias' => $ alias , 'entity' => $ entity , 'entity_id' => $ entity_id ) ; return $ this -> alias -> add ( $ data ) ; } | Add a URL alias |
51,769 | protected function generateListAlias ( $ entity ) { if ( ! $ this -> alias -> isSupportedEntity ( $ entity ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ model = gplcart_instance_model ( $ entity ) ; if ( ! $ model instanceof CrudInterface ) { $ this -> errorAndExit ( $ this -> text ( 'Inv... | Mass generate URL aliases for the given entity |
51,770 | protected function getListAlias ( ) { $ id = $ this -> getParam ( 0 ) ; if ( ! isset ( $ id ) ) { return $ this -> alias -> getList ( array ( 'limit' => $ this -> getLimit ( ) ) ) ; } if ( $ this -> getParam ( 'entity' ) ) { return $ this -> alias -> getList ( array ( 'entity' => $ id , 'limit' => $ this -> getLimit ( ... | Returns an array of URL aliases |
51,771 | public function render ( ) { if ( ! $ this -> view ) { return false ; } return $ this -> renderRawData ( $ this -> data ? : $ this -> renderFile ( $ this -> getViewFile ( $ this -> view ) , $ this -> params ) ) ; } | Render insert data into view |
51,772 | public function renderRawData ( $ data = '' ) { $ layoutPath = null ; if ( $ this -> layout && ( ! $ layoutPath = $ this -> getLayoutFile ( ( new KernelInjector ) -> build ( ) -> getAppDir ( ) , $ this -> module ) ) ) { ( new LoggerInjector ) -> build ( ) -> send ( 'error' , 'Layout `' . $ this -> layout . '` not found... | Render raw data in layout |
51,773 | protected function getLayoutFile ( $ appDir , $ module ) { if ( $ module ) { $ module = strtolower ( str_replace ( '\\' , '/' , $ module ) ) ; $ module = substr ( $ module , strpos ( $ module , '/' ) + 1 ) ; $ module = substr ( $ module , 0 , strrpos ( $ module , '/' ) ) ; } $ layout = $ appDir . '/' . ( $ module ? $ m... | Get layout path |
51,774 | protected function renderFile ( $ fileName , array $ data = [ ] ) { $ lang = new Language ( $ fileName ) ; extract ( $ data , EXTR_PREFIX_SAME || EXTR_REFS , 'data' ) ; ob_start ( ) ; include str_replace ( '\\' , '/' , $ fileName ) ; if ( ! empty ( $ GLOBALS [ 'widgetStack' ] ) ) { throw new Exception ( count ( $ GLOBA... | Render file by path |
51,775 | private function getViewFile ( $ view ) { $ calledClass = $ this -> path ; if ( 0 === strpos ( $ calledClass , 'App' ) ) { $ path = ( new KernelInjector ) -> build ( ) -> getAppDir ( ) ; } else { $ path = Autoload :: getAlias ( 'Micro' ) ; } $ cl = strtolower ( dirname ( str_replace ( '\\' , '/' , $ calledClass ) ) ) ;... | Get view file |
51,776 | final public static function checkPhpVersion ( ) { $ phpv = phpversion ( ) ; if ( $ phpv >= self :: $ php_accept ) { return ( json_encode ( array ( "code" => 200 , "results" => "OK" , "phpv" => $ phpv ) ) ) ; } else { return ( json_encode ( array ( "code" => 500 , "results" => "NOK" , "phpv" => $ phpv , "msg" => "The v... | Check the php version |
51,777 | final public static function checkFrameworkBuildVersion ( ) { $ f = json_decode ( file_get_contents ( __DIR__ . "/../../elements/config_files/core/framework.config.json" ) ) ; if ( ! property_exists ( $ f , 'installation' ) ) { return ( json_encode ( array ( "code" => 500 , "results" => "NOK" , "fv" => "unknow" , "msg"... | Check the iumio Framework version |
51,778 | final public static function isDirEmpty ( $ dir ) { if ( ! is_readable ( $ dir ) ) { return ( null ) ; } $ handle = opendir ( $ dir ) ; while ( false !== ( $ entry = readdir ( $ handle ) ) ) { if ( $ entry != "." && $ entry != ".." ) { return ( false ) ; } } return ( true ) ; } | Check if dir is empty or not |
51,779 | final public static function checkLibrariesRequired ( ) { $ base = __DIR__ . "/../../" ; foreach ( self :: $ libs as $ lib => $ val ) { if ( ! is_dir ( $ base . $ lib ) || ! self :: checkIsReadable ( $ base . $ lib ) || ! self :: checkIsWritable ( $ base . $ lib ) || self :: isDirEmpty ( $ base . $ lib ) ) { return ( j... | Check if librairies required are installed |
51,780 | public function setParameters ( array $ params ) : self { foreach ( $ params as $ key => $ value ) { $ this -> parameters [ $ key ] = $ value ; } return $ this ; } | Adds new parameters . The %params% will be expanded . |
51,781 | public function setDebugMode ( $ value ) : self { if ( is_string ( $ value ) || is_array ( $ value ) ) { $ value = static :: detectDebugMode ( $ value ) ; } elseif ( ! is_bool ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( 'Value must be either a string, array, or boolean, %s given.' , gettype ( $ value... | Set parameter %debugMode% . |
51,782 | public function createContainer ( ) : Factory { Core :: $ appDir = $ this -> parameters [ 'appDir' ] ; Core :: $ wwwDir = $ this -> parameters [ 'wwwDir' ] ; Core :: $ tempDir = $ this -> parameters [ 'tempDir' ] ; Core :: $ logDir = $ this -> parameters [ 'logDir' ] ; if ( $ this -> parameters [ 'debugMode' ] ) { defi... | Create the container which holds FuzeWorks . |
51,783 | public function get ( string $ configKey , string $ configFile = 'default' , ? string $ parseType = null ) { $ this -> load ( $ configFile ) ; if ( ! isset ( $ this -> data [ $ configFile ] ) ) { return false ; } if ( ! isset ( $ this -> data [ $ configFile ] [ $ configKey ] ) ) { return false ; } $ response = $ this -... | Get config value by config key from configuration file |
51,784 | public function getAll ( $ configFile = 'default' ) : ? array { $ this -> load ( $ configFile ) ; if ( ! Any :: isArray ( $ this -> data ) || ! array_key_exists ( $ configFile , $ this -> data ) ) { return null ; } return $ this -> data [ $ configFile ] ; } | Get all configuration data of selected file |
51,785 | public function updateConfig ( string $ configFile , array $ newData , ? bool $ mergeDeep = false ) : bool { $ this -> load ( $ configFile ) ; if ( ! isset ( $ this -> data [ $ configFile ] ) ) { return false ; } $ oldData = $ this -> data [ $ configFile ] ; $ saveData = ( $ mergeDeep ? Arr :: mergeRecursive ( $ oldDat... | Update configuration data based on key - value array of new data . Do not pass multi - level array on new position without existing keys |
51,786 | public function writeConfig ( string $ configFile , array $ data ) : bool { $ path = '/Private/Config/' . ucfirst ( Str :: lowerCase ( $ configFile ) ) . '.php' ; if ( ! File :: exist ( $ path ) || ! File :: writable ( $ path ) ) { return false ; } $ saveData = '<?php return ' . Arr :: exportVar ( $ data ) . ';' ; File... | Write configurations data from array to cfg file |
51,787 | protected function renderContent ( array $ replacements ) { return $ this -> getContentReplacer ( ) -> replace ( $ this -> content , array_merge ( [ 'app_name' => config ( 'app.name' ) , 'app_url' => link_to ( config ( 'app.url' ) , config ( 'app.name' ) ) , 'mobile' => html ( ) -> tel ( config ( 'cms.company.mobile' )... | Render the content . |
51,788 | public function setLabel ( LabelElement $ label ) { $ this -> label = $ label ; if ( ( $ for = $ this -> getAttribute ( 'id' ) ) ) { $ label -> setAttribute ( 'for' , $ for ) ; } return $ this ; } | assign label element to this form element for attribute of label is set if form element has an id attribute |
51,789 | public function setAttribute ( $ attr , $ value ) { $ attr = strtolower ( $ attr ) ; if ( $ attr === 'value' ) { return $ this -> setValue ( $ value ) ; } if ( $ attr === 'name' ) { return $ this -> setName ( $ value ) ; } if ( $ attr === 'id' && $ this -> label ) { $ this -> label -> setAttribute ( 'for' , $ value ) ;... | sets miscellaneous attribute of form element attributes value name are treated by calling the according setters setting id will update for when a label element is assigned |
51,790 | public function setAttributes ( Array $ attributes ) { foreach ( $ attributes as $ k => $ v ) { $ this -> setAttribute ( $ k , $ v ) ; } return $ this ; } | sets several attributes with an associative array |
51,791 | public function getAttribute ( $ name ) { $ key = strtolower ( $ name ) ; if ( 'value' === $ key ) { return $ this -> getValue ( ) ; } if ( 'name' === $ key ) { return $ this -> getName ( ) ; } if ( array_key_exists ( $ key , $ this -> attributes ) ) { return $ this -> attributes [ strtolower ( $ name ) ] ; } return nu... | get a single attribute name and value attributes are redirected to the respective getter methods |
51,792 | public function isValid ( ) { if ( ! isset ( $ this -> valid ) ) { $ this -> valid = $ this -> applyValidators ( $ this -> applyModifiers ( $ this -> getValue ( ) ) ) ; } return $ this -> valid ; } | checks whether modified form element passes validation rules |
51,793 | public function canSubmit ( ) { return $ this instanceof InputElement && isset ( $ this -> attributes [ 'type' ] ) && $ this -> attributes [ 'type' ] == 'submit' || $ this instanceof ImageElement || $ this instanceof SubmitInputElement || $ this instanceof ButtonElement && $ this -> attributes [ 'type' ] == 'submit' ; ... | check whether element can submit a form |
51,794 | public function render ( ) { if ( ! $ this -> template ) { throw new \ RuntimeException ( sprintf ( "No template for element '%s' defined." , $ this -> getName ( ) ) ) ; } $ this -> html = $ this -> template -> assign ( 'element' , $ this ) -> display ( ) ; return $ this -> html ; } | renders form element and returns markup requires a template for rendering |
51,795 | public function prepare ( $ connectionId , Credentials $ credentials ) { $ connection = Connection :: fromCredentials ( $ credentials ) ; $ this -> store ( $ connectionId , $ connection ) ; } | Stores a new database connection with provided credentials . |
51,796 | public function store ( $ connectionId , Connection $ connection ) { $ connectionId = ( string ) $ connectionId ; $ this -> connections [ $ connectionId ] = $ connection ; } | Stores an existing database connection . |
51,797 | public function fetch ( $ connectionId ) { $ connectionId = ( string ) $ connectionId ; if ( $ this -> exist ( $ connectionId ) ) { return $ this -> connections [ $ connectionId ] ; } throw new \ DomainException ( "Requested database connection '{$connectionId}' does not exist." ) ; } | Returns the database connection with provided identifier or throws an exception if not found . |
51,798 | public function actionMinute ( ) { $ this -> stdout ( "Executing minute tasks:" . PHP_EOL , Console :: FG_YELLOW ) ; $ this -> trigger ( self :: EVENT_ON_MINUTE_RUN ) ; Yii :: $ app -> settings -> set ( 'cronLastMinuteRun' , time ( ) , 'core' ) ; return ExitCode :: OK ; } | Executes minute cron tasks . |
51,799 | public function actionHourly ( ) { $ this -> stdout ( "Executing hourly tasks:" . PHP_EOL , Console :: FG_YELLOW ) ; $ this -> trigger ( self :: EVENT_ON_HOURLY_RUN ) ; Yii :: $ app -> settings -> set ( 'cronLastHourlyRun' , time ( ) , 'core' ) ; return ExitCode :: OK ; } | Executes hourly cron tasks . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.