idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
900 | private function parseRow ( \ stdClass $ dataRow , NodePath $ nodePath , array $ parentCols = [ ] , $ outerObjectHash = null ) { $ csvRow = new CsvRow ( $ this -> getHeaders ( $ nodePath , $ parentCols ) ) ; $ arrayParentId = $ this -> getPrimaryKeyValue ( $ dataRow , $ nodePath , $ outerObjectHash ) ; $ columns = $ th... | Parse a single row If the row contains an array it s recursively parsed |
901 | private function getHeaders ( NodePath $ nodePath , & $ parent = false ) { $ headers = [ ] ; $ nodeData = $ this -> structure -> getNode ( $ nodePath ) ; if ( $ nodeData [ 'nodeType' ] == 'scalar' ) { $ headers [ ] = $ nodeData [ 'headerNames' ] ; } if ( is_array ( $ parent ) && ! empty ( $ parent ) ) { foreach ( $ par... | Get column names for a particular node path |
902 | private function createCsvFile ( $ type , NodePath $ nodePath , & $ parentId ) { if ( empty ( $ this -> csvFiles [ $ type ] ) ) { $ this -> csvFiles [ $ type ] = Table :: create ( $ type , $ this -> getHeaders ( $ nodePath , $ parentId ) , $ this -> temp ) ; $ this -> csvFiles [ $ type ] -> addAttributes ( [ "fullDispl... | to allow saving a single type to different files |
903 | private function validateParentId ( $ parentId ) : array { if ( ! empty ( $ parentId ) ) { if ( is_array ( $ parentId ) ) { if ( count ( $ parentId ) != count ( $ parentId , COUNT_RECURSIVE ) ) { throw new JsonParserException ( 'Error assigning parentId to a CSV file! $parentId array cannot be multidimensional.' , [ 'p... | Ensure the parentId array is not multidimensional |
904 | public function getCsvFiles ( ) { while ( $ batch = $ this -> cache -> getNext ( ) ) { $ this -> parse ( $ batch [ "data" ] , new NodePath ( [ $ batch [ 'type' ] , Structure :: ARRAY_NAME ] ) , $ batch [ "parentId" ] ) ; } return $ this -> csvFiles ; } | Returns an array of CSV files containing results |
905 | public function login ( Request $ request , AuthenticateUser $ authenticate , ThrottlesCommand $ throttles ) { $ username = Authen :: getIdentifierName ( ) ; $ input = $ request -> only ( [ $ username , 'password' , 'remember' ] ) ; $ throttles -> setRequest ( $ request ) -> setLoginKey ( $ username ) ; return $ authen... | POST Login the user . |
906 | public function userLoginHasFailedAuthentication ( array $ input ) { $ message = trans ( 'orchestra/foundation::response.credential.invalid-combination' ) ; return $ this -> redirectWithMessage ( $ this -> getRedirectToLoginPath ( ) , $ message , 'error' ) -> withInput ( ) ; } | Response to user log - in trigger has failed authentication . |
907 | public function profile ( $ model , $ url ) { return $ this -> form -> of ( 'orchestra.account' , function ( FormGrid $ form ) use ( $ model , $ url ) { $ form -> setup ( $ this , $ url , $ model ) ; $ form -> hidden ( 'id' ) ; $ form -> fieldset ( function ( Fieldset $ fieldset ) { $ fieldset -> control ( 'input:text'... | Form view generator for User Account . |
908 | public function activationHasSucceed ( Fluent $ extension ) { $ this -> dispatch ( new RefreshRouteCache ( ) ) ; $ message = trans ( 'orchestra/foundation::response.extensions.activate' , $ extension -> getAttributes ( ) ) ; return $ this -> redirectWithMessage ( handles ( 'orchestra::extensions' ) , $ message ) ; } | Response when extension activation has succeed . |
909 | protected function markAsRegistered ( $ provider ) { $ this [ 'events' ] -> dispatch ( \ get_class ( $ provider ) , [ $ provider ] ) ; parent :: markAsRegistered ( $ provider ) ; } | Mark the given provider as registered . |
910 | public function configure ( Processor $ processor , $ vendor , $ package = null ) { $ extension = $ this -> getExtension ( $ vendor , $ package ) ; return $ processor -> configure ( $ this , $ extension ) ; } | Configure an extension . |
911 | public function update ( Processor $ processor , $ vendor , $ package = null ) { $ extension = $ this -> getExtension ( $ vendor , $ package ) ; return $ processor -> update ( $ this , $ extension , Input :: all ( ) ) ; } | Update extension configuration . |
912 | public function showConfigurationChanger ( array $ data ) { $ name = $ data [ 'extension' ] -> name ; set_meta ( 'title' , Foundation :: memory ( ) -> get ( "extensions.available.{$name}.name" , $ name ) ) ; set_meta ( 'description' , trans ( 'orchestra/foundation::title.extensions.configure' ) ) ; return view ( 'orche... | Response for extension configuration . |
913 | public function load ( string $ helper ) { if ( isset ( $ this -> filters [ $ helper ] ) ) { return call_user_func_array ( $ this -> filters [ $ helper ] , array_slice ( func_get_args ( ) , 1 ) ) ; } } | Check if filter is registered call filter if is registered |
914 | public function collect ( ) { $ self = $ this ; $ fileSystem = new FileSystem ( ) ; $ environment = $ this -> environment ; $ this -> testTargetRepository -> walkOnResources ( function ( $ resource , $ index , TestTargetRepository $ testTargetRepository ) use ( $ self , $ fileSystem , $ environment ) { $ absoluteTarget... | Collects tests . |
915 | protected function getRecord ( $ tableName , $ where = null ) { $ record = $ this -> database -> table ( $ tableName ) -> order ( 'RAND()' ) ; return $ where ? $ record -> where ( $ where ) -> limit ( 1 ) -> fetch ( ) : $ record -> limit ( 1 ) -> fetch ( ) ; } | Returns random record from given table . |
916 | protected function getId ( $ tableName , $ where = null ) { $ record = $ this -> getRecord ( $ tableName , $ where ) ; return $ record ? $ record -> id : null ; } | Returns id of random record from given table . |
917 | public function scaffold ( ) { $ this -> updateDependencies ( [ "vue" => "^2.4.3" , ] ) ; $ this -> updateDevDependencies ( [ "vue-loader" => "^13.3.0" , "vue-template-compiler" => "^2.5.2" , ] ) ; $ this -> updateJavascript ( $ this -> name ) ; $ this -> updateAssets ( $ this -> name ) ; } | Scaffold a Vue boilerplate preset . |
918 | private function buildConfig ( ) { $ env = getenv ( 'CRM_ENV' ) ; $ configData = [ 'paths' => [ 'migrations' => [ '%%PHINX_CONFIG_DIR%%/../../../../migrations' ] ] , 'environments' => [ 'default_migration_table' => 'phinxlog' , 'default_database' => $ env , ] , ] ; foreach ( $ this -> moduleManager -> getModules ( ) as... | Build phinx config from config . local . neon |
919 | public function clone ( $ destination ) { $ fs = new Filesystem ; if ( ! $ fs -> exists ( $ destination ) ) { $ fs -> mkdir ( $ destination , 0755 ) ; } $ fs -> mirror ( $ this -> source , $ destination , null , $ this -> options ) ; } | Perform source cloning . |
920 | public function copy ( $ file ) { $ fs = new Filesystem ; if ( ! $ fs -> exists ( dirname ( $ file ) ) ) { $ fs -> mkdir ( dirname ( $ file ) , 0755 ) ; } $ fs -> copy ( $ this -> source , $ file , true ) ; } | Perform source coping . |
921 | public function run ( $ suite ) { $ printer = $ this -> createPrinter ( ) ; $ testResult = new \ PHPUnit_Framework_TestResult ( ) ; $ testRunner = new TestRunner ( ) ; $ testRunner -> setTestResult ( $ testResult ) ; $ testRunner -> doRun ( $ suite , $ this -> createArguments ( $ printer , $ testResult ) , false ) ; $ ... | Runs tests based on the given \ PHPUnit_Framework_TestSuite object . |
922 | private function getFiltered ( bool $ public = true ) : array { $ result = [ ] ; foreach ( $ this -> events as $ event ) { if ( $ event [ 'is_public' ] === $ public ) { $ result [ ] = $ event ; } } return $ result ; } | Returns array with events filtered by event s visibility |
923 | public function quoteValue ( $ str ) { if ( is_int ( $ str ) || is_float ( $ str ) ) { return $ str ; } return "'" . addcslashes ( str_replace ( "'" , "''" , $ str ) , "\000\n\r\\\032" ) . "'" ; } | Quotes a string value for use in a query . |
924 | public function utmParams ( ) : array { return array_filter ( [ 'utm_source' => $ this -> utmSession -> utmSource , 'utm_medium' => $ this -> utmSession -> utmMedium , 'utm_campaign' => $ this -> utmSession -> utmCampaign , 'utm_content' => $ this -> utmSession -> utmContent , ] ) ; } | Returns array with UTM parameters of campaign |
925 | protected function buildTrackingParamsSession ( ) { $ this -> utmSession = $ this -> getSession ( 'utm_session' ) ; $ this -> utmSession -> setExpiration ( '30 minutes' ) ; if ( $ this -> getParameter ( 'utm_source' ) ) { $ this -> utmSession -> utmSource = $ this -> getParameter ( 'utm_source' ) ; } if ( $ this -> get... | Store sales funnel UTM parameters and additional tracking parameters to session |
926 | public function onMethodVerificationSuccess ( Member $ member , $ method ) { $ this -> getAuditLogger ( ) -> info ( sprintf ( '"%s" (ID: %s) successfully verified using MFA method' , $ member -> Email ? : $ member -> Title , $ member -> ID ) , [ 'method' => get_class ( $ method ) ] ) ; } | A successful login using an MFA method |
927 | public function onMethodVerificationFailure ( Member $ member , $ method ) { $ context = [ 'method' => get_class ( $ method ) , ] ; if ( $ lockOutAfterCount = $ member -> config ( ) -> get ( 'lock_out_after_incorrect_logins' ) ) { $ context [ 'attempts' ] = $ member -> FailedLoginCount ; $ context [ 'attempt_limit' ] =... | A failed login using an MFA method |
928 | public function onSkipRegistration ( Member $ member ) { $ this -> getAuditLogger ( ) -> info ( sprintf ( '"%s" (ID: %s) skipped MFA registration' , $ member -> Email ? : $ member -> Title , $ member -> ID ) ) ; } | A user has skipped MFA registration when it is enabled but optional or within a grace period |
929 | public function getDatabaseSeriesData ( Criteria $ criteria ) { $ dbData = [ ] ; $ res = $ this -> database -> query ( "SELECT {$criteria->getValueField()} AS value,calendar.week AS week,calendar.month AS month,calendar.year AS year,{$this->getSeries($criteria->getSeries())}{$criteria->getTableName()}.idFROM {$criteria... | pridat do vsetkych queries ? |
930 | public function add ( array $ assets ) { if ( ! file_exists ( $ this -> file ) ) { throw new RuntimeException ( "Could not add assets, `app.json` file do not exists." ) ; } $ packages = json_decode ( file_get_contents ( $ this -> file ) , true ) ; $ packages [ 'assets' ] = $ assets + $ packages [ 'assets' ] ; ksort ( $... | Adds additional entries to the assets option . |
931 | public function insert ( $ query , $ bindings = [ ] ) { try { $ this -> statement ( $ query , $ bindings ) ; return true ; } catch ( \ Exception $ e ) { throw new InternalServerErrorException ( 'Insert failed. ' . $ e -> getMessage ( ) ) ; } } | Run an insert statement against the database . |
932 | public function run ( Renamer $ renamer , Scaffolder $ scaffolder ) { $ this -> drawBanner ( ) ; $ child = $ this -> askForChildConfirmation ( ) ; $ replacements = $ this -> askForReplacements ( $ child ) ; if ( ! $ child ) { $ preset = $ this -> askForPreset ( ) ; } if ( $ this -> askForConfirmation ( ) ) { if ( isset... | Run CLI logic . |
933 | public function askForReplacements ( $ child ) { $ replacements = [ ] ; if ( $ child ) { $ this -> placeholders = array_merge ( $ this -> placeholders , $ this -> childPlaceholders ) ; } foreach ( $ this -> placeholders as $ placeholder => $ data ) { $ input = $ this -> climate -> input ( $ data [ 'message' ] ) ; $ inp... | Asks placeholders and saves answers . |
934 | public function askForPreset ( ) { $ input = $ this -> climate -> input ( '<comment>Choose the front-end scaffolding</comment>' ) ; $ input -> accept ( $ this -> presets , true ) ; return strtolower ( $ input -> prompt ( ) ) ; } | Asks for preset name which files will be generated . |
935 | public function scaffold ( ) { $ this -> updateDependencies ( [ 'foundation-sites' => '^6.4.1' , 'what-input' => '^4.1.3' , 'motion-ui' => '^1.2.2' , ] ) ; $ this -> updateConfig ( [ 'foundation' => [ './resources/assets/js/foundation.js' , './resources/assets/sass/foundation.scss' , ] , ] ) ; $ this -> updateSass ( $ ... | Scaffold a Foundation boilerplate preset . |
936 | public function removeObjectById ( $ contentObjectId , $ commit = null ) { if ( ! isset ( $ commit ) && ( $ this -> iniConfig -> variable ( 'IndexOptions' , 'DisableDeleteCommits' ) === 'true' ) ) { $ commit = false ; } elseif ( ! isset ( $ commit ) ) { $ commit = true ; } if ( $ this -> searchHandler instanceof Legacy... | Removes a content object by ID from the search database . |
937 | public function cleanup ( ) { if ( $ this -> searchHandler instanceof LegacyHandler ) { $ db = eZDB :: instance ( ) ; $ db -> begin ( ) ; $ db -> query ( "DELETE FROM ezsearch_word" ) ; $ db -> query ( "DELETE FROM ezsearch_object_word_link" ) ; $ db -> commit ( ) ; } else if ( method_exists ( $ this -> searchHandler ,... | Purges the index . |
938 | public function updateNodeSection ( $ nodeID , $ sectionID ) { $ contentObject = eZContentObject :: fetchByNodeID ( $ nodeID ) ; eZContentOperationCollection :: registerSearchObject ( $ contentObject -> attribute ( 'id' ) ) ; } | Update index when a new section is assigned to an object through a node . |
939 | public function updateNodeVisibility ( $ nodeID , $ action ) { $ node = eZContentObjectTreeNode :: fetch ( $ nodeID ) ; eZContentOperationCollection :: registerSearchObject ( $ node -> attribute ( 'contentobject_id' ) ) ; $ params = array ( 'Depth' => 1 , 'DepthOperator' => 'eq' , 'Limitation' => array ( ) , 'IgnoreVis... | Update index when node s visibility is modified . |
940 | public function swapNode ( $ nodeID , $ selectedNodeID , $ nodeIdList = array ( ) ) { $ contentObject1 = eZContentObject :: fetchByNodeID ( $ nodeID ) ; $ contentObject2 = eZContentObject :: fetchByNodeID ( $ selectedNodeID ) ; eZContentOperationCollection :: registerSearchObject ( $ contentObject1 -> attribute ( 'id' ... | Update search index when two nodes are swapped |
941 | function isSearchPartIncomplete ( $ part ) { if ( $ this -> searchHandler instanceof LegacyHandler ) { $ searchEngine = new eZSearchEngine ( ) ; return $ searchEngine -> isSearchPartIncomplete ( $ part ) ; } return false ; } | Returns true if the search part is incomplete . |
942 | public function normalizeText ( $ text ) { if ( $ this -> searchHandler instanceof LegacyHandler ) { $ searchEngine = new eZSearchEngine ( ) ; return $ searchEngine -> normalizeText ( $ text ) ; } return $ text ; } | Normalizes the text so that it is easily parsable |
943 | protected function getSSLBuilder ( $ config ) { if ( empty ( $ config ) ) { return null ; } $ ssl = \ Cassandra :: ssl ( ) ; $ serverCert = array_get ( $ config , 'server_cert_path' ) ; $ clientCert = array_get ( $ config , 'client_cert_path' ) ; $ privateKey = array_get ( $ config , 'private_key_path' ) ; $ passPhrase... | Creates the SSL connection builder . |
944 | public function listTables ( ) { $ tables = $ this -> keyspace -> tables ( ) ; $ out = [ ] ; foreach ( $ tables as $ table ) { $ out [ ] = [ 'table_name' => $ table -> name ( ) ] ; } return $ out ; } | Lists Cassandra table . |
945 | protected function extractPaginationInfo ( & $ cql ) { $ words = explode ( ' ' , $ cql ) ; $ limit = 0 ; $ offset = 0 ; $ limitKey = null ; foreach ( $ words as $ key => $ word ) { if ( 'limit' === strtolower ( $ word ) && is_numeric ( $ words [ $ key + 1 ] ) ) { $ limit = ( int ) $ words [ $ key + 1 ] ; $ limitKey = $... | Extracts pagination info from CQL . |
946 | protected function handleBootstrap ( $ filename , $ syntaxCheck = false ) { try { \ PHPUnit_Util_Fileloader :: checkAndLoad ( $ filename , $ syntaxCheck ) ; } catch ( RuntimeException $ e ) { \ PHPUnit_TextUI_TestRunner :: showError ( $ e -> getMessage ( ) ) ; } } | Loads a bootstrap file . |
947 | public function addSeeder ( AbstractPopulator $ seeder ) { $ seeder -> setPopulator ( $ this ) ; $ seeder -> setDatabase ( $ this -> database ) ; $ seeder -> setFaker ( $ this -> faker ) ; $ this -> seeders [ ] = $ seeder ; } | Add new seeder |
948 | public function canvasImageScale ( ) { $ imageOriginalWidth = imagesx ( $ this -> oImg ) ; $ imageOriginalHeight = imagesy ( $ this -> oImg ) ; $ scale = min ( $ imageOriginalWidth / $ this -> options [ 'width' ] , $ imageOriginalHeight / $ this -> options [ 'height' ] ) ; $ this -> options [ 'cropWidth' ] = ceil ( $ t... | Scale the image before smartcrop analyse |
949 | public function canvasImageResample ( $ width , $ height ) { $ oCanvas = imagecreatetruecolor ( $ width , $ height ) ; imagecopyresampled ( $ oCanvas , $ this -> oImg , 0 , 0 , 0 , 0 , $ width , $ height , imagesx ( $ this -> oImg ) , imagesy ( $ this -> oImg ) ) ; $ this -> oImg = $ oCanvas ; return $ this ; } | Function for scale image |
950 | public function analyse ( ) { $ result = [ ] ; $ w = $ this -> w = imagesx ( $ this -> oImg ) ; $ h = $ this -> h = imagesy ( $ this -> oImg ) ; $ this -> od = new \ SplFixedArray ( $ h * $ w * 3 ) ; $ this -> aSample = new \ SplFixedArray ( $ h * $ w ) ; for ( $ y = 0 ; $ y < $ h ; $ y ++ ) { for ( $ x = 0 ; $ x < $ w... | Analyse the image find out the optimal crop scheme |
951 | public function generateCrops ( ) { $ w = imagesx ( $ this -> oImg ) ; $ h = imagesy ( $ this -> oImg ) ; $ results = [ ] ; $ minDimension = min ( $ w , $ h ) ; $ cropWidth = empty ( $ this -> options [ 'cropWidth' ] ) ? $ minDimension : $ this -> options [ 'cropWidth' ] ; $ cropHeight = empty ( $ this -> options [ 'cr... | Generate crop schemes |
952 | public function score ( $ output , $ crop ) { $ result = [ 'detail' => 0 , 'saturation' => 0 , 'skin' => 0 , 'boost' => 0 , 'total' => 0 ] ; $ downSample = $ this -> options [ 'scoreDownSample' ] ; $ invDownSample = 1 / $ downSample ; $ outputHeightDownSample = floor ( $ this -> h / $ downSample ) * $ downSample ; $ ou... | Score a crop scheme |
953 | public function swap ( array $ replacements ) { foreach ( $ replacements as $ from => $ to ) { $ this -> replace ( $ from , $ this -> normalize ( $ to ) ) ; } } | Inits renaming process . |
954 | protected function replace ( $ from , $ to ) { if ( $ this -> file -> getExtension ( ) === 'json' ) { $ from = addslashes ( $ from ) ; } file_put_contents ( $ this -> file -> getRealPath ( ) , str_replace ( $ from , $ to , $ this -> file -> getContents ( ) ) ) ; } | Replaces strings in file content . |
955 | public function delete ( IRow & $ row ) { $ res = $ this -> getTable ( ) -> wherePrimary ( $ row -> getPrimary ( ) ) -> delete ( ) ; $ oldValues = [ ] ; if ( $ row instanceof ActiveRow ) { $ oldValues = $ row -> toArray ( ) ; } if ( ! $ res ) { return false ; } if ( $ this -> auditLogRepository ) { $ from = $ this -> f... | Delete deletes provided record from repository and mutates the provided instance . Operation is logged to audit log . |
956 | public function insert ( $ data ) { $ row = $ this -> getTable ( ) -> insert ( $ data ) ; if ( ! $ row instanceof IRow ) { return $ row ; } if ( $ this -> auditLogRepository ) { $ to = $ this -> filterValues ( $ this -> excludeColumns ( ( array ) $ data ) ) ; $ data = [ 'version' => '1' , 'from' => [ ] , 'to' => $ to ,... | Insert inserts data to the repository . If single IRow is returned it attempts to log audit information . |
957 | private function filterValues ( array $ values ) { foreach ( $ values as $ i => $ field ) { if ( is_bool ( $ field ) ) { $ values [ $ i ] = ( int ) $ field ; } elseif ( $ field instanceof \ DateTime ) { $ values [ $ i ] = $ field -> format ( 'Y-m-d H:i:s' ) ; } elseif ( ! is_scalar ( $ field ) ) { unset ( $ values [ $ ... | filterValues removes non - scalar values from the array and formats any DateTime to DB string representation . |
958 | public static function bind_manipulation_capture ( ) { $ current = DB :: get_conn ( ) ; if ( ! $ current || ! $ current -> getConnector ( ) -> getSelectedDatabase ( ) || @ $ current -> isManipulationLoggingCapture ) { return ; } $ type = get_class ( $ current ) ; $ sanitisedType = str_replace ( '\\' , '_' , $ type ) ; ... | This will bind a new class dynamically so we can hook into manipulation and capture it . It creates a new PHP file in the temp folder then loads it and sets it as the active DB class . |
959 | public function onAfterPublish ( & $ original ) { $ member = Security :: getCurrentUser ( ) ; if ( ! $ member || ! $ member -> exists ( ) ) { return false ; } $ effectiveViewerGroups = '' ; if ( $ this -> owner -> CanViewType === 'OnlyTheseUsers' ) { $ originalViewerGroups = $ original ? $ original -> ViewerGroups ( ) ... | Log a record being published . |
960 | public function onAfterUnpublish ( ) { $ member = Security :: getCurrentUser ( ) ; if ( ! $ member || ! $ member -> exists ( ) ) { return false ; } $ this -> getAuditLogger ( ) -> info ( sprintf ( '"%s" (ID: %s) unpublished %s "%s" (ID: %s)' , $ member -> Email ? : $ member -> Title , $ member -> ID , $ this -> owner -... | Log a record being unpublished . |
961 | public function afterMemberLoggedIn ( ) { $ this -> getAuditLogger ( ) -> info ( sprintf ( '"%s" (ID: %s) successfully logged in' , $ this -> owner -> Email ? : $ this -> owner -> Title , $ this -> owner -> ID ) ) ; } | Log successful login attempts . |
962 | public function authenticationFailed ( $ data ) { $ login = isset ( $ data [ 'Login' ] ) ? $ data [ 'Login' ] : ( isset ( $ data [ Email :: class ] ) ? $ data [ Email :: class ] : '' ) ; if ( empty ( $ login ) ) { return $ this -> getAuditLogger ( ) -> warning ( 'Could not determine username/email of failed authenticat... | Log failed login attempts . |
963 | public function replace ( array $ replacements ) { foreach ( $ this -> files ( ) as $ file ) { ( new Replacer ( $ file ) ) -> swap ( $ replacements ) ; } } | Process renaming in files content . |
964 | public function files ( ) { $ files = ( new Finder ) -> files ( ) ; foreach ( $ this -> ignoredFiles as $ name ) { $ files -> notName ( $ name ) ; } foreach ( $ this -> searchedFiles as $ name ) { $ files -> name ( $ name ) ; } return $ files -> exclude ( $ this -> ignoredDirectories ) -> in ( $ this -> dir ) ; } | Finds files to rename . |
965 | public function hasRoleById ( int $ roleId ) : bool { if ( isset ( $ this -> roles [ $ roleId ] ) ) { return true ; } return false ; } | Check if an user has a role use role Id . |
966 | public function hasRoleByName ( string $ roleName ) : bool { if ( \ in_array ( $ roleName , \ array_column ( $ this -> roles , 'name' ) , true ) ) { return true ; } return false ; } | Check if an user has a role use role name . |
967 | public function update ( SplSubject $ subject ) { if ( $ subject instanceof Model ) { $ this -> data = \ array_merge ( $ this -> data , $ subject -> get ( ) ) ; } } | Update Observer data . |
968 | public static function createNewRefreshToken ( int $ ttl , TokenOwnerInterface $ owner = null , Client $ client = null , $ scopes = null ) : RefreshToken { return static :: createNew ( $ ttl , $ owner , $ client , $ scopes ) ; } | Create a new RefreshToken |
969 | public function prepare ( ) { $ object_type = $ this -> getObjectType ( ) ; $ object_link = elgg_view ( 'output/url' , array ( 'text' => $ this -> object -> getDisplayName ( ) , 'href' => elgg_http_add_url_query_elements ( $ this -> object -> getURL ( ) , array ( 'active_tab' => 'comments' , ) ) , ) ) ; if ( $ this -> ... | Prepares notification elements |
970 | public function getObjectType ( ) { $ type = $ this -> object -> getType ( ) ; $ subtype = $ this -> object -> getSubtype ( ) ? : 'default' ; $ keys = [ "interactions:$type:$subtype" , $ this -> object instanceof Comment ? "interactions:comment" : "interactions:post" , ] ; foreach ( $ keys as $ key ) { if ( elgg_langua... | Prepares object type string |
971 | protected function getComment ( ) { $ comment_body = elgg_view ( 'output/longtext' , array ( 'value' => $ this -> comment -> description , ) ) ; $ comment_body .= elgg_view ( 'output/attached' , array ( 'entity' => $ this -> comment , ) ) ; $ attachments = $ this -> comment -> getAttachments ( array ( 'limit' => 0 ) ) ... | Prepares comment body including the text and attachment info |
972 | protected static function parseProgressBar ( ProgressBarInterface $ progressBar , array $ args ) { $ progressBar -> setAnimated ( ArrayHelper :: get ( $ args , "animated" , false ) ) ; $ progressBar -> setContent ( ArrayHelper :: get ( $ args , "content" ) ) ; $ progressBar -> setMax ( ArrayHelper :: get ( $ args , "ma... | Parses a progress bar . |
973 | public static function urlHandler ( $ hook , $ type , $ url , $ params ) { $ entity = elgg_extract ( 'entity' , $ params ) ; if ( $ entity instanceof Comment ) { $ container = $ entity -> getContainerEntity ( ) ; if ( $ container instanceof Comment ) { return $ container -> getURL ( ) ; } return elgg_normalize_url ( im... | Handles entity URLs |
974 | public static function iconUrlHandler ( $ hook , $ type , $ url , $ params ) { $ entity = elgg_extract ( 'entity' , $ params ) ; if ( $ entity instanceof Comment ) { $ owner = $ entity -> getOwnerEntity ( ) ; if ( ! $ owner ) { return ; } return $ owner -> getIconURL ( $ params ) ; } return $ url ; } | Replaces comment icons |
975 | protected function bootstrapProgressBar ( ProgressBarInterface $ progressBar ) { $ span = static :: coreHTMLElement ( "span" , $ progressBar -> getValue ( ) . "%" , [ "class" => "sr-only" ] ) ; $ attributes = [ ] ; $ attributes [ "class" ] = [ "progress-bar" , ProgressBarRenderer :: renderType ( $ progressBar ) ] ; $ a... | Displays a Bootstrap progress bar . |
976 | public function bootstrapGridOffsetFunction ( array $ args = [ ] ) { return $ this -> bootstrapGrid ( ArrayHelper :: get ( $ args , "lgOffset" ) , ArrayHelper :: get ( $ args , "mdOffset" ) , ArrayHelper :: get ( $ args , "smOffset" ) , ArrayHelper :: get ( $ args , "xsOffset" ) , ArrayHelper :: get ( $ args , "recopyO... | Displays a Bootstrap grid with offset . |
977 | public function bootstrapGridPullFunction ( array $ args = [ ] ) { return $ this -> bootstrapGrid ( ArrayHelper :: get ( $ args , "lgPull" ) , ArrayHelper :: get ( $ args , "mdPull" ) , ArrayHelper :: get ( $ args , "smPull" ) , ArrayHelper :: get ( $ args , "xsPull" ) , ArrayHelper :: get ( $ args , "recopyPull" , fal... | Displays a Bootstrap grid with pull . |
978 | public function bootstrapGridPushFunction ( array $ args = [ ] ) { return $ this -> bootstrapGrid ( ArrayHelper :: get ( $ args , "lgPush" ) , ArrayHelper :: get ( $ args , "mdPush" ) , ArrayHelper :: get ( $ args , "smPush" ) , ArrayHelper :: get ( $ args , "xsPush" ) , ArrayHelper :: get ( $ args , "recopyPush" , fal... | Displays a Bootstrap grid with push . |
979 | public function bootstrapGridStackedFunction ( array $ args = [ ] ) { return $ this -> bootstrapGrid ( ArrayHelper :: get ( $ args , "lg" ) , ArrayHelper :: get ( $ args , "md" ) , ArrayHelper :: get ( $ args , "sm" ) , ArrayHelper :: get ( $ args , "xs" ) , ArrayHelper :: get ( $ args , "recopy" , false ) , "" ) ; } | Displays a Bootstrap grid with stacked - to - horizontal . |
980 | public static function fromArray ( array $ options = [ ] ) : self { return new self ( $ options [ 'authorization_code_ttl' ] ?? 120 , $ options [ 'access_token_ttl' ] ?? 3600 , $ options [ 'refresh_token_ttl' ] ?? 86400 , $ options [ 'rotate_refresh_tokens' ] ?? false , $ options [ 'revoke_rotated_refresh_tokens' ] ?? ... | Set one or more configuration properties |
981 | public function add ( array $ parameters ) { if ( ! array_key_exists ( 'name' , $ parameters ) || ! is_string ( $ parameters [ 'name' ] ) ) { throw new \ InvalidArgumentException ( 'You need to provide the name of the SSH Key.' ) ; } if ( ! array_key_exists ( 'ssh_pub_key' , $ parameters ) || ! is_string ( $ parameters... | Adds a new public SSH key to your account . The array requires name and ssh_pub_key keys . |
982 | public function edit ( $ sshKeyId , array $ parameters ) { if ( ! array_key_exists ( 'ssh_pub_key' , $ parameters ) || ! is_string ( $ parameters [ 'ssh_pub_key' ] ) ) { throw new \ InvalidArgumentException ( 'You need to provide the new public SSH Key.' ) ; } return $ this -> processQuery ( $ this -> buildQuery ( $ ss... | Edits an existing public SSH key in your account . The array requires ssh_pub_key key . |
983 | public function make ( $ path , $ name , array $ options = [ ] ) { $ options += [ 'middleware' => null , 'prefix' => null ] ; $ parsedRoutes = $ this -> getParsedRoutes ( $ options [ 'middleware' ] , $ options [ 'prefix' ] ) ; $ template = $ this -> file -> get ( __DIR__ . '/templates/Router.js' ) ; $ template = str_re... | Compile routes template and generate |
984 | private function bootstrapBreadcrumb ( NavigationNode $ node , $ last ) { $ attributes = true === $ node -> getActive ( ) && true === $ last ? [ "class" => "active" ] : [ ] ; $ content = $ this -> getTranslator ( ) -> trans ( $ node -> getId ( ) ) ; $ innerHTML = true === $ last ? $ content : static :: coreHTMLElement ... | Displays a Bootstrap breadcrumb . |
985 | public function respond ( array $ data , $ status = 200 , $ code , array $ headers = [ ] , $ options = 0 ) { return $ this -> response -> json ( array_merge ( compact ( 'status' , 'code' ) , $ data ) , $ status , $ headers , $ options ) ; } | Respond with a json response . |
986 | protected function buildRecordsQuery ( $ domain , $ id = null , $ action = null , array $ parameters = array ( ) ) { $ parameters = http_build_query ( array_merge ( $ parameters , $ this -> credentials ) ) ; $ query = sprintf ( "%s/%s/%s" , $ this -> apiUrl , $ domain , DomainsActions :: ACTION_RECORDS ) ; $ query = $ ... | Builds the records API url according to the parameters . |
987 | protected function checkParameters ( array $ parameters ) { if ( ! array_key_exists ( 'record_type' , $ parameters ) ) { throw new \ InvalidArgumentException ( 'You need to provide the record_type.' ) ; } if ( ! in_array ( $ parameters [ 'record_type' ] , array ( 'A' , 'CNAME' , 'NS' , 'TXT' , 'MX' , 'SRV' ) ) ) { thro... | Check submitted parameters . |
988 | public function newRecord ( $ domain , array $ parameters ) { $ this -> checkParameters ( $ parameters ) ; return $ this -> processQuery ( $ this -> buildRecordsQuery ( $ domain , null , RecordsActions :: ACTION_ADD , $ parameters ) ) ; } | Adds a new record to a specific domain . |
989 | public function editRecord ( $ domain , $ recordId , array $ parameters ) { $ this -> checkParameters ( $ parameters ) ; return $ this -> processQuery ( $ this -> buildRecordsQuery ( $ domain , $ recordId , RecordsActions :: ACTION_EDIT , $ parameters ) ) ; } | Edits a record to a specific domain . |
990 | public function destroyRecord ( $ domain , $ recordId ) { return $ this -> processQuery ( $ this -> buildRecordsQuery ( $ domain , $ recordId , RecordsActions :: ACTION_DESTROY ) ) ; } | Deletes the specified domain record . |
991 | protected function buildQuery ( $ id = null , $ action = null , array $ parameters = array ( ) ) { $ parameters = http_build_query ( array_merge ( $ parameters , $ this -> credentials ) ) ; $ query = $ id ? sprintf ( "%s/%s" , $ this -> apiUrl , $ id ) : $ this -> apiUrl ; $ query = $ action ? sprintf ( "%s/%s/?%s" , $... | Builds the API url according to the parameters . |
992 | protected function processQuery ( $ query ) { if ( null === $ processed = json_decode ( $ this -> adapter -> getContent ( $ query ) ) ) { throw new \ RuntimeException ( sprintf ( "Impossible to process this query: %s" , $ query ) ) ; } if ( 'ERROR' === $ processed -> status ) { if ( isset ( $ processed -> error_message... | Processes the query . |
993 | public static function deleteRiverObject ( $ event , $ type , $ river ) { $ ia = elgg_set_ignore_access ( true ) ; $ guid = InteractionsCache :: getInstance ( ) -> getGuidFromRiverId ( $ river -> id ) ; if ( $ guid ) { $ object = get_entity ( $ guid ) ; if ( $ object ) { $ object -> delete ( ) ; } } elgg_set_ignore_acc... | Deletes a commentable object associated with river items whose object is not ElggObject |
994 | public static function createActionableRiverObject ( ElggRiverItem $ river ) { if ( ! $ river instanceof ElggRiverItem ) { return false ; } $ object = $ river -> getObjectEntity ( ) ; $ views = self :: getActionableViews ( ) ; if ( ! in_array ( $ river -> view , $ views ) ) { return $ object ; } $ access_id = $ object ... | Creates an object associated with a river item for commenting and other purposes This is a workaround for river items that do not have an object or have an object that is group or user |
995 | public static function getRiverObject ( ElggRiverItem $ river ) { if ( ! $ river instanceof ElggRiverItem ) { return false ; } $ object = $ river -> getObjectEntity ( ) ; $ views = self :: getActionableViews ( ) ; if ( in_array ( $ river -> view , $ views ) ) { $ ia = elgg_set_ignore_access ( true ) ; $ guid = Interact... | Get an actionable object associated with the river item This could be a river object entity or a special entity that was created for this river item |
996 | public static function getStats ( $ entity ) { if ( ! $ entity instanceof ElggEntity ) { return array ( ) ; } $ stats = array ( 'comments' => array ( 'count' => $ entity -> countComments ( ) ) , 'likes' => array ( 'count' => $ entity -> countAnnotations ( 'likes' ) , 'state' => ( elgg_annotation_exists ( $ entity -> gu... | Get interaction statistics |
997 | public static function getCommentsSort ( ) { $ user_setting = elgg_get_plugin_user_setting ( 'comments_order' , 0 , 'hypeInteractions' ) ; $ setting = $ user_setting ? : elgg_get_plugin_setting ( 'comments_order' , 'hypeInteractions' ) ; if ( $ setting == 'asc' ) { $ setting = 'time_created::asc' ; } else if ( $ settin... | Get configured comments order |
998 | public static function getLimit ( $ partial = true ) { if ( $ partial ) { $ limit = elgg_get_plugin_setting ( 'comments_limit' , 'hypeInteractions' ) ; return $ limit ? : 3 ; } else { $ limit = elgg_get_plugin_setting ( 'comments_load_limit' , 'hypeInteractions' ) ; return min ( max ( ( int ) $ limit , 20 ) , 200 ) ; }... | Get number of comments to show |
999 | public static function calculateOffset ( $ count , $ limit , $ comment = null ) { $ order = self :: getCommentsSort ( ) ; $ style = self :: getLoadStyle ( ) ; if ( $ comment instanceof Comment ) { $ thread = new Thread ( $ comment ) ; $ offset = $ thread -> getOffset ( $ limit , $ order ) ; } else if ( ( $ order == 'ti... | Calculate offset till the page that contains the comment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.