idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
231,600
private function isOpera ( ) { $ is = false ; if ( preg_match ( "/(Opera)\/9.80.*Version\/((\d+)\.(\d+)(?:\.(\d+))?)/" , $ this -> ua , $ matches ) ) { $ is = true ; $ version = $ matches [ 2 ] ; $ major = $ matches [ 3 ] ; $ minor = $ matches [ 4 ] ; } elseif ( preg_match ( "/Opera (([0-9]+)\.?([0-9]*))/" , $ this -> ...
Determines if a browser is Opera by the user agent string .
231,601
private function isOperaMobile ( ) { $ is = false ; $ android = false ; $ ios = false ; $ tablet = false ; $ phone = false ; $ touch = false ; if ( $ this -> browser == 'opera' || $ this -> isOpera ( ) ) { if ( preg_match ( "/(?:Mobile Safari).*(OPR)/" , $ this -> ua ) ) { $ is = true ; $ android = true ; } elseif ( pr...
Determines if the browser is the mobile or mini version of opera by the user agent string .
231,602
private function isChromeMobile ( ) { $ is = false ; $ android = false ; $ ios = false ; $ tablet = false ; $ phone = false ; if ( $ this -> browser == 'chrome' || $ this -> isChrome ( ) ) { if ( stripos ( $ this -> ua , 'android' ) !== false ) { $ is = true ; $ android = true ; $ tablet = ( stripos ( $ this -> ua , 'm...
Determines if the browser is Chrome on a mobile device by the user agent string .
231,603
private function isSafariMobile ( ) { $ is = false ; $ tablet = false ; $ phone = false ; if ( $ this -> browser == 'safari' || $ this -> isSafari ( ) ) { if ( preg_match ( "/(iPhone|iPod|iPad)/" , $ this -> ua , $ matches ) ) { $ is = true ; $ tablet = ( $ matches [ 1 ] == 'iPad' ) ; $ phone = ( $ matches [ 1 ] == 'iP...
Determines if the browser is Safari Mobile by the User Agent String .
231,604
private function isFirefoxMobile ( ) { $ is = false ; $ tablet = false ; $ phone = false ; $ android = false ; $ touch = true ; if ( $ this -> browser == 'firefox' || $ this -> isFirefox ( ) ) { if ( preg_match ( "/(Mobile|Tablet|TV)/" , $ this -> ua , $ matches ) ) { $ is = true ; $ tablet = ( $ matches [ 1 ] == 'Tabl...
Determines if the browser is Firefox Mobile by the User Agent string .
231,605
public function save ( $ savepath ) { $ result = move_uploaded_file ( $ this -> stored_filename , $ savepath ) ; if ( $ result === true ) { $ this -> stored_filename = $ savepath ; return true ; } else { return false ; } }
Save the uploaded file to a specific path .
231,606
protected static function createSlug ( string $ input , array $ rulesets = self :: SLUG_RULESETS , string $ separator = '-' ) : string { $ slugify = new Slugify ( [ 'rulesets' => $ rulesets , 'separator' => $ separator ] ) ; $ slug = $ slugify -> slugify ( $ input ) ; return $ slug ; }
Creates a slug from an input .
231,607
private function createJsonApiAdapter ( $ configName , ContainerBuilder $ container ) { $ serializerName = Utility :: getAliasedName ( 'api.serializer' ) ; $ definition = new Definition ( Utility :: getLibraryClass ( 'Api\JsonApiOrg\Serializer' ) ) ; $ definition -> setPublic ( false ) ; $ container -> setDefinition ( ...
Creates the jsonapi . org Adapter service definition .
231,608
private function loadAdapter ( $ adapterName , $ configName , array $ adapterConfig , ContainerBuilder $ container ) { if ( isset ( $ adapterConfig [ 'service' ] ) ) { $ container -> setAlias ( $ adapterName , Utility :: cleanServiceName ( $ adapterConfig [ 'service' ] ) ) ; return $ this ; } switch ( $ adapterConfig [...
Loads the Adapter service based on the adapter config .
231,609
private function loadConfiguration ( $ name , array $ restConfig , ContainerBuilder $ container ) { $ definition = new Definition ( Utility :: getLibraryClass ( 'Rest\RestConfiguration' ) , [ new Reference ( Utility :: getAliasedName ( 'util.validator' ) ) , ] ) ; $ definition -> setPublic ( false ) ; $ endpoint = $ re...
Loads the Rest config service based on the config .
231,610
private function loadKernel ( $ adapterName , $ configName , $ debug , ContainerBuilder $ container ) { $ definition = new Definition ( Utility :: getLibraryClass ( 'Rest\RestKernel' ) , [ new Reference ( $ adapterName ) , new Reference ( $ configName ) , ] ) ; $ definition -> addMethodCall ( 'enableDebug' , [ $ debug ...
Loads the Rest Kernel service based on the config .
231,611
private function doRefresh ( $ document , array & $ visited ) { $ oid = spl_object_hash ( $ document ) ; if ( isset ( $ visited [ $ oid ] ) ) { return ; } $ visited [ $ oid ] = $ document ; $ class = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; if ( ! $ class -> isEmbeddedDocument ) { if ( $ this -> ...
Executes a refresh operation on a document .
231,612
public function getAssociationPersister ( ) { if ( ! isset ( $ this -> associationPersister ) ) { $ this -> associationPersister = new Persister \ AssociationPersister ( $ this -> dm , $ this ) ; } return $ this -> associationPersister ; }
Get the association persister instance .
231,613
public function getDocumentIdentifier ( $ document ) { return isset ( $ this -> documentIdentifiers [ spl_object_hash ( $ document ) ] ) ? $ this -> documentIdentifiers [ spl_object_hash ( $ document ) ] : null ; }
Gets the identifier of a document .
231,614
public function size ( ) { $ count = 0 ; foreach ( $ this -> identityMap as $ documentSet ) { $ count += count ( $ documentSet ) ; } return $ count ; }
Calculates the size of the UnitOfWork . The size of the UnitOfWork is the number of documents in the identity map .
231,615
protected function supportsCommonTableExpressionQuery ( ) { $ driver = DB :: connection ( ) -> getDriverName ( ) ; if ( $ driver == 'mysql' ) { return true ; } if ( $ driver == 'sqlite' && \ SQLite3 :: version ( ) [ 'versionNumber' ] >= 3008003 ) { return true ; } return false ; }
Tests if the driver supports Common Table Expression .
231,616
public function getDescent ( $ id ) { $ key = $ this -> getCacheKey ( 'descent' , $ id ) ; if ( $ results = $ this -> cache -> get ( $ key ) ) { return $ results ; } $ this -> cache -> add ( $ key , $ results = $ this -> getRecursiveRetriever ( ) -> getDescent ( $ id ) , 2 ) ; return $ results ; }
Get all childs recursively .
231,617
protected function prepareVertices ( $ data ) { $ vertices = [ ] ; foreach ( $ data as $ content ) { $ content -> term_id = "$content->term_id" ; $ content -> parent_id = "$content->parent_id" ; if ( ! array_key_exists ( $ content -> term_id , $ vertices ) ) { $ vertices [ $ content -> term_id ] = new Vertex ( $ conten...
Prepare the vertices to create the graph .
231,618
public function getAncestryGraph ( $ id ) { $ data = $ this -> getAncestry ( $ id ) ; if ( count ( $ data ) == 0 ) { return [ null , null ] ; } $ this -> vertices = $ this -> prepareVertices ( $ data ) ; $ graph = new DirectedGraph ( ) ; foreach ( $ this -> vertices as $ vertex ) { $ graph -> add_vertex ( $ vertex ) ; ...
Get all parents recursively
231,619
public function setCity ( City $ city ) : void { $ this -> city = $ city -> getName ( ) ; $ this -> postCode = $ city -> getPostCode ( ) ; }
Set the value of post code and city through a City instance .
231,620
public function getIterator ( $ models = [ ] , $ requestedClassPath = '' ) { $ possiblePath = '' ; if ( $ requestedClassPath ) { $ possiblePath = $ this -> iteratorFactory -> getDefaultNamespaceAbs ( $ requestedClassPath ) ; if ( ! class_exists ( $ possiblePath ) ) { throw new \ Exception ( "Unable to find iterator '$p...
get the iterator specific to this class or a custom one if required
231,621
public function getInsertGenericSql ( array $ cols ) { $ sql = [ 'insert into' , "`{$this->getTableNameLazy()}`" , '(' ] ; $ sqlCols = [ ] ; foreach ( $ cols as $ col ) { $ sqlCols [ ] = "`$col`" ; } $ sql [ ] = implode ( ', ' , $ sqlCols ) ; $ sql [ ] = ') values (' ; $ sqlCols = [ ] ; foreach ( $ cols as $ col ) { $ ...
builds insert statement using cols provided
231,622
public function getUpdateGenericSql ( array $ cols ) { $ sql = [ 'update' , "`{$this->getTableNameLazy()}`" , 'set' ] ; $ sqlCols = [ ] ; foreach ( $ cols as $ col ) { $ sqlCols [ ] = "`$col` = :$col" ; } $ sql [ ] = implode ( ', ' , $ sqlCols ) ; $ sql [ ] = "where `id` = :id" ; return implode ( ' ' , $ sql ) ; }
builds update statement using cols provided
231,623
protected function scanDirectory ( string $ path , string $ parentDir ) : array { $ files = [ ] ; $ rdi = new \ RecursiveDirectoryIterator ( $ path , \ FilesystemIterator :: SKIP_DOTS | \ FilesystemIterator :: KEY_AS_FILENAME | \ FilesystemIterator :: CURRENT_AS_FILEINFO ) ; $ rii = new \ RecursiveIteratorIterator ( $ ...
Scans the given directory and its sub - directories returning a list of all the relative path to each file from the given marker .
231,624
private function loadIndexFile ( string $ indexFilepath ) : array { $ this -> status = IndexInterface :: STATUS_LOADED ; return \ unserialize ( \ file_get_contents ( $ indexFilepath ) ) ; }
Reads the file and unserializes it .
231,625
public function createTable ( BeanInterface $ bean , $ findCondition = "" ) { if ( $ this -> _table_factory instanceof TableFactoryInterface ) { return $ this -> _table_factory -> generateTable ( $ bean , $ findCondition , true ) ; } return false ; }
This function generates the Table based on the Bean and the search condition that is passed .
231,626
public function matches ( \ Neos \ ContentRepository \ Domain \ Model \ NodeData $ node ) { $ nodeIsMatchingNodeType = false ; for ( $ i = 0 ; $ i < $ this -> searchDepth ; $ i ++ ) { $ parentNode = $ node -> getParent ( ) ; if ( $ parentNode !== null ) { $ nodeType = $ parentNode -> getNodeType ( ) ; if ( $ this -> wi...
Returns TRUE if the given node has a parent of a specific nodetype
231,627
public function handleFilter ( $ filtererName , $ method , $ params , $ locals , $ globals ) { $ this -> allowTemplateCode = false ; $ this -> locals = $ locals ; $ this -> globals = $ globals ; $ this -> params = $ params ; if ( strlen ( $ method ) == 0 && $ this -> getDefaultMethod ( ) != null ) $ methodResolved = $ ...
This function is used to handle the call to the filterer method . It fires preHandle the specified filterer method then postHandle .
231,628
protected function readOption ( string $ key , $ fallback = null ) { $ value = get_option ( $ this -> prefix . $ key , $ fallback ?? false ) ; if ( false === $ value ) { return $ fallback ; } return $ value ; }
Read a single option from the persistence mechanism .
231,629
public function redirect ( ClientInterface $ client , string $ url , int $ status = 302 ) : EndPointInterface { $ client -> acceptResponse ( new Response \ RedirectResponse ( $ url , $ status ) ) ; return $ this ; }
Returns a RedirectResponse to the given URL .
231,630
public function img ( $ email = '' , $ alt = '' , array $ attr = [ ] ) { if ( empty ( $ email ) ) { $ email = $ this -> _options [ 'email' ] ; } $ img = '<img src="' . $ this -> src ( $ email , $ attr ) . '"' ; if ( ! empty ( $ alt ) ) { $ img .= ' alt="' . $ alt . '"' ; } if ( isset ( $ attr [ 'width' ] ) ) { $ img .=...
Generates and returns the HTML image .
231,631
public function showAction ( Request $ request , $ access , $ id ) { $ em = $ this -> getDoctrineManager ( ) ; $ message = null ; if ( $ id instanceof Message ) { $ message = $ id ; } elseif ( is_numeric ( $ id ) ) { $ message = $ em -> getRepository ( 'BisonLabSakonninBundle:Message' ) -> find ( $ id ) ; } else { $ me...
Finds and displays a Message entity .
231,632
public function searchContextGetAction ( Request $ request , $ access , $ system , $ object_name , $ external_id ) { $ this -> denyAccessUnlessGranted ( 'index' , new Message ( ) ) ; $ context_conf = $ this -> container -> getParameter ( 'app.contexts' ) ; $ conf = $ context_conf [ 'BisonLabSakonninBundle' ] [ 'Message...
Lists all Messages with that context .
231,633
public function deleteAction ( Request $ request , $ access , Message $ message ) { $ this -> denyAccessUnlessGranted ( 'edit' , $ message ) ; $ form = $ this -> createDeleteForm ( $ message ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctr...
Deletes a message entity .
231,634
public function checkUnreadAction ( Request $ request , $ access ) { $ em = $ this -> getDoctrineManager ( ) ; $ sm = $ this -> container -> get ( 'sakonnin.messages' ) ; $ user = $ this -> getUser ( ) ; $ repo = $ em -> getRepository ( 'BisonLabSakonninBundle:Message' ) ; $ messages = $ sm -> getMessagesForLoggedIn ( ...
Check for unread messages
231,635
public function newAction ( Request $ request , $ access ) { $ message = new Message ( ) ; if ( $ message_type = $ request -> get ( 'message_type' ) ) { $ em = $ this -> getDoctrineManager ( ) ; $ message -> setMessageType ( $ em -> getRepository ( 'BisonLabSakonninBundle:MessageType' ) -> find ( $ message_type ) ) ; }...
Creates a new person entity .
231,636
public function createDeleteForm ( Message $ message , $ access = "ajax" ) { $ form_name = "message_delete_" . $ message -> getId ( ) ; return $ this -> get ( 'form.factory' ) -> createNamedBuilder ( $ form_name , FormType :: class ) -> setAction ( $ this -> generateUrl ( 'message_delete' , array ( 'id' => $ message ->...
Creates a form to delete a message entity .
231,637
public function checkChars ( $ value ) { if ( $ value [ 0 ] == '(' ) { $ value = substr ( $ value , 1 ) ; if ( $ value [ strlen ( $ value ) - 1 ] == ')' ) { $ value = substr ( $ value , 0 , - 1 ) ; } else { return false ; } } return parent :: checkChars ( $ value ) ; }
Allows start and stop tag within checked chars
231,638
public function getExtension ( $ extensionName ) { if ( ! $ this -> hasExtension ( $ extensionName ) ) { $ this -> addExtension ( new $ extensionName ) ; } return $ this -> extensions [ $ extensionName ] ; }
Get the named extension create one if not injected yet
231,639
protected function decorateService ( $ service ) { $ extName = DecorateExtension :: EXTENSION_CLASS ; if ( $ this -> hasExtension ( $ extName ) ) { $ ext = $ this -> getExtension ( $ extName ) ; $ ext -> decorateService ( $ service ) ; } return $ this ; }
Decorate the service object if DecorateExtension loaded
231,640
public static function splitClassName ( $ className ) { $ chunk = explode ( '\\' , $ className ) ; $ className = array_pop ( $ chunk ) ; $ namespace = implode ( '\\' , $ chunk ) ; $ result = array ( $ namespace , $ className ) ; return $ result ; }
Split class name
231,641
final public function showTables ( ) { $ q = $ this -> query ( 'SHOW TABLES' ) ; $ q -> execute ( ) ; return $ q -> fetchAll ( self :: FETCH_COLUMN ) ; }
Returns an array of available database tables
231,642
final public function describe ( $ table ) { $ q = $ this -> query ( "DESCRIBE `{$table}`" ) ; $ q -> execute ( ) ; return $ q -> fetchAll ( self :: FETCH_COLUMN ) ; }
Describe a table
231,643
public function actionLogin ( array $ confirm_data , $ goto ) { $ url = 'http://hiapi.ahnames.com/verifyConfirmation?' . http_build_query ( [ 'auth_ip' => Yii :: $ app -> request -> getUserIp ( ) , 'what' => 'redirect_hipanel' , 'confirm_data' => $ confirm_data , ] ) ; $ res = Json :: decode ( file_get_contents ( $ url...
Implements login from MRDP panel .
231,644
public function setBreadcrumbElement ( $ element ) { if ( ! empty ( trim ( $ element ) ) && is_string ( $ element ) ) { $ this -> breadcrumbElement = trim ( $ element ) ; } return $ this ; }
Sets the main element to give to list style breadcrumb menus
231,645
public function setBreacrumbLinks ( $ links ) { if ( is_array ( $ links ) && ! empty ( $ links ) ) { $ this -> links = $ links ; } return $ this ; }
Sets the link to include in the breadcrumb element
231,646
private static function createConfiguration ( array $ config , ContainerInterface $ container = null ) { $ cache = $ config [ 'cache' ] ; if ( $ container && is_string ( $ config [ 'cache' ] ) && $ container -> has ( $ config [ 'cache' ] ) ) { $ cache = $ container -> get ( $ config [ 'cache' ] ) ; } return Setup :: cr...
Creates the ORM configuration .
231,647
public function get_string_from_code ( $ code ) { $ errors = [ self :: ERR_GENERAL => 'General Error' , self :: ERR_BAD_REQUEST => 'Bad Request' , self :: ERR_UNAUTHORIZED => 'Unauthorized' , self :: ERR_FORBIDDEN => 'Forbidden' , self :: ERR_INTERNAL_ERROR => 'Internal Error' , self :: ERR_PRECONDITION_FAILED => 'Prec...
Translate an error code into a human - readable string explaining the problem .
231,648
private function setClientFilename ( $ clientFilename ) { if ( preg_match ( '`[/\\]+`' , $ clientFilename ) > 0 ) { throw new \ InvalidArgumentException ( 'Filename contain invalid character "\" or "/" in his name.' ) ; } $ this -> clientFilename = ( empty ( $ clientFilename ) ? null : ( string ) $ clientFilename ) ; r...
Set client filename .
231,649
private function setSize ( $ size = null ) { if ( $ size !== null ) { $ size = ( int ) $ size ; if ( $ size < 0 ) { throw new \ RuntimeException ( 'File size cannot be a negative value ! (size: ' . $ size . ')' ) ; } } $ this -> size = $ size ; return $ this ; }
Set file size
231,650
public function getDefault ( $ key ) { $ schema = $ this -> getModelSchema ( ) ; if ( array_key_exists ( 'default' , $ schema [ $ key ] ) ) return $ schema [ $ key ] [ 'default' ] ; return null ; }
Returns the default value of the field .
231,651
public function getFieldTitle ( $ key ) { $ schema = $ this -> getModelSchema ( ) ; if ( array_key_exists ( 'title' , $ schema [ $ key ] ) ) return $ schema [ $ key ] [ 'title' ] ; return $ key ; }
Returns the field title .
231,652
public function getValidation ( $ field = null ) { $ validation = array ( ) ; $ schema = $ this -> getModelSchema ( ) ; if ( $ field != null ) $ schema = array ( $ field => $ schema [ $ field ] ) ; foreach ( $ schema as $ key => $ value ) { if ( ! isset ( $ value [ 'validation' ] ) ) throw new Exception ( 'Validation m...
Returns the model schema which we ll use for validation
231,653
public function append ( ) { $ args = func_get_args ( ) ; foreach ( $ args as $ arg ) { if ( $ arg instanceof Element ) { if ( $ arg -> _used ) { continue ; } $ arg -> _used = true ; } $ this -> _html [ ] = $ arg ; } }
Append content or other elements .
231,654
protected function outputOpeningTag ( ) { echo '<' , htmlspecialchars ( $ this -> _tag ) ; foreach ( $ this -> _attributes as $ name => $ value ) { echo ' ' , htmlspecialchars ( $ name ) , '="' , htmlspecialchars ( $ value ) , '"' ; } echo '>' ; if ( $ this -> _tag == 'html' || $ this -> _tag == 'head' || $ this -> _ta...
Output opening HTML .
231,655
protected function outputContent ( ) { foreach ( $ this -> _html as $ part ) { if ( $ part instanceof Element ) { $ part -> output ( ) ; } else { echo $ part ; } } }
Output inner HTML .
231,656
protected function outputClosingTag ( ) { echo '</' , htmlspecialchars ( $ this -> _tag ) , '>' ; if ( $ this -> _tag == 'html' || $ this -> _tag == 'head' || $ this -> _tag == 'body' ) { echo "\n" ; } }
Output closing HTML .
231,657
public function validate ( $ value ) { return in_array ( $ value , $ this -> choices ) ? Ok :: unit ( ) : Error :: unit ( [ Error :: INVALID_CHOICE ] ) ; }
Tells if a given value is a valid choice according to the property s definition .
231,658
public function tags ( Tags $ tags = null ) { if ( is_null ( $ tags ) ) { return $ this -> tags ; } $ this -> tags = $ tags ; return $ this ; }
This needs a tag collection .
231,659
protected function getEventPriority ( $ eventName ) { $ suffix = $ this -> getEventSuffix ( $ eventName ) ; if ( $ suffix === static :: UPDATE ) { return 9999 ; } elseif ( $ suffix === static :: INSERT ) { return 9998 ; } elseif ( $ suffix === static :: DELETE ) { return 9997 ; } return parent :: getEventPriority ( $ e...
Returns the event priority .
231,660
public static function getMimeType ( $ filename ) { $ mime_types = static :: getMimeTypes ( ) ; $ extension = pathinfo ( $ filename , PATHINFO_EXTENSION ) ; $ extension = strtolower ( $ extension ) ; if ( array_key_exists ( $ extension , $ mime_types ) ) { return $ mime_types [ $ extension ] ; } elseif ( function_exist...
Get the mime - type of a file
231,661
public function addTaxAmount ( TaxAmount $ taxAmount ) { $ this -> total += $ taxAmount -> getAmount ( ) ; foreach ( $ this -> taxes as $ tax ) { if ( $ tax -> getTax ( ) == $ taxAmount -> getTax ( ) ) { $ tax -> addAmount ( $ taxAmount -> getAmount ( ) ) ; return ; } } $ this -> taxes [ ] = $ taxAmount ; }
Adds a tax amount
231,662
public function bind ( ViewModelInterface $ model ) { $ this -> scoped [ '@file' ] = $ model -> getResource ( ) ; $ this -> scoped [ '@model' ] = $ this -> model = $ model ; $ this -> scoped [ '@context' ] = $ this ; $ this -> renderer -> triggerContextBound ( $ this ) ; }
Bind this express context to the given view model triggering a context - bound event in the process .
231,663
public function get ( $ key ) { if ( array_key_exists ( $ key , $ this -> scoped ) ) { return $ this -> scoped [ $ key ] ; } return $ this -> model -> get ( $ key , NULL ) ; }
Get the value of a scoped variable or fallback to the view model .
231,664
public function set ( $ key , $ value ) { if ( array_key_exists ( $ key , $ this -> scoped ) ) { $ val = $ this -> scoped [ $ key ] ; if ( $ value === NULL ) { unset ( $ this -> scoped [ $ key ] ) ; } else { $ this -> scoped [ $ key ] = $ value ; } return $ val ; } if ( $ value !== NULL ) { $ this -> scoped [ $ key ] =...
Set the given variable in the scope and return the previous value if present setting a value of NULL will remove the value from the context .
231,665
protected function processStatistics ( $ query = null ) { $ this -> skips = 0 ; $ this -> success = 0 ; $ this -> failures = 0 ; $ this -> noops = 0 ; $ reports = $ this -> getReportService ( ) -> getAllForToday ( $ query ) ; foreach ( $ reports as $ report ) { if ( $ report -> getStatus ( ) == Model \ ReportInterface ...
Browse all reports and process all the statistics
231,666
public function curlGETauth ( $ curlUrl ) { if ( ! isset ( $ this -> auth ) ) { $ this -> authenticate ( ) ; } $ results = $ this -> curlGET ( $ curlUrl , true ) ; $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_cURL: curlGETauth' , 1 ) ; return $ results ; }
cURL GET with authentication
231,667
public function curlPOSTauth ( $ curlUrl , $ post ) { if ( ! isset ( $ this -> auth ) ) { $ this -> authenticate ( ) ; } $ results = $ this -> curlPOST ( $ curlUrl , $ post , true ) ; $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_cURL: curlPOSTauth' , 1 ) ; return $ results ; }
cURL POSTs with authentication
231,668
public function curlDELETEauth ( $ curlUrl ) { if ( ! isset ( $ this -> auth ) ) { $ this -> authenticate ( ) ; } $ results = $ this -> curlDELETE ( $ curlUrl , true ) ; $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_cURL: curlDELETEauth' , 1 ) ; return $ results ; }
cURL DELETE with authentication
231,669
private function authenticate ( ) { $ dsDrupalAPIConfig = $ this -> mbConfig -> getProperty ( 'ds_drupal_api_config' ) ; if ( ! empty ( $ dsDrupalAPIConfig [ 'username' ] ) && ! empty ( $ dsDrupalAPIConfig [ 'password' ] ) ) { $ post = [ 'username' => $ dsDrupalAPIConfig [ 'username' ] , 'password' => $ dsDrupalAPIConf...
Authenticate for Drupal API access
231,670
public function buildcURL ( $ settings ) { if ( isset ( $ settings [ 'host' ] ) ) { $ curlUrl = $ settings [ 'host' ] ; $ port = $ settings [ 'port' ] ; if ( $ port > 0 && is_numeric ( $ port ) ) { $ curlUrl .= ':' . ( int ) $ port ; } $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_cURL: buildcURL' , 1 ) ; retu...
buildURL - Common construction utility for URLs of API paths .
231,671
private function isNorthstar ( $ northstarConfig , $ curlUrl ) { if ( empty ( $ northstarConfig [ 'host' ] ) ) { $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_cURL: isNorthstar false' , 1 ) ; return false ; } if ( empty ( $ northstarConfig [ 'id' ] ) ) { $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_c...
Test if the Northstar configuration settings are valid and the cURL is for Northstar .
231,672
public function create ( $ table , Closure $ closure ) { $ blueprint = $ this -> createBlueprint ( $ table , $ closure ) ; $ blueprint -> create ( ) ; }
Creates table from migration .
231,673
public function update ( $ table , Closure $ closure ) { $ blueprint = $ this -> createBlueprint ( $ table , $ closure ) ; $ blueprint -> update ( ) ; }
updates table from migration .
231,674
private function seedAdminUser ( ) { tap ( new User ( $ this -> getAdminUserAttributes ( ) ) , function ( User $ admin ) { $ admin -> save ( ) ; $ adminRole = Role :: admin ( ) -> first ( ) ; $ adminRole -> attachUser ( $ admin ) ; } ) ; }
Seed the admin account .
231,675
private function getAdminUserAttributes ( ) { $ attributes = [ 'username' => 'admin' , 'first_name' => 'Super' , 'last_name' => 'ADMIN' , 'email' => env ( 'ADMIN_EMAIL' , 'admin@example.com' ) , 'password' => env ( 'ADMIN_PASSWORD' , 'password' ) , 'is_admin' => true , 'activated_at' => $ now = now ( ) , ] ; if ( UserC...
Get the admin user s attributes .
231,676
protected function sendThroughPipeline ( array $ middleware , \ Closure $ then ) { if ( count ( $ middleware ) > 0 ) { return ( new Pipeline ( $ this ) ) -> send ( $ this ) -> through ( $ middleware ) -> then ( $ then ) ; } return $ then ( ) ; }
Send the request through the pipeline with the given callback .
231,677
public function get ( $ name , $ type = self :: TYPE_GET , $ default = null ) { return ( isset ( $ this -> vars [ $ type ] ) && isset ( $ this -> vars [ $ type ] [ $ name ] ) ) ? $ this -> vars [ $ type ] [ $ name ] : $ default ; }
This method return request value
231,678
public function xmlRequest ( $ url = '' , $ data = '' , $ timeout = 60 ) { $ this -> debug -> debug ( __FUNCTION__ , '/---------- . __FUNCTION__ . ' <------------\\' ) ; $ inputParams = [ 'url' => $ url , 'data' => $ data , 'timeout' => $ timeout , ] ; $ this -> debug -> info ( __FUNCTION__ , 'input Params: ' , $ input...
Function xmlRequest Send XML Request to Server
231,679
public function decode ( $ assoc = false , $ depth = 512 , $ options = 0 ) { return json_decode ( $ this -> content , $ assoc , $ depth , $ options ) ; }
Decodes the given JSON string
231,680
protected function createBitbucketDriver ( ) { $ config = $ this -> app [ 'config' ] [ 'services.bitbucket' ] ; return new BitbucketProvider ( $ this -> app [ 'request' ] , new BitbucketServer ( $ this -> formatConfig ( $ config ) ) ) ; }
Create an instance of Bitbucket driver .
231,681
public function addFile ( $ file ) { $ baseName = basename ( $ file , '.php' ) ; $ components = explode ( '.' , $ baseName ) ; $ language = $ components [ 1 ] ; $ data = require ( $ file ) ; $ this -> add ( $ data , $ language ) ; }
Add translation file content
231,682
private function add ( $ data , $ language ) { $ parts = explode ( '-' , $ language ) ; foreach ( $ data as $ key => $ translation ) { if ( count ( $ parts ) == 1 ) { $ this -> translations [ $ language ] [ $ key ] = $ translation ; } elseif ( count ( $ parts ) == 2 ) { $ this -> translations [ $ parts [ 0 ] ] [ $ part...
Add translation data for a language
231,683
public static function getParserByKey ( $ key ) { switch ( strtolower ( $ key ) ) { case "twig" : return new TwigTemplateParser ( ) ; default : if ( isset ( self :: $ customParsers [ $ key ] ) ) return self :: $ customParsers [ $ key ] ; else return new MustacheTemplateParser ( ) ; } }
Get a view parser by key .
231,684
public static function start ( ) { if ( is_null ( self :: $ _transaction ) ) { $ object = self :: $ _transaction = new self ( ) ; $ object -> _stored = Config :: getDataAdapter ( ) ; Config :: setDataAdapter ( $ object ) ; $ result = true ; } else { $ result = false ; } return $ result ; }
Start transaction and save current config adapter
231,685
private static function _stop ( ) { $ adapter = self :: $ _transaction -> _stored ; if ( is_null ( $ adapter ) ) { Config :: clearDataAdapter ( ) ; } else { Config :: setDataAdapter ( $ adapter ) ; } }
Restore old data adapter
231,686
public function cmdGetConfig ( ) { $ result = $ this -> getListConfig ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableConfig ( $ result ) ; $ this -> output ( ) ; }
Callback for config - get command
231,687
protected function getListConfig ( ) { $ name = $ this -> getParam ( 0 ) ; if ( isset ( $ name ) ) { $ result = $ this -> config -> get ( $ name ) ; if ( ! isset ( $ result ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ list = array ( $ name => $ result ) ; } else { $ list = $ this -> conf...
Returns an array of configurations
231,688
public function cmdDeleteConfig ( ) { $ id = $ this -> getParam ( 0 ) ; if ( ! isset ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } if ( ! $ this -> config -> reset ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> output ( ) ; }
Callback for config - delete command
231,689
public function cmdSetConfig ( ) { $ key = $ this -> getParam ( 0 ) ; $ value = $ this -> getParam ( 1 ) ; if ( ! isset ( $ key ) || ! isset ( $ value ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! $ this -> config -> set ( $ key , $ value ) ) { $ this -> errorAndExit ( $ this -> text ...
Callback for config - set command
231,690
protected function doExecute ( \ Closure $ cb ) { try { return $ cb ( $ this -> manager , $ this -> collection ) ; } catch ( \ Exception $ e ) { throw Exception \ Translator \ MongoDb :: translate ( $ e ) ; } }
Executes something in the context of the collection .
231,691
public function insertLog ( $ idObject = "" , $ objJson = "" , $ idFunzione = "" , $ dettagli = "" ) { $ intranetLogApp = new IntranetLogApp ( ) ; $ intranetLogApp -> setDettagli ( $ dettagli ) ; if ( ! empty ( $ idFunzione ) ) { $ repository = $ this -> em -> getRepository ( 'retItaliaAuthenticationBundle:SaFunzione' ...
Questa funzione inserisce una nuova occorrenza nel file di log
231,692
public function initC2Ms ( $ overrideExisting = true ) { if ( null !== $ this -> collC2Ms && ! $ overrideExisting ) { return ; } $ collectionClassName = C2MTableMap :: getTableMap ( ) -> getCollectionClassName ( ) ; $ this -> collC2Ms = new $ collectionClassName ; $ this -> collC2Ms -> setModel ( '\Attogram\SharedMedia...
Initializes the collC2Ms collection .
231,693
public function countC2Ms ( Criteria $ criteria = null , $ distinct = false , ConnectionInterface $ con = null ) { $ partial = $ this -> collC2MsPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collC2Ms || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collC2Ms ) { return ...
Returns the number of related C2M objects .
231,694
public function addC2M ( ChildC2M $ l ) { if ( $ this -> collC2Ms === null ) { $ this -> initC2Ms ( ) ; $ this -> collC2MsPartial = true ; } if ( ! $ this -> collC2Ms -> contains ( $ l ) ) { $ this -> doAddC2M ( $ l ) ; if ( $ this -> c2MsScheduledForDeletion and $ this -> c2MsScheduledForDeletion -> contains ( $ l ) )...
Method called to associate a ChildC2M object to this object through the ChildC2M foreign key attribute .
231,695
public function getC2MsJoinMedia ( Criteria $ criteria = null , ConnectionInterface $ con = null , $ joinBehavior = Criteria :: LEFT_JOIN ) { $ query = ChildC2MQuery :: create ( null , $ criteria ) ; $ query -> joinWith ( 'Media' , $ joinBehavior ) ; return $ this -> getC2Ms ( $ query , $ con ) ; }
If this collection has already been initialized with an identical criteria it returns the collection . Otherwise if this Category is new it will return an empty collection ; or if this Category has previously been saved it will retrieve related C2Ms from storage .
231,696
public function countC2Ps ( Criteria $ criteria = null , $ distinct = false , ConnectionInterface $ con = null ) { $ partial = $ this -> collC2PsPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collC2Ps || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collC2Ps ) { return ...
Returns the number of related C2P objects .
231,697
public function getC2PsJoinPage ( Criteria $ criteria = null , ConnectionInterface $ con = null , $ joinBehavior = Criteria :: LEFT_JOIN ) { $ query = ChildC2PQuery :: create ( null , $ criteria ) ; $ query -> joinWith ( 'Page' , $ joinBehavior ) ; return $ this -> getC2Ps ( $ query , $ con ) ; }
If this collection has already been initialized with an identical criteria it returns the collection . Otherwise if this Category is new it will return an empty collection ; or if this Category has previously been saved it will retrieve related C2Ps from storage .
231,698
public function makeRoot ( ) { if ( $ this -> getLeftValue ( ) || $ this -> getRightValue ( ) ) { throw new PropelException ( 'Cannot turn an existing node into a root node.' ) ; } $ this -> setLeftValue ( 1 ) ; $ this -> setRightValue ( 2 ) ; $ this -> setLevel ( 0 ) ; return $ this ; }
Creates the supplied node as the root node .
231,699
public function isDescendantOf ( ChildCategory $ parent ) { return $ this -> isInTree ( ) && $ this -> getLeftValue ( ) > $ parent -> getLeftValue ( ) && $ this -> getRightValue ( ) < $ parent -> getRightValue ( ) ; }
Tests if node is a descendant of another node