idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
14,500 | public static function get_asset_url ( $ file ) { if ( static :: $ manifest === null ) { static :: parse_manifest ( ) ; } if ( static :: $ manifest === null || ! isset ( static :: $ manifest [ $ file ] ) ) { return get_stylesheet_directory_uri ( ) . '/public' . $ file ; } return get_stylesheet_directory_uri ( ) . '/pub... | Retrieves a filename public URL with Webpack version ID if present . |
14,501 | public static function get_path_to_partial ( $ partial ) : string { $ partial = \ str_replace ( [ '.php' , '.' ] , [ '' , '/' ] , $ partial ) ; $ path = \ trailingslashit ( Config :: get ( 'theme.templates_directory' ) ) . 'partials/' . $ partial . '.php' ; return $ path ; } | Transforms a partial name and returns the path to the partial relative to theme root . |
14,502 | public static function get_post_templates_path ( $ post_template ) : string { $ template = \ str_replace ( [ '.php' , '.' ] , [ '' , '/' ] , $ post_template ) ; return \ trailingslashit ( Config :: get ( 'theme.templates_directory' ) ) . 'views/post-templates/' . $ template . '.php' ; } | Returns the full include path for a given post template . |
14,503 | private static function parse_manifest ( ) { $ manifest_path = get_stylesheet_directory ( ) . '/public/mix-manifest.json' ; if ( \ file_exists ( $ manifest_path ) ) { $ manifest = \ file_get_contents ( $ manifest_path ) ; static :: $ manifest = ( array ) \ json_decode ( $ manifest ) ; } } | Parse the contents of mix - manifest . json and store as array . |
14,504 | public static function is_external_url ( $ url ) { if ( \ parse_url ( $ url , PHP_URL_HOST ) === Request :: get_host ( ) ) { return false ; } if ( \ strpos ( $ url , "/" ) === 0 ) { return false ; } return true ; } | Check if a URL is off - site or not . |
14,505 | public static function bindTranslator ( $ app ) { static :: bindLoader ( $ app ) ; $ app -> singleton ( 'translator' , function ( $ app ) { $ trans = new Translator ( $ app [ 'translation.loader' ] , $ app [ 'config' ] [ 'app.locale' ] ) ; $ trans -> setFallback ( $ app [ 'config' ] [ 'app.fallback_locale' ] ) ; return... | Bind the translator with app or ioc container . |
14,506 | static function get ( $ template ) { $ ext = pathinfo ( basename ( $ template ) , PATHINFO_EXTENSION ) ; return static :: getEngines ( ) -> get ( $ ext ) ; } | Returns the engine class for the given path |
14,507 | static function create ( $ source , $ options = array ( ) , $ callback = null ) { return static :: getEngines ( ) -> create ( $ source , $ options , $ callback ) ; } | Creates a engine instance for the given template path |
14,508 | public function handler ( ) { if ( $ this -> allow_public_access ) { Container :: resolve_method ( $ this , 'handle' ) ; return ; } if ( empty ( $ this -> restrict_to_roles ) || \ in_array ( User_Utils :: get_user_role ( ) -> name , $ this -> restrict_to_roles ) ) { Container :: resolve_method ( $ this , 'handle' ) ; r... | Auto - wire and call the child class s handle method . |
14,509 | private function getRegisteredQuoteByUniqueKey ( $ custId , $ stockId ) { $ result = null ; $ byCustId = EWrhsQuote :: A_CUST_REF . '=' . ( int ) $ custId ; $ byStockId = EWrhsQuote :: A_STOCK_REF . '=' . ( int ) $ stockId ; $ where = "($byCustId) AND ($byStockId)" ; $ rs = $ this -> daoWrhsQuote -> get ( $ where ) ; i... | Get quote from registry by unique key . |
14,510 | private function setQuotesAllInactive ( $ custId ) { $ bind = [ Cfg :: E_QUOTE_A_IS_ACTIVE => false ] ; $ where = Cfg :: E_QUOTE_A_CUSTOMER_ID . '=' . ( int ) $ custId ; $ this -> daoGeneric -> updateEntity ( Cfg :: ENTITY_MAGE_QUOTE , $ bind , $ where ) ; } | Set all customer quotes as inactive . |
14,511 | private function getMetaModelById ( $ metaModelId ) { $ name = $ this -> factory -> translateIdToMetaModelName ( $ metaModelId ) ; return $ this -> factory -> getMetaModel ( $ name ) ; } | Get the metamodel by it s id . |
14,512 | public function getControlHandler ( ) { if ( $ this -> _controlHandler === null ) { if ( $ this -> hasLocator ( ) && $ this -> getLocator ( ) -> has ( $ this -> _controlHandlerServiceId ) ) { $ this -> _controlHandler = $ this -> getLocator ( ) -> get ( $ this -> _controlHandlerServiceId ) ; if ( ! $ this -> _controlHa... | Get the pagination control handler |
14,513 | public function setCurrentPage ( $ page ) { $ this -> _currentPage = ( int ) $ page ; if ( $ this -> _currentPage < 1 ) { throw new RuntimeException ( 'Page number can\'t be zero or negative' ) ; } $ this -> reset ( ) ; return $ this ; } | Set the current page number |
14,514 | public function getPagesNumber ( ) { if ( $ this -> _entirePagesNumber === null ) { $ this -> _entirePagesNumbe = ( int ) ceil ( $ this -> getAdapter ( ) -> count ( ) / $ this -> _itemsPerPage ) ; } return $ this -> _entirePagesNumbe ; } | Get the entire pages number |
14,515 | public function getCurrentItems ( ) { if ( $ this -> _currentItems === null ) { $ offset = $ this -> _itemsPerPage * $ this -> _currentPage - $ this -> _itemsPerPage ; $ this -> _currentItems = $ this -> getAdapter ( ) -> getItems ( $ offset , $ this -> _itemsPerPage ) ; if ( ! $ this -> _currentItems instanceof Traver... | Get an items of the current page |
14,516 | private function resolveContext ( array $ context ) { $ defaultOptions = [ self :: OPTION_EXCEPTION_ON_INVALID_TYPE => $ this -> exceptionOnInvalidType , self :: OPTION_OBJECT => $ this -> object , self :: OPTION_OBJECT_FOR_MAP => $ this -> objectForMap , self :: OPTION_DATE_TIME => $ this -> dateTime , ] ; return arra... | Merges the default options of the Yaml Decoder with the passed context . |
14,517 | public static function get_widget_count ( $ sidebar_id ) { global $ _wp_sidebars_widgets ; if ( empty ( $ _wp_sidebars_widgets ) ) { $ _wp_sidebars_widgets = \ get_option ( 'sidebars_widgets' , [ ] ) ; } if ( isset ( $ _wp_sidebars_widgets [ $ sidebar_id ] ) ) { return \ count ( $ _wp_sidebars_widgets [ $ sidebar_id ] ... | Counts the number of widgets for a given sidebar ID . |
14,518 | public function writeRows ( iterable $ rows ) : void { foreach ( $ rows as $ row ) { $ this -> writeRow ( $ row ) ; } } | Write a list of rows to the stream . |
14,519 | public function writeRow ( iterable $ row ) : void { $ str = Csv :: dump ( $ row , $ this -> delimiter , $ this -> enclosure , $ this -> escape ) ; try { $ written = $ this -> stream -> write ( $ str ) ; } catch ( \ Throwable $ e ) { throw new \ RuntimeException ( 'Failed to write CSV row.' , 0 , $ e ) ; } if ( strlen ... | Write a row to the stream . |
14,520 | public function AddConstant ( \ Peg \ Lib \ Definitions \ Element \ Constant $ constant , $ namespace = "\\" ) { $ this -> CreateNamespace ( $ namespace ) ; $ constant -> header = & $ this ; $ constant -> namespace = & $ this -> namespaces [ $ namespace ] ; $ this -> namespaces [ $ namespace ] -> constants [ $ constant... | Adds a new constant . |
14,521 | public function AddGlobalVariable ( \ Peg \ Lib \ Definitions \ Element \ GlobalVariable $ global_variable , $ namespace = "\\" ) { $ this -> CreateNamespace ( $ namespace ) ; $ global_variable -> header = & $ this ; $ global_variable -> namespace = & $ this -> namespaces [ $ namespace ] ; $ this -> namespaces [ $ name... | Adds a new global variable . |
14,522 | public function AddFunction ( \ Peg \ Lib \ Definitions \ Element \ FunctionElement $ function , $ namespace = "\\" ) { $ this -> CreateNamespace ( $ namespace ) ; $ function -> header = & $ this ; $ function -> namespace = & $ this -> namespaces [ $ namespace ] ; $ this -> namespaces [ $ namespace ] -> functions [ $ f... | Adds a new function . |
14,523 | public function AddClass ( \ Peg \ Lib \ Definitions \ Element \ ClassElement $ class , $ namespace = "\\" ) { $ this -> CreateNamespace ( $ namespace ) ; $ class -> header = & $ this ; $ class -> namespace = & $ this -> namespaces [ $ namespace ] ; $ this -> namespaces [ $ namespace ] -> classes [ $ class -> name ] = ... | Adds a new class . |
14,524 | private function CreateNamespace ( & $ name ) { if ( $ name == "" ) $ name = "\\" ; if ( ! isset ( $ this -> namespaces [ $ name ] ) ) $ this -> namespaces [ $ name ] = new NamespaceElement ( $ name ) ; } | Adds a namespace to the namespaces array if not already listed . |
14,525 | protected function getLanguageNames ( $ language = null ) { $ event = new LoadLanguageFileEvent ( 'languages' , $ language , true ) ; $ this -> eventDispatcher -> dispatch ( ContaoEvents :: SYSTEM_LOAD_LANGUAGE_FILE , $ event ) ; return $ GLOBALS [ 'TL_LANG' ] [ 'LNG' ] ; } | Retrieve all language names in the given language . |
14,526 | protected function getLanguages ( ) { if ( null !== $ this -> languageCache ) { return $ this -> languageCache ; } $ loadedLanguage = $ this -> getMetaModel ( ) -> getActiveLanguage ( ) ; $ languageValues = $ this -> getLanguageNames ( $ loadedLanguage ) ; $ languages = $ this -> getRealLanguages ( ) ; $ keys = \ array... | Retrieve all language names . |
14,527 | private function addNeededFallbackLanguages ( $ keys , & $ aux , & $ real ) { $ loadedLanguage = $ this -> getMetaModel ( ) -> getFallbackLanguage ( ) ; $ fallbackValues = $ this -> getLanguageNames ( $ loadedLanguage ) ; foreach ( $ keys as $ key ) { if ( isset ( $ fallbackValues [ $ key ] ) ) { $ aux [ $ key ] = \ ut... | Add the fallback languages to the array . |
14,528 | public function set ( $ key , $ value , $ ttl ) { if ( $ this -> safe ) { return $ this -> memcache -> set ( $ key , $ value , false , $ ttl ) ; } return false ; } | Add a value to the memcache |
14,529 | public function addServer ( $ ip = '127.0.0.1' , $ port = 11211 ) { if ( ! $ this -> serverVerifier -> verify ( $ ip , $ port ) ) { return false ; } if ( $ status = $ this -> memcache -> addServer ( $ ip , $ port ) ) { $ this -> safe = true ; } return $ status ; } | Add a server to the memcache pool |
14,530 | public function setValidator ( $ validator , array $ options = null ) { if ( $ validator instanceof ZendValidatorInterface ) { $ this -> validator = $ validator ; } else if ( is_string ( $ validator ) ) { $ class = 'Zend_Validate_' . ucfirst ( $ validator ) ; if ( $ options === null ) { $ this -> validator = new $ clas... | Set Zend validator |
14,531 | public static function getTypeCodeFromObject ( $ value ) { if ( is_null ( $ value ) ) { return TypeCode :: Null_ ; } if ( is_array ( $ value ) ) { return TypeCode :: assocArray ; } if ( is_string ( $ value ) ) { return strlen ( $ value ) === 1 ? TypeCode :: Char : TypeCode :: String ; } if ( $ value instanceof DateTime... | Generated a type code value for a variable |
14,532 | public function assemble ( ) { $ descTag = new Tag ( 'meta' ) ; $ descTag -> setClosed ( ) ; $ descTag -> name = 'description' ; $ descTag -> content = $ this -> description ; return $ descTag -> render ( ) ; } | Assemble the description tag |
14,533 | private function findItemBySubject ( OrderInterface $ order , $ subject ) { return $ this -> findTransformedItem ( $ order , $ this -> itemHelper -> transform ( $ subject ) ) ; } | Finds the order item by subject . |
14,534 | private function findTransformedItem ( OrderInterface $ order , OrderItemInterface $ transformed ) { foreach ( $ order -> getItems ( ) as $ item ) { if ( $ item -> equals ( $ transformed ) ) { return $ item ; } } return null ; } | Finds the transformed item in the order . |
14,535 | private function synchronizeItems ( OrderItemInterface $ source , OrderItemInterface $ target ) { $ accessor = PropertyAccess :: createPropertyAccessor ( ) ; foreach ( array ( 'designation' , 'reference' , 'price' , 'weight' , 'tax' ) as $ property ) { $ value = $ accessor -> getValue ( $ source , $ property ) ; if ( $... | Synchronizes the items . |
14,536 | protected function performUpdate ( ? Session $ session , array $ payload ) { if ( $ session === null ) { throw new NullValueException ( 'Attempted to update null session' ) ; } return $ session -> updateExisting ( $ payload ) ; } | Perform an update operation on the session ID . |
14,537 | protected function getPayload ( string $ session_id , $ data ) : array { return [ 'id' => $ session_id , 'user_id' => $ this -> request -> user ( ) -> id ?? null , 'ipv4' => $ this -> getLongIp ( ) , 'user_agent' => $ this -> request -> server ( 'HTTP_USER_AGENT' ) , 'data' => base64_encode ( is_array ( $ data ) ? seri... | Get session payload |
14,538 | protected function readFromDatabase ( string $ session_id , $ ip ) : ? Model { return $ this -> getModel ( ) -> newQuery ( ) -> where ( 'id' , $ session_id ) -> where ( 'ipv4' , $ this -> getLongIp ( $ ip ) ) -> first ( ) ; } | Read session from database |
14,539 | protected function getLongIp ( $ ip = null ) : int { if ( $ ip === null ) { $ ip = $ this -> request -> getClientIp ( ) ; } return is_int ( $ ip ) ? $ ip : ip2long ( $ ip ) ; } | Get ip in long format |
14,540 | public function assignGroup ( $ group ) { if ( Group :: count ( ) === 0 ) { throw new \ Exception ( 'No groups have been created.' ) ; } return $ this -> groups ( ) -> save ( Group :: whereName ( $ group ) -> firstOrFail ( ) ) ; } | Assign the given group to the user . |
14,541 | public function hasGroup ( $ group ) { if ( is_string ( $ group ) ) { return $ this -> groups -> contains ( 'name' , $ group ) ; } return ! ! $ group -> intersect ( $ this -> groups ) -> count ( ) ; } | Determine if the user is inthe given group . |
14,542 | private function getService ( $ class ) { if ( ! array_key_exists ( $ class , $ this -> services ) ) { $ this -> services [ $ class ] = new $ class ( $ this -> getClient ( ) , $ this -> getLogger ( ) ) ; } return $ this -> services [ $ class ] ; } | Return service singleton . |
14,543 | public function allToPdf ( ) { $ attendances = $ this -> repository -> all ( ) ; $ pdf = \ App :: make ( 'dompdf.wrapper' ) ; $ view = \ View :: make ( 'attendance::pdf.attendances' ) -> with ( 'attendances' , $ attendances ) -> render ( ) ; $ pdf -> loadHTML ( $ view , $ attendances ) ; $ pdf -> output ( ) ; return $ ... | Convert all attendances to pdf |
14,544 | private static function route ( $ uri ) { $ result = $ uri ; $ routes = \ Application :: get ( 'routes' ) ; if ( empty ( $ routes ) ) $ routes = [ ] ; $ extra_routes = \ Object \ ACL \ Resources :: getStatic ( 'routes' ) ; if ( ! empty ( $ extra_routes ) ) { $ routes = array_merge ( $ routes , $ extra_routes ) ; } if (... | Routing allow re - routing |
14,545 | protected function setOptions ( array $ options ) { $ defaults = array_change_key_case ( $ this -> getDefaultOptions ( ) , CASE_UPPER ) ; $ options = array_change_key_case ( $ options , CASE_UPPER ) ; $ options = array_merge ( $ defaults , $ options ) ; if ( array_key_exists ( 'BASE_URI' , $ options ) ) { $ this -> bas... | Sets cURL options and headers for the current request |
14,546 | public function get ( $ url , array $ vars = [ ] ) { if ( ! empty ( $ vars [ 'form_params' ] ) ) { $ url .= '?' . http_build_query ( $ vars [ 'form_params' ] ) ; unset ( $ vars [ 'form_params' ] ) ; } return $ this -> call ( 'GET' , $ url , $ vars ) ; } | Sends GET request |
14,547 | protected function setMethod ( $ method ) { switch ( strtoupper ( $ method ) ) { case 'HEAD' : curl_setopt ( $ this -> request , CURLOPT_NOBODY , true ) ; break ; case 'GET' : curl_setopt ( $ this -> request , CURLOPT_HTTPGET , true ) ; break ; case 'POST' : curl_setopt ( $ this -> request , CURLOPT_POST , true ) ; bre... | Sets desired HTTP method |
14,548 | protected function prepareResponse ( $ response ) { $ header_size = curl_getinfo ( $ this -> request , CURLINFO_HEADER_SIZE ) ; $ headers = substr ( $ response , 0 , $ header_size ) ; $ body = substr ( $ response , $ header_size ) ; return [ $ headers , $ body ] ; } | Prepares the response for parsing |
14,549 | protected function setHeaders ( array $ headers = array ( ) ) { if ( count ( $ headers ) === 0 ) { return ; } $ this -> headers = array_merge ( $ this -> headers , $ headers ) ; $ curl_headers = [ ] ; $ curl_version = curl_version ( ) ; foreach ( $ this -> headers as $ key => $ value ) { $ curl_headers [ ] = $ key . ':... | Adds headers to the current request |
14,550 | public function actionGear ( ) { if ( ! \ Yii :: $ app -> user -> can ( 'gear' ) ) throw new ForbiddenHttpException ( Module :: t ( 'core' , 'Access denied.' ) ) ; $ model = new \ sergmoro1 \ blog \ models \ GearForm ( ) ; $ error = false ; if ( $ model -> load ( \ Yii :: $ app -> request -> post ( ) ) ) { $ syntax = n... | Gear or params . |
14,551 | public static function delegate ( $ flag , $ submodule , $ arguments ) { $ options = Application :: get ( $ flag . '.' . $ submodule . '.options' ) ; if ( ! empty ( $ options ) ) { $ arguments [ 0 ] = array_merge_hard ( $ options , $ arguments [ 0 ] ) ; } if ( Application :: get ( $ flag . '.' . $ submodule . '.submodu... | Delegate arguments to submodule |
14,552 | public static function method ( $ method , $ base_class = null , $ model = false , $ constructor_parameters = null ) { $ temp = explode ( '::' , $ method ) ; if ( count ( $ temp ) > 1 ) { $ temp_model = $ temp [ 0 ] ; $ temp_method = $ temp [ 1 ] ; } else { $ temp_model = $ base_class ; $ temp_method = $ temp [ 0 ] ; }... | Convert method string to an array for future execution |
14,553 | public function trigger ( $ event , $ target = null , $ args = [ ] ) { if ( $ this -> _profilerEnabled ) { $ profilerEvent = $ this -> getProfiler ( ) -> startEvent ( $ event ) ; } $ this -> fire ( $ event , $ target , $ args ) ; if ( $ this -> _profilerEnabled ) { $ profilerEvent -> stop ( ) ; } return $ this ; } | Trigger the event |
14,554 | public function check ( $ code ) { $ code = trim ( $ code ) ; if ( substr ( $ code , - 1 ) != ';' ) { $ this -> error = [ 'line' => ( substr_count ( $ code , "\n" ) + 1 ) , 'prev' => ']' , 'token' => ';' , 'must' => true ] ; return false ; } $ code = substr ( $ code , 0 , - 1 ) ; $ tokens = token_get_all ( $ code ) ; $... | Syntax check of a string . |
14,555 | public function validSequence ( $ prev , $ current ) { if ( in_array ( $ current , [ 'T_CONSTANT_ENCAPSED_STRING' , 'T_LNUMBER' , 'T_DNUMBER' ] ) ) return in_array ( $ prev , [ '[' , '(' , ',' , 'T_DOUBLE_ARROW' ] ) ; elseif ( $ current == 'T_DOUBLE_ARROW' ) return in_array ( $ prev , [ 'T_CONSTANT_ENCAPSED_STRING' , '... | Valid sequence check . |
14,556 | public static function sendHtmlEmail ( \ stdClass $ emailBody , \ stdClass $ to , \ stdClass $ from , \ stdClass $ replyTo , $ SMTPConfig = '' ) : bool { $ mail = new PHPMailer ; static :: setSMTPConfig ( $ mail , $ SMTPConfig ) ; $ mail -> Subject = $ emailBody -> subject ; $ mail -> MsgHTML ( $ emailBody -> messageBo... | Sends Html Email |
14,557 | public static function configure ( PHPMailer $ mail , \ stdClass $ configurations ) { $ mail -> isSMTP ( ) ; $ mail -> SMTPAuth = true ; $ mail -> Host = $ configurations -> host ?? '' ; $ mail -> Username = $ configurations -> username ?? '' ; $ mail -> Password = $ configurations -> password ?? '' ; $ mail -> SMTPSec... | Configures STMP Server |
14,558 | final public static function setSMTP ( string $ host , string $ username , string $ password , string $ SMTPSecure , int $ port ) : \ stdClass { return ( object ) $ SMTPConfig = [ 'host' => $ host , 'username' => $ username , 'password' => $ password , 'SMTPSecure' => $ SMTPSecure , 'port' => $ port ] ; } | Set SMTP configuration for email sending . |
14,559 | public function getStatus ( ) { $ status = self :: HTTP_INTERNAL_SERVER_ERROR ; if ( $ this -> getCode ( ) >= 400 && $ this -> getCode ( ) < 600 ) { $ status = $ this -> getCode ( ) ; } return $ status ; } | Get HTTP status code |
14,560 | public function createAdminMenu ( array $ options ) : ItemInterface { $ menu = $ this -> factory -> createItem ( 'root' ) ; $ event = new AdminMenuCollectionEvent ( $ menu ) ; $ this -> dispatcher -> dispatch ( AdminMenuCollectionEvent :: NAME , $ event ) ; return $ menu ; } | Create the admin menu . |
14,561 | public function createMainMenu ( array $ options ) : ItemInterface { $ menu = $ this -> factory -> createItem ( 'root' ) ; $ event = new MainMenuCollectionEvent ( $ menu ) ; $ this -> dispatcher -> dispatch ( MainMenuCollectionEvent :: NAME , $ event ) ; return $ menu ; } | Create the main menu . |
14,562 | public function createProductionMenu ( array $ options ) : ItemInterface { $ menu = $ this -> factory -> createItem ( 'root' ) ; if ( null === $ group = $ this -> group_context -> getContext ( ) ) { return $ menu ; } $ menu -> setLabel ( $ group -> getName ( ) ) ; $ menu -> setExtra ( 'translation_domain' , false ) ; $... | Create the production menu . |
14,563 | public function createUserMenu ( array $ options ) { $ menu = $ this -> factory -> createItem ( 'root' ) ; $ menu -> setLabel ( $ this -> token_storage -> getToken ( ) -> getUser ( ) -> __toString ( ) ) ; $ event = new UserMenuCollectionEvent ( $ menu ) ; $ this -> dispatcher -> dispatch ( UserMenuCollectionEvent :: NA... | Create the user menu . |
14,564 | public function widget ( $ args , $ instance ) { $ this -> parent_page_id = View_Utils :: get_top_level_parent_id ( ) ; if ( $ this -> parent_page_id === null ) { return ; } $ this -> args = wp_parse_args ( $ instance , apply_filters ( 'snap_related_pages_widget_defaults' , $ this -> get_defaults ( ) ) ) ; $ this -> ge... | The widget output . |
14,565 | public function form ( $ instance ) { if ( isset ( $ instance [ 'title' ] ) ) { $ title = $ instance [ 'title' ] ; } else { $ title = __ ( 'New title' , 'wpb_widget_domain' ) ; } if ( isset ( $ instance [ 'show_parent' ] ) ) { $ show_parent = $ instance [ 'show_parent' ] ; } else { $ show_parent = 0 ; } ?> <p> ... | Output the admin widget form . |
14,566 | public function update ( $ new_instance , $ old_instance ) { $ instance = [ ] ; $ instance [ 'title' ] = ( ! empty ( $ new_instance [ 'title' ] ) ) ? \ strip_tags ( $ new_instance [ 'title' ] ) : '' ; $ instance [ 'show_parent' ] = ( ! empty ( $ new_instance [ 'show_parent' ] ) ) ? true : false ; return $ instance ; } | Update the widget upon saving . |
14,567 | private function render ( ) { $ str = $ this -> args [ 'container_start' ] ; if ( $ this -> args [ 'show_parent' ] && $ this -> parent_page_id !== false ) { $ str .= $ this -> get_parent_link_html ( ) ; } foreach ( $ this -> pages as $ page ) { $ str .= $ this -> get_link_html ( $ page ) ; } $ str .= $ this -> args [ '... | Output the related pages list HTML . |
14,568 | private function get_parent_link_html ( ) { global $ post ; if ( ! empty ( $ post ) && $ this -> parent_page_id == $ post -> ID ) { $ li_class = $ this -> args [ 'li_active_class' ] . ' ' . $ this -> args [ 'li_class' ] ; $ link_class = $ this -> args [ 'link_active_class' ] . ' ' . $ this -> args [ 'link_class' ] ; } ... | Construct the HTML for the parent link . |
14,569 | private function get_link_html ( $ page ) { global $ post ; if ( ! empty ( $ post ) && $ page -> ID == $ post -> ID ) { $ li_class = $ this -> args [ 'li_active_class' ] . ' ' . $ this -> args [ 'li_class' ] ; $ link_class = $ this -> args [ 'link_active_class' ] . ' ' . $ this -> args [ 'link_class' ] ; } else { $ li_... | Construct the HTML for the a non - parent link . |
14,570 | public function setConfiguration ( array $ configuration ) { $ this -> actions = array ( ) ; $ this -> client = new Client ( ) ; if ( ! isset ( $ configuration [ 'parameters' ] ) ) { throw new BadApiConfigurationException ( sprintf ( '[%s] Missing parameters array for api configuration' , $ this -> getApiName ( ) ) ) ;... | Sets the configuration |
14,571 | public function mergeActionParameterConfigs ( array & $ lowPriorityConfig , array & $ highPriorityConfig ) { if ( isset ( $ lowPriorityConfig [ 'actions_parameters' ] ) && isset ( $ highPriorityConfig [ 'actions_parameters' ] ) ) { $ lowPriorityConfig [ 'actions_parameters' ] = $ this -> mergeConfigs ( $ lowPriorityCon... | Merges two action parameter configuration array using a priority criteria |
14,572 | public function setGeneralApiCallParameters ( array $ apiCallParameters ) { if ( ! isset ( $ apiCallParameters [ 'host' ] ) ) { throw new BadApiConfigurationException ( sprintf ( '[%s] Missing parameter for GENERAL API configuration: host.' , $ this -> getApiName ( ) ) ) ; } $ this -> host = $ apiCallParameters [ 'host... | Sets all general parameters for all api calls |
14,573 | public function setActionRequests ( array $ actionsParameters , array $ defaultActionsParameters = array ( ) ) { foreach ( $ actionsParameters as $ actionNameFirstLevel => $ actionGroup ) { foreach ( $ actionGroup as $ actionNameSecondLevel => $ actionConf ) { $ this -> setActionRequest ( $ actionConf , $ actionNameFir... | Default method to set the remote actions to be called |
14,574 | protected function getRequestInstance ( $ requestType ) { $ className = null ; if ( class_exists ( $ requestType ) ) { $ className = $ requestType ; } elseif ( class_exists ( AbstractActionRequest :: REQUEST_NAMESPACE . '\\' . $ requestType ) ) { $ className = AbstractActionRequest :: REQUEST_NAMESPACE . '\\' . $ reque... | Returns a proper ActionRequestInterface instance for the given Request Type |
14,575 | protected function getResponseInstance ( $ responseType , $ responseWrapper = "" ) { $ className = null ; if ( class_exists ( $ responseType ) ) { $ className = $ responseType ; } elseif ( class_exists ( AbstractActionRequest :: RESPONSE_NAMESPACE . '\\' . $ responseType ) ) { $ className = AbstractActionRequest :: RES... | Returns a proper ActionResponseInterface . php instance for the given Response Type |
14,576 | public function getActionRequestParametersByName ( $ actionName ) { $ parameters = array ( ) ; $ request = $ this -> getActionRequestByName ( $ actionName ) ; if ( $ request instanceof AbstractActionRequest ) { $ parameters = $ request -> getParameters ( ) ; } return $ parameters ; } | Returns an array of required parameters from a well - configured ActionRequestInterface instance by action name |
14,577 | public function getActionRequestByName ( $ actionName ) { $ actionNameFirstPart = $ actionNameSecondPart = "" ; if ( strpos ( $ actionName , self :: API_NAME_LEVEL_SEPARATOR ) === 0 ) { throw new BadApiConfigurationException ( sprintf ( '[%s] Action name \'%s\' is not well formed. It should contain two parts separated ... | Returns a ActionRequestInterface instance by action name |
14,578 | public function getActionRequestsGroupByName ( $ actionGroupName ) { if ( ! isset ( $ this -> actions [ $ actionGroupName ] ) ) { throw new NotConfiguredActionException ( sprintf ( '[%s] No action group configured with the following name: %s.' , $ this -> getApiName ( ) , $ actionGroupName ) , $ actionGroupName ) ; } r... | Returns an array of ActionRequestInterface instances for the given action group name |
14,579 | public function execute ( $ actionName , array $ requestParameters = array ( ) , $ content = "" , array $ urlBuildParameters = array ( ) , array $ headersValue = array ( ) ) { $ actionRequest = $ this -> getActionRequestByName ( $ actionName ) ; if ( ! $ actionRequest instanceof AbstractActionRequest ) { throw new BadC... | Executes a remote api action by action name |
14,580 | protected function getNotValidRequestExMsg ( $ requestObj ) { if ( is_object ( $ requestObj ) ) { $ type = get_class ( $ requestObj ) ; } else { $ type = gettype ( $ requestObj ) ; } return sprintf ( '[%s] Unknown request object. Expected was \'%s\' but got \'%s\'.' , $ this -> getApiName ( ) , '\RemoteHost\Api\ActionR... | Returns a message for a not valid request object exception |
14,581 | public static function get_files_to_publish ( $ type = null ) { if ( ! isset ( static :: $ publishes [ static :: class ] ) ) { return [ ] ; } if ( $ type !== null ) { return static :: $ publishes [ static :: class ] [ $ type ] ; } $ iterator = new RecursiveIteratorIterator ( new RecursiveArrayIterator ( static :: $ pub... | Returns the package s files to publish . |
14,582 | public function format ( $ seconds , $ params = null , $ locale = null ) { if ( $ seconds == 0 ) { return 0 ; } if ( $ seconds < 0.01 ) { return round ( $ seconds * 1000 , 2 ) . 'ms' ; } if ( $ seconds < 0.1 ) { return round ( $ seconds * 1000 , 1 ) . 'ms' ; } if ( $ seconds < 1 ) { return round ( $ seconds * 1000 ) . ... | Format the time |
14,583 | public function toArray ( $ notifiable ) { return [ 'subject' => $ this -> subject , 'content' => $ this -> content , 'link' => $ this -> link , 'link_label' => $ this -> link_label , 'data' => $ this -> data , 'template' => $ this -> template , 'cc' => $ this -> cc , 'bcc' => $ this -> bcc , 'attachments' => $ this ->... | Get the array representation of the notification . |
14,584 | public function create ( $ path , $ data = array ( ) ) { $ path = $ this -> buildPath ( $ path ) ; if ( ! file_exists ( $ path ) ) throw new NotFoundException ( 'Unable to find view [' . $ path . ']' ) ; $ class = '\Exedra\View\View' ; if ( is_string ( $ data ) ) { if ( $ data ) { $ class = $ data ; $ data = array ( ) ... | Create view instance based on given relative path . |
14,585 | public function setDefaultData ( $ key , $ val = null ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ k => $ v ) { $ this -> setDefaultData ( $ k , $ v ) ; } } else { $ this -> defaultData [ $ key ] = $ val ; } return $ this ; } | Set default data for every view created through this factory . |
14,586 | public static function validate ( array $ inputs , array $ rules = [ ] , array $ messages = [ ] ) { $ validation = Container :: get ( 'Rakit\Validation\Validator' ) -> validate ( $ inputs , $ rules , $ messages ) ; if ( $ validation -> fails ( ) ) { return $ validation -> errors ( ) -> toArray ( ) ; } return true ; } | Manually validate any given array . |
14,587 | public function is_valid ( ) : bool { $ this -> validation -> validate ( ) ; static :: $ errors = $ this -> validation -> errors ( ) ; return ! $ this -> validation -> fails ( ) ; } | Validates the request using the rules and messages set on the internal validation instance . |
14,588 | function currentUserHasRated ( ) { $ rateDataObj = ezsrRatingDataObject :: create ( array ( 'contentobject_id' => $ this -> attribute ( 'contentobject_id' ) , 'contentobject_attribute_id' => $ this -> attribute ( 'contentobject_attribute_id' ) , 'created_at' => 0 ) ) ; return $ rateDataObj -> userHasRated ( ) ; } | Check if current user has rated on this content attribute or not! |
14,589 | public function addCustomNodeClass ( string $ name , string $ class ) : self { if ( ! is_subclass_of ( $ class , NodeInterface :: class ) ) { throw new \ InvalidArgumentException ( ) ; } $ this -> customNodes [ $ name ] = $ class ; return $ this ; } | Add custom node class name . |
14,590 | protected function generateSame ( string $ same , ? NodeInterface $ parent ) : NodeInterface { $ node = new SameNode ( $ this , $ parent , null ) ; $ node -> setSame ( $ same ) ; return $ node ; } | Generate same node . |
14,591 | protected function generateDigit ( ? NodeInterface $ parent , ? string $ name ) : NodeInterface { return new DigitNode ( $ this , $ parent , $ name ) ; } | Generate digit node . |
14,592 | protected function generateRegex ( string $ regex , ? NodeInterface $ parent , ? string $ name ) : NodeInterface { $ node = new RegexNode ( $ this , $ parent , $ name ) ; $ node -> setRegex ( $ regex ) ; return $ node ; } | Generate regex node . |
14,593 | protected function generateWildcard ( string $ wildcard , ? NodeInterface $ parent , ? string $ name ) : NodeInterface { $ node = new WildcardNode ( $ this , $ parent , $ name ) ; $ node -> setWildcard ( $ wildcard ) ; return $ node ; } | Generate wildcard node . |
14,594 | public static function input ( $ key = '' , bool $ xss = true , bool $ cookie = false , array $ options = [ ] ) { $ _GET = $ _GET ?? $ _REQUEST ?? [ ] ; $ files = [ ] ; foreach ( ( $ _FILES ?? [ ] ) as $ k => $ v ) { if ( is_array ( $ v [ 'name' ] ) ) { foreach ( $ v [ 'name' ] as $ k2 => $ v2 ) { if ( empty ( $ v [ 't... | Get merged cookie get and post |
14,595 | public static function hostParts ( $ host = null ) { if ( empty ( $ host ) ) { $ host = self :: host ( ) ; } $ host = str_replace ( [ 'http://' , 'https://' , '/' ] , '' , $ host ) ; $ temp = explode ( '.' , $ host ) ; krsort ( $ temp ) ; $ result = [ ] ; $ counter = 1 ; foreach ( $ temp as $ k => $ v ) { $ result [ $ ... | Get host parts |
14,596 | public static function tenantHost ( string $ tenant_part ) : string { $ domain_level = ( int ) \ Application :: get ( 'application.structure.tenant_domain_level' ) ; $ host_parts = \ Request :: hostParts ( ) ; $ host_parts [ $ domain_level ] = $ tenant_part ; krsort ( $ host_parts ) ; $ crypt_model = new \ Crypt ( ) ; ... | Generate urt for particular tenant |
14,597 | final public static function validateNumericFields ( array $ fields = [ ] , string $ option , string $ field ) : bool { $ fieldsWithError = "" ; $ field = static :: checkGlobal ( $ field ) ; foreach ( $ fields as $ fieldName => $ length ) { $ value = static :: setValueNull ( $ field [ $ fieldName ] ) ; if ( $ value !==... | Validates numeric fields and length from super globals ... |
14,598 | final public static function validateUserId ( array $ fields = [ ] , string $ field ) : bool { $ fieldsWithError = "" ; $ field = static :: checkGlobal ( $ field ) ; foreach ( $ fields as $ fieldName => $ format ) { $ value = static :: setValueNull ( $ field [ $ fieldName ] ) ; if ( $ value !== NULL ) { if ( ! static :... | Validates the format of super global fields ... |
14,599 | final public static function allowedParams ( array $ allowedParams = [ ] , string $ option ) : array { $ allowedArray = [ ] ; $ option = static :: checkGlobal ( $ option ) ; foreach ( $ allowedParams as $ param ) $ allowedArray [ $ param ] = $ option [ $ param ] ?? NULL ; return $ allowedArray ; } | Used for whitelisting super globals . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.