idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
59,600 | public function inCollection ( $ varValue , $ blnReturnKey = false ) { $ varReturn = false ; foreach ( $ this -> collection as $ object ) { if ( $ object == $ varValue || $ varValue === get_class ( $ object ) ) { $ varReturn = ( $ blnReturnKey ) ? $ this -> key ( ) : true ; break ; } } self :: rewind ( ) ; return $ var... | Check if an object is in the collection |
59,601 | public function remove ( $ objElement ) { $ varKey = $ this -> inCollection ( $ objElement , true ) ; if ( $ varKey !== false ) { unset ( $ this -> collection [ $ varKey ] ) ; } $ this -> rebuild ( ) ; return true ; } | Remove an element from the collection |
59,602 | public function toHtmlInternal ( $ value = null ) { $ strSelected = "" ; if ( $ this -> __selected && is_null ( $ value ) ) { $ strSelected = " selected=\"selected\"" ; } if ( $ value == $ this -> __value ) { $ strSelected = " selected=\"selected\"" ; } $ strOutput = "<option value=\"{$this->__value}\"{$strSelected} {$... | Generate HTMl output |
59,603 | public function __toHtml ( ) { return $ this -> toHtml ( $ submitted = false , $ blnSimpleLayout = false , $ blnLabel = true , $ blnDisplayError = true ) ; } | Render paragraph s HTML |
59,604 | public function toHtml ( $ submitted = false , $ blnSimpleLayout = false , $ blnLabel = true , $ blnDisplayError = true ) { $ this -> setConditionalMeta ( ) ; $ this -> setMeta ( "class" , "vf__paragraph" ) ; $ strOutput = "<div{$this->__getMetaString()}>\n" ; if ( ! empty ( $ this -> __header ) ) { $ strOutput .= "<h3... | Render paragraph HTML |
59,605 | public function getValidValue ( $ intDynamicPosition = 0 ) { $ varReturn = null ; if ( isset ( $ this -> __validvalues [ $ intDynamicPosition ] ) ) { $ varReturn = $ this -> __validvalues [ $ intDynamicPosition ] ; } return $ varReturn ; } | Get the validated value |
59,606 | private function __hasError ( $ intDynamicPosition = 0 ) { return ( isset ( $ this -> __errors [ $ intDynamicPosition ] ) && ! empty ( $ this -> __errors [ $ intDynamicPosition ] ) ) ; } | Check if an error has occured |
59,607 | public static function checkCORS ( ) { Logger :: log ( 'Checking CORS' ) ; $ corsEnabled = Config :: getParam ( 'cors.enabled' ) ; $ request = Request :: getInstance ( ) ; if ( NULL !== $ corsEnabled ) { if ( $ corsEnabled === '*' || preg_match ( $ corsEnabled , $ request -> getServer ( 'HTTP_REFERER' ) ) ) { if ( ! he... | Check CROS requests |
59,608 | protected function dumpException ( \ Exception $ e ) { Logger :: log ( 'Starting dump exception' ) ; $ ex = ( NULL !== $ e -> getPrevious ( ) ) ? $ e -> getPrevious ( ) : $ e ; $ error = array ( "error" => $ ex -> getMessage ( ) , "file" => $ ex -> getFile ( ) , "line" => $ ex -> getLine ( ) , ) ; Logger :: log ( 'Thro... | Method that convert an exception to html |
59,609 | public function contains ( Address $ address ) { $ addressValue = $ address -> get ( ) ; return $ addressValue >= $ this -> firstAddress -> get ( ) && $ addressValue <= $ this -> lastAddress -> get ( ) ; } | Determine if a given address is contained within the range . |
59,610 | public function logs ( ) { $ log = t ( "Selecciona un fichero de log" ) ; $ logs = $ this -> srv -> getLogFiles ( ) ; asort ( $ logs ) ; return $ this -> render ( "logs.html.twig" , array ( "logs" => $ logs , "log" => $ log , ) ) ; } | Servicio que muestra los logs del sistema |
59,611 | public function setDefaults ( $ arrDefaults = array ( ) ) { if ( is_array ( $ arrDefaults ) ) { $ this -> __defaults = $ arrDefaults ; } else { throw new \ InvalidArgumentException ( "Invalid argument passed in to ValidForm->setDefaults(). Expected array got " . gettype ( $ arrDefaults ) , E_ERROR ) ; } } | Use an array to set default values on all the forms children . The array s keys should be the form name to set the default value of the value is the actual value or values to set . |
59,612 | public function addHtml ( $ html , $ meta = array ( ) ) { $ objString = new StaticText ( $ html , $ meta ) ; $ this -> __elements -> addObject ( $ objString ) ; return $ objString ; } | Injects a string in the form . |
59,613 | public function addFieldset ( $ header = null , $ noteHeader = null , $ noteBody = null , $ meta = array ( ) ) { $ objFieldSet = new Fieldset ( $ header , $ noteHeader , $ noteBody , $ meta ) ; $ this -> __elements -> addObject ( $ objFieldSet ) ; return $ objFieldSet ; } | Add a fieldset to the form field collection |
59,614 | public function addHiddenField ( $ name , $ type , $ meta = array ( ) , $ blnJustRender = false ) { $ objField = new Hidden ( $ name , $ type , $ meta ) ; if ( ! $ blnJustRender ) { $ objFieldset = $ this -> __elements -> getLast ( "ValidFormBuilder\\Fieldset" ) ; if ( $ this -> __elements -> count ( ) == 0 || ! is_obj... | Add a hidden input field to the form collection . |
59,615 | public static function renderField ( $ name , $ label , $ type , $ validationRules , $ errorHandlers , $ meta ) { $ objField = null ; switch ( $ type ) { case static :: VFORM_STRING : case static :: VFORM_WORD : case static :: VFORM_EMAIL : case static :: VFORM_URL : case static :: VFORM_SIMPLEURL : case static :: VFOR... | Use this utility method to only render \ ValidFormBuilder \ Element instances of the defined types . |
59,616 | public function addField ( $ name , $ label , $ type , $ validationRules = array ( ) , $ errorHandlers = array ( ) , $ meta = array ( ) , $ blnJustRender = false ) { $ objField = static :: renderField ( $ name , $ label , $ type , $ validationRules , $ errorHandlers , $ meta ) ; $ objField -> setRequiredStyle ( $ this ... | Add a new element to the internal elements collection |
59,617 | public function addParagraph ( $ strBody , $ strHeader = "" , $ meta = array ( ) ) { $ objParagraph = new Paragraph ( $ strHeader , $ strBody , $ meta ) ; $ objFieldset = $ this -> __elements -> getLast ( "ValidFormBuilder\\Fieldset" ) ; if ( $ this -> __elements -> count ( ) == 0 || ! is_object ( $ objFieldset ) ) { $... | Adds a \ ValidFormBuilder \ Paragraph object to the internal elements collection . |
59,618 | public function addArea ( $ label = null , $ active = false , $ name = null , $ checked = false , $ meta = array ( ) ) { $ objArea = new Area ( $ label , $ active , $ name , $ checked , $ meta ) ; $ objArea -> setRequiredStyle ( $ this -> __requiredstyle ) ; $ objFieldset = $ this -> __elements -> getLast ( "ValidFormB... | Add an area to the internal elements collection . |
59,619 | public function addMultiField ( $ label = null , $ meta = array ( ) ) { $ strName = ( isset ( $ meta [ "name" ] ) ) ? $ meta [ "name" ] : null ; $ objField = new MultiField ( $ label , $ meta , $ strName ) ; $ objField -> setRequiredStyle ( $ this -> __requiredstyle ) ; $ objFieldset = $ this -> __elements -> getLast (... | Create a Multifield element |
59,620 | public function toHtml ( $ blnClientSide = true , $ blnForceSubmitted = null , $ strCustomJs = "" ) { $ strOutput = "" ; if ( $ blnClientSide ) { $ strOutput .= $ this -> __toJS ( $ strCustomJs ) ; } $ strClass = "validform" ; if ( is_array ( $ this -> __meta ) ) { if ( isset ( $ this -> __meta [ "class" ] ) ) { $ strC... | Generate HTML output - build form |
59,621 | public function fieldsToHtml ( $ blnForceSubmitted = false , & $ blnNavigation = false ) { $ strReturn = "" ; if ( is_array ( $ this -> __defaults ) && count ( $ this -> __defaults ) > 0 ) { $ objFields = $ this -> getCachedFields ( ) ; foreach ( $ objFields as $ objField ) { $ strName = $ objField -> getName ( true ) ... | This method generates HTML output for the current internal elements collection . |
59,622 | public function elementsToJs ( $ blnRawJs = false ) { $ strReturn = "" ; $ strJs = "" ; foreach ( $ this -> __elements as $ element ) { $ strJs .= $ element -> toJS ( ) ; } $ strJs = str_replace ( "\n" , "\n\t" , $ strJs ) ; if ( ! $ blnRawJs ) { $ strReturn .= "<script type=\"text/javascript\">\n" ; $ strReturn .= "//... | Generate the Javascript output only for the fields and conditions . |
59,623 | public function serialize ( $ blnSubmittedValues = true ) { $ this -> valuesAsHtml ( $ blnSubmittedValues ) ; return base64_encode ( gzcompress ( serialize ( $ this ) ) ) ; } | Serialize compress and encode the entire form including it s values |
59,624 | public function getFields ( ) { $ objFields = new Collection ( ) ; foreach ( $ this -> __elements as $ objFieldset ) { if ( $ objFieldset -> hasFields ( ) ) { foreach ( $ objFieldset -> getFields ( ) as $ objField ) { if ( is_object ( $ objField ) ) { if ( $ objField -> hasFields ( ) ) { if ( get_class ( $ objField ) =... | Get a flat Collection of all internal elements . |
59,625 | public function getValidField ( $ id ) { $ objReturn = null ; $ objFields = $ this -> getFields ( ) ; foreach ( $ objFields as $ objField ) { if ( $ objField -> getId ( ) == $ id ) { $ objReturn = $ objField ; break ; } } if ( is_null ( $ objReturn ) ) { foreach ( $ objFields as $ objField ) { if ( $ objField -> getNam... | Get a valid field object . |
59,626 | public function valuesAsHtml ( $ hideEmpty = false , $ collection = null ) { $ strTable = "\t<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"validform\">\n" ; $ strTableOutput = "" ; $ collection = ( ! is_null ( $ collection ) ) ? $ collection : $ this -> __elements ; foreach ( $ collection as $ objFiel... | A utility method to parse an overview of the submitted values . |
59,627 | public function fieldsetAsHtml ( $ objFieldset , & $ strSet , $ hideEmpty = false ) { $ strTableOutput = "" ; if ( ! $ this -> elementShouldDisplay ( $ objFieldset ) ) { return $ strTableOutput ; } foreach ( $ objFieldset -> getFields ( ) as $ objField ) { if ( is_object ( $ objField ) && get_class ( $ objField ) !== "... | Generates HTML output for all fieldsets and their children elements . |
59,628 | protected function areaAsHtml ( $ objField , $ hideEmpty = false , $ intDynamicCount = 0 ) { $ strReturn = "" ; $ strSet = "" ; $ blnShouldDisplay = $ this -> elementShouldDisplay ( $ objField ) ; if ( $ objField -> hasContent ( $ intDynamicCount ) && $ blnShouldDisplay ) { foreach ( $ objField -> getFields ( ) as $ ob... | Generates HTML output for the given area object and its child elements |
59,629 | protected function multiFieldAsHtml ( $ objField , $ hideEmpty = false , $ intDynamicCount = 0 ) { $ strReturn = "" ; if ( ! $ this -> elementShouldDisplay ( $ objField ) ) { return $ strReturn ; } if ( $ objField -> hasContent ( $ intDynamicCount ) ) { if ( $ objField -> hasFields ( ) ) { $ strValue = "" ; $ objSubFie... | Generates HTML output for the given MultiField object and its child elements |
59,630 | protected function fieldAsHtml ( $ objField , $ hideEmpty = false , $ intDynamicCount = 0 ) { $ strReturn = "" ; $ strLabel = $ objField -> getShortLabel ( ) ; $ varValue = ( $ intDynamicCount > 0 ) ? $ objField -> getValue ( $ intDynamicCount ) : $ objField -> getValue ( ) ; $ strValue = ( is_array ( $ varValue ) ) ? ... | Generates HTML output for the given field object and its child elements |
59,631 | public function generateId ( $ intLength = 8 ) { $ strChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ; $ strReturn = '' ; srand ( ( double ) microtime ( ) * 1000000 ) ; for ( $ i = 1 ; $ i <= $ intLength ; $ i ++ ) { $ intNum = rand ( ) % ( strlen ( $ strChars ) - 1 ) ; $ strTmp = substr ( $ s... | Generate a unique ID |
59,632 | public static function getHttpBodyValue ( $ param , $ varReplaceNotSet = null ) { parse_str ( file_get_contents ( 'php://input' ) , $ arrPostVars ) ; $ strReturn = ( isset ( $ arrPostVars [ $ param ] ) ) ? $ arrPostVars [ $ param ] : $ varReplaceNotSet ; return $ strReturn ; } | Get the value of a form field from the raw HTTP body . This is used for PUT and DELETE HTTP methods . |
59,633 | protected function __toJS ( $ strCustomJs = "" , $ arrInitArguments = array ( ) , $ blnRawJs = false ) { $ strReturn = "" ; $ strJs = "" ; foreach ( $ this -> __elements as $ element ) { $ strJs .= $ element -> toJS ( ) ; } foreach ( $ this -> __jsevents as $ event => $ method ) { $ strJs .= "\tobjForm.addEvent(\"{$eve... | Generate javascript initialization code . |
59,634 | protected function elementShouldDisplay ( Base $ objElement ) { $ blnReturn = true ; $ objCondition = $ objElement -> getConditionRecursive ( "visible" ) ; if ( is_object ( $ objCondition ) ) { if ( $ objCondition -> isMet ( 0 ) ) { $ blnReturn = $ objCondition -> getValue ( ) ; } else { $ blnReturn = ! $ objCondition ... | Check if an element should be visible according to an optionally attached visible condition . |
59,635 | private function __validate ( ) { $ blnReturn = true ; foreach ( $ this -> __elements as $ element ) { if ( ! $ element -> isValid ( ) ) { $ blnReturn = false ; break ; } } return $ blnReturn ; } | Loops trough all internal elements in the collection and validates each element . |
59,636 | public static function getStrippedClassName ( $ classname ) { $ pos = strrpos ( $ classname , '\\' ) ; if ( $ pos ) { return substr ( $ classname , $ pos + 1 ) ; } return $ classname ; } | Returns the class name and strips off the namespace . |
59,637 | private static function splitFriendlyEmail ( $ email ) { if ( false !== strpos ( $ email , '<' ) ) { return array_map ( 'trim' , explode ( ' <' , str_replace ( '>' , '' , $ email ) ) ) ; } elseif ( false !== strpos ( $ email , '[' ) ) { return array_map ( 'trim' , explode ( ' [' , str_replace ( ']' , '' , $ email ) ) )... | Split a friendly - name e - address and return name and e - mail as array |
59,638 | public function regenerateUrls ( ) { $ router = Router :: getInstance ( ) ; try { $ router -> hydrateRouting ( ) ; $ router -> simpatize ( ) ; Security :: getInstance ( ) -> setFlash ( "callback_message" , t ( "Rutas generadas correctamente" ) ) ; Security :: getInstance ( ) -> setFlash ( "callback_route" , $ this -> g... | Service to regenerate routes |
59,639 | private function updateData ( $ callback = null ) : void { $ queryBuilder = $ this -> dbUtils -> getConn ( ) -> createQueryBuilder ( ) ; if ( $ this -> limit === 0 ) { $ this -> setLimit ( $ this -> dbUtils -> countResults ( $ this -> entity ) ) ; } $ this -> expression -> evaluateExpressions ( $ this -> configEntities... | Update data of db table . |
59,640 | private function insertData ( $ callback = null ) : void { $ this -> expression -> evaluateExpressions ( $ this -> configEntities [ $ this -> entity ] [ 'pre_actions' ] ) ; for ( $ rowNum = 1 ; $ rowNum <= $ this -> limit ; $ rowNum ++ ) { $ this -> { $ this -> insertMode [ $ this -> mode ] } ( $ rowNum ) ; if ( ! is_n... | Insert data into table |
59,641 | private function doInsertByQueries ( ) : void { $ data = $ this -> generateFakeData ( ) ; $ queryBuilder = $ this -> dbUtils -> getConn ( ) -> createQueryBuilder ( ) ; $ queryBuilder = $ queryBuilder -> insert ( $ this -> entity ) ; foreach ( $ data as $ field => $ value ) { $ queryBuilder = $ queryBuilder -> setValue ... | Execute an INSERT with Doctrine QueryBuilder |
59,642 | public function toHtml ( $ submitted = false , $ blnSimpleLayout = false , $ blnLabel = true , $ blnDisplayErrors = true ) { if ( ! empty ( $ this -> __disabled ) ) { $ this -> setFieldMeta ( "disabled" , "disabled" ) ; } $ strReturn = "<input type=\"{$this->__type}\" value=\"{$this->__label}\"{$this->__getFieldMetaStr... | Generate the HTML output for this button |
59,643 | public function check ( $ intDynamicPosition = 0 ) { $ blnReturn = false ; if ( $ this -> __subject instanceof Element ) { $ strValue = $ this -> __subject -> __getValue ( true , $ intDynamicPosition ) ; $ strValue = ( is_null ( $ strValue ) ) ? $ strValue = $ this -> __subject -> getValue ( $ intDynamicPosition ) : $ ... | Check this comparison |
59,644 | public function jsonSerialize ( $ intDynamicPosition = null ) { if ( get_class ( $ this -> __subject ) == "ValidFormBuilder\\GroupField" ) { $ identifier = $ this -> __subject -> getId ( ) ; } else { $ identifier = $ this -> __subject -> getName ( ) ; if ( $ intDynamicPosition > 0 ) { $ identifier = $ identifier . "_" ... | Convert the Comparion s contents to a json string in order to validate this comparison client - side |
59,645 | private function __verify ( $ strValue ) { $ blnReturn = false ; $ strLowerValue = strtolower ( $ strValue ) ; $ strCompareAgainst = ( is_string ( $ this -> __value ) ) ? strtolower ( $ this -> __value ) : null ; switch ( $ this -> __comparison ) { case ValidForm :: VFORM_COMPARISON_EQUAL : $ blnReturn = ( $ strLowerVa... | Verify this comparison against the actual value |
59,646 | public static function clearDocumentRoot ( ) { $ rootDirs = array ( "css" , "js" , "media" , "font" ) ; foreach ( $ rootDirs as $ dir ) { if ( file_exists ( WEB_DIR . DIRECTORY_SEPARATOR . $ dir ) ) { try { self :: deleteDir ( WEB_DIR . DIRECTORY_SEPARATOR . $ dir ) ; } catch ( \ Exception $ e ) { Logger :: log ( $ e -... | Method that remove all data in the document root path |
59,647 | public static function createDir ( $ dir ) { try { if ( ! is_dir ( $ dir ) && @ mkdir ( $ dir , 0775 , true ) === false ) { throw new \ Exception ( t ( 'Can\'t create directory ' ) . $ dir ) ; } } catch ( \ Exception $ e ) { Logger :: log ( $ e -> getMessage ( ) , LOG_WARNING ) ; if ( ! file_exists ( dirname ( $ dir ) ... | Method that creates any parametrized path |
59,648 | public static function getTemplatePath ( ) { $ path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR ; return realpath ( $ path ) ; } | Method that returns the templates path |
59,649 | private function convertToBytes ( $ strSize ) { switch ( strtolower ( substr ( $ strSize , - 1 ) ) ) { case 'm' : return ( int ) $ strSize * 1048576 ; case 'k' : return ( int ) $ strSize * 1024 ; case 'g' : return ( int ) $ strSize * 1073741824 ; default : return $ strSize ; } } | Convert file size to bytes |
59,650 | public function registerCustomTypes ( ) : void { if ( \ Doctrine \ DBAL \ Types \ Type :: hasType ( 'neuralyzer_enum' ) ) { return ; } \ Doctrine \ DBAL \ Types \ Type :: addType ( 'neuralyzer_enum' , 'Edyan\Neuralyzer\Doctrine\Type\Enum' ) ; $ platform = $ this -> conn -> getDatabasePlatform ( ) ; $ platform -> regist... | Add a custom enum type |
59,651 | public function isSubmitted ( $ blnForce = false ) { $ blnReturn = false ; if ( ValidForm :: get ( "vf__dispatch" ) == $ this -> __name ) { $ strUniqueId = ValidWizard :: get ( "vf__uniqueid" ) ; if ( ! empty ( $ strUniqueId ) ) { $ this -> __setUniqueId ( $ strUniqueId ) ; } $ blnReturn = true ; } elseif ( $ blnForce ... | Check if the wizard is submitted |
59,652 | public function getPage ( $ intPage = 1 ) { $ intPage -- ; if ( $ intPage < 0 ) { $ intPage = 0 ; } $ this -> __elements -> seek ( $ intPage ) ; $ objReturn = $ this -> __elements -> current ( ) ; if ( $ objReturn === false || get_class ( $ objReturn ) !== "ValidFormBuilder\\Page" ) { $ objReturn = null ; } return $ ob... | Get a page from the collection based on it s zero - based position in the elements collection |
59,653 | public function addPage ( $ id = "" , $ header = "" , $ meta = array ( ) ) { $ objPage = new Page ( $ id , $ header , $ meta ) ; $ this -> __elements -> addObject ( $ objPage ) ; if ( $ this -> __elements -> count ( ) == 1 ) { $ this -> addHiddenField ( "vf__uniqueid" , ValidForm :: VFORM_STRING , array ( "default" => ... | Add a page to the wizard |
59,654 | public function addFieldset ( $ header = null , $ noteHeader = null , $ noteBody = null , $ meta = array ( ) ) { $ objFieldSet = new Fieldset ( $ header , $ noteHeader , $ noteBody , $ meta ) ; $ objPage = $ this -> __elements -> getLast ( "ValidFormBuilder\\Page" ) ; if ( ! is_object ( $ objPage ) ) { $ objPage = $ th... | Add a fieldset |
59,655 | public function valuesAsHtml ( $ hideEmpty = false , $ collection = null ) { $ strTable = "\t<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"validform\">\n" ; $ strTableOutput = "" ; $ collection = ( ! is_null ( $ collection ) ) ? $ collection : $ this -> __elements ; foreach ( $ collection as $ objPage... | Generate valuesAsHtml overview |
59,656 | public static function unserialize ( $ strSerialized , $ strUniqueId = "" ) { $ objReturn = parent :: unserialize ( $ strSerialized ) ; if ( get_class ( $ objReturn ) == "ValidFormBuilder\\ValidWizard" && ! empty ( $ strUniqueId ) ) { $ objReturn -> __setUniqueId ( $ strUniqueId ) ; } return $ objReturn ; } | Unserialize a previously serialized ValidWizard object |
59,657 | protected function __toJs ( $ strCustomJs = "" , $ arrInitArguments = array ( ) , $ blnRawJs = false ) { if ( $ this -> __currentpage > 1 ) { $ arrInitArguments [ "initialPage" ] = $ this -> __currentpage ; } $ arrInitArguments [ "confirmPage" ] = $ this -> __hasconfirmpage ; $ strJs = "" ; $ strJs .= "objForm.setLabel... | Generate Javascript code |
59,658 | public function getFields ( $ blnIncludeMultiFields = false ) { $ objFields = new Collection ( ) ; foreach ( $ this -> __elements as $ objPage ) { if ( $ objPage -> hasFields ( ) ) { foreach ( $ objPage -> getFields ( ) as $ objFieldset ) { if ( $ objFieldset -> hasFields ( ) ) { foreach ( $ objFieldset -> getFields ( ... | getFields creates a flat collection of all form fields . |
59,659 | protected function hasQueryBuilderMethod ( string $ name ) : bool { if ( method_exists ( $ this -> queryBuilder , $ name ) ) { return true ; } if ( method_exists ( $ this -> queryBuilder , 'hasMacro' ) && $ this -> queryBuilder -> hasMacro ( $ name ) ) { return true ; } return false ; } | Does the QueryBuilder we re using have a method with the provided name? This will also check any functionality added via a macro . |
59,660 | public static function register ( ) { $ postType = static :: getPostType ( ) ; $ config = static :: getPostTypeConfig ( ) ; if ( empty ( $ postType ) || $ postType === 'post' ) { throw new PostTypeRegistrationException ( 'Post type not set' ) ; } if ( empty ( $ config ) ) { throw new PostTypeRegistrationException ( 'Co... | Register this PostType with WordPress |
59,661 | public static function all ( $ perPage = - 1 , $ orderby = 'menu_order' , $ order = 'ASC' ) { $ order = strtoupper ( $ order ) ; $ args = [ 'posts_per_page' => $ perPage , 'orderby' => $ orderby , 'order' => $ order , ] ; return static :: query ( $ args ) ; } | Get all posts of this type |
59,662 | public static function query ( $ args = null ) { $ args = is_array ( $ args ) ? $ args : [ ] ; $ args = array_merge ( $ args , [ 'post_type' => static :: getPostType ( ) ] ) ; if ( ! isset ( $ args [ 'post_status' ] ) ) { $ args [ 'post_status' ] = 'publish' ; } return static :: posts ( $ args ) ; } | Convenience function that takes a standard set of WP_Query arguments but mixes it with arguments that mean we re selecting the right post type |
59,663 | private function run ( TaskExecutionInterface $ execution ) { $ start = microtime ( true ) ; $ execution -> setStartTime ( new \ DateTime ( ) ) ; $ execution -> setStatus ( TaskStatus :: RUNNING ) ; $ this -> taskExecutionRepository -> save ( $ execution ) ; try { $ execution = $ this -> hasPassed ( $ execution , $ thi... | Run execution with given handler . |
59,664 | private function handle ( TaskExecutionInterface $ execution ) { $ this -> eventDispatcher -> dispatch ( Events :: TASK_BEFORE , new TaskExecutionEvent ( $ execution -> getTask ( ) , $ execution ) ) ; try { return $ this -> executor -> execute ( $ execution ) ; } catch ( RetryException $ exception ) { $ execution = $ t... | Handle given execution and fire before and after events . |
59,665 | private function hasPassed ( TaskExecutionInterface $ execution , $ result ) { $ execution = $ this -> taskExecutionRepository -> findByUuid ( $ execution -> getUuid ( ) ) ; $ execution -> setStatus ( TaskStatus :: COMPLETED ) ; $ execution -> setResult ( $ result ) ; $ this -> eventDispatcher -> dispatch ( Events :: T... | The given task passed the run . |
59,666 | private function hasFailed ( TaskExecutionInterface $ execution , \ Exception $ exception ) { $ execution = $ this -> taskExecutionRepository -> findByUuid ( $ execution -> getUuid ( ) ) ; $ execution -> setException ( $ exception -> __toString ( ) ) ; $ execution -> setStatus ( TaskStatus :: FAILED ) ; $ this -> event... | The given task failed the run . |
59,667 | private function finalize ( TaskExecutionInterface $ execution , $ start ) { $ execution = $ this -> taskExecutionRepository -> findByUuid ( $ execution -> getUuid ( ) ) ; if ( $ execution -> getStatus ( ) !== TaskStatus :: PLANNED ) { $ execution -> setEndTime ( new \ DateTime ( ) ) ; $ execution -> setDuration ( micr... | Finalizes given execution . |
59,668 | public function cacheMetrics ( $ num = 1000 , $ page = 1 ) { if ( $ this -> cached != null ) { return $ this -> cached ; } $ this -> cached = $ this -> client -> call ( 'GET' , 'metrics' , [ 'query' => [ 'per_page' => $ num , 'current_page' => $ page , ] , ] ) ; return $ this -> cached ; } | Cache Metrics for performance improvement . |
59,669 | public function indexMetrics ( $ num = 1000 , $ page = 1 ) { if ( $ this -> cache != false ) { return $ this -> cacheMetrics ( $ num , $ page ) ; } return $ this -> client -> call ( 'GET' , 'metrics' , [ 'query' => [ 'per_page' => $ num , 'current_page' => $ page , ] , ] ) ; } | Get a defined number of Metrics . |
59,670 | public function searchMetrics ( $ search , $ by , $ limit = 1 , $ num = 1000 , $ page = 1 ) { $ metrics = $ this -> indexMetrics ( $ num , $ page ) [ 'data' ] ; $ filtered = array_filter ( $ metrics , function ( $ metric ) use ( $ search , $ by ) { if ( array_key_exists ( $ by , $ metric ) ) { if ( strpos ( $ metric [ ... | Search if a defined number of Metrics exists . |
59,671 | private function loadFullDictionary ( ) : void { $ file = __DIR__ . '/../Dictionary/' . $ this -> language ; if ( ! file_exists ( $ file ) ) { $ file = __DIR__ . '/../Dictionary/en_US' ; } self :: $ dictionary = array_filter ( explode ( PHP_EOL , file_get_contents ( $ file ) ) ) ; } | Load the current language dictionary with a lot of words to always be able to get a unique value . |
59,672 | public function __toArray ( ) { $ dto = array ( ) ; try { $ reflectionClass = new \ ReflectionClass ( $ this ) ; $ properties = $ reflectionClass -> getProperties ( \ ReflectionProperty :: IS_PUBLIC ) ; if ( count ( $ properties ) > 0 ) { foreach ( $ properties as $ property ) { $ value = $ property -> getValue ( $ thi... | Convert dto to array representation |
59,673 | public function fromArray ( array $ object = array ( ) ) { if ( count ( $ object ) > 0 ) { $ reflector = new \ ReflectionClass ( $ this ) ; $ properties = InjectorHelper :: extractProperties ( $ reflector , \ ReflectionProperty :: IS_PUBLIC , InjectorHelper :: VAR_PATTERN ) ; unset ( $ reflector ) ; foreach ( $ object ... | Hydrate object from array |
59,674 | public static function addModelField ( TableMap $ tableMap , ModelCriteria & $ query , $ field , $ value = null ) { if ( $ column = self :: checkFieldExists ( $ tableMap , $ field ) ) { self :: addQueryFilter ( $ column , $ query , $ value ) ; } } | Method that adds the fields for the model into the API Query |
59,675 | public function createInstance ( $ sid , $ token , $ version = null , $ retryAttempts = 1 ) { return new \ Services_Twilio ( $ sid , $ token , $ version , null , $ retryAttempts ) ; } | Returns a new \ Services_Twilio instance from the given parameters |
59,676 | public static function checkFieldExists ( TableMap $ tableMap , $ field ) { $ column = null ; try { foreach ( $ tableMap -> getColumns ( ) as $ tableMapColumn ) { $ columnName = $ tableMapColumn -> getPhpName ( ) ; if ( preg_match ( '/^' . $ field . '$/i' , $ columnName ) ) { $ column = $ tableMapColumn ; break ; } } }... | Check if parametrized field exists in api model |
59,677 | public function postLogin ( $ route = null ) { $ form = new LoginForm ( ) ; $ form -> setData ( array ( "route" => $ route ) ) ; $ form -> build ( ) ; $ tpl = Template :: getInstance ( ) ; $ tpl -> setPublicZone ( true ) ; $ template = "login.html.twig" ; $ params = array ( 'form' => $ form , ) ; $ cookies = array ( ) ... | Servicio que valida el login |
59,678 | public function addField ( $ objField ) { if ( get_class ( $ objField ) == "ValidFormBuilder\\Fieldset" ) { $ objField -> setMeta ( "parent" , $ this , true ) ; $ this -> __elements -> addObject ( $ objField ) ; } else { if ( $ this -> __elements -> count ( ) == 0 ) { $ objFieldset = new Fieldset ( ) ; $ this -> __elem... | Add a field object |
59,679 | public function getValue ( $ intDynamicPosition = 0 ) { $ varValue = parent :: getValue ( $ intDynamicPosition ) ; return ( strlen ( $ varValue ) > 0 && $ varValue !== 0 ) ? true : false ; } | Get checkbox value |
59,680 | public static function checkRestrictedAccess ( $ route ) { Logger :: log ( 'Checking admin zone' ) ; if ( ! Config :: getInstance ( ) -> checkTryToSaveConfig ( ) && ( preg_match ( '/^\/(admin|setup\-admin)/i' , $ route ) || Config :: getParam ( 'restricted' , false ) ) ) { if ( ! self :: isTest ( ) && null === Cache ::... | Method that checks the access to the restricted zone |
59,681 | public static function calculateNetworkAddress ( Address $ address , SubnetMask $ subnetMask ) { return new Address ( $ address -> get ( ) & $ subnetMask -> get ( ) ) ; } | Calculate the network address of a Block given an IPV4 network address and SubnetMask . |
59,682 | public static function calculateBroadcastAddress ( Address $ address , SubnetMask $ subnetMask ) { return new Address ( $ address -> get ( ) | ~ $ subnetMask -> get ( ) ) ; } | Calculate the broadcast address of a Block given an IPV4 network address and SubnetMask . |
59,683 | public function addField ( $ field ) { if ( ! $ field instanceof Base ) { throw new \ InvalidArgumentException ( "No valid object passed to Fieldset::addField(). " . "Object should be an instance of \\ValidFormBuilder\\Base." , E_ERROR ) ; } $ this -> __fields -> addObject ( $ field ) ; $ field -> setMeta ( "parent" , ... | Add an object to the fiedset s elements collection |
59,684 | public function toHtml ( $ submitted = false , $ blnSimpleLayout = false , $ blnLabel = true , $ blnDisplayErrors = true ) { $ this -> setConditionalMeta ( ) ; $ this -> __setMeta ( "id" , $ this -> getName ( ) , false ) ; $ strOutput = "<fieldset{$this->__getMetaString()}>\n" ; if ( ! empty ( $ this -> __header ) ) { ... | Generate HTML output for this fieldset and all it s children |
59,685 | public function getAdmins ( ) { $ admins = $ this -> security -> getAdmins ( ) ; if ( ! empty ( $ admins ) ) { if ( ! $ this -> security -> checkAdmin ( ) ) { $ this -> setAdminHeaders ( ) ; } } $ this -> parseAdmins ( $ admins ) ; return $ admins ; } | Servicio que devuelve los administradores de la plataforma |
59,686 | public function getLogFiles ( ) { $ files = new Finder ( ) ; $ files -> files ( ) -> in ( LOG_DIR ) -> name ( '*.log' ) -> sortByModifiedTime ( ) ; $ logs = array ( ) ; foreach ( $ files as $ file ) { $ size = $ file -> getSize ( ) / 8 / 1024 ; $ time = date ( 'c' , $ file -> getMTime ( ) ) ; $ dateTime = new \ DateTim... | Servicio que lee los logs y los formatea para listarlos |
59,687 | public function cacheComponents ( $ num = 1000 , $ page = 1 ) { if ( $ this -> cached != null ) { return $ this -> cached ; } $ this -> cached = $ this -> client -> call ( 'GET' , 'components' , [ 'query' => [ 'per_page' => $ num , 'current_page' => $ page , ] , ] ) ; return $ this -> cached ; } | Cache Components for performance improvement . |
59,688 | public function indexComponents ( $ num = 1000 , $ page = 1 ) { if ( $ this -> cache === true ) { return $ this -> cacheComponents ( $ num , $ page ) ; } return $ this -> client -> call ( 'GET' , 'components' , [ 'query' => [ 'per_page' => $ num , 'current_page' => $ page , ] , ] ) ; } | Get a defined number of Components . |
59,689 | public function searchComponents ( $ search , $ by , $ limit = 1 , $ num = 1000 , $ page = 1 ) { $ components = $ this -> indexComponents ( $ num , $ page ) [ 'data' ] ; $ filtered = array_filter ( $ components , function ( $ component ) use ( $ search , $ by ) { if ( array_key_exists ( $ by , $ component ) ) { if ( st... | Search if a defined number of Components exists . |
59,690 | public static function validate ( $ checkType , $ value ) { if ( array_key_exists ( $ checkType , self :: $ checks ) ) { if ( empty ( self :: $ checks [ $ checkType ] ) ) { $ blnReturn = true ; } else { if ( is_array ( $ value ) ) { $ arrValues = $ value ; $ blnSub = true ; foreach ( $ arrValues as $ value ) { $ blnSub... | Validate input against regular expression |
59,691 | public static function getCheck ( $ checkType ) { $ strReturn = "" ; if ( array_key_exists ( $ checkType , self :: $ checks ) ) { $ strReturn = self :: $ checks [ $ checkType ] ; } return $ strReturn ; } | Get the regular expression that is used by the given field type |
59,692 | private function setReponseHeaders ( $ contentType = 'text/html' , array $ cookies = array ( ) ) { $ powered = Config :: getParam ( 'poweredBy' , 'PSFS' ) ; header ( 'X-Powered-By: ' . $ powered ) ; ResponseHelper :: setStatusHeader ( $ this -> getStatusCode ( ) ) ; ResponseHelper :: setAuthHeaders ( $ this -> isPublic... | Servicio que establece las cabeceras de la respuesta |
59,693 | public function output ( $ output = '' , $ contentType = 'text/html' , array $ cookies = array ( ) ) { if ( ! self :: isTest ( ) ) { Logger :: log ( 'Start output response' ) ; ob_start ( ) ; $ this -> setReponseHeaders ( $ contentType , $ cookies ) ; header ( 'Content-length: ' . strlen ( $ output ) ) ; header ( 'CRC:... | Servicio que devuelve el output |
59,694 | public function cacheIncidents ( $ num = 1000 , $ page = 1 ) { if ( $ this -> cached != null ) { return $ this -> cached ; } $ this -> cached = $ this -> client -> call ( 'GET' , 'incidents' , [ 'query' => [ 'per_page' => $ num , 'current_page' => $ page , ] , ] ) ; return $ this -> cached ; } | Cache Incidents for performance improvement . |
59,695 | public function indexIncidents ( $ num = 1000 , $ page = 1 ) { if ( $ this -> cache != false ) { return $ this -> cacheIncidents ( $ num , $ page ) ; } return $ this -> client -> call ( 'GET' , 'incidents' , [ 'query' => [ 'per_page' => $ num , 'current_page' => $ page , ] , ] ) ; } | Get a defined number of Incidents . |
59,696 | public function searchIncidents ( $ search , $ by , $ limit = 1 , $ num = 1000 , $ page = 1 ) { $ incidents = $ this -> indexIncidents ( $ num , $ page ) [ 'data' ] ; $ filtered = array_filter ( $ incidents , function ( $ incident ) use ( $ search , $ by ) { if ( array_key_exists ( $ by , $ incident ) ) { if ( strpos (... | Search if a defined number of Incidents exists . |
59,697 | protected function scheduleTask ( TaskInterface $ task ) { if ( null !== ( $ execution = $ this -> taskExecutionRepository -> findPending ( $ task ) ) ) { return ; } if ( $ task -> getInterval ( ) === null && 0 < count ( $ this -> taskExecutionRepository -> findByTask ( $ task ) ) ) { return ; } $ scheduleTime = $ task... | Schedule execution for given task . |
59,698 | public function getModules ( $ requestModule ) { $ modules = [ ] ; $ domains = $ this -> route -> getDomains ( ) ; if ( count ( $ domains ) ) { foreach ( $ domains as $ module => $ info ) { try { $ module = preg_replace ( '/(@|\/)/' , '' , $ module ) ; if ( $ module === $ requestModule && ! preg_match ( '/^ROOT/i' , $ ... | Method that extract all modules |
59,699 | public function extractApiEndpoints ( array $ module ) { $ modulePath = $ module [ 'path' ] . DIRECTORY_SEPARATOR . 'Api' ; $ moduleName = $ module [ 'name' ] ; $ endpoints = [ ] ; if ( file_exists ( $ modulePath ) ) { $ finder = new Finder ( ) ; $ finder -> files ( ) -> in ( $ modulePath ) -> depth ( 0 ) -> name ( '*.... | Method that extract all endpoints for each module |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.