├── .gitignore ├── README.md ├── mu-plugins ├── cmb2-post-search-field │ ├── .gitignore │ ├── README.md │ └── cmb2_post_search_field.php ├── cmb2 │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── bootstrap.php │ ├── css │ │ ├── cmb2.css │ │ └── cmb2.min.css │ ├── example-functions.php │ ├── images │ │ ├── ico-delete.png │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ └── ui-icons_cd0a0a_256x240.png │ ├── includes │ │ ├── CMB2.php │ │ ├── CMB2_Ajax.php │ │ ├── CMB2_Boxes.php │ │ ├── CMB2_Field.php │ │ ├── CMB2_Options.php │ │ ├── CMB2_Sanitize.php │ │ ├── CMB2_Show_Filters.php │ │ ├── CMB2_Types.php │ │ ├── CMB2_Utils.php │ │ ├── CMB2_hookup.php │ │ └── helper-functions.php │ ├── init.php │ ├── js │ │ ├── cmb2.js │ │ ├── cmb2.min.js │ │ └── jquery-ui-timepicker-addon.min.js │ ├── languages │ │ ├── cmb2-ach.po │ │ ├── cmb2-af.po │ │ ├── cmb2-ar.po │ │ ├── cmb2-az.po │ │ ├── cmb2-be_BY.po │ │ ├── cmb2-bg_BG.po │ │ ├── cmb2-bn_BD.po │ │ ├── cmb2-br.po │ │ ├── cmb2-bs_BA.po │ │ ├── cmb2-ca.po │ │ ├── cmb2-co.po │ │ ├── cmb2-cs_CZ.po │ │ ├── cmb2-cy.po │ │ ├── cmb2-da_DK.po │ │ ├── cmb2-de_AT.po │ │ ├── cmb2-de_DE.po │ │ ├── cmb2-el.po │ │ ├── cmb2-en@pirate.po │ │ ├── cmb2-en_GB.po │ │ ├── cmb2-en_US.mo │ │ ├── cmb2-en_US.po │ │ ├── cmb2-eo.po │ │ ├── cmb2-es_AR.po │ │ ├── cmb2-es_CL.po │ │ ├── cmb2-es_ES.mo │ │ ├── cmb2-es_ES.po │ │ ├── cmb2-es_MX.mo │ │ ├── cmb2-es_MX.po │ │ ├── cmb2-es_PE.po │ │ ├── cmb2-es_VE.po │ │ ├── cmb2-et.po │ │ ├── cmb2-eu.po │ │ ├── cmb2-fa.po │ │ ├── cmb2-fa_IR.po │ │ ├── cmb2-fi.mo │ │ ├── cmb2-fi.po │ │ ├── cmb2-fo.po │ │ ├── cmb2-fr_FR.mo │ │ ├── cmb2-fr_FR.po │ │ ├── cmb2-ga.po │ │ ├── cmb2-gl_ES.po │ │ ├── cmb2-gu_IN.po │ │ ├── cmb2-he_IL.po │ │ ├── cmb2-hi_IN.po │ │ ├── cmb2-hr.po │ │ ├── cmb2-hu_HU.po │ │ ├── cmb2-hy.po │ │ ├── cmb2-id.po │ │ ├── cmb2-id_ID.mo │ │ ├── cmb2-id_ID.po │ │ ├── cmb2-is_IS.po │ │ ├── cmb2-it_IT.po │ │ ├── cmb2-ja.po │ │ ├── cmb2-jv.po │ │ ├── cmb2-ka.po │ │ ├── cmb2-kk.po │ │ ├── cmb2-km.po │ │ ├── cmb2-ko_KR.po │ │ ├── cmb2-ku.po │ │ ├── cmb2-ky.po │ │ ├── cmb2-lt_LT.po │ │ ├── cmb2-lv.po │ │ ├── cmb2-mg.po │ │ ├── cmb2-mk_MK.po │ │ ├── cmb2-mn.po │ │ ├── cmb2-my_MM.po │ │ ├── cmb2-nb_NO.po │ │ ├── cmb2-ne_NP.po │ │ ├── cmb2-nl_NL.po │ │ ├── cmb2-nn_NO.po │ │ ├── cmb2-oc.po │ │ ├── cmb2-pap.po │ │ ├── cmb2-pl_PL.mo │ │ ├── cmb2-pl_PL.po │ │ ├── cmb2-pt_BR.mo │ │ ├── cmb2-pt_BR.po │ │ ├── cmb2-pt_PT.po │ │ ├── cmb2-ro_RO.po │ │ ├── cmb2-ru_RU.mo │ │ ├── cmb2-ru_RU.po │ │ ├── cmb2-sah.po │ │ ├── cmb2-si_LK.po │ │ ├── cmb2-sk_SK.po │ │ ├── cmb2-sl_SI.po │ │ ├── cmb2-sq.po │ │ ├── cmb2-sr_RS.po │ │ ├── cmb2-su.po │ │ ├── cmb2-sv_SE.mo │ │ ├── cmb2-sv_SE.po │ │ ├── cmb2-sw.po │ │ ├── cmb2-ta_LK.po │ │ ├── cmb2-te.po │ │ ├── cmb2-th.po │ │ ├── cmb2-tk_TM.po │ │ ├── cmb2-tr_TR.po │ │ ├── cmb2-ug.po │ │ ├── cmb2-uk.po │ │ ├── cmb2-ur_PK.po │ │ ├── cmb2-uz.po │ │ ├── cmb2-vi.po │ │ ├── cmb2-zh_CN.GB2312.po │ │ ├── cmb2-zh_CN.po │ │ ├── cmb2-zh_HK.po │ │ ├── cmb2-zh_TW.po │ │ ├── cmb2.mo │ │ └── cmb2.pot │ └── readme.txt ├── include-cmb-for-project.php └── include-cmb2-post-search-field.php ├── plugins ├── akismet │ ├── _inc │ │ ├── akismet.css │ │ ├── akismet.js │ │ ├── form.js │ │ └── img │ │ │ └── logo-full-2x.png │ ├── akismet.php │ ├── class.akismet-admin.php │ ├── class.akismet-widget.php │ ├── class.akismet.php │ ├── readme.txt │ ├── views │ │ ├── config.php │ │ ├── get.php │ │ ├── notice.php │ │ ├── start.php │ │ ├── stats.php │ │ └── strict.php │ └── wrapper.php └── books-cpt │ ├── README.md │ ├── books-cpt.php │ ├── cpt.php │ ├── custom-fields.php │ ├── readme.txt │ ├── submission-form-shortcode.php │ ├── taxonomy.php │ └── template-filters.php └── themes ├── twentyfourteen-child-books ├── content-homepage.php ├── footer.php ├── front-page.php ├── functions.php ├── includes │ ├── cmb-fields.php │ ├── custom-cmb-field-types.php │ └── theme-options-cmb.php ├── screenshot.png └── style.css └── twentyfourteen ├── 404.php ├── archive.php ├── author.php ├── category.php ├── comments.php ├── content-aside.php ├── content-audio.php ├── content-featured-post.php ├── content-gallery.php ├── content-image.php ├── content-link.php ├── content-none.php ├── content-page.php ├── content-quote.php ├── content-video.php ├── content.php ├── css ├── editor-style.css └── ie.css ├── featured-content.php ├── footer.php ├── functions.php ├── genericons ├── COPYING.txt ├── Genericons-Regular.otf ├── LICENSE.txt ├── README.txt ├── font │ ├── genericons-regular-webfont.eot │ ├── genericons-regular-webfont.svg │ ├── genericons-regular-webfont.ttf │ └── genericons-regular-webfont.woff └── genericons.css ├── header.php ├── image.php ├── images ├── pattern-dark.svg └── pattern-light.svg ├── inc ├── back-compat.php ├── custom-header.php ├── customizer.php ├── featured-content.php ├── template-tags.php └── widgets.php ├── js ├── customizer.js ├── featured-content-admin.js ├── functions.js ├── html5.js ├── keyboard-image-navigation.js └── slider.js ├── languages └── twentyfourteen.pot ├── page-templates ├── contributors.php └── full-width.php ├── page.php ├── rtl.css ├── screenshot.png ├── search.php ├── sidebar-content.php ├── sidebar-footer.php ├── sidebar.php ├── single.php ├── style.css ├── tag.php └── taxonomy-post_format.php /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### WordPress ### 4 | *.log 5 | .htaccess 6 | sitemap.xml 7 | sitemap.xml.gz 8 | wp-config.php 9 | advanced-cache.php 10 | backup-db/ 11 | backups/ 12 | blogs.dir/ 13 | cache/ 14 | upgrade/ 15 | uploads/ 16 | wp-cache-config.php 17 | *index.php 18 | 19 | 20 | ### OSX ### 21 | .DS_Store 22 | .AppleDouble 23 | .LSOverride 24 | 25 | # Icon must end with two \r 26 | Icon 27 | 28 | 29 | # Thumbnails 30 | ._* 31 | 32 | # Files that might appear in the root of a volume 33 | .DocumentRevisions-V100 34 | .fseventsd 35 | .Spotlight-V100 36 | .TemporaryItems 37 | .Trashes 38 | .VolumeIcon.icns 39 | 40 | # Directories potentially created on remote AFP share 41 | .AppleDB 42 | .AppleDesktop 43 | Network Trash Folder 44 | Temporary Items 45 | .apdisk 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CMB2 WPSessions Demo 2 | ==== 3 | 4 | A WPSessions demo/walk-through for using CMB2 to power your project's fields. This repo is to demonstrate how to get up and running with CMB2 and will be used for my [WPSessions session](http://wpsessions.com/sessions/custom-meta-and-settings-with-cmb2/). 5 | 6 | To follow demonstration, [check out the tags](https://github.com/jtsternberg/CMB2-WPSessions-Demo/releases) in order. 7 | -------------------------------------------------------------------------------- /mu-plugins/cmb2-post-search-field/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by http://www.gitignore.io 2 | 3 | ### OSX ### 4 | .DS_Store 5 | .AppleDouble 6 | .LSOverride 7 | 8 | # Icon must end with two \r 9 | Icon 10 | 11 | 12 | # Thumbnails 13 | ._* 14 | 15 | # Files that might appear on external disk 16 | .Spotlight-V100 17 | .Trashes 18 | 19 | # Directories potentially created on remote AFP share 20 | .AppleDB 21 | .AppleDesktop 22 | Network Trash Folder 23 | Temporary Items 24 | .apdisk 25 | 26 | 27 | ### Node ### 28 | # Logs 29 | logs 30 | *.log 31 | 32 | # Runtime data 33 | pids 34 | *.pid 35 | *.seed 36 | 37 | # Directory for instrumented libs generated by jscoverage/JSCover 38 | lib-cov 39 | 40 | # Coverage directory used by tools like istanbul 41 | coverage 42 | 43 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 44 | .grunt 45 | 46 | # Compiled binary addons (http://nodejs.org/api/addons.html) 47 | build/Release 48 | 49 | # Dependency directory 50 | # Deployed apps should consider commenting this line out: 51 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 52 | node_modules 53 | 54 | # Sass Cache 55 | *.sass-cache 56 | 57 | dandelion.yml 58 | -------------------------------------------------------------------------------- /mu-plugins/cmb2-post-search-field/README.md: -------------------------------------------------------------------------------- 1 | CMB2 Post Search field 2 | ====================== 3 | 4 | Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs 5 | 6 | Adds a new field type, `post_search_text` that adds a quick post search dialog for saving post IDs to a text input. 7 | 8 | If you're looking for a more general way to attach posts (or other custom post types) with a drag and drop interface, you might consider [CMB2 Attached Posts Field](https://github.com/WebDevStudios/cmb2-attached-posts) instead. 9 | -------------------------------------------------------------------------------- /mu-plugins/cmb2-post-search-field/cmb2_post_search_field.php: -------------------------------------------------------------------------------- 1 | args( 'select_type' ); 14 | 15 | echo $field_type->input( array( 16 | 'data-posttype' => $field->args( 'post_type' ), 17 | 'data-selecttype' => 'radio' == $select_type ? 'radio' : 'checkbox', 18 | ) ); 19 | } 20 | add_action( 'cmb2_render_post_search_text', 'cmb2_post_search_render_field', 10, 5 ); 21 | 22 | function cmb2_post_search_render_js( $cmb_id, $object_id, $object_type, $cmb ) { 23 | static $rendered; 24 | 25 | if ( $rendered ) { 26 | return; 27 | } 28 | 29 | $fields = $cmb->prop( 'fields' ); 30 | 31 | if ( ! is_array( $fields ) ) { 32 | return; 33 | } 34 | 35 | $has_post_search_field = false; 36 | foreach ( $fields as $field ) { 37 | if ( 'post_search_text' == $field['type'] ) { 38 | $has_post_search_field = true; 39 | break; 40 | } 41 | } 42 | 43 | if ( ! $has_post_search_field ) { 44 | return; 45 | } 46 | 47 | // JS needed for modal 48 | // wp_enqueue_media(); 49 | wp_enqueue_script( 'jquery' ); 50 | wp_enqueue_script( 'wp-backbone' ); 51 | 52 | if ( ! is_admin() ) { 53 | // Will need custom styling! 54 | // @todo add styles for front-end 55 | require_once( ABSPATH . 'wp-admin/includes/template.php' ); 56 | add_action( 'wp_footer', 'find_posts_div' ); 57 | } 58 | 59 | // markup needed for modal 60 | add_action( 'admin_footer', 'find_posts_div' ); 61 | 62 | $error = __( 'An error has occurred. Please reload the page and try again.' ); 63 | $find = __( 'Find Posts or Pages' ); 64 | 65 | // @TODO this should really be in its own JS file. 66 | ?> 67 | 221 | set( 'post_type', esc_attr( $_POST['post_search_cpt'] ) ); 233 | } 234 | 235 | /** 236 | * Check to see if we have a post type set and, if so, add the 237 | * pre_get_posts action to set the queried post type 238 | */ 239 | function cmb2_post_search_wp_ajax_find_posts() { 240 | if ( 241 | defined( 'DOING_AJAX' ) 242 | && DOING_AJAX 243 | && isset( $_POST['cmb2_post_search'], $_POST['action'], $_POST['post_search_cpt'] ) 244 | && 'find_posts' == $_POST['action'] 245 | && ! empty( $_POST['post_search_cpt'] ) 246 | ) { 247 | add_action( 'pre_get_posts', 'cmb2_post_search_set_post_type' ); 248 | } 249 | } 250 | add_action( 'admin_init', 'cmb2_post_search_wp_ajax_find_posts' ); 251 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to CMB2 2 | 3 | Thank you for your interest in contributing back to CMB2. Please help us review your issues and/or merge your pull requests by following the below guidelines. 4 | 5 | #### NOTE: The issues section is for bug reports and feature requests only. 6 | _Support is not offered for this library, and the likelihood that the maintainers will respond is very low. If you need help, please use [stackoverflow](http://stackoverflow.com/search?q=cmb), or the [wordpress.org plugin forums](http://wordpress.org/support/plugin/cmb2)._ 7 | 8 | Before reporting a bug 9 | --- 10 | 1. Search [issues](https://github.com/WebDevStudios/CMB2/issues) to see if the issue has been previously reported. 11 | 2. Install the trunk version of CMB2 and test there. 12 | 13 | 14 | How to report a bug 15 | --- 16 | 1. Specify the version number for both WordPress and CMB2. 17 | 3. Describe the problem in detail. Explain what happened, and what you expected would happen. 18 | 4. Provide a small test-case and a link to a [gist](https://gist.github.com/) containing your entire metabox registration code. 19 | 5. If helpful, include a screenshot. Annotate the screenshot for clarity. 20 | 21 | 22 | How to contribute to CMB2 23 | --- 24 | All contributions welcome. If you would like to submit a pull request, please follow the steps below. 25 | 26 | 1. Make sure you have a GitHub account. 27 | 2. Fork the repository on GitHub. 28 | 3. **Check out the trunk version of CMB2.** If you submit to the master branch, the PR will be closed with a link back to this document. 29 | 4. **Verify your issue still exists in the trunk branch.** 30 | 5. Make changes to your clone of the repository. 31 | 1. Please follow the [WordPress code standards](https://make.wordpress.org/core/handbook/coding-standards). 32 | 2. If possible, and if applicable, please also add/update unit tests for your changes. 33 | 3. Please add documentation to any new functions, methods, actions and filters. 34 | 4. When committing, reference your issue (if present) and include a note about the fix. 35 | 6. [Submit a pull request](https://help.github.com/articles/creating-a-pull-request/). 36 | 37 | **Note:** You may gain more ground and avoid unecessary effort if you first open an issue with the proposed changes, but this step is not necessary. 38 | 39 | Additional Resources 40 | --- 41 | 42 | * [CMB2 Documentation Wiki](https://github.com/WebDevStudios/CMB2/wiki) 43 | * [CMB2 Snippet Library](https://github.com/WebDevStudios/CMB2-Snippet-Library) 44 | * [CMB2 API Documentation](http://cmb2.io/api/) 45 | * [General GitHub Documentation](http://help.github.com/) 46 | * [GitHub Pull Request documentation](http://help.github.com/send-pull-requests/) 47 | * [PHPUnit Tests Guide](http://phpunit.de/manual/current/en/writing-tests-for-phpunit.html) -------------------------------------------------------------------------------- /mu-plugins/cmb2/bootstrap.php: -------------------------------------------------------------------------------- 1 | prop( 'hookup' ) ) { 41 | $hookup = new CMB2_hookup( $cmb ); 42 | } 43 | } 44 | 45 | /** 46 | * Fires after CMB2 initiation process has been completed 47 | */ 48 | do_action( 'cmb2_after_init' ); 49 | 50 | // End. That's it, folks! // 51 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ico-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ico-delete.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/includes/CMB2_Ajax.php: -------------------------------------------------------------------------------- 1 | ' . __( 'Please Try Again', 'cmb2' ) . '
' ); 41 | } 42 | 43 | // Set width of embed 44 | $embed_width = isset( $_REQUEST['oembed_width'] ) && intval( $_REQUEST['oembed_width'] ) < 640 ? intval( $_REQUEST['oembed_width'] ) : '640'; 45 | 46 | // Set url 47 | $oembed_url = esc_url( $oembed_string ); 48 | 49 | // Set args 50 | $embed_args = array( 'width' => $embed_width ); 51 | 52 | $this->ajax_update = true; 53 | 54 | // Get embed code (or fallback link) 55 | $html = $this->get_oembed( array( 56 | 'url' => $oembed_url, 57 | 'object_id' => $_REQUEST['object_id'], 58 | 'object_type' => isset( $_REQUEST['object_type'] ) ? $_REQUEST['object_type'] : 'post', 59 | 'oembed_args' => $embed_args, 60 | 'field_id' => $_REQUEST['field_id'], 61 | ) ); 62 | 63 | wp_send_json_success( $html ); 64 | } 65 | 66 | /** 67 | * Retrieves oEmbed from url/object ID 68 | * @since 0.9.5 69 | * @param array $args Arguments for method 70 | * @return string html markup with embed or fallback 71 | */ 72 | public function get_oembed( $args ) { 73 | 74 | global $wp_embed; 75 | 76 | $oembed_url = esc_url( $args['url'] ); 77 | 78 | // Sanitize object_id 79 | $this->object_id = is_numeric( $args['object_id'] ) ? absint( $args['object_id'] ) : sanitize_text_field( $args['object_id'] ); 80 | 81 | $args = wp_parse_args( $args, array( 82 | 'object_type' => 'post', 83 | 'oembed_args' => $this->embed_args, 84 | 'field_id' => false, 85 | 'cache_key' => false, 86 | ) ); 87 | 88 | $this->embed_args =& $args; 89 | 90 | 91 | /** 92 | * Set the post_ID so oEmbed won't fail 93 | * wp-includes/class-wp-embed.php, WP_Embed::shortcode() 94 | */ 95 | $wp_embed->post_ID = $this->object_id; 96 | 97 | // Special scenario if NOT a post object 98 | if ( isset( $args['object_type'] ) && 'post' != $args['object_type'] ) { 99 | 100 | if ( 'options-page' == $args['object_type'] ) { 101 | 102 | // Bogus id to pass some numeric checks. Issue with a VERY large WP install? 103 | $wp_embed->post_ID = 1987645321; 104 | 105 | // Use our own cache key to correspond to this field (vs one cache key per url) 106 | $args['cache_key'] = $args['field_id'] . '_cache'; 107 | } 108 | 109 | // Ok, we need to hijack the oembed cache system 110 | $this->hijack = true; 111 | $this->object_type = $args['object_type']; 112 | 113 | // Gets ombed cache from our object's meta (vs postmeta) 114 | add_filter( 'get_post_metadata', array( $this, 'hijack_oembed_cache_get' ), 10, 3 ); 115 | 116 | // Sets ombed cache in our object's meta (vs postmeta) 117 | add_filter( 'update_post_metadata', array( $this, 'hijack_oembed_cache_set' ), 10, 4 ); 118 | 119 | } 120 | 121 | $embed_args = ''; 122 | 123 | foreach ( $args['oembed_args'] as $key => $val ) { 124 | $embed_args .= " $key=\"$val\""; 125 | } 126 | 127 | // Ping WordPress for an embed 128 | $check_embed = $wp_embed->run_shortcode( '[embed' . $embed_args . ']' . $oembed_url . '[/embed]' ); 129 | 130 | // Fallback that WordPress creates when no oEmbed was found 131 | $fallback = $wp_embed->maybe_make_link( $oembed_url ); 132 | 133 | // Send back our embed 134 | if ( $check_embed && $check_embed != $fallback ) { 135 | return ' '; 136 | } 137 | 138 | // Otherwise, send back error info that no oEmbeds were found 139 | return '' . sprintf( __( 'No oEmbed Results Found for %s. View more info at', 'cmb2' ), $fallback ) . ' codex.wordpress.org/Embeds.
'; 140 | 141 | } 142 | 143 | /** 144 | * Hijacks retrieving of cached oEmbed. 145 | * Returns cached data from relevant object metadata (vs postmeta) 146 | * 147 | * @since 0.9.5 148 | * @param boolean $check Whether to retrieve postmeta or override 149 | * @param int $object_id Object ID 150 | * @param string $meta_key Object metakey 151 | * @return mixed Object's oEmbed cached data 152 | */ 153 | public function hijack_oembed_cache_get( $check, $object_id, $meta_key ) { 154 | 155 | if ( ! $this->hijack || ( $this->object_id != $object_id && 1987645321 !== $object_id ) ) { 156 | return $check; 157 | } 158 | 159 | if ( $this->ajax_update ) { 160 | return false; 161 | } 162 | 163 | // Get cached data 164 | return ( 'options-page' === $this->object_type ) 165 | ? cmb2_options( $this->object_id )->get( $this->embed_args['cache_key'] ) 166 | : get_metadata( $this->object_type, $this->object_id, $meta_key, true ); 167 | 168 | } 169 | 170 | /** 171 | * Hijacks saving of cached oEmbed. 172 | * Saves cached data to relevant object metadata (vs postmeta) 173 | * 174 | * @since 0.9.5 175 | * @param boolean $check Whether to continue setting postmeta 176 | * @param int $object_id Object ID to get postmeta from 177 | * @param string $meta_key Postmeta's key 178 | * @param mixed $meta_value Value of the postmeta to be saved 179 | * @return boolean Whether to continue setting 180 | */ 181 | public function hijack_oembed_cache_set( $check, $object_id, $meta_key, $meta_value ) { 182 | 183 | if ( ! $this->hijack || ( $this->object_id != $object_id && 1987645321 !== $object_id ) ) { 184 | return $check; 185 | } 186 | 187 | $this->oembed_cache_set( $meta_key, $meta_value ); 188 | 189 | // Anything other than `null` to cancel saving to postmeta 190 | return true; 191 | } 192 | 193 | /** 194 | * Saves the cached oEmbed value to relevant object metadata (vs postmeta) 195 | * 196 | * @since 1.3.0 197 | * @param string $meta_key Postmeta's key 198 | * @param mixed $meta_value Value of the postmeta to be saved 199 | */ 200 | public function oembed_cache_set( $meta_key, $meta_value ) { 201 | 202 | // Cache the result to our metadata 203 | return ( 'options-page' !== $this->object_type ) 204 | ? update_metadata( $this->object_type, $this->object_id, $meta_key, $meta_value ) 205 | : cmb2_options( $this->object_id )->update( $this->embed_args['cache_key'], $meta_value, true ); 206 | } 207 | 208 | } 209 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/includes/CMB2_Boxes.php: -------------------------------------------------------------------------------- 1 | cmb_id ] = $cmb_instance; 27 | } 28 | 29 | /** 30 | * Remove a CMB2 instance object to the registry 31 | * @since 1.X.X 32 | * @param string $cmb_id A CMB2 instance id 33 | */ 34 | public static function remove( $cmb_id ) { 35 | if ( array_key_exists( $cmb_id, self::$cmb2_instances ) ) { 36 | unset( self::$cmb2_instances[ $cmb_id ] ); 37 | } 38 | } 39 | 40 | /** 41 | * Retrieve a CMB2 instance by cmb id 42 | * @since 1.X.X 43 | * @param string $cmb_id A CMB2 instance id 44 | * 45 | * @return mixed False or CMB2 object instance 46 | */ 47 | public static function get( $cmb_id ) { 48 | if ( empty( self::$cmb2_instances ) || empty( self::$cmb2_instances[ $cmb_id ] ) ) { 49 | return false; 50 | } 51 | 52 | return self::$cmb2_instances[ $cmb_id ]; 53 | } 54 | 55 | /** 56 | * Retrieve all CMB2 instances registered 57 | * @since 1.X.X 58 | * @return array Array of all registered metaboxes 59 | */ 60 | public static function get_all() { 61 | return self::$cmb2_instances; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/includes/CMB2_Options.php: -------------------------------------------------------------------------------- 1 | key = ! empty( $option_key ) ? $option_key : ''; 65 | } 66 | 67 | /** 68 | * Delete the option from the db 69 | * @since 2.0.0 70 | * @return bool Delete success or failure 71 | */ 72 | public function delete_option() { 73 | $deleted = $this->key ? delete_option( $this->key ) : true; 74 | $this->options = $deleted ? array() : $this->options; 75 | return $this->options; 76 | } 77 | 78 | /** 79 | * Removes an option from an option array 80 | * @since 1.0.1 81 | * @param string $field_id Option array field key 82 | * @return array Modified options 83 | */ 84 | public function remove( $field_id, $resave = false ) { 85 | 86 | $this->get_options(); 87 | 88 | if ( isset( $this->options[ $field_id ] ) ) { 89 | unset( $this->options[ $field_id ] ); 90 | } 91 | 92 | if ( $resave ) { 93 | $this->set(); 94 | } 95 | 96 | return $this->options; 97 | } 98 | 99 | /** 100 | * Retrieves an option from an option array 101 | * @since 1.0.1 102 | * @param string $field_id Option array field key 103 | * @param mixed $default Fallback value for the option 104 | * @return array Requested field or default 105 | */ 106 | public function get( $field_id, $default = false ) { 107 | $opts = $this->get_options(); 108 | 109 | if ( 'all' == $field_id ) { 110 | return $opts; 111 | } elseif ( array_key_exists( $field_id, $opts ) ) { 112 | return false !== $opts[ $field_id ] ? $opts[ $field_id ] : $default; 113 | } 114 | 115 | return $default; 116 | } 117 | 118 | /** 119 | * Updates Option data 120 | * @since 1.0.1 121 | * @param string $field_id Option array field key 122 | * @param mixed $value Value to update data with 123 | * @param bool $resave Whether to re-save the data 124 | * @param bool $single Whether data should not be an array 125 | * @return boolean Return status of update 126 | */ 127 | public function update( $field_id, $value = '', $resave = false, $single = true ) { 128 | $this->get_options(); 129 | 130 | if ( true !== $field_id ) { 131 | 132 | if ( ! $single ) { 133 | // If multiple, add to array 134 | $this->options[ $field_id ][] = $value; 135 | } else { 136 | $this->options[ $field_id ] = $value; 137 | } 138 | 139 | } 140 | 141 | if ( $resave || true === $field_id ) { 142 | return $this->set(); 143 | } 144 | 145 | return true; 146 | } 147 | 148 | /** 149 | * Saves the option array 150 | * Needs to be run after finished using remove/update_option 151 | * @uses apply_filters() Calls 'cmb2_override_option_save_{$this->key}' hook 152 | * to allow overwriting the option value to be stored. 153 | * 154 | * @since 1.0.1 155 | * @param array $options Optional options to override 156 | * @return bool Success/Failure 157 | */ 158 | public function set( $options = array() ) { 159 | $this->options = ! empty( $options ) || empty( $options ) && empty( $this->key ) 160 | ? $options 161 | : $this->options; 162 | 163 | if ( empty( $this->key ) ) { 164 | return false; 165 | } 166 | 167 | $test_save = apply_filters( "cmb2_override_option_save_{$this->key}", 'cmb2_no_override_option_save', $this->options, $this ); 168 | 169 | if ( 'cmb2_no_override_option_save' !== $test_save ) { 170 | return $test_save; 171 | } 172 | 173 | // If no override, update the option 174 | return update_option( $this->key, $this->options ); 175 | } 176 | 177 | /** 178 | * Retrieve option value based on name of option. 179 | * @uses apply_filters() Calls 'cmb2_override_option_get_{$this->key}' hook to allow 180 | * overwriting the option value to be retrieved. 181 | * 182 | * @since 1.0.1 183 | * @param mixed $default Optional. Default value to return if the option does not exist. 184 | * @return mixed Value set for the option. 185 | */ 186 | public function get_options( $default = null ) { 187 | if ( empty( $this->options ) && ! empty( $this->key ) ) { 188 | 189 | $test_get = apply_filters( "cmb2_override_option_get_{$this->key}", 'cmb2_no_override_option_get', $default, $this ); 190 | 191 | if ( 'cmb2_no_override_option_get' !== $test_get ) { 192 | $this->options = $test_get; 193 | } else { 194 | // If no override, get the option 195 | $this->options = get_option( $this->key, $default ); 196 | } 197 | } 198 | 199 | return (array) $this->options; 200 | } 201 | 202 | } 203 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/includes/CMB2_Show_Filters.php: -------------------------------------------------------------------------------- 1 | object_id() : @get_the_id(); 85 | 86 | if ( ! $object_id ) { 87 | return false; 88 | } 89 | 90 | // If current page id is in the included array, display the metabox 91 | return in_array( $object_id, (array) self::get_show_on_value( $meta_box_args ) ); 92 | } 93 | 94 | /** 95 | * Add metaboxes for an specific Page Template 96 | * @since 1.0.0 97 | * @param bool $display To display or not 98 | * @param array $meta_box_args Metabox config array 99 | * @return bool Whether to display this metabox on the current page. 100 | */ 101 | public static function check_page_template( $display, $meta_box_args, $cmb ) { 102 | 103 | $key = self::get_show_on_key( $meta_box_args ); 104 | if ( ! $key || 'page-template' !== $key ) { 105 | return $display; 106 | } 107 | 108 | $object_id = $cmb->object_id(); 109 | 110 | if ( ! $object_id || 'post' !== $cmb->object_type() ) { 111 | return false; 112 | } 113 | 114 | // Get current template 115 | $current_template = get_post_meta( $object_id, '_wp_page_template', true ); 116 | 117 | // See if there's a match 118 | if ( $current_template && in_array( $current_template, (array) self::get_show_on_value( $meta_box_args ) ) ) { 119 | return true; 120 | } 121 | 122 | return false; 123 | } 124 | 125 | /** 126 | * Only show options-page metaboxes on their options page (but only enforce on the admin side) 127 | * @since 1.0.0 128 | * @param bool $display To display or not 129 | * @param array $meta_box_args Metabox config array 130 | * @return bool Whether to display this metabox on the current page. 131 | */ 132 | public static function check_admin_page( $display, $meta_box_args ) { 133 | 134 | $key = self::get_show_on_key( $meta_box_args ); 135 | // check if this is a 'options-page' metabox 136 | if ( ! $key || 'options-page' !== $key ) { 137 | return $display; 138 | } 139 | 140 | // Enforce 'show_on' filter in the admin 141 | if ( is_admin() ) { 142 | 143 | // If there is no 'page' query var, our filter isn't applicable 144 | if ( ! isset( $_GET['page'] ) ) { 145 | return $display; 146 | } 147 | 148 | $show_on = self::get_show_on_value( $meta_box_args ); 149 | 150 | if ( empty( $show_on ) ) { 151 | return false; 152 | } 153 | 154 | if ( is_array( $show_on ) ) { 155 | foreach ( $show_on as $page ) { 156 | if ( $_GET['page'] == $page ) { 157 | return true; 158 | } 159 | } 160 | } else { 161 | if ( $_GET['page'] == $show_on ) { 162 | return true; 163 | } 164 | } 165 | 166 | return false; 167 | 168 | } 169 | 170 | // Allow options-page metaboxes to be displayed anywhere on the front-end 171 | return true; 172 | } 173 | 174 | } 175 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/includes/CMB2_Utils.php: -------------------------------------------------------------------------------- 1 | get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid LIKE '%%%s%%' LIMIT 1;", $img_url ) ); 40 | 41 | // If we found an attachement ID, return it 42 | if ( ! empty( $attachment ) && is_array( $attachment ) ) { 43 | return $attachment[0]; 44 | } 45 | 46 | // No luck 47 | return false; 48 | } 49 | 50 | /** 51 | * Utility method that returns time string offset by timezone 52 | * @since 1.0.0 53 | * @param string $tzstring Time string 54 | * @return string Offset time string 55 | */ 56 | public function timezone_offset( $tzstring ) { 57 | if ( ! empty( $tzstring ) && is_string( $tzstring ) ) { 58 | if ( 'UTC' === substr( $tzstring, 0, 3 ) ) { 59 | $tzstring = str_replace( array( ':15', ':30', ':45' ), array( '.25', '.5', '.75' ), $tzstring ); 60 | return intval( floatval( substr( $tzstring, 3 ) ) * HOUR_IN_SECONDS ); 61 | } 62 | 63 | $date_time_zone_selected = new DateTimeZone( $tzstring ); 64 | $tz_offset = timezone_offset_get( $date_time_zone_selected, date_create() ); 65 | 66 | return $tz_offset; 67 | } 68 | 69 | return 0; 70 | } 71 | 72 | /** 73 | * Utility method that returns a timezone string representing the default timezone for the site. 74 | * 75 | * Roughly copied from WordPress, as get_option('timezone_string') will return 76 | * an empty string if no value has been set on the options page. 77 | * A timezone string is required by the wp_timezone_choice() used by the 78 | * select_timezone field. 79 | * 80 | * @since 1.0.0 81 | * @return string Timezone string 82 | */ 83 | public function timezone_string() { 84 | $current_offset = get_option( 'gmt_offset' ); 85 | $tzstring = get_option( 'timezone_string' ); 86 | 87 | if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists 88 | if ( 0 == $current_offset ) { 89 | $tzstring = 'UTC+0'; 90 | } elseif ( $current_offset < 0 ) { 91 | $tzstring = 'UTC' . $current_offset; 92 | } else { 93 | $tzstring = 'UTC+' . $current_offset; 94 | } 95 | } 96 | 97 | return $tzstring; 98 | } 99 | 100 | /** 101 | * Returns a timestamp, first checking if value already is a timestamp. 102 | * @since 2.0.0 103 | * @param string|int $string Possible timestamp string 104 | * @return int Time stamp 105 | */ 106 | public function make_valid_time_stamp( $string ) { 107 | if ( ! $string ) { 108 | return 0; 109 | } 110 | 111 | return $this->is_valid_time_stamp( $string ) 112 | ? (int) $string : 113 | strtotime( $string ); 114 | } 115 | 116 | /** 117 | * Determine if a value is a valid timestamp 118 | * @since 2.0.0 119 | * @param mixed $timestamp Value to check 120 | * @return boolean Whether value is a valid timestamp 121 | */ 122 | public function is_valid_time_stamp( $timestamp ) { 123 | return (string) (int) $timestamp === (string) $timestamp 124 | && $timestamp <= PHP_INT_MAX 125 | && $timestamp >= ~PHP_INT_MAX; 126 | } 127 | 128 | /** 129 | * Checks if a value is 'empty'. Still accepts 0. 130 | * @since 2.0.0 131 | * @param mixed $value Value to check 132 | * @return bool True or false 133 | */ 134 | public function isempty( $value ) { 135 | return null === $value || '' === $value || false === $value; 136 | } 137 | 138 | /** 139 | * Insert a single array item inside another array at a set position 140 | * @since 2.0.2 141 | * @param array &$array Array to modify. Is passed by reference, and no return is needed. 142 | * @param array $new New array to insert 143 | * @param int $position Position in the main array to insert the new array 144 | */ 145 | public function array_insert( &$array, $new, $position ) { 146 | $before = array_slice( $array, 0, $position - 1 ); 147 | $after = array_diff_key( $array, $before ); 148 | $array = array_merge( $before, $new, $after ); 149 | } 150 | 151 | /** 152 | * Defines the url which is used to load local resources. 153 | * This may need to be filtered for local Window installations. 154 | * If resources do not load, please check the wiki for details. 155 | * @since 1.0.1 156 | * @return string URL to CMB2 resources 157 | */ 158 | public function url( $path = '' ) { 159 | if ( $this->url ) { 160 | return $this->url . $path; 161 | } 162 | 163 | if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) { 164 | // Windows 165 | $content_dir = str_replace( '/', DIRECTORY_SEPARATOR, WP_CONTENT_DIR ); 166 | $content_url = str_replace( $content_dir, WP_CONTENT_URL, cmb2_dir() ); 167 | $cmb2_url = str_replace( DIRECTORY_SEPARATOR, '/', $content_url ); 168 | 169 | } else { 170 | $cmb2_url = str_replace( 171 | array( WP_CONTENT_DIR, WP_PLUGIN_DIR ), 172 | array( WP_CONTENT_URL, WP_PLUGIN_URL ), 173 | cmb2_dir() 174 | ); 175 | } 176 | 177 | /** 178 | * Filter the CMB location url 179 | * 180 | * @param string $cmb2_url Currently registered url 181 | */ 182 | $this->url = trailingslashit( apply_filters( 'cmb2_meta_box_url', set_url_scheme( $cmb2_url ), CMB2_VERSION ) ); 183 | 184 | return $this->url . $path; 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/init.php: -------------------------------------------------------------------------------- 1 | l10ni18n(); 142 | 143 | // Include helper functions 144 | require_once 'includes/helper-functions.php'; 145 | 146 | // Now kick off the class autoloader 147 | spl_autoload_register( 'cmb2_autoload_classes' ); 148 | 149 | // Kick the whole thing off 150 | require_once 'bootstrap.php'; 151 | } 152 | 153 | /** 154 | * Registers CMB2 text domain path 155 | * @since 2.0.0 156 | */ 157 | public function l10ni18n() { 158 | $loaded = load_plugin_textdomain( 'cmb2', false, '/languages/' ); 159 | if ( ! $loaded ) { 160 | $loaded = load_muplugin_textdomain( 'cmb2', '/languages/' ); 161 | } 162 | if ( ! $loaded ) { 163 | $loaded = load_theme_textdomain( 'cmb2', '/languages/' ); 164 | } 165 | 166 | if ( ! $loaded ) { 167 | $locale = apply_filters( 'plugin_locale', get_locale(), 'cmb2' ); 168 | $mofile = dirname( __FILE__ ) . '/languages/cmb2-' . $locale . '.mo'; 169 | load_textdomain( 'cmb2', $mofile ); 170 | } 171 | } 172 | 173 | } 174 | 175 | // Make it so... 176 | CMB2_Bootstrap_206::initiate(); 177 | 178 | } 179 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-en_US.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-en_US.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-es_ES.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-es_ES.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-es_MX.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-es_MX.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-fi.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-fi.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-fr_FR.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-id_ID.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-id_ID.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-pl_PL.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-pl_PL.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-pt_BR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-pt_BR.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-ru_RU.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-ru_RU.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-sv_SE.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-sv_SE.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2.mo -------------------------------------------------------------------------------- /mu-plugins/include-cmb-for-project.php: -------------------------------------------------------------------------------- 1 | x' ) 32 | .attr( 'commentid', thisCommentId[1] ) 33 | .attr( 'title', WPAkismet.strings['Remove this URL'] ) 34 | ); 35 | } 36 | }); 37 | $('.remove_url').live('click', function () { 38 | var thisId = $(this).attr('commentid'); 39 | var data = { 40 | action: 'comment_author_deurl', 41 | _wpnonce: WPAkismet.comment_author_url_nonce, 42 | id: thisId 43 | }; 44 | $.ajax({ 45 | url: ajaxurl, 46 | type: 'POST', 47 | data: data, 48 | beforeSend: function () { 49 | // Removes "x" link 50 | $("a[commentid='"+ thisId +"']").hide(); 51 | // Show temp status 52 | $("#author_comment_url_"+ thisId).html( $( '' ).text( WPAkismet.strings['Removing...'] ) ); 53 | }, 54 | success: function (response) { 55 | if (response) { 56 | // Show status/undo link 57 | $("#author_comment_url_"+ thisId) 58 | .attr('cid', thisId) 59 | .addClass('akismet_undo_link_removal') 60 | .html( 61 | $( '' ).text( WPAkismet.strings['URL removed'] ) 62 | ) 63 | .append( ' ' ) 64 | .append( 65 | $( '' ) 66 | .text( WPAkismet.strings['(undo)'] ) 67 | .addClass( 'akismet-span-link' ) 68 | ); 69 | } 70 | } 71 | }); 72 | 73 | return false; 74 | }); 75 | $('.akismet_undo_link_removal').live('click', function () { 76 | var thisId = $(this).attr('cid'); 77 | var thisUrl = $(this).attr('href'); 78 | var data = { 79 | action: 'comment_author_reurl', 80 | _wpnonce: WPAkismet.comment_author_url_nonce, 81 | id: thisId, 82 | url: thisUrl 83 | }; 84 | $.ajax({ 85 | url: ajaxurl, 86 | type: 'POST', 87 | data: data, 88 | beforeSend: function () { 89 | // Show temp status 90 | $("#author_comment_url_"+ thisId).html( $( '' ).text( WPAkismet.strings['Re-adding...'] ) ); 91 | }, 92 | success: function (response) { 93 | if (response) { 94 | // Add "x" link 95 | $("a[commentid='"+ thisId +"']").show(); 96 | // Show link. Core strips leading http://, so let's do that too. 97 | $("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').text( thisUrl.replace( /^http:\/\/(www\.)?/ig, '' ) ); 98 | } 99 | } 100 | }); 101 | 102 | return false; 103 | }); 104 | $('a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type').mouseover(function () { 105 | var wpcomProtocol = ( 'https:' === location.protocol ) ? 'https://' : 'http://'; 106 | // Need to determine size of author column 107 | var thisParentWidth = $(this).parent().width(); 108 | // It changes based on if there is a gravatar present 109 | thisParentWidth = ($(this).parent().find('.grav-hijack').length) ? thisParentWidth - 42 + 'px' : thisParentWidth + 'px'; 110 | if ($(this).find('.mShot').length == 0 && !$(this).hasClass('akismet_undo_link_removal')) { 111 | var self = $( this ); 112 | $('.widefat td').css('overflow', 'visible'); 113 | $(this).css('position', 'relative'); 114 | var thisHref = $.URLEncode( $(this).attr('href') ); 115 | $(this).append('74 | 75 | 76 |
77 | 78 | 96 | 97 | 100 | 101 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /plugins/akismet/views/start.php: -------------------------------------------------------------------------------- 1 |'. __( 'Genres: ', 'wpsessions' ), ', ', '
' ); 39 | 40 | return $content; 41 | } 42 | 43 | /** 44 | * Get book meta to be output at the end of the content field 45 | */ 46 | function bookscpt_post_content_meta( $post_id ) { 47 | 48 | $content = ''; 49 | 50 | if ( $submitter_name = get_post_meta( $post_id, '_bookcpt_submitter', 1 ) ) { 51 | 52 | $submitter_name = esc_html( $submitter_name ); 53 | 54 | if ( $submitter_url = get_post_meta( $post_id, '_bookcpt_submitter_url', 1 ) ) { 55 | $submitter_name = sprintf( '%s', esc_url( $submitter_url ), $submitter_name ); 56 | } 57 | 58 | $submitter_name = sprintf( _x( 'Submitted by: %s', 'book byline', 'wpsessions' ), $submitter_name ); 59 | 60 | $content .= sprintf( '%s
', $submitter_name ); 61 | } 62 | 63 | return $content; 64 | } 65 | 66 | /** 67 | * Replace prev nav with related links 68 | */ 69 | function bookscpt_maybe_filter_previous_post_link( $html ) { 70 | 71 | if ( is_singular( 'book' ) ) { 72 | 73 | $html = ''; 74 | 75 | if ( $related_ids = get_post_meta( get_the_ID(), '_bookcpt_related', 1 ) ) { 76 | 77 | $related_ids = array_map( 'trim', explode( ',', $related_ids ) ); 78 | 79 | foreach ( (array) $related_ids as $related_id ) { 80 | $html .= sprintf( 81 | '