idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
59,400 | public function monthTitle ( Month $ month ) { $ weekendClass = 'bm-calendar-weekend' ; $ monthName = self :: $ monthNames [ $ month -> value ( ) ] ; $ output = '<thead>' ; $ output .= '<tr>' ; $ output .= '<th colspan="7" class="bm-calendar-month-title">' . $ monthName . '</th>' ; $ output .= '</tr><tr>' ; for ( $ col... | Returns the markup for the header of a month table . |
59,401 | public function renderDay ( DayInterface $ day ) { $ classes = array ( ) ; $ dayOfWeek = $ day -> dayOfWeek ( ) ; if ( DayInterface :: SATURDAY === $ dayOfWeek || DayInterface :: SUNDAY === $ dayOfWeek ) { $ classes [ ] = 'bm-calendar-weekend' ; } foreach ( $ day -> getStates ( ) as $ state ) { $ classes [ ] = 'bm-cale... | Returns the markup for a single table cell . |
59,402 | public function renderMonth ( $ year , $ month ) { $ monthClass = sprintf ( 'bm-calendar-month-%02d' , $ month ) ; $ yearClass = sprintf ( 'bm-calendar-year-%04d' , $ year ) ; $ month = $ this -> calendar -> getMonth ( $ year , $ month ) ; $ days = $ this -> calendar -> getDays ( $ month ) ; $ column = 0 ; $ output = '... | Render a month table internally . |
59,403 | protected function getCommandConfig ( $ commandKey ) { if ( isset ( $ this -> configsPerCommandKey [ $ commandKey ] ) ) { return $ this -> configsPerCommandKey [ $ commandKey ] ; } $ config = new Config ( $ this -> config -> get ( 'default' ) -> toArray ( ) , true ) ; if ( $ this -> config -> __isset ( $ commandKey ) )... | Gets the config for given command key |
59,404 | public function saveMessage ( $ mail ) { $ messageHtml = quoted_printable_decode ( $ mail -> getMessage ( ) -> getBodyHtml ( true ) ) ; $ this -> createFolder ( $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) ) ; $ this -> storeFile ( $ messageHtml , $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) . DIR... | Save file to spool path |
59,405 | protected function createFolder ( $ folderPath ) { if ( ! @ mkdir ( $ folderPath , 0777 , true ) && ! is_dir ( $ folderPath ) ) { throw new FileSystemException ( new Phrase ( 'Folder can not be created, but does not exist.' ) ) ; } return $ this ; } | Create a folder path if folder does not exist |
59,406 | protected function storeFile ( $ data , $ filePath ) { if ( ! is_dir ( dirname ( $ filePath ) ) ) { $ this -> createFolder ( dirname ( $ filePath ) ) ; } for ( $ i = 0 ; $ i < $ this -> _config -> getHostRetryLimit ( ) ; $ i ++ ) { $ fp = @ fopen ( $ filePath , 'x' ) ; if ( $ fp !== false ) { if ( false === fwrite ( $ ... | Stores string data at a given path |
59,407 | public function loadMessage ( $ mail ) { $ localFilePath = $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) . DIRECTORY_SEPARATOR . self :: MESSAGE_FILE_NAME ; $ messageJson = $ this -> restoreFile ( $ localFilePath ) ; if ( empty ( $ messageJson ) ) { $ messageJson = '{}' ; } $ messageData = json_decode ( $ mes... | Restore a message from filesystem |
59,408 | private function restoreFile ( $ filePath ) { try { for ( $ i = 0 ; $ i < $ this -> _config -> getHostRetryLimit ( ) ; ++ $ i ) { @ fopen ( $ filePath , 'x' ) ; if ( false === $ fileData = file_get_contents ( $ filePath ) ) { return null ; } return $ fileData ; } } catch ( \ Exception $ e ) { return null ; } return nul... | Load binary file data from a given file path |
59,409 | public function saveMail ( $ mail ) { $ mailJson = json_encode ( $ mail ) ; $ this -> createFolder ( $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) ) ; return $ this -> storeFile ( $ mailJson , $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) . DIRECTORY_SEPARATOR . self :: MAIL_FILE_NAME ) ; } | Convert a mail object to json and store it at mail folder path |
59,410 | public function loadAttachment ( $ mail , $ path ) { $ attachmentFolder = DIRECTORY_SEPARATOR . self :: ATTACHMENT_PATH ; $ localFilePath = $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) . $ attachmentFolder . $ path ; return $ this -> restoreFile ( $ localFilePath ) ; } | Load binary data from storage provider |
59,411 | public function getAttachments ( $ mail ) { if ( empty ( $ mail -> getId ( ) ) ) { return [ ] ; } $ folderFileList = $ this -> getMailLocalFolderFileList ( $ mail ) ; $ attachments = [ ] ; foreach ( $ folderFileList as $ filePath => $ fileMetaData ) { $ filePath = $ fileMetaData [ 'path' ] ; $ attachment = $ this -> _o... | Returns attachments for a given mail |
59,412 | protected function getMailLocalFolderFileList ( $ mail ) { $ spoolFolder = $ this -> _config -> getHostSpoolerFolderPath ( ) . DIRECTORY_SEPARATOR . $ mail -> getId ( ) . DIRECTORY_SEPARATOR . self :: ATTACHMENT_PATH ; if ( ! is_dir ( $ spoolFolder ) ) { $ this -> createFolder ( $ spoolFolder ) ; } $ objects = new Recu... | Get file list for a given mail |
59,413 | public function saveAttachments ( $ mail ) { $ attachments = $ mail -> getAttachments ( ) ; foreach ( $ attachments as $ attachment ) { $ this -> saveAttachment ( $ attachment ) ; } return $ this ; } | Save all attachments of a given mail |
59,414 | public function saveAttachment ( $ attachment ) { $ binaryData = $ attachment -> getBinary ( ) ; $ mail = $ attachment -> getMail ( ) ; $ folderPath = $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) . DIRECTORY_SEPARATOR . self :: ATTACHMENT_PATH ; $ this -> createFolder ( $ folderPath ) ; $ filePath = $ this -... | Save an attachment binary to a file in host temp folder |
59,415 | public function getRootLocalFolderFileList ( ) { $ spoolFolder = $ this -> _config -> getHostSpoolerFolderPath ( ) ; $ objects = new IteratorIterator ( new DirectoryIterator ( $ spoolFolder ) ) ; $ files = [ ] ; foreach ( $ objects as $ path => $ object ) { if ( $ object -> getFilename ( ) != '.' && $ object -> getFile... | Get Folder list for host spooler folder path |
59,416 | public function getLocalFileListForPath ( $ localPath ) { $ files = [ ] ; $ objects = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ localPath ) , RecursiveIteratorIterator :: LEAVES_ONLY , FilesystemIterator :: SKIP_DOTS ) ; foreach ( $ objects as $ path => $ object ) { if ( $ object -> getFilename... | Get list of files in a local file path |
59,417 | public function deleteLocalFiles ( $ localPath ) { $ it = new RecursiveDirectoryIterator ( $ localPath , RecursiveDirectoryIterator :: SKIP_DOTS ) ; $ files = new RecursiveIteratorIterator ( $ it , RecursiveIteratorIterator :: CHILD_FIRST ) ; foreach ( $ files as $ file ) { if ( $ file -> isDir ( ) ) { rmdir ( $ file -... | Deletes all local stored files |
59,418 | public function setAttribute ( $ userId , $ name , $ value ) { $ row = $ this -> connection -> fetchAssoc ( 'SELECT id FROM fusio_user_attribute WHERE name = :name' , [ 'name' => $ name ] ) ; if ( empty ( $ row ) ) { $ this -> connection -> insert ( 'fusio_user_attribute' , [ 'user_id' => $ userId , 'name' => $ name , ... | Sets a specific user attribute |
59,419 | private function getSubmittedVersionNumber ( RequestInterface $ request ) { $ accept = $ request -> getHeader ( 'Accept' ) ; $ matches = array ( ) ; preg_match ( '/^application\/vnd\.([a-z.-_]+)\.v([\d]+)\+([a-z]+)$/' , $ accept , $ matches ) ; return isset ( $ matches [ 2 ] ) ? $ matches [ 2 ] : null ; } | Returns the version number which was submitted by the client in the accept header field |
59,420 | private function parseTxt ( $ txt ) { $ result = [ ] ; $ lines = array_map ( 'trim' , mb_split ( '\r\n|\n|\r' , $ txt ) ) ; foreach ( $ lines as $ key => $ line ) { $ line = mb_substr ( $ line , 0 , self :: MAX_LENGTH_RULE ) ; $ line = explode ( '#' , $ line , 2 ) [ 0 ] ; $ result [ ] = $ this -> parseLine ( $ line ) ;... | Client robots . txt |
59,421 | public function accessOverride ( ) { if ( strpos ( $ this -> scheme , 'http' ) === 0 ) { switch ( floor ( $ this -> code / 100 ) * 100 ) { case 300 : case 400 : return self :: DIRECTIVE_ALLOW ; case 500 : return self :: DIRECTIVE_DISALLOW ; } } return false ; } | Check if the code overrides the robots . txt file |
59,422 | protected function prepare_form_data ( ) { $ this -> data = [ ] ; foreach ( $ this -> fields as $ field ) { $ this -> data [ $ field -> get_id ( ) ] = $ field -> get_value ( ) ; } } | Prepare data from the storage . |
59,423 | protected function make_fields_validation ( ) { foreach ( $ this -> fields as $ key => $ field ) { if ( $ this -> maybe_skip_field ( $ field ) ) { continue ; } if ( $ rules = $ field -> get_option ( 'validate' ) ) { $ attributes = ( new Rules_Parser ( $ field ) ) -> parse ( $ rules ) ; $ field -> set_attribute ( $ attr... | HTML5 validation attributes based on validate . |
59,424 | protected function resolve_flash_errors ( $ name ) { if ( ! $ this -> session ) { return ; } if ( ! $ this -> session -> get ( $ name ) instanceof WP_Error ) { return ; } $ this -> errors = new WP_Error ; $ errors = $ this -> session -> get ( $ name ) ; foreach ( $ errors -> errors as $ key => $ error ) { $ this -> add... | Resolve flash errors for the display . |
59,425 | protected function fill_old_values ( ) { if ( ! $ this -> session ) { return ; } if ( 0 === count ( ( array ) $ this -> session -> get_old_input ( ) ) ) { return ; } foreach ( $ this -> fields as $ key => $ field ) { if ( ! is_null ( $ old = $ this -> session -> get_old_input ( $ key ) ) ) { $ field -> set_value ( $ ol... | Fill old input values . |
59,426 | protected function prepare_submitted_data ( $ fields , array $ data , $ clear_missing ) { $ submitted = [ ] ; foreach ( $ fields as $ field ) { if ( $ this -> maybe_skip_field ( $ field ) ) { continue ; } $ value = array_key_exists ( $ field -> get_id ( ) , $ data ) ? $ data [ $ field -> get_id ( ) ] : null ; if ( fals... | Returns submitted data from input . |
59,427 | protected function get_group_values ( Field_Contract $ group , $ data ) { if ( ! $ group -> is_group ( ) || ! $ group -> get_option ( 'fields' ) ) { return null ; } if ( ! is_array ( $ data ) ) { return null ; } $ group = clone $ group ; $ i = 0 ; $ values = [ ] ; foreach ( array_values ( $ data ) as $ _data ) { if ( !... | Gets values of a group with given data . |
59,428 | protected function maybe_skip_field ( Field_Contract $ field ) { if ( in_array ( $ field -> get_type ( ) , static :: $ skip_proccess_types ) ) { return true ; } if ( $ field -> is_disabled ( ) || false === $ field -> get_option ( 'save_field' , true ) ) { return true ; } $ id = $ field -> get_id ( ) ; if ( $ group = $ ... | Check if given field is skipped in the process . |
59,429 | protected function get_validate_rules ( ) { $ rules = [ ] ; foreach ( $ this -> fields as $ key => $ field ) { if ( 'group' === $ field -> get_type ( ) ) { continue ; } if ( $ rule = $ field -> get_option ( 'validate' ) ) { $ key = $ field -> is_repeatable ( ) ? $ key . '.*' : $ key ; $ rules [ $ key ] = $ rule ; } } r... | Returns the validator rules . |
59,430 | protected function validate_use_validator ( array $ data , array $ rules ) { if ( empty ( $ rules ) ) { return ; } $ validator = new Validator ( $ data , $ rules ) ; $ validator -> labels ( $ this -> fields -> pluck ( 'name' , 'id' ) -> all ( ) ) ; if ( $ validator -> fails ( ) ) { foreach ( $ rules as $ key => $ rule ... | Validate fields use validate parameter . |
59,431 | protected function validate_by_callbacks ( array $ data , array $ callbacks ) { foreach ( $ callbacks as $ key => $ callback ) { $ validity = new WP_Error ; $ value = array_key_exists ( $ key , $ data ) ? $ data [ $ key ] : null ; $ callback ( $ validity , $ value ) ; if ( is_wp_error ( $ validity ) && count ( $ validi... | Validate fields use validate_cb parameter . |
59,432 | public function has_error ( $ key ) { return $ this -> errors && array_key_exists ( $ key , $ this -> errors -> errors ) && count ( $ this -> errors -> errors [ $ key ] ) > 0 ; } | Determnies if given field has any errors . |
59,433 | public function isPreferred ( ) { if ( ( $ host = $ this -> export ( ) ) === null ) { return $ this -> base === $ this -> effective ; } $ parsed = parse_url ( $ host ) ; $ new = [ 'scheme' => isset ( $ parsed [ 'scheme' ] ) ? $ parsed [ 'scheme' ] : parse_url ( $ this -> base , PHP_URL_SCHEME ) , 'host' => isset ( $ pa... | Is preferred host? |
59,434 | public function getWithUriFallback ( ) { if ( ( $ get = $ this -> export ( ) ) !== null ) { return $ get ; } elseif ( $ this -> base !== $ this -> effective && parse_url ( $ this -> base , PHP_URL_HOST ) === ( $ host = parse_url ( $ this -> effective , PHP_URL_HOST ) ) ) { return getservbyname ( $ scheme = parse_url ( ... | Get Host falls back to Effective Request URI if not found |
59,435 | public function get_new_storage ( $ id , $ object_type = null ) { $ id = $ id ? : $ this -> context -> get_object_id ( ) ; return new Metadata_Storage ( $ id , $ object_type ? : $ this -> mb_object_type ( ) ) ; } | Returns new storage . |
59,436 | public function convertToFull ( $ fallbackBase ) { $ this -> encode ( ) ; if ( $ this -> validate ( ) ) { return $ this -> uri ; } elseif ( strpos ( $ this -> uri , '/' ) === 0 ) { $ relative = $ this -> uri ; $ this -> uri = $ fallbackBase ; return $ this -> base ( ) . $ relative ; } throw new \ InvalidArgumentExcepti... | Convert relative to full |
59,437 | private function baseToLowercase ( ) { if ( ( $ host = parse_url ( $ this -> uri , PHP_URL_HOST ) ) === null ) { return $ this -> uri ; } $ pos = strpos ( $ this -> uri , $ host ) + strlen ( $ host ) ; return $ this -> uri = substr_replace ( $ this -> uri , strtolower ( substr ( $ this -> uri , 0 , $ pos ) ) , 0 , $ po... | Base uri to lowercase |
59,438 | public function validateIP ( $ ipAddress = null ) { if ( $ ipAddress === null ) { $ parsed = parse_url ( $ this -> uri ) ; $ ipAddress = isset ( $ parsed [ 'host' ] ) ? $ parsed [ 'host' ] : null ; } return ( filter_var ( $ ipAddress , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ) || filter_var ( trim ( $ ipAddress , '[]' ) ... | Validate IPv4 or IPv6 |
59,439 | public function getMethod ( $ routeId , $ version , $ method ) { if ( $ version == '*' || empty ( $ version ) ) { $ version = $ this -> methodTable -> getLatestVersion ( $ routeId ) ; } else { $ version = $ this -> methodTable -> getVersion ( $ routeId , $ version ) ; } if ( empty ( $ version ) ) { throw new StatusCode... | Returns the method configuration for the provide route version and request method |
59,440 | protected function apply_current_section ( Form $ form ) { if ( count ( $ this -> sections ) === 0 ) { return ; } foreach ( $ this -> sections as $ section ) { $ section -> options [ 'active' ] = false ; } $ current = $ this -> current_section_in_cookie ( $ form -> get_id ( ) ) ; if ( ! $ current && $ form -> get_confi... | Set the current section . |
59,441 | protected function current_section_in_cookie ( $ id ) { if ( empty ( $ _COOKIE [ '_wplibs_current_sections' ] ) ) { return null ; } $ currents = json_decode ( sanitize_text_field ( wp_unslash ( $ _COOKIE [ '_wplibs_current_sections' ] ) ) , true ) ; if ( array_key_exists ( $ id , $ currents ) ) { return $ currents [ $ ... | Resolve current section from the cookie . |
59,442 | protected function prepare_fields ( Form $ form ) { foreach ( $ form -> all ( ) as $ field ) { if ( ! $ field -> should_show ( ) ) { return ; } $ _section = $ field -> get_option ( 'section' ) ; if ( ! $ _section || ! isset ( $ this -> sections [ $ _section ] ) ) { continue ; } $ this -> sections [ $ _section ] -> fiel... | Maps fields into their section . |
59,443 | protected function prepare_sections ( ) { $ this -> sections = wp_list_sort ( $ this -> sections , [ 'priority' => 'ASC' , 'instance_number' => 'ASC' , ] , 'ASC' , true ) ; $ sections = [ ] ; foreach ( $ this -> sections as $ section ) { if ( ! $ section -> check_capabilities ( ) ) { continue ; } if ( ! $ this instance... | Prepare the sections . |
59,444 | protected function prepare_panels ( ) { if ( ! $ this instanceof Has_Panel ) { return ; } $ this -> panels = wp_list_sort ( $ this -> panels ( ) , [ 'priority' => 'ASC' , 'instance_number' => 'ASC' , ] , 'ASC' , true ) ; $ panels = [ ] ; foreach ( $ this -> panels ( ) as $ panel ) { if ( ! $ panel -> check_capabilities... | Prepare the panels . |
59,445 | protected function getLocale ( ? string $ expectedLocale ) { return $ expectedLocale ?? ( null === $ this -> request ? $ this -> defaultLocale : $ this -> request -> getLocale ( ) ) ; } | Always get a locale even if we are not in a request . |
59,446 | public function add_section ( $ id , $ args = [ ] ) { $ section = $ this -> manager -> add_section ( $ id , $ args ) ; $ section -> panel = $ this -> id ; return $ section ; } | Add a section into this panel . |
59,447 | private function convertEncoding ( ) { $ convert = new EncodingHandler ( $ this -> content , $ this -> encoding ) ; if ( ( $ result = $ convert -> auto ( ) ) !== false ) { $ this -> encoding = self :: ENCODING ; mb_internal_encoding ( self :: ENCODING ) ; return $ this -> content = $ result ; } mb_internal_encoding ( s... | Convert character encoding |
59,448 | public function userAgent ( $ product = self :: USER_AGENT , $ version = null ) { return $ this -> handler -> userAgent -> client ( $ product , $ version , $ this -> statusCode ) ; } | User - agent specific rules |
59,449 | public function attributes ( $ attributes , $ merge_global = false ) { if ( $ merge_global && count ( $ this -> global_attributes ) > 0 ) { $ attributes = $ attributes + $ this -> global_attributes ; } return Utils :: build_html_attributes ( $ attributes ) ; } | Create an HTML attribute string from an array . |
59,450 | protected function set_textarea_size ( $ options ) { if ( isset ( $ options [ 'size' ] ) ) { list ( $ cols , $ rows ) = explode ( 'x' , $ options [ 'size' ] ) ; } else { $ cols = Arr :: get ( $ options , 'cols' , 50 ) ; $ rows = Arr :: get ( $ options , 'rows' , 10 ) ; } return array_merge ( $ options , compact ( 'cols... | Set the text area size on the attributes . |
59,451 | protected function get_checkbox_checked_state ( $ name , $ value , $ checked ) { $ request = $ this -> request ( $ name ) ; if ( ! $ request && null !== $ this -> session && ! $ this -> old_input_is_empty ( ) && is_null ( $ this -> old ( $ name ) ) ) { return false ; } if ( $ this -> missing_old_and_model ( $ name ) &&... | Get the check state for a checkbox input . |
59,452 | protected function missing_old_and_model ( $ name ) { return ( is_null ( $ this -> old ( $ name ) ) && is_null ( $ this -> get_model_value_attribute ( $ name ) ) ) ; } | Determine if old input or model input exists for a key . |
59,453 | protected function request ( $ name ) { if ( ! $ this -> consider_request || ! $ this -> request ) { return null ; } return $ this -> request -> input ( $ this -> transform_key ( $ name ) ) ; } | Get value from current Request |
59,454 | public function set_group ( Field $ group ) { $ this -> group = $ group ; $ this -> form = $ this -> group -> get_form ( ) ; $ this -> storage = $ this -> group -> get_storage ( ) ; return $ this ; } | Sets the group field instance . |
59,455 | public function js_data ( $ field ) { $ value = $ field -> get_value ( ) ; $ attachment = [ ] ; if ( ! $ value && $ _default = $ field -> get_default ( ) ) { $ type = in_array ( substr ( $ _default , - 3 ) , [ 'jpg' , 'png' , 'gif' , 'bmp' ] ) ? 'image' : 'document' ; $ attachment = [ 'id' => 1 , 'url' => $ _default , ... | Returns field data for the JS . |
59,456 | public function get_button_labels ( ) { $ mime_type = ! empty ( $ this -> mime_type ) ? strtok ( ltrim ( $ this -> mime_type , '/' ) , '/' ) : 'default' ; switch ( $ mime_type ) { case 'video' : return [ 'select' => esc_html__ ( 'Select video' , 'wplibs-form' ) , 'change' => esc_html__ ( 'Change video' , 'wplibs-form' ... | Get the button labels . |
59,457 | public static function get_system_fonts ( ) { $ fonts = [ ] ; foreach ( static :: $ websafe_fonts as $ label => $ family ) { $ fonts [ ] = [ 'family' => $ family , 'label' => $ label , 'variants' => [ '400' , '400italic' , '700' , '700italic' ] , ] ; } return apply_filters ( 'suru_libs_system_fonts' , $ fonts ) ; } | Gets list system fonts . |
59,458 | public static function get_google_fonts ( ) { $ google_fonts = get_transient ( '_suru_libs_google_fonts' ) ; if ( ! is_array ( $ google_fonts ) || empty ( $ google_fonts ) ) { $ google_fonts = json_decode ( file_get_contents ( dirname ( dirname ( __DIR__ ) ) . '/Resources/webfonts.json' ) , true ) ; static :: set_trans... | Gets the Google Fonts . |
59,459 | public static function fetch_google_fonts ( $ api_key = null ) { $ raw_fonts = static :: request_google_fonts ( $ api_key ) ; if ( ! is_array ( $ raw_fonts ) || ! isset ( $ raw_fonts [ 'items' ] ) ) { return [ ] ; } $ fonts = [ ] ; foreach ( $ raw_fonts [ 'items' ] as $ item ) { if ( ! isset ( $ item [ 'kind' ] ) || 'w... | Get list of fonts from Google Fonts . |
59,460 | public static function request_google_fonts ( $ api_key = null ) { $ api_key = apply_filters ( 'suru_libs_google_fonts_api_keys' , $ api_key ) ; if ( empty ( $ api_key ) ) { return false ; } $ response = wp_remote_get ( static :: GOOGLE_FONTS_ENDPOINT . '?sort=alpha' . ( $ api_key ? "&key={$api_key}" : '' ) , [ 'sslver... | Send http request to get fonts from Google Fonts service . |
59,461 | public function read ( ) { $ data = get_option ( $ this -> name , [ ] ) ; $ this -> data = is_array ( $ data ) ? $ data : [ ] ; } | Read data from storage . |
59,462 | public function save ( ) { if ( empty ( $ this -> data ) ) { return delete_option ( $ this -> name ) ; } $ updated = update_option ( $ this -> name , $ this -> data , $ this -> autoload ) ; $ this -> read ( ) ; return $ updated ; } | Save data to the storage . |
59,463 | public function prepare_new_row ( ) { $ this -> field = [ ] ; $ this -> setup_fields ( ) ; $ values = $ this -> get_value ( ) ; Dependency :: check ( $ this -> fields , isset ( $ values [ $ this -> index ] ) ? ( array ) $ values [ $ this -> index ] : [ ] ) ; } | Setup group for a new row . |
59,464 | protected function setup_fields ( ) { foreach ( $ this -> prop ( 'fields' ) as $ args ) { $ field = $ this -> builder -> get_field ( $ args , $ this ) -> set_option ( 'context' , $ this -> args ( 'context' ) ) -> initialize ( ) ; if ( ! $ field -> check_capabilities ( ) ) { continue ; } if ( 'hidden' === $ args [ 'type... | Setup field in the group . |
59,465 | public function parse ( $ source ) { $ resolver = new RefResolver ( ) ; if ( $ this -> connection !== null ) { $ resolver -> addResolver ( 'schema' , new Resolver ( $ this -> connection ) ) ; } $ parser = new JsonSchema ( null , $ resolver ) ; $ schema = $ parser -> parse ( $ source ) ; return Service \ Schema :: seria... | Parses and resolves the json schema source and returns the object presentation of the schema |
59,466 | public function setCredentials ( $ username , $ password ) { $ this -> username = $ username ; $ this -> password = $ password ; $ this -> token = '' ; $ this -> accessToken = '' ; return $ this ; } | Set username and password for authentication |
59,467 | public function setToken ( $ token ) { $ this -> token = $ token ; $ this -> username = '' ; $ this -> password = '' ; $ this -> accessToken = '' ; return $ this ; } | Set simple token for authentication |
59,468 | public function setAccessToken ( $ accessToken ) { $ this -> accessToken = $ accessToken ; $ this -> username = '' ; $ this -> password = '' ; $ this -> token = '' ; return $ this ; } | Set access token for OAuth2 authentication |
59,469 | public function createApplicationFromRepo ( $ source , $ options = array ( ) ) { $ options = array_merge ( $ options , array ( 'create_method' => 'remote_repo' , 'repo' => $ source , ) ) ; return $ this -> createApplication ( $ options ) ; } | Create application using GitHub repository |
59,470 | public function createApplicationFromFile ( $ source , $ options = array ( ) ) { $ options = array_merge ( $ options , array ( 'create_method' => 'file' , 'file' => $ this -> file ( $ source ) , ) ) ; return $ this -> createApplication ( $ options ) ; } | Create application from file |
59,471 | public function updateApplicationFromRepo ( $ applicationId , $ options = array ( ) ) { $ options = array_merge ( $ options , array ( 'pull' => true , ) ) ; return $ this -> updateApplication ( $ applicationId , $ options ) ; } | Update application from GitHub repository |
59,472 | public function updateApplicationFromFile ( $ applicationId , $ source , $ options = array ( ) ) { $ options = array_merge ( $ options , array ( 'file' => $ this -> file ( $ source ) , ) ) ; return $ this -> updateApplication ( $ applicationId , $ options ) ; } | Update application from file |
59,473 | public function updateApplicationIcon ( $ applicationId , $ source ) { $ options [ 'icon' ] = $ this -> file ( $ source ) ; return $ this -> request ( array ( 'apps' , $ applicationId , 'icon' ) , 'post' , $ options ) ; } | Update application icon |
59,474 | public function buildApplication ( $ applicationId , $ platforms = array ( ) ) { $ options = array ( ) ; if ( ! empty ( $ platforms ) ) { if ( ! is_array ( $ platforms ) ) { $ platforms = array ( $ platforms ) ; } $ options [ 'platforms' ] = $ platforms ; } return $ this -> request ( array ( 'apps' , $ applicationId , ... | Start building application |
59,475 | public function addKeyAndroid ( $ title , $ keystore , $ options = array ( ) ) { $ defaults = array ( 'title' => $ title , 'keystore' => $ this -> file ( $ keystore ) , ) ; $ options = array_merge ( $ defaults , $ options ) ; return $ this -> addKeyPlatform ( self :: ANDROID , $ options ) ; } | Add key for android |
59,476 | public function addKeyIos ( $ title , $ cert , $ profile , $ options = array ( ) ) { $ defaults = array ( 'title' => $ title , 'cert' => $ this -> file ( $ cert ) , 'profile' => $ this -> file ( $ profile ) , ) ; $ options = array_merge ( $ defaults , $ options ) ; return $ this -> addKeyPlatform ( self :: IOS , $ opti... | Add key for ios |
59,477 | protected function assocToString ( $ array , $ keyValueSeparator = ' - ' , $ pairSeparator = '; ' ) { if ( ! is_array ( $ array ) ) { return print_r ( $ array , true ) ; } foreach ( $ array as $ key => & $ value ) { $ value = $ key . $ keyValueSeparator . $ value ; } return implode ( $ pairSeparator , $ array ) ; } | Represent associative array as string |
59,478 | private function resolveActionsFromRoutes ( array $ data , $ basePath ) { $ actions = [ ] ; $ type = SystemAbstract :: TYPE_ROUTES ; if ( isset ( $ data [ $ type ] ) && is_array ( $ data [ $ type ] ) ) { foreach ( $ data [ $ type ] as $ name => $ row ) { $ row = IncludeDirective :: resolve ( $ row , $ basePath , $ type... | In case the routes contains a class as action we automatically create a fitting action entry |
59,479 | public function clean ( ) { $ delay = self :: OUT_OF_SYNC_TIME_LIMIT ; $ query = $ this -> pdo -> prepare ( <<<SQLDELETE FROM robotstxt__delay0WHERE delayUntil < ((UNIX_TIMESTAMP() - :delay) * 1000000);SQL ) ; $ query -> bindValue ( 'delay' , $ delay , \ PDO :: PARAM_INT ) ; return $ query -> execute ( ) ; } | Clean the delay table |
59,480 | public function getTopWaitTimes ( $ limit = self :: TOP_X_LIMIT , $ minDelay = self :: TOP_X_MIN_DELAY ) { $ query = $ this -> pdo -> prepare ( <<<SQLSELECT base, userAgent, delayUntil / 1000000 AS delayUntil, lastDelay / 1000000 AS lastDelayFROM robotstxt__delay0WHERE delayUntil > ((UNIX_TIMESTAMP(CURTIME(6)) + :m... | Top X wait time |
59,481 | public function onVichUploaderPreUpload ( Event $ event ) { $ media = $ event -> getObject ( ) ; $ this -> checkIfThereIsAName ( $ media ) ; $ this -> checkIfNameEverExistInDatabase ( $ media ) ; $ this -> checkIfFileLocationIsChanging ( $ media ) ; } | Check if name exist . |
59,482 | public function onVichUploaderPostUpload ( Event $ event ) { $ object = $ event -> getObject ( ) ; $ mapping = $ event -> getMapping ( ) ; $ absoluteDir = $ mapping -> getUploadDestination ( ) . '/' . $ mapping -> getUploadDir ( $ object ) ; $ relativeDir = substr_replace ( $ absoluteDir , '' , 0 , strlen ( $ this -> p... | Update RelativeDir . |
59,483 | public function nav ( $ nav_class = '' ) { echo '<ul role="tablist" class="wplibs-box__nav ' . esc_attr ( $ nav_class ) . '">' ; foreach ( $ this -> sections ( ) as $ section ) { echo $ section -> navlink ( ) ; } echo '</ul><!-- /.wplibs-box__nav ; } | Output the navigation . |
59,484 | public function main ( $ main_class = '' ) { if ( count ( $ containers = $ this -> containers ( ) ) > 0 ) { echo '<main class="wplibs-box__container ' . esc_attr ( $ main_class ) . '">' ; $ this -> show_sections ( $ containers ) ; echo '</main>' ; } else { $ this -> show_fields ( $ this -> get_form ( ) -> all ( ) ) ; }... | Output the main sections and fields . |
59,485 | public function navlink ( ) { $ attributes = [ 'role' => 'tab' , 'aria-controls' => $ this -> uniqid ( ) , 'data-section' => $ this -> id , 'data-open' => ! empty ( $ this -> options [ 'active' ] ) ? 'true' : 'false' , ] ; return sprintf ( '<li%1$s><a href="#" aria-expanded="false">%3$s <span>%2$s</span></a></li>' , Ut... | Returns the nav - link of the section . |
59,486 | public function output ( ) { if ( ! $ form = $ this -> manager -> get_form ( ) ) { _doing_it_wrong ( __FUNCTION__ , 'Cannot output the section until the form is created' , null ) ; return ; } $ attributes = [ 'role' => 'tabpanel' , 'id' => $ this -> uniqid ( ) , 'aria-hidden' => ! empty ( $ this -> options [ 'active' ]... | Output the section content . |
59,487 | private function newAction ( $ class , $ engine ) { if ( ! class_exists ( $ engine ) ) { throw new StatusCode \ BadRequestException ( 'Could not resolve engine' ) ; } try { $ action = $ this -> actionFactory -> factory ( $ class , $ engine ) ; } catch ( FactoryResolveException $ e ) { throw new StatusCode \ BadRequestE... | Checks whether the provided class is resolvable and returns an action instance |
59,488 | public function set_object_type ( $ object_type ) { if ( ! in_array ( $ object_type , $ supported = [ 'user' , 'comment' , 'term' , 'post' ] ) ) { _doing_it_wrong ( __FUNCTION__ , 'The object type must be one of: ' . implode ( ', ' , $ supported ) , null ) ; } $ this -> object_type = $ object_type ; return $ this ; } | Sets the current object type . |
59,489 | public static function guest_object_id ( $ object_id = 0 , $ object_type = null ) { global $ pagenow ; if ( is_null ( $ object_type ) ) { $ object_type = static :: guest_object_type ( ) ; } switch ( $ object_type ) { case 'user' : $ object_id = isset ( $ _REQUEST [ 'user_id' ] ) ? sanitize_text_field ( wp_unslash ( $ _... | Guest the object ID from global space . |
59,490 | public function get_form ( ) { $ this -> throws_if_locked ( 'access' ) ; $ form = new Form ( $ this -> get_form_config ( ) ) ; foreach ( $ this -> prop ( 'fields' ) as $ args ) { $ form -> add ( $ this -> get_field ( $ args ) -> initialize ( ) ) ; } if ( $ this -> get_auto_initialize ( ) ) { $ form -> initialize ( ) ; ... | Creates the form . |
59,491 | public function get_html_builder ( ) { if ( ! $ this -> html_builder ) { $ this -> html_builder = new Html_Form ( ) ; } $ this -> html_builder -> global_attributes ( array_merge ( ( array ) $ this -> field -> args ( 'attributes' ) , [ 'data-hash' => $ this -> field -> hash_id ( ) , 'data-iterator' => $ this -> field ->... | Gets the html form builder helper . |
59,492 | public function _input_id ( $ suffix = '' ) { return $ this -> field -> id ( ) . $ suffix . ( $ this -> field -> is_repeatable ( ) ? '_' . $ this -> iterator : '' ) ; } | Generate the ID attribute . |
59,493 | public function cacheDelay ( ) { return $ this -> handler -> cacheDelay -> client ( $ this -> product , $ this -> crawlDelay ( ) -> getValue ( ) ) ; } | Cache - delay |
59,494 | public function requestRate ( ) { return $ this -> handler -> requestRate -> client ( $ this -> product , $ this -> crawlDelay ( ) -> getValue ( ) ) ; } | RequestClient - rate |
59,495 | public function numberOfDays ( ) { if ( self :: APRIL === $ this -> month || self :: JUNE === $ this -> month || self :: SEPTEMBER === $ this -> month || self :: NOVEMBER === $ this -> month ) { return 30 ; } if ( self :: FEBRURY === $ this -> month ) { return $ this -> year -> isLeap ( ) ? 29 : 28 ; } return 31 ; } | Gets the number of days in this month . |
59,496 | public function startDay ( ) { $ dateString = sprintf ( '%04d-%02d-01' , $ this -> year -> value ( ) , $ this -> month ) ; $ datetime = new \ DateTime ( $ dateString ) ; return ( int ) $ datetime -> format ( 'N' ) ; } | Returns the day of the week that the 1st of this month is on . |
59,497 | private function checkOverride ( $ uri ) { if ( parse_url ( $ uri , PHP_URL_PATH ) === self :: PATH ) { return self :: DIRECTIVE_ALLOW ; } $ statusCodeParser = new StatusCodeParser ( $ this -> statusCode , parse_url ( $ this -> base , PHP_URL_SCHEME ) ) ; if ( ( $ result = $ statusCodeParser -> accessOverride ( ) ) !==... | Check for overrides |
59,498 | protected function createConnection ( TableMap $ tableMap ) { $ this -> con = Propel :: getConnection ( $ tableMap :: DATABASE_NAME ) ; $ this -> con -> beginTransaction ( ) ; if ( method_exists ( $ this -> con , 'useDebug' ) ) { Logger :: log ( 'Enabling debug queries mode' , LOG_INFO ) ; $ this -> con -> useDebug ( C... | Initialize db connection |
59,499 | protected function closeTransaction ( $ status ) { if ( null !== $ this -> con ) { $ this -> traceDebugQuery ( ) ; if ( null !== $ this -> con && $ this -> con -> inTransaction ( ) ) { if ( $ status === 200 ) { $ this -> con -> commit ( ) ; } else { $ this -> con -> rollBack ( ) ; } } Propel :: closeConnections ( ) ; }... | Close transactions if are requireds |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.