idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
12,800 | public function errorInTabs ( $ counters ) { if ( empty ( $ this -> current_tab ) || empty ( $ counters ) ) { return ; } if ( ! isset ( $ this -> errors [ 'tabs' ] ) ) { $ this -> errors [ 'tabs' ] = [ ] ; } foreach ( $ counters as $ type => $ counter ) { $ current_tab = $ this -> current_tab ; do { $ key = implode ( '... | Add error to tabs |
12,801 | final public function validateDataTypesSingleValue ( $ k , $ v , $ in_value , $ error_field = null ) { if ( empty ( $ error_field ) ) { $ error_field = $ k ; } $ result = \ Object \ Table \ Columns :: validateSingleColumn ( $ k , $ v [ 'options' ] , $ in_value ) ; if ( ! $ result [ 'success' ] ) { $ this -> error ( 'da... | Validate data type for single value |
12,802 | final public function preloadCollectionObject ( ) { if ( empty ( $ this -> collection ) ) return false ; if ( empty ( $ this -> collection_object ) ) { if ( ! empty ( $ this -> collection [ 'details' ] ) ) { $ this -> tempAclSubresourceUnsetFromCollection ( $ this -> collection [ 'details' ] ) ; } $ this -> collection_... | Pre load collection object |
12,803 | private function tempAclSubresourceUnsetFromCollection ( array & $ details ) { foreach ( $ details as $ k0 => $ v0 ) { if ( ! empty ( $ v0 [ 'acl_subresource' ] ) ) { if ( ! is_array ( $ v0 [ 'acl_subresource' ] ) ) { $ v0 [ 'acl_subresource' ] = [ $ v0 [ 'acl_subresource' ] ] ; } $ found = true ; foreach ( $ v0 [ 'acl... | Unset collection sub - resources based on acl |
12,804 | final public function updateCollectionObject ( ) { if ( ! empty ( $ this -> collection_object ) && ! empty ( $ this -> collection ) ) { $ this -> collection_object -> data = array_merge_hard ( $ this -> collection_object -> data , $ this -> collection ) ; } } | Update collection object |
12,805 | final public function loadPk ( & $ values ) { $ this -> pk = [ ] ; $ this -> full_pk = true ; if ( ! empty ( $ this -> collection_object ) ) { foreach ( $ this -> collection_object -> data [ 'pk' ] as $ v ) { if ( ! empty ( $ this -> collection_object -> primary_model -> tenant ) && $ v == $ this -> collection_object -... | Load primary key from values |
12,806 | final public function loadValues ( $ for_update = false ) { if ( $ this -> full_pk ) { $ for_update = false ; $ result = $ this -> collection_object -> get ( [ 'where' => $ this -> pk , 'single_row' => true , 'for_update' => $ for_update ] ) ; if ( $ result [ 'success' ] ) { $ this -> misc_settings [ 'max_records' ] = ... | Load values from database |
12,807 | public function hasErrors ( $ error_names = null ) { if ( empty ( $ error_names ) ) { return ! empty ( $ this -> errors [ 'flag_error_in_fields' ] ) || ! empty ( $ this -> errors [ 'general' ] [ 'danger' ] ) ; } else { if ( ! is_array ( $ error_names ) ) { $ error_names = [ $ error_names ] ; } foreach ( $ error_names a... | Whether form has errors |
12,808 | public function tempProcessACLSubresources ( $ subresources , $ action ) : bool { if ( ! is_array ( $ subresources ) ) { $ subresources = [ $ subresources ] ; } foreach ( $ subresources as $ v ) { if ( empty ( $ this -> options [ 'skip_acl' ] ) && ! \ Application :: $ controller -> canSubresourceCached ( $ v , $ action... | Process ACL sub - resources |
12,809 | public function getFieldErrors ( $ field ) { $ existing = array_key_get ( $ this -> errors [ 'fields' ] , $ field [ 'options' ] [ 'name' ] ) ; if ( ! empty ( $ existing ) ) { $ result = [ 'type' => null , 'message' => '' , 'counters' => [ ] ] ; $ sorted = [ 'danger' => [ ] , 'warning' => [ ] , 'success' => [ ] , 'info'... | Get field errors |
12,810 | public function processParamsAndDepends ( & $ params , & $ neighbouring_values , $ options , $ flag_params = true ) { foreach ( $ params as $ k => $ v ) { if ( is_array ( $ v ) ) continue ; if ( strpos ( $ v , 'parent::' ) !== false ) { $ field = str_replace ( [ 'parent::' , 'static::' ] , '' , $ v ) ; if ( ! empty ( $... | Process depends and params |
12,811 | public function processDefaultValue ( $ key , $ default , $ value , & $ neighbouring_values , $ set_neightbouring_values = true , $ changed_field = [ ] , $ options = [ ] ) { if ( strpos ( $ default , 'dependent::' ) !== false ) { } else if ( strpos ( $ default , 'master_object::' ) !== false ) { $ field = explode ( '::... | Process default value |
12,812 | public function canProcessDefaultValue ( $ value , $ options , $ default = null ) { if ( strpos ( $ options [ 'options' ] [ 'default' ] , 'static::' ) !== false || strpos ( $ options [ 'options' ] [ 'default' ] , 'master_object::' ) !== false || strpos ( $ options [ 'options' ] [ 'default' ] , 'dependent::' ) !== false... | Can default value be processed |
12,813 | public function prepareExportFileVariables ( ) : array { $ result = [ 'success' => false , 'error' => [ ] , 'data' => [ ] ] ; $ details = [ ] ; if ( ! empty ( $ this -> collection [ 'details' ] ) ) { $ this -> disassembleCollectionObject ( $ this -> collection [ 'details' ] , $ details ) ; } $ result [ 'data' ] [ $ thi... | Prepare export file variables |
12,814 | public function generateFormFields ( ) : array { $ result = [ 'success' => false , 'error' => [ ] , 'data' => [ ] ] ; $ details = [ ] ; if ( ! empty ( $ this -> collection [ 'details' ] ) ) { $ this -> disassembleCollectionObject ( $ this -> collection [ 'details' ] , $ details ) ; } foreach ( $ this -> fields as $ k =... | Generate form fields |
12,815 | private function skipExportField ( string $ field_name , array $ field_options ) : bool { if ( ! empty ( $ field_options [ 'options' ] [ 'process_submit' ] ) ) return false ; if ( $ field_name == $ this :: SEPARATOR_HORIZONTAL || $ field_name == $ this :: SEPARATOR_VERTICAL ) return false ; if ( ! empty ( $ field_optio... | Skip export field |
12,816 | private function disassembleCollectionObject ( array $ collection_details , & $ result , $ parent = [ ] ) { foreach ( $ collection_details as $ k => $ v ) { if ( ! empty ( $ v [ 'readonly' ] ) ) continue ; $ result [ $ k ] = $ v ; $ result [ $ k ] [ 'model' ] = $ k ; $ result [ $ k ] [ '__parent' ] = $ parent ; if ( ! ... | Disassemble collection details |
12,817 | public function processImportedSheets ( array $ data , array $ globals ) : array { $ result = [ 'success' => false , 'error' => [ ] , 'data' => [ ] ] ; $ globals_final = [ ] ; $ ignore_columns = [ ] ; if ( $ this -> collection_object -> primary_model -> tenant ) { $ globals_final [ $ this -> collection_object -> primar... | Process imported sheets |
12,818 | public function renderListContainerDefaultOptions ( array $ options , $ value , $ neighbouring_values = [ ] ) { if ( strpos ( $ options [ 'options_model' ] , '::' ) === false ) $ options [ 'options_model' ] .= '::options' ; $ params = $ options [ 'options_params' ] ?? [ ] ; if ( ! empty ( $ options [ 'options_depends' ... | Render list one option |
12,819 | public function validateDetailsPrimaryColumn ( string $ detail , string $ primary_column , string $ inactive_column , string $ pk_column , string & $ key = null ) { if ( empty ( $ this -> values [ $ detail ] ) ) return null ; $ primary_found = 0 ; $ primary_first_line = null ; $ primary_pk_id = null ; foreach ( $ this ... | Validate details primary column |
12,820 | public function redirectOnSuccess ( ) { $ params = [ ] ; if ( ! empty ( $ this -> options [ 'bypass_hidden_from_input' ] ) ) { foreach ( $ this -> options [ 'bypass_hidden_from_input' ] as $ v ) { $ params [ $ v ] = $ this -> options [ 'input' ] [ $ v ] ?? '' ; } } if ( ! empty ( $ this -> options [ 'collection_current... | Redirect on success |
12,821 | public function validateAsRequiredFields ( array $ fields ) { foreach ( $ fields as $ v ) { $ options = $ this -> fields [ $ v ] ; $ options [ 'options' ] [ 'required' ] = true ; $ this -> validateRequiredOneField ( $ this -> values [ $ v ] , $ v , $ options ) ; } } | Validate as required |
12,822 | public function getHeaderForRender ( string $ report_name , string $ header_name ) : array { $ columns = $ this -> data [ $ report_name ] [ 'header' ] [ $ header_name ] ; foreach ( $ columns as $ k => $ v ) { if ( $ k == 'blank' || empty ( $ v [ 'label_name' ] ) ) continue ; $ columns [ $ k ] [ 'as_header' ] = true ; $... | Get header for rendering |
12,823 | public function addNumberOfRows ( string $ report_name , int $ num_rows ) { $ this -> addSeparator ( $ report_name ) ; $ this -> addLegend ( $ report_name , i18n ( null , \ Object \ Content \ Messages :: REPORT_ROWS_NUMBER , [ 'replace' => [ '[Number]' => \ Format :: id ( $ num_rows ) ] ] ) ) ; if ( ! empty ( $ this ->... | Add number of rows |
12,824 | public function actionSave ( $ languageId = null , $ attrId = null ) { if ( empty ( $ languageId ) ) { $ languageId = Language :: getCurrent ( ) -> id ; } $ selectedLanguage = Language :: findOne ( $ languageId ) ; $ languages = Language :: find ( ) -> all ( ) ; $ attributeType = ArrayHelper :: toArray ( ShopAttributeT... | Save data action for ShopAttribute . If user has not permissions to do this action a 403 HTTP exception will be thrown . |
12,825 | public function actionRemove ( $ id ) { $ this -> findModel ( $ id ) -> delete ( ) ; return $ this -> redirect ( Url :: to ( [ '/shop/attribute' ] ) ) ; } | Deletes an existing ShopAttribute model . If deletion is successful the browser will be redirected to the index page . |
12,826 | public function actionGetAttributeValues ( $ attributeId ) { if ( \ Yii :: $ app -> request -> isAjax ) { $ attributeValues = ShopAttributeValue :: find ( ) -> where ( [ 'attribute_id' => $ attributeId ] ) -> all ( ) ; $ attributeValuesArray = ArrayHelper :: toArray ( $ attributeValues , [ 'bl\cms\shop\common\entities\... | Return attribute values by ajax request . |
12,827 | public function isRunning ( int $ pid ) : bool { $ cmd = sprintf ( 'kill -0 %d 2>&1' , $ pid ) ; $ this -> logger -> debug ( __METHOD__ . ": Exec command: $cmd" ) ; exec ( $ cmd , $ output , $ return_var ) ; return $ return_var === 0 ; } | Check whether a pid is running . |
12,828 | public function actionIndex ( ) { if ( ! \ Yii :: $ app -> user -> can ( 'index' , [ ] , false ) ) throw new ForbiddenHttpException ( Module :: t ( 'metaTag' , 'Access denied.' ) ) ; return parent :: actionIndex ( ) ; } | Lists all MetaTag models . |
12,829 | public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; if ( ! \ Yii :: $ app -> user -> can ( 'update' , [ 'model' => $ model ] ) ) throw new ForbiddenHttpException ( Module :: t ( 'metaTag' , 'Access denied.' ) ) ; if ( $ model -> load ( \ Yii :: $ app -> request -> post ( ) ) && $ model -> s... | Updates an existing MetaTag model . If update is successful the browser will be redirected to the view page . |
12,830 | public function actionDelete ( $ id ) { if ( ! \ Yii :: $ app -> user -> can ( 'delete' ) ) throw new ForbiddenHttpException ( \ Module :: t ( 'metaTag' , 'Access denied.' ) ) ; parent :: actionDelete ( $ id ) ; } | Deletes an existing MetaTag model . If deletion is successful the browser will be redirected to the index page . |
12,831 | public function getPrice ( ) { if ( \ Yii :: $ app -> user -> isGuest ) { $ params = [ 'combination_id' => $ this -> id , 'user_group_id' => UserGroup :: USER_GROUP_ALL_USERS ] ; } else { $ params = [ 'combination_id' => $ this -> id , 'user_group_id' => \ Yii :: $ app -> user -> identity -> user_group_id ] ; } $ combi... | Gets price for user group |
12,832 | public function findDefaultCombinationAndUndefault ( ) { if ( ! empty ( $ this -> id ) ) { $ defaultProductCombinations = Combination :: find ( ) -> where ( [ 'product_id' => $ this -> product_id , 'default' => true ] ) -> andWhere ( [ '!=' , 'id' , $ this -> id ] ) -> all ( ) ; } else { $ defaultProductCombinations = ... | Finds default combination for one product and makes it not default . |
12,833 | public function setDefaultOrNotDefault ( ) { if ( $ this -> default ) $ this -> findDefaultCombinationAndUndefault ( ) ; else { $ productCombinations = Combination :: find ( ) -> where ( [ 'product_id' => $ this -> product_id ] ) -> all ( ) ; if ( empty ( $ productCombinations ) ) $ this -> default = true ; } } | If there are not combinations in product sets this combination as default . |
12,834 | public function loadModalContent ( ) { global $ objPage ; $ id = \ Input :: get ( 'modal' ) ; if ( $ id == '' ) { return ; } $ page = \ Input :: get ( 'page' ) ; $ objPage = \ PageModel :: findByPk ( $ page ) ; $ objPage -> loadDetails ( ) ; if ( $ objPage === null ) { $ this -> log ( sprintf ( 'Page ID %s not found' ,... | load modal content |
12,835 | protected function output ( $ buffer ) { $ buffer = $ this -> replaceInsertTags ( $ buffer ) ; $ buffer = str_replace ( array ( '{{request_token}}' , '[{]' , '[}]' ) , array ( REQUEST_TOKEN , '{{' , '}}' ) , $ buffer ) ; $ buffer = str_replace ( '{{request_token}}' , \ RequestToken :: get ( ) , $ buffer ) ; if ( is_arr... | Output data encode to json and replace insert tags . |
12,836 | public function run ( ) : string { $ params = [ 'fields' => $ this -> fields , 'model' => $ this -> model , 'form' => $ this -> form , ] ; if ( $ this -> languageModel === null ) { $ template = 'fieldsSimple' ; } else { $ template = 'fieldsMultilanguage' ; $ params [ 'languageModel' ] = $ this -> languageModel ; } retu... | Starts the output widget of the form fields list with the specified types . |
12,837 | public function setSourceData ( array $ source ) { if ( $ this -> _locked ) { throw new ReadOnly ( 'Config is read only' ) ; } foreach ( $ source as $ key => $ part ) { if ( is_array ( $ part ) ) { $ this -> _data [ $ key ] = new static ( $ part , false ) ; } else { $ this -> _data [ $ key ] = $ part ; } } return $ thi... | Set a source data for the config |
12,838 | public function lock ( ) { $ this -> _locked = true ; foreach ( $ this -> _data as $ part ) { if ( $ part instanceof Config ) { $ part -> lock ( ) ; } } return $ this ; } | Lock the config to the read only mode |
12,839 | public function merge ( ConfigInterface $ config ) { if ( $ this -> _locked ) { throw new ReadOnly ( 'Config is read only' ) ; } $ source = array_replace_recursive ( $ this -> toArray ( ) , $ config -> toArray ( ) ) ; $ this -> setSourceData ( $ source ) ; return $ this ; } | Merge a config into this config |
12,840 | public function toArray ( ) { $ result = [ ] ; foreach ( $ this -> _data as $ key => $ part ) { if ( $ part instanceof Config ) { $ result [ $ key ] = $ part -> toArray ( ) ; } else { $ result [ $ key ] = $ part ; } } return $ result ; } | Get the config as an array |
12,841 | public function init ( array $ rawData , ActionResponseInterface $ actionResponse ) { $ this -> rawData = $ rawData ; $ this -> setDefaultResponseValues ( $ actionResponse ) ; $ this -> initStatusFromResponse ( ) ; } | Initializes the object fields with the given raw data |
12,842 | public function onContentChange ( OrderEvent $ event ) { $ order = $ event -> getOrder ( ) ; $ this -> calculator -> updateTotals ( $ order ) ; $ this -> stateResolver -> resolve ( $ order , $ event ) ; } | Content change event handler . |
12,843 | public function onStateChange ( OrderEvent $ event ) { $ order = $ event -> getOrder ( ) ; if ( in_array ( $ order -> getState ( ) , [ OrderStates :: STATE_ACCEPTED , OrderStates :: STATE_COMPLETED ] ) && $ order -> getType ( ) != OrderTypes :: TYPE_ORDER ) { $ order -> setType ( OrderTypes :: TYPE_ORDER ) -> setCreate... | State change event handler . |
12,844 | private function handleIdentity ( OrderInterface $ order ) { if ( null !== $ user = $ order -> getUser ( ) ) { if ( 0 == strlen ( $ order -> getEmail ( ) ) ) { $ order -> setEmail ( $ user -> getEmail ( ) ) ; } if ( 0 == strlen ( $ order -> getGender ( ) ) ) { $ order -> setGender ( $ user -> getGender ( ) ) ; } if ( 0... | handle the identity . |
12,845 | private function handleAddresses ( OrderInterface $ order ) { if ( null === $ order -> getInvoiceAddress ( ) ) { $ order -> setInvoiceAddress ( $ this -> getOrderUserDefaultAddress ( $ order ) ) ; } if ( ( null === $ order -> getDeliveryAddress ( ) ) && ! $ order -> getSameAddress ( ) ) { $ order -> setDeliveryAddress ... | handle the addresses . |
12,846 | private function handleAddressIdentity ( AddressInterface $ address , UserInterface $ user ) { if ( null === $ address -> getGender ( ) ) { $ address -> setGender ( $ user -> getGender ( ) ) ; } if ( null === $ address -> getFirstName ( ) ) { $ address -> setFirstName ( $ user -> getFirstName ( ) ) ; } if ( null === $ ... | Fills the address identity fields if needed . |
12,847 | private function getOrderUserDefaultAddress ( OrderInterface $ order ) { if ( null === $ user = $ order -> getUser ( ) ) { throw new OrderException ( 'User is not set.' ) ; } if ( null === $ address = $ user -> getAddresses ( ) -> first ( ) ) { throw new OrderException ( 'Unable to find the user default address.' ) ; }... | Returns the default address of the order s user . |
12,848 | public function setArticlesRows ( $ dc ) { $ element = \ ContentModel :: findByPk ( $ dc -> id ) ; $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ 'bootstrap_columnset' ] [ 'eval' ] [ 'minCount' ] = $ element -> sc_type ; } | set number of rows for bootstrap_columnset |
12,849 | public function getPageBootstrapArticles ( $ mcw ) { if ( $ this -> articles === null ) { $ article = \ ArticleModel :: findByPk ( $ mcw -> activeRecord -> pid ) ; $ model = \ ArticleModel :: findAll ( array ( 'column' => 'pid =? AND inColumn' , 'value' => array ( $ article -> pid , 'bootstrap' ) , ) ) ; $ articles = a... | get all articles in bootstrap section of an article |
12,850 | public function countExistingTabSeparators ( ContentWrapper \ Model $ model ) { $ id = $ model -> getType ( ) == ContentWrapper \ Model :: TYPE_START ? $ model -> id : $ model -> bootstrap_parentId ; $ number = \ ContentModel :: countBy ( 'type=? AND bootstrap_parentId' , array ( $ model -> getTypeName ( ContentWrapper... | count existing tab separators elements |
12,851 | public function countRequiredTabSeparators ( ContentWrapper \ Model $ model ) { if ( $ model -> getType ( ) != ContentWrapper \ Model :: TYPE_START ) { $ model = \ ContentModel :: findByPk ( $ model -> bootstrap_parentId ) ; } $ tabs = array ( ) ; if ( $ model -> bootstrap_tabs ) { $ tabs = deserialize ( $ model -> boo... | count required tab separator elements |
12,852 | protected function compile ( ) { $ dataModules = deserialize ( $ this -> navbarModules , true ) ; $ modules = array ( ) ; foreach ( $ dataModules as $ module ) { if ( $ module [ 'module' ] != '' ) { $ modules [ ] = $ this -> generateModule ( $ module ) ; } } if ( $ this -> cssID [ 1 ] == '' ) { $ cssID = $ this -> cssI... | compile the navbar |
12,853 | public function getStream ( ) { if ( ! $ this -> stream ) $ this -> stream = Stream :: createFromPath ( $ this -> path ) ; return $ this -> stream ; } | Get stream of the uploaded file |
12,854 | public function choose ( $ number , array $ variants , $ locale = null ) { if ( $ locale === null ) { $ locale = $ this -> getLocale ( ) ; } else { $ locale = $ this -> normalizeLocale ( $ locale ) ; } if ( ! isset ( self :: $ rulesMap [ $ locale ] ) ) { $ position = 0 ; } else { $ rule = self :: $ rulesMap [ $ locale ... | Choose the plural variant |
12,855 | protected function normalizeLocale ( $ locale ) { if ( $ locale instanceof Locale ) { $ locale = $ locale -> getPrimaryLanguage ( ) ; } $ underlinePos = strpos ( $ locale , '_' ) ; if ( $ underlinePos !== false ) { return substr ( $ locale , 0 , $ underlinePos ) ; } return $ locale ; } | Normalize the locale |
12,856 | private function helpers ( ) { $ HELPERS_FILE = [ ] ; if ( file_exists ( $ pathHelpers = VENDOR_KNOB_BASE_DIR . '/src/config/' . static :: HELPERS_FILE . '.php' ) ) { $ HELPERS_FILE += include $ pathHelpers ; } if ( file_exists ( $ pathHelpers = APP_DIR . '/config/' . static :: HELPERS_FILE . '.php' ) ) { $ HELPERS_FIL... | List of helpers for our templates |
12,857 | public static function createGuid ( ) { return strtolower ( sprintf ( '%04x%04x%04x%04x%04x%04x%04x%04x' , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0x0fff ) | 0x4000 , mt_rand ( 0 , 0x3fff ) | 0x8000 , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff... | Creates a 32 character GUID string |
12,858 | protected function processArgumentService ( Element $ arg ) { $ definition = new stdClass ( ) ; $ definition -> type = 'service' ; if ( ! isset ( $ arg -> id ) ) { throw new InvalidConfig ( 'Definition of an argument type "service" must contain the "id" attribute' , null , null , $ arg ) ; } $ definition -> id = trim (... | Process service type argument |
12,859 | protected function processArgumentParameter ( Element $ arg ) { $ definition = new stdClass ( ) ; $ definition -> type = 'parameter' ; if ( ! isset ( $ arg -> name ) ) { throw new InvalidConfig ( 'Definition of an argument type "paramater" must contain the "name" attribute' , null , null , $ arg ) ; } $ definition -> n... | Process parameter type argument |
12,860 | protected function processArgumentBoolean ( Element $ arg ) { $ definition = new stdClass ( ) ; $ definition -> type = 'value' ; if ( isset ( $ arg -> value ) ) { $ definition -> value = ( trim ( $ arg -> value ) === 'true' ) ; return $ definition ; } $ value = $ arg -> getValue ( ) ; if ( ! empty ( $ value ) ) { $ def... | Process boolean type argument |
12,861 | protected function processArgumentNull ( Element $ arg ) { $ definition = new stdClass ( ) ; $ definition -> type = 'value' ; $ definition -> value = null ; return $ definition ; } | Process null type argument |
12,862 | protected function processArgumentArray ( Element $ arg ) { $ definition = new stdClass ( ) ; $ definition -> type = 'value' ; $ definition -> value = [ ] ; foreach ( $ arg -> getContent ( ) as $ element ) { if ( $ element -> getName ( ) !== 'element' ) { throw new InvalidConfig ( 'Array definition must contain only "e... | Process array type argument |
12,863 | public function set_sortable_columns ( $ columns ) { if ( ! empty ( $ this -> sortable_columns ) ) { $ columns = \ array_merge ( $ columns , $ this -> sortable_columns ) ; } return $ columns ; } | Make custom columns sortable . |
12,864 | public function output_column ( $ content , $ column , $ term_id ) { $ method = "get_{$column}_column" ; if ( \ method_exists ( $ this , $ method ) ) { return $ this -> { $ method } ( $ term_id ) ; } return $ content ; } | Register a columns sort method with PostTypes \ Taxonomy . |
12,865 | private function get_names ( ) { $ names = [ 'name' => $ this -> get_name ( ) , ] ; if ( $ this -> plural !== null ) { $ names [ 'plural' ] = $ this -> plural ; } if ( $ this -> singular !== null ) { $ names [ 'singular' ] = $ this -> singular ; } if ( $ this -> slug !== null ) { $ names [ 'slug' ] = $ this -> slug ; }... | Get the full array of overridden names to pass to PostTypes \ Taxonomy . |
12,866 | public function setVars ( array $ vars ) { $ name = isset ( $ vars [ 'name' ] ) && ! empty ( $ vars [ 'name' ] ) ? $ vars [ 'name' ] : $ vars [ 'id' ] ; $ vars [ 'name' ] = $ name ; $ this -> vars = $ vars ; return $ this ; } | Sets the value of vars . |
12,867 | public function handleResize ( ResizeImageEvent $ event ) { $ image = $ this -> imageFactory -> create ( $ this -> rootDir . '/' . $ event -> getImage ( ) , [ $ event -> getWidth ( ) , $ event -> getHeight ( ) , $ event -> getMode ( ) ] , $ event -> getTarget ( ) ) ; $ event -> setResultImage ( $ image -> getUrl ( $ th... | Handle a resize image event . |
12,868 | public function handleGenerateHtml ( GenerateHtmlEvent $ event ) { $ imageAdapter = $ this -> framework -> getAdapter ( Image :: class ) ; $ event -> setHtml ( $ imageAdapter -> getHtml ( $ event -> getSrc ( ) , $ event -> getAlt ( ) , $ event -> getAttributes ( ) ) ) ; } | Handle a get html for image event . |
12,869 | public function initialize ( array $ data = array ( ) ) { if ( $ this -> exe -> flash -> has ( 'form_data' ) ) $ this -> set ( $ this -> exe -> flash -> get ( 'form_data' ) ) ; parent :: initialize ( $ data ) ; } | Initialize with flash data |
12,870 | public function flash ( array $ data = array ( ) ) { if ( count ( $ data ) == 0 && $ this -> exe -> request === null ) return ; $ data = count ( $ data ) > 0 ? $ data : $ this -> exe -> request -> getParsedBody ( ) ; $ this -> exe -> flash -> set ( 'form_data' , $ data ) ; return $ this ; } | Flash given data If not passed flash form data |
12,871 | protected function prepareCall ( $ func_args ) { if ( ! $ this -> prepared_url ) $ this -> prepared_url = $ this -> url ( ) ; $ args = array_merge ( $ this -> args , $ func_args ) ; $ cnt = count ( $ args ) ; $ replaced_cnt = 0 ; $ params = array ( ) ; $ this -> lastArgs = array ( ) ; for ( $ i = 0 ; $ i < $ cnt ; $ i ... | Prepare parameters for the action invocation . |
12,872 | private function parseConfig ( string $ configText ) : array { $ config = $ this -> deindent ( $ configText ) ; if ( empty ( $ config ) ) { return [ ] ; } try { $ parsed = Yaml :: parse ( $ config ) ; return is_array ( $ parsed ) ? $ parsed : [ ] ; } catch ( ParseException $ e ) { return [ ] ; } } | Parses the config from the given config text |
12,873 | private function deindent ( string $ configText ) : string { $ configText = rtrim ( $ configText ) ; if ( empty ( $ configText ) ) { return "" ; } $ configText = preg_replace ( "~\\A\\s*\n~" , "" , $ configText ) ; if ( 1 === preg_match ( '~\A(?P<indention>\\s*)[^\\s]~' , $ configText , $ matches ) ) { if ( 1 === preg_... | Deindents the given text |
12,874 | public function getPath ( ) : string { if ( $ this -> fullPath !== null ) { return $ this -> fullPath ; } $ path = $ this -> getSetting ( 'path' ) ; if ( is_dir ( $ path ) ) { $ this -> verified = true ; return $ this -> fullPath = realpath ( $ path ) ; } $ pubPath = public_path ( trim ( $ path , '/' ) ) ; $ this -> ve... | Get path to theme |
12,875 | public function getWebPath ( ) : string { if ( $ this -> fullWebPath !== null ) { return $ this -> fullWebPath ; } $ path = rtrim ( $ this -> getSetting ( 'webPath' ) , '/' ) ; if ( filter_var ( $ path , FILTER_VALIDATE_URL ) !== false ) { return $ this -> fullWebPath = $ path ; } if ( Str :: startsWith ( $ path , '//'... | Get web path for theme |
12,876 | public function verified ( ) : bool { if ( $ this -> verified !== null ) { return $ this -> verified ; } return $ this -> verified = is_dir ( $ this -> getPath ( ) ) ; } | Check if theme is verified i . e . Directory exists in given path |
12,877 | private function confirm_choice ( InputInterface $ input , OutputInterface $ output ) : bool { $ helper = $ this -> getHelper ( 'question' ) ; $ question = new ConfirmationQuestion ( '<fg=yellow>The site seems to be in a production environment, are you sure you want to continue?</>' , false ) ; return $ helper -> ask (... | Confirm choice of user to cache . |
12,878 | public function loadFromFieldset ( $ definition ) { if ( ! is_array ( $ definition ) ) { $ definition = deserialize ( $ definition , true ) ; } $ buttons = array ( ) ; $ group = false ; $ dropdown = false ; foreach ( $ definition as $ button ) { if ( $ button [ 'label' ] == '' && $ button [ 'type' ] != 'group' ) { cont... | load buttons defined in a field set definition created by the MultiColumnWizard |
12,879 | public function addItem ( array $ item , $ first = false , $ createGroup = false ) { $ this -> addItemToTarget ( $ this -> arrButtons , $ item , $ first , $ createGroup ) ; } | add item to button component |
12,880 | protected function addItemToTarget ( array & $ target , array $ item , $ first = false , $ createGroup = false ) { if ( is_array ( $ item [ 'attributes' ] ) ) { $ attributes = '' ; foreach ( $ item [ 'attributes' ] as $ attribute ) { if ( $ attribute [ 'name' ] == '' ) { continue ; } if ( $ attribute [ 'name' ] == 'cla... | add item to a target used for subitems and button component itself |
12,881 | public static function getSearchWord ( $ url ) { $ parsed_url = parse_url ( $ url ) ; if ( ! isset ( $ parsed_url [ 'host' ] ) ) { $ parsed_url [ 'host' ] = '' ; } $ domain_parts = array_reverse ( explode ( '.' , $ parsed_url [ 'host' ] ) ) ; if ( ! isset ( $ domain_parts [ 1 ] ) ) { return false ; } $ engine = $ domai... | Get search engine name by query string . required for SEO leads |
12,882 | protected function _setConfig ( ) { $ config = [ ] ; $ currentConfig = $ this -> _modelConfigSearchInfo -> getConfig ( ) ; if ( ! empty ( $ this -> _searchInfo ) && is_array ( $ this -> _searchInfo ) ) { $ config = $ this -> _searchInfo + $ currentConfig ; } if ( ! empty ( $ this -> AutocompleteLimit ) && is_numeric ( ... | Merge configuration of plugin with configuration of component and write it . |
12,883 | public function getTargetList ( ) { $ targetFieldsList = $ this -> _modelSearch -> getTargetFieldsList ( ) ; $ targetData = $ this -> _controller -> request -> query ( 'target' ) ; if ( empty ( $ targetData ) ) { $ target = $ targetFieldsList ; } else { $ target = array_intersect ( ( array ) $ targetData , $ targetFiel... | Get list of target fields by URL GET parameters |
12,884 | public function getAnyPartFlag ( ) { $ targetData = $ this -> _controller -> request -> query ( 'target' ) ; $ anyPart = $ this -> _modelSearch -> getAnyPartFlag ( $ targetData ) ; return $ anyPart ; } | Get state of flag any part search by URL GET parameters |
12,885 | public function getQueryStr ( ) { $ queryData = ( string ) $ this -> _controller -> request -> query ( 'query' ) ; $ query = $ this -> _modelSearch -> getQueryStr ( $ queryData ) ; return $ query ; } | Get query string by URL GET parameters |
12,886 | public function autocomplete ( ) { Configure :: write ( 'debug' , 0 ) ; if ( ! $ this -> _controller -> request -> is ( 'ajax' ) || ! $ this -> _controller -> request -> is ( 'post' ) || ! $ this -> _controller -> RequestHandler -> prefers ( 'json' ) ) { throw new BadRequestException ( ) ; } $ data = [ ] ; $ query = $ ... | Action autocomplete . Used to autocomplte input fields . |
12,887 | protected function handleIcon ( Infoset $ info ) { $ profiler = $ this -> getProfiler ( ) ; if ( $ profiler instanceof ProfilerExtendedInterface ) { $ icon = $ profiler -> getIcon ( ) ; if ( $ icon !== null ) { if ( strpos ( $ icon , 'data:image' ) === 0 ) { $ info -> setIcon ( $ icon , Infoset :: ICON_BASE64 ) ; retur... | Resolve the icon source |
12,888 | protected function createContent ( Infoset $ info ) { $ profiler = $ this -> getProfiler ( ) ; if ( $ profiler instanceof ProfilerExtendedInterface && $ profiler -> hasAdditionalInfo ( ) ) { $ profilerInfo = $ profiler -> getAdditionalInfo ( ) ; if ( isset ( $ profilerInfo [ '__TOPOLOGY__' ] ) && $ profilerInfo [ '__TO... | Get a panel with full information |
12,889 | protected function eventsInfo ( Infoset $ info , array $ profiles ) { $ table = $ this -> createTable ( ) -> setColsWidths ( [ 1 , 1 , 1 , 94 ] ) -> setHeadContent ( [ '' , '' , 'Time' , 'Action' ] ) -> enableBbCodes ( ) -> setTitle ( 'Events' ) ; $ info [ ] = $ table ; $ number = 1 ; foreach ( $ profiles as $ profile ... | Create the events info |
12,890 | protected function handleProfileStatus ( ProfileInterface $ profile ) { switch ( $ profile -> getStatus ( ) ) { case ProfileInterface :: STATUS_SUCCESS : return self :: STATUS_SUCCESS ; case ProfileInterface :: STATUS_NOTICE : return self :: STATUS_NOTICE ; case ProfileInterface :: STATUS_WARNING : return self :: STATU... | Resolve the profile status |
12,891 | protected function handleProfileType ( ProfileInterface $ profile , InfosetTable $ table , array $ row ) { switch ( $ profile -> getType ( ) ) { case ProfileInterface :: TYPE_READ : $ table -> pushSuccess ( $ row ) ; break ; case ProfileInterface :: TYPE_WRITE : $ table -> pushInfo ( $ row ) ; break ; case ProfileInter... | Handle the table row by the type of the profile |
12,892 | protected function additionalInfo ( Infoset $ info , array $ profilerInfo ) { $ infoTable = $ this -> createTable ( ) -> enableBbCodes ( ) -> setTitle ( 'Info' ) ; $ info [ ] = $ infoTable ; foreach ( $ profilerInfo as $ key => $ value ) { $ infoTable [ ] = [ $ key . ':' , $ value ] ; } } | Create the additional info |
12,893 | protected function topologyInfo ( Infoset $ info , Descriptor $ topology ) { $ topologyInfo = $ this -> createInfoset ( ) ; $ topologyInfo -> setTitle ( 'Topology' ) ; $ topologyInfo -> setContentType ( Infoset :: TYPE_TOPOLOGY ) ; $ topologyInfo [ ] = $ topology ; $ info [ ] = $ topologyInfo ; } | Create the topology info |
12,894 | public function uniqueExceptItself ( $ attribute , $ params ) { $ _attribute = '_' . $ attribute ; $ value = $ this -> $ attribute ; $ _value = $ this -> $ _attribute ; if ( $ value <> $ _value ) { $ found = false ; if ( Rubric :: find ( ) -> select ( [ $ attribute ] ) -> where ( [ $ attribute => $ value ] ) -> count (... | Checks unique except of the value of the attribute . |
12,895 | public function pluginContactForm ( $ settings ) { if ( empty ( $ settings ) ) { return ; } $ available = [ 'enqueue_styles' , ] ; if ( is_bool ( $ settings ) && $ settings ) { $ settings = $ available ; } foreach ( $ settings as $ key ) { $ key = strtolower ( $ key ) ; if ( ! in_array ( $ key , $ available ) ) { conti... | Clean Contact Form plugin functionalities . |
12,896 | public function pluginW3tc ( $ settings ) { if ( empty ( $ settings ) ) { return ; } $ available = [ 'remove_comment' , 'remove_meta_box' , ] ; if ( is_bool ( $ settings ) && $ settings ) { $ settings = $ available ; } foreach ( $ settings as $ key ) { $ key = strtolower ( $ key ) ; if ( ! in_array ( $ key , $ availabl... | Clean W3TC plugin functionalities . |
12,897 | public function pluginWoocommerce ( $ settings ) { if ( empty ( $ settings ) ) { return ; } $ available = [ 'enqueue_scripts' , 'enqueue_styles' , 'cart_fragments' , 'generator_tag' , 'reviews_tab' , ] ; if ( is_bool ( $ settings ) && $ settings ) { $ settings = $ available ; } foreach ( $ settings as $ key ) { $ key =... | Clean WooCommerce plugin functionalities . |
12,898 | public function pluginWpSocializer ( $ settings ) { if ( empty ( $ settings ) ) { return ; } $ available = [ 'remove_meta_box' , ] ; if ( is_bool ( $ settings ) && $ settings ) { $ settings = $ available ; } foreach ( $ settings as $ key ) { $ key = strtolower ( $ key ) ; if ( ! in_array ( $ key , $ available ) ) { con... | Clean WP Socializer plugin functionalities . |
12,899 | public function pluginYoast ( $ settings ) { if ( empty ( $ settings ) || ! defined ( 'WPSEO_VERSION' ) ) { return ; } $ available = [ 'remove_breadcrumbs_duplicates' , 'remove_comment' , 'remove_meta_box' , ] ; if ( is_bool ( $ settings ) && $ settings ) { $ settings = $ available ; } foreach ( $ settings as $ key ) {... | Clean YOAST plugin functionalities . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.