idx
int64 0
60.3k
| question
stringlengths 64
4.24k
| target
stringlengths 5
618
|
|---|---|---|
48,800
|
public function getConfigFiles ( $ configs = [ ] ) { $ finder = $ this -> make ( Finder :: class ) -> files ( ) -> in ( $ this -> configPath ( ) ) -> name ( '*.php' ) ; foreach ( $ finder as $ file ) { $ configs [ basename ( $ file -> getFilename ( ) , '.php' ) ] = require $ file -> getRealPath ( ) ; } return $ configs ; }
|
Gets all config files .
|
48,801
|
private function registerBaseFacades ( ) { Facade :: clearResolvedInstances ( ) ; Facade :: setFacadeApplication ( $ this ) ; AliasLoader :: getInstance ( $ this -> make ( 'config' ) -> get ( 'app.aliases' ) ) -> register ( ) ; }
|
Register Base Facades .
|
48,802
|
public function register ( ) { $ this -> app -> singleton ( 'hook.factory' , function ( $ app ) { return new HookFactory ( $ app ) ; } ) ; $ this -> app -> alias ( 'hook.factory' , HookFactory :: class ) ; }
|
Register hook services .
|
48,803
|
public function findMeta ( $ id , $ key ) { $ meta = $ this -> getMeta ( $ id ) ; if ( is_string ( $ result = $ meta -> get ( $ key ) ) ) { return $ result ; } return new Collection ( $ result ) ; }
|
Find user meta data .
|
48,804
|
public function createMeta ( $ id , array $ arguments ) { $ parameters = $ this -> resolveMetaArguments ( $ arguments ) ; return $ this -> resolveMeta ( 'make' , [ $ id , $ parameters [ 'key' ] , $ parameters [ 'value' ] , $ parameters [ 'unique' ] , ] ) ; }
|
Create user meta data .
|
48,805
|
public function updateMeta ( $ id , array $ arguments ) { $ parameters = $ this -> resolveMetaArguments ( $ arguments ) ; return $ this -> resolveMeta ( 'save' , [ $ id , $ parameters [ 'key' ] , $ parameters [ 'value' ] , ] ) ; }
|
Update user meta .
|
48,806
|
public function jsonSerialize ( ) { return [ 'id' => $ this -> id , 'size' => $ this -> size , 'link' => $ this -> link , 'title' => $ this -> title , 'caption' => $ this -> caption , 'description' => $ this -> description , 'type' => $ this -> type , 'mimeType' => $ this -> mime_type , 'meta' => $ this -> meta , 'width' => $ this -> width , 'height' => $ this -> height , ] ; }
|
Handle json encoding .
|
48,807
|
public function propagateSchemaWithValues ( ) { array_walk ( $ this -> schema , function ( $ field , $ index ) { if ( $ this -> hasParent ( ) and $ this -> getParent ( ) -> isTypeOf ( 'repeatable' ) ) { return $ this -> propagateAsRepeatableSchema ( $ field , $ index ) ; } return $ this -> propagateAsNormalSchema ( $ field ) ; } ) ; $ this -> mergeFields ( $ this -> heap ) ; }
|
Propagate fields schemas with values .
|
48,808
|
public function propagateAsRepeatableSchema ( Field $ field , $ index ) { if ( $ field -> isTypeOf ( 'tinymce' ) ) { throw new FieldException ( "Tinymce [{$field->getSlug()}] field cannot be nested in repeatable field." ) ; } foreach ( $ this -> getValues ( ) as $ key => $ value ) { $ clone = clone $ field ; $ clone -> setValue ( $ value [ $ clone -> getSlug ( ) ] ) -> dispatch ( ) ; $ this -> heap [ $ key ] [ $ index ] = $ clone ; } }
|
Propagate schema for repeatable field .
|
48,809
|
public function propagateAsNormalSchema ( Field $ field ) { $ field -> setValue ( $ this -> getValue ( $ field -> getSlug ( ) ) ) -> dispatch ( ) ; return $ this -> pushFields ( $ field ) ; }
|
Propagate schema for normal field .
|
48,810
|
public function getSanitizedValues ( & $ values = [ ] ) { array_walk ( $ this -> fields , function ( $ field , $ index ) use ( & $ values ) { if ( is_array ( $ field ) ) { return $ this -> sanitizeConditionalValues ( $ values , $ field , $ index ) ; } return $ this -> sanitizeValues ( $ values [ $ field -> getSlug ( ) ] , $ field ) ; } ) ; return $ values ; }
|
Sanitize values .
|
48,811
|
public function sanitizeConditionalValues ( & $ values , $ fields , $ index ) { foreach ( $ fields as $ key => $ field ) { if ( $ values === $ index ) { $ this -> sanitizeValues ( $ values [ $ index ] [ $ field -> getSlug ( ) ] , $ field ) ; } } }
|
Sanitize values in associative array .
|
48,812
|
public function sanitizeValues ( & $ values , $ field ) { $ values = $ field -> getValue ( ) ; if ( $ field -> hasChildren ( ) ) { $ field -> getChildren ( ) -> getSanitizedValues ( $ values ) ; } }
|
Sanitize field values with field .
|
48,813
|
public function register ( ) { $ this -> app -> singleton ( 'user.factory' , function ( $ app ) { return new UserFactory ( $ app ) ; } ) ; $ this -> app -> alias ( 'user.factory' , UserFactory :: class ) ; }
|
Register user services .
|
48,814
|
public function query ( array $ arguments = [ ] ) { $ options = array_merge ( [ 'hierarchical' => 'threaded' , ] , $ arguments ) ; return $ this -> plugger -> setModel ( $ this ) -> setAdapter ( Comment :: class ) -> plugIn ( get_comments ( $ options ) ) -> getConnected ( ) ; }
|
Query comments .
|
48,815
|
public function findOrFail ( $ id ) { $ comment = $ this -> find ( $ id ) ; if ( ! $ comment -> getAdaptee ( ) ) { throw new QueryException ( "Comment [{$id}] not found." ) ; } return $ comment ; }
|
Find comment by id or trow if unsuccessful .
|
48,816
|
public function createOrFail ( array $ arguments ) { $ status = $ this -> create ( $ arguments ) ; if ( is_wp_error ( $ status ) ) { throw new QueryException ( 'Could not create new comment.' ) ; } return $ status ; }
|
Create post or fail if unsuccessful .
|
48,817
|
public function mapRulesToAttributes ( ) { foreach ( $ this -> rules as $ rule ) { $ params = explode ( ':' , $ rule ) ; $ this -> attributes [ reset ( $ params ) ] = end ( $ params ) ; } }
|
Map rules for field attributes .
|
48,818
|
public function register ( ) { $ this -> app -> singleton ( 'column.factory' , function ( $ app ) { return new ColumnFactory ( $ app ) ; } ) ; $ this -> app -> alias ( 'column.factory' , ColumnFactory :: class ) ; }
|
Register column services .
|
48,819
|
public function register ( ) { $ this -> app -> singleton ( 'posttype.factory' , function ( $ app ) { return new PosttypeFactory ( $ app ) ; } ) ; $ this -> app -> alias ( 'posttype.factory' , PosttypeFactory :: class ) ; }
|
Register posttype services .
|
48,820
|
public function setSingular ( $ title = [ ] ) { if ( ! empty ( $ title ) && isset ( $ title [ 0 ] ) ) { $ this -> singular = $ title [ 0 ] ; } else { $ name = str_replace ( '_' , ' ' , $ this -> getSlug ( ) ) ; $ this -> singular = Str :: singular ( Str :: title ( $ name ) ) ; } return $ this ; }
|
Sets the value of singular .
|
48,821
|
public function setPlural ( $ title = [ ] ) { if ( ! empty ( $ title ) && isset ( $ title [ 1 ] ) ) { $ this -> plural = $ title [ 1 ] ; } else { $ name = str_replace ( '_' , ' ' , $ this -> getSlug ( ) ) ; $ this -> plural = Str :: plural ( Str :: title ( $ name ) ) ; } return $ this ; }
|
Sets the value of plural .
|
48,822
|
public function getLabels ( ) { return [ 'name' => $ this -> plural , 'singular_name' => $ this -> singular , 'add_new' => 'Add New' . ' ' . $ this -> singular , 'add_new_item' => 'Add New' . ' ' . $ this -> singular , 'edit_item' => 'Edit' . ' ' . $ this -> singular , 'new_item' => 'New' . ' ' . $ this -> singular , 'all_items' => 'All' . ' ' . $ this -> plural , 'view_item' => 'View' . ' ' . $ this -> singular , 'search_items' => 'Search' . ' ' . $ this -> plural , 'not_found' => $ this -> plural . ' ' . 'no found' , 'not_found_in_trash' => $ this -> plural . ' ' . 'no found in Trash' , 'parent_item_colon' => '' , 'menu_name' => $ this -> plural , ] ; }
|
Get labels .
|
48,823
|
public function create ( ModelInterface $ model ) { $ comment = $ this -> container -> make ( CommentSingularity :: class ) ; $ comment -> setModel ( $ model ) -> boot ( ) ; return $ comment ; }
|
Create comment .
|
48,824
|
public function when ( $ condition , $ fields ) { $ this -> getChildren ( ) -> mergeSchema ( [ $ this -> normalizeCondition ( $ condition ) => $ fields , ] ) ; return $ this ; }
|
Set condition fields .
|
48,825
|
public function normalizeCondition ( $ condition ) { if ( $ condition === true || $ condition === 1 ) { return 'true' ; } if ( $ condition === false || $ condition === 0 ) { return 'false' ; } return Helper :: slugify ( $ condition ) ; }
|
Normalize condition for array key .
|
48,826
|
public function registerThumbnailFactory ( ) { $ this -> app -> singleton ( 'thumbnail.factory' , function ( $ app ) { return new ThumbnailFactory ( $ app [ 'thumbnails.collection' ] , $ app ) ; } ) ; $ this -> app -> alias ( 'thumbnail.factory' , ThumbnailFactory :: class ) ; }
|
Register thumbnail factory .
|
48,827
|
public function dispatchTo ( $ action ) { $ this -> setAction ( $ action ) ; $ this -> hook -> action ( 'init' , [ $ this , 'hooks' ] ) -> dispatch ( ) ; return $ this ; }
|
Dispach asset to action handler .
|
48,828
|
public function hooks ( ) { $ this -> hook -> action ( $ this -> isAllowedArea ( $ this -> getArea ( ) ) , [ $ this , 'handleAction' ] ) -> dispatch ( ) ; if ( ! empty ( $ this -> getArgument ( 'execution' ) ) ) { $ this -> hook -> filter ( 'script_loader_tag' , [ $ this , 'addExecutionTypes' ] ) -> dispatch ( ) ; } }
|
Register asset hooks .
|
48,829
|
public function register ( ) { if ( ! $ this -> is ( 'registered' ) ) { call_user_func ( "wp_register_{$this->getType()}" , $ this -> getSlug ( ) , $ this -> getPath ( ) , $ this -> getArgument ( 'dependences' ) , $ this -> getArgument ( 'version' ) , ( $ this -> getPlacement ( ) === 'footer' ) ? true : false ) ; $ this -> localizeAsset ( ) ; } return $ this ; }
|
Register asset .
|
48,830
|
private function localizeAsset ( ) { if ( $ this -> getArgument ( 'localize' ) ) { wp_localize_script ( $ this -> getSlug ( ) , $ this -> getArgument ( 'localize' ) [ 'var' ] , $ this -> getArgument ( 'localize' ) [ 'callback' ] ) ; } return $ this ; }
|
Localize asset .
|
48,831
|
public function addExecutionTypes ( $ tag , $ handler ) { if ( $ handler === $ this -> getSlug ( ) ) { $ attributes = implode ( ' ' , $ this -> getArgument ( 'execution' ) ) ; return str_replace ( ' src' , " {$attributes} src" , $ tag ) ; } return $ tag ; }
|
Add specifed execution type to the asset html tag .
|
48,832
|
public function getType ( ) { $ type = $ this -> getArgument ( 'type' ) ; $ allowed = $ this -> getAllowedTypes ( ) ; if ( $ type ) { if ( ! $ this -> isAllowedType ( $ type ) ) { throw new AssetException ( 'Illegal Asset Type: Assets types can be only ' . implode ( ', ' , $ allowed ) ) ; } return $ type ; } $ ext = pathinfo ( $ this -> getArgument ( 'path' ) , PATHINFO_EXTENSION ) ; return ( $ ext && $ ext === 'js' ) ? $ allowed [ 0 ] : $ allowed [ 1 ] ; }
|
Gets asset type .
|
48,833
|
public function getArea ( ) { $ area = $ this -> getArgument ( 'area' ) ; $ allowed = $ this -> getAllowedAreas ( ) ; if ( $ area ) { if ( ! $ this -> isAllowedArea ( $ area ) ) { throw new AssetException ( 'Illegal Asset Area: Assets can be only assigned to ' . implode ( ', ' , $ allowed ) ) ; } return $ area ; } return reset ( $ allowed ) ; }
|
Gets asset area .
|
48,834
|
private function getStylesMedia ( ) { $ media = $ this -> getArgument ( 'media' ) ; $ allowed = $ this -> getAllowedMedia ( ) ; if ( $ media ) { if ( ! $ this -> isAllowedMedia ( $ media ) ) { throw new AssetException ( 'Illegal media: Style assets acceptable madia ' . implode ( ', ' , $ allowed ) ) ; } return $ media ; } return reset ( $ allowed ) ; }
|
Gets media of styles asset .
|
48,835
|
private function getScriptsPlacement ( ) { $ placement = $ this -> getArgument ( 'placement' ) ; $ allowed = $ this -> getAllowedPlacements ( ) ; if ( $ placement ) { if ( ! $ this -> isAllowedPlacement ( $ placement ) ) { throw new AssetException ( 'Illegal placement: Script assets can be only placed in ' . implode ( ', ' , $ allowed ) ) ; } if ( $ this -> isPlacement ( 'head' ) ) { return $ placement ; } } return 'footer' ; }
|
Gets placement of scripts asset .
|
48,836
|
public function register ( ) { $ this -> registerAdapterPlugger ( ) ; $ this -> registerPostAdapter ( ) ; $ this -> registerTermAdapter ( ) ; $ this -> registerUserAdapter ( ) ; $ this -> registerMenuAdapter ( ) ; $ this -> registerCommentAdapter ( ) ; }
|
Register adapter services .
|
48,837
|
protected function registerAdapterPlugger ( ) { $ this -> app -> bind ( 'adapter.plugger' , function ( $ app ) { $ collection = new Collection ; return new AdapterPlugger ( $ collection , $ app [ 'config' ] ) ; } ) ; $ this -> app -> alias ( 'adapter.plugger' , AdapterPlugger :: class ) ; }
|
Register Adapter Plugger .
|
48,838
|
protected function registerPostAdapter ( ) { $ this -> app -> bind ( 'adapter.post' , function ( $ app ) { return new Post ( $ app [ 'config' ] ) ; } ) ; $ this -> app -> alias ( 'adapter.post' , Post :: class ) ; }
|
Register Post Adapter .
|
48,839
|
protected function registerTermAdapter ( ) { $ this -> app -> bind ( 'adapter.term' , function ( $ app ) { return new Term ( $ app [ 'config' ] ) ; } ) ; $ this -> app -> alias ( 'adapter.term' , Term :: class ) ; }
|
Register Term Adapter .
|
48,840
|
protected function registerUserAdapter ( ) { $ this -> app -> bind ( 'adapter.user' , function ( $ app ) { return new User ( $ app [ 'config' ] ) ; } ) ; $ this -> app -> alias ( 'adapter.user' , User :: class ) ; }
|
Register User Adapter .
|
48,841
|
protected function registerCommentAdapter ( ) { $ this -> app -> bind ( 'adapter.comment' , function ( $ app ) { return new Comment ( $ app [ 'config' ] ) ; } ) ; $ this -> app -> alias ( 'adapter.comment' , Comment :: class ) ; }
|
Register Comment Adapter .
|
48,842
|
protected function registerMenuAdapter ( ) { $ this -> app -> bind ( 'adapter.menu' , function ( $ app ) { return new Menu ( $ app [ 'config' ] ) ; } ) ; $ this -> app -> alias ( 'adapter.menu' , Menu :: class ) ; }
|
Register Menu Adapter .
|
48,843
|
private function setLoggedinUser ( UserModel $ model , User $ adapter ) { $ wp_user = new WP_User ( $ this -> getCurrentUserId ( ) ) ; $ adapter -> setModel ( $ model ) -> setAdaptee ( $ wp_user ) -> connect ( ) ; $ this -> setUser ( $ adapter ) ; }
|
Get logged in user object .
|
48,844
|
public function attempt ( array $ credentials , $ remember = false ) { $ credentials = array_merge ( $ credentials , [ 'remember' => $ remember ] ) ; $ user = wp_signon ( $ credentials ) ; if ( ! is_wp_error ( $ user ) ) { return true ; } return false ; }
|
Attempt user login .
|
48,845
|
public function login ( User $ user , $ remember = false , $ secure = '' ) { wp_set_auth_cookie ( $ user -> id , $ remember , $ secure ) ; wp_set_current_user ( $ user -> id ) ; }
|
Login with User istance .
|
48,846
|
protected function registerPosttype ( ) { if ( ! $ this -> isRegistered ( ) ) { $ parameters = array_merge ( [ 'labels' => $ this -> model -> getLabels ( ) ] , $ this -> model -> getArguments ( ) ) ; return register_post_type ( $ this -> model -> getSlug ( ) , $ parameters ) ; } throw new PosttypeException ( "Posttype [{$this->model->getSlug()}] already exsist." ) ; }
|
Register posttype .
|
48,847
|
public function registerSidebarsCollection ( ) { $ this -> app -> singleton ( 'sidebars.collection' , function ( $ app ) { return new SidebarsCollection ; } ) ; $ this -> app -> alias ( 'sidebars.collection' , SidebarsCollection :: class ) ; }
|
Registers collection of sidebars .
|
48,848
|
public function registerSidebarFactory ( ) { $ this -> app -> singleton ( 'sidebar.factory' , function ( $ app ) { return new SidebarFactory ( $ app [ 'sidebars.collection' ] , $ app ) ; } ) ; $ this -> app -> alias ( 'sidebar.factory' , SidebarFactory :: class ) ; }
|
Registers sidebars factory .
|
48,849
|
public function boot ( ) { $ this -> loadViewsFrom ( ASSELY_FRAMEWORK_DIR . 'resources/views' , 'Assely' ) ; $ this -> registerGlobalWP ( ) ; $ this -> registerGlobalWPQuery ( ) ; $ this -> registerAssets ( ) ; $ this -> registerJSVariables ( ) ; }
|
Bootstrap framework services .
|
48,850
|
private function registerConfigs ( ) { $ this -> app -> singleton ( 'config.framework' , function ( ) { return new FrameworkConfig ( $ this -> getConfigs ( ) ) ; } ) ; $ this -> app -> alias ( 'config.framework' , FrameworkConfig :: class ) ; }
|
Register framework configs .
|
48,851
|
public function getConfigs ( ) { $ configs = [ ] ; foreach ( $ this -> getConfigFiles ( ) as $ file ) { $ name = basename ( $ file -> getFilename ( ) , '.php' ) ; $ values = require $ file -> getRealPath ( ) ; $ configs [ $ name ] = $ values ; } return $ configs ; }
|
Get configs values from files .
|
48,852
|
public function registerGlobalWP ( ) { $ this -> app -> singleton ( 'wp' , function ( ) { global $ wp ; return $ wp ; } ) ; $ this -> app -> alias ( 'wp' , WP :: class ) ; }
|
Register global WP object .
|
48,853
|
public function registerGlobalWPQuery ( ) { $ this -> app -> singleton ( 'wpquery' , function ( ) { global $ wp_query ; return $ wp_query ; } ) ; $ this -> app -> alias ( 'wpquery' , WP_Query :: class ) ; }
|
Register global WP_Query object .
|
48,854
|
private function registerAssets ( ) { $ this -> app [ 'asset.factory' ] -> add ( 'assely-styles' , [ 'path' => ASSELY_FRAMEWORK_URI . 'public/css/assely.css' , ] ) -> area ( 'admin' ) ; $ this -> app [ 'asset.factory' ] -> add ( 'parsleyjs' , [ 'path' => ASSELY_FRAMEWORK_URI . 'public/js/vendors/parsley.js' , 'placement' => 'head' , ] ) -> area ( 'admin' ) ; $ this -> app [ 'asset.factory' ] -> add ( 'vue' , [ 'path' => ASSELY_FRAMEWORK_URI . 'public/js/vendors/vue.js' , 'placement' => 'head' , ] ) -> area ( 'admin' ) ; $ this -> app [ 'asset.factory' ] -> add ( 'assely-components' , [ 'path' => ASSELY_FRAMEWORK_URI . 'public/js/assely-components.js' , 'placement' => 'head' , 'dependences' => [ 'jquery' , 'underscore' , 'vue' , 'parsleyjs' ] , ] ) -> localize ( 'Assely' , [ $ this , 'localizationData' ] ) -> area ( 'admin' ) ; }
|
Register framework assets .
|
48,855
|
public function registerJSVariables ( ) { $ object = json_encode ( $ this -> localizationData ( ) ) ; $ this -> app [ 'hook.factory' ] -> action ( 'wp_head' , function ( ) use ( $ object ) { echo "<script>var Assely = {$object};</script>" ; } ) -> dispatch ( ) ; }
|
Prints Assely javascript global variable .
|
48,856
|
public function dispatch ( UserModel $ user , UserFactory $ factory , HookFactory $ hook ) { $ this -> user = $ user ; $ this -> factory = $ factory ; $ this -> hook = $ hook ; }
|
Construct repository .
|
48,857
|
protected function registerColumns ( ) { $ this -> hook -> action ( 'admin_init' , function ( ) { $ this -> singularity -> columns ( $ this -> columns ( ) ) ; } ) -> dispatch ( ) ; }
|
Register columns of the users list .
|
48,858
|
public function put ( $ key , $ value , $ expire = null ) { return call_user_func_array ( "set{$this->getPrefix()}_transient" , [ $ key , $ value , $ expire ? : $ this -> getDefault ( 'expire' ) , ] ) ; }
|
Put data to store .
|
48,859
|
public function boot ( $ sidebar ) { $ this -> sidebar = $ sidebar ; $ this -> hook -> action ( 'widgets_init' , [ $ this -> sidebar , 'register' ] ) -> dispatch ( ) ; }
|
Bootstrap sidebar manager .
|
48,860
|
public function setArguments ( $ arguments ) { $ parameters = array_merge ( $ this -> getDefaults ( ) , $ this -> arguments ) ; $ this -> arguments = array_merge ( $ parameters , $ arguments ) ; return $ this ; }
|
Sets the value of arguments .
|
48,861
|
public function setArgument ( $ argument , $ value ) { Arr :: set ( $ this -> arguments , $ argument , $ value ) ; return $ this ; }
|
Sets the value of argument .
|
48,862
|
public function setDefault ( $ argument , $ value ) { Arr :: set ( $ this -> defaults , $ argument , $ value ) ; return $ this ; }
|
Sets the value of default argument .
|
48,863
|
public function rule ( $ pattern ) { $ rewrite = $ this -> container -> make ( Rewrite :: class ) ; $ rewrite -> setPattern ( $ pattern ) ; return $ this -> hang ( $ rewrite ) ; }
|
Create rewrite rule .
|
48,864
|
public function endpoint ( $ point ) { $ endpoint = $ this -> container -> make ( Endpoint :: class ) ; $ endpoint -> setPoint ( $ point ) -> add ( ) ; return $ this -> hang ( $ endpoint ) ; }
|
Create rewrite endpoint .
|
48,865
|
public function replies ( ) { $ adaptees = $ this -> adaptee -> get_children ( ) ; return $ this -> model -> plugAdapter ( self :: class , $ adaptees ) ; }
|
Get replies comments .
|
48,866
|
public function boot ( Application $ app ) { $ this -> app = $ app ; $ this -> config = $ app -> make ( 'config' ) ; return $ this ; }
|
Bootstrap command instance .
|
48,867
|
protected function choice ( $ title , array $ choices , $ default = false ) { $ this -> line ( 'Available choices:' ) ; return cli \ menu ( $ choices , $ default , $ title ) ; }
|
Ask for choice .
|
48,868
|
protected function table ( array $ headers , array $ data ) { $ dataset = [ ] ; foreach ( array_values ( $ data ) as $ value ) { $ dataset [ ] = array_combine ( $ headers , $ value ) ; } return Utils \ format_items ( 'table' , $ dataset , $ headers ) ; }
|
Render tabular data .
|
48,869
|
public function dispatch ( ) { return $ this -> execute ( $ this -> getActionAlias ( 'dispatch' ) , [ $ this -> getSlug ( ) , $ this -> getCallback ( ) , $ this -> getArgument ( 'piority' ) , $ this -> getArgument ( 'numberOfArguments' ) , ] ) ; }
|
Dispach hook .
|
48,870
|
public function detach ( ) { return $ this -> execute ( $ this -> getActionAlias ( 'detach' ) , [ $ this -> getSlug ( ) , $ this -> getCallback ( ) , $ this -> getArgument ( 'piority' ) , ] ) ; }
|
Remove hook .
|
48,871
|
public function resolve ( $ pattern , array $ conditions = [ ] ) { $ this -> setRegrex ( $ pattern ) -> extractParameters ( $ conditions ) -> replaceMocksWithConditions ( ) -> generateGuid ( ) ; return $ this ; }
|
Resolves rule pattern regrex and parameters .
|
48,872
|
public function extractParameters ( array $ conditions ) { preg_match_all ( '/{(\w+)}/' , $ this -> regrex , $ matches , PREG_PATTERN_ORDER ) ; array_map ( function ( $ parameter ) use ( $ conditions ) { if ( isset ( $ conditions [ $ parameter ] ) ) { return $ this -> parameters [ $ parameter ] = $ conditions [ $ parameter ] ; } return $ this -> parameters [ $ parameter ] = self :: DEFAULT_REGREX ; } , $ matches [ 1 ] ) ; return $ this ; }
|
Extracts parameters from rule pattern and conditions .
|
48,873
|
public function replaceMocksWithConditions ( ) { foreach ( $ this -> parameters as $ parameter => $ condition ) { $ this -> regrex = preg_replace ( "/{{$parameter}}/" , $ condition , $ this -> regrex ) ; } return $ this ; }
|
Replaces mocked pararameters with conditions in regrex string .
|
48,874
|
public function generateGuid ( ) { $ index = 1 ; foreach ( $ this -> parameters as $ parameter => $ condition ) { $ separator = ( $ index > 1 ) ? '&' : '?' ; $ this -> guid .= "{$separator}{$parameter}=\$matches[{$index}]" ; $ index ++ ; } return $ this ; }
|
Generates guid URI path .
|
48,875
|
protected function make ( $ slug , $ arguments = [ ] ) { $ menu = $ this -> container -> make ( Menu :: class ) ; $ model = $ this -> container -> make ( MenuModel :: class ) ; $ menu -> setModel ( $ model -> make ( $ slug , $ arguments ) ) ; return $ this -> hang ( $ menu ) ; }
|
Make and hang menu .
|
48,876
|
public function boot ( ) { $ this -> setSingular ( $ this -> getArgument ( 'title' ) ) ; $ this -> setPlural ( $ this -> getArgument ( 'title' ) ) ; $ this -> manager -> boot ( $ this ) ; }
|
Bootstrap sidebar .
|
48,877
|
public function register ( ) { $ parameters = [ 'name' => $ this -> getSingular ( ) , 'id' => $ this -> getSlug ( ) , ] ; return register_sidebar ( array_merge ( $ this -> getArguments ( ) , $ parameters ) ) ; }
|
Register widget area .
|
48,878
|
public function registerConfiguredSingularities ( ) { foreach ( $ this -> getAllowedSingularityTypes ( ) as $ type ) { $ this -> resolveSingularities ( $ this -> getSingularityType ( $ type ) , $ type ) ; } }
|
Register configured singularites .
|
48,879
|
public function resolveSingularity ( $ singularity ) { $ class = $ this -> app -> make ( $ singularity ) ; $ this -> app -> instance ( $ singularity , $ class -> make ( $ this -> app ) ) ; }
|
Resolve singularity instance from the class name .
|
48,880
|
public function create ( ModelInterface $ model , array $ belongsTo ) { $ taxonomy = $ this -> container -> make ( TaxonomySingularity :: class ) ; $ taxonomy -> setModel ( $ model ) -> setBelongsTo ( $ belongsTo ) -> boot ( ) ; return $ taxonomy ; }
|
Create taxonomy .
|
48,881
|
public function add ( $ options , $ arguments = true ) { if ( is_array ( $ options ) ) { return $ this -> register ( $ options ) ; } return $ this -> register ( [ $ options => $ arguments ] ) ; }
|
Add support for options .
|
48,882
|
protected function register ( array $ options ) { foreach ( $ options as $ option => $ argument ) { if ( is_bool ( $ argument ) ) { add_theme_support ( $ option ) ; continue ; } add_theme_support ( $ option , $ argument ) ; } }
|
Register support options .
|
48,883
|
protected function make ( $ slug , $ arguments = [ ] ) { $ sidebar = $ this -> container -> make ( Sidebar :: class ) ; $ sidebar -> setSlug ( $ slug ) -> setArguments ( $ arguments ) -> boot ( ) ; return $ this -> hang ( $ sidebar ) ; }
|
Make sidebar .
|
48,884
|
public function reach ( $ name ) { if ( $ this -> collection -> has ( $ name ) ) { return $ this -> collection -> get ( $ name ) ; } }
|
Get item form the collection .
|
48,885
|
public function registerAssetsCollection ( ) { $ this -> app -> singleton ( 'assets.collection' , function ( $ app ) { return new AssetsCollection ; } ) ; $ this -> app -> alias ( 'assets.collection' , AssetsCollection :: class ) ; }
|
Register collection of assets .
|
48,886
|
public function registerAssetFactory ( ) { $ this -> app -> singleton ( 'asset.factory' , function ( $ app ) { return new AssetFactory ( $ app [ 'assets.collection' ] , $ app ) ; } ) ; $ this -> app -> alias ( 'asset.factory' , AssetFactory :: class ) ; }
|
Register factory of assets .
|
48,887
|
public function add ( array $ conditions ) { $ this -> conditions = array_merge ( $ this -> conditions , $ conditions ) ; return $ this -> conditions ; }
|
Add Wordpress condition .
|
48,888
|
public function is ( $ condition , $ arguments = [ ] ) { if ( is_array ( $ arguments ) ) { return call_user_func_array ( $ this -> { $ condition } , $ arguments ) ; } return call_user_func ( $ this -> { $ condition } , $ arguments ) ; }
|
Checks if passed condition is positive .
|
48,889
|
public function listen ( $ slug , $ action , array $ arguments = [ ] ) { $ ajax = $ this -> container -> make ( Ajax :: class ) -> setSlug ( $ slug ) -> setAction ( $ action ) -> setArguments ( $ arguments ) -> dispatch ( ) ; return $ this -> actions -> set ( $ ajax -> getSlug ( ) , $ ajax ) ; }
|
Listen for action .
|
48,890
|
public function getField ( ) { $ singularity = $ this -> profile -> getSingularity ( ) ; if ( isset ( $ singularity ) ) { return $ this -> profile -> getFields ( ) -> find ( $ this -> path ) ; } return $ this -> profile ; }
|
Get profile field .
|
48,891
|
public function posts ( $ posttype = null , $ arguments = [ ] ) { return $ this -> model -> postsWith ( $ this , $ posttype , $ arguments ) ; }
|
Get posts with this term .
|
48,892
|
public function make ( $ name , $ data = [ ] ) { $ view = $ this -> container -> make ( 'view' ) ; echo $ view -> make ( $ name , $ data ) -> render ( ) ; }
|
Make view .
|
48,893
|
public function create ( ModelInterface $ model ) { $ posttype = $ this -> container -> make ( PosttypeSingularity :: class ) ; $ posttype -> setModel ( $ model ) -> boot ( ) ; return $ posttype ; }
|
Create posttype .
|
48,894
|
public function hooks ( ) { $ this -> hook -> action ( 'show_user_profile' , [ $ this -> profile , 'fill' ] ) -> dispatch ( ) ; $ this -> hook -> action ( 'edit_user_profile' , [ $ this -> profile , 'fill' ] ) -> dispatch ( ) ; $ this -> hook -> action ( 'personal_options_update' , [ $ this -> profile , 'save' ] ) -> dispatch ( ) ; $ this -> hook -> action ( 'edit_user_profile_update' , [ $ this -> profile , 'save' ] ) -> dispatch ( ) ; }
|
Register profile hooks .
|
48,895
|
public function dispatch ( ) { $ this -> hook -> action ( 'admin_print_footer_scripts' , [ $ this , 'script' ] ) -> dispatch ( ) ; echo $ this -> view -> make ( 'Assely::Profile/profile' , [ 'title' => $ this -> profile -> getModel ( ) -> getSingular ( ) , 'description' => $ this -> profile -> getModel ( ) -> getArgument ( 'description' ) , 'slug' => $ this -> profile -> getModel ( ) -> getSlug ( ) , 'fingerprint' => $ this -> profile -> getModel ( ) -> getFingerprint ( ) , ] ) ; }
|
Dispach profile to the view .
|
48,896
|
public function add ( $ parameters , $ condition = null ) { if ( is_array ( $ parameters ) ) { foreach ( $ parameters as $ parameter => $ condition ) { $ this -> add ( $ parameter , $ condition ) ; } return ; } return $ this -> register ( $ parameters , $ condition ) ; }
|
Adds rewrite rule tags .
|
48,897
|
public function items ( $ arguments = [ ] ) { return $ this -> plugger -> setModel ( $ this ) -> setAdapter ( Menu :: class ) -> plugIn ( wp_get_nav_menu_items ( $ this -> getNavigation ( ) -> name , $ arguments ) ) -> getConnected ( ) ; }
|
Get menu items .
|
48,898
|
public function getNavigation ( ) { $ locations = get_nav_menu_locations ( ) ; if ( isset ( $ locations [ $ this -> getSlug ( ) ] ) ) { $ location = $ locations [ $ this -> getSlug ( ) ] ; $ navigation = wp_get_nav_menus ( [ 'include' => $ location ] ) ; return reset ( $ navigation ) ; } }
|
Get navigation assigned to the menu .
|
48,899
|
public function registerMenuFactory ( ) { $ this -> app -> singleton ( 'menu.factory' , function ( $ app ) { return new MenuFactory ( $ app [ 'menus.collection' ] , $ app ) ; } ) ; $ this -> app -> alias ( 'menu.factory' , MenuFactory :: class ) ; }
|
Register factory of menus .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.