idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
9,000 | public function getCMSFields ( ) { $ fields = parent :: getCMSFields ( ) ; $ field = SortableUploadField :: create ( 'Images' , _t ( 'CarouselPage.db_Images' ) ) ; $ field -> setFolderName ( $ this -> getClassFolder ( ) ) ; $ field -> setFileEditFields ( 'getCarouselEditFields' ) ; $ root = $ fields -> fieldByName ( 'R... | Add the Images tab to the content form of the page . |
9,001 | public function getSettingsFields ( ) { $ fields = parent :: getSettingsFields ( ) ; $ settings = FieldGroup :: create ( FieldGroup :: create ( NumericField :: create ( 'Width' , _t ( 'CarouselPage.db_Width' ) ) , NumericField :: create ( 'Height' , _t ( 'CarouselPage.db_Height' ) ) , CheckboxField :: create ( 'Caption... | Add carousel related fields to the page settings . |
9,002 | public function parse ( ) { $ css = new Parser ( file_get_contents ( $ this -> path ) ) ; $ this -> leanCSS = $ css -> parse ( ) ; $ this -> blubberCSS = clone $ this -> leanCSS ; } | Begins parsing the CSS file |
9,003 | public function saveBlubber ( ) { $ fh = fopen ( $ this -> getDirname ( ) . '/' . $ this -> getBlubberName ( ) , 'w' ) ; fwrite ( $ fh , $ this -> blubberCSS -> render ( ) ) ; } | Saves the blubber CSS to the filesystem |
9,004 | public function saveLean ( ) { $ fh = fopen ( $ this -> getDirname ( ) . '/' . $ this -> getLeanName ( ) , 'w' ) ; fwrite ( $ fh , $ this -> leanCSS -> render ( ) ) ; } | Saves the lean CSS to the filesystem |
9,005 | protected function getBaseData ( ) { $ data = array ( ) ; $ data [ 'xKey' ] = $ this -> getCardknoxKey ( ) ; $ data [ 'xVersion' ] = '4.5.4' ; $ data [ 'xSoftwareName' ] = 'omnipay' ; $ data [ 'xSoftwareVersion' ] = '1' ; $ data [ 'xCommand' ] = $ this -> action ; return $ data ; } | Base data used only for the API . |
9,006 | protected function build ( ) { $ sql = $ this -> start . "\n" . ( $ this -> from ? $ this -> from . "\n" : null ) . ( $ this -> join ? $ this -> join : null ) . ( $ this -> set ? $ this -> set . "\n" : null ) . ( $ this -> where ? $ this -> where . "\n" : null ) . ( $ this -> groupby ? $ this -> groupby . "\n" : null )... | Build the SQL query from its parts . |
9,007 | public function rightJoin ( $ table , $ condition ) { if ( $ this -> dialect == 'sqlite' ) { throw new BuildException ( "SQLite does not support RIGHT JOIN" ) ; } return $ this -> createJoin ( $ table , $ condition , 'RIGHT OUTER' ) ; } | Build the right join part . |
9,008 | function paginateCount ( $ conditions , $ recursive ) { $ sql = $ this -> sql ; return count ( $ this -> query ( $ sql ) ) ; } | Esta funcion sobreescribe a la del paginador . Como son consultas guardadas en la tabla query tengo que calcular la cantidad de registros para que pagine bien . |
9,009 | function paginate ( $ conditions , $ fields , $ order , $ limit , $ page , $ recursive ) { $ sql = $ this -> sql ; $ sql .= " LIMIT " . $ this -> limit . " " ; $ sql .= " OFFSET " . ( ( $ page - 1 ) * $ this -> limit ) ; return $ this -> query ( $ sql ) ; } | Esta funcion sobreescribe a la del paginador . Como son consultas guardadas en la tabla query tengo que reescribir el limit y el offset para poder mostrar por pantalla |
9,010 | protected function respondWithItem ( $ item , $ resource_name = '' , array $ links = [ ] , array $ included = [ ] ) { $ resource = new Item ( $ item , $ resource_name , $ links , $ included ) ; return $ this -> respondWithArray ( $ resource -> toArray ( ) ) ; } | Response with item |
9,011 | public function transform ( $ value ) { if ( $ value === null || $ value == '' ) { return null ; } if ( ! ( $ value instanceof Page ) ) { throw new TransformationFailedException ( 'Expected an instance of a concrete5 page object.' ) ; } return intval ( $ value -> getCollectionID ( ) ) ; } | Converts a concrete5 page object to an integer . |
9,012 | public function getParameters ( array $ config ) { $ params = [ 'opifer_eav.attribute_class' => $ config [ 'attribute_class' ] , 'opifer_eav.media_class' => $ config [ 'media_class' ] , 'opifer_eav.nestable_class' => $ config [ 'nestable_class' ] , 'opifer_eav.option_class' => $ config [ 'option_class' ] , 'opifer_eav.... | Simplifying parameter syntax |
9,013 | public function prepend ( ContainerBuilder $ container ) { $ configs = $ container -> getExtensionConfig ( $ this -> getAlias ( ) ) ; $ config = $ this -> processConfiguration ( new Configuration ( ) , $ configs ) ; $ parameters = $ this -> getParameters ( $ config ) ; foreach ( $ parameters as $ key => $ value ) { $ c... | Prepend our config before other bundles so we can preset their config with our parameters |
9,014 | public static function encode ( $ data , $ prettyPrint = false ) { if ( $ prettyPrint ) { if ( version_compare ( PHP_VERSION , '5.4.0' , '>=' ) && defined ( 'JSON_PRETTY_PRINT' ) ) { return json_encode ( $ data , JSON_PRETTY_PRINT ) ; } else { $ jsonPretty = new JsonPretty ( ) ; return $ jsonPretty -> prettify ( $ data... | Encodes an array to json strutcture |
9,015 | protected function provideTemplatingSystem ( Application $ app ) { $ templateDir = __DIR__ . '/../../../data/templates' ; $ composerTemplatePath = __DIR__ . '/../../../../templates' ; if ( file_exists ( $ composerTemplatePath ) ) { $ templateDir = $ composerTemplatePath ; } $ app [ 'transformer.template.location' ] = $... | Initializes the templating system in the container . |
9,016 | public function getIndentationPrefix ( $ times = 1 ) { if ( ! is_integer ( $ times ) ) { throw new \ InvalidArgumentException ( 'The times parameter has to be an integer' ) ; } $ indentation = '' ; for ( $ i = 0 ; $ i < $ times ; $ i ++ ) { $ indentation .= $ this -> getTemplate ( ) -> getIndentation ( ) ; } return $ i... | Returns all the indentation that should be put before the current line |
9,017 | public function convertLinesToCode ( array $ lines ) { if ( 0 === count ( $ lines ) ) { return '' ; } if ( 0 !== strlen ( $ this -> getTemplate ( ) -> getIndentationPrefix ( ) ) ) { foreach ( $ lines as $ lineNumber => $ line ) { if ( null === $ line ) { unset ( $ lines [ $ lineNumber ] ) ; } elseif ( '' === trim ( $ l... | Converts an array of lines into code including the current indentation |
9,018 | public function getBlurbLines ( ) { $ lines = [ ] ; $ lines [ ] = '' ; $ lines [ ] = '/************************************************************************************************' ; $ lines [ ] = ' ** THIS IS AN AUTOMATICALLY GENERATED BASE FILE AND SHOULD NOT BE MANUALLY EDITED **' ; $ lines [ ] = ' *... | Get the default Blurb |
9,019 | public function from_path ( string $ path , $ type = 'page' ) : ? string { $ parent = null ; if ( $ root = $ this -> opt -> from_code ( $ type , self :: $ option_root_id ) ) { $ parts = explode ( '/' , $ path ) ; $ parent = $ root ; foreach ( $ parts as $ i => $ p ) { $ is_not_last = $ i < ( \ count ( $ parts ) - 1 ) ;... | Returns the option s ID corresponds to the given path . |
9,020 | public function get_all ( string $ id_option = null , string $ type = 'page' ) : ? array { if ( $ id_option = $ this -> _get_id_option ( $ id_option , $ type ) ) { return $ this -> pref -> options ( $ id_option ? : $ this -> get_current ( ) ) ; } return null ; } | Returns the full list of permissions existing in the given option |
9,021 | public function get_full ( $ id_option = null , string $ type = 'page' ) : ? array { if ( $ id_option = $ this -> _get_id_option ( $ id_option , $ type ) ) { return $ this -> pref -> full_options ( $ id_option ? : $ this -> get_current ( ) ) ; } return null ; } | Returns the full list of permissions existing in the given option with all the current user s preferences |
9,022 | public function is ( string $ path , string $ type = 'page' ) : ? string { return $ this -> from_path ( $ path , $ type ) ; } | Checks if an option corresponds to the given path . |
9,023 | public function customize ( array $ arr ) : array { $ res = [ ] ; if ( isset ( $ arr [ 0 ] ) ) { foreach ( $ arr as $ a ) { if ( isset ( $ a [ 'id' ] ) && $ this -> has ( $ a [ 'id' ] ) ) { $ res [ ] = $ a ; } } } else if ( isset ( $ arr [ 'items' ] ) ) { $ res = $ arr ; unset ( $ res [ 'items' ] ) ; foreach ( $ arr [ ... | Adapts a given array of options to user s permissions |
9,024 | public function add ( string $ id_option , string $ type = 'page' ) : ? int { if ( $ id_option = $ this -> _get_id_option ( $ id_option , $ type ) ) { return $ this -> pref -> set_by_option ( $ id_option , [ ] ) ; } return null ; } | Grants a new permission to a user or a group |
9,025 | public function remove ( $ id_option , string $ type = 'page' ) : ? int { if ( $ id_option = $ this -> _get_id_option ( $ id_option , $ type ) ) { return $ this -> pref -> delete ( $ id_option ) ; } return null ; } | Deletes a preference for a path or an ID . |
9,026 | public function read_option ( string $ id_option = null ) : ? bool { if ( bbn \ str :: is_uid ( $ id_option ) ) { $ root = self :: get_option_id ( 'options' ) ; $ id_to_check = $ this -> opt -> from_code ( 'opt' . $ id_option , $ root ) ; return $ this -> has ( $ id_to_check , 'options' ) ; } return null ; } | Checks if the category represented by the given option ID is readable by the current user |
9,027 | public function renderMustache ( $ filename , $ data ) { $ data [ 'getView' ] = function ( $ name , $ data ) { return $ this -> getView ( $ name , $ data ) ; } ; return parent :: renderMustache ( $ filename , $ data ) ; } | Attach getView function to the mustache view |
9,028 | public static function availableTypes ( ) { return [ self :: CONDITION_EQUAL , self :: CONDITION_NOT_EQUAL , self :: CONDITION_GREATER_THAN , self :: CONDITION_LESS_THAN , self :: CONDITION_GREATER_THAN_OR_EQUAL_TO , self :: CONDITION_LESS_THAN_OR_EQUAL_TO , self :: CONDITION_IF_EMPTY , self :: CONDITION_IF_NOT_EXISTS ... | All Available ConditionInterface Types |
9,029 | function filter ( $ key = NULL , $ func = NULL ) { if ( ! $ key ) return array_keys ( $ this -> filter ) ; if ( ! $ func ) return $ this -> filter [ $ key ] ; $ this -> filter [ $ key ] = $ func ; } | register token filter |
9,030 | protected function seeSuccessData ( $ data = null ) { collect ( $ data ) -> each ( function ( $ value , $ key ) { if ( is_array ( $ value ) ) { $ this -> seeSuccessData ( $ value ) ; } else { $ this -> seeJson ( [ $ key => $ value ] ) ; } } ) ; return $ this ; } | Assert that the response data contains given values . |
9,031 | protected function getSuccessData ( $ attributes = null ) { $ rawData = $ this -> decodeResponseJson ( ) [ 'data' ] ; if ( is_null ( $ attributes ) ) { return $ rawData ; } elseif ( is_string ( $ attributes ) ) { return array_get ( $ rawData , $ attributes ) ; } $ data = [ ] ; foreach ( $ attributes as $ attribute ) { ... | Decodes JSON response and returns the data . |
9,032 | protected function seeError ( string $ error , int $ status = null ) { if ( ! is_null ( $ status ) ) { $ this -> seeStatusCode ( $ status ) ; } if ( $ this -> app -> config -> get ( 'responder.status_code' ) ) { $ this -> seeJson ( [ 'status' => $ status ] ) ; } return $ this -> seeJson ( [ 'success' => false ] ) -> se... | Assert that the response is a valid error response . |
9,033 | public function generateRandomPassword ( ) { $ alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789" ; $ pass = array ( ) ; $ alphaLength = strlen ( $ alphabet ) - 1 ; for ( $ i = 0 ; $ i < 8 ; $ i ++ ) { $ n = rand ( 0 , $ alphaLength ) ; $ pass [ ] = $ alphabet [ $ n ] ; } return implode ( $ pass ... | Geneate Radmon password . |
9,034 | public function isUnique ( $ username , $ email , $ dni = null , $ code = null ) { $ entities = $ this -> getEm ( ) -> getRepository ( "AmulenUserBundle:User" ) -> findByUniques ( $ username , $ email , $ dni , $ code ) ; return count ( $ entities ) <= 0 ; } | Check if is unique . |
9,035 | public function getAuthToken ( $ user , $ plainPassword , $ firewall , $ roles = array ( ) ) { $ token = new UsernamePasswordToken ( $ user , $ user -> getPlainPassword ( ) , $ firewall , $ roles ) ; $ this -> tokenStorage -> setToken ( $ token ) ; return $ token ; } | Get by Code . |
9,036 | public function uploadImage ( User $ entity ) { if ( null === $ entity -> getFile ( ) ) { return $ entity ; } $ uploadBaseDir = $ this -> container -> getParameter ( "user_avatar_basedir" ) ; $ uploadDir = $ this -> container -> getParameter ( "user_avatar_dir" ) ; $ filename = $ entity -> getFile ( ) -> getClientOrigi... | Upload user image . |
9,037 | protected function addUpdateExchangeRate ( $ currencyFrom , $ currencyTo , $ rate ) { if ( ! in_array ( $ currencyTo , $ this -> managedCurrencies ) ) { return false ; } $ exchangeRate = $ this -> currencyRateRepository -> findOneBy ( [ 'currencyFrom' => $ currencyFrom , 'currencyTo' => $ currencyTo , ] ) ; if ( null =... | Adds new rate or updates existing one |
9,038 | public function store ( $ path , $ fileId , $ mimeType , $ size ) { $ this -> cache -> put ( 'seaweedfs.' . md5 ( $ path ) , [ 'fid' => $ fileId , 'mimeType' => $ mimeType , 'size' => $ size ] ) ; } | Store a path to a seaweedfs file id |
9,039 | public function render ( $ view , $ data = [ ] , $ mergeData = [ ] ) { return $ this -> make ( $ view , $ this -> parseData ( $ data ) , $ mergeData ) -> render ( ) ; } | Get the rendered content of the view based |
9,040 | public function addRecord ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Banking \ Report \ Record $ record ) { $ this -> records [ ] = $ record ; return $ this ; } | Add record . |
9,041 | public function removeRecord ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Banking \ Report \ Record $ record ) { return $ this -> records -> removeElement ( $ record ) ; } | Remove record . |
9,042 | private function _check_filter ( $ item , $ filter ) : bool { if ( $ filter ) { if ( is_string ( $ filter ) ) { return strtolower ( substr ( \ is_array ( $ item ) ? $ item [ 'path' ] : $ item , - strlen ( $ filter ) ) ) === strtolower ( $ filter ) ; } if ( is_callable ( $ filter ) ) { return $ filter ( $ item ) ; } } r... | Checks if the given files name ends with the given suffix string |
9,043 | public function addIcalendarEvent ( \ sb \ ICalendar \ Event $ event ) { $ a = new \ sb \ Email \ Attachment ( ) ; $ a -> mime_type = 'text/calendar;' ; $ a -> setEncoding ( '8bit' ) ; $ a -> name = 'event.ics' ; $ a -> contents = $ event -> __toString ( ) ; $ this -> addAttachment ( $ a ) ; } | Add an \ sb \ ICalendar \ Event request |
9,044 | public function onBeforeSend ( ) { if ( ! isset ( $ this -> __added_sent_by_stamp ) ) { $ this -> body .= "\n\nSent Using Surebert Mail" . " recorded: \nSending IP: " . \ sb \ Gateway :: $ remote_addr . " \nSending Host: " . \ sb \ Gateway :: $ http_host ; if ( ! empty ( $ this -> body_HTML ) ) { $ this -> body_HTML .=... | Fires before sending if returns false then sending does not occur |
9,045 | public function send ( $ outbox = null ) { if ( $ outbox instanceof Writer ) { self :: $ outbox = $ outbox ; } elseif ( ! self :: $ outbox ) { self :: $ outbox = new Writer ( ) ; } if ( $ this -> onBeforeSend ( $ this ) !== false ) { self :: $ outbox -> addEmailToOutbox ( $ this ) ; return self :: $ outbox -> send ( ) ... | Uses sb_Email_Writer to send the email |
9,046 | public function map ( array $ params ) { if ( ! isset ( $ params [ 'ientifier' ] ) ) { throw new MissingArgumentException ( 'identifier' ) ; } if ( ! isset ( $ params [ 'primaryKey' ] ) ) { throw new MissingArgumentException ( 'primaryKey' ) ; } if ( ! isset ( $ params [ 'format' ] ) ) { $ params [ 'format' ] = 'json' ... | Associates a primary key with a user s social identity . |
9,047 | public function unmap ( array $ params ) { if ( ! isset ( $ params [ 'ientifier' ] ) ) { throw new MissingArgumentException ( 'identifier' ) ; } if ( ! isset ( $ params [ 'all_identifiers' ] ) ) { throw new MissingArgumentException ( 'all_identifiers' ) ; } if ( ! isset ( $ params [ 'primaryKey' ] ) ) { throw new Missi... | Removes an identity provider from a primary key as well as allowing you to optionally unlink your application from the user s account with the provider . |
9,048 | public function get ( $ id ) { return $ this -> _sendPayload ( $ this -> _getService ( $ this -> _pageServiceKey ) -> getPageLayout ( $ id ) ) ; } | Get page layout details |
9,049 | public function setReport ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Banking \ Report \ Report $ report = null ) { $ this -> report = $ report ; return $ this ; } | Set report . |
9,050 | public function get ( $ name ) { if ( ! isset ( $ this -> items [ $ name ] ) && ! array_key_exists ( $ name , $ this -> items ) && ! $ this -> applyDefaultValue ( $ name ) ) { throw new \ OutOfBoundsException ( sprintf ( 'Undefined data item index: %s.' , $ name ) ) ; } ; return $ this -> items [ $ name ] ; } | Gets a value stored in the context data variable . |
9,051 | protected function logException ( \ Exception $ exception ) { $ this -> logger -> error ( $ exception -> getMessage ( ) , array ( 'class' => get_class ( $ exception ) , 'message' => $ exception -> getMessage ( ) , 'file' => $ exception -> getMessage ( ) , 'line' => $ exception -> getMessage ( ) , 'command' => $ this ->... | Logs an exception to the logger |
9,052 | public static function zip ( $ zip , $ check_usps = true ) { $ result = new \ sb \ Validate \ Results ( ) ; $ result -> value = $ zip ; $ result -> is_valid = false ; if ( preg_match ( "/^(\d{5})(-\d{4})*$/" , $ zip ) ) { $ result -> message = "Valid zip code format" ; $ result -> is_valid = true ; if ( $ check_usps ) ... | Validates a zip code |
9,053 | public static function normalize ( $ risk ) { return ( float ) max ( min ( $ risk , self :: MAXIMUM_RISK ) , self :: MINIMUM_RISK ) ; } | Normalize Risk - make sure that risk will be in bound |
9,054 | public function listAction ( ) { $ this -> performAccessChecks ( ) ; $ crons = $ this -> cronService -> listCronsStatus ( ) ; $ cronRows = array ( ) ; foreach ( $ crons as $ cron ) { $ cronRows [ ] = array ( 'alias' => $ cron -> getAlias ( ) , 'queued' => $ cron instanceof SmileCron ? ( $ cron -> getQueued ( ) ? $ cron... | List crons status |
9,055 | protected function createValidators ( array $ validators ) { $ this -> availableValidators = [ ] ; foreach ( $ validators as $ name => $ type ) { $ class = '\\Valdi\\Validator\\' . $ type ; $ this -> availableValidators [ $ name ] = new $ class ( ) ; } } | Creates instances of the available validators . |
9,056 | protected function isValidRule ( $ validator , $ parameters , $ value ) { if ( ! array_key_exists ( $ validator , $ this -> availableValidators ) ) { throw new ValidatorException ( '"' . $ validator . '" not found as available validator.' ) ; } return $ this -> availableValidators [ $ validator ] -> isValid ( $ value ,... | Validates a single rule . |
9,057 | public function isValidValue ( $ rules , $ value ) { $ result = [ ] ; foreach ( $ rules as $ rule ) { $ parameters = $ rule ; $ name = array_shift ( $ parameters ) ; $ valid = $ this -> isValidRule ( $ name , $ parameters , $ value ) ; if ( $ valid !== null ) { $ result [ ] = $ valid ; } } return $ result ; } | Validates a value via the given rules . |
9,058 | public function isValid ( array $ rules , array $ data ) { $ errors = [ ] ; foreach ( $ rules as $ field => $ fieldRules ) { $ value = isset ( $ data [ $ field ] ) ? $ data [ $ field ] : null ; $ fieldErrors = $ this -> isValidValue ( $ fieldRules , $ value ) ; if ( ! empty ( $ fieldErrors ) ) { $ errors [ $ field ] = ... | Performs the actual validation . |
9,059 | public function saveToDb ( $ incomingOnly = false ) { $ count = ( $ incomingOnly ) ? $ this -> dbInterface -> executeDataImportIncoming ( ) : $ this -> dbInterface -> executeDataImport ( ) ; return $ count ; } | Saves the data to DB using iAccountStatementDbController |
9,060 | public function addLoop ( $ data ) { $ length = is_array ( $ data ) || $ data instanceof Countable ? count ( $ data ) : null ; $ parent = Arr :: last ( $ this -> loopsStack ) ; $ this -> loopsStack [ ] = [ 'iteration' => 0 , 'index' => 0 , 'remaining' => isset ( $ length ) ? $ length : null , 'count' => $ length , 'fir... | Add new loop to the stack . |
9,061 | public function incrementLoopIndices ( ) { $ loop = $ this -> loopsStack [ $ index = count ( $ this -> loopsStack ) - 1 ] ; $ this -> loopsStack [ $ index ] = array_merge ( $ this -> loopsStack [ $ index ] , [ 'iteration' => $ loop [ 'iteration' ] + 1 , 'index' => $ loop [ 'iteration' ] , 'first' => $ loop [ 'iteration... | Increment the top loop s indices . |
9,062 | public function evaluate ( $ actual ) { $ matcherResult = $ this -> matcher -> match ( $ actual ) ; $ expected = $ this -> negated ? false : true ; $ result = $ matcherResult === $ expected ; return new Result ( $ actual , $ this -> negated , $ this -> matcher , $ result ) ; } | Evaluate the value of actual . |
9,063 | static function parseMobileNumber ( $ number ) { $ numerics = static :: extractNumerics ( $ number ) ; $ countryCode = '' ; $ short = static :: right ( $ numerics , 10 , $ countryCode ) ; $ carriercode = '' ; $ number = static :: right ( $ short , 7 , $ carrierCode ) ; return compact ( 'countryCode' , 'carrierCode' , '... | Parse mobile number |
9,064 | static function arrayExtract ( array $ keys , array $ array , array $ callbacks = [ ] ) { $ extracted = [ ] ; foreach ( $ keys as $ key ) { if ( array_key_exists ( $ key , $ array ) ) { $ item = $ array [ $ key ] ; if ( isset ( $ callbacks [ $ key ] ) && is_callable ( $ callbacks [ $ key ] ) ) { $ item = call_user_func... | Extract array from array with keys |
9,065 | public function onLayoutBoxFormInit ( FormEvent $ event ) { $ builder = $ event -> getFormBuilder ( ) ; $ form = $ event -> getForm ( ) ; $ configurators = $ this -> container -> get ( 'layout_box.configurator.collection' ) -> all ( ) ; $ resource = $ event -> getResource ( ) ; $ boxSettings = $ resource -> getSettings... | Adds configurator fields to main layout box edit form . Loops through all configurators renders the fieldset and sets default data |
9,066 | public function onLayoutBoxPreUpdate ( EntityEvent $ event ) { $ resource = $ event -> getEntity ( ) ; if ( $ resource instanceof LayoutBox ) { $ request = $ this -> getRequestHelper ( ) -> getCurrentRequest ( ) ; $ settings = $ this -> getBoxSettingsFromRequest ( $ request ) ; $ settings = $ this -> mergeUnmodifiedSet... | Sets resource settings fetched from fieldset corresponding to selected box type |
9,067 | public function export ( $ product ) { $ files = $ product -> generateFiles ( ) ; mkdir ( $ this -> target , 0777 , true ) ; foreach ( $ files as $ file ) if ( ! $ file -> getContent ( ) -> copy ( fphp \ Helper \ Path :: join ( $ this -> target , $ file -> getTarget ( ) ) ) ) throw new LocalExporterException ( "could n... | Exports a product in the local filesystem . Every generated file is copied to the filesystem at its target path . |
9,068 | protected function validatePassword ( LoginForm & $ loginForm ) { return [ 'password' , function ( $ attribute ) use ( & $ loginForm ) { if ( $ loginForm -> user === null || ! PasswordHelper :: validate ( $ loginForm -> password , $ loginForm -> user -> password_hash ) ) { $ loginForm -> addError ( $ attribute , Yii ::... | Adds password validation rule for login scenario |
9,069 | protected function inactiveUsers ( LoginForm & $ loginForm ) { if ( UsersModule :: module ( ) -> allowLoginInactiveAccounts === false ) { return [ ] ; } return [ 'username' , function ( $ attribute ) use ( & $ loginForm ) { if ( $ loginForm -> user !== null && $ loginForm -> user -> is_active === false ) { $ loginForm ... | Adds validation rule to not accept inactive users if such feature is toggled on in module configuration . |
9,070 | public function tag ( $ tag , $ attr = null , $ content = null , $ close = false ) { $ tag = strtolower ( $ tag ) ; if ( ! empty ( $ attr ) && is_array ( $ attr ) ) { $ attr = $ this -> Attr -> attr ( $ attr ) ; } if ( $ close ) { return sprintf ( '<%s%s>%s</%1$s>' , $ tag , $ attr , $ content ) ; } else { return sprin... | render a tag |
9,071 | public function processList ( $ list , $ subListType = 'ul' ) { $ out = '' ; foreach ( $ list as $ key => $ value ) { if ( is_array ( $ value ) && ( isset ( $ value [ 'list' ] ) || isset ( $ value [ 'attr' ] ) ) ) { $ attr = ( isset ( $ value [ 'attr' ] ) ) ? $ value [ 'attr' ] : null ; $ listAttr = ( isset ( $ value [... | process list items |
9,072 | public function image ( $ src , $ attr = array ( ) ) { $ src = $ this -> Assets -> getImage ( $ src ) ; $ attr [ 'src' ] = $ src ; return $ this -> tag ( 'img' , $ attr ) ; } | create an image |
9,073 | public function style ( $ src , $ attr = array ( ) ) { $ src = $ this -> Assets -> getStyle ( $ src ) ; $ attr [ 'href' ] = $ src ; $ attr = array_merge ( array ( 'media' => 'screen' , 'rel' => 'stylesheet' , 'type' => 'text/css' ) , $ attr ) ; return $ this -> tag ( 'link' , $ attr ) ; } | create a style link |
9,074 | public function script ( $ src , $ attr = array ( ) ) { $ src = $ this -> Assets -> getScript ( $ src ) ; $ attr [ 'src' ] = $ src ; return $ this -> tag ( 'script' , $ attr , '' , true ) ; } | create a script tag |
9,075 | public function setRouter ( $ Router ) { if ( ! is_object ( $ Router ) || ! $ Router instanceof Router ) { throw new \ InvalidArgumentException ( 'The Router Interface must be a valid Router Object' ) ; } $ this -> Router = $ Router ; return true ; } | check and set the router interface |
9,076 | public function setAssets ( $ Assets ) { if ( ! is_object ( $ Assets ) || ! $ Assets instanceof Assets ) { throw new \ InvalidArgumentException ( 'The Assets Interface must be a valid Assets Object' ) ; } $ this -> Assets = $ Assets ; return true ; } | check and set the Asset interface |
9,077 | public function setForm ( $ Form ) { if ( ! is_object ( $ Form ) || ! $ Form instanceof Helpers \ Form ) { throw new \ InvalidArgumentException ( 'The Form Object must be a valid Helpers\Form Object' ) ; } $ this -> Form = $ Form ; return true ; } | check and set the Form Object |
9,078 | public function removePayment ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Payment \ Payment $ payment ) { return $ this -> payments -> removeElement ( $ payment ) ; } | Remove payment . |
9,079 | public function baseUrl ( ) { if ( ! $ this -> baseUrl ) { $ this -> baseUrl = $ this -> request -> getScheme ( ) . '://' . $ this -> request -> getHttpHost ( ) ; } return $ this -> baseUrl ; } | Gets the base url |
9,080 | public function absoluteUrl ( $ uri = null , $ args = null ) { if ( isset ( $ uri ) ) { $ uri = '/' . ltrim ( $ uri , "/" ) ; return $ this -> baseUrl ( ) . $ this -> url -> get ( $ uri , $ args ) ; } else { return $ this -> baseUrl ( ) . $ this -> url -> getBaseUri ( ) ; } } | Gets absolute url |
9,081 | public function ltrim ( $ str , $ charlist = null ) { return isset ( $ charlist ) ? ltrim ( $ str , $ charlist ) : ltrim ( $ str ) ; } | left trim string |
9,082 | public function rtrim ( $ str , $ charlist = null ) { return isset ( $ charlist ) ? rtrim ( $ str , $ charlist ) : rtrim ( $ str ) ; } | right trim string |
9,083 | private function zSignatureExists ( $ dom ) { $ signature = $ dom -> getElementsByTagName ( 'Signature' ) -> item ( 0 ) ; if ( ! isset ( $ signature ) ) { return false ; } return true ; } | signatureExists Check se o xml possi a tag Signature . |
9,084 | private function zLeaveParam ( ) { $ this -> pfxCert = '' ; $ this -> pubKey = '' ; $ this -> priKey = '' ; $ this -> certKey = '' ; $ this -> pubKeyFile = '' ; $ this -> priKeyFile = '' ; $ this -> certKeyFile = '' ; $ this -> expireTimestamp = '' ; } | zLeaveParam Limpa os parametros da classe . |
9,085 | public function getPackage ( ) { $ inheritedElement = $ this -> getInheritedElement ( ) ; if ( $ this -> package instanceof PackageDescriptor && ! ( $ this -> package -> getName ( ) === '\\' && $ inheritedElement ) ) { return $ this -> package ; } if ( $ inheritedElement instanceof DescriptorAbstract ) { return $ inher... | Returns the package name for this element . |
9,086 | protected function buildMethods ( ) { $ refl = new \ ReflectionClass ( $ this ) ; $ enterMethods = [ ] ; $ leaveMethods = [ ] ; foreach ( $ refl -> getMethods ( ) as $ method ) { $ name = $ method -> getName ( ) ; if ( preg_match ( '/^(enter|leave).+/' , $ name ) && ! preg_match ( '/^(enter|leave)Node$/' , $ name ) ) {... | collect all rule method according to node type of parameter |
9,087 | protected function setDefaults ( array $ defaultOptions = array ( ) ) { $ defaultOptions = array_merge ( array ( 'depth' => null , 'ancestorCurrencyDepth' => null , 'currentClass' => 'active' , 'ancestorClass' => 'active' , 'firstClass' => null , 'lastClass' => null ) , $ defaultOptions ) ; parent :: setDefaults ( $ de... | Overwriting some options - classes etc . |
9,088 | public function write ( $ data ) { $ post_date_string = $ data [ 'post_date' ] -> format ( 'Y-m-d H:i:s' ) ; $ slug = $ this -> generateSlug ( $ data [ 'title' ] ) ; $ filename = $ data [ 'post_date' ] -> format ( 'Y-m-d' ) . '-' . $ slug ; $ headerData = [ 'title' => $ data [ 'title' ] , 'date' => $ post_date_string ,... | Write out a set of data into a file |
9,089 | static function parse ( string $ url , ? int $ preferredFormat = self :: ABSOLUTE ) { $ components = parse_url ( $ url ) ; if ( $ components === false ) { throw new InvalidUrlException ( sprintf ( 'The given URL "%s" is invalid' , $ url ) ) ; } $ query = [ ] ; if ( isset ( $ components [ 'query' ] ) ) { parse_str ( $ c... | Parse an URL |
9,090 | function getFullHost ( ) : ? string { if ( $ this -> host === null ) { return null ; } $ fullHost = $ this -> host ; if ( $ this -> port !== null ) { $ fullHost .= ':' . $ this -> port ; } return $ fullHost ; } | Get host name including the port if defined |
9,091 | function add ( array $ parameters ) : void { foreach ( $ parameters as $ parameter => $ value ) { $ this -> query [ $ parameter ] = $ value ; } } | Add multiple query parameters |
9,092 | function build ( ) : string { if ( $ this -> host !== null && $ this -> preferredFormat === static :: ABSOLUTE ) { return $ this -> buildAbsolute ( ) ; } else { return $ this -> buildRelative ( ) ; } } | Build an absolute or relative URL |
9,093 | function buildAbsolute ( ) : string { $ output = '' ; if ( $ this -> host === null ) { throw new IncompleteUrlException ( 'No host specified' ) ; } if ( $ this -> scheme !== null ) { $ output .= $ this -> scheme ; $ output .= '://' ; } else { $ output .= '//' ; } $ output .= $ this -> getFullHost ( ) ; if ( $ this -> p... | Build an absolute URL |
9,094 | function buildRelative ( ) : string { $ output = '' ; $ output .= $ this -> path ; if ( $ this -> query ) { $ output .= '?' ; $ output .= $ this -> getQueryString ( ) ; } if ( $ this -> fragment !== null ) { $ output .= '#' ; $ output .= $ this -> fragment ; } return $ output ; } | Build a relative URL |
9,095 | public function container ( $ container = 'default' ) { if ( ! isset ( $ this -> containers [ $ container ] ) ) { $ this -> containers [ $ container ] = new Container ( $ container ) ; } return $ this -> containers [ $ container ] ; } | Retrieve the requested asset container object . |
9,096 | public function preparePharCacert ( $ md5Check = true ) { $ from = __DIR__ . '/Resources/cacert.pem' ; $ certFile = sys_get_temp_dir ( ) . '/guzzle-cacert.pem' ; if ( ! file_exists ( $ certFile ) && ! copy ( $ from , $ certFile ) ) { throw new RuntimeException ( "Could not copy {$from} to {$certFile}: " . var_export ( ... | Copy the cacert . pem file from the phar if it is not in the temp folder and validate the MD5 checksum |
9,097 | static protected function findRecursiveCallback ( ezcBaseFileFindContext $ context , $ sourceDir , $ fileName , $ fileInfo ) { if ( $ fileInfo [ 'mode' ] & 0x4000 ) { return ; } $ context -> elements [ ] = $ sourceDir . DIRECTORY_SEPARATOR . $ fileName ; $ context -> count ++ ; $ context -> size += $ fileInfo [ 'size' ... | This is the callback used by findRecursive to collect data . |
9,098 | static public function walkRecursive ( $ sourceDir , array $ includeFilters = array ( ) , array $ excludeFilters = array ( ) , $ callback , & $ callbackContext ) { if ( ! is_dir ( $ sourceDir ) ) { throw new ezcBaseFileNotFoundException ( $ sourceDir , 'directory' ) ; } $ elements = array ( ) ; $ d = @ dir ( $ sourceDi... | Walks files and directories recursively on a file system |
9,099 | static public function findRecursive ( $ sourceDir , array $ includeFilters = array ( ) , array $ excludeFilters = array ( ) , & $ statistics = null ) { if ( ! is_array ( $ statistics ) || ! array_key_exists ( 'size' , $ statistics ) || ! array_key_exists ( 'count' , $ statistics ) ) { $ statistics [ 'size' ] = 0 ; $ s... | Finds files recursively on a file system |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.