idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
60,100 | public function get ( $ key ) { if ( ! @ $ this -> langDb [ $ key ] ) { return '---' ; } $ lang = $ this -> lang ; if ( ! strlen ( $ this -> langDb [ $ key ] [ $ lang ] ) ) { $ lang = $ this -> defaultLang ; } if ( ! strlen ( $ this -> langDb [ $ key ] [ $ lang ] ) ) { return '---' ; } $ rtn = $ this -> langDb [ $ key ... | get word by key |
60,101 | public static function getExtension ( $ file ) { $ file = trim ( $ file ) ; $ extension = strtolower ( substr ( strrchr ( $ file , '.' ) , 1 ) ) ; if ( $ extension == $ file ) { return '' ; } else { return $ extension ; } } | Get the extension of a file . |
60,102 | public static function Anpm ( $ a ) { $ w ; $ w = fmod ( $ a , D2PI ) ; if ( abs ( $ w ) >= DPI ) $ w -= sign ( D2PI , $ a ) ; return $ w ; } | - - - - - - - - i a u A n p m - - - - - - - - |
60,103 | public function bindRequest ( Request $ request ) { $ this -> request = $ request ; foreach ( $ this -> request -> postArray ( ) as $ key => $ value ) { if ( isset ( $ this -> fieldSet [ $ key ] ) ) { $ this -> fieldSet [ $ key ] -> setValue ( $ value ) ; } } } | Binds the request to the form |
60,104 | public function deleteAction ( Request $ request , $ userId ) { $ successorUserId = $ request -> request -> get ( 'successor' ) ; $ userManager = $ this -> get ( 'phlexible_user.user_manager' ) ; $ successorUser = $ userManager -> find ( $ successorUserId ) ; $ user = $ userManager -> find ( $ userId ) ; $ userManager ... | Delete users . |
60,105 | public function filtervaluesAction ( ) { $ groupManager = $ this -> get ( 'phlexible_user.group_manager' ) ; $ allGroups = $ groupManager -> findAll ( ) ; $ everyoneGroupId = $ groupManager -> getEveryoneGroupId ( ) ; $ groups = [ ] ; foreach ( $ allGroups as $ group ) { if ( $ group -> getId ( ) === $ everyoneGroupId ... | Return filter values . |
60,106 | public function passwordAction ( ) { $ minLength = $ this -> container -> getParameter ( 'phlexible_user.password.min_length' ) ; $ generator = new PasswordGenerator ( ) ; $ password = $ generator -> create ( $ minLength , PasswordGenerator :: TYPE_UNPRONOUNCABLE ) ; return new JsonResponse ( [ 'password' => $ password... | Create password . |
60,107 | public static function run ( $ source = null , MappingInterface $ mapping , $ output = null ) { $ data = [ ] ; foreach ( $ source as $ src ) { $ data [ ] = self :: runOnce ( $ src , $ mapping , $ output ) ; } return $ data ; } | Insert a array of objects |
60,108 | private static function transformData ( $ source , MappingInterface $ mapping , $ output ) { $ data = [ ] ; $ mappingArray = $ mapping -> getMapping ( ) ; foreach ( $ mappingArray as $ key => $ value ) { $ callback = null ; $ found = null ; $ search = null ; $ sourceType = gettype ( $ source ) ; if ( is_array ( $ value... | Helper function to transform data with a mapping |
60,109 | private static function populateObject ( $ output , $ source ) { $ source = json_decode ( json_encode ( $ source ) , true ) ; foreach ( $ source as $ key => $ value ) { $ method = self :: createMethodNames ( $ key ) ; if ( is_callable ( [ $ output , $ method ] ) ) { call_user_func ( [ $ output , $ method ] , $ value ) ... | Helper function to set Array data to a object . |
60,110 | public function getConfig ( ) { $ config = [ ] ; $ provider = new ConfigProvider ( ) ; $ config [ 'middleware_pipeline' ] = $ provider -> getMiddlewareConfig ( ) ; $ config [ 'service_manager' ] = $ provider -> getDependencyConfig ( ) ; return $ config ; } | Return default configuration for zend - mvc applications . |
60,111 | public static function get_all_post_meta ( $ post ) { $ tags = [ [ 'name' => 'description' , 'content' => self :: get_post_meta_description ( $ post ) ] , [ 'property' => 'og:locale' , 'content' => get_locale ( ) ] , [ 'property' => 'og:type' , 'content' => 'article' ] , [ 'property' => 'og:title' , 'content' => self :... | Get all metadata for a post . |
60,112 | public static function get_post_meta_title ( $ post ) { $ title = get_post_meta ( $ post -> ID , '_yoast_wpseo_title' , true ) ; if ( empty ( $ title ) ) { if ( ( int ) get_option ( 'page_on_front' ) === $ post -> ID ) { $ title = get_bloginfo ( 'title' ) ; } else { $ title = $ post -> post_title . ' - ' . get_bloginfo... | Get the post s meta title . |
60,113 | public static function get_post_meta_description ( $ post ) { $ description = get_post_meta ( $ post -> ID , '_yoast_wpseo_metadesc' , true ) ; if ( empty ( $ description ) ) { $ description = Text :: trim_to_nearest_word ( wp_strip_all_tags ( $ post -> post_content ) , 160 ) ; } return $ description ; } | Get the post s meta description . |
60,114 | public static function get_post_twitter_title ( $ post ) { $ title = get_post_meta ( $ post -> ID , '_yoast_wpseo_twitter-title' , true ) ; if ( empty ( $ title ) ) { $ title = self :: get_post_meta_title ( $ post ) ; } return $ title ; } | Get the post s twitter title . |
60,115 | public static function get_post_twitter_description ( $ post ) { $ description = get_post_meta ( $ post -> ID , '_yoast_wpseo_twitter-description' , true ) ; if ( empty ( $ description ) ) { $ description = self :: get_post_meta_description ( $ post ) ; } return $ description ; } | Get the post s twitter description . |
60,116 | public static function get_post_twitter_image ( $ post ) { $ image = get_post_meta ( $ post -> ID , '_yoast_wpseo_twitter-image' , true ) ; if ( empty ( $ image ) ) { $ image = self :: get_fallback_image ( $ post ) ; } return $ image ; } | Get the post s twitter image . |
60,117 | private static function get_fallback_image ( $ post ) { $ image = wp_get_attachment_url ( get_post_thumbnail_id ( $ post -> ID ) ) ; if ( empty ( $ image ) ) { $ logo = Acf :: get_option_field ( SiteIdentity :: LOGO_KEY ) ; $ image = is_array ( $ logo ) ? $ logo [ 'src' ] : get_site_icon_url ( ) ; } return $ image ; } | Get a fallback image for the post . |
60,118 | public static function get_twitter_card_type ( ) { $ card = 'summary' ; $ social = get_option ( 'wpseo_social' ) ; if ( ! empty ( $ social ) && ! empty ( $ social [ 'twitter_card_type' ] ) ) { $ card = $ social [ 'twitter_card_type' ] ; } return $ card ; } | Get twitter card type . |
60,119 | public function registerClientCommand ( $ baseUri , $ publicKey ) { try { $ this -> rsaWalletService -> getPublicKey ( $ publicKey ) ; } catch ( \ TYPO3 \ Flow \ Security \ Exception \ InvalidKeyPairIdException $ exception ) { $ this -> outputLine ( 'Invalid or unknown public key fingerprint: ' . $ publicKey . '. Make ... | Add a client |
60,120 | public function triggerAction ( $ companyFid , $ actionKey , $ transactionId , $ transactionValue = 0 , array $ data = null , $ couponCode = null , $ returnPixels = null , $ userReference = null , $ campaignHash = null , $ sid1 = null , $ sid2 = null , $ sid3 = null ) { if ( $ returnPixels === null ) { $ returnPixels =... | Trigger a visitor action |
60,121 | public function reverseAction ( $ transactionId , $ originalAction = AffiliateBuiltInAction :: ACQUISITION , $ reason = ReversalReason :: CANCEL , $ reversalId = null , $ reversalAmount = 0 , array $ data = null ) { $ endpoint = AffiliateActionEndpoint :: bound ( $ this -> _getApi ( ) ) ; $ payload = new ReversalPayloa... | Reverse a previously triggered action |
60,122 | public function first ( $ default = NULL ) { $ first = $ this -> shift ( ) ; if ( ! $ first ) { $ first = $ default ; } else { $ this -> unshift ( $ first ) ; } return $ first ; } | Get the first element of the collection |
60,123 | public function clear ( array $ excepts = [ ] ) { $ tmp = array ( ) ; foreach ( $ excepts as $ except ) { if ( $ this -> has ( $ except ) ) { $ tmp [ $ except ] = $ this -> get ( $ except ) ; } } $ this -> setAll ( array ( ) ) ; foreach ( $ tmp as $ key => $ value ) { $ this -> set ( $ key , $ value ) ; } } | Remove all items from collection with a list of exception |
60,124 | private function setQueryParameters ( TransportRequestInterface $ transportRequest , $ parameters ) { if ( ! empty ( $ parameters ) && is_array ( $ parameters ) ) { $ transportRequest -> setQueryParams ( $ parameters ) ; } return $ transportRequest ; } | Sets query params to transport request |
60,125 | private function generatePath ( RequestInterface $ request ) { $ path = array ( ) ; if ( null !== $ request -> getIndex ( ) ) { $ path [ ] = $ request -> getIndex ( ) ; } if ( null !== $ request -> getType ( ) ) { $ path [ ] = $ request -> getType ( ) ; } if ( null !== $ request -> getAction ( ) ) { $ path [ ] = $ requ... | Generates the path by given request |
60,126 | function setContentType ( $ mime_type , $ charset = 'utf-8' ) { $ header = 'Content-Type: ' . $ mime_type ; if ( $ charset ) { $ header .= '; charset=' . $ charset ; } $ this -> headers [ ] = array ( $ header , TRUE ) ; return $ this ; } | Set Content Type Header |
60,127 | public function validate ( array $ data , array $ rules , array $ messages = [ ] ) { $ validator = $ this -> validationFactory -> make ( $ data , $ rules , $ messages ) ; if ( $ validator -> fails ( ) ) { return new Payload ( $ validator -> messages ( ) , 'invalid' ) ; } return new Payload ( $ data , 'valid' ) ; } | Validate input against the specified rules |
60,128 | public function uploadFile ( ) { if ( ! $ this -> request -> files -> has ( 'file' ) ) { return false ; } $ file = $ this -> request -> files -> get ( 'file' ) ; $ upload = rtrim ( $ this -> uploadDir , '/' ) ; if ( ! is_dir ( $ upload ) ) { mkdir ( $ upload , 0777 , true ) ; } $ file -> move ( realpath ( $ upload ) , ... | Upload file from request |
60,129 | public function listFiles ( array $ paths ) { $ files = array ( ) ; $ webDir = rtrim ( realpath ( $ this -> webDir ) , '/' ) ; foreach ( $ paths as $ path ) { if ( substr ( $ path , 0 , 1 ) != '/' ) { $ path = sprintf ( '/%s' , $ path ) ; } $ realpath = realpath ( $ webDir . $ path ) ; if ( $ realpath && strpos ( $ rea... | List files in a list of paths |
60,130 | protected function remoteColumn ( $ model , $ column ) { $ table = $ model :: $ table ; return ! is_null ( $ column ) ? $ column : $ this -> idKey ( $ table ) ; } | get the name of the column of the remote table . |
60,131 | protected function relate ( $ remote , $ intermediates , $ remoteColumn , $ localColumn , $ localValue ) { $ intermediates = $ this -> intermediates ( $ intermediates , $ localColumn , $ localValue ) ; if ( ! is_null ( $ intermediates ) ) { return $ this -> all ( $ intermediates , $ remote , $ remoteColumn ) ; } } | get all values in relation . |
60,132 | protected function all ( $ intermediates , $ model , $ column ) { $ data = [ ] ; foreach ( $ intermediates as $ intermediate ) { $ data [ ] = $ this -> one ( $ model , $ column , $ intermediate -> $ column ) ; } return $ data ; } | get all values in remote model . |
60,133 | protected function one ( $ model , $ column , $ value ) { $ object = $ model :: where ( $ column , '=' , $ value ) ; if ( ! is_null ( $ object ) ) { if ( count ( $ object ) > 0 ) { return $ object [ 0 ] ; } } } | get one value in remote model . |
60,134 | public function createCredentials ( ) { $ credentials = new Credentials ( ) ; $ credentials -> setTransactor ( $ this ) ; $ credentials -> setCredentials ( array ( 'providerId' => null , 'providerGateId' => null , 'providerGateKey' => null , 'merchantId' => null , 'merchantGateId' => null , 'merchantGateKey' => null ) ... | Creates a new empty Credentials entity |
60,135 | protected function handleQueryResponse ( Transaction $ transaction , $ data ) { $ result = $ transaction -> getResult ( ) ; $ parentResult = $ transaction -> getParent ( ) -> getResult ( ) ; $ eventResult = null ; foreach ( $ data -> Results as $ event ) { if ( $ event -> TransAct_ReferenceID === $ parentResult -> getE... | Handles a query response |
60,136 | protected function normalizeQueryResponse ( $ content ) { $ result = new \ stdClass ( ) ; $ result -> Results = array ( ) ; $ lines = explode ( "\n" , $ content ) ; foreach ( $ lines as $ line ) { if ( empty ( $ line ) ) { continue ; } $ parts = str_getcsv ( $ line ) ; if ( $ parts [ 0 ] === 'Command Response' ) { $ re... | Normalizes a Query response converting it from CSV to an object |
60,137 | private function createRolesAndPermissions ( ) { $ permissions = [ ] ; $ permissions [ ] = [ 'name' => 'admin-access' , 'category' => 'general' ] ; $ entities = [ 'content' , 'block' , 'user' , 'file' , 'role' ] ; foreach ( $ entities as $ entity ) { $ permissions [ ] = [ 'name' => $ entity . '-create' , 'category' => ... | It creates base permissions |
60,138 | static public function instance ( $ srcPath , $ codePool ) { if ( ! self :: $ _instance ) { self :: $ _instance = new WpLoader ( $ srcPath , $ codePool ) ; } return self :: $ _instance ; } | Singleton pattern implementation |
60,139 | public function autoload ( $ class ) { if ( $ this -> _collectClasses ) { $ this -> _arrLoadedClasses [ self :: $ _scope ] [ ] = $ class ; } $ classFile = str_replace ( ' ' , DIRECTORY_SEPARATOR , ucwords ( str_replace ( '_' , ' ' , $ class ) ) ) ; if ( $ this -> _isIncludePathDefined ) { $ classFile = COMPILER_INCLUDE... | Load class source code |
60,140 | static public function registerScope ( $ code ) { self :: $ _scope = $ code ; if ( defined ( 'COMPILER_INCLUDE_PATH' ) ) { @ include COMPILER_INCLUDE_PATH . DIRECTORY_SEPARATOR . self :: SCOPE_FILE_PREFIX . $ code . '.php' ; } } | Register autoload scope This process allow include scope file which can contain classes definition which are used for this scope |
60,141 | private function includeController ( $ class ) { $ local = $ this -> _srcPath . DIRECTORY_SEPARATOR ; $ controller = explode ( '_' , $ class ) ; array_splice ( $ controller , 2 , 0 , 'controllers' ) ; $ pathToController = implode ( DIRECTORY_SEPARATOR , $ controller ) ; $ classFile = $ local . $ pathToController . '.ph... | Includes a controller given a controller class name |
60,142 | public function getPort ( ) { return $ this -> port && ! Validator :: isStandardPort ( $ this -> port ) ? $ this -> port : null ; } | Retrieve the port component of the URI |
60,143 | public function withPath ( $ path ) { if ( ! is_string ( $ path ) ) { throw new InvalidArgumentException ( 'Uri path must be a string' ) ; } $ clone = clone $ this ; $ clone -> path = Validator :: checkPath ( $ path ) ; if ( substr ( $ path , 0 , 1 ) == '/' ) { $ clone -> basePath = '' ; } return $ clone ; } | Return an instance with the specified path |
60,144 | public function withQuery ( $ query ) { if ( ! is_string ( $ query ) && ! method_exists ( $ query , '__toString' ) ) { throw new InvalidArgumentException ( 'Uri query must be a string' ) ; } $ query = ltrim ( ( string ) $ query , '?' ) ; $ clone = clone $ this ; $ clone -> query = Validator :: checkQuery ( $ query ) ; ... | Return an instance with the specified query string |
60,145 | public function withFragment ( $ fragment ) { if ( ! is_string ( $ fragment ) && ! method_exists ( $ fragment , '__toString' ) ) { throw new InvalidArgumentException ( 'Uri fragment must be a string' ) ; } $ fragment = ltrim ( ( string ) $ fragment , '#' ) ; $ clone = clone $ this ; $ clone -> fragment = Validator :: c... | Return an instance with the specified URI fragment |
60,146 | public function getBaseUrl ( ) { $ scheme = $ this -> getScheme ( ) ; $ authority = $ this -> getAuthority ( ) ; $ basePath = $ this -> getBasePath ( ) ; if ( $ authority && substr ( $ basePath , 0 , 1 ) !== '/' ) { $ basePath = $ basePath . '/' . $ basePath ; } return ( $ scheme ? $ scheme . ':' : '' ) . ( $ authority... | Return the fully qualified base URL |
60,147 | public function getResult ( ) { $ result = $ this -> getRoot ( ) ; if ( is_array ( $ result ) && A :: isAssoc ( $ result ) ) { return ( object ) $ result ; } return $ result ; } | Does not json encode by default |
60,148 | public function setupAcl ( ) { $ this -> insertRoles ( $ this -> findRoles ( ) ) -> insertResources ( $ this -> findResources ( ) ) -> insertPrivileges ( $ this -> findPrivileges ( ) ) ; $ this -> loaded = true ; return $ this ; } | Build a new ACL object from the database . |
60,149 | protected function insertRoles ( array $ roles ) { foreach ( $ roles as $ role ) { if ( null === $ role -> getParent ( ) ) { $ this -> addRole ( $ role ) ; } else { $ parents = [ ] ; $ parents [ ] = $ role -> getParent ( ) -> getRoleId ( ) ; $ this -> addRole ( $ role , $ parents ) ; } } return $ this ; } | Insert an array of roles into the current ACL object . |
60,150 | protected function insertResources ( array $ resources ) { foreach ( $ resources as $ resource ) { if ( null === $ resource -> getParent ( ) ) { $ this -> addResource ( $ resource ) ; } else { $ parent = $ resource -> getParent ( ) -> getResourceId ( ) ; $ this -> addResource ( $ resource , $ parent ) ; } } return $ th... | Inserts an array of resources into the current ACL object . |
60,151 | protected function insertPrivileges ( array $ privileges ) { foreach ( $ privileges as $ privilege ) { $ this -> { $ privilege -> getType ( ) } ( $ privilege -> getRole ( ) , $ privilege -> getResource ( ) , $ privilege -> getPrivilege ( ) ) ; } return $ this ; } | Setup the privileges . |
60,152 | public function createResource ( $ newResource , $ baseResource ) { $ em = $ this -> getEntityManager ( ) ; if ( ! $ baseResource instanceof ResourceEntity && ! is_string ( $ baseResource ) ) { throw new \ Exception ( 'Base resource is not a valid ACL resource, ' . get_class ( $ baseResource ) . ' given.' ) ; } elseif ... | Create a new resource in the ACL structure |
60,153 | public function checkPrivilegeRequest ( $ privilege , $ resource ) { $ em = $ this -> getEntityManager ( ) ; $ privilege = trim ( $ privilege ) ; $ resource = trim ( $ resource ) ; if ( $ resource === '' || $ privilege === '' ) { return false ; } $ requestedPrivilege = $ em -> getRepository ( 'JaztecAcl\Entity\Monitor\... | Checks and adds the privilege request and the resource to the request storage if it doesn t exist . |
60,154 | public function find ( $ template ) { if ( ! $ this -> supports ( $ template ) ) { return false ; } foreach ( $ this -> paths as $ path ) { $ filePath = "{$path}/{$template}" ; if ( file_exists ( $ filePath ) ) { return $ filePath ; } } return false ; } | Searches for the template in the registered search paths . |
60,155 | public function getByShortcut ( string $ shortcut ) : input \ Option { if ( ! isset ( $ this -> shortcuts [ $ shortcut ] ) ) { throw new core \ collections \ exceptions \ KeyNotExists ( $ this , $ shortcut , "The short option [$shortcut] is not defined." ) ; } return $ this -> shortcuts [ $ shortcut ] ; } | Returns the Option matching a given shortcut name . |
60,156 | protected function unpack ( array $ definition ) : input \ Option { if ( isset ( $ definition [ 3 ] ) && is_int ( $ definition [ 3 ] ) ) { $ definition [ 3 ] = new input \ Value ( $ definition [ 3 ] ) ; } return new input \ Option ( ... $ definition ) ; } | Unpacks a sequence of Option constructor arguments into an Option instance . |
60,157 | public function __isset ( string $ property ) : bool { if ( in_array ( $ property , [ 'raw' , 'arguments' , 'options' ] ) ) { return isset ( $ this -> $ property ) ; } return false ; } | Magic isset . |
60,158 | public function current ( ) { list ( $ name , $ content ) = $ this -> members [ $ this -> pointer ] ; if ( is_a ( $ content , ViewHelperInterface :: class ) ) { return $ content -> __toString ( ) ; } switch ( $ name ) { case 'charset' : return "<meta {$name}=\"{$content}\">" ; case 'base' : return "<base href=\"{$conte... | Return the value of the current member of the collection . Styling or formatting of the element should be done in this function . |
60,159 | public static final function registerProject ( Project $ project ) { if ( isset ( self :: $ REGISTERED_PRROJECT_INSTANCES [ $ project -> getProjectName ( ) ] ) ) { throw new ConflictProjectNameException ( sprintf ( "The project \"%s\" EXISTS." , $ project -> getProjectName ( ) ) ) ; } self :: $ REGISTERED_PRROJECT_INST... | Register a project object into this util manager . |
60,160 | public static final function getRegisteredProject ( $ project_name ) { if ( isset ( self :: $ REGISTERED_PRROJECT_INSTANCES [ $ project_name ] ) ) { return self :: $ REGISTERED_PRROJECT_INSTANCES [ $ project_name ] ; } else { throw new ProjectNotFoundException ( sprintf ( "The project \"%s\" NOT registered." , $ projec... | Searches the registered project for a given name and returns the corresponding object if successful . |
60,161 | public static final function searchRelativeProject ( MemberIdentifier $ member ) { $ result = array ( ) ; foreach ( self :: $ REGISTERED_PRROJECT_INSTANCES as $ project ) { $ members = $ project -> getAllMembers ( ) ; if ( isset ( $ members [ $ member -> getMemberId ( ) ] ) ) { array_push ( $ result , $ project ) ; } }... | Searches the Projects for a given member and returns the corresponding object array if successful . |
60,162 | public function findByCategoryAction ( Request $ request , $ category_name , $ pageId = null ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ category = $ em -> getRepository ( 'AmulenClassificationBundle:Category' ) -> findOneBy ( array ( "name" => $ category_name ) ) ; $ pages = $ em -> getRepository ( 'Amu... | Find by . |
60,163 | public function indexAction ( Request $ request ) { $ page = $ request -> get ( "page" , 1 ) ; $ searchStr = $ request -> get ( "search" ) ; $ type = $ request -> get ( "type" ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ query = $ em -> getRepository ( "AmulenMediaBundle:Gallery" ) -> getQuerySearch ( $ s... | Lists all Gallery entities . |
60,164 | public function itemsAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ gallery = $ em -> getRepository ( 'AmulenMediaBundle:Gallery' ) -> find ( $ id ) ; if ( ! $ gallery ) { throw $ this -> createNotFoundException ( 'Unable to find Gallery entity.' ) ; } return array ( 'gallery' => $ gallery , '... | Lists all Gallery items . |
60,165 | public function searchForRoute ( ) { $ router = Mouf :: getSplashMiddleware ( ) ; $ request = ServerRequestFactory :: fromGlobals ( $ _SERVER , $ _GET , $ _POST , $ _COOKIE , $ _FILES ) ; $ response = new Response ( ) ; $ response = $ router ( $ request , $ response , function ( RequestInterface $ request , ResponseInt... | This function will ask the Mouf router for routes . A PSR - 7 response will be returned with content or a Vary array set with the value mouflaNotFound at the first pos |
60,166 | public static function listAll ( ) { $ r = array ( ) ; foreach ( static :: $ fixtures as $ class => & $ state ) { if ( $ state == null ) { $ state = class_exists ( $ class , true ) && is_subclass_of ( $ class , 'Orpheus\Publisher\Fixture\FixtureInterface' ) ; } if ( $ state == true ) { $ r [ ] = $ class ; } } return $ ... | List all classes having some fixtures to load |
60,167 | public function renderTemplateFile ( $ templateFile , Framework $ framework , RequestAbstract $ request , Response $ response , $ additionalData = array ( ) ) { if ( ! file_exists ( $ templateFile ) ) { return ; } ob_start ( ) ; include ( $ templateFile ) ; $ content = ob_get_contents ( ) ; ob_end_clean ( ) ; return $ ... | Renders a template file . This function renders the given template file and returns the output to the template manager . |
60,168 | public static function Pnm06a ( $ date1 , $ date2 , array & $ rnpb ) { $ gamb ; $ phib ; $ psib ; $ epsa ; $ dp ; $ de ; IAU :: Pfw06 ( $ date1 , $ date2 , $ gamb , $ phib , $ psib , $ epsa ) ; IAU :: Nut06a ( $ date1 , $ date2 , $ dp , $ de ) ; IAU :: Fw2m ( $ gamb , $ phib , $ psib + $ dp , $ epsa + $ de , $ rnpb ) ;... | - - - - - - - - - - i a u P n m 0 6 a - - - - - - - - - - |
60,169 | public function routeName ( ) { if ( ! $ this -> currentRoute ) { $ request = $ this -> stack -> getCurrentRequest ( ) ; if ( $ request instanceof Request ) { $ this -> currentRoute = $ request -> get ( '_route' ) ; } } return $ this -> currentRoute ; } | Get current route name . |
60,170 | public function saveImage ( Nette \ Http \ FileUpload $ image ) { $ filename = $ image -> getSanitizedName ( ) ; $ path = $ this -> dir ; $ filename = $ this -> getFileName ( $ path , $ filename ) ; $ image -> move ( "$path/$filename" ) ; $ filePath = "{$this->uri}/$filename" ; $ image = Image :: fromFile ( "$path/$fil... | save file and return path |
60,171 | public function getFileName ( $ path , $ filename ) { if ( file_exists ( "$path/$filename" ) ) { $ filename = Nette \ Utils \ Random :: generate ( ) . '_' . $ filename ; $ filename = $ this -> getFileName ( $ path , $ filename ) ; } else { $ filename ; } return $ filename ; } | return unique file name |
60,172 | public function add ( $ data = [ ] ) { if ( isset ( $ data [ 'email' ] ) && isset ( $ data [ 'username' ] ) && isset ( $ data [ 'password' ] ) ) { $ create = array ( 'email' => $ data [ 'email' ] , 'username' => Strings :: webalize ( $ data [ 'username' ] ) , 'password' => Passwords :: hash ( $ data [ 'password' ] ) , ... | Inserts new user |
60,173 | public function generateRecoveryToken ( $ userId ) { $ token = SELF :: generateToken ( ) ; $ update = array ( 'reset_password_token' => Passwords :: hash ( $ token ) , 'reset_password_requested_at' => new DateTime ( ) , ) ; $ this -> repository -> update ( $ userId , $ update ) ; return $ token ; } | generate token for user who can reset password |
60,174 | public function verifyToken ( $ token , $ userId ) { $ user = $ this -> repository -> get ( $ userId ) ; $ now = new DateTime ( ) ; if ( $ user ) { $ dateDiff = $ now -> diff ( $ user -> reset_password_requested_at ) ; $ totalHours = ( $ dateDiff -> d * 24 ) + $ dateDiff -> h ; if ( $ totalHours > 2 ) { $ update = [ 'r... | verify token in database and delete it |
60,175 | public function setName ( $ name ) { $ this -> reflection = NULL ; $ this -> name = trim ( $ name , '\\' ) ; return $ this ; } | Sets the Name of the Class |
60,176 | public function getContentType ( ) { switch ( $ this -> input -> getFormat ( ) ) { case InputInterface :: FORMAT_JSON : return ClientInterface :: CONTENT_TYPE_JSON ; break ; case InputInterface :: FORMAT_TEXT : return ClientInterface :: CONTENT_TYPE_TEXT ; break ; default : throw new \ LogicException ( 'Allowed invalid... | Gets the Content - Type appropriate for the Input format . |
60,177 | public function register ( ) { $ this -> registerKernel ( ) ; $ this -> registerResponse ( ) ; $ this -> registerUrls ( ) ; $ this -> registerRedirect ( ) ; $ this -> registerSession ( ) ; $ this -> registerCookie ( ) ; $ this -> registerRouting ( ) ; } | Register objetos para web . |
60,178 | public function registerKernel ( ) { $ this -> app -> singleton ( 'kernel.web' , function ( $ app ) { $ web = new \ Nano7 \ Http \ Kernel ( $ app ) ; $ web -> middlewareGroup ( 'web' , [ ] ) ; $ web -> middlewareGroup ( 'api' , [ 'session.api' , ] ) ; $ web -> middleware ( 'session.api' , '\Nano7\Http\Middlewares\Start... | Register kernel web . |
60,179 | protected function registerResponse ( ) { $ this -> app -> singleton ( 'response.factory' , function ( $ app ) { $ factory = new ResponseFactory ( $ app [ 'redirect' ] ) ; $ factory -> setViewResolver ( function ( ) use ( $ app ) { return $ app [ 'view' ] ; } ) ; return $ factory ; } ) ; } | Register response factory . |
60,180 | protected function registerRedirect ( ) { $ this -> app -> singleton ( 'redirect' , function ( $ app ) { $ redirect = new Redirector ( $ app [ 'url' ] ) ; $ redirect -> setSession ( $ app [ 'session' ] ) ; return $ redirect ; } ) ; } | Register redirect . |
60,181 | protected function registerRouting ( ) { $ this -> app -> singleton ( 'router' , function ( $ app ) { return new \ Nano7 \ Http \ Routing \ Router ( $ app ) ; } ) ; } | Register routing . |
60,182 | protected function registerCookie ( ) { $ this -> app -> singleton ( 'cookie' , function ( $ app ) { $ config = $ app [ 'config' ] [ 'session' ] ; return new CookieManager ( $ config [ 'path' ] , $ config [ 'domain' ] , $ config [ 'secure' ] ) ; } ) ; } | Register the cookie instance . |
60,183 | public function setFrom ( $ fromEmail , $ fromName = null ) { $ translator = $ this -> mailManager -> getTranslator ( ) ; $ this -> fromEmail = $ translator -> trans ( $ fromEmail ) ; if ( null !== $ fromName ) { $ this -> fromName = $ translator -> trans ( $ fromName ) ; } return $ this ; } | Sets the from email & name . |
60,184 | public function setReplyTo ( $ replyToEmail ) { $ this -> replyToEmail = $ this -> mailManager -> getTranslator ( ) -> trans ( $ replyToEmail ) ; return $ this ; } | Sets the reply to address for the email . |
60,185 | public function setTemplate ( $ template , array $ parameters = [ ] ) { if ( strrpos ( $ template , '.html.twig' ) === false ) { $ template = 'Mail/' . $ template . '.html.twig' ; } $ template = $ this -> mailManager -> getTwig ( ) -> loadTemplate ( $ template ) ; $ parameters = $ this -> mailManager -> getTwig ( ) -> ... | Renders the template into the message parts . Email templates are assumed to be in the Mail folder in views . For the email template if . html . twig is included it will be assumed it s the entire path to the email template including filename and ext . |
60,186 | public function send ( $ to ) { $ this -> testValidateMessageParts ( ) ; $ message = $ this -> createMessage ( $ to ) ; return $ this -> mailManager -> send ( $ message ) ; } | Creates the message and sends it . |
60,187 | public static function resolve ( $ id ) { global $ PPHP ; if ( array_key_exists ( $ id , self :: $ _resolved ) ) { return self :: $ _resolved [ $ id ] ; } ; $ db = $ PPHP [ 'db' ] ; if ( $ user = $ db -> selectSingleArray ( "SELECT * FROM users WHERE id=?" , array ( $ id ) ) ) { return self :: $ _resolved [ $ id ] = $ ... | Resolve a user ID to basic information |
60,188 | public static function fromEmail ( $ email , $ active = true ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ email = strtolower ( $ email ) ; $ isActive = ( $ active ? ' AND active ' : '' ) ; if ( $ user = $ db -> selectSingleArray ( self :: $ _selectFrom . " WHERE email=? {$isActive}" , array ( $ email ) ) ) { return $... | Load a user by e - mail |
60,189 | public static function login ( $ email , $ password , $ onetime = '' ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ config = $ PPHP [ 'config' ] [ 'global' ] ; $ onetimeMaxLow = $ config [ 'onetime_lifetime' ] * 60 ; $ onetimeMaxHigh = $ config [ 'invite_lifetime' ] * 24 * 3600 ; if ( ( $ user = self :: fromEmail ( $ e... | Load and authenticate a user |
60,190 | public static function update ( $ id , $ cols = array ( ) ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ sessUserId = 0 ; if ( isset ( $ _SESSION [ 'user' ] ) && is_array ( $ _SESSION [ 'user' ] ) ) { $ sessUserId = $ _SESSION [ 'user' ] [ 'id' ] ; } ; if ( isset ( $ cols [ 'id' ] ) ) { unset ( $ cols [ 'id' ] ) ; } ; ... | Update an existing user s information |
60,191 | public static function create ( $ cols = array ( ) ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ onetime = null ; if ( isset ( $ cols [ 'id' ] ) ) { unset ( $ cols [ 'id' ] ) ; } ; $ cols [ 'email' ] = strtolower ( $ cols [ 'email' ] ) ; if ( isset ( $ cols [ 'token' ] ) && strlen ( $ cols [ 'token' ] ) > 0 ) { $ cols... | Create new user from information |
60,192 | public static function search ( $ keyword = null ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ query = $ db -> query ( 'SELECT id, email, active, name FROM users' ) ; $ conditions = array ( ) ; if ( $ keyword !== null ) { $ search = array ( ) ; $ search [ ] = $ db -> query ( 'email LIKE ?' , strtolower ( "%{$keyword}%... | Search directory of users |
60,193 | public static function ban ( $ id ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ res = $ db -> exec ( "UPDATE users SET active='0' WHERE id=?" , array ( $ id ) ) ; return $ res ; } | Ban user by turning off its active flag |
60,194 | public static function cleanList ( $ list , $ userData , $ template = null ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ list = array_map ( 'strtolower' , $ list ) ; $ db -> begin ( ) ; $ out = array ( ) ; foreach ( $ list as $ id ) { if ( is_numeric ( $ id ) ) { $ cleanId = $ db -> selectAtom ( 'SELECT id FROM users ... | Resolve all items of a list into userIDs preserving order |
60,195 | public function isValid ( $ value , $ context = null ) : bool { if ( ! is_array ( $ context ) ) { $ this -> error ( self :: INVALID ) ; return false ; } if ( ! in_array ( $ this -> getCommentType ( ) , $ this -> validCommentTypes ) ) { $ this -> error ( self :: INVALID_COMMENT_TYPE ) ; return false ; } $ this -> setVal... | Validate the value so see if it s spam . |
60,196 | protected function _containerUnsetMany ( & $ container , $ keys ) { $ keys = $ this -> _normalizeIterable ( $ keys ) ; foreach ( $ keys as $ _k ) { $ this -> _containerUnset ( $ container , $ _k ) ; } } | Unsets values with the specified keys on the given container . |
60,197 | public function render ( $ path , array $ placeholders = [ ] , $ context = null , $ isAjax = false ) { if ( isset ( $ context ) ) { $ this -> setContext ( $ context ) ; } $ this -> scopes [ spl_object_hash ( $ this ) ] = $ this ; list ( $ cacheKey , $ cacheExpire , $ cacheTags ) = $ this -> calculateCacheParams ( $ pla... | Rendering layout . |
60,198 | public function getPlaceholder ( $ name , $ sanitize = null ) { list ( $ name , $ placeholders , $ template ) = $ this -> getParentPlaceholder ( $ name ) ; if ( $ template === false ) { if ( $ this -> throwException ) { if ( is_array ( $ name ) ) { $ name = implode ( '.' , $ name ) ; } throw new TemplateException ( "Un... | Returns placeholder by name . |
60,199 | public function getAllPlaceholders ( $ parent = null , $ sanitize = null , array $ only = [ ] , array $ exclude = [ ] ) { if ( isset ( $ parent ) ) { list ( , , $ template ) = $ this -> getParentPlaceholder ( $ parent ) ; } if ( ! isset ( $ template ) ) { $ template = $ this ; } if ( $ template === false ) { if ( $ thi... | Returns all placeholders . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.