idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
55,900
public function addChild ( Content $ child ) { $ this -> pages [ $ child -> id ] = $ child ; if ( ! isset ( $ this -> categories [ $ child -> category ] ) ) { $ this -> categories [ $ child -> category ] = [ ] ; } $ this -> categories [ $ child -> category ] [ ] = $ child ; }
Add child to page .
55,901
final public function restore ( $ fname = null ) { if ( is_null ( $ fname ) ) { $ fname = $ this -> database ; } if ( $ this -> pathExtension ( $ fname ) === '' ) { $ fname .= '.sql' ; } if ( $ this -> pathDirname ( $ fname ) === '.' ) { $ fname = $ _SERVER [ 'DOCUMENT_ROOT' ] . DIRECTORY_SEPARATOR . $ fname ; } if ( @...
Restore a file from a mysqldump
55,902
public function all ( $ directory = '/' ) { $ directories = $ this -> directories ( $ directory ) -> transform ( function ( $ item ) { return $ item + [ 'type' => self :: MEDIA_TYPE_DIRECTORY ] ; } ) ; $ files = $ this -> files ( $ directory ) -> transform ( function ( array $ item ) { return $ item + [ 'type' => self ...
Get all the directories & files from a given location .
55,903
public function files ( $ directory ) { $ this -> checkDirectory ( $ directory ) ; $ disk = $ this -> disk ( ) ; $ files = array_map ( function ( $ filePath ) use ( $ disk , $ directory ) { return [ 'name' => str_replace ( "$directory/" , '' , $ filePath ) , 'path' => $ filePath , 'url' => $ disk -> url ( $ filePath ) ...
Get a collection of all files in a directory .
55,904
public function file ( $ path ) { return $ this -> files ( dirname ( $ path ) ) -> first ( function ( $ file ) use ( $ path ) { return $ file [ 'path' ] === $ path ; } , function ( ) use ( $ path ) { throw new FileNotFoundException ( "File [$path] not found!" ) ; } ) ; }
Get the file details .
55,905
public function storeMany ( $ directory , array $ files ) { $ uploaded = [ ] ; foreach ( $ files as $ file ) { $ uploaded [ $ directory . '/' . $ file -> getClientOriginalName ( ) ] = $ this -> store ( $ directory , $ file ) ; } return $ uploaded ; }
Store an array of files .
55,906
public function isExcludedDirectory ( $ directory ) { foreach ( $ this -> getExcludedDirectories ( ) as $ pattern ) { if ( Str :: is ( $ pattern , $ directory ) ) return true ; } return false ; }
Check if the directory is excluded .
55,907
protected function checkDirectory ( & $ directory ) { $ directory = trim ( $ directory , '/' ) ; $ this -> checkDirectoryExists ( $ directory ) ; $ this -> checkDirectoryAccess ( $ directory ) ; }
Check the given directory location .
55,908
public static function get_instance ( $ site_id ) { global $ wpdb ; $ site_id = ( int ) $ site_id ; if ( ! $ site_id ) { return false ; } $ _site = wp_cache_get ( $ site_id , 'sites' ) ; if ( ! $ _site ) { $ _site = $ wpdb -> get_row ( $ wpdb -> prepare ( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d LIMIT 1" , $ si...
Retrieves a site from the database by its ID .
55,909
public function __isset ( $ key ) { switch ( $ key ) { case 'id' : case 'network_id' : return true ; case 'blogname' : case 'siteurl' : case 'post_count' : case 'home' : if ( ! did_action ( 'ms_loaded' ) ) { return false ; } return true ; default : if ( ! did_action ( 'ms_loaded' ) ) { return false ; } $ details = $ th...
Isset - er .
55,910
private function get_details ( ) { $ details = wp_cache_get ( $ this -> blog_id , 'site-details' ) ; if ( false === $ details ) { switch_to_blog ( $ this -> blog_id ) ; $ details = new stdClass ( ) ; foreach ( get_object_vars ( $ this ) as $ key => $ value ) { $ details -> $ key = $ value ; } $ details -> blogname = ge...
Retrieves the details for this site .
55,911
public static function getsessionIdApiCall ( $ login , $ password ) { $ sessionId = "" ; try { $ response = self :: $ buzz -> get ( self :: BASE_URL . '/User/sessionId?login=' . $ login . '&password=' . $ password ) ; $ sessionId = str_replace ( '"' , '' , $ response -> getContent ( ) ) ; } catch ( \ Exception $ e ) { ...
Session ID Queue
55,912
protected static function createRequestParameters ( $ sessionId , $ sourceAddres , $ destinationAddress , $ data , $ sendDate = null , $ validity = 0 ) { $ parameters = array ( 'sessionId' => $ sessionId , 'sourceAddress' => $ sourceAddres , 'data' => $ data ) ; if ( gettype ( $ destinationAddress ) == "string" ) { $ p...
SMS send request parameters preparation
55,913
protected function checkSecurity ( $ intention , $ resource = null ) { $ securityMapping = $ this -> getSecurityMapping ( ) ; return $ this -> container -> get ( 'security.authorization_checker' ) -> isGranted ( ( array ) ( empty ( $ securityMapping [ $ intention ] ) ? $ intention : $ securityMapping [ $ intention ] ) ...
checks security for given intention
55,914
protected function extractQueryFilter ( Request $ request ) { return array_map ( function ( $ value ) { return array_filter ( explode ( ',' , trim ( $ value , ',' ) ) , function ( $ var ) { return ! empty ( $ var ) ; } ) ; } , $ request -> query -> all ( ) ) ; }
Extract available query filter from request .
55,915
protected function retrieveOr404 ( $ entityId , $ loaderId ) { if ( ! $ this -> container -> has ( $ loaderId ) ) { throw new NotFoundHttpException ( sprintf ( 'Unknow required loader : "%s"' , $ loaderId ) ) ; } if ( ! $ entity = $ this -> container -> get ( $ loaderId ) -> retrieve ( $ entityId ) ) { throw $ this -> ...
Retrieves entity for given id into given repository service .
55,916
protected function create404 ( $ entityId , $ loaderId ) { return new NotFoundHttpException ( sprintf ( 'Entity with id "%s" not found%s.' , $ entityId , $ this -> container -> getParameter ( 'kernel.debug' ) ? sprintf ( ' : (looked into "%s")' , $ loaderId ) : '' ) ) ; }
create a formatted http not found exception .
55,917
public function destroyModel ( $ model , $ path = null ) { $ this -> model = $ model ; try { if ( ! $ this -> model -> delete ( ) ) { throw new DestroyException ( $ this -> model ) ; } event ( new $ this -> events [ 'success' ] ( $ this -> model ) ) ; if ( is_null ( $ path ) ) { return response ( ) -> json ( $ this -> ...
destroy data of the eloquent model or models
55,918
protected function destroyGroupAction ( $ class ) { $ result = $ class :: destroy ( $ this -> request -> id ) ; if ( is_integer ( $ result ) && $ result > 0 ) { return true ; } return false ; }
destroy group action
55,919
protected function notPublishGroupAction ( $ class ) { try { if ( ! $ class :: whereIn ( 'id' , $ this -> request -> id ) -> update ( [ 'is_publish' => false ] ) ) { throw new UpdateException ( $ this -> request -> id , 'group not not published' ) ; } event ( new $ this -> events [ 'success' ] ( $ this -> request -> id...
not publish group action
55,920
protected function fillModel ( $ datas ) { $ grouped = collect ( $ datas ) -> groupBy ( 'relation_type' ) ; foreach ( $ grouped as $ key => $ groups ) { if ( $ key === 'not' ) { foreach ( $ groups as $ group ) { $ this -> model -> fill ( $ group [ 'datas' ] ) -> save ( ) ; } continue ; } if ( $ key === 'hasOne' ) { for...
fill model datas to database
55,921
protected function getData ( ) { if ( ! $ this -> fileOptions ) { return $ this -> request -> all ( ) ; } $ excepts = collect ( $ this -> fileOptions ) -> keyBy ( function ( $ item ) { $ columns = explode ( '.' , $ item [ 'column' ] ) ; return count ( $ columns ) === 1 ? $ columns [ 0 ] : $ columns [ 1 ] ; } ) -> keys ...
get data if image column passed except it
55,922
private function preUploadFile ( $ exception ) { $ datas = [ ] ; foreach ( $ this -> fileOptions as $ options ) { $ result = $ this -> uploadFile ( $ options ) ; if ( $ result !== false ) { $ datas [ ] = $ result ; } } if ( ! empty ( $ datas ) && ! $ this -> fillModel ( $ datas ) ) { throw new $ exception ( $ this -> r...
pre upload file control function
55,923
protected function uploadFile ( $ options ) { if ( $ options [ 'type' ] === 'file' ) { $ this -> repo = new FileRepository ( $ options ) ; $ this -> hasFile = true ; } else { $ this -> repo = new ImageRepository ( $ options ) ; $ this -> hasPhoto = true ; } if ( ! $ this -> repo -> upload ( $ this -> model , $ this -> ...
upload file or files
55,924
protected function returnData ( $ type ) { $ data = [ 'result' => $ type ] ; if ( $ this -> hasPhoto ) { $ data [ 'photos' ] = $ this -> repo -> files ; } if ( $ this -> hasFile ) { $ data [ 'files' ] = $ this -> repo -> files ; } return $ data ; }
return data for api
55,925
protected function redirectRoute ( $ path , $ isUpdate = false ) { $ indexPos = strpos ( $ path , 'index' ) ; $ dotPos = strpos ( $ path , '.' ) ; $ slug = getModelSlug ( $ this -> model ) ; if ( $ indexPos === false && $ dotPos === false ) { return redirect ( lmbRoute ( "admin.{$slug}.{$path}" , [ 'id' => $ this -> mo...
return redirect url path
55,926
protected function setElfinderToOptions ( $ column ) { $ this -> fileOptions = collect ( $ this -> fileOptions ) -> map ( function ( $ item , $ key ) use ( $ column ) { if ( ( is_array ( $ column ) && $ key === $ column [ 'index' ] && $ item [ 'column' ] === $ column [ 'column' ] ) || $ item [ 'column' ] === $ column )...
set to file options is file from elfinder
55,927
protected function updateAlias ( $ model , $ events = [ ] , $ path = null ) { $ namespace = getBaseName ( $ model , 'Events' ) ; $ events = $ events ? $ events : [ 'success' => "{$namespace}\\UpdateSuccess" , 'fail' => "{$namespace}\\UpdateFail" , ] ; $ this -> setEvents ( $ events ) ; return $ this -> updateModel ( $ ...
update alias method
55,928
protected function groupAlias ( $ model , $ subBase = 'Events' ) { $ namespace = getBaseName ( $ model , $ subBase ) ; $ events = [ ] ; switch ( $ this -> request -> action ) { case 'activate' : $ events [ 'activationSuccess' ] = \ ErenMustafaOzdal \ LaravelUserModule \ Events \ Auth \ ActivateSuccess :: class ; $ even...
group operation alias method
55,929
protected function cloneModel ( $ model , $ lastCopy , $ changeColumns = [ ] , $ relations = [ ] ) { $ clone = $ model -> replicate ( ) ; $ clone -> copied_id = $ model -> id ; if ( is_null ( $ lastCopy ) ) { foreach ( $ changeColumns as $ column ) { $ clone -> $ column = "{$model->$column}-2" ; } } else { foreach ( $ ...
clone model and relation
55,930
protected function setModuleThumbnails ( $ category , $ model , $ uploadType ) { $ module = getModule ( get_called_class ( ) ) ; if ( is_null ( $ category -> thumbnails ) ) { return ; } Config :: set ( "{$module}.{$model}.uploads.{$uploadType}.thumbnails" , $ category -> thumbnails -> map ( function ( $ item ) { return...
set the module config
55,931
protected function listRunnables ( ) { $ commands = array_values ( Command :: getRegisteredCommands ( ) ) ; $ format = "| %8.60s | %-50.30s\n" ; printf ( $ format , "id" , "class" ) ; $ this -> env -> sendOutput ( '-----------------------------------' ) ; foreach ( $ commands as $ runnable ) { printf ( $ format , $ run...
Lists all registered runnables id .
55,932
protected function createRunnable ( ) { $ runnable = new StdClass ( ) ; $ response = $ this -> cmd -> question ( '1. Runnable class name? [required]' ) ; if ( strlen ( $ response ) < 3 ) { return $ this -> env -> sendOutput ( 'runnable class name is required.' , 'red' ) ; } $ runnable -> name = rtrim ( $ response ) ; $...
Creates a new runnable class .
55,933
protected function listRunnableCommands ( String $ runnableId ) { if ( ! Command :: hasCommand ( $ runnableId ) ) { $ this -> cmd -> error ( sprintf ( '[%s] is not a valid runnable id' , $ runnableId ) ) ; } $ runnable = Command :: getCommandById ( $ runnableId ) ; $ commands = $ runnable -> runnableCommands ( ) ; $ fo...
Lists commands available in a runnable object .
55,934
protected function displayHelpInformation ( ) { $ this -> env -> sendOutput ( 'PhoxPHP Command Line Interface help.' , 'green' ) ; $ this -> env -> sendOutput ( 'Usage:' . $ this -> env -> addTab ( ) . 'php console [command id] [...arguments]' ) ; $ this -> env -> sendOutput ( $ this -> env -> addTab ( ) . 'E.g: ' . 'p...
Displays cli help information .
55,935
protected function validate ( ) { if ( empty ( $ this -> author ) ) { throw new \ Exception ( 'Author is empty!' ) ; } if ( empty ( $ this -> classname ) ) { throw new \ Exception ( 'Class name is empty!' ) ; } if ( empty ( $ this -> namespace ) ) { throw new \ Exception ( 'Namespace is empty!' ) ; } if ( empty ( $ thi...
Check if config has required values .
55,936
protected function symlinkLegacyExtensionSiteAccesses ( string $ legacyExtensionPath , OutputInterface $ output ) : void { $ legacyRootDir = $ this -> getContainer ( ) -> getParameter ( 'ezpublish_legacy.root_dir' ) ; $ directories = [ ] ; $ path = $ legacyExtensionPath . '/root_' . $ this -> environment . '/settings/s...
Symlinks siteccesses from a legacy extension .
55,937
protected function symlinkLegacyExtensionOverride ( string $ legacyExtensionPath , OutputInterface $ output ) : void { $ legacyRootDir = $ this -> getContainer ( ) -> getParameter ( 'ezpublish_legacy.root_dir' ) ; $ sourceFolder = $ legacyExtensionPath . '/root_' . $ this -> environment . '/settings/override' ; if ( ! ...
Symlinks override folder from a legacy extension .
55,938
public function getRootPath ( ) { $ appPath = app_path ( ) ; $ folders = explode ( DIRECTORY_SEPARATOR , $ appPath ) ; array_pop ( $ folders ) ; $ rootPath = implode ( DIRECTORY_SEPARATOR , $ folders ) ; return $ rootPath . '/' ; }
Return path to the Laravel project root
55,939
public function indexAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( 'AnimeDbCatalogBundle:Label' ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ rep = $ this -> getDoctrine ( ) -> getManager ( ) -> getRepository ( 'AnimeDbCatalogBundle:Label'...
Edit labels .
55,940
private function MakeWords ( $ chunks ) { $ words = array ( ) ; $ index = 0 ; foreach ( $ chunks as $ chunk ) { $ one = isset ( $ chunk { 0 } ) ? intval ( $ chunk { 0 } ) : null ; $ ten = isset ( $ chunk { 1 } ) ? intval ( $ chunk { 1 } ) : null ; $ hundred = isset ( $ chunk { 2 } ) ? intval ( $ chunk { 2 } ) : null ; ...
Takes an array of number chunks in string form and generates the corresponding word forms of those chunks . It then reorganizes the chunks into the correct order .
55,941
public function filterByMime ( $ mime = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ mime ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_MIME , $ mime , $ comparison ) ; }
Filter the query on the mime column
55,942
public function filterBySha1 ( $ sha1 = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ sha1 ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_SHA1 , $ sha1 , $ comparison ) ; }
Filter the query on the sha1 column
55,943
public function filterByThumburl ( $ thumburl = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ thumburl ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_THUMBURL , $ thumburl , $ comparison ) ; }
Filter the query on the thumburl column
55,944
public function filterByThumbmime ( $ thumbmime = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ thumbmime ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_THUMBMIME , $ thumbmime , $ comparison ) ; }
Filter the query on the thumbmime column
55,945
public function filterByThumbwidth ( $ thumbwidth = null , $ comparison = null ) { if ( is_array ( $ thumbwidth ) ) { $ useMinMax = false ; if ( isset ( $ thumbwidth [ 'min' ] ) ) { $ this -> addUsingAlias ( MediaTableMap :: COL_THUMBWIDTH , $ thumbwidth [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } ...
Filter the query on the thumbwidth column
55,946
public function filterByThumbheight ( $ thumbheight = null , $ comparison = null ) { if ( is_array ( $ thumbheight ) ) { $ useMinMax = false ; if ( isset ( $ thumbheight [ 'min' ] ) ) { $ this -> addUsingAlias ( MediaTableMap :: COL_THUMBHEIGHT , $ thumbheight [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = tru...
Filter the query on the thumbheight column
55,947
public function filterByThumbsize ( $ thumbsize = null , $ comparison = null ) { if ( is_array ( $ thumbsize ) ) { $ useMinMax = false ; if ( isset ( $ thumbsize [ 'min' ] ) ) { $ this -> addUsingAlias ( MediaTableMap :: COL_THUMBSIZE , $ thumbsize [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( i...
Filter the query on the thumbsize column
55,948
public function filterByDescriptionurl ( $ descriptionurl = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ descriptionurl ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_DESCRIPTIONURL , $ descriptionurl , $ comparison ) ; }
Filter the query on the descriptionurl column
55,949
public function filterByDescriptionurlshort ( $ descriptionurlshort = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ descriptionurlshort ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_DESCRIPTIONURLSHORT , $ descriptionurlshort , $ compar...
Filter the query on the descriptionurlshort column
55,950
public function filterByImagedescription ( $ imagedescription = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ imagedescription ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_IMAGEDESCRIPTION , $ imagedescription , $ comparison ) ; }
Filter the query on the imagedescription column
55,951
public function filterByDatetimeoriginal ( $ datetimeoriginal = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ datetimeoriginal ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_DATETIMEORIGINAL , $ datetimeoriginal , $ comparison ) ; }
Filter the query on the datetimeoriginal column
55,952
public function filterByArtist ( $ artist = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ artist ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_ARTIST , $ artist , $ comparison ) ; }
Filter the query on the artist column
55,953
public function filterByLicenseshortname ( $ licenseshortname = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ licenseshortname ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_LICENSESHORTNAME , $ licenseshortname , $ comparison ) ; }
Filter the query on the licenseshortname column
55,954
public function filterByUsageterms ( $ usageterms = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ usageterms ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_USAGETERMS , $ usageterms , $ comparison ) ; }
Filter the query on the usageterms column
55,955
public function filterByAttributionrequired ( $ attributionrequired = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ attributionrequired ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_ATTRIBUTIONREQUIRED , $ attributionrequired , $ compar...
Filter the query on the attributionrequired column
55,956
public function filterByRestrictions ( $ restrictions = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ restrictions ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_RESTRICTIONS , $ restrictions , $ comparison ) ; }
Filter the query on the restrictions column
55,957
public function filterByTimestamp ( $ timestamp = null , $ comparison = null ) { if ( is_array ( $ timestamp ) ) { $ useMinMax = false ; if ( isset ( $ timestamp [ 'min' ] ) ) { $ this -> addUsingAlias ( MediaTableMap :: COL_TIMESTAMP , $ timestamp [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( i...
Filter the query on the timestamp column
55,958
public function filterByUser ( $ user = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ user ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_USER , $ user , $ comparison ) ; }
Filter the query on the user column
55,959
public function filterByMissing ( $ missing = null , $ comparison = null ) { if ( is_string ( $ missing ) ) { $ missing = in_array ( strtolower ( $ missing ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( MediaTableMap :: COL_MISSING , $ missing , $ compa...
Filter the query on the missing column
55,960
public function filterByKnown ( $ known = null , $ comparison = null ) { if ( is_string ( $ known ) ) { $ known = in_array ( strtolower ( $ known ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( MediaTableMap :: COL_KNOWN , $ known , $ comparison ) ; }
Filter the query on the known column
55,961
public function filterByImagerepository ( $ imagerepository = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ imagerepository ) ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( MediaTableMap :: COL_IMAGEREPOSITORY , $ imagerepository , $ comparison ) ; }
Filter the query on the imagerepository column
55,962
public function useC2MQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinC2M ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'C2M' , '\Attogram\SharedMedia\Orm\C2MQuery' ) ; }
Use the C2M relation C2M object
55,963
public function filterByM2P ( $ m2P , $ comparison = null ) { if ( $ m2P instanceof \ Attogram \ SharedMedia \ Orm \ M2P ) { return $ this -> addUsingAlias ( MediaTableMap :: COL_ID , $ m2P -> getMediaId ( ) , $ comparison ) ; } elseif ( $ m2P instanceof ObjectCollection ) { return $ this -> useM2PQuery ( ) -> filterBy...
Filter the query by a related \ Attogram \ SharedMedia \ Orm \ M2P object
55,964
public function authorize ( $ redirect_uri , $ scope = Client :: SCOPE_READ ) { header ( 'Location: ' . $ this -> getAuthorizeUri ( $ redirect_uri , $ scope ) ) ; exit ; }
Begin authorization .
55,965
public function getAuthorizeUri ( $ redirect_uri , $ scope = Client :: SCOPE_READ ) { $ state = sha1 ( mt_rand ( ) ) ; $ _SESSION [ $ this -> oauth_key ] = [ 'redirect_uri' => $ redirect_uri , 'scope' => $ scope , 'state' => $ state , ] ; return $ this -> client -> authorizationEndpoint ( ) . '?' . http_build_query ( [...
Generate and return the authorization URI .
55,966
public function getAuthorizationCode ( ) { if ( isset ( $ _GET [ 'error' ] ) ) { throw new OAuthException ( $ _GET [ 'error' ] , 1 ) ; } elseif ( ! isset ( $ _GET [ 'code' ] ) || ! isset ( $ _GET [ 'state' ] ) ) { throw new OAuthException ( 'Invalid parameters' , 2 ) ; } elseif ( ! isset ( $ _SESSION [ $ this -> oauth_...
Obtain an authorization code .
55,967
public function getToken ( $ authorization_code = null ) { if ( $ authorization_code == null ) { $ authorization_code = $ this -> getAuthorizationCode ( ) ; } $ params = $ _SESSION [ $ this -> oauth_key ] ; unset ( $ _SESSION [ $ this -> oauth_key ] ) ; $ response = $ this -> client -> post ( 'oauth/token' , [ 'client_...
Swap an authorization code for a token .
55,968
public function getEnumValues ( $ tableName , $ columnName ) { if ( ! $ this -> columnExists ( $ tableName , $ columnName ) ) { throw new \ PDOException ( sprintf ( "Unknown column '%s' in table '%s'." , $ columnName , $ tableName ) ) ; } $ dataType = $ this -> tableStructureCache [ $ tableName ] [ $ columnName ] [ 'da...
return all possible options of an enum or set attribute
55,969
public function publish ( \ Caridea \ Event \ Event $ event ) { foreach ( iterator_to_array ( $ this -> listeners ) as $ listener ) { $ listener -> notify ( $ event ) ; } }
Queues an event to be sent to Listeners .
55,970
public function maketbodyrows ( $ query , $ rowdesc , $ callback = null , & $ retresult = false , $ delim = false ) { list ( $ result , $ num ) = $ this -> query ( $ query , true ) ; if ( ! $ num ) { return false ; } if ( $ retresult !== false ) $ retresult = $ result ; $ rdelimlft = $ rdelimrit = "" ; if ( ! $ delim )...
Make Tbody Row
55,971
public function maketable ( $ query , array $ extra = null ) { $ table = "<table" ; if ( $ extra [ 'attr' ] ) { $ attr = $ extra [ 'attr' ] ; foreach ( $ attr as $ k => $ v ) { $ table .= " $k='$v'" ; } } $ table .= ">\n<thead>\n<tr>%<th>*</th>%</tr>\n</thead>" ; $ rowdesc = "<tr><td>*</td></tr>" ; $ delim = array ( "<...
Make a full table
55,972
protected function _initParent ( $ message = '' , $ code = 0 , RootException $ previous = null ) { parent :: __construct ( $ message , $ code , $ previous ) ; }
Calls the parent constructor .
55,973
public function explainPerms ( $ permissionNumber ) { $ firstFlag = $ this -> matchFirstFlagSingle ( $ permissionNumber ) ; $ permissionsString = substr ( sprintf ( '%o' , $ permissionNumber ) , - 4 ) ; $ numericalPermissions = $ this -> numericalPermissionsArray ( ) ; return [ 'Permissions' => $ permissionNumber , 'Co...
Returns an array with meaningfull content of permissions
55,974
public function create ( string $ className , array $ bindings = [ ] ) { try { $ class = new ReflectionClass ( $ className ) ; } catch ( ReflectionException $ ex ) { throw new ContainerException ( 'Failed to create reflection class from given class name.' ) ; } $ out = null ; if ( $ class -> getConstructor ( ) !== null...
Create a instance of given class name . The injector will try to handle constructor injection if it fails it will throw an exception .
55,975
public function prepareTitleForPersist ( $ title ) { $ transformedTitle = trim ( $ title ) ; $ transformedTitle = strip_tags ( $ transformedTitle ) ; $ transformedTitle = filter_var ( $ transformedTitle , FILTER_SANITIZE_STRING ) ; $ transformedTitle = ucwords ( $ transformedTitle ) ; return $ transformedTitle ; }
Transform title for persist .
55,976
public function prepareDescriptionForPersist ( $ description ) { $ description = html_entity_decode ( $ description ) ; $ description = strip_tags ( $ description ) ; $ description = filter_var ( $ description , FILTER_SANITIZE_STRING ) ; $ description = str_replace ( "\xc2\xa0" , '' , $ description ) ; $ description =...
Transform description for persist .
55,977
public function prepareSlugForPersist ( $ title , $ slug , $ id = false ) { $ separator = '-' ; if ( $ slug == "" ) { $ flip = $ separator == '-' ? '_' : '-' ; $ title = html_entity_decode ( $ title ) ; $ title = strip_tags ( $ title ) ; $ title = filter_var ( $ title , FILTER_SANITIZE_STRING ) ; $ title = str_replace ...
Prepare slug for persist .
55,978
public function isManuallyChangedSlugInEditForm ( $ slug , $ id = false ) { if ( ! $ id ) return false ; $ record = DB :: table ( $ this -> model -> table ) -> where ( 'id' , $ id ) -> first ( ) ; if ( $ record -> slug == $ slug ) { return false ; } else { return true ; } }
Was the slug changed in the edit form?
55,979
public function doesSlugAlreadyExist ( $ slug ) { $ rowCount = DB :: table ( $ this -> model -> table ) -> where ( 'slug' , $ slug ) -> count ( ) ; if ( $ rowCount > 0 ) return $ rowCount ; return 0 ; }
Does the slug already exist in the table?
55,980
public function prepareCanonicalURLForPersist ( $ slug ) { $ baseURL = rtrim ( config ( 'app.url' ) , "/" ) ; if ( $ this -> model -> table == "posts" ) $ type = "blog" ; return $ baseURL . '/' . $ slug ; }
Transform canonical_url for persist .
55,981
public function prepareURLForPersist ( $ url ) { if ( substr ( $ url , 0 , 7 ) == "http://" ) return $ url ; if ( substr ( $ url , 0 , 8 ) == "https://" ) return $ url ; $ washedUrl = "http://" ; $ washedUrl .= $ url ; return $ url ; }
Wash URL for persist .
55,982
public function prepareExcerptForPersist ( $ excerpt = "" , $ content ) { $ chars_to_excerpt = config ( 'lasallecmsapi.how_many_initial_chars_of_content_field_for_excerpt' ) ; if ( $ excerpt == "" ) { $ excerpt = $ content ; $ excerpt = html_entity_decode ( $ excerpt ) ; $ excerpt = strip_tags ( $ excerpt ) ; $ excerpt...
Transform excerpt for persist .
55,983
public function prepareMetaDescriptionForPersist ( $ meta_description = "" , $ excerpt ) { if ( $ meta_description == "" ) return $ excerpt ; $ meta_description = html_entity_decode ( $ meta_description ) ; $ meta_description = strip_tags ( $ meta_description ) ; $ meta_description = filter_var ( $ meta_description , F...
Transform meta_description for persist .
55,984
public function prepareCompositeTitleForPersist ( $ fieldsToConcatenate , $ data ) { $ composite_title = "" ; $ count = count ( $ fieldsToConcatenate ) ; $ i = 1 ; foreach ( $ fieldsToConcatenate as $ fieldToConcatenate ) { if ( ( $ data [ $ fieldToConcatenate ] == "" ) || ( ! $ data [ $ fieldToConcatenate ] ) || ( emp...
Concatenate fields for the composite Title field
55,985
public function prepareRelatedTableForPersist ( $ field , $ data ) { if ( ( ( $ data == "" ) || ( $ data == null ) || ( ! $ data ) || ( empty ( $ data ) ) ) && ( $ field [ 'nullable' ] ) ) { $ data = null ; } return $ data ; }
Prepare foreign key field for persist .
55,986
public function genericWashText ( $ text ) { $ text = strip_tags ( $ text ) ; $ text = filter_var ( $ text , FILTER_SANITIZE_STRING ) ; $ text = str_replace ( "\xc2\xa0" , '' , $ text ) ; $ text = str_replace ( "&#39;" , '' , $ text ) ; $ text = trim ( $ text ) ; return $ text ; }
A generic wash of plain ol text .
55,987
public function genericCreateSlug ( $ text ) { $ separator = '-' ; $ flip = $ separator == '-' ? '_' : '-' ; $ slug = $ this -> genericWashText ( $ text ) ; $ slug = preg_replace ( '![' . preg_quote ( $ flip ) . ']+!u' , $ separator , $ slug ) ; $ slug = preg_replace ( '![^' . preg_quote ( $ separator ) . '\pL\pN\s]+!u...
A generic method to create a slug based on any string .
55,988
public function onlineUsers ( ) : int { $ builder = $ this -> builder ( ) -> addSelect ( 'COUNT(DISTINCT([uid])) count' ) -> andWhere ( '[inserted] > %dt' , ( new \ DateTime ) -> modify ( '-' . $ this -> onlineTime . ' minute' ) ) -> andWhere ( '[timeOnPage] IS NOT null' ) ; return $ this -> execute ( $ builder ) -> fe...
Vrati online uzivatele
55,989
public function findVisitsHours ( Range $ interval , bool $ useTime = false ) : ? Result { $ date = $ useTime ? '%dt' : 'DATE(%dt)' ; $ subQuery = 'SELECT ' . 'DATE_FORMAT([inserted], "%%Y-%%m-%%d %%H:00:00") datefield, ' . 'COUNT([uid]) visits ' . 'FROM %table ' . 'WHERE ' . ( $ useTime ? '[inserted]' : 'DATE([inserte...
Vrati navstevy po hodinach
55,990
public function getByNameFirst ( $ value ) { $ users = [ ] ; foreach ( $ this as $ user ) { if ( $ user -> get ( 'nameFirst' ) ) { $ users [ ] = $ user ; } } return new $ this ( $ users ) ; }
example usage of more specific iterator will tidy the controllers even further
55,991
protected function inflateColumns ( $ columns ) { $ inflatedColumns = [ ] ; foreach ( $ columns as $ key => $ value ) { $ tableColumn = $ value ; $ label = ! is_numeric ( $ key ) ? $ key : null ; if ( is_string ( $ tableColumn ) ) { $ value = ( string ) $ value ; $ tableColumn = $ this -> createColumnFromString ( $ val...
Expands the columns array creating TableColumn objects where needed .
55,992
protected function getDataForPresenter ( $ dataKey , $ viewIndex = false ) { if ( ! isset ( $ this -> currentRow [ $ dataKey ] ) ) { return $ this -> model -> getBoundValue ( $ dataKey , $ viewIndex ) ; } $ value = $ this -> currentRow [ $ dataKey ] ; if ( $ value instanceof Model ) { return $ value -> UniqueIdentifier...
Provides model data to the requesting presenter .
55,993
public function getTemplate ( $ templatePath ) { $ absoluteTemplateFilePath = $ this -> getTemplateFilePath ( $ templatePath ) ; if ( ! $ absoluteTemplateFilePath ) { return ; } extract ( $ this -> getArrayCopy ( ) ) ; ob_start ( ) ; include $ absoluteTemplateFilePath ; $ content = ob_get_contents ( ) ; ob_end_clean ( ...
converts stored key values in iterator to output from template path requested
55,994
private function loadCustomerData ( ) { $ custId = $ this -> registry -> registry ( \ Magento \ Customer \ Controller \ RegistryConstants :: CURRENT_CUSTOMER_ID ) ; if ( $ custId ) { $ query = $ this -> qLoad -> build ( ) ; $ conn = $ query -> getConnection ( ) ; $ bind = [ QLoad :: BND_CUST_ID => $ custId ] ; $ rs = $...
Load block s working data before rendering .
55,995
public function getContent ( ) { foreach ( $ this -> dom -> documentElement -> childNodes as $ node ) { if ( $ node -> nodeName == 'content' ) { return $ node ; } } return null ; }
Gets the content section .
55,996
function log ( $ message , $ type = null , $ explicit = false ) { try { $ time = date ( 'Y-m-d|H:i:s' ) ; if ( $ type === null ) { $ this -> appendToFile ( date ( 'Y/m/d' ) , "[$time] $message" , $ explicit ) ; } else { $ this -> appendToFile ( $ type , "[$time] $message" , $ explicit ) ; } } catch ( \ Exception $ e ) ...
Logs a message . The type can be used as a hint to the logger on how to log the message . If the logger doesn t understand the type a file with the type name will be created as default behavior .
55,997
protected function appendToFile ( $ logfile , $ logstring , $ explicit = false ) { $ class = \ hlin \ PHP :: unn ( __CLASS__ ) ; $ sig = crc32 ( $ logstring ) ; $ filesig = crc32 ( $ sig . $ logfile ) ; if ( ! in_array ( $ filesig , $ this -> filesigs ) ) { $ fs = $ this -> fs ; $ filepath = $ this -> logspath . '/' . ...
Appeds to the logfile . The logfile is relative to the logs directory . If the logfile doesn t exist yet the system will create it . The . log extention is automatically appended along with a single newline character .
55,998
public function setValueAttribute ( $ value ) { if ( ! $ this -> isValid ( $ value ) ) { throw new InvalidValueException ( "The value in the field '" . get_class ( $ this ) . "' is invalid" ) ; } $ this -> attributes [ 'value' ] = $ this -> prepareValue ( $ value ) ; }
Validate and set the value
55,999
public function getArchitectureFromUserAgent ( $ userAgent , $ targetToAnalyze = 'os' ) { switch ( $ targetToAnalyze ) { case 'browser' : $ aReturn = $ this -> getArchitectureFromUserAgentBrowser ( $ userAgent ) ; break ; case 'os' : $ aReturn = $ this -> getArchitectureFromUserAgentOperatingSystem ( $ userAgent ) ; br...
Return CPU architecture details from given user agent