idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
7,200
public function aggregate ( $ collection , array $ pipeline , $ options = [ ] ) { $ data = $ this -> dbConnection -> selectCollection ( $ collection ) -> aggregate ( $ pipeline ) ; if ( $ data [ 'ok' ] != 1 ) { throw new Exception ( "Tool Aggregation Error: " . $ data [ 'errmsg' ] , $ data [ 'code' ] ) ; } return $ dat...
Run Aggregation through the Aggregation Pipeline
7,201
public function findOne ( $ collection , array $ criteria , array $ fields = [ ] ) { return $ this -> dbConnection -> selectCollection ( $ collection ) -> findOne ( $ criteria , $ fields ) ; }
returns the first found matching document
7,202
public function newObject ( $ collection ) { $ obj = $ this -> container -> get ( $ this -> classMap -> getClassForResult ( $ collection , [ ] ) ) ; $ obj -> setCollection ( $ collection ) ; return $ obj ; }
conveniant method to create new instances
7,203
public function jquery ( ) { $ this -> Html -> script ( 'libs/jquery.min.js' , $ this -> _setOptions ( [ 'alias' => __FUNCTION__ , 'weight' => self :: WEIGHT_CORE ] ) ) ; return $ this ; }
Include jquery lib .
7,204
public function jqueryFactory ( ) { $ this -> jquery ( ) ; $ this -> Html -> script ( 'libs/utils.min.js' , $ this -> _setOptions ( [ 'alias' => 'jquery-utils' , 'weight' => self :: WEIGHT_LIB ] ) ) ; $ this -> Html -> script ( 'libs/jquery-factory.min.js' , $ this -> _setOptions ( [ 'weight' => self :: WEIGHT_LIB , 'a...
Include jquery factory .
7,205
public function loadPluginAssets ( ) { $ plugin = ( string ) $ this -> request -> getParam ( 'plugin' ) ; $ prefix = ( $ this -> request -> getParam ( 'prefix' ) ) ? $ this -> request -> getParam ( 'prefix' ) . '/' : null ; $ action = ( string ) $ this -> request -> getParam ( 'action' ) ; $ controller = ( string ) $ t...
Autoload plugin assets .
7,206
public function materialize ( ) { $ this -> jquery ( ) ; $ this -> Html -> script ( 'libs/materialize.min.js' , $ this -> _setOptions ( [ 'alias' => __FUNCTION__ , 'weight' => self :: WEIGHT_LIB ] ) ) ; $ this -> Html -> css ( 'libs/materialize.min.css' , $ this -> _setOptions ( [ 'alias' => __FUNCTION__ , 'weight' => ...
Include materialize design .
7,207
public function toggleField ( $ selector = '.jsToggleField' , $ widget = 'JBZoo.FieldToggle' , array $ options = [ ] ) { $ this -> jqueryFactory ( ) ; $ this -> Html -> script ( 'Core.admin/widget/field-toggle.js' , $ this -> _setOptions ( [ 'alias' => __FUNCTION__ , 'weight' => self :: WEIGHT_WIDGET ] ) ) ; $ options ...
Include toggle field js widget .
7,208
public function exists ( ) { return ( $ this -> page_id > 0 || $ this -> file_id > 0 || $ this -> custom_url !== null || $ this -> shortcode !== null && $ this -> title !== null ) ; }
Determines if any of the properties in this field have a value meaning at least one of them is not NULL .
7,209
public function addGroupKeyToPostbox ( $ post ) { if ( $ post -> post_type !== 'acf-field-group' ) { return ; } global $ acfExportManagerHasGroupIdInSidebar ; if ( $ acfExportManagerHasGroupIdInSidebar ) { return ; } $ acfExportManagerHasGroupIdInSidebar = true ; $ fieldgroup = acf_get_field_group ( $ post -> ID ) ; ec...
Displays the fieldgroup key in misc publishing actions
7,210
public function deleteExport ( array $ fieldgroup ) : bool { $ filename = $ this -> getExportFilename ( $ fieldgroup ) ; $ this -> maybeUnlink ( $ this -> exportFolder . 'php/' . $ filename [ 'php' ] ) ; $ this -> maybeUnlink ( $ this -> exportFolder . 'json/' . $ filename [ 'json' ] ) ; return true ; }
Deletes export file for deleted fieldgroup
7,211
public function export ( array $ fieldgroup , bool $ restrictToExportPosts = true , bool $ translate = true ) : array { global $ locale ; $ locale = "en_US" ; if ( $ restrictToExportPosts && ! in_array ( $ fieldgroup [ 'key' ] , $ this -> exportPosts ) ) { return array ( ) ; } $ this -> maybeCreateExportFolders ( ) ; i...
Does the actual export of the php fields
7,212
public function getJson ( array $ fieldgroup ) : string { $ json = json_encode ( $ fieldgroup , JSON_PRETTY_PRINT ) ; $ json = str_replace ( '!!__(!!\'' , '' , $ json ) ; $ json = str_replace ( "!!', !!'" . $ this -> textdomain . "!!')!!" , '' , $ json ) ; return '[' . $ json . "]\n\r" ; }
Get fieldgroup as json
7,213
public function maybeCreateExportFolders ( ) { if ( ! is_writable ( $ this -> exportFolder ) ) { trigger_error ( 'The export folder (' . $ this -> exportFolder . ') is not writable. Exports will not be saved.' , E_USER_ERROR ) ; } if ( ! file_exists ( $ this -> exportFolder . 'json' ) ) { mkdir ( $ this -> exportFolder...
Creates export folders if needed
7,214
public function getExportFilename ( array $ fieldgroup ) : array { if ( $ key = array_search ( $ fieldgroup [ 'key' ] , $ this -> exportPosts ) ) { return array ( 'php' => $ key . '.php' , 'json' => $ key . '.json' ) ; } return array ( 'php' => sanitize_title ( $ fieldgroup [ 'title' ] ) . '.php' , 'json' => sanitize_t...
Get filename for the export file
7,215
protected function generatePhp ( int $ fieldgroupId , bool $ translate = true ) : string { $ strReplace = array ( " " => " " , "!!\'" => "'" , "'!!" => "" , "!!'" => "" , "array (" => "array(" , " => \n" => " => " ) ; $ pregReplace = array ( '/([\t\r\n]+?)array/' => 'array' , '/[0-9]+ => array/' => 'array' , '/=>(\...
Generates PHP exportcode for a fieldgroup
7,216
public function getFieldgroupParams ( int $ fieldgroupId , bool $ translate = true ) : array { $ fieldgroup = acf_get_field_group ( $ fieldgroupId ) ; if ( empty ( $ fieldgroup ) ) { trigger_error ( 'The fieldgroup with id "' . $ fieldgroupId . '" is empty.' , E_USER_WARNING ) ; return array ( ) ; } $ fieldgroup [ 'fie...
Get exportable fieldgroup params
7,217
public function translateFieldParams ( array $ field ) : array { $ keys = array ( 'prepend' , 'append' , 'placeholder' , 'default_value' ) ; foreach ( $ keys as $ key ) { if ( ! isset ( $ field [ $ key ] ) ) { continue ; } $ field [ $ key ] = acf_translate ( $ field [ $ key ] ) ; } if ( isset ( $ field [ 'sub_fields' ]...
Translate field params
7,218
public function setExportFolder ( string $ folder ) { $ folder = trailingslashit ( $ folder ) ; if ( ! file_exists ( $ folder ) ) { if ( ! mkdir ( $ folder ) ) { trigger_error ( 'The export folder (' . $ folder . ') can not be found. Exports will not be saved.' , E_USER_WARNING ) ; } else { chmod ( $ folder , 0777 ) ; ...
Set exports folder
7,219
public function autoExport ( array $ ids ) { $ this -> exportPosts = array_replace ( $ this -> exportPosts , $ ids ) ; $ this -> exportPosts = array_unique ( $ this -> exportPosts ) ; }
Sets which acf - fieldgroups postids to autoexport
7,220
public function handleBulkExport ( $ redirectTo , $ doaction , $ postIds ) { if ( $ doaction !== 'acfExportManager-export' ) { return $ redirectTo ; } foreach ( $ postIds as $ postId ) { $ fieldgroup = acf_get_field_group ( $ postId ) ; if ( ! in_array ( $ fieldgroup [ 'key' ] , $ this -> exportPosts ) ) { continue ; }...
Handles bulk exporting
7,221
public function hasCustomHandler ( ) { if ( ! class_exists ( \ App \ Exception \ Handler :: class ) ) { return false ; } if ( ! in_array ( \ Pharest \ Exception \ ExceptionHandler :: class , class_implements ( \ App \ Exception \ Handler :: class ) ) ) { return false ; } return true ; }
Determine if the app has custom exception handler
7,222
public static function relative ( $ ts ) { if ( ! ctype_digit ( $ ts ) ) $ ts = strtotime ( $ ts ) ; $ diff = time ( ) - $ ts ; if ( $ diff == 0 ) return __ ( 'Core::common.date.now' ) ; elseif ( $ diff > 0 ) { $ day_diff = floor ( $ diff / 86400 ) ; if ( $ day_diff == 0 ) { if ( $ diff < 60 ) return __ ( 'Core::common...
to string relative string
7,223
protected function render ( $ template , $ context = [ ] ) { $ context = array_merge ( $ this -> _context , $ context ) ; $ body = $ this -> twig -> render ( $ template , $ context ) ; return $ body ; }
render template with context will merge context with allready known context
7,224
public function truncateTables ( ) { $ dbName = env ( 'DB_DATABASE' ) ; $ tables = DB :: select ( 'SHOW TABLES WHERE `Tables_in_' . $ dbName . '` != ?' , [ 'migrations' ] ) ; DB :: statement ( 'SET FOREIGN_KEY_CHECKS=0;' ) ; foreach ( $ tables as $ table ) { DB :: table ( $ table -> { 'Tables_in_' . $ dbName } ) -> tru...
Truncates all tables except migrations .
7,225
public function getConfig ( $ type = null ) { $ types = [ 'php' => true , 'ini' => true ] ; $ type = isset ( $ types [ $ type ] ) ? $ type : 'ini' ; foreach ( [ 'app/config/' , 'config/' , 'apps/config/' , 'apps/frontend/config/' ] as $ configPath ) { if ( 'ini' == $ type && file_exists ( $ this -> rootPath . $ configP...
Tries to find the current configuration in the application
7,226
public function isAbsolutePath ( $ path ) { if ( strtoupper ( substr ( PHP_OS , 0 , 3 ) ) === 'WIN' ) { if ( preg_match ( '/^[A-Z]:\\\\/' , $ path ) ) { return true ; } } else { if ( substr ( $ path , 0 , 1 ) == DIRECTORY_SEPARATOR ) { return true ; } } return false ; }
Check if a path is absolute
7,227
public function add ( $ item ) { if ( strpos ( $ item , "<" ) !== false ) { $ macro = '_' ; } else { $ macro = CCStr :: extension ( $ item ) ; } if ( ! isset ( $ this -> assets [ $ macro ] ) ) { $ this -> assets [ $ macro ] = array ( ) ; } $ this -> assets [ $ macro ] [ ] = $ item ; }
Add an asset to the holder . Basically this method checks the file extension to sort them and generate the correct code using the macros .
7,228
public function getForm ( $ documentClass = null ) { if ( null === $ documentClass ) { $ documentClass = $ this -> getDocumentClass ( ) ; } $ builder = new AnnotationBuilder ( ) ; $ form = $ builder -> createForm ( $ documentClass ) ; $ hasDocument = false ; foreach ( $ form -> getElements ( ) as $ element ) { if ( met...
Retorna a form para o cadastro do documento .
7,229
public static function doSelectJoinCountry ( Criteria $ criteria , $ con = null , $ join_behavior = Criteria :: LEFT_JOIN ) { $ criteria = clone $ criteria ; if ( $ criteria -> getDbName ( ) == Propel :: getDefaultDB ( ) ) { $ criteria -> setDbName ( CustomerPeer :: DATABASE_NAME ) ; } CustomerPeer :: addSelectColumns ...
Selects a collection of Customer objects pre - filled with their Country objects .
7,230
public static function doDeleteAll ( PropelPDO $ con = null ) { if ( $ con === null ) { $ con = Propel :: getConnection ( CustomerPeer :: DATABASE_NAME , Propel :: CONNECTION_WRITE ) ; } $ affectedRows = 0 ; try { $ con -> beginTransaction ( ) ; $ affectedRows += CustomerPeer :: doOnDeleteCascade ( new Criteria ( Custo...
Deletes all rows from the customer table .
7,231
private function processStringData ( DataFromServerEvent $ event ) { $ regex = "/^(?:[:@]([^\\s]+) )?([^\\s]+)(?: ((?:[^:\\s][^\\s]* ?)*))?(?: ?:(.*))?$/" ; preg_match ( $ regex , $ event -> getData ( ) , $ matches ) ; if ( isset ( $ matches [ 2 ] ) && ( '' !== trim ( $ matches [ 2 ] ) ) ) { $ this -> dispatcher -> dis...
Process string response from server .
7,232
public function preSend ( Event $ e ) { $ validator = new NotEmpty ( ) ; if ( ! isset ( $ this -> options [ 'tokenOrLogin' ] ) || ! $ validator -> isValid ( $ this -> options [ 'tokenOrLogin' ] ) ) { throw new Exception \ InvalidArgumentException ( 'You need to set OAuth token!' ) ; } $ request = $ e -> getTarget ( ) ;...
Add Authorization Token to Header
7,233
public function action_create ( $ params ) { $ name = array_shift ( $ params ) ; $ file = \ DB \ Migrator :: path ( $ name ) ; \ CCFile :: write ( $ file , "# - ) ; }
Create new migration
7,234
public function schedule ( $ type , $ details ) { $ schedule = array ( ) ; $ schedule [ $ type ] = $ details ; return $ this -> setArgument ( "schedule" , $ schedule ) ; }
Schedule this message
7,235
private static function _getCharMap ( ) : array { static $ map = [ ] ; if ( empty ( $ map ) ) { foreach ( StringHelper :: asciiCharMap ( ) as $ asciiChar => $ charsArray ) { foreach ( $ charsArray as $ char ) { $ map [ $ char ] = $ asciiChar ; } } foreach ( self :: _getPunctuation ( ) as $ value ) { $ map [ $ value ] =...
Get array of chars to be used for conversion .
7,236
protected function addUserFlash ( SessionInterface $ session , $ type , $ message ) { $ session -> getFlashBag ( ) -> add ( $ type , $ message ) ; }
Adds a flash message to the given session .
7,237
public static function create ( $ file , $ type = null ) { if ( is_null ( $ type ) ) { $ type = CCStr :: extension ( $ file ) ; if ( ! in_array ( $ type , static :: $ available_image_types ) ) { $ type = null ; } } $ image_data = getimagesize ( $ file ) ; if ( $ image_data === false ) { return false ; } $ image = null ...
Create a image from file
7,238
public static function string ( $ string , $ type = null ) { $ image = imagecreatefromstring ( $ string ) ; if ( $ image !== false ) { return new static ( $ image , $ type ) ; } return false ; }
Create an image from string
7,239
public static function aspect_ratio ( $ width , $ height , $ proper = false ) { $ ratio = $ width / $ height ; if ( ! $ proper ) { return $ ratio ; } $ tolerance = 1.e-6 ; $ h1 = 1 ; $ h2 = 0 ; $ k1 = 0 ; $ k2 = 1 ; $ b = 1 / $ ratio ; do { $ b = 1 / $ b ; $ a = floor ( $ b ) ; $ aux = $ h1 ; $ h1 = $ a * $ h1 + $ h2 ;...
Calculate the aspect ratio
7,240
protected function reload_context_info ( ) { $ this -> width = imagesx ( $ this -> image_context ) ; $ this -> height = imagesy ( $ this -> image_context ) ; }
Reload the image dimension etc .
7,241
protected function set_type ( $ type , $ overwrite = true ) { if ( ! is_null ( $ type ) ) { if ( ! in_array ( $ type , static :: $ available_image_types ) ) { throw new CCException ( "CCImage - Invalid image type '" . $ type . "'." ) ; } if ( $ type === 'jpg' ) { $ type = 'jpeg' ; } if ( $ overwrite ) { $ this -> type ...
Set the current image type
7,242
public function stream ( $ quality = null , $ type = null ) { $ this -> save ( null , $ quality , $ type ) ; }
Send the image to the output buffer
7,243
public function stringify ( $ quality = null , $ type = null ) { ob_start ( ) ; $ this -> stream ( $ quality , $ type ) ; return ob_get_clean ( ) ; }
Return the image data as string
7,244
public function response ( $ quality = null , $ type = null ) { $ response = CCResponse :: create ( $ this -> stringify ( $ quality , $ type ) ) ; if ( ! is_null ( $ this -> type ) ) { $ response -> header ( 'Content-Type' , 'image/' . $ this -> type ) ; } return $ response ; }
Create a CCRespone of the image
7,245
public function resize ( $ width , $ height , $ mode = null ) { if ( strpos ( $ width , 'x' ) !== false ) { $ mode = $ height ; $ dimensions = explode ( 'x' , $ width ) ; $ width = $ dimensions [ 0 ] ; $ height = $ dimensions [ 1 ] ; } if ( is_null ( $ mode ) ) { $ mode = 'strict' ; } if ( $ width == 'auto' ) { $ mode ...
Resize the image
7,246
public function resize_landscape ( $ width , $ ignore_me ) { $ height = $ width * ( $ this -> height / $ this -> width ) ; return $ this -> resize_strict ( $ width , $ height ) ; }
Resize the current image from width and keep aspect ratio
7,247
public function resize_portrait ( $ height , $ ignore_me ) { $ width = $ height * ( $ this -> width / $ this -> height ) ; return $ this -> resize_strict ( $ width , $ height ) ; }
Resize the current image from height and keep aspect ratio
7,248
public function resize_max ( $ width , $ height ) { $ new_width = $ this -> width ; $ new_height = $ this -> height ; if ( $ new_width > $ width ) { $ new_width = $ width ; $ new_height = $ new_width * ( $ this -> height / $ this -> width ) ; } if ( $ new_height > $ height ) { $ new_height = $ height ; $ new_width = $ ...
Resize the image that it fits into a size doesn t crop and does not add a border
7,249
public function resize_fit ( $ width , $ height , $ background_color = '#fff' ) { $ background = static :: blank ( $ width , $ height ) ; static :: resize_max ( $ width , $ height ) ; $ background -> fill_color ( $ background_color ) ; $ background -> add_layer ( $ this , 'center' , 'middle' ) ; $ this -> image_context...
Resize the image that it fits into a size doesn t crop adds a background layer
7,250
public function resize_fill ( $ width , $ height ) { $ original_aspect = $ this -> width / $ this -> height ; $ thumb_aspect = $ width / $ height ; if ( $ original_aspect >= $ thumb_aspect ) { $ new_height = $ height ; $ new_width = $ this -> width / ( $ this -> height / $ height ) ; } else { $ new_width = $ width ; $ ...
Resize the image to fill the new size . This will crop your image .
7,251
public function resize_strict ( $ width , $ height ) { if ( ! ( $ width > 0 ) || ! ( $ height > 0 ) ) { throw new CCException ( "CCImage::resize_strict - width and height can't be smaller then 1" ) ; } $ result = imagecreatetruecolor ( $ width , $ height ) ; imagecopyresampled ( $ result , $ this -> image_context , 0 ,...
Resize the current image to strict dimensions
7,252
public function crop ( $ x , $ y , $ width , $ height ) { if ( $ x == 'center' || $ x == 'auto' ) { $ x = ( $ this -> width / 2 ) - ( $ width / 2 ) ; } if ( $ y == 'middle' || $ y == 'auto' ) { $ y = ( $ this -> height / 2 ) - ( $ height / 2 ) ; } $ result = imagecreatetruecolor ( $ width , $ height ) ; ImageCopyResamp...
Crop the current image
7,253
public function add_layer ( CCImage $ image , $ x = 0 , $ y = 0 , $ alpha = 100 ) { if ( $ x == 'center' || $ x == 'auto' ) { $ x = ( $ this -> width / 2 ) - ( $ image -> width / 2 ) ; } elseif ( $ x == 'left' ) { $ x = 0 ; } elseif ( $ x == 'right' ) { $ x = $ this -> width - $ image -> width ; } if ( $ y == 'middle' ...
add an layer to the current image
7,254
public function fill_color ( $ color , $ alpha = 1 ) { $ alpha = $ alpha * 127 ; $ color = CCColor :: create ( $ color ) ; $ color = imagecolorallocatealpha ( $ this -> image_context , $ color -> RGB [ 0 ] , $ color -> RGB [ 1 ] , $ color -> RGB [ 2 ] , $ alpha ) ; imagefill ( $ this -> image_context , 0 , 0 , $ color ...
fill the current image with an color you can pass an array with rgb or hex string
7,255
public function blur ( $ ratio = 5 ) { for ( $ x = 0 ; $ x < $ ratio ; $ x ++ ) { imagefilter ( $ this -> image_context , IMG_FILTER_GAUSSIAN_BLUR ) ; } return $ this ; }
Blur the image using the gaussian blur .
7,256
public function get_luminance ( $ num_samples = 10 ) { $ x_step = ( int ) $ this -> width / $ num_samples ; $ y_step = ( int ) $ this -> height / $ num_samples ; $ total_lum = 0 ; $ sample_no = 1 ; for ( $ x = 0 ; $ x < $ this -> width ; $ x += $ x_step ) { for ( $ y = 0 ; $ y < $ this -> height ; $ y += $ y_step ) { $...
Get the average luminance of the image
7,257
function flip ( $ mode ) { $ width = $ this -> width ; $ height = $ this -> height ; $ src_x = 0 ; $ src_y = 0 ; $ src_width = $ width ; $ src_height = $ height ; switch ( $ mode ) { case 'vertical' : $ src_y = $ height - 1 ; $ src_height = - $ height ; break ; case 'horizontal' : $ src_x = $ width - 1 ; $ src_width = ...
Flip an image
7,258
public function work ( $ file , $ customFilters = null , $ customDeployer = null ) { foreach ( $ this -> assetsSource as $ source ) { if ( is_file ( $ source . DIRECTORY_SEPARATOR . $ file ) ) { $ asset = $ this -> objectsFactory -> buildAsset ( $ source . DIRECTORY_SEPARATOR . $ file ) ; } } if ( ! isset ( $ asset ) )...
Processes and deploys an asset and returns an Asset instance with modified properties according to used filters and deployers .
7,259
private function deployAsset ( $ deploy , Asset $ asset ) { if ( $ this -> loadDeployer ( $ deploy ) ) { try { $ this -> deployersInstances [ $ deploy ] -> deploy ( $ asset ) ; } catch ( PhassetsInternalException $ e ) { $ this -> loadedLogger -> error ( 'An error occurred while deploying the asset: ' . $ e ) ; } } }
Tries to load a deployer and passes the Asset instance through it .
7,260
private function loadFilter ( $ class ) { if ( isset ( $ this -> filtersInstances [ $ class ] ) ) { return true ; } $ filter = $ this -> objectsFactory -> buildFilter ( $ class , $ this -> loadedConfigurator ) ; if ( $ filter === false ) { $ this -> loadedLogger -> warning ( 'Could not load ' . $ class . ' filter.' ) ;...
Try to create & load an instance of a given Filter class name .
7,261
private function loadDeployer ( $ class ) { if ( isset ( $ this -> deployersInstances [ $ class ] ) ) { return true ; } $ deployer = $ this -> objectsFactory -> buildDeployer ( $ class , $ this -> loadedConfigurator , $ this -> loadedCacheAdapter ) ; if ( $ deployer === false ) { $ this -> loadedLogger -> warning ( 'Co...
Try to create & load an instance of a given Deployer class name .
7,262
private function loadAssetsManager ( $ class ) { if ( isset ( $ this -> assetsMergerInstances [ $ class ] ) ) { return true ; } $ merger = $ this -> objectsFactory -> buildAssetsMerger ( $ class , $ this -> loadedConfigurator ) ; if ( $ merger === false ) { $ this -> loadedLogger -> warning ( 'Could not load ' . $ clas...
Try to create & load an instance of a given AssetsMerger class name .
7,263
public function populateIndex ( ) { $ this -> buildDocumentsByManager ( $ this -> doctrine ) ; if ( $ this -> mongo ) { $ this -> buildDocumentsByManager ( $ this -> mongo ) ; } if ( ! empty ( $ this -> documents ) ) { $ response = $ this -> searchProvider -> addDocuments ( $ this -> documents ) ; $ this -> documents =...
Populate the indexes
7,264
protected function render ( $ view , array $ parameters = array ( ) , Response $ response = null ) { return $ this -> app -> render ( $ view , $ parameters , $ response ) ; }
Render to response twig views .
7,265
public function redirectMyContentTypeNode ( GetResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ language = $ this -> languageManager -> getCurrentLanguage ( ) -> getId ( ) ; if ( $ request -> attributes -> get ( '_route' ) !== 'entity.node.canonical' ) { return ; } if ( $ request -> attributes -> get...
Redirect requests for challenge go to custom module controller route .
7,266
public function setBody ( $ body ) { if ( is_array ( $ body ) || is_object ( $ body ) ) $ this -> body = ( object ) $ body ; else $ this -> body = $ body ; return $ this ; }
Setzt den RequestBody
7,267
public function profile ( OutputInterface $ output , array $ response ) { $ this -> printList ( $ output , [ 'Fullname' , 'Username' , 'Email' , 'Admin' , 'Notifications' ] , [ 'fullname' , 'username' , 'email' , 'admin' , 'notifications' ] , $ response , function ( $ key , $ value ) { if ( 'Notifications' !== $ key ) ...
output for the profile api .
7,268
public function comments ( OutputInterface $ output , array $ response ) { $ table = $ this -> createTable ( $ output ) ; $ table -> setHeaders ( [ 'Name' , 'Language' , 'Version' , 'Type' , 'Date' , 'Comment' ] ) ; foreach ( $ response [ 'comments' ] as $ comment ) { $ table -> addRow ( [ $ comment [ 'product' ] [ 'na...
output for the comments api .
7,269
public function setMeta ( $ name , $ content = NULL , $ httpEquiv = FALSE , $ scheme = NULL ) { $ meta = HTML :: Tag ( 'meta' ) ; $ meta -> setOption ( 'selfClosing' , TRUE ) ; if ( $ content === NULL ) { $ this -> removeMeta ( $ name ) ; } else { if ( isset ( $ name ) ) { if ( ! $ httpEquiv ) $ meta -> setAttribute ( ...
Setzt ein Meta Attribut
7,270
public function validate ( $ data ) { if ( isset ( $ this -> callback ) ) { return $ this -> callback -> call ( array ( $ data ) ) ; } throw new \ Psc \ Exception ( 'empty rule!' ) ; }
Validiert die gespeicherte Rule
7,271
public function getForm ( $ entityClass = null ) { if ( null === $ entityClass ) { $ entityClass = $ this -> getEntityClass ( ) ; } $ builder = new AnnotationBuilder ( ) ; $ form = $ builder -> createForm ( $ entityClass ) ; $ hasEntity = false ; foreach ( $ form -> getElements ( ) as $ element ) { if ( method_exists (...
Retorna a form para o cadastro da entidade .
7,272
public function getQueryFrom ( DatatableViewInterface $ datatableView ) { $ twig = $ datatableView -> getTwig ( ) ; $ type = $ datatableView -> getAjax ( ) -> getType ( ) ; $ parameterBag = null ; if ( 'GET' === strtoupper ( $ type ) ) { $ parameterBag = $ this -> request -> query ; } if ( 'POST' === strtoupper ( $ typ...
Get query .
7,273
public static function create ( $ modelAlias = null , $ criteria = null ) { if ( $ criteria instanceof UserCustomerRelationQuery ) { return $ criteria ; } $ query = new UserCustomerRelationQuery ( null , null , $ modelAlias ) ; if ( $ criteria instanceof Criteria ) { $ query -> mergeWith ( $ criteria ) ; } return $ que...
Returns a new UserCustomerRelationQuery object .
7,274
public function filterByUser ( $ user , $ comparison = null ) { if ( $ user instanceof User ) { return $ this -> addUsingAlias ( UserCustomerRelationPeer :: USER_ID , $ user -> getId ( ) , $ comparison ) ; } elseif ( $ user instanceof PropelObjectCollection ) { if ( null === $ comparison ) { $ comparison = Criteria :: ...
Filter the query by a related User object
7,275
private static function prepare ( $ type , $ message ) { $ type = strtolower ( $ type ) ; if ( ! in_array ( $ type , static :: $ _types ) ) { throw new Exception ( "UI\Alert - Unknown alert type '{$type}'!" ) ; } if ( ! is_array ( $ message ) ) { return array ( $ message ) ; } return $ message ; }
Validate the alert type and format the message
7,276
public function getCloudStorage ( ) : ? Cloud { if ( ! $ this -> hasCloudStorage ( ) ) { $ this -> setCloudStorage ( $ this -> getDefaultCloudStorage ( ) ) ; } return $ this -> cloudStorage ; }
Get cloud storage
7,277
public function getDefaultCloudStorage ( ) : ? Cloud { $ manager = Storage :: getFacadeRoot ( ) ; if ( isset ( $ manager ) ) { return $ manager -> disk ( ) ; } return $ manager ; }
Get a default cloud storage value if any is available
7,278
public function stream ( ) { if ( ob_get_level ( ) ) { ob_end_clean ( ) ; } if ( $ fd = fopen ( $ this -> path , 'rb' ) ) { while ( ! feof ( $ fd ) ) { echo fread ( $ fd , 1024 ) ; } fclose ( $ fd ) ; } }
Transfer an image to the browser
7,279
protected function getCachingHeaders ( $ fileinfo ) { $ last_modified = gmdate ( 'D, d M Y H:i:s' , $ fileinfo [ 9 ] ) . ' GMT' ; $ etag = md5 ( $ last_modified ) ; $ if_modified_since = $ this -> server_value ( 'HTTP_IF_MODIFIED_SINCE' , false ) ; $ if_none_match = $ this -> server_value ( 'HTTP_IF_NONE_MATCH' , false...
Set file headers that handle If - Modified - Since correctly for the given fileinfo .
7,280
public function addCode ( $ tableName , $ columnName = 'code' ) { $ this -> addColumn ( '{{%' . $ tableName . '}}' , $ columnName , $ this -> string ( 32 ) -> comment ( 'Code for this item, used identifying when needed. Another criteria to replace ID because ID is auto-increment' ) ) ; $ this -> createIndex ( $ tableNa...
Add and put index to code column Use if identity an item alternatively to ID
7,281
public function addCreatorID ( $ tableName , $ columnName = 'creator_id' ) { $ this -> addColumn ( '{{%' . $ tableName . '}}' , $ columnName , $ this -> bigInteger ( ) -> comment ( 'ID of user who created this item' ) ) ; $ this -> createIndex ( $ tableName . '_' . $ columnName . '_idx' , '{{%' . $ tableName . '}}' , $...
Add and put Index to creator_id column Store id of user who create this record
7,282
public function setAutoCompleteRequestMeta ( \ Psc \ CMS \ AutoCompleteRequestMeta $ autoCompleteRequestMeta ) { $ this -> acRequestMeta = $ autoCompleteRequestMeta ; $ this -> avaibleItems = NULL ; return $ this ; }
Ist dies gesetzt wird avaibleItems ignoriert
7,283
public static function attachLabel ( $ element , $ label , $ type = self :: LABEL_TOP ) { Code :: value ( $ type , self :: LABEL_TOP , self :: LABEL_CHECKBOX ) ; if ( $ label != NULL ) { $ element -> templateContent -> label = fHTML :: label ( $ label , $ element ) -> addClass ( '\Psc\label' ) ; if ( $ type == self :: ...
benutzt von dropBox2
7,284
public static function hasTrait ( $ class , $ traitName , $ isRecursive = false ) { if ( is_string ( $ class ) ) { $ class = new \ ReflectionClass ( $ class ) ; } if ( in_array ( $ traitName , $ class -> getTraitNames ( ) , true ) ) { return true ; } $ parentClass = $ class -> getParentClass ( ) ; if ( ( false === $ is...
Return true if the given object use the given trait FALSE if not .
7,285
public function sort ( array $ sorts = array ( ) ) { if ( func_num_args ( ) === 0 ) { return $ this -> sorts ; } $ this -> sorts = array ( ) ; foreach ( $ sorts as $ key => $ value ) { if ( $ key [ 0 ] === '$' ) { $ key [ 0 ] = '_' ; } $ this -> sorts [ $ key ] = $ value ; } return $ this ; }
When argument specified will set new sorts otherwise will return existing sorts
7,286
public function match ( $ q ) { if ( is_null ( $ q ) ) { return $ this ; } $ orCriteria = array ( ) ; $ schema = $ this -> collection -> schema ( ) ; if ( empty ( $ schema ) ) { throw new \ Exception ( '[Norm\Cursor] Cannot use match for schemaless collection' ) ; } foreach ( $ schema as $ key => $ value ) { $ orCriter...
Set query to match on every field exists in schema . Beware this will override criteria
7,287
public function toArray ( $ plain = false ) { $ result = array ( ) ; foreach ( $ this as $ key => $ value ) { if ( $ plain ) { $ result [ ] = $ value -> toArray ( ) ; } else { $ result [ ] = $ this -> connection -> unmarshall ( $ value ) ; } } return $ result ; }
Extract data into array of models .
7,288
public function import ( array $ data ) { $ response = $ this -> client -> post ( "{$this->uriImport}product/" , [ 'json' => $ data , 'query' => [ 'key' => $ this -> config [ 'data' ] [ 'key' ] , ] , ] ) ; $ response = json_decode ( $ response -> getBody ( ) , true ) ; if ( isset ( $ response [ 'affected' ] ) && $ resp...
Atomic product import .
7,289
public function search ( array $ data ) { if ( ! isset ( $ data [ 'size' ] ) ) { $ data [ 'size' ] = 10 ; } $ response = $ this -> client -> post ( "{$this->uriSearch}search/" , [ 'json' => $ data , 'query' => [ 'key' => $ this -> config [ 'search' ] [ 'key' ] , ] , ] ) ; $ response = json_decode ( $ response -> getBod...
Product Search .
7,290
public function delete ( $ id ) { $ response = false ; if ( empty ( $ id ) ) { throw new \ InvalidArgumentException ( 'ID Product cannot be empty' ) ; } try { $ apiResponse = $ this -> client -> delete ( "{$this->uriImport}product/{$id}" , [ 'query' => [ 'key' => $ this -> config [ 'data' ] [ 'key' ] , ] , ] ) ; $ apiR...
Product Delete .
7,291
public function addAlias ( $ location , $ path ) { $ this -> setVar ( 'aliases' , $ this -> getVar ( 'aliases' ) . sprintf ( "\n Alias %s %s" , $ location , $ this -> replaceHelpers ( $ path ) ) ) ; return $ this ; }
Adds an Location alias
7,292
public function findSubjects ( Category $ category , $ getQuery = false ) { $ dql = " SELECT s.id as id, COUNT(m_count.id) AS count_messages, MAX(m.creationDate) AS last_message_created, s.id as subjectId, s.title as title, s.isSticked as isSticked, ...
Deep magic goes here . Gets a subject with some of its last messages datas .
7,293
public function getMemoryUsageData ( ) { if ( null === $ this -> memoryUsageData ) { $ memoryUsage = memory_get_usage ( ) ; $ unit = [ 'B' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' ] ; $ this -> memoryUsageData = [ round ( $ memoryUsage / pow ( 1024 , ( $ i = floor ( log ( $ memoryUsage , 1024 ) ) ) ) , 2 ) , $ unit [ $ i ] ]...
Return the application memory usage data .
7,294
public function setConfiguration ( array $ config = [ ] ) { $ config = $ config + $ this -> getDefaultConfiguration ( ) ; if ( ! empty ( $ config [ 'debug' ] ) ) { $ this -> config = $ config ; } return $ config ; }
Return application configuration values .
7,295
private function generateNotFoundPlainResponse ( ServerRequestInterface $ request ) : ResponseInterface { $ response = ( $ this -> responseFactory ) ( ) -> withStatus ( StatusCodeInterface :: STATUS_NOT_FOUND ) ; $ response -> getBody ( ) -> write ( \ sprintf ( "Encountered a 404 Error, %s doesn't exist" , ( string ) $...
Generates a plain text response indicating the request method and URI .
7,296
private function generateTemplateResponse ( Renderer $ renderer , ServerRequestInterface $ request ) : ResponseInterface { $ response = ( $ this -> responseFactory ) ( ) -> withStatus ( StatusCodeInterface :: STATUS_NOT_FOUND ) ; $ response -> getBody ( ) -> write ( $ renderer -> render ( $ this -> template , [ 'reques...
Generates a response using a template .
7,297
public function action_uninstall ( $ params ) { $ path = $ params [ 0 ] ; if ( empty ( $ path ) ) { CCCli :: line ( 'no ship path given.' , 'red' ) ; return ; } if ( substr ( $ path , 0 , 1 ) == '/' ) { if ( substr ( $ path , - 1 ) != '/' ) { $ path .= '/' ; } if ( ! is_dir ( $ path ) ) { CCCli :: line ( 'could not fin...
uninstall an orbit module
7,298
private function config ( ) { $ this -> loadViewsFrom ( __DIR__ . '/views' , 'center' ) ; $ this -> loadTranslationsFrom ( __DIR__ . '/translations' , 'center' ) ; $ this -> publishes ( [ __DIR__ . '/../assets/public' => public_path ( 'vendor/center' ) , ] , 'public' ) ; $ this -> publishes ( [ __DIR__ . '/config' => c...
set up publishes paths and define config locations
7,299
function isNumberIn ( $ number , $ integerConstraint = true ) { foreach ( $ this -> parts as $ part ) { if ( is_array ( $ part ) ) { if ( ( ! $ integerConstraint || floor ( $ number ) === ( float ) $ number ) && $ number >= $ part [ 0 ] && $ number <= $ part [ 1 ] ) { return true ; } } else { if ( $ number == $ part ) ...
Determine if the given number is inside the range .