idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
52,800 | private function addPoolsSection ( ArrayNodeDefinition $ node ) { $ node -> children ( ) -> arrayNode ( 'pools' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> arrayNode ( 'method' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> variableNode ( 'templates' ) -> defaultValue ( [ '_form.html' => 'EkynaPaymentBundle:Admin/... | Adds admin pool sections . |
52,801 | public function getIterator ( IteratorFilter $ filter = null ) { if ( is_null ( $ filter ) ) { $ filter = new IteratorFilter ( ) ; } $ param = [ ] ; $ formatter = new IteratorFilterSqlFormatter ( ) ; $ sql = $ formatter -> getFilter ( $ filter -> getRawFilters ( ) , $ param ) ; $ query = Query :: getInstance ( ) -> tab... | Get the users database information based on a filter . |
52,802 | public function removeByLoginField ( $ login ) { $ user = $ this -> getByLoginField ( $ login ) ; if ( $ user !== null ) { return $ this -> removeUserById ( $ user -> getUserid ( ) ) ; } return false ; } | Remove the user based on his user login . |
52,803 | public function removeUserById ( $ userId ) { $ updtableProperties = Updatable :: getInstance ( ) -> table ( $ this -> getUserPropertiesDefinition ( ) -> table ( ) ) -> where ( "{$this->getUserPropertiesDefinition()->getUserid()} = :id" , [ "id" => $ userId ] ) ; $ this -> propertiesRepository -> deleteByQuery ( $ updt... | Remove the user based on his user id . |
52,804 | public function removeProperty ( $ userId , $ propertyName , $ value = null ) { $ user = $ this -> getById ( $ userId ) ; if ( $ user !== null ) { $ updateable = Updatable :: getInstance ( ) -> table ( $ this -> getUserPropertiesDefinition ( ) -> table ( ) ) -> where ( "{$this->getUserPropertiesDefinition()->getUserid(... | Remove a specific site from user Return True or false |
52,805 | protected function setPropertiesInUser ( UserModel $ userRow ) { $ query = Query :: getInstance ( ) -> table ( $ this -> getUserPropertiesDefinition ( ) -> table ( ) ) -> where ( "{$this->getUserPropertiesDefinition()->getUserid()} = :id" , [ 'id' => $ userRow -> getUserid ( ) ] ) ; $ userRow -> setProperties ( $ this ... | Return all property s fields from this user |
52,806 | public function searchServer ( Connection $ connection , string $ searchTerm ) : \ Generator { $ serverMetadata = ( new MetadataFactory ( ) ) -> getServerMetadata ( $ connection ) ; foreach ( $ serverMetadata -> getAllDatabaseMetadata ( ) as $ databaseMetadata ) { $ resultList = $ this -> searchDatabase ( $ connection ... | Performs a search across databases on a server . |
52,807 | public function searchDatabase ( Connection $ connection , string $ databaseName , string $ searchTerm ) : \ Generator { $ databaseMetadata = ( new MetadataFactory ( ) ) -> getDatabaseMetadata ( $ connection , $ databaseName ) ; foreach ( $ databaseMetadata -> getAllTableMetadata ( ) as $ tableMetadata ) { $ resultList... | Performs a search across tables in a database . |
52,808 | public function searchTable ( Connection $ connection , string $ databaseName , string $ tableName , string $ searchTerm ) : \ Generator { $ tableMetadata = ( new MetadataFactory ( ) ) -> getTableMetadata ( $ connection , $ databaseName , $ tableName ) ; if ( ! $ tableMetadata -> hasStringTypeColumn ( ) ) { return ; } ... | Performs a search on the provided table . |
52,809 | public static function slash ( string ... $ sections ) { $ count = count ( $ sections ) ; if ( 1 === $ count ) { return $ sections [ 0 ] ; } elseif ( 0 >= $ count || empty ( $ sections ) ) { return null ; } elseif ( 2 === $ count ) { $ compiled = sprintf ( "%s%s%s" , trim ( $ sections [ 0 ] ) , DIRECTORY_SEPARATOR , tr... | Combine strings with a directory separator . |
52,810 | public static function resolve ( string $ path , bool $ absolute = false ) { $ path = static :: normalize ( $ path ) ; if ( strpos ( $ path , DIRECTORY_SEPARATOR ) === 0 ) { $ absolute = true ; } $ parts = array_filter ( explode ( DIRECTORY_SEPARATOR , $ path ) , 'strlen' ) ; $ absolutes = array ( ) ; foreach ( $ parts... | Naively resolve paths . |
52,811 | public static function resolveReal ( string $ path , string $ workingDir = null ) { if ( null === $ workingDir && file_exists ( $ real = Filesystem :: resolve ( $ path ) ) ) { return $ real ; } elseif ( null !== $ workingDir ) { $ fullPath = Filesystem :: slash ( $ workingDir , $ path ) ; $ real = Filesystem :: resolve... | Resolve paths to real locations . |
52,812 | public static function recursiveRemove ( string $ dir , bool $ complete = true ) { $ di = new \ RecursiveDirectoryIterator ( $ dir , \ FilesystemIterator :: SKIP_DOTS ) ; $ ri = new \ RecursiveIteratorIterator ( $ di , \ RecursiveIteratorIterator :: CHILD_FIRST ) ; foreach ( $ ri as $ file ) { $ file -> isDir ( ) ? rmd... | Removes all files and directories in a directory . BE CAREFUL! |
52,813 | public function getPaginationPath ( $ route , $ page , $ extraParams = array ( ) ) { $ params = array ( $ this -> getActionParameterName ( ) => $ this -> getPageActionParameterName ( ) , $ this -> getDatagridParameterName ( ) => $ this -> getName ( ) , $ this -> getPageParameterName ( ) => $ page , ) ; return $ this ->... | Generate pagination route |
52,814 | public function getResetPath ( $ route , $ extraParams = array ( ) ) { $ params = array ( $ this -> getActionParameterName ( ) => $ this -> getResetActionParameterName ( ) , $ this -> getDatagridParameterName ( ) => $ this -> getName ( ) , ) ; return $ this -> container -> get ( 'router' ) -> generate ( $ route , array... | Generate reset route for the button view |
52,815 | public function getSortPath ( $ route , $ column , $ order , $ extraParams = array ( ) ) { $ params = array ( $ this -> getActionParameterName ( ) => $ this -> getSortActionParameterName ( ) , $ this -> getDatagridParameterName ( ) => $ this -> getName ( ) , $ this -> getSortColumnParameterName ( ) => $ column , $ this... | Generate sorting route for a given column to be displayed in view |
52,816 | public function validate ( $ value ) { return is_scalar ( $ value ) ? Ok :: unit ( ) : Error :: unit ( [ Error :: NON_SCALAR ] ) ; } | Tells if a given value is a valid scalar . |
52,817 | public function validateObjectFieldValue ( $ value , $ fieldName , $ targetObject , & $ validatorParams , $ validatorKey ) { if ( sizeof ( $ validatorParams ) < ( $ this -> mode == self :: MODE_RANGE ? 2 : 1 ) ) { throw new MisconfiguredValidatorException ( $ validatorKey , $ fieldName , $ targetObject ) ; } if ( ! $ v... | Validate a range object |
52,818 | protected function applyStrategies ( \ Jb \ Bundle \ TagCloudBundle \ Model \ TagCloud $ tagCloud ) { foreach ( $ this -> strategies as $ strategy ) { $ strategy -> process ( $ tagCloud ) ; } } | Apply all registered strategies |
52,819 | public function migrateCkeditorBlocks ( ) { $ legacyBlocks = $ this -> getLegacyCkeditorBlocks ( ) ; foreach ( $ legacyBlocks as $ legacyBlock ) { $ legacyBlock -> setType ( 'cms.block.ckeditor' ) ; $ settings = $ legacyBlock -> getSettings ( ) ; if ( isset ( $ settings [ 'contenu' ] ) ) { $ settings [ 'content' ] = $ ... | Function of migration of included blocks . |
52,820 | protected function exists ( $ url ) { $ shortener = Shortener :: where ( 'hash' , hash ( 'sha512' , $ url ) ) -> first ( ) ; if ( is_null ( $ shortener ) ) { return false ; } return route ( 'shortener.show' , [ 'url' => $ this -> hashids -> encode ( $ shortener -> getKey ( ) ) , ] ) ; } | Returns shorten url if exists or false . |
52,821 | public function decode ( $ short ) { $ ids = $ this -> hashids -> decode ( $ short ) ; if ( empty ( $ ids ) ) { throw new \ InvalidArgumentException ; } return Shortener :: findOrFail ( reset ( $ ids ) ) -> getAttribute ( 'url' ) ; } | Get the origin url . |
52,822 | public static function label ( $ status ) { $ statuses = [ SeoChecker :: STATUS_DANGER => 'danger' , SeoChecker :: STATUS_GOOD => 'success' , SeoChecker :: STATUS_WARNING => 'warning' , ] ; return Arr :: get ( $ statuses , $ status , 'default' ) ; } | Get the label class for the given status . |
52,823 | protected static function check ( $ value , $ min , $ max ) { $ length = strlen ( $ value ) ; if ( $ length < $ min ) return self :: STATUS_WARNING ; if ( $ min <= $ length && $ length <= $ max ) return self :: STATUS_GOOD ; return self :: STATUS_DANGER ; } | Check the value with min & max length . |
52,824 | public function save ( ) { if ( $ this -> id ) { throw new Exception ( 'Can\'t save this server because it is already stored' ) ; } $ server = $ this -> _post ( 'servers' , $ this -> dirty_values ) ; $ this -> mergeValues ( $ server ) ; } | Saves a server |
52,825 | public function verify ( $ token = null ) { if ( ! $ token ) { $ data = $ this -> requestVerificationToken ( ) ; $ token = $ data [ 'token' ] ; } return $ this -> _post ( 'servers/' . $ this -> id . '/verify' , [ 'token' => $ token ] ) ; } | Verifies the server with the verification token |
52,826 | public function allSoftware ( $ scopes = [ ] ) { if ( ! $ this -> id ) { throw new Exception ( "The server has no ID, can\'t get software" ) ; } $ software = new Software ( $ this -> patrol ) ; $ software -> defaults ( [ 'server_id' => $ this -> id ] ) ; return $ software -> all ( $ scopes ) ; } | Gets all installed software from this server |
52,827 | public function software ( $ id , $ scopes = [ ] ) { if ( ! $ this -> id ) { throw new Exception ( "The server has no ID, can\'t get software" ) ; } $ software = new Software ( $ this -> patrol ) ; $ software -> defaults ( [ 'server_id' => $ this -> id ] ) ; return $ software -> find ( $ id , $ scopes ) ; } | Gets a single installed software from this server |
52,828 | public function buckets ( ) { if ( ! $ this -> id ) { throw new Exception ( "The server has no ID, can\'t get buckets" ) ; } $ bucket = new Bucket ( $ this -> patrol ) ; $ bucket -> defaults ( [ 'server_id' => $ this -> id ] ) ; return $ bucket -> all ( ) ; } | Gets all software buckets from this server |
52,829 | public function bucket ( $ key = null ) { if ( ! $ this -> id ) { throw new Exception ( "The server has no ID, can\'t get buckets" ) ; } $ bucket = new Bucket ( $ this -> patrol ) ; $ bucket -> defaults ( [ 'server_id' => $ this -> id ] ) ; if ( is_null ( $ key ) ) { return $ bucket ; } try { return $ bucket -> find ( ... | Gets a single software bucket If no key is set an empty Bucket object will be returned which will act as a repository |
52,830 | public static function cleanFilename ( $ filename ) { return preg_replace ( '/[^A-Za-z0-9_\-]/' , '_' , htmlentities ( pathinfo ( $ filename , PATHINFO_FILENAME ) ) ) . '.' . preg_replace ( '/[^A-Za-z0-9_\-]/' , '_' , htmlentities ( pathinfo ( $ filename , PATHINFO_EXTENSION ) ) ) ; } | White list scrub of file name . |
52,831 | public static function encrypt ( $ name , $ location , $ destination , $ publicKeyLocation ) { $ publicKey = openssl_get_publickey ( file_get_contents ( $ publicKeyLocation ) ) ; $ data = file_get_contents ( $ location ) ; $ info = json_encode ( [ 'name' => $ name ] ) ; openssl_seal ( gzcompress ( $ data ) , $ encrypte... | Encrypt a specified file . |
52,832 | public function getPointEvent ( $ typeId = null ) { $ this -> buildQuery ( ) ; $ query = $ this -> eventQuery ; if ( ! is_null ( $ typeId ) ) { $ query -> where ( 'point_event_type_id' , $ typeId ) ; } return $ this -> doQuery ( ) ; } | get user point event |
52,833 | public function getPointEventByType ( $ isIncrease = true ) { $ query = PointEventType :: select ( 'id' ) ; $ isIncrease ? $ query -> where ( 'is_increase' , $ isIncrease ) : $ query -> where ( 'is_deduction' ) ; $ eventType = $ query -> get ( ) ; $ this -> eventQuery = PointEvent :: with ( 'activities' ) -> whereIn ( ... | get point event by type |
52,834 | public function validateElfinder ( $ attribute , $ value , $ parameters , $ validator ) { if ( ! File :: exists ( $ value ) ) { return false ; } if ( count ( $ parameters ) > 0 ) { return in_array ( File :: extension ( $ value ) , $ parameters ) ; } return true ; } | validator elfinder file |
52,835 | public function validateElfinderMax ( $ attribute , $ value , $ parameters , $ validator ) { $ size = $ parameters [ 0 ] * 1024 ; if ( File :: size ( $ value ) > $ size ) { return false ; } return true ; } | validator elfinder max size file |
52,836 | public function validateVideoLink ( $ attribute , $ value , $ parameters , $ validator ) { return preg_match ( $ this -> youtubeRegex , $ value ) || preg_match ( $ this -> vimeoRegex , $ value ) ; } | validator youtube link |
52,837 | public function send ( $ method , $ endpoint , $ data = [ ] ) { try { $ request = $ this -> client -> createRequest ( $ method , $ endpoint , [ 'body' => json_encode ( $ data ) ] ) ; return new Response ( $ this -> client -> send ( $ request ) ) ; } catch ( GuzzleExceptions \ RequestException $ e ) { return $ this -> h... | Wraps HTTP call into a good mould |
52,838 | private function handleError ( $ e ) { if ( ! $ e -> hasResponse ( ) ) { throw new Errors \ NetworkError ; } $ response = $ e -> getResponse ( ) ; $ body = $ response -> json ( ) ; switch ( $ response -> getStatusCode ( ) ) { case 400 : throw new Errors \ InvalidRequestError ( $ body [ 'error' ] [ 'message' ] , $ body ... | Handles the error by throwing proper exception |
52,839 | private function handleUnknownError ( $ e ) { $ response = $ e -> getResponse ( ) ; $ body = $ response -> json ( ) ; switch ( floor ( $ response -> getStatusCode ( ) / 100 ) ) { case 4 : throw new Errors \ InvalidRequestError ( $ body [ 'error' ] [ 'message' ] , $ body [ 'error' ] [ 'code' ] , $ body [ 'error' ] [ 'ty... | Handles unknown errors by checking the kind of HTTP status code |
52,840 | public function getSourceFile ( $ page ) { $ path = realpath ( $ this -> generator -> getInputDirectory ( ) . '/' . $ page . '.xml' ) ; return new SourceFile ( $ page , $ path ) ; } | Loads a source file . |
52,841 | protected function validateParams ( array & $ params , $ rules = null , $ clean = false ) { if ( ! is_null ( $ rules ) ) { $ validator = $ this -> newValidator ( $ params , $ rules , $ clean ) ; $ this -> setValidator ( $ validator ) ; } $ validator = $ this -> getValidator ( ) ; $ rules = $ validator -> getRules ( ) ;... | Validate params by given rules |
52,842 | public function formatShippingAddress ( ClientShippingAddressInterface $ address , $ lineSeparator = self :: LINES_SEPARATOR ) { $ lines = [ ] ; $ lines [ ] = sprintf ( '%s %s' , $ address -> getFirstName ( ) , $ address -> getLastName ( ) ) ; if ( '' !== $ address -> getCompanyName ( ) ) { $ lines [ ] = $ address -> g... | Formats the shipping address |
52,843 | public function formatContactDetails ( ClientContactDetailsInterface $ details , $ lineSeparator = self :: LINES_SEPARATOR ) { $ lines = [ ] ; $ lines [ ] = sprintf ( '%s %s' , $ details -> getFirstName ( ) , $ details -> getLastName ( ) ) ; $ lines [ ] = sprintf ( '%s %s' , $ details -> getPhone ( ) , $ details -> get... | Formats the contact details |
52,844 | public function frm ( $ txt , $ att = '' , $ a = '' , $ m = '' , $ e = '' ) { $ attList = array ( ) ; if ( ! empty ( $ a ) ) { $ attList [ 'action' ] = $ a ; } if ( ! empty ( $ m ) ) { $ attList [ 'method' ] = $ m ; } if ( ! empty ( $ e ) ) { $ attList [ 'enctype' ] = $ e ; } $ newatt = $ this -> addAttributes ( $ attL... | complex tags predefined to simplify coding |
52,845 | public function setConfig ( $ param , $ value ) { $ dn = new DotNotation ( $ this -> configs ) ; $ dn -> set ( $ param , $ value ) ; $ this -> configs = $ dn -> getValues ( ) ; } | Set configuration parameter . |
52,846 | public function getConfig ( $ param , $ defaultValue = null ) { $ dn = new DotNotation ( $ this -> configs ) ; return $ dn -> get ( $ param , $ defaultValue ) ; } | Get Configuration Value . |
52,847 | protected function loadProviders ( $ providers ) { foreach ( ( array ) $ providers as $ provider ) { $ provider = $ this -> container -> get ( $ provider ) ; if ( ! $ provider instanceof ServiceProviderInterface ) { $ providerName = get_class ( $ provider ) ; throw new \ Exception ( "$providerName does not implement re... | Register Providers into the Application . |
52,848 | protected function loadEvents ( $ appEvents ) { foreach ( ( array ) $ appEvents as $ appEventType => $ events ) { foreach ( $ events as $ event ) { $ this -> eventDispatcher -> addListener ( $ appEventType , $ this -> container -> get ( $ event ) ) ; } } } | Register Event Listeners . |
52,849 | protected function getSuperGlobalValue ( $ name ) { $ pos = strpos ( $ name , $ this -> field_splitter ) ; if ( false !== $ pos ) { $ pref = substr ( $ name , 0 , $ pos ) ; $ suff = substr ( $ name , $ pos + 1 ) ; if ( isset ( $ GLOBALS [ $ pref ] [ $ suff ] ) ) { return $ GLOBALS [ $ pref ] [ $ suff ] ; } } else { $ p... | Get super global value |
52,850 | protected function exceptionIfNotString ( $ key ) { if ( ! is_string ( $ key ) ) { throw new InvalidArgumentException ( Message :: get ( Message :: CONFIG_KEY_INVALID , $ key ) , Message :: CONFIG_KEY_INVALID ) ; } } | Throw exception if not a string |
52,851 | static function GatherParams ( $ url ) { $ reader = new StringReader ( $ url ) ; $ param = '' ; $ params = array ( ) ; $ start = false ; while ( false !== ( $ ch = $ reader -> ReadChar ( ) ) ) { if ( $ ch == '{' ) { $ start = true ; } else if ( $ ch == '}' && $ start ) { $ params [ ] = $ param ; $ param = '' ; $ start ... | Gathers the obligatory parameters from the url |
52,852 | static function PageUrl ( Page $ page , array $ params = array ( ) , $ fragment = '' ) { $ siteUrl = $ page -> GetSite ( ) -> GetUrl ( ) ; $ pageUrl = $ page -> GetUrl ( ) ; if ( $ pageUrl == 'index.html' ) { $ url = $ siteUrl ; } else { $ url = Path :: Combine ( $ siteUrl , $ pageUrl ) ; } $ oblParams = self :: Gather... | Returns the url of a page with parameters and fragment |
52,853 | static function Url ( PageUrl $ pageUrl , array $ additionalParameters = array ( ) ) { $ list = new PageParamListProvider ( $ pageUrl ) ; $ params = $ list -> ToArray ( ) ; foreach ( $ additionalParameters as $ key => $ value ) { $ params [ $ key ] = $ value ; } return self :: PageUrl ( $ pageUrl -> GetPage ( ) , $ par... | Gets the url for a page url entity |
52,854 | private static function AttachObligatoryParams ( $ url , array $ oblParams , array $ params ) { foreach ( $ oblParams as $ oblParam ) { $ value = '' ; if ( ! array_key_exists ( $ oblParam , $ params ) ) { $ value = Request :: GetData ( $ oblParam ) ; } else { $ value = $ params [ $ oblParam ] ; } if ( $ value ) { $ url... | Attaches obligatory parameters |
52,855 | private static function AttachMoreParams ( $ url , array $ oblParams , array $ params ) { $ moreParams = array ( ) ; foreach ( $ params as $ key => $ value ) { if ( ! in_array ( $ key , $ oblParams ) ) { $ moreParams [ $ key ] = $ value ; } } if ( count ( $ moreParams ) ) { $ url .= '?' . http_build_query ( $ moreParam... | Attaches none oblique url paramters |
52,856 | static function Page404 ( Site $ site ) { $ sql = Access :: SqlBuilder ( ) ; $ tblPage = Page :: Schema ( ) -> Table ( ) ; $ where = $ sql -> Equals ( $ tblPage -> Field ( 'Type' ) , $ sql -> Value ( ( string ) PageType :: NotFound ( ) ) ) -> And_ ( $ sql -> Equals ( $ tblPage -> Field ( 'Site' ) , $ sql -> Value ( $ s... | Finds the 404 page for a site |
52,857 | protected function getPattern ( ) { if ( is_null ( $ this -> reference_pattern ) ) { if ( '' === $ this -> reference_start || is_null ( $ this -> reference_end ) ) { $ this -> reference_pattern = '' ; } else { $ this -> reference_pattern = '~(' . preg_quote ( $ this -> reference_start ) . '([a-zA-Z_][a-zA-Z0-9._]*+)' .... | Get the reference pattern |
52,858 | protected function deReferenceArray ( array & $ dataArray , $ clearCache = false ) { if ( '' === $ this -> getPattern ( ) ) { return ; } if ( $ clearCache ) { $ this -> loop_detect = [ ] ; } try { foreach ( $ dataArray as $ idx => & $ data ) { if ( is_array ( $ data ) ) { $ this -> dereferenceArray ( $ data ) ; } elsei... | Derefence all references in an array |
52,859 | static function BundleFolder ( $ bundleName ) { $ packageBundles = self :: PackageBundles ( ) ; if ( isset ( $ packageBundles [ $ bundleName ] ) ) { return $ packageBundles [ $ bundleName ] ; } return Path :: Combine ( self :: AppBundlesFolder ( ) , $ bundleName ) ; } | Gets the folder for the bundle |
52,860 | static function Modules ( $ bundleName , ModuleLocation $ location ) { $ result = array ( ) ; $ modulesFolder = Path :: Combine ( self :: BundleFolder ( $ bundleName ) , 'Modules' ) ; $ folder = Path :: Combine ( $ modulesFolder , ( string ) $ location ) ; if ( ! Folder :: Exists ( $ folder ) ) { return $ result ; } $ ... | Gets all modules in a bundle |
52,861 | static function BundleTranslationsFile ( ModuleBase $ module , $ lang ) { $ moduleTransFolder = self :: ModuleTranslationsFolder ( $ module ) ; $ bundleTransFolder = Path :: Directory ( $ moduleTransFolder ) ; $ file = Path :: Combine ( $ bundleTransFolder , $ lang ) ; return Path :: AddExtension ( $ file , 'php' ) ; } | Gets the bundle translations file |
52,862 | static function ModuleTranslationsFolder ( ModuleBase $ module ) { $ class = new \ ReflectionClass ( $ module ) ; $ classFile = Str :: Replace ( '\\' , '/' , $ class -> getFileName ( ) ) ; return Str :: Replace ( '/Modules/' , '/Translations/' , Path :: RemoveExtension ( $ classFile ) ) ; } | Gets the translations folder for a module |
52,863 | static function ModuleTranslationsFile ( ModuleBase $ module , $ lang ) { $ folder = self :: ModuleTranslationsFolder ( $ module ) ; $ file = Path :: Combine ( $ folder , $ lang ) ; return Path :: AddExtension ( $ file , 'php' ) ; } | Gets the translations file for a module |
52,864 | static function ModuleCustomTemplatesFolder ( TemplateModule $ module ) { $ parentFolder = Path :: Combine ( PHINE_PATH , 'App/Phine/ModuleTemplates' ) ; $ bundleFolder = Path :: Combine ( $ parentFolder , $ module -> MyBundle ( ) ) ; return Path :: Combine ( $ bundleFolder , $ module -> MyName ( ) ) ; } | Gets the folder for |
52,865 | static function LayoutTemplate ( Layout $ layout ) { $ folder = Path :: Combine ( PHINE_PATH , 'App/Phine/LayoutTemplates' ) ; $ file = Path :: Combine ( $ folder , $ layout -> GetName ( ) ) ; return Path :: AddExtension ( $ file , 'phtml' ) ; } | The template file for a page layout |
52,866 | static function SitemapCacheFile ( Site $ site ) { $ cacheFolder = Path :: Combine ( PHINE_PATH , 'App/Phine/Cache/Sitemap' ) ; $ filename = Path :: AddExtension ( $ site -> GetID ( ) , 'xml' ) ; return Path :: Combine ( $ cacheFolder , $ filename ) ; } | The name of the cache file of the |
52,867 | static function ContentCacheFile ( FrontendModule $ module ) { $ file = $ module -> Content ( ) -> GetID ( ) ; $ cacheKey = $ module -> CacheKey ( ) ; if ( $ cacheKey ) { if ( ! ctype_alnum ( $ cacheKey ) ) { throw new \ Exception ( Trans ( 'Core.CacheKey.Error.NotAlphaNumeric' ) ) ; } $ file .= '-' . $ cacheKey ; } $ ... | The name of the cache file |
52,868 | public function process ( $ file ) { ob_start ( ) ; extract ( $ this -> viewmodel -> getVariables ( ) , EXTR_REFS ) ; include ( $ file ) ; $ this -> output = ob_get_clean ( ) ; return $ this ; } | Converts template code to output string |
52,869 | public function escapeJs ( $ string , $ encoding = 'utf-8' ) { $ current = Escape :: getEncoding ( ) ; Escape :: setEncoding ( $ encoding ) ; $ result = Escape :: js ( $ string ) ; Escape :: setEncoding ( $ current ) ; return $ result ; } | Escape a string for the Javascript context . |
52,870 | public function escapeCss ( $ string , $ encoding = 'utf-8' ) { $ current = Escape :: getEncoding ( ) ; Escape :: setEncoding ( $ encoding ) ; $ result = Escape :: css ( $ string ) ; Escape :: setEncoding ( $ current ) ; return $ result ; } | Escape a string for the CSS context . |
52,871 | protected function partial ( $ file ) { $ viewmodel = new ViewModel ( $ file ) ; $ viewmodel -> assign ( $ this -> viewmodel -> getVariables ( ) ) ; ViewContainer :: output ( $ viewmodel ) ; } | Calls the parse function |
52,872 | protected function form ( $ type , $ name = null , $ value = null ) { $ form = new Form ( ) ; return $ form -> { $ type } ( $ name , $ value ) ; } | Calls the url function of the sFire \ Routing \ Router |
52,873 | protected function translate ( $ key , $ params = null , $ language = null ) { return Translation :: translate ( $ key , $ params , $ language , $ this -> getViewmodel ( ) ) ; } | Calls the translate function of the sFire \ Translation \ Translate |
52,874 | protected function template ( $ action , $ params = null ) { if ( false === is_string ( $ action ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ action ) ) , E_USER_ERROR ) ; } if ( null !== $ params && false === is_array ( $ params ) ... | Execute user defined template function |
52,875 | public function getPolicy ( Role $ role , string $ action ) { $ rules = $ this -> getRules ( ) ; $ pref_policy = $ this -> getACL ( ) -> getPreferredPolicy ( ) ; $ inherit = true ; $ ancestor_distance = null ; $ ancestor_policy = null ; foreach ( $ rules as $ rule ) { if ( $ rule -> policy === Rule :: NOINHERIT ) { $ i... | Find the policy to the Role performing the action on this Entity . |
52,876 | public function setUp ( array $ params ) { if ( empty ( $ params [ 'endpoint' ] ) ) { throw new \ RuntimeException ( 'Parameter "endpoint" cannot be empty.' ) ; } if ( empty ( $ params [ 'ssl_pem_path' ] ) ) { throw new \ RuntimeException ( 'Parameter "ssl_pem_path" cannot be empty.' ) ; } if ( ! is_readable ( $ params... | Set up parameters . |
52,877 | private function getStreamSocketClient ( ) { $ stream_socket_client = stream_socket_client ( $ this -> params [ 'endpoint' ] , $ errno , $ errstr , 30 , STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT , $ this -> getStreamContext ( ) ) ; if ( $ stream_socket_client === false ) { throw new PushException ( 'An error occ... | Get the Stream socket client . |
52,878 | private function getStreamContext ( ) { $ context = array ( 'ssl' => array ( 'local_cert' => $ this -> params [ 'ssl_pem_path' ] , ) , ) ; if ( ! empty ( $ this -> params [ 'ssl_passphrase' ] ) ) { $ context [ 'ssl' ] [ 'passphrase' ] = $ this -> params [ 'ssl_passphrase' ] ; } return stream_context_create ( $ context ... | Get secured stream context from SSL certificate . |
52,879 | public function hiddenFormFields ( ) { $ fields = $ this -> getParameter ( 'fields' ) ; if ( empty ( $ fields ) ) return '' ; $ html_array = ArrayUtils :: htmlArrayFlatten ( $ fields ) ; foreach ( $ html_array as $ name => $ value ) { $ name = htmlentities ( $ name , ENT_QUOTES ) ; $ value = htmlentities ( $ value , EN... | Returns all the fields passed into fields as hidden fields to submit |
52,880 | public function protocol ( $ version = false ) : string { if ( $ version === false ) { $ protocol = 'http' ; if ( $ this -> server ( ) -> get ( 'HTTPS' ) ) { $ protocol = 'https' ; } return $ protocol ; } return $ this -> server ( ) -> get ( 'SERVER_PROTOCOL' ) ; } | Get used server protocal |
52,881 | public function incoming ( Application $ app ) { $ route = $ app -> getService ( 'router' ) -> findHttpRoute ( $ this ) ; if ( ! empty ( $ route -> offsetGet ( 'action' ) ) ) { $ app :: getContainer ( ) -> offsetSet ( 'callback' , $ route ) ; return ; } $ app -> setActiveUnit ( Application :: APPLICATION_UNIT_NAMESPACE... | Initialize incoming request Determine if route contains callback or service execution |
52,882 | private function buildProcess ( string $ process , string $ fullServiceName ) { $ methods = array_flip ( get_class_methods ( $ fullServiceName ) ) ; if ( ! array_key_exists ( ( $ process ) , $ methods ) ) { throw new \ Nuki \ Exceptions \ Base ( 'No available process is found for the provided service' ) ; } return $ pr... | Build process name |
52,883 | public function triggerGroup ( ? array $ events = [ ] , ? array $ args = null ) { foreach ( $ events as $ callback ) { if ( is_callable ( $ callback ) ) { call_user_func_array ( $ callback , isset ( $ args ) ? $ args : [ ] ) ; } else if ( is_string ( $ callback ) ) { $ call = new $ callback ; call_user_func_array ( [ $... | Trigger a grouped event |
52,884 | public function cmdGetCity ( ) { $ result = $ this -> getListCity ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableCity ( $ result ) ; $ this -> output ( ) ; } | Callback for city - get command |
52,885 | public function cmdDeleteCity ( ) { $ id = $ this -> getParam ( 0 ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ options = null ; if ( $ this -> getParam ( 'state' ) ) { $ options = array ( 'state_id' => $ id ) ; } else if ( $ this -> getParam ( 'country' ) ) { $ opti... | Callback for city - delete command |
52,886 | public function cmdUpdateCity ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this -> ... | Callback for city - update command |
52,887 | protected function getListCity ( ) { $ id = $ this -> getParam ( 0 ) ; if ( ! isset ( $ id ) ) { return $ this -> city -> getList ( array ( 'limit' => $ this -> getLimit ( ) ) ) ; } if ( $ this -> getParam ( 'state' ) ) { return $ this -> city -> getList ( array ( 'state_id' => $ id , 'limit' => $ this -> getLimit ( ) ... | Returns an array of cities |
52,888 | protected function addCity ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> city -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } } | Add a new city |
52,889 | protected function submitAddCity ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'city' ) ; $ this -> addCity ( ) ; } | Add a new city at once |
52,890 | protected function wizardAddCity ( ) { $ this -> validatePrompt ( 'name' , $ this -> text ( 'Name' ) , 'city' ) ; $ this -> validatePrompt ( 'state_id' , $ this -> text ( 'Country state' ) , 'city' ) ; $ this -> validatePrompt ( 'country' , $ this -> text ( 'Country' ) , 'city' ) ; $ this -> validatePrompt ( 'zone_id' ... | Add a new city step by step |
52,891 | public static function commit ( $ protocol ) { if ( isset ( self :: $ _partitions [ $ protocol ] ) ) { $ partition = self :: $ _partitions [ $ protocol ] ; $ partition -> commit ( ) ; $ result = true ; } else { $ result = false ; } return $ result ; } | Commit all changes to real FS |
52,892 | protected static function getPartition ( $ url ) { $ urlParts = explode ( "://" , $ url ) ; $ protocol = array_shift ( $ urlParts ) ; return self :: $ _partitions [ $ protocol ] ; } | Return partition by file url |
52,893 | public static function getRelativePath ( $ url ) { $ urlParts = explode ( "://" , $ url ) ; array_shift ( $ urlParts ) ; $ urlPath = implode ( "://" , $ urlParts ) ; return Entity :: fixPath ( $ urlPath ) ; } | Return urlPath of url |
52,894 | public function create ( $ options = [ ] ) { $ capsule = $ this -> _database -> getCapsule ( ) ; if ( empty ( $ options ) || ! is_array ( $ options ) ) { throw new \ Exception ( 'Create options must not be empty and must be an instance of an array!' ) ; } $ this -> filter ( $ options ) ; $ options [ 'created_at' ] = da... | Creates a new table row . |
52,895 | public function find ( $ id ) { $ capsule = $ this -> _database -> getCapsule ( ) ; $ this -> _model = $ capsule -> table ( $ this -> table ) -> where ( 'id' , '=' , $ id ) ; return $ this -> _model -> first ( ) ; } | Finds an item by it s id . |
52,896 | public function where ( $ column , $ operator , $ value ) { $ capsule = $ this -> _database -> getCapsule ( ) ; if ( empty ( $ column ) ) { throw new \ Exception ( 'You must provide the column to look up!' ) ; } if ( empty ( $ operator ) ) { throw new \ Exception ( 'You must provide an operator!' ) ; } if ( empty ( $ v... | Searches for something in the database . |
52,897 | public function count ( ) { if ( is_array ( $ this -> _model ) ) { return count ( $ this -> _model ) ; } else { return $ this -> _model -> count ( ) ; } } | Gets the number of results . |
52,898 | public function all ( $ order = 'ASC' ) { $ capsule = $ this -> _database -> getCapsule ( ) ; $ this -> _model = $ capsule -> table ( $ this -> table ) -> orderBy ( 'id' , $ order ) -> get ( ) ; return $ this -> _model ; } | Gets all results from the database . |
52,899 | public function select ( $ capsule = null , $ limit = null , $ offset = null , $ columns = [ ] ) { if ( is_null ( $ capsule ) ) { $ capsule = $ this -> _database -> getCapsule ( ) -> table ( $ this -> table ) ; } if ( empty ( $ columns ) ) { $ columns = '*' ; } else { $ cstring = '' ; foreach ( $ columns as $ column ) ... | Selects from the database table via custom SQL command . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.