idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
12,600
public function render ( $ view , $ params = array ( ) , $ context = null ) { if ( $ context === null ) { $ context = $ this -> context ; } return parent :: render ( $ view , $ params , $ context ) ; }
This View class overrides render and findViewFile to use the theme view files
12,601
public function tax ( ) { $ tax = get_query_var ( 'taxonomy' ) ; $ term = get_term_by ( 'slug' , get_query_var ( 'term' ) , $ tax ) ; if ( is_taxonomy_hierarchical ( $ tax ) && $ term -> parent != 0 ) { $ ancestors = array_reverse ( get_ancestors ( $ term -> term_id , $ tax ) ) ; foreach ( $ ancestors as $ ancestor_id ...
Add Tax Crumb
12,602
public function attachment ( ) { if ( $ this -> _post -> post_parent ) { if ( $ parent_post = get_post ( $ this -> _post -> post_parent ) ) { $ this -> addHierarchyOfSingularCrumbs ( $ parent_post ) ; $ this -> addCrumb ( get_the_title ( $ parent_post ) , get_permalink ( $ parent_post ) ) ; } } $ this -> addCrumb ( $ t...
Add Attachment Crumbs
12,603
public function singular ( ) { if ( is_front_page ( ) ) { return ; } $ this -> addHierarchyOfSingularCrumbs ( $ this -> _post ) ; $ this -> addCrumb ( get_the_title ( $ this -> _post ) , get_permalink ( $ this -> _post ) ) ; }
Add Singular Crumbs
12,604
public function category ( ) { global $ cat ; $ category = get_category ( $ cat ) ; if ( $ category -> parent != 0 ) { $ ancestors = array_reverse ( get_ancestors ( $ category -> term_id , 'category' ) ) ; foreach ( $ ancestors as $ ancestor_id ) { $ ancestor = get_category ( $ ancestor_id ) ; $ this -> addCrumb ( $ an...
Add Category Crumb
12,605
public function tag ( ) { global $ tag_id ; $ tag = get_tag ( $ tag_id ) ; $ this -> addCrumb ( $ this -> label ( 'tag' , $ tag -> name ) , get_tag_link ( $ tag_id ) ) ; }
Add Tag Crumb
12,606
public function author ( ) { $ author = get_query_var ( 'author' ) ; $ author_name = get_the_author_meta ( 'display_name' , $ author ) ; $ this -> addCrumb ( $ this -> label ( $ author_name ) , get_author_posts_url ( $ author ) ) ; }
Add Author Crumb
12,607
public function day ( ) { if ( $ m = get_query_var ( 'm' ) ) { $ year = substr ( $ m , 0 , 4 ) ; $ month = substr ( $ m , 4 , 2 ) ; $ day = substr ( $ m , 6 , 2 ) ; } else { $ year = get_query_var ( 'year' ) ; $ month = get_query_var ( 'monthnum' ) ; $ day = get_query_var ( 'day' ) ; } $ month_title = $ this -> getMont...
Add Day Crumb
12,608
public function month ( ) { if ( $ m = get_query_var ( 'm' ) ) { $ year = substr ( $ m , 0 , 4 ) ; $ month = substr ( $ m , 4 , 2 ) ; } else { $ year = get_query_var ( 'year' ) ; $ month = get_query_var ( 'monthnum' ) ; } $ month_title = $ this -> getMonthTitle ( $ month ) ; $ this -> addCrumb ( $ this -> label ( 'year...
Add Month Crumb
12,609
public function year ( ) { if ( $ m = get_query_var ( 'm' ) ) { $ year = substr ( $ m , 0 , 4 ) ; } else { $ year = get_query_var ( 'year' ) ; } $ this -> addCrumb ( $ this -> label ( 'year' , $ year ) , get_year_link ( $ year ) ) ; }
ADd Year Crumb
12,610
public function postTypeArchive ( ) { $ post_type = get_post_type_object ( get_query_var ( 'post_type' ) ) ; $ this -> addCrumb ( $ this -> label ( 'post_type' , $ post_type -> label ) , get_post_type_archive_link ( $ post_type -> name ) ) ; }
Add Post Type Archive Crumb
12,611
private function addHierarchyOfSingularCrumbs ( $ post ) { $ post_type = get_post_type_object ( $ post -> post_type ) ; if ( $ post_type && $ post_type -> has_archive ) { $ this -> addCrumb ( $ this -> label ( 'post_type' , $ post_type -> label ) , get_post_type_archive_link ( $ post_type -> name ) ) ; } if ( is_post_t...
Add Singular Hierarchy Crumbs
12,612
public static function create ( string $ path , string $ type ) : int { try { switch ( $ type ) { case "directory" : if ( ! is_dir ( $ path ) ) { mkdir ( $ path ) ; } break ; case "file" : if ( ! is_file ( $ path ) ) { touch ( $ path ) ; } break ; } } catch ( \ Exception $ exception ) { throw new \ Exception ( "Server ...
Create an element on the server
12,613
public static function move ( string $ path , string $ to , bool $ symlink = false ) : int { try { if ( $ symlink != false ) { symlink ( $ path , $ to ) ; } else { rename ( $ path , $ to ) ; } } catch ( \ Exception $ exception ) { throw new \ Exception ( "Server Error : Cannot move $path to $to => " . $ exception ) ; }...
Move an element on the server
12,614
public static function copy ( string $ path , string $ to , string $ type , bool $ symlink = false ) : int { try { if ( $ symlink != false ) { @ symlink ( $ path , $ to ) ; } elseif ( $ symlink == false && $ type == "directory" ) { self :: recursiveCopy ( $ path , $ to ) ; } elseif ( $ symlink == false && $ type == "fi...
Copy an element on the server
12,615
public static function delete ( string $ path , string $ type ) : int { try { switch ( $ type ) { case "directory" : if ( is_link ( $ path ) ) { unlink ( $ path ) ; } elseif ( is_dir ( $ path ) ) { try { self :: recursiveRmdir ( $ path ) ; } catch ( \ Exception $ e ) { throw new \ Exception ( "Server Manager delete err...
Delete an element on the server
12,616
private function export ( SessionInterface $ session , $ path , $ stream ) { $ session -> exportSystemView ( $ path , $ stream , true , false ) ; }
Exports workspace .
12,617
private function import ( SessionInterface $ session , $ path , $ fileName ) { if ( $ session -> nodeExists ( $ path ) ) { $ session -> getNode ( $ path ) -> remove ( ) ; $ session -> save ( ) ; } $ session -> importXML ( PathHelper :: getParentPath ( $ path ) , $ fileName , ImportUUIDBehaviorInterface :: IMPORT_UUID_C...
Imports workspace .
12,618
private function getSession ( $ parameter ) { $ factory = new RepositoryFactoryJackrabbit ( ) ; $ repository = $ factory -> getRepository ( array ( 'jackalope.jackrabbit_uri' => $ parameter [ 'jackrabbit_uri' ] ) ) ; $ credentials = new SimpleCredentials ( $ parameter [ 'user' ] , $ parameter [ 'password' ] ) ; return ...
Creates session .
12,619
private function deleteCompiled ( string $ env , string $ isdefault = null ) { Output :: displayAsSuccess ( "Hey, I delete compiled from $env environment " , "none" ) ; $ this -> callDelCreaServer ( $ env ) ; if ( in_array ( "--noexit" , $ this -> options [ "options" ] ) ) { Output :: displayAsEndSuccess ( "Compiled de...
Delete a Compiled from a specific environment
12,620
private function deleteAllCompiled ( ) { $ env = array ( "dev" , "prod" ) ; Output :: displayAsSuccess ( "Hey, I delete compiled for all environment" , "none" ) ; for ( $ i = 0 ; $ i < count ( $ env ) ; $ i ++ ) { $ this -> callDelCreaServer ( $ env [ $ i ] ) ; } if ( in_array ( "--noexit" , $ this -> options [ "option...
Delete a compiled for all environment
12,621
public function resolvePath ( string $ source , string $ target ) : string { $ sourceDirs = $ this -> toDirectoryFragments ( \ dirname ( $ source ) ) ; $ targetFileName = \ basename ( $ target ) ; if ( "/" === \ substr ( $ target , 0 , 1 ) ) { return $ target ; } if ( "./" === \ substr ( $ target , 0 , 2 ) ) { $ target...
Resolves an absolute path with a relative one
12,622
private function buildFilePath ( array $ directories , string $ fileName ) : string { $ dir = ! empty ( $ directories ) ? "/" . implode ( "/" , $ directories ) : "" ; $ file = "" !== $ fileName ? "/{$fileName}" : "" ; return $ dir . $ file ; }
Builds a file path from the directory segments with the file name
12,623
public function send ( AbstractMetric $ metric ) { $ data = $ this -> getData ( $ metric ) ; $ tags = array_merge ( $ data , $ metric -> getTags ( ) ) ; $ this -> logger -> log ( $ this -> level , $ this -> getMessage ( $ data ) , $ tags ) ; }
Logs the metric
12,624
protected function fillEncodingsOnce ( ) { if ( $ this -> filled ) { return ; } foreach ( $ this -> loadEncodings ( ) as $ encoding ) { $ encoding = strtoupper ( $ encoding ) ; $ this -> encodings [ ] = $ encoding ; $ this -> encodingLookup [ $ encoding ] = true ; } $ this -> filled = true ; }
Fill the encodings for faster lookups .
12,625
public static function chmodPath ( $ path , $ dirMode = null , $ fileMode = null , $ recursive = true ) { $ result = false ; $ path = realpath ( $ path ) ; if ( empty ( $ path ) ) { return false ; } $ dirMode = $ dirMode ? : self :: getDefaultDirMode ( ) ; $ fileMode = $ fileMode ? : self :: getDefaultFileMode ( ) ; $ ...
Change permissions on path
12,626
protected static function chmodPathSingle ( $ path , $ dirMode , $ fileMode ) { $ result = false ; $ dirMode = self :: valueToOct ( $ dirMode ) ; $ fileMode = self :: valueToOct ( $ fileMode ) ; $ result = is_dir ( $ path ) ? chmod ( $ path , $ dirMode ) : chmod ( $ path , $ fileMode ) ; return $ result ; }
Change permissions on a single file path
12,627
protected static function chmodPathRecursive ( $ path , $ dirMode , $ fileMode ) { $ result = false ; $ dirMode = self :: valueToOct ( $ dirMode ) ; $ fileMode = self :: valueToOct ( $ fileMode ) ; $ finder = new Finder ( ) ; foreach ( $ finder -> directories ( ) -> in ( $ path ) as $ item ) { $ result = chmod ( $ item...
Change permissions recursively
12,628
public static function chownPath ( $ path , $ user = null , $ recursive = true ) { $ path = realpath ( $ path ) ; if ( empty ( $ path ) ) { return false ; } if ( empty ( $ user ) ) { $ user = self :: getDefaultUser ( ) ; } self :: chown ( $ path , $ user , $ recursive ) ; return true ; }
Change user ownership on path
12,629
public static function chgrpPath ( $ path , $ group = null , $ recursive = true ) { $ path = realpath ( $ path ) ; if ( empty ( $ path ) ) { return false ; } if ( empty ( $ group ) ) { $ group = self :: getDefaultGroup ( ) ; } self :: chgrp ( $ path , $ group , $ recursive ) ; return true ; }
Change group ownership on path
12,630
public static function downloadFile ( $ src , $ dst ) { $ result = false ; $ fileHandler = @ fopen ( $ dst , 'w' ) ; if ( ! is_resource ( $ fileHandler ) ) { return $ result ; } $ curl = curl_init ( ) ; curl_setopt ( $ curl , CURLOPT_URL , $ src ) ; curl_setopt ( $ curl , CURLOPT_FILE , $ fileHandler ) ; curl_setopt ( ...
Download remote file using CURL
12,631
public static function isFileReadable ( $ file ) { $ result = false ; if ( ! file_exists ( $ file ) ) { return $ result ; } if ( ! is_file ( $ file ) ) { return $ result ; } if ( ! is_readable ( $ file ) ) { return $ result ; } $ result = true ; return $ result ; }
Check if the file is missing or is not readable
12,632
protected static function valueToOct ( $ value ) { $ result = $ value ; if ( is_string ( $ value ) && ( strpos ( $ value , '0' ) === 0 ) ) { $ value = intval ( $ value , 8 ) ; } if ( decoct ( octdec ( $ value ) ) <> $ value ) { $ result = base_convert ( ( string ) $ value , 10 , 8 ) ; } return $ value ; }
Convert a given value to octal
12,633
public function themeEditor ( ) { $ this -> setTitleThemeEditor ( ) ; $ this -> setBreadcrumbThemeEditor ( ) ; $ this -> setData ( 'themes' , $ this -> module -> getByType ( 'theme' ) ) ; $ this -> outputThemeEditor ( ) ; }
Route callback to display the select theme page
12,634
protected function setBreadcrumbThemeEditor ( ) { $ breadcrumbs = array ( ) ; $ breadcrumbs [ ] = array ( 'url' => $ this -> url ( 'admin' ) , 'text' => $ this -> text ( 'Dashboard' ) ) ; $ breadcrumbs [ ] = array ( 'url' => $ this -> url ( 'admin/module/list' ) , 'text' => $ this -> text ( 'Modules' ) ) ; $ this -> se...
Set breadcrumbs on the select theme page
12,635
public function listEditor ( $ module_id ) { $ this -> setModuleEditor ( $ module_id ) ; $ this -> setTitleListEditor ( ) ; $ this -> setBreadcrumbListEditor ( ) ; $ this -> setData ( 'module' , $ this -> data_module ) ; $ this -> setData ( 'files' , $ this -> getFilesEditor ( ) ) ; $ this -> outputListEditor ( ) ; }
Route callback Displays the module file overview page
12,636
protected function getFilesEditor ( ) { $ data = $ this -> editor -> getList ( $ this -> data_module ) ; return $ this -> prepareFilesEditor ( $ data ) ; }
Returns an array of files to edit
12,637
protected function prepareFilesEditor ( array $ data ) { $ prepared = array ( ) ; foreach ( $ data as $ folder => $ files ) { foreach ( $ files as $ file ) { $ path = trim ( str_replace ( $ this -> data_module [ 'directory' ] , '' , $ file ) , '/' ) ; $ depth = substr_count ( str_replace ( '\\' , '/' , $ path ) , '/' )...
Prepares an array of files to be edited
12,638
protected function setBreadcrumbListEditor ( ) { $ breadcrumbs = array ( ) ; $ breadcrumbs [ ] = array ( 'url' => $ this -> url ( 'admin' ) , 'text' => $ this -> text ( 'Dashboard' ) ) ; $ breadcrumbs [ ] = array ( 'url' => $ this -> url ( 'admin/module/list' ) , 'text' => $ this -> text ( 'Modules' ) ) ; $ this -> set...
Sets breadcrumbs on theme files overview page
12,639
public function editEditor ( $ module_id , $ file_id ) { $ this -> setModuleEditor ( $ module_id ) ; $ this -> setFilePathEditor ( $ file_id ) ; $ this -> setTitleEditEditor ( ) ; $ this -> setBreadcrumbEditEditor ( ) ; $ this -> setMessageEditEditor ( ) ; $ this -> setData ( 'module' , $ this -> data_module ) ; $ this...
Route callback Displays the file edit page
12,640
protected function setMessageEditEditor ( ) { if ( $ this -> current_theme [ 'id' ] == $ this -> data_module [ 'id' ] ) { $ message = $ this -> text ( 'You cannot edit the current theme' ) ; $ this -> setMessage ( $ message , 'warning' ) ; } else if ( $ this -> canSaveEditor ( ) && $ this -> data_extension === 'php' ) ...
Sets messages on the file edit page
12,641
protected function validateEditor ( ) { $ this -> setSubmitted ( 'editor' , null , false ) ; $ this -> setSubmitted ( 'user_id' , $ this -> uid ) ; $ this -> setSubmitted ( 'path' , $ this -> data_file ) ; $ this -> setSubmitted ( 'module' , $ this -> data_module ) ; $ this -> validateSyntaxEditor ( ) ; return ! $ this...
Validates a submitted data when editing a theme file
12,642
protected function validateSyntaxEditor ( ) { $ code = $ this -> getSubmitted ( 'content' ) ; if ( empty ( $ code ) || $ this -> data_extension !== 'php' ) { return null ; } $ result = $ this -> editor -> validatePhpCode ( $ code ) ; if ( ! isset ( $ result ) || $ result === true ) { return null ; } $ error = empty ( $...
Validate syntax of a submitted file
12,643
protected function saveEditor ( ) { $ this -> controlAccessSaveEditor ( ) ; $ submitted = $ this -> getSubmitted ( ) ; $ result = $ this -> editor -> save ( $ submitted ) ; if ( $ result === true ) { $ message = $ this -> text ( 'File has been saved' ) ; $ this -> redirect ( "admin/tool/editor/{$submitted['module']['id...
Writes a submitted content to a theme file
12,644
protected function setTitleEditEditor ( ) { $ vars = array ( '%name' => str_replace ( '\\' , '/' , gplcart_path_relative ( $ this -> data_file ) ) ) ; $ this -> setTitle ( $ this -> text ( 'Edit %name' , $ vars ) ) ; }
Sets titles on the file edit page
12,645
protected function setBreadcrumbEditEditor ( ) { $ breadcrumbs = array ( ) ; $ breadcrumbs [ ] = array ( 'url' => $ this -> url ( 'admin' ) , 'text' => $ this -> text ( 'Dashboard' ) ) ; $ breadcrumbs [ ] = array ( 'url' => $ this -> url ( 'admin/module/list' ) , 'text' => $ this -> text ( 'Modules' ) ) ; $ breadcrumbs...
Sets breadcrumbs on the file edit page
12,646
protected function setFilePathEditor ( $ encoded_filename ) { $ filepath = gplcart_string_decode ( $ encoded_filename ) ; $ this -> data_file = "{$this->data_module['directory']}/$filepath" ; if ( ! is_file ( $ this -> data_file ) || ! is_readable ( $ this -> data_file ) ) { $ this -> outputHttpStatus ( 404 ) ; } $ thi...
Returns a path to the file to be edited
12,647
public function addSnippets ( array $ snippets = null ) { $ this -> add ( new DefaultSnippets ( ) ) ; if ( ! is_null ( $ snippets ) ) { foreach ( $ snippets as $ snippet => $ definition ) { if ( $ definition instanceof Snippets ) { $ this -> add ( $ definition ) ; } else { $ this -> add ( $ snippet , $ definition ) ; }...
Adds snippets so that the SnippetParser has snippets to parse and render .
12,648
public function onStyleLoaderTag ( $ tag , $ handle ) : string { $ tag = ( string ) $ tag ; $ handle = ( string ) $ handle ; if ( ! ( $ style = $ this -> didEnqueueStyle ( $ handle ) ) ) { return $ tag ; } if ( $ style [ 'sri' ] !== '' && ! preg_match ( '/\sintegrity\s*\=/ui' , $ tag ) ) { if ( ( $ sri = $ style [ 'sri...
On style_loader_tag .
12,649
public function onScriptLoaderTag ( $ tag , $ handle ) : string { $ tag = ( string ) $ tag ; $ handle = ( string ) $ handle ; if ( ! ( $ script = $ this -> didEnqueueScript ( $ handle ) ) ) { return $ tag ; } if ( $ script [ 'async' ] && ! preg_match ( '/\s(?:async|defer)[=\s>]/ui' , $ tag ) ) { $ tag = str_replace ( '...
On script_loader_tag .
12,650
public function enqueueChopChopLibs ( array $ deps = [ ] ) : array { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'chop-chop' => [ 'version' => '0.0.8' , 'url' => '//unpkg.com/chop-chop@%1$s' , ] , ] , ] ; return $ this -> enqueueLibs ( __METHOD__ , $ data ) ...
Enqueue Chop - Chop libs .
12,651
public function enqueueRequireJsLibs ( array $ deps = [ ] ) : array { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'requirejs' => [ 'version' => '2.3.2' , 'deps' => $ deps , 'url' => '//cdnjs.cloudflare.com/ajax/libs/require.js/%1$s/require.min.js' , ] , ] , ...
Enqueue Require . js .
12,652
public function enqueueUnicodeGcsLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'unicode-gcs' => [ 'version' => '1.0.3' , 'url' => '//cdn.rawgit.com/websharks/unicode-gcs/%1$s/dist/index.min.js' , ] , ] , ] ; return $ this -> enqueueLibs ( __METHOD__...
Enqueue Unicode Gcs libs .
12,653
public function enqueuePakoLibs ( string $ which = 'base' ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } if ( $ which === 'base' ) { $ data = [ 'scripts' => [ 'pako' => [ 'version' => '1.0.4' , 'url' => '//cdnjs.cloudflare.com/ajax/libs/pako/%1$s/pako.min.js' , ] , ] , ] ; } elseif ...
Enqueue Pako libs .
12,654
public function enqueueFontAwesomeLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'styles' => [ 'font-awesome' => [ 'version' => '4.7.0' , 'url' => '//maxcdn.bootstrapcdn.com/font-awesome/%1$s/css/font-awesome.min.css' , ] , ] , ] ; return $ this -> enqueueLibs ( __...
Enqueue Font Awesome libs .
12,655
public function enqueueDeviconLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'styles' => [ 'devicons' => [ 'version' => '4f6a4b08efdad6bb29f9cc801f5c07e263b39907' , 'url' => '//cdn.rawgit.com/konpa/devicon/%1$s/devicon.min.css' , ] , ] , ] ; return $ this -> enqueu...
Enqueue Devicon libs .
12,656
public function enqueueSharkiconLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'styles' => [ 'sharkicons' => [ 'ver' => $ this -> cv , 'url' => $ this -> c :: appCoreUrl ( '/vendor/websharks/sharkicons/src/long-classes.min.css' ) , ] , ] , ] ; return $ this -> enqu...
Enqueue Sharkicon libs .
12,657
public function enqueueSemanticUiLibs ( string $ which = 'all' ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } if ( $ which === 'all' || $ which === 'styles' ) { $ data [ 'styles' ] = $ this -> enqueueSemanticUiStyles ( ) ; } if ( $ which === 'all' || $ which === 'scripts' ) { $ data...
Enqueue Semantic UI libs .
12,658
public function enqueueSemanticUiScripts ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data [ 'scripts' ] = [ 'semantic-ui' => [ 'ver' => $ this -> cv , 'deps' => [ 'jquery' ] , 'url' => $ this -> c :: appWsCoreUrl ( '/client-s/semantic/dist/semantic.min.js' ) , ] , ] ; return ...
Enqueue Semantic UI scripts .
12,659
public function enqueueBehaveLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'behave' => [ 'version' => '0.1' , 'url' => '//cdn.jsdelivr.net/behave.js/%1$s/behave.js' , ] , ] , ] ; return $ this -> enqueueLibs ( __METHOD__ , $ data ) ; }
Enqueue Behave libs .
12,660
public function enqueueAceLibs ( string $ mode , string $ theme ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ version = '170626' ; $ base_url = 'https://cdn.rawgit.com/websharks/ace-builds/%1$s/src-min-noconflict' ; $ data = [ 'scripts' => [ 'ace' => [ 'version' => $ version , 'u...
Enqueue Ace libs .
12,661
public function enqueueMarkdownItLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'markdown-it' => [ 'version' => '8.2.2' , 'url' => '//cdnjs.cloudflare.com/ajax/libs/markdown-it/%1$s/markdown-it.min.js' , ] , 'markdown-it-attrs' => [ 'version' => '0.8...
Enqueue Markdown - It libs .
12,662
public function enqueueHighlightJsLibs ( $ style = '' , array $ langs = [ 'wp' ] ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } if ( isset ( $ style ) ) { $ style = $ style ? : 'default' ; } else { $ style = '' ; } $ data = [ ] ; if ( $ style ) { $ data [ 'styles' ] = [ 'highlight-j...
Enqueue Highlight . js libs .
12,663
public function highlightJsLangData ( string $ lang ) : array { if ( $ lang === 'wp' ) { return [ 'ver' => $ this -> cv , 'deps' => [ 'highlight-js' ] , 'url' => $ this -> c :: appWsCoreUrl ( '/client-s/js/hljs/langs/wp.min.js' ) , ] ; } return [ 'version' => '9.12.0' , 'deps' => [ 'highlight-js' ] , 'url' => '//cdnjs....
Highlight . js lang data .
12,664
public function enqueueStripeLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'stripe' => [ 'sri' => '' , 'url' => '//checkout.stripe.com/checkout.js' , ] , ] , ] ; return $ this -> enqueueLibs ( __METHOD__ , $ data ) ; }
Enqueue Stripe libs .
12,665
public function enqueueGumroadLibs ( string $ which = 'all' ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } if ( $ which === 'all' || $ which === 'overlay' ) { $ data = $ this -> enqueueGumroadOverlayLibs ( ) ; } if ( $ which === 'all' || $ which === 'embed' ) { $ data = array_merge_...
Enqueue Gumroad libs .
12,666
public function enqueueGumroadOverlayLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'gumroad-overlay' => [ 'sri' => '' , 'url' => '//gumroad.com/js/gumroad-overlay.js' , ] , ] , ] ; return $ this -> enqueueLibs ( __METHOD__ , $ data ) ; }
Enqueue Gumroad overlay libs .
12,667
public function enqueueGumroadEmbedLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'gumroad-embed' => [ 'sri' => '' , 'url' => '//gumroad.com/js/gumroad-embed.js' , ] , ] , ] ; return $ this -> enqueueLibs ( __METHOD__ , $ data ) ; }
Enqueue Gumroad embed libs .
12,668
public function enqueueRecaptchaLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'recaptcha' => [ 'async' => true , 'sri' => '' , 'url' => '//www.google.com/recaptcha/api.js' , ] , ] , ] ; return $ this -> enqueueLibs ( __METHOD__ , $ data ) ; }
Enqueue reCAPTCHA libs .
12,669
public function enqueueJsCookieLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'js-cookie' => [ 'version' => '2.1.4' , 'url' => 'https://cdnjs.cloudflare.com/ajax/libs/js-cookie/%1$s/js.cookie.min.js' , ] , ] , ] ; return $ this -> enqueueLibs ( __MET...
Enqueue JS Cookie libs .
12,670
public function enqueueMomentLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'moment' => [ 'version' => '2.17.1' , 'url' => '//cdnjs.cloudflare.com/ajax/libs/moment.js/%1$s/moment.min.js' , 'localize' => [ 'key' => 'rgvfbtgzxqrdbpcdjvzpcrfrsbtgpdvpMom...
Enqueue Moment libs .
12,671
public function enqueueNoUiSliderLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'styles' => [ 'no-ui-slider' => [ 'version' => '9.2.0' , 'url' => '//cdnjs.cloudflare.com/ajax/libs/noUiSlider/%1$s/nouislider.min.css' , ] , ] , 'scripts' => [ 'no-ui-wnumb' => [ 'vers...
Enqueue No UI Slider libs .
12,672
public function enqueueJQueryAddressLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'jquery-address' => [ 'version' => '1.6' , 'deps' => [ 'jquery' ] , 'url' => 'https://cdnjs.cloudflare.com/ajax/libs/jquery.address/%1$s/jquery.address.min.js' , ] , ]...
Enqueue jQuery Address libs .
12,673
public function enqueueJQueryAnimateCssLibs ( bool $ with_styles = false ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'scripts' => [ 'jquery-animate-css' => [ 'version' => '1.2.1' , 'deps' => [ 'jquery' ] , 'url' => '//cdnjs.cloudflare.com/ajax/libs/animateCSS/%1$s/jque...
Enqueue jQuery animate . css libs .
12,674
public function enqueueJQueryChosenLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ data = [ 'styles' => [ 'jquery-chosen' => [ 'version' => '1.6.2' , 'url' => '//cdnjs.cloudflare.com/ajax/libs/chosen/%1$s/chosen.min.css' , ] , ] , 'scripts' => [ 'jquery-chosen' => [ 'version...
Enqueue jQuery Chosen libs .
12,675
public function enqueueMenuPageLibs ( ) { if ( ( $ data = $ this -> didEnqueueLibs ( __METHOD__ ) ) ) { return $ data ; } $ this -> enqueueSharkiconLibs ( ) ; $ data = [ 'styles' => [ $ this -> App :: CORE_CONTAINER_SLUG . '-menu-page' => [ 'ver' => $ this -> cv , 'deps' => [ 'sharkicons' , 'wp-color-picker' ] , 'url' ...
Enqueue menu - page libs .
12,676
protected function log ( $ message ) { if ( method_exists ( $ this -> io , 'writeError' ) ) { $ this -> io -> writeError ( $ message ) ; } else { $ this -> io -> write ( $ message ) ; } }
Write a message .
12,677
protected function filter ( $ rows , $ condition ) { $ result = [ ] ; foreach ( ( array ) $ rows as $ row ) { $ actual = isset ( $ row [ $ condition [ 'field' ] ] ) ? $ row [ $ condition [ 'field' ] ] : null ; switch ( $ condition [ 'op' ] ) { case Operator :: EQUAL : if ( $ actual == $ condition [ 'value' ] ) { $ resu...
Apply a condition to a record set
12,678
private function applyConditions ( $ matches ) { foreach ( $ this -> conditions as $ condition ) { $ matches = $ this -> filter ( $ matches , $ condition ) ; } return $ matches ; }
Apply the conditions
12,679
private function applyOrdering ( $ matches ) { foreach ( $ this -> ordering as $ ordering ) { usort ( $ matches , function ( $ aRow , $ bRow ) use ( $ ordering ) { $ a = $ aRow [ $ ordering [ 'column' ] ] ; $ b = $ bRow [ $ ordering [ 'column' ] ] ; return $ ordering [ 'direction' ] * ( $ a == $ b ? 0 : ( $ a < $ b ? -...
Apply the ordering
12,680
private function applyColumns ( $ matches ) { if ( empty ( $ matches ) || empty ( $ this -> columns ) || in_array ( '*' , $ this -> columns ) ) { return $ matches ; } $ availableColumns = array_keys ( reset ( $ matches ) ) ; $ requestedColumns = $ this -> columns ; if ( count ( $ this -> columns ) == 1 && $ this -> col...
Apply the columns
12,681
protected function obtainCtrlRouterLinkTasks ( ) : array { return [ 'searchRoute' => \ BFW \ RunTasks :: generateStepItem ( $ this -> ctrlRouterInfos ) , 'checkRouteFound' => \ BFW \ RunTasks :: generateStepItem ( null , function ( ) { if ( $ this -> ctrlRouterInfos -> isFound === false ) { http_response_code ( 404 ) ;...
List all tasks runned by ctrlRouterLink
12,682
protected function addRequiredIfNotNull ( XType $ type , & $ rule ) { if ( isset ( $ type -> not_null ) && $ type -> not_null ) { $ rule [ ] = $ this -> callExtension ( 'not_null' , [ true ] ) ; } }
Add the required rule .
12,683
protected function addGroupName ( XType $ type , & $ rule ) { $ groupName = $ this -> groupName ( $ type ) ; if ( isset ( $ this -> typeToRule [ $ groupName ] ) ) { $ rule [ ] = $ this -> typeToRule [ $ groupName ] ; } }
Add the group name to the rule
12,684
protected function addConstraints ( XType $ type , & $ rule ) { foreach ( $ type -> constraints as $ name => $ parameters ) { if ( $ name == 'not_null' ) { continue ; } if ( isset ( $ this -> constraintToRule [ $ name ] ) ) { $ constraintName = $ this -> constraintToRule [ $ name ] ; $ rule [ ] = $ constraintName . ':'...
Add the constraints as rules
12,685
protected function maxDepthFromRelations ( array $ relations ) { if ( ! $ relations ) { return 1 ; } $ max = 1 ; foreach ( $ relations as $ path ) { $ max = max ( $ max , count ( explode ( '.' , $ path ) ) ) ; } return ( int ) $ max + 1 ; }
Calculate the max depth from the passed relations
12,686
protected function addMissingParentRelations ( array $ relations ) { $ filled = $ relations ; foreach ( $ relations as $ relation ) { $ segments = explode ( '.' , $ relation ) ; $ path = [ ] ; foreach ( $ segments as $ segment ) { $ path [ ] = $ segment ; $ pathString = implode ( '.' , $ path ) ; if ( ! in_array ( $ pa...
If you pass a relation filter of only address . country . territory this method adds the not passed address and address . country relations .
12,687
public function encode ( array $ args ) { if ( ! $ args ) { return $ args ; } $ serializable = [ ] ; foreach ( $ args as $ arg ) { $ serializable [ ] = $ this -> serialize ( $ arg ) ; } return $ serializable ; }
Encode the arguments in a way the can be stored via json_encode or serialize .
12,688
public function decode ( array $ args ) { $ decoded = [ ] ; foreach ( $ args as $ arg ) { if ( ! is_string ( $ arg ) ) { $ decoded [ ] = $ arg ; continue ; } $ decoded [ ] = $ this -> deserialize ( $ arg ) ; } return $ decoded ; }
Decode the values of the passed array
12,689
public function setBody ( $ body ) { if ( is_string ( $ body ) ) { return $ this -> setStringBody ( $ body ) ; } if ( ! is_resource ( $ body ) ) { throw new InvalidArgumentException ( 'Body must be a stream !' ) ; } if ( ! stream_is_local ( $ body ) ) { throw new InvalidArgumentException ( 'Body must be a local stream ...
Set body with stream acceptance
12,690
public function updateTranslation ( $ locale , array $ values ) { foreach ( $ values as $ attribute => $ value ) { $ this -> setTranslation ( $ locale , $ attribute , $ value ) ; } $ this -> save ( ) ; }
Save multiple attributes at once
12,691
public function saveTranslation ( $ locale , $ attribute , $ value ) { $ this -> setTranslation ( $ locale , $ attribute , $ value ) ; $ this -> save ( ) ; }
Save a single attribute
12,692
private function fetchLocales ( $ available = true ) { $ available_locales = $ this -> getAvailableLocales ( ) ; $ current_locales = $ this -> translations ( ) -> lists ( 'locale' ) -> toArray ( ) ; return array_filter ( $ available_locales , function ( $ v ) use ( $ current_locales , $ available ) { return $ available...
Get all locales associated with this entity
12,693
public static function copy ( $ stream , $ close = true ) { $ cloned = fopen ( 'php://temp' , 'w+b' ) ; $ pos = ftell ( $ stream ) ; static :: tryRewind ( $ stream ) ; stream_copy_to_stream ( $ stream , $ cloned ) ; if ( $ close ) { fclose ( $ stream ) ; } else { static :: trySeek ( $ stream , $ pos ) ; } fseek ( $ clo...
Copies a stream .
12,694
public static function trySeek ( $ stream , $ offset , $ whence = SEEK_SET ) { $ offset = ( int ) $ offset ; if ( $ whence === SEEK_SET && ftell ( $ stream ) === $ offset ) { return true ; } return static :: isSeekable ( $ stream ) && fseek ( $ stream , $ offset , $ whence ) === 0 ; }
Tries to seek a stream .
12,695
private function generateLeftMenu ( ) { $ leftMenu = \ Menu :: getMenu ( 'leftMenu' ) ; $ leftMenu -> link ( 'docs' , function ( Link $ link ) { $ link -> name = 'Documentation' ; $ link -> url = route ( 'larecipe.index' ) ; } ) ; }
Adds items to the menu that appears on the left side of the main menu .
12,696
private function generateRightMenu ( ) { $ rightMenu = \ Menu :: getMenu ( 'rightMenu' ) ; if ( auth ( ) -> guest ( ) ) { $ rightMenu -> link ( 'login' , function ( Link $ link ) { $ link -> name = 'Login' ; $ link -> url = route ( 'auth.login' ) ; } ) ; if ( config ( 'jumpgate.users.settings.allow_registration' ) ) { ...
Adds items to the menu that appears on the right side of the main menu .
12,697
protected function loadHelper ( $ id , $ onlyCheck = false ) { $ namespaces = $ this -> getNamespaces ( ) ; if ( empty ( $ namespaces ) ) { throw new NoNamespaces ( 'Wasn\'t a namespaces registered' ) ; } $ misses = & $ this -> _loadMisses ; set_error_handler ( function ( ) use ( & $ misses ) { ++ $ misses ; } ) ; fore...
Load the service
12,698
public function has ( $ id ) { if ( isset ( $ this -> _helpers [ $ id ] ) ) { return true ; } return $ this -> loadHelper ( $ id , true ) ; }
Has the helper
12,699
public function storage ( $ image , ? string $ alt = null , array $ extra = [ ] ) : ? string { return $ this -> generateImagePayload ( $ image , $ alt , $ extra , true , true ) -> htmlstring ?? null ; }
Get uploaded image from local storage