idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
5,900
public function init ( ) { $ this -> basePath = __DIR__ ; AdminLteAsset :: $ skin = $ this -> skin ; AdminLteAsset :: $ customSkin = $ this -> customSkin ; if ( ! $ this -> pathMap ) { $ this -> createPathMap ( ) ; } }
Set the basePath of the theme the
5,901
protected function getItemOptions ( $ items , $ index ) { $ options = array_merge ( $ this -> itemOptions , ArrayHelper :: getValue ( $ items [ $ index ] , 'options' , [ ] ) ) ; Html :: addCssClass ( $ options , $ this -> generateItemClass ( $ items , $ index ) ) ; return $ options ; }
Generates options for the item
5,902
public function create ( $ driverName = null , $ customPool = null ) { $ pool = $ this -> getPool ( $ customPool ) ; $ driver = mb_convert_case ( $ driverName , MB_CASE_LOWER ) ; $ factoryName = 'create' . $ driver ; if ( ! method_exists ( $ this , $ factoryName ) ) { $ factoryName = 'createStatic' ; } $ l1CacheInstanc...
L1 cache drivers const
5,903
protected function createSQLite ( $ pool ) { $ hasApcu = function_exists ( 'apcu_fetch' ) ; $ state = $ hasApcu ? new StateL1APCu ( "sqlite-$pool" ) : new StateL1Static ( ) ; $ cache = new SQLiteL1 ( $ pool , $ state ) ; return $ cache ; }
Factory method for the L1 SQLite driver .
5,904
protected function getPool ( $ pool = null ) { if ( ! is_null ( $ pool ) ) { $ result = ( string ) $ pool ; } elseif ( isset ( $ _SERVER [ 'SERVER_ADDR' ] ) && isset ( $ _SERVER [ 'SERVER_PORT' ] ) ) { $ result = $ _SERVER [ 'SERVER_ADDR' ] . '-' . $ _SERVER [ 'SERVER_PORT' ] ; } else { $ result = $ this -> generateUni...
Pool generator utility .
5,905
public function prepare ( ) { $ blocks = $ this -> container -> getBlocks ( ) ; $ fields = array_merge ( $ this -> container -> getFields ( ) , $ this -> container -> getImages ( ) ) ; $ this -> declareListOfBlocks ( $ blocks ) -> declareListOfValues ( $ fields ) ; return $ this -> createDocument ( ) ; }
Prepare the merging of the fields and return a document
5,906
protected function declareListOfBlocks ( $ blocks ) { foreach ( $ blocks as $ block ) { try { $ this -> getSoapClient ( ) -> SetBlockFieldValues ( array ( 'blockName' => $ block -> getName ( ) , 'blockFieldValues' => $ this -> getSoapClient ( ) -> convertArray ( $ block -> retrieveValues ( ) ) ) ) ; } catch ( SoapExcep...
Send the list of all block values to Livedocx service to prepare the merging
5,907
protected function declareListOfValues ( $ fields ) { try { $ this -> getSoapClient ( ) -> SetFieldValues ( array ( 'fieldValues' => $ this -> getSoapClient ( ) -> convertArray ( $ fields ) ) ) ; } catch ( SoapException $ e ) { throw new DeclarationException ( 'Error while sending the fields/values binding to Livedocx ...
Send the list of all field values to Livedocx service to prepare the merging
5,908
public function getEvent ( $ event_id ) { $ sth = $ this -> dbh -> prepare ( 'SELECT * FROM ' . $ this -> prefixTable ( 'lcache_events' ) . ' WHERE event_id = :event_id' ) ; $ sth -> bindValue ( ':event_id' , $ event_id , \ PDO :: PARAM_INT ) ; $ sth -> execute ( ) ; $ event = $ sth -> fetchObject ( ) ; if ( false === ...
Returns the event entry . Currently used only for testing .
5,909
public function listAll ( ) { try { $ ret = array ( ) ; $ result = $ this -> getSoapClient ( ) -> ListTemplates ( ) ; if ( isset ( $ result -> ListTemplatesResult ) ) { $ ret = $ this -> getSoapClient ( ) -> backendListArrayToMultiAssocArray ( $ result -> ListTemplatesResult ) ; } return $ ret ; } catch ( SoapException...
Return the list of all templates uploaded to the Livedocx service
5,910
public function getAcceptedTemplateFormats ( ) { try { $ ret = array ( ) ; $ result = $ this -> getSoapClient ( ) -> GetTemplateFormats ( ) ; if ( isset ( $ result -> GetTemplateFormatsResult -> string ) ) { $ ret = $ result -> GetTemplateFormatsResult -> string ; $ ret = array_map ( 'strtolower' , $ ret ) ; } return $...
Return a list of all the accepted template formats you can use to generate your document
5,911
public function getAvailableFonts ( ) { try { $ ret = array ( ) ; $ result = $ this -> getSoapClient ( ) -> GetFontNames ( ) ; if ( isset ( $ result -> GetFontNamesResult -> string ) ) { $ ret = $ result -> GetFontNamesResult -> string ; } return $ ret ; } catch ( SoapException $ ex ) { throw new StatusException ( 'Err...
Get the list of all available fonts on the Livedocx service
5,912
public function ignoreAllSubTemplates ( $ state = true ) { $ state = ( bool ) $ state ; try { $ this -> getSoapClient ( ) -> SetIgnoreSubTemplates ( array ( 'ignoreSubTemplates' => $ state , ) ) ; return $ this ; } catch ( SoapException $ ex ) { throw new IgnoreException ( "Error while telling the server to ignore subt...
Tell the Livedocx service to ignore included subtemplates when generating the final document
5,913
public function ignoreListOfSubTemplates ( $ subtemplates_list ) { if ( ! is_array ( $ subtemplates_list ) ) { throw new InvalidException ( 'List of subtemplate filenames must be an array' ) ; } $ filenames = array_values ( $ subtemplates_list ) ; try { $ this -> getSoapClient ( ) -> SetSubTemplateIgnoreList ( array ( ...
Define a list of subtemplates to ignore when generating the final document
5,914
public function get ( Address $ address ) { $ entry = $ this -> getEntry ( $ address ) ; if ( is_null ( $ entry ) ) { return null ; } return $ entry -> value ; }
Fetch a value from the cache .
5,915
public function markAllSaved ( ) { $ this -> saved = $ this -> all ( ) ; foreach ( $ this -> saved as $ document ) { $ document -> clearModified ( ) ; $ rap = $ document -> getRootAndPath ( ) ; $ rap [ 'path' ] = str_replace ( '._add' , '.' , $ rap [ 'path' ] ) ; $ document -> setRootAndPath ( $ rap [ 'root' ] , $ rap ...
Marks everything as saved removes pending add and delete arrays
5,916
public function set ( $ key , $ value ) { $ this -> keys [ $ key ] = true ; $ this -> archive [ $ key ] = $ value ; }
Set a key value .
5,917
public function remove ( $ key ) { if ( ! $ this -> has ( $ key ) ) { return ; } unset ( $ this -> archive [ $ key ] ) ; unset ( $ this -> keys [ $ key ] ) ; }
Remove a key .
5,918
public function & getByRef ( $ key , $ default = null ) { if ( ! $ this -> has ( $ key ) ) { $ this -> set ( $ key , $ default ) ; } return $ this -> archive [ $ key ] ; }
Returns a key by reference . It creates the key if the key does not exist .
5,919
public static function get ( $ name ) { if ( ! isset ( static :: $ types [ $ name ] ) ) { if ( ! static :: has ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The type "%s" does not exists.' , $ name ) ) ; } static :: $ types [ $ name ] = new static :: $ map [ $ name ] ; } return static :: $ types [ $ ...
Returns a type .
5,920
public static function remove ( $ name ) { if ( ! static :: has ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The type "%s" does not exists.' , $ name ) ) ; } unset ( static :: $ map [ $ name ] , static :: $ types [ $ name ] ) ; }
Remove a type .
5,921
public function setAsActive ( ) { if ( ! $ this -> exists ( ) ) { throw new FileExistException ( 'Remote template does not exist' ) ; } try { $ this -> getSoapClient ( ) -> SetRemoteTemplate ( [ 'filename' => $ this -> getName ( ) ] ) ; $ this -> isActive = true ; return $ this ; } catch ( SoapException $ ex ) { throw ...
Set the remote template as active to be used when generating the final document
5,922
public function exists ( ) { try { $ result = $ this -> soapClient -> templateExists ( [ 'filename' => $ this -> getName ( ) ] ) ; return ( bool ) $ result -> TemplateExistsResult ; } catch ( SoapException $ ex ) { throw new StatusException ( 'Error while verifying the existence of a remote template' , $ ex ) ; } }
Check if a remote template exists on the Livedocx service
5,923
public function getFieldNames ( ) { if ( ! $ this -> isActive ) { throw new NonActiveException ( 'You can only get the field names of the active template' ) ; } $ ret = array ( ) ; try { $ result = $ this -> getSoapClient ( ) -> GetFieldNames ( ) ; } catch ( SoapException $ ex ) { throw new StatusException ( 'Error whi...
Return the list of all fields in the active template
5,924
public function download ( ) { if ( ! $ this -> exists ( ) ) { throw new FileExistException ( 'Remote template does not exist' ) ; } try { $ result = $ this -> getSoapClient ( ) -> DownloadTemplate ( array ( 'filename' => basename ( $ this -> getName ( ) ) ) ) ; return base64_decode ( $ result -> DownloadTemplateResult...
Download a remote template from the Livedocx service
5,925
public function delete ( ) { try { $ this -> getSoapClient ( ) -> DeleteTemplate ( array ( 'filename' => basename ( $ this -> getName ( ) ) ) ) ; return $ this ; } catch ( SoapException $ ex ) { throw new DeleteException ( 'Error while deleting the remote template from Livedocx service' , $ ex ) ; } }
Delete a remote template from the Livedocx service .
5,926
public function setRootAndPath ( Document $ root , $ path ) { $ this -> getArchive ( ) -> set ( 'root_and_path' , array ( 'root' => $ root , 'path' => $ path ) ) ; foreach ( $ this -> getAdd ( ) as $ key => $ document ) { $ document -> setRootAndPath ( $ root , $ path . '._add' . $ key ) ; } }
Set the root and path of the embedded group .
5,927
public function setFilename ( $ filename , $ directory = null ) { $ this -> filename = $ filename ; $ this -> directory = $ directory ; }
Define the file and the working directory for a localfile
5,928
public function listAll ( ) { try { $ return = [ ] ; $ result = $ this -> getSoapClient ( ) -> ListImages ( ) ; if ( isset ( $ result -> ListImagesResult ) ) { $ return = $ this -> getSoapClient ( ) -> backendListArrayToMultiAssocArray ( $ result -> ListImagesResult ) ; } return $ return ; } catch ( SoapException $ ex ...
Return a list of all images present on the Livedocx service
5,929
public function getAcceptedFormats ( ) { try { $ ret = array ( ) ; $ result = $ this -> getSoapClient ( ) -> GetImageImportFormats ( ) ; if ( isset ( $ result -> GetImageImportFormatsResult -> string ) ) { $ ret = $ result -> GetImageImportFormatsResult -> string ; $ ret = array_map ( 'strtolower' , $ ret ) ; } return ...
Get the list of accepted images format for upload
5,930
public function getAvailableReturnFormats ( ) { try { $ ret = array ( ) ; $ result = $ this -> getSoapClient ( ) -> GetImageExportFormats ( ) ; if ( isset ( $ result -> GetImageExportFormatsResult -> string ) ) { $ ret = $ result -> GetImageExportFormatsResult -> string ; $ ret = array_map ( 'strtolower' , $ ret ) ; } ...
Get the list of accepted formats for image generation
5,931
public function upload ( ) { $ filename = $ this -> getName ( true ) ; if ( ! is_readable ( $ filename ) ) { throw new FileExistException ( 'Image file from disk is not readable' ) ; } try { $ this -> getSoapClient ( ) -> UploadImage ( array ( 'image' => base64_encode ( file_get_contents ( $ filename ) ) , 'filename' =...
Upload the active image on the livedocx server
5,932
public function download ( ) { try { $ result = $ this -> getSoapClient ( ) -> DownloadImage ( array ( 'filename' => basename ( $ this -> filename ) , ) ) ; return base64_decode ( $ result -> DownloadImageResult ) ; } catch ( SoapException $ e ) { throw new DownloadException ( 'Error while downloading the image' , $ e ...
Download an image file from Livedocx
5,933
public function exists ( ) { try { $ result = $ this -> getSoapClient ( ) -> ImageExists ( array ( 'filename' => basename ( $ this -> filename ) , ) ) ; return ( boolean ) $ result -> ImageExistsResult ; } catch ( SoapException $ e ) { throw new StatusException ( 'Error while verifying existence of the image' , $ e ) ;...
Check if an image exists on the Livedocx service
5,934
public function delete ( ) { try { $ this -> getSoapClient ( ) -> DeleteImage ( [ 'filename' => basename ( $ this -> getName ( true ) ) , ] ) ; return $ this ; } catch ( SoapException $ e ) { throw new DeleteException ( 'Error while deleting the image' , $ e ) ; } }
Delete the file from the Livedocx service
5,935
public function text ( $ search , array $ filter = array ( ) , $ fields = array ( ) , $ limit = null , $ language = null , $ options = array ( ) ) { $ command = array ( 'text' => $ this -> getCollectionName ( ) , 'search' => $ search , 'filter' => $ filter , 'project' => $ fields , 'limit' => $ limit , 'language' => $ ...
Search text content stored in the text index .
5,936
public function mapReduce ( $ map , $ reduce , array $ out , array $ query = array ( ) , array $ command = array ( ) , $ options = array ( ) ) { $ command = array_merge ( $ command , array ( 'mapreduce' => $ this -> getCollectionName ( ) , 'map' => is_string ( $ map ) ? new \ MongoCode ( $ map ) : $ map , 'reduce' => i...
Shortcut to make map reduce .
5,937
public function aggregate ( array $ pipeline , array $ options = array ( ) ) { $ command = array ( 'aggregate' => $ this -> getCollectionName ( ) , 'pipeline' => $ pipeline ) ; $ result = $ this -> command ( $ command , $ options ) ; return $ result [ 'result' ] ; }
Shortcut to make an aggregation .
5,938
public function createImage ( ) { $ ini = microtime ( true ) ; $ this -> imageAllocate ( ) ; $ text = $ this -> getCaptchaText ( ) ; $ fontcfg = $ this -> fonts [ array_rand ( $ this -> fonts ) ] ; $ this -> writeText ( $ text , $ fontcfg ) ; if ( ! empty ( $ this -> lineWidth ) ) { $ this -> writeLine ( ) ; } $ this -...
Generates captcha and outputs it to the browser .
5,939
protected function imageAllocate ( ) { if ( ! empty ( $ this -> im ) ) { imagedestroy ( $ this -> im ) ; } $ this -> im = imagecreatetruecolor ( $ this -> width * $ this -> scale , $ this -> height * $ this -> scale ) ; $ this -> GdBgColor = imagecolorallocate ( $ this -> im , $ this -> backgroundColor [ 0 ] , $ this -...
Creates the image resources
5,940
protected function getRandomCaptchaText ( $ length = null ) { if ( empty ( $ length ) ) { $ length = rand ( $ this -> minWordLength , $ this -> maxWordLength ) ; } $ words = "abcdefghijlmnopqrstvwyz" ; $ vocals = "aeiou" ; $ text = "" ; $ vocal = rand ( 0 , 1 ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { if ( $ vocal...
Random text generation
5,941
public function getDictionaryCaptchaText ( $ extended = false ) { if ( empty ( $ this -> wordsFile ) ) { return false ; } if ( substr ( $ this -> wordsFile , 0 , 1 ) == '/' ) { $ wordsfile = $ this -> wordsFile ; } else { $ wordsfile = $ this -> resourcesPath . '/' . $ this -> wordsFile ; } if ( ! file_exists ( $ words...
Random dictionary word generation
5,942
protected function writeLine ( ) { $ x1 = $ this -> width * $ this -> scale * .15 ; $ x2 = $ this -> textFinalX ; $ y1 = rand ( $ this -> height * $ this -> scale * .40 , $ this -> height * $ this -> scale * .65 ) ; $ y2 = rand ( $ this -> height * $ this -> scale * .40 , $ this -> height * $ this -> scale * .65 ) ; $ ...
Horizontal line insertion
5,943
protected function reduceImage ( ) { $ imResampled = imagecreatetruecolor ( $ this -> width , $ this -> height ) ; imagecopyresampled ( $ imResampled , $ this -> im , 0 , 0 , 0 , 0 , $ this -> width , $ this -> height , $ this -> width * $ this -> scale , $ this -> height * $ this -> scale ) ; imagedestroy ( $ this -> ...
Reduce the image to the final size
5,944
private function getConnection ( $ app , $ options , $ connections ) { $ connection_name = @ $ options [ 'connection' ] ? : self :: DEFAULT_CONNECTION ; if ( ! isset ( $ connections [ $ connection_name ] ) ) { throw new \ InvalidArgumentException ( 'Configuration for connection [' . $ connection_name . '] not found' ) ...
Return the name of the connection to use .
5,945
public function get ( $ key ) { if ( ! $ content = $ this -> info ( $ key ) ) { return null ; } return $ this -> unpack ( $ content ) ; }
Returns the value for a key .
5,946
protected function pack ( $ key , $ value , $ ttl = 0 ) { $ content = array ( 'key' => $ key , 'time' => time ( ) , 'ttl' => $ ttl , 'value' => $ value ) ; return $ content ; }
Pack the value in array with metadata
5,947
protected function unpack ( $ content ) { if ( ! is_array ( $ content ) ) return null ; if ( $ content [ 'ttl' ] > 0 && time ( ) >= $ content [ 'time' ] + $ content [ 'ttl' ] ) { $ this -> remove ( $ content [ 'key' ] ) ; return null ; } return $ content [ 'value' ] ; }
Unpack the data from cache and unserialize the value . If ttl is ussed and is expired false is return
5,948
public function bind ( $ values ) { if ( ! is_array ( $ values ) ) { throw new InvalidException ( 'Values assigned to a block must be an array' ) ; } if ( ! $ this -> isArrayMulti ( $ values ) ) { $ this -> bindings [ ] = $ values ; return $ this ; } foreach ( $ values as $ line ) { $ this -> bind ( $ line ) ; } return...
Bind a set of values to a block fieldname
5,949
public function getAllBlockNames ( ) { $ ret = [ ] ; try { $ result = $ this -> getSoapClient ( ) -> GetBlockNames ( ) ; } catch ( SoapException $ ex ) { throw new StatusException ( 'Error while getting the list of all blocks in the active template' , $ ex ) ; } if ( isset ( $ result -> GetBlockNamesResult -> string ) ...
Return the names of all blocks included in the active template
5,950
public function getFieldNames ( ) { $ ret = [ ] ; try { $ result = $ this -> getSoapClient ( ) -> GetBlockFieldNames ( [ 'blockName' => $ this -> getName ( ) , ] ) ; } catch ( SoapException $ ex ) { throw new StatusException ( 'Error while getting the list of all fields in this block' , $ ex ) ; } if ( isset ( $ result...
Return the list of all fields contained in this block inside the active template
5,951
public function connect ( $ username , $ password ) { if ( ! $ this -> isConnected ) { try { $ this -> client -> LogIn ( [ 'username' => $ username , 'password' => $ password ] ) ; $ this -> isConnected = true ; } catch ( SoapFault $ ex ) { throw new ConnectException ( 'Either an error occured when connecting to Livedo...
Create a session on Livedocx service
5,952
protected function assocArrayToArrayOfArrayOfString ( $ assoc ) { $ arrayKeys = array_keys ( $ assoc ) ; $ arrayValues = array_values ( $ assoc ) ; return array ( $ arrayKeys , $ arrayValues ) ; }
Convert an associative PHP array to an array of array of strings
5,953
protected function multiAssocArrayToArrayOfArrayOfString ( $ multi ) { $ arrayKeys = array_keys ( $ multi [ 0 ] ) ; $ arrayValues = array ( ) ; foreach ( $ multi as $ v ) { $ arrayValues [ ] = array_values ( $ v ) ; } $ _arrayKeys = array ( ) ; $ _arrayKeys [ 0 ] = $ arrayKeys ; return array_merge ( $ _arrayKeys , $ ar...
Convert a multidimensional PHP array to an array of array of arrays of strings
5,954
public function backendListArrayToMultiAssocArray ( stdClass $ list ) { $ ret = array ( ) ; if ( isset ( $ list -> ArrayOfString ) ) { foreach ( $ list -> ArrayOfString as $ a ) { if ( is_array ( $ a ) ) { $ o = new StdClass ( ) ; $ o -> string = $ a ; } else { $ o = $ a ; } unset ( $ a ) ; if ( isset ( $ o -> string )...
Convert LiveDocx service return value from list methods to consistent PHP array .
5,955
public function isMatch ( Address $ address ) { if ( ! is_null ( $ address -> getBin ( ) ) && ! is_null ( $ this -> bin ) && $ address -> getBin ( ) !== $ this -> bin ) { return false ; } if ( ! is_null ( $ address -> getKey ( ) ) && ! is_null ( $ this -> key ) && $ address -> getKey ( ) !== $ this -> key ) { return fa...
Return true if this object refers to any of the same objects as the provided Address object .
5,956
public function serialize ( ) { if ( is_null ( $ this -> bin ) ) { return '' ; } $ length_prefixed_bin = strlen ( $ this -> bin ) . ':' . $ this -> bin ; if ( is_null ( $ this -> key ) ) { return $ length_prefixed_bin . ':' ; } return $ length_prefixed_bin . ':' . $ this -> key ; }
Serialize this object returning a string representing this address .
5,957
public function unserialize ( $ serialized ) { $ entries = explode ( ':' , $ serialized , 2 ) ; $ this -> bin = null ; $ this -> key = null ; if ( count ( $ entries ) === 2 ) { list ( $ bin_length , $ bin_and_key ) = $ entries ; $ bin_length = intval ( $ bin_length ) ; $ this -> bin = substr ( $ bin_and_key , 0 , $ bin...
Unpack a serialized Address into this object .
5,958
private function recordEvent ( $ key ) { $ success = null ; apcu_inc ( $ key , 1 , $ success ) ; if ( $ success !== null && ! $ success ) { $ success = apcu_store ( $ key , 1 ) ; } return $ success ; }
Utility method to reduce code duplication .
5,959
public function getDiff ( ) { $ set = $ this -> getIndexInfo ( ) ; unset ( $ set [ '_id_1' ] ) ; $ present = array ( ) ; $ missing = array ( ) ; foreach ( $ this -> config as $ index ) { if ( ! isset ( $ index [ 'options' ] ) ) $ index [ 'options' ] = array ( ) ; $ name = $ this -> generateIndexKeyFromConfig ( $ index ...
Returns the diferences between server indexes and class config when a indexes change will be marked in db as unknown and missing the new version .
5,960
public function commit ( $ delete = true ) { $ diff = $ this -> getDiff ( ) ; if ( $ delete ) { foreach ( $ diff [ 'unknown' ] as $ index ) { $ this -> deleteIndex ( $ index [ 'name' ] ) ; } } foreach ( $ diff [ 'missing' ] as $ name => $ index ) { $ this -> ensureIndex ( $ index [ 'keys' ] , $ index [ 'options' ] ) ; ...
Commit the indexes to the database
5,961
public function text ( $ search , $ requiredScore = null , $ language = null ) { if ( $ search === null ) { $ this -> text = null ; } else { $ this -> text = array ( 'search' => $ search , 'requiredScore' => $ requiredScore , 'language' => $ language ) ; } return $ this ; }
Set the text search criterias . The text methods requires a text index .
5,962
public function createResult ( ) { if ( ! $ this -> text ) { return false ; } list ( $ search , $ requiredScore , $ language ) = array_values ( $ this -> text ) ; $ limit = $ this -> limit ; if ( $ this -> skip && $ this -> limit ) { $ limit += $ this -> skip ; } $ options = array ( ) ; if ( $ this -> timeout ) $ optio...
Create an ArrayObject with a result s text command of the query .
5,963
public function generateKey ( $ includeHash = true ) { $ keys = array ( ) ; $ keys [ 'vars' ] = get_object_vars ( $ this ) ; $ keys [ 'class' ] = get_class ( $ this ) ; $ keys [ 'metadata' ] = $ this -> repository -> getMetadata ( ) ; $ keys [ 'dbname' ] = $ this -> repository -> getConnection ( ) -> getDbName ( ) ; un...
Generate a unique key for this query
5,964
public function setName ( $ template_name , $ path = null ) { parent :: setName ( $ template_name ) ; $ this -> directory = $ path ; }
Set the name of the template and its path
5,965
public function setAsActive ( ) { try { $ templatecontent = $ this -> getBase64Contents ( ) ; $ format = $ this -> getFormat ( ) ; } catch ( FileExistException $ ex ) { throw new FileExistException ( 'Template file does not exist or is not readable' , $ ex ) ; } try { $ this -> getSoapClient ( ) -> SetLocalTemplate ( [...
Set the local template as active and upload it to be used when generating the final document
5,966
public function upload ( ) { try { $ templatecontent = $ this -> getBase64Contents ( ) ; $ filename = basename ( $ this -> getName ( ) ) ; } catch ( FileExistException $ ex ) { throw new FileExistException ( 'Template file does not exist or is not readable' , $ ex ) ; } try { $ this -> getSoapClient ( ) -> UploadTempla...
Upload the local template to Livedocx service and return a new instance of corresponding remote template
5,967
public function getContents ( ) { try { $ fileObj = new SplFileObject ( $ this -> getName ( true ) , 'r' ) ; } catch ( RuntimeException $ ex ) { throw new FileExistException ( 'The provided file is not readable' , $ ex ) ; } return file_get_contents ( $ fileObj -> getPathname ( ) ) ; }
Return the contents of the whole template file
5,968
public function getFormat ( ) { try { $ fileObj = new SplFileObject ( $ this -> getName ( true ) , 'r' ) ; } catch ( RuntimeException $ ex ) { throw new FileExistException ( 'The provided file is not readable' , $ ex ) ; } return $ fileObj -> getExtension ( ) ; }
Return the format of the file
5,969
public static function add ( $ name , $ class ) { if ( static :: has ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The id generator "%s" already exists.' , $ name ) ) ; } $ r = new \ ReflectionClass ( $ class ) ; if ( ! $ r -> isSubclassOf ( 'Mongator\Id\BaseIdGenerator' ) ) { throw new \ InvalidArgu...
Add an id generator .
5,970
public static function get ( $ name ) { if ( ! isset ( static :: $ idGenerators [ $ name ] ) ) { if ( ! static :: has ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The id generator "%s" does not exists.' , $ name ) ) ; } static :: $ idGenerators [ $ name ] = new static :: $ map [ $ name ] ; } return ...
Returns an id generator .
5,971
public static function remove ( $ name ) { if ( ! static :: has ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The id generator "%s" does not exists.' , $ name ) ) ; } unset ( static :: $ map [ $ name ] , static :: $ idGenerators [ $ name ] ) ; }
Remove an id generator .
5,972
public function save ( array $ options = array ( ) ) { if ( $ this -> isNew ( ) ) { $ this -> queryFields = array ( ) ; $ batchInsertOptions = $ options ; $ updateOptions = array ( ) ; } else { $ batchInsertOptions = array ( ) ; $ updateOptions = $ options ; } $ this -> getRepository ( ) -> save ( $ this , $ batchInser...
Save the document .
5,973
protected function setQueryFields ( array $ fields ) { $ this -> queryFields = array ( ) ; foreach ( $ fields as $ field => $ included ) { if ( $ included ) $ this -> queryFields [ $ field ] = 1 ; } }
Set the fields that were included in the query used to populate the object .
5,974
public function applyPathPrefix ( $ path ) { $ path = ltrim ( $ path , '/' ) ; if ( strlen ( $ path ) === 0 ) { return rtrim ( $ this -> getPathPrefix ( ) , '/' ) ; } return $ this -> getPathPrefix ( ) . $ path ; }
Prefix a path .
5,975
private function getFolderNode ( $ path , $ create = false ) { $ location = $ this -> applyPathPrefix ( $ path ) ; if ( ! $ create && ! $ this -> session -> nodeExists ( $ location ) ) { return $ this -> session -> getNode ( $ location ) ; } $ folders = array ( ) ; while ( ! $ this -> session -> nodeExists ( $ location...
Ensure the directory exists and try to create it if it does not exist .
5,976
public function deploy ( $ stage , $ branchOrTag , $ revision = '' , $ opts = [ self :: OPT_REINSTALL_PROJECT => false , self :: OPT_DROP_VENDOR => false , self :: OPT_DROP_DATABASE => false , self :: OPT_DEPLOYER_PARALLEL => false , ] ) { $ this -> startTimer ( ) ; $ this -> deployMagentoSetup ( $ branchOrTag , $ revi...
command to trigger deployment process completly
5,977
public function deployArtifactsGenerate ( ) { $ this -> startTimer ( ) ; $ this -> printStageInfo ( 'GENERATE ASSETS' ) ; $ this -> printTaskInfo ( 'SET PRODUCTION MODE' ) ; $ this -> taskMagentoSetProductionMode ( ) -> run ( ) ; $ this -> printTaskInfo ( 'MAGENTO SETUP DI COMPILE' ) ; $ this -> taskMagentoSetupDiCompi...
STAGE command that generates all artifacts for the deploy
5,978
public function deployDeploy ( $ stage , $ branchOrTag , $ opts = [ self :: OPT_DEPLOYER_PARALLEL => false , ] ) { $ parallelMode = $ opts [ 'parallel' ] ; $ this -> startTimer ( ) ; $ this -> printStageInfo ( 'DEPLOYER DEPLOY' ) ; $ task = $ this -> taskDeployerDeploy ( $ stage , $ branchOrTag ) ; if ( $ parallelMode ...
STAGE command triggering release to server using deployer
5,979
static function call ( $ command , $ additional_command_params = null , $ post_params = null , $ attachments = null ) { if ( empty ( self :: $ url ) || empty ( self :: $ key ) || empty ( self :: $ connector ) ) { throw new WrapperNotInitialized ( ) ; } $ data = is_array ( $ additional_command_params ) && count ( $ addi...
Prepare and execute API command
5,980
public static function create ( string $ name , string $ bindTo = '' ) : Base { $ fullName = __NAMESPACE__ . '\\Widget\\' . $ name ; $ widget = class_exists ( $ fullName ) ? new $ fullName ( ) : new Widget \ Base ( 'kendo' . $ name ) ; if ( $ bindTo ) { $ widget -> bindTo ( $ bindTo ) ; } return $ widget ; }
Create and return instance of requested Kendo widget .
5,981
public static function date ( string $ value ) : ? JavascriptFunction { $ timestamp = strtotime ( $ value ) ; if ( ! $ timestamp ) { return null ; } return new JavascriptFunction ( 'kendo.parseDate("' . date ( 'Y-m-d H:i:s' , $ timestamp ) . '")' ) ; }
Create javascript date object .
5,982
public function install ( $ val , $ opts = null ) { $ this -> id = isset ( $ val [ 'id' ] ) ? $ val [ 'id' ] : null ; $ this -> opts = Util \ Options :: parse ( $ opts ) ; foreach ( $ val as $ k => $ v ) { $ this -> values [ $ k ] = Util \ Util :: arrayToObject ( $ v ) ; } }
Apply the contents of the given Object to this instance .
5,983
public static function constructFrom ( $ val , $ opts = null ) { $ obj = new static ( isset ( $ val [ 'id' ] ) ? $ val [ 'id' ] : null ) ; $ obj -> install ( $ val , $ opts ) ; return $ obj ; }
Create new instance from JSON string .
5,984
public static function parseJson ( $ jsonString ) { $ jsonObj = json_decode ( $ jsonString , true ) ; $ jsonCheck = json_last_error ( ) ; if ( $ jsonObj === null && $ jsonCheck !== JSON_ERROR_NONE ) { $ msg = "Invalid json string: $jsonString -- " . "json_last_error() returns $jsonCheck" ; throw new Error \ ParseExcept...
Apply the contents of given JSON string to this instance .
5,985
public static function getObjectTag ( $ class , $ id ) { if ( is_object ( $ class ) && $ class instanceof ActiveRecord ) { $ class = $ class -> className ( ) ; } elseif ( ! is_string ( $ class ) ) { throw new InvalidParamException ( 'Param $class must be a string or an object.' ) ; } return $ class . '[ObjectTag:' . se...
Get object tag name .
5,986
public static function getCompositeTag ( $ class , $ fields ) { if ( is_object ( $ class ) && $ class instanceof ActiveRecord ) { $ class = $ class -> className ( ) ; } elseif ( ! is_string ( $ class ) ) { throw new InvalidParamException ( 'Param $class must be a string or an object.' ) ; } return $ class . '[Composite...
Get composite tag name from model fields .
5,987
public static function getCacheKeyById ( $ id , $ keys = false ) { if ( is_array ( $ id ) ) { ksort ( $ id ) ; $ id = ( $ keys ) ? array_keys ( $ id ) : array_values ( $ id ) ; return implode ( '|' , $ id ) ; } return ( string ) $ id ; }
Return string for cache - key from varios primary key
5,988
public function create ( string $ name ) { $ className = $ this -> getClassName ( $ name ) ; $ result = $ this -> createInstance ( $ className ) ; return $ result ; }
Returns a new DAO instance
5,989
public function openGroup ( $ name , $ label = null , $ options = array ( ) ) { $ options = $ this -> appendClassToOptions ( Config :: get ( 'form-builder.group-class' ) , $ options ) ; $ this -> groupStack [ ] = $ name ; if ( $ this -> hasErrors ( $ name ) ) { $ options = $ this -> appendClassToOptions ( Config :: get...
Open a new form group
5,990
public function select ( $ name , $ list = [ ] , $ selected = null , array $ selectAttributes = [ ] , array $ optionsAttributes = [ ] , array $ optgroupsAttributes = [ ] ) { $ selectAttributes = $ this -> appendClassToOptions ( Config :: get ( 'form-builder.control-class' ) , $ selectAttributes ) ; return parent :: sel...
Create a select box
5,991
public function plainSelect ( $ name , $ list = array ( ) , $ selected = null , array $ selectAttributes = [ ] , array $ optionsAttributes = [ ] ) { return parent :: select ( $ name , $ list , $ selected , $ selectAttributes , $ optionsAttributes ) ; }
Create a plain select box
5,992
private function hasErrors ( $ name ) { if ( is_null ( $ this -> session ) || ! $ this -> session -> has ( 'errors' ) ) { return false ; } $ errors = $ this -> getErrorsSession ( ) ; return $ errors -> has ( $ this -> transformKey ( $ name ) ) ; }
Determine whether the form element with the given name has any validation errors
5,993
private function getFormattedErrors ( $ name ) { if ( ! $ this -> hasErrors ( $ name ) ) { return '' ; } $ errors = $ this -> getErrorsSession ( ) ; return $ errors -> first ( $ this -> transformKey ( $ name ) , '<p class="help-block">:message</p>' ) ; }
Get the formatted errors for the form element with the given name
5,994
protected function addContextToMessages ( ) { $ context = $ this -> getContextMessage ( ) ; if ( $ context === [ ] ) { return ; } foreach ( $ this -> messages as & $ message ) { $ message [ 0 ] = ArrayHelper :: merge ( $ context , $ this -> parseText ( $ message [ 0 ] ) ) ; } }
Updates all messages if there are context variables .
5,995
protected function getContextMessage ( ) { $ context = $ this -> context ; if ( ( $ this -> logUser === true ) && ( $ user = \ Yii :: $ app -> get ( 'user' , false ) ) !== null ) { $ context [ 'userId' ] = $ user -> getId ( ) ; } foreach ( $ this -> logVars as $ name ) { if ( empty ( $ GLOBALS [ $ name ] ) === false ) ...
Generates the context information to be logged .
5,996
protected function prepareMessage ( $ message ) { list ( $ text , $ level , $ category , $ timestamp ) = $ message ; $ level = Logger :: getLevelName ( $ level ) ; $ timestamp = date ( 'c' , $ timestamp ) ; $ result = ArrayHelper :: merge ( $ this -> parseText ( $ text ) , [ 'level' => $ level , 'category' => $ categor...
Transform log message to assoc .
5,997
public static function fromSql ( string $ format , $ data = null ) { if ( $ data === null ) { return null ; } switch ( $ format ) { case self :: NONE : return $ data ; case self :: DATE : $ result = DateTime :: createFromFormat ( $ format , $ data ) ; $ result -> setTime ( 0 , 0 , 0 ) ; return $ result ; case self :: T...
Converts data from sql data source
5,998
public static function toSql ( string $ format , $ data = null ) { if ( $ data === null ) { return null ; } switch ( $ format ) { case self :: NONE : return $ data ; case self :: TIME : case self :: TIMEU : case self :: TIMETZ : case self :: TIMEUTZ : case self :: DATE : case self :: DATETIME : case self :: DATETIMEU :...
Converts data to sql format
5,999
public static function retrieve ( $ id , $ opts = null ) { $ list = self :: all ( array ( 'id' => $ id ) , $ opts ) ; $ ch = new Charge ( ) ; $ ch -> install ( $ list -> data [ 0 ] -> values , $ list -> opts ) ; return $ ch ; }
Get Charge object which has specific charge id .